- Fix Xen networking problems with partial checksums (#221964)

This commit is contained in:
David Cantrell 2007-01-30 18:37:21 +00:00
parent fc985eca96
commit 02017bb235
3 changed files with 308 additions and 50 deletions

View File

@ -1,5 +1,5 @@
--- dhcp-3.0.5/client/dhclient.c.libdhcp4client 2007-01-29 17:02:31.000000000 -0500 --- dhcp-3.0.5/client/dhclient.c.libdhcp4client 2007-01-30 13:29:31.000000000 -0500
+++ dhcp-3.0.5/client/dhclient.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/client/dhclient.c 2007-01-30 13:29:31.000000000 -0500
@@ -78,7 +78,9 @@ @@ -78,7 +78,9 @@
int extended_option_environment = 0; int extended_option_environment = 0;
#endif #endif
@ -587,8 +587,8 @@
ddns_dhcid, client_identifier; ddns_dhcid, client_identifier;
struct option_cache *oc; struct option_cache *oc;
int ignorep; int ignorep;
--- dhcp-3.0.5/common/alloc.c.libdhcp4client 2007-01-29 17:02:31.000000000 -0500 --- dhcp-3.0.5/common/alloc.c.libdhcp4client 2007-01-30 13:29:31.000000000 -0500
+++ dhcp-3.0.5/common/alloc.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/common/alloc.c 2007-01-30 13:29:31.000000000 -0500
@@ -48,7 +48,6 @@ @@ -48,7 +48,6 @@
const char *file; const char *file;
int line; int line;
@ -669,8 +669,8 @@
struct dns_zone *d; struct dns_zone *d;
if (!ptr) { if (!ptr) {
--- dhcp-3.0.5/common/discover.c.libdhcp4client 2007-01-29 17:02:31.000000000 -0500 --- dhcp-3.0.5/common/discover.c.libdhcp4client 2007-01-30 13:29:31.000000000 -0500
+++ dhcp-3.0.5/common/discover.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/common/discover.c 2007-01-30 13:29:31.000000000 -0500
@@ -120,28 +120,30 @@ @@ -120,28 +120,30 @@
For each interface that's of type INET and not the loopback interface, For each interface that's of type INET and not the loopback interface,
register that interface with the network I/O software, figure out what register that interface with the network I/O software, figure out what
@ -760,18 +760,18 @@
isc_result_t status; isc_result_t status;
if (h -> type != dhcp_type_interface) if (h -> type != dhcp_type_interface)
--- dhcp-3.0.5/common/lpf.c.libdhcp4client 2004-11-24 12:39:15.000000000 -0500 --- dhcp-3.0.5/common/lpf.c.libdhcp4client 2007-01-30 13:29:31.000000000 -0500
+++ dhcp-3.0.5/common/lpf.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/common/lpf.c 2007-01-30 13:30:23.000000000 -0500
@@ -69,8 +69,6 @@ @@ -89,8 +89,6 @@
struct interface_info *info; struct sockaddr common;
{ } sa;
int sock; struct ifreq ifr;
- char filename[50]; - char filename[50];
- int b; - int b;
struct sockaddr sa;
/* Make an LPF socket. */ /* Make an LPF socket. */
@@ -216,6 +214,7 @@ if ((sock = socket(PF_PACKET, SOCK_RAW,
@@ -249,6 +247,7 @@
struct interface_info *info; struct interface_info *info;
{ {
struct sock_fprog p; struct sock_fprog p;
@ -779,16 +779,16 @@
/* Set up the bpf filter program structure. This is defined in /* Set up the bpf filter program structure. This is defined in
bpf.c */ bpf.c */
@@ -334,7 +333,6 @@ @@ -358,7 +357,6 @@
struct sockaddr_in *from; struct sockaddr_in *from;
struct hardware *hfrom; struct hardware *hfrom;
{ {
- int nread; - int nread;
int length = 0; int length = 0;
int offset = 0; int offset = 0;
unsigned char ibuf [1536]; int nocsum = 0;
--- dhcp-3.0.5/dst/hmac_link.c.libdhcp4client 2007-01-29 17:02:31.000000000 -0500 --- dhcp-3.0.5/dst/hmac_link.c.libdhcp4client 2007-01-30 13:29:31.000000000 -0500
+++ dhcp-3.0.5/dst/hmac_link.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/dst/hmac_link.c 2007-01-30 13:29:31.000000000 -0500
@@ -38,6 +38,10 @@ @@ -38,6 +38,10 @@
#include "dst_internal.h" #include "dst_internal.h"
@ -876,7 +876,7 @@
return (0); return (0);
memset(dst_t_func[KEY_HMAC_MD5], 0, sizeof(struct dst_func)); memset(dst_t_func[KEY_HMAC_MD5], 0, sizeof(struct dst_func));
--- dhcp-3.0.5/dst/md5_dgst.c.libdhcp4client 2004-06-14 14:50:06.000000000 -0400 --- dhcp-3.0.5/dst/md5_dgst.c.libdhcp4client 2004-06-14 14:50:06.000000000 -0400
+++ dhcp-3.0.5/dst/md5_dgst.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/dst/md5_dgst.c 2007-01-30 13:29:31.000000000 -0500
@@ -65,7 +65,7 @@ @@ -65,7 +65,7 @@
#ifdef USE_MD5 /* Added by ogud@tis.com 1998/1/26 */ #ifdef USE_MD5 /* Added by ogud@tis.com 1998/1/26 */
@ -911,7 +911,7 @@
unsigned char *md; unsigned char *md;
MD5_CTX *c; MD5_CTX *c;
--- dhcp-3.0.5/minires/ns_date.c.libdhcp4client 2004-06-10 13:59:40.000000000 -0400 --- dhcp-3.0.5/minires/ns_date.c.libdhcp4client 2004-06-10 13:59:40.000000000 -0400
+++ dhcp-3.0.5/minires/ns_date.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/minires/ns_date.c 2007-01-30 13:29:31.000000000 -0500
@@ -56,6 +56,7 @@ @@ -56,6 +56,7 @@
1 January 1970 (GMT assumed). Format is yyyymmddhhmmss, all 1 January 1970 (GMT assumed). Format is yyyymmddhhmmss, all
digits required, no spaces allowed. */ digits required, no spaces allowed. */
@ -921,7 +921,7 @@
ns_datetosecs(const char *cp, int *errp) { ns_datetosecs(const char *cp, int *errp) {
struct tm time; struct tm time;
--- dhcp-3.0.5/minires/ns_verify.c.libdhcp4client 2004-06-10 13:59:42.000000000 -0400 --- dhcp-3.0.5/minires/ns_verify.c.libdhcp4client 2004-06-10 13:59:42.000000000 -0400
+++ dhcp-3.0.5/minires/ns_verify.c 2007-01-29 17:05:45.000000000 -0500 +++ dhcp-3.0.5/minires/ns_verify.c 2007-01-30 13:29:31.000000000 -0500
@@ -61,6 +61,7 @@ @@ -61,6 +61,7 @@
/* Public. */ /* Public. */
@ -939,7 +939,7 @@
ns_verify(u_char *msg, unsigned *msglen, void *k, ns_verify(u_char *msg, unsigned *msglen, void *k,
const u_char *querysig, unsigned querysiglen, const u_char *querysig, unsigned querysiglen,
--- dhcp-3.0.5/minires/ns_parse.c.libdhcp4client 2004-06-10 13:59:40.000000000 -0400 --- dhcp-3.0.5/minires/ns_parse.c.libdhcp4client 2004-06-10 13:59:40.000000000 -0400
+++ dhcp-3.0.5/minires/ns_parse.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/minires/ns_parse.c 2007-01-30 13:29:31.000000000 -0500
@@ -47,7 +47,7 @@ @@ -47,7 +47,7 @@
/* Public. */ /* Public. */
@ -974,7 +974,7 @@
ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) { ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
int b; int b;
--- dhcp-3.0.5/minires/ns_samedomain.c.libdhcp4client 2004-06-10 13:59:41.000000000 -0400 --- dhcp-3.0.5/minires/ns_samedomain.c.libdhcp4client 2004-06-10 13:59:41.000000000 -0400
+++ dhcp-3.0.5/minires/ns_samedomain.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/minires/ns_samedomain.c 2007-01-30 13:29:31.000000000 -0500
@@ -53,6 +53,7 @@ @@ -53,6 +53,7 @@
* but NOT in "bar.top" * but NOT in "bar.top"
*/ */
@ -1007,8 +1007,8 @@
int int
ns_samename(const char *a, const char *b) { ns_samename(const char *a, const char *b) {
char ta[NS_MAXDNAME], tb[NS_MAXDNAME]; char ta[NS_MAXDNAME], tb[NS_MAXDNAME];
--- dhcp-3.0.5/minires/ns_name.c.libdhcp4client 2007-01-29 17:02:31.000000000 -0500 --- dhcp-3.0.5/minires/ns_name.c.libdhcp4client 2007-01-30 13:29:31.000000000 -0500
+++ dhcp-3.0.5/minires/ns_name.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/minires/ns_name.c 2007-01-30 13:29:31.000000000 -0500
@@ -60,6 +60,7 @@ @@ -60,6 +60,7 @@
* The root is returned as "." * The root is returned as "."
* All other domains are returned in non absolute form * All other domains are returned in non absolute form
@ -1074,7 +1074,7 @@
ns_name_skip(const u_char **ptrptr, const u_char *eom) { ns_name_skip(const u_char **ptrptr, const u_char *eom) {
const u_char *cp; const u_char *cp;
--- dhcp-3.0.5/minires/ns_sign.c.libdhcp4client 2004-06-10 13:59:42.000000000 -0400 --- dhcp-3.0.5/minires/ns_sign.c.libdhcp4client 2004-06-10 13:59:42.000000000 -0400
+++ dhcp-3.0.5/minires/ns_sign.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/minires/ns_sign.c 2007-01-30 13:29:31.000000000 -0500
@@ -78,6 +78,7 @@ @@ -78,6 +78,7 @@
* - bad key / sign failed (-BADKEY) * - bad key / sign failed (-BADKEY)
* - not enough space (NS_TSIG_ERROR_NO_SPACE) * - not enough space (NS_TSIG_ERROR_NO_SPACE)
@ -1083,8 +1083,8 @@
isc_result_t isc_result_t
ns_sign(u_char *msg, unsigned *msglen, unsigned msgsize, int error, void *k, ns_sign(u_char *msg, unsigned *msglen, unsigned msgsize, int error, void *k,
const u_char *querysig, unsigned querysiglen, u_char *sig, const u_char *querysig, unsigned querysiglen, u_char *sig,
--- dhcp-3.0.5/minires/res_comp.c.libdhcp4client 2007-01-29 17:02:31.000000000 -0500 --- dhcp-3.0.5/minires/res_comp.c.libdhcp4client 2007-01-30 13:29:31.000000000 -0500
+++ dhcp-3.0.5/minires/res_comp.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/minires/res_comp.c 2007-01-30 13:29:31.000000000 -0500
@@ -103,6 +103,7 @@ @@ -103,6 +103,7 @@
* 'exp_dn' is a pointer to a buffer of size 'length' for the result. * 'exp_dn' is a pointer to a buffer of size 'length' for the result.
* Return size of compressed name or -1 if there was an error. * Return size of compressed name or -1 if there was an error.
@ -1109,8 +1109,8 @@
int int
dn_skipname(const u_char *ptr, const u_char *eom) { dn_skipname(const u_char *ptr, const u_char *eom) {
const u_char *saveptr = ptr; const u_char *saveptr = ptr;
--- dhcp-3.0.5/minires/res_mkupdate.c.libdhcp4client 2007-01-29 17:02:32.000000000 -0500 --- dhcp-3.0.5/minires/res_mkupdate.c.libdhcp4client 2007-01-30 13:29:31.000000000 -0500
+++ dhcp-3.0.5/minires/res_mkupdate.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/minires/res_mkupdate.c 2007-01-30 13:29:31.000000000 -0500
@@ -936,6 +936,7 @@ @@ -936,6 +936,7 @@
static struct valuelist *servicelist, *protolist; static struct valuelist *servicelist, *protolist;
@ -1176,7 +1176,7 @@
res_servicename(u_int16_t port, const char *proto) { /* Host byte order. */ res_servicename(u_int16_t port, const char *proto) { /* Host byte order. */
static char number[8]; static char number[8];
--- dhcp-3.0.5/minires/res_findzonecut.c.libdhcp4client 2004-06-10 13:59:43.000000000 -0400 --- dhcp-3.0.5/minires/res_findzonecut.c.libdhcp4client 2004-06-10 13:59:43.000000000 -0400
+++ dhcp-3.0.5/minires/res_findzonecut.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/minires/res_findzonecut.c 2007-01-30 13:29:31.000000000 -0500
@@ -139,6 +139,7 @@ @@ -139,6 +139,7 @@
* keep going. for the NS and A queries this means we just give up. * keep going. for the NS and A queries this means we just give up.
*/ */
@ -1186,7 +1186,7 @@
res_findzonecut(res_state statp, const char *dname, ns_class class, int opts, res_findzonecut(res_state statp, const char *dname, ns_class class, int opts,
char *zname, size_t zsize, struct in_addr *addrs, int naddrs, char *zname, size_t zsize, struct in_addr *addrs, int naddrs,
--- dhcp-3.0.5/minires/res_send.c.libdhcp4client 2004-06-10 13:59:44.000000000 -0400 --- dhcp-3.0.5/minires/res_send.c.libdhcp4client 2004-06-10 13:59:44.000000000 -0400
+++ dhcp-3.0.5/minires/res_send.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/minires/res_send.c 2007-01-30 13:29:31.000000000 -0500
@@ -128,6 +128,7 @@ @@ -128,6 +128,7 @@
* author: * author:
* paul vixie, 29may94 * paul vixie, 29may94
@ -1228,7 +1228,7 @@
res_nclose(res_state statp) { res_nclose(res_state statp) {
if (statp->_sock >= 0) { if (statp->_sock >= 0) {
--- dhcp-3.0.5/minires/res_mkquery.c.libdhcp4client 2004-06-10 13:59:43.000000000 -0400 --- dhcp-3.0.5/minires/res_mkquery.c.libdhcp4client 2004-06-10 13:59:43.000000000 -0400
+++ dhcp-3.0.5/minires/res_mkquery.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/minires/res_mkquery.c 2007-01-30 13:29:31.000000000 -0500
@@ -96,6 +96,7 @@ @@ -96,6 +96,7 @@
* Form all types of queries. * Form all types of queries.
* Returns the size of the result or -1. * Returns the size of the result or -1.
@ -1238,7 +1238,7 @@
res_nmkquery(res_state statp, res_nmkquery(res_state statp,
int op, /* opcode of query */ int op, /* opcode of query */
--- dhcp-3.0.5/minires/res_sendsigned.c.libdhcp4client 2004-06-10 13:59:44.000000000 -0400 --- dhcp-3.0.5/minires/res_sendsigned.c.libdhcp4client 2004-06-10 13:59:44.000000000 -0400
+++ dhcp-3.0.5/minires/res_sendsigned.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/minires/res_sendsigned.c 2007-01-30 13:29:31.000000000 -0500
@@ -41,6 +41,7 @@ @@ -41,6 +41,7 @@
#include <isc-dhcp/dst.h> #include <isc-dhcp/dst.h>
@ -1247,8 +1247,8 @@
isc_result_t isc_result_t
res_nsendsigned(res_state statp, res_nsendsigned(res_state statp,
double *msg, unsigned msglen, ns_tsig_key *key, double *msg, unsigned msglen, ns_tsig_key *key,
--- dhcp-3.0.5/minires/res_init.c.libdhcp4client 2007-01-29 17:02:31.000000000 -0500 --- dhcp-3.0.5/minires/res_init.c.libdhcp4client 2007-01-30 13:29:31.000000000 -0500
+++ dhcp-3.0.5/minires/res_init.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/minires/res_init.c 2007-01-30 13:29:31.000000000 -0500
@@ -484,6 +484,7 @@ @@ -484,6 +484,7 @@
} }
#endif #endif
@ -1258,7 +1258,7 @@
res_randomid(void) { res_randomid(void) {
struct timeval now; struct timeval now;
--- dhcp-3.0.5/omapip/alloc.c.libdhcp4client 2006-02-22 17:43:27.000000000 -0500 --- dhcp-3.0.5/omapip/alloc.c.libdhcp4client 2006-02-22 17:43:27.000000000 -0500
+++ dhcp-3.0.5/omapip/alloc.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/omapip/alloc.c 2007-01-30 13:29:31.000000000 -0500
@@ -40,6 +40,41 @@ @@ -40,6 +40,41 @@
#include <omapip/omapip_p.h> #include <omapip/omapip_p.h>
@ -1330,8 +1330,8 @@
} }
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \ #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
--- dhcp-3.0.5/omapip/dispatch.c.libdhcp4client 2007-01-29 17:02:31.000000000 -0500 --- dhcp-3.0.5/omapip/dispatch.c.libdhcp4client 2007-01-30 13:29:31.000000000 -0500
+++ dhcp-3.0.5/omapip/dispatch.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/omapip/dispatch.c 2007-01-30 13:29:31.000000000 -0500
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
#include <omapip/omapip_p.h> #include <omapip/omapip_p.h>
@ -1341,8 +1341,8 @@
TIME cur_time; TIME cur_time;
OMAPI_OBJECT_ALLOC (omapi_io, OMAPI_OBJECT_ALLOC (omapi_io,
--- dhcp-3.0.5/omapip/errwarn.c.libdhcp4client 2007-01-29 17:02:31.000000000 -0500 --- dhcp-3.0.5/omapip/errwarn.c.libdhcp4client 2007-01-30 13:29:31.000000000 -0500
+++ dhcp-3.0.5/omapip/errwarn.c 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/omapip/errwarn.c 2007-01-30 13:29:31.000000000 -0500
@@ -39,6 +39,11 @@ @@ -39,6 +39,11 @@
#include <omapip/omapip_p.h> #include <omapip/omapip_p.h>
#include <errno.h> #include <errno.h>
@ -1465,7 +1465,7 @@
} }
--- dhcp-3.0.5/configure.libdhcp4client 2004-09-10 17:02:30.000000000 -0400 --- dhcp-3.0.5/configure.libdhcp4client 2004-09-10 17:02:30.000000000 -0400
+++ dhcp-3.0.5/configure 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/configure 2007-01-30 13:29:31.000000000 -0500
@@ -246,7 +246,7 @@ @@ -246,7 +246,7 @@
fi fi
@ -1475,8 +1475,8 @@
fi fi
for foo in $dirs; do for foo in $dirs; do
--- /dev/null 2007-01-28 13:50:40.723776703 -0500 --- /dev/null 2007-01-30 11:05:20.939899920 -0500
+++ dhcp-3.0.5/libdhcp4client/Makefile.dist 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/libdhcp4client/Makefile.dist 2007-01-30 13:29:31.000000000 -0500
@@ -0,0 +1,127 @@ @@ -0,0 +1,127 @@
+# Makefile.dist for libdhcp4client +# Makefile.dist for libdhcp4client
+# +#
@ -1605,8 +1605,8 @@
+ $(CC) -shared -o $@ -Wl,-soname,$@ $(OBJS) `$(AR) t libres.a | grep -v res_query.o` + $(CC) -shared -o $@ -Wl,-soname,$@ $(OBJS) `$(AR) t libres.a | grep -v res_query.o`
+ +
+# Dependencies (semi-automatically-generated) +# Dependencies (semi-automatically-generated)
--- /dev/null 2007-01-28 13:50:40.723776703 -0500 --- /dev/null 2007-01-30 11:05:20.939899920 -0500
+++ dhcp-3.0.5/libdhcp4client/dhcp4client.h 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/libdhcp4client/dhcp4client.h 2007-01-30 13:29:31.000000000 -0500
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
+/* dhcp4client.h +/* dhcp4client.h
+ * + *
@ -1632,8 +1632,8 @@
+extern int dhcpv4_client( struct libdhcp_control_s *dhc_ctl, int argc, char **argv, char **envp); +extern int dhcpv4_client( struct libdhcp_control_s *dhc_ctl, int argc, char **argv, char **envp);
+ /* The ISC IPv4 DHCP client main() function . + /* The ISC IPv4 DHCP client main() function .
+ */ + */
--- /dev/null 2007-01-28 13:50:40.723776703 -0500 --- /dev/null 2007-01-30 11:05:20.939899920 -0500
+++ dhcp-3.0.5/libdhcp4client/libdhcp_control.h 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/libdhcp4client/libdhcp_control.h 2007-01-30 13:29:31.000000000 -0500
@@ -0,0 +1,102 @@ @@ -0,0 +1,102 @@
+/* libdhcp_control.h +/* libdhcp_control.h
+ * + *
@ -1738,7 +1738,7 @@
+ +
+#endif +#endif
--- dhcp-3.0.5/Makefile.dist.libdhcp4client 2004-06-10 13:59:10.000000000 -0400 --- dhcp-3.0.5/Makefile.dist.libdhcp4client 2004-06-10 13:59:10.000000000 -0400
+++ dhcp-3.0.5/Makefile.dist 2007-01-29 17:02:32.000000000 -0500 +++ dhcp-3.0.5/Makefile.dist 2007-01-30 13:29:31.000000000 -0500
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
# http://www.isc.org/ # http://www.isc.org/

View File

@ -0,0 +1,251 @@
diff -urN dhcp-3.0.5.xen/common/bpf.c dhcp-3.0.5/common/bpf.c
--- dhcp-3.0.5.xen/common/bpf.c 2004-11-24 12:39:15.000000000 -0500
+++ dhcp-3.0.5/common/bpf.c 2007-01-30 13:23:57.000000000 -0500
@@ -478,7 +478,8 @@
interface -> rbuf,
interface -> rbuf_offset,
from,
- hdr.bh_caplen);
+ hdr.bh_caplen,
+ 0);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0) {
diff -urN dhcp-3.0.5.xen/common/dlpi.c dhcp-3.0.5/common/dlpi.c
--- dhcp-3.0.5.xen/common/dlpi.c 2004-11-24 12:39:15.000000000 -0500
+++ dhcp-3.0.5/common/dlpi.c 2007-01-30 13:23:57.000000000 -0500
@@ -679,7 +679,7 @@
length -= offset;
#endif
offset = decode_udp_ip_header (interface, dbuf, bufix,
- from, length);
+ from, length, 0);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0) {
diff -urN dhcp-3.0.5.xen/common/lpf.c dhcp-3.0.5/common/lpf.c
--- dhcp-3.0.5.xen/common/lpf.c 2004-11-24 12:39:15.000000000 -0500
+++ dhcp-3.0.5/common/lpf.c 2007-01-30 13:27:39.000000000 -0500
@@ -34,16 +34,31 @@
#include "dhcpd.h"
#if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
#include <sys/ioctl.h>
+#include <sys/socket.h>
#include <sys/uio.h>
#include <asm/types.h>
#include <linux/filter.h>
#include <linux/if_ether.h>
+#include <linux/if_packet.h>
#include <netinet/in_systm.h>
#include "includes/netinet/ip.h"
#include "includes/netinet/udp.h"
#include "includes/netinet/if_ether.h"
+#ifndef PACKET_AUXDATA
+#define PACKET_AUXDATA 8
+
+struct tpacket_auxdata
+{
+ __u32 tp_status;
+ __u32 tp_len;
+ __u32 tp_snaplen;
+ __u16 tp_mac;
+ __u16 tp_net;
+};
+#endif
+
/* Reinitializes the specified interface after an address change. This
is not required for packet-filter APIs. */
@@ -69,12 +84,16 @@
struct interface_info *info;
{
int sock;
+ union {
+ struct sockaddr_ll ll;
+ struct sockaddr common;
+ } sa;
+ struct ifreq ifr;
char filename[50];
int b;
- struct sockaddr sa;
/* Make an LPF socket. */
- if ((sock = socket(PF_PACKET, SOCK_PACKET,
+ if ((sock = socket(PF_PACKET, SOCK_RAW,
htons((short)ETH_P_ALL))) < 0) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
@@ -89,11 +108,16 @@
log_fatal ("Open a socket for LPF: %m");
}
+ memset (&ifr, 0, sizeof ifr);
+ strncpy (ifr.ifr_name, (const char *)info -> ifp, sizeof ifr.ifr_name);
+ if (ioctl (sock, SIOCGIFINDEX, &ifr))
+ log_fatal ("Failed to get interface index: %m");
+
/* Bind to the interface name */
memset (&sa, 0, sizeof sa);
- sa.sa_family = AF_PACKET;
- strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data);
- if (bind (sock, &sa, sizeof sa)) {
+ sa.ll.sll_family = AF_PACKET;
+ sa.ll.sll_ifindex = ifr.ifr_ifindex;
+ if (bind (sock, &sa.common, sizeof sa)) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
errno == EAFNOSUPPORT || errno == EINVAL) {
@@ -173,9 +197,18 @@
void if_register_receive (info)
struct interface_info *info;
{
+ int val;
+
/* Open a LPF device and hang it on this interface... */
info -> rfdesc = if_register_lpf (info);
+ val = 1;
+ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
+ sizeof val) < 0) {
+ if (errno != ENOPROTOOPT)
+ log_fatal ("Failed to set auxiliary packet data: %m");
+ }
+
#if defined (HAVE_TR_SUPPORT)
if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
lpf_tr_filter_setup (info);
@@ -293,7 +326,6 @@
double hh [16];
double ih [1536 / sizeof (double)];
unsigned char *buf = (unsigned char *)ih;
- struct sockaddr sa;
int result;
int fudge;
@@ -311,15 +343,7 @@
(unsigned char *)raw, len);
memcpy (buf + ibufp, raw, len);
- /* For some reason, SOCK_PACKET sockets can't be connected,
- so we have to do a sentdo every time. */
- memset (&sa, 0, sizeof sa);
- sa.sa_family = AF_PACKET;
- strncpy (sa.sa_data,
- (const char *)interface -> ifp, sizeof sa.sa_data);
-
- result = sendto (interface -> wfdesc,
- buf + fudge, ibufp + len - fudge, 0, &sa, sizeof sa);
+ result = write (interface -> wfdesc, buf + fudge, ibufp + len - fudge);
if (result < 0)
log_error ("send_packet: %m");
return result;
@@ -337,13 +361,34 @@
int nread;
int length = 0;
int offset = 0;
+ int nocsum = 0;
unsigned char ibuf [1536];
unsigned bufix = 0;
+ unsigned char cmsgbuf[CMSG_LEN(sizeof(struct tpacket_auxdata))];
+ struct iovec iov = {
+ .iov_base = ibuf,
+ .iov_len = sizeof ibuf,
+ };
+ struct msghdr msg = {
+ .msg_iov = &iov,
+ .msg_iovlen = 1,
+ .msg_control = cmsgbuf,
+ .msg_controllen = sizeof(cmsgbuf),
+ };
+ struct cmsghdr *cmsg;
- length = read (interface -> rfdesc, ibuf, sizeof ibuf);
+ length = recvmsg (interface -> rfdesc, &msg, 0);
if (length <= 0)
return length;
+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+ if (cmsg->cmsg_level == SOL_PACKET &&
+ cmsg->cmsg_type == PACKET_AUXDATA) {
+ struct tpacket_auxdata *aux = (void *)CMSG_DATA(cmsg);
+ nocsum = aux->tp_status & TP_STATUS_CSUMNOTREADY;
+ }
+ }
+
bufix = 0;
/* Decode the physical header... */
offset = decode_hw_header (interface, ibuf, bufix, hfrom);
@@ -360,7 +405,7 @@
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix, from,
- (unsigned)length);
+ (unsigned)length, nocsum);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff -urN dhcp-3.0.5.xen/common/nit.c dhcp-3.0.5/common/nit.c
--- dhcp-3.0.5.xen/common/nit.c 2004-11-24 12:39:15.000000000 -0500
+++ dhcp-3.0.5/common/nit.c 2007-01-30 13:23:57.000000000 -0500
@@ -370,7 +370,7 @@
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix,
- from, length);
+ from, length, 0);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff -urN dhcp-3.0.5.xen/common/packet.c dhcp-3.0.5/common/packet.c
--- dhcp-3.0.5.xen/common/packet.c 2007-01-30 13:23:27.000000000 -0500
+++ dhcp-3.0.5/common/packet.c 2007-01-30 13:23:57.000000000 -0500
@@ -211,12 +211,13 @@
/* UDP header and IP header decoded together for convenience. */
-ssize_t decode_udp_ip_header (interface, buf, bufix, from, buflen)
+ssize_t decode_udp_ip_header (interface, buf, bufix, from, buflen, nocsum)
struct interface_info *interface;
unsigned char *buf;
unsigned bufix;
struct sockaddr_in *from;
unsigned buflen;
+ int nocsum;
{
unsigned char *data;
struct ip ip;
@@ -319,7 +320,7 @@
(u_int32_t)ulen))));
udp_packets_seen++;
- if (usum && usum != sum) {
+ if (!nocsum && usum && usum != sum) {
udp_packets_bad_checksum++;
if (udp_packets_seen > 4 &&
(udp_packets_seen / udp_packets_bad_checksum) < 2) {
diff -urN dhcp-3.0.5.xen/common/upf.c dhcp-3.0.5/common/upf.c
--- dhcp-3.0.5.xen/common/upf.c 2004-11-24 12:39:16.000000000 -0500
+++ dhcp-3.0.5/common/upf.c 2007-01-30 13:23:57.000000000 -0500
@@ -321,7 +321,7 @@
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix,
- from, length);
+ from, length, 0);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff -urN dhcp-3.0.5.xen/includes/dhcpd.h dhcp-3.0.5/includes/dhcpd.h
--- dhcp-3.0.5.xen/includes/dhcpd.h 2007-01-30 13:23:28.000000000 -0500
+++ dhcp-3.0.5/includes/dhcpd.h 2007-01-30 13:23:57.000000000 -0500
@@ -1948,7 +1948,7 @@
unsigned, struct hardware *));
ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
unsigned, struct sockaddr_in *,
- unsigned));
+ unsigned, int));
/* ethernet.c */
void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *,

View File

@ -8,7 +8,7 @@
Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent. Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent.
Name: dhcp Name: dhcp
Version: 3.0.5 Version: 3.0.5
Release: 9%{?dist} Release: 10%{?dist}
Epoch: 12 Epoch: 12
License: distributable License: distributable
Group: System Environment/Daemons Group: System Environment/Daemons
@ -33,6 +33,7 @@ Patch9: dhcp-3.0.5-minires.patch
Patch10: dhcp-3.0.5-server.patch Patch10: dhcp-3.0.5-server.patch
Patch11: dhcp-3.0.5-timeouts.patch Patch11: dhcp-3.0.5-timeouts.patch
Patch12: dhcp-3.0.5-fix-warnings.patch Patch12: dhcp-3.0.5-fix-warnings.patch
Patch13: dhcp-3.0.5-xen-checksum.patch
# adds libdhcp4client to the ISC code base # adds libdhcp4client to the ISC code base
Patch50: dhcp-3.0.5-libdhcp4client.patch Patch50: dhcp-3.0.5-libdhcp4client.patch
@ -141,6 +142,9 @@ client library .
# Fix up anything that fails -Wall -Werror # Fix up anything that fails -Wall -Werror
%patch12 -p1 -b .warnings %patch12 -p1 -b .warnings
# Fix Xen host networking problems (partial checksums)
%patch13 -p1 -b .xen
# Add the libdhcp4client target (library version of dhclient) # Add the libdhcp4client target (library version of dhclient)
%patch50 -p1 -b .libdhcp4client %patch50 -p1 -b .libdhcp4client
@ -344,6 +348,9 @@ exit 0
%{_libdir}/libdhcp4client.so %{_libdir}/libdhcp4client.so
%changelog %changelog
* Tue Jan 30 2007 David Cantrell <dcantrell@redhat.com> - 12:3.0.5-10
- Fix Xen networking problems with partial checksums (#221964)
* Mon Jan 29 2007 David Cantrell <dcantrell@redhat.com> - 12:3.0.5-9 * Mon Jan 29 2007 David Cantrell <dcantrell@redhat.com> - 12:3.0.5-9
- Remove dhcptables.pl from the source package - Remove dhcptables.pl from the source package
- Mark libres.a symbols hidden (#198496) - Mark libres.a symbols hidden (#198496)