* if.c: (if_lookup_by_name) shouldn't crash just cause we got a NULL 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. */
{
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;
}