Re: Linux, tcpdump and vlan

2007-07-21 Thread Krzysztof Halasa
Ben Greear <[EMAIL PROTECTED]> writes: >> IOW: I think all Ethernet interfaces should always be VLAN-aware, >> stripping the tag (only one) early on RX and adding it late on TX. >> That means tcpdump would see packets with exactly one tag removed >> (unless there was no tag), in both RX and TX.

Re: Linux, tcpdump and vlan

2007-07-21 Thread Ben Greear
Krzysztof Halasa wrote: Ben Greear <[EMAIL PROTECTED]> writes: There is already a flag you can set on vlan devices (reorder-header) that strips the VLAN tag before presenting it to user-space. Sure, but isn't it only valid for VLAN device (not the main ethX)? I.e., can you have the

Re: Linux, tcpdump and vlan

2007-07-21 Thread Krzysztof Halasa
Ben Greear <[EMAIL PROTECTED]> writes: > There is already a flag you can set on vlan devices (reorder-header) > that strips the VLAN tag before presenting it to user-space. Sure, but isn't it only valid for VLAN device (not the main ethX)? I.e., can you have the tag stripped from frames captured

Re: Linux, tcpdump and vlan

2007-07-21 Thread Krzysztof Halasa
Ben Greear [EMAIL PROTECTED] writes: There is already a flag you can set on vlan devices (reorder-header) that strips the VLAN tag before presenting it to user-space. Sure, but isn't it only valid for VLAN device (not the main ethX)? I.e., can you have the tag stripped from frames captured on

Re: Linux, tcpdump and vlan

2007-07-21 Thread Ben Greear
Krzysztof Halasa wrote: Ben Greear [EMAIL PROTECTED] writes: There is already a flag you can set on vlan devices (reorder-header) that strips the VLAN tag before presenting it to user-space. Sure, but isn't it only valid for VLAN device (not the main ethX)? I.e., can you have the tag

Re: Linux, tcpdump and vlan

2007-07-21 Thread Krzysztof Halasa
Ben Greear [EMAIL PROTECTED] writes: IOW: I think all Ethernet interfaces should always be VLAN-aware, stripping the tag (only one) early on RX and adding it late on TX. That means tcpdump would see packets with exactly one tag removed (unless there was no tag), in both RX and TX. Tcpdump

Re: Linux, tcpdump and vlan

