]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: don't protodown a NULL interface
authorQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 14 Mar 2019 19:51:32 +0000 (19:51 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 17 May 2019 00:27:08 +0000 (00:27 +0000)
We were running into some problems where VRRP is trying to protodown
interfaces that no longer exist. While this is a minor bug in its own
right, this was crashing Zebra because Zebra was not doing a null check
after its ifindex lookup.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
zebra/zapi_msg.c

index ca371186b7735dbd86bae58a1eb7fd33a1bac740..6a478560abddcccf85fc75a4e853a90ab7071349 100644 (file)
@@ -1352,10 +1352,17 @@ static void zread_interface_set_protodown(ZAPI_HANDLER_ARGS)
 
        /* set ifdown */
        ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(NS_DEFAULT), ifindex);
-       zlog_info("Setting interface %s (%u): protodown %s", ifp->name, ifindex,
-                 down ? "on" : "off");
 
-       zebra_if_set_protodown(ifp, down);
+       if (ifp) {
+               zlog_info("Setting interface %s (%u): protodown %s", ifp->name,
+                         ifindex, down ? "on" : "off");
+               zebra_if_set_protodown(ifp, down);
+       } else {
+               zlog_warn(
+                       "Cannot set protodown %s for interface %u; does not exist",
+                       down ? "on" : "off", ifindex);
+       }
+
 
 stream_failure:
        return;