projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Releasing 1.0.25.
[tinc]
/
src
/
net_socket.c
diff --git
a/src/net_socket.c
b/src/net_socket.c
index
cfcf1c3
..
cb27106
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
3
Guus Sliepen <guus@tinc-vpn.org>
+ 2000-201
4
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>
@@
-40,6
+40,7
@@
#endif
int addressfamily = AF_UNSPEC;
#endif
int addressfamily = AF_UNSPEC;
+int mintimeout = 0;
int maxtimeout = 900;
int seconds_till_retry = 5;
int udp_rcvbuf = 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
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) {
@@
-102,7
+108,6
@@
static bool bind_to_interface(int sd) {
return false;
}
return false;
}
- free(iface);
#else /* if !defined(SOL_SOCKET) || !defined(SO_BINDTODEVICE) */
logger(LOG_WARNING, "%s not supported on this platform", "BindToInterface");
#endif
#else /* if !defined(SOL_SOCKET) || !defined(SO_BINDTODEVICE) */
logger(LOG_WARNING, "%s not supported on this platform", "BindToInterface");
#endif
@@
-241,8
+246,6
@@
int setup_vpn_in_socket(const sockaddr_t *sa) {
option = 1;
setsockopt(nfd, IPPROTO_IP, IP_DONTFRAGMENT, (void *)&option, sizeof(option));
}
option = 1;
setsockopt(nfd, IPPROTO_IP, IP_DONTFRAGMENT, (void *)&option, sizeof(option));
}
-#else
-#warning No way to disable IPv4 fragmentation
#endif
#if defined(SOL_IPV6) && defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO)
#endif
#if defined(SOL_IPV6) && defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO)
@@
-255,8
+258,6
@@
int setup_vpn_in_socket(const sockaddr_t *sa) {
option = 1;
setsockopt(nfd, IPPROTO_IPV6, IPV6_DONTFRAG, (void *)&option, sizeof(option));
}
option = 1;
setsockopt(nfd, IPPROTO_IPV6, IPV6_DONTFRAG, (void *)&option, sizeof(option));
}
-#else
-#warning No way to disable IPv6 fragmentation
#endif
if (!bind_to_interface(nfd)) {
#endif
if (!bind_to_interface(nfd)) {
@@
-278,6
+279,9
@@
int setup_vpn_in_socket(const sockaddr_t *sa) {
void retry_outgoing(outgoing_t *outgoing) {
outgoing->timeout += 5;
void retry_outgoing(outgoing_t *outgoing) {
outgoing->timeout += 5;
+ if(outgoing->timeout < mintimeout)
+ outgoing->timeout = mintimeout;
+
if(outgoing->timeout > maxtimeout)
outgoing->timeout = maxtimeout;
if(outgoing->timeout > maxtimeout)
outgoing->timeout = maxtimeout;