qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host
@ 2011-08-05 20:09 Kenneth Salerno
  2011-08-05 20:46 ` Blue Swirl
  0 siblings, 1 reply; 10+ messages in thread
From: Kenneth Salerno @ 2011-08-05 20:09 UTC (permalink / raw)
  To: qemu-devel

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?

Thanks,
Ken

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host
  2011-08-05 20:09 [Qemu-devel] 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host Kenneth Salerno
@ 2011-08-05 20:46 ` Blue Swirl
  2011-08-05 21:43   ` Jan Kiszka
  2011-08-06  3:25   ` TeLeMan
  0 siblings, 2 replies; 10+ messages in thread
From: Blue Swirl @ 2011-08-05 20:46 UTC (permalink / raw)
  To: Kenneth Salerno, Jan Kiszka; +Cc: qemu-devel

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host
  2011-08-05 20:46 ` Blue Swirl
@ 2011-08-05 21:43   ` Jan Kiszka
  2011-08-05 23:17     ` Kenneth Salerno
  2011-08-06  3:25   ` TeLeMan
  1 sibling, 1 reply; 10+ messages in thread
From: Jan Kiszka @ 2011-08-05 21:43 UTC (permalink / raw)
  To: Blue Swirl, Kenneth Salerno; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2775 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host
  2011-08-05 21:43   ` Jan Kiszka
@ 2011-08-05 23:17     ` Kenneth Salerno
  2011-08-06  7:31       ` Stefan Weil
  0 siblings, 1 reply; 10+ messages in thread
From: Kenneth Salerno @ 2011-08-05 23:17 UTC (permalink / raw)
  To: Blue Swirl, Jan Kiszka; +Cc: qemu-devel

--- 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host
  2011-08-05 20:46 ` Blue Swirl
  2011-08-05 21:43   ` Jan Kiszka
@ 2011-08-06  3:25   ` TeLeMan
  2011-08-06 13:33     ` Anthony Liguori
  1 sibling, 1 reply; 10+ messages in thread
From: TeLeMan @ 2011-08-06  3:25 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Jan Kiszka, Kenneth Salerno, qemu-devel

On Sat, Aug 6, 2011 at 04:46, Blue Swirl <blauwirbel@gmail.com> 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.

-mms-bitfields affects all byte-alignments in a structure. For example,
struct s
{
   uint8_t a;
   uint32_t b;
} __attribute__((packed));

sizeof(s) is 5 without -mms-bitfields but sizeof(s) is 8 with -mms-bitfields.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host
  2011-08-05 23:17     ` Kenneth Salerno
@ 2011-08-06  7:31       ` Stefan Weil
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Weil @ 2011-08-06  7:31 UTC (permalink / raw)
  To: Kenneth Salerno; +Cc: Blue Swirl, Jan Kiszka, qemu-devel

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host
  2011-08-06  3:25   ` TeLeMan
@ 2011-08-06 13:33     ` Anthony Liguori
  2011-08-06 14:35       ` Blue Swirl
  0 siblings, 1 reply; 10+ messages in thread
From: Anthony Liguori @ 2011-08-06 13:33 UTC (permalink / raw)
  To: TeLeMan; +Cc: Blue Swirl, Jan Kiszka, Kenneth Salerno, qemu-devel

On 08/05/2011 10:25 PM, TeLeMan wrote:
> On Sat, Aug 6, 2011 at 04:46, Blue Swirl<blauwirbel@gmail.com>  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.
>
> -mms-bitfields affects all byte-alignments in a structure. For example,
> struct s
> {
>     uint8_t a;
>     uint32_t b;
> } __attribute__((packed));
>
> sizeof(s) is 5 without -mms-bitfields but sizeof(s) is 8 with -mms-bitfields.

If you can identify the offending structs, you can do:

#pragma pack(push,1)

struct s
{
     uint8_t a;
     uint32_t b;
} __attribute__((packed));

