Module Name:    src
Committed By:   roy
Date:           Wed Feb  3 05:51:40 UTC 2021

Modified Files:
        src/sys/net: if_arp.h if_ether.h if_gre.h
        src/sys/netinet: if_ether.h igmp.h in.h ip.h ip6.h ip_carp.h ip_icmp.h
            ip_mroute.h ip_var.h tcp.h tcp_debug.h tcp_var.h udp.h udp_var.h

Log Message:
Remove __packed from various network structures

They are already network aligned and adding the __packed attribute
just causes needless compiler warnings about accssing members of packed
objects.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/net/if_arp.h
cvs rdiff -u -r1.81 -r1.82 src/sys/net/if_ether.h
cvs rdiff -u -r1.44 -r1.45 src/sys/net/if_gre.h
cvs rdiff -u -r1.34 -r1.35 src/sys/netinet/if_ether.h src/sys/netinet/tcp.h
cvs rdiff -u -r1.12 -r1.13 src/sys/netinet/igmp.h src/sys/netinet/ip_carp.h
cvs rdiff -u -r1.111 -r1.112 src/sys/netinet/in.h
cvs rdiff -u -r1.35 -r1.36 src/sys/netinet/ip.h
cvs rdiff -u -r1.26 -r1.27 src/sys/netinet/ip6.h
cvs rdiff -u -r1.40 -r1.41 src/sys/netinet/ip_icmp.h
cvs rdiff -u -r1.32 -r1.33 src/sys/netinet/ip_mroute.h
cvs rdiff -u -r1.130 -r1.131 src/sys/netinet/ip_var.h
cvs rdiff -u -r1.18 -r1.19 src/sys/netinet/tcp_debug.h
cvs rdiff -u -r1.192 -r1.193 src/sys/netinet/tcp_var.h
cvs rdiff -u -r1.16 -r1.17 src/sys/netinet/udp.h
cvs rdiff -u -r1.46 -r1.47 src/sys/netinet/udp_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_arp.h
diff -u src/sys/net/if_arp.h:1.33 src/sys/net/if_arp.h:1.34
--- src/sys/net/if_arp.h:1.33	Sat Jun 30 15:08:04 2018
+++ src/sys/net/if_arp.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.h,v 1.33 2018/06/30 15:08:04 christos Exp $	*/
+/*	$NetBSD: if_arp.h,v 1.34 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1986, 1993
@@ -71,7 +71,7 @@ struct	arphdr {
 	uint8_t  ar_tha[];	/* target hardware address (!IEEE1394) */
 	uint8_t  ar_tpa[];	/* target protocol address */
 #endif
-} __packed;
+};
 
 static __inline uint8_t *
 ar_data(struct arphdr *ap)

Index: src/sys/net/if_ether.h
diff -u src/sys/net/if_ether.h:1.81 src/sys/net/if_ether.h:1.82
--- src/sys/net/if_ether.h:1.81	Wed Jul 17 03:26:24 2019
+++ src/sys/net/if_ether.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.81 2019/07/17 03:26:24 msaitoh Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.82 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -79,7 +79,7 @@
  */
 struct ether_addr {
 	uint8_t ether_addr_octet[ETHER_ADDR_LEN];
-} __packed;
+};
 
 /*
  * Structure of a 10Mb/s Ethernet header.
@@ -88,7 +88,7 @@ struct ether_header {
 	uint8_t  ether_dhost[ETHER_ADDR_LEN];
 	uint8_t  ether_shost[ETHER_ADDR_LEN];
 	uint16_t ether_type;
-} __packed;
+};
 
 #include <net/ethertypes.h>
 

Index: src/sys/net/if_gre.h
diff -u src/sys/net/if_gre.h:1.44 src/sys/net/if_gre.h:1.45
--- src/sys/net/if_gre.h:1.44	Tue Feb 26 09:43:37 2019
+++ src/sys/net/if_gre.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.h,v 1.44 2019/02/26 09:43:37 msaitoh Exp $ */
+/*	$NetBSD: if_gre.h,v 1.45 2021/02/03 05:51:40 roy Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@ struct gre_h {
 	struct gre_sre[] routing Routing fileds (see below)
 				Present if (rt_pres == 1)
  */
