]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: Prevent crash from using pim static mroutes
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 25 Jan 2019 16:57:09 +0000 (11:57 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 25 Jan 2019 17:07:02 +0000 (12:07 -0500)
If you have an interface being added to a static mroute
and that interface has been configured w/ pim but does
not have a valid ip address yet, we do not create a
VIF for that device yet.  As such when we attempt
to assign the vif array in the pim static data structure
we attempt to write into -1 of that array.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_static.c

index 7334353c3757bf4beab35c9208f07ea9a8f37f6d..f7f6ea17c166f05aa9449e9318335bd9ad0a22e0 100644 (file)
@@ -76,7 +76,7 @@ int pim_static_add(struct pim_instance *pim, struct interface *iif,
        ifindex_t iif_index = pim_iif ? pim_iif->mroute_vif_index : 0;
        ifindex_t oif_index = pim_oif ? pim_oif->mroute_vif_index : 0;
 
-       if (!iif_index || !oif_index) {
+       if (!iif_index || !oif_index || iif_index == -1 || oif_index == -1) {
                zlog_warn(
                        "%s %s: Unable to add static route: Invalid interface index(iif=%d,oif=%d)",
                        __FILE__, __PRETTY_FUNCTION__, iif_index, oif_index);