cmd_config: replace action magic numbers with enum
[tinc] / src / net_socket.c
index a29398d..dfee573 100644 (file)
@@ -25,6 +25,7 @@
 #include "address_cache.h"
 #include "conf.h"
 #include "connection.h"
+#include "crypto.h"
 #include "list.h"
 #include "logger.h"
 #include "names.h"
@@ -46,7 +47,7 @@ int fwmark;
 
 listen_socket_t listen_socket[MAXSOCKETS];
 int listen_sockets;
-#ifndef HAVE_MINGW
+#ifndef HAVE_WINDOWS
 io_t unix_socket;
 #endif
 
@@ -115,7 +116,7 @@ static bool bind_to_interface(int sd) {
        int status;
 #endif /* defined(SOL_SOCKET) && defined(SO_BINDTODEVICE) */
 
-       if(!get_config_string(lookup_config(config_tree, "BindToInterface"), &iface)) {
+       if(!get_config_string(lookup_config(&config_tree, "BindToInterface"), &iface)) {
                return true;
        }
 
@@ -216,7 +217,7 @@ int setup_listen_socket(const sockaddr_t *sa) {
 #endif
 
        if(get_config_string
-                       (lookup_config(config_tree, "BindToInterface"), &iface)) {
+                       (lookup_config(&config_tree, "BindToInterface"), &iface)) {
 #if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE)
                struct ifreq ifr;
 
@@ -408,7 +409,7 @@ void retry_outgoing(outgoing_t *outgoing) {
        }
 
        timeout_add(&outgoing->ev, retry_outgoing_handler, outgoing, &(struct timeval) {
-               outgoing->timeout, rand() % 100000
+               outgoing->timeout, jitter()
        });
 
        logger(DEBUG_CONNECTIONS, LOG_NOTICE, "Trying to re-establish outgoing connection in %d seconds", outgoing->timeout);
@@ -424,7 +425,7 @@ void finish_connecting(connection_t *c) {
 }
 
 static void do_outgoing_pipe(connection_t *c, const char *command) {
-#ifndef HAVE_MINGW
+#ifndef HAVE_WINDOWS
        int fd[2];
 
        if(socketpair(AF_UNIX, SOCK_STREAM, 0, fd)) {
@@ -782,7 +783,7 @@ void handle_new_meta_connection(void *data, int flags) {
        c->allow_request = ID;
 }
 
-#ifndef HAVE_MINGW
+#ifndef HAVE_WINDOWS
 /*
   accept a new UNIX socket connection
 */
@@ -829,7 +830,7 @@ void try_outgoing_connections(void) {
 
        /* Make sure there is one outgoing_t in the list for each ConnectTo. */
 
-       for(config_t *cfg = lookup_config(config_tree, "ConnectTo"); cfg; cfg = lookup_config_next(config_tree, cfg)) {
+       for(config_t *cfg = lookup_config(&config_tree, "ConnectTo"); cfg; cfg = lookup_config_next(&config_tree, cfg)) {
                char *name;
                get_config_string(cfg, &name);