b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@meshcoding.com>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Antonio Quartulli <antonio@meshcoding.com>
Subject: [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: clean nf state when removing protocol header
Date: Mon, 23 Dec 2013 01:28:05 +0100	[thread overview]
Message-ID: <1387758485-3568-2-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1387758485-3568-1-git-send-email-antonio@meshcoding.com>

If an interface enslaved into batman-adv is a bridge (or a
virtual interface built on top of a bridge) the nf_bridge
member of the skbs reaching the soft-interface is filled
with the state about "netfilter bridge" operations.

Then, if one of such skbs is locally delivered, the nf_bridge
member should be cleaned up to avoid that the old state
could mess up with other "netfilter bridge" operations when
entering a second bridge.
This is needed because batman-adv is an encapsulation
protocol.

However at the moment skb->nf_bridge is not released at all
leading to bogus "netfilter bridge" behaviours.

Fix this by cleaning the netfilter state of the skb before
it gets delivered to the upper layer in interface_rx().

Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
 soft-interface.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/soft-interface.c b/soft-interface.c
index 33b6144..08086cf 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -324,6 +324,11 @@ void batadv_interface_rx(struct net_device *soft_iface,
 	skb_pull_rcsum(skb, hdr_size);
 	skb_reset_mac_header(skb);
 
+	/* clean the netfilter state now that the batman-adv header has been
+	 * removed
+	 */
+	nf_reset(skb);
+
 	ethhdr = eth_hdr(skb);
 
 	switch (ntohs(ethhdr->h_proto)) {
-- 
1.8.5.2


  reply	other threads:[~2013-12-23  0:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-23  0:28 [B.A.T.M.A.N.] [PATCH maint 1/2] Revert "batman-adv: free nf_bridge member on locally delivered skb" Antonio Quartulli
2013-12-23  0:28 ` Antonio Quartulli [this message]
2013-12-23 12:19   ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: clean nf state when removing protocol header Marek Lindner
2013-12-23 12:17 ` [B.A.T.M.A.N.] [PATCH maint 1/2] Revert "batman-adv: free nf_bridge member on locally delivered skb" Marek Lindner

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=1387758485-3568-2-git-send-email-antonio@meshcoding.com \
    --to=antonio@meshcoding.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.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).