/* * parse the packet */ void ppp_chap_process_packet(struct ppp_chap *chap, const guint8 *new_packet, gsize len) { guint8 code; if (len < sizeof(struct chap_header)) return; code = new_packet[0]; switch (code) { case CHALLENGE: chap_process_challenge(chap, new_packet); break; case RESPONSE: break; case SUCCESS: ppp_auth_notify(chap->ppp, TRUE); break; case FAILURE: ppp_auth_notify(chap->ppp, FALSE); break; default: break; } }
void ppp_lcp_up_notify(GAtPPP *ppp) { /* Wait for the peer to send us a challenge if we expect auth */ if (ppp->chap != NULL) { ppp_enter_phase(ppp, PPP_PHASE_AUTHENTICATION); return; } /* Otherwise proceed as if auth succeeded */ ppp_auth_notify(ppp, TRUE); }