Pull up following revision(s) (requested by jnemeth in ticket #1394): netbsd-7
authorsnj <snj@NetBSD.org>
Fri, 12 May 2017 05:32:12 +0000
branchnetbsd-7
changeset 255180 5f383a4f480e
parent 255179 919b677ce696
child 255181 94f1662b7bcb
Pull up following revision(s) (requested by jnemeth in ticket #1394): sys/net/npf/npf_inet.c: revisions 1.34, 1.35 via patch sys/net/npf/npf_mbuf.c: revision 1.16 sys/net/npf/npf_nat.c: revision 1.40 minimal changes necessary to link into an INET6-less kernel. -- fixup misplaced #endif
sys/net/npf/npf_inet.c
sys/net/npf/npf_mbuf.c
sys/net/npf/npf_nat.c
--- a/sys/net/npf/npf_inet.c	Fri May 12 05:28:23 2017 +0000
+++ b/sys/net/npf/npf_inet.c	Fri May 12 05:32:12 2017 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_inet.c,v 1.32 2014/07/20 00:37:41 rmind Exp $	*/
+/*	$NetBSD: npf_inet.c,v 1.32.2.1 2017/05/12 05:32:12 snj Exp $	*/
 
 /*-
  * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.32 2014/07/20 00:37:41 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.32.2.1 2017/05/12 05:32:12 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -654,7 +654,9 @@
 		}
 		break;
 	case IPPROTO_ICMP:
+#ifdef INET6
 	case IPPROTO_ICMPV6:
+#endif
 		KASSERT(npf_iscached(npc, NPC_ICMP));
 		/* Nothing. */
 		break;
@@ -668,6 +670,7 @@
  * IPv6-to-IPv6 Network Prefix Translation (NPTv6), as per RFC 6296.
  */
 
+#ifdef INET6
 int
 npf_npt66_rwr(const npf_cache_t *npc, u_int which, const npf_addr_t *pref,
     npf_netmask_t len, uint16_t adj)
@@ -736,18 +739,25 @@
 	addr->s6_addr16[word] = sum;
 	return 0;
 }
+#endif
 
 #if defined(DDB) || defined(_NPF_TESTING)
 
 const char *
 npf_addr_dump(const npf_addr_t *addr, int alen)
 {
+#ifdef INET6
 	if (alen == sizeof(struct in_addr)) {
+#else
+		KASSERT(alen == sizeof(struct in_addr));
+#endif
 		struct in_addr ip;
 		memcpy(&ip, addr, alen);
 		return inet_ntoa(ip);
+#ifdef INET6
 	}
-	return "[IPv6]"; // XXX
+	return ip6_sprintf(addr);
+#endif
 }
 
 #endif
--- a/sys/net/npf/npf_mbuf.c	Fri May 12 05:28:23 2017 +0000
+++ b/sys/net/npf/npf_mbuf.c	Fri May 12 05:32:12 2017 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_mbuf.c,v 1.13.2.2 2016/01/26 01:27:21 riz Exp $	*/
+/*	$NetBSD: npf_mbuf.c,v 1.13.2.3 2017/05/12 05:32:12 snj Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_mbuf.c,v 1.13.2.2 2016/01/26 01:27:21 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_mbuf.c,v 1.13.2.3 2017/05/12 05:32:12 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/mbuf.h>
@@ -258,11 +258,13 @@
 		m->m_pkthdr.csum_flags &= ~(M_CSUM_TCPv4 | M_CSUM_UDPv4);
 		return true;
 	}
+#ifdef INET6
 	if (m->m_pkthdr.csum_flags & (M_CSUM_TCPv6 | M_CSUM_UDPv6)) {
 		in6_delayed_cksum(m);
 		m->m_pkthdr.csum_flags &= ~(M_CSUM_TCPv6 | M_CSUM_UDPv6);
 		return true;
 	}
+#endif
 	return false;
 }
 
--- a/sys/net/npf/npf_nat.c	Fri May 12 05:28:23 2017 +0000
+++ b/sys/net/npf/npf_nat.c	Fri May 12 05:32:12 2017 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_nat.c,v 1.32.2.5 2015/01/04 11:37:38 martin Exp $	*/
+/*	$NetBSD: npf_nat.c,v 1.32.2.6 2017/05/12 05:32:12 snj Exp $	*/
 
 /*-
  * Copyright (c) 2014 Mindaugas Rasiukevicius <rmind at netbsd org>
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.32.2.5 2015/01/04 11:37:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.32.2.6 2017/05/12 05:32:12 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -657,10 +657,12 @@
 	int error;
 
 	switch (np->n_algo) {
+#ifdef INET6
 	case NPF_ALGO_NPT66:
 		error = npf_npt66_rwr(npc, which, &np->n_taddr,
 		    np->n_tmask, np->n_npt66_adj);
 		break;
+#endif
 	default:
 		error = npf_napt_rwr(npc, which, &np->n_taddr, np->n_tport);
 		break;