aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-12-02 13:49:21 -0500
committerDavid S. Miller <davem@davemloft.net>2011-12-02 13:49:21 -0500
commitb3613118eb30a589d971e4eccbbb2a1314f5dfd4 (patch)
tree868c1ee59e1b5c19a4f2e43716400d0001a994e5 /drivers/net/bonding
parent7505afe28c16a8d386624930a018d0052c75d687 (diff)
parent5983fe2b29df5885880d7fa3b91aca306c7564ef (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_main.c33
1 files changed, 6 insertions, 27 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 25a44d94be1..3216c514fdc 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2554,30 +2554,6 @@ re_arm:
2554 } 2554 }
2555} 2555}
2556 2556
2557static __be32 bond_glean_dev_ip(struct net_device *dev)
2558{
2559 struct in_device *idev;
2560 struct in_ifaddr *ifa;
2561 __be32 addr = 0;
2562
2563 if (!dev)
2564 return 0;
2565
2566 rcu_read_lock();
2567 idev = __in_dev_get_rcu(dev);
2568 if (!idev)
2569 goto out;
2570
2571 ifa = idev->ifa_list;
2572 if (!ifa)
2573 goto out;
2574
2575 addr = ifa->ifa_local;
2576out:
2577 rcu_read_unlock();
2578 return addr;
2579}
2580
2581static int bond_has_this_ip(struct bonding *bond, __be32 ip) 2557static int bond_has_this_ip(struct bonding *bond, __be32 ip)
2582{ 2558{
2583 struct vlan_entry *vlan; 2559 struct vlan_entry *vlan;
@@ -3323,6 +3299,10 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
3323 struct bonding *bond; 3299 struct bonding *bond;
3324 struct vlan_entry *vlan; 3300 struct vlan_entry *vlan;
3325 3301
3302 /* we only care about primary address */
3303 if(ifa->ifa_flags & IFA_F_SECONDARY)
3304 return NOTIFY_DONE;
3305
3326 list_for_each_entry(bond, &bn->dev_list, bond_list) { 3306 list_for_each_entry(bond, &bn->dev_list, bond_list) {
3327 if (bond->dev == event_dev) { 3307 if (bond->dev == event_dev) {
3328 switch (event) { 3308 switch (event) {
@@ -3330,7 +3310,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
3330 bond->master_ip = ifa->ifa_local; 3310 bond->master_ip = ifa->ifa_local;
3331 return NOTIFY_OK; 3311 return NOTIFY_OK;
3332 case NETDEV_DOWN: 3312 case NETDEV_DOWN:
3333 bond->master_ip = bond_glean_dev_ip(bond->dev); 3313 bond->master_ip = 0;
3334 return NOTIFY_OK; 3314 return NOTIFY_OK;
3335 default: 3315 default:
3336 return NOTIFY_DONE; 3316 return NOTIFY_DONE;
@@ -3346,8 +3326,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
3346 vlan->vlan_ip = ifa->ifa_local; 3326 vlan->vlan_ip = ifa->ifa_local;
3347 return NOTIFY_OK; 3327 return NOTIFY_OK;
3348 case NETDEV_DOWN: 3328 case NETDEV_DOWN:
3349 vlan->vlan_ip = 3329 vlan->vlan_ip = 0;
3350 bond_glean_dev_ip(vlan_dev);
3351 return NOTIFY_OK; 3330 return NOTIFY_OK;
3352 default: 3331 default:
3353 return NOTIFY_DONE; 3332 return NOTIFY_DONE;