Commit 917fbdb3 authored by Henrik Saavedra Persson's avatar Henrik Saavedra Persson Committed by David S. Miller

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: default avatarHenrik Saavedra Persson <henrik.e.persson@ericsson.com>
Signed-off-by: default avatarAndy Gospodarek <andy@greyhouse.net>
Signed-off-by: default avatarDavid S. Miller <davem@drr.davemloft.net>
parent 218fa90f
...@@ -2553,30 +2553,6 @@ void bond_mii_monitor(struct work_struct *work) ...@@ -2553,30 +2553,6 @@ void bond_mii_monitor(struct work_struct *work)
} }
} }
static __be32 bond_glean_dev_ip(struct net_device *dev)
{
struct in_device *idev;
struct in_ifaddr *ifa;
__be32 addr = 0;
if (!dev)
return 0;
rcu_read_lock();
idev = __in_dev_get_rcu(dev);
if (!idev)
goto out;
ifa = idev->ifa_list;
if (!ifa)
goto out;
addr = ifa->ifa_local;
out:
rcu_read_unlock();
return addr;
}
static int bond_has_this_ip(struct bonding *bond, __be32 ip) static int bond_has_this_ip(struct bonding *bond, __be32 ip)
{ {
struct vlan_entry *vlan; struct vlan_entry *vlan;
...@@ -3322,6 +3298,10 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event, ...@@ -3322,6 +3298,10 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
struct bonding *bond; struct bonding *bond;
struct vlan_entry *vlan; struct vlan_entry *vlan;
/* we only care about primary address */
if(ifa->ifa_flags & IFA_F_SECONDARY)
return NOTIFY_DONE;
list_for_each_entry(bond, &bn->dev_list, bond_list) { list_for_each_entry(bond, &bn->dev_list, bond_list) {
if (bond->dev == event_dev) { if (bond->dev == event_dev) {
switch (event) { switch (event) {
...@@ -3329,7 +3309,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event, ...@@ -3329,7 +3309,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
bond->master_ip = ifa->ifa_local; bond->master_ip = ifa->ifa_local;
return NOTIFY_OK; return NOTIFY_OK;
case NETDEV_DOWN: case NETDEV_DOWN:
bond->master_ip = bond_glean_dev_ip(bond->dev); bond->master_ip = 0;
return NOTIFY_OK; return NOTIFY_OK;
default: default:
return NOTIFY_DONE; return NOTIFY_DONE;
...@@ -3345,8 +3325,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event, ...@@ -3345,8 +3325,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
vlan->vlan_ip = ifa->ifa_local; vlan->vlan_ip = ifa->ifa_local;
return NOTIFY_OK; return NOTIFY_OK;
case NETDEV_DOWN: case NETDEV_DOWN:
vlan->vlan_ip = vlan->vlan_ip = 0;
bond_glean_dev_ip(vlan_dev);
return NOTIFY_OK; return NOTIFY_OK;
default: default:
return NOTIFY_DONE; return NOTIFY_DONE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment