All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Huajian Yang <huajianyang@asrmicro.com>
Cc: pablo@netfilter.org, kadlec@netfilter.org, razor@blackwall.org,
	idosch@nvidia.com, davem@davemloft.net, dsahern@kernel.org,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	bridge@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: Expand headroom to send fragmented packets in bridge fragment forward
Date: Fri, 11 Apr 2025 11:54:50 +0100	[thread overview]
Message-ID: <20250411105450.GA395307@horms.kernel.org> (raw)
In-Reply-To: <20250409074444.8213-1-huajianyang@asrmicro.com>

On Wed, Apr 09, 2025 at 03:44:44PM +0800, Huajian Yang wrote:
> The config NF_CONNTRACK_BRIDGE will change the way fragments are processed.
> Bridge does not know that it is a fragmented packet and forwards it
> directly, after NF_CONNTRACK_BRIDGE is enabled, function nf_br_ip_fragment
> will check and fraglist this packet.
> 
> Some network devices that would not able to ping large packet under bridge,
> but large packet ping is successful if not enable NF_CONNTRACK_BRIDGE.
> 
> In function nf_br_ip_fragment, checking the headroom before sending is
> undoubted, but it is unreasonable to directly drop skb with insufficient
> headroom.
> 
> Using skb_copy_expand to expand the headroom of skb instead of dropping
> it.
> 
> Signed-off-by: Huajian Yang <huajianyang@asrmicro.com>
> ---
>  net/bridge/netfilter/nf_conntrack_bridge.c | 14 ++++++++++++--
>  net/ipv6/netfilter.c                       | 14 ++++++++++++--
>  2 files changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/net/bridge/netfilter/nf_conntrack_bridge.c b/net/bridge/netfilter/nf_conntrack_bridge.c
> index 816bb0fde718..b8fb81a49377 100644
> --- a/net/bridge/netfilter/nf_conntrack_bridge.c
> +++ b/net/bridge/netfilter/nf_conntrack_bridge.c

...

> @@ -97,6 +97,16 @@ static int nf_br_ip_fragment(struct net *net, struct sock *sk,
>  
>  		return err;
>  	}
> +
> +expand_headroom:
> +	struct sk_buff *expand_skb;

Please move this declaration to the top of the function.

Flagged by W=1 builds with gcc 14.2.0 and clang 20.1.2.

> +
> +	expand_skb = skb_copy_expand(skb, ll_rs, skb_tailroom(skb), GFP_ATOMIC);
> +	if (unlikely(!expand_skb))
> +		goto blackhole;
> +	kfree_skb(skb);
> +	skb = expand_skb;
> +
>  slow_path:
>  	/* This is a linearized skbuff, the original geometry is lost for us.
>  	 * This may also be a clone skbuff, we could preserve the geometry for

...

  reply	other threads:[~2025-04-11 10:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09  7:44 [PATCH] net: Expand headroom to send fragmented packets in bridge fragment forward Huajian Yang
2025-04-11 10:54 ` Simon Horman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-04-09  7:33 Huajian Yang
2025-04-09  9:18 ` Florian Westphal

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=20250411105450.GA395307@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=bridge@lists.linux.dev \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=huajianyang@asrmicro.com \
    --cc=idosch@nvidia.com \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=razor@blackwall.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.