Bug 740653

Summary: Bug in virtio_net at NF_INET_PRE_ROUTING
Product: Red Hat Enterprise Linux 6 Reporter: cristea
Component: qemu-kvmAssignee: Michael S. Tsirkin <mst>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.1CC: acathrow, mkenneth, tburke, toracat, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-27 10:00:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
kernel module that dumps IP packets at NF_INET_PRE_ROUTING hook none

Description cristea 2011-09-22 20:20:31 UTC
Created attachment 524467 [details]
kernel module that dumps IP packets at NF_INET_PRE_ROUTING hook

Description of problem:
Packets captured in NF_INET_PRE_ROUTING, or NF_INET_LOCAL_INPUT hook over a virtio NIC shows rubbish starting at offset 0x80 from raw-Ethernet.

Version-Release number of selected component (if applicable):

QEMU emulator version 0.14.1 (qemu-kvm-0.14.1) in host.
centos6.0 (kernel 2.6.32-71.29.1.el6.x86_64) in VM
and 
scientific-linux-6.1 (kernel 2.6.32-131.12.1.el6.x86_64) in VM

How reproducible:

To show this, I made a simple kernel module with netfilter hook for nfho.hooknum  = NF_INET_PRE_ROUTING; - runned it and tested with pings (dump the ping packet). You can download the sources of this module here: http://dl.free.fr/gXETj3izM (or attached to this report)

Steps to Reproduce:
1.Use a VM running centos6 (or sl-6.1) with the latest kernel. Have 2 NICs types: e1000 and virtio.
2. Take the attached module and compile it (run ./build.sh) => get mymodule.ko
3. insmod the compiled kernel module (./reload.sh) => see mymodule in lsmod
4. from another host, ping each of the NIC of the VM that has mymodule running using: ping x.x.x.x -p AA -s 1000 (filled with 0xAA 1000bytes).
  
Actual results:

When pinging the virtio NIC:

Dump ICMP packet, size of: 1028
45 00 04 04 00 00 40 00  40 01 bf 07 c0 a8 7b 01    E.....@.@.....{.
c0 a8 7b 9f 08 00 f9 ce  69 8a 00 05 d2 b1 5b 4e    ..{.....i.....[N
00 00 00 00 5d a1 09 00  00 00 00 00 aa aa aa aa    ....]...........
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
01 00 00 00 01 00 00 00  00 00 00 00 00 00 00 00    ................
00 00 01 c0 0c 00 10 00  00 00 00 00 00 00 00 00    ................
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00    ................
60 86 c3 00 00 ea ff ff  aa 00 00 00 74 03 00 00    `...........t...
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00    ................
00 76 61 68 69 2e 63 6f  00 00 00 00 00 00 00 00    .vahi

Expected results:

When pinging the e1000 NIC:

Dump ICMP packet, size of: 1028
45 00 04 04 00 00 40 00  40 01 0b 0d xx xx xx xx    E.....@.@....d..
yy yy yy yy 08 00 73 10  c1 7e 00 1c 83 b1 5b 4e    .d....s.......[N
00 00 00 00 d8 54 0c 00  00 00 00 00 aa aa aa aa    .....T..........
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    ................
aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa    .....


Additional info:
This problem didn't occur with older kernels (2.6.18-centos, or vanilla 2.6.25)!

Comment 2 Dor Laor 2011-09-27 10:00:17 UTC
This is not the place to report centos issues and the above versions are too old in respect to rhel6 series.

Comment 3 cristea 2011-09-27 11:07:11 UTC
(In reply to comment #2)
> This is not the place to report centos issues and the above versions are too
> old in respect to rhel6 series.

Unfortunately, it's not a CentOS issue: it's about virtio and latest linux kernels. Besides Centos and ScientificLinux, I tried it also on the latest Debian and ubuntu - same problems. Just try the code I posted in your favorite linux - and you'll see the problem.

Kind regards,
Mihai

Comment 4 Dor Laor 2011-10-02 14:19:03 UTC
Michael, can you please check if we like to fixed it?