-} __packed;
+};
 
 #define GRE_CP		0x8000  /* Checksum Present */
 #define GRE_RP		0x4000  /* Routing Present */

Index: src/sys/netinet/if_ether.h
diff -u src/sys/netinet/if_ether.h:1.34 src/sys/netinet/if_ether.h:1.35
--- src/sys/netinet/if_ether.h:1.34	Tue Dec 25 18:33:46 2007
+++ src/sys/netinet/if_ether.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.34 2007/12/25 18:33:46 perry Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.35 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -75,7 +75,7 @@ struct	ether_arp {
 	u_int8_t arp_spa[4];			/* sender protocol address */
 	u_int8_t arp_tha[ETHER_ADDR_LEN];	/* target hardware address */
 	u_int8_t arp_tpa[4];			/* target protocol address */
-} __packed;
+};
 #define	arp_hrd	ea_hdr.ar_hrd
 #define	arp_pro	ea_hdr.ar_pro
 #define	arp_hln	ea_hdr.ar_hln
Index: src/sys/netinet/tcp.h
diff -u src/sys/netinet/tcp.h:1.34 src/sys/netinet/tcp.h:1.35
--- src/sys/netinet/tcp.h:1.34	Fri Nov  1 13:54:59 2019
+++ src/sys/netinet/tcp.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp.h,v 1.34 2019/11/01 13:54:59 christos Exp $	*/
+/*	$NetBSD: tcp.h,v 1.35 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -72,7 +72,7 @@ struct tcphdr {
 	uint16_t th_win;			/* window */
 	uint16_t th_sum;			/* checksum */
 	uint16_t th_urp;			/* urgent pointer */
-} __packed;
+};
 
 #define	TCPOPT_EOL		0
 #define	   TCPOLEN_EOL			1

Index: src/sys/netinet/igmp.h
diff -u src/sys/netinet/igmp.h:1.12 src/sys/netinet/igmp.h:1.13
--- src/sys/netinet/igmp.h:1.12	Thu May 29 23:02:48 2014
+++ src/sys/netinet/igmp.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: igmp.h,v 1.12 2014/05/29 23:02:48 rmind Exp $	*/
+/*	$NetBSD: igmp.h,v 1.13 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -88,7 +88,7 @@ struct igmp {
 	uint8_t		igmp_code;	/* code for routing sub-messages   */
 	uint16_t	igmp_cksum;	/* IP-style checksum               */
 	struct in_addr	igmp_group;	/* group address being reported    */
-} __packed;		/*  (zero for queries)             */
+};			/*  (zero for queries)             */
 
 #define	IGMP_MINLEN			8
 
Index: src/sys/netinet/ip_carp.h
diff -u src/sys/netinet/ip_carp.h:1.12 src/sys/netinet/ip_carp.h:1.13
--- src/sys/netinet/ip_carp.h:1.12	Mon Oct 12 15:18:48 2020
+++ src/sys/netinet/ip_carp.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_carp.h,v 1.12 2020/10/12 15:18:48 roy Exp $	*/
+/*	$NetBSD: ip_carp.h,v 1.13 2021/02/03 05:51:40 roy Exp $	*/
 /*	$OpenBSD: ip_carp.h,v 1.18 2005/04/20 23:00:41 mpf Exp $	*/
 
 /*
@@ -74,7 +74,11 @@ struct carp_header {
 	u_int16_t	carp_cksum;
 	u_int32_t	carp_counter[2];
 	unsigned char	carp_md[20];	/* SHA1 HMAC */
-} __packed;
+};
+
+#ifdef CTASSERT
+CTASSERT(sizeof(struct carp_header) == 36);
+#endif
 
 #define	CARP_DFLTTL		255
 

