diff options
| author | Hayato Kiwata <dev@haytok.jp> | 2026-08-22 17:48:56 +0900 |
|---|---|---|
| committer | Stefano Brivio <sbrivio@redhat.com> | 2026-09-01 17:04:35 +0200 |
| commit | 7e8d49b8a6b501b9eb9caf44cf1f653fd2a385b5 (patch) | |
| tree | cc5d21ace94eab6e3de59ac831d97e06a47cb92a | |
| parent | defc25b9444c508d21badb6bc9a0b835ddd01126 (diff) | |
| download | passt-master.tar passt-master.tar.gz passt-master.tar.bz2 passt-master.tar.lz passt-master.tar.xz passt-master.tar.zst passt-master.zip | |
Suppose there is a single network interface on the host, with two
addresses of different prefixes assigned to it.
In this situation, running pasta to create an isolated netns prints
"Multiple interfaces with %s routes, picked first", even though there
is in fact only one candidate interface.
Reproducer:
sudo ip link add dummy42 type dummy
sudo ip link set dev dummy42 up
sudo ip addr add fdaa:aaaa:aaaa::1/64 dev dummy42
sudo ip addr add fdbb:bbbb:bbbb::1/64 dev dummy42
pasta --config-net -- true
This message is meant to indicate that there are multiple candidate
interfaces, but in fact there is only one, which can mislead users.
Therefore, avoid printing this message when there are multiple non-default
routes that all belong to the same interface.
Fixes: 450a6131beab ("netlink: With no default route, pick the first interface with a route")
Signed-off-by: Hayato Kiwata <dev@haytok.jp>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
| -rw-r--r-- | netlink.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -271,6 +271,7 @@ unsigned int nl_get_ext_if(int s, sa_family_t af) }; unsigned defifi = 0, anyifi = 0; unsigned ndef = 0, nany = 0; + bool multi_anyif = false; struct nlmsghdr *nh; struct rtattr *rta; char buf[NLBUFSIZ]; @@ -330,6 +331,8 @@ unsigned int nl_get_ext_if(int s, sa_family_t af) nany++; if (!anyifi) anyifi = thisifi; + else if (anyifi != thisifi) + multi_anyif = true; } } @@ -345,7 +348,7 @@ unsigned int nl_get_ext_if(int s, sa_family_t af) } if (anyifi) { - if (nany > 1) { + if (multi_anyif) { info("Multiple interfaces with %s routes, picked first", af_name(af)); } |
