All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
	pabeni@redhat.com, edumazet@kernel.org, horms@kernel.org,
	fw@strlen.de, ja@ssi.bg
Subject: [PATCH net-next 10/13] netfilter: flowtable: tunnel device poisons h_source of fast-path frames
Date: Mon, 16 Nov 2026 01:16:09 +0100	[thread overview]
Message-ID: <20261116001612.2806263-11-pablo@netfilter.org> (raw)
In-Reply-To: <20261116001612.2806263-1-pablo@netfilter.org>

From: Marek Majkowski <marek@lysk.ai>

When a flow enters an IP tunnel, the forward path discovered by
dev_fill_forward_path() starts with a DEV_PATH_TUN entry for the tunnel
device, followed by whatever carries the outer packet.
nft_dev_path_info() handles DEV_PATH_TUN in the same switch case as the
Ethernet-like path types and copies path->dev->dev_addr into
info->h_source if it is still unset. For a tunnel device dev_addr is not
an Ethernet address: ip6_tunnel stores the 16-byte local IPv6 there and
ip_tunnel the 4-byte local IPv4. The tunnel entry is the first one on
the path, so its "address" wins and poisons h_source: every fast-path
frame is transmitted with the first bytes of the tunnel local IP address
as the Ethernet source MAC.

Seen on a DS-Lite setup, LAN -> ip6tnl (IPv4 inside IPv6) -> PPPoE ->
802.1Q VLAN -> Ethernet, with conntrack flows offloaded through an
nftables flowtable ('flow add @ft'). The first packets of a flow, still
on the slow path, and the fast-path packets of the same flow differ only
in the Ethernet source address:

  slow path:  d8:58:d7:00:2e:bd > 80:ac:ac:39:ef:c2, 802.1Q vlan 35,
              PPPoE [ses 0x454] IP6 2a01:110f:4328:c400::1 >
              2a01:1000:0:1::2216 next-header IPIP, 192.0.0.2.40010 >
              1.1.1.1.53
  fast path:  2a:01:11:0f:43:28 > 80:ac:ac:39:ef:c2, same frame otherwise

As you can see 2a:01:11:0f:43:28 is the start of 2a01:110f:4328:c400::1,
the tunnel local address. The PPPoE endpoint binds the session to the
subscriber MAC and silently drops the frames, the effect is that every
TCP/UDP flow dies the moment it is offloaded, while ICMP, which is never
offloaded, keeps working. Received traffic is unaffected.

Do not let DEV_PATH_TUN poison h_source: skip the assignment for it. The
real link-layer device appears later on the same path and provides the
correct address; for a path with no Ethernet device the address stays
zero as before.

Fixes: ab427db17885 ("netfilter: flowtable: Add IPIP rx sw acceleration")
Signed-off-by: Marek Majkowski <marek@lysk.ai>
Reviewed-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_flow_table_path.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nf_flow_table_path.c b/net/netfilter/nf_flow_table_path.c
index 841f099434d9..4ca6e09c7f8e 100644
--- a/net/netfilter/nf_flow_table_path.c
+++ b/net/netfilter/nf_flow_table_path.c
@@ -121,7 +121,12 @@ static int nft_dev_path_info(struct net_device_path_stack *stack,
 		case DEV_PATH_PPPOE:
 		case DEV_PATH_TUN:
 			info->dev = path->dev;
-			if (is_zero_ether_addr(info->h_source))
+			/* A tunnel device has no Ethernet address: its dev_addr
+			 * is the tunnel local IP address. Take h_source from the
+			 * real link-layer device further down the path.
+			 */
+			if (path->type != DEV_PATH_TUN &&
+			    is_zero_ether_addr(info->h_source))
 				memcpy(info->h_source, path->dev->dev_addr, ETH_ALEN);
 
 			if (path->type == DEV_PATH_ETHERNET ||
-- 
2.47.3


  parent reply	other threads:[~2026-11-16  0:17 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  0:15 [PATCH net-next,v2 00/13] Netfilter updates for net-next Pablo Neira Ayuso
2026-11-16  0:16 ` [PATCH net-next 01/13] netfilter: flowtable: do not hw offload flows in teardown state Pablo Neira Ayuso
2026-11-16  0:23   ` netdev-bot+sinfo
2026-11-16  0:27     ` Pablo Neira Ayuso
2026-11-17  0:22   ` netdev-bot+sashiko
2026-11-17  9:40     ` Paolo Abeni
2026-11-17 10:26       ` Pablo Neira Ayuso
2026-11-17 11:20   ` patchwork-bot+netdevbpf
2026-11-16  0:16 ` [PATCH net-next 02/13] netfilter: flowtable: retrieve stats on flow deletion Pablo Neira Ayuso
2026-11-17  0:22   ` netdev-bot+sashiko
2026-11-16  0:16 ` [PATCH net-next 03/13] net: ethernet: mtk_ppe: update " Pablo Neira Ayuso
2026-11-17  0:22   ` netdev-bot+sashiko
2026-11-16  0:16 ` [PATCH net-next 04/13] net: airoha: " Pablo Neira Ayuso
2026-11-17  0:22   ` netdev-bot+sashiko
2026-11-16  0:16 ` [PATCH net-next 05/13] netfilter: xt_time: fix monthday computation for dates past 2039 Pablo Neira Ayuso
2026-11-17  0:22   ` netdev-bot+sashiko
2026-11-16  0:16 ` [PATCH net-next 06/13] netfilter: nft_flow_offload: do not offload multicast Pablo Neira Ayuso
2026-11-17  0:22   ` netdev-bot+sashiko
2026-11-16  0:16 ` [PATCH net-next 07/13] netfilter: flowtable: purge entries immediately when destroying the flowtable Pablo Neira Ayuso
2026-11-17  0:22   ` netdev-bot+sashiko
2026-11-16  0:16 ` [PATCH net-next 08/13] selftests: netfilter: nf_queue: drop the no-op loop initializer Pablo Neira Ayuso
2026-11-16  0:16 ` [PATCH net-next 09/13] netfilter: flowtable: do not scrub as crossing netns Pablo Neira Ayuso
2026-11-17  0:22   ` netdev-bot+sashiko
2026-11-16  0:16 ` Pablo Neira Ayuso [this message]
2026-11-16  0:16 ` [PATCH net-next 11/13] netfilter: flowtable: do not clear the offload bit twice Pablo Neira Ayuso
2026-11-16  0:16 ` [PATCH net-next 12/13] netfilter: nfnetlink_queue: make skb writable before writing NFQA_L2HDR Pablo Neira Ayuso
2026-11-16  0:16 ` [PATCH net-next 13/13] selftests: netfilter: add UDP flowtable offload test Pablo Neira Ayuso
2026-11-17  0:22   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261116001612.2806263-11-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=ja@ssi.bg \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.