diff mbox

Current wireless-testing breaks libpcap: mr_alen should be set

Message ID 1267578048.14049.11.camel@mj
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Pavel Roskin March 3, 2010, 1 a.m. UTC
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:


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.

Comments

John W. Linville March 3, 2010, 2:36 a.m. UTC | #1
On Tue, Mar 02, 2010 at 08:00:48PM -0500, Pavel Roskin wrote:

> 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...
Jiri Pirko March 3, 2010, 6:24 a.m. UTC | #2
Wed, Mar 03, 2010 at 02:00:48AM CET, proski@gnu.org 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:
>
>--- a/pcap-linux.c
>+++ b/pcap-linux.c
>@@ -1563,6 +1563,7 @@ live_open_new(pcap_t *handle, const char
> 			memset(&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.

Sorry about this. Corrected patch will follow.

Jirka
>
>-- 
>Regards,
>Pavel Roskin
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pavel Roskin March 3, 2010, 6:57 a.m. UTC | #3
Quoting Jiri Pirko <jpirko@redhat.com>:

> 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.
Frank W. Miller March 3, 2010, 3:31 p.m. UTC | #4
Would this be preventing pcap_inject() from working say in kernel 2.6.31
(stock FC12 kernel)?

Thanks,
FM


> -----Original Message-----
> From: tcpdump-workers-owner@lists.tcpdump.org [mailto:tcpdump-workers-
> owner@lists.tcpdump.org] On Behalf Of Pavel Roskin
> Sent: Tuesday, March 02, 2010 6:01 PM
> To: linux-wireless@vger.kernel.org; netdev@vger.kernel.org; tcpdump-
> workers@lists.tcpdump.org
> Cc: Jiri Pirko
> Subject: [tcpdump-workers] Current wireless-testing breaks libpcap:
> mr_alen should be set
> 
> 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:
> 
> --- a/pcap-linux.c
> +++ b/pcap-linux.c
> @@ -1563,6 +1563,7 @@ live_open_new(pcap_t *handle, const char
>  			memset(&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.
> 
> --
> Regards,
> Pavel Roskin
> -
> This is the tcpdump-workers list.
> Visit https://cod.sandelman.ca/ to unsubscribe.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Pirko March 3, 2010, 3:54 p.m. UTC | #5
Wed, Mar 03, 2010 at 04:31:07PM CET, frankwmiller@frankwmiller.net 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.

>
>Thanks,
>FM
>
>
>> -----Original Message-----
>> From: tcpdump-workers-owner@lists.tcpdump.org [mailto:tcpdump-workers-
>> owner@lists.tcpdump.org] On Behalf Of Pavel Roskin
>> Sent: Tuesday, March 02, 2010 6:01 PM
>> To: linux-wireless@vger.kernel.org; netdev@vger.kernel.org; tcpdump-
>> workers@lists.tcpdump.org
>> Cc: Jiri Pirko
>> Subject: [tcpdump-workers] Current wireless-testing breaks libpcap:
>> mr_alen should be set
>> 
>> 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:
>> 
>> --- a/pcap-linux.c
>> +++ b/pcap-linux.c
>> @@ -1563,6 +1563,7 @@ live_open_new(pcap_t *handle, const char
>>  			memset(&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.
>> 
>> --
>> Regards,
>> Pavel Roskin
>> -
>> This is the tcpdump-workers list.
>> Visit https://cod.sandelman.ca/ to unsubscribe.
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Guy Harris March 6, 2010, 9:23 p.m. UTC | #6
On Mar 2, 2010, at 5:00 PM, Pavel Roskin wrote:

> This patch to libpcap helps:
> 
> --- a/pcap-linux.c
> +++ b/pcap-linux.c
> @@ -1563,6 +1563,7 @@ live_open_new(pcap_t *handle, const char
> 			memset(&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?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Pirko March 8, 2010, 8:11 a.m. UTC | #7
Sat, Mar 06, 2010 at 10:23:12PM CET, guy@alum.mit.edu wrote:
>
>On Mar 2, 2010, at 5:00 PM, Pavel Roskin wrote:
>
>> This patch to libpcap helps:
>> 
>> --- a/pcap-linux.c
>> +++ b/pcap-linux.c
>> @@ -1563,6 +1563,7 @@ live_open_new(pcap_t *handle, const char
>> 			memset(&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?

This should be fixed in kernel (net-2.6
1162563f82b434e3099c9e6c1bbdba846d792f0d)

Jirka
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -1563,6 +1563,7 @@  live_open_new(pcap_t *handle, const char
 			memset(&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)
 			{