Use a different UDP discovery interval if the tunnel is established.
This introduces a new configuration option, UDPDiscoveryKeepaliveInterval, which is used as the UDP discovery interval once the UDP tunnel is established. The pre-existing option, UDPDiscoveryInterval, is therefore only used before UDP connectivity is established. The defaults are set so that tinc sends UDP pings more aggressively if the tunnel is not established yet. This is appropriate since the size of probes in that scenario is very small (16 bytes).
This commit is contained in:
parent
06345f89b9
commit
07108117ce
7 changed files with 21 additions and 7 deletions
|
|
@ -139,6 +139,7 @@ extern unsigned replaywin;
|
|||
extern bool localdiscovery;
|
||||
|
||||
extern bool udp_discovery;
|
||||
extern int udp_discovery_keepalive_interval;
|
||||
extern int udp_discovery_interval;
|
||||
extern int udp_discovery_timeout;
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,8 @@ static void send_udppacket(node_t *, vpn_packet_t *);
|
|||
unsigned replaywin = 16;
|
||||
bool localdiscovery = true;
|
||||
bool udp_discovery = true;
|
||||
int udp_discovery_interval = 9;
|
||||
int udp_discovery_keepalive_interval = 9;
|
||||
int udp_discovery_interval = 2;
|
||||
int udp_discovery_timeout = 30;
|
||||
|
||||
#define MAX_SEQNO 1073741824
|
||||
|
|
@ -874,7 +875,9 @@ static void try_udp(node_t* n) {
|
|||
struct timeval ping_tx_elapsed;
|
||||
timersub(&now, &n->udp_ping_sent, &ping_tx_elapsed);
|
||||
|
||||
if(ping_tx_elapsed.tv_sec >= udp_discovery_interval) {
|
||||
int interval = n->status.udp_confirmed ? udp_discovery_keepalive_interval : udp_discovery_interval;
|
||||
|
||||
if(ping_tx_elapsed.tv_sec >= interval) {
|
||||
send_udp_probe_packet(n, MAX(n->minmtu, 16));
|
||||
n->udp_ping_sent = now;
|
||||
|
||||
|
|
|
|||
|
|
@ -511,6 +511,7 @@ bool setup_myself_reloadable(void) {
|
|||
myself->options |= OPTION_INDIRECT;
|
||||
|
||||
get_config_bool(lookup_config(config_tree, "UDPDiscovery"), &udp_discovery);
|
||||
get_config_int(lookup_config(config_tree, "UDPDiscoveryKeepaliveInterval"), &udp_discovery_keepalive_interval);
|
||||
get_config_int(lookup_config(config_tree, "UDPDiscoveryInterval"), &udp_discovery_interval);
|
||||
get_config_int(lookup_config(config_tree, "UDPDiscoveryTimeout"), &udp_discovery_timeout);
|
||||
|
||||
|
|
|
|||
|
|
@ -1365,6 +1365,7 @@ const var_t variables[] = {
|
|||
{"StrictSubnets", VAR_SERVER},
|
||||
{"TunnelServer", VAR_SERVER},
|
||||
{"UDPDiscovery", VAR_SERVER},
|
||||
{"UDPDiscoveryKeepaliveInterval", VAR_SERVER},
|
||||
{"UDPDiscoveryInterval", VAR_SERVER},
|
||||
{"UDPDiscoveryTimeout", VAR_SERVER},
|
||||
{"UDPRcvBuf", VAR_SERVER},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue