mz: allow for zero udp checksum
commit73da36ba1a4b6964ada8af8ac693d01edc078e94
authorMark Latimer <mark.latimer@gmail.com>
Sun, 11 Jan 2015 11:19:20 +0000 (11 12:19 +0100)
committerDaniel Borkmann <dborkman@redhat.com>
Sun, 11 Jan 2015 11:21:43 +0000 (11 12:21 +0100)
treee5b1204148149c72c75e5343218c11f1da72459d
parentf7f5b215eadf47fde1300cd8855532bc4bfe0ff4
mz: allow for zero udp checksum

I have been investigating tools to generate UDP with checksums of
zero for software testing. This is legal in IPv4 but unwise due to
inability to verify the data has not been corrupted.

I found that mausezahn was not able to create these packets due
despite being able to create incorrect UDP checksums. The code does
not distinguish set to zero and unset.

Results as seen by wireshark (UDP checksum verification enabled)

mausezahn  eth0  -A 192.168.0.105 -B 192.168.0.104 -t udp "sp=32452,dp=1024" -P Hello
-> UDP checksum is automatically set to the valid value.

mausezahn  eth0  -A 192.168.0.105 -B 192.168.0.104 -t udp "sp=32452,dp=1024,udp_sum=1" -P Hello
-> UDP checksum is set to 1 (which is invalid and highlighted by wireshark).

mausezahn  eth0  -A 192.168.0.105 -B 192.168.0.104 -t udp "sp=32452,dp=1024,udp_sum=0" -P Hello
-> Before patch the checksum was set to the valid value.
-> After patch the checksum was sent to zero.

Signed-off-by: Mark Latimer <mark.latimer@gmail.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
staging/layer4.c