linux/net/netfilter/ipvs
Yingnan Zhang 67bf42cae4 ipvs: fix MTU check for GSO packets in tunnel mode
Currently, IPVS skips MTU checks for GSO packets by excluding them with
the !skb_is_gso(skb) condition. This creates problems when IPVS tunnel
mode encapsulates GSO packets with IPIP headers.

The issue manifests in two ways:

1. MTU violation after encapsulation:
   When a GSO packet passes through IPVS tunnel mode, the original MTU
   check is bypassed. After adding the IPIP tunnel header, the packet
   size may exceed the outgoing interface MTU, leading to unexpected
   fragmentation at the IP layer.

2. Fragmentation with problematic IP IDs:
   When net.ipv4.vs.pmtu_disc=1 and a GSO packet with multiple segments
   is fragmented after encapsulation, each segment gets a sequentially
   incremented IP ID (0, 1, 2, ...). This happens because:

   a) The GSO packet bypasses MTU check and gets encapsulated
   b) At __ip_finish_output, the oversized GSO packet is split into
      separate SKBs (one per segment), with IP IDs incrementing
   c) Each SKB is then fragmented again based on the actual MTU

   This sequential IP ID allocation differs from the expected behavior
   and can cause issues with fragment reassembly and packet tracking.

Fix this by properly validating GSO packets using
skb_gso_validate_network_len(). This function correctly validates
whether the GSO segments will fit within the MTU after segmentation. If
validation fails, send an ICMP Fragmentation Needed message to enable
proper PMTU discovery.

Fixes: 4cdd34084d ("netfilter: nf_conntrack_ipv6: improve fragmentation handling")
Signed-off-by: Yingnan Zhang <342144303@qq.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
History 2026-04-20 23:45:43 +02:00
..
ip_vs_app.c net: Remove KMSG_COMPONENT macro 2025-11-28 19:20:27 -08:00
ip_vs_conn.c ipvs: use more keys for connection hashing 2026-03-04 11:45:45 +01:00
ip_vs_core.c ipvs: add resizable hash tables 2026-03-04 11:45:45 +01:00
ip_vs_ctl.c ipvs: add conn_lfactor and svc_lfactor sysctl vars 2026-04-10 12:16:26 +02:00
ip_vs_dh.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ip_vs_est.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-02-26 10:23:00 -08:00
ip_vs_fo.c net: Remove KMSG_COMPONENT macro 2025-11-28 19:20:27 -08:00
ip_vs_ftp.c net: Remove KMSG_COMPONENT macro 2025-11-28 19:20:27 -08:00
ip_vs_lblc.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ip_vs_lblcr.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ip_vs_lc.c net: Remove KMSG_COMPONENT macro 2025-11-28 19:20:27 -08:00
ip_vs_mh.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
ip_vs_nfct.c net: Remove KMSG_COMPONENT macro 2025-11-28 19:20:27 -08:00
ip_vs_nq.c net: Remove KMSG_COMPONENT macro 2025-11-28 19:20:27 -08:00
ip_vs_ovf.c net: Remove KMSG_COMPONENT macro 2025-11-28 19:20:27 -08:00
ip_vs_pe.c net: Remove KMSG_COMPONENT macro 2025-11-28 19:20:27 -08:00
ip_vs_pe_sip.c ipvs: switch to per-net connection table 2026-03-04 11:45:45 +01:00
ip_vs_proto.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ip_vs_proto_ah_esp.c net: Remove KMSG_COMPONENT macro 2025-11-28 19:20:27 -08:00
ip_vs_proto_sctp.c ipvs: skip ipv6 extension headers for csum checks 2026-02-17 15:04:20 +01:00
ip_vs_proto_tcp.c ipvs: skip ipv6 extension headers for csum checks 2026-02-17 15:04:20 +01:00
ip_vs_proto_udp.c ipvs: skip ipv6 extension headers for csum checks 2026-02-17 15:04:20 +01:00
ip_vs_rr.c net: Remove KMSG_COMPONENT macro 2025-11-28 19:20:27 -08:00
ip_vs_sched.c net: Remove KMSG_COMPONENT macro 2025-11-28 19:20:27 -08:00
ip_vs_sed.c net: Remove KMSG_COMPONENT macro 2025-11-28 19:20:27 -08:00
ip_vs_sh.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ip_vs_sync.c ipvs: switch to per-net connection table 2026-03-04 11:45:45 +01:00
ip_vs_twos.c net: Remove KMSG_COMPONENT macro 2025-11-28 19:20:27 -08:00
ip_vs_wlc.c net: Remove KMSG_COMPONENT macro 2025-11-28 19:20:27 -08:00
ip_vs_wrr.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ip_vs_xmit.c ipvs: fix MTU check for GSO packets in tunnel mode 2026-04-20 23:45:43 +02:00
Kconfig sctp: use skb_crc32c() instead of __skb_checksum() 2025-05-21 15:40:16 -07:00
Makefile ipvs: add weighted random twos choice algorithm 2021-01-26 01:09:46 +01:00