2007-07-20 Thread Ben Greear
Krzysztof Halasa wrote: Another idea - perhaps we could make the software VLANs behave the same as hw ones? I.e., stripping the tag on RX while setting some magic skb field? The packets could go via main interface first (normal path, with eth_type_trans stripping the tag and setting protocol =

Re: Linux, tcpdump and vlan

2007-07-20 Thread Krzysztof Halasa
Ben Greear <[EMAIL PROTECTED]> writes: >> The net result is that dev_queue_xmit_nit() is called twice, once >> for dev=eth0.2 then for dev=eth0. > > Maybe binding to all isn't such a good idea then. Anyway I would expect the frame on eth0.2 and then on eth0 as well. Anything different is crazy.

Re: Linux, tcpdump and vlan

2007-07-20 Thread Krzysztof Halasa
Another idea - perhaps we could make the software VLANs behave the same as hw ones? I.e., stripping the tag on RX while setting some magic skb field? The packets could go via main interface first (normal path, with eth_type_trans stripping the tag and setting protocol = some 802.1Q), netif_rx |

Re: Linux, tcpdump and vlan

2007-07-20 Thread Florian Lohoff
On Wed, Jul 18, 2007 at 12:34:33PM -0700, andrei radulescu-banu wrote: > > Dear kernel networking gurus, > > I am trying to understand why tcpdump does not work properly for vlan packets > on linux. Here is the existing behavior, observed with: > - kernel 2.6.16, > - e1000 driver > -

Re: Linux, tcpdump and vlan

2007-07-20 Thread Florian Lohoff
On Wed, Jul 18, 2007 at 12:34:33PM -0700, andrei radulescu-banu wrote: Dear kernel networking gurus, I am trying to understand why tcpdump does not work properly for vlan packets on linux. Here is the existing behavior, observed with: - kernel 2.6.16, - e1000 driver - libpcap

Re: Linux, tcpdump and vlan

2007-07-20 Thread Krzysztof Halasa
Another idea - perhaps we could make the software VLANs behave the same as hw ones? I.e., stripping the tag on RX while setting some magic skb field? The packets could go via main interface first (normal path, with eth_type_trans stripping the tag and setting protocol = some 802.1Q), netif_rx |

Re: Linux, tcpdump and vlan

2007-07-20 Thread Krzysztof Halasa
Ben Greear [EMAIL PROTECTED] writes: The net result is that dev_queue_xmit_nit() is called twice, once for dev=eth0.2 then for dev=eth0. Maybe binding to all isn't such a good idea then. Anyway I would expect the frame on eth0.2 and then on eth0 as well. Anything different is crazy. --

Re: Linux, tcpdump and vlan

2007-07-20 Thread Ben Greear
Krzysztof Halasa wrote: Another idea - perhaps we could make the software VLANs behave the same as hw ones? I.e., stripping the tag on RX while setting some magic skb field? The packets could go via main interface first (normal path, with eth_type_trans stripping the tag and setting protocol =

Re: Linux, tcpdump and vlan

2007-07-19 Thread Ben Greear
andrei radulescu-banu wrote: During debugging, I noticed that dev_queue_xmit() is called twice for tx vlan frames. This results in a frame being passed twice to a packet socket bound to 'any' interface. If the packet socket is bound to a specific interface, though, it will get only one copy

Re: Linux, tcpdump and vlan

2007-07-19 Thread andrei radulescu-banu
During debugging, I noticed that dev_queue_xmit() is called twice for tx vlan frames. This results in a frame being passed twice to a packet socket bound to 'any' interface. If the packet socket is bound to a specific interface, though, it will get only one copy of the tx frame, which is good.

Re: Linux, tcpdump and vlan

2007-07-19 Thread Stephen Hemminger
On Thu, 19 Jul 2007 11:20:43 -0700 (PDT) andrei radulescu-banu <[EMAIL PROTECTED]> wrote: > > [Ben] If tcpdump and/or bridging needs to disable the hw-accel, then it can > explicitly do so by some API. That is better than overloading > the promisc flag in my opinion. > > I guess I could be

Re: Linux, tcpdump and vlan

2007-07-19 Thread andrei radulescu-banu
> [Ben] If tcpdump and/or bridging needs to disable the hw-accel, then it can explicitly do so by some API. That is better than overloading the promisc flag in my opinion. I guess I could be persuaded in the end. But let me still play devil advocate. The semantics of 'promiscuous', in my

Re: Linux, tcpdump and vlan

2007-07-19 Thread andrei radulescu-banu
>> [Andrei] VLAN_TX_SKB_CB() is perfect for that. > [Patrick, Stephen] No its not. Its only legal to use while something has > ownership of the skb. Between VLAN devices and real devices qdiscs are free to use it. All right, using VLAN_TX_SKB_CB() is a bad idea. In that case, we need to amend

Re: Linux, tcpdump and vlan

2007-07-19 Thread Ben Greear
andrei radulescu-banu wrote: [Ben] I think a better method would be to allow disabling VLAN HW accel for a NIC with ethtool. This requires changes to ethtool and e1000 driver, +other drivers. It is a handy thing to have. I don't view it as a solution to tcpdump - or to the vlan

Re: Linux, tcpdump and vlan

2007-07-19 Thread Patrick McHardy
andrei radulescu-banu wrote: > The consensus seems to be that skb's need to carry vlan accelerated tags in > their cb's, on rx as well as tx. VLAN_TX_SKB_CB() is perfect for that. No its not. Its only legal to use while something has ownership of the skb. Between VLAN devices and real devices

Re: Linux, tcpdump and vlan

2007-07-19 Thread Stephen Hemminger
On Thu, 19 Jul 2007 08:47:01 -0700 (PDT) andrei radulescu-banu <[EMAIL PROTECTED]> wrote: > The consensus seems to be that skb's need to carry vlan accelerated tags in > their cb's, on rx as well as tx. VLAN_TX_SKB_CB() is perfect for that. > > > [Patrick] On the TX path, it could simply use

Re: Linux, tcpdump and vlan

2007-07-19 Thread andrei radulescu-banu
One additional thought: with the proposed changes in my prev message, the driver can be set to hw vlan accelerated mode, even if no vlan interfaces are configured. We would not have to switch hw vlan accelerated mode anymore, when vlan interfaces are created or destroyed.

Re: Linux, tcpdump and vlan

2007-07-19 Thread andrei radulescu-banu
The consensus seems to be that skb's need to carry vlan accelerated tags in their cb's, on rx as well as tx. VLAN_TX_SKB_CB() is perfect for that. > [Patrick] On the TX path, it could simply use the CB, but this is actually also wrong (for both macvlan and real devices) since qdiscs have

Re: Linux, tcpdump and vlan

2007-07-19 Thread Krzysztof Halasa
Stephen Hemminger <[EMAIL PROTECTED]> writes: > Not at runtime, acceleration is always on if you compile kernel with vlan > support. That is a design mistake as far as I can tell. I think so. >> However seeing unknown tags on master device (with tcpdump etc) >> would certainly be useful. > >

Re: Linux, tcpdump and vlan

2007-07-19 Thread Stephen Hemminger
On Thu, 19 Jul 2007 16:23:48 +0200 Krzysztof Halasa <[EMAIL PROTECTED]> wrote: > Stephen Hemminger <[EMAIL PROTECTED]> writes: > > > 1) non-accelerated device > > * all frames show in promiscious mode > > * tag is part of the frame that shows up > >in tcpdump, and then gets

Re: Linux, tcpdump and vlan

2007-07-19 Thread Stephen Hemminger
On Thu, 19 Jul 2007 16:23:48 +0200 Krzysztof Halasa <[EMAIL PROTECTED]> wrote: > Stephen Hemminger <[EMAIL PROTECTED]> writes: > > > 1) non-accelerated device > > * all frames show in promiscious mode > > * tag is part of the frame that shows up > >in tcpdump, and then gets

