All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nir Tzachar <nir.tzachar@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: coreteam@netfilter.org
Subject: [PATCH]: Fix ipt_REJECT problem with nf_bridge
Date: Thu, 26 Feb 2009 10:48:26 +0200	[thread overview]
Message-ID: <9b2db90b0902260048j514b6ab0w63038bd11ab3f8f6@mail.gmail.com> (raw)

Hello.

There is a problem with the current version of ipt_REJECT when
operating on a bridge interface.
To be more exact, an RST is never sent to connections over the bridge,
as the ip_route_me_harder function always fail.

The problem arises from the following code
(net/ipv4/netfilter/ipt_REJECT.c line 221:)

        if (hook != NF_INET_FORWARD
#ifdef CONFIG_BRIDGE_NETFILTER
            || (nskb->nf_bridge && nskb->nf_bridge->mask & BRNF_BRIDGED)
#endif
           )
                addr_type = RTN_LOCAL;

but, as nskb was newly allocated just a few line back, the
oldskb->nf_bridge was never copied, so nskb->nf_bridge is always NULL.
The following patch corrects the problem. Please review and apply.

Cheers, Nir.


Signed-off-by: Nir Tzachar <nir.tzachar@gmail.com>
Tested-by: Elad Kertis <elad.kertis@gmail.com>

--- linux-2.6.28.7.old/net/ipv4/netfilter/ipt_REJECT.c	2009-02-26
10:28:51.000000000 +0200
+++ linux-2.6.28.7/net/ipv4/netfilter/ipt_REJECT.c	2009-02-26
10:31:26.000000000 +0200
@@ -98,6 +98,12 @@
 				       niph->saddr, niph->daddr,
 				       csum_partial(tcph,
 						    sizeof(struct tcphdr), 0));
+#ifdef CONFIG_BRIDGE_NETFILTER
+	if (oldskb->nf_bridge){
+		nf_bridge_get(oldskb->nf_bridge);
+		nskb->nf_bridge = oldskb->nf_bridge;
+	}
+#endif

 	addr_type = RTN_UNSPEC;
 	if (hook != NF_INET_FORWARD

             reply	other threads:[~2009-02-26  8:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-26  8:48 Nir Tzachar [this message]
2009-03-10  5:29 ` [PATCH]: Fix ipt_REJECT problem with nf_bridge 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

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=9b2db90b0902260048j514b6ab0w63038bd11ab3f8f6@mail.gmail.com \
    --to=nir.tzachar@gmail.com \
    --cc=coreteam@netfilter.org \
    --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.