#474000 dhcp3-common: dhcp should set the protocol when sending packets using AF_PACKET

Package:
src:isc-dhcp
Source:
isc-dhcp
Submitter:
Patrick McHardy
Date:
2026-08-05 17:33:31 UTC
Severity:
important
Tags:
#474000#5
Date:
2008-04-02 15:35:09 UTC
From:
To:
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.

#474000#8
Date:
2008-06-14 22:57:45 UTC
From:
To:
Hello,

This bug was received by a Debian user, and includes a patch for the
problem reported. You might like to consider including it in a future
point release of 3.1

Please maintain the Cc on any correspondence to keep our BTS in the
loop.

regards

Andrew
----- Forwarded message from Patrick McHardy <kaber@trash.net> ----- Subject: Bug#474000: dhcp3-common: dhcp should set the protocol when sending packets using AF_PACKET Reply-To: Patrick McHardy <kaber@trash.net>, 474000@bugs.debian.org Resent-From: Patrick McHardy <kaber@trash.net> Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: Andrew Pollock <apollock@debian.org> Resent-Date: Wed, 02 Apr 2008 15:36:02 +0000 Resent-Message-ID: <handler.474000.B.12071505139492@bugs.debian.org> Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 474000 X-Debian-PR-Package: dhcp3-common X-Debian-PR-Keywords: patch X-Debian-PR-Source: dhcp3 X-Spam-Checker-Version: SpamAssassin 3.1.4-bugs.debian.org_2005_01_02 (2006-07-26) on rietz.debian.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=4.0 tests=BAYES_00,FORGED_RCVD_HELO, FOURLA,HAS_PACKAGE,IMPRONONCABLE_1,MURPHY_DRUGS_REL8, MURPHY_WRONG_WORD2 autolearn=no version=3.1.4-bugs.debian.org_2005_01_02 From: Patrick McHardy <kaber@trash.net> To: Debian Bug Tracking System <submit@bugs.debian.org> 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.
--- 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;
----- End forwarded message -----
#474000#13
Date:
2008-06-14 23:01:21 UTC
From:
To:
----- Forwarded message from DHCP Bugs via RT <dhcp-bugs@isc.org> -----

From: DHCP Bugs via RT <dhcp-bugs@isc.org>
To: apollock@debian.org
Subject: [ISC-Bugs #18176] AutoReply: [kaber@trash.net: Bug#474000: dhcp3-common: dhcp should set the protocol when sending packets using AF_PACKET]
Date: Sat, 14 Jun 2008 22:57:55 +0000


Greetings,

This message has been automatically generated in response to the
creation of a trouble ticket regarding:
	"[kaber@trash.net: Bug#474000: dhcp3-common: dhcp should set the protocol when sending packets using AF_PACKET]",
a summary of which appears below.

There is no need to reply to this message right now.  Your ticket has been
assigned an ID of [ISC-Bugs #18176].

Please include the string:

         [ISC-Bugs #18176]

in the subject line of all future correspondence about this issue. To do so,
you may reply to this message.

                        Thank you,
                        dhcp-bugs@isc.org
------------------------------------------------------------------------- Hello, This bug was received by a Debian user, and includes a patch for the problem reported. You might like to consider including it in a future point release of 3.1 Please maintain the Cc on any correspondence to keep our BTS in the loop. regards Andrew
----- Forwarded message from Patrick McHardy <kaber@trash.net> ----- Subject: Bug#474000: dhcp3-common: dhcp should set the protocol when sending packets using AF_PACKET Reply-To: Patrick McHardy <kaber@trash.net>, 474000@bugs.debian.org Resent-From: Patrick McHardy <kaber@trash.net> Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: Andrew Pollock <apollock@debian.org> Resent-Date: Wed, 02 Apr 2008 15:36:02 +0000 Resent-Message-ID: <handler.474000.B.12071505139492@bugs.debian.org> Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 474000 X-Debian-PR-Package: dhcp3-common X-Debian-PR-Keywords: patch X-Debian-PR-Source: dhcp3 X-Spam-Checker-Version: SpamAssassin 3.1.4-bugs.debian.org_2005_01_02 (2006-07-26) on rietz.debian.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=4.0 tests=BAYES_00,FORGED_RCVD_HELO, FOURLA,HAS_PACKAGE,IMPRONONCABLE_1,MURPHY_DRUGS_REL8, MURPHY_WRONG_WORD2 autolearn=no version=3.1.4-bugs.debian.org_2005_01_02 From: Patrick McHardy <kaber@trash.net> To: Debian Bug Tracking System <submit@bugs.debian.org> 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.
--- 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;
----- End forwarded message -----
----- End forwarded message -----
#474000#24
Date:
2026-08-05 17:31:09 UTC
From:
To:
Dear submitter,

as the package isc-dhcp has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/1143544

The version of this package that was in Debian prior to this removal
can still be found using https://snapshot.debian.org/.

Please note that the changes have been done on the master archive and
will not propagate to any mirrors until the next dinstall run at the
earliest.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmaster@ftp-master.debian.org.

Debian distribution maintenance software
pp.
Thorsten Alteholz (the ftpmaster behind the curtain)