diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 4c29ec5f..75b33c54 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -1780,12 +1780,41 @@ #endif /** - * LWIP_PPP_API==1: Support PPP API (in pppapi.c) + * PRINTPKT_SUPPORT==1: Enable PPP print packet support + * + * Mandatory for debugging, it displays exchanged packet content in debug trace. + */ +#ifndef PRINTPKT_SUPPORT +#define PRINTPKT_SUPPORT 0 +#endif + +/** + * PPP_IPV6_SUPPORT==1: Enable PPP IPv6 support + */ +#ifndef PPP_IPV6_SUPPORT +#define PPP_IPV6_SUPPORT 0 +#endif + +/** + * LWIP_PPP_API==1: Enable PPP API (in pppapi.c) */ #ifndef LWIP_PPP_API #define LWIP_PPP_API 0 #endif +/** + * PPP_NOTIFY_PHASE==1: Support PPP notify phase support + * + * PPP notify phase support allows you to set a callback which is + * called on change of the internal PPP state machine. + * + * This can be used for example to set a LED pattern depending on the + * current phase of the PPP session. + */ +#ifndef PPP_NOTIFY_PHASE +#define PPP_NOTIFY_PHASE 0 +#endif + /** * pbuf_type PPP is using for LCP, PAP, CHAP, EAP, IPCP and IP6CP packets. * @@ -1832,6 +1861,13 @@ #define CHAP_SUPPORT 1 /* MSCHAP requires CHAP support */ #endif /* MSCHAP_SUPPORT */ +/** + * EAP_SUPPORT==1: Support EAP. + */ +#ifndef EAP_SUPPORT +#define EAP_SUPPORT 0 +#endif + /** * CBCP_SUPPORT==1: Support CBCP. CURRENTLY NOT SUPPORTED! DO NOT SET! */ @@ -1860,6 +1896,13 @@ #define LQR_SUPPORT 0 #endif +/** + * PPP_SERVER==1: Enable PPP server support (waiting for incoming PPP session). CURRENTLY NOT SUPPORTED! DO NOT SET! + */ +#ifndef PPP_SERVER +#define PPP_SERVER 0 +#endif + /** * VJ_SUPPORT==1: Support VJ header compression. */ diff --git a/src/include/netif/ppp/ppp.h b/src/include/netif/ppp/ppp.h index cda32ba0..97ab3cde 100644 --- a/src/include/netif/ppp/ppp.h +++ b/src/include/netif/ppp/ppp.h @@ -48,6 +48,42 @@ #include "lwip/ip6_addr.h" #endif /* PPP_IPV6_SUPPORT */ +/* Disable non-working or rarely used PPP feature, so rarely that we don't want to bloat opt.h with them */ +#ifndef PPP_OPTIONS +#define PPP_OPTIONS 0 +#endif + +#ifndef PPP_REMOTENAME +#define PPP_REMOTENAME 0 +#endif + +#ifndef PPP_IDLETIMELIMIT +#define PPP_IDLETIMELIMIT 0 +#endif + +#ifndef PPP_LCP_ADAPTIVE +#define PPP_LCP_ADAPTIVE 0 +#endif + +#ifndef PPP_MAXCONNECT +#define PPP_MAXCONNECT 0 +#endif + +#ifndef DEMAND_SUPPORT +#define DEMAND_SUPPORT 0 +#endif + +#ifndef PPP_ALLOWED_ADDRS +#define PPP_ALLOWED_ADDRS 0 +#endif + +#ifndef PPP_PROTOCOLNAME +#define PPP_PROTOCOLNAME 0 +#endif + +#ifndef PPP_STATS_SUPPORT +#define PPP_STATS_SUPPORT 0 +#endif /************************* diff --git a/src/netif/ppp/auth.c b/src/netif/ppp/auth.c index 4cbf0afb..830e21fd 100644 --- a/src/netif/ppp/auth.c +++ b/src/netif/ppp/auth.c @@ -546,6 +546,7 @@ set_permitted_number(argv) * An Open on LCP has requested a change from Dead to Establish phase. */ void link_required(ppp_pcb *pcb) { + LWIP_UNUSED_ARG(pcb); } #if 0 @@ -1003,6 +1004,7 @@ void continue_networks(ppp_pcb *pcb) { */ void auth_peer_fail(ppp_pcb *pcb, int protocol) { int errcode = PPPERR_AUTHFAIL; + LWIP_UNUSED_ARG(protocol); /* * Authentication failure: take the link down */ @@ -1057,8 +1059,8 @@ void auth_peer_success(ppp_pcb *pcb, int protocol, int prot_flavor, char *name, * Save the authenticated name of the peer for later. */ /* FIXME: do we need that ? */ - if (namelen > sizeof(pcb->peer_authname) - 1) - namelen = sizeof(pcb->peer_authname) - 1; + if (namelen > (int)sizeof(pcb->peer_authname) - 1) + namelen = (int)sizeof(pcb->peer_authname) - 1; MEMCPY(pcb->peer_authname, name, namelen); pcb->peer_authname[namelen] = 0; #if 0 /* UNUSED */ @@ -1082,6 +1084,7 @@ void auth_peer_success(ppp_pcb *pcb, int protocol, int prot_flavor, char *name, */ void auth_withpeer_fail(ppp_pcb *pcb, int protocol) { int errcode = PPPERR_AUTHFAIL; + LWIP_UNUSED_ARG(protocol); /* * We've failed to authenticate ourselves to our peer. * @@ -1162,6 +1165,7 @@ void np_up(ppp_pcb *pcb, int proto) { #if PPP_IDLETIMELIMIT int tlim; #endif /* PPP_IDLETIMELIMIT */ + LWIP_UNUSED_ARG(proto); if (pcb->num_np_up == 0) { /* @@ -1209,6 +1213,7 @@ void np_up(ppp_pcb *pcb, int proto) { * np_down - a network protocol has gone down. */ void np_down(ppp_pcb *pcb, int proto) { + LWIP_UNUSED_ARG(proto); if (--pcb->num_np_up == 0) { #if PPP_IDLETIMELIMIT UNTIMEOUT(check_idle, (void*)pcb); @@ -1227,6 +1232,7 @@ void np_down(ppp_pcb *pcb, int proto) { * np_finished - a network protocol has finished using the link. */ void np_finished(ppp_pcb *pcb, int proto) { + LWIP_UNUSED_ARG(proto); if (--pcb->num_np_open <= 0) { /* no further use for the link: shut up shop. */ lcp_close(pcb, "No network protocols running"); diff --git a/src/netif/ppp/chap-md5.c b/src/netif/ppp/chap-md5.c index f6361314..f7965490 100644 --- a/src/netif/ppp/chap-md5.c +++ b/src/netif/ppp/chap-md5.c @@ -70,6 +70,7 @@ static int chap_md5_verify_response(int id, char *name, unsigned char idbyte = id; unsigned char hash[MD5_HASH_SIZE]; int challenge_len, response_len; + LWIP_UNUSED_ARG(name); challenge_len = *challenge++; response_len = *response++; @@ -98,6 +99,8 @@ static void chap_md5_make_response(unsigned char *response, int id, char *our_na md5_context ctx; unsigned char idbyte = id; int challenge_len = *challenge++; + LWIP_UNUSED_ARG(our_name); + LWIP_UNUSED_ARG(private); md5_starts(&ctx); md5_update(&ctx, &idbyte, 1); diff --git a/src/netif/ppp/chap-new.c b/src/netif/ppp/chap-new.c index 052b4095..d4dbd7cc 100644 --- a/src/netif/ppp/chap-new.c +++ b/src/netif/ppp/chap-new.c @@ -106,7 +106,7 @@ static int chap_print_pkt(unsigned char *p, int plen, #endif /* PRINTPKT_SUPPORT */ /* List of digest types that we know about */ -const static struct chap_digest_type* const chap_digests[] = { +static const struct chap_digest_type* const chap_digests[] = { &md5_digest, #if MSCHAP_SUPPORT &chapms_digest, @@ -409,7 +409,11 @@ static int chap_verify_response(char *name, char *ourname, int id, ppp_error("No CHAP secret found for authenticating %q", name); return 0; } -#endif +#else + /* only here to clean compiler warnings */ + LWIP_UNUSED_ARG(ourname); + secret_len = 0; +#endif /* 0 */ ok = digest->verify_response(id, name, secret, secret_len, challenge, response, message, message_space); memset(secret, 0, sizeof(secret)); @@ -486,6 +490,7 @@ static void chap_respond(ppp_pcb *pcb, int id, static void chap_handle_status(ppp_pcb *pcb, int code, int id, unsigned char *pkt, int len) { const char *msg = NULL; + LWIP_UNUSED_ARG(id); if ((pcb->chap_client.flags & (AUTH_DONE|AUTH_STARTED|LOWERUP)) != (AUTH_STARTED|LOWERUP)) @@ -590,7 +595,7 @@ static int chap_print_pkt(unsigned char *p, int plen, if (len < CHAP_HDRLEN || len > plen) return 0; - if (code >= 1 && code <= sizeof(chap_code_names) / sizeof(char *)) + if (code >= 1 && code <= (int)sizeof(chap_code_names) / (int)sizeof(char *)) printer(arg, " %s", chap_code_names[code-1]); else printer(arg, " code=0x%x", code); diff --git a/src/netif/ppp/chap_ms.c b/src/netif/ppp/chap_ms.c index 2467aa54..7935de65 100644 --- a/src/netif/ppp/chap_ms.c +++ b/src/netif/ppp/chap_ms.c @@ -208,6 +208,8 @@ static int chapms_verify_response(int id, char *name, unsigned char md[MS_CHAP_RESPONSE_LEN]; int diff; int challenge_len, response_len; + LWIP_UNUSED_ARG(id); + LWIP_UNUSED_ARG(name); challenge_len = *challenge++; /* skip length, is 8 */ response_len = *response++; @@ -254,6 +256,7 @@ static int chapms2_verify_response(int id, char *name, unsigned char md[MS_CHAP2_RESPONSE_LEN]; char saresponse[MS_AUTH_RESPONSE_LENGTH+1]; int challenge_len, response_len; + LWIP_UNUSED_ARG(id); challenge_len = *challenge++; /* skip length, is 16 */ response_len = *response++; @@ -326,6 +329,9 @@ static int chapms2_verify_response(int id, char *name, static void chapms_make_response(unsigned char *response, int id, char *our_name, unsigned char *challenge, char *secret, int secret_len, unsigned char *private) { + LWIP_UNUSED_ARG(id); + LWIP_UNUSED_ARG(our_name); + LWIP_UNUSED_ARG(private); challenge++; /* skip length, should be 8 */ *response++ = MS_CHAP_RESPONSE_LEN; ChapMS(challenge, secret, secret_len, response); @@ -334,6 +340,7 @@ static void chapms_make_response(unsigned char *response, int id, char *our_name static void chapms2_make_response(unsigned char *response, int id, char *our_name, unsigned char *challenge, char *secret, int secret_len, unsigned char *private) { + LWIP_UNUSED_ARG(id); challenge++; /* skip length, should be 16 */ *response++ = MS_CHAP2_RESPONSE_LEN; ChapMS2(challenge, @@ -608,7 +615,7 @@ void GenerateAuthenticatorResponse(u_char PasswordHashHash[MD4_SIGNATURE_SIZE], sha1_finish(&sha1Context, Digest); /* Convert to ASCII hex string. */ - for (i = 0; i < LWIP_MAX((MS_AUTH_RESPONSE_LENGTH / 2), sizeof(Digest)); i++) + for (i = 0; i < LWIP_MAX((MS_AUTH_RESPONSE_LENGTH / 2), (int)sizeof(Digest)); i++) sprintf((char *)&authResponse[i * 2], "%02X", Digest[i]); } @@ -821,6 +828,7 @@ void ChapMS2(u_char *rchallenge, u_char *PeerChallenge, /* ARGSUSED */ u_char *p = &response[MS_CHAP2_PEER_CHALLENGE]; int i; + LWIP_UNUSED_ARG(authenticator); BZERO(response, MS_CHAP2_RESPONSE_LEN); diff --git a/src/netif/ppp/eap.c b/src/netif/ppp/eap.c index 4c385d6f..2bb0c5e8 100644 --- a/src/netif/ppp/eap.c +++ b/src/netif/ppp/eap.c @@ -2046,6 +2046,8 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { * eap_success - Receive EAP Success message (client mode). */ static void eap_success(ppp_pcb *pcb, u_char *inp, int id, int len) { + LWIP_UNUSED_ARG(id); + if (pcb->eap.es_client.ea_state != eapOpen && !eap_client_active(pcb)) { ppp_dbglog("EAP unexpected success message in state %s (%d)", eap_state_name(pcb->eap.es_client.ea_state), @@ -2070,6 +2072,8 @@ static void eap_success(ppp_pcb *pcb, u_char *inp, int id, int len) { * eap_failure - Receive EAP Failure message (client mode). */ static void eap_failure(ppp_pcb *pcb, u_char *inp, int id, int len) { + LWIP_UNUSED_ARG(id); + if (!eap_client_active(pcb)) { ppp_dbglog("EAP unexpected failure message in state %s (%d)", eap_state_name(pcb->eap.es_client.ea_state), @@ -2173,7 +2177,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *, if (len < EAP_HEADERLEN || len > inlen) return (0); - if (code >= 1 && code <= sizeof(eap_codenames) / sizeof(char *)) + if (code >= 1 && code <= (int)sizeof(eap_codenames) / (int)sizeof(char *)) printer(arg, " %s", eap_codenames[code-1]); else printer(arg, " code=0x%x", code); @@ -2188,7 +2192,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *, GETCHAR(rtype, inp); len--; if (rtype >= 1 && - rtype <= sizeof (eap_typenames) / sizeof (char *)) + rtype <= (int)sizeof (eap_typenames) / (int)sizeof (char *)) printer(arg, " %s", eap_typenames[rtype-1]); else printer(arg, " type=0x%x", rtype); @@ -2283,7 +2287,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *, break; case EAPSRP_SVALIDATOR: - if (len < sizeof (u32_t)) + if (len < (int)sizeof (u32_t)) break; GETLONG(uval, inp); len -= sizeof (u32_t); @@ -2323,7 +2327,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *, GETCHAR(rtype, inp); len--; if (rtype >= 1 && - rtype <= sizeof (eap_typenames) / sizeof (char *)) + rtype <= (int)sizeof (eap_typenames) / (int)sizeof (char *)) printer(arg, " %s", eap_typenames[rtype-1]); else printer(arg, " type=0x%x", rtype); @@ -2347,7 +2351,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *, len--; printer(arg, " = 1 && - rtype < sizeof (eap_typenames) / sizeof (char *)) + rtype < (int)sizeof (eap_typenames) / (int)sizeof (char *)) printer(arg, " (%s)", eap_typenames[rtype-1]); printer(arg, ">"); break; @@ -2389,7 +2393,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *, break; case EAPSRP_CVALIDATOR: - if (len < sizeof (u32_t)) + if (len < (int)sizeof (u32_t)) break; GETLONG(uval, inp); len -= sizeof (u32_t); diff --git a/src/netif/ppp/ipcp.c b/src/netif/ppp/ipcp.c index 1944fc86..8a0c87ac 100644 --- a/src/netif/ppp/ipcp.c +++ b/src/netif/ppp/ipcp.c @@ -2041,6 +2041,7 @@ static void ipcp_down(fsm *f) { * proxy arp entries, etc. */ static void ipcp_clear_addrs(ppp_pcb *pcb, u32_t ouraddr, u32_t hisaddr, u8_t replacedefaultroute) { + LWIP_UNUSED_ARG(replacedefaultroute); if (pcb->proxy_arp_set) { cifproxyarp(pcb, hisaddr); @@ -2113,7 +2114,7 @@ static int ipcp_printpkt(u_char *p, int plen, if (len < HEADERLEN || len > plen) return 0; - if (code >= 1 && code <= sizeof(ipcp_codenames) / sizeof(char *)) + if (code >= 1 && code <= (int)sizeof(ipcp_codenames) / (int)sizeof(char *)) printer(arg, " %s", ipcp_codenames[code-1]); else printer(arg, " code=0x%x", code); diff --git a/src/netif/ppp/ipv6cp.c b/src/netif/ppp/ipv6cp.c index 8fb01ada..bb472445 100644 --- a/src/netif/ppp/ipv6cp.c +++ b/src/netif/ppp/ipv6cp.c @@ -44,30 +44,30 @@ Alain.Durand@imag.fr, IMAG, Jean-Luc.Richier@imag.fr, IMAG-LSR. - Ce travail a été fait au sein du GIE DYADE (Groupement d'Intérêt - Économique ayant pour membres BULL S.A. et l'INRIA). + Ce travail a �t� fait au sein du GIE DYADE (Groupement d'Int�r�t + �conomique ayant pour membres BULL S.A. et l'INRIA). Ce logiciel informatique est disponible aux conditions - usuelles dans la recherche, c'est-à-dire qu'il peut - être utilisé, copié, modifié, distribué à l'unique - condition que ce texte soit conservé afin que + usuelles dans la recherche, c'est-�-dire qu'il peut + �tre utilis�, copi�, modifi�, distribu� � l'unique + condition que ce texte soit conserv� afin que l'origine de ce logiciel soit reconnue. Le nom de l'Institut National de Recherche en Informatique et en Automatique (INRIA), de l'IMAG, ou d'une personne morale - ou physique ayant participé à l'élaboration de ce logiciel ne peut - être utilisé sans son accord préalable explicite. + ou physique ayant particip� � l'�laboration de ce logiciel ne peut + �tre utilis� sans son accord pr�alable explicite. Ce logiciel est fourni tel quel sans aucune garantie, - support ou responsabilité d'aucune sorte. - Ce logiciel est dérivé de sources d'origine + support ou responsabilit� d'aucune sorte. + Ce logiciel est d�riv� de sources d'origine "University of California at Berkeley" et "Digital Equipment Corporation" couvertes par des copyrights. - L'Institut d'Informatique et de Mathématiques Appliquées de Grenoble (IMAG) - est une fédération d'unités mixtes de recherche du CNRS, de l'Institut National - Polytechnique de Grenoble et de l'Université Joseph Fourier regroupant - sept laboratoires dont le laboratoire Logiciels, Systèmes, Réseaux (LSR). + L'Institut d'Informatique et de Math�matiques Appliqu�es de Grenoble (IMAG) + est une f�d�ration d'unit�s mixtes de recherche du CNRS, de l'Institut National + Polytechnique de Grenoble et de l'Universit� Joseph Fourier regroupant + sept laboratoires dont le laboratoire Logiciels, Syst�mes, R�seaux (LSR). This work has been done in the context of GIE DYADE (joint R & D venture between BULL S.A. and INRIA). @@ -270,9 +270,9 @@ static int ipv6_demand_conf(int u); static int ipv6cp_printpkt(u_char *p, int plen, void (*printer)(void *, char *, ...), void *arg); #endif /* PRINTPKT_SUPPORT */ -#if PPP_DEMAND +#if DEMAND_SUPPORT static int ipv6_active_pkt(u_char *pkt, int len); -#endif /* PPP_DEMAND */ +#endif /* DEMAND_SUPPORT */ const struct protent ipv6cp_protent = { PPP_IPV6CP, @@ -1035,7 +1035,7 @@ endswitch: return (rc); /* Return final code */ } -#if PPP_OPTION +#if PPP_OPTIONS /* * ipv6_check_options - check that any IP-related options are OK, * and assign appropriate defaults. @@ -1092,7 +1092,7 @@ static void ipv6_check_options() { exit(1); } } -#endif /* PPP_OPTION */ +#endif /* PPP_OPTIONS */ #if DEMAND_SUPPORT /* @@ -1271,7 +1271,7 @@ static void ipv6cp_down(fsm *f) { sif6comp(f->unit, 0); #endif -#if PPP_DEMAND +#if DEMAND_SUPPORT /* * If we are doing dial-on-demand, set the interface * to queue up outgoing packets (for now). @@ -1279,7 +1279,7 @@ static void ipv6cp_down(fsm *f) { if (demand) { sifnpmode(f->pcb, PPP_IPV6, NPMODE_QUEUE); } else -#endif /* PPP_DEMAND */ +#endif /* DEMAND_SUPPORT */ { sifnpmode(f->pcb, PPP_IPV6, NPMODE_DROP); ipv6cp_clear_addrs(f->pcb, @@ -1396,7 +1396,7 @@ static int ipv6cp_printpkt(u_char *p, int plen, if (len < HEADERLEN || len > plen) return 0; - if (code >= 1 && code <= sizeof(ipv6cp_codenames) / sizeof(char *)) + if (code >= 1 && code <= (int)sizeof(ipv6cp_codenames) / (int)sizeof(char *)) printer(arg, " %s", ipv6cp_codenames[code-1]); else printer(arg, " code=0x%x", code); @@ -1464,7 +1464,7 @@ static int ipv6cp_printpkt(u_char *p, int plen, } #endif /* PRINTPKT_SUPPORT */ -#if PPP_DEMAND +#if DEMAND_SUPPORT /* * ipv6_active_pkt - see if this IP packet is worth bringing the link up for. * We don't bring the link up for IP fragments or for TCP FIN packets @@ -1502,6 +1502,6 @@ static int ipv6_active_pkt(u_char *pkt, int len) { return 0; return 1; } -#endif /* PPP_DEMAND */ +#endif /* DEMAND_SUPPORT */ #endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */ diff --git a/src/netif/ppp/lcp.c b/src/netif/ppp/lcp.c index 52f7a50f..bd616c40 100644 --- a/src/netif/ppp/lcp.c +++ b/src/netif/ppp/lcp.c @@ -1382,6 +1382,8 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) { try_.mrru = cishort; ); } +#else /* HAVE_MULTILINK */ + LWIP_UNUSED_ARG(treat_as_reject); #endif /* HAVE_MULTILINK */ /* @@ -2332,7 +2334,7 @@ static int lcp_printpkt(u_char *p, int plen, if (len < HEADERLEN || len > plen) return 0; - if (code >= 1 && code <= sizeof(lcp_codenames) / sizeof(char *)) + if (code >= 1 && code <= (int)sizeof(lcp_codenames) / (int)sizeof(char *)) printer(arg, " %s", lcp_codenames[code-1]); else printer(arg, " code=0x%x", code); @@ -2617,6 +2619,7 @@ static void lcp_received_echo_reply(fsm *f, int id, u_char *inp, int len) { ppp_pcb *pcb = f->pcb; lcp_options *go = &pcb->lcp_gotoptions; u32_t magic; + LWIP_UNUSED_ARG(id); /* Check the magic number - don't count replies from ourselves. */ if (len < 4) { diff --git a/src/netif/ppp/multilink.c b/src/netif/ppp/multilink.c index 9acbb567..3bea516a 100644 --- a/src/netif/ppp/multilink.c +++ b/src/netif/ppp/multilink.c @@ -29,7 +29,7 @@ */ #include "lwip/opt.h" -#if PPP_SUPPORT && HAVE_MULTILINK /* don't build if not configured for use in lwipopts.h */ +#if PPP_SUPPORT && defined(HAVE_MULTILINK) /* don't build if not configured for use in lwipopts.h */ /* Multilink support * diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index 12a57ebd..d2cdf1f0 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -602,7 +602,7 @@ static void ppp_clear(ppp_pcb *pcb) { LWIP_ASSERT("pcb->phase == PPP_PHASE_DEAD || pcb->phase == PPP_PHASE_HOLDOFF", pcb->phase == PPP_PHASE_DEAD || pcb->phase == PPP_PHASE_HOLDOFF); -#if PPP_STATS_SUPPORTs +#if PPP_STATS_SUPPORT link_stats_valid = 0; #endif /* PPP_STATS_SUPPORT */ @@ -1622,6 +1622,10 @@ pppos_input(ppp_pcb *pcb, u_char *s, int l) /* Packet consumed, release our references. */ pcrx->in_head = NULL; pcrx->in_tail = NULL; +#if IP_FORWARD || LWIP_IPV6_FORWARD + /* hide the room for Ethernet forwarding header */ + pbuf_header(inp, -(s16_t)PBUF_LINK_HLEN); +#endif /* IP_FORWARD || LWIP_IPV6_FORWARD */ #if PPP_INPROC_MULTITHREADED if(tcpip_callback_with_block(pppos_input_callback, inp, 0) != ERR_OK) { PPPDEBUG(LOG_ERR, ("pppos_input[%d]: tcpip_callback() failed, dropping packet\n", pcb->num)); @@ -1711,6 +1715,7 @@ pppos_input(ppp_pcb *pcb, u_char *s, int l) case PDDATA: /* Process data byte. */ /* Make space to receive processed data. */ if (pcrx->in_tail == NULL || pcrx->in_tail->len == PBUF_POOL_BUFSIZE) { + u16_t pbuf_alloc_len; if (pcrx->in_tail != NULL) { pcrx->in_tail->tot_len = pcrx->in_tail->len; if (pcrx->in_tail != pcrx->in_head) { @@ -1720,45 +1725,35 @@ pppos_input(ppp_pcb *pcb, u_char *s, int l) } } /* If we haven't started a packet, we need a packet header. */ + pbuf_alloc_len = 0; #if IP_FORWARD || LWIP_IPV6_FORWARD - /* If IP forwarding is enabled we are using a PBUF_LINK packet type so + /* If IP forwarding is enabled we are reserving PBUF_LINK_HLEN bytes so * the packet is being allocated with enough header space to be * forwarded (to Ethernet for example). */ - next_pbuf = pbuf_alloc(PBUF_LINK, 0, PBUF_POOL); -#else /* IP_FORWARD || LWIP_IPV6_FORWARD */ - next_pbuf = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL); + if (pcrx->in_head == NULL) { + pbuf_alloc_len = PBUF_LINK_HLEN; + } #endif /* IP_FORWARD || LWIP_IPV6_FORWARD */ + next_pbuf = pbuf_alloc(PBUF_RAW, pbuf_alloc_len, PBUF_POOL); if (next_pbuf == NULL) { /* No free buffers. Drop the input packet and let the * higher layers deal with it. Continue processing * the received pbuf chain in case a new packet starts. */ - PPPDEBUG(LOG_ERR, ("pppos_input[%d]: NO FREE MBUFS!\n", pcb->num)); + PPPDEBUG(LOG_ERR, ("pppos_input[%d]: NO FREE PBUFS!\n", pcb->num)); LINK_STATS_INC(link.memerr); ppp_drop(pcrx); pcrx->in_state = PDSTART; /* Wait for flag sequence. */ break; } if (pcrx->in_head == NULL) { - u8_t *payload; - /* pbuf_header() used below is only trying to put PPP headers - * before the current payload pointer if there is enough space - * in the pbuf to do so. Therefore we don't care if it fails, - * but if it fail we have to set len to the size used by PPP headers. - */ + u8_t *payload = ((u8_t*)next_pbuf->payload) + pbuf_alloc_len; #if PPP_INPROC_MULTITHREADED - if (pbuf_header(next_pbuf, +sizeof(struct pppos_input_header) +sizeof(pcrx->in_protocol))) { - next_pbuf->len += sizeof(struct pppos_input_header) + sizeof(pcrx->in_protocol); - } - payload = next_pbuf->payload; ((struct pppos_input_header*)payload)->pcb = pcb; payload += sizeof(struct pppos_input_header); -#else /* PPP_INPROC_MULTITHREADED */ - if (pbuf_header(next_pbuf, +sizeof(pcrx->in_protocol))) { - next_pbuf->len += sizeof(pcrx->in_protocol); - } - payload = next_pbuf->payload; + next_pbuf->len += sizeof(struct pppos_input_header); #endif /* PPP_INPROC_MULTITHREADED */ + next_pbuf->len += sizeof(pcrx->in_protocol); *(payload++) = pcrx->in_protocol >> 8; *(payload) = pcrx->in_protocol & 0xFF; pcrx->in_head = next_pbuf; @@ -1930,6 +1925,7 @@ static void ppp_over_l2tp_open(ppp_pcb *pcb) { #endif /* PPPOL2TP_SUPPORT */ void ppp_link_down(ppp_pcb *pcb) { + LWIP_UNUSED_ARG(pcb); /* necessary if PPPDEBUG is defined to an empty function */ PPPDEBUG(LOG_DEBUG, ("ppp_link_down: unit %d\n", pcb->num)); } @@ -2014,6 +2010,7 @@ int ppp_send_config(ppp_pcb *pcb, int mtu, u32_t accm, int pcomp, int accomp) { #if PPPOS_SUPPORT int i; #endif /* PPPOS_SUPPORT */ + LWIP_UNUSED_ARG(mtu); /* pcb->mtu = mtu; -- set correctly with netif_set_mtu */ pcb->pcomp = pcomp; diff --git a/src/netif/ppp/pppoe.c b/src/netif/ppp/pppoe.c index a5f4bd30..101ac90e 100644 --- a/src/netif/ppp/pppoe.c +++ b/src/netif/ppp/pppoe.c @@ -313,7 +313,7 @@ pppoe_disc_input(struct netif *netif, struct pbuf *pb) hunique_len = 0; #endif session = 0; - if (pb->len - off < PPPOE_HEADERLEN) { + if (pb->len - off < (u16_t)PPPOE_HEADERLEN) { PPPDEBUG(LOG_DEBUG, ("pppoe: packet too short: %d\n", pb->len)); goto done; } diff --git a/src/netif/ppp/pppol2tp.c b/src/netif/ppp/pppol2tp.c index dad340aa..017223b4 100644 --- a/src/netif/ppp/pppol2tp.c +++ b/src/netif/ppp/pppol2tp.c @@ -189,6 +189,7 @@ static void pppol2tp_input(void *arg, struct udp_pcb *pcb, struct pbuf *p, struc pppol2tp_pcb *l2tp = (pppol2tp_pcb*)arg; u16_t hflags, hlen, len=0, tunnel_id=0, session_id=0, ns=0, nr=0, offset=0; u8_t *inp; + LWIP_UNUSED_ARG(pcb); if (l2tp->phase < PPPOL2TP_STATE_SCCRQ_SENT) { goto free_and_return; @@ -324,6 +325,10 @@ static void pppol2tp_dispatch_control_packet(pppol2tp_pcb *l2tp, struct ip_addr u8_t md5_hash[16]; u8_t challenge_id = 0; #endif /* PPPOL2TP_AUTH_SUPPORT */ + LWIP_UNUSED_ARG(addr); + LWIP_UNUSED_ARG(len); + LWIP_UNUSED_ARG(tunnel_id); + LWIP_UNUSED_ARG(session_id); l2tp->peer_nr = nr; l2tp->peer_ns = ns; diff --git a/src/netif/ppp/upap.c b/src/netif/ppp/upap.c index 11dddd3e..72931305 100644 --- a/src/netif/ppp/upap.c +++ b/src/netif/ppp/upap.c @@ -357,7 +357,10 @@ static void upap_input(ppp_pcb *pcb, u_char *inpacket, int l) { */ static void upap_rauthreq(ppp_pcb *pcb, u_char *inp, int id, int len) { u_char ruserlen, rpasswdlen; - char *ruser, *rpasswd; + char *ruser; +#if 0 + char *rpasswd; +#endif char rhostname[256]; int retcode; char *msg; @@ -401,12 +404,12 @@ static void upap_rauthreq(ppp_pcb *pcb, u_char *inp, int id, int len) { } /* FIXME: we need a way to check peer secret */ +#if 0 rpasswd = (char *) inp; /* * Check the username and password given. */ -#if 0 retcode = check_passwd(pcb->upap.us_unit, ruser, ruserlen, rpasswd, rpasswdlen, &msg); BZERO(rpasswd, rpasswdlen); @@ -423,11 +426,17 @@ static void upap_rauthreq(ppp_pcb *pcb, u_char *inp, int id, int len) { warn("calling number %q is not authorized", remote_number); } } -#endif msglen = strlen(msg); if (msglen > 255) msglen = 255; +#else + /* only here to clean compiler warnings */ + retcode = UPAP_AUTHNAK; + msg = NULL; + msglen = 0; +#endif /* 0 */ + upap_sresp(pcb, retcode, id, msg, msglen); /* Null terminate and clean remote name. */ @@ -454,6 +463,7 @@ static void upap_rauthreq(ppp_pcb *pcb, u_char *inp, int id, int len) { static void upap_rauthack(ppp_pcb *pcb, u_char *inp, int id, int len) { u_char msglen; char *msg; + LWIP_UNUSED_ARG(id); if (pcb->upap.us_clientstate != UPAPCS_AUTHREQ) /* XXX */ return; @@ -488,6 +498,7 @@ static void upap_rauthack(ppp_pcb *pcb, u_char *inp, int id, int len) { static void upap_rauthnak(ppp_pcb *pcb, u_char *inp, int id, int len) { u_char msglen; char *msg; + LWIP_UNUSED_ARG(id); if (pcb->upap.us_clientstate != UPAPCS_AUTHREQ) /* XXX */ return; @@ -608,7 +619,7 @@ static int upap_printpkt(u_char *p, int plen, void (*printer) (void *, char *, . if (len < UPAP_HEADERLEN || len > plen) return 0; - if (code >= 1 && code <= sizeof(upap_codenames) / sizeof(char *)) + if (code >= 1 && code <= (int)sizeof(upap_codenames) / (int)sizeof(char *)) printer(arg, " %s", upap_codenames[code-1]); else printer(arg, " code=0x%x", code); diff --git a/src/netif/ppp/utils.c b/src/netif/ppp/utils.c index d03f6c25..60cf7f85 100644 --- a/src/netif/ppp/utils.c +++ b/src/netif/ppp/utils.c @@ -209,7 +209,7 @@ int ppp_vslprintf(char *buf, int buflen, char *fmt, va_list args) { val = va_arg(args, long); if ((long)val < 0) { neg = 1; - val = -val; + val = (unsigned long)-val; } base = 10; break; @@ -607,6 +607,8 @@ static void ppp_logit(int level, char *fmt, va_list args) { } static void ppp_log_write(int level, char *buf) { + LWIP_UNUSED_ARG(level); /* necessary if PPPDEBUG is defined to an empty function */ + LWIP_UNUSED_ARG(buf); PPPDEBUG(level, ("%s\n", buf) ); #if 0 if (log_to_fd >= 0 && (level != LOG_DEBUG || debug)) {