From 6f6f426b353596edca77829c0477268fc2fc1925 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Tue, 27 Oct 2009 23:53:49 +0100 Subject: [PATCH 1/1] 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. --- src/protocol_subnet.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; } -- 2.20.1