]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: fix PtP address handling 8637/head
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 18 May 2021 11:55:48 +0000 (13:55 +0200)
committerMartin Winter <mwinter@opensourcerouting.org>
Tue, 6 Jul 2021 12:24:09 +0000 (14:24 +0200)
When we have a "192.0.2.1 peer 192.0.2.2/32" address on an interface, we
need to (a) recognize the local address as being on the link for our own
packets, and (b) do the IGMP socket lookup with the proper local address
rather than the peer prefix.

Fixes: efe6f18 ("pimd: fix IGMP receive handling")
Cc: Nathan Bahr <nbahr@atcorp.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
pimd/pim_iface.c

index 48b019c8c8877a85c13f61292a01e338f10ce7af..0b28a3e84c36e6d2d2a95e0d4fbe6ed1a6867d3b 100644 (file)
@@ -1512,10 +1512,15 @@ struct prefix *pim_if_connected_to_source(struct interface *ifp, struct in_addr
        p.prefixlen = IPV4_MAX_BITLEN;
 
        for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, c)) {
-               if ((c->address->family == AF_INET)
-                   && prefix_match(CONNECTED_PREFIX(c), &p)) {
-                       return CONNECTED_PREFIX(c);
-               }
+               if (c->address->family != AF_INET)
+                       continue;
+               if (prefix_match(c->address, &p))
+                       return c->address;
+               if (CONNECTED_PEER(c) && prefix_match(c->destination, &p))
+                       /* this is not a typo, on PtP we need to return the
+                        * *local* address that lines up with src.
+                        */
+                       return c->address;
        }
 
        return NULL;