diff options
author | Luigi Rizzo <luigi@FreeBSD.org> | 2009-02-13 15:14:43 +0000 |
---|---|---|
committer | Luigi Rizzo <luigi@FreeBSD.org> | 2009-02-13 15:14:43 +0000 |
commit | d685b6ee05ef4f104a4deb6df0339dabc2c15e61 (patch) | |
tree | f9961350adcc7bd13c688e2b550c9447ac90cfaf /sys/netinet/ip_options.c | |
parent | 4f6b49338e96612ed4c55cf6aa850d32b6f56ea2 (diff) | |
download | src-d685b6ee05ef4f104a4deb6df0339dabc2c15e61.tar.gz src-d685b6ee05ef4f104a4deb6df0339dabc2c15e61.zip |
Use uint32_t instead of n_long and n_time, and uint16_t instead of n_short.
Add a note next to fields in network format.
The n_* types are not enough for compiler checks on endianness, and their
use often requires an otherwise unnecessary #include <netinet/in_systm.h>
The typedef in in_systm.h are still there.
Notes
Notes:
svn path=/head/; revision=188578
Diffstat (limited to 'sys/netinet/ip_options.c')
-rw-r--r-- | sys/netinet/ip_options.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/netinet/ip_options.c b/sys/netinet/ip_options.c index 1a97c6fe14e2..27b1569082fc 100644 --- a/sys/netinet/ip_options.c +++ b/sys/netinet/ip_options.c @@ -105,7 +105,7 @@ ip_dooptions(struct mbuf *m, int pass) struct in_ifaddr *ia; int opt, optlen, cnt, off, code, type = ICMP_PARAMPROB, forward = 0; struct in_addr *sin, dst; - n_time ntime; + uint32_t ntime; struct sockaddr_in ipaddr = { sizeof(ipaddr), AF_INET }; /* Ignore or reject packets with IP options. */ @@ -320,7 +320,7 @@ dropit: break; case IPOPT_TS_TSANDADDR: - if (off + sizeof(n_time) + + if (off + sizeof(uint32_t) + sizeof(struct in_addr) > optlen) { code = &cp[IPOPT_OFFSET] - (u_char *)ip; goto bad; @@ -337,7 +337,7 @@ dropit: break; case IPOPT_TS_PRESPEC: - if (off + sizeof(n_time) + + if (off + sizeof(uint32_t) + sizeof(struct in_addr) > optlen) { code = &cp[IPOPT_OFFSET] - (u_char *)ip; goto bad; @@ -355,8 +355,8 @@ dropit: goto bad; } ntime = iptime(); - (void)memcpy(cp + off, &ntime, sizeof(n_time)); - cp[IPOPT_OFFSET] += sizeof(n_time); + (void)memcpy(cp + off, &ntime, sizeof(uint32_t)); + cp[IPOPT_OFFSET] += sizeof(uint32_t); } } if (forward && V_ipforwarding) { |