Patchwork 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host

login
register
mail settings
Submitter Jan Kiszka
Date Aug. 5, 2011, 9:43 p.m.
Message ID <4E3C6407.1010300@web.de>
Download mbox | patch
Permalink /patch/108742/
State New
Headers show

Comments

Jan Kiszka - Aug. 5, 2011, 9:43 p.m.
On 2011-08-05 22:46, Blue Swirl wrote:
> On Fri, Aug 5, 2011 at 8:09 PM, Kenneth Salerno
> <kennethsalerno@yahoo.com> wrote:
>> Hi,
>>
>> I'm not sure if any defaults (build or runtime) have changed since 0.14.1, but I can no longer get the following to work anymore for QEMU versions 0.15.0-rc2 or recent development builds:
>>
>>  -device e1000,netdev=mynet0 -netdev type=user,id=mynet0 ...
>>
>> Works great in 0.14.1 however.
>>
>> From the QEMU console, "info networking" shows the NIC e1000 and the VLAN correctly setup, the guest (RHEL 6.1 x86_64) has its NIC recognized and networking setup, just can't seem to communicate with the gateway (10.0.2.2). The only difference I see in the console is cosmetic (restricted=off rather than restricted=n).
>>
>> Host OS: Windows XP
>> Build env: i686-pc-mingw32-gcc 4.5.2, binutils 2.21.53.20110731 i386pe
>> Runtime env: Cygwin 1.7.9 2011-03-29, SDL 1.2.14, mingw32-glib 2.28.1-1,
>>             mingw32-gettext 0.18.1-2
>> Guest OS: RHEL 6.1
>>
>> Is it just me?
> 
> No, this is fallout from glib use:
> http://lists.nongnu.org/archive/html/qemu-devel/2011-08/msg00134.html
> 
> The fix is to rewrite structures without using GCC bit fields.

Does this help?


Jan
Kenneth Salerno - Aug. 5, 2011, 11:17 p.m.
--- On Fri, 8/5/11, Jan Kiszka <jan.kiszka@web.de> wrote:

> From: Jan Kiszka <jan.kiszka@web.de>
> Subject: Re: 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host
> To: "Blue Swirl" <blauwirbel@gmail.com>, "Kenneth Salerno" <kennethsalerno@yahoo.com>
> Cc: qemu-devel@nongnu.org
> Date: Friday, August 5, 2011, 5:43 PM
> On 2011-08-05 22:46, Blue Swirl
> wrote:
> > On Fri, Aug 5, 2011 at 8:09 PM, Kenneth Salerno
> > <kennethsalerno@yahoo.com>
> wrote:
> >> Hi,
> >>
> >> I'm not sure if any defaults (build or runtime)
> have changed since 0.14.1, but I can no longer get the
> following to work anymore for QEMU versions 0.15.0-rc2 or
> recent development builds:
> >>
> >>  -device e1000,netdev=mynet0 -netdev
> type=user,id=mynet0 ...
> >>
> >> Works great in 0.14.1 however.
> >>
> >> From the QEMU console, "info networking" shows the
> NIC e1000 and the VLAN correctly setup, the guest (RHEL 6.1
> x86_64) has its NIC recognized and networking setup, just
> can't seem to communicate with the gateway (10.0.2.2). The
> only difference I see in the console is cosmetic
> (restricted=off rather than restricted=n).
> >>
> >> Host OS: Windows XP
> >> Build env: i686-pc-mingw32-gcc 4.5.2, binutils
> 2.21.53.20110731 i386pe
> >> Runtime env: Cygwin 1.7.9 2011-03-29, SDL 1.2.14,
> mingw32-glib 2.28.1-1,
> >>         
>    mingw32-gettext 0.18.1-2
> >> Guest OS: RHEL 6.1
> >>
> >> Is it just me?
> > 
> > No, this is fallout from glib use:
> > http://lists.nongnu.org/archive/html/qemu-devel/2011-08/msg00134.html
> > 
> > The fix is to rewrite structures without using GCC bit
> fields.
> 
> Does this help?
> 
> diff --git a/slirp/ip.h b/slirp/ip.h
> index 48ea38e..72dbe9a 100644
> --- a/slirp/ip.h
> +++ b/slirp/ip.h
> @@ -74,10 +74,10 @@ typedef uint32_t n_long;   
>              /* long
> as received from the net */
>   */
>  struct ip {
>  #ifdef HOST_WORDS_BIGENDIAN
> -    u_int ip_v:4,   
>         /* version */
> +    uint8_t ip_v:4,   
>         /* version */
>         
> ip_hl:4;        /* header
> length */
>  #else
> -    u_int ip_hl:4,   
>     /* header length */
> +    uint8_t ip_hl:4,   
>     /* header length */
>         
> ip_v:4;       
>     /* version */
>  #endif
>      uint8_t   
>     ip_tos;   
>         /* type of service */
> @@ -140,10 +140,10 @@ struct    ip_timestamp
> {
>      uint8_t   
> ipt_len;        /* size of
> structure (variable) */
>      uint8_t   
> ipt_ptr;        /* index of
> current entry */
>  #ifdef HOST_WORDS_BIGENDIAN
> -    u_int   
> ipt_oflw:4,        /* overflow
> counter */
> +    uint8_t   
> ipt_oflw:4,        /* overflow
> counter */
>         
> ipt_flg:4;        /* flags,
> see below */
>  #else
> -    u_int   
> ipt_flg:4,        /* flags,
> see below */
> +    uint8_t   
> ipt_flg:4,        /* flags,
> see below */
>         
> ipt_oflw:4;        /* overflow
> counter */
>  #endif
>      union ipt_timestamp {
> diff --git a/slirp/tcp.h b/slirp/tcp.h
> index 9d06836..b3817cb 100644
> --- a/slirp/tcp.h
> +++ b/slirp/tcp.h
> @@ -51,10 +51,10 @@ struct tcphdr {
>      tcp_seq   
> th_seq;       
>     /* sequence number */
>      tcp_seq   
> th_ack;       
>     /* acknowledgement number */
>  #ifdef HOST_WORDS_BIGENDIAN
> -    u_int   
> th_off:4,        /* data
> offset */
> +    uint8_t   
> th_off:4,        /* data
> offset */
>         
> th_x2:4;        /* (unused)
> */
>  #else
> -    u_int   
> th_x2:4,        /* (unused)
> */
> +    uint8_t   
> th_x2:4,        /* (unused)
> */
>         
> th_off:4;        /* data
> offset */
>  #endif
>      uint8_t th_flags;
> 
> Jan
> 
> 


With this patch it gets caught up in tcg/tcg.c line 1646:
  
    if (ts->val_type == TEMP_VAL_REG)
    ...
    else if (ts->val_type == TEMP_VAL_MEM)
    ...
    else if (ts->val_type == TEMP_VAL_CONST)
    ....
    } else {  <------- we get here by changing unsigned int to unsigned character
        tcg_abort();
    }



Output from QEMU:
  
/home/kens/cross-compile/qemu/testing/qemu/tcg/tcg.c:1646: tcg fatal error

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Thanks,
Ken
Stefan Weil - Aug. 6, 2011, 7:31 a.m.
Am 06.08.2011 01:17, schrieb Kenneth Salerno:
> With this patch it gets caught up in tcg/tcg.c line 1646:
>
> if (ts->val_type == TEMP_VAL_REG)
> ...
> else if (ts->val_type == TEMP_VAL_MEM)
> ...
> else if (ts->val_type == TEMP_VAL_CONST)
> ....
> } else { <------- we get here by changing unsigned int to unsigned 
> character
> tcg_abort();
> }
>
>
>
> Output from QEMU:
>
> /home/kens/cross-compile/qemu/testing/qemu/tcg/tcg.c:1646: tcg fatal error
>
> This application has requested the Runtime to terminate it in an 
> unusual way.
> Please contact the application's support team for more information.
>
> Thanks,
> Ken

That's a different issue. Read more here:

http://lists.nongnu.org/archive/html/qemu-devel/2011-08/msg00758.html
http://lists.nongnu.org/archive/html/qemu-devel/2011-08/msg00797.html

Regards,
Stefan

Patch

diff --git a/slirp/ip.h b/slirp/ip.h
index 48ea38e..72dbe9a 100644
--- a/slirp/ip.h
+++ b/slirp/ip.h
@@ -74,10 +74,10 @@  typedef uint32_t n_long;                 /* long as received from the net */
  */
 struct ip {
 #ifdef HOST_WORDS_BIGENDIAN
-	u_int ip_v:4,			/* version */
+	uint8_t ip_v:4,			/* version */
 		ip_hl:4;		/* header length */
 #else
-	u_int ip_hl:4,		/* header length */
+	uint8_t ip_hl:4,		/* header length */
 		ip_v:4;			/* version */
 #endif
 	uint8_t		ip_tos;			/* type of service */
@@ -140,10 +140,10 @@  struct	ip_timestamp {
 	uint8_t	ipt_len;		/* size of structure (variable) */
 	uint8_t	ipt_ptr;		/* index of current entry */
 #ifdef HOST_WORDS_BIGENDIAN
-	u_int	ipt_oflw:4,		/* overflow counter */
+	uint8_t	ipt_oflw:4,		/* overflow counter */
 		ipt_flg:4;		/* flags, see below */
 #else
-	u_int	ipt_flg:4,		/* flags, see below */
+	uint8_t	ipt_flg:4,		/* flags, see below */
 		ipt_oflw:4;		/* overflow counter */
 #endif
 	union ipt_timestamp {
diff --git a/slirp/tcp.h b/slirp/tcp.h
index 9d06836..b3817cb 100644
--- a/slirp/tcp.h
+++ b/slirp/tcp.h
@@ -51,10 +51,10 @@  struct tcphdr {
 	tcp_seq	th_seq;			/* sequence number */
 	tcp_seq	th_ack;			/* acknowledgement number */
 #ifdef HOST_WORDS_BIGENDIAN
-	u_int	th_off:4,		/* data offset */
+	uint8_t	th_off:4,		/* data offset */
 		th_x2:4;		/* (unused) */
 #else
-	u_int	th_x2:4,		/* (unused) */
+	uint8_t	th_x2:4,		/* (unused) */
 		th_off:4;		/* data offset */
 #endif
 	uint8_t th_flags;