netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jay Vosburgh <fubar@us.ibm.com>
To: Weiping Pan <panweiping3@gmail.com>
Cc: netdev@vger.kernel.org, jbohac@suse.cz, andy@greyhouse.net
Subject: Re: [PATCH net] delete rlb entry if ip of bonding is deleted
Date: Wed, 29 Feb 2012 20:19:59 -0800	[thread overview]
Message-ID: <10138.1330575599@death.nxdomain> (raw)
In-Reply-To: <b68da7936fe7ed8e6e15edecb41a140a07026ace.1330573426.git.panweiping3@gmail.com>

Weiping Pan <panweiping3@gmail.com> wrote:

>When the ip of bonding is deleted, its rlb table still contains old invalid
>mappings, just delete them to avoid poisoning other clients arp cache.

	I don't believe this patch will handle the case that Jiri
mentioned earlier: the bond host is acting as a router or bridge.  The
key here is that the "source address" in question is not assigned to the
bond at all, but comes from another host whose traffic passes through
the bond.

	On the other hand, the logic of this patch might be useful to
purge table entries for local addresses when they are deconfigured from
the bond.  I don't think it's a complete solution by itself, though.

	-J

>Signed-off-by: Weiping Pan <panweiping3@gmail.com>
>---
> drivers/net/bonding/bond_alb.c  |   35 +++++++++++++++++++++++++++++++++++
> drivers/net/bonding/bond_alb.h  |    2 ++
> drivers/net/bonding/bond_main.c |    1 +
> 3 files changed, 38 insertions(+), 0 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
>index f820b26..928c636 100644
>--- a/drivers/net/bonding/bond_alb.c
>+++ b/drivers/net/bonding/bond_alb.c
>@@ -853,6 +853,41 @@ static void rlb_clear_vlan(struct bonding *bond, unsigned short vlan_id)
> 	_unlock_rx_hashtbl_bh(bond);
> }
>
>+/* delete all rlb entries which has ip as ip_src */
>+void bond_alb_delete_entry(struct bonding *bond, __be32 ip)
>+{
>+	struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
>+	u32 curr_index;
>+
>+	_lock_rx_hashtbl_bh(bond);
>+
>+	curr_index = bond_info->rx_hashtbl_head;
>+	while (curr_index != RLB_NULL_INDEX) {
>+		struct rlb_client_info *curr = &(bond_info->rx_hashtbl[curr_index]);
>+		u32 next_index = bond_info->rx_hashtbl[curr_index].next;
>+		u32 prev_index = bond_info->rx_hashtbl[curr_index].prev;
>+		if (curr->assigned && (curr->ip_src == ip)) {
>+			if (curr_index == bond_info->rx_hashtbl_head) {
>+				bond_info->rx_hashtbl_head = next_index;
>+			}
>+
>+			if (prev_index != RLB_NULL_INDEX) {
>+				bond_info->rx_hashtbl[prev_index].next = next_index;
>+			}
>+
>+			if (next_index != RLB_NULL_INDEX) {
>+				bond_info->rx_hashtbl[next_index].prev = prev_index;
>+			}
>+
>+			rlb_init_table_entry(curr);
>+		}
>+
>+		curr_index = next_index;
>+	}
>+
>+	_unlock_rx_hashtbl_bh(bond);
>+}
>+
> /*********************** tlb/rlb shared functions *********************/
>
> static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[])
>diff --git a/drivers/net/bonding/bond_alb.h b/drivers/net/bonding/bond_alb.h
>index 90f140a..38863fc 100644
>--- a/drivers/net/bonding/bond_alb.h
>+++ b/drivers/net/bonding/bond_alb.h
>@@ -163,5 +163,7 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev);
> void bond_alb_monitor(struct work_struct *);
> int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr);
> void bond_alb_clear_vlan(struct bonding *bond, unsigned short vlan_id);
>+
>+void bond_alb_delete_entry(struct bonding *bond, __be32 ip);
> #endif /* __BOND_ALB_H__ */
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 435984a..ec071b9 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -3315,6 +3315,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
> 				return NOTIFY_OK;
> 			case NETDEV_DOWN:
> 				bond->master_ip = 0;
>+				bond_alb_delete_entry(bond, ifa->ifa_local);
> 				return NOTIFY_OK;
> 			default:
> 				return NOTIFY_DONE;
>-- 
>1.7.4.4
>

---
	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com

  reply	other threads:[~2012-03-01  4:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-27 17:34 [PATCH][RFC] bonding: delete migrated IP addresses from the rlb hash table Jiri Bohac
2012-02-27 17:46 ` bonding: should rlb rx_hashtbl be reimplemented? Jiri Bohac
2012-02-29 13:55 ` [PATCH net] bonding:update rlb entry for arp request Weiping Pan
2012-02-29 18:26   ` Jiri Bohac
2012-02-29 13:58 ` [PATCH][RFC] bonding: delete migrated IP addresses from the rlb hash table WeipingPan
2012-02-29 18:49   ` Jiri Bohac
2012-02-29 18:59 ` Jay Vosburgh
2012-03-01  2:12 ` Jay Vosburgh
2012-03-01  3:58   ` WeipingPan
2012-03-01  4:01     ` [PATCH net] delete rlb entry if ip of bonding is deleted Weiping Pan
2012-03-01  4:19       ` Jay Vosburgh [this message]
2012-03-07 16:02   ` [PATCH][RFC] bonding: delete migrated IP addresses from the rlb hash table Jiri Bohac
2012-04-20 18:56     ` Jiri Bohac
2012-04-26 20:18       ` Jay Vosburgh
2012-04-27 21:03         ` Jiri Bohac
2012-03-23  7:10 ` WeipingPan
2012-03-23 10:33   ` Jiri Bohac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10138.1330575599@death.nxdomain \
    --to=fubar@us.ibm.com \
    --cc=andy@greyhouse.net \
    --cc=jbohac@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=panweiping3@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).