diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-06-03 02:22:39 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-07-24 19:51:38 +0200 |
commit | e2d451e2eebd646c2c8a0bd2cb6fb56803950b9c (patch) | |
tree | afb14f566f2b2d5b0aca818cfa63c2568163cb18 /pimd/pim_pim.c | |
parent | pimd: Don't send hello's out vrf interface (diff) | |
download | frr-e2d451e2eebd646c2c8a0bd2cb6fb56803950b9c.tar.xz frr-e2d451e2eebd646c2c8a0bd2cb6fb56803950b9c.zip |
pimd: Trust the recvfromto ifindex information
The vrf interface is receiving the pim packet
instead of the slave interface that is bound.
Lookup the ifindex ifp pointer from that.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_pim.c')
-rw-r--r-- | pimd/pim_pim.c | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index be5bcee5d..bd6d16c37 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -320,35 +320,13 @@ static int pim_sock_read(struct thread *t) goto done; } -#ifdef PIM_CHECK_RECV_IFINDEX_SANITY - /* ifindex sanity check */ - if (ifindex != (int)ifp->ifindex) { - char from_str[INET_ADDRSTRLEN]; - char to_str[INET_ADDRSTRLEN]; - struct interface *recv_ifp; - - if (!inet_ntop(AF_INET, &from.sin_addr, from_str, - sizeof(from_str))) - sprintf(from_str, "<from?>"); - if (!inet_ntop(AF_INET, &to.sin_addr, to_str, - sizeof(to_str))) - sprintf(to_str, "<to?>"); - - recv_ifp = if_lookup_by_index(ifindex, ifp->vrf_id); - if (recv_ifp) { - zassert(ifindex == (int)recv_ifp->ifindex); - } - -#ifdef PIM_REPORT_RECV_IFINDEX_MISMATCH - zlog_warn( - "Interface mismatch: recv PIM pkt from %s to %s on fd=%d: recv_ifindex=%d (%s) sock_ifindex=%d (%s)", - from_str, to_str, fd, ifindex, - recv_ifp ? recv_ifp->name : "<if-notfound>", - ifp->ifindex, ifp->name); -#endif - goto done; - } -#endif + /* + * What? So with vrf's the incoming packet is received + * on the vrf interface but recvfromto above returns + * the right ifindex, so just use it. We know + * it's the right interface because we bind to it + */ + ifp = if_lookup_by_index(ifindex, pim_ifp->pim->vrf_id); int fail = pim_pim_packet(ifp, buf, len); if (fail) { |