[ovs-discuss] udp checksum issue with openvswitch

Rakesh B.K bk.rakesh at ymail.com
Wed Aug 21 14:09:29 UTC 2013


Hello,

Found the bug in OpenVSwitch and below is the Description attaching a test sample to reproduce the bug,
                                                                   
Problem Description:                                                                

    I am facing a problem where OpenVSwitch is not complying with the RFC 768 standard on calculating UDP checksum. According to the standard 
    (http://www.ietf.org/rfc/rfc768.txt), details on the UDP fields specify that

        "If the computed checksum is zero, it is transmitted as all ones (the equivalent in one's complement arithmetic)"

    In my case, I expect UDP checksum to be 0xffff, but I receive the computed checksum as 0x0000. This happens in a VM communicating to external 
    network via OpenVSwitch. For checking this, I have used udp based test program which is mentioned in the set-up below.

Test Environment:
    My test environment, in simple terms, consists of two host machines connected via a switch. In one of the host machines, I have a VM connected
    to the NIC interface via OpenVSwitch. The second host machine is just connected via the NIC interface. See figure (A) below.

    The test environment consists of the following framework:

    Host 1 (with VM launched):
    1. Virtual Machine details:
        a. NIC used : Virtio-net
        b. Guest OS : Centos-6.3, invokes udpcli program

    2. Openvswitch Details:
        Adds the vnet0 and eth0 ports to bridge created by openVSwitch
        a. OpenVSwitch-1.4.2 - Fedora provided by fc17 release
        b. OpenVSwitch-1.12.90 - Downloaded from git.
        c. OpenVSwitch-1.4.5
    
    3. Physical machine details:
        a. NIC Used : e1000e
        b. Distros  : Centos-6.3/Fedora Core-17(upgraded to 3.9.10-100.fc17)
        c. Backend driver used : vhost-net

    4. Guest OS running on qemu-kvm:
        a. Centos-6.3 provided(qemu-kvm-0.12.1.2-2.295.el6.x86_64) OR
        b. Fedora-17 provided(qemu-kvm-1.0.1-6.fc17.x86_64)

    Host 2 (without VM):

    1. Physical machine details:
        a. NIC Used : RealTek r8169
        b. Distro   : Ubuntu 11.10 



Setup Network Description:


     -----------------------
    |         VM               | (Udp packet sender, eth0 is virtio-net, 
    |    (Centos-6.3)       |  Which invokes udpcli sample, show in log.a)
     -----------------------    IPAddr : 198.162.0.4
              ^
               |
               |
               |
     ------------------------                            
    | OpenVswitch Bridge |                            
     ------------------------                            
             ^                                
              |                                    
              |                                (Udp packet receiver)
              |                                 IPAddr : 198.162.0.5
     -------------------------------------------------------------            --------------------------------
    |                         PM1                                           |         |        PM2                          |
    | ( (Centos-6.3) / (Fedora-17, upgraded kernel-3.9.x) )|         |(Rx running Ubuntu-11.10) )  |
     -------------------------------------------------------------            ---------------------------------
                                                      ^(Eth0)                             (Eth0)          ^     
                                                       |                                                         |  (TCPDump details         
                                                       |                                                         |   shown in log.b)    
                                                       |                                                         |         
                                                       |          ----------------------------             |
                                                       \-------|    Physical Switch         |----------/
                                                                  ----------------------------

   PM : Physical Machine.
   VM : Virtual Machine.
   vnet0 and eth0 of PM1 is been attached as OpenVswitch Ports.

                        figure (A)

Expected behaviour:
    
    I am triggering the client UDP test program from Guest OS in Host 1 with the destination IP address as the command argument. I am capturing the 
        data sent this way in the 2nd Host via tcpdump utility. I am expecting the checksum and the data tuple to be 0xffff, 0xa584 respectively, but I 
    am getting 0x0000, 0xa584 instead. Please see the description I have mentioned in log.b below.

Running the UDP test programs:

    1. Run tcpdump in the Host2 with the following command:
        tcpdump -i vnet0 udp and src <Address of VM> -x 
    2. Simultaneously in the Guest OS of Host1, invoke udpcli <data> <ipaddress>. 
            This will program will send data to the Host2 machine and wait for the entry of checksum as received in the tcpdump 
    3. Copy the 16-bit checksum from the tcpdump log (see log.b) and enter it in (little endian format) the waiting udpcli console. Press enter.
          The checksum is the 26th and 27th byte of the tcpdump log ( in my case "a9e9" (see log.b) and entered as "e9a9" (see log.a).
    4. Now observe the logs in tcpdump.
    

Logs:

    log.a
    -----
    Invoking the udpcli program inside VM(centos-6.3),

        [root at centos-vm user]# ./udpcli 0000 198.162.0.5
        sending data : 0
        Enter the checksum as data that is been recived from RX 
        e9a9
        sending data : e9a9
        sending data : e9a9
        sending data : e9a9



    where e9a9 corressponds to data recevied bafter firstpacket to get the checksum as 0000 and convert to ffff from second transmission onwards.


    log.b
    -----
    Tcpdump from Rx Log captured from PM2 running ubuntu-11.10,
        root at user-desktop:~/kernel_sources/linux-2.6# tcpdump  -i eth0 udp and src 198.162.0.4 -x
        tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
        listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
        19:17:03.932414 IP 198.162.0.4.44467 > rakesh-desktop.local.6895: UDP, length 2
            0x0000:  4500 001e 0000 4000 4011 ad81 c6a2 0004
            0x0010:  c6a2 0005 adb3 1aef 000a a9e9 0000 0000
                                                           <csum,data>
            0x0020:  0000 0000 0000 0000 0000 0000 0000
        19:17:15.581176 IP 198.162.0.4.44467 > rakesh-desktop.local.6895: UDP, length 2
            0x0000:  4500 001e 0000 4000 4011 ad81 c6a2 0004
            0x0010:  c6a2 0005 adb3 1aef 000a 0000 a9e9 0000
                                                          <csum,data> (This should be 0xffff, here checksum recieved as 0000)
            0x0020:  0000 0000 0000 0000 0000 0000 0000
        19:17:16.581620 IP 198.162.0.4.44467 > rakesh-desktop.local.6895: UDP, length 2
            0x0000:  4500 001e 0000 4000 4011 ad81 c6a2 0004
            0x0010:  c6a2 0005 adb3 1aef 000a ffff a9e9 0000
                                                          <csum,data> (This seems to be fine)
            0x0020:  0000 0000 0000 0000 0000 0000 0000
        19:17:17.581817 IP 198.162.0.4.44467 > rakesh-desktop.local.6895: UDP, length 2
            0x0000:  4500 001e 0000 4000 4011 ad81 c6a2 0004
            0x0010:  c6a2 0005 adb3 1aef 000a ffff a9e9 0000
                                                          <csum,data> (This seems to be fine)
            0x0020:  0000 0000 0000 0000 0000 0000 0000
        
        4 packets captured
        4 packets received by filter
        0 packets dropped by kernel


please share If you have any advice on solving on the issue.


Thanks & Regards,
Rakesh.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20130821/ba6e2f46/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: udpcli.c
Type: text/x-c
Size: 1365 bytes
Desc: not available
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20130821/ba6e2f46/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: udpcli
Type: application/octet-stream
Size: 7743 bytes
Desc: not available
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20130821/ba6e2f46/attachment-0005.obj>


More information about the discuss mailing list