X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fplugins%2Fpppoe%2Fdiscovery.c;h=b32b0c891dcd89c5fb46ebe402adc698f9a0611f;hb=HEAD;hp=a5c2c62fdc383738edf8d5edb65101a6cc5b3b98;hpb=607d8eadccfd62c1fa84a36bd1440bd48b4e55ca;p=ppp.git diff --git a/pppd/plugins/pppoe/discovery.c b/pppd/plugins/pppoe/discovery.c index a5c2c62..ccb88b2 100644 --- a/pppd/plugins/pppoe/discovery.c +++ b/pppd/plugins/pppoe/discovery.c @@ -44,6 +44,15 @@ static char const RCSID[] = #include +#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;