Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Remove __packed from various network structures



details:   https://anonhg.NetBSD.org/src/rev/27b4787c2827
branches:  trunk
changeset: 959161:27b4787c2827
user:      roy <roy%NetBSD.org@localhost>
date:      Wed Feb 03 05:51:40 2021 +0000

description:
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.

diffstat:

 sys/net/if_arp.h        |   4 ++--
 sys/net/if_ether.h      |   6 +++---
 sys/net/if_gre.h        |   4 ++--
 sys/netinet/if_ether.h  |   4 ++--
 sys/netinet/igmp.h      |   4 ++--
 sys/netinet/in.h        |   4 ++--
 sys/netinet/ip.h        |  12 ++++++------
 sys/netinet/ip6.h       |   4 ++--
 sys/netinet/ip_carp.h   |   8 ++++++--
 sys/netinet/ip_icmp.h   |  24 ++++++++++++------------
 sys/netinet/ip_mroute.h |   4 ++--
 sys/netinet/ip_var.h    |   4 ++--
 sys/netinet/tcp.h       |   4 ++--
 sys/netinet/tcp_debug.h |   6 +++---
 sys/netinet/tcp_var.h   |   4 ++--
 sys/netinet/udp.h       |   4 ++--
 sys/netinet/udp_var.h   |   6 +++---
 17 files changed, 55 insertions(+), 51 deletions(-)

diffs (truncated from 429 to 300 lines):

diff -r 6805c1494d33 -r 27b4787c2827 sys/net/if_arp.h
--- a/sys/net/if_arp.h  Tue Feb 02 21:45:39 2021 +0000
+++ b/sys/net/if_arp.h  Wed Feb 03 05:51:40 2021 +0000
@@ -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 @@
        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)
diff -r 6805c1494d33 -r 27b4787c2827 sys/net/if_ether.h
--- a/sys/net/if_ether.h        Tue Feb 02 21:45:39 2021 +0000
+++ b/sys/net/if_ether.h        Wed Feb 03 05:51:40 2021 +0000
@@ -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 @@
        uint8_t  ether_dhost[ETHER_ADDR_LEN];
        uint8_t  ether_shost[ETHER_ADDR_LEN];
        uint16_t ether_type;
-} __packed;
+};
 
 #include <net/ethertypes.h>
 
diff -r 6805c1494d33 -r 27b4787c2827 sys/net/if_gre.h
--- a/sys/net/if_gre.h  Tue Feb 02 21:45:39 2021 +0000
+++ b/sys/net/if_gre.h  Wed Feb 03 05:51:40 2021 +0000
@@ -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_sre[] routing Routing fileds (see below)
                                Present if (rt_pres == 1)
  */
-} __packed;
+};
 
 #define GRE_CP         0x8000  /* Checksum Present */
 #define GRE_RP         0x4000  /* Routing Present */
diff -r 6805c1494d33 -r 27b4787c2827 sys/netinet/if_ether.h
--- a/sys/netinet/if_ether.h    Tue Feb 02 21:45:39 2021 +0000
+++ b/sys/netinet/if_ether.h    Wed Feb 03 05:51:40 2021 +0000
@@ -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 @@
        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
diff -r 6805c1494d33 -r 27b4787c2827 sys/netinet/igmp.h
--- a/sys/netinet/igmp.h        Tue Feb 02 21:45:39 2021 +0000
+++ b/sys/netinet/igmp.h        Wed Feb 03 05:51:40 2021 +0000
@@ -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 @@
        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
 
diff -r 6805c1494d33 -r 27b4787c2827 sys/netinet/in.h
--- a/sys/netinet/in.h  Tue Feb 02 21:45:39 2021 +0000
+++ b/sys/netinet/in.h  Wed Feb 03 05:51:40 2021 +0000
@@ -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 @@
  */
 struct in_addr {
        in_addr_t s_addr;
-} __packed;
+};
 
 /*
  * Definitions of bits in internet address integers.
diff -r 6805c1494d33 -r 27b4787c2827 sys/netinet/ip.h
--- a/sys/netinet/ip.h  Tue Feb 02 21:45:39 2021 +0000
+++ b/sys/netinet/ip.h  Wed Feb 03 05:51:40 2021 +0000
@@ -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 @@
        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 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 @@
        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_ */
diff -r 6805c1494d33 -r 27b4787c2827 sys/netinet/ip6.h
--- a/sys/netinet/ip6.h Tue Feb 02 21:45:39 2021 +0000
+++ b/sys/netinet/ip6.h Wed Feb 03 05:51:40 2021 +0000
@@ -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 @@
        u_int32_t       ip6ph_len;
        u_int8_t        ip6ph_zero[3];
        u_int8_t        ip6ph_nxt;
-} __packed;
+};
 #endif
 
 /*
diff -r 6805c1494d33 -r 27b4787c2827 sys/netinet/ip_carp.h
--- a/sys/netinet/ip_carp.h     Tue Feb 02 21:45:39 2021 +0000
+++ b/sys/netinet/ip_carp.h     Wed Feb 03 05:51:40 2021 +0000
@@ -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 @@
        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
 
diff -r 6805c1494d33 -r 27b4787c2827 sys/netinet/ip_icmp.h
--- a/sys/netinet/ip_icmp.h     Tue Feb 02 21:45:39 2021 +0000
+++ b/sys/netinet/ip_icmp.h     Wed Feb 03 05:51:40 2021 +0000
@@ -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 @@
                        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 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 @@
                        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 @@
                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 @@
 #endif
        uint8_t rsvd2;
        uint16_t checksum;
-} __packed;
+};
 
 /*
  * ICMP Extension Object Header (RFC4884).
@@ -158,7 +158,7 @@
        uint16_t length;
        uint8_t class_num;
        uint8_t c_type;
-} __packed;
+};
 
 /*
  * Lower bounds on packet lengths for various types.
diff -r 6805c1494d33 -r 27b4787c2827 sys/netinet/ip_mroute.h
--- a/sys/netinet/ip_mroute.h   Tue Feb 02 21:45:39 2021 +0000
+++ b/sys/netinet/ip_mroute.h   Wed Feb 03 05:51:40 2021 +0000
@@ -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_



Home | Main Index | Thread Index | Old Index