Re: Linux, tcpdump and vlan

2 messages, 2 authors, 2007-07-21 · open the first message on its own page

Re: Linux, tcpdump and vlan

From: Krzysztof Halasa <khc@pm.waw.pl>
Date: 2007-07-21 11:32:45

Ben Greear [off-list ref] 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 ethX?
On tx, if it shows up on the vlan device, we add that device's VID to
the header if no VID is currently in the SKB.  If it is in the SKB header
we change the VID to be the tx dev's VID (if it was different).  This allows user-space
to send a raw ethernet frame on a vlan device and have it automatically
go out of the box on the correct vlan.  User-space can also send raw VLAN frames
and have those also go out on the correct VLAN.
Well... I think the tag should be added unconditionally (for things like
QinQ) but that's trivial and minor.

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 would need other means to get VLAN id...
-- 
Krzysztof Halasa

Re: Linux, tcpdump and vlan

From: Ben Greear <hidden>
Date: 2007-07-21 17:57:35

Krzysztof Halasa wrote:
Ben Greear [off-list ref] writes:

  
quoted
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 ethX?
  
No.  I don't see a good reason to strip on ethX.  That hardware accel 
VLANs strip
is an inconvenience in my opinion, no need to force it in software as well.
quoted
On tx, if it shows up on the vlan device, we add that device's VID to
the header if no VID is currently in the SKB.  If it is in the SKB header
we change the VID to be the tx dev's VID (if it was different).  This allows user-space
to send a raw ethernet frame on a vlan device and have it automatically
go out of the box on the correct vlan.  User-space can also send raw VLAN frames
and have those also go out on the correct VLAN.
    
Well... I think the tag should be added unconditionally (for things like
QinQ) but that's trivial and minor.
  
I think that for Q in Q, we would need some explicit flag on each skb to 
know when to add or modify
the VID.  I was never able to think of an automatic solution that worked 
in all cases
(bridging, writing raw packets from user space, normal receive, normal 
transmit, ...)

Modifying the bridging code would fix that path, and adding a socket opt 
to deal with writing
raw packets from user-space should handle the other tricky case I believe.
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 would need other means to get VLAN id...
  
What benefit will this add?  It will certainly decrease performance to 
copy around
the header for every VLAN packet, so there would have to be a good reason to
add this logic...

Ben


-- 
Ben Greear [off-list ref] 
Candela Technologies Inc  http://www.candelatech.com

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help