From mboxrd@z Thu Jan 1 00:00:00 1970 From: Veaceslav Falico Subject: [PATCH net-next 4/8] bonding: convert bond_has_this_ip() to use upper devices Date: Mon, 26 Aug 2013 18:28:49 +0200 Message-ID: <1377534533-6944-5-git-send-email-vfalico@redhat.com> References: <1377534533-6944-1-git-send-email-vfalico@redhat.com> Cc: Veaceslav Falico , Jay Vosburgh , Andy Gospodarek To: netdev@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:58101 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752130Ab3HZQ2x (ORCPT ); Mon, 26 Aug 2013 12:28:53 -0400 In-Reply-To: <1377534533-6944-1-git-send-email-vfalico@redhat.com> Sender: netdev-owner@vger.kernel.org List-ID: Currently, bond_has_this_ip() is aware only of vlan upper devices, and thus will return false if the address is associated with the upper bridge or any other device, and thus will break the arp logic. Fix this by using the upper device list. For every upper device we verify if the address associated with it is our address, and if yes - return true. CC: Jay Vosburgh CC: Andy Gospodarek Signed-off-by: Veaceslav Falico --- drivers/net/bonding/bond_main.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index f8927b3..f3787a2 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -2392,24 +2392,24 @@ re_arm: } } -static int bond_has_this_ip(struct bonding *bond, __be32 ip) +static bool bond_has_this_ip(struct bonding *bond, __be32 ip) { - struct vlan_entry *vlan; - struct net_device *vlan_dev; + struct netdev_upper *upper; + bool ret = false; if (ip == bond_confirm_addr(bond->dev, 0, ip)) - return 1; + return true; - list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { - rcu_read_lock(); - vlan_dev = __vlan_find_dev_deep(bond->dev, htons(ETH_P_8021Q), - vlan->vlan_id); - rcu_read_unlock(); - if (vlan_dev && ip == bond_confirm_addr(vlan_dev, 0, ip)) - return 1; + rcu_read_lock(); + list_for_each_entry_rcu(upper, &bond->dev->upper_dev_list, list) { + if (ip == bond_confirm_addr(upper->dev, 0, ip)) { + ret = true; + break; + } } + rcu_read_unlock(); - return 0; + return ret; } /* -- 1.7.1