Skip to content

Commit

Permalink
bonding: only use primary address for ARP
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Henrik Saavedra Persson authored and David S. Miller committed Dec 1, 2011
1 parent 218fa90 commit 917fbdb
Showing 1 changed file with 6 additions and 27 deletions.
33 changes: 6 additions & 27 deletions drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
struct vlan_entry *vlan;
Expand Down Expand Up @@ -3322,14 +3298,18 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
struct bonding *bond;
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) {
if (bond->dev == event_dev) {
switch (event) {
case NETDEV_UP:
bond->master_ip = ifa->ifa_local;
return NOTIFY_OK;
case NETDEV_DOWN:
bond->master_ip = bond_glean_dev_ip(bond->dev);
bond->master_ip = 0;
return NOTIFY_OK;
default:
return NOTIFY_DONE;
Expand All @@ -3345,8 +3325,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
vlan->vlan_ip = ifa->ifa_local;
return NOTIFY_OK;
case NETDEV_DOWN:
vlan->vlan_ip =
bond_glean_dev_ip(vlan_dev);
vlan->vlan_ip = 0;
return NOTIFY_OK;
default:
return NOTIFY_DONE;
Expand Down

0 comments on commit 917fbdb

Please sign in to comment.