lowpan6_ble: fix compiling with LWIP_RFC7668_NUM_CONTEXTS==0

This commit is contained in:
goldsimon 2018-02-24 11:39:31 +01:00
parent 2ce3c79ec5
commit a3034a442b

View File

@ -152,6 +152,8 @@ rfc7668_context_lookup(const ip6_addr_t *ip6addr)
return i; return i;
} }
} }
#else
LWIP_UNUSED_ARG(ip6addr);
#endif #endif
/* no address found, return -1 */ /* no address found, return -1 */
return -1; return -1;
@ -461,7 +463,7 @@ rfc7668_frag(struct netif *netif, struct pbuf *p, const ip6_addr_t * src, const
* @return ERR_OK (if everything is fine), ERR_ARG (if the context id is out of range), ERR_VAL (if contexts disabled) * @return ERR_OK (if everything is fine), ERR_ARG (if the context id is out of range), ERR_VAL (if contexts disabled)
*/ */
err_t err_t
rfc7668_set_context(u8_t idx, const ip6_addr_t * context) rfc7668_set_context(u8_t idx, const ip6_addr_t *context)
{ {
#if LWIP_RFC7668_NUM_CONTEXTS > 0 #if LWIP_RFC7668_NUM_CONTEXTS > 0
/* check if the ID is possible */ /* check if the ID is possible */
@ -472,6 +474,8 @@ rfc7668_set_context(u8_t idx, const ip6_addr_t * context)
ip6_addr_set(&rfc7668_context[idx], context); ip6_addr_set(&rfc7668_context[idx], context);
return ERR_OK; return ERR_OK;
#else #else
LWIP_UNUSED_ARG(idx);
LWIP_UNUSED_ARG(context);
return ERR_VAL; return ERR_VAL;
#endif #endif
} }
@ -669,10 +673,12 @@ rfc7668_decompress(struct pbuf * p, const ip6_addr_t * src, const ip6_addr_t * d
pbuf_free(q); pbuf_free(q);
return NULL; return NULL;
} }
#if LWIP_RFC7668_NUM_CONTEXTS > 0
/* load prefix from context storage */ /* load prefix from context storage */
ip6hdr->src.addr[0] = rfc7668_context[j].addr[0]; ip6hdr->src.addr[0] = rfc7668_context[j].addr[0];
ip6hdr->src.addr[1] = rfc7668_context[j].addr[1]; ip6hdr->src.addr[1] = rfc7668_context[j].addr[1];
LWIP_DEBUGF(LWIP_RFC7668_DEBUG|LWIP_RFC7668_DECOMPRESSION_DEBUG,("SAM == xx, context compression found @%d: %8X, %8X\n", j, ip6hdr->src.addr[0], ip6hdr->src.addr[1])); LWIP_DEBUGF(LWIP_RFC7668_DEBUG|LWIP_RFC7668_DECOMPRESSION_DEBUG,("SAM == xx, context compression found @%d: %8X, %8X\n", j, ip6hdr->src.addr[0], ip6hdr->src.addr[1]));
#endif
} }
/* determine further address bits */ /* determine further address bits */
@ -756,9 +762,10 @@ rfc7668_decompress(struct pbuf * p, const ip6_addr_t * src, const ip6_addr_t * d
pbuf_free(q); pbuf_free(q);
return NULL; return NULL;
} }
#if LWIP_RFC7668_NUM_CONTEXTS > 0
ip6hdr->dest.addr[0] = rfc7668_context[j].addr[0]; ip6hdr->dest.addr[0] = rfc7668_context[j].addr[0];
ip6hdr->dest.addr[1] = rfc7668_context[j].addr[1]; ip6hdr->dest.addr[1] = rfc7668_context[j].addr[1];
#endif
} else { } else {
LWIP_DEBUGF(LWIP_RFC7668_DEBUG|LWIP_RFC7668_DECOMPRESSION_DEBUG,("DAC == 0, stateless compression, setting link local prefix\n")); LWIP_DEBUGF(LWIP_RFC7668_DEBUG|LWIP_RFC7668_DECOMPRESSION_DEBUG,("DAC == 0, stateless compression, setting link local prefix\n"));
/* Link local address compression */ /* Link local address compression */