X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet_socket.c;h=cb271063b0bc5d25ad22d3d0cec65e66ad5052f8;hp=9a67bb3cebb63e1c0529c09fc50f21c6f83e5094;hb=c72e237caa22525ab36a8286758e47544db3d496;hpb=d7be59a9dc6540f7ae6b7d5d6e595265f5f8b3cc diff --git a/src/net_socket.c b/src/net_socket.c index 9a67bb3c..cb271063 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -40,6 +40,7 @@ #endif int addressfamily = AF_UNSPEC; +int mintimeout = 0; int maxtimeout = 900; int seconds_till_retry = 5; int udp_rcvbuf = 0; @@ -77,6 +78,11 @@ static void configure_tcp(connection_t *c) { 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) { @@ -273,6 +279,9 @@ int setup_vpn_in_socket(const sockaddr_t *sa) { void retry_outgoing(outgoing_t *outgoing) { outgoing->timeout += 5; + if(outgoing->timeout < mintimeout) + outgoing->timeout = mintimeout; + if(outgoing->timeout > maxtimeout) outgoing->timeout = maxtimeout;