On 7/8/2019 10:17 PM, Florian Westphal wrote: > wenxu@xxxxxxxxx <wenxu@xxxxxxxxx> wrote: >> From: wenxu <wenxu@xxxxxxxxx> >> >> Add nf_nat_bridge_ops to do nat in the bridge family > Whats the use case for this? > > The reason I'm asking is that a bridge doesn't know about IP, > Bridge netfilter (the call-iptables thing) has a lot of glue code > to detect dnat rewrites and updates target mac address, including > support for redirect (suddently packet has to be pushed up the stack) > or changes in the oif to non-bridge ports (it even checks forward sysctl > state ..) and so on. > > Thats something that I don't want to support in nftables. > > For NAT on bridge, it should be possible already to push such packets > up the stack by > > bridge input meta iif eth0 ip saddr 192.168.0.0/16 \ > meta pkttype set unicast ether daddr set 00:11:22:33:44:55 yes, packet can be push up to IP stack to handle the nat through bridge device. In my case dnat 2.2.1.7 to 10.0.0.7, It assume the mac address of the two address is the same known by outer. So The bridge can just do nat( without modify mac address or oif). But in This case modify the packet dmac to bridge device, the packet push up through bridge device Then do nat and route send back to bridge device.