]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
use addrs for static host ordering in curses 429/head
authorBrandon Ewing <brandon.ewing@warningg.com>
Fri, 13 May 2022 15:27:55 +0000 (10:27 -0500)
committerBrandon Ewing <brandon.ewing@warningg.com>
Fri, 13 May 2022 15:27:55 +0000 (10:27 -0500)
Change d2552ca has the side effect of moving hosts around in the
multipath view, as the last host to reply to a packet was set as
addr.  Using addrs[0] istead of addr to draw the first host keeps
the ordering deterministic, in order of first reply.

ui/curses.c

index d01e178c0d5a641fbe1f1d83a5d961004e38f210..ce662757c1e46c31d5996fa430b04e4971ee6c29 100644 (file)
@@ -421,8 +421,8 @@ static void mtr_curses_hosts(
     for (at = net_min(ctl) + ctl->display_offset; at < max; at++) {
         printw("%2d. ", at + 1);
         err = net_err(at);
-        addr = net_addr(at);
-        mpls = net_mpls(at);
+        addr = net_addrs(at, 0);
+        mpls = net_mplss(at, 0);
 
         addrcmp_result = addrcmp(addr, &ctl->unspec_addr, ctl->af);
 
@@ -471,7 +471,7 @@ static void mtr_curses_hosts(
             }
 
             /* Multi path */
-            for (i = 0; i < MAX_PATH; i++) {
+            for (i = 1; i < MAX_PATH; i++) {
                 addrs = net_addrs(at, i);
                 mplss = net_mplss(at, i);
                 if (addrcmp(addrs, addr, ctl->af) == 0)