make traceroute follow RFC-3484 conditionally

RFC-3484 - Is defining rules for IPv6 address selection.
https://www.rfc-editor.org/info/rfc3484

This patch is adding option to allow traceroute to follow RFC-3484 for IPv6 address selection by setting the environment variable TRACEROUTE_USE_RFC3484.

Modification of upstream patch released in 2.1.6 - upstream tracker https://sourceforge.net/p/traceroute/bugs/16/

Resolves: RHEL-59444
This commit is contained in:
Jan Macku 2024-09-18 14:21:05 +02:00
parent 5cd9bc46d6
commit adef36ad32
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From 614edd1ad7e5d2ec2f5f6c43dc6cae05ac893f48 Mon Sep 17 00:00:00 2001
From: Jan Macku <jamacku@redhat.com>
Date: Wed, 18 Sep 2024 13:02:48 +0200
Subject: [PATCH] make traceroute follow RFC-3484 conditionally
RFC-3484 - Is defining rules for IPv6 address selection.
https://www.rfc-editor.org/info/rfc3484
This patch is adding option to allow traceroute to follow RFC-3484 for IPv6 address selection by setting the environment variable TRACEROUTE_USE_RFC3484.
Modification of upstream patch released in 2.1.6 - upstream tracker https://sourceforge.net/p/traceroute/bugs/16/
Resolves: RHEL-59444
---
traceroute/traceroute.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/traceroute/traceroute.c b/traceroute/traceroute.c
index 0a29e36..f755a24 100644
--- a/traceroute/traceroute.c
+++ b/traceroute/traceroute.c
@@ -210,10 +210,15 @@ static int getaddr (const char *name, sockaddr_any *addr) {
}
for (ai = res; ai; ai = ai->ai_next) {
+ if (!getenv("TRACEROUTE_USE_RFC3484")) {
if (ai->ai_family == af) break;
/* when af not specified, choose DEF_AF if present */
if (!af && ai->ai_family == DEF_AF)
break;
+ } else {
+ if (!af || ai->ai_family == af)
+ break;
+ }
}
if (!ai) ai = res; /* anything... */
--
2.46.0

View File

@ -2,7 +2,7 @@ Summary: Traces the route taken by packets over an IPv4/IPv6 network
Name: traceroute
Epoch: 3
Version: 2.1.0
Release: 18%{?dist}
Release: 19%{?dist}
License: GPLv2+
URL: http://traceroute.sourceforge.net
Source0: https://downloads.sourceforge.net/project/traceroute/traceroute/traceroute-%{version}/traceroute-%{version}.tar.gz
@ -10,6 +10,9 @@ Source0: https://downloads.sourceforge.net/project/traceroute/traceroute/tracero
Patch001: 001-review-of-CWE-170-CWE-772.patch
Patch002: 002-traceroute-CVE-2023-46316.patch
# Downstream only patches
Patch100: 100-make-traceroute-follow-RFC-3484-conditionally.patch
Provides: tcptraceroute = 1.5-1
Obsoletes: tcptraceroute < 1.5-1
@ -54,6 +57,9 @@ ln -s traceroute.8 $RPM_BUILD_ROOT%{_mandir}/man8/tcptraceroute.8
%changelog
* Wed Sep 18 2024 Jan Macku <jamacku@redhat.com> - 3:2.1.0-19
- make traceroute follow RFC-3484 conditionally (RHEL-58449)
* Mon Nov 27 2023 Jan Macku <jamacku@redhat.com> - 3:2.1.0-18
- add gating.yaml