Skip to content

udp: fix FOU/GUE over multicast

Anton Danilov linux-kselftest netdev 7 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest2 patches 4 repliesApplied 2/2
  2. v52 patches 2 repliesSuperseded
  3. v42 patches 1 replySuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v3 posting 2/22 patches1 replySuperseded
v3 RFC posting 1/22 patches0 repliesSuperseded
v2 RFC2 patches1 replySuperseded
v1 RFC2 patches2 repliesSuperseded

Changes in v6 from the cover letter · 19 lines

- selftest: use the lib.sh ktap helpers (log_test / log_test_skip)
so the IPv6-unavailable case reports KSFT_SKIP properly (Willem
de Bruijn)
- selftest: add CONFIG_IPV6_FOU / CONFIG_IPV6_FOU_TUNNEL to tools/testing/selftests/net/config (Willem de Bruijn)
- selftest: speed up the ping loop with -i 0.01
v5: https://lore.kernel.org/netdev/[email protected]/
- Fix IPv6 patch: return ret, not -ret (Willem de Bruijn)
- selftest: add IPv6 test case
- selftest: create the veth pair inside the namespaces (Willem de Bruijn)
v4: https://lore.kernel.org/netdev/[email protected]/
- Promoted from RFC to PATCH; no functional changes since v3.
v3: https://lore.kernel.org/netdev/[email protected]/
- Use return -ret instead of calling ip_protocol_deliver_rcu() directly, matching the unicast path (Kuniyuki Iwashima)
- Replace Python packet generator with ping through a real
FOU/GRETAP tunnel in the selftest
v2: https://lore.kernel.org/netdev/ad_dal164gVmImWl@dau-home-pc/
- Moved inline Python packet generator into a separate helper
- Fixed author email typo in Signed-off-by
v1 (RFC): https://lore.kernel.org/netdev/ad7MsSJOuUU6EGwS@dau-home-pc/

Patches in v6 All 2 applied

#Subject and filesSizeRepliesApplied
1/2udp: fix encapsulation packet resubmit in multicast delivernet/ipv4/udp.c net/ipv6/udp.c+8 -43 repliesApplied
2/2selftests: net: add FOU multicast encapsulation resubmit testtools/testing/selftests/net/Makefile tools/testing/selftests/net/config tools/testing/selftests/net/fou_mcast_encap.sh+175 -01 replyApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchWillem de Bruijn
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH net-next v6 0/2] udp: fix FOU/GUE over multicast

UDP encapsulation (FOU, GUE) has never worked correctly with multicast destination addresses. When a FOU-encapsulated packet arrives at a multicast address, it enters __udp4_lib_mcast_deliver() / __udp6_lib_mcast_deliver() which call consume_skb() on packets that need resubmission to the inner protocol handler, silently dropping them instead.

The unicast delivery paths handle this correctly by propagating the return value up to ip[6]_protocol_deliver_rcu() for resubmission, but the multicast paths were never updated to support UDP encapsulation resubmit.

This causes silent packet loss for FOU/GRETAP tunnels configured with multicast remote addresses (both IPv4 and IPv6).

Reproducing the issue (IPv4):

ip netns add ns_a && ip netns add ns_b
ip link add veth0 netns ns_a type veth peer name veth1 netns ns_b

  ip -n ns_a addr add 10.0.0.1/24 dev veth0 && ip -n ns_a link set veth0 up
  ip -n ns_b addr add 10.0.0.2/24 dev veth1 && ip -n ns_b link set veth1 up

ip -n ns_a route add 239.0.0.0/8 dev veth0
ip -n ns_b route add 239.0.0.0/8 dev veth1

# Disable early demux to expose the issue (otherwise it's partially masked) ip netns exec ns_b sysctl -w net.ipv4.ip_early_demux=0

