mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	bonding: accept unsolicited NA message
The unsolicited NA message with all-nodes multicast dest address should
be valid, as this also means the link could reach the target.
Also rename bond_validate_ns() to bond_validate_na().
Reported-by: LiLiang <liali@redhat.com>
Fixes: 5e1eeef69c ("bonding: NS target should accept link local address")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
			
			
This commit is contained in:
		
							parent
							
								
									fd16eb948e
								
							
						
					
					
						commit
						592335a416
					
				
					 1 changed files with 12 additions and 5 deletions
				
			
		| 
						 | 
					@ -3201,12 +3201,19 @@ static bool bond_has_this_ip6(struct bonding *bond, struct in6_addr *addr)
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void bond_validate_ns(struct bonding *bond, struct slave *slave,
 | 
					static void bond_validate_na(struct bonding *bond, struct slave *slave,
 | 
				
			||||||
			     struct in6_addr *saddr, struct in6_addr *daddr)
 | 
								     struct in6_addr *saddr, struct in6_addr *daddr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (ipv6_addr_any(saddr) || !bond_has_this_ip6(bond, daddr)) {
 | 
						/* Ignore NAs that:
 | 
				
			||||||
 | 
						 * 1. Source address is unspecified address.
 | 
				
			||||||
 | 
						 * 2. Dest address is neither all-nodes multicast address nor
 | 
				
			||||||
 | 
						 *    exist on bond interface.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						if (ipv6_addr_any(saddr) ||
 | 
				
			||||||
 | 
						    (!ipv6_addr_equal(daddr, &in6addr_linklocal_allnodes) &&
 | 
				
			||||||
 | 
						     !bond_has_this_ip6(bond, daddr))) {
 | 
				
			||||||
		slave_dbg(bond->dev, slave->dev, "%s: sip %pI6c tip %pI6c not found\n",
 | 
							slave_dbg(bond->dev, slave->dev, "%s: sip %pI6c tip %pI6c not found\n",
 | 
				
			||||||
			  __func__, saddr, daddr);
 | 
								  __func__, saddr, daddr);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					@ -3249,14 +3256,14 @@ static int bond_na_rcv(const struct sk_buff *skb, struct bonding *bond,
 | 
				
			||||||
	 * see bond_arp_rcv().
 | 
						 * see bond_arp_rcv().
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (bond_is_active_slave(slave))
 | 
						if (bond_is_active_slave(slave))
 | 
				
			||||||
		bond_validate_ns(bond, slave, saddr, daddr);
 | 
							bond_validate_na(bond, slave, saddr, daddr);
 | 
				
			||||||
	else if (curr_active_slave &&
 | 
						else if (curr_active_slave &&
 | 
				
			||||||
		 time_after(slave_last_rx(bond, curr_active_slave),
 | 
							 time_after(slave_last_rx(bond, curr_active_slave),
 | 
				
			||||||
			    curr_active_slave->last_link_up))
 | 
								    curr_active_slave->last_link_up))
 | 
				
			||||||
		bond_validate_ns(bond, slave, saddr, daddr);
 | 
							bond_validate_na(bond, slave, saddr, daddr);
 | 
				
			||||||
	else if (curr_arp_slave &&
 | 
						else if (curr_arp_slave &&
 | 
				
			||||||
		 bond_time_in_interval(bond, slave_last_tx(curr_arp_slave), 1))
 | 
							 bond_time_in_interval(bond, slave_last_tx(curr_arp_slave), 1))
 | 
				
			||||||
		bond_validate_ns(bond, slave, saddr, daddr);
 | 
							bond_validate_na(bond, slave, saddr, daddr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
out:
 | 
					out:
 | 
				
			||||||
	return RX_HANDLER_ANOTHER;
 | 
						return RX_HANDLER_ANOTHER;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue