Current wireless-testing breaks libpcap: mr_alen should be set
Subsystems (3)
Hello!
The current wireless-testing appears to have some non-wireless bits from the upcoming Linux 2.6.34. As a result, libpcap and all capture programs that use it are broken.
This patch to libpcap helps:
pcap-linux.c +1 -0
@@ -1563,6 +1563,7 @@ live_open_new(pcap_t *handle, const charmemset (&mr,0 ,sizeof (mr)); mr.mr_ifindex = handle->md.ifindex; mr.mr_type =PACKET_MR_PROMISC ; + mr.mr_alen =6 ;if (setsockopt (sock_fd,SOL_PACKET ,PACKET_ADD_MEMBERSHIP , &mr,sizeof (mr)) ==-1 ) {
libpcap git doesn't have the fix yet.
The breakage must be coming from the commit 914c8ad2 by Jiri Pirko to net/packet/af_packet.c
I think it's very unhelpful to introduce patches that break significant userspace functionality without giving the affected programs an advance warning.
Also, pulling bleeding edge stuff into wireless-testing before rc1 appears to be either a mistake or a bad decision.
Sorry for cross-post, but it's an urgent issue. Repliers are encouraged to trim the recipient list as necessary.
Signature · 2 lines
Regards, Pavel Roskin
Quoted 2 lines · Pavel Roskin
Also, pulling bleeding edge stuff into wireless-testing before rc1 appears to be either a mistake or a bad decision.
Feel free to use an earlier commit...
Signature · 6 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 28 lines · Wed, Mar 03, 2010 at 02:00:48AM CET, proski-mXXj517/[email protected] wrote:
Hello!
The current wireless-testing appears to have some non-wireless bits from the upcoming Linux 2.6.34. As a result, libpcap and all capture programs that use it are broken.
This patch to libpcap helps:
pcap-linux.c +1
-0@@ -1563,6 +1563,7 @@ live_open_new(pcap_t *handle, const charmemset (&mr,0 ,sizeof (mr)); mr.mr_ifindex = handle->md.ifindex; mr.mr_type =PACKET_MR_PROMISC ; + mr.mr_alen =6 ;if (setsockopt (sock_fd,SOL_PACKET ,PACKET_ADD_MEMBERSHIP , &mr,sizeof (mr)) ==-1 ) {libpcap git doesn't have the fix yet.
The breakage must be coming from the commit
914c8ad2by Jiri Pirko tonet/packet/af_packet.cI think it's very unhelpful to introduce patches that break significant userspace functionality without giving the affected programs an advance warning.
Quoted 5 lines
Also, pulling bleeding edge stuff into wireless-testing before rc1 appears to be either a mistake or a bad decision.
Sorry for cross-post, but it's an urgent issue. Repliers are encouraged to trim the recipient list as necessary.
Sorry about this. Corrected patch will follow.
Jirka
Quoted 4 lines
Signature · 3 lines
-- Regards, Pavel Roskin
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoting Jiri Pirko <[email protected]>:
Quoted 1 line
Sorry about this. Corrected patch will follow.
I guess the address length should not be checked if the address is not supplied, as in this case.
Signature · 2 lines
Regards, Pavel Roskin
PATCH 1/1 af_packet: move strict addr_len check right before dev_[mc/unicast]_[add/del]
In reply to Pavel RoskinSubject: [net-2.6 PATCH] af_packet: move strict addr_len check right before dev_[mc/unicast]_[add/del]
My previous patch 914c8ad2d18b62ad1420f518c0cab0b0b90ab308 incorrectly changed the length check in packet_mc_add to be more strict. The problem is that userspace is not filling this field (and it stays zeroed) in case of setting PACKET_MR_PROMISC or PACKET_MR_ALLMULTI. So move the strict check to the point in path where the addr_len must be set correctly.
net/packet/af_packet.c +5 -1
@@ -1688,6 +1688,8 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i, {switch (i->type) {case PACKET_MR_MULTICAST : +if (i->alen != dev->addr_len) +return -EINVAL ;if (what >0 )return dev_mc_add (dev, i->addr, i->alen,0 );else
@@ -1700,6 +1702,8 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i,return dev_set_allmulti (dev, what);break ;case PACKET_MR_UNICAST : +if (i->alen != dev->addr_len) +return -EINVAL ;if (what >0 )return dev_unicast_add (dev, i->addr);else
@@ -1734,7 +1738,7 @@ static int packet_mc_add(struct sock *sk, struct packet_mreq_max *mreq) goto done; err = -EINVAL ; -if (mreq->mr_alen != dev->addr_len) +if (mreq->mr_alen > dev->addr_len) goto done; err = -ENOBUFS ;
A message that is not in the archive (sent off-list or not yet received): 20100303064001.GB2648-YzwxZg+R7et1/[email protected]
Re: [net-2.6 PATCH] af_packet: move strict addr_len check right before dev_[mc/unicast]_[add/del]
Quoted 10 lines · Jiri Pirko
Subject: [net-2.6 PATCH]
af_packet: move strictaddr_lencheck right before dev_[mc/unicast]_[add/del]My previous patch
914c8ad2d18b62ad1420f518c0cab0b0b90ab308incorrectly changed the length check inpacket_mc_addto be more strict. The problem is that userspace is not filling this field (and it stays zeroed) in case of settingPACKET_MR_PROMISCorPACKET_MR_ALLMULTI. So move the strict check to the point in path where theaddr_lenmust be set correctly.Signed-off-by Jiri Pirko <[email protected]>
I am not sure it solves Pavel Roskin concern, but some credit should be given to him :)
Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [net-2.6 PATCH] af_packet: move strict addr_len check right before dev_[mc/unicast]_[add/del]
In reply to a message not in the archiveQuoted 1 line · Wed, Mar 03, 2010 at 07:40:01AM CET, [email protected]…
Subject: [net-2.6 PATCH]
af_packet: move strictaddr_lencheck right before dev_[mc/unicast]_[add/del]
Dave please apply this against net-next-2.6. I see that 914c8ad2d18b is still not in net-2.6.
Thanks a lot
Jirka
Quoted 32 lines
My previous patch
914c8ad2d18b62ad1420f518c0cab0b0b90ab308incorrectly changed the length check inpacket_mc_addto be more strict. The problem is that userspace is not filling this field (and it stays zeroed) in case of settingPACKET_MR_PROMISCorPACKET_MR_ALLMULTI. So move the strict check to the point in path where theaddr_lenmust be set correctly.Signed-off-by Jiri Pirko <[email protected]>net/packet/af_packet.c +4
-0@@ -1688,6 +1688,8 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i, {switch (i->type) {case PACKET_MR_MULTICAST : +if (i->alen != dev->addr_len) +return -EINVAL ;if (what >0 )return dev_mc_add (dev, i->addr, i->alen,0 );else @@ -1700,6 +1702,8 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i,return dev_set_allmulti (dev, what);break ;case PACKET_MR_UNICAST : +if (i->alen != dev->addr_len) +return -EINVAL ;if (what >0 )return dev_unicast_add (dev, i->addr);else
net/packet/af_packet.c static int packet_mc_add(struct sock *sk, struct packet_mreq_max *mreq) · line 1744
Quoted 8 lines
net/packet/af_packet.c +1
-1@@ -1734,7 +1738,7 @@ static int packet_mc_add(struct sock *sk, struct packet_mreq_max *mreq) goto done; err = -EINVAL ; -if (mreq->mr_alen != dev->addr_len) +if (mreq->mr_alen > dev->addr_len) goto done; err = -ENOBUFS ;
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20100303090512.GB2961-YzwxZg+R7evMbnheQZGK0N5OCZ2W11yPFxja6HXR22MAvxtiuMwx3w@public.gmane.org
Re: [net-2.6 PATCH] af_packet: move strict addr_len check right before dev_[mc/unicast]_[add/del]
From: Jiri Pirko <[email protected]>
Date: Wed, 3 Mar 2010 10:05:13 +0100
Quoted 5 lines
Quoted 1 line · Wed, Mar 03, 2010 at 07:40:01AM CET, [email protected] wrote:
Subject: [net-2.6 PATCH]
af_packet: move strictaddr_lencheck right before dev_[mc/unicast]_[add/del]Dave please apply this against net-next-2.6. I see that
914c8ad2d18bis still not in net-2.6.
Would you relax?
I just rebased net-2.6 and net-next-2.6 after Linus took in my changes and I just applied your regression fix to my tree and was about to let you know I applied it.
David Miller
AppliedRe: [net-2.6 PATCH] af_packet: move strict addr_len check right before dev_[mc/unicast]_[add/del]
In reply to a message not in the archiveFrom: Jiri Pirko <[email protected]>
Date: Wed, 3 Mar 2010 07:40:01 +0100
Quoted 9 lines
Subject: [net-2.6 PATCH]
af_packet: move strictaddr_lencheck right before dev_[mc/unicast]_[add/del]My previous patch
914c8ad2d18b62ad1420f518c0cab0b0b90ab308incorrectly changed the length check inpacket_mc_addto be more strict. The problem is that userspace is not filling this field (and it stays zeroed) in case of settingPACKET_MR_PROMISCorPACKET_MR_ALLMULTI. So move the strict check to the point in path where theaddr_lenmust be set correctly.Signed-off-by Jiri Pirko <[email protected]>
Applied.
Re: [net-2.6 PATCH] af_packet: move strict addr_len check right before dev_[mc/unicast]_[add/del]
In reply to Jiri PirkoQuoting Jiri Pirko <[email protected]>:
Quoted 10 lines
net/packet/af_packet.c +1
-1@@ -1734,7 +1738,7 @@ static int packet_mc_add(struct sock *sk, struct packet_mreq_max *mreq) goto done; err = -EINVAL ; -if (mreq->mr_alen != dev->addr_len) +if (mreq->mr_alen > dev->addr_len) goto done;err =
-ENOBUFS;
The patch looks good, but did you mean to include this change? It's not described.
Signature · 2 lines
Regards, Pavel Roskin
Re: [net-2.6 PATCH] af_packet: move strict addr_len check right before dev_[mc/unicast]_[add/del]
Quoted 11 lines · Wed, Mar 03, 2010 at 08:01:10AM CET, [email protected] wrote:
Quoting Jiri Pirko <[email protected]>:
Quoted 9 lines
net/packet/af_packet.c +1
-1@@ -1734,7 +1738,7 @@ static int packet_mc_add(struct sock *sk, struct packet_mreq_max *mreq) goto done; err = -EINVAL ; -if (mreq->mr_alen != dev->addr_len) +if (mreq->mr_alen > dev->addr_len) goto done;
Quoted 4 lines
Quoted 1 line
err = -ENOBUFS;The patch looks good, but did you mean to include this change? It's not described.
Sure - this is revert of the bit from my original patch. I think it's clear from description.
Jirka
Quoted 4 lines
Signature · 3 lines
-- Regards, Pavel Roskin
Would this be preventing pcap_inject() from working say in kernel 2.6.31 (stock FC12 kernel)?
Thanks,
FM
Quoted 21 lines
-----Original Message-----
From: [email protected] [mailto:tcpdump-workers- [email protected]] On Behalf Of Pavel Roskin
Sent: Tuesday, March 02, 2010 6:01 PM
To: [email protected]; [email protected]; tcpdump- [email protected]
Cc: Jiri Pirko
Subject: [tcpdump-workers] Current wireless-testing breaks libpcap:mr_alenshould be setHello!
The current wireless-testing appears to have some non-wireless bits from the upcoming Linux 2.6.34. As a result, libpcap and all capture programs that use it are broken.
This patch to libpcap helps:
pcap-linux.c live_open_new(pcap_t *handle, const char · line 1568
Quoted 6 lines
pcap-linux.c +1
-0@@ -1563,6 +1563,7 @@ live_open_new(pcap_t *handle, const charmemset (&mr,0 ,sizeof (mr)); mr.mr_ifindex = handle->md.ifindex; mr.mr_type =PACKET_MR_PROMISC ; + mr.mr_alen =6 ; if (setsockopt(sock_fd, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mr, sizeof(mr)) ==
-1)
Quoted 23 lines
pcap-linux.c +0
-0{libpcap git doesn't have the fix yet.
The breakage must be coming from the commit
914c8ad2by Jiri Pirko tonet/packet/af_packet.cI think it's very unhelpful to introduce patches that break significant userspace functionality without giving the affected programs an advance warning.
Also, pulling bleeding edge stuff into wireless-testing before rc1 appears to be either a mistake or a bad decision.
Sorry for cross-post, but it's an urgent issue. Repliers are encouraged to trim the recipient list as necessary.
--
Regards,
Pavel Roskin
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.
Quoted 3 lines · Wed, Mar 03, 2010 at 04:31:07PM CET, [email protected] wrote:
Would this be preventing
pcap_inject()from working say in kernel 2.6.31 (stock FC12 kernel)?
Nope. The patch went in just recently.
Quoted 57 lines
Thanks,
FMQuoted 21 lines
-----Original Message-----
From: [email protected] [mailto:tcpdump-workers- [email protected]] On Behalf Of Pavel Roskin
Sent: Tuesday, March 02, 2010 6:01 PM
To: [email protected]; [email protected]; tcpdump- [email protected]
Cc: Jiri Pirko
Subject: [tcpdump-workers] Current wireless-testing breaks libpcap:mr_alenshould be setHello!
The current wireless-testing appears to have some non-wireless bits from the upcoming Linux 2.6.34. As a result, libpcap and all capture programs that use it are broken.
This patch to libpcap helps:
pcap-linux.c live_open_new(pcap_t *handle, const char · line 1568
Quoted 6 lines
pcap-linux.c +1
-0@@ -1563,6 +1563,7 @@ live_open_new(pcap_t *handle, const charmemset (&mr,0 ,sizeof (mr)); mr.mr_ifindex = handle->md.ifindex; mr.mr_type =PACKET_MR_PROMISC ; + mr.mr_alen =6 ; if (setsockopt(sock_fd, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mr, sizeof(mr)) ==-1)
Quoted 23 lines
pcap-linux.c +0
-0{libpcap git doesn't have the fix yet.
The breakage must be coming from the commit
914c8ad2by Jiri Pirko tonet/packet/af_packet.cI think it's very unhelpful to introduce patches that break significant userspace functionality without giving the affected programs an advance warning.
Also, pulling bleeding edge stuff into wireless-testing before rc1 appears to be either a mistake or a bad decision.
Sorry for cross-post, but it's an urgent issue. Repliers are encouraged to trim the recipient list as necessary.
--
Regards,
Pavel Roskin
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.
pcap-linux.c live_open_new(pcap_t *handle, const char · line 1566
Quoted 9 lines · Pavel Roskin
This patch to libpcap helps:
pcap-linux.c +1
-0@@ -1563,6 +1563,7 @@ live_open_new(pcap_t *handle, const charmemset (&mr,0 ,sizeof (mr)); mr.mr_ifindex = handle->md.ifindex; mr.mr_type =PACKET_MR_PROMISC ; + mr.mr_alen =6 ;
If there are any network types that support promiscuous mode and have link-layer addresses that aren't 6 octets long, that would still fail.
It sounds as if the fix is not to care about the address length if the address isn't used, so you don't need to get the length right for PACKET_MR_PROMISC or PACKET_MR_ALLMULTI, so libpcap, and other clients setting promiscuous or "show me all multicast packets" mode, don't need to change. Is that the case?
Quoted 15 lines · Sat, Mar 06, 2010 at 10:23:12PM CET, [email protected] wrote:
pcap-linux.c live_open_new(pcap_t *handle, const char · line 1566
Quoted 9 lines · Pavel Roskin
This patch to libpcap helps:
pcap-linux.c +1
-0@@ -1563,6 +1563,7 @@ live_open_new(pcap_t *handle, const charmemset (&mr,0 ,sizeof (mr)); mr.mr_ifindex = handle->md.ifindex; mr.mr_type =PACKET_MR_PROMISC ; + mr.mr_alen =6 ;If there are any network types that support promiscuous mode and have link-layer addresses that aren't 6 octets long, that would still fail.
Quoted 1 line
It sounds as if the fix is not to care about the address length if the address isn't used, so you don't need to get the length right for
PACKET_MR_PROMISCorPACKET_MR_ALLMULTI, so libpcap, and other clients setting promiscuous or "show me all multicast packets" mode, don't need to change. Is that the case?
This should be fixed in kernel (net-2.61162563f82b434e3099c9e6c1bbdba846d792f0d)
Jirka