Page MenuHomeVyOS Platform

Convert 'traceroute' operation to the new syntax and expand available options using python
Needs testing, Requires assessmentPublic

Description

Rewrite 'traceroute' in python re-using the same logic and code as for 'ping' op-mode. The main reason is to simplify adding options for the 'traceroute' (there is a lack of options, such as no possibility to show source interface/address, check backwards-hops count, choose between ICMP/UDP/TCP, specify TTL, etc.). Not sure if the structure is fully compatible with the requirements for the command. The current implementation for 'ping' is not able to display help descriptions for the available command options:

[email protected]:~$ ping 8.8.8.8
Possible completions:
  <Enter>       Execute the current command
  adaptive      Ping options
  allow-broadcast
  audible
  bypass-route
  count
  deadline
  do-not-fragment
  flood
  interface
  interval
  mark
  no-loopback
  numeric
  pattern
  quiet
  record-route
  size
  source-address
  timestamp
  tos
  ttl
  verbose
  vrf

The same happens when re-using similar logic with 'traceroute':

[email protected]:~$ traceroute 8.8.8.8
Possible completions:
  <Enter>       Execute the current command
  backward-hops Traceroute options
  bypass
  do-not-fragment
  first-ttl
  icmp
  interface
  lookup-as
  mark
  no-resolve
  port
  source-address
  tcp
  tos
  ttl
  udp
  vrf

Maybe we can use this as a temporary replacement until a better solution is found. Maybe all similar op-mode commands can have the same structure and use the same logic for future simplicity, code reuse and standardized implementation (such as ping, traceroute, ssh, SCP, telnet, FTP, etc.)?

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Unspecified (please specify)

Event Timeline

Viacheslav changed the task status from Open to Needs testing.Sun, May 8, 9:39 AM

Tested on the latest rolling release:

[email protected]:~$ show version

Version:          VyOS 1.4-rolling-202205080844
Release train:    sagitta

Built by:         [email protected]
Built on:         Sun 08 May 2022 08:44 UTC
Build UUID:       eaac6278-bcd7-4e7d-8fc8-bf9fc0c6be4d
Build commit ID:  992c7b5e8a4e25

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  QEMU
Hardware model:   Standard PC (i440FX + PIIX, 1996)
Hardware S/N:
Hardware UUID:    fee7cae1-ff46-4c42-b1be-17dfd5aec277

Copyright:        VyOS maintainers and contributors

IPv4

[email protected]:~$ traceroute 8.8.8.8 interface eth0 source-address 192.168.100.13 backward-hops do-not-fragment first-ttl 2 ttl 50 lookup-as no-resolve vrf default
traceroute to 8.8.8.8 (8.8.8.8), 50 hops max, 60 byte packets
 2  192.168.99.1 [!!]  3.883 ms  3.796 ms  3.761 ms
 3  31.146.255.66 [!!]  9.406 ms  9.344 ms  9.305 ms
 4  188.123.128.0 [!!]  4.074 ms  4.028 ms  3.961 ms
 5  188.123.128.1 [!!]  4.176 ms 188.123.128.15 [!!]  4.128 ms  4.077 ms
 6  72.14.242.73 [!!] '-5'  4.029 ms  3.981 ms 72.14.242.72 [!!]  71.086 ms
 7  72.14.242.72 [!!] '-6'  66.561 ms 108.170.252.65 [!!] '-8'  72.090 ms 72.14.242.72 [!!] '-6'  64.670 ms
 8  108.170.252.1 [!!]  70.028 ms 108.170.251.129 [!!]  68.670 ms 142.250.214.189 [!!] '-9'  69.939 ms
 9  66.249.95.169 [!!]  69.837 ms 142.250.46.247 [!!]  66.076 ms 8.8.8.8 [!!] '-11'  64.807 ms

IPv6

[email protected]:~$ traceroute 2001:cafe::1 backward-hops do-not-fragment first-ttl 2 ttl 50 interface bond0 source-address 2001:beaf::1 vrf default no-resolve
traceroute to 2001:cafe::1 (2001:cafe::1), 50 hops max, 80 byte packets
 2  2001:face::2  1.644 ms  1.544 ms  1.511 ms
 3  2001:cafe::1  2.382 ms  2.352 ms  2.328 ms