]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/pppoe/discovery.c
Header file reorganization and cleaning up the public API for pppd version 2.5.0...
[ppp.git] / pppd / plugins / pppoe / discovery.c
index a5c2c62fdc383738edf8d5edb65101a6cc5b3b98..ccb88b2d6bf576e775758add1ec8af397393cb1d 100644 (file)
@@ -44,6 +44,15 @@ static char const RCSID[] =
 
 #include <signal.h>
 
+#ifdef PLUGIN
+#define signaled(x) ppp_signaled(x)
+#define get_time(x) ppp_get_time(x)
+#else
+int signaled(int signal);
+int get_time(struct timeval *tv);
+
+#endif
+
 /* Calculate time remaining until *exp, return 0 if now >= *exp */
 static int time_left(struct timeval *diff, struct timeval *exp)
 {
@@ -404,7 +413,7 @@ waitForPADO(PPPoEConnection *conn, int timeout)
 
            while(1) {
                r = select(conn->discoverySocket+1, &readable, NULL, NULL, &tv);
-               if (r >= 0 || errno != EINTR || got_sigterm) break;
+               if (r >= 0 || errno != EINTR || signaled(SIGTERM)) break;
            }
            if (r < 0) {
                error("select (waitForPADO): %m");
@@ -595,7 +604,7 @@ waitForPADS(PPPoEConnection *conn, int timeout)
 
            while(1) {
                r = select(conn->discoverySocket+1, &readable, NULL, NULL, &tv);
-               if (r >= 0 || errno != EINTR || got_sigterm) break;
+               if (r >= 0 || errno != EINTR || signaled(SIGTERM)) break;
            }
            if (r < 0) {
                error("select (waitForPADS): %m");
@@ -666,7 +675,7 @@ discovery1(PPPoEConnection *conn)
 
     do {
        padiAttempts++;
-       if (got_sigterm || padiAttempts > conn->discoveryAttempts) {
+       if (signaled(SIGTERM) || padiAttempts > conn->discoveryAttempts) {
            warn("Timeout waiting for PADO packets");
            close(conn->discoverySocket);
            conn->discoverySocket = -1;
@@ -697,7 +706,7 @@ discovery2(PPPoEConnection *conn)
 
     do {
        padrAttempts++;
-       if (got_sigterm || padrAttempts > conn->discoveryAttempts) {
+       if (signaled(SIGTERM) || padrAttempts > conn->discoveryAttempts) {
            warn("Timeout waiting for PADS packets");
            close(conn->discoverySocket);
            conn->discoverySocket = -1;