|
|
| version 1.1, 2019/10/21 14:25:31 | version 1.1.1.2, 2021/03/17 00:07:30 |
|---|---|
| Line 11 | Line 11 |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. | GNU General Public License for more details. |
| You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License along |
| along with this program; if not, write to the Free Software | with this program; if not, write to the Free Software Foundation, Inc., |
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| */ | */ |
| #include "config.h" | #include "config.h" |
| Line 157 int mtr_curses_keyaction( | Line 157 int mtr_curses_keyaction( |
| switch (c) { | switch (c) { |
| case 'q': | case 'q': |
| case -1: | |
| case 3: | case 3: |
| return ActionQuit; | return ActionQuit; |
| case 12: | case 12: |
| Line 235 int mtr_curses_keyaction( | Line 236 int mtr_curses_keyaction( |
| if (f <= 0.0) | if (f <= 0.0) |
| return ActionNone; | return ActionNone; |
| if (getuid() != 0 && f < 1.0) | if (!running_as_root() && (f < 1.0)) |
| return ActionNone; | return ActionNone; |
| ctl->WaitTime = f; | ctl->WaitTime = f; |
| Line 363 int mtr_curses_keyaction( | Line 364 int mtr_curses_keyaction( |
| (" b <c> set ping bit pattern to c(0..255) or random(c<0)\n"); | (" b <c> set ping bit pattern to c(0..255) or random(c<0)\n"); |
| printw(" Q <t> set ping packet's TOS to t\n"); | printw(" Q <t> set ping packet's TOS to t\n"); |
| printw(" u switch between ICMP ECHO and UDP datagrams\n"); | printw(" u switch between ICMP ECHO and UDP datagrams\n"); |
| printw(" t switch between ICMP ECHO and TCP\n"); | |
| #ifdef HAVE_IPINFO | #ifdef HAVE_IPINFO |
| printw(" y switching IP info\n"); | printw(" y switching IP info\n"); |
| printw(" z toggle ASN info on/off\n"); | printw(" z toggle ASN info on/off\n"); |
| Line 404 static void mtr_curses_hosts( | Line 406 static void mtr_curses_hosts( |
| int at; | int at; |
| struct mplslen *mpls, *mplss; | struct mplslen *mpls, *mplss; |
| ip_t *addr, *addrs; | ip_t *addr, *addrs; |
| int addrcmp_result; | |
| int err; | |
| int y; | int y; |
| char *name; | char *name; |
| Line 416 static void mtr_curses_hosts( | Line 420 static void mtr_curses_hosts( |
| for (at = net_min(ctl) + ctl->display_offset; at < max; at++) { | for (at = net_min(ctl) + ctl->display_offset; at < max; at++) { |
| printw("%2d. ", at + 1); | printw("%2d. ", at + 1); |
| err = net_err(at); | |
| addr = net_addr(at); | addr = net_addr(at); |
| mpls = net_mpls(at); | mpls = net_mpls(at); |
| if (addrcmp((void *) addr, (void *) &ctl->unspec_addr, ctl->af) != | addrcmp_result = addrcmp(addr, &ctl->unspec_addr, ctl->af); |
| 0) { | |
| if (err == 0 && addrcmp_result != 0) { | |
| name = dns_lookup(ctl, addr); | name = dns_lookup(ctl, addr); |
| if (!net_up(at)) | if (!net_up(at)) |
| attron(A_BOLD); | attron(A_BOLD); |
| Line 459 static void mtr_curses_hosts( | Line 465 static void mtr_curses_hosts( |
| printw("%s", buf); | printw("%s", buf); |
| for (k = 0; k < mpls->labels && ctl->enablempls; k++) { | for (k = 0; k < mpls->labels && ctl->enablempls; k++) { |
| printw("\n [MPLS: Lbl %lu Exp %u S %u TTL %u]", | printw("\n [MPLS: Lbl %lu TC %u S %u TTL %u]", |
| mpls->label[k], mpls->exp[k], mpls->s[k], | mpls->label[k], mpls->tc[k], mpls->s[k], |
| mpls->ttl[k]); | mpls->ttl[k]); |
| } | } |
| /* Multi path */ | /* Multi path */ |
| for (i = 0; i < MAXPATH; i++) { | for (i = 0; i < MAX_PATH; i++) { |
| addrs = net_addrs(at, i); | addrs = net_addrs(at, i); |
| mplss = net_mplss(at, i); | mplss = net_mplss(at, i); |
| if (addrcmp((void *) addrs, (void *) addr, ctl->af) == 0) | if (addrcmp(addrs, addr, ctl->af) == 0) |
| continue; | continue; |
| if (addrcmp | if (addrcmp(addrs, &ctl->unspec_addr,ctl->af) == 0) |
| ((void *) addrs, (void *) &ctl->unspec_addr, | |
| ctl->af) == 0) | |
| break; | break; |
| name = dns_lookup(ctl, addrs); | name = dns_lookup(ctl, addrs); |
| Line 492 static void mtr_curses_hosts( | Line 496 static void mtr_curses_hosts( |
| printw("%s", strlongip(ctl, addrs)); | printw("%s", strlongip(ctl, addrs)); |
| } | } |
| for (k = 0; k < mplss->labels && ctl->enablempls; k++) { | for (k = 0; k < mplss->labels && ctl->enablempls; k++) { |
| printw("\n [MPLS: Lbl %lu Exp %u S %u TTL %u]", | printw("\n [MPLS: Lbl %lu TC %u S %u TTL %u]", |
| mplss->label[k], mplss->exp[k], mplss->s[k], | mplss->label[k], mplss->tc[k], mplss->s[k], |
| mplss->ttl[k]); | mplss->ttl[k]); |
| } | } |
| attroff(A_BOLD); | attroff(A_BOLD); |
| } | } |
| } else { | } else { |
| printw("???"); | attron(A_BOLD); |
| printw("(%s)", host_error_to_string(err)); | |
| attroff(A_BOLD); | |
| } | } |
| printw("\n"); | printw("\n"); |
| Line 618 static void mtr_curses_graph( | Line 623 static void mtr_curses_graph( |
| int startstat, | int startstat, |
| int cols) | int cols) |
| { | { |
| int max, at, y; | int max, at, y, err; |
| ip_t *addr; | ip_t *addr; |
| char *name; | char *name; |
| int __unused_int ATTRIBUTE_UNUSED; | int __unused_int ATTRIBUTE_UNUSED; |
| Line 629 static void mtr_curses_graph( | Line 634 static void mtr_curses_graph( |
| printw("%2d. ", at + 1); | printw("%2d. ", at + 1); |
| addr = net_addr(at); | addr = net_addr(at); |
| err = net_err(at); | |
| if (!addr) { | if (!addr) { |
| printw("???\n"); | printw("(%s)", host_error_to_string(err)); |
| continue; | continue; |
| } | } |
| if (!net_up(at)) | if (err == 0 |
| attron(A_BOLD); | && addrcmp(addr, &ctl->unspec_addr, ctl->af)) { |
| if (addrcmp((void *) addr, (void *) &ctl->unspec_addr, ctl->af)) { | |
| if (!net_up(at)) { | |
| attron(A_BOLD); | |
| } | |
| #ifdef HAVE_IPINFO | #ifdef HAVE_IPINFO |
| if (is_printii(ctl)) | if (is_printii(ctl)) |
| printw(fmt_ipinfo(ctl, addr)); | printw(fmt_ipinfo(ctl, addr)); |
| #endif | #endif |
| name = dns_lookup(ctl, addr); | name = dns_lookup(ctl, addr); |
| printw("%s", name ? name : strlongip(ctl, addr)); | printw("%s", name ? name : strlongip(ctl, addr)); |
| } else | } else { |
| printw("???"); | attron(A_BOLD); |
| printw("(%s)", host_error_to_string(err)); | |
| } | |
| attroff(A_BOLD); | attroff(A_BOLD); |
| getyx(stdscr, y, __unused_int); | getyx(stdscr, y, __unused_int); |
| Line 684 void mtr_curses_redraw( | Line 698 void mtr_curses_redraw( |
| pwcenter(buf); | pwcenter(buf); |
| attroff(A_BOLD); | attroff(A_BOLD); |
| mvprintw(1, 0, "%s (%s)", ctl->LocalHostname, net_localaddr()); | mvprintw(1, 0, "%s (%s) -> %s", ctl->LocalHostname, net_localaddr(), ctl->Hostname); |
| t = time(NULL); | t = time(NULL); |
| mvprintw(1, maxx - 25, iso_time(&t)); | mvprintw(1, maxx - 25, iso_time(&t)); |
| printw("\n"); | printw("\n"); |