[maint,2/2] batman-adv: clean nf state when removing protocol header

Message ID 1387758485-3568-2-git-send-email-antonio@meshcoding.com (mailing list archive)
State Accepted, archived
Commit 135602880b28bc7cf12c60fec550a6122851f2e9
Headers

Commit Message

Antonio Quartulli Dec. 23, 2013, 12:28 a.m. UTC
  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(+)
  

Comments

Marek Lindner Dec. 23, 2013, 12:19 p.m. UTC | #1
On Monday 23 December 2013 01:28:05 Antonio Quartulli wrote:
> 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(+)

Applied in revision 1356028.

Thanks,
Marek
  

Patch

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)) {