pimd: fix PtP address handling

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>
This commit is contained in:
David Lamparter 2021-05-18 13:55:48 +02:00 committed by Martin Winter
parent 511184897b
commit a2810d3025
No known key found for this signature in database
GPG key ID: 05A4ECF8C0102306

View 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;