b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Antonio Quartulli <a@unstable.cc>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Simon Wunderlich <simon@open-mesh.com>,
	b.a.t.m.a.n@lists.open-mesh.org,
	Antonio Quartulli <a@unstable.cc>,
	Marek Lindner <mareklindner@neomailbox.ch>
Subject: [B.A.T.M.A.N.] [PATCH 04/16] batman-adv: purge bridge loop avoidance when its disabled
Date: Sat,  9 Jan 2016 21:20:09 +0800	[thread overview]
Message-ID: <1452345621-15908-5-git-send-email-a@unstable.cc> (raw)
In-Reply-To: <1452345621-15908-1-git-send-email-a@unstable.cc>

From: Simon Wunderlich <simon@open-mesh.com>

When bridge loop avoidance is disabled through sysfs, the internal
datastructures are not disabled, but only BLA operations are disabled.
To be sure that they are removed, purge the data immediately. That is
especially useful if a firmwares network state is changed, and the BLA
wait periods should restart on the new network.

Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 net/batman-adv/bridge_loop_avoidance.c | 20 ++++++++++++++++++++
 net/batman-adv/bridge_loop_avoidance.h |  2 ++
 net/batman-adv/sysfs.c                 |  4 +++-
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 99dcae316ec8..d5d71ac96c8a 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -1168,6 +1168,26 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
 	}
 }
 
+/**
+ * batadv_bla_status_update - purge bla interfaces if necessary
+ * @net_dev: the soft interface net device
+ */
+void batadv_bla_status_update(struct net_device *net_dev)
+{
+	struct batadv_priv *bat_priv = netdev_priv(net_dev);
+	struct batadv_hard_iface *primary_if;
+
+	primary_if = batadv_primary_if_get_selected(bat_priv);
+	if (!primary_if)
+		return;
+
+	/* this function already purges everything when bla is disabled,
+	 * so just call that one.
+	 */
+	batadv_bla_update_orig_address(bat_priv, primary_if, primary_if);
+	batadv_hardif_free_ref(primary_if);
+}
+
 /* periodic work to do:
  *  * purge structures when they are too old
  *  * send announcements
diff --git a/net/batman-adv/bridge_loop_avoidance.h b/net/batman-adv/bridge_loop_avoidance.h
index 025152b34282..7ea199b8b5ab 100644
--- a/net/batman-adv/bridge_loop_avoidance.h
+++ b/net/batman-adv/bridge_loop_avoidance.h
@@ -22,6 +22,7 @@
 
 #include <linux/types.h>
 
+struct net_device;
 struct seq_file;
 struct sk_buff;
 
@@ -42,6 +43,7 @@ int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
 void batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
 				    struct batadv_hard_iface *primary_if,
 				    struct batadv_hard_iface *oldif);
+void batadv_bla_status_update(struct net_device *net_dev);
 int batadv_bla_init(struct batadv_priv *bat_priv);
 void batadv_bla_free(struct batadv_priv *bat_priv);
 
diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c
index 9de3c8804ff4..48e2aaddda49 100644
--- a/net/batman-adv/sysfs.c
+++ b/net/batman-adv/sysfs.c
@@ -40,6 +40,7 @@
 #include "distributed-arp-table.h"
 #include "gateway_client.h"
 #include "gateway_common.h"
+#include "bridge_loop_avoidance.h"
 #include "hard-interface.h"
 #include "network-coding.h"
 #include "packet.h"
@@ -549,7 +550,8 @@ static ssize_t batadv_store_isolation_mark(struct kobject *kobj,
 BATADV_ATTR_SIF_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL);
 BATADV_ATTR_SIF_BOOL(bonding, S_IRUGO | S_IWUSR, NULL);
 #ifdef CONFIG_BATMAN_ADV_BLA
-BATADV_ATTR_SIF_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL);
+BATADV_ATTR_SIF_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR,
+		     batadv_bla_status_update);
 #endif
 #ifdef CONFIG_BATMAN_ADV_DAT
 BATADV_ATTR_SIF_BOOL(distributed_arp_table, S_IRUGO | S_IWUSR,
-- 
2.7.0


  parent reply	other threads:[~2016-01-09 13:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-09 13:20 [B.A.T.M.A.N.] pull request: batman-adv 20160109 Antonio Quartulli
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 01/16] batman-adv: Start new development cycle Antonio Quartulli
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 02/16] batman-adv: Fix lockdep annotation of batadv_tlv_container_remove Antonio Quartulli
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 03/16] batman-adv: remove leftovers of unused BATADV_PRIMARIES_FIRST_HOP flag Antonio Quartulli
2016-01-09 13:20 ` Antonio Quartulli [this message]
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 05/16] batman-adv: increase BLA wait periods to 6 Antonio Quartulli
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 06/16] batman-adv: only call post function if something changed Antonio Quartulli
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 07/16] batman-adv: Add function to convert string to batadv throughput Antonio Quartulli
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 08/16] batman-adv: Delete unnecessary checks before the function call "kfree_skb" Antonio Quartulli
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 09/16] batman-adv: Less checks in batadv_tvlv_unicast_send() Antonio Quartulli
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 10/16] batman-adv: Delete an unnecessary check before the function call "batadv_softif_vlan_free_ref" Antonio Quartulli
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 11/16] batman-adv: Split a condition check Antonio Quartulli
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 12/16] batman-adv: Change ifconfig examples to iproute2 Antonio Quartulli
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 13/16] batman-adv: Fix kernel-doc parsing of main structs Antonio Quartulli
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 14/16] batman-adv: Fix kerneldoc member names in for " Antonio Quartulli
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 15/16] batman-adv: Remove kerneldoc for missing struct members Antonio Quartulli
2016-01-09 13:20 ` [B.A.T.M.A.N.] [PATCH 16/16] batman-adv: Add kerneldoc for batadv_neigh_node::refcount Antonio Quartulli
2016-01-10  2:49 ` [B.A.T.M.A.N.] pull request: batman-adv 20160109 David Miller

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=1452345621-15908-5-git-send-email-a@unstable.cc \
    --to=a@unstable.cc \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=mareklindner@neomailbox.ch \
    --cc=netdev@vger.kernel.org \
    --cc=simon@open-mesh.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 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).