]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
Changed how conflicitng first/max TTL works.
authorR.E. Wolff <R.E.Wolff@BitWizard.nl>
Wed, 5 Feb 2025 12:34:05 +0000 (13:34 +0100)
committerR.E. Wolff <R.E.Wolff@BitWizard.nl>
Wed, 5 Feb 2025 12:34:05 +0000 (13:34 +0100)
.gitignore
ui/mtr.c

index 887cc01b03b7353901c2a4c2f1b6ea8fea8b3d93..ba54f42bded48f62ba1fef4c6cd4e2dbe9b48e39 100644 (file)
@@ -43,3 +43,4 @@ stamp-h1*
 
 /mtr-*.tar.gz
 *.swp
+*~
index 49e9f9f1a6bc32f66447f7e7dd6b88e32d3ce1f1..d47e75c5c09647bb78cabe3732410a987c6643ad 100644 (file)
--- 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;