netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yigal Reiss (yreiss)" <yreiss@cisco.com>
To: "netfilter-devel@vger.kernel.org" <netfilter-devel@vger.kernel.org>
Subject: NFQ breaks conntrack creation to confirmation path for a fast UDP stream causing dropped packets
Date: Mon, 28 Mar 2016 18:54:59 +0000	[thread overview]
Message-ID: <0f95cd7b83dc47969639081df1bfe911@XCH-RTP-014.cisco.com> (raw)

Sending a high throughput stream of UDP packets through NFQ causes a few packets to be dropped.

Let's say we have 10 packets with same tuple going in. They all receive different conntrack objects (with confirmed flag unset).

They then get grabbed by user space through NFQ and suppose they all get accept verdict.

The first one to be accepted will go through the standard flow (get confirmed and the conntrack will be entered into the hash table). 

The other 9 packets are reinjected and upon being sent for confirmation (ipv4_confirm) at some point it gets dropped (in __nf_conntrack_confirm). The conditions for being dropped are that a conntrack entry with that tuple already exists. The reason for dropping is given as comment in the code:

/* See if there's one in the list already, including reverse:
NAT could have grabbed it without realizing, since we're
not in the hash.  If there is, we lost race. */

Dropping packets in this case seems like a malfunction IMO. True, UDP is not guaranteed, but still this may in some cases cause degradation in functionality to a working application. Any opinions on that?

Also any ideas for how to resolve this? Seems like there is a strong assumption of serialization in conntrack, that is that one packet enters the ip layer only after the previous packet has left (i.e. confirmed). So any solution that only replaces the contract with the more updated one in the middle (not that I know how to do it) will be only partial (since the packet has already traversed some hooks which may have relied on having a 'good' conntrack). 

Any thoughts appreciated.




                 reply	other threads:[~2016-03-28 18:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=0f95cd7b83dc47969639081df1bfe911@XCH-RTP-014.cisco.com \
    --to=yreiss@cisco.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).