From fe2cfe2dbaa39b20a556b167c165e24663499705 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 18 Jan 2016 22:46:35 +0800 Subject: [PATCH] raw: Fix build error IP6_HLEN is only defined when LWIP_IPV6, IP_HLEN is only defined when LWIP_IPV4. This fixes build error in !LWIP_IPV4 || !LWIP_IPV6 cases. Fixes: f2c7e9c939ed ("raw: Remove unnecessary #if guard around PCB_ISIPV6() calls") Reported-by: Erik Ekman Signed-off-by: Axel Lin --- src/core/raw.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/raw.c b/src/core/raw.c index 2ba7dfa1..0e0bce2f 100644 --- a/src/core/raw.c +++ b/src/core/raw.c @@ -246,7 +246,14 @@ raw_sendto(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr) LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_TRACE, ("raw_sendto\n")); - header_size = PCB_ISIPV6(pcb) ? IP6_HLEN : IP_HLEN; + header_size = ( +#if LWIP_IPV4 && LWIP_IPV6 + PCB_ISIPV6(pcb) ? IP6_HLEN : IP_HLEN); +#elif LWIP_IPV4 + IP_HLEN); +#else + IP6_HLEN); +#endif /* not enough space to add an IP header to first pbuf in given p chain? */ if (pbuf_header(p, header_size)) {