From 3c71c378bc02de34ed69ad35fdb4fbda055fd236 Mon Sep 17 00:00:00 2001 From: likewise Date: Fri, 14 Nov 2003 14:56:30 +0000 Subject: [PATCH] An overriden merge from DEVEL to main was needed as small changes had been made to main. --- src/include/ipv4/lwip/inet.h | 16 ++++++++-------- src/include/lwip/opt.h | 6 ++++-- src/netif/loopif.c | 6 +++++- src/netif/ppp/chap.c | 14 +++++++------- src/netif/ppp/chpms.h | 4 ++-- src/netif/ppp/ipcp.c | 8 ++++---- src/netif/ppp/pap.c | 8 ++++---- src/netif/ppp/pppdebug.h | 15 +++++++-------- src/netif/ppp/randm.c | 2 ++ src/netif/ppp/vj.c | 5 ++--- src/netif/ppp/vj.h | 4 ++-- 11 files changed, 47 insertions(+), 41 deletions(-) diff --git a/src/include/ipv4/lwip/inet.h b/src/include/ipv4/lwip/inet.h index 636efb0c..80524a72 100644 --- a/src/include/ipv4/lwip/inet.h +++ b/src/include/ipv4/lwip/inet.h @@ -62,10 +62,10 @@ u8_t *inet_ntoa(u32_t addr); /* returns ptr to static buffer; not reentrant! */ #endif /* ntohl */ #if BYTE_ORDER == BIG_ENDIAN -#define htons(n) (n) -#define ntohs(n) (n) -#define htonl(n) (n) -#define ntohl(n) (n) +#define htons(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define ntohl(x) (x) #else #ifdef LWIP_PREFIX_BYTEORDER_FUNCS /* workaround for naming collisions on some platforms */ @@ -74,10 +74,10 @@ u8_t *inet_ntoa(u32_t addr); /* returns ptr to static buffer; not reentrant! */ #define htonl lwip_htonl #define ntohl lwip_ntohl #endif -u16_t htons(u16_t n); -u16_t ntohs(u16_t n); -u32_t htonl(u32_t n); -u32_t ntohl(u32_t n); +u16_t htons(u16_t x); +u16_t ntohs(u16_t x); +u32_t htonl(u32_t x); +u32_t ntohl(u32_t x); #endif #endif /* __LWIP_INET_H__ */ diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 237bde45..3c887838 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -299,8 +299,10 @@ a lot of data that needs to be copied, this should be set high. */ #define TCP_SNDLOWAT TCP_SND_BUF/2 #endif - - +/* Support loop interface (127.0.0.1) */ +#ifndef LWIP_HAVE_LOOPIF +#define LWIP_HAVE_LOOPIF 1 +#endif #ifndef LWIP_EVENT_API #define LWIP_EVENT_API 0 diff --git a/src/netif/loopif.c b/src/netif/loopif.c index 1a8e2e28..9e7c03a0 100644 --- a/src/netif/loopif.c +++ b/src/netif/loopif.c @@ -29,9 +29,12 @@ * Author: Adam Dunkels * */ -#include "lwip/mem.h" #include "lwip/opt.h" + +#if LWIP_HAVE_LOOPIF + #include "netif/loopif.h" +#include "lwip/mem.h" #if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP) #include "netif/tcpdump.h" @@ -106,6 +109,7 @@ loopif_init(struct netif *netif) return ERR_OK; } +#endif /* LWIP_HAVE_LOOPIF */ diff --git a/src/netif/ppp/chap.c b/src/netif/ppp/chap.c index 3860b671..4d1dc0d2 100644 --- a/src/netif/ppp/chap.c +++ b/src/netif/ppp/chap.c @@ -245,7 +245,7 @@ static void ChapChallengeTimeout(void *arg) if (cstate->chal_transmits >= cstate->max_transmits) { /* give up on peer */ - ppp_trace(LOG_ERR, "Peer failed to respond to CHAP challenge\n"); + CHAPDEBUG((LOG_ERR, "Peer failed to respond to CHAP challenge\n")); cstate->serverstate = CHAPSS_BADAUTH; auth_peer_fail(cstate->unit, PPP_CHAP); return; @@ -405,7 +405,7 @@ static void ChapInput(int unit, u_char *inpacket, int packet_len) break; default: /* Need code reject? */ - ppp_trace(LOG_WARNING, "Unknown CHAP code (%d) received.\n", code); + CHAPDEBUG((LOG_WARNING, "Unknown CHAP code (%d) received.\n", code)); break; } } @@ -466,7 +466,7 @@ static void ChapReceiveChallenge(chap_state *cstate, u_char *inp, int id, int le if (!get_secret(cstate->unit, cstate->resp_name, rhostname, secret, &secret_len, 0)) { secret_len = 0; /* assume null secret if can't find one */ - ppp_trace(LOG_WARNING, "No CHAP secret found for authenticating us to %s\n", rhostname); + CHAPDEBUG((LOG_WARNING, "No CHAP secret found for authenticating us to %s\n", rhostname)); } /* cancel response send timeout if necessary */ @@ -576,8 +576,8 @@ static void ChapReceiveResponse(chap_state *cstate, u_char *inp, int id, int len if (!get_secret(cstate->unit, rhostname, cstate->chal_name, secret, &secret_len, 1)) { /* CHAPDEBUG((LOG_WARNING, TL_CHAP, "No CHAP secret found for authenticating %s\n", rhostname)); */ - ppp_trace(LOG_WARNING, "No CHAP secret found for authenticating %s\n", - rhostname); + CHAPDEBUG((LOG_WARNING, "No CHAP secret found for authenticating %s\n", + rhostname)); } else { /* generate MD based on negotiated type */ @@ -614,7 +614,7 @@ static void ChapReceiveResponse(chap_state *cstate, u_char *inp, int id, int len if (cstate->chal_interval != 0) TIMEOUT(ChapRechallenge, cstate, cstate->chal_interval); } else { - ppp_trace(LOG_ERR, "CHAP peer authentication failed\n"); + CHAPDEBUG((LOG_ERR, "CHAP peer authentication failed\n")); cstate->serverstate = CHAPSS_BADAUTH; auth_peer_fail(cstate->unit, PPP_CHAP); } @@ -675,7 +675,7 @@ static void ChapReceiveFailure(chap_state *cstate, u_char *inp, u_char id, int l if (len > 0) PRINTMSG(inp, len); - ppp_trace(LOG_ERR, "CHAP authentication failed\n"); + CHAPDEBUG((LOG_ERR, "CHAP authentication failed\n")); auth_withpeer_fail(cstate->unit, PPP_CHAP); } diff --git a/src/netif/ppp/chpms.h b/src/netif/ppp/chpms.h index 540d331e..ea4f8b34 100644 --- a/src/netif/ppp/chpms.h +++ b/src/netif/ppp/chpms.h @@ -29,7 +29,7 @@ * Ported to lwIP. * 98-01-30 Guy Lancaster , Global Election Systems Inc. * Original built from BSD network code. -****************************************************************************** +******************************************************************************/ /* * chap.h - Challenge Handshake Authentication Protocol definitions. * @@ -51,7 +51,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: chpms.h,v 1.1 2003/05/27 14:37:56 jani Exp $ + * $Id: chpms.h,v 1.2 2003/11/14 14:56:31 likewise Exp $ */ #ifndef CHPMS_H diff --git a/src/netif/ppp/ipcp.c b/src/netif/ppp/ipcp.c index 59f84447..67c2061b 100644 --- a/src/netif/ppp/ipcp.c +++ b/src/netif/ppp/ipcp.c @@ -1192,12 +1192,12 @@ static void ipcp_up(fsm *f) ho->hisaddr = wo->hisaddr; if (ho->hisaddr == 0) { - ppp_trace(LOG_ERR, "Could not determine remote IP address\n"); + IPCPDEBUG((LOG_ERR, "Could not determine remote IP address\n")); ipcp_close(f->unit, "Could not determine remote IP address"); return; } if (go->ouraddr == 0) { - ppp_trace(LOG_ERR, "Could not determine local IP address\n"); + IPCPDEBUG((LOG_ERR, "Could not determine local IP address\n")); ipcp_close(f->unit, "Could not determine local IP address"); return; } @@ -1210,8 +1210,8 @@ static void ipcp_up(fsm *f) * Check that the peer is allowed to use the IP address it wants. */ if (!auth_ip_addr(f->unit, ho->hisaddr)) { - ppp_trace(LOG_ERR, "Peer is not authorized to use remote address %s\n", - inet_ntoa(ho->hisaddr)); + IPCPDEBUG((LOG_ERR, "Peer is not authorized to use remote address %s\n", + inet_ntoa(ho->hisaddr))); ipcp_close(f->unit, "Unauthorized remote IP address"); return; } diff --git a/src/netif/ppp/pap.c b/src/netif/ppp/pap.c index 1edf1c1e..23e438ff 100644 --- a/src/netif/ppp/pap.c +++ b/src/netif/ppp/pap.c @@ -216,7 +216,7 @@ static void upap_timeout(void *arg) if (u->us_transmits >= u->us_maxtransmits) { /* give up in disgust */ - ppp_trace(LOG_ERR, "No response to PAP authenticate-requests\n"); + UPAPDEBUG((LOG_ERR, "No response to PAP authenticate-requests\n")); u->us_clientstate = UPAPCS_BADAUTH; auth_withpeer_fail(u->us_unit, PPP_PAP); return; @@ -299,11 +299,11 @@ static void upap_protrej(int unit) upap_state *u = &upap[unit]; if (u->us_clientstate == UPAPCS_AUTHREQ) { - ppp_trace(LOG_ERR, "PAP authentication failed due to protocol-reject\n"); + UPAPDEBUG((LOG_ERR, "PAP authentication failed due to protocol-reject\n")); auth_withpeer_fail(unit, PPP_PAP); } if (u->us_serverstate == UPAPSS_LISTEN) { - ppp_trace(LOG_ERR, "PAP authentication of peer failed (protocol-reject)\n"); + UPAPDEBUG((LOG_ERR, "PAP authentication of peer failed (protocol-reject)\n")); auth_peer_fail(unit, PPP_PAP); } upap_lowerdown(unit); @@ -518,7 +518,7 @@ static void upap_rauthnak( u->us_clientstate = UPAPCS_BADAUTH; - ppp_trace(LOG_ERR, "PAP authentication failed\n"); + UPAPDEBUG((LOG_ERR, "PAP authentication failed\n")); auth_withpeer_fail(u->us_unit, PPP_PAP); } diff --git a/src/netif/ppp/pppdebug.h b/src/netif/ppp/pppdebug.h index 5761bbc7..de1478ce 100644 --- a/src/netif/ppp/pppdebug.h +++ b/src/netif/ppp/pppdebug.h @@ -61,14 +61,13 @@ void ppp_trace(int level, const char *format,...); #if PPP_DEBUG > 0 -#define AUTHDEBUG(a) ppp_trace##a -#define IPCPDEBUG(a) ppp_trace##a -#define UPAPDEBUG(a) ppp_trace##a -#define LCPDEBUG(a) ppp_trace##a -#define FSMDEBUG(a) ppp_trace##a -#define CHAPDEBUG(a) ppp_trace##a - -#define PPPDEBUG(a) ppp_trace##a +#define AUTHDEBUG(a) ppp_trace a +#define IPCPDEBUG(a) ppp_trace a +#define UPAPDEBUG(a) ppp_trace a +#define LCPDEBUG(a) ppp_trace a +#define FSMDEBUG(a) ppp_trace a +#define CHAPDEBUG(a) ppp_trace a +#define PPPDEBUG(a) ppp_trace a #define TRACELCP 1 diff --git a/src/netif/ppp/randm.c b/src/netif/ppp/randm.c index f813178f..05eeb441 100644 --- a/src/netif/ppp/randm.c +++ b/src/netif/ppp/randm.c @@ -32,6 +32,7 @@ *****************************************************************************/ #include "ppp.h" +#if PPP_SUPPORT > 0 #include "md5.h" #include "randm.h" @@ -237,4 +238,5 @@ u32_t avRandom() #endif /* MD5_SUPPORT */ +#endif /* PPP_SUPPORT */ diff --git a/src/netif/ppp/vj.c b/src/netif/ppp/vj.c index 8ea66a29..7615bb5b 100644 --- a/src/netif/ppp/vj.c +++ b/src/netif/ppp/vj.c @@ -35,7 +35,7 @@ #if VJ_SUPPORT > 0 -#ifdef LINK_STATS +#if LINK_STATS #define INCR(counter) ++comp->stats.counter #else #define INCR(counter) @@ -611,8 +611,7 @@ int vj_uncompress_tcp( *nb = NULL; goto bad; } - pbuf_chain(np, n0); - pbuf_free(n0); + pbuf_cat(np, n0); n0 = np; } LWIP_ASSERT("n0->len >= cs->cs_hlen", n0->len >= cs->cs_hlen); diff --git a/src/netif/ppp/vj.h b/src/netif/ppp/vj.h index e5b60056..fb080936 100644 --- a/src/netif/ppp/vj.h +++ b/src/netif/ppp/vj.h @@ -1,7 +1,7 @@ /* * Definitions for tcp compression routines. * - * $Id: vj.h,v 1.2 2003/06/02 11:12:56 jani Exp $ + * $Id: vj.h,v 1.3 2003/11/14 14:56:31 likewise Exp $ * * Copyright (c) 1989 Regents of the University of California. * All rights reserved. @@ -136,7 +136,7 @@ struct vjcompress { u_short flags; u_char maxSlotIndex; u_char compressSlot; /* Flag indicating OK to compress slot ID. */ -#ifdef LINK_STATS +#if LINK_STATS struct vjstat stats; #endif struct cstate tstate[MAX_SLOTS]; /* xmit connection states */