Re: Linux, tcpdump and vlan

2007-07-19 Thread Krzysztof Halasa
Stephen Hemminger <[EMAIL PROTECTED]> writes: > 1) non-accelerated device > * all frames show in promiscious mode > * tag is part of the frame that shows up >in tcpdump, and then gets stripped by the 8021q module. Sure. It's IMHO good and working, modulo the tag being removed on

Re: Linux, tcpdump and vlan

2007-07-19 Thread Patrick McHardy
Stephen Hemminger wrote: > On Thu, 19 Jul 2007 15:28:46 +0200 > Krzysztof Halasa <[EMAIL PROTECTED]> wrote: > >>>Your suggestion of disabling VLAN acceleration in promiscous >>>mode sounds like a reasonable solution until then .. >> >>From a user perspective: >> >>I'm not sure promiscous mode is

Re: Linux, tcpdump and vlan

2007-07-19 Thread Stephen Hemminger
On Thu, 19 Jul 2007 15:28:46 +0200 Krzysztof Halasa <[EMAIL PROTECTED]> wrote: > Patrick McHardy <[EMAIL PROTECTED]> writes: > > > Your suggestion of disabling VLAN acceleration in promiscous > > mode sounds like a reasonable solution until then .. > > From a user perspective: > > I'm not sure

Re: Linux, tcpdump and vlan

2007-07-19 Thread Krzysztof Halasa
Patrick McHardy <[EMAIL PROTECTED]> writes: > Your suggestion of disabling VLAN acceleration in promiscous > mode sounds like a reasonable solution until then .. >From a user perspective: I'm not sure promiscous mode is related to the problem. Tcpdump without promiscous mode makes perfect

Re: Linux, tcpdump and vlan

2007-07-19 Thread Krzysztof Halasa
Patrick McHardy [EMAIL PROTECTED] writes: Your suggestion of disabling VLAN acceleration in promiscous mode sounds like a reasonable solution until then .. From a user perspective: I'm not sure promiscous mode is related to the problem. Tcpdump without promiscous mode makes perfect sense. I

Re: Linux, tcpdump and vlan

2007-07-19 Thread Stephen Hemminger
On Thu, 19 Jul 2007 15:28:46 +0200 Krzysztof Halasa [EMAIL PROTECTED] wrote: Patrick McHardy [EMAIL PROTECTED] writes: Your suggestion of disabling VLAN acceleration in promiscous mode sounds like a reasonable solution until then .. From a user perspective: I'm not sure promiscous

Re: Linux, tcpdump and vlan

2007-07-19 Thread Patrick McHardy
Stephen Hemminger wrote: On Thu, 19 Jul 2007 15:28:46 +0200 Krzysztof Halasa [EMAIL PROTECTED] wrote: Your suggestion of disabling VLAN acceleration in promiscous mode sounds like a reasonable solution until then .. From a user perspective: I'm not sure promiscous mode is related to the

Re: Linux, tcpdump and vlan

2007-07-19 Thread Krzysztof Halasa
Stephen Hemminger [EMAIL PROTECTED] writes: 1) non-accelerated device * all frames show in promiscious mode * tag is part of the frame that shows up in tcpdump, and then gets stripped by the 8021q module. Sure. It's IMHO good and working, modulo the tag being removed on the

Re: Linux, tcpdump and vlan