# Join multicast group on receiver
ip -n ns_b addr add 239.0.0.1/32 dev veth1 autojoin

  # Sender: GRETAP with FOU encap
  ip -n ns_a link add eoudp0 type gretap \
      remote 239.0.0.1 local 10.0.0.1 \
      encap fou encap-sport 4797 encap-dport 4797 key 239.0.0.1
  ip -n ns_a link set eoudp0 up
  ip -n ns_a addr add 192.168.99.1/24 dev eoudp0

  # Receiver: FOU listener + GRETAP
  ip netns exec ns_b ip fou add port 4797 ipproto 47
  ip -n ns_b link add eoudp0 type gretap \
      remote 239.0.0.1 local 10.0.0.2 \
      encap fou encap-sport 4797 encap-dport 4797 key 239.0.0.1
  ip -n ns_b link set eoudp0 up
  ip -n ns_b addr add 192.168.99.2/24 dev eoudp0

  # Static neigh: ARP replies can't traverse unidirectional mcast tunnel
  recv_mac=$(ip -n ns_b link show eoudp0 | awk '/ether/{print $2}')
  ip -n ns_a neigh add 192.168.99.2 lladdr $recv_mac dev eoudp0

# Test: ping through the FOU/GRETAP tunnel ip netns exec ns_a ping -c 100 192.168.99.2 # -> without this patch: 0 packets received on eoudp0 # -> with this patch: all packets received on eoudp0

IPv6 (using fou6 + ip6gretap) exhibits the same silent drop with a different fix (see 1/2 for the sign-of-ret difference between ip_protocol_deliver_rcu() and ip6_protocol_deliver_rcu()).

AI assistance (Claude, claude-opus-4-6) was used during root cause analysis of the kernel source code (tracing the call chain from udp[6]_queue_rcv_skb through encap_rcv to ip[6]_protocol_deliver_rcu, comparing unicast/GSO/multicast paths) and during patch and selftest authoring.

v6:
- selftest: use the lib.sh ktap helpers (log_test / log_test_skip)
so the IPv6-unavailable case reports KSFT_SKIP properly (Willem
de Bruijn)
- selftest: add CONFIG_IPV6_FOU / CONFIG_IPV6_FOU_TUNNEL to tools/testing/selftests/net/config (Willem de Bruijn)
- selftest: speed up the ping loop with -i 0.01
v5: https://lore.kernel.org/netdev/[email protected]/
- Fix IPv6 patch: return ret, not -ret (Willem de Bruijn)
- selftest: add IPv6 test case
- selftest: create the veth pair inside the namespaces (Willem de Bruijn)
v4: https://lore.kernel.org/netdev/[email protected]/
- Promoted from RFC to PATCH; no functional changes since v3.
v3: https://lore.kernel.org/netdev/[email protected]/
- Use return -ret instead of calling ip_protocol_deliver_rcu() directly, matching the unicast path (Kuniyuki Iwashima)
- Replace Python packet generator with ping through a real
FOU/GRETAP tunnel in the selftest
v2: https://lore.kernel.org/netdev/ad_dal164gVmImWl@dau-home-pc/
- Moved inline Python packet generator into a separate helper
- Fixed author email typo in Signed-off-by
v1 (RFC): https://lore.kernel.org/netdev/ad7MsSJOuUU6EGwS@dau-home-pc/

Anton Danilov (2):
udp: fix encapsulation packet resubmit in multicast deliver
selftests: net: add FOU multicast encapsulation resubmit test

 net/ipv4/udp.c                                |   6 +-
 net/ipv6/udp.c                                |   6 +-
 tools/testing/selftests/net/Makefile          |   1 +
 tools/testing/selftests/net/config            |   2 +
 .../testing/selftests/net/fou_mcast_encap.sh  | 172 ++++++++++++++++++
 5 files changed, 183 insertions(+), 4 deletions(-)
 create mode 100755 tools/testing/selftests/net/fou_mcast_encap.sh
Signature · 1 line
2.47.3