]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: Trust the recvfromto ifindex information
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 3 Jun 2017 00:22:39 +0000 (20:22 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 24 Jul 2017 17:51:38 +0000 (13:51 -0400)
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>
pimd/pim_pim.c

index be5bcee5db44c95788366128bfa4864c008df5e8..bd6d16c37bddffda8bb83fb0bc9481d40b7bae15 100644 (file)
@@ -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) {