svn commit: r188587 - stable/7/sys/netinet

Robert Watson rwatson at FreeBSD.org
Fri Feb 13 10:54:38 PST 2009


On Fri, 13 Feb 2009, Luigi Rizzo wrote:

> Author: luigi
> Date: Fri Feb 13 18:09:38 2009
> New Revision: 188587
> URL: http://svn.freebsd.org/changeset/base/188587
>
> Log:
>  MFC - replace usage of n_* types with uint*_t , to help removing
>  unnecessary dependencies on in_systm.h

As harmless as these changes may seem, insta-MFCs often come with unexpected 
side effects.  A three day MFC wait will also never hurt for what are 
definitely not critical bug fixes :-).

Robert N M Watson
Computer Laboratory
University of Cambridge

>
> Modified:
>  stable/7/sys/netinet/in_systm.h
>  stable/7/sys/netinet/ip.h
>  stable/7/sys/netinet/ip_icmp.c
>  stable/7/sys/netinet/ip_icmp.h
>  stable/7/sys/netinet/ip_options.c
>  stable/7/sys/netinet/tcp_debug.h
>  stable/7/sys/netinet/tcp_subr.c
>
> Modified: stable/7/sys/netinet/in_systm.h
> ==============================================================================
> --- stable/7/sys/netinet/in_systm.h	Fri Feb 13 18:04:55 2009	(r188586)
> +++ stable/7/sys/netinet/in_systm.h	Fri Feb 13 18:09:38 2009	(r188587)
> @@ -52,7 +52,7 @@ typedef u_int32_t n_long;		/* long as re
> 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
>
> Modified: stable/7/sys/netinet/ip.h
> ==============================================================================
> --- stable/7/sys/netinet/ip.h	Fri Feb 13 18:04:55 2009	(r188586)
> +++ stable/7/sys/netinet/ip.h	Fri Feb 13 18:09:38 2009	(r188587)
> @@ -159,10 +159,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;
> };
>
> Modified: stable/7/sys/netinet/ip_icmp.c
> ==============================================================================
> --- stable/7/sys/netinet/ip_icmp.c	Fri Feb 13 18:04:55 2009	(r188586)
> +++ stable/7/sys/netinet/ip_icmp.c	Fri Feb 13 18:09:38 2009	(r188587)
> @@ -141,7 +141,7 @@ extern	struct protosw inetsw[];
>  * 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)
> {
> 	register struct ip *oip = mtod(n, struct ip *), *nip;
> 	register unsigned oiphlen = oip->ip_hl << 2;
> @@ -825,7 +825,10 @@ icmp_send(struct mbuf *m, struct mbuf *o
> 	(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;
>
> Modified: stable/7/sys/netinet/ip_icmp.h
> ==============================================================================
> --- stable/7/sys/netinet/ip_icmp.h	Fri Feb 13 18:04:55 2009	(r188586)
> +++ stable/7/sys/netinet/ip_icmp.h	Fri Feb 13 18:09:38 2009	(r188587)
> @@ -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);
> int	ip_next_mtu(int, int);
> #endif
>
> Modified: stable/7/sys/netinet/ip_options.c
> ==============================================================================
> --- stable/7/sys/netinet/ip_options.c	Fri Feb 13 18:04:55 2009	(r188586)
> +++ stable/7/sys/netinet/ip_options.c	Fri Feb 13 18:09:38 2009	(r188587)
> @@ -102,7 +102,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. */
> @@ -317,7 +317,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;
> @@ -334,7 +334,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;
> @@ -352,8 +352,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 && ipforwarding) {
>
> Modified: stable/7/sys/netinet/tcp_debug.h
> ==============================================================================
> --- stable/7/sys/netinet/tcp_debug.h	Fri Feb 13 18:04:55 2009	(r188586)
> +++ stable/7/sys/netinet/tcp_debug.h	Fri Feb 13 18:09:38 2009	(r188587)
> @@ -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;
>
> Modified: stable/7/sys/netinet/tcp_subr.c
> ==============================================================================
> --- stable/7/sys/netinet/tcp_subr.c	Fri Feb 13 18:04:55 2009	(r188586)
> +++ stable/7/sys/netinet/tcp_subr.c	Fri Feb 13 18:09:38 2009	(r188587)
> @@ -484,7 +484,7 @@ tcp_respond(struct tcpcb *tp, void *ipge
> 		} 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) {
> @@ -496,7 +496,7 @@ tcp_respond(struct tcpcb *tp, void *ipge
> 			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
>


More information about the svn-src-stable-7 mailing list