Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ipv4: remove unnecessary judgment in ip_route_output_key_hash_rcu

In the ip_route_output_key_cash_rcu function, the input fl4 member saddr is
first checked to be non-zero before entering multicast, broadcast and
arbitrary IP address checks. However, the fact that the IP address is not
0 has already ruled out the possibility of any address, so remove
unnecessary judgment.

Signed-off-by: Zhengchao Shao <shaozhengchao@163.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/20250409033321.108244-1-shaozhengchao@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Zhengchao Shao and committed by
Jakub Kicinski
3b4f78f9 dd4f33b4

+1 -2
+1 -2
net/ipv4/route.c
··· 2699 2699 2700 2700 if (fl4->saddr) { 2701 2701 if (ipv4_is_multicast(fl4->saddr) || 2702 - ipv4_is_lbcast(fl4->saddr) || 2703 - ipv4_is_zeronet(fl4->saddr)) { 2702 + ipv4_is_lbcast(fl4->saddr)) { 2704 2703 rth = ERR_PTR(-EINVAL); 2705 2704 goto out; 2706 2705 }