diff --git a/src/include/ipv4/lwip/ip.h b/src/include/ipv4/lwip/ip.h index bc3a4e19..dc50b73d 100644 --- a/src/include/ipv4/lwip/ip.h +++ b/src/include/ipv4/lwip/ip.h @@ -56,10 +56,10 @@ err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, #define IP_HLEN 20 -#define IP_PROTO_ICMP 1 -#define IP_PROTO_UDP 17 +#define IP_PROTO_ICMP 1 +#define IP_PROTO_UDP 17 #define IP_PROTO_UDPLITE 136 -#define IP_PROTO_TCP 6 +#define IP_PROTO_TCP 6 /* This is passed as the destination address to ip_output_if (not to ip_output), meaning that an IP header already is constructed @@ -69,6 +69,11 @@ err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, #endif /* IP_HDRINCL */ #define IP_HDRINCL NULL +#if LWIP_NETIF_HWADDRHINT +#define IP_PCB_ADDRHINT ;u8_t addr_hint +#else +#define IP_PCB_ADDRHINT +#endif /* LWIP_NETIF_HWADDRHINT */ /* 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 @@ -83,27 +88,24 @@ err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, /* Type Of Service */ \ u8_t tos; \ /* Time To Live */ \ - u8_t ttl; \ -#if LWIP_NETIF_HWADDRHINT + u8_t ttl \ /* link layer address resolution hint */ \ - u8_t addr_hint -#endif /* LWIP_NETIF_HWADDRHINT */ + IP_PCB_ADDRHINT /* * Option flags per-socket. These are the same like SO_XXX. */ -#define SOF_DEBUG (u16_t)0x0001U /* turn on debugging info recording */ +#define SOF_DEBUG (u16_t)0x0001U /* turn on debugging info recording */ #define SOF_ACCEPTCONN (u16_t)0x0002U /* socket has had listen() */ -#define SOF_REUSEADDR (u16_t)0x0004U /* allow local address reuse */ -#define SOF_KEEPALIVE (u16_t)0x0008U /* keep connections alive */ -#define SOF_DONTROUTE (u16_t)0x0010U /* just use interface addresses */ -#define SOF_BROADCAST (u16_t)0x0020U /* permit sending of broadcast msgs */ +#define SOF_REUSEADDR (u16_t)0x0004U /* allow local address reuse */ +#define SOF_KEEPALIVE (u16_t)0x0008U /* keep connections alive */ +#define SOF_DONTROUTE (u16_t)0x0010U /* just use interface addresses */ +#define SOF_BROADCAST (u16_t)0x0020U /* permit sending of broadcast msgs */ #define SOF_USELOOPBACK (u16_t)0x0040U /* bypass hardware when possible */ #define SOF_LINGER (u16_t)0x0080U /* linger on close if data present */ -#define SOF_OOBINLINE (u16_t)0x0100U /* leave received OOB data in line */ -#define SOF_REUSEPORT (u16_t)0x0200U /* allow local address & port reuse */ - +#define SOF_OOBINLINE (u16_t)0x0100U /* leave received OOB data in line */ +#define SOF_REUSEPORT (u16_t)0x0200U /* allow local address & port reuse */ #ifdef PACK_STRUCT_USE_INCLUDES diff --git a/src/include/ipv6/lwip/ip.h b/src/include/ipv6/lwip/ip.h index bfb60533..f6e59cc6 100644 --- a/src/include/ipv6/lwip/ip.h +++ b/src/include/ipv6/lwip/ip.h @@ -45,10 +45,10 @@ extern "C" { #define IP_HLEN 40 -#define IP_PROTO_ICMP 58 -#define IP_PROTO_UDP 17 +#define IP_PROTO_ICMP 58 +#define IP_PROTO_UDP 17 #define IP_PROTO_UDPLITE 136 -#define IP_PROTO_TCP 6 +#define IP_PROTO_TCP 6 /* This is passed as the destination address to ip_output_if (not to ip_output), meaning that an IP header already is constructed @@ -58,6 +58,12 @@ extern "C" { #endif /* IP_HDRINCL */ #define IP_HDRINCL NULL +#if LWIP_NETIF_HWADDRHINT +#define IP_PCB_ADDRHINT ;u8_t addr_hint +#else +#define IP_PCB_ADDRHINT +#endif /* LWIP_NETIF_HWADDRHINT */ + /* 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 @@ -70,10 +76,8 @@ extern "C" { u8_t tos; \ /* Time To Live */ \ u8_t ttl; \ -#if LWIP_NETIF_HWADDRHINT /* link layer address resolution hint */ \ - u8_t addr_hint -#endif /* LWIP_NETIF_HWADDRHINT */ + IP_PCB_ADDRHINT /* The IPv6 header. */ diff --git a/src/netif/etharp.c b/src/netif/etharp.c index 191a6caf..fa379b6a 100644 --- a/src/netif/etharp.c +++ b/src/netif/etharp.c @@ -116,8 +116,8 @@ static u8_t etharp_cached_entry = 0; #define ETHARP_FIND_ONLY 2 #if LWIP_NETIF_HWADDRHINT -#define NETIF_SET_HINT(netif, hint) (((netif) != NULL) && ((netif)->addr_hint != NULL)) ? \ - *((netif)->addr_hint) = (hint) : LWIP_UNUSED_ARG(hint) ; +#define NETIF_SET_HINT(netif, hint) if (((netif) != NULL) && ((netif)->addr_hint != NULL)) \ + *((netif)->addr_hint) = (hint); static s8_t find_entry(struct ip_addr *ipaddr, u8_t flags, struct netif *netif); #else /* LWIP_NETIF_HWADDRHINT */ static s8_t find_entry(struct ip_addr *ipaddr, u8_t flags);