netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Alexander Duyck <alexanderduyck@fb.com>
Cc: Florian Westphal <fw@strlen.de>,
	"netfilter-devel@vger.kernel.org"
	<netfilter-devel@vger.kernel.org>,
	"edumazet@google.com" <edumazet@google.com>
Subject: Re: [PATCH nf 3/4] netfilter: conntrack_ftp: prefer skb_linearize
Date: Tue, 9 Aug 2022 18:07:20 +0200	[thread overview]
Message-ID: <20220809160720.GA26023@breakpoint.cc> (raw)
In-Reply-To: <SA1PR15MB51371BED076EBB8032CC6F3EBD629@SA1PR15MB5137.namprd15.prod.outlook.com>

Alexander Duyck <alexanderduyck@fb.com> wrote:
> > -	spin_lock_bh(&nf_ftp_lock);
> > -	fb_ptr = skb_header_pointer(skb, dataoff, datalen, ftp_buffer);
> > -	if (!fb_ptr) {
> > -		spin_unlock_bh(&nf_ftp_lock);
> > -		return NF_ACCEPT;
> > -	}
> > +	spin_lock_bh(&ct->lock);
> > +	fb_ptr = skb->data + dataoff;
> > 
> >  	ends_in_nl = (fb_ptr[datalen - 1] == '\n');
> >  	seq = ntohl(th->seq) + datalen;
> 
> Rather than using skb_header_pointer/skb_linearize is there any reason why you couldn't use pskb_may_pull? It seems like that would be much closer to what you are looking for here rather than linearizing the entire buffer. With that you would have access to all the same headers you did with the skb_header_pointer approach and in most cases the copy should just be skipped since the headlen is already in the skb->data buffer.

This helper is written with the assumption that everything is searchable
via 'const char *'.

I'm not going to submit a patch to -net that rewrites this,
and I'm not sure its worth it to spend time on it for -next either.

  reply	other threads:[~2022-08-09 16:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09 13:16 [PATCH nf 0/4] netfilter: conntrack: remove 64kb max size assumptions Florian Westphal
2022-08-09 13:16 ` [PATCH nf 1/4] netfilter: conntrack: sane: remove pseudo skb linearization Florian Westphal
2022-08-09 13:16 ` [PATCH nf 2/4] netfilter: conntrack: h323: cap packet size at 64k Florian Westphal
2022-08-09 13:16 ` [PATCH nf 3/4] netfilter: conntrack_ftp: prefer skb_linearize Florian Westphal
2022-08-09 15:36   ` Alexander Duyck
2022-08-09 16:07     ` Florian Westphal [this message]
2022-08-09 16:54       ` Alexander Duyck
2022-08-09 22:38         ` Florian Westphal
2022-08-09 13:16 ` [PATCH nf 4/4] netfilter: conntrack_irc: cap packet search space to 4k Florian Westphal
2022-08-11 14:41 ` [PATCH nf 0/4] netfilter: conntrack: remove 64kb max size assumptions Pablo Neira Ayuso

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=20220809160720.GA26023@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=alexanderduyck@fb.com \
    --cc=edumazet@google.com \
    --cc=netfilter-devel@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;
as well as URLs for NNTP newsgroup(s).