Work around dhclient brokenness
commit42765e43a8d0ededab01e7ebc16553b92310b839
authorAnthony Liguori <aliguori@us.ibm.com>
Tue, 19 Aug 2008 14:10:40 +0000 (19 09:10 -0500)
committerAvi Kivity <avi@qumranet.com>
Tue, 19 Aug 2008 14:16:04 +0000 (19 17:16 +0300)
tree31aaec41f3d0452478a04dea2d02a8e6407f87cc
parent54b6296e54fd300ed36747bcfa4d69865ddffa4c
Work around dhclient brokenness

With the latest GSO/csum offload patches, any guest using an unpatched version
of dhclient (any Ubuntu guest, for instance), will no longer be able to get
a DHCP address.

dhclient is actually at fault here.  It uses AF_PACKET to receive DHCP responses
but does not check auxdata to see if the packet has a valid csum.  This causes
it to throw out the DHCP responses it gets from the virtio interface as there
is not a valid checksum.

Fedora has carried a patch to fix their dhclient (it's needed for Xen too) but
this patch has not made it into a release of dhclient.  AFAIK, the patch is in
the dhclient CVS but I cannot confirm since their CVS is not public.

This patch, suggested by Rusty, looks for UDP packets (of a normal MTU) and
explicitly adds a checksum to them if they are missing one.

This allows unpatched dhclients to continue to work without needing to update
the guest kernels.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
hw/virtio-net.c