View | Details | Raw Unified | Return to bug 188990 | Differences between
and this patch

Collapse All | Expand All

(-)b/sbin/dhclient/dhclient.c (+12 lines)
Lines 61-66 __FBSDID("$FreeBSD$"); Link Here
61
61
62
#include <sys/capsicum.h>
62
#include <sys/capsicum.h>
63
#include <sys/endian.h>
63
#include <sys/endian.h>
64
#include <sys/sysctl.h>
64
65
65
#include <net80211/ieee80211_freebsd.h>
66
#include <net80211/ieee80211_freebsd.h>
66
67
Lines 96-101 int nullfd = -1; Link Here
96
97
97
char hostname[_POSIX_HOST_NAME_MAX + 1];
98
char hostname[_POSIX_HOST_NAME_MAX + 1];
98
99
100
int is_xen_guest = -1;
101
99
struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } };
102
struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } };
100
struct in_addr inaddr_any, inaddr_broadcast;
103
struct in_addr inaddr_any, inaddr_broadcast;
101
104
Lines 351-356 main(int argc, char *argv[]) Link Here
351
	struct passwd		*pw;
354
	struct passwd		*pw;
352
	pid_t			 otherpid;
355
	pid_t			 otherpid;
353
	cap_rights_t		 rights;
356
	cap_rights_t		 rights;
357
	char			 vm_guest[16];
358
	size_t			 sysctl_len = sizeof(vm_guest);
354
359
355
	/* Initially, log errors to stderr as well as to syslogd. */
360
	/* Initially, log errors to stderr as well as to syslogd. */
356
	openlog(__progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY);
361
	openlog(__progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY);
Lines 462-467 main(int argc, char *argv[]) Link Here
462
	if (gethostname(hostname, sizeof(hostname)) < 0)
467
	if (gethostname(hostname, sizeof(hostname)) < 0)
463
		hostname[0] = '\0';
468
		hostname[0] = '\0';
464
469
470
	/*
471
	 * Check if running in a Xen VM before entering capability mode.
472
	 */
473
	if (sysctlbyname("kern.vm_guest", vm_guest, &sysctl_len, NULL, 0) == 0)
474
		if (strcasecmp(vm_guest, "xen") == 0)
475
			is_xen_guest = 1;
476
465
	priv_script_init("PREINIT", NULL);
477
	priv_script_init("PREINIT", NULL);
466
	if (ifi->client->alias)
478
	if (ifi->client->alias)
467
		priv_script_write_params("alias_", ifi->client->alias);
479
		priv_script_write_params("alias_", ifi->client->alias);
(-)b/sbin/dhclient/packet.c (-2 / +3 lines)
Lines 55-60 __FBSDID("$FreeBSD$"); Link Here
55
u_int32_t	checksum(unsigned char *, unsigned, u_int32_t);
55
u_int32_t	checksum(unsigned char *, unsigned, u_int32_t);
56
u_int32_t	wrapsum(u_int32_t);
56
u_int32_t	wrapsum(u_int32_t);
57
57
58
extern int	is_xen_guest;
59
58
u_int32_t
60
u_int32_t
59
checksum(unsigned char *buf, unsigned nbytes, u_int32_t sum)
61
checksum(unsigned char *buf, unsigned nbytes, u_int32_t sum)
60
{
62
{
Lines 231-237 decode_udp_ip_header(unsigned char *buf, int bufix, struct sockaddr_in *from, Link Here
231
	    IPPROTO_UDP + (u_int32_t)ntohs(udp->uh_ulen)))));
233
	    IPPROTO_UDP + (u_int32_t)ntohs(udp->uh_ulen)))));
232
234
233
	udp_packets_seen++;
235
	udp_packets_seen++;
234
	if (usum && usum != sum) {
236
	if (usum && usum != sum && is_xen_guest != 1) {
235
		udp_packets_bad_checksum++;
237
		udp_packets_bad_checksum++;
236
		if (udp_packets_seen > 4 &&
238
		if (udp_packets_seen > 4 &&
237
		    (udp_packets_seen / udp_packets_bad_checksum) < 2) {
239
		    (udp_packets_seen / udp_packets_bad_checksum) < 2) {
238
- 

Return to bug 188990