diff options
author | mike <mike@FreeBSD.org> | 2002-02-18 20:35:27 +0000 |
---|---|---|
committer | mike <mike@FreeBSD.org> | 2002-02-18 20:35:27 +0000 |
commit | bcee06d42c20a8ea0e6c6ffb8924e16e7e793c0f (patch) | |
tree | 970c36894ee638248ec810bd7570ac8aabb5eaf5 /sbin | |
parent | f2e166dc7a7880a8564c2a7cb8ca2b94566d8d6b (diff) | |
download | FreeBSD-src-bcee06d42c20a8ea0e6c6ffb8924e16e7e793c0f.zip FreeBSD-src-bcee06d42c20a8ea0e6c6ffb8924e16e7e793c0f.tar.gz |
o Move NTOHL() and associated macros into <sys/param.h>. These are
deprecated in favor of the POSIX-defined lowercase variants.
o Change all occurrences of NTOHL() and associated marcros in the
source tree to use the lowercase function variants.
o Add missing license bits to sparc64's <machine/endian.h>.
Approved by: jake
o Clean up <machine/endian.h> files.
o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>.
o Remove prototypes for non-existent bswapXX() functions.
o Include <machine/endian.h> in <arpa/inet.h> to define the
POSIX-required ntohl() family of functions.
o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>,
and <sys/param.h>.
o Prepend underscores to the ntohl() family to help deal with
complexities associated with having MD (asm and inline) versions, and
having to prevent exposure of these functions in other headers that
happen to make use of endian-specific defines.
o Create weak aliases to the canonical function name to help deal with
third-party software forgetting to include an appropriate header.
o Remove some now unneeded pollution from <sys/types.h>.
o Add missing <arpa/inet.h> includes in userland.
Tested on: alpha, i386
Reviewed by: bde, jake, tmm
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/mount_cd9660/mount_cd9660.c | 2 | ||||
-rw-r--r-- | sbin/routed/if.c | 4 | ||||
-rw-r--r-- | sbin/routed/input.c | 6 | ||||
-rw-r--r-- | sbin/routed/output.c | 2 | ||||
-rw-r--r-- | sbin/routed/parms.c | 7 | ||||
-rw-r--r-- | sbin/routed/rtquery/rtquery.c | 4 | ||||
-rw-r--r-- | sbin/routed/table.c | 2 |
7 files changed, 15 insertions, 12 deletions
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. * |