seg6: set IPSKB_L3SLAVE from IP6SKB_L3SLAVE on IPIP decapsulation
Subsystems (3)
Andrea Mayer
maintainerPATCH 1/1 seg6: set IPSKB_L3SLAVE from IP6SKB_L3SLAVE on IPIP decapsulation
When an SRv6 packet arrives on an interface enslaved to a VRF, vrf_ip6_rcv() sets IP6SKB_L3SLAVE in IP6CB, but decap_and_validate() has never set IPSKB_L3SLAVE in IPCB. The bit stayed clear in the common case, and with CONFIG_IPV6_MIP6 the leftover frag_max_size of a reassembled outer packet could even set it, with no VRF involved. Commit 44930446dde4 ("ipv6: seg6: clear IPv4 control block on IPIP decapsulation") then made the unreliable bit reliably clear.
The effect of the missing flag is visible with End.DX4 when a delivery to a local address of the node reaches the socket lookup. For example, a UDP socket bound to the enslaved ingress interface does not receive any of the decapsulated packets, while an unbound socket outside the VRF does.
This contradicts Documentation/networking/vrf.rst: by default the scope of an unbound UDP or TCP socket is limited to the default VRF.
Set IPSKB_L3SLAVE for IPv4 in decap_and_validate(), which already does the same for IPv6. The socket lookup then matches the decapsulated packet like any other packet received on that enslaved interface. Such a packet matches an unbound UDP or TCP socket only when udp_l3mdev_accept or tcp_l3mdev_accept is set.
--- net/ipv6/seg6_local.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv6/seg6_local.c +3 -0
@@ -257,10 +257,13 @@ static bool decap_and_validate(struct sk_buff *skb, int proto)return false;if (proto ==IPPROTO_IPIP ) { +bool l3slave =ipv6_l3mdev_skb (IP6CB (skb)->flags);int iif =IP6CB (skb)->iif;memset (IPCB (skb),0 ,sizeof (*IPCB (skb)));IPCB (skb)->iif = iif; +if (l3slave) +IPCB (skb)->flags |=IPSKB_L3SLAVE ; }else if (proto ==IPPROTO_IPV6 ) {bool l3slave =ipv6_l3mdev_skb (IP6CB (skb)->flags);int iif =IP6CB (skb)->iif;
Signature · 1 line
2.43.0
Quoted 22 lines · Andrea Mayer
When an SRv6 packet arrives on an interface enslaved to a VRF,
vrf_ip6_rcv()setsIP6SKB_L3SLAVEin IP6CB, butdecap_and_validate()has never setIPSKB_L3SLAVEin IPCB. The bit stayed clear in the common case, and withCONFIG_IPV6_MIP6the leftoverfrag_max_sizeof a reassembled outer packet could even set it, with no VRF involved. Commit44930446dde4("ipv6: seg6: clear IPv4 control block on IPIP decapsulation") then made the unreliable bit reliably clear.The effect of the missing flag is visible with End.DX4 when a delivery to a local address of the node reaches the socket lookup. For example, a UDP socket bound to the enslaved ingress interface does not receive any of the decapsulated packets, while an unbound socket outside the VRF does.
This contradictsDocumentation/networking/vrf.rst: by default the scope of an unbound UDP or TCP socket is limited to the default VRF.Set
IPSKB_L3SLAVEfor IPv4 indecap_and_validate(), which already does the same for IPv6. The socket lookup then matches the decapsulated packet like any other packet received on that enslaved interface. Such a packet matches an unbound UDP or TCP socket only whenudp_l3mdev_acceptortcp_l3mdev_acceptis set.
Quoted 6 lines
Fixes 891ef8dd2a8d ("ipv6: sr: implement additional seg6local actions")Signed-off-by Andrea Mayer <[email protected]>--- net/ipv6/seg6_local.c | 3 +++ 1 file changed, 3 insertions(+)
Quoted 49 lines · Andrea Mayer
When an SRv6 packet arrives on an interface enslaved to a VRF,
vrf_ip6_rcv()setsIP6SKB_L3SLAVEin IP6CB, butdecap_and_validate()has never setIPSKB_L3SLAVEin IPCB. The bit stayed clear in the common case, and withCONFIG_IPV6_MIP6the leftoverfrag_max_sizeof a reassembled outer packet could even set it, with no VRF involved. Commit44930446dde4("ipv6: seg6: clear IPv4 control block on IPIP decapsulation") then made the unreliable bit reliably clear.The effect of the missing flag is visible with End.DX4 when a delivery to a local address of the node reaches the socket lookup. For example, a UDP socket bound to the enslaved ingress interface does not receive any of the decapsulated packets, while an unbound socket outside the VRF does.
This contradictsDocumentation/networking/vrf.rst: by default the scope of an unbound UDP or TCP socket is limited to the default VRF.Set
IPSKB_L3SLAVEfor IPv4 indecap_and_validate(), which already does the same for IPv6. The socket lookup then matches the decapsulated packet like any other packet received on that enslaved interface. Such a packet matches an unbound UDP or TCP socket only whenudp_l3mdev_acceptortcp_l3mdev_acceptis set.Fixes 891ef8dd2a8d ("ipv6: sr: implement additional seg6local actions")Signed-off-by Andrea Mayer <[email protected]>--- net/ipv6/seg6_local.c | 3 +++ 1 file changed, 3 insertions(+)net/ipv6/seg6_local.c +3
-0@@ -257,10 +257,13 @@ static bool decap_and_validate(struct sk_buff *skb, int proto)return false;if (proto ==IPPROTO_IPIP ) { +bool l3slave =ipv6_l3mdev_skb (IP6CB (skb)->flags);int iif =IP6CB (skb)->iif;memset (IPCB (skb),0 ,sizeof (*IPCB (skb)));IPCB (skb)->iif = iif; +if (l3slave) +IPCB (skb)->flags |=IPSKB_L3SLAVE ; }else if (proto ==IPPROTO_IPV6 ) {bool l3slave =ipv6_l3mdev_skb (IP6CB (skb)->flags);int iif =IP6CB (skb)->iif;Signature · 1 line
2.43.0
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Sun, 13 Sep 2026 21:44:21 +0200 you wrote:
When an SRv6 packet arrives on an interface enslaved to a VRF,
vrf_ip6_rcv()setsIP6SKB_L3SLAVEin IP6CB, butdecap_and_validate()has never setIPSKB_L3SLAVEin IPCB. The bit stayed clear in the common case, and withCONFIG_IPV6_MIP6the leftoverfrag_max_sizeof a reassembled outer packet could even set it, with no VRF involved. Commit44930446dde4("ipv6: seg6: clear IPv4 control block on IPIP decapsulation") then made the unreliable bit reliably clear.[...]
Here is the summary with links:
- [net] seg6: set IPSKB_L3SLAVE from IP6SKB_L3SLAVE on IPIP decapsulation
https://git.kernel.org/netdev/net/c/7616242a2b37
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html