Message ID | 69d333c976553016d3dea2a4eab1c6d652366b27.1330523517.git.panweiping3@gmail.com |
---|---|
State | Rejected, archived |
Delegated to: | David Miller |
Headers | show |
On Wed, Feb 29, 2012 at 09:55:36PM +0800, Weiping Pan wrote: > rlb_arp_recv() only handles arp reply packets, > but I think arp request packets contain the latest information about > clients(ip and mac), so we should update rlb entry for arp request. when an ARP request arrives, a reply will be generated by the ARP protocol and that is going to be intercepted by rlb_arp_xmit(). When we start the "connection" by sending an ARP request, again, this is intercepted by rlb_arp_xmit(). But at that point we don't know the client's MAC address - that's why we handle the ARP reply in rlb_arp_recv(). > This patch can resolve a problem that if an IP address is migrated to a > different host in the network No, it can't - it in no way removes entries from the hash table. And these entries that list an IP address as ours while it is no longer ours cause the problem. > the corresponding rlb entry still contains the > old mac address for this IP, and bonding will send out invalid ARP packets > that will poison other systems' ARP caches. yes, but it poisons the caches with an invalid client_info->ip_src (IP) + client_info->slave->dev->dev_addr (MAC) combination. rlb_update_entry_from_arp() updates the _client_ MAC address, i.e. client_info->mac_dst.
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index f820b26..fe881a9 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c @@ -332,7 +332,6 @@ static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp) client_info = &(bond_info->rx_hashtbl[hash_index]); if ((client_info->assigned) && - (client_info->ip_src == arp->ip_dst) && (client_info->ip_dst == arp->ip_src) && (compare_ether_addr_64bits(client_info->mac_dst, arp->mac_src))) { /* update the clients MAC address */ @@ -366,11 +365,9 @@ static void rlb_arp_recv(struct sk_buff *skb, struct bonding *bond, return; } - if (arp->op_code == htons(ARPOP_REPLY)) { - /* update rx hash table for this ARP */ - rlb_update_entry_from_arp(bond, arp); - pr_debug("Server received an ARP Reply from client\n"); - } + /* update rx hash table for this ARP */ + rlb_update_entry_from_arp(bond, arp); + pr_debug("Server received an ARP Request/Reply from client\n"); } /* Caller must hold bond lock for read */
rlb_arp_recv() only handles arp reply packets, but I think arp request packets contain the latest information about clients(ip and mac), so we should update rlb entry for arp request. This patch can resolve a problem that if an IP address is migrated to a different host in the network, the corresponding rlb entry still contains the old mac address for this IP, and bonding will send out invalid ARP packets that will poison other systems' ARP caches. Jiri Bohac <jbohac@suse.cz> found this problem and posted a patch, but I don't know whether this patch can fix his problem. Signed-off-by: Weiping Pan <panweiping3@gmail.com> --- drivers/net/bonding/bond_alb.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)