public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Oscar Maes <oscmaes92@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, dsahern@kernel.org,
	edumazet@google.com, pabeni@redhat.com, horms@kernel.org,
	stable@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: ipv4: allow directed broadcast routes to use dst hint
Date: Fri, 25 Jul 2025 14:42:17 -0700	[thread overview]
Message-ID: <20250725144217.2617f6bc@kernel.org> (raw)
In-Reply-To: <20250724124942.6895-1-oscmaes92@gmail.com>

On Thu, 24 Jul 2025 14:49:42 +0200 Oscar Maes wrote:
> 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.

We are wrapping up our 6.17 material, I think this will need
to wait for 6.18. In the meantime, would it make sense to add
a selftest? Sounds like a relatively rare use case, easy to
regress.

> diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
> index fc323994b..1581b98bc 100644
> --- a/net/ipv4/ip_input.c
> +++ b/net/ipv4/ip_input.c
> @@ -589,8 +589,10 @@ 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)
>  {
> -	if (fib4_has_custom_rules(net) || rt_type == RTN_BROADCAST ||
> -	    IPCB(skb)->flags & IPSKB_MULTIPATH)
> +	const struct iphdr *iph = ip_hdr(skb);
> +
> +	if (fib4_has_custom_rules(net) || ipv4_is_lbcast(iph->daddr) ||
> +	    (iph->daddr == 0 && iph->saddr == 0) || IPCB(skb)->flags & IPSKB_MULTIPATH)

nit: we still prefer to wrap lines at 80 chars in networking
-- 
pw-bot: cr

      parent reply	other threads:[~2025-07-25 21:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-24 12:49 [PATCH net-next] net: ipv4: allow directed broadcast routes to use dst hint Oscar Maes
2025-07-24 12:52 ` kernel test robot
2025-07-25 21:42 ` Jakub Kicinski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250725144217.2617f6bc@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oscmaes92@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox