]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/io: log another message if `freebind` isn't supported
authorVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 24 Aug 2022 08:58:26 +0000 (10:58 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 24 Aug 2022 09:00:26 +0000 (11:00 +0200)
So far the message wasn't pointing to freebind at all:
[net   ] bind to '::1@53' (UDP): Operation not supported

I used preprocessor to avoid duplication and unused warnings.

Another way would be to ignore the freebind option if not supported,
but I think it's better to convince users not to specify it.

daemon/io.c

index 824a4b9f59d60daaa1364584814bb36bd71ba96a..4d85792410e9d9c3d1a4577048fa8789ac462c13 100644 (file)
@@ -148,6 +148,8 @@ void udp_recv(uv_udp_t *handle, ssize_t nread, const uv_buf_t *buf,
 
 static int family_to_freebind_option(sa_family_t sa_family, int *level, int *name)
 {
+#define LOG_NO_FB kr_log_error(NETWORK, "your system does not support 'freebind', " \
+                               "please remove it from your configuration\n")
        switch (sa_family) {
        case AF_INET:
                *level = IPPROTO_IP;
@@ -156,6 +158,7 @@ static int family_to_freebind_option(sa_family_t sa_family, int *level, int *nam
 #elif defined(IP_BINDANY)
                *name = IP_BINDANY;
 #else
+               LOG_NO_FB;
                return kr_error(ENOTSUP);
 #endif
                break;
@@ -167,6 +170,7 @@ static int family_to_freebind_option(sa_family_t sa_family, int *level, int *nam
                *level = IPPROTO_IPV6;
                *name = IPV6_BINDANY;
 #else
+               LOG_NO_FB;
                return kr_error(ENOTSUP);
 #endif
                break;