summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--games/fortune/fortune/fortune.c3
-rw-r--r--games/fortune/strfile/strfile.c1
-rw-r--r--games/fortune/unstr/unstr.c1
-rw-r--r--include/arpa/inet.h22
-rw-r--r--include/rpc/xdr.h8
-rw-r--r--lib/libc/alpha/net/byte_swap_2.S7
-rw-r--r--lib/libc/alpha/net/byte_swap_4.S7
-rw-r--r--lib/libc/alpha/net/htonl.S5
-rw-r--r--lib/libc/alpha/net/htons.S5
-rw-r--r--lib/libc/alpha/net/ntohl.S5
-rw-r--r--lib/libc/alpha/net/ntohs.S5
-rw-r--r--lib/libc/amd64/net/htonl.S4
-rw-r--r--lib/libc/amd64/net/htons.S4
-rw-r--r--lib/libc/amd64/net/ntohl.S4
-rw-r--r--lib/libc/amd64/net/ntohs.S4
-rw-r--r--lib/libc/i386/net/htonl.S4
-rw-r--r--lib/libc/i386/net/htons.S4
-rw-r--r--lib/libc/i386/net/ntohl.S4
-rw-r--r--lib/libc/i386/net/ntohs.S4
-rw-r--r--lib/libc/ia64/net/byte_swap_2.S5
-rw-r--r--lib/libc/ia64/net/byte_swap_4.S5
-rw-r--r--lib/libc/ia64/net/htonl.S3
-rw-r--r--lib/libc/ia64/net/htons.S3
-rw-r--r--lib/libc/ia64/net/ntohl.S3
-rw-r--r--lib/libc/ia64/net/ntohs.S3
-rw-r--r--lib/libc/locale/rune.c1
-rw-r--r--lib/libc/net/getservent.c6
-rw-r--r--lib/libc/net/ns_addr.c1
-rw-r--r--lib/libc/net/ns_ntoa.c6
-rw-r--r--lib/libc/rpc/auth_des.c1
-rw-r--r--lib/libc/rpc/clnt_dg.c1
-rw-r--r--lib/libc/rpc/clnt_vc.c1
-rw-r--r--lib/libc/rpc/pmap_getmaps.c1
-rw-r--r--lib/libc/rpc/pmap_getport.c1
-rw-r--r--lib/libc/sparc64/net/htonl.S6
-rw-r--r--lib/libc/sparc64/net/htons.S6
-rw-r--r--lib/libc/sparc64/net/ntohl.S6
-rw-r--r--lib/libc/sparc64/net/ntohs.S6
-rw-r--r--lib/libc/xdr/xdr_stdio.c1
-rw-r--r--lib/libc/yp/yplib.c1
-rw-r--r--lib/libipx/ipx_addr.c1
-rw-r--r--lib/libipx/ipx_ntoa.c1
-rw-r--r--lib/libncp/ipx.c1
-rw-r--r--lib/libncp/ncpl_bind.c1
-rw-r--r--lib/libncp/ncpl_file.c1
-rw-r--r--lib/libncp/ncpl_misc.c1
-rw-r--r--lib/libncp/ncpl_rpc.c1
-rw-r--r--lib/libncp/sap.c1
-rw-r--r--lib/libstand/net.c2
-rw-r--r--lib/libstand/stand.h13
-rw-r--r--libexec/rpc.rwalld/rwalld.c1
-rw-r--r--libexec/talkd/print.c1
-rw-r--r--sbin/mount_cd9660/mount_cd9660.c2
-rw-r--r--sbin/routed/if.c4
-rw-r--r--sbin/routed/input.c6
-rw-r--r--sbin/routed/output.c2
-rw-r--r--sbin/routed/parms.c7
-rw-r--r--sbin/routed/rtquery/rtquery.c4
-rw-r--r--sbin/routed/table.c2
-rw-r--r--secure/lib/libcipher/crypt.c1
-rw-r--r--secure/lib/libcrypt/crypt-des.c1
-rw-r--r--sys/alpha/include/endian.h55
-rw-r--r--sys/cam/scsi/scsi_cd.c2
-rw-r--r--sys/i386/include/endian.h58
-rw-r--r--sys/ia64/include/endian.h88
-rw-r--r--sys/libkern/alpha/byte_swap_2.S5
-rw-r--r--sys/libkern/alpha/byte_swap_4.S5
-rw-r--r--sys/libkern/alpha/htonl.S3
-rw-r--r--sys/libkern/alpha/htons.S3
-rw-r--r--sys/libkern/alpha/ntohl.S3
-rw-r--r--sys/libkern/alpha/ntohs.S3
-rw-r--r--sys/libkern/ia64/byte_swap_2.S5
-rw-r--r--sys/libkern/ia64/byte_swap_4.S5
-rw-r--r--sys/libkern/ia64/htonl.S3
-rw-r--r--sys/libkern/ia64/htons.S3
-rw-r--r--sys/libkern/ia64/ntohl.S3
-rw-r--r--sys/libkern/ia64/ntohs.S3
-rw-r--r--sys/net/bridge.c10
-rw-r--r--sys/netgraph/ng_mppc.c2
-rw-r--r--sys/netinet/in.h17
-rw-r--r--sys/netinet/ip_divert.c4
-rw-r--r--sys/netinet/ip_fw.c4
-rw-r--r--sys/netinet/ip_icmp.c6
-rw-r--r--sys/netinet/ip_input.c16
-rw-r--r--sys/netinet/ip_mroute.c4
-rw-r--r--sys/netinet/ip_output.c28
-rw-r--r--sys/netinet/tcp_input.c22
-rw-r--r--sys/netinet/tcp_reass.c22
-rw-r--r--sys/netinet6/ip6_fw.c4
-rw-r--r--sys/netinet6/nd6_rtr.c2
-rw-r--r--sys/powerpc/include/endian.h53
-rw-r--r--sys/sparc64/include/endian.h54
-rw-r--r--sys/sys/imgact_aout.h10
-rw-r--r--sys/sys/mchain.h16
-rw-r--r--sys/sys/param.h24
-rw-r--r--sys/sys/types.h19
-rw-r--r--usr.bin/locate/locate/util.c1
-rw-r--r--usr.bin/mklocale/yacc.y2
-rw-r--r--usr.bin/talk/ctl_transact.c2
-rw-r--r--usr.sbin/IPXrouted/defs.h1
-rw-r--r--usr.sbin/ancontrol/ancontrol.c3
-rw-r--r--usr.sbin/burncd/burncd.c1
-rw-r--r--usr.sbin/cdcontrol/cdcontrol.c1
-rw-r--r--usr.sbin/ppp/mppe.c2
-rw-r--r--usr.sbin/timed/timedc/cmds.c2
-rw-r--r--usr.sbin/ypbind/yp_ping.c1
106 files changed, 420 insertions, 382 deletions
diff --git a/games/fortune/fortune/fortune.c b/games/fortune/fortune/fortune.c
index 844892f..2cd7de7 100644
--- a/games/fortune/fortune/fortune.c
+++ b/games/fortune/fortune/fortune.c
@@ -48,9 +48,10 @@ static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
-# include <sys/param.h>
# include <sys/stat.h>
+# include <arpa/inet.h>
+
# include <dirent.h>
# include <fcntl.h>
# include <assert.h>
diff --git a/games/fortune/strfile/strfile.c b/games/fortune/strfile/strfile.c
index 607f572..7dfd9cf 100644
--- a/games/fortune/strfile/strfile.c
+++ b/games/fortune/strfile/strfile.c
@@ -50,6 +50,7 @@ static const char rcsid[] =
#endif /* not lint */
# include <sys/param.h>
+# include <arpa/inet.h>
# include <stdio.h>
# include <stdlib.h>
# include <ctype.h>
diff --git a/games/fortune/unstr/unstr.c b/games/fortune/unstr/unstr.c
index 8d4a572..2f5fff0 100644
--- a/games/fortune/unstr/unstr.c
+++ b/games/fortune/unstr/unstr.c
@@ -63,6 +63,7 @@ static const char rcsid[] =
*/
# include <sys/param.h>
+# include <arpa/inet.h>
# include <stdio.h>
# include <ctype.h>
# include <string.h>
diff --git a/include/arpa/inet.h b/include/arpa/inet.h
index 7ac95e5..3ac128d 100644
--- a/include/arpa/inet.h
+++ b/include/arpa/inet.h
@@ -47,9 +47,7 @@
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
- */
-
-/*
+ *
* @(#)inet.h 8.1 (Berkeley) 6/2/93
* From: Id: inet.h,v 8.5 1997/01/29 08:48:09 vixie Exp $
* $FreeBSD$
@@ -63,6 +61,9 @@
#include <sys/cdefs.h>
#include <machine/ansi.h>
+/* Required for byteorder(3) functions. */
+#include <machine/endian.h>
+
#ifndef _IN_ADDR_T_DECLARED_
typedef __uint32_t in_addr_t;
#define _IN_ADDR_T_DECLARED_
@@ -114,14 +115,23 @@ struct in_addr {
#define inet_nsap_ntoa __inet_nsap_ntoa
#endif /* !_POSIX_SOURCE */
+#ifndef _BYTEORDER_FUNC_DEFINED
+#define _BYTEORDER_FUNC_DEFINED
+#define htonl(x) __htonl(x)
+#define htons(x) __htons(x)
+#define ntohl(x) __ntohl(x)
+#define ntohs(x) __ntohs(x)
+#endif
+
__BEGIN_DECLS
+__uint32_t htonl(__uint32_t);
+__uint16_t htons(__uint16_t);
in_addr_t inet_addr __P((const char *));
char *inet_ntoa __P((struct in_addr));
const char *inet_ntop __P((int, const void *, char *, socklen_t));
int inet_pton __P((int, const char *, void *));
-/*
- * XXX missing: ntohl() family.
- */
+__uint32_t ntohl(__uint32_t);
+__uint16_t ntohs(__uint16_t);
/* Nonstandard functions. */
#ifndef _POSIX_SOURCE
diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h
index d38aa49..9867b25 100644
--- a/include/rpc/xdr.h
+++ b/include/rpc/xdr.h
@@ -261,13 +261,13 @@ struct xdr_discrim {
* N.B. and frozen for all time: each data type here uses 4 bytes
* of external representation.
*/
-#define IXDR_GET_INT32(buf) ((int32_t)ntohl((u_int32_t)*(buf)++))
-#define IXDR_PUT_INT32(buf, v) (*(buf)++ =(int32_t)htonl((u_int32_t)v))
+#define IXDR_GET_INT32(buf) ((int32_t)__ntohl((u_int32_t)*(buf)++))
+#define IXDR_PUT_INT32(buf, v) (*(buf)++ =(int32_t)__htonl((u_int32_t)v))
#define IXDR_GET_U_INT32(buf) ((u_int32_t)IXDR_GET_INT32(buf))
#define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32((buf), ((int32_t)(v)))
-#define IXDR_GET_LONG(buf) ((long)ntohl((u_int32_t)*(buf)++))
-#define IXDR_PUT_LONG(buf, v) (*(buf)++ =(int32_t)htonl((u_int32_t)v))
+#define IXDR_GET_LONG(buf) ((long)__ntohl((u_int32_t)*(buf)++))
+#define IXDR_PUT_LONG(buf, v) (*(buf)++ =(int32_t)__htonl((u_int32_t)v))
#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf))
#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf))
diff --git a/lib/libc/alpha/net/byte_swap_2.S b/lib/libc/alpha/net/byte_swap_2.S
index fab3c58..ebcbeda 100644
--- a/lib/libc/alpha/net/byte_swap_2.S
+++ b/lib/libc/alpha/net/byte_swap_2.S
@@ -25,12 +25,14 @@
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
+ *
+ * $FreeBSD$
*/
#include <machine/asm.h>
-#ifndef NAME
-#define NAME byte_swap_2
+#if !defined(ALIAS) || !defined(NAME)
+#error ALIAS or NAME not defined
#endif
/*
@@ -38,6 +40,7 @@
*
* Argument is an unsigned 2-byte integer (u_int16_t).
*/
+XLEAF(ALIAS, 1)
LEAF(NAME, 1) /* a0 contains 0x0123 */
extbl a0, 0, t0 /* t0 = 0x 23 */
extbl a0, 1, t1 /* t1 = 0x 01 */
diff --git a/lib/libc/alpha/net/byte_swap_4.S b/lib/libc/alpha/net/byte_swap_4.S
index 8dbb83c..ddfd1e9 100644
--- a/lib/libc/alpha/net/byte_swap_4.S
+++ b/lib/libc/alpha/net/byte_swap_4.S
@@ -25,12 +25,14 @@
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
+ *
+ * $FreeBSD$
*/
#include <machine/asm.h>
-#ifndef NAME
-#define NAME byte_swap_4
+#if !defined(ALIAS) || !defined(NAME)
+#error ALIAS or NAME not defined
#endif
/*
@@ -38,6 +40,7 @@
*
* Argument is an unsigned 4-byte integer (u_int32_t).
*/
+XLEAF(ALIAS, 1)
LEAF(NAME, 1) /* a0 contains 0x01234567 */
extbl a0, 0, t0 /* t0 = 0x 67 */
extbl a0, 1, t1 /* t1 = 0x 45 */
diff --git a/lib/libc/alpha/net/htonl.S b/lib/libc/alpha/net/htonl.S
index bacab1e..90d9441 100644
--- a/lib/libc/alpha/net/htonl.S
+++ b/lib/libc/alpha/net/htonl.S
@@ -25,8 +25,11 @@
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
+ *
+ * $FreeBSD$
*/
-#define NAME htonl
+#define ALIAS htonl
+#define NAME __htonl
#include "byte_swap_4.S"
diff --git a/lib/libc/alpha/net/htons.S b/lib/libc/alpha/net/htons.S
index fb08222..405d537 100644
--- a/lib/libc/alpha/net/htons.S
+++ b/lib/libc/alpha/net/htons.S
@@ -25,8 +25,11 @@
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
+ *
+ * $FreeBSD$
*/
-#define NAME htons
+#define ALIAS htons
+#define NAME __htons
#include "byte_swap_2.S"
diff --git a/lib/libc/alpha/net/ntohl.S b/lib/libc/alpha/net/ntohl.S
index b571647..54ea68d 100644
--- a/lib/libc/alpha/net/ntohl.S
+++ b/lib/libc/alpha/net/ntohl.S
@@ -25,8 +25,11 @@
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
+ *
+ * $FreeBSD$
*/
-#define NAME ntohl
+#define ALIAS ntohl
+#define NAME __ntohl
#include "byte_swap_4.S"
diff --git a/lib/libc/alpha/net/ntohs.S b/lib/libc/alpha/net/ntohs.S
index 6db9961..f841a7a8 100644
--- a/lib/libc/alpha/net/ntohs.S
+++ b/lib/libc/alpha/net/ntohs.S
@@ -25,8 +25,11 @@
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
+ *
+ * $FreeBSD$
*/
-#define NAME ntohs
+#define ALIAS ntohs
+#define NAME __ntohs
#include "byte_swap_2.S"
diff --git a/lib/libc/amd64/net/htonl.S b/lib/libc/amd64/net/htonl.S
index af3354f..6658b69 100644
--- a/lib/libc/amd64/net/htonl.S
+++ b/lib/libc/amd64/net/htonl.S
@@ -43,7 +43,9 @@
#include <machine/asm.h>
-ENTRY(htonl)
+ .weak CNAME(htonl)
+ .set CNAME(htonl),CNAME(__htonl)
+ENTRY(__htonl)
movl 4(%esp),%eax
xchgb %al,%ah
roll $16,%eax
diff --git a/lib/libc/amd64/net/htons.S b/lib/libc/amd64/net/htons.S
index c78b108..c354eaa 100644
--- a/lib/libc/amd64/net/htons.S
+++ b/lib/libc/amd64/net/htons.S
@@ -43,7 +43,9 @@
#include <machine/asm.h>
-ENTRY(htons)
+ .weak CNAME(htons)
+ .set CNAME(htons),CNAME(__htons)
+ENTRY(__htons)
movzwl 4(%esp),%eax
xchgb %al,%ah
ret
diff --git a/lib/libc/amd64/net/ntohl.S b/lib/libc/amd64/net/ntohl.S
index 3a2c202..46ff54e 100644
--- a/lib/libc/amd64/net/ntohl.S
+++ b/lib/libc/amd64/net/ntohl.S
@@ -43,7 +43,9 @@
#include <machine/asm.h>
-ENTRY(ntohl)
+ .weak CNAME(ntohl)
+ .set CNAME(ntohl),CNAME(__ntohl)
+ENTRY(__ntohl)
movl 4(%esp),%eax
xchgb %al,%ah
roll $16,%eax
diff --git a/lib/libc/amd64/net/ntohs.S b/lib/libc/amd64/net/ntohs.S
index 110faf7..3f0a36a 100644
--- a/lib/libc/amd64/net/ntohs.S
+++ b/lib/libc/amd64/net/ntohs.S
@@ -43,7 +43,9 @@
#include <machine/asm.h>
-ENTRY(ntohs)
+ .weak CNAME(ntohs)
+ .set CNAME(ntohs),CNAME(__ntohs)
+ENTRY(__ntohs)
movzwl 4(%esp),%eax
xchgb %al,%ah
ret
diff --git a/lib/libc/i386/net/htonl.S b/lib/libc/i386/net/htonl.S
index af3354f..6658b69 100644
--- a/lib/libc/i386/net/htonl.S
+++ b/lib/libc/i386/net/htonl.S
@@ -43,7 +43,9 @@
#include <machine/asm.h>
-ENTRY(htonl)
+ .weak CNAME(htonl)
+ .set CNAME(htonl),CNAME(__htonl)
+ENTRY(__htonl)
movl 4(%esp),%eax
xchgb %al,%ah
roll $16,%eax
diff --git a/lib/libc/i386/net/htons.S b/lib/libc/i386/net/htons.S
index c78b108..c354eaa 100644
--- a/lib/libc/i386/net/htons.S
+++ b/lib/libc/i386/net/htons.S
@@ -43,7 +43,9 @@
#include <machine/asm.h>
-ENTRY(htons)
+ .weak CNAME(htons)
+ .set CNAME(htons),CNAME(__htons)
+ENTRY(__htons)
movzwl 4(%esp),%eax
xchgb %al,%ah
ret
diff --git a/lib/libc/i386/net/ntohl.S b/lib/libc/i386/net/ntohl.S
index 3a2c202..46ff54e 100644
--- a/lib/libc/i386/net/ntohl.S
+++ b/lib/libc/i386/net/ntohl.S
@@ -43,7 +43,9 @@
#include <machine/asm.h>
-ENTRY(ntohl)
+ .weak CNAME(ntohl)
+ .set CNAME(ntohl),CNAME(__ntohl)
+ENTRY(__ntohl)
movl 4(%esp),%eax
xchgb %al,%ah
roll $16,%eax
diff --git a/lib/libc/i386/net/ntohs.S b/lib/libc/i386/net/ntohs.S
index 110faf7..3f0a36a 100644
--- a/lib/libc/i386/net/ntohs.S
+++ b/lib/libc/i386/net/ntohs.S
@@ -43,7 +43,9 @@
#include <machine/asm.h>
-ENTRY(ntohs)
+ .weak CNAME(ntohs)
+ .set CNAME(ntohs),CNAME(__ntohs)
+ENTRY(__ntohs)
movzwl 4(%esp),%eax
xchgb %al,%ah
ret
diff --git a/lib/libc/ia64/net/byte_swap_2.S b/lib/libc/ia64/net/byte_swap_2.S
index fbee3c8..19d0eef 100644
--- a/lib/libc/ia64/net/byte_swap_2.S
+++ b/lib/libc/ia64/net/byte_swap_2.S
@@ -30,8 +30,8 @@
#include <machine/asm.h>
-#ifndef NAME
-#define NAME byte_swap_2
+#if !defined(ALIAS) || !defined(NAME)
+#error ALIAS or NAME not defined
#endif
/*
@@ -39,6 +39,7 @@
*
* Argument is an unsigned 2-byte integer (u_int16_t).
*/
+WEAK_ALIAS(ALIAS, NAME)
ENTRY(NAME, 1)
mux1 r16=in0,@rev
;;
diff --git a/lib/libc/ia64/net/byte_swap_4.S b/lib/libc/ia64/net/byte_swap_4.S
index d183644..71019ba 100644
--- a/lib/libc/ia64/net/byte_swap_4.S
+++ b/lib/libc/ia64/net/byte_swap_4.S
@@ -30,8 +30,8 @@
#include <machine/asm.h>
-#ifndef NAME
-#define NAME byte_swap_4
+#if !defined(ALIAS) || !defined(NAME)
+#error ALIAS or NAME not defined
#endif
/*
@@ -39,6 +39,7 @@
*
* Argument is an unsigned 4-byte integer (u_int32_t).
*/
+WEAK_ALIAS(ALIAS, NAME)
ENTRY(NAME, 1)
mux1 r16=in0,@rev
;;
diff --git a/lib/libc/ia64/net/htonl.S b/lib/libc/ia64/net/htonl.S
index 20d86af..7a71a29 100644
--- a/lib/libc/ia64/net/htonl.S
+++ b/lib/libc/ia64/net/htonl.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME htonl
+#define ALIAS htonl
+#define NAME __htonl
#include "byte_swap_4.S"
diff --git a/lib/libc/ia64/net/htons.S b/lib/libc/ia64/net/htons.S
index 5082d88..689b367 100644
--- a/lib/libc/ia64/net/htons.S
+++ b/lib/libc/ia64/net/htons.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME htons
+#define ALIAS htons
+#define NAME __htons
#include "byte_swap_2.S"
diff --git a/lib/libc/ia64/net/ntohl.S b/lib/libc/ia64/net/ntohl.S
index 54299c4..9e2c612 100644
--- a/lib/libc/ia64/net/ntohl.S
+++ b/lib/libc/ia64/net/ntohl.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME ntohl
+#define ALIAS ntohl
+#define NAME __ntohl
#include "byte_swap_4.S"
diff --git a/lib/libc/ia64/net/ntohs.S b/lib/libc/ia64/net/ntohs.S
index 1eec14b..16a884b 100644
--- a/lib/libc/ia64/net/ntohs.S
+++ b/lib/libc/ia64/net/ntohs.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME ntohs
+#define ALIAS ntohs
+#define NAME __ntohs
#include "byte_swap_2.S"
diff --git a/lib/libc/locale/rune.c b/lib/libc/locale/rune.c
index f0a5490..a6b890d 100644
--- a/lib/libc/locale/rune.c
+++ b/lib/libc/locale/rune.c
@@ -41,6 +41,7 @@ static char sccsid[] = "@(#)rune.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
+#include <arpa/inet.h>
#include <rune.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libc/net/getservent.c b/lib/libc/net/getservent.c
index cd4449f..5ffb6d2 100644
--- a/lib/libc/net/getservent.c
+++ b/lib/libc/net/getservent.c
@@ -31,12 +31,18 @@
* SUCH DAMAGE.
*/
+#if 0
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)getservent.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
+#endif 0
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/socket.h>
+#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libc/net/ns_addr.c b/lib/libc/net/ns_addr.c
index 75449ed..e00f20d 100644
--- a/lib/libc/net/ns_addr.c
+++ b/lib/libc/net/ns_addr.c
@@ -41,6 +41,7 @@ static char sccsid[] = "@(#)ns_addr.c 8.1 (Berkeley) 6/7/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
+#include <arpa/inet.h>
#include <netns/ns.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libc/net/ns_ntoa.c b/lib/libc/net/ns_ntoa.c
index de5f305..6ba2caf 100644
--- a/lib/libc/net/ns_ntoa.c
+++ b/lib/libc/net/ns_ntoa.c
@@ -31,11 +31,17 @@
* SUCH DAMAGE.
*/
+#if 0
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)ns_ntoa.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <arpa/inet.h>
#include <netns/ns.h>
#include <stdio.h>
diff --git a/lib/libc/rpc/auth_des.c b/lib/libc/rpc/auth_des.c
index e7aef64..6a7da3a 100644
--- a/lib/libc/rpc/auth_des.c
+++ b/lib/libc/rpc/auth_des.c
@@ -48,7 +48,6 @@
#include <rpc/auth_des.h>
#include <rpc/clnt.h>
#include <rpc/xdr.h>
-#include <netinet/in.h> /* XXX: just to get htonl() and ntohl() */
#include <sys/socket.h>
#undef NIS
#include <rpcsvc/nis.h>
diff --git a/lib/libc/rpc/clnt_dg.c b/lib/libc/rpc/clnt_dg.c
index 59869bf..5ca88d3 100644
--- a/lib/libc/rpc/clnt_dg.c
+++ b/lib/libc/rpc/clnt_dg.c
@@ -52,6 +52,7 @@ static char sccsid[] = "@(#)clnt_dg.c 1.19 89/03/16 Copyr 1988 Sun Micro";
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#include <arpa/inet.h>
#include <rpc/rpc.h>
#include <errno.h>
#include <stdlib.h>
diff --git a/lib/libc/rpc/clnt_vc.c b/lib/libc/rpc/clnt_vc.c
index d2d0178..b96822e 100644
--- a/lib/libc/rpc/clnt_vc.c
+++ b/lib/libc/rpc/clnt_vc.c
@@ -65,6 +65,7 @@ static char sccsid[] = "@(#)clnt_vc.c 1.19 89/03/16 Copyr 1988 Sun Micro";
#include <sys/un.h>
#include <sys/uio.h>
+#include <arpa/inet.h>
#include <assert.h>
#include <err.h>
#include <errno.h>
diff --git a/lib/libc/rpc/pmap_getmaps.c b/lib/libc/rpc/pmap_getmaps.c
index 4c8397f..3fdc44f 100644
--- a/lib/libc/rpc/pmap_getmaps.c
+++ b/lib/libc/rpc/pmap_getmaps.c
@@ -49,6 +49,7 @@ static char *rcsid = "$FreeBSD$";
#include <sys/socket.h>
#include <sys/ioctl.h>
+#include <arpa/inet.h>
#include <net/if.h>
#include <assert.h>
diff --git a/lib/libc/rpc/pmap_getport.c b/lib/libc/rpc/pmap_getport.c
index ff75c9f..02946d3 100644
--- a/lib/libc/rpc/pmap_getport.c
+++ b/lib/libc/rpc/pmap_getport.c
@@ -47,6 +47,7 @@ static char *rcsid = "$FreeBSD$";
#include <sys/types.h>
#include <sys/socket.h>
+#include <arpa/inet.h>
#include <net/if.h>
#include <assert.h>
diff --git a/lib/libc/sparc64/net/htonl.S b/lib/libc/sparc64/net/htonl.S
index c479615..c3d10e5 100644
--- a/lib/libc/sparc64/net/htonl.S
+++ b/lib/libc/sparc64/net/htonl.S
@@ -53,7 +53,9 @@
#endif /* SYSLIBC_RCS and not lint */
/* netorder = htonl(hostorder) */
-ENTRY(htonl)
+ .weak CNAME(htonl)
+ .set CNAME(htonl),CNAME(__htonl)
+ENTRY(__htonl)
retl
srl %o0, 0, %o0 /* zero extend -- or do we sign extend? */
-END(htonl)
+END(__htonl)
diff --git a/lib/libc/sparc64/net/htons.S b/lib/libc/sparc64/net/htons.S
index 70cd0cc..6f1fa70 100644
--- a/lib/libc/sparc64/net/htons.S
+++ b/lib/libc/sparc64/net/htons.S
@@ -53,9 +53,11 @@
#endif /* SYSLIBC_RCS and not lint */
/* netorder = htons(hostorder) */
-ENTRY(htons)
+ .weak CNAME(htons)
+ .set CNAME(htons),CNAME(__htons)
+ENTRY(__htons)
sethi %hi(0xffff0000), %o1
signx %o1, %o1
retl
andn %o0, %o1, %o0
-END(htons)
+END(__htons)
diff --git a/lib/libc/sparc64/net/ntohl.S b/lib/libc/sparc64/net/ntohl.S
index 3ed47ee..4a54691 100644
--- a/lib/libc/sparc64/net/ntohl.S
+++ b/lib/libc/sparc64/net/ntohl.S
@@ -53,7 +53,9 @@
#endif /* SYSLIBC_RCS and not lint */
/* hostorder = ntohl(netorder) */
-ENTRY(ntohl)
+ .weak CNAME(ntohl)
+ .set CNAME(ntohl),CNAME(__ntohl)
+ENTRY(__ntohl)
retl
signx %o0, %o0
-END(ntohl)
+END(__ntohl)
diff --git a/lib/libc/sparc64/net/ntohs.S b/lib/libc/sparc64/net/ntohs.S
index f3a5e19..1b144a9 100644
--- a/lib/libc/sparc64/net/ntohs.S
+++ b/lib/libc/sparc64/net/ntohs.S
@@ -53,9 +53,11 @@
#endif /* SYSLIBC_RCS and not lint */
/* hostorder = ntohs(netorder) */
-ENTRY(ntohs)
+ .weak CNAME(ntohs)
+ .set CNAME(ntohs),CNAME(__ntohs)
+ENTRY(__ntohs)
sethi %hi(0xffff0000), %o1
signx %o1, %o1
retl
andn %o0, %o1, %o0
-END(ntohs)
+END(__ntohs)
diff --git a/lib/libc/xdr/xdr_stdio.c b/lib/libc/xdr/xdr_stdio.c
index c4328ec..e49cb44 100644
--- a/lib/libc/xdr/xdr_stdio.c
+++ b/lib/libc/xdr/xdr_stdio.c
@@ -49,6 +49,7 @@ static char *rcsid = "$FreeBSD$";
#include "namespace.h"
#include <stdio.h>
+#include <arpa/inet.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#include "un-namespace.h"
diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c
index 0a4bc7e..9f9ffba 100644
--- a/lib/libc/yp/yplib.c
+++ b/lib/libc/yp/yplib.c
@@ -38,6 +38,7 @@ static char *rcsid = "$FreeBSD$";
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/uio.h>
+#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libipx/ipx_addr.c b/lib/libipx/ipx_addr.c
index 051d28b..7a4c6b8 100644
--- a/lib/libipx/ipx_addr.c
+++ b/lib/libipx/ipx_addr.c
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)ipx_addr.c";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
+#include <arpa/inet.h>
#include <netipx/ipx.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libipx/ipx_ntoa.c b/lib/libipx/ipx_ntoa.c
index b73d72c..437a2b3 100644
--- a/lib/libipx/ipx_ntoa.c
+++ b/lib/libipx/ipx_ntoa.c
@@ -39,6 +39,7 @@ static char sccsid[] = "@(#)ipx_ntoa.c";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
+#include <arpa/inet.h>
#include <netipx/ipx.h>
#include <stdio.h>
diff --git a/lib/libncp/ipx.c b/lib/libncp/ipx.c
index b55b58b..9f0a21e 100644
--- a/lib/libncp/ipx.c
+++ b/lib/libncp/ipx.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/time.h>
+#include <arpa/inet.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_dl.h>
diff --git a/lib/libncp/ncpl_bind.c b/lib/libncp/ncpl_bind.c
index e7bbb1c..ab591eb 100644
--- a/lib/libncp/ncpl_bind.c
+++ b/lib/libncp/ncpl_bind.c
@@ -34,6 +34,7 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
+#include <arpa/inet.h>
#include <errno.h>
#include <string.h>
#include <netncp/ncp_lib.h>
diff --git a/lib/libncp/ncpl_file.c b/lib/libncp/ncpl_file.c
index 4f611c5..2ffcc46 100644
--- a/lib/libncp/ncpl_file.c
+++ b/lib/libncp/ncpl_file.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/ioctl.h>
+#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
diff --git a/lib/libncp/ncpl_misc.c b/lib/libncp/ncpl_misc.c
index c145fda..16a54c5 100644
--- a/lib/libncp/ncpl_misc.c
+++ b/lib/libncp/ncpl_misc.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/time.h>
+#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <strings.h>
diff --git a/lib/libncp/ncpl_rpc.c b/lib/libncp/ncpl_rpc.c
index 1299ac9..f2240e3 100644
--- a/lib/libncp/ncpl_rpc.c
+++ b/lib/libncp/ncpl_rpc.c
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/time.h>
+#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <strings.h>
diff --git a/lib/libncp/sap.c b/lib/libncp/sap.c
index b9f95a9..a0c7d0c 100644
--- a/lib/libncp/sap.c
+++ b/lib/libncp/sap.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
+#include <arpa/inet.h>
#include <netipx/ipx.h>
#include <errno.h>
#include <unistd.h>
diff --git a/lib/libstand/net.c b/lib/libstand/net.c
index 6ac0de8..06d9dbf 100644
--- a/lib/libstand/net.c
+++ b/lib/libstand/net.c
@@ -231,7 +231,7 @@ intoa(addr)
register int n;
static char buf[17]; /* strlen(".255.255.255.255") + 1 */
- NTOHL(addr);
+ addr = ntohl(addr);
cp = &buf[sizeof buf];
*--cp = '\0';
diff --git a/lib/libstand/stand.h b/lib/libstand/stand.h
index b9e31ad..e3570f9 100644
--- a/lib/libstand/stand.h
+++ b/lib/libstand/stand.h
@@ -371,6 +371,19 @@ extern void panic(const char *, ...) __dead2;
extern struct fs_ops *file_system[];
extern struct devsw *devsw[];
+/*
+ * Expose byteorder(3) functions.
+ */
+#define htonl(x) __htonl(x)
+#define htons(x) __htons(x)
+#define ntohl(x) __ntohl(x)
+#define ntohs(x) __ntohs(x)
+
+extern uint32_t htonl(uint32_t);
+extern uint16_t htons(uint16_t);
+extern uint32_t ntohl(uint32_t);
+extern uint16_t ntohs(uint16_t);
+
#if 0
static inline void *
diff --git a/libexec/rpc.rwalld/rwalld.c b/libexec/rpc.rwalld/rwalld.c
index d352406..9fa71b3 100644
--- a/libexec/rpc.rwalld/rwalld.c
+++ b/libexec/rpc.rwalld/rwalld.c
@@ -39,6 +39,7 @@ static const char rcsid[] =
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
+#include <arpa/inet.h>
#include <rpc/rpc.h>
#include <rpc/pmap_clnt.h>
#include <rpcsvc/rwall.h>
diff --git a/libexec/talkd/print.c b/libexec/talkd/print.c
index 94b87b4..355910c 100644
--- a/libexec/talkd/print.c
+++ b/libexec/talkd/print.c
@@ -43,6 +43,7 @@ static const char rcsid[] =
#include <sys/types.h>
#include <sys/socket.h>
+#include <arpa/inet.h>
#include <protocols/talkd.h>
#include <stdio.h>
#include <syslog.h>
diff --git a/sbin/mount_cd9660/mount_cd9660.c b/sbin/mount_cd9660/mount_cd9660.c
index 3ea3d39..dff7ac8 100644
--- a/sbin/mount_cd9660/mount_cd9660.c
+++ b/sbin/mount_cd9660/mount_cd9660.c
@@ -58,6 +58,8 @@ static const char rcsid[] =
#include <sys/mount.h>
#include <sys/../isofs/cd9660/cd9660_mount.h>
+#include <arpa/inet.h>
+
#include <err.h>
#include <errno.h>
#include <stdlib.h>
diff --git a/sbin/routed/if.c b/sbin/routed/if.c
index b439767..55da15f 100644
--- a/sbin/routed/if.c
+++ b/sbin/routed/if.c
@@ -284,7 +284,7 @@ iflookup(naddr addr)
naddr /* host byte order */
std_mask(naddr addr) /* network byte order */
{
- NTOHL(addr); /* was a host, not a network */
+ addr = ntohl(addr); /* was a host, not a network */
if (addr == 0) /* default route has mask 0 */
return 0;
@@ -372,7 +372,7 @@ ripv1_mask_host(naddr addr, /* in network byte order */
int /* 0=bad */
check_dst(naddr addr)
{
- NTOHL(addr);
+ addr = ntohl(addr);
if (IN_CLASSA(addr)) {
if (addr == 0)
diff --git a/sbin/routed/input.c b/sbin/routed/input.c
index dd94fd6..6d258f1 100644
--- a/sbin/routed/input.c
+++ b/sbin/routed/input.c
@@ -277,7 +277,7 @@ input(struct sockaddr_in *from, /* received from this IP address */
clr_ws_buf(&v12buf, ap);
do {
- NTOHL(n->n_metric);
+ n->n_metric = ntohl(n->n_metric);
/* A single entry with family RIP_AF_UNSPEC and
* metric HOPCNT_INFINITY means "all routes".
@@ -413,7 +413,7 @@ input(struct sockaddr_in *from, /* received from this IP address */
v12buf.n->n_nhop = rt->rt_gate;
}
}
- HTONL(v12buf.n->n_metric);
+ v12buf.n->n_metric = htonl(v12buf.n->n_metric);
/* Stop paying attention if we fill the output buffer.
*/
@@ -582,7 +582,7 @@ input(struct sockaddr_in *from, /* received from this IP address */
if (n->n_family == RIP_AF_AUTH)
continue;
- NTOHL(n->n_metric);
+ n->n_metric = ntohl(n->n_metric);
dst = n->n_dst;
if (n->n_family != RIP_AF_INET
&& (n->n_family != RIP_AF_UNSPEC
diff --git a/sbin/routed/output.c b/sbin/routed/output.c
index 013edd2..0077ba0 100644
--- a/sbin/routed/output.c
+++ b/sbin/routed/output.c
@@ -419,7 +419,7 @@ supply_out(struct ag_info *ag)
wb->n->n_metric = ((stopint || ag->ag_metric < 1)
? HOPCNT_INFINITY
: ag->ag_metric);
- HTONL(wb->n->n_metric);
+ wb->n->n_metric = htonl(wb->n->n_metric);
/* Any non-zero bits in the supposedly unused RIPv1 fields
* cause the old `routed` to ignore the route.
* That means the mask and so forth cannot be sent
diff --git a/sbin/routed/parms.c b/sbin/routed/parms.c
index 057dae9..3e1b0ab 100644
--- a/sbin/routed/parms.c
+++ b/sbin/routed/parms.c
@@ -249,7 +249,8 @@ gwkludge(void)
dname, lptr);
continue;
}
- HTONL(dst); /* make network # into IP address */
+ /* Turn network # into IP address. */
+ dst = htonl(dst);
} else {
msglog("bad \"%s\" in "_PATH_GATEWAYS
" entry \"%s\"", net_host, lptr);
@@ -612,7 +613,7 @@ parse_parms(char *line,
free(intnetp);
return bad_str(line);
}
- HTONL(intnetp->intnet_addr);
+ intnetp->intnet_addr = htonl(intnetp->intnet_addr);
intnetp->intnet_next = intnets;
intnets = intnetp;
return 0;
@@ -945,7 +946,7 @@ getnet(char *name,
if (0 == (in.s_addr & 0xff000000))
in.s_addr <<= 8;
} else if (inet_aton(name, &in) == 1) {
- NTOHL(in.s_addr);
+ in.s_addr = ntohl(in.s_addr);
} else if (!mname && !strcasecmp(name,"default")) {
in.s_addr = RIP_DEFAULT;
} else {
diff --git a/sbin/routed/rtquery/rtquery.c b/sbin/routed/rtquery/rtquery.c
index 1441699..a41c0fd 100644
--- a/sbin/routed/rtquery/rtquery.c
+++ b/sbin/routed/rtquery/rtquery.c
@@ -782,7 +782,7 @@ rip_input(struct sockaddr_in *from,
static u_int
std_mask(u_int addr) /* in network order */
{
- NTOHL(addr); /* was a host, not a network */
+ addr = ntohl(addr); /* was a host, not a network */
if (addr == 0) /* default route has mask 0 */
return 0;
@@ -825,7 +825,7 @@ getnet(char *name,
if (nentp != 0) {
in.s_addr = nentp->n_net;
} else if (inet_aton(name, &in) == 1) {
- NTOHL(in.s_addr);
+ in.s_addr = ntohl(in.s_addr);
} else {
return 0;
}
diff --git a/sbin/routed/table.c b/sbin/routed/table.c
index acfc76f..a8ea949 100644
--- a/sbin/routed/table.c
+++ b/sbin/routed/table.c
@@ -298,7 +298,7 @@ ag_check(naddr dst,
naddr xaddr;
int x;
- NTOHL(dst);
+ dst = ntohl(dst);
/* Punt non-contiguous subnet masks.
*
diff --git a/secure/lib/libcipher/crypt.c b/secure/lib/libcipher/crypt.c
index 4798371..baf09e2 100644
--- a/secure/lib/libcipher/crypt.c
+++ b/secure/lib/libcipher/crypt.c
@@ -53,6 +53,7 @@
*/
#include <sys/types.h>
#include <sys/param.h>
+#include <arpa/inet.h>
#include <pwd.h>
#ifdef DEBUG
diff --git a/secure/lib/libcrypt/crypt-des.c b/secure/lib/libcrypt/crypt-des.c
index 5538cc8..2e86eac 100644
--- a/secure/lib/libcrypt/crypt-des.c
+++ b/secure/lib/libcrypt/crypt-des.c
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/param.h>
+#include <arpa/inet.h>
#include <pwd.h>
#include <string.h>
#include "crypt.h"
diff --git a/sys/alpha/include/endian.h b/sys/alpha/include/endian.h
index 0ba53cd..d9e64c8 100644
--- a/sys/alpha/include/endian.h
+++ b/sys/alpha/include/endian.h
@@ -1,7 +1,4 @@
-/* $FreeBSD$ */
-/* From: NetBSD: endian.h,v 1.5 1997/10/09 15:42:19 bouyer Exp */
-
-/*
+/*-
* Copyright (c) 1987, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -34,10 +31,14 @@
* SUCH DAMAGE.
*
* @(#)endian.h 8.1 (Berkeley) 6/10/93
+ * $NetBSD: endian.h,v 1.5 1997/10/09 15:42:19 bouyer Exp $
+ * $FreeBSD$
*/
-#ifndef _ENDIAN_H_
-#define _ENDIAN_H_
+#ifndef _MACHINE_ENDIAN_H_
+#define _MACHINE_ENDIAN_H_
+
+#include <machine/ansi.h>
/*
* Define the order of 32-bit words in 64-bit words.
@@ -45,52 +46,16 @@
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
-#ifndef _POSIX_SOURCE
/*
* Definitions for byte order, according to byte significance from low
* address to high.
*/
+#ifndef _POSIX_SOURCE
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
#define BYTE_ORDER LITTLE_ENDIAN
-
-#ifndef _KERNEL
-#include <sys/cdefs.h>
-#endif
-#include <machine/ansi.h>
-
-__BEGIN_DECLS
-__uint32_t htonl __P((__uint32_t));
-__uint16_t htons __P((__uint16_t));
-__uint32_t ntohl __P((__uint32_t));
-__uint16_t ntohs __P((__uint16_t));
-__uint16_t bswap16 __P((__uint16_t));
-__uint32_t bswap32 __P((__uint32_t));
-__uint64_t bswap64 __P((__uint64_t));
-__END_DECLS
-
-/*
- * Macros for network/external number representation conversion.
- */
-#if BYTE_ORDER == BIG_ENDIAN && !defined(lint)
-#define ntohl(x) (x)
-#define ntohs(x) (x)
-#define htonl(x) (x)
-#define htons(x) (x)
-
-#define NTOHL(x) (x)
-#define NTOHS(x) (x)
-#define HTONL(x) (x)
-#define HTONS(x) (x)
-
-#else
-
-#define NTOHL(x) (x) = ntohl((__uint32_t)x)
-#define NTOHS(x) (x) = ntohs((__uint16_t)x)
-#define HTONL(x) (x) = htonl((__uint32_t)x)
-#define HTONS(x) (x) = htons((__uint16_t)x)
-#endif
#endif /* !_POSIX_SOURCE */
-#endif /* !_ENDIAN_H_ */
+
+#endif /* !_MACHINE_ENDIAN_H_ */
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index 7ac3195..550ef41 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -1991,7 +1991,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
bcd2bin(th->starting_track);
th->ending_track = bcd2bin(th->ending_track);
}
- NTOHS(th->len);
+ th->len = ntohs(th->len);
bcopy(th, addr, sizeof(*th));
free(th, M_TEMP);
}
diff --git a/sys/i386/include/endian.h b/sys/i386/include/endian.h
index be87af2..f22988b 100644
--- a/sys/i386/include/endian.h
+++ b/sys/i386/include/endian.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1987, 1991 Regents of the University of California.
* All rights reserved.
*
@@ -30,55 +30,37 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)endian.h 7.8 (Berkeley) 4/3/91
+ * @(#)endian.h 7.8 (Berkeley) 4/3/91
* $FreeBSD$
*/
#ifndef _MACHINE_ENDIAN_H_
#define _MACHINE_ENDIAN_H_
+#include <machine/ansi.h>
+
/*
* Define the order of 32-bit words in 64-bit words.
*/
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
-#ifndef _POSIX_SOURCE
-
/*
* Definitions for byte order, according to byte significance from low
* address to high.
*/
+#ifndef _POSIX_SOURCE
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
#define BYTE_ORDER LITTLE_ENDIAN
-
-#ifndef _KERNEL
-#include <sys/cdefs.h>
-#endif
-#include <machine/ansi.h>
-
-__BEGIN_DECLS
-__uint32_t htonl(__uint32_t);
-__uint16_t htons(__uint16_t);
-__uint32_t ntohl(__uint32_t);
-__uint16_t ntohs(__uint16_t);
-__END_DECLS
+#endif /* ! _POSIX_SOURCE */
#ifdef __GNUC__
static __inline __uint32_t
-__uint16_swap_uint32(__uint32_t __x)
-{
- __asm ("rorl $16, %0" : "+r" (__x));
-
- return __x;
-}
-
-static __inline __uint32_t
-__uint8_swap_uint32(__uint32_t __x)
+__htonl(__uint32_t __x)
{
#if defined(_KERNEL) && (defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU)) && !defined(I386_CPU)
__asm ("bswap %0" : "+r" (__x));
@@ -92,29 +74,27 @@ __uint8_swap_uint32(__uint32_t __x)
}
static __inline __uint16_t
-__uint8_swap_uint16(__uint16_t __x)
+__htons(__uint16_t __x)
{
__asm ("xchgb %h0, %b0" : "+q" (__x));
return __x;
}
-/*
- * Macros for network/external number representation conversion.
- */
-#define ntohl __uint8_swap_uint32
-#define ntohs __uint8_swap_uint16
-#define htonl __uint8_swap_uint32
-#define htons __uint8_swap_uint16
+static __inline __uint32_t
+__ntohl(__uint32_t __x)
+{
-#endif /* __GNUC__ */
+ return (__htonl(__x));
+}
-#define NTOHL(x) ((x) = ntohl(x))
-#define NTOHS(x) ((x) = ntohs(x))
-#define HTONL(x) ((x) = htonl(x))
-#define HTONS(x) ((x) = htons(x))
+static __inline __uint16_t
+__ntohs(__uint16_t __x)
+{
+ return (__htons(__x));
+}
-#endif /* ! _POSIX_SOURCE */
+#endif /* __GNUC__ */
#endif /* !_MACHINE_ENDIAN_H_ */
diff --git a/sys/ia64/include/endian.h b/sys/ia64/include/endian.h
index b4b5a0b..bfc2381 100644
--- a/sys/ia64/include/endian.h
+++ b/sys/ia64/include/endian.h
@@ -1,7 +1,4 @@
-/* $FreeBSD$ */
-/* From: NetBSD: endian.h,v 1.5 1997/10/09 15:42:19 bouyer Exp */
-
-/*
+/*-
* Copyright (c) 1987, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -34,10 +31,14 @@
* SUCH DAMAGE.
*
* @(#)endian.h 8.1 (Berkeley) 6/10/93
+ * $NetBSD: endian.h,v 1.5 1997/10/09 15:42:19 bouyer Exp $
+ * $FreeBSD$
*/
-#ifndef _ENDIAN_H_
-#define _ENDIAN_H_
+#ifndef _MACHINE_ENDIAN_H_
+#define _MACHINE_ENDIAN_H_
+
+#include <sys/cdefs.h>
/*
* Define the order of 32-bit words in 64-bit words.
@@ -45,44 +46,17 @@
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
-#ifndef _POSIX_SOURCE
/*
* Definitions for byte order, according to byte significance from low
* address to high.
*/
+#ifndef _POSIX_SOURCE
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
#define BYTE_ORDER LITTLE_ENDIAN
-
-#ifndef _KERNEL
-#include <sys/cdefs.h>
-#endif
-#include <machine/ansi.h>
-
-__BEGIN_DECLS
-__uint32_t htonl __P((__uint32_t));
-__uint16_t htons __P((__uint16_t));
-__uint32_t ntohl __P((__uint32_t));
-__uint16_t ntohs __P((__uint16_t));
-__END_DECLS
-
-/*
- * Macros for network/external number representation conversion.
- */
-#if BYTE_ORDER == BIG_ENDIAN && !defined(lint)
-#define ntohl(x) (x)
-#define ntohs(x) (x)
-#define htonl(x) (x)
-#define htons(x) (x)
-
-#define NTOHL(x) (x)
-#define NTOHS(x) (x)
-#define HTONL(x) (x)
-#define HTONS(x) (x)
-
-#else
+#endif /* !_POSIX_SOURCE */
#ifdef __GNUC__
@@ -96,31 +70,33 @@ __uint8_swap_uint64(__uint64_t __x)
}
static __inline __uint32_t
-__uint8_swap_uint32(__uint32_t __x)
+__htonl(__uint32_t __x)
{
- return __uint8_swap_uint64(__x) >> 32;
+
+ return (__uint8_swap_uint64(__x) >> 32);
}
static __inline __uint16_t
-__uint8_swap_uint16(__uint16_t __x)
+__htons(__uint16_t __x)
{
- return __uint8_swap_uint64(__x) >> 48;
+
+ return (__uint8_swap_uint64(__x) >> 48);
}
-/*
- * Macros for network/external number representation conversion.
- */
-#define ntohl __uint8_swap_uint32
-#define ntohs __uint8_swap_uint16
-#define htonl __uint8_swap_uint32
-#define htons __uint8_swap_uint16
-
-#endif /* __GNUC__ */
-
-#define NTOHL(x) (x) = ntohl((__uint32_t)x)
-#define NTOHS(x) (x) = ntohs((__uint16_t)x)
-#define HTONL(x) (x) = htonl((__uint32_t)x)
-#define HTONS(x) (x) = htons((__uint16_t)x)
-#endif
-#endif /* !_POSIX_SOURCE */
-#endif /* !_ENDIAN_H_ */
+static __inline __uint32_t
+__ntohl(__uint32_t __x)
+{
+
+ return (__uint8_swap_uint64(__x) >> 32);
+}
+
+static __inline __uint16_t
+__ntohs(__uint16_t __x)
+{
+
+ return (__uint8_swap_uint64(__x) >> 48);
+}
+
+#endif /* __GNUC__ */
+
+#endif /* !_MACHINE_ENDIAN_H_ */
diff --git a/sys/libkern/alpha/byte_swap_2.S b/sys/libkern/alpha/byte_swap_2.S
index a9d70a9..8111918 100644
--- a/sys/libkern/alpha/byte_swap_2.S
+++ b/sys/libkern/alpha/byte_swap_2.S
@@ -30,8 +30,8 @@
#include <machine/asm.h>
-#ifndef NAME
-#define NAME byte_swap_2
+#if !defined(ALIAS) || !defined(NAME)
+#error ALIAS or NAME not defined
#endif
/*
@@ -39,6 +39,7 @@
*
* Argument is an unsigned 2-byte integer (u_int16_t).
*/
+XLEAF(ALIAS, 1)
LEAF(NAME, 1) /* a0 contains 0x0123 */
extbl a0, 0, t0 /* t0 = 0x 23 */
extbl a0, 1, t1 /* t1 = 0x 01 */
diff --git a/sys/libkern/alpha/byte_swap_4.S b/sys/libkern/alpha/byte_swap_4.S
index 9f6df34..d31bbe8 100644
--- a/sys/libkern/alpha/byte_swap_4.S
+++ b/sys/libkern/alpha/byte_swap_4.S
@@ -30,8 +30,8 @@
#include <machine/asm.h>
-#ifndef NAME
-#define NAME byte_swap_4
+#if !defined(ALIAS) || !defined(NAME)
+#error ALIAS or NAME not defined
#endif
/*
@@ -39,6 +39,7 @@
*
* Argument is an unsigned 4-byte integer (u_int32_t).
*/
+XLEAF(ALIAS, 1)
LEAF(NAME, 1) /* a0 contains 0x01234567 */
extbl a0, 0, t0 /* t0 = 0x 67 */
extbl a0, 1, t1 /* t1 = 0x 45 */
diff --git a/sys/libkern/alpha/htonl.S b/sys/libkern/alpha/htonl.S
index b5ebaa5..2604034 100644
--- a/sys/libkern/alpha/htonl.S
+++ b/sys/libkern/alpha/htonl.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME htonl
+#define ALIAS htonl
+#define NAME __htonl
#include <libkern/alpha/byte_swap_4.S>
diff --git a/sys/libkern/alpha/htons.S b/sys/libkern/alpha/htons.S
index 9ffabf4..6b8ea16 100644
--- a/sys/libkern/alpha/htons.S
+++ b/sys/libkern/alpha/htons.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME htons
+#define ALIAS htons
+#define NAME __htons
#include <libkern/alpha/byte_swap_2.S>
diff --git a/sys/libkern/alpha/ntohl.S b/sys/libkern/alpha/ntohl.S
index f86a404..590203a 100644
--- a/sys/libkern/alpha/ntohl.S
+++ b/sys/libkern/alpha/ntohl.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME ntohl
+#define ALIAS ntohl
+#define NAME __ntohl
#include <libkern/alpha/byte_swap_4.S>
diff --git a/sys/libkern/alpha/ntohs.S b/sys/libkern/alpha/ntohs.S
index 496f75c..9306881 100644
--- a/sys/libkern/alpha/ntohs.S
+++ b/sys/libkern/alpha/ntohs.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME ntohs
+#define ALIAS ntohs
+#define NAME __ntohs
#include <libkern/alpha/byte_swap_2.S>
diff --git a/sys/libkern/ia64/byte_swap_2.S b/sys/libkern/ia64/byte_swap_2.S
index fbee3c8..19d0eef 100644
--- a/sys/libkern/ia64/byte_swap_2.S
+++ b/sys/libkern/ia64/byte_swap_2.S
@@ -30,8 +30,8 @@
#include <machine/asm.h>
-#ifndef NAME
-#define NAME byte_swap_2
+#if !defined(ALIAS) || !defined(NAME)
+#error ALIAS or NAME not defined
#endif
/*
@@ -39,6 +39,7 @@
*
* Argument is an unsigned 2-byte integer (u_int16_t).
*/
+WEAK_ALIAS(ALIAS, NAME)
ENTRY(NAME, 1)
mux1 r16=in0,@rev
;;
diff --git a/sys/libkern/ia64/byte_swap_4.S b/sys/libkern/ia64/byte_swap_4.S
index d183644..71019ba 100644
--- a/sys/libkern/ia64/byte_swap_4.S
+++ b/sys/libkern/ia64/byte_swap_4.S
@@ -30,8 +30,8 @@
#include <machine/asm.h>
-#ifndef NAME
-#define NAME byte_swap_4
+#if !defined(ALIAS) || !defined(NAME)
+#error ALIAS or NAME not defined
#endif
/*
@@ -39,6 +39,7 @@
*
* Argument is an unsigned 4-byte integer (u_int32_t).
*/
+WEAK_ALIAS(ALIAS, NAME)
ENTRY(NAME, 1)
mux1 r16=in0,@rev
;;
diff --git a/sys/libkern/ia64/htonl.S b/sys/libkern/ia64/htonl.S
index 666f702..f0c89f4 100644
--- a/sys/libkern/ia64/htonl.S
+++ b/sys/libkern/ia64/htonl.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME htonl
+#define ALIAS htonl
+#define NAME __htonl
#include <libkern/ia64/byte_swap_4.S>
diff --git a/sys/libkern/ia64/htons.S b/sys/libkern/ia64/htons.S
index aaea4da..16a83d6 100644
--- a/sys/libkern/ia64/htons.S
+++ b/sys/libkern/ia64/htons.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME htons
+#define ALIAS htons
+#define NAME __htons
#include <libkern/ia64/byte_swap_2.S>
diff --git a/sys/libkern/ia64/ntohl.S b/sys/libkern/ia64/ntohl.S
index b306222..2f2e7ba 100644
--- a/sys/libkern/ia64/ntohl.S
+++ b/sys/libkern/ia64/ntohl.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME ntohl
+#define ALIAS ntohl
+#define NAME __ntohl
#include <libkern/ia64/byte_swap_4.S>
diff --git a/sys/libkern/ia64/ntohs.S b/sys/libkern/ia64/ntohs.S
index ddd7344..051f103 100644
--- a/sys/libkern/ia64/ntohs.S
+++ b/sys/libkern/ia64/ntohs.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME ntohs
+#define ALIAS ntohs
+#define NAME __ntohs
#include <libkern/ia64/byte_swap_2.S>
diff --git a/sys/net/bridge.c b/sys/net/bridge.c
index f05221c..f3412b5 100644
--- a/sys/net/bridge.c
+++ b/sys/net/bridge.c
@@ -867,8 +867,8 @@ bdg_forward(struct mbuf *m0, struct ether_header *const eh, struct ifnet *dst)
* here we assume the pkt is an IP one and the header is contiguous
*/
ip = mtod(m0, struct ip *);
- NTOHS(ip->ip_len);
- NTOHS(ip->ip_off);
+ ip->ip_len = ntohs(ip->ip_len);
+ ip->ip_off = ntohs(ip->ip_off);
/*
* The third parameter to the firewall code is the dst. interface.
@@ -881,11 +881,11 @@ bdg_forward(struct mbuf *m0, struct ether_header *const eh, struct ifnet *dst)
return m0 ;
/*
* If we get here, the firewall has passed the pkt, but the mbuf
- * pointer might have changed. Restore ip and the fields NTOHS()'d.
+ * pointer might have changed. Restore ip and the fields ntohs()'d.
*/
ip = mtod(m0, struct ip *);
- HTONS(ip->ip_len);
- HTONS(ip->ip_off);
+ ip->ip_len = htons(ip->ip_len);
+ ip->ip_off = htons(ip->ip_off);
if (i == 0) /* a PASS rule. */
goto forward ;
diff --git a/sys/netgraph/ng_mppc.c b/sys/netgraph/ng_mppc.c
index 0ebd7d2..ec1428f 100644
--- a/sys/netgraph/ng_mppc.c
+++ b/sys/netgraph/ng_mppc.c
@@ -574,7 +574,7 @@ ng_mppc_decompress(node_p node, struct mbuf *m, struct mbuf **resultp)
if (m->m_pkthdr.len < MPPC_HDRLEN)
return (EINVAL);
m_copydata(m, 0, MPPC_HDRLEN, (caddr_t)&header);
- NTOHS(header);
+ header = ntohs(header);
cc = (header & MPPC_CCOUNT_MASK);
/* Copy payload into a contiguous region of memory */
diff --git a/sys/netinet/in.h b/sys/netinet/in.h
index cf72e57..cfd55ca 100644
--- a/sys/netinet/in.h
+++ b/sys/netinet/in.h
@@ -496,6 +496,23 @@ char *inet_ntoa_r __P((struct in_addr ina, char *buf)); /* in libkern */
#define sintosa(sin) ((struct sockaddr *)(sin))
#define ifatoia(ifa) ((struct in_ifaddr *)(ifa))
+#else /* !_KERNEL */
+
+#ifndef _BYTEORDER_FUNC_DEFINED
+#define _BYTEORDER_FUNC_DEFINED
+#define htonl(x) __htonl(x)
+#define htons(x) __htons(x)
+#define ntohl(x) __ntohl(x)
+#define ntohs(x) __ntohs(x)
#endif
+__BEGIN_DECLS
+__uint32_t htonl __P((__uint32_t));
+__uint16_t htons __P((__uint16_t));
+__uint32_t ntohl __P((__uint32_t));
+__uint16_t ntohs __P((__uint16_t));
+__END_DECLS
+
+#endif /* _KERNEL */
+
#endif
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 1341e18..2fa823f 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -291,8 +291,8 @@ div_output(so, m, addr, control)
}
/* Convert fields to host order for ip_output() */
- NTOHS(ip->ip_len);
- NTOHS(ip->ip_off);
+ ip->ip_len = ntohs(ip->ip_len);
+ ip->ip_off = ntohs(ip->ip_off);
/* Send packet to output processing */
ipstat.ips_rawout++; /* XXX */
diff --git a/sys/netinet/ip_fw.c b/sys/netinet/ip_fw.c
index b176512..5c6e155 100644
--- a/sys/netinet/ip_fw.c
+++ b/sys/netinet/ip_fw.c
@@ -1575,8 +1575,8 @@ got_match:
ti.ti_i = *((struct ipovly *) ip);
ti.ti_t = *tcp;
bcopy(&ti, ip, sizeof(ti));
- NTOHL(tip->ti_seq);
- NTOHL(tip->ti_ack);
+ tip->ti_seq = ntohl(tip->ti_seq);
+ tip->ti_ack = ntohl(tip->ti_ack);
tip->ti_len = ip_len - hlen - (tip->ti_off << 2);
if (tcp->th_flags & TH_ACK) {
tcp_respond(NULL, (void *)ip, tcp, *m,
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index b1d37dc..e19c642 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -193,8 +193,8 @@ icmp_error(n, type, code, dest, destifp)
/*
* Convert fields to network representation.
*/
- HTONS(nip->ip_len);
- HTONS(nip->ip_off);
+ nip->ip_len = htons(nip->ip_len);
+ nip->ip_off = htons(nip->ip_off);
/*
* Now, copy old ip header (without options)
@@ -363,7 +363,7 @@ icmp_input(m, off)
icmpstat.icps_badlen++;
goto freeit;
}
- NTOHS(icp->icmp_ip.ip_len);
+ icp->icmp_ip.ip_len = ntohs(icp->icmp_ip.ip_len);
/* Discard ICMP's in response to multicast packets */
if (IN_MULTICAST(ntohl(icp->icmp_ip.ip_dst.s_addr)))
goto badcode;
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 9a4c248..e82e66f 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -369,12 +369,12 @@ ip_input(struct mbuf *m)
/*
* Convert fields to host representation.
*/
- NTOHS(ip->ip_len);
+ ip->ip_len = ntohs(ip->ip_len);
if (ip->ip_len < hlen) {
ipstat.ips_badlen++;
goto bad;
}
- NTOHS(ip->ip_off);
+ ip->ip_off = ntohs(ip->ip_off);
/*
* Check that the amount of data in the buffers
@@ -762,15 +762,15 @@ found:
/* Restore original checksum before diverting packet */
if (divert_info != 0) {
ip->ip_len += hlen;
- HTONS(ip->ip_len);
- HTONS(ip->ip_off);
+ ip->ip_len = htons(ip->ip_len);
+ ip->ip_off = htons(ip->ip_off);
ip->ip_sum = 0;
if (hlen == sizeof(struct ip))
ip->ip_sum = in_cksum_hdr(ip);
else
ip->ip_sum = in_cksum(m, hlen);
- NTOHS(ip->ip_off);
- NTOHS(ip->ip_len);
+ ip->ip_off = ntohs(ip->ip_off);
+ ip->ip_len = ntohs(ip->ip_len);
ip->ip_len -= hlen;
}
#endif
@@ -793,8 +793,8 @@ found:
/* Restore packet header fields to original values */
ip->ip_len += hlen;
- HTONS(ip->ip_len);
- HTONS(ip->ip_off);
+ ip->ip_len = htons(ip->ip_len);
+ ip->ip_off = htons(ip->ip_off);
/* Deliver packet to divert input routine */
ip_divert_cookie = divert_cookie;
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 956c466..54d5cd7 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -1661,8 +1661,8 @@ encap_send(ip, vifp, m)
*/
ip = (struct ip *)((caddr_t)ip_copy + sizeof(multicast_encap_iphdr));
--ip->ip_ttl;
- HTONS(ip->ip_len);
- HTONS(ip->ip_off);
+ ip->ip_len = htons(ip->ip_len);
+ ip->ip_off = htons(ip->ip_off);
ip->ip_sum = 0;
mb_copy->m_data += sizeof(multicast_encap_iphdr);
ip->ip_sum = in_cksum(mb_copy, ip->ip_hl << 2);
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index aab04c9..d6ee761 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -513,8 +513,8 @@ sendit:
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
}
- HTONS(ip->ip_len);
- HTONS(ip->ip_off);
+ ip->ip_len = htons(ip->ip_len);
+ ip->ip_off = htons(ip->ip_off);
error = ipsec4_output(&state, sp, flags);
@@ -573,8 +573,8 @@ sendit:
}
/* make it flipped, again. */
- NTOHS(ip->ip_len);
- NTOHS(ip->ip_off);
+ ip->ip_len = ntohs(ip->ip_len);
+ ip->ip_off = ntohs(ip->ip_off);
skip_ipsec:
#endif /*IPSEC*/
@@ -681,8 +681,8 @@ skip_ipsec:
}
/* Restore packet header fields to original values */
- HTONS(ip->ip_len);
- HTONS(ip->ip_off);
+ ip->ip_len = htons(ip->ip_len);
+ ip->ip_off = htons(ip->ip_off);
/* Deliver packet to divert input routine */
ip_divert_cookie = divert_cookie;
@@ -755,8 +755,8 @@ skip_ipsec:
}
m->m_pkthdr.csum_flags |=
CSUM_IP_CHECKED | CSUM_IP_VALID;
- HTONS(ip->ip_len);
- HTONS(ip->ip_off);
+ ip->ip_len = htons(ip->ip_len);
+ ip->ip_off = htons(ip->ip_off);
ip_input(m);
goto done;
}
@@ -837,8 +837,8 @@ pass:
*/
if ((u_short)ip->ip_len <= ifp->if_mtu ||
ifp->if_hwassist & CSUM_FRAGMENT) {
- HTONS(ip->ip_len);
- HTONS(ip->ip_off);
+ ip->ip_len = htons(ip->ip_len);
+ ip->ip_off = htons(ip->ip_off);
ip->ip_sum = 0;
if (sw_csum & CSUM_DELAY_IP) {
if (ip->ip_vhl == IP_VHL_BORING) {
@@ -943,7 +943,7 @@ pass:
m->m_pkthdr.len = mhlen + len;
m->m_pkthdr.rcvif = (struct ifnet *)0;
m->m_pkthdr.csum_flags = m0->m_pkthdr.csum_flags;
- HTONS(mhip->ip_off);
+ mhip->ip_off = htons(mhip->ip_off);
mhip->ip_sum = 0;
if (sw_csum & CSUM_DELAY_IP) {
if (mhip->ip_vhl == IP_VHL_BORING) {
@@ -972,7 +972,7 @@ pass:
m->m_pkthdr.len = hlen + firstlen;
ip->ip_len = htons((u_short)m->m_pkthdr.len);
ip->ip_off |= IP_MF;
- HTONS(ip->ip_off);
+ ip->ip_off = htons(ip->ip_off);
ip->ip_sum = 0;
if (sw_csum & CSUM_DELAY_IP) {
if (ip->ip_vhl == IP_VHL_BORING) {
@@ -1950,8 +1950,8 @@ ip_mloopback(ifp, m, dst, hlen)
* than the interface's MTU. Can this possibly matter?
*/
ip = mtod(copym, struct ip *);
- HTONS(ip->ip_len);
- HTONS(ip->ip_off);
+ ip->ip_len = htons(ip->ip_len);
+ ip->ip_off = htons(ip->ip_off);
ip->ip_sum = 0;
if (ip->ip_vhl == IP_VHL_BORING) {
ip->ip_sum = in_cksum_hdr(ip);
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index d6a1760..dc06328 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -424,7 +424,7 @@ tcp_input(m, off0)
len = sizeof (struct ip) + tlen;
bzero(ipov->ih_x1, sizeof(ipov->ih_x1));
ipov->ih_len = (u_short)tlen;
- HTONS(ipov->ih_len);
+ ipov->ih_len = htons(ipov->ih_len);
th->th_sum = in_cksum(m, len);
}
if (th->th_sum) {
@@ -486,10 +486,10 @@ tcp_input(m, off0)
/*
* Convert TCP protocol specific fields to host format.
*/
- NTOHL(th->th_seq);
- NTOHL(th->th_ack);
- NTOHS(th->th_win);
- NTOHS(th->th_urp);
+ th->th_seq = ntohl(th->th_seq);
+ th->th_ack = ntohl(th->th_ack);
+ th->th_win = ntohs(th->th_win);
+ th->th_urp = ntohs(th->th_urp);
/*
* Delay droping TCP, IP headers, IPv6 ext headers, and TCP options,
@@ -2246,7 +2246,7 @@ tcp_dooptions(to, cp, cnt, is_syn)
to->to_flags |= TOF_MSS;
bcopy((char *)cp + 2,
(char *)&to->to_mss, sizeof(to->to_mss));
- NTOHS(to->to_mss);
+ to->to_mss = ntohs(to->to_mss);
break;
case TCPOPT_WINDOW:
if (optlen != TCPOLEN_WINDOW)
@@ -2262,10 +2262,10 @@ tcp_dooptions(to, cp, cnt, is_syn)
to->to_flags |= TOF_TS;
bcopy((char *)cp + 2,
(char *)&to->to_tsval, sizeof(to->to_tsval));
- NTOHL(to->to_tsval);
+ to->to_tsval = ntohl(to->to_tsval);
bcopy((char *)cp + 6,
(char *)&to->to_tsecr, sizeof(to->to_tsecr));
- NTOHL(to->to_tsecr);
+ to->to_tsecr = ntohl(to->to_tsecr);
break;
case TCPOPT_CC:
if (optlen != TCPOLEN_CC)
@@ -2273,7 +2273,7 @@ tcp_dooptions(to, cp, cnt, is_syn)
to->to_flags |= TOF_CC;
bcopy((char *)cp + 2,
(char *)&to->to_cc, sizeof(to->to_cc));
- NTOHL(to->to_cc);
+ to->to_cc = ntohl(to->to_cc);
break;
case TCPOPT_CCNEW:
if (optlen != TCPOLEN_CC)
@@ -2283,7 +2283,7 @@ tcp_dooptions(to, cp, cnt, is_syn)
to->to_flags |= TOF_CCNEW;
bcopy((char *)cp + 2,
(char *)&to->to_cc, sizeof(to->to_cc));
- NTOHL(to->to_cc);
+ to->to_cc = ntohl(to->to_cc);
break;
case TCPOPT_CCECHO:
if (optlen != TCPOLEN_CC)
@@ -2293,7 +2293,7 @@ tcp_dooptions(to, cp, cnt, is_syn)
to->to_flags |= TOF_CCECHO;
bcopy((char *)cp + 2,
(char *)&to->to_ccecho, sizeof(to->to_ccecho));
- NTOHL(to->to_ccecho);
+ to->to_ccecho = ntohl(to->to_ccecho);
break;
default:
continue;
diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c
index d6a1760..dc06328 100644
--- a/sys/netinet/tcp_reass.c
+++ b/sys/netinet/tcp_reass.c
@@ -424,7 +424,7 @@ tcp_input(m, off0)
len = sizeof (struct ip) + tlen;
bzero(ipov->ih_x1, sizeof(ipov->ih_x1));
ipov->ih_len = (u_short)tlen;
- HTONS(ipov->ih_len);
+ ipov->ih_len = htons(ipov->ih_len);
th->th_sum = in_cksum(m, len);
}
if (th->th_sum) {
@@ -486,10 +486,10 @@ tcp_input(m, off0)
/*
* Convert TCP protocol specific fields to host format.
*/
- NTOHL(th->th_seq);
- NTOHL(th->th_ack);
- NTOHS(th->th_win);
- NTOHS(th->th_urp);
+ th->th_seq = ntohl(th->th_seq);
+ th->th_ack = ntohl(th->th_ack);
+ th->th_win = ntohs(th->th_win);
+ th->th_urp = ntohs(th->th_urp);
/*
* Delay droping TCP, IP headers, IPv6 ext headers, and TCP options,
@@ -2246,7 +2246,7 @@ tcp_dooptions(to, cp, cnt, is_syn)
to->to_flags |= TOF_MSS;
bcopy((char *)cp + 2,
(char *)&to->to_mss, sizeof(to->to_mss));
- NTOHS(to->to_mss);
+ to->to_mss = ntohs(to->to_mss);
break;
case TCPOPT_WINDOW:
if (optlen != TCPOLEN_WINDOW)
@@ -2262,10 +2262,10 @@ tcp_dooptions(to, cp, cnt, is_syn)
to->to_flags |= TOF_TS;
bcopy((char *)cp + 2,
(char *)&to->to_tsval, sizeof(to->to_tsval));
- NTOHL(to->to_tsval);
+ to->to_tsval = ntohl(to->to_tsval);
bcopy((char *)cp + 6,
(char *)&to->to_tsecr, sizeof(to->to_tsecr));
- NTOHL(to->to_tsecr);
+ to->to_tsecr = ntohl(to->to_tsecr);
break;
case TCPOPT_CC:
if (optlen != TCPOLEN_CC)
@@ -2273,7 +2273,7 @@ tcp_dooptions(to, cp, cnt, is_syn)
to->to_flags |= TOF_CC;
bcopy((char *)cp + 2,
(char *)&to->to_cc, sizeof(to->to_cc));
- NTOHL(to->to_cc);
+ to->to_cc = ntohl(to->to_cc);
break;
case TCPOPT_CCNEW:
if (optlen != TCPOLEN_CC)
@@ -2283,7 +2283,7 @@ tcp_dooptions(to, cp, cnt, is_syn)
to->to_flags |= TOF_CCNEW;
bcopy((char *)cp + 2,
(char *)&to->to_cc, sizeof(to->to_cc));
- NTOHL(to->to_cc);
+ to->to_cc = ntohl(to->to_cc);
break;
case TCPOPT_CCECHO:
if (optlen != TCPOLEN_CC)
@@ -2293,7 +2293,7 @@ tcp_dooptions(to, cp, cnt, is_syn)
to->to_flags |= TOF_CCECHO;
bcopy((char *)cp + 2,
(char *)&to->to_ccecho, sizeof(to->to_ccecho));
- NTOHL(to->to_ccecho);
+ to->to_ccecho = ntohl(to->to_ccecho);
break;
default:
continue;
diff --git a/sys/netinet6/ip6_fw.c b/sys/netinet6/ip6_fw.c
index a861e65..468400c 100644
--- a/sys/netinet6/ip6_fw.c
+++ b/sys/netinet6/ip6_fw.c
@@ -756,8 +756,8 @@ got_match:
ti.ip6 = *ip6;
ti.th = *tcp;
- NTOHL(ti.th.th_seq);
- NTOHL(ti.th.th_ack);
+ ti.th.th_seq = ntohl(ti.th.th_seq);
+ ti.th.th_ack = ntohl(ti.th.th_ack);
ti.ip6.ip6_nxt = IPPROTO_TCP;
if (ti.th.th_flags & TH_ACK) {
ack = 0;
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index 268884d..d84ba59 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -269,7 +269,7 @@ nd6_ra_input(m, off, icmp6len)
dr0.advints_lost = 0; /* Mobile IPv6 */
/* unspecified or not? (RFC 2461 6.3.4) */
if (advreachable) {
- NTOHL(advreachable);
+ advreachable = ntohl(advreachable);
if (advreachable <= MAX_REACHABLE_TIME &&
ndi->basereachable != advreachable) {
ndi->basereachable = advreachable;
diff --git a/sys/powerpc/include/endian.h b/sys/powerpc/include/endian.h
index a1f5ce6..3b45b73 100644
--- a/sys/powerpc/include/endian.h
+++ b/sys/powerpc/include/endian.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1987, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -35,8 +35,10 @@
* $FreeBSD$
*/
-#ifndef _ENDIAN_H_
-#define _ENDIAN_H_
+#ifndef _MACHINE_ENDIAN_H_
+#define _MACHINE_ENDIAN_H_
+
+#include <machine/ansi.h>
/*
* Define the order of 32-bit words in 64-bit words.
@@ -44,53 +46,32 @@
#define _QUAD_HIGHWORD 0
#define _QUAD_LOWWORD 1
-#ifndef _POSIX_SOURCE
/*
* Definitions for byte order, according to byte significance from low
* address to high.
*/
+#ifndef _POSIX_SOURCE
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
#define BYTE_ORDER BIG_ENDIAN
+#endif /* !_POSIX_SOURCE */
#ifndef _KERNEL
#include <sys/cdefs.h>
-#endif
-#include <machine/ansi.h>
__BEGIN_DECLS
-__uint32_t htonl __P((__uint32_t));
-__uint16_t htons __P((__uint16_t));
-__uint32_t ntohl __P((__uint32_t));
-__uint16_t ntohs __P((__uint16_t));
-__uint16_t bswap16 __P((__uint16_t));
-__uint32_t bswap32 __P((__uint32_t));
-__uint64_t bswap64 __P((__uint64_t));
+__uint32_t __htonl __P((__uint32_t));
+__uint16_t __htons __P((__uint16_t));
+__uint32_t __ntohl __P((__uint32_t));
+__uint16_t __ntohs __P((__uint16_t));
__END_DECLS
+#endif /* _KERNEL */
-/*
- * Macros for network/external number representation conversion.
- */
-#if BYTE_ORDER == BIG_ENDIAN && !defined(lint)
-#define ntohl(x) (x)
-#define ntohs(x) (x)
-#define htonl(x) (x)
-#define htons(x) (x)
-
-#define NTOHL(x) (x)
-#define NTOHS(x) (x)
-#define HTONL(x) (x)
-#define HTONS(x) (x)
+#define __htonl(x) (x)
+#define __htons(x) (x)
+#define __ntohl(x) (x)
+#define __ntohs(x) (x)
-#else
-
-#define NTOHL(x) (x) = ntohl((__uint32_t)(x))
-#define NTOHS(x) (x) = ntohs((__uint16_t)(x))
-#define HTONL(x) (x) = htonl((__uint32_t)(x))
-#define HTONS(x) (x) = htons((__uint16_t)(x))
-#endif
-
-#endif /* !_POSIX_SOURCE */
-#endif /* !_ENDIAN_H_ */
+#endif /* !_MACHINE_ENDIAN_H_ */
diff --git a/sys/sparc64/include/endian.h b/sys/sparc64/include/endian.h
index 54cc624..532daab 100644
--- a/sys/sparc64/include/endian.h
+++ b/sys/sparc64/include/endian.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1987, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -10,6 +10,13 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -30,58 +37,29 @@
#ifndef _MACHINE_ENDIAN_H_
#define _MACHINE_ENDIAN_H_
+#include <machine/ansi.h>
+
/*
* Define the order of 32-bit words in 64-bit words.
*/
#define _QUAD_HIGHWORD 0
#define _QUAD_LOWWORD 1
-#ifndef _POSIX_SOURCE
/*
* Definitions for byte order, according to byte significance from low
* address to high.
*/
+#ifndef _POSIX_SOURCE
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
#define BYTE_ORDER BIG_ENDIAN
+#endif /* !_POSIX_SOURCE */
-#ifndef _KERNEL
-#include <sys/cdefs.h>
-#endif
-#include <machine/ansi.h>
-
-__BEGIN_DECLS
-__uint32_t htonl __P((__uint32_t));
-__uint16_t htons __P((__uint16_t));
-__uint32_t ntohl __P((__uint32_t));
-__uint16_t ntohs __P((__uint16_t));
-__uint16_t bswap16 __P((__uint16_t));
-__uint32_t bswap32 __P((__uint32_t));
-__uint64_t bswap64 __P((__uint64_t));
-__END_DECLS
-
-/*
- * Macros for network/external number representation conversion.
- */
-#if BYTE_ORDER == BIG_ENDIAN && !defined(lint)
-#define ntohl(x) (x)
-#define ntohs(x) (x)
-#define htonl(x) (x)
-#define htons(x) (x)
-
-#define NTOHL(x)
-#define NTOHS(x)
-#define HTONL(x)
-#define HTONS(x)
-
-#else
+#define __htonl(x) (x)
+#define __htons(x) (x)
+#define __ntohl(x) (x)
+#define __ntohs(x) (x)
-#define NTOHL(x) (x) = ntohl((in_addr_t)x)
-#define NTOHS(x) (x) = ntohs((in_port_t)x)
-#define HTONL(x) (x) = htonl((in_addr_t)x)
-#define HTONS(x) (x) = htons((in_port_t)x)
-#endif
-#endif /* !_POSIX_SOURCE */
#endif /* !_MACHINE_ENDIAN_H_ */
diff --git a/sys/sys/imgact_aout.h b/sys/sys/imgact_aout.h
index 39d6baf..4b20b87 100644
--- a/sys/sys/imgact_aout.h
+++ b/sys/sys/imgact_aout.h
@@ -50,14 +50,14 @@
((mag) & 0xffff) )
#define N_GETMAGIC_NET(ex) \
- (ntohl((ex).a_midmag) & 0xffff)
+ (__ntohl((ex).a_midmag) & 0xffff)
#define N_GETMID_NET(ex) \
- ((ntohl((ex).a_midmag) >> 16) & 0x03ff)
+ ((__ntohl((ex).a_midmag) >> 16) & 0x03ff)
#define N_GETFLAG_NET(ex) \
- ((ntohl((ex).a_midmag) >> 26) & 0x3f)
+ ((__ntohl((ex).a_midmag) >> 26) & 0x3f)
#define N_SETMAGIC_NET(ex,mag,mid,flag) \
- ( (ex).a_midmag = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \
- (((mag)&0xffff)) ) )
+ ( (ex).a_midmag = __htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) \
+ | (((mag)&0xffff)) ) )
#define N_ALIGN(ex,x) \
(N_GETMAGIC(ex) == ZMAGIC || N_GETMAGIC(ex) == QMAGIC || \
diff --git a/sys/sys/mchain.h b/sys/sys/mchain.h
index e79fbfb..57278f4 100644
--- a/sys/sys/mchain.h
+++ b/sys/sys/mchain.h
@@ -48,23 +48,23 @@
#define htoleq(x) ((int64_t)(x))
#define letohq(x) ((int64_t)(x))
-#define htobes(x) (htons(x))
-#define betohs(x) (ntohs(x))
-#define htobel(x) (htonl(x))
-#define betohl(x) (ntohl(x))
+#define htobes(x) (__htons(x))
+#define betohs(x) (__ntohs(x))
+#define htobel(x) (__htonl(x))
+#define betohl(x) (__ntohl(x))
static __inline int64_t
htobeq(int64_t x)
{
- return (int64_t)htonl((u_int32_t)(x >> 32)) |
- (int64_t)htonl((u_int32_t)(x & 0xffffffff)) << 32;
+ return (int64_t)__htonl((u_int32_t)(x >> 32)) |
+ (int64_t)__htonl((u_int32_t)(x & 0xffffffff)) << 32;
}
static __inline int64_t
betohq(int64_t x)
{
- return (int64_t)ntohl((u_int32_t)(x >> 32)) |
- (int64_t)ntohl((u_int32_t)(x & 0xffffffff)) << 32;
+ return (int64_t)__ntohl((u_int32_t)(x >> 32)) |
+ (int64_t)__ntohl((u_int32_t)(x & 0xffffffff)) << 32;
}
#else /* (BYTE_ORDER == LITTLE_ENDIAN) */
diff --git a/sys/sys/param.h b/sys/sys/param.h
index fe77232..90cc586 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -189,6 +189,30 @@
#endif
/*
+ * Kernel exposed versions of byteorder(3) functions.
+ *
+ * XXX this section should only be defined in the kernel, but some userland
+ * software utilizes it.
+ */
+#ifndef _BYTEORDER_FUNC_DEFINED
+#define _BYTEORDER_FUNC_DEFINED
+#define htonl(x) __htonl(x)
+#define htons(x) __htons(x)
+#define ntohl(x) __ntohl(x)
+#define ntohs(x) __ntohs(x)
+#endif
+
+/*
+ * XXX deprecated uppercase variants for byteorder(3) functions.
+ */
+#ifndef _POSIX_SOURCE
+#define NTOHL(x) ((x) = __ntohl(x))
+#define NTOHS(x) ((x) = __ntohs(x))
+#define HTONL(x) ((x) = __htonl(x))
+#define HTONS(x) ((x) = __htons(x))
+#endif /* _POSIX_SOURCE */
+
+/*
* Constants for setting the parameters of the kernel memory allocator.
*
* 2 ** MINBUCKET is the smallest unit of memory that will be
diff --git a/sys/sys/types.h b/sys/sys/types.h
index f01d985..e80462b 100644
--- a/sys/sys/types.h
+++ b/sys/sys/types.h
@@ -46,6 +46,7 @@
/* Machine type dependent parameters. */
#include <sys/stdint.h> /* includes <machine/ansi.h> */
+#include <machine/endian.h>
#include <machine/types.h>
#ifndef _POSIX_SOURCE
@@ -122,12 +123,6 @@ typedef u_int32_t dev_t; /* device number */
#endif /* !_KERNEL */
-/*
- * XXX: Deprecated;
- * byteorder(3) functions now defined in <arpa/inet.h>.
- */
-#include <machine/endian.h>
-
#ifdef _BSD_CLOCK_T_
typedef _BSD_CLOCK_T_ clock_t;
#undef _BSD_CLOCK_T_
@@ -143,18 +138,6 @@ typedef _BSD_FFLAGS_T_ fflags_t; /* file flags */
#undef _BSD_FFLAGS_T_
#endif
-/* XXX: Deprecated; now defined in <arpa/inet.h>. */
-#ifndef _IN_ADDR_T_DECLARED_
-typedef __uint32_t in_addr_t;
-#define _IN_ADDR_T_DECLARED_
-#endif
-
-/* XXX: Deprecated; now defined in <arpa/inet.h>. */
-#ifndef _IN_PORT_T_DECLARED_
-typedef __uint16_t in_port_t;
-#define _IN_PORT_T_DECLARED_
-#endif
-
#ifdef _BSD_SIZE_T_
typedef _BSD_SIZE_T_ size_t;
#undef _BSD_SIZE_T_
diff --git a/usr.bin/locate/locate/util.c b/usr.bin/locate/locate/util.c
index feaa32a..4fee1f3 100644
--- a/usr.bin/locate/locate/util.c
+++ b/usr.bin/locate/locate/util.c
@@ -42,6 +42,7 @@
#include <string.h>
#include <err.h>
#include <sys/param.h>
+#include <arpa/inet.h>
#include <stdio.h>
#include "locate.h"
diff --git a/usr.bin/mklocale/yacc.y b/usr.bin/mklocale/yacc.y
index 7ad1d37..51378f1 100644
--- a/usr.bin/mklocale/yacc.y
+++ b/usr.bin/mklocale/yacc.y
@@ -40,6 +40,8 @@ static char sccsid[] = "@(#)yacc.y 8.1 (Berkeley) 6/6/93";
static char rcsid[] = "$FreeBSD$";
#endif /* not lint */
+#include <arpa/inet.h>
+
#include <ctype.h>
#include <rune.h>
#include <stddef.h>
diff --git a/usr.bin/talk/ctl_transact.c b/usr.bin/talk/ctl_transact.c
index 1d68b69..0871feb 100644
--- a/usr.bin/talk/ctl_transact.c
+++ b/usr.bin/talk/ctl_transact.c
@@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$");
static const char sccsid[] = "@(#)ctl_transact.c 8.1 (Berkeley) 6/6/93";
#endif
+#include <arpa/inet.h>
+
#include <errno.h>
#include <string.h>
diff --git a/usr.sbin/IPXrouted/defs.h b/usr.sbin/IPXrouted/defs.h
index 3a1e6ac..c2b28a7 100644
--- a/usr.sbin/IPXrouted/defs.h
+++ b/usr.sbin/IPXrouted/defs.h
@@ -40,6 +40,7 @@
#include <sys/types.h>
#include <sys/socket.h>
+#include <arpa/inet.h>
#include <net/route.h>
#include <netipx/ipx.h>
#if defined(vax) || defined(pdp11)
diff --git a/usr.sbin/ancontrol/ancontrol.c b/usr.sbin/ancontrol/ancontrol.c
index 6323965..6fb1cd3 100644
--- a/usr.sbin/ancontrol/ancontrol.c
+++ b/usr.sbin/ancontrol/ancontrol.c
@@ -39,11 +39,12 @@ static const char rcsid[] =
#include <sys/types.h>
#include <sys/cdefs.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
+#include <arpa/inet.h>
+
#include <net/if.h>
#include <net/if_var.h>
#include <net/ethernet.h>
diff --git a/usr.sbin/burncd/burncd.c b/usr.sbin/burncd/burncd.c
index 88132b2..daea1a4 100644
--- a/usr.sbin/burncd/burncd.c
+++ b/usr.sbin/burncd/burncd.c
@@ -28,6 +28,7 @@
* $FreeBSD$
*/
+#include <arpa/inet.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/usr.sbin/cdcontrol/cdcontrol.c b/usr.sbin/cdcontrol/cdcontrol.c
index eadf8dc..8bd3f4b 100644
--- a/usr.sbin/cdcontrol/cdcontrol.c
+++ b/usr.sbin/cdcontrol/cdcontrol.c
@@ -27,6 +27,7 @@ static const char rcsid[] =
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/param.h>
+#include <arpa/inet.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
diff --git a/usr.sbin/ppp/mppe.c b/usr.sbin/ppp/mppe.c
index 09dccff..6278ad1 100644
--- a/usr.sbin/ppp/mppe.c
+++ b/usr.sbin/ppp/mppe.c
@@ -28,6 +28,8 @@
#include <sys/types.h>
+#include <arpa/inet.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/usr.sbin/timed/timedc/cmds.c b/usr.sbin/timed/timedc/cmds.c
index 950a2cf..edb41d1 100644
--- a/usr.sbin/timed/timedc/cmds.c
+++ b/usr.sbin/timed/timedc/cmds.c
@@ -42,6 +42,8 @@ static const char rcsid[] =
#include "timedc.h"
#include <sys/file.h>
+#include <arpa/inet.h>
+
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
diff --git a/usr.sbin/ypbind/yp_ping.c b/usr.sbin/ypbind/yp_ping.c
index 3983ff3..9252a74 100644
--- a/usr.sbin/ypbind/yp_ping.c
+++ b/usr.sbin/ypbind/yp_ping.c
@@ -90,6 +90,7 @@ static const char rcsid[] =
#include <sys/socket.h>
#include <sys/signal.h>
#include <sys/ioctl.h>
+#include <arpa/inet.h>
#include <net/if.h>
#include "yp_ping.h"
OpenPOWER on IntegriCloud