I rearranged my network and ended up getting these in messages:

cannot forward src fe80:9::a691:b1ff:fe1f:d2a0, dst 
2001:44b8:3110:fb00:200:5eff:fe00:10a, nxt 58, rcvif 9, outif 1

I guess I could run ifconfig and count interfaces, but I'm lazy and the
kernel knows what they are.

cannot forward src fe80:9::a691:b1ff:fe1f:d2a0, dst 
2001:44b8:3110:fb00:200:5eff:fe00:10a, nxt 58, rcvif carp0, outif em0

ok?  (caveat: kernel n00b, don't assume I know what I'm doing)

Index: netinet6/ip6_forward.c
===================================================================
RCS file: /cvs/src/sys/netinet6/ip6_forward.c,v
retrieving revision 1.95
diff -u -p -r1.95 ip6_forward.c
--- netinet6/ip6_forward.c      30 Jun 2017 11:29:15 -0000      1.95
+++ netinet6/ip6_forward.c      2 Jan 2018 08:44:38 -0000
@@ -86,7 +86,7 @@ ip6_forward(struct mbuf *m, struct rtent
 {
        struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
        struct sockaddr_in6 *dst, sin6;
-       struct ifnet *ifp = NULL;
+       struct ifnet *ifp = NULL, *ifp_dst = NULL;
        int error = 0, type = 0, code = 0;
        struct mbuf *mcopy = NULL;
 #ifdef IPSEC
@@ -197,12 +197,27 @@ reroute:
                        ip6_log_time = time_uptime;
                        inet_ntop(AF_INET6, &ip6->ip6_src, src6, sizeof(src6));
                        inet_ntop(AF_INET6, &ip6->ip6_dst, dst6, sizeof(dst6));
-                       log(LOG_DEBUG,
-                           "cannot forward "
-                           "src %s, dst %s, nxt %d, rcvif %u, outif %u\n",
-                           src6, dst6,
-                           ip6->ip6_nxt,
-                           m->m_pkthdr.ph_ifidx, rt->rt_ifidx);
+                       ifp = if_get(m->m_pkthdr.ph_ifidx);
+                       ifp_dst = if_get(rt->rt_ifidx);
+                       if (ifp != NULL && ifp_dst != NULL) {
+                               log(LOG_DEBUG,
+                                   "cannot forward src %s, dst %s, "
+                                   "nxt %d, rcvif %s, outif %s\n",
+                                   src6, dst6,
+                                   ip6->ip6_nxt,
+                                   ifp->if_xname, ifp_dst->if_xname);
+                       } else {
+                               log(LOG_DEBUG,
+                                   "cannot forward src %s, dst %s, "
+                                   "nxt %d, rcvif %u, outif %u\n",
+                                   src6, dst6,
+                                   ip6->ip6_nxt,
+                                   m->m_pkthdr.ph_ifidx, rt->rt_ifidx);
+                       }
+                       if_put(ifp_dst);
+                       ifp_dst = NULL;
+                       if_put(ifp);
+                       ifp = NULL;
                }
                if (mcopy)
                        icmp6_error(mcopy, ICMP6_DST_UNREACH,

-- 
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860  37F4 9357 ECEF 11EA A6FA (new)
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

Reply via email to