From 7a8f545bc0595b097a8a1241b93afe374419e4e0 Mon Sep 17 00:00:00 2001 From: "R.E. Wolff" Date: Wed, 5 Feb 2025 13:34:05 +0100 Subject: [PATCH] Changed how conflicitng first/max TTL works. --- .gitignore | 1 + ui/mtr.c | 19 +++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 887cc01..ba54f42 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,4 @@ stamp-h1* /mtr-*.tar.gz *.swp +*~ diff --git a/ui/mtr.c b/ui/mtr.c index 49e9f9f..d47e75c 100644 --- a/ui/mtr.c +++ b/ui/mtr.c @@ -476,11 +476,7 @@ static void parse_arg( } break; case 'f': - ctl->fstTTL = - strtonum_or_err(optarg, "invalid argument", STRTO_INT); - if (ctl->fstTTL > ctl->maxTTL) { - ctl->fstTTL = ctl->maxTTL; - } + ctl->fstTTL = strtonum_or_err(optarg, "invalid argument", STRTO_INT); if (ctl->fstTTL < 1) { /* prevent 0 hop */ ctl->fstTTL = 1; } @@ -489,17 +485,13 @@ static void parse_arg( read_from_file(names, optarg); break; case 'm': - ctl->maxTTL = - strtonum_or_err(optarg, "invalid argument", STRTO_INT); + ctl->maxTTL = strtonum_or_err(optarg, "invalid argument", STRTO_INT); if (ctl->maxTTL > (MaxHost - 1)) { ctl->maxTTL = MaxHost - 1; } if (ctl->maxTTL < 1) { /* prevent 0 hop */ ctl->maxTTL = 1; } - if (ctl->fstTTL > ctl->maxTTL) { /* don't know the pos of -m or -f */ - ctl->fstTTL = ctl->maxTTL; - } break; case 'U': ctl->maxUnknown = @@ -650,6 +642,13 @@ static void parse_arg( ctl->DisplayMode == DisplayRaw || ctl->DisplayMode == DisplayCSV) ctl->Interactive = 0; + if (ctl->fstTTL > ctl->maxTTL) { + fprintf (stderr, "%s: firstTTL(%d) cannot be larger than maxTTL(%d). \n", + argv[0], ctl->fstTTL, ctl->maxTTL); + exit (1); + //ctl->fstTTL = ctl->maxTTL; + } + if (optind > argc - 1) return; -- 2.47.2