iproute2mac icon indicating copy to clipboard operation
iproute2mac copied to clipboard

Fix return status for ip route -6 get default

Open kbrock opened this issue 1 year ago • 1 comments

If there is no default for a ipv6 default route, Ubuntu just returns an empty result.

So this change just mimics linux's ip behavior.

Before

$ ./src/ip.py -6 -json route get default
route: writing to routing socket: not in table

After

$ ./src/ip.py -6 route get default
$ ./src/ip.py -6 -json route get default
[]

kbrock avatar Dec 04 '24 20:12 kbrock

Thanks you for the PR and sorry for the delay. Can you please provide output from the ubuntu? This is what I am seeing on one of my Debian machines:

user@debian:~$ ip -V
ip utility, iproute2-6.1.0, libbpf 1.1.0

user@debian:~$ ip -6 r
fe80::/64 dev enp1s0 proto kernel metric 256 pref medium

user@debian:~$ ip -6 route get default
Warning: /0 as prefix is invalid, only /128 (or none) is supported.
RTNETLINK answers: Network is unreachable

user@debian:~$ echo $?
2

I want to make sure we return identical error code as well in this case.

brona avatar Feb 01 '25 11:02 brona

Did you have chance to look into this again?

brona avatar Apr 16 '25 19:04 brona

Closing for no reply over 3+ months to my previous question, feel free to re-open. And if this is fixing a bug, please file a bug report first.

brona avatar Jul 29 '25 14:07 brona

thank you. Sorry I zoned out on you

kbrock avatar Jul 29 '25 15:07 kbrock