]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: allow resolving bsr via directly connected secondary address 17249/head
authorJafar Al-Gharaibeh <jafar@atcorp.com>
Wed, 23 Oct 2024 04:09:53 +0000 (23:09 -0500)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Fri, 25 Oct 2024 20:07:33 +0000 (20:07 +0000)
This only matters to single hop nodes that are adjacent to the bsr. More common
with IPv6 where LL address is used in PIM as the primary address. If the BSR IP
happens to be an address on the same interface, the receiving pim router
rejects the BSR address because it expects the BSR IP to resolve via the LL address
even if we have a connected route for the same BSR IP subnet. Effectively, we want to
allow rpf to be resolved via secondary IPs with connected routes on the same interface,
and not limit them to primary addresses.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
(cherry picked from commit d23a7d0949aaa9aa95d6d3ae293ac4eea81e19f5)

pimd/pim_nht.c

index 4e8e5f0df7353b2205b7abf268e75b323d0f19c5..76027af56d305f0f2ca1ce120a25ed6d1610dd12 100644 (file)
@@ -313,7 +313,19 @@ bool pim_nht_bsr_rpf_check(struct pim_instance *pim, pim_addr bsr_addr,
                        if (!nbr)
                                continue;
 
-                       return znh->ifindex == src_ifp->ifindex;
+                       /* Are we on the correct interface? */
+                       if (znh->ifindex == src_ifp->ifindex) {
+                               /* Do we have the correct NH ? */
+                               if (!pim_addr_cmp(znh->nexthop_addr, src_ip))
+                                       return true;
+                               /*
+                                * check If the packet came from the neighbor,
+                                * and the dst is a secondary address on the connected interface
+                                */
+                               return (!pim_addr_cmp(nbr->source_addr, src_ip) &&
+                                       pim_if_connected_to_source(ifp, znh->nexthop_addr));
+                       }
+                       return false;
                }
                return false;
        }
@@ -380,7 +392,19 @@ bool pim_nht_bsr_rpf_check(struct pim_instance *pim, pim_addr bsr_addr,
                if (!nbr)
                        continue;
 
-               return nh->ifindex == src_ifp->ifindex;
+               /* Are we on the correct interface? */
+               if (nh->ifindex == src_ifp->ifindex) {
+                       /* Do we have the correct NH ? */
+                       if (!pim_addr_cmp(nhaddr, src_ip))
+                               return true;
+                       /*
+                        * check If the packet came from the neighbor,
+                        * and the dst is a secondary address on the connected interface
+                        */
+                       return (!pim_addr_cmp(nbr->source_addr, src_ip) &&
+                               pim_if_connected_to_source(ifp, nhaddr));
+               }
+               return false;
        }
        return false;
 }