All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: Philip Craig <philipc@snapgear.com>,
	Nir Tzachar <nir.tzachar@gmail.com>,
	netfilter-devel@vger.kernel.org
Subject: Re: Fix ipt_REJECT problem with nf_bridge
Date: Mon, 16 Mar 2009 16:11:16 +0100	[thread overview]
Message-ID: <49BE6C14.9030802@trash.net> (raw)
In-Reply-To: <alpine.LSU.2.00.0903120341520.31440@fbirervta.pbzchgretzou.qr>

Jan Engelhardt wrote:
> If I read the comments in ip_route_me_harder correctly, RTN_LOCAL
> must not be used when ipt_REJECT generates the RST packet with a
> source address that does not belong to the firewall itself. In other
> words, if it is forwarded (hence the NF_INET_FORWARD check).

Correct.

> If hook is INPUT or OUTPUT, saddr will be ours anyway (except maybe
> in TPROXY setups, yayay, don't wanna think about that right now ;-)
> so RTN_LOCAL is ok.
> 
> Now look at (hook == NF_INET_FORWARD && BRNF_BRIDGED). For a plain
> packet to arrive in the FORWARD chain, daddr must not be local. So
> when the address tuple is reversed for the RST packet, saddr will not
> be a local address.
> 
> This is the commit that originally introduced the BRNF_BRIDGED clause:
> 
> commit dbf3813cdabe3c0336667bbf3347652cb897e365 (v2.6.5-rc3-27-gdbf3813)
> Author: Bart De Schuymer <bdschuym@pandora.be>
> Date:   Tue Mar 30 23:18:10 2004 -0800
> 
>     [NETFILTER]: Do not require ip_forwarding for reset on a bridge.
>     
>     Currently, to be able to send a reset in the FORWARD chain of iptables
>     for bridged traffic, ip forwarding must be enabled. This causes confusion
>     and in some situations people really don't want to enable ip forwarding.
>     The patch below lets the user send reset packets for bridged frames in
>     the FORWARD chain, with ip forwarding disabled (as long as there is a
>     route).
> 
> FYI: This is talking about "pure"-bridged traffic, i.e. traffic that will
> go from one bridge port to another without touching the "routing decision"
> box in [1]. In iptables terminology, that's
> 
> 	FORWARD -i br0 -o br0
> 
> style traffic. Since the RST packet REJECT creates goes through
> OUTPUT, so I would assume no forwarding would take place, and the
> ip_forward flag not be relevant. The BRNF_BRIDGED clause therefore
> seems wrong because it will always be a non-local saddr.

Packets with non-local saddrs are routed similar to forward packets
(meaning the use ip_route_input and set an input device for policy
routing). This is also where the forwarding check kicks in.

We should actually be able to avoid these hacks nowadays since
routing allows to override the "output must use local source"
check using FLOWI_FLAG_ANYSRC.

      parent reply	other threads:[~2009-03-16 15:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-26  8:48 [PATCH]: Fix ipt_REJECT problem with nf_bridge Nir Tzachar
2009-03-10  5:29 ` Nir Tzachar
2009-03-10  5:43   ` Philip Craig
2009-03-11  9:29     ` Nir Tzachar
2009-03-11 11:44       ` Nir Tzachar
2009-03-12  1:04         ` Philip Craig
2009-03-12  3:25           ` Jan Engelhardt
2009-03-12  6:04             ` Philip Craig
2009-03-12 10:35               ` Jan Engelhardt
     [not found]                 ` <9b2db90b0903120516n1f9e67ck8994c9b92bb6aa0a@mail.gmail.com>
2009-03-12 12:17                   ` Nir Tzachar
2009-03-13  0:50                 ` Philip Craig
2009-03-16 15:11             ` 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=49BE6C14.9030802@trash.net \
    --to=kaber@trash.net \
    --cc=jengelh@medozas.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=nir.tzachar@gmail.com \
    --cc=philipc@snapgear.com \
    /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.