From: Guus Sliepen Date: Thu, 23 Feb 2012 12:26:01 +0000 (+0100) Subject: Merge branch 'master' of git://tinc-vpn.org/tinc into 1.1 X-Git-Tag: release-1.1pre3~152 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=f5dc136cfd7a3a195b75f7174722734e25f30fd9;p=tinc Merge branch 'master' of git://tinc-vpn.org/tinc into 1.1 Conflicts: src/net.c src/net_packet.c src/net_socket.c --- f5dc136cfd7a3a195b75f7174722734e25f30fd9 diff --cc src/net_packet.c index f7d86403,18a898d3..64b0f8e8 --- a/src/net_packet.c +++ b/src/net_packet.c @@@ -65,13 -65,19 +66,20 @@@ bool localdiscovery = false #define MAX_SEQNO 1073741824 - // mtuprobes == 1..30: initial discovery, send bursts with 1 second interval - // mtuprobes == 31: sleep pinginterval seconds - // mtuprobes == 32: send 1 burst, sleep pingtimeout second - // mtuprobes == 33: no response from other side, restart PMTU discovery process + /* mtuprobes == 1..30: initial discovery, send bursts with 1 second interval + mtuprobes == 31: sleep pinginterval seconds + mtuprobes == 32: send 1 burst, sleep pingtimeout second + mtuprobes == 33: no response from other side, restart PMTU discovery process + + Probes are sent in batches of three, with random sizes between the lower and + upper boundaries for the MTU thus far discovered. + + In case local discovery is enabled, a fourth packet is added to each batch, + which will be broadcast to the local network. + */ -void send_mtu_probe(node_t *n) { +static void send_mtu_probe_handler(int fd, short events, void *data) { + node_t *n = data; vpn_packet_t packet; int len, i; int timeout = 1; @@@ -129,9 -136,9 +137,9 @@@ len = 64; memset(packet.data, 0, 14); - RAND_pseudo_bytes(packet.data + 14, len - 14); + randomize(packet.data + 14, len - 14); packet.len = len; - packet.priority = 0; + packet.priority = i < 3 ? 0 : -1; ifdebug(TRAFFIC) logger(LOG_INFO, "Sending MTU probe length %d to %s (%s)", len, n->name, n->hostname); diff --cc src/net_socket.c index 730cf6b8,94db11c0..28206697 --- a/src/net_socket.c +++ b/src/net_socket.c @@@ -209,7 -210,8 +209,8 @@@ int setup_vpn_in_socket(const sockaddr_ #endif option = 1; - setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, (void *)&option, sizeof(option)); - setsockopt(nfd, SOL_SOCKET, SO_BROADCAST, (void *)&option, sizeof(option)); + setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, (void *)&option, sizeof option); ++ setsockopt(nfd, SOL_SOCKET, SO_BROADCAST, (void *)&option, sizeof option); if(udp_rcvbuf && setsockopt(nfd, SOL_SOCKET, SO_RCVBUF, (void *)&udp_rcvbuf, sizeof(udp_rcvbuf))) logger(LOG_WARNING, "Can't set UDP SO_RCVBUF to %i: %s", udp_rcvbuf, strerror(errno)); diff --cc src/node.h index 4464011f,d1cb97f7..e86aa6a0 --- a/src/node.h +++ b/src/node.h @@@ -62,13 -66,13 +62,14 @@@ typedef struct node_t int incompression; /* Compressionlevel, 0 = no compression */ int outcompression; /* Compressionlevel, 0 = no compression */ + int distance; struct node_t *nexthop; /* nearest node from us to him */ + struct edge_t *prevedge; /* nearest node from him to us */ struct node_t *via; /* next hop for UDP packets */ - avl_tree_t *subnet_tree; /* Pointer to a tree of subnets belonging to this node */ + splay_tree_t *subnet_tree; /* Pointer to a tree of subnets belonging to this node */ - avl_tree_t *edge_tree; /* Edges with this node as one of the endpoints */ + splay_tree_t *edge_tree; /* Edges with this node as one of the endpoints */ struct connection_t *connection; /* Connection associated with this node (if a direct connection exists) */