netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: nf-devel <netfilter-devel@vger.kernel.org>
Subject: Re: nfqueue: detect when packet has already been checksummed?
Date: Wed, 29 May 2013 13:57:05 +0200	[thread overview]
Message-ID: <20130529115705.GA5315@localhost> (raw)
In-Reply-To: <20130529112542.GE6578@breakpoint.cc>

On Wed, May 29, 2013 at 01:25:42PM +0200, Florian Westphal wrote:
> Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > On Sun, May 26, 2013 at 10:48:26PM +0200, Florian Westphal wrote:
> > > Hi.
> > > 
> > > When using nfqueue, userspace currently has no way
> > > to tell wheter queued packets have a bad checksum, i.e.
> > > applications that need data integrity must do full checksum
> > > validation in userspace (except maybe when only queueing in OUTPUT).
> > > 
> > > However, there are several places where incoming packets are already
> > > checksummed in kernel, before packet hits nfqueue, e.g. via nic rx
> > > csum offload, or in conntrack.
> > > 
> > > So I think it would be nice to provide a hint that kernel already did
> > > checksumming.
> > > 
> > > The SKB_INFO attribute added in -net for GRO support seems like a
> > > candidate.  However, since 'already checksummed' is the common case this
> > > would mean adding that attribute most of the time.
> > > 
> > > Unless we would do the opposite hint, i.e. tell userspace when
> > > checksumming has NOT been performed yet.
> > > 
> > > Such change would however need to go into -net, else userspace can't tell
> > > 'checksum ok' from 'kernel too old to provide flag in SKB_INFO attribute'.
> > 
> > User-space has no way to know what info flags are available. If we add
> > more info flags in the future, we'll have the same problem that we have
> > now. I mean, currently an unset info flag from userspace may mean:
> >
> > * It's actually unset.
> > * It is not available in this kernel.
> 
> Yes, I understand this.
> 
> > So I think we need to pass a mask of available info flags, so
> > user-space knows how to interpret what 'unset' means. The mask would
> > also help to tell user-space that some info flag is not available.
> 
> I plan to add a query feature that userspace can use to determine
> supported attributes/flags.
>
> Userspace can then bind the queue and then figure out what
> attributes are support.
> 
> A more simple solution is to simply add a 32bit revision number
> that is dumped to userspace.
>
> But regardless of the solution, its definitely -next material.
>
> I simply tried do get one-more-thing into -net.  If you say no,
> thats ok.

I agree that the current situation is inconsistent. We have no way to
know if the kernel validated the checksum or not from user-space, and
I think this needs a fix.

We can add a new NFQA_CFG_F_CSUM flag so user-space explicitly ask for
assistance regarding checksumming from the kernel. If user-space tries
to set that flag and the kernel does not support it, it will hit
-EOPNOTSUPP. Thus, we can skip the feature retrieval thing.

We would still need your patch as well.

  reply	other threads:[~2013-05-29 11:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-26 20:48 nfqueue: detect when packet has already been checksummed? Florian Westphal
2013-05-26 20:48 ` [PATCH] netfilter: nf_queue: add NFQA_SKB_CSUM_NOTVERIFIED info flag Florian Westphal
2013-06-29 12:45   ` Pablo Neira Ayuso
2013-05-29 11:14 ` nfqueue: detect when packet has already been checksummed? Pablo Neira Ayuso
2013-05-29 11:25   ` Florian Westphal
2013-05-29 11:57     ` Pablo Neira Ayuso [this message]
2013-05-29 12:03       ` Florian Westphal
2013-05-29 12:23         ` Pablo Neira Ayuso
2013-05-29 13:25           ` 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=20130529115705.GA5315@localhost \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --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).