Index: src/sys/netinet/in.h
diff -u src/sys/netinet/in.h:1.111 src/sys/netinet/in.h:1.112
--- src/sys/netinet/in.h:1.111	Tue Sep  8 14:12:57 2020
+++ src/sys/netinet/in.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: in.h,v 1.111 2020/09/08 14:12:57 christos Exp $	*/
+/*	$NetBSD: in.h,v 1.112 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -157,7 +157,7 @@ typedef __sa_family_t	sa_family_t;
  */
 struct in_addr {
 	in_addr_t s_addr;
-} __packed;
+};
 
 /*
  * Definitions of bits in internet address integers.

Index: src/sys/netinet/ip.h
diff -u src/sys/netinet/ip.h:1.35 src/sys/netinet/ip.h:1.36
--- src/sys/netinet/ip.h:1.35	Fri Aug 28 07:01:57 2020
+++ src/sys/netinet/ip.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip.h,v 1.35 2020/08/28 07:01:57 riastradh Exp $	*/
+/*	$NetBSD: ip.h,v 1.36 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -70,7 +70,7 @@ struct ip {
 	u_int8_t  ip_p;			/* protocol */
 	u_int16_t ip_sum;		/* checksum */
 	struct	  in_addr ip_src, ip_dst; /* source and dest address */
-} __packed;
+};
 
 #define	IP_MAXPACKET	65535		/* maximum packet size */
 #define	IP_MINFRAGSIZE	69		/* minumum size that can be fraged */
@@ -207,9 +207,9 @@ struct	ip_timestamp {
 		 struct	ipt_ta {
 			struct in_addr ipt_addr;
 			n_time ipt_time;
-		 } ipt_ta[1] __packed;
-	} ipt_timestamp __packed;
-} __packed;
+		 } ipt_ta[1];
+	} ipt_timestamp;
+};
 
 /* flag bits for ipt_flg */
 #define	IPOPT_TS_TSONLY		0		/* timestamps only */
@@ -246,6 +246,6 @@ struct ippseudo {
 	u_int8_t	ippseudo_pad;	/* pad, must be zero */
 	u_int8_t	ippseudo_p;	/* protocol */
 	u_int16_t	ippseudo_len;	/* protocol length */
-} __packed;
+};
 
 #endif	/* !_NETINET_IP_H_ */

Index: src/sys/netinet/ip6.h
diff -u src/sys/netinet/ip6.h:1.26 src/sys/netinet/ip6.h:1.27
--- src/sys/netinet/ip6.h:1.26	Mon Jul 27 14:06:58 2020
+++ src/sys/netinet/ip6.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6.h,v 1.26 2020/07/27 14:06:58 roy Exp $	*/
+/*	$NetBSD: ip6.h,v 1.27 2021/02/03 05:51:40 roy Exp $	*/
 /*	$KAME: ip6.h,v 1.45 2003/06/05 04:46:38 keiichi Exp $	*/
 
 /*
@@ -119,7 +119,7 @@ struct ip6_hdr_pseudo {
 	u_int32_t	ip6ph_len;
 	u_int8_t	ip6ph_zero[3];
 	u_int8_t	ip6ph_nxt;
-} __packed;
+};
 #endif
 
 /*

Index: src/sys/netinet/ip_icmp.h
diff -u src/sys/netinet/ip_icmp.h:1.40 src/sys/netinet/ip_icmp.h:1.41
--- src/sys/netinet/ip_icmp.h:1.40	Fri Sep 14 05:09:51 2018
+++ src/sys/netinet/ip_icmp.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_icmp.h,v 1.40 2018/09/14 05:09:51 maxv Exp $	*/
+/*	$NetBSD: ip_icmp.h,v 1.41 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -45,7 +45,7 @@
 struct icmp_ra_addr {
 	uint32_t ira_addr;
 	uint32_t ira_preference;
-} __packed;
+};
 
 /*
  * Structure of an icmp header.
@@ -63,7 +63,7 @@ struct icmp {
 			uint8_t iex_void1;
 			uint8_t iex_length;
 			uint16_t iex_void2;
-		} ih_exthdr __packed;
+		} ih_exthdr;
 
 		/* ICMP_PARAMPROB */
 		uint8_t ih_pptr;
