From d2311b4517beebda22c76f82a120f7b1f765a79d Mon Sep 17 00:00:00 2001 From: csalinezh Date: Thu, 5 Jan 2023 22:38:31 +0200 Subject: [PATCH] tracepath: restore the MTU probing behaviour since release 20071127 Since 81d0f03 (tracepath: fix IP{V6,}_PMTUDISC_DO values), tracepath shows the PMTU for a target only at the first hop but not the hop where MTU is reduced, if that data has been cached in kernel FIB by previous probing attempts. IP_PMTUDISC_PROBE instructs the kernel to set the Don't Fragment flag while bypassing PMTU checks. Usage of IP_PMTUDISC_PROBE in tracepath was introduced in 37bd60c and mentioned in the release note of 20071127 (1d83610) as a feature. As previously identified in 81d0f03 (appeared in release 20190709), the definition of these options became incorrect during a copy refactoring in d3028f1 (in release 20100418). The value for IP_PMTUDISC_PROBE continued to be used until 81d0f03 when the correct definition of IP_PMTUDISC_DO was adopted, thus causing a regression. This commit resotres the previous behaviour by adopting IP_PMTUDISC_PROBE. Fixes: d3028f1, 81d0f03 Signed-off-by: Charles Zhang --- iputils_common.h | 6 ++++++ tracepath.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/iputils_common.h b/iputils_common.h index 67b495ef..49e790d8 100644 --- a/iputils_common.h +++ b/iputils_common.h @@ -55,6 +55,12 @@ #ifndef IPV6_PMTUDISC_DO # define IPV6_PMTUDISC_DO 2 #endif +#ifndef IP_PMTUDISC_PROBE +# define IP_PMTUDISC_PROBE 3 +#endif +#ifndef IPV6_PMTUDISC_PROBE +# define IPV6_PMTUDISC_PROBE 3 +#endif #ifdef HAVE_ERROR_H # include diff --git a/tracepath.c b/tracepath.c index 4d2a9acf..ebb7f72f 100644 --- a/tracepath.c +++ b/tracepath.c @@ -532,7 +532,7 @@ int main(int argc, char **argv) if (ctl.mtu <= ctl.overhead) goto pktlen_error; - on = IPV6_PMTUDISC_DO; + on = IPV6_PMTUDISC_PROBE; if (setsockopt(ctl.socket_fd, SOL_IPV6, IPV6_MTU_DISCOVER, &on, sizeof(on)) && (on = IPV6_PMTUDISC_DO, setsockopt(ctl.socket_fd, SOL_IPV6, IPV6_MTU_DISCOVER, &on, sizeof(on)))) @@ -557,7 +557,7 @@ int main(int argc, char **argv) if (ctl.mtu <= ctl.overhead) goto pktlen_error; - on = IP_PMTUDISC_DO; + on = IP_PMTUDISC_PROBE; if (setsockopt(ctl.socket_fd, SOL_IP, IP_MTU_DISCOVER, &on, sizeof(on))) error(1, errno, "IP_MTU_DISCOVER"); on = 1;