mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-16 19:29:06 +08:00
net: ipv4: allow directed broadcast routes to use dst hint
Currently, ip_extract_route_hint uses RTN_BROADCAST to decide whether to use the route dst hint mechanism. This check is too strict, as it prevents directed broadcast routes from using the hint, resulting in poor performance during bursts of directed broadcast traffic. Fix this in ip_extract_route_hint and modify ip_route_use_hint to preserve the intended behaviour. Signed-off-by: Oscar Maes <oscmaes92@gmail.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://patch.msgid.link/20250819174642.5148-2-oscmaes92@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
7f052126ff
commit
1b8c5fa0cb
@@ -587,9 +587,13 @@ static void ip_sublist_rcv_finish(struct list_head *head)
|
||||
}
|
||||
|
||||
static struct sk_buff *ip_extract_route_hint(const struct net *net,
|
||||
struct sk_buff *skb, int rt_type)
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
if (fib4_has_custom_rules(net) || rt_type == RTN_BROADCAST ||
|
||||
const struct iphdr *iph = ip_hdr(skb);
|
||||
|
||||
if (fib4_has_custom_rules(net) ||
|
||||
ipv4_is_lbcast(iph->daddr) ||
|
||||
ipv4_is_zeronet(iph->daddr) ||
|
||||
IPCB(skb)->flags & IPSKB_MULTIPATH)
|
||||
return NULL;
|
||||
|
||||
@@ -618,8 +622,7 @@ static void ip_list_rcv_finish(struct net *net, struct list_head *head)
|
||||
|
||||
dst = skb_dst(skb);
|
||||
if (curr_dst != dst) {
|
||||
hint = ip_extract_route_hint(net, skb,
|
||||
dst_rtable(dst)->rt_type);
|
||||
hint = ip_extract_route_hint(net, skb);
|
||||
|
||||
/* dispatch old sublist */
|
||||
if (!list_empty(&sublist))
|
||||
|
||||
@@ -2210,7 +2210,7 @@ ip_route_use_hint(struct sk_buff *skb, __be32 daddr, __be32 saddr,
|
||||
goto martian_source;
|
||||
}
|
||||
|
||||
if (rt->rt_type != RTN_LOCAL)
|
||||
if (!(rt->rt_flags & RTCF_LOCAL))
|
||||
goto skip_validate_source;
|
||||
|
||||
reason = fib_validate_source_reason(skb, saddr, daddr, dscp, 0, dev,
|
||||
|
||||
Reference in New Issue
Block a user