Applied patch #5832 from Tai-hwa Liang to keep ipv6 building.

This commit is contained in:
jifl 2007-04-10 13:18:14 +00:00
parent 35893e36dd
commit 712a22e18c
4 changed files with 65 additions and 42 deletions

View File

@ -103,7 +103,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
LWIP_DEBUGF(IP_DEBUG, ("ip_input: no forwarding route found for ")); LWIP_DEBUGF(IP_DEBUG, ("ip_input: no forwarding route found for "));
#if IP_DEBUG #if IP_DEBUG
ip_addr_debug_print(IP_DEBUG, &(iphdr->dest)); ip_addr_debug_print(IP_DEBUG, ((struct ip_addr *)&(iphdr->dest)));
#endif /* IP_DEBUG */ #endif /* IP_DEBUG */
LWIP_DEBUGF(IP_DEBUG, ("\n")); LWIP_DEBUGF(IP_DEBUG, ("\n"));
pbuf_free(p); pbuf_free(p);
@ -129,7 +129,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
LWIP_DEBUGF(IP_DEBUG, ("ip_forward: forwarding packet to ")); LWIP_DEBUGF(IP_DEBUG, ("ip_forward: forwarding packet to "));
#if IP_DEBUG #if IP_DEBUG
ip_addr_debug_print(IP_DEBUG, &(iphdr->dest)); ip_addr_debug_print(IP_DEBUG, ((struct ip_addr *)&(iphdr->dest)));
#endif /* IP_DEBUG */ #endif /* IP_DEBUG */
LWIP_DEBUGF(IP_DEBUG, ("\n")); LWIP_DEBUGF(IP_DEBUG, ("\n"));
@ -191,9 +191,9 @@ ip_input(struct pbuf *p, struct netif *inp) {
for(netif = netif_list; netif != NULL; netif = netif->next) { for(netif = netif_list; netif != NULL; netif = netif->next) {
#if IP_DEBUG #if IP_DEBUG
LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest ")); LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest "));
ip_addr_debug_print(IP_DEBUG, &(iphdr->dest)); ip_addr_debug_print(IP_DEBUG, ((struct ip_addr *)&(iphdr->dest)));
LWIP_DEBUGF(IP_DEBUG, ("netif->ip_addr ")); LWIP_DEBUGF(IP_DEBUG, ("netif->ip_addr "));
ip_addr_debug_print(IP_DEBUG, &(netif->ip_addr)); ip_addr_debug_print(IP_DEBUG, ((struct ip_addr *)&(iphdr->dest)));
LWIP_DEBUGF(IP_DEBUG, ("\n")); LWIP_DEBUGF(IP_DEBUG, ("\n"));
#endif /* IP_DEBUG */ #endif /* IP_DEBUG */
if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr))) { if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr))) {
@ -227,10 +227,10 @@ ip_input(struct pbuf *p, struct netif *inp) {
switch (iphdr->nexthdr) { switch (iphdr->nexthdr) {
case IP_PROTO_UDP: case IP_PROTO_UDP:
udp_input(p); udp_input(p, inp);
break; break;
case IP_PROTO_TCP: case IP_PROTO_TCP:
tcp_input(p); tcp_input(p, inp);
break; break;
case IP_PROTO_ICMP: case IP_PROTO_ICMP:
icmp_input(p, inp); icmp_input(p, inp);
@ -341,9 +341,6 @@ void
ip_debug_print(struct pbuf *p) ip_debug_print(struct pbuf *p)
{ {
struct ip_hdr *iphdr = p->payload; struct ip_hdr *iphdr = p->payload;
u8_t *payload;
payload = (u8_t *)iphdr + IP_HLEN;
LWIP_DEBUGF(IP_DEBUG, ("IP header:\n")); LWIP_DEBUGF(IP_DEBUG, ("IP header:\n"));
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
@ -358,29 +355,29 @@ ip_debug_print(struct pbuf *p)
iphdr->hoplim)); iphdr->hoplim));
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n", LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n",
ntohl(iphdr->src.addr[0]) >> 16 & 0xffff, (ntohl(iphdr->src.addr[0]) >> 16) & 0xffff,
ntohl(iphdr->src.addr[0]) & 0xffff)); ntohl(iphdr->src.addr[0]) & 0xffff));
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n", LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n",
ntohl(iphdr->src.addr[1]) >> 16 & 0xffff, (ntohl(iphdr->src.addr[1]) >> 16) & 0xffff,
ntohl(iphdr->src.addr[1]) & 0xffff)); ntohl(iphdr->src.addr[1]) & 0xffff));
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n", LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n",
ntohl(iphdr->src.addr[2]) >> 16 & 0xffff, (ntohl(iphdr->src.addr[2]) >> 16) & 0xffff,
ntohl(iphdr->src.addr[2]) & 0xffff)); ntohl(iphdr->src.addr[2]) & 0xffff));
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n", LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n",
ntohl(iphdr->src.addr[3]) >> 16 & 0xffff, (ntohl(iphdr->src.addr[3]) >> 16) & 0xffff,
ntohl(iphdr->src.addr[3]) & 0xffff)); ntohl(iphdr->src.addr[3]) & 0xffff));
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n", LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n",
ntohl(iphdr->dest.addr[0]) >> 16 & 0xffff, (ntohl(iphdr->dest.addr[0]) >> 16) & 0xffff,
ntohl(iphdr->dest.addr[0]) & 0xffff)); ntohl(iphdr->dest.addr[0]) & 0xffff));
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n", LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n",
ntohl(iphdr->dest.addr[1]) >> 16 & 0xffff, (ntohl(iphdr->dest.addr[1]) >> 16) & 0xffff,
ntohl(iphdr->dest.addr[1]) & 0xffff)); ntohl(iphdr->dest.addr[1]) & 0xffff));
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n", LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n",
ntohl(iphdr->dest.addr[2]) >> 16 & 0xffff, (ntohl(iphdr->dest.addr[2]) >> 16) & 0xffff,
ntohl(iphdr->dest.addr[2]) & 0xffff)); ntohl(iphdr->dest.addr[2]) & 0xffff));
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n", LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n",
ntohl(iphdr->dest.addr[3]) >> 16 & 0xffff, (ntohl(iphdr->dest.addr[3]) >> 16) & 0xffff,
ntohl(iphdr->dest.addr[3]) & 0xffff)); ntohl(iphdr->dest.addr[3]) & 0xffff));
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
} }

