[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87sj7iesdl.fsf@xmission.com>
Date: Thu, 06 Dec 2012 14:19:02 -0800
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Ani Sinha <ani@...stanetworks.com>
Cc: Michael Richardson <mcr@...delman.ca>,
tcpdump-workers@...ts.tcpdump.org, netdev@...r.kernel.org,
Francesco Ruggeri <fruggeri@...stanetworks.com>
Subject: Re: [tcpdump-workers] vlan tagged packets and libpcap breakage
Ani Sinha <ani@...stanetworks.com> writes:
> On Sat, Nov 17, 2012 at 3:33 PM, Eric W. Biederman
> <ebiederm@...ssion.com> wrote:
>> the vlan header in packets as we receive them.
>>
>> The code is correct except for the case of packets in vlan 0. Currently
>> the packet reconstruction is ambiguous. The most recent kernels have
>> a TP_STATUS_VLAN_VALID flag that can be checked to see if the packet was
>> in vlan 0 or if there was no vlan at all. libpcap probably should be
>> taught how to handle TP_STATUS_VLAN_VALID so that it can get the vlan 0
>> handling correct.
>>
>
> May be this?
Two things.
- TP_STATUS_VLAN_VALID lives in the tp_status field not the tp_vlan_tci field.
- To work on older kernels with binaries compiled with newer headers you
first want to test for tp_vlan_tci == 0 and then look at the status field for
TP_STATUS_VALID.
Which means the tests need to look something like:
- if (aux->tp_vlan_tci == 0)
+#if defined(TP_STATUS_VLAN_VALID)
+ if ((aux->tp_vlan_tci == 0) && !(aux->tp_status & TP_STATUS_VLAN_VALID))
+#else
+ if (aux->tp_vlan_tci == 0) /* this is ambigious but without the
+
TP_STATUS_VLAN_VALID flag, there is
+ nothing that we can do */
+#endif
#ifdef HAVE_TPACKET2
- if (handle->md.tp_version == TPACKET_V2 && h.h2->tp_vlan_tci &&
+ if (handle->md.tp_version == TPACKET_V2 &&
+#if defined(TP_STATUS_VLAN_VALID)
+ (h.h2->tp_vlan_tci || (h.h2->tp_status & TP_STATUS_VALID)) &&
+#else
+ h.h2->tp_vlan_tci &&
+#endif
Eric
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists