]> git.ozlabs.org Git - ppp.git/commitdiff
Suppress false error message on PPPoE disconnect
authorSimon Farnsworth <simon@farnz.org.uk>
Sun, 1 Mar 2015 11:49:06 +0000 (11:49 +0000)
committerSimon Farnsworth <simon@farnz.org.uk>
Sun, 1 Mar 2015 11:49:06 +0000 (11:49 +0000)
Once the kernel handles PPPoE PADTs correctly[1], a PADT triggered
disconnect will result in EALREADY when pppd tries to clear the session ID.

Simply ignore the error if, and only if, the error is EALREADY

[1] https://patchwork.ozlabs.org/patch/444717/

Signed-off-by: Simon Farnsworth <simon@farnz.org.uk>
pppd/plugins/rp-pppoe/plugin.c

index a8c2bb4f4a6aec1cb76f30ebfa5403f852cc092f..da50cdf2b9d3956a90a61e9209a2249a7ca61faa 100644 (file)
@@ -270,7 +270,7 @@ PPPOEDisconnectDevice(void)
     memcpy(sp.sa_addr.pppoe.dev, conn->ifName, IFNAMSIZ);
     memcpy(sp.sa_addr.pppoe.remote, conn->peerEth, ETH_ALEN);
     if (connect(conn->sessionSocket, (struct sockaddr *) &sp,
-               sizeof(struct sockaddr_pppox)) < 0)
+               sizeof(struct sockaddr_pppox)) < 0 && errno != EALREADY)
        error("Failed to disconnect PPPoE socket: %d %m", errno);
     close(conn->sessionSocket);
     /* don't send PADT?? */