#pragma pack(pop)

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host
  2011-08-06 13:33     ` Anthony Liguori
@ 2011-08-06 14:35       ` Blue Swirl
  2012-02-01 22:16         ` Kenneth Salerno
  0 siblings, 1 reply; 10+ messages in thread
From: Blue Swirl @ 2011-08-06 14:35 UTC (permalink / raw)
  To: Anthony Liguori, Jan Kiszka; +Cc: TeLeMan, Kenneth Salerno, qemu-devel

On Sat, Aug 6, 2011 at 1:33 PM, Anthony Liguori <anthony@codemonkey.ws> wrote:
> On 08/05/2011 10:25 PM, TeLeMan wrote:
>>
>> On Sat, Aug 6, 2011 at 04:46, Blue Swirl<blauwirbel@gmail.com>  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.
>>
>> -mms-bitfields affects all byte-alignments in a structure. For example,
>> struct s
>> {
>>    uint8_t a;
>>    uint32_t b;
>> } __attribute__((packed));
>>
>> sizeof(s) is 5 without -mms-bitfields but sizeof(s) is 8 with
>> -mms-bitfields.
>
> If you can identify the offending structs, you can do:
>
> #pragma pack(push,1)
>
> struct s
> {
>    uint8_t a;
>    uint32_t b;
> } __attribute__((packed));
>
> #pragma pack(pop)

I grepped the tree for ((packed)). The only two places where bit
fields are used with packed structs are in SLIRP:

struct ip {
#ifdef HOST_WORDS_BIGENDIAN
	u_int ip_v:4,			/* version */
		ip_hl:4;		/* header length */
#else
	u_int ip_hl:4,		/* header length */
		ip_v:4;			/* version */
#endif
	uint8_t		ip_tos;			/* type of service */
	uint16_t	ip_len;			/* total length */
	uint16_t	ip_id;			/* identification */
	uint16_t	ip_off;			/* fragment offset field */
#define	IP_DF 0x4000			/* don't fragment flag */
#define	IP_MF 0x2000			/* more fragments flag */
#define	IP_OFFMASK 0x1fff		/* mask for fragmenting bits */
	uint8_t ip_ttl;			/* time to live */
	uint8_t ip_p;			/* protocol */
	uint16_t	ip_sum;			/* checksum */
	struct	in_addr ip_src,ip_dst;	/* source and dest address */
} __attribute__((packed));

struct	ip_timestamp {
	uint8_t	ipt_code;		/* IPOPT_TS */
	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 */
		ipt_flg:4;		/* flags, see below */
#else
	u_int	ipt_flg:4,		/* flags, see below */
		ipt_oflw:4;		/* overflow counter */
#endif
	union ipt_timestamp {
		n_long	ipt_time[1];
		struct	ipt_ta {
			struct in_addr ipt_addr;
			n_long ipt_time;
		} ipt_ta[1];
	} ipt_timestamp;
} __attribute__((packed));

I'd avoid the bit fields altogether in both cases, then also the
#ifdeffery could be removed.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host
  2011-08-06 14:35       ` Blue Swirl
@ 2012-02-01 22:16         ` Kenneth Salerno
  2012-02-02  6:06           ` Stefan Weil
  0 siblings, 1 reply; 10+ messages in thread
From: Kenneth Salerno @ 2012-02-01 22:16 UTC (permalink / raw)
  To: Anthony Liguori, Jan Kiszka, Blue Swirl; +Cc: TeLeMan, qemu-devel

Hello,

While the patches fixed the pseudo ICMP between the guest (10.0.2.x) and the DHCP gateway (10.0.2.2), I have still never been able to get TCP/UDP working. I even tried compiling glib for MinGW32 without -mms-bitfields to force Qemu to build without taking this compiler flag from pkg-config, but I got the same results so I don't believe it's a packing issue this time. What is different about the way packets are constructed for ICMP versus actual TCP/UDP packets that leave the guest?

Here is a log I collected from the latest Git build as of 2012-02-01. The sequence was as follows: I ping 10.0.2.2 from 10.0.2.5, then I attempt a DNS lookup from nameserver 209.18.47.61:

arp_table_add...
 ip = 0x502000a
 hw addr = 52:54:00:12:34:56
arp_table_add...
 ip = 0x502000a
 hw addr = 52:54:00:12:34:56
m_get...
 m = 5bd4f0b8
ip_input...
 m = 5bd4f0b8
 m_len = 84
icmp_input...
 m = 5bd4f0b8
 m_len = 84
 icmp_type = 8
ip_output...
 so = 0
 m0 = 5bd4f0b8
if_output...
 so = 0
 ifm = 5bd4f0b8
if_start...
arp_table_search...
 ip = 0x502000a
 found hw addr = 52:54:00:12:34:56
m_free...
 m = 5bd4f0b8
m_get...
 m = 5bd4f0b8
ip_input...
 m = 5bd4f0b8
 m_len = 84
icmp_input...
 m = 5bd4f0b8
 m_len = 84
 icmp_type = 8
ip_output...
 so = 0
 m0 = 5bd4f0b8
if_output...
 so = 0
 ifm = 5bd4f0b8
if_start...
arp_table_search...
 ip = 0x502000a
 found hw addr = 52:54:00:12:34:56
m_free...
 m = 5bd4f0b8
arp_table_add...
 ip = 0x502000a
 hw addr = 52:54:00:12:34:56
m_get...
 m = 5bd4f0b8
ip_input...
 m = 5bd4f0b8
 m_len = 55
udp_input...
 m = 5bd4f0b8
 iphlen = 20
sosendto...
 so = 5bd104a0
 m = 5bd4f0b8
 sendto()ing, addr.sin_port=53, addr.sin_addr.s_addr=209.18.47.61
m_free...
 m = 0
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
m_get...
 m = 5bd4f728
ip_input...
 m = 5bd4f728
 m_len = 55
udp_input...
 m = 5bd4f728
 iphlen = 20
sosendto...
 so = 5bd104a0
 m = 5bd4f728
 sendto()ing, addr.sin_port=53, addr.sin_addr.s_addr=209.18.47.61
m_free...
 m = 5bd4f0b8
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
m_get...
 m = 5bd4f0b8
ip_input...
 m = 5bd4f0b8
 m_len = 55
udp_input...
 m = 5bd4f0b8
 iphlen = 20
sosendto...
 so = 5bd104a0
 m = 5bd4f0b8
 sendto()ing, addr.sin_port=53, addr.sin_addr.s_addr=209.18.47.61
m_free...
 m = 5bd4f728
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
ip_slowtimo...
tcp_slowtimo...
[repeated]


Another strange problem I've been having with newer builds from Git lately is I can only execute qemu-system-*.exe correctly from within gdb (i.e. "/usr/bin/gdb.exe ./i386-softmmu/qemu-system-i386.exe; gdb>run -L ./pc-bios"). If I run qemu-system-*.exe outside of gdb it will otherwise die complaining about exception code 0xc0000005 at address 0x000000007c91b21a in ntdll.dll... "--help" works though...


Any suggestions are appreciated. Thanks.

Ken

--- On Sat, 8/6/11, Blue Swirl <blauwirbel@gmail.com> wrote:

