X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fplugins%2Fpppoe%2Fplugin.c;h=c53450752b7c481fda436891622ebdac2cdc9c6b;hb=HEAD;hp=c7ace96f18a43112699e5644aac65a760c799f9e;hpb=a20059a09c56555f6c2006a7193de4c1676b477a;p=ppp.git diff --git a/pppd/plugins/pppoe/plugin.c b/pppd/plugins/pppoe/plugin.c index c7ace96..b429a2f 100644 --- a/pppd/plugins/pppoe/plugin.c +++ b/pppd/plugins/pppoe/plugin.c @@ -22,9 +22,6 @@ * ***********************************************************************/ -static char const RCSID[] = -"$Id: plugin.c,v 1.17 2008/06/15 04:35:50 paulus Exp $"; - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -128,8 +125,6 @@ PPPOEInitDevice(void) conn->ifName = devnam; conn->discoverySocket = -1; conn->sessionSocket = -1; - conn->discoveryTimeout = pppoe_padi_timeout; - conn->discoveryAttempts = pppoe_padi_attempts; return 1; } @@ -217,7 +212,7 @@ PPPOEConnectDevice(void) error("Failed to create PPPoE discovery socket: %m"); goto errout; } - discovery1(conn); + discovery1(conn, 0); /* discovery1() may update conn->mtu and conn->mru */ lcp_allowoptions[0].mru = conn->mtu; lcp_wantoptions[0].mru = conn->mru; @@ -256,6 +251,8 @@ PPPOEConnectDevice(void) ppp_set_remote_number(remote_number); ppp_script_setenv("MACREMOTE", remote_number, 0); + if (conn->actualACname) + ppp_script_setenv("ACNAME", conn->actualACname, 0); if (connect(conn->sessionSocket, (struct sockaddr *) &sp, sizeof(struct sockaddr_pppox)) < 0) { @@ -310,10 +307,15 @@ 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); } + free(conn->actualACname); + conn->actualACname = NULL; } static void @@ -468,6 +470,9 @@ void pppoe_check_options(void) ccp_allowoptions[0].bsd_compress = 0; ccp_wantoptions[0].bsd_compress = 0; + + conn->discoveryTimeout = pppoe_padi_timeout; + conn->discoveryAttempts = pppoe_padi_attempts; } struct channel pppoe_channel = {