/* This function is called when carrier is lost on the PPP channel. */ void pppSigHUP(int pd) { PPPControl *pc = &pppControl[pd]; pc->sig_hup = 1; pppMainWakeup(pd); }
/* * LCP has terminated the link; go to the Dead phase and take the * physical layer down. */ void link_terminated(int unit) { AUTHDEBUG((LOG_INFO, "link_terminated: %d\n", unit)); if (lcp_phase[unit] == PHASE_DEAD) return; if (logged_in) logout(); lcp_phase[unit] = PHASE_DEAD; ppp_trace(LOG_NOTICE, "Connection terminated.\n"); pppMainWakeup(unit); }
/* Close a PPP connection and release the descriptor. * Any outstanding packets in the queues are dropped. * Return 0 on success, an error code on failure. */ int pppClose(int pd) { PPPControl *pc = &pppControl[pd]; int st = 0; /* Disconnect */ pc->kill_link = !0; pppMainWakeup(pd); if(!pc->linkStatusCB) { while(st >= 0 && lcp_phase[pd] != PHASE_DEAD) { sys_msleep(500); break; } } return st; }
/* * LCP has gone down; it will either die or try to re-establish. */ void link_down(int unit) { int i; struct protent *protp; AUTHDEBUG((LOG_INFO, "link_down: %d\n", unit)); if (did_authup) { /* XXX Do link down processing. */ did_authup = 0; } for (i = 0; (protp = ppp_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 (lcp_phase[unit] != PHASE_DEAD) lcp_phase[unit] = PHASE_TERMINATE; pppMainWakeup(unit); }