From nobody Tue Nov 17 20:39:38 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jTc6L6MPyz71qWk for ; Tue, 17 Nov 2026 20:39:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jTc6L22Kkz3R75 for ; Tue, 17 Nov 2026 20:39:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794947978; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KK6iDx/VNiD/1yYuVUuefQ3cbuvofJrAXY7Vpnv8as4=; b=ki3mSwOFyKQll4ZoJb00gFThGolo0WLJBT9tvwfWuYMpkzMSn7TFglqfSUTio5LHwu6Qjm F1xzeTCbpgbIHbm+mIhiXiTy4XgCEHEB502B5lv0mmo592YCq/Xj/Mp7E/CEGA1scG7csI b8maUf9pjnxseKkUT/VtN+lgnfA/Yd8KQp2vDlMjjFuhr14OqxAHmmqODH2VuacubiI862 MzFr1tqemLDSI+CmuldcqrAWiSqBGEXvztQKGNREfF73OE67Iuq7GaZ9/nAsYbI2gP8Nzt QeX2SAqwlc1qS6493RE7fAQT9arb0GfBhIq4q7l++YwXPgUyLd3c8K1sARel/A== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794947978; b=lnRqK8o0FvAMeSPDsTyF/d0g3vzxak2IS/4/9s9Tt8rTJG908mJ0Yv/IiknavF5Kzt16fJ yyVM+nEm4YI/gJc5gcZQTt22HqWguaZom+2cNbHoZ03NGZx89QkxRqp4s7h5kWQ5jHIKqG W09xT0rmJty7BiLRlnNwlOKYYlZ+vs7lXjXxdfJUeYCgs3lCmY0vc4hLbVls0x1Bq9+ZcZ IRb3iPUK2UrGYTtpfbVVUMcBSYmKd9ZuFuqroJZcw25aNlqoscLYVwal/QFiL6WiUzLPXG RyXSLG2GxJlryBxHUjY2Oc+01sTadQFRD+JFea/T82E+1dwNTK56edDfm4etwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794947978; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KK6iDx/VNiD/1yYuVUuefQ3cbuvofJrAXY7Vpnv8as4=; b=yNqAuC8Uyr1ZqNcf5xxREqHVd5GRXkrZTOKq1ySl8SiCWcgSBkbeQAxsSaGwcdr5feuuFV pZdCGEBRsoJLlagzlfjI+Q+EuavWV8CeKsXY/lBBouhXORjawpxqRwqU5c8MkHYZLbkfM3 lp5PZ7lQE31uzuLqRmKwdXC6UUCUVLnZ966xY0Ckvrz8aT0UC1ysZG36Mb1BisjPUhruNl x6qTlpWb3TTDmCU59bHdTqy/OUcjVCcSyv+sYfTnDa5KjXurNj7SaZ1J7UdMmx5zip6n69 uXPAQa8Y8++qNqmRnQ4r0aUJdYBejLuOPceZUNKM2CGTtxVo8O2gVnfa9QHP5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jTc6L18cYzyZZ for ; Tue, 17 Nov 2026 20:39:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 163a6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 17 Nov 2026 20:39:38 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Maxim Konovalov Subject: git: d6473780b8d9 - main - traceroute: do not use a stale or NULL quoted header with -E List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: maxim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d6473780b8d9d7ac4a3ed40a455fae6302df708e Auto-Submitted: auto-generated Date: Tue, 17 Nov 2026 20:39:38 +0000 Message-Id: <6afcbb8a.163a6.2d61947@gitrepo.freebsd.org> The branch main has been updated by maxim: URL: https://cgit.FreeBSD.org/src/commit/?id=d6473780b8d9d7ac4a3ed40a455fae6302df708e commit d6473780b8d9d7ac4a3ed40a455fae6302df708e Author: Maxim Konovalov AuthorDate: 2026-11-16 00:28:47 +0000 Commit: Maxim Konovalov CommitDate: 2026-11-17 20:32:52 +0000 traceroute: do not use a stale or NULL quoted header with -E packet_ok() points the global hip at the IP header quoted by an ICMP error message and nothing resets it afterwards. The destination answers an ICMP probe (-I) with an echo reply, which repeats the ICMP data of the probe but not its IP header, so for that reply the main loop used whatever an earlier packet had left in hip. With -E the ECN report for the destination was therefore read from the payload of the echo reply. If no ICMP error had been received before, because the destination is one hop away, the first hops are skipped with -f or the routers on the path are silent, hip was still NULL and traceroute crashed: $ traceroute -E -I 127.0.0.1 traceroute to 127.0.0.1 (127.0.0.1), 64 hops max, 48 byte packets Segmentation fault With -D the stale quote was compared with the probe. Reset hip and hiplen for every received packet and print the ECN report only when there is a quoted header. Document that there is no ECN report for an echo reply. Reviewed by: jlduran, Kevin Day Fixes: 8aafae66394f ("traceroute: Implement ECN bleaching detection") MFC after: 2 weeks Co-Authored-By: Claude Opus 5.5 Differential Revision: https://reviews.freebsd.org/D61606 --- usr.sbin/traceroute/traceroute.8 | 5 ++++- usr.sbin/traceroute/traceroute.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/usr.sbin/traceroute/traceroute.8 b/usr.sbin/traceroute/traceroute.8 index f36d473f2727..a5d102968fbf 100644 --- a/usr.sbin/traceroute/traceroute.8 +++ b/usr.sbin/traceroute/traceroute.8 @@ -18,7 +18,7 @@ .\" .\" $Id: traceroute.8,v 1.19 2000/09/21 08:44:19 leres Exp $ .\" -.Dd May 14, 2025 +.Dd November 15, 2026 .Dt TRACEROUTE 8 .Os .Sh NAME @@ -91,6 +91,9 @@ or mangled them, or if it is experiencing congestion .Pq Dv 11 . Otherwise, report that it passed the bits appropriately. +The report is taken from the probe header quoted in the ICMP error message +sent by the hop, so there is none for a destination which answers an ICMP +probe with an echo reply. If .Fl t is also specified, the corresponding ECN bits will be replaced. diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c index be14c40b8d7b..74e78c16c81b 100644 --- a/usr.sbin/traceroute/traceroute.c +++ b/usr.sbin/traceroute/traceroute.c @@ -1058,7 +1058,7 @@ main(int argc, char **argv) #endif precis = 3; Printf(" %.*f ms", precis, T); - if (ecnflag) { + if (ecnflag && hip != NULL) { u_char ecn = hip->ip_tos & IPTOS_ECN_MASK; switch (ecn) { case IPTOS_ECN_ECT1: @@ -1374,6 +1374,9 @@ packet_ok(register u_char *buf, int cc, register struct sockaddr_in *from, #endif type = icp->icmp_type; code = icp->icmp_code; + /* Forget the header quoted by the previous packet. */ + hip = NULL; + hiplen = 0; /* Path MTU Discovery (RFC1191) */ if (code != ICMP_UNREACH_NEEDFRAG) pmtu = 0;