2007-07-19 Thread Stephen Hemminger
On Thu, 19 Jul 2007 16:23:48 +0200 Krzysztof Halasa [EMAIL PROTECTED] wrote: Stephen Hemminger [EMAIL PROTECTED] writes: 1) non-accelerated device * all frames show in promiscious mode * tag is part of the frame that shows up in tcpdump, and then gets stripped by the

Re: Linux, tcpdump and vlan

2007-07-19 Thread Stephen Hemminger
On Thu, 19 Jul 2007 16:23:48 +0200 Krzysztof Halasa [EMAIL PROTECTED] wrote: Stephen Hemminger [EMAIL PROTECTED] writes: 1) non-accelerated device * all frames show in promiscious mode * tag is part of the frame that shows up in tcpdump, and then gets stripped by the

Re: Linux, tcpdump and vlan

2007-07-19 Thread Krzysztof Halasa
Stephen Hemminger [EMAIL PROTECTED] writes: Not at runtime, acceleration is always on if you compile kernel with vlan support. That is a design mistake as far as I can tell. I think so. However seeing unknown tags on master device (with tcpdump etc) would certainly be useful. Only in

Re: Linux, tcpdump and vlan

2007-07-19 Thread andrei radulescu-banu
The consensus seems to be that skb's need to carry vlan accelerated tags in their cb's, on rx as well as tx. VLAN_TX_SKB_CB() is perfect for that. [Patrick] On the TX path, it could simply use the CB, but this is actually also wrong (for both macvlan and real devices) since qdiscs have

Re: Linux, tcpdump and vlan

2007-07-19 Thread andrei radulescu-banu
One additional thought: with the proposed changes in my prev message, the driver can be set to hw vlan accelerated mode, even if no vlan interfaces are configured. We would not have to switch hw vlan accelerated mode anymore, when vlan interfaces are created or destroyed.

Re: Linux, tcpdump and vlan

2007-07-19 Thread Stephen Hemminger
On Thu, 19 Jul 2007 08:47:01 -0700 (PDT) andrei radulescu-banu [EMAIL PROTECTED] wrote: The consensus seems to be that skb's need to carry vlan accelerated tags in their cb's, on rx as well as tx. VLAN_TX_SKB_CB() is perfect for that. [Patrick] On the TX path, it could simply use the CB,

Re: Linux, tcpdump and vlan

2007-07-19 Thread Patrick McHardy
andrei radulescu-banu wrote: The consensus seems to be that skb's need to carry vlan accelerated tags in their cb's, on rx as well as tx. VLAN_TX_SKB_CB() is perfect for that. No its not. Its only legal to use while something has ownership of the skb. Between VLAN devices and real devices

Re: Linux, tcpdump and vlan

2007-07-19 Thread Ben Greear
andrei radulescu-banu wrote: [Ben] I think a better method would be to allow disabling VLAN HW accel for a NIC with ethtool. This requires changes to ethtool and e1000 driver, +other drivers. It is a handy thing to have. I don't view it as a solution to tcpdump - or to the vlan

Re: Linux, tcpdump and vlan

2007-07-19 Thread andrei radulescu-banu
[Andrei] VLAN_TX_SKB_CB() is perfect for that. [Patrick, Stephen] No its not. Its only legal to use while something has ownership of the skb. Between VLAN devices and real devices qdiscs are free to use it. All right, using VLAN_TX_SKB_CB() is a bad idea. In that case, we need to amend the

Re: Linux, tcpdump and vlan

2007-07-19 Thread andrei radulescu-banu
[Ben] If tcpdump and/or bridging needs to disable the hw-accel, then it can explicitly do so by some API. That is better than overloading the promisc flag in my opinion. I guess I could be persuaded in the end. But let me still play devil advocate. The semantics of 'promiscuous', in my

Re: Linux, tcpdump and vlan

2007-07-19 Thread Stephen Hemminger
On Thu, 19 Jul 2007 11:20:43 -0700 (PDT) andrei radulescu-banu [EMAIL PROTECTED] wrote: [Ben] If tcpdump and/or bridging needs to disable the hw-accel, then it can explicitly do so by some API. That is better than overloading the promisc flag in my opinion. I guess I could be persuaded

Re: Linux, tcpdump and vlan

2007-07-19 Thread andrei radulescu-banu
During debugging, I noticed that dev_queue_xmit() is called twice for tx vlan frames. This results in a frame being passed twice to a packet socket bound to 'any' interface. If the packet socket is bound to a specific interface, though, it will get only one copy of the tx frame, which is good.

Re: Linux, tcpdump and vlan

