On Mon, Sep 20, 2010 at 9:31 PM, Anthony Liguori <anth...@codemonkey.ws> wrote: > On 09/20/2010 05:42 AM, Michael S. Tsirkin wrote: >> >> On Sun, Sep 19, 2010 at 07:36:51AM +0100, Stefan Hajnoczi wrote: >> >>> >>> On Sat, Sep 18, 2010 at 10:27 PM, Edgar E. Iglesias >>> <edgar.igles...@gmail.com> wrote: >>> >>>> >>>> This doesn't look right. AFAIK, MAC's dont pad on receive. >>>> >>> >>> I agree. NICs that do padding will do it on transmit, not receive. >>> Anything coming in on the wire should already have the minimum length. >>> >> >> QEMU never gets access to the wire. >> Our APIs do not really pass complete ethernet packets: >> we forward packets without checksum and padding. >> >> I think it makes complete sense to keep this and >> handle padding in devices because we >> have devices that pass the frame to guest without padding and checksum. >> It should be easy to replace padding code in devices that >> need it with some kind of macro. >> > > Would this not also address the problem? It sounds like the root cause is > the tap code, not the devices..
This won't work when s->has_vnet_hdr is 1 because the virtio-net header consumes buffer space and reduces the amount we pad. The padding size should be 60 + (s->has_vnet_hdr ? sizeof(struct virtio_net_hdr) : 0). Adjusting the length without clearing the untouched buffer space is probably fine. I'm trying to think of a scenario where this becomes an information leak (security issue). Perhaps if the guest has vlans enabled and allows different users to sniff traffic only on their vlans? Then you may be able to read part of another vlan's traffic by sending short packets to your vlan and gathering the padding data. This is pretty contrived but doing a <60 byte memset would prevent the issue for sure. Stefan -- emulated netcards don't work with recent sunos kernel https://bugs.launchpad.net/bugs/638955 You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. Status in QEMU: New Bug description: hi there, i'm using qemu-kvm backend in version: # qemu-kvm -version QEMU PC emulator version 0.12.5 (qemu-kvm-0.12.5), Copyright (c) 2003-2008 Fabrice Bellard and there are just *not working any of model=$type with combinations of recent sunos (solaris, openindiana, opensolaris, ..) .. you can download for testing purposes iso from here: http://dlc-origin.openindiana.org/isos/147/ or from here: http://genunix.org/distributions/indiana/ << osol and oi are also bubuntu-like *live cds, so no need to bother with installing behaviour is as follows: e1000 - receiving doesn't work, transmitting works .. dladm (tool for handle ethers) shows that is all ok, correct mode is loaded up, it just seems like this driver works at 100% but .. rtl8169|pcnet - works in 10Mbit mode with several other issues like high cpu utilization and so .. dladm is unable to recognize options for this kind of -nic others - just don't work .. i experienced this issue several times in past .. woraround was, that rtl8169 worked so-so .. with recent sunos kernel it doesn't. it's easy to reproduce, this is why i'm not putting here more then launching script for my virtual machine: # cat openindiana.sh qemu-kvm -hda /home/kvm/openindiana/openindiana.img -m 2048 -localtime -cdrom /home/kvm/+images/oi-dev-147-x86.iso -boot d \ -vga std -vnc :9 -k en-us -monitor unix:/home/kvm/openindiana/instance,server,nowait \ -net nic,model=e1000,vlan=1 -net tap,ifname=oi0,script=no,vlan=1 & sleep 2; ip l set oi0 up; ip a a 192.168.99.9/24 dev oi0; regards by daniel