]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix for unbound-control on Windows and set TCP socket parameters
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 19 Jun 2018 09:40:59 +0000 (09:40 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 19 Jun 2018 09:40:59 +0000 (09:40 +0000)
  more closely.

git-svn-id: file:///svn/unbound/trunk@4743 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
smallapp/unbound-control.c

index 1fb7bd4548f0c8ca27402f338d7031730226c6a5..c1e3f2d6119f1668388887d957ac03d582f2642d 100644 (file)
@@ -1,3 +1,7 @@
+19 June 2018: Wouter
+       - Fix for unbound-control on Windows and set TCP socket parameters
+         more closely.
+
 18 June 2018: Wouter
        - Fix that control-use-cert: no works for 127.0.0.1 to disable certs.
          This fix is part of 1.7.3rc2.
index e31ca7f907a6842fc5025ae66b7d8b306c74dc57..c794e4258e69082bf5dd023fbec5ec7d50367ce0 100644 (file)
@@ -489,7 +489,7 @@ contact_server(const char* svr, struct config_file* cfg, int statuscmd)
 {
        struct sockaddr_storage addr;
        socklen_t addrlen;
-       int addrfamily = 0;
+       int addrfamily = 0, proto = IPPROTO_TCP;
        int fd, useport = 1;
        /* use svr or the first config entry */
        if(!svr) {
@@ -523,6 +523,7 @@ contact_server(const char* svr, struct config_file* cfg, int statuscmd)
                addrlen = (socklen_t)sizeof(struct sockaddr_un);
                addrfamily = AF_LOCAL;
                useport = 0;
+               proto = 0;
 #endif
        } else {
                if(!ipstrtoaddr(svr, cfg->control_port, &addr, &addrlen))
@@ -530,8 +531,8 @@ contact_server(const char* svr, struct config_file* cfg, int statuscmd)
        }
 
        if(addrfamily == 0)
-               addrfamily = addr_is_ip6(&addr, addrlen)?AF_INET6:AF_INET;
-       fd = socket(addrfamily, SOCK_STREAM, 0);
+               addrfamily = addr_is_ip6(&addr, addrlen)?PF_INET6:PF_INET;
+       fd = socket(addrfamily, SOCK_STREAM, proto);
        if(fd == -1) {
 #ifndef USE_WINSOCK
                fatal_exit("socket: %s", strerror(errno));