projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update "now" after connect() when making outgoing connections.
[tinc]
/
src
/
net_socket.c
diff --git
a/src/net_socket.c
b/src/net_socket.c
index
1bf9d16
..
8983d28
100644
(file)
--- a/
src/net_socket.c
+++ b/
src/net_socket.c
@@
-1,7
+1,7
@@
/*
net_socket.c -- Handle various kinds of sockets.
Copyright (C) 1998-2005 Ivo Timmermans,
/*
net_socket.c -- Handle various kinds of sockets.
Copyright (C) 1998-2005 Ivo Timmermans,
- 2000-201
4
Guus Sliepen <guus@tinc-vpn.org>
+ 2000-201
6
Guus Sliepen <guus@tinc-vpn.org>
2006 Scott Lamb <slamb@slamb.org>
2009 Florian Forster <octo@verplant.org>
2006 Scott Lamb <slamb@slamb.org>
2009 Florian Forster <octo@verplant.org>
@@
-43,8
+43,8
@@
int addressfamily = AF_UNSPEC;
int maxtimeout = 900;
int seconds_till_retry = 5;
int addressfamily = AF_UNSPEC;
int maxtimeout = 900;
int seconds_till_retry = 5;
-int udp_rcvbuf =
0
;
-int udp_sndbuf =
0
;
+int udp_rcvbuf =
1024 * 1024
;
+int udp_sndbuf =
1024 * 1024
;
int max_connection_burst = 100;
listen_socket_t listen_socket[MAXSOCKETS];
int max_connection_burst = 100;
listen_socket_t listen_socket[MAXSOCKETS];
@@
-82,6
+82,11
@@
static void configure_tcp(connection_t *c) {
option = IPTOS_LOWDELAY;
setsockopt(c->socket, SOL_IP, IP_TOS, (void *)&option, sizeof option);
#endif
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) {
}
static bool bind_to_interface(int sd) {
@@
-547,10
+552,13
@@
begin:
/* Now that there is a working socket, fill in the rest and register this connection. */
/* 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);
c->status.connecting = true;
c->name = xstrdup(outgoing->name);
+#ifndef DISABLE_LEGACY
c->outcipher = myself->connection->outcipher;
c->outdigest = myself->connection->outdigest;
c->outcipher = myself->connection->outcipher;
c->outdigest = myself->connection->outdigest;
+#endif
c->outmaclength = myself->connection->outmaclength;
c->outcompression = myself->connection->outcompression;
c->last_ping_time = now.tv_sec;
c->outmaclength = myself->connection->outmaclength;
c->outcompression = myself->connection->outcompression;
c->last_ping_time = now.tv_sec;
@@
-602,9
+610,12
@@
void setup_outgoing_connection(outgoing_t *outgoing) {
if(n && n->connection) {
logger(DEBUG_CONNECTIONS, LOG_INFO, "Already connected to %s", outgoing->name);
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);
}
init_configuration(&outgoing->config_tree);
@@
-615,12
+626,16
@@
void setup_outgoing_connection(outgoing_t *outgoing) {
if(n)
outgoing->aip = outgoing->ai = get_known_addresses(n);
if(!outgoing->ai) {
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);
}
}
do_outgoing_connection(outgoing);
+ return;
+
+remove:
+ list_delete(outgoing_list, outgoing);
}
/*
}
/*
@@
-696,8
+711,10
@@
void handle_new_meta_connection(void *data, int flags) {
c = new_connection();
c->name = xstrdup("<unknown>");
c = new_connection();
c->name = xstrdup("<unknown>");
+#ifndef DISABLE_LEGACY
c->outcipher = myself->connection->outcipher;
c->outdigest = myself->connection->outdigest;
c->outcipher = myself->connection->outcipher;
c->outdigest = myself->connection->outdigest;
+#endif
c->outmaclength = myself->connection->outmaclength;
c->outcompression = myself->connection->outcompression;
c->outmaclength = myself->connection->outmaclength;
c->outcompression = myself->connection->outcompression;
@@
-796,6
+813,11
@@
void try_outgoing_connections(void) {
continue;
}
continue;
}
+ if(!strcmp(name, myself->name)) {
+ free(name);
+ continue;
+ }
+
bool found = false;
for list_each(outgoing_t, outgoing, outgoing_list) {
bool found = false;
for list_each(outgoing_t, outgoing, outgoing_list) {