From 499bfea65d00a4bd113fed3051ff6db5ed8e4fb5 Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Mon, 18 Aug 2025 19:15:39 +0200 Subject: [PATCH] icmp: clear offset and flags when reflecting a packet When reflecting a packet, use an offset of 0 and clear all three bits, in particular the DF bit. PR: 288558 Reviewed by: markj, zlei Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D51991 (cherry picked from commit b9a2d84b1bf7f9cf556e2f0b68023d5af8362797) --- sys/netinet/ip_icmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 122293a36a1..84780b7859a 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -393,7 +393,6 @@ stdreply: icmpelen = max(8, min(V_icmp_quotelen, ntohs(oip->ip_len) - nip->ip_hl = 5; nip->ip_p = IPPROTO_ICMP; nip->ip_tos = 0; - nip->ip_off = 0; if (V_error_keeptags) m_tag_copy_chain(m, n, M_NOWAIT); @@ -879,6 +878,8 @@ match: mac_netinet_icmp_replyinplace(m); #endif ip->ip_src = t; + /* ip->ip_tos will be reflected. */ + ip->ip_off = htons(0); ip->ip_ttl = V_ip_defttl; if (optlen > 0) {