Merge branch 'master' of git.sv.gnu.org:/srv/git/lwip

This commit is contained in:
goldsimon 2014-10-21 11:09:30 +02:00
commit 5a6c64cc28
16 changed files with 189 additions and 65 deletions

View File

@ -1780,12 +1780,41 @@
#endif #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 #ifndef LWIP_PPP_API
#define LWIP_PPP_API 0 #define LWIP_PPP_API 0
#endif #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. * 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 */ #define CHAP_SUPPORT 1 /* MSCHAP requires CHAP support */
#endif /* MSCHAP_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! * CBCP_SUPPORT==1: Support CBCP. CURRENTLY NOT SUPPORTED! DO NOT SET!
*/ */
@ -1860,6 +1896,13 @@
#define LQR_SUPPORT 0 #define LQR_SUPPORT 0
#endif #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. * VJ_SUPPORT==1: Support VJ header compression.
*/ */

View File

@ -48,6 +48,42 @@
#include "lwip/ip6_addr.h" #include "lwip/ip6_addr.h"
#endif /* PPP_IPV6_SUPPORT */ #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
/************************* /*************************

View File

@ -546,6 +546,7 @@ set_permitted_number(argv)
* An Open on LCP has requested a change from Dead to Establish phase. * An Open on LCP has requested a change from Dead to Establish phase.
*/ */
void link_required(ppp_pcb *pcb) { void link_required(ppp_pcb *pcb) {
LWIP_UNUSED_ARG(pcb);
} }
#if 0 #if 0
@ -1003,6 +1004,7 @@ void continue_networks(ppp_pcb *pcb) {
*/ */
void auth_peer_fail(ppp_pcb *pcb, int protocol) { void auth_peer_fail(ppp_pcb *pcb, int protocol) {
int errcode = PPPERR_AUTHFAIL; int errcode = PPPERR_AUTHFAIL;
LWIP_UNUSED_ARG(protocol);
/* /*
* Authentication failure: take the link down * 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. * Save the authenticated name of the peer for later.
*/ */
/* FIXME: do we need that ? */ /* FIXME: do we need that ? */
if (namelen > sizeof(pcb->peer_authname) - 1) if (namelen > (int)sizeof(pcb->peer_authname) - 1)
namelen = sizeof(pcb->peer_authname) - 1; namelen = (int)sizeof(pcb->peer_authname) - 1;
MEMCPY(pcb->peer_authname, name, namelen); MEMCPY(pcb->peer_authname, name, namelen);
pcb->peer_authname[namelen] = 0; pcb->peer_authname[namelen] = 0;
#if 0 /* UNUSED */ #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) { void auth_withpeer_fail(ppp_pcb *pcb, int protocol) {
int errcode = PPPERR_AUTHFAIL; int errcode = PPPERR_AUTHFAIL;
LWIP_UNUSED_ARG(protocol);
/* /*
* We've failed to authenticate ourselves to our peer. * We've failed to authenticate ourselves to our peer.
* *
@ -1162,6 +1165,7 @@ void np_up(ppp_pcb *pcb, int proto) {
#if PPP_IDLETIMELIMIT #if PPP_IDLETIMELIMIT
int tlim; int tlim;
#endif /* PPP_IDLETIMELIMIT */ #endif /* PPP_IDLETIMELIMIT */
LWIP_UNUSED_ARG(proto);
if (pcb->num_np_up == 0) { 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. * np_down - a network protocol has gone down.
*/ */
void np_down(ppp_pcb *pcb, int proto) { void np_down(ppp_pcb *pcb, int proto) {
LWIP_UNUSED_ARG(proto);
if (--pcb->num_np_up == 0) { if (--pcb->num_np_up == 0) {
#if PPP_IDLETIMELIMIT #if PPP_IDLETIMELIMIT
UNTIMEOUT(check_idle, (void*)pcb); 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. * np_finished - a network protocol has finished using the link.
*/ */
void np_finished(ppp_pcb *pcb, int proto) { void np_finished(ppp_pcb *pcb, int proto) {
LWIP_UNUSED_ARG(proto);
if (--pcb->num_np_open <= 0) { if (--pcb->num_np_open <= 0) {
/* no further use for the link: shut up shop. */ /* no further use for the link: shut up shop. */
lcp_close(pcb, "No network protocols running"); lcp_close(pcb, "No network protocols running");

View File

@ -70,6 +70,7 @@ static int chap_md5_verify_response(int id, char *name,
unsigned char idbyte = id; unsigned char idbyte = id;
unsigned char hash[MD5_HASH_SIZE]; unsigned char hash[MD5_HASH_SIZE];
int challenge_len, response_len; int challenge_len, response_len;
LWIP_UNUSED_ARG(name);
challenge_len = *challenge++; challenge_len = *challenge++;
response_len = *response++; response_len = *response++;
@ -98,6 +99,8 @@ static void chap_md5_make_response(unsigned char *response, int id, char *our_na
md5_context ctx; md5_context ctx;
unsigned char idbyte = id; unsigned char idbyte = id;
int challenge_len = *challenge++; int challenge_len = *challenge++;
LWIP_UNUSED_ARG(our_name);
LWIP_UNUSED_ARG(private);
md5_starts(&ctx); md5_starts(&ctx);
md5_update(&ctx, &idbyte, 1); md5_update(&ctx, &idbyte, 1);

View File

@ -106,7 +106,7 @@ static int chap_print_pkt(unsigned char *p, int plen,
#endif /* PRINTPKT_SUPPORT */ #endif /* PRINTPKT_SUPPORT */
/* List of digest types that we know about */ /* 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, &md5_digest,
#if MSCHAP_SUPPORT #if MSCHAP_SUPPORT
&chapms_digest, &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); ppp_error("No CHAP secret found for authenticating %q", name);
return 0; 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, ok = digest->verify_response(id, name, secret, secret_len, challenge,
response, message, message_space); response, message, message_space);
memset(secret, 0, sizeof(secret)); 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, static void chap_handle_status(ppp_pcb *pcb, int code, int id,
unsigned char *pkt, int len) { unsigned char *pkt, int len) {
const char *msg = NULL; const char *msg = NULL;
LWIP_UNUSED_ARG(id);
if ((pcb->chap_client.flags & (AUTH_DONE|AUTH_STARTED|LOWERUP)) if ((pcb->chap_client.flags & (AUTH_DONE|AUTH_STARTED|LOWERUP))
!= (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) if (len < CHAP_HDRLEN || len > plen)
return 0; 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]); printer(arg, " %s", chap_code_names[code-1]);
else else
printer(arg, " code=0x%x", code); printer(arg, " code=0x%x", code);

View File

@ -208,6 +208,8 @@ static int chapms_verify_response(int id, char *name,
unsigned char md[MS_CHAP_RESPONSE_LEN]; unsigned char md[MS_CHAP_RESPONSE_LEN];
int diff; int diff;
int challenge_len, response_len; int challenge_len, response_len;
LWIP_UNUSED_ARG(id);
LWIP_UNUSED_ARG(name);
challenge_len = *challenge++; /* skip length, is 8 */ challenge_len = *challenge++; /* skip length, is 8 */
response_len = *response++; response_len = *response++;
@ -254,6 +256,7 @@ static int chapms2_verify_response(int id, char *name,
unsigned char md[MS_CHAP2_RESPONSE_LEN]; unsigned char md[MS_CHAP2_RESPONSE_LEN];
char saresponse[MS_AUTH_RESPONSE_LENGTH+1]; char saresponse[MS_AUTH_RESPONSE_LENGTH+1];
int challenge_len, response_len; int challenge_len, response_len;
LWIP_UNUSED_ARG(id);
challenge_len = *challenge++; /* skip length, is 16 */ challenge_len = *challenge++; /* skip length, is 16 */
response_len = *response++; 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, static void chapms_make_response(unsigned char *response, int id, char *our_name,
unsigned char *challenge, char *secret, int secret_len, unsigned char *challenge, char *secret, int secret_len,
unsigned char *private) { unsigned char *private) {
LWIP_UNUSED_ARG(id);
LWIP_UNUSED_ARG(our_name);
LWIP_UNUSED_ARG(private);
challenge++; /* skip length, should be 8 */ challenge++; /* skip length, should be 8 */
*response++ = MS_CHAP_RESPONSE_LEN; *response++ = MS_CHAP_RESPONSE_LEN;
ChapMS(challenge, secret, secret_len, response); 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, static void chapms2_make_response(unsigned char *response, int id, char *our_name,
unsigned char *challenge, char *secret, int secret_len, unsigned char *challenge, char *secret, int secret_len,
unsigned char *private) { unsigned char *private) {
LWIP_UNUSED_ARG(id);
challenge++; /* skip length, should be 16 */ challenge++; /* skip length, should be 16 */
*response++ = MS_CHAP2_RESPONSE_LEN; *response++ = MS_CHAP2_RESPONSE_LEN;
ChapMS2(challenge, ChapMS2(challenge,
@ -608,7 +615,7 @@ void GenerateAuthenticatorResponse(u_char PasswordHashHash[MD4_SIGNATURE_SIZE],
sha1_finish(&sha1Context, Digest); sha1_finish(&sha1Context, Digest);
/* Convert to ASCII hex string. */ /* 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]); sprintf((char *)&authResponse[i * 2], "%02X", Digest[i]);
} }
@ -821,6 +828,7 @@ void ChapMS2(u_char *rchallenge, u_char *PeerChallenge,
/* ARGSUSED */ /* ARGSUSED */
u_char *p = &response[MS_CHAP2_PEER_CHALLENGE]; u_char *p = &response[MS_CHAP2_PEER_CHALLENGE];
int i; int i;
LWIP_UNUSED_ARG(authenticator);
BZERO(response, MS_CHAP2_RESPONSE_LEN); BZERO(response, MS_CHAP2_RESPONSE_LEN);

View File

@ -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). * eap_success - Receive EAP Success message (client mode).
*/ */
static void eap_success(ppp_pcb *pcb, u_char *inp, int id, int len) { 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)) { if (pcb->eap.es_client.ea_state != eapOpen && !eap_client_active(pcb)) {
ppp_dbglog("EAP unexpected success message in state %s (%d)", ppp_dbglog("EAP unexpected success message in state %s (%d)",
eap_state_name(pcb->eap.es_client.ea_state), 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). * eap_failure - Receive EAP Failure message (client mode).
*/ */
static void eap_failure(ppp_pcb *pcb, u_char *inp, int id, int len) { static void eap_failure(ppp_pcb *pcb, u_char *inp, int id, int len) {
LWIP_UNUSED_ARG(id);
if (!eap_client_active(pcb)) { if (!eap_client_active(pcb)) {
ppp_dbglog("EAP unexpected failure message in state %s (%d)", ppp_dbglog("EAP unexpected failure message in state %s (%d)",
eap_state_name(pcb->eap.es_client.ea_state), 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) if (len < EAP_HEADERLEN || len > inlen)
return (0); 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]); printer(arg, " %s", eap_codenames[code-1]);
else else
printer(arg, " code=0x%x", code); 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); GETCHAR(rtype, inp);
len--; len--;
if (rtype >= 1 && if (rtype >= 1 &&
rtype <= sizeof (eap_typenames) / sizeof (char *)) rtype <= (int)sizeof (eap_typenames) / (int)sizeof (char *))
printer(arg, " %s", eap_typenames[rtype-1]); printer(arg, " %s", eap_typenames[rtype-1]);
else else
printer(arg, " type=0x%x", rtype); printer(arg, " type=0x%x", rtype);
@ -2283,7 +2287,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *,
break; break;
case EAPSRP_SVALIDATOR: case EAPSRP_SVALIDATOR:
if (len < sizeof (u32_t)) if (len < (int)sizeof (u32_t))
break; break;
GETLONG(uval, inp); GETLONG(uval, inp);
len -= sizeof (u32_t); len -= sizeof (u32_t);
@ -2323,7 +2327,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *,
GETCHAR(rtype, inp); GETCHAR(rtype, inp);
len--; len--;
if (rtype >= 1 && if (rtype >= 1 &&
rtype <= sizeof (eap_typenames) / sizeof (char *)) rtype <= (int)sizeof (eap_typenames) / (int)sizeof (char *))
printer(arg, " %s", eap_typenames[rtype-1]); printer(arg, " %s", eap_typenames[rtype-1]);
else else
printer(arg, " type=0x%x", rtype); printer(arg, " type=0x%x", rtype);
@ -2347,7 +2351,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *,
len--; len--;
printer(arg, " <Suggested-type %02X", rtype); printer(arg, " <Suggested-type %02X", rtype);
if (rtype >= 1 && if (rtype >= 1 &&
rtype < sizeof (eap_typenames) / sizeof (char *)) rtype < (int)sizeof (eap_typenames) / (int)sizeof (char *))
printer(arg, " (%s)", eap_typenames[rtype-1]); printer(arg, " (%s)", eap_typenames[rtype-1]);
printer(arg, ">"); printer(arg, ">");
break; break;
@ -2389,7 +2393,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *,
break; break;
case EAPSRP_CVALIDATOR: case EAPSRP_CVALIDATOR:
if (len < sizeof (u32_t)) if (len < (int)sizeof (u32_t))
break; break;
GETLONG(uval, inp); GETLONG(uval, inp);
len -= sizeof (u32_t); len -= sizeof (u32_t);

View File

@ -2041,6 +2041,7 @@ static void ipcp_down(fsm *f) {
* proxy arp entries, etc. * proxy arp entries, etc.
*/ */
static void ipcp_clear_addrs(ppp_pcb *pcb, u32_t ouraddr, u32_t hisaddr, u8_t replacedefaultroute) { 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) { if (pcb->proxy_arp_set) {
cifproxyarp(pcb, hisaddr); cifproxyarp(pcb, hisaddr);
@ -2113,7 +2114,7 @@ static int ipcp_printpkt(u_char *p, int plen,
if (len < HEADERLEN || len > plen) if (len < HEADERLEN || len > plen)
return 0; 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]); printer(arg, " %s", ipcp_codenames[code-1]);
else else
printer(arg, " code=0x%x", code); printer(arg, " code=0x%x", code);

View File

@ -44,30 +44,30 @@
Alain.Durand@imag.fr, IMAG, Alain.Durand@imag.fr, IMAG,
Jean-Luc.Richier@imag.fr, IMAG-LSR. Jean-Luc.Richier@imag.fr, IMAG-LSR.
Ce travail a é fait au sein du GIE DYADE (Groupement d'Intérêt Ce travail a <EFBFBD>t<EFBFBD> fait au sein du GIE DYADE (Groupement d'Int<EFBFBD>r<EFBFBD>t
Économique ayant pour membres BULL S.A. et l'INRIA). <EFBFBD>conomique ayant pour membres BULL S.A. et l'INRIA).
Ce logiciel informatique est disponible aux conditions Ce logiciel informatique est disponible aux conditions
usuelles dans la recherche, c'est-à-dire qu'il peut usuelles dans la recherche, c'est-<EFBFBD>-dire qu'il peut
être utilisé, copié, modifié, distribué à l'unique <EFBFBD>tre utilis<EFBFBD>, copi<EFBFBD>, modifi<EFBFBD>, distribu<EFBFBD> <EFBFBD> l'unique
condition que ce texte soit conservé afin que condition que ce texte soit conserv<EFBFBD> afin que
l'origine de ce logiciel soit reconnue. l'origine de ce logiciel soit reconnue.
Le nom de l'Institut National de Recherche en Informatique Le nom de l'Institut National de Recherche en Informatique
et en Automatique (INRIA), de l'IMAG, ou d'une personne morale et en Automatique (INRIA), de l'IMAG, ou d'une personne morale
ou physique ayant participé à l'élaboration de ce logiciel ne peut ou physique ayant particip<EFBFBD> <EFBFBD> l'<EFBFBD>laboration de ce logiciel ne peut
être utilisé sans son accord préalable explicite. <EFBFBD>tre utilis<EFBFBD> sans son accord pr<EFBFBD>alable explicite.
Ce logiciel est fourni tel quel sans aucune garantie, Ce logiciel est fourni tel quel sans aucune garantie,
support ou responsabilité d'aucune sorte. support ou responsabilit<EFBFBD> d'aucune sorte.
Ce logiciel est dérivé de sources d'origine Ce logiciel est d<EFBFBD>riv<EFBFBD> de sources d'origine
"University of California at Berkeley" et "University of California at Berkeley" et
"Digital Equipment Corporation" couvertes par des copyrights. "Digital Equipment Corporation" couvertes par des copyrights.
L'Institut d'Informatique et de Mathématiques Appliquées de Grenoble (IMAG) L'Institut d'Informatique et de Math<EFBFBD>matiques Appliqu<EFBFBD>es de Grenoble (IMAG)
est une fédération d'unités mixtes de recherche du CNRS, de l'Institut National est une f<EFBFBD>d<EFBFBD>ration d'unit<EFBFBD>s mixtes de recherche du CNRS, de l'Institut National
Polytechnique de Grenoble et de l'Université Joseph Fourier regroupant Polytechnique de Grenoble et de l'Universit<EFBFBD> Joseph Fourier regroupant
sept laboratoires dont le laboratoire Logiciels, Systèmes, seaux (LSR). sept laboratoires dont le laboratoire Logiciels, Syst<EFBFBD>mes, R<EFBFBD>seaux (LSR).
This work has been done in the context of GIE DYADE (joint R & D venture This work has been done in the context of GIE DYADE (joint R & D venture
between BULL S.A. and INRIA). 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, static int ipv6cp_printpkt(u_char *p, int plen,
void (*printer)(void *, char *, ...), void *arg); void (*printer)(void *, char *, ...), void *arg);
#endif /* PRINTPKT_SUPPORT */ #endif /* PRINTPKT_SUPPORT */
#if PPP_DEMAND #if DEMAND_SUPPORT
static int ipv6_active_pkt(u_char *pkt, int len); static int ipv6_active_pkt(u_char *pkt, int len);
#endif /* PPP_DEMAND */ #endif /* DEMAND_SUPPORT */
const struct protent ipv6cp_protent = { const struct protent ipv6cp_protent = {
PPP_IPV6CP, PPP_IPV6CP,
@ -1035,7 +1035,7 @@ endswitch:
return (rc); /* Return final code */ return (rc); /* Return final code */
} }
#if PPP_OPTION #if PPP_OPTIONS
/* /*
* ipv6_check_options - check that any IP-related options are OK, * ipv6_check_options - check that any IP-related options are OK,
* and assign appropriate defaults. * and assign appropriate defaults.
@ -1092,7 +1092,7 @@ static void ipv6_check_options() {
exit(1); exit(1);
} }
} }
#endif /* PPP_OPTION */ #endif /* PPP_OPTIONS */
#if DEMAND_SUPPORT #if DEMAND_SUPPORT
/* /*
@ -1271,7 +1271,7 @@ static void ipv6cp_down(fsm *f) {
sif6comp(f->unit, 0); sif6comp(f->unit, 0);
#endif #endif
#if PPP_DEMAND #if DEMAND_SUPPORT
/* /*
* If we are doing dial-on-demand, set the interface * If we are doing dial-on-demand, set the interface
* to queue up outgoing packets (for now). * to queue up outgoing packets (for now).
@ -1279,7 +1279,7 @@ static void ipv6cp_down(fsm *f) {
if (demand) { if (demand) {
sifnpmode(f->pcb, PPP_IPV6, NPMODE_QUEUE); sifnpmode(f->pcb, PPP_IPV6, NPMODE_QUEUE);
} else } else
#endif /* PPP_DEMAND */ #endif /* DEMAND_SUPPORT */
{ {
sifnpmode(f->pcb, PPP_IPV6, NPMODE_DROP); sifnpmode(f->pcb, PPP_IPV6, NPMODE_DROP);
ipv6cp_clear_addrs(f->pcb, ipv6cp_clear_addrs(f->pcb,
@ -1396,7 +1396,7 @@ static int ipv6cp_printpkt(u_char *p, int plen,
if (len < HEADERLEN || len > plen) if (len < HEADERLEN || len > plen)
return 0; 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]); printer(arg, " %s", ipv6cp_codenames[code-1]);
else else
printer(arg, " code=0x%x", code); printer(arg, " code=0x%x", code);
@ -1464,7 +1464,7 @@ static int ipv6cp_printpkt(u_char *p, int plen,
} }
#endif /* PRINTPKT_SUPPORT */ #endif /* PRINTPKT_SUPPORT */
#if PPP_DEMAND #if DEMAND_SUPPORT
/* /*
* ipv6_active_pkt - see if this IP packet is worth bringing the link up for. * 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 * 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 0;
return 1; return 1;
} }
#endif /* PPP_DEMAND */ #endif /* DEMAND_SUPPORT */
#endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */ #endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */

View File

@ -1382,6 +1382,8 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
try_.mrru = cishort; try_.mrru = cishort;
); );
} }
#else /* HAVE_MULTILINK */
LWIP_UNUSED_ARG(treat_as_reject);
#endif /* HAVE_MULTILINK */ #endif /* HAVE_MULTILINK */
/* /*
@ -2332,7 +2334,7 @@ static int lcp_printpkt(u_char *p, int plen,
if (len < HEADERLEN || len > plen) if (len < HEADERLEN || len > plen)
return 0; 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]); printer(arg, " %s", lcp_codenames[code-1]);
else else
printer(arg, " code=0x%x", code); 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; ppp_pcb *pcb = f->pcb;
lcp_options *go = &pcb->lcp_gotoptions; lcp_options *go = &pcb->lcp_gotoptions;
u32_t magic; u32_t magic;
LWIP_UNUSED_ARG(id);
/* Check the magic number - don't count replies from ourselves. */ /* Check the magic number - don't count replies from ourselves. */
if (len < 4) { if (len < 4) {

View File

@ -29,7 +29,7 @@
*/ */
#include "lwip/opt.h" #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 /* Multilink support
* *

View File

@ -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); 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; link_stats_valid = 0;
#endif /* PPP_STATS_SUPPORT */ #endif /* PPP_STATS_SUPPORT */
@ -1622,6 +1622,10 @@ pppos_input(ppp_pcb *pcb, u_char *s, int l)
/* Packet consumed, release our references. */ /* Packet consumed, release our references. */
pcrx->in_head = NULL; pcrx->in_head = NULL;
pcrx->in_tail = 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 PPP_INPROC_MULTITHREADED
if(tcpip_callback_with_block(pppos_input_callback, inp, 0) != ERR_OK) { 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)); 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. */ case PDDATA: /* Process data byte. */
/* Make space to receive processed data. */ /* Make space to receive processed data. */
if (pcrx->in_tail == NULL || pcrx->in_tail->len == PBUF_POOL_BUFSIZE) { if (pcrx->in_tail == NULL || pcrx->in_tail->len == PBUF_POOL_BUFSIZE) {
u16_t pbuf_alloc_len;
if (pcrx->in_tail != NULL) { if (pcrx->in_tail != NULL) {
pcrx->in_tail->tot_len = pcrx->in_tail->len; pcrx->in_tail->tot_len = pcrx->in_tail->len;
if (pcrx->in_tail != pcrx->in_head) { 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. */ /* If we haven't started a packet, we need a packet header. */
pbuf_alloc_len = 0;
#if IP_FORWARD || LWIP_IPV6_FORWARD #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 * the packet is being allocated with enough header space to be
* forwarded (to Ethernet for example). * forwarded (to Ethernet for example).
*/ */
next_pbuf = pbuf_alloc(PBUF_LINK, 0, PBUF_POOL); if (pcrx->in_head == NULL) {
#else /* IP_FORWARD || LWIP_IPV6_FORWARD */ pbuf_alloc_len = PBUF_LINK_HLEN;
next_pbuf = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL); }
#endif /* IP_FORWARD || LWIP_IPV6_FORWARD */ #endif /* IP_FORWARD || LWIP_IPV6_FORWARD */
next_pbuf = pbuf_alloc(PBUF_RAW, pbuf_alloc_len, PBUF_POOL);
if (next_pbuf == NULL) { if (next_pbuf == NULL) {
/* No free buffers. Drop the input packet and let the /* No free buffers. Drop the input packet and let the
* higher layers deal with it. Continue processing * higher layers deal with it. Continue processing
* the received pbuf chain in case a new packet starts. */ * 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); LINK_STATS_INC(link.memerr);
ppp_drop(pcrx); ppp_drop(pcrx);
pcrx->in_state = PDSTART; /* Wait for flag sequence. */ pcrx->in_state = PDSTART; /* Wait for flag sequence. */
break; break;
} }
if (pcrx->in_head == NULL) { if (pcrx->in_head == NULL) {
u8_t *payload; u8_t *payload = ((u8_t*)next_pbuf->payload) + pbuf_alloc_len;
/* 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.
*/
#if PPP_INPROC_MULTITHREADED #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; ((struct pppos_input_header*)payload)->pcb = pcb;
payload += sizeof(struct pppos_input_header); payload += sizeof(struct pppos_input_header);
#else /* PPP_INPROC_MULTITHREADED */ next_pbuf->len += sizeof(struct pppos_input_header);
if (pbuf_header(next_pbuf, +sizeof(pcrx->in_protocol))) {
next_pbuf->len += sizeof(pcrx->in_protocol);
}
payload = next_pbuf->payload;
#endif /* PPP_INPROC_MULTITHREADED */ #endif /* PPP_INPROC_MULTITHREADED */
next_pbuf->len += sizeof(pcrx->in_protocol);
*(payload++) = pcrx->in_protocol >> 8; *(payload++) = pcrx->in_protocol >> 8;
*(payload) = pcrx->in_protocol & 0xFF; *(payload) = pcrx->in_protocol & 0xFF;
pcrx->in_head = next_pbuf; pcrx->in_head = next_pbuf;
@ -1930,6 +1925,7 @@ static void ppp_over_l2tp_open(ppp_pcb *pcb) {
#endif /* PPPOL2TP_SUPPORT */ #endif /* PPPOL2TP_SUPPORT */
void ppp_link_down(ppp_pcb *pcb) { 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)); 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 #if PPPOS_SUPPORT
int i; int i;
#endif /* PPPOS_SUPPORT */ #endif /* PPPOS_SUPPORT */
LWIP_UNUSED_ARG(mtu);
/* pcb->mtu = mtu; -- set correctly with netif_set_mtu */ /* pcb->mtu = mtu; -- set correctly with netif_set_mtu */
pcb->pcomp = pcomp; pcb->pcomp = pcomp;

View File

@ -313,7 +313,7 @@ pppoe_disc_input(struct netif *netif, struct pbuf *pb)
hunique_len = 0; hunique_len = 0;
#endif #endif
session = 0; 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)); PPPDEBUG(LOG_DEBUG, ("pppoe: packet too short: %d\n", pb->len));
goto done; goto done;
} }

View File

@ -189,6 +189,7 @@ static void pppol2tp_input(void *arg, struct udp_pcb *pcb, struct pbuf *p, struc
pppol2tp_pcb *l2tp = (pppol2tp_pcb*)arg; pppol2tp_pcb *l2tp = (pppol2tp_pcb*)arg;
u16_t hflags, hlen, len=0, tunnel_id=0, session_id=0, ns=0, nr=0, offset=0; u16_t hflags, hlen, len=0, tunnel_id=0, session_id=0, ns=0, nr=0, offset=0;
u8_t *inp; u8_t *inp;
LWIP_UNUSED_ARG(pcb);
if (l2tp->phase < PPPOL2TP_STATE_SCCRQ_SENT) { if (l2tp->phase < PPPOL2TP_STATE_SCCRQ_SENT) {
goto free_and_return; 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 md5_hash[16];
u8_t challenge_id = 0; u8_t challenge_id = 0;
#endif /* PPPOL2TP_AUTH_SUPPORT */ #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_nr = nr;
l2tp->peer_ns = ns; l2tp->peer_ns = ns;

View File

@ -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) { static void upap_rauthreq(ppp_pcb *pcb, u_char *inp, int id, int len) {
u_char ruserlen, rpasswdlen; u_char ruserlen, rpasswdlen;
char *ruser, *rpasswd; char *ruser;
#if 0
char *rpasswd;
#endif
char rhostname[256]; char rhostname[256];
int retcode; int retcode;
char *msg; 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 */ /* FIXME: we need a way to check peer secret */
#if 0
rpasswd = (char *) inp; rpasswd = (char *) inp;
/* /*
* Check the username and password given. * Check the username and password given.
*/ */
#if 0
retcode = check_passwd(pcb->upap.us_unit, ruser, ruserlen, rpasswd, retcode = check_passwd(pcb->upap.us_unit, ruser, ruserlen, rpasswd,
rpasswdlen, &msg); rpasswdlen, &msg);
BZERO(rpasswd, rpasswdlen); 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); warn("calling number %q is not authorized", remote_number);
} }
} }
#endif
msglen = strlen(msg); msglen = strlen(msg);
if (msglen > 255) if (msglen > 255)
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); upap_sresp(pcb, retcode, id, msg, msglen);
/* Null terminate and clean remote name. */ /* 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) { static void upap_rauthack(ppp_pcb *pcb, u_char *inp, int id, int len) {
u_char msglen; u_char msglen;
char *msg; char *msg;
LWIP_UNUSED_ARG(id);
if (pcb->upap.us_clientstate != UPAPCS_AUTHREQ) /* XXX */ if (pcb->upap.us_clientstate != UPAPCS_AUTHREQ) /* XXX */
return; 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) { static void upap_rauthnak(ppp_pcb *pcb, u_char *inp, int id, int len) {
u_char msglen; u_char msglen;
char *msg; char *msg;
LWIP_UNUSED_ARG(id);
if (pcb->upap.us_clientstate != UPAPCS_AUTHREQ) /* XXX */ if (pcb->upap.us_clientstate != UPAPCS_AUTHREQ) /* XXX */
return; return;
@ -608,7 +619,7 @@ static int upap_printpkt(u_char *p, int plen, void (*printer) (void *, char *, .
if (len < UPAP_HEADERLEN || len > plen) if (len < UPAP_HEADERLEN || len > plen)
return 0; 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]); printer(arg, " %s", upap_codenames[code-1]);
else else
printer(arg, " code=0x%x", code); printer(arg, " code=0x%x", code);

View File

@ -209,7 +209,7 @@ int ppp_vslprintf(char *buf, int buflen, char *fmt, va_list args) {
val = va_arg(args, long); val = va_arg(args, long);
if ((long)val < 0) { if ((long)val < 0) {
neg = 1; neg = 1;
val = -val; val = (unsigned long)-val;
} }
base = 10; base = 10;
break; 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) { 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) ); PPPDEBUG(level, ("%s\n", buf) );
#if 0 #if 0
if (log_to_fd >= 0 && (level != LOG_DEBUG || debug)) { if (log_to_fd >= 0 && (level != LOG_DEBUG || debug)) {