summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHangbin Liu <liuhangbin@gmail.com>2023-04-06 16:23:50 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-20 12:35:08 +0200
commit4f6c08c2323bfcbc7b8cad5b9fd527e649d21b0a (patch)
treed0907b8e14168113854681d55915315c46e6ffab /include
parent9d7765638fd8034e6861e90b3d4a47faea04b732 (diff)
downloadlinux-4f6c08c2323bfcbc7b8cad5b9fd527e649d21b0a.tar.gz
linux-4f6c08c2323bfcbc7b8cad5b9fd527e649d21b0a.tar.bz2
linux-4f6c08c2323bfcbc7b8cad5b9fd527e649d21b0a.zip
bonding: fix ns validation on backup slaves
[ Upstream commit 4598380f9c548aa161eb4e990a1583f0a7d1e0d7 ] When arp_validate is set to 2, 3, or 6, validation is performed for backup slaves as well. As stated in the bond documentation, validation involves checking the broadcast ARP request sent out via the active slave. This helps determine which slaves are more likely to function in the event of an active slave failure. However, when the target is an IPv6 address, the NS message sent from the active interface is not checked on backup slaves. Additionally, based on the bond_arp_rcv() rule b, we must reverse the saddr and daddr when checking the NS message. Note that when checking the NS message, the destination address is a multicast address. Therefore, we must convert the target address to solicited multicast in the bond_get_targets_ip6() function. Prior to the fix, the backup slaves had a mii status of "down", but after the fix, all of the slaves' mii status was updated to "UP". Fixes: 4e24be018eb9 ("bonding: add new parameter ns_targets") Reviewed-by: Jonathan Toppins <jtoppins@redhat.com> Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/bonding.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/net/bonding.h b/include/net/bonding.h
index e999f851738b..768348008d0c 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -765,13 +765,17 @@ static inline int bond_get_targets_ip(__be32 *targets, __be32 ip)
#if IS_ENABLED(CONFIG_IPV6)
static inline int bond_get_targets_ip6(struct in6_addr *targets, struct in6_addr *ip)
{
+ struct in6_addr mcaddr;
int i;
- for (i = 0; i < BOND_MAX_NS_TARGETS; i++)
- if (ipv6_addr_equal(&targets[i], ip))
+ for (i = 0; i < BOND_MAX_NS_TARGETS; i++) {
+ addrconf_addr_solict_mult(&targets[i], &mcaddr);
+ if ((ipv6_addr_equal(&targets[i], ip)) ||
+ (ipv6_addr_equal(&mcaddr, ip)))
return i;
else if (ipv6_addr_any(&targets[i]))
break;
+ }
return -1;
}