netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Mike Acar <mikeacar@gmail.com>
Cc: Jan Engelhardt <jengelh@medozas.de>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Netfilter Developer Mailing List
	<netfilter-devel@vger.kernel.org>
Subject: Re: DROP still returns -EPERM to userspace in OUTPUT chain
Date: Mon, 08 Jun 2009 15:56:47 +0200	[thread overview]
Message-ID: <4A2D189F.6090902@trash.net> (raw)
In-Reply-To: <4664d77a0906062122w7ec23b73p9a322b02b5fb3744@mail.gmail.com>

Mike Acar wrote:
> I'd like to re-open this discussion. I apologize for not responding
> sooner; I've been a bit busy. I'm also not subscribed to
> netfilter-devel, so this message may bounce from there.
> 
> On Sat, May 23, 2009 at 6:20 AM, Jan Engelhardt<jengelh@medozas.de> wrote:
> 
>> Then again, people might be using -m limit -j DROP to simulate actual
>> packet loss, for whatever scientific interests they currently have.
> 
> Which is precisely what happened: I was using DROP to simulate packet
> loss to test timeout handling in a program. The program in question
> does handle errors, but that wasn't the code path I wanted to
> exercise. I wasn't aware of netem, but DROP would be all I needed in
> this case (if it didn't return -EPERM).
> 
> In my former life as a sysadmin, it never occurred to me to interpret
> DROP as "administratively prohibited"; that is what REJECT is for. I
> interpreted DROP as "drop the packet silently, without any response",
> which I think is the intuitive interpretation. An ICMP reply to a
> remote machine is a response, and changing the return value of a
> system call is also a response; neither is desirable.
> 
> The current behavior produces different results on local and remote
> machines - programs on the remote machine time out, while programs on
> the local machine get an error. I think this inconsistency - or
> asymmetry - is undesirable.
> 
> What happens when adding an INPUT DROP rule for a protocol and port
> bound for a socket where a daemon is listening? If we apply this
> interpretation consistently, then when the rule is added, those
> listen() calls should be interrupted and return -EPERM. I don't think
> that's desirable behavior either - I think the kernel should drop the
> packets when they arrive, and the listening daemon should never know
> it happened.
> 
> Pablo Neira Ayuso <pablo@netfilter.org> wrote:
>> Reporting -EPERM seems to me a good practise to report user-space
>> applications that the kernel is explicit dropping the packet. Otherwise,
>> while diagnosing problems, people cannot be sure where the packet has
>> been lost.
> 
> I don't agree. In fact, the current behavior makes this worse, because
> the -EPERM behavior is unexpected (I think the interpretation of DROP
> as silent is very common) and inconsistent (different things happen if
> you're dropping remotely versus locally) - so it's not like you can
> forget that you must check both end's firewalling rules when you're
> diagnosing a problem.

As I said, I'd gladly take a patch to a) propagate errno codes from
netfilter by encoding them in the verdict and b) make the exact
code configurable. The default needs to stay -EPERM however.

      reply	other threads:[~2009-06-08 13:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22  9:44 DROP still returns -EPERM to userspace in OUTPUT chain Jan Engelhardt
2009-05-23 10:47 ` Pablo Neira Ayuso
2009-05-23 11:11   ` Jan Engelhardt
2009-05-23 11:43     ` Pablo Neira Ayuso
2009-05-23 13:20       ` Jan Engelhardt
2009-05-23 15:02         ` Pablo Neira Ayuso
2009-05-25 14:56           ` Patrick McHardy
2009-06-07  4:22         ` Mike Acar
2009-06-08 13:56           ` Patrick McHardy [this message]

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=4A2D189F.6090902@trash.net \
    --to=kaber@trash.net \
    --cc=jengelh@medozas.de \
    --cc=mikeacar@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).