clarified a bit more ppp.[ch]

This commit is contained in:
Sylvain Rochet 2012-06-03 01:46:46 +02:00
parent b5b075eb04
commit 9c35403b98
7 changed files with 477 additions and 475 deletions

View File

@ -276,7 +276,7 @@ chap_timeout(void *arg)
return; return;
} }
ppp_output(0, ss->challenge, ss->challenge_pktlen); ppp_write(0, ss->challenge, ss->challenge_pktlen);
++ss->challenge_xmits; ++ss->challenge_xmits;
ss->flags |= TIMEOUT_PENDING; ss->flags |= TIMEOUT_PENDING;
TIMEOUT(chap_timeout, arg, chap_timeout_time); TIMEOUT(chap_timeout, arg, chap_timeout_time);
@ -377,7 +377,7 @@ chap_handle_response(struct chap_server_state *ss, int id,
p[3] = len; p[3] = len;
if (mlen > 0) if (mlen > 0)
memcpy(p + CHAP_HDRLEN, ss->message, mlen); memcpy(p + CHAP_HDRLEN, ss->message, mlen);
ppp_output(0, outpacket_buf, PPP_HDRLEN + len); ppp_write(0, outpacket_buf, PPP_HDRLEN + len);
if (ss->flags & CHALLENGE_VALID) { if (ss->flags & CHALLENGE_VALID) {
ss->flags &= ~CHALLENGE_VALID; ss->flags &= ~CHALLENGE_VALID;
@ -499,7 +499,7 @@ chap_respond(struct chap_client_state *cs, int id,
p[2] = len >> 8; p[2] = len >> 8;
p[3] = len; p[3] = len;
ppp_output(0, response, PPP_HDRLEN + len); ppp_write(0, response, PPP_HDRLEN + len);
} }
static void static void

View File

@ -274,7 +274,7 @@ eap_state *esp;
PUTCHAR(esp->es_server.ea_id, outp); PUTCHAR(esp->es_server.ea_id, outp);
PUTSHORT(EAP_HEADERLEN, outp); PUTSHORT(EAP_HEADERLEN, outp);
ppp_output(esp->es_unit, outpacket_buf, EAP_HEADERLEN + PPP_HDRLEN); ppp_write(esp->es_unit, outpacket_buf, EAP_HEADERLEN + PPP_HDRLEN);
esp->es_server.ea_state = eapBadAuth; esp->es_server.ea_state = eapBadAuth;
auth_peer_fail(esp->es_unit, PPP_EAP); auth_peer_fail(esp->es_unit, PPP_EAP);
@ -299,7 +299,7 @@ eap_state *esp;
PUTCHAR(esp->es_server.ea_id, outp); PUTCHAR(esp->es_server.ea_id, outp);
PUTSHORT(EAP_HEADERLEN, outp); PUTSHORT(EAP_HEADERLEN, outp);
ppp_output(esp->es_unit, outpacket_buf, PPP_HDRLEN + EAP_HEADERLEN); ppp_write(esp->es_unit, outpacket_buf, PPP_HDRLEN + EAP_HEADERLEN);
auth_peer_success(esp->es_unit, PPP_EAP, 0, auth_peer_success(esp->es_unit, PPP_EAP, 0,
esp->es_server.ea_peer, esp->es_server.ea_peerlen); esp->es_server.ea_peer, esp->es_server.ea_peerlen);
@ -860,7 +860,7 @@ eap_state *esp;
outlen = (outp - outpacket_buf) - PPP_HDRLEN; outlen = (outp - outpacket_buf) - PPP_HDRLEN;
PUTSHORT(outlen, lenloc); PUTSHORT(outlen, lenloc);
ppp_output(esp->es_unit, outpacket_buf, outlen + PPP_HDRLEN); ppp_write(esp->es_unit, outpacket_buf, outlen + PPP_HDRLEN);
esp->es_server.ea_requests++; esp->es_server.ea_requests++;
@ -1067,7 +1067,7 @@ int lenstr;
MEMCPY(outp, str, lenstr); MEMCPY(outp, str, lenstr);
} }
ppp_output(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen); ppp_write(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen);
} }
/* /*
@ -1102,7 +1102,7 @@ int namelen;
MEMCPY(outp, name, namelen); MEMCPY(outp, name, namelen);
} }
ppp_output(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen); ppp_write(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen);
} }
#ifdef USE_SRP #ifdef USE_SRP
@ -1135,7 +1135,7 @@ int lenstr;
MEMCPY(outp, str, lenstr); MEMCPY(outp, str, lenstr);
} }
ppp_output(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen); ppp_write(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen);
} }
/* /*
@ -1166,7 +1166,7 @@ u_char *str;
PUTLONG(flags, outp); PUTLONG(flags, outp);
MEMCPY(outp, str, SHA_DIGESTSIZE); MEMCPY(outp, str, SHA_DIGESTSIZE);
ppp_output(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen); ppp_write(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen);
} }
#endif /* USE_SRP */ #endif /* USE_SRP */
@ -1191,7 +1191,7 @@ u_char type;
PUTCHAR(EAPT_NAK, outp); PUTCHAR(EAPT_NAK, outp);
PUTCHAR(type, outp); PUTCHAR(type, outp);
ppp_output(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen); ppp_write(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen);
} }
#ifdef USE_SRP #ifdef USE_SRP

