]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Fix bug, AI_CANONNAME can only be set when an address is specified
authorpcarana <pc.moreno2099@gmail.com>
Thu, 8 Aug 2019 22:50:22 +0000 (17:50 -0500)
committerpcarana <pc.moreno2099@gmail.com>
Thu, 8 Aug 2019 22:50:22 +0000 (17:50 -0500)
src/rtr/rtr.c

index 88ac2ca5e98a0c8a4b9b516dac52789be911e69b..c148734927625a397a3542742671433ca0e45828 100644 (file)
@@ -40,12 +40,14 @@ init_addrinfo(struct addrinfo **result)
        memset(&hints, 0 , sizeof(hints));
        hints.ai_family = AF_UNSPEC;
        /* hints.ai_socktype = SOCK_DGRAM; */
-       hints.ai_flags |= AI_CANONNAME;
        hints.ai_flags |= AI_PASSIVE;
 
        hostname = config_get_server_address();
        service = config_get_server_port();
 
+       if (hostname != NULL)
+               hints.ai_flags |= AI_CANONNAME;
+
        error = getaddrinfo(hostname, service, &hints, result);
        if (error) {
                pr_err("Could not infer a bindable address out of address '%s' and port '%s': %s",