Index: if_loop.c =================================================================== RCS file: /cvs/src/sys/net/if_loop.c,v diff -u -p -r1.98 if_loop.c --- if_loop.c 29 Dec 2023 11:43:04 -0000 1.98 +++ if_loop.c 9 Oct 2024 06:10:16 -0000 @@ -261,17 +261,20 @@ looutput(struct ifnet *ifp, struct mbuf if ((m->m_flags & M_PKTHDR) == 0) panic("%s: no header mbuf", __func__); - if (rt && rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE)) { - m_freem(m); - return (rt->rt_flags & RTF_BLACKHOLE ? 0 : - rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH); + if (rt != NULL) { + if (ISSET(rt->rt_flags, RTF_BLACKHOLE)) { + m_freem(m); + return (0); + } + if (ISSET(rt->rt_flags, RTF_REJECT) || + !ISSET(rt->rt_flags, RTF_LOCAL)) { + m_freem(m); + return (ISSET(rt->rt_flags, RTF_HOST) ? + EHOSTUNREACH : ENETUNREACH); + } } - /* - * Do not call if_input_local() directly. Queue the packet to avoid - * stack overflow and make TCP handshake over loopback work. - */ - return (if_output_local(ifp, m, dst->sa_family)); + return (if_input_local(ifp, m, dst->sa_family)); } void