mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-27 06:14:09 +00:00
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:
parent
e158f87286
commit
b5011e7012
@ -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 */
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user