All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: netfilter-devel@vger.kernel.org
Subject: nfqueue max copy_range broken, how to fix/mitigate?
Date: Fri, 17 Aug 2012 11:12:07 +0200	[thread overview]
Message-ID: <20120817091207.GA12344@breakpoint.cc> (raw)

nf_queue claims to support copy size of up to 0xffff:

case NFQNL_COPY_PACKET:
        /* we're using struct nlattr which has 16bit nla_len */
        if (range > 0xffff)
               queue->copy_range = 0xffff;

Which is incorrect, as the maximum attribute size is 0xffff - NLA_HDRLEN.
Thus, when trying to queue a maximum-sized IP packet, you get
NFQA_PAYLOAD with nla->len = 4 (due to overflow), i.e. no payload at
all.

Since this is a limitation of netlink this isn't fixable in nfqueue.
How to best handle this situation?

We can either truncate and queue 0xffff - NLA_HDRLEN (i.e., cut off 4
bytes from what will be queued), or we could refuse to queue the packet
(userspace asked for the full packet, but we can't fullfill the
 request).

Any ideas/suggestions?

Thanks,
Florian

             reply	other threads:[~2012-08-17  9:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-17  9:12 Florian Westphal [this message]
2012-08-17 10:53 ` nfqueue max copy_range broken, how to fix/mitigate? 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=20120817091207.GA12344@breakpoint.cc \
    --to=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 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.