Package: dhcp3-common
Version: 3.1.0-5
Severity: important
Tags: patch
dhclient (applies to dhcpd as well) doesn't initialize the spkt_protocol
member of the sockaddr used for sending packets, which makes the kernel
initialize skb->protocol to an incorrect value (0) instead of ETH_P_IP.
This field is used by traffic classifiers, rules specifying
"protocol ip" won't match and dhcp queries (in my case) are dropped.
This patch (in case reportbug gives me an opportunity to attach it,
otherwise will follow in mail) properly initializes the sockaddr,
fixing the problem.
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.25-rc6 (SMP w/2 CPU cores; PREEMPT)
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash
--- a/common/lpf.c 2007-05-24 01:30:32.000000000 +0200
+++ b/common/lpf.c 2008-04-02 17:25:35.000000000 +0200
@@ -39,6 +39,7 @@ static char copyright[] =
#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"
@@ -293,7 +294,7 @@ ssize_t send_packet (interface, packet,
double hh [16];
double ih [1536 / sizeof (double)];
unsigned char *buf = (unsigned char *)ih;
- struct sockaddr sa;
+ struct sockaddr_pkt sa;
int result;
int fudge;
@@ -314,12 +315,14 @@ ssize_t send_packet (interface, packet,
/* 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);
+ sa.spkt_family = AF_PACKET;
+ strncpy (sa.spkt_device,
+ (const char *)interface -> ifp, sizeof sa.spkt_device);
+ sa.spkt_protocol = htons(ETH_P_IP);
result = sendto (interface -> wfdesc,
- buf + fudge, ibufp + len - fudge, 0, &sa, sizeof sa);
+ buf + fudge, ibufp + len - fudge, 0,
+ (struct sockaddr *)&sa, sizeof sa);
if (result < 0)
log_error ("send_packet: %m");
return result;