2007-07-19 Thread Ben Greear
andrei radulescu-banu wrote: During debugging, I noticed that dev_queue_xmit() is called twice for tx vlan frames. This results in a frame being passed twice to a packet socket bound to 'any' interface. If the packet socket is bound to a specific interface, though, it will get only one copy

Re: Linux, tcpdump and vlan

2007-07-18 Thread Patrick McHardy
Ben Greear wrote: > Patrick McHardy wrote: > >> Its actually more a problem on the RX path. VLAN acceleration >> works (at least with some drivers) by enabling HW header striping >> and using the VLAN ID for an immediate lookup in the VLAN devices >> configured on that device. So if the VLAN is

Re: Linux, tcpdump and vlan

2007-07-18 Thread Ben Greear
Patrick McHardy wrote: Ben Greear wrote: Patrick McHardy wrote: Put another way, once you enable VLAN header stripping, you won't see the headers for *any* VLAN, not only for those you're actually running locally. This is also a problem for devices like macvlan, where it would be

Re: Linux, tcpdump and vlan

2007-07-18 Thread Ben Greear
Patrick McHardy wrote: andrei radulescu-banu wrote: [...] In conclusion, here is the buglist: 1). If set promiscuous, the e1000 should disable any vlan rx filtering, so that it can receive vlan frames of other vlan id's. Other ethernet drivers probably need fixed as well. 2). The

Re: Linux, tcpdump and vlan

2007-07-18 Thread Patrick McHardy
Ben Greear wrote: > Patrick McHardy wrote: > >> Put another way, once you enable VLAN header stripping, you >> won't see the headers for *any* VLAN, not only for those you're >> actually running locally. This is also a problem for devices >> like macvlan, where it would be desirable to make use

Re: Linux, tcpdump and vlan

2007-07-18 Thread Patrick McHardy
andrei radulescu-banu wrote: > [...] > > In conclusion, here is the buglist: > 1). If set promiscuous, the e1000 should disable any vlan rx filtering, so > that it can receive vlan frames of other vlan id's. Other ethernet drivers > probably need fixed as well. > 2). The packet layer should

Linux, tcpdump and vlan

2007-07-18 Thread andrei radulescu-banu
Dear kernel networking gurus, I am trying to understand why tcpdump does not work properly for vlan packets on linux. Here is the existing behavior, observed with: - kernel 2.6.16, - e1000 driver - libpcap 0.9.6 - tcpdump 3.9.6 The e1000 driver has two modes when handling vlan

Linux, tcpdump and vlan

2007-07-18 Thread andrei radulescu-banu
Dear kernel networking gurus, I am trying to understand why tcpdump does not work properly for vlan packets on linux. Here is the existing behavior, observed with: - kernel 2.6.16, - e1000 driver - libpcap 0.9.6 - tcpdump 3.9.6 The e1000 driver has two modes when handling vlan

Re: Linux, tcpdump and vlan

2007-07-18 Thread Patrick McHardy
andrei radulescu-banu wrote: [...] In conclusion, here is the buglist: 1). If set promiscuous, the e1000 should disable any vlan rx filtering, so that it can receive vlan frames of other vlan id's. Other ethernet drivers probably need fixed as well. 2). The packet layer should change

Re: Linux, tcpdump and vlan

2007-07-18 Thread Patrick McHardy
Ben Greear wrote: Patrick McHardy wrote: Put another way, once you enable VLAN header stripping, you won't see the headers for *any* VLAN, not only for those you're actually running locally. This is also a problem for devices like macvlan, where it would be desirable to make use of

Re: Linux, tcpdump and vlan

2007-07-18 Thread Ben Greear
Patrick McHardy wrote: andrei radulescu-banu wrote: [...] In conclusion, here is the buglist: 1). If set promiscuous, the e1000 should disable any vlan rx filtering, so that it can receive vlan frames of other vlan id's. Other ethernet drivers probably need fixed as well. 2). The

Re: Linux, tcpdump and vlan

2007-07-18 Thread Ben Greear
Patrick McHardy wrote: Ben Greear wrote: Patrick McHardy wrote: Put another way, once you enable VLAN header stripping, you won't see the headers for *any* VLAN, not only for those you're actually running locally. This is also a problem for devices like macvlan, where it would be

Re: Linux, tcpdump and vlan

2007-07-18 Thread Patrick McHardy
Ben Greear wrote: Patrick McHardy wrote: Its actually more a problem on the RX path. VLAN acceleration works (at least with some drivers) by enabling HW header striping and using the VLAN ID for an immediate lookup in the VLAN devices configured on that device. So if the VLAN is not