From: Guus Sliepen Date: Tue, 27 Oct 2009 22:53:49 +0000 (+0100) Subject: Fast handoff of roaming MAC addresses. X-Git-Tag: import-tinc-1.1~584^2~2 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=6f6f426b353596edca77829c0477268fc2fc1925;p=meshlink Fast handoff of roaming MAC addresses. In switch mode, if a known MAC address is claimed by a second node before it expired at the first node, it is likely that this is because a computer has roamed from the LAN of the first node to that of the second node. To ensure packets for that computer are routed to the second node, the first node should delete its corresponding Subnet as soon as possible, without waiting for the normal expiry timeout. --- diff --git a/src/protocol_subnet.c b/src/protocol_subnet.c index f7ce53b9..ba75c899 100644 --- a/src/protocol_subnet.c +++ b/src/protocol_subnet.c @@ -45,7 +45,7 @@ bool add_subnet_h(connection_t *c) { char subnetstr[MAX_STRING_SIZE]; char name[MAX_STRING_SIZE]; node_t *owner; - subnet_t s = {0}, *new; + subnet_t s = {0}, *new, *old; if(sscanf(c->buffer, "%*d %*x " MAX_STRING " " MAX_STRING, name, subnetstr) != 2) { logger(LOG_ERR, "Got bad %s from %s (%s)", "ADD_SUBNET", c->name, @@ -142,6 +142,11 @@ bool add_subnet_h(connection_t *c) { if(!tunnelserver) forward_request(c); + /* Fast handoff of roaming MAC addresses */ + + if(s.type == SUBNET_MAC && owner != myself && (old = lookup_subnet(myself, &s)) && old->expires) + old->expires = now; + return true; }