@@ -75,21 +75,21 @@ struct icmp {
 		struct ih_idseq {
 			uint16_t icd_id;
 			uint16_t icd_seq;
-		} ih_idseq __packed;
+		} ih_idseq;
 
 		/* ICMP_UNREACH_NEEDFRAG (Path MTU Discovery, RFC1191) */
 		struct ih_pmtu {
 			uint16_t ipm_void;
 			uint16_t ipm_nextmtu;
-		} ih_pmtu __packed;
+		} ih_pmtu;
 
 		/* ICMP_ROUTERADVERT */
 		struct ih_rtradv {
 			uint8_t irt_num_addrs;
 			uint8_t irt_wpa;
 			uint16_t irt_lifetime;
-		} ih_rtradv __packed;
-	} icmp_hun /* XXX __packed ??? */;
+		} ih_rtradv;
+	} icmp_hun;
 
 #define icmp_pptr	icmp_hun.ih_pptr
 #define icmp_gwaddr	icmp_hun.ih_gwaddr
@@ -108,12 +108,12 @@ struct icmp {
 			uint32_t its_otime;
 			uint32_t its_rtime;
 			uint32_t its_ttime;
-		} id_ts __packed;
+		} id_ts;
 
 		struct id_ip {
 			struct ip idi_ip;
 			/* options and then 64 bits of data */
-		} id_ip /* XXX: __packed ??? */;
+		} id_ip;
 
 		/* ICMP_ROUTERADVERT */
 		struct icmp_ra_addr id_radv;
@@ -122,7 +122,7 @@ struct icmp {
 		uint32_t id_mask;
 
 		int8_t id_data[1];
-	} icmp_dun /* XXX __packed ??? */;
+	} icmp_dun;
 
 #define icmp_otime	icmp_dun.id_ts.its_otime
 #define icmp_rtime	icmp_dun.id_ts.its_rtime
@@ -149,7 +149,7 @@ struct icmp_ext_hdr {
 #endif
 	uint8_t rsvd2;
 	uint16_t checksum;
-} __packed;
+};
 
 /*
  * ICMP Extension Object Header (RFC4884).
@@ -158,7 +158,7 @@ struct icmp_ext_obj_hdr {
 	uint16_t length;
 	uint8_t class_num;
 	uint8_t c_type;
-} __packed;
+};
 
 /*
  * Lower bounds on packet lengths for various types.

Index: src/sys/netinet/ip_mroute.h
diff -u src/sys/netinet/ip_mroute.h:1.32 src/sys/netinet/ip_mroute.h:1.33
--- src/sys/netinet/ip_mroute.h:1.32	Wed Feb  7 11:42:58 2018
+++ src/sys/netinet/ip_mroute.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_mroute.h,v 1.32 2018/02/07 11:42:58 maxv Exp $	*/
+/*	$NetBSD: ip_mroute.h,v 1.33 2021/02/03 05:51:40 roy Exp $	*/
 
 #ifndef _NETINET_IP_MROUTE_H_
 #define _NETINET_IP_MROUTE_H_
@@ -283,7 +283,7 @@ struct igmpmsg {
 	u_int8_t  im_vif;		/* vif rec'd on */
 	u_int8_t  unused3;
 	struct	  in_addr im_src, im_dst;
-} __packed;
+};
 
 /*
  * Argument structure used for pkt info. while upcall is made.

Index: src/sys/netinet/ip_var.h
diff -u src/sys/netinet/ip_var.h:1.130 src/sys/netinet/ip_var.h:1.131
--- src/sys/netinet/ip_var.h:1.130	Fri Aug 28 06:31:42 2020
+++ src/sys/netinet/ip_var.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_var.h,v 1.130 2020/08/28 06:31:42 ozaki-r Exp $	*/
+/*	$NetBSD: ip_var.h,v 1.131 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -46,7 +46,7 @@ struct ipovly {
 	u_int16_t ih_len;		/* protocol length */
 	struct	  in_addr ih_src;	/* source internet address */
 	struct	  in_addr ih_dst;	/* destination internet address */
