]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: Cleanup vrf SA issues exposed by recent commits
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 25 Oct 2017 17:30:45 +0000 (13:30 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 25 Oct 2017 17:43:51 +0000 (13:43 -0400)
A recent commit has shown that we were not consistent with
handling of the vrf lookup.  Adjust pim to do the right
thing with vrf lookup to be consistent and to make SA
happier.

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

index 5dc64a1b3fea08201863ef25dae4b1742cda12d7..b2a8a6ff8f14867bb8386eb4833000242aae2c4c 100644 (file)
@@ -797,7 +797,11 @@ void pim_if_addr_del_all(struct interface *ifp)
        struct listnode *node;
        struct listnode *nextnode;
        struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id);
-       struct pim_instance *pim = vrf->info;
+       struct pim_instance *pim;
+
+       if (!vrf)
+               return;
+       pim = vrf->info;
 
        /* PIM/IGMP enabled ? */
        if (!ifp->info)
@@ -860,12 +864,15 @@ struct in_addr pim_find_primary_addr(struct interface *ifp)
 {
        struct connected *ifc;
        struct listnode *node;
-       struct in_addr addr;
+       struct in_addr addr = {0};
        int v4_addrs = 0;
        int v6_addrs = 0;
        struct pim_interface *pim_ifp = ifp->info;
        struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id);
 
+       if (!vrf)
+               return addr;
+
        if (pim_ifp && PIM_INADDR_ISNOT_ANY(pim_ifp->update_source)) {
                return pim_ifp->update_source;
        }
index 8f9058d99478df4be66471edd757e27031663cdb..e2984e1d131233292657c09d6b521065de395699 100644 (file)
@@ -648,7 +648,11 @@ int pim_parse_nexthop_update(int command, struct zclient *zclient,
        struct interface *ifp = NULL;
        struct interface *ifp1 = NULL;
        struct vrf *vrf = vrf_lookup_by_id(vrf_id);
-       struct pim_instance *pim = vrf->info;
+       struct pim_instance *pim;
+
+       if (!vrf)
+               return 0;
+       pim = vrf->info;
 
        s = zclient->ibuf;
        memset(&p, 0, sizeof(struct prefix));
index 8c90ccbed16cd51c658457435bdab6097a0c57c4..bee6521b6c48cb64571a0bd9d2c73b97645f4305 100644 (file)
@@ -348,7 +348,11 @@ static int pim_zebra_if_address_del(int command, struct zclient *client,
        struct connected *c;
        struct prefix *p;
        struct vrf *vrf = vrf_lookup_by_id(vrf_id);
-       struct pim_instance *pim = vrf->info;
+       struct pim_instance *pim;
+
+       if (!vrf)
+               return 0;
+       pim = vrf->info;
 
        /*
          zebra api notifies address adds/dels events by using the same call