From: Srinivas Aji Date: Mon, 28 May 2007 18:14:43 +0000 (+0530) Subject: Change notification processing to account for kernel changes X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=09dffbd42fa35e38142d07764825b7a4498ec5b8;p=people%2Fms%2Frstp.git Change notification processing to account for kernel changes We now always get NEWLINK and DELLINK notifications for bridge port additions and deletions. And DELLINK is only for port deletions. So we can always remove a bridge port on a DELLINK notification, and not make uncertain checks in fear of missing this. Signed-off-by: Srinivas Aji --- diff --git a/bridge_track.c b/bridge_track.c index da53d9b..00e60e3 100644 --- a/bridge_track.c +++ b/bridge_track.c @@ -513,18 +513,21 @@ int bridge_notify(int br_index, int if_index, int newlink, int up) ifc = NULL; } } - if (!ifc) + if (!ifc) { + if (!newlink) { + INFO("Got DELLINK for unknown port %d on " + "bridge %d", if_index, br_index); + return -1; + } ifc = create_if(if_index, br); + } if (!ifc) { ERROR ("Couldn't create data for interface %d (master %d)", if_index, br_index); return -1; } - if (!newlink && !is_bridge_slave(br->name, ifc->name)) { - /* brctl delif generates a DELLINK, but so does ifconfig down. - So check and delete if it has been removed. - */ + if (!newlink) { delete_if(ifc); return 0; } @@ -551,12 +554,6 @@ int bridge_notify(int br_index, int if_index, int newlink, int up) } } } - if (ifc && !ifc->is_bridge && - !is_bridge_slave(ifc->master->name, ifc->name)) { - /* Interface might have left bridge and we might have missed deletion */ - delete_if(ifc); - return 0; - } if (ifc && ifc->up != up) { if (ifc->is_bridge) set_br_up(ifc, up);