> From: Blue Swirl <blauwirbel@gmail.com>
> Subject: Re: [Qemu-devel] 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host
> To: "Anthony Liguori" <anthony@codemonkey.ws>, "Jan Kiszka" <jan.kiszka@siemens.com>
> Cc: "TeLeMan" <geleman@gmail.com>, "Kenneth Salerno" <kennethsalerno@yahoo.com>, qemu-devel@nongnu.org
> Date: Saturday, August 6, 2011, 10:35 AM
> On Sat, Aug 6, 2011 at 1:33 PM,
> Anthony Liguori <anthony@codemonkey.ws>
> wrote:
> > On 08/05/2011 10:25 PM, TeLeMan wrote:
> >>
> >> On Sat, Aug 6, 2011 at 04:46, Blue Swirl<blauwirbel@gmail.com>
>  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.
> >>
> >> -mms-bitfields affects all byte-alignments in a
> structure. For example,
> >> struct s
> >> {
> >>    uint8_t a;
> >>    uint32_t b;
> >> } __attribute__((packed));
> >>
> >> sizeof(s) is 5 without -mms-bitfields but sizeof(s)
> is 8 with
> >> -mms-bitfields.
> >
> > If you can identify the offending structs, you can do:
> >
> > #pragma pack(push,1)
> >
> > struct s
> > {
> >    uint8_t a;
> >    uint32_t b;
> > } __attribute__((packed));
> >
> > #pragma pack(pop)
> 
> I grepped the tree for ((packed)). The only two places where
> bit
> fields are used with packed structs are in SLIRP:
> 
> struct ip {
> #ifdef HOST_WORDS_BIGENDIAN
>     u_int ip_v:4,   
>         /* version */
>        
> ip_hl:4;        /* header
> length */
> #else
>     u_int ip_hl:4,   
>     /* header length */
>        
> ip_v:4;       
>     /* version */
> #endif
>     uint8_t   
>     ip_tos;   
>         /* type of service */
>     uint16_t   
> ip_len;       
>     /* total length */
>     uint16_t   
> ip_id;       
>     /* identification */
>     uint16_t   
> ip_off;       
>     /* fragment offset field */
> #define    IP_DF 0x4000   
>         /* don't fragment flag
> */
> #define    IP_MF 0x2000   
>         /* more fragments flag
> */
> #define    IP_OFFMASK
> 0x1fff        /* mask for
> fragmenting bits */
>     uint8_t ip_ttl;   
>         /* time to live */
>     uint8_t ip_p;   
>         /* protocol */
>     uint16_t   
> ip_sum;       
>     /* checksum */
>     struct    in_addr
> ip_src,ip_dst;    /* source and dest address
> */
> } __attribute__((packed));
> 
> struct    ip_timestamp {
>     uint8_t   
> ipt_code;        /* IPOPT_TS
> */
>     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 */
>        
> ipt_flg:4;        /* flags,
> see below */
> #else
>     u_int   
> ipt_flg:4,        /* flags,
> see below */
>        
> ipt_oflw:4;        /* overflow
> counter */
> #endif
>     union ipt_timestamp {
>        
> n_long    ipt_time[1];
>        
> struct    ipt_ta {
>            
> struct in_addr ipt_addr;
>            
> n_long ipt_time;
>         } ipt_ta[1];
>     } ipt_timestamp;
> } __attribute__((packed));
> 
> I'd avoid the bit fields altogether in both cases, then also
> the
> #ifdeffery could be removed.
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host
  2012-02-01 22:16         ` Kenneth Salerno
@ 2012-02-02  6:06           ` Stefan Weil
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Weil @ 2012-02-02  6:06 UTC (permalink / raw)
  To: Kenneth Salerno; +Cc: Blue Swirl, Jan Kiszka, qemu-devel, TeLeMan

Am 01.02.2012 23:16, schrieb Kenneth Salerno:
> Another strange problem I've been having with newer builds from Git 
> lately is I can only execute qemu-system-*.exe correctly from within 
> gdb (i.e. "/usr/bin/gdb.exe ./i386-softmmu/qemu-system-i386.exe; 
> gdb>run -L ./pc-bios"). If I run qemu-system-*.exe outside of gdb it 
> will otherwise die complaining about exception code 0xc0000005 at 
> address 0x000000007c91b21a in ntdll.dll... "--help" works though...
>
> Any suggestions are appreciated. Thanks.
>
> Ken

This problem was already reported, and there is a patch for it:

http://patchwork.ozlabs.org/patch/138690/
*https://bugs.launchpad.net/qemu/+bug/922131

Stefan

*

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-02-02  6:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-05 20:09 [Qemu-devel] 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host Kenneth Salerno
2011-08-05 20:46 ` Blue Swirl
2011-08-05 21:43   ` Jan Kiszka
2011-08-05 23:17     ` Kenneth Salerno
2011-08-06  7:31       ` Stefan Weil
2011-08-06  3:25   ` TeLeMan
2011-08-06 13:33     ` Anthony Liguori
2011-08-06 14:35       ` Blue Swirl
2012-02-01 22:16         ` Kenneth Salerno
2012-02-02  6:06           ` Stefan Weil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).