Skip to content

Commit

Permalink
pppoe: Fix sending of PADT on connection termination
Browse files Browse the repository at this point in the history
Commit 2b4166d ("Close discovery socket after session completed",
2020-11-26) arranged for the discovery socket to be closed when the
PPPOE session negotiation was complete.  However, the discovery socket
is used for sending a PADT message when the connection terminates, and
now that doesn't work because the socket has been closed.

To fix this, we reopen the discovery socket in order to send the PADT
message.

Signed-off-by: Paul Mackerras <[email protected]>
  • Loading branch information
paulusmack committed Jan 2, 2024
1 parent fafbfdf commit 2d4ca31
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pppd/plugins/pppoe/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ PPPOEDisconnectDevice(void)
sizeof(struct sockaddr_pppox)) < 0 && errno != EALREADY)
error("Failed to disconnect PPPoE socket: %d %m", errno);
close(conn->sessionSocket);
if (conn->discoverySocket < 0)
conn->discoverySocket =
openInterface(conn->ifName, Eth_PPPOE_Discovery, NULL);
if (conn->discoverySocket >= 0) {
sendPADT(conn, NULL);
close(conn->discoverySocket);
Expand Down

0 comments on commit 2d4ca31

Please sign in to comment.