diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-03-20 16:33:39 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-03-20 09:34:08 +0100 |
commit | 639fdf06edecfa0f61eaa55753edb6f3fae9fcef (patch) | |
tree | db8e418609c7b90eb4d9d0ec21b0e06c8e5ace80 /checksum.h | |
parent | d35bcbee9009b847fe635a4e298a084ade7b81ca (diff) | |
download | passt-639fdf06edecfa0f61eaa55753edb6f3fae9fcef.tar passt-639fdf06edecfa0f61eaa55753edb6f3fae9fcef.tar.gz passt-639fdf06edecfa0f61eaa55753edb6f3fae9fcef.tar.bz2 passt-639fdf06edecfa0f61eaa55753edb6f3fae9fcef.tar.lz passt-639fdf06edecfa0f61eaa55753edb6f3fae9fcef.tar.xz passt-639fdf06edecfa0f61eaa55753edb6f3fae9fcef.tar.zst passt-639fdf06edecfa0f61eaa55753edb6f3fae9fcef.zip |
netlink: Fix selection of template interface
Since f919dc7a4b1c ("conf, netlink: Don't require a default route to
start"), if there is only one host interface with routes, we will pick that
as the template interface, even if there are no default routes for an IP
version. Unfortunately this selection had a serious flaw: in some cases
it would 'return' in the middle of an nl_foreach() loop, meaning we
wouldn't consume all the netlink responses for our query. This could cause
later netlink operations to fail as we read leftover responses from the
aborted query.
Rewrite the interface detection to avoid this problem. While we're there:
* Perform detection of both default and non-default routes in a single
pass, avoiding an ugly goto
* Give more detail on error and working but unusual paths about the
situation (no suitable interface, multiple possible candidates, etc.).
Fixes: f919dc7a4b1c ("conf, netlink: Don't require a default route to start")
Link: https://bugs.passt.top/show_bug.cgi?id=83
Link: https://github.com/containers/podman/issues/22052
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2270257
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[sbrivio: Use info(), not warn() for somewhat expected cases where one
IP version has no default routes, or no routes at all]
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'checksum.h')
0 files changed, 0 insertions, 0 deletions