diff --git a/CHANGELOG b/CHANGELOG index a25d4fe4..8f7ce1bd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -145,12 +145,11 @@ HISTORY ++ Bugfixes: - 2013-04-26: Sylvain Rochet - * dhcp.c, reverted from DOS (CRLF) to UNIX format (LF), it was saved in DOS format - by mistake the 2012-09-26 + 2013-06-29: Simon Goldschmidt + * inet.h, sockets.h: partially fixed bug #37585: IPv6 compatibility (in socket structs) - 2013-04-26: Sylvain Rochet - * ip6.h, cleared compilation warning, C++ style comments are not allowed in ISO C90 + 2013-06-29: Simon Goldschmidt + * inet6.h: bug #37585/task #12600: fixed struct in6_addr.s6_addr to conform to spec 2013-04-24: patch by Liam * api_msg.c: patch #8008 Fix a potential null pointer dereference in assert diff --git a/src/core/tcp.c b/src/core/tcp.c index a0cbb159..8690cd24 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -667,7 +667,7 @@ tcp_recved(struct tcp_pcb *pcb, u16_t len) tcp_output(pcb); } - LWIP_DEBUGF(TCP_DEBUG, ("tcp_recved: recveived %"U16_F" bytes, wnd %"U16_F" (%"U16_F").\n", + LWIP_DEBUGF(TCP_DEBUG, ("tcp_recved: received %"U16_F" bytes, wnd %"U16_F" (%"U16_F").\n", len, pcb->rcv_wnd, TCP_WND - pcb->rcv_wnd)); } diff --git a/src/include/ipv4/lwip/inet.h b/src/include/ipv4/lwip/inet.h index 7bff49b5..ec6d0909 100644 --- a/src/include/ipv4/lwip/inet.h +++ b/src/include/ipv4/lwip/inet.h @@ -40,9 +40,14 @@ extern "C" { #endif +/* If your port already typedef's in_addr_t, define IN_ADDR_T_DEFINED + to prevent this code from redefining it. */ +#if !defined(in_addr_t) && !defined(IN_ADDR_T_DEFINED) +typedef u32_t in_addr_t; +#endif /** For compatibility with BSD code */ struct in_addr { - u32_t s_addr; + in_addr_t s_addr; }; /** 255.255.255.255 */ diff --git a/src/include/ipv6/lwip/inet6.h b/src/include/ipv6/lwip/inet6.h index dbf98df0..8359521b 100644 --- a/src/include/ipv6/lwip/inet6.h +++ b/src/include/ipv6/lwip/inet6.h @@ -58,7 +58,7 @@ struct in6_addr { u8_t u8_addr[16]; u32_t u32_addr[4]; } un; -#define s6_addr un.u32_addr +#define s6_addr un.u8_addr }; #define IN6ADDR_ANY_INIT {0,0,0,0} diff --git a/src/include/ipv6/lwip/ip6.h b/src/include/ipv6/lwip/ip6.h index 027a20be..ac32ceec 100644 --- a/src/include/ipv6/lwip/ip6.h +++ b/src/include/ipv6/lwip/ip6.h @@ -45,7 +45,6 @@ #if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ -/* #include "lwip/ip.h" */ #include "lwip/ip6_addr.h" #include "lwip/def.h" #include "lwip/pbuf.h" diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h index 73461374..4d6e055a 100644 --- a/src/include/lwip/sockets.h +++ b/src/include/lwip/sockets.h @@ -48,33 +48,54 @@ extern "C" { #endif +/* If your port already typedef's sa_family_t, define SA_FAMILY_T_DEFINED + to prevent this code from redefining it. */ +#if !defined(sa_family_t) && !defined(SA_FAMILY_T_DEFINED) +typedef u8_t sa_family_t; +#endif +/* If your port already typedef's in_port_t, define IN_PORT_T_DEFINED + to prevent this code from redefining it. */ +#if !defined(in_port_t) && !defined(IN_PORT_T_DEFINED) +typedef u16_t in_port_t; +#endif + /* members are in network byte order */ struct sockaddr_in { - u8_t sin_len; - u8_t sin_family; - u16_t sin_port; - struct in_addr sin_addr; + u8_t sin_len; + sa_family_t sin_family; + in_port_t sin_port; + struct in_addr sin_addr; #define SIN_ZERO_LEN 8 - char sin_zero[SIN_ZERO_LEN]; + char sin_zero[SIN_ZERO_LEN]; }; #if LWIP_IPV6 struct sockaddr_in6 { - u8_t sin6_len; /* length of this structure */ - u8_t sin6_family; /* AF_INET6 */ - u16_t sin6_port; /* Transport layer port # */ - u32_t sin6_flowinfo; /* IPv6 flow information */ - struct in6_addr sin6_addr; /* IPv6 address */ + u8_t sin6_len; /* length of this structure */ + sa_family_t sin6_family; /* AF_INET6 */ + in_port_t sin6_port; /* Transport layer port # */ + u32_t sin6_flowinfo; /* IPv6 flow information */ + struct in6_addr sin6_addr; /* IPv6 address */ }; #endif /* LWIP_IPV6 */ struct sockaddr { - u8_t sa_len; - u8_t sa_family; + u8_t sa_len; + sa_family_t sa_family; #if LWIP_IPV6 - u8_t sa_data[22]; + char sa_data[22]; #else /* LWIP_IPV6 */ - u8_t sa_data[14]; + char sa_data[14]; +#endif /* LWIP_IPV6 */ +}; + +struct sockaddr_storage { + u8_t s2_len; + sa_family_t ss_family; + char s2_data1[2]; + u32_t s2_data2[3]; +#if LWIP_IPV6 + u32_t s2_data3[2]; #endif /* LWIP_IPV6 */ };