api:if: Handle case when LWIP_NETIF_API is not defined

When LWIP_NETIF_API is not enabled in lwipopts.h. Return error from if
APIs

Signed-off-by: Ajay Bhargav <contact@rickeyworld.info>
This commit is contained in:
Ajay Bhargav 2017-01-23 09:26:57 -06:00 committed by Joel Cunningham
parent e158f87286
commit b5011e7012

View File

@ -45,6 +45,7 @@
char *
lwip_if_indextoname(unsigned ifindex, char *ifname)
{
#if LWIP_NETIF_API
err_t err;
if (ifindex > 0xff) {
return NULL;
@ -54,12 +55,17 @@ lwip_if_indextoname(unsigned ifindex, char *ifname)
if (!err && ifname[0] != '\0') {
return ifname;
}
#else /* LWIP_NETIF_API */
LWIP_UNUSED_ARG(ifindex);
LWIP_UNUSED_ARG(ifname);
#endif /* LWIP_NETIF_API */
return NULL;
}
unsigned int
lwip_if_nametoindex(const char *ifname)
{
#if LWIP_NETIF_API
err_t err;
u8_t index;
@ -67,6 +73,9 @@ lwip_if_nametoindex(const char *ifname)
if (!err) {
return index;
}
#else /* LWIP_NETIF_API */
LWIP_UNUSED_ARG(ifname);
#endif /* LWIP_NETIF_API */
return 0; /* invalid index */
}