Received: from eggs.gnu.org ([140.186.70.92]:59763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsiTz-0004Ng-Di for qemu-devel@nongnu.org; Wed, 01 Feb 2012 17:16:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RsiTx-00014w-9r for qemu-devel@nongnu.org; Wed, 01 Feb 2012 17:16:51 -0500 Received: from nm1.bullet.mail.sp2.yahoo.com ([98.139.91.71]:48628) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1RsiTw-00014r-R6 for qemu-devel@nongnu.org; Wed, 01 Feb 2012 17:16:49 -0500 Message-ID: <1328134606.54868.YahooMailClassic@web110406.mail.gq1.yahoo.com> Date: Wed, 1 Feb 2012 14:16:46 -0800 (PST) From: Kenneth Salerno In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] 0.15.0-rc2 (any version past 0.14.1) having issues with SLIRP on Windows XP host List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori , Jan Kiszka , Blue Swirl Cc: TeLeMan , qemu-devel@nongnu.org Hello,=0A=0AWhile 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-bitfi= elds to force Qemu to build without taking this compiler flag from pkg-conf= ig, 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 ver= sus actual TCP/UDP packets that leave the guest?=0A=0AHere is a log I colle= cted from the latest Git build as of 2012-02-01. The sequence was as follow= s: I ping 10.0.2.2 from 10.0.2.5, then I attempt a DNS lookup from nameserv= er 209.18.47.61:=0A=0Aarp_table_add...=0A ip =3D 0x502000a=0A hw addr =3D 5= 2:54:00:12:34:56=0Aarp_table_add...=0A ip =3D 0x502000a=0A hw addr =3D 52:5= 4:00:12:34:56=0Am_get...=0A m =3D 5bd4f0b8=0Aip_input...=0A m =3D 5bd4f0b8= =0A m_len =3D 84=0Aicmp_input...=0A m =3D 5bd4f0b8=0A m_len =3D 84=0A icmp_= type =3D 8=0Aip_output...=0A so =3D 0=0A m0 =3D 5bd4f0b8=0Aif_output...=0A = so =3D 0=0A ifm =3D 5bd4f0b8=0Aif_start...=0Aarp_table_search...=0A ip =3D = 0x502000a=0A found hw addr =3D 52:54:00:12:34:56=0Am_free...=0A m =3D 5bd4f= 0b8=0Am_get...=0A m =3D 5bd4f0b8=0Aip_input...=0A m =3D 5bd4f0b8=0A m_len = =3D 84=0Aicmp_input...=0A m =3D 5bd4f0b8=0A m_len =3D 84=0A icmp_type =3D 8= =0Aip_output...=0A so =3D 0=0A m0 =3D 5bd4f0b8=0Aif_output...=0A so =3D 0= =0A ifm =3D 5bd4f0b8=0Aif_start...=0Aarp_table_search...=0A ip =3D 0x502000= a=0A found hw addr =3D 52:54:00:12:34:56=0Am_free...=0A m =3D 5bd4f0b8=0Aar= p_table_add...=0A ip =3D 0x502000a=0A hw addr =3D 52:54:00:12:34:56=0Am_get= ...=0A m =3D 5bd4f0b8=0Aip_input...=0A m =3D 5bd4f0b8=0A m_len =3D 55=0Audp= _input...=0A m =3D 5bd4f0b8=0A iphlen =3D 20=0Asosendto...=0A so =3D 5bd104= a0=0A m =3D 5bd4f0b8=0A sendto()ing, addr.sin_port=3D53, addr.sin_addr.s_ad= dr=3D209.18.47.61=0Am_free...=0A m =3D 0=0Aip_slowtimo...=0Atcp_slowtimo...= =0Aip_slowtimo...=0Atcp_slowtimo...=0Aip_slowtimo...=0Atcp_slowtimo...=0Aip= _slowtimo...=0Atcp_slowtimo...=0Aip_slowtimo...=0Atcp_slowtimo...=0Aip_slow= timo...=0Atcp_slowtimo...=0Aip_slowtimo...=0Atcp_slowtimo...=0Aip_slowtimo.= ..=0Atcp_slowtimo...=0Aip_slowtimo...=0Atcp_slowtimo...=0Aip_slowtimo...=0A= tcp_slowtimo...=0Am_get...=0A m =3D 5bd4f728=0Aip_input...=0A m =3D 5bd4f72= 8=0A m_len =3D 55=0Audp_input...=0A m =3D 5bd4f728=0A iphlen =3D 20=0Asosen= dto...=0A so =3D 5bd104a0=0A m =3D 5bd4f728=0A sendto()ing, addr.sin_port= =3D53, addr.sin_addr.s_addr=3D209.18.47.61=0Am_free...=0A m =3D 5bd4f0b8=0A= ip_slowtimo...=0Atcp_slowtimo...=0Aip_slowtimo...=0Atcp_slowtimo...=0Aip_sl= owtimo...=0Atcp_slowtimo...=0Aip_slowtimo...=0Atcp_slowtimo...=0Aip_slowtim= o...=0Atcp_slowtimo...=0Aip_slowtimo...=0Atcp_slowtimo...=0Aip_slowtimo...= =0Atcp_slowtimo...=0Aip_slowtimo...=0Atcp_slowtimo...=0Aip_slowtimo...=0Atc= p_slowtimo...=0Aip_slowtimo...=0Atcp_slowtimo...=0Am_get...=0A m =3D 5bd4f0= b8=0Aip_input...=0A m =3D 5bd4f0b8=0A m_len =3D 55=0Audp_input...=0A m =3D = 5bd4f0b8=0A iphlen =3D 20=0Asosendto...=0A so =3D 5bd104a0=0A m =3D 5bd4f0b= 8=0A sendto()ing, addr.sin_port=3D53, addr.sin_addr.s_addr=3D209.18.47.61= =0Am_free...=0A m =3D 5bd4f728=0Aip_slowtimo...=0Atcp_slowtimo...=0Aip_slow= timo...=0Atcp_slowtimo...=0Aip_slowtimo...=0Atcp_slowtimo...=0Aip_slowtimo.= ..=0Atcp_slowtimo...=0Aip_slowtimo...=0Atcp_slowtimo...=0Aip_slowtimo...=0A= tcp_slowtimo...=0A[repeated]=0A=0A=0AAnother strange problem I've been havi= ng with newer builds from Git lately is I can only execute qemu-system-*.ex= e correctly from within gdb (i.e. "/usr/bin/gdb.exe ./i386-softmmu/qemu-sys= tem-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 a= ddress 0x000000007c91b21a in ntdll.dll... "--help" works though...=0A=0A=0A= Any suggestions are appreciated. Thanks.=0A=0AKen=0A=0A--- On Sat, 8/6/11, = Blue Swirl wrote:=0A=0A> From: Blue Swirl =0A> Subject: Re: [Qemu-devel] 0.15.0-rc2 (any version past 0.1= 4.1) having issues with SLIRP on Windows XP host=0A> To: "Anthony Liguori" = , "Jan Kiszka" =0A> Cc: "TeL= eMan" , "Kenneth Salerno" , qe= mu-devel@nongnu.org=0A> Date: Saturday, August 6, 2011, 10:35 AM=0A> On Sat= , Aug 6, 2011 at 1:33 PM,=0A> Anthony Liguori =0A> w= rote:=0A> > On 08/05/2011 10:25 PM, TeLeMan wrote:=0A> >>=0A> >> On Sat, Au= g 6, 2011 at 04:46, Blue Swirl=0A> =A0wrote:=0A> >>>= =0A> >>> On Fri, Aug 5, 2011 at 8:09 PM, Kenneth=0A> Salerno=0A> >>> =0A> =A0wrote:=0A> >>>>=0A> >>>> Hi,=0A> >>>>=0A> >>>> = I'm not sure if any defaults (build or=0A> runtime) have changed since=0A> = >>>> 0.14.1, but I can no longer get the=0A> following to work anymore for = QEMU=0A> >>>> versions 0.15.0-rc2 or recent development=0A> builds:=0A> >>>= >=0A> >>>> =A0-device e1000,netdev=3Dmynet0 -netdev=0A> type=3Duser,id=3Dmy= net0 ...=0A> >>>>=0A> >>>> Works great in 0.14.1 however.=0A> >>>>=0A> >>>>= =A0From the QEMU console, "info networking"=0A> shows the NIC e1000 and th= e=0A> >>>> VLAN correctly setup, the guest (RHEL 6.1=0A> x86_64) has its NI= C recognized and=0A> >>>> networking setup, just can't seem to=0A> communic= ate with the gateway=0A> >>>> (10.0.2.2). The only difference I see in=0A> = the console is cosmetic=0A> >>>> (restricted=3Doff rather than restricted= =3Dn).=0A> >>>>=0A> >>>> Host OS: Windows XP=0A> >>>> Build env: i686-pc-mi= ngw32-gcc 4.5.2,=0A> binutils 2.21.53.20110731 i386pe=0A> >>>> Runtime env:= Cygwin 1.7.9 2011-03-29, SDL=0A> 1.2.14, mingw32-glib 2.28.1-1,=0A> >>>> = =A0 =A0 =A0 =A0 =A0 =A0 mingw32-gettext 0.18.1-2=0A> >>>> Guest OS: RHEL 6.= 1=0A> >>>>=0A> >>>> Is it just me?=0A> >>>=0A> >>> No, this is fallout from= glib use:=0A> >>> http://lists.nongnu.org/archive/html/qemu-devel/2011-08/= msg00134.html=0A> >>>=0A> >>> The fix is to rewrite structures without usin= g=0A> GCC bit fields.=0A> >>=0A> >> -mms-bitfields affects all byte-alignme= nts in a=0A> structure. For example,=0A> >> struct s=0A> >> {=0A> >> =A0 = =A0uint8_t a;=0A> >> =A0 =A0uint32_t b;=0A> >> } __attribute__((packed));= =0A> >>=0A> >> sizeof(s) is 5 without -mms-bitfields but sizeof(s)=0A> is 8= with=0A> >> -mms-bitfields.=0A> >=0A> > If you can identify the offending = structs, you can do:=0A> >=0A> > #pragma pack(push,1)=0A> >=0A> > struct s= =0A> > {=0A> > =A0 =A0uint8_t a;=0A> > =A0 =A0uint32_t b;=0A> > } __attribu= te__((packed));=0A> >=0A> > #pragma pack(pop)=0A> =0A> I grepped the tree f= or ((packed)). The only two places where=0A> bit=0A> fields are used with p= acked structs are in SLIRP:=0A> =0A> struct ip {=0A> #ifdef HOST_WORDS_BIGE= NDIAN=0A> =A0=A0=A0 u_int ip_v:4,=A0=A0=A0=0A> =A0=A0=A0 =A0=A0=A0 /* versi= on */=0A> =A0=A0=A0 =A0=A0=A0=0A> ip_hl:4;=A0=A0=A0 =A0=A0=A0 /* header=0A>= length */=0A> #else=0A> =A0=A0=A0 u_int ip_hl:4,=A0=A0=A0=0A> =A0=A0=A0 /*= header length */=0A> =A0=A0=A0 =A0=A0=A0=0A> ip_v:4;=A0=A0=A0 =A0=A0=A0=0A= > =A0=A0=A0 /* version */=0A> #endif=0A> =A0=A0=A0 uint8_t=A0=A0=A0=0A> =A0= =A0=A0 ip_tos;=A0=A0=A0=0A> =A0=A0=A0 =A0=A0=A0 /* type of service */=0A> = =A0=A0=A0 uint16_t=A0=A0=A0=0A> ip_len;=A0=A0=A0 =A0=A0=A0=0A> =A0=A0=A0 /*= total length */=0A> =A0=A0=A0 uint16_t=A0=A0=A0=0A> ip_id;=A0=A0=A0 =A0=A0= =A0=0A> =A0=A0=A0 /* identification */=0A> =A0=A0=A0 uint16_t=A0=A0=A0=0A> = ip_off;=A0=A0=A0 =A0=A0=A0=0A> =A0=A0=A0 /* fragment offset field */=0A> #d= efine=A0=A0=A0 IP_DF 0x4000=A0=A0=A0=0A> =A0=A0=A0 =A0=A0=A0 /* don't fragm= ent flag=0A> */=0A> #define=A0=A0=A0 IP_MF 0x2000=A0=A0=A0=0A> =A0=A0=A0 = =A0=A0=A0 /* more fragments flag=0A> */=0A> #define=A0=A0=A0 IP_OFFMASK=0A>= 0x1fff=A0=A0=A0 =A0=A0=A0 /* mask for=0A> fragmenting bits */=0A> =A0=A0= =A0 uint8_t ip_ttl;=A0=A0=A0=0A> =A0=A0=A0 =A0=A0=A0 /* time to live */=0A>= =A0=A0=A0 uint8_t ip_p;=A0=A0=A0=0A> =A0=A0=A0 =A0=A0=A0 /* protocol */=0A= > =A0=A0=A0 uint16_t=A0=A0=A0=0A> ip_sum;=A0=A0=A0 =A0=A0=A0=0A> =A0=A0=A0 = /* checksum */=0A> =A0=A0=A0 struct=A0=A0=A0 in_addr=0A> ip_src,ip_dst;=A0= =A0=A0 /* source and dest address=0A> */=0A> } __attribute__((packed));=0A>= =0A> struct=A0=A0=A0 ip_timestamp {=0A> =A0=A0=A0 uint8_t=A0=A0=A0=0A> ipt= _code;=A0=A0=A0 =A0=A0=A0 /* IPOPT_TS=0A> */=0A> =A0=A0=A0 uint8_t=A0=A0=A0= =0A> ipt_len;=A0=A0=A0 =A0=A0=A0 /* size of=0A> structure (variable) */=0A>= =A0=A0=A0 uint8_t=A0=A0=A0=0A> ipt_ptr;=A0=A0=A0 =A0=A0=A0 /* index of=0A>= current entry */=0A> #ifdef HOST_WORDS_BIGENDIAN=0A> =A0=A0=A0 u_int=A0=A0= =A0=0A> ipt_oflw:4,=A0=A0=A0 =A0=A0=A0 /* overflow=0A> counter */=0A> =A0= =A0=A0 =A0=A0=A0=0A> ipt_flg:4;=A0=A0=A0 =A0=A0=A0 /* flags,=0A> see below = */=0A> #else=0A> =A0=A0=A0 u_int=A0=A0=A0=0A> ipt_flg:4,=A0=A0=A0 =A0=A0=A0= /* flags,=0A> see below */=0A> =A0=A0=A0 =A0=A0=A0=0A> ipt_oflw:4;=A0=A0= =A0 =A0=A0=A0 /* overflow=0A> counter */=0A> #endif=0A> =A0=A0=A0 union ipt= _timestamp {=0A> =A0=A0=A0 =A0=A0=A0=0A> n_long=A0=A0=A0 ipt_time[1];=0A> = =A0=A0=A0 =A0=A0=A0=0A> struct=A0=A0=A0 ipt_ta {=0A> =A0=A0=A0 =A0=A0=A0 = =A0=A0=A0=0A> struct in_addr ipt_addr;=0A> =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=0A= > n_long ipt_time;=0A> =A0=A0=A0 =A0=A0=A0 } ipt_ta[1];=0A> =A0=A0=A0 } ipt= _timestamp;=0A> } __attribute__((packed));=0A> =0A> I'd avoid the bit field= s altogether in both cases, then also=0A> the=0A> #ifdeffery could be remov= ed.=0A>