-} __packed;
+};
 
 /*
  * IP Flow structure

Index: src/sys/netinet/tcp_debug.h
diff -u src/sys/netinet/tcp_debug.h:1.18 src/sys/netinet/tcp_debug.h:1.19
--- src/sys/netinet/tcp_debug.h:1.18	Tue May  1 07:03:33 2018
+++ src/sys/netinet/tcp_debug.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_debug.h,v 1.18 2018/05/01 07:03:33 maxv Exp $	*/
+/*	$NetBSD: tcp_debug.h,v 1.19 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -47,7 +47,7 @@ struct	tcp_debug {
 	struct {
 		struct ip ip4;
 		struct tcphdr th;
-	} __packed td_ti;
+	} td_ti;
 	struct {
 #ifdef INET6
 		struct ip6_hdr ip6;
@@ -60,7 +60,7 @@ struct	tcp_debug {
 	struct	tcpcb td_cb;
 };
 
-#define	TA_INPUT 	0
+#define	TA_INPUT	0
 #define	TA_OUTPUT	1
 #define	TA_USER		2
 #define	TA_RESPOND	3

Index: src/sys/netinet/tcp_var.h
diff -u src/sys/netinet/tcp_var.h:1.192 src/sys/netinet/tcp_var.h:1.193
--- src/sys/netinet/tcp_var.h:1.192	Thu Mar  5 15:18:55 2020
+++ src/sys/netinet/tcp_var.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_var.h,v 1.192 2020/03/05 15:18:55 riastradh Exp $	*/
+/*	$NetBSD: tcp_var.h,v 1.193 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -168,7 +168,7 @@
 struct tcpiphdr {
 	struct ipovly ti_i;		/* overlaid ip structure */
 	struct tcphdr ti_t;		/* tcp header */
-} __packed;
+};
 #define	ti_x1		ti_i.ih_x1
 #define	ti_pr		ti_i.ih_pr
 #define	ti_len		ti_i.ih_len

Index: src/sys/netinet/udp.h
diff -u src/sys/netinet/udp.h:1.16 src/sys/netinet/udp.h:1.17
--- src/sys/netinet/udp.h:1.16	Fri Jun 22 14:54:35 2012
+++ src/sys/netinet/udp.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: udp.h,v 1.16 2012/06/22 14:54:35 christos Exp $	*/
+/*	$NetBSD: udp.h,v 1.17 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -44,7 +44,7 @@ struct udphdr {
 	uint16_t uh_dport;		/* destination port */
 	uint16_t uh_ulen;		/* udp length */
 	uint16_t uh_sum;		/* udp checksum */
-} __packed;
+};
 
 /* socket options for UDP */
 #define	UDP_ENCAP	100

Index: src/sys/netinet/udp_var.h
diff -u src/sys/netinet/udp_var.h:1.46 src/sys/netinet/udp_var.h:1.47
--- src/sys/netinet/udp_var.h:1.46	Thu Aug 20 21:21:32 2020
+++ src/sys/netinet/udp_var.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: udp_var.h,v 1.46 2020/08/20 21:21:32 riastradh Exp $	*/
+/*	$NetBSD: udp_var.h,v 1.47 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -38,9 +38,9 @@
  * UDP kernel structures and variables.
  */
 struct	udpiphdr {
-	struct 	ipovly ui_i;		/* overlaid ip structure */
+	struct	ipovly ui_i;		/* overlaid ip structure */
 	struct	udphdr ui_u;		/* udp header */
-} __packed;
+};
 #define	ui_x1		ui_i.ih_x1
 #define	ui_pr		ui_i.ih_pr
 #define	ui_len		ui_i.ih_len

Reply via email to