View File

@ -30,6 +30,7 @@
* *
*/ */
#include "lwip/opt.h"
#include "lwip/ip_addr.h" #include "lwip/ip_addr.h"
#include "lwip/inet.h" #include "lwip/inet.h"
@ -70,21 +71,3 @@ ip_addr_isany(struct ip_addr *addr)
if (addr == NULL) return 1; if (addr == NULL) return 1;
return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) == 0); return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) == 0);
} }
/*#if IP_DEBUG*/
void
ip_addr_debug_print(struct ip_addr *addr)
{
printf("%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F",
ntohl(addr->addr[0]) >> 16 & 0xffff,
ntohl(addr->addr[0]) & 0xffff,
ntohl(addr->addr[1]) >> 16 & 0xffff,
ntohl(addr->addr[1]) & 0xffff,
ntohl(addr->addr[2]) >> 16 & 0xffff,
ntohl(addr->addr[2]) & 0xffff,
ntohl(addr->addr[3]) >> 16 & 0xffff,
ntohl(addr->addr[3]) & 0xffff);
}
/*#endif*/ /* IP_DEBUG */

View File

@ -54,6 +54,19 @@
#endif /* IP_HDRINCL */ #endif /* IP_HDRINCL */
#define IP_HDRINCL NULL #define IP_HDRINCL NULL
/* This is the common part of all PCB types. It needs to be at the
beginning of a PCB type definition. It is located here so that
changes to this common part are made in one location instead of
having to change all PCB structs. */
#define IP_PCB struct ip_addr local_ip; \
struct ip_addr remote_ip; \
/* Socket options */ \
u16_t so_options; \
/* Type Of Service */ \
u8_t tos; \
/* Time To Live */ \
u8_t ttl
/* The IPv6 header. */ /* The IPv6 header. */
struct ip_hdr { struct ip_hdr {

View File

@ -36,9 +36,33 @@
#define IP_ADDR_ANY 0 #define IP_ADDR_ANY 0
struct ip_addr { #ifdef PACK_STRUCT_USE_INCLUDES
u32_t addr[4]; # include "arch/bpstruct.h"
}; #endif
PACK_STRUCT_BEGIN
struct ip_addr {
PACK_STRUCT_FIELD(u32_t addr[4]);
} PACK_STRUCT_STRUCT;
PACK_STRUCT_END
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/epstruct.h"
#endif
/*
* struct ipaddr2 is used in the definition of the ARP packet format in
* order to support compilers that don't have structure packing.
*/
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/bpstruct.h"
#endif
PACK_STRUCT_BEGIN
struct ip_addr2 {
PACK_STRUCT_FIELD(u16_t addrw[2]);
} PACK_STRUCT_STRUCT;
PACK_STRUCT_END
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/epstruct.h"
#endif
#define IP6_ADDR(ipaddr, a,b,c,d,e,f,g,h) do { (ipaddr)->addr[0] = htonl((u32_t)((a & 0xffff) << 16) | (b & 0xffff)); \ #define IP6_ADDR(ipaddr, a,b,c,d,e,f,g,h) do { (ipaddr)->addr[0] = htonl((u32_t)((a & 0xffff) << 16) | (b & 0xffff)); \
(ipaddr)->addr[1] = htonl(((c & 0xffff) << 16) | (d & 0xffff)); \ (ipaddr)->addr[1] = htonl(((c & 0xffff) << 16) | (d & 0xffff)); \
@ -51,9 +75,15 @@ u8_t ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2);
void ip_addr_set(struct ip_addr *dest, struct ip_addr *src); void ip_addr_set(struct ip_addr *dest, struct ip_addr *src);
u8_t ip_addr_isany(struct ip_addr *addr); u8_t ip_addr_isany(struct ip_addr *addr);
#define ip_addr_debug_print(debug, ipaddr) \
#if IP_DEBUG LWIP_DEBUGF(debug, ("%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F"\n", \
void ip_addr_debug_print(struct ip_addr *addr); (ntohl(ipaddr->addr[0]) >> 16) & 0xffff, \
#endif /* IP_DEBUG */ ntohl(ipaddr->addr[0]) & 0xffff, \
(ntohl(ipaddr->addr[1]) >> 16) & 0xffff, \
ntohl(ipaddr->addr[1]) & 0xffff, \
(ntohl(ipaddr->addr[2]) >> 16) & 0xffff, \
ntohl(ipaddr->addr[2]) & 0xffff, \
(ntohl(ipaddr->addr[3]) >> 16) & 0xffff, \
ntohl(ipaddr->addr[3]) & 0xffff));
#endif /* __LWIP_IP_ADDR_H__ */ #endif /* __LWIP_IP_ADDR_H__ */