Index: sys/net/if_loop.c =================================================================== --- sys/net/if_loop.c +++ sys/net/if_loop.c @@ -244,20 +244,10 @@ m->m_pkthdr.csum_flags &= ~LO_CSUM_FEATURES; break; case AF_INET6: -#if 0 - /* - * XXX-BZ for now always claim the checksum is good despite - * any interface flags. This is a workaround for 9.1-R and - * a proper solution ought to be sought later. - */ if (ifp->if_capenable & IFCAP_RXCSUM_IPV6) { m->m_pkthdr.csum_data = 0xffff; m->m_pkthdr.csum_flags = LO_CSUM_SET; } -#else - m->m_pkthdr.csum_data = 0xffff; - m->m_pkthdr.csum_flags = LO_CSUM_SET; -#endif m->m_pkthdr.csum_flags &= ~LO_CSUM_FEATURES6; break; default: @@ -300,23 +290,20 @@ * - IPv4/v6 multicast packet loopback (netinet(6)/ip(6)_output.c) * -> not passes it to any BPF * - Normal packet loopback from myself to myself (net/if_loop.c) - * -> passes to lo0's BPF (even in case of IPv6, where ifp!=lo0) + * -> passes to lo0's BPF */ - if (hlen > 0) { - if (bpf_peers_present(ifp->if_bpf)) { + + if (bpf_peers_present(ifp->if_bpf)) { + if (hlen > 0) bpf_mtap(ifp->if_bpf, m); - } - } else { - if (bpf_peers_present(V_loif->if_bpf)) { - if ((m->m_flags & M_MCAST) == 0 || V_loif == ifp) { - /* XXX beware sizeof(af) != 4 */ - u_int32_t af1 = af; - - /* - * We need to prepend the address family. - */ - bpf_mtap2(V_loif->if_bpf, &af1, sizeof(af1), m); - } + else if ((m->m_flags & M_MCAST) == 0) { + /* XXX beware sizeof(af) != 4 */ + u_int32_t af1 = af; + + /* + * We need to prepend the address family. + */ + bpf_mtap2(ifp->if_bpf, &af1, sizeof(af1), m); } } Index: sys/netinet6/ip6_forward.c =================================================================== --- sys/netinet6/ip6_forward.c +++ sys/netinet6/ip6_forward.c @@ -98,7 +98,6 @@ struct route_in6 rin6; int error, type = 0, code = 0; struct mbuf *mcopy = NULL; - struct ifnet *origifp; /* maybe unnecessary */ u_int32_t inzone, outzone; struct in6_addr src_in6, dst_in6, odst; #ifdef IPSEC @@ -445,43 +444,6 @@ } /* - * Fake scoped addresses. Note that even link-local source or - * destinaion can appear, if the originating node just sends the - * packet to us (without address resolution for the destination). - * Since both icmp6_error and icmp6_redirect_output fill the embedded - * link identifiers, we can do this stuff after making a copy for - * returning an error. - */ - if ((rt->rt_ifp->if_flags & IFF_LOOPBACK) != 0) { - /* - * See corresponding comments in ip6_output. - * XXX: but is it possible that ip6_forward() sends a packet - * to a loopback interface? I don't think so, and thus - * I bark here. (jinmei@kame.net) - * XXX: it is common to route invalid packets to loopback. - * also, the codepath will be visited on use of ::1 in - * rthdr. (itojun) - */ -#if 1 - if (0) -#else - if ((rt->rt_flags & (RTF_BLACKHOLE|RTF_REJECT)) == 0) -#endif - { - printf("ip6_forward: outgoing interface is loopback. " - "src %s, dst %s, nxt %d, rcvif %s, outif %s\n", - ip6_sprintf(ip6bufs, &ip6->ip6_src), - ip6_sprintf(ip6bufd, &ip6->ip6_dst), - ip6->ip6_nxt, if_name(m->m_pkthdr.rcvif), - if_name(rt->rt_ifp)); - } - - /* we can just use rcvif in forwarding. */ - origifp = m->m_pkthdr.rcvif; - } - else - origifp = rt->rt_ifp; - /* * clear embedded scope identifiers if necessary. * in6_clearscope will touch the addresses only when necessary. */ @@ -571,7 +533,7 @@ goto bad; } - error = nd6_output_ifp(rt->rt_ifp, origifp, m, dst); + error = nd6_output_ifp(rt->rt_ifp, m, dst); if (error) { in6_ifstat_inc(rt->rt_ifp, ifs6_out_discard); IP6STAT_INC(ip6s_cantforward); Index: sys/netinet6/ip6_output.c =================================================================== --- sys/netinet6/ip6_output.c +++ sys/netinet6/ip6_output.c @@ -935,7 +935,7 @@ m->m_pkthdr.len); ifa_free(&ia6->ia_ifa); } - error = nd6_output_ifp(ifp, origifp, m, dst); + error = nd6_output_ifp(ifp, m, dst); goto done; } @@ -1034,7 +1034,7 @@ counter_u64_add(ia->ia_ifa.ifa_obytes, m->m_pkthdr.len); } - error = nd6_output_ifp(ifp, origifp, m, dst); + error = nd6_output_ifp(ifp, m, dst); } else m_freem(m); } Index: sys/netinet6/nd6.h =================================================================== --- sys/netinet6/nd6.h +++ sys/netinet6/nd6.h @@ -417,12 +417,10 @@ char *, int, int, int); void nd6_grab_holdchain(struct llentry *, struct mbuf **, struct sockaddr_in6 *); -int nd6_flush_holdchain(struct ifnet *, struct ifnet *, struct mbuf *, - struct sockaddr_in6 *); +int nd6_flush_holdchain(struct ifnet *, struct mbuf *, struct sockaddr_in6 *); int nd6_add_ifa_lle(struct in6_ifaddr *); void nd6_rem_ifa_lle(struct in6_ifaddr *, int); -int nd6_output_ifp(struct ifnet *, struct ifnet *, struct mbuf *, - struct sockaddr_in6 *); +int nd6_output_ifp(struct ifnet *, struct mbuf *, struct sockaddr_in6 *); /* nd6_nbr.c */ void nd6_na_input(struct mbuf *, int, int); Index: sys/netinet6/nd6.c =================================================================== --- sys/netinet6/nd6.c +++ sys/netinet6/nd6.c @@ -1824,7 +1824,7 @@ LLE_RUNLOCK(ln); if (chain != NULL) - nd6_flush_holdchain(ifp, ifp, chain, &sin6); + nd6_flush_holdchain(ifp, chain, &sin6); /* * When the link-layer address of a router changes, select the @@ -1907,8 +1907,7 @@ } int -nd6_output_ifp(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m, - struct sockaddr_in6 *dst) +nd6_output_ifp(struct ifnet *ifp, struct mbuf *m, struct sockaddr_in6 *dst) { int error; int ip6len; @@ -1944,10 +1943,7 @@ IP_PROBE(send, NULL, NULL, mtod(m, struct ip6_hdr *), ifp, NULL, mtod(m, struct ip6_hdr *)); - if ((ifp->if_flags & IFF_LOOPBACK) == 0) - origifp = ifp; - - error = (*ifp->if_output)(origifp, m, (struct sockaddr *)dst, NULL); + error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, NULL); return (error); } @@ -2179,23 +2175,18 @@ int -nd6_flush_holdchain(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *chain, +nd6_flush_holdchain(struct ifnet *ifp, struct mbuf *chain, struct sockaddr_in6 *dst) { struct mbuf *m, *m_head; - struct ifnet *outifp; int error = 0; m_head = chain; - if ((ifp->if_flags & IFF_LOOPBACK) != 0) - outifp = origifp; - else - outifp = ifp; while (m_head) { m = m_head; m_head = m_head->m_nextpkt; - error = nd6_output_ifp(ifp, origifp, m, dst); + error = nd6_output_ifp(ifp, m, dst); } /* Index: sys/netinet6/nd6_nbr.c =================================================================== --- sys/netinet6/nd6_nbr.c +++ sys/netinet6/nd6_nbr.c @@ -897,7 +897,7 @@ LLE_WUNLOCK(ln); if (chain != NULL) - nd6_flush_holdchain(ifp, ifp, chain, &sin6); + nd6_flush_holdchain(ifp, chain, &sin6); if (checklink) pfxlist_onlink_check(); Index: sys/netpfil/pf/pf.c =================================================================== --- sys/netpfil/pf/pf.c +++ sys/netpfil/pf/pf.c @@ -5534,7 +5534,7 @@ if (IN6_IS_SCOPE_EMBED(&dst.sin6_addr)) dst.sin6_addr.s6_addr16[1] = htons(ifp->if_index); if ((u_long)m0->m_pkthdr.len <= ifp->if_mtu) - nd6_output_ifp(ifp, ifp, m0, &dst); + nd6_output_ifp(ifp, m0, &dst); else { in6_ifstat_inc(ifp, ifs6_in_toobig); if (r->rt != PF_DUPTO)