Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net/npf npf_return_tcp: fix no-INET6 case.



details:   https://anonhg.NetBSD.org/src/rev/92273cb809c4
branches:  trunk
changeset: 433719:92273cb809c4
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sat Sep 29 18:00:35 2018 +0000

description:
npf_return_tcp: fix no-INET6 case.

diffstat:

 sys/net/npf/npf_sendpkt.c |  20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diffs (59 lines):

diff -r 353bd9bc822c -r 92273cb809c4 sys/net/npf/npf_sendpkt.c
--- a/sys/net/npf/npf_sendpkt.c Sat Sep 29 17:28:34 2018 +0000
+++ b/sys/net/npf/npf_sendpkt.c Sat Sep 29 18:00:35 2018 +0000
@@ -33,7 +33,7 @@
 
 #ifdef _KERNEL
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_sendpkt.c,v 1.20 2018/09/29 14:41:36 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_sendpkt.c,v 1.21 2018/09/29 18:00:35 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -56,16 +56,16 @@
 #define        DEFAULT_IP_TTL          (ip_defttl)
 
 #if defined(_NPF_STANDALONE)
-#define        m_gethdr(t, f)          npf->mbufops->alloc(0, 0)
-#define        m_freem(m)              npc->npc_ctx->mbufops->free(m)
-#define        mtod(m,t)               ((t)((npf)->mbufops->getdata(m)))
+#define        m_gethdr(t, f)          (npf)->mbufops->alloc(0, 0)
+#define        m_freem(m)              (npc)->npc_ctx->mbufops->free(m)
+#define        mtod(m,t)               ((t)((npc)->npc_ctx->mbufops->getdata(m)))
 #endif
 
 #if !defined(INET6) || defined(_NPF_STANDALONE)
 #define        in6_cksum(...)          0
 #define        ip6_output(...)         0
 #define        icmp6_error(m, ...)     m_freem(m)
-#define        npf_ip6_setscope(n, i)  0
+#define        npf_ip6_setscope(n, i)  ((void)(i), 0)
 #endif
 
 #if defined(INET6)
@@ -190,21 +190,19 @@
                KASSERT(npf_iscached(npc, NPC_IP6));
                th->th_sum = in6_cksum(m, IPPROTO_TCP, sizeof(struct ip6_hdr),
                    sizeof(struct tcphdr));
-       }
 
-       /* Handle IPv6 scopes */
-       if (npf_iscached(npc, NPC_IP6) && npf_ip6_setscope(npc, ip6) != 0) {
-               goto bad;
+               /* Handle IPv6 scopes */
+               if (npf_ip6_setscope(npc, ip6) != 0) {
+                       goto bad;
+               }
        }
 
        /* Pass to IP layer. */
        if (npf_iscached(npc, NPC_IP4)) {
                return ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL);
        }
-#if defined(INET6)
        return ip6_output(m, NULL, NULL, IPV6_FORWARDING, NULL, NULL, NULL);
 bad:
-#endif
        m_freem(m);
        return EINVAL;
 }



Home | Main Index | Thread Index | Old Index