summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-04-21 16:34:51 -0700
committerBen Pfaff <blp@nicira.com>2011-04-21 16:34:51 -0700
commita6934aa95f96f946a07b87143f72ab1fb4db854f (patch)
treed66feef97a1ecea058e41486a3ea2a8179387ced
parent10b78e7d091b85a2808bac9dd24d7fd3cfeaa8b1 (diff)
downloadopenvswitch-a6934aa95f96f946a07b87143f72ab1fb4db854f.tar.gz
bond: Be more careful about adding and removing netdevs in the monitor.
The code was careless about updating the netdev_monitor. Newly added slaves weren't added to the monitor until the next bond_reconfigure() call, and netdevs were never removed from the monitor.
-rw-r--r--lib/bond.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/bond.c b/lib/bond.c
index 4d7d05ab3..ed6ed89b8 100644
--- a/lib/bond.c
+++ b/lib/bond.c
@@ -369,7 +369,16 @@ bond_slave_register(struct bond *bond, void *slave_, uint16_t stb_id,
bond->bond_revalidate = true;
}
- slave->netdev = netdev;
+ if (slave->netdev != netdev) {
+ if (bond->monitor) {
+ if (slave->netdev) {
+ netdev_monitor_remove(bond->monitor, slave->netdev);
+ }
+ netdev_monitor_add(bond->monitor, netdev);
+ }
+ slave->netdev = netdev;
+ }
+
free(slave->name);
slave->name = xstrdup(netdev_get_name(netdev));
}
@@ -388,6 +397,10 @@ bond_slave_unregister(struct bond *bond, const void *slave_)
return;
}
+ if (bond->monitor) {
+ netdev_monitor_remove(bond->monitor, slave->netdev);
+ }
+
bond_enable_slave(slave, false, NULL);
del_active = bond->active_slave == slave;