Re: ebt_vnat -- Slapping on a VLAN tag on the bridge

Bart De Schuymer <[email protected]>
Newsgroups gmane.linux.network.bridge.ebtables.devel
Message-ID <[email protected]>
On Friday 19 December 2003 20:59, Kashyap Ashwin wrote:
> Hi,
> This question is related to "Headroom for bridging question". I wrote a new
> target to add a VLAN tag to specified packets. This is how you set the
> rule: # ebtables -t nat -A POSTROUTING -s 00:11:22:33:44:55 -j vnat
> --to-vlan 6
>
> Most of the code was simply copied from ebt_s/dnat both in user and kernel
> code.
>
> This is the problem:
> br_netfilter: Argh!! br_nf_post_routing: bad mac.raw pointer.[eth0][br0]
>
> How do I fix the mismatch between skb->mac.raw and skb->data? I was
> thinking of putting this in the OUTPUT chain instead of postrouting...

skb->mac.raw -= VLAN_HLEN;
skb->nh.raw -= VLAN_HLEN;

I think nat OUTPUT seem most appropriate.

It would be nice if this vnat module were able to
1. change both vlan fields of a vlan packet, this should also be allowed in 
nat PREROUTING.
2. encapsulate the packet in a vlan header (like your code does) and give a 
valid values to the vlan fields.
E.g. -j vnat --vnat-encapsulate adds a vlan header with default values, -j 
vnat --vnat-id id changes the vlan id. --vnat-id together with 
vnat-encapsulate changes the id of the newly added vlan header.
Also, adding the option --vnat-target analogous to --dnat-target is essential.

cheers,
Bart



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.