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>
1 file changed
tree: 31aaec41f3d0452478a04dea2d02a8e6407f87cc
  1. audio/
  2. darwin-user/
  3. fpu/
  4. hw/
  5. keymaps/
  6. kvm/
  7. linux-user/
  8. pc-bios/
  9. slirp/
  10. target-alpha/
  11. target-arm/
  12. target-cris/
  13. target-i386/
  14. target-ia64/
  15. target-m68k/
  16. target-mips/
  17. target-ppc/
  18. target-sh4/
  19. target-sparc/
  20. tcg/
  21. tests/
  22. a.out.h
  23. aes.c
  24. aes.h
  25. alpha-dis.c
  26. alpha.ld
  27. arm-dis.c
  28. arm-semi.c
  29. arm.ld
  30. block-bochs.c
  31. block-cloop.c
  32. block-cow.c
  33. block-dmg.c
  34. block-nbd.c
  35. block-parallels.c
  36. block-qcow.c
  37. block-qcow2.c
  38. block-raw-posix.c
  39. block-raw-win32.c
  40. block-vmdk.c
  41. block-vpc.c
  42. block-vvfat.c
  43. block.c
  44. block.h
  45. block_int.h
  46. bswap.h
  47. Changelog
  48. check_ops.sh
  49. cocoa.m
  50. configure
  51. console.c
  52. console.h
  53. COPYING
  54. COPYING.LIB
  55. cpu-all.h
  56. cpu-defs.h
  57. cpu-exec.c
  58. cris-dis.c
  59. curses.c
  60. curses_keys.h
  61. cutils.c
  62. d3des.c
  63. d3des.h
  64. dis-asm.h
  65. disas.c
  66. disas.h
  67. dyngen-exec.h
  68. dyngen.c
  69. elf.h
  70. elf_ops.h
  71. exec-all.h
  72. exec.c
  73. gdbstub.c
  74. gdbstub.h
  75. gen-icount.h
  76. host-utils.c
  77. host-utils.h
  78. hostregs_helper.h
  79. hpet.h
  80. hppa-dis.c
  81. hppa.ld
  82. i386-dis.c
  83. i386.ld
  84. ia64.ld
  85. ia64intrin.h
  86. keymaps.c
  87. kqemu.c
  88. kqemu.h
  89. kvm-compatfd.c
  90. kvm-tpr-opt.c
  91. LICENSE
  92. loader.c
  93. m68k-dis.c
  94. m68k-semi.c
  95. m68k.ld
  96. MAINTAINERS
  97. Makefile
  98. Makefile.target
  99. migration.c
  100. migration.h
  101. mips-dis.c
  102. mips.ld
  103. mipsel.ld
  104. monitor.c
  105. nbd.c
  106. nbd.h
  107. net-checksum.c
  108. net.h
  109. osdep.c
  110. osdep.h
  111. ppc-dis.c
  112. ppc.ld
  113. ppc64.ld
  114. qemu-binfmt-conf.sh
  115. qemu-char.h
  116. qemu-common.h
  117. qemu-doc.texi
  118. qemu-img.c
  119. qemu-img.texi
  120. qemu-kvm-helper.c
  121. qemu-kvm-ia64.c
  122. qemu-kvm-powerpc.c
  123. qemu-kvm-x86.c
  124. qemu-kvm.c
  125. qemu-kvm.h
  126. qemu-lock.h
  127. qemu-malloc.c
  128. qemu-nbd.c
  129. qemu-nbd.texi
  130. qemu-tech.texi
  131. qemu-timer.h
  132. qemu_socket.h
  133. readline.c
  134. README
  135. s390-dis.c
  136. s390.ld
  137. sdl.c
  138. sdl_keysym.h
  139. sh4-dis.c
  140. softmmu-semi.h
  141. softmmu_exec.h
  142. softmmu_header.h
  143. softmmu_template.h
  144. sparc-dis.c
  145. sparc.ld
  146. sparc64.ld
  147. sys-queue.h
  148. sysemu.h
  149. tap-win32.c
  150. texi2pod.pl
  151. thunk.c
  152. thunk.h
  153. TODO
  154. translate-all.c
  155. uboot_image.h
  156. usb-linux.c
  157. VERSION
  158. vgafont.h
  159. vl.c
  160. vnc.c
  161. vnc_keysym.h
  162. vnchextile.h
  163. x86_64.ld
  164. x_keymap.c