/* * auth_script_done - called when the auth-up or auth-down script * has finished. */ static void auth_script_done(void *arg) { auth_script_pid = 0; switch (auth_script_state) { case s_up: if (auth_state == s_down) { auth_script_state = s_down; auth_script(_PATH_AUTHDOWN); } break; case s_down: if (auth_state == s_up) { auth_script_state = s_up; auth_script(_PATH_AUTHUP); } break; } }
/* * Proceed to the network phase. */ static void network_phase(int unit) { int i; struct protent *protp; lcp_options *go = &lcp_gotoptions[unit]; /* * If the peer had to authenticate, run the auth-up script now. */ if ((go->neg_chap || go->neg_upap) && !did_authup) { auth_script(_PATH_AUTHUP); did_authup = 1; } #ifdef CBCP_SUPPORT /* * If we negotiated callback, do it now. */ if (go->neg_cbcp) { phase = PHASE_CALLBACK; (*cbcp_protent.open)(unit); return; } #endif phase = PHASE_NETWORK; #if 0 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)(unit); if (protp->protocol != PPP_CCP) ++num_np_open; } if (num_np_open == 0) /* nothing to do */ lcp_close(0, "No network protocols running"); }
/* * LCP has gone down; it will either die or try to re-establish. */ void link_down(int unit) { int i; struct protent *protp; if (did_authup) { auth_script(_PATH_AUTHDOWN); did_authup = 0; } for (i = 0; (protp = protocols[i]) != NULL; ++i) { if (!protp->enabled_flag) continue; if (protp->protocol != PPP_LCP && protp->lowerdown != NULL) (*protp->lowerdown)(unit); if (protp->protocol < 0xC000 && protp->close != NULL) (*protp->close)(unit, "LCP down"); } num_np_open = 0; num_np_up = 0; if (phase != PHASE_DEAD) phase = PHASE_TERMINATE; }