public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] seg6: fix seg6 lwtunnel output redirect for L2 reduced encap mode
@ 2026-04-18 16:28 Andrea Mayer
  2026-04-21 17:50 ` Justin Iurman
  2026-04-23  4:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Andrea Mayer @ 2026-04-18 16:28 UTC (permalink / raw)
  To: davem, dsahern, edumazet, kuba, pabeni, horms
  Cc: anton.makarov11235, stefano.salsano, netdev, linux-kernel,
	Andrea Mayer, stable

When SEG6_IPTUN_MODE_L2ENCAP_RED (L2ENCAP_RED) was introduced, the
condition in seg6_build_state() that excludes L2 encap modes from
setting LWTUNNEL_STATE_OUTPUT_REDIRECT was not updated to account for
the new mode.
As a consequence, L2ENCAP_RED routes incorrectly trigger seg6_output()
on the output path, where the packet is silently dropped because
skb_mac_header_was_set() fails on L3 packets.

Extend the check to also exclude L2ENCAP_RED, consistent with L2ENCAP.

Fixes: 13f0296be8ec ("seg6: add support for SRv6 H.L2Encaps.Red behavior")
Cc: stable@vger.kernel.org
Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
---
 net/ipv6/seg6_iptunnel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
index 97b50d9b1365..9b64343ebad6 100644
--- a/net/ipv6/seg6_iptunnel.c
+++ b/net/ipv6/seg6_iptunnel.c
@@ -746,7 +746,8 @@ static int seg6_build_state(struct net *net, struct nlattr *nla,
 	newts->type = LWTUNNEL_ENCAP_SEG6;
 	newts->flags |= LWTUNNEL_STATE_INPUT_REDIRECT;
 
-	if (tuninfo->mode != SEG6_IPTUN_MODE_L2ENCAP)
+	if (tuninfo->mode != SEG6_IPTUN_MODE_L2ENCAP &&
+	    tuninfo->mode != SEG6_IPTUN_MODE_L2ENCAP_RED)
 		newts->flags |= LWTUNNEL_STATE_OUTPUT_REDIRECT;
 
 	newts->headroom = seg6_lwt_headroom(tuninfo);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] seg6: fix seg6 lwtunnel output redirect for L2 reduced encap mode
  2026-04-18 16:28 [PATCH net] seg6: fix seg6 lwtunnel output redirect for L2 reduced encap mode Andrea Mayer
@ 2026-04-21 17:50 ` Justin Iurman
  2026-04-23  4:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Justin Iurman @ 2026-04-21 17:50 UTC (permalink / raw)
  To: Andrea Mayer, davem, dsahern, edumazet, kuba, pabeni, horms
  Cc: anton.makarov11235, stefano.salsano, netdev, linux-kernel, stable

On 4/18/26 18:28, Andrea Mayer wrote:
> When SEG6_IPTUN_MODE_L2ENCAP_RED (L2ENCAP_RED) was introduced, the
> condition in seg6_build_state() that excludes L2 encap modes from
> setting LWTUNNEL_STATE_OUTPUT_REDIRECT was not updated to account for
> the new mode.
> As a consequence, L2ENCAP_RED routes incorrectly trigger seg6_output()
> on the output path, where the packet is silently dropped because
> skb_mac_header_was_set() fails on L3 packets.
> 
> Extend the check to also exclude L2ENCAP_RED, consistent with L2ENCAP.
> 
> Fixes: 13f0296be8ec ("seg6: add support for SRv6 H.L2Encaps.Red behavior")
> Cc: stable@vger.kernel.org
> Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
> ---
>   net/ipv6/seg6_iptunnel.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
> index 97b50d9b1365..9b64343ebad6 100644
> --- a/net/ipv6/seg6_iptunnel.c
> +++ b/net/ipv6/seg6_iptunnel.c
> @@ -746,7 +746,8 @@ static int seg6_build_state(struct net *net, struct nlattr *nla,
>   	newts->type = LWTUNNEL_ENCAP_SEG6;
>   	newts->flags |= LWTUNNEL_STATE_INPUT_REDIRECT;
>   
> -	if (tuninfo->mode != SEG6_IPTUN_MODE_L2ENCAP)
> +	if (tuninfo->mode != SEG6_IPTUN_MODE_L2ENCAP &&
> +	    tuninfo->mode != SEG6_IPTUN_MODE_L2ENCAP_RED)
>   		newts->flags |= LWTUNNEL_STATE_OUTPUT_REDIRECT;
>   
>   	newts->headroom = seg6_lwt_headroom(tuninfo);

Reviewed-by: Justin Iurman <justin.iurman@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] seg6: fix seg6 lwtunnel output redirect for L2 reduced encap mode
  2026-04-18 16:28 [PATCH net] seg6: fix seg6 lwtunnel output redirect for L2 reduced encap mode Andrea Mayer
  2026-04-21 17:50 ` Justin Iurman
@ 2026-04-23  4:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-04-23  4:10 UTC (permalink / raw)
  To: Andrea Mayer
  Cc: davem, dsahern, edumazet, kuba, pabeni, horms, anton.makarov11235,
	stefano.salsano, netdev, linux-kernel, stable

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 18 Apr 2026 18:28:38 +0200 you wrote:
> When SEG6_IPTUN_MODE_L2ENCAP_RED (L2ENCAP_RED) was introduced, the
> condition in seg6_build_state() that excludes L2 encap modes from
> setting LWTUNNEL_STATE_OUTPUT_REDIRECT was not updated to account for
> the new mode.
> As a consequence, L2ENCAP_RED routes incorrectly trigger seg6_output()
> on the output path, where the packet is silently dropped because
> skb_mac_header_was_set() fails on L3 packets.
> 
> [...]

Here is the summary with links:
  - [net] seg6: fix seg6 lwtunnel output redirect for L2 reduced encap mode
    https://git.kernel.org/netdev/net/c/ade67d5f5888

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-23  4:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-18 16:28 [PATCH net] seg6: fix seg6 lwtunnel output redirect for L2 reduced encap mode Andrea Mayer
2026-04-21 17:50 ` Justin Iurman
2026-04-23  4:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox