Module Name: src Committed By: snj Date: Fri May 12 05:32:12 UTC 2017
Modified Files: src/sys/net/npf [netbsd-7]: npf_inet.c npf_mbuf.c npf_nat.c Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.32.2.1 src/sys/net/npf/npf_inet.c cvs rdiff -u -r1.13.2.2 -r1.13.2.3 src/sys/net/npf/npf_mbuf.c cvs rdiff -u -r1.32.2.5 -r1.32.2.6 src/sys/net/npf/npf_nat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/npf/npf_inet.c diff -u src/sys/net/npf/npf_inet.c:1.32 src/sys/net/npf/npf_inet.c:1.32.2.1 --- src/sys/net/npf/npf_inet.c:1.32 Sun Jul 20 00:37:41 2014 +++ src/sys/net/npf/npf_inet.c Fri May 12 05:32:12 2017 @@ -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 @@ npf_napt_rwr(const npf_cache_t *npc, u_i } break; case IPPROTO_ICMP: +#ifdef INET6 case IPPROTO_ICMPV6: +#endif KASSERT(npf_iscached(npc, NPC_ICMP)); /* Nothing. */ break; @@ -668,6 +670,7 @@ npf_napt_rwr(const npf_cache_t *npc, u_i * 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 @@ npf_npt66_rwr(const npf_cache_t *npc, u_ 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 Index: src/sys/net/npf/npf_mbuf.c diff -u src/sys/net/npf/npf_mbuf.c:1.13.2.2 src/sys/net/npf/npf_mbuf.c:1.13.2.3 --- src/sys/net/npf/npf_mbuf.c:1.13.2.2 Tue Jan 26 01:27:21 2016 +++ src/sys/net/npf/npf_mbuf.c Fri May 12 05:32:12 2017 @@ -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 @@ nbuf_cksum_barrier(nbuf_t *nbuf, int di) 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; } Index: src/sys/net/npf/npf_nat.c diff -u src/sys/net/npf/npf_nat.c:1.32.2.5 src/sys/net/npf/npf_nat.c:1.32.2.6 --- src/sys/net/npf/npf_nat.c:1.32.2.5 Sun Jan 4 11:37:38 2015 +++ src/sys/net/npf/npf_nat.c Fri May 12 05:32:12 2017 @@ -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 @@ npf_nat_algo(npf_cache_t *npc, const npf 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;