X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fauth.c;h=727c69d4af8d92bf55924d95eef3edf1c3070b17;hp=67f12782584c279b21fc705f05e3fbac0393db50;hb=7bb8beb860037a6c18dd0b64b8d542a20aa2c8c0;hpb=85fb3a1ac84c4bc9bf1b66d00ab0a09def5c38db diff --git a/pppd/auth.c b/pppd/auth.c index 67f1278..727c69d 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -32,7 +32,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#define RCSID "$Id: auth.c,v 1.76 2002/04/02 13:54:59 dfs Exp $" +#define RCSID "$Id: auth.c,v 1.77 2002/05/21 17:26:49 dfs Exp $" #include #include @@ -69,6 +69,8 @@ #include "pppd.h" #include "fsm.h" #include "lcp.h" +#include "ccp.h" +#include "ecp.h" #include "ipcp.h" #include "upap.h" #include "chap.h" @@ -595,42 +597,66 @@ network_phase(unit) free_wordlist(extra_options); extra_options = 0; } - start_networks(); + start_networks(unit); } void -start_networks() +start_networks(unit) + int unit; { + static int started = 0; int i; struct protent *protp; + int ecp_required, mppe_required; - new_phase(PHASE_NETWORK); + if (!started) { + started = 1; + new_phase(PHASE_NETWORK); #ifdef HAVE_MULTILINK - if (multilink) { - if (mp_join_bundle()) { - if (updetach && !nodetach) - detach(); - return; + if (multilink) { + if (mp_join_bundle()) { + if (updetach && !nodetach) + detach(); + return; + } } - } #endif /* HAVE_MULTILINK */ #ifdef PPP_FILTER - if (!demand) - set_filters(&pass_filter, &active_filter); + if (!demand) + set_filters(&pass_filter, &active_filter); #endif - for (i = 0; (protp = protocols[i]) != NULL; ++i) - if (protp->protocol < 0xC000 && protp->enabled_flag - && protp->open != NULL) { - (*protp->open)(0); - if (protp->protocol != PPP_CCP) + /* Start CCP and ECP */ + for (i = 0; (protp = protocols[i]) != NULL; ++i) + if ((protp->protocol == PPP_ECP || protp->protocol == PPP_CCP) + && protp->enabled_flag && protp->open != NULL) + (*protp->open)(0); + } + + /* + * Bring up other network protocols after encryption has completed. + * OPENED here merely means that negotiation has completed. It is + * up to the protocol to correctly terminate or disable LCP/NCP + * based on the result of the negotiation. + */ + ecp_required = ecp_gotoptions[unit].required; + mppe_required = ccp_gotoptions[unit].mppe; + if ((!ecp_required && !mppe_required) + || (ecp_required && ecp_fsm[unit].state == OPENED) + || (mppe_required && ccp_fsm[unit].state == OPENED)) { + for (i = 0; (protp = protocols[i]) != NULL; ++i) + if (protp->protocol < 0xC000 + && protp->protocol != PPP_CCP && protp->protocol != PPP_ECP + && protp->enabled_flag && protp->open != NULL) { + (*protp->open)(0); ++num_np_open; - } + } - if (num_np_open == 0) - /* nothing to do */ - lcp_close(0, "No network protocols running"); + if (num_np_open == 0) + /* nothing to do */ + lcp_close(0, "No network protocols running"); + } } /*