Re: Change destination MAC

Bart De Schuymer <[email protected]>
Newsgroups gmane.linux.network.bridge.ebtables.devel
Message-ID <[email protected]>
Op vr, 18-02-2005 te 13:40 +0100, schreef George:
> Hello.
> 
> I'm developing a kernel module in order to change the MAC address to the 
> one I desired. For that I'm using the netfilter/ebtables hook. However I'm 
> facing a problem, I don't know the reason why it happens.
> The module works fine and seems to do its job. However that depends on the 
> dest MAC address I put to the packet.
> Let's explain it. If the dest MAC addr is under the control of the brigde 
> (brctl showmacs br0) there is no problem when changing it, I can put 
> whatever within this list.
> However if I put another different from the ones in the list, the packet is 
> not sent. I'm sniffing the channel and no packet get out of the device.
> 
> When exiting the NF_BR_POST_ROUTING it seems that the mac has been changed, 
> but the packet never gets out.
> 
> Any reason for that.
> Any help is more than welcome.

Have a look at ebt_snat.c

Try not changing nfcache and using the test (see ebt_snat.c)
if (skb_shared(*pskb) || skb_cloned(*pskb))

Btw, dnat is usually done on the PREROUTING hook. If you do dnat to a
host on a different side of the bridge your packet won't arrive unless
you use the PREROUTING hook.

cheers,
Bart




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&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.