From 46d03b86a618d06f448f107dbea80e916dc58894 Mon Sep 17 00:00:00 2001 From: Tim Niemeyer Date: Tue, 3 Apr 2018 19:37:27 +0200 Subject: [PATCH] server: bind to device, too --- macnockserver.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macnockserver.c b/macnockserver.c index be553d3..9ddf0a0 100644 --- a/macnockserver.c +++ b/macnockserver.c @@ -45,6 +45,11 @@ void macNockServer_run() return; } + if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, g_interface, strlen(g_interface)) < 0) + { + perror("[c] WARNING: Can't bind to device"); + } + // allow to reuse the port immediately as soon as the service exits. int sockoptval = 1; if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &sockoptval, sizeof(int)) != 0)