X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fplugins%2Frp-pppoe%2Fdiscovery.c;h=23089df550771f2a795c1e54b8d197b6bdc5e492;hb=0f9bd9807d92d624782fa3bc3d2abfb305edf7ee;hp=a4e4cec93ce1c21ebd8841813b6ee33cdc67d13f;hpb=b1fcf16fa66159f380ee4abd7c9a76b59809dc7b;p=ppp.git diff --git a/pppd/plugins/rp-pppoe/discovery.c b/pppd/plugins/rp-pppoe/discovery.c index a4e4cec..23089df 100644 --- a/pppd/plugins/rp-pppoe/discovery.c +++ b/pppd/plugins/rp-pppoe/discovery.c @@ -369,7 +369,7 @@ waitForPADO(PPPoEConnection *conn, int timeout) while(1) { r = select(conn->discoverySocket+1, &readable, NULL, NULL, &tv); - if (r >= 0 || errno != EINTR) break; + if (r >= 0 || errno != EINTR || got_sigterm) break; } if (r < 0) { error("select (waitForPADO): %m"); @@ -550,7 +550,7 @@ waitForPADS(PPPoEConnection *conn, int timeout) while(1) { r = select(conn->discoverySocket+1, &readable, NULL, NULL, &tv); - if (r >= 0 || errno != EINTR) break; + if (r >= 0 || errno != EINTR || got_sigterm) break; } if (r < 0) { error("select (waitForPADS): %m"); @@ -622,7 +622,7 @@ discovery(PPPoEConnection *conn) do { padiAttempts++; - if (padiAttempts > conn->discoveryAttempts) { + if (got_sigterm || padiAttempts > conn->discoveryAttempts) { warn("Timeout waiting for PADO packets"); close(conn->discoverySocket); conn->discoverySocket = -1; @@ -638,7 +638,7 @@ discovery(PPPoEConnection *conn) timeout = conn->discoveryTimeout; do { padrAttempts++; - if (padrAttempts > conn->discoveryAttempts) { + if (got_sigterm || padrAttempts > conn->discoveryAttempts) { warn("Timeout waiting for PADS packets"); close(conn->discoverySocket); conn->discoverySocket = -1; @@ -659,6 +659,8 @@ discovery(PPPoEConnection *conn) } /* We're done. */ + close(conn->discoverySocket); + conn->discoverySocket = -1; conn->discoveryState = STATE_SESSION; return; }