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.
This commit is contained in:
Guus Sliepen 2009-10-27 23:53:49 +01:00
parent e00b44cb98
commit 6f6f426b35

View file

@ -45,7 +45,7 @@ bool add_subnet_h(connection_t *c) {
char subnetstr[MAX_STRING_SIZE]; char subnetstr[MAX_STRING_SIZE];
char name[MAX_STRING_SIZE]; char name[MAX_STRING_SIZE];
node_t *owner; 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) { 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, 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) if(!tunnelserver)
forward_request(c); 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; return true;
} }