/*
net_socket.c -- Handle various kinds of sockets.
Copyright (C) 1998-2005 Ivo Timmermans,
- 2000-2014 Guus Sliepen <guus@tinc-vpn.org>
+ 2000-2016 Guus Sliepen <guus@tinc-vpn.org>
2006 Scott Lamb <slamb@slamb.org>
2009 Florian Forster <octo@verplant.org>
option = IPTOS_LOWDELAY;
setsockopt(c->socket, SOL_IP, IP_TOS, (void *)&option, sizeof option);
#endif
+
+#if defined(IPPROTO_IPV6) && defined(IPV6_TCLASS) && defined(IPTOS_LOWDELAY)
+ option = IPTOS_LOWDELAY;
+ setsockopt(c->socket, IPPROTO_IPV6, IPV6_TCLASS, (void *)&option, sizeof option);
+#endif
}
static bool bind_to_interface(int sd) {
/* Now that there is a working socket, fill in the rest and register this connection. */
+ c->last_ping_time = time(NULL);
c->status.connecting = true;
c->name = xstrdup(outgoing->name);
#ifndef DISABLE_LEGACY
if(n && n->connection) {
logger(DEBUG_CONNECTIONS, LOG_INFO, "Already connected to %s", outgoing->name);
-
- n->connection->outgoing = outgoing;
- return;
+ if(!n->connection->outgoing) {
+ n->connection->outgoing = outgoing;
+ return;
+ } else {
+ goto remove;
+ }
}
init_configuration(&outgoing->config_tree);
if(n)
outgoing->aip = outgoing->ai = get_known_addresses(n);
if(!outgoing->ai) {
- logger(DEBUG_ALWAYS, LOG_ERR, "No address known for %s", outgoing->name);
- return;
+ logger(DEBUG_ALWAYS, LOG_DEBUG, "No address known for %s", outgoing->name);
+ goto remove;
}
}
do_outgoing_connection(outgoing);
+ return;
+
+remove:
+ list_delete(outgoing_list, outgoing);
}
/*
continue;
}
+ if(!strcmp(name, myself->name)) {
+ free(name);
+ continue;
+ }
+
bool found = false;
for list_each(outgoing_t, outgoing, outgoing_list) {