diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2021-05-18 13:55:48 +0200 |
|---|---|---|
| committer | Martin Winter <mwinter@opensourcerouting.org> | 2021-07-06 14:24:09 +0200 |
| commit | a2810d30256e8de250b9e0fdc274fc4852c7877c (patch) | |
| tree | 119fd4c306f8bcef2c350c1206e0584734344eb9 /pimd/pim_iface.c | |
| parent | 511184897b1ba45703f1a8b6503c6b4abc513482 (diff) | |
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>
Diffstat (limited to 'pimd/pim_iface.c')
| -rw-r--r-- | pimd/pim_iface.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 48b019c8c8..0b28a3e84c 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -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; |
