summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/if.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/if.c b/lib/if.c
index ecf9ff90..e3107116 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -205,7 +205,8 @@ ifname2ifindex (const char *name)
{
struct interface *ifp;
- return ((ifp = if_lookup_by_name(name)) != NULL) ? ifp->ifindex : 0;
+ return ((ifp = if_lookup_by_name(name)) != NULL) ? ifp->ifindex
+ : IFINDEX_INTERNAL;
}
/* Interface existance check by interface name. */
@@ -214,12 +215,13 @@ if_lookup_by_name (const char *name)
{
struct listnode *node;
struct interface *ifp;
-
- for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
- {
- if (strcmp(name, ifp->name) == 0)
- return ifp;
- }
+
+ if (name)
+ for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+ {
+ if (strcmp(name, ifp->name) == 0)
+ return ifp;
+ }
return NULL;
}