diff mbox series

[02/12] slirp: struct icmp/ethhdr ARE packed

Message ID 20180108172904.8772-3-f4bug@amsat.org
State New
Headers show
Series add HOST_SUPPORTS_UNALIGNED_ACCESS, reduce slirp warnings | expand

Commit Message

Philippe Mathieu-Daudé Jan. 8, 2018, 5:28 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 slirp/ip6_icmp.h | 6 +++---
 slirp/ip_icmp.h  | 2 +-
 slirp/slirp.h    | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

Comments

Thomas Huth Jan. 8, 2018, 5:43 p.m. UTC | #1
On 08.01.2018 18:28, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  slirp/ip6_icmp.h | 6 +++---
>  slirp/ip_icmp.h  | 2 +-
>  slirp/slirp.h    | 2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/slirp/ip6_icmp.h b/slirp/ip6_icmp.h
> index b3378b17b5..a4ccc69974 100644
> --- a/slirp/ip6_icmp.h
> +++ b/slirp/ip6_icmp.h
> @@ -17,20 +17,20 @@
>  struct icmp6_echo { /* Echo Messages */
>      uint16_t id;
>      uint16_t seq_num;
> -};
> +} QEMU_PACKED;
>  
>  union icmp6_error_body {
>      uint32_t unused;
>      uint32_t pointer;
>      uint32_t mtu;
> -};
> +} QEMU_PACKED;
>  
>  /*
>   * NDP Messages
>   */
>  struct ndp_rs {     /* Router Solicitation Message */
>      uint32_t reserved;
> -};
> +} QEMU_PACKED;
...
> diff --git a/slirp/slirp.h b/slirp/slirp.h
> index 9f29b52610..9a7287e7cc 100644
> --- a/slirp/slirp.h
> +++ b/slirp/slirp.h
> @@ -103,7 +103,7 @@ struct ethhdr {
>      unsigned char  h_dest[ETH_ALEN];   /* destination eth addr */
>      unsigned char  h_source[ETH_ALEN]; /* source ether addr    */
>      unsigned short h_proto;            /* packet type ID field */
> -};
> +} QEMU_PACKED;
>  
>  struct slirp_arphdr {
>      unsigned short ar_hrd;      /* format of hardware address */
> 

The above structs all look naturally aligned to me - so why do you need
the QEMU_PACKED here?

 Thomas
diff mbox series

Patch

diff --git a/slirp/ip6_icmp.h b/slirp/ip6_icmp.h
index b3378b17b5..a4ccc69974 100644
--- a/slirp/ip6_icmp.h
+++ b/slirp/ip6_icmp.h
@@ -17,20 +17,20 @@ 
 struct icmp6_echo { /* Echo Messages */
     uint16_t id;
     uint16_t seq_num;
-};
+} QEMU_PACKED;
 
 union icmp6_error_body {
     uint32_t unused;
     uint32_t pointer;
     uint32_t mtu;
-};
+} QEMU_PACKED;
 
 /*
  * NDP Messages
  */
 struct ndp_rs {     /* Router Solicitation Message */
     uint32_t reserved;
-};
+} QEMU_PACKED;
 
 struct ndp_ra {     /* Router Advertisement Message */
     uint8_t chl;    /* Cur Hop Limit */
diff --git a/slirp/ip_icmp.h b/slirp/ip_icmp.h
index d88ab34c1b..e53242bdd8 100644
--- a/slirp/ip_icmp.h
+++ b/slirp/ip_icmp.h
@@ -88,7 +88,7 @@  struct icmp {
 #define	icmp_ip		icmp_dun.id_ip.idi_ip
 #define	icmp_mask	icmp_dun.id_mask
 #define	icmp_data	icmp_dun.id_data
-};
+} QEMU_PACKED;
 
 /*
  * Lower bounds on packet lengths for various types.
diff --git a/slirp/slirp.h b/slirp/slirp.h
index 9f29b52610..9a7287e7cc 100644
--- a/slirp/slirp.h
+++ b/slirp/slirp.h
@@ -103,7 +103,7 @@  struct ethhdr {
     unsigned char  h_dest[ETH_ALEN];   /* destination eth addr */
     unsigned char  h_source[ETH_ALEN]; /* source ether addr    */
     unsigned short h_proto;            /* packet type ID field */
-};
+} QEMU_PACKED;
 
 struct slirp_arphdr {
     unsigned short ar_hrd;      /* format of hardware address */