From owner-svn-src-stable-9@FreeBSD.ORG Sun Jul 8 10:46:55 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B4F6E106566C; Sun, 8 Jul 2012 10:46:55 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9CEB28FC0A; Sun, 8 Jul 2012 10:46:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q68AktK2044824; Sun, 8 Jul 2012 10:46:55 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q68AktaF044816; Sun, 8 Jul 2012 10:46:55 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201207081046.q68AktaF044816@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 8 Jul 2012 10:46:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238228 - in stable/9/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2012 10:46:55 -0000 Author: bz Date: Sun Jul 8 10:46:55 2012 New Revision: 238228 URL: http://svn.freebsd.org/changeset/base/238228 Log: MFC r235941: in_cksum.h required ip.h to be included for struct ip. To be able to use some general checksum functions like in_addword() in a non-IPv4 context, limit the (also exported to user space) IPv4 specific functions to the times, when the ip.h header is present and IPVERSION is defined (to 4). Approved by: re Modified: stable/9/sys/amd64/include/in_cksum.h stable/9/sys/arm/include/in_cksum.h stable/9/sys/i386/include/in_cksum.h stable/9/sys/ia64/include/in_cksum.h stable/9/sys/mips/include/in_cksum.h stable/9/sys/powerpc/include/in_cksum.h stable/9/sys/sparc64/include/in_cksum.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/include/in_cksum.h ============================================================================== --- stable/9/sys/amd64/include/in_cksum.h Sun Jul 8 10:29:01 2012 (r238227) +++ stable/9/sys/amd64/include/in_cksum.h Sun Jul 8 10:46:55 2012 (r238228) @@ -43,6 +43,7 @@ #define in_cksum(m, len) in_cksum_skip(m, len, 0) +#if defined(IPVERSION) && (IPVERSION == 4) /* * It it useful to have an Internet checksum routine which is inlineable * and optimized specifically for the task of computing IP header checksums @@ -69,9 +70,12 @@ in_cksum_update(struct ip *ip) } while(0) #endif +#endif #ifdef _KERNEL +#if defined(IPVERSION) && (IPVERSION == 4) u_int in_cksum_hdr(const struct ip *ip); +#endif u_short in_addword(u_short sum, u_short b); u_short in_pseudo(u_int sum, u_int b, u_int c); u_short in_cksum_skip(struct mbuf *m, int len, int skip); Modified: stable/9/sys/arm/include/in_cksum.h ============================================================================== --- stable/9/sys/arm/include/in_cksum.h Sun Jul 8 10:29:01 2012 (r238227) +++ stable/9/sys/arm/include/in_cksum.h Sun Jul 8 10:46:55 2012 (r238228) @@ -46,7 +46,9 @@ u_short in_cksum(struct mbuf *m, int len u_short in_addword(u_short sum, u_short b); u_short in_cksum_skip(struct mbuf *m, int len, int skip); u_int do_cksum(const void *, int); +#if defined(IPVERSION) && (IPVERSION == 4) u_int in_cksum_hdr(const struct ip *); +#endif static __inline u_short in_pseudo(u_int sum, u_int b, u_int c) Modified: stable/9/sys/i386/include/in_cksum.h ============================================================================== --- stable/9/sys/i386/include/in_cksum.h Sun Jul 8 10:29:01 2012 (r238227) +++ stable/9/sys/i386/include/in_cksum.h Sun Jul 8 10:46:55 2012 (r238228) @@ -54,6 +54,7 @@ * therefore always exactly five 32-bit words. */ #if defined(__GNUCLIKE_ASM) && !defined(__INTEL_COMPILER) +#if defined(IPVERSION) && (IPVERSION == 4) static __inline u_int in_cksum_hdr(const struct ip *ip) { @@ -88,6 +89,7 @@ in_cksum_update(struct ip *ip) __tmpsum = (int)ntohs(ip->ip_sum) + 256; ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); } +#endif static __inline u_short in_addword(u_short sum, u_short b) @@ -121,6 +123,7 @@ in_pseudo(u_int sum, u_int b, u_int c) } #else +#if defined(IPVERSION) && (IPVERSION == 4) #define in_cksum_update(ip) \ do { \ int __tmpsum; \ @@ -129,10 +132,13 @@ in_pseudo(u_int sum, u_int b, u_int c) } while(0) #endif +#endif #ifdef _KERNEL #if !defined(__GNUCLIKE_ASM) || defined(__INTEL_COMPILER) +#if defined(IPVERSION) && (IPVERSION == 4) u_int in_cksum_hdr(const struct ip *ip); +#endif u_short in_addword(u_short sum, u_short b); u_short in_pseudo(u_int sum, u_int b, u_int c); #endif Modified: stable/9/sys/ia64/include/in_cksum.h ============================================================================== --- stable/9/sys/ia64/include/in_cksum.h Sun Jul 8 10:29:01 2012 (r238227) +++ stable/9/sys/ia64/include/in_cksum.h Sun Jul 8 10:46:55 2012 (r238228) @@ -39,6 +39,7 @@ #define in_cksum(m, len) in_cksum_skip(m, len, 0) +#if defined(IPVERSION) && (IPVERSION == 4) /* * It it useful to have an Internet checksum routine which is inlineable * and optimized specifically for the task of computing IP header checksums @@ -65,9 +66,12 @@ in_cksum_update(struct ip *ip) } while(0) #endif +#endif #ifdef _KERNEL +#if defined(IPVERSION) && (IPVERSION == 4) u_int in_cksum_hdr(const struct ip *ip); +#endif u_short in_addword(u_short sum, u_short b); u_short in_pseudo(u_int sum, u_int b, u_int c); u_short in_cksum_skip(struct mbuf *m, int len, int skip); Modified: stable/9/sys/mips/include/in_cksum.h ============================================================================== --- stable/9/sys/mips/include/in_cksum.h Sun Jul 8 10:29:01 2012 (r238227) +++ stable/9/sys/mips/include/in_cksum.h Sun Jul 8 10:46:55 2012 (r238228) @@ -40,6 +40,7 @@ #define in_cksum(m, len) in_cksum_skip(m, len, 0) +#if defined(IPVERSION) && (IPVERSION == 4) /* * It it useful to have an Internet checksum routine which is inlineable * and optimized specifically for the task of computing IP header checksums @@ -66,9 +67,12 @@ in_cksum_update(struct ip *ip) } while(0) #endif +#endif #ifdef _KERNEL +#if defined(IPVERSION) && (IPVERSION == 4) u_int in_cksum_hdr(const struct ip *ip); +#endif u_short in_addword(u_short sum, u_short b); u_short in_pseudo(u_int sum, u_int b, u_int c); u_short in_cksum_skip(struct mbuf *m, int len, int skip); Modified: stable/9/sys/powerpc/include/in_cksum.h ============================================================================== --- stable/9/sys/powerpc/include/in_cksum.h Sun Jul 8 10:29:01 2012 (r238227) +++ stable/9/sys/powerpc/include/in_cksum.h Sun Jul 8 10:46:55 2012 (r238228) @@ -39,6 +39,7 @@ #define in_cksum(m, len) in_cksum_skip(m, len, 0) +#if defined(IPVERSION) && (IPVERSION == 4) /* * It it useful to have an Internet checksum routine which is inlineable * and optimized specifically for the task of computing IP header checksums @@ -65,9 +66,12 @@ in_cksum_update(struct ip *ip) } while(0) #endif +#endif #ifdef _KERNEL +#if defined(IPVERSION) && (IPVERSION == 4) u_int in_cksum_hdr(const struct ip *ip); +#endif u_short in_addword(u_short sum, u_short b); u_short in_pseudo(u_int sum, u_int b, u_int c); u_short in_cksum_skip(struct mbuf *m, int len, int skip); Modified: stable/9/sys/sparc64/include/in_cksum.h ============================================================================== --- stable/9/sys/sparc64/include/in_cksum.h Sun Jul 8 10:29:01 2012 (r238227) +++ stable/9/sys/sparc64/include/in_cksum.h Sun Jul 8 10:46:55 2012 (r238228) @@ -65,6 +65,7 @@ #define in_cksum(m, len) in_cksum_skip(m, len, 0) +#if defined(IPVERSION) && (IPVERSION == 4) static __inline void in_cksum_update(struct ip *ip) { @@ -73,6 +74,7 @@ in_cksum_update(struct ip *ip) __tmp = (int)ip->ip_sum + 1; ip->ip_sum = __tmp + (__tmp >> 16); } +#endif static __inline u_short in_addword(u_short sum, u_short b) @@ -106,6 +108,7 @@ in_pseudo(u_int sum, u_int b, u_int c) return (sum); } +#if defined(IPVERSION) && (IPVERSION == 4) static __inline u_int in_cksum_hdr(struct ip *ip) { @@ -163,6 +166,7 @@ in_cksum_hdr(struct ip *ip) #undef __LD_ADD return (__ret); } +#endif #ifdef _KERNEL u_short in_cksum_skip(struct mbuf *m, int len, int skip);