lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201015011630.2399-9-pablo@netfilter.org>
Date:   Thu, 15 Oct 2020 03:16:29 +0200
From:   Pablo Neira Ayuso <pablo@...filter.org>
To:     netfilter-devel@...r.kernel.org
Cc:     davem@...emloft.net, netdev@...r.kernel.org, kuba@...nel.org
Subject: [PATCH net-next 8/9] netfilter: flowtable: bridge port support

Update hardware destination address to the master bridge device to
emulate the forwarding behaviour.

Signed-off-by: Pablo Neira Ayuso <pablo@...filter.org>
---
 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