mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-28 09:19:53 +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 *
|
char *
|
||||||
lwip_if_indextoname(unsigned ifindex, char *ifname)
|
lwip_if_indextoname(unsigned ifindex, char *ifname)
|
||||||
{
|
{
|
||||||
|
#if LWIP_NETIF_API
|
||||||
err_t err;
|
err_t err;
|
||||||
if (ifindex > 0xff) {
|
if (ifindex > 0xff) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -54,12 +55,17 @@ lwip_if_indextoname(unsigned ifindex, char *ifname)
|
|||||||
if (!err && ifname[0] != '\0') {
|
if (!err && ifname[0] != '\0') {
|
||||||
return ifname;
|
return ifname;
|
||||||
}
|
}
|
||||||
|
#else /* LWIP_NETIF_API */
|
||||||
|
LWIP_UNUSED_ARG(ifindex);
|
||||||
|
LWIP_UNUSED_ARG(ifname);
|
||||||
|
#endif /* LWIP_NETIF_API */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
lwip_if_nametoindex(const char *ifname)
|
lwip_if_nametoindex(const char *ifname)
|
||||||
{
|
{
|
||||||
|
#if LWIP_NETIF_API
|
||||||
err_t err;
|
err_t err;
|
||||||
u8_t index;
|
u8_t index;
|
||||||
|
|
||||||
@ -67,6 +73,9 @@ lwip_if_nametoindex(const char *ifname)
|
|||||||
if (!err) {
|
if (!err) {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
#else /* LWIP_NETIF_API */
|
||||||
|
LWIP_UNUSED_ARG(ifname);
|
||||||
|
#endif /* LWIP_NETIF_API */
|
||||||
return 0; /* invalid index */
|
return 0; /* invalid index */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user