aboutgitcodebugslistschat
diff options
context:
space:
mode:
-rw-r--r--netlink.c16
-rw-r--r--passt.14
2 files changed, 10 insertions, 10 deletions
diff --git a/netlink.c b/netlink.c
index d3bea68..0221a53 100644
--- a/netlink.c
+++ b/netlink.c
@@ -269,8 +269,7 @@ unsigned int nl_get_ext_if(int s, sa_family_t af)
size_t na;
/* Look for an interface with a default route first, failing that, look
- * for any interface with a route, and pick it only if it's the only
- * interface with a route.
+ * for any interface with a route, and pick the first one, if any.
*/
seq = nl_send(s, &req, RTM_GETROUTE, NLM_F_DUMP, sizeof(req));
nl_foreach_oftype(nh, status, s, buf, seq, RTM_NEWROUTE) {
@@ -324,18 +323,19 @@ unsigned int nl_get_ext_if(int s, sa_family_t af)
warn("netlink: RTM_GETROUTE failed: %s", strerror(-status));
if (defifi) {
- if (ndef > 1)
+ if (ndef > 1) {
info("Multiple default %s routes, picked first",
af_name(af));
+ }
return defifi;
}
if (anyifi) {
- if (nany == 1)
- return anyifi;
-
- info("Multiple interfaces with %s routes, use -i to select one",
- af_name(af));
+ if (nany > 1) {
+ info("Multiple interfaces with %s routes, picked first",
+ af_name(af));
+ }
+ return anyifi;
}
if (!nany)
diff --git a/passt.1 b/passt.1
index 3a23a43..15eb336 100644
--- a/passt.1
+++ b/passt.1
@@ -149,8 +149,8 @@ This option can be specified zero (for defaults) to two times (once for IPv4,
once for IPv6).
By default, assigned IPv4 and IPv6 addresses are taken from the host interfaces
with the first default route, if any, for the corresponding IP version. If no
-default routes are available and there is just one interface with any route,
-that interface will be chosen instead.
+default routes are available and there is any interface with any route for a
+given IP version, the first of these interfaces will be chosen instead.
.TP
.BR \-n ", " \-\-netmask " " \fImask