The warning message we print of SO_BINDTODEVICE fails is incorrect: we
include EPOLL_TYPE_STR(proto), but the proto variable is not an epoll type
so this will generate misleading garbage. This has been wrong ever since
340164445 but the message is rare enough that we never noticed.
Correct that, and reword the message a bit for clarity while we're
there.
Fixes: 340164445341 ("epoll: Generalize epoll_ref to cover things other than sockets")
Signed-off-by: David Gibson
---
util.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/util.c b/util.c
index ab23463b..347f34f5 100644
--- a/util.c
+++ b/util.c
@@ -126,9 +126,10 @@ int sock_l4_sa(const struct ctx *c, enum epoll_type type,
char str[SOCKADDR_STRLEN];
ret = -errno;
- warn("Can't bind %s socket for %s to %s, closing",
- EPOLL_TYPE_STR(proto),
- sockaddr_ntop(sa, str, sizeof(str)), ifname);
+ warn("SO_BINDTODEVICE %s failed for %s on %s: %s",
+ ifname, EPOLL_TYPE_STR(type),
+ sockaddr_ntop(sa, str, sizeof(str)),
+ strerror_(-ret));
close(fd);
return ret;
}
--
2.51.1