Update hardware destination address to the master bridge device to emulate the forwarding behaviour. Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> --- include/net/netfilter/nf_flow_table.h | 1 + net/netfilter/nf_flow_table_core.c | 4 ++++ net/netfilter/nft_flow_offload.c | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h index 1b57d1d1270d..4ec3f9bb2f32 100644 --- a/include/net/netfilter/nf_flow_table.h +++ b/include/net/netfilter/nf_flow_table.h @@ -172,6 +172,7 @@ struct nf_flow_route { u32 ifindex; u8 h_source[ETH_ALEN]; u8 h_dest[ETH_ALEN]; + enum flow_offload_xmit_type xmit_type; } out; struct dst_entry *dst; } tuple[FLOW_OFFLOAD_DIR_MAX]; diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c index 725366339b85..e80dcabe3668 100644 --- a/net/netfilter/nf_flow_table_core.c +++ b/net/netfilter/nf_flow_table_core.c @@ -100,6 +100,10 @@ static int flow_offload_fill_route(struct flow_offload *flow, if (dst_xfrm(dst)) flow_tuple->xmit_type = FLOW_OFFLOAD_XMIT_XFRM; + else + flow_tuple->xmit_type = route->tuple[dir].out.xmit_type; + + flow_tuple->dst_cache = dst; flow_tuple->dst_cache = dst; diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c index d440e436cb16..9efb5d584290 100644 --- a/net/netfilter/nft_flow_offload.c +++ b/net/netfilter/nft_flow_offload.c @@ -54,6 +54,7 @@ struct nft_forward_info { u32 iifindex; u8 h_source[ETH_ALEN]; u8 h_dest[ETH_ALEN]; + enum flow_offload_xmit_type xmit_type; }; static int nft_dev_forward_path(struct nf_flow_route *route, @@ -83,7 +84,9 @@ static int nft_dev_forward_path(struct nf_flow_route *route, case DEV_PATH_VLAN: return -1; case DEV_PATH_BRIDGE: - return -1; + memcpy(info.h_dest, path->dev->dev_addr, ETH_ALEN); + info.xmit_type = FLOW_OFFLOAD_XMIT_DIRECT; + break; } } @@ -91,6 +94,7 @@ static int nft_dev_forward_path(struct nf_flow_route *route, memcpy(route->tuple[dir].out.h_dest, info.h_source, ETH_ALEN); memcpy(route->tuple[dir].out.h_source, info.h_dest, ETH_ALEN); route->tuple[dir].out.ifindex = info.iifindex; + route->tuple[dir].out.xmit_type = info.xmit_type; return 0; } -- 2.20.1