]> git.proxmox.com Git - mirror_frr.git/commitdiff
pim6d: Do not use interfaces with ifindex as 0
authorSai Gomathi N <nsaigomathi@vmware.com>
Fri, 17 Mar 2023 08:55:16 +0000 (01:55 -0700)
committerSai Gomathi N <nsaigomathi@vmware.com>
Mon, 20 Mar 2023 05:58:55 +0000 (22:58 -0700)
After restarting pim6d, in some cases the ifindex is 0 for the interfaces,
so the vif index is also assigned as 0.
This causes the interface name to be pim6reg.

Fix:
If the ifindex is 0 and the interface name is not "pimreg" or "pim6reg",
the function will return without assigning vifindex with an error message.

Issue: #12744

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
pimd/pim_iface.c

index d284912d1d26d8d0ec6000a5c00025a636226254..ead02d8bd753cfe14a3b1f49a7b792c874120f20 100644 (file)
@@ -982,6 +982,12 @@ int pim_if_add_vif(struct interface *ifp, bool ispimreg, bool is_vxlan_term)
                zlog_warn("%s: ifindex=%d < 1 on interface %s", __func__,
                          ifp->ifindex, ifp->name);
                return -2;
+       } else if ((ifp->ifindex == 0) &&
+                  ((strncmp(ifp->name, "pimreg", 6)) &&
+                   (strncmp(ifp->name, "pim6reg", 7)))) {
+               zlog_warn("%s: ifindex=%d == 0 on interface %s", __func__,
+                         ifp->ifindex, ifp->name);
+               return -2;
        }
 
        ifaddr = pim_ifp->primary_address;