]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: don't crash on iface add for unknown vrf
authorQuentin Young <qlyoung@cumulusnetworks.com>
Sun, 1 Mar 2020 22:44:12 +0000 (17:44 -0500)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 13 Apr 2020 17:25:25 +0000 (13:25 -0400)
If Zebra sends us an interface add notification with a garbage VRF we
crash on an assert(vrf_get(vrf_id, NULL)); let's not

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

index ba4070ffee0d0254511c4a3634d986c34a2515e5..e5336d8ec262885eef1432501a67e4c43c8f5ed4 100644 (file)
@@ -1763,6 +1763,13 @@ static int zclient_interface_add(struct zclient *zclient, vrf_id_t vrf_id)
        STREAM_GET(ifname_tmp, s, INTERFACE_NAMSIZ);
 
        /* Lookup/create interface by name. */
+       if (!vrf_get(vrf_id, NULL)) {
+               zlog_debug(
+                       "Rx'd interface add from Zebra, but VRF %u does not exist",
+                       vrf_id);
+               return -1;
+       }
+
        ifp = if_get_by_name(ifname_tmp, vrf_id);
 
        zebra_interface_if_set_value(s, ifp);