FreeBSD Bugzilla – Attachment 180307 Details for
Bug 188990
[xen] dhclient(8) does not accept DHCP Offer on FreeBSD 10 as Xen DomU Guest
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH] dhclient: skip UDP checksum check when running in a Xen VM
0001-dhclient-skip-UDP-checksum-check-when-running-in-a-X.patch (text/plain), 2.86 KB, created by
Bhavesh Davda
on 2017-02-26 01:04:23 UTC
(
hide
)
Description:
[PATCH] dhclient: skip UDP checksum check when running in a Xen VM
Filename:
MIME Type:
Creator:
Bhavesh Davda
Created:
2017-02-26 01:04:23 UTC
Size:
2.86 KB
patch
obsolete
>From 848f31f6485744ae11fe531ac2c79659d657a6d0 Mon Sep 17 00:00:00 2001 >From: bhavesh.davda <bhavesh.davda@oracle.com> >Date: Sat, 25 Feb 2017 15:36:06 -0800 >Subject: [PATCH] dhclient: skip UDP checksum check when running in a Xen VM > >The Xen PV network interface offloads checksum validation on receive and >checksum computation on transmit, so the UDP checksum in the packet may appear >to be incorrect. This leads to false negatives and packet drops when receiving >DHCP packets from a DHCP server running in the Xen dom-0. > >Check if dhclient is running in a Xen VM using the 'kern.vm_guest' sysctl and >skip UDP checksum validation if it is. > >Signed-off-by: Bhavesh Davda <bhavesh.davda@oracle.com> >--- > sbin/dhclient/dhclient.c | 12 ++++++++++++ > sbin/dhclient/packet.c | 4 +++- > 2 files changed, 15 insertions(+), 1 deletions(-) > >diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c >index d20585d..646e8a3 100644 >--- a/sbin/dhclient/dhclient.c >+++ b/sbin/dhclient/dhclient.c >@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); > > #include <sys/capsicum.h> > #include <sys/endian.h> >+#include <sys/sysctl.h> > > #include <net80211/ieee80211_freebsd.h> > >@@ -96,6 +97,8 @@ int nullfd = -1; > > char hostname[_POSIX_HOST_NAME_MAX + 1]; > >+int is_xen_guest = -1; >+ > struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } }; > struct in_addr inaddr_any, inaddr_broadcast; > >@@ -351,6 +354,8 @@ main(int argc, char *argv[]) > struct passwd *pw; > pid_t otherpid; > cap_rights_t rights; >+ char vm_guest[16]; >+ size_t sysctl_len = sizeof(vm_guest); > > /* Initially, log errors to stderr as well as to syslogd. */ > openlog(__progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY); >@@ -462,6 +467,13 @@ main(int argc, char *argv[]) > if (gethostname(hostname, sizeof(hostname)) < 0) > hostname[0] = '\0'; > >+ /* >+ * Check if running in a Xen VM before entering capability mode. >+ */ >+ if (sysctlbyname("kern.vm_guest", vm_guest, &sysctl_len, NULL, 0) == 0) >+ if (strcasecmp(vm_guest, "xen") == 0) >+ is_xen_guest = 1; >+ > priv_script_init("PREINIT", NULL); > if (ifi->client->alias) > priv_script_write_params("alias_", ifi->client->alias); >diff --git a/sbin/dhclient/packet.c b/sbin/dhclient/packet.c >index 859f48b..e691ca5 100644 >--- a/sbin/dhclient/packet.c >+++ b/sbin/dhclient/packet.c >@@ -55,6 +55,8 @@ __FBSDID("$FreeBSD$"); > u_int32_t checksum(unsigned char *, unsigned, u_int32_t); > u_int32_t wrapsum(u_int32_t); > >+extern int is_xen_guest; >+ > u_int32_t > checksum(unsigned char *buf, unsigned nbytes, u_int32_t sum) > { >@@ -231,7 +233,7 @@ decode_udp_ip_header(unsigned char *buf, int bufix, struct sockaddr_in *from, > IPPROTO_UDP + (u_int32_t)ntohs(udp->uh_ulen))))); > > udp_packets_seen++; >- if (usum && usum != sum) { >+ if (usum && usum != sum && is_xen_guest != 1) { > udp_packets_bad_checksum++; > if (udp_packets_seen > 4 && > (udp_packets_seen / udp_packets_bad_checksum) < 2) { >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 188990
:
180307
|
180335
|
180347