I have a bridge set up using brctl that has 2 interfaces, eth0 and tap0.

What I would like to do is change the stack so that if a packet comes into interface tap0 that is destined for some device on tap0, I would like to forward it back out of tap0 instead of the default, which would be to drop the packet. Also if it is possible it would be great to be able to masquerade these packet.

I was thinking that this would be possible with iptables with something like:

iptables -a FORWARD -m physdev --physdev-in tap0 physdev --physdev-out tap0 ACCEPT
Or something like that to get these packets to echo back out the tap0 port, but that doesn't seem to work. Also I am not clear on how I would masquerade just these packets.

Any ideas here?