View File

@ -818,5 +818,5 @@ fsm_sdata(f, code, id, data, datalen)
PUTCHAR(code, outp); PUTCHAR(code, outp);
PUTCHAR(id, outp); PUTCHAR(id, outp);
PUTSHORT(outlen, outp); PUTSHORT(outlen, outp);
ppp_output(f->unit, outpacket_buf, outlen + PPP_HDRLEN); ppp_write(f->unit, outpacket_buf, outlen + PPP_HDRLEN);
} }

File diff suppressed because it is too large Load Diff

View File

@ -342,19 +342,19 @@ int pppOverEthernetOpen(struct netif *ethif, const char *service_name, const cha
/* PPP flow functions /* PPP flow functions
*/ */
struct pbuf * pppSingleBuf(struct pbuf *p);
void pppInProcOverEthernet(int pd, struct pbuf *pb);
void pppOverEthernetInitFailed(int pd); void pppOverEthernetInitFailed(int pd);
u_short pppMTU(int pd); u_short pppMTU(int pd);
int pppWriteOverEthernet(int pd, const u_char *s, int n); #if PPPOE_SUPPORT
/* function called by pppoe.c */
void ppp_input_over_ethernet(int pd, struct pbuf *pb);
#endif /* PPPOE_SUPPORT */
int ppp_output(int pd, const u_char *s, int n); /* function called by all PPP subsystems to send packets */
int ppp_write(int pd, const u_char *s, int n);
void pppInProcOverEthernet(int pd, struct pbuf *pb); struct pbuf * ppp_singlebuf(struct pbuf *p);
/* Functions called by various PPP subsystems to configure /* Functions called by various PPP subsystems to configure

View File

@ -300,7 +300,7 @@ pppoe_dispatch_disc_pkt(struct netif *netif, struct pbuf *pb)
int off, err; int off, err;
struct eth_hdr *ethhdr; struct eth_hdr *ethhdr;
pb = pppSingleBuf(pb); pb = ppp_singlebuf(pb);
strcpy(devname, "pppoe"); /* as long as we don't know which instance */ strcpy(devname, "pppoe"); /* as long as we don't know which instance */
err_msg = NULL; err_msg = NULL;
@ -574,7 +574,7 @@ pppoe_data_input(struct netif *netif, struct pbuf *pb)
goto drop; goto drop;
} }
pb = pppSingleBuf (pb); pb = ppp_singlebuf (pb);
if (pb->len <= PPPOE_HEADERLEN) { if (pb->len <= PPPOE_HEADERLEN) {
PPPDEBUG(LOG_DEBUG, ("pppoe (data): dropping too short packet: %d bytes\n", pb->len)); PPPDEBUG(LOG_DEBUG, ("pppoe (data): dropping too short packet: %d bytes\n", pb->len));
@ -622,7 +622,7 @@ pppoe_data_input(struct netif *netif, struct pbuf *pb)
goto drop; goto drop;
} }
pppInProcOverEthernet(sc->sc_pd, pb); ppp_input_over_ethernet(sc->sc_pd, pb);
return; return;

View File

@ -592,7 +592,7 @@ upap_sauthreq(u)
PUTCHAR(u->us_passwdlen, outp); PUTCHAR(u->us_passwdlen, outp);
MEMCPY(outp, u->us_passwd, u->us_passwdlen); MEMCPY(outp, u->us_passwd, u->us_passwdlen);
ppp_output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN); ppp_write(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN);
TIMEOUT(upap_timeout, u, u->us_timeouttime); TIMEOUT(upap_timeout, u, u->us_timeouttime);
++u->us_transmits; ++u->us_transmits;
@ -622,7 +622,7 @@ upap_sresp(u, code, id, msg, msglen)
PUTSHORT(outlen, outp); PUTSHORT(outlen, outp);
PUTCHAR(msglen, outp); PUTCHAR(msglen, outp);
MEMCPY(outp, msg, msglen); MEMCPY(outp, msg, msglen);
ppp_output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN); ppp_write(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN);
} }
#endif /* UNUSED */ #endif /* UNUSED */