mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Oscar Maes <oscmaes92@gmail.com>, netdev@vger.kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, shuah@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3 1/2] net: ipv4: allow directed broadcast routes to use dst hint
Date: Wed, 20 Aug 2025 08:19:59 -0600	[thread overview]
Message-ID: <89f5efc6-e380-4523-a512-38fef942890a@kernel.org> (raw)
In-Reply-To: <20250819174642.5148-2-oscmaes92@gmail.com>

On 8/19/25 11:46 AM, 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.
> 
> Signed-off-by: Oscar Maes <oscmaes92@gmail.com>
> ---
>  net/ipv4/ip_input.c | 11 +++++++----
>  net/ipv4/route.c    |  2 +-
>  2 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
> index fc323994b1fa..a09aca2c8567 100644
> --- a/net/ipv4/ip_input.c
> +++ b/net/ipv4/ip_input.c
> @@ -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;
>  

seems ok to me.

Reviewed-by: David Ahern <dsahern@kernel.org>



  reply	other threads:[~2025-08-20 14:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-19 17:46 [PATCH net-next v3 0/2] " Oscar Maes
2025-08-19 17:46 ` [PATCH net-next v3 1/2] " Oscar Maes
2025-08-20 14:19   ` David Ahern [this message]
2025-08-19 17:46 ` [PATCH net-next v3 2/2] selftests: net: add test for dst hint mechanism with directed broadcast addresses Oscar Maes
2025-08-25 23:30 ` [PATCH net-next v3 0/2] net: ipv4: allow directed broadcast routes to use dst hint patchwork-bot+netdevbpf

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=89f5efc6-e380-4523-a512-38fef942890a@kernel.org \
    --to=dsahern@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oscmaes92@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=shuah@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

all inboxes | Powered by JetHome®