minimal changes necessary to link into an INET6-less kernel. trunk
authormrg <mrg@NetBSD.org>
Fri, 18 Mar 2016 10:09:46 +0000
branchtrunk
changeset 241493 d24adc7a5760
parent 241492 9696b7f33282
child 241494 a01942c790d8
minimal changes necessary to link into an INET6-less kernel.
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 Mar 18 10:08:43 2016 +0000
+++ b/sys/net/npf/npf_inet.c	Fri Mar 18 10:09:46 2016 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_inet.c,v 1.33 2015/12/17 12:17:13 mlelstv Exp $	*/
+/*	$NetBSD: npf_inet.c,v 1.34 2016/03/18 10:09:46 mrg 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.33 2015/12/17 12:17:13 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.34 2016/03/18 10:09:46 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -655,10 +655,12 @@
 		}
 		break;
 	case IPPROTO_ICMP:
+#ifdef INET6
 	case IPPROTO_ICMPV6:
 		KASSERT(npf_iscached(npc, NPC_ICMP));
 		/* Nothing. */
 		break;
+#endif
 	default:
 		return ENOTSUP;
 	}
@@ -669,6 +671,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)
@@ -737,18 +740,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 ip6_sprintf(addr);
+#endif
 }
 
 #endif
--- a/sys/net/npf/npf_mbuf.c	Fri Mar 18 10:08:43 2016 +0000
+++ b/sys/net/npf/npf_mbuf.c	Fri Mar 18 10:09:46 2016 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_mbuf.c,v 1.15 2015/12/17 12:16:21 mlelstv Exp $	*/
+/*	$NetBSD: npf_mbuf.c,v 1.16 2016/03/18 10:09:46 mrg 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.15 2015/12/17 12:16:21 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_mbuf.c,v 1.16 2016/03/18 10:09:46 mrg 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 Mar 18 10:08:43 2016 +0000
+++ b/sys/net/npf/npf_nat.c	Fri Mar 18 10:09:46 2016 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_nat.c,v 1.39 2014/12/30 19:11:44 christos Exp $	*/
+/*	$NetBSD: npf_nat.c,v 1.40 2016/03/18 10:09:46 mrg 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.39 2014/12/30 19:11:44 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.40 2016/03/18 10:09:46 mrg 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;