Skip to content

Commit e74216b

Browse files
liuhangbinPaolo Abeni
authored andcommitted
bonding: fix macvlan over alb bond support
The commit 14af996 ("bonding: Support macvlans on top of tlb/rlb mode bonds") aims to enable the use of macvlans on top of rlb bond mode. However, the current rlb bond mode only handles ARP packets to update remote neighbor entries. This causes an issue when a macvlan is on top of the bond, and remote devices send packets to the macvlan using the bond's MAC address as the destination. After delivering the packets to the macvlan, the macvlan will rejects them as the MAC address is incorrect. Consequently, this commit makes macvlan over bond non-functional. To address this problem, one potential solution is to check for the presence of a macvlan port on the bond device using netif_is_macvlan_port(bond->dev) and return NULL in the rlb_arp_xmit() function. However, this approach doesn't fully resolve the situation when a VLAN exists between the bond and macvlan. So let's just do a partial revert for commit 14af996 in rlb_arp_xmit(). As the comment said, Don't modify or load balance ARPs that do not originate locally. Fixes: 14af996 ("bonding: Support macvlans on top of tlb/rlb mode bonds") Reported-by: susan.zheng@veritas.com Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2117816 Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 30188bd commit e74216b

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

drivers/net/bonding/bond_alb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -660,10 +660,10 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
660660
return NULL;
661661
arp = (struct arp_pkt *)skb_network_header(skb);
662662

663-
/* Don't modify or load balance ARPs that do not originate locally
664-
* (e.g.,arrive via a bridge).
663+
/* Don't modify or load balance ARPs that do not originate
664+
* from the bond itself or a VLAN directly above the bond.
665665
*/
666-
if (!bond_slave_has_mac_rx(bond, arp->mac_src))
666+
if (!bond_slave_has_mac_rcu(bond, arp->mac_src))
667667
return NULL;
668668

669669
dev = ip_dev_find(dev_net(bond->dev), arp->ip_src);

include/net/bonding.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -722,23 +722,14 @@ static inline struct slave *bond_slave_has_mac(struct bonding *bond,
722722
}
723723

724724
/* Caller must hold rcu_read_lock() for read */
725-
static inline bool bond_slave_has_mac_rx(struct bonding *bond, const u8 *mac)
725+
static inline bool bond_slave_has_mac_rcu(struct bonding *bond, const u8 *mac)
726726
{
727727
struct list_head *iter;
728728
struct slave *tmp;
729-
struct netdev_hw_addr *ha;
730729

731730
bond_for_each_slave_rcu(bond, tmp, iter)
732731
if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr))
733732
return true;
734-
735-
if (netdev_uc_empty(bond->dev))
736-
return false;
737-
738-
netdev_for_each_uc_addr(ha, bond->dev)
739-
if (ether_addr_equal_64bits(mac, ha->addr))
740-
return true;
741-
742733
return false;
743734
}
744735

0 commit comments

Comments
 (0)