[BUG] interface binding: length must include the trailing zero
The interface length passed to the setsockopt(SO_BINDTODEVICE) must
include the trailing \0. Otherwise it will randomly fail.
diff --git a/src/checks.c b/src/checks.c
index 1acff0d..37e0c29 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -594,7 +594,7 @@
/* Note: this might fail if not CAP_NET_RAW */
if (s->iface_name)
setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE,
- s->iface_name, s->iface_len);
+ s->iface_name, s->iface_len + 1);
#endif
ret = tcpv4_bind_socket(fd, flags, &s->source_addr, remote);
if (ret) {
@@ -625,7 +625,7 @@
/* Note: this might fail if not CAP_NET_RAW */
if (s->proxy->iface_name)
setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE,
- s->proxy->iface_name, s->proxy->iface_len);
+ s->proxy->iface_name, s->proxy->iface_len + 1);
#endif
ret = tcpv4_bind_socket(fd, flags, &s->proxy->source_addr, remote);
if (ret) {