From 10e850a8602b44ef110f5504062f49dbe0cb2e77 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 2 Dec 2025 15:02:01 +1100 Subject: util: Correct error message on SO_BINDTODEVICE failure 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 Signed-off-by: Stefano Brivio --- util.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util.c b/util.c index 4fdb611..7493f98 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; } -- cgit v1.2.3