summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/netinet/in_systm.h2
-rw-r--r--sys/netinet/ip.h4
-rw-r--r--sys/netinet/ip_icmp.c7
-rw-r--r--sys/netinet/ip_icmp.h22
-rw-r--r--sys/netinet/ip_options.c10
-rw-r--r--sys/netinet/tcp_debug.h2
-rw-r--r--sys/netinet/tcp_subr.c4
7 files changed, 29 insertions, 22 deletions
diff --git a/sys/netinet/in_systm.h b/sys/netinet/in_systm.h
index 8ae8885..4b34aa0 100644
--- a/sys/netinet/in_systm.h
+++ b/sys/netinet/in_systm.h
@@ -52,7 +52,7 @@ typedef u_int32_t n_long; /* long as received from the net */
typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */
#ifdef _KERNEL
-n_time iptime(void);
+uint32_t iptime(void);
#endif
#endif
diff --git a/sys/netinet/ip.h b/sys/netinet/ip.h
index 00d9cc1..daee533 100644
--- a/sys/netinet/ip.h
+++ b/sys/netinet/ip.h
@@ -150,10 +150,10 @@ struct ip_timestamp {
ipt_flg:4; /* flags, see below */
#endif
union ipt_timestamp {
- n_long ipt_time[1];
+ uint32_t ipt_time[1]; /* network format */
struct ipt_ta {
struct in_addr ipt_addr;
- n_long ipt_time;
+ uint32_t ipt_time; /* network format */
} ipt_ta[1];
} ipt_timestamp;
};
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 3666f5c..baf07d3 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -165,7 +165,7 @@ icmp_init(void)
* in response to bad packet ip.
*/
void
-icmp_error(struct mbuf *n, int type, int code, n_long dest, int mtu)
+icmp_error(struct mbuf *n, int type, int code, uint32_t dest, int mtu)
{
INIT_VNET_INET(curvnet);
register struct ip *oip = mtod(n, struct ip *), *nip;
@@ -852,7 +852,10 @@ icmp_send(struct mbuf *m, struct mbuf *opts)
(void) ip_output(m, opts, NULL, 0, NULL, NULL);
}
-n_time
+/*
+ * Return milliseconds since 00:00 GMT in network format.
+ */
+uint32_t
iptime(void)
{
struct timeval atv;
diff --git a/sys/netinet/ip_icmp.h b/sys/netinet/ip_icmp.h
index a55c6fc..e4ee7f7 100644
--- a/sys/netinet/ip_icmp.h
+++ b/sys/netinet/ip_icmp.h
@@ -68,15 +68,15 @@ struct icmp {
u_char ih_pptr; /* ICMP_PARAMPROB */
struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
struct ih_idseq {
- n_short icd_id;
- n_short icd_seq;
+ uint16_t icd_id; /* network format */
+ uint16_t icd_seq; /* network format */
} ih_idseq;
int ih_void;
/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
struct ih_pmtu {
- n_short ipm_void;
- n_short ipm_nextmtu;
+ uint16_t ipm_void; /* network format */
+ uint16_t ipm_nextmtu; /* network format */
} ih_pmtu;
struct ih_rtradv {
@@ -97,9 +97,13 @@ struct icmp {
#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
union {
struct id_ts { /* ICMP Timestamp */
- n_time its_otime; /* Originate */
- n_time its_rtime; /* Receive */
- n_time its_ttime; /* Transmit */
+ /*
+ * The next 3 fields are in network format,
+ * milliseconds since 00:00 GMT
+ */
+ uint32_t its_otime; /* Originate */
+ uint32_t its_rtime; /* Receive */
+ uint32_t its_ttime; /* Transmit */
} id_ts;
struct id_ip {
struct ip idi_ip;
@@ -127,7 +131,7 @@ struct icmp {
* ip header length.
*/
#define ICMP_MINLEN 8 /* abs minimum */
-#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
+#define ICMP_TSLEN (8 + 3 * sizeof (uint32_t)) /* timestamp */
#define ICMP_MASKLEN 12 /* address mask */
#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
@@ -202,7 +206,7 @@ struct icmp {
(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
#ifdef _KERNEL
-void icmp_error(struct mbuf *, int, int, n_long, int);
+void icmp_error(struct mbuf *, int, int, uint32_t, int);
void icmp_input(struct mbuf *, int);
void icmp_init(void);
int ip_next_mtu(int, int);
diff --git a/sys/netinet/ip_options.c b/sys/netinet/ip_options.c
index 1a97c6f..27b1569 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) {
diff --git a/sys/netinet/tcp_debug.h b/sys/netinet/tcp_debug.h
index 8547d0e..c4d38da 100644
--- a/sys/netinet/tcp_debug.h
+++ b/sys/netinet/tcp_debug.h
@@ -34,7 +34,7 @@
#define _NETINET_TCP_DEBUG_H_
struct tcp_debug {
- n_time td_time;
+ uint32_t td_time; /* network format */
short td_act;
short td_ostate;
caddr_t td_tcb;
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index bba7be3..11f4a81 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -581,7 +581,7 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m,
} else
#endif /* INET6 */
{
- xchg(ip->ip_dst.s_addr, ip->ip_src.s_addr, n_long);
+ xchg(ip->ip_dst.s_addr, ip->ip_src.s_addr, uint32_t);
nth = (struct tcphdr *)(ip + 1);
}
if (th != nth) {
@@ -593,7 +593,7 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m,
nth->th_sport = th->th_sport;
nth->th_dport = th->th_dport;
}
- xchg(nth->th_dport, nth->th_sport, n_short);
+ xchg(nth->th_dport, nth->th_sport, uint16_t);
#undef xchg
}
#ifdef INET6
OpenPOWER on IntegriCloud