From 0912877fd7e091ecae27bfcccacca34f394e269d Mon Sep 17 00:00:00 2001 From: likewise Date: Fri, 23 Apr 2004 16:16:48 +0000 Subject: [PATCH] Several fixed from HEAD merged in. --- src/core/inet.c | 5 ++-- src/core/netif.c | 4 ++-- src/core/raw.c | 2 +- src/core/sys.c | 1 + src/include/ipv4/lwip/inet.h | 2 +- src/include/ipv4/lwip/ip_addr.h | 41 ++++++++++++++++++--------------- src/include/lwip/udp.h | 2 -- src/netif/ppp/auth.c | 2 +- src/netif/ppp/chpms.h | 1 - src/netif/ppp/ipcp.c | 14 +++++++++++ src/netif/ppp/vj.h | 2 -- 11 files changed, 45 insertions(+), 31 deletions(-) diff --git a/src/core/inet.c b/src/core/inet.c index 818f7ba9..694cb002 100644 --- a/src/core/inet.c +++ b/src/core/inet.c @@ -300,9 +300,10 @@ inet_chksum_pbuf(struct pbuf *p) /* Convert numeric IP address into decimal dotted ASCII representation. * returns ptr to static buffer; not reentrant! */ -u8_t *inet_ntoa(u32_t addr) +char *inet_ntoa(struct in_addr addr) { static u8_t str[16]; + u32_t s_addr = addr.s_addr; u8_t inv[3]; u8_t *rp; u8_t *ap; @@ -311,7 +312,7 @@ u8_t *inet_ntoa(u32_t addr) u8_t i; rp = str; - ap = (u8_t *)&addr; + ap = (u8_t *)&s_addr; for(n = 0; n < 4; n++) { i = 0; do { diff --git a/src/core/netif.c b/src/core/netif.c index 74480017..91d0afa2 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -172,7 +172,7 @@ netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr) /* address is actually being changed? */ if ((ip_addr_cmp(ipaddr, &(netif->ip_addr))) == 0) { - extern struct tcp_pcb *tcp_active_pcbs; + /* extern struct tcp_pcb *tcp_active_pcbs; defined by tcp.h */ LWIP_DEBUGF(NETIF_DEBUG | 1, ("netif_set_ipaddr: netif address being changed\n")); pcb = tcp_active_pcbs; while (pcb != NULL) { @@ -187,7 +187,7 @@ netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr) pcb = pcb->next; } } - for (lpcb = tcp_listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { + for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { /* PCB bound to current local interface address? */ if (ip_addr_cmp(&(lpcb->local_ip), &(netif->ip_addr))) { /* The PCB is listening to the old ipaddr and diff --git a/src/core/raw.c b/src/core/raw.c index c4c69e54..f5792a4f 100644 --- a/src/core/raw.c +++ b/src/core/raw.c @@ -47,8 +47,8 @@ #include "lwip/def.h" #include "lwip/memp.h" #include "lwip/inet.h" -#include "lwip/netif.h" #include "lwip/ip_addr.h" +#include "lwip/netif.h" #include "lwip/raw.h" #include "lwip/stats.h" diff --git a/src/core/sys.c b/src/core/sys.c index f71425e3..a07a839a 100644 --- a/src/core/sys.c +++ b/src/core/sys.c @@ -174,6 +174,7 @@ sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg) (void *)timeout, msecs, (void *)h, (void *)arg)); LWIP_ASSERT("sys_timeout: timeouts != NULL", timeouts != NULL); + if (timeouts->next == NULL) { timeouts->next = timeout; return; diff --git a/src/include/ipv4/lwip/inet.h b/src/include/ipv4/lwip/inet.h index 01bd8a89..beab8518 100644 --- a/src/include/ipv4/lwip/inet.h +++ b/src/include/ipv4/lwip/inet.h @@ -46,7 +46,7 @@ u16_t inet_chksum_pseudo(struct pbuf *p, u32_t inet_addr(const char *cp); int inet_aton(const char *cp, struct in_addr *addr); -u8_t *inet_ntoa(u32_t addr); /* returns ptr to static buffer; not reentrant! */ +char *inet_ntoa(struct in_addr addr); /* returns ptr to static buffer; not reentrant! */ #ifdef htons #undef htons diff --git a/src/include/ipv4/lwip/ip_addr.h b/src/include/ipv4/lwip/ip_addr.h index 6b142eec..e76d2552 100644 --- a/src/include/ipv4/lwip/ip_addr.h +++ b/src/include/ipv4/lwip/ip_addr.h @@ -34,6 +34,28 @@ #include "lwip/arch.h" +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +struct ip_addr { + PACK_STRUCT_FIELD(u32_t addr); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +/* For compatibility with BSD code */ +struct in_addr { + u32_t s_addr; +}; + +struct netif; + +extern const struct ip_addr ip_addr_any; +extern const struct ip_addr ip_addr_broadcast; + /** IP_ADDR_ can be used as a fixed IP address * for the wildcard and the broadcast address */ @@ -76,25 +98,6 @@ #define IN_LOOPBACKNET 127 /* official! */ -#ifdef PACK_STRUCT_USE_INCLUDES -# include "arch/bpstruct.h" -#endif -PACK_STRUCT_BEGIN -struct ip_addr { - PACK_STRUCT_FIELD(u32_t addr); -} PACK_STRUCT_STRUCT; -PACK_STRUCT_END -#ifdef PACK_STRUCT_USE_INCLUDES -# include "arch/epstruct.h" -#endif - -/* For compatibility with BSD code */ -struct in_addr { - u32_t s_addr; -}; - -extern const struct ip_addr ip_addr_any; -extern const struct ip_addr ip_addr_broadcast; #define IP4_ADDR(ipaddr, a,b,c,d) (ipaddr)->addr = htonl(((u32_t)(a & 0xff) << 24) | ((u32_t)(b & 0xff) << 16) | \ ((u32_t)(c & 0xff) << 8) | (u32_t)(d & 0xff)) diff --git a/src/include/lwip/udp.h b/src/include/lwip/udp.h index 29a548ce..c5485947 100644 --- a/src/include/lwip/udp.h +++ b/src/include/lwip/udp.h @@ -90,9 +90,7 @@ err_t udp_send (struct udp_pcb *pcb, struct pbuf *p); #define udp_flags(pcb) ((pcb)->flags) #define udp_setflags(pcb, f) ((pcb)->flags = (f)) - /* The following functions are the lower layer interface to UDP. */ -u8_t udp_lookup (struct ip_hdr *iphdr, struct netif *inp); void udp_input (struct pbuf *p, struct netif *inp); void udp_init (void); diff --git a/src/netif/ppp/auth.c b/src/netif/ppp/auth.c index 45001336..33349640 100644 --- a/src/netif/ppp/auth.c +++ b/src/netif/ppp/auth.c @@ -610,7 +610,7 @@ int get_secret( addrs = NULL; - if(!client || !client[0] && strcmp(client, ppp_settings.user)) { + if(!client || !client[0] || strcmp(client, ppp_settings.user)) { return 0; } diff --git a/src/netif/ppp/chpms.h b/src/netif/ppp/chpms.h index ea4f8b34..8a48bda0 100644 --- a/src/netif/ppp/chpms.h +++ b/src/netif/ppp/chpms.h @@ -51,7 +51,6 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $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 67c2061b..3da1ba67 100644 --- a/src/netif/ppp/ipcp.c +++ b/src/netif/ppp/ipcp.c @@ -178,6 +178,20 @@ static fsm_callbacks ipcp_callbacks = { /* IPCP callback routines */ /*** LOCAL FUNCTION DEFINITIONS ***/ /**********************************/ +/* + * Non-standard inet_ntoa left here for compat with original ppp + * sources. Assumes u32_t instead of struct in_addr. + */ + +char * _inet_ntoa(u32_t n) +{ + struct in_addr ia; + ia.s_addr = n; + return inet_ntoa(ia); +} + +#define inet_ntoa _inet_ntoa + /* * ipcp_init - Initialize IPCP. */ diff --git a/src/netif/ppp/vj.h b/src/netif/ppp/vj.h index fb080936..0c157c48 100644 --- a/src/netif/ppp/vj.h +++ b/src/netif/ppp/vj.h @@ -1,8 +1,6 @@ /* * Definitions for tcp compression routines. * - * $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. *