diff mbox

[for-2.7] slirp: Rename "struct arphdr" to "struct slirp_arphdr"

Message ID 1471249494-17392-1-git-send-email-thuth@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Huth Aug. 15, 2016, 8:24 a.m. UTC
struct arphdr is already used by the system headers on OpenBSD
and thus QEMU does not compile here anymore. Fix it by renaming
our struct to slirp_arphdr instead.

Reported-by: Brad Smith
Buglink: https://bugs.launchpad.net/qemu/+bug/1613133
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 slirp/slirp.c | 10 +++++-----
 slirp/slirp.h |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Samuel Thibault Aug. 15, 2016, 11:24 a.m. UTC | #1
Thomas Huth, on Mon 15 Aug 2016 10:24:54 +0200, wrote:
> struct arphdr is already used by the system headers on OpenBSD
> and thus QEMU does not compile here anymore. Fix it by renaming
> our struct to slirp_arphdr instead.
> 
> Reported-by: Brad Smith
> Buglink: https://bugs.launchpad.net/qemu/+bug/1613133
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  slirp/slirp.c | 10 +++++-----
>  slirp/slirp.h |  4 ++--
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/slirp/slirp.c b/slirp/slirp.c
> index 47a1652..d67eda1 100644
> --- a/slirp/slirp.c
> +++ b/slirp/slirp.c
> @@ -773,10 +773,10 @@ void slirp_pollfds_poll(GArray *pollfds, int select_error)
>  
>  static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
>  {
> -    struct arphdr *ah = (struct arphdr *)(pkt + ETH_HLEN);
> -    uint8_t arp_reply[max(ETH_HLEN + sizeof(struct arphdr), 64)];
> +    struct slirp_arphdr *ah = (struct slirp_arphdr *)(pkt + ETH_HLEN);
> +    uint8_t arp_reply[max(ETH_HLEN + sizeof(struct slirp_arphdr), 64)];
>      struct ethhdr *reh = (struct ethhdr *)arp_reply;
> -    struct arphdr *rah = (struct arphdr *)(arp_reply + ETH_HLEN);
> +    struct slirp_arphdr *rah = (struct slirp_arphdr *)(arp_reply + ETH_HLEN);
>      int ar_op;
>      struct ex_list *ex_ptr;
>  
> @@ -890,9 +890,9 @@ static int if_encap4(Slirp *slirp, struct mbuf *ifm, struct ethhdr *eh,
>          return 1;
>      }
>      if (!arp_table_search(slirp, iph->ip_dst.s_addr, ethaddr)) {
> -        uint8_t arp_req[ETH_HLEN + sizeof(struct arphdr)];
> +        uint8_t arp_req[ETH_HLEN + sizeof(struct slirp_arphdr)];
>          struct ethhdr *reh = (struct ethhdr *)arp_req;
> -        struct arphdr *rah = (struct arphdr *)(arp_req + ETH_HLEN);
> +        struct slirp_arphdr *rah = (struct slirp_arphdr *)(arp_req + ETH_HLEN);
>  
>          if (!ifm->resolution_requested) {
>              /* If the client addr is not known, send an ARP request */
> diff --git a/slirp/slirp.h b/slirp/slirp.h
> index 624a850..a1f3139 100644
> --- a/slirp/slirp.h
> +++ b/slirp/slirp.h
> @@ -105,7 +105,7 @@ struct ethhdr {
>      unsigned short h_proto;            /* packet type ID field */
>  };
>  
> -struct arphdr {
> +struct slirp_arphdr {
>      unsigned short ar_hrd;      /* format of hardware address */
>      unsigned short ar_pro;      /* format of protocol address */
>      unsigned char  ar_hln;      /* length of hardware address */
> @@ -124,7 +124,7 @@ struct arphdr {
>  #define ARP_TABLE_SIZE 16
>  
>  typedef struct ArpTable {
> -    struct arphdr table[ARP_TABLE_SIZE];
> +    struct slirp_arphdr table[ARP_TABLE_SIZE];
>      int next_victim;
>  } ArpTable;
>  
> -- 
> 1.8.3.1
>
Brad Smith Aug. 16, 2016, 4:03 a.m. UTC | #2
On 08/15/16 04:24, Thomas Huth wrote:
> struct arphdr is already used by the system headers on OpenBSD
> and thus QEMU does not compile here anymore. Fix it by renaming
> our struct to slirp_arphdr instead.
>
> Reported-by: Brad Smith
> Buglink: https://bugs.launchpad.net/qemu/+bug/1613133
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Thanks, this does fix the build.

> ---
>  slirp/slirp.c | 10 +++++-----
>  slirp/slirp.h |  4 ++--
>  2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/slirp/slirp.c b/slirp/slirp.c
> index 47a1652..d67eda1 100644
> --- a/slirp/slirp.c
> +++ b/slirp/slirp.c
> @@ -773,10 +773,10 @@ void slirp_pollfds_poll(GArray *pollfds, int select_error)
>
>  static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
>  {
> -    struct arphdr *ah = (struct arphdr *)(pkt + ETH_HLEN);
> -    uint8_t arp_reply[max(ETH_HLEN + sizeof(struct arphdr), 64)];
> +    struct slirp_arphdr *ah = (struct slirp_arphdr *)(pkt + ETH_HLEN);
> +    uint8_t arp_reply[max(ETH_HLEN + sizeof(struct slirp_arphdr), 64)];
>      struct ethhdr *reh = (struct ethhdr *)arp_reply;
> -    struct arphdr *rah = (struct arphdr *)(arp_reply + ETH_HLEN);
> +    struct slirp_arphdr *rah = (struct slirp_arphdr *)(arp_reply + ETH_HLEN);
>      int ar_op;
>      struct ex_list *ex_ptr;
>
> @@ -890,9 +890,9 @@ static int if_encap4(Slirp *slirp, struct mbuf *ifm, struct ethhdr *eh,
>          return 1;
>      }
>      if (!arp_table_search(slirp, iph->ip_dst.s_addr, ethaddr)) {
> -        uint8_t arp_req[ETH_HLEN + sizeof(struct arphdr)];
> +        uint8_t arp_req[ETH_HLEN + sizeof(struct slirp_arphdr)];
>          struct ethhdr *reh = (struct ethhdr *)arp_req;
> -        struct arphdr *rah = (struct arphdr *)(arp_req + ETH_HLEN);
> +        struct slirp_arphdr *rah = (struct slirp_arphdr *)(arp_req + ETH_HLEN);
>
>          if (!ifm->resolution_requested) {
>              /* If the client addr is not known, send an ARP request */
> diff --git a/slirp/slirp.h b/slirp/slirp.h
> index 624a850..a1f3139 100644
> --- a/slirp/slirp.h
> +++ b/slirp/slirp.h
> @@ -105,7 +105,7 @@ struct ethhdr {
>      unsigned short h_proto;            /* packet type ID field */
>  };
>
> -struct arphdr {
> +struct slirp_arphdr {
>      unsigned short ar_hrd;      /* format of hardware address */
>      unsigned short ar_pro;      /* format of protocol address */
>      unsigned char  ar_hln;      /* length of hardware address */
> @@ -124,7 +124,7 @@ struct arphdr {
>  #define ARP_TABLE_SIZE 16
>
>  typedef struct ArpTable {
> -    struct arphdr table[ARP_TABLE_SIZE];
> +    struct slirp_arphdr table[ARP_TABLE_SIZE];
>      int next_victim;
>  } ArpTable;
>
>
Peter Maydell Aug. 16, 2016, 11:53 a.m. UTC | #3
On 16 August 2016 at 05:03, Brad Smith <brad@comstyle.com> wrote:
> On 08/15/16 04:24, Thomas Huth wrote:
>>
>> struct arphdr is already used by the system headers on OpenBSD
>> and thus QEMU does not compile here anymore. Fix it by renaming
>> our struct to slirp_arphdr instead.
>>
>> Reported-by: Brad Smith
>> Buglink: https://bugs.launchpad.net/qemu/+bug/1613133
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>
>
> Thanks, this does fix the build.

Applied, thanks.

-- PMM
diff mbox

Patch

diff --git a/slirp/slirp.c b/slirp/slirp.c
index 47a1652..d67eda1 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -773,10 +773,10 @@  void slirp_pollfds_poll(GArray *pollfds, int select_error)
 
 static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
 {
-    struct arphdr *ah = (struct arphdr *)(pkt + ETH_HLEN);
-    uint8_t arp_reply[max(ETH_HLEN + sizeof(struct arphdr), 64)];
+    struct slirp_arphdr *ah = (struct slirp_arphdr *)(pkt + ETH_HLEN);
+    uint8_t arp_reply[max(ETH_HLEN + sizeof(struct slirp_arphdr), 64)];
     struct ethhdr *reh = (struct ethhdr *)arp_reply;
-    struct arphdr *rah = (struct arphdr *)(arp_reply + ETH_HLEN);
+    struct slirp_arphdr *rah = (struct slirp_arphdr *)(arp_reply + ETH_HLEN);
     int ar_op;
     struct ex_list *ex_ptr;
 
@@ -890,9 +890,9 @@  static int if_encap4(Slirp *slirp, struct mbuf *ifm, struct ethhdr *eh,
         return 1;
     }
     if (!arp_table_search(slirp, iph->ip_dst.s_addr, ethaddr)) {
-        uint8_t arp_req[ETH_HLEN + sizeof(struct arphdr)];
+        uint8_t arp_req[ETH_HLEN + sizeof(struct slirp_arphdr)];
         struct ethhdr *reh = (struct ethhdr *)arp_req;
-        struct arphdr *rah = (struct arphdr *)(arp_req + ETH_HLEN);
+        struct slirp_arphdr *rah = (struct slirp_arphdr *)(arp_req + ETH_HLEN);
 
         if (!ifm->resolution_requested) {
             /* If the client addr is not known, send an ARP request */
diff --git a/slirp/slirp.h b/slirp/slirp.h
index 624a850..a1f3139 100644
--- a/slirp/slirp.h
+++ b/slirp/slirp.h
@@ -105,7 +105,7 @@  struct ethhdr {
     unsigned short h_proto;            /* packet type ID field */
 };
 
-struct arphdr {
+struct slirp_arphdr {
     unsigned short ar_hrd;      /* format of hardware address */
     unsigned short ar_pro;      /* format of protocol address */
     unsigned char  ar_hln;      /* length of hardware address */
@@ -124,7 +124,7 @@  struct arphdr {
 #define ARP_TABLE_SIZE 16
 
 typedef struct ArpTable {
-    struct arphdr table[ARP_TABLE_SIZE];
+    struct slirp_arphdr table[ARP_TABLE_SIZE];
     int next_victim;
 } ArpTable;