From: mpi Date: Sun, 13 Jul 2014 13:57:56 +0000 (+0000) Subject: Stop using old n_time, n_long and n_short types in netinet headers. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f5676b7bba9160cbfd10f276a851b67aaf300083;p=openbsd Stop using old n_time, n_long and n_short types in netinet headers. ok deraadt@, naddy@ --- diff --git a/sys/netinet/in_systm.h b/sys/netinet/in_systm.h index febf30f4fc1..222782cf034 100644 --- a/sys/netinet/in_systm.h +++ b/sys/netinet/in_systm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in_systm.h,v 1.6 2013/10/19 14:50:21 deraadt Exp $ */ +/* $OpenBSD: in_systm.h,v 1.7 2014/07/13 13:57:56 mpi Exp $ */ /* $NetBSD: in_systm.h,v 1.8 1995/04/13 06:29:22 cgd Exp $ */ /* @@ -41,7 +41,7 @@ typedef u_int32_t n_long; typedef u_int32_t n_time; /* ms since 00:00 GMT */ #ifdef _KERNEL -n_time iptime(void); +u_int32_t iptime(void); #endif /* _KERNEL */ #endif /* _NETINET_IN_SYSTM_H_ */ diff --git a/sys/netinet/ip.h b/sys/netinet/ip.h index 16a06272fea..a208fcd8f8d 100644 --- a/sys/netinet/ip.h +++ b/sys/netinet/ip.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip.h,v 1.15 2014/05/12 09:15:00 mpi Exp $ */ +/* $OpenBSD: ip.h,v 1.16 2014/07/13 13:57:56 mpi Exp $ */ /* $NetBSD: ip.h,v 1.9 1995/05/15 01:22:44 cgd Exp $ */ /* @@ -176,10 +176,10 @@ struct ip_timestamp { ipt_flg:4; /* flags, see below */ #endif union ipt_timestamp { - n_time ipt_time[1]; + u_int32_t ipt_time[1]; struct ipt_ta { struct in_addr ipt_addr; - n_time ipt_time; + u_int32_t ipt_time; } ipt_ta[1]; } ipt_timestamp; }; diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 1e3fa7c336d..94931485874 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.c,v 1.122 2014/05/07 08:09:33 mpi Exp $ */ +/* $OpenBSD: ip_icmp.c,v 1.123 2014/07/13 13:57:56 mpi Exp $ */ /* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */ /* @@ -143,7 +143,7 @@ icmp_init(void) } struct mbuf * -icmp_do_error(struct mbuf *n, int type, int code, n_long dest, int destmtu) +icmp_do_error(struct mbuf *n, int type, int code, u_int32_t dest, int destmtu) { struct ip *oip = mtod(n, struct ip *), *nip; unsigned oiplen = oip->ip_hl << 2; @@ -289,7 +289,7 @@ freeit: * The ip packet inside has ip_off and ip_len in host byte order. */ void -icmp_error(struct mbuf *n, int type, int code, n_long dest, int destmtu) +icmp_error(struct mbuf *n, int type, int code, u_int32_t dest, int destmtu) { struct mbuf *m; @@ -849,7 +849,7 @@ icmp_send(struct mbuf *m, struct mbuf *opts) ip_output(m, opts, NULL, 0, NULL, NULL, 0); } -n_time +u_int32_t iptime(void) { struct timeval atv; diff --git a/sys/netinet/ip_icmp.h b/sys/netinet/ip_icmp.h index 04c54458b3a..eaa22da83f0 100644 --- a/sys/netinet/ip_icmp.h +++ b/sys/netinet/ip_icmp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.h,v 1.25 2013/08/08 14:29:29 mpi Exp $ */ +/* $OpenBSD: ip_icmp.h,v 1.26 2014/07/13 13:57:56 mpi Exp $ */ /* $NetBSD: ip_icmp.h,v 1.10 1996/02/13 23:42:28 christos Exp $ */ /* @@ -51,8 +51,8 @@ * ICMP Router Advertisement data */ struct icmp_ra_addr { - n_long ira_addr; - n_long ira_preference; + u_int32_t ira_addr; + u_int32_t ira_preference; }; /* @@ -70,21 +70,21 @@ struct icmp { } ih_exthdr; struct in_addr ih_gwaddr; /* ICMP_REDIRECT */ struct ih_idseq { - n_short icd_id; - n_short icd_seq; + u_int16_t icd_id; + u_int16_t icd_seq; } ih_idseq; int32_t ih_void; /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ struct ih_pmtu { - n_short ipm_void; - n_short ipm_nextmtu; + u_int16_t ipm_void; + u_int16_t ipm_nextmtu; } ih_pmtu; struct ih_rtradv { u_int8_t irt_num_addrs; u_int8_t irt_wpa; - n_short irt_lifetime; + u_int16_t irt_lifetime; } ih_rtradv; } icmp_hun; #define icmp_pptr icmp_hun.ih_pptr @@ -100,9 +100,9 @@ struct icmp { #define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime union { struct id_ts { - n_time its_otime; - n_time its_rtime; - n_time its_ttime; + u_int32_t its_otime; + u_int32_t its_rtime; + u_int32_t its_ttime; } id_ts; struct id_ip { struct ip idi_ip; @@ -153,7 +153,7 @@ struct icmp_ext_obj_hdr { * ip header length. */ #define ICMP_MINLEN 8 /* abs minimum */ -#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */ +#define ICMP_TSLEN (8 + 3 * sizeof (u_int32_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) @@ -230,8 +230,8 @@ struct icmp_ext_obj_hdr { #ifdef _KERNEL struct mbuf * - icmp_do_error(struct mbuf *, int, int, n_long, int); -void icmp_error(struct mbuf *, int, int, n_long, int); + icmp_do_error(struct mbuf *, int, int, u_int32_t, int); +void icmp_error(struct mbuf *, int, int, u_int32_t, int); void icmp_input(struct mbuf *, ...); void icmp_init(void); int icmp_reflect(struct mbuf *, struct mbuf **, struct in_ifaddr *); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 672cfbf5320..3cc4897d792 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.234 2014/06/04 12:20:00 mpi Exp $ */ +/* $OpenBSD: ip_input.c,v 1.235 2014/07/13 13:57:56 mpi Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -1008,7 +1008,7 @@ ip_dooptions(struct mbuf *m, struct ifnet *ifp) struct in_ifaddr *ia; int opt, optlen, cnt, off, code, type = ICMP_PARAMPROB, forward = 0; struct in_addr sin, dst; - n_time ntime; + u_int32_t ntime; dst = ip->ip_dst; cp = (u_char *)(ip + 1); @@ -1161,7 +1161,7 @@ ip_dooptions(struct mbuf *m, struct ifnet *ifp) memcpy(&ipt, cp, sizeof(struct ip_timestamp)); if (ipt.ipt_ptr < 5 || ipt.ipt_len < 5) goto bad; - if (ipt.ipt_ptr - 1 + sizeof(n_time) > ipt.ipt_len) { + if (ipt.ipt_ptr - 1 + sizeof(u_int32_t) > ipt.ipt_len) { if (++ipt.ipt_oflw == 0) goto bad; break; @@ -1173,7 +1173,7 @@ ip_dooptions(struct mbuf *m, struct ifnet *ifp) break; case IPOPT_TS_TSANDADDR: - if (ipt.ipt_ptr - 1 + sizeof(n_time) + + if (ipt.ipt_ptr - 1 + sizeof(u_int32_t) + sizeof(struct in_addr) > ipt.ipt_len) goto bad; memset(&ipaddr, 0, sizeof(ipaddr)); @@ -1190,7 +1190,7 @@ ip_dooptions(struct mbuf *m, struct ifnet *ifp) break; case IPOPT_TS_PRESPEC: - if (ipt.ipt_ptr - 1 + sizeof(n_time) + + if (ipt.ipt_ptr - 1 + sizeof(u_int32_t) + sizeof(struct in_addr) > ipt.ipt_len) goto bad; memset(&ipaddr, 0, sizeof(ipaddr)); @@ -1210,8 +1210,8 @@ ip_dooptions(struct mbuf *m, struct ifnet *ifp) goto bad; } ntime = iptime(); - memcpy(cp + ipt.ipt_ptr - 1, &ntime, sizeof(n_time)); - ipt.ipt_ptr += sizeof(n_time); + memcpy(cp + ipt.ipt_ptr - 1, &ntime, sizeof(u_int32_t)); + ipt.ipt_ptr += sizeof(u_int32_t); } } if (forward && ipforwarding) { @@ -1396,7 +1396,7 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, int srcrt) struct rtentry *rt; int error, type = 0, code = 0, destmtu = 0, fake = 0, len; u_int rtableid = 0; - n_long dest; + u_int32_t dest; dest = 0; if (m->m_flags & (M_BCAST|M_MCAST) || in_canforward(ip->ip_dst) == 0) { diff --git a/sys/netinet/tcp_debug.h b/sys/netinet/tcp_debug.h index 7d42e0152d7..8111ca24f9b 100644 --- a/sys/netinet/tcp_debug.h +++ b/sys/netinet/tcp_debug.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_debug.h,v 1.7 2003/06/02 23:28:14 millert Exp $ */ +/* $OpenBSD: tcp_debug.h,v 1.8 2014/07/13 13:57:56 mpi Exp $ */ /* $NetBSD: tcp_debug.h,v 1.5 1994/06/29 06:38:38 cgd Exp $ */ /* @@ -38,7 +38,7 @@ #include struct tcp_debug { - n_time td_time; + uint32_t td_time; short td_act; short td_ostate; caddr_t td_tcb;