aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHenrik Saavedra Persson <henrik.e.persson@ericsson.com>2011-11-23 18:37:15 -0500
committerDavid S. Miller <davem@drr.davemloft.net>2011-11-30 22:59:11 -0500
commit917fbdb32f37e9a93b00bb12ee83532982982df3 (patch)
tree6be75401515d2bbb7dde186a06be521ffef9ecf7 /drivers
parent218fa90f072e4aeff9003d57e390857f4f35513e (diff)
bonding: only use primary address for ARP
Only use the primary address of the bond device for master_ip. This will prevent changing the ARP source address in Active-Backup mode whenever a secondry address is added to the bond device. Signed-off-by: Henrik Saavedra Persson <henrik.e.persson@ericsson.com> Signed-off-by: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: David S. Miller <davem@drr.davemloft.net>
Diffstat (limited to 'drivers')
-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 b0c577256487..7f8756825b8a 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2553,30 +2553,6 @@ re_arm:
2553 } 2553 }
2554} 2554}
2555 2555
2556static __be32 bond_glean_dev_ip(struct net_device *dev)
2557{
2558 struct in_device *idev;
2559 struct in_ifaddr *ifa;
2560 __be32 addr = 0;
2561
2562 if (!dev)
2563 return 0;
2564
2565 rcu_read_lock();
2566 idev = __in_dev_get_rcu(dev);
2567 if (!idev)
2568 goto out;
2569
2570 ifa = idev->ifa_list;
2571 if (!ifa)
2572 goto out;
2573
2574 addr = ifa->ifa_local;
2575out:
2576 rcu_read_unlock();
2577 return addr;
2578}
2579
2580static int bond_has_this_ip(struct bonding *bond, __be32 ip) 2556static int bond_has_this_ip(struct bonding *bond, __be32 ip)
2581{ 2557{
2582 struct vlan_entry *vlan; 2558 struct vlan_entry *vlan;
@@ -3322,6 +3298,10 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
3322 struct bonding *bond; 3298 struct bonding *bond;
3323 struct vlan_entry *vlan; 3299 struct vlan_entry *vlan;
3324 3300
3301 /* we only care about primary address */
3302 if(ifa->ifa_flags & IFA_F_SECONDARY)
3303 return NOTIFY_DONE;
3304
3325 list_for_each_entry(bond, &bn->dev_list, bond_list) { 3305 list_for_each_entry(bond, &bn->dev_list, bond_list) {
3326 if (bond->dev == event_dev) { 3306 if (bond->dev == event_dev) {
3327 switch (event) { 3307 switch (event) {
@@ -3329,7 +3309,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
3329 bond->master_ip = ifa->ifa_local; 3309 bond->master_ip = ifa->ifa_local;
3330 return NOTIFY_OK; 3310 return NOTIFY_OK;
3331 case NETDEV_DOWN: 3311 case NETDEV_DOWN:
3332 bond->master_ip = bond_glean_dev_ip(bond->dev); 3312 bond->master_ip = 0;
3333 return NOTIFY_OK; 3313 return NOTIFY_OK;
3334 default: 3314 default:
3335 return NOTIFY_DONE; 3315 return NOTIFY_DONE;
@@ -3345,8 +3325,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
3345 vlan->vlan_ip = ifa->ifa_local; 3325 vlan->vlan_ip = ifa->ifa_local;
3346 return NOTIFY_OK; 3326 return NOTIFY_OK;
3347 case NETDEV_DOWN: 3327 case NETDEV_DOWN:
3348 vlan->vlan_ip = 3328 vlan->vlan_ip = 0;
3349 bond_glean_dev_ip(vlan_dev);
3350 return NOTIFY_OK; 3329 return NOTIFY_OK;
3351 default: 3330 default:
3352 return NOTIFY_DONE; 3331 return NOTIFY_DONE;