|
@@ -3,13 +3,13 @@ Date: Thu, 2 Apr 2015 20:24:14 +0200
|
|
|
Subject: batman-adv: introduce 'no_rebroadcast' option
|
|
|
|
|
|
diff --git a/batman-adv/files/lib/netifd/proto/batadv.sh b/batman-adv/files/lib/netifd/proto/batadv.sh
|
|
|
-index 632a209..01f567f 100644
|
|
|
+index 1e0c9d0..d0ab238 100644
|
|
|
--- a/batman-adv/files/lib/netifd/proto/batadv.sh
|
|
|
+++ b/batman-adv/files/lib/netifd/proto/batadv.sh
|
|
|
-@@ -6,16 +6,19 @@ init_proto "$@"
|
|
|
-
|
|
|
+@@ -7,19 +7,22 @@ init_proto "$@"
|
|
|
proto_batadv_init_config() {
|
|
|
proto_config_add_string "mesh"
|
|
|
+ proto_config_add_string "routing_algo"
|
|
|
+ proto_config_add_string "mesh_no_rebroadcast"
|
|
|
}
|
|
|
|
|
@@ -17,10 +17,13 @@ index 632a209..01f567f 100644
|
|
|
local config="$1"
|
|
|
local iface="$2"
|
|
|
|
|
|
-- local mesh
|
|
|
-- json_get_vars mesh
|
|
|
-+ local mesh mesh_no_rebroadcast
|
|
|
-+ json_get_vars mesh mesh_no_rebroadcast
|
|
|
+- local mesh routing_algo
|
|
|
+- json_get_vars mesh routing_algo
|
|
|
++ local mesh routing_algo mesh_no_rebroadcast
|
|
|
++ json_get_vars mesh routing_algo mesh_no_rebroadcast
|
|
|
+
|
|
|
+ [ -n "$routing_algo" ] || routing_algo="BATMAN_IV"
|
|
|
+ echo "$routing_algo" > "/sys/module/batman_adv/parameters/routing_algo"
|
|
|
|
|
|
echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface"
|
|
|
+ [ -n "$mesh_no_rebroadcast" ] && echo "$mesh_no_rebroadcast" > "/sys/class/net/$iface/batman_adv/no_rebroadcast"
|
|
@@ -30,12 +33,12 @@ index 632a209..01f567f 100644
|
|
|
}
|
|
|
diff --git a/batman-adv/patches/1001-batman-adv-introduce-no_rebroadcast-option.patch b/batman-adv/patches/1001-batman-adv-introduce-no_rebroadcast-option.patch
|
|
|
new file mode 100644
|
|
|
-index 0000000..3324102
|
|
|
+index 0000000..e9f5ffb
|
|
|
--- /dev/null
|
|
|
+++ b/batman-adv/patches/1001-batman-adv-introduce-no_rebroadcast-option.patch
|
|
|
-@@ -0,0 +1,185 @@
|
|
|
-+From bb9feeed3b49a55034cce90be996b11cd095b1ce Mon Sep 17 00:00:00 2001
|
|
|
-+Message-Id: <bb9feeed3b49a55034cce90be996b11cd095b1ce.1454958586.git.mschiffer@universe-factory.net>
|
|
|
+@@ -0,0 +1,189 @@
|
|
|
++From bb66988dc6972d5400b4ff4f0b49ed090007d635 Mon Sep 17 00:00:00 2001
|
|
|
++Message-Id: <bb66988dc6972d5400b4ff4f0b49ed090007d635.1466049319.git.mschiffer@universe-factory.net>
|
|
|
+From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@web.de>
|
|
|
+Date: Tue, 24 Sep 2013 04:36:27 +0200
|
|
|
+Subject: [PATCH 1/2] batman-adv: introduce 'no_rebroadcast' option
|
|
@@ -63,21 +66,22 @@ index 0000000..3324102
|
|
|
+
|
|
|
+Signed-off-by: Linus Lüssing <linus.luessing@web.de>
|
|
|
+---
|
|
|
-+ .../ABI/testing/sysfs-class-net-batman-adv | 10 ++++
|
|
|
++ .../ABI/testing/sysfs-class-net-batman-adv | 11 ++++
|
|
|
+ net/batman-adv/hard-interface.c | 2 +
|
|
|
+ net/batman-adv/send.c | 4 ++
|
|
|
+ net/batman-adv/sysfs.c | 59 ++++++++++++++++++++++
|
|
|
+ net/batman-adv/types.h | 1 +
|
|
|
-+ 5 files changed, 76 insertions(+)
|
|
|
++ 5 files changed, 77 insertions(+)
|
|
|
+
|
|
|
+diff --git a/Documentation/ABI/testing/sysfs-class-net-batman-adv b/Documentation/ABI/testing/sysfs-class-net-batman-adv
|
|
|
-+index 7f34a95..cf7fe00 100644
|
|
|
++index 518f6a1..896c480 100644
|
|
|
+--- a/Documentation/ABI/testing/sysfs-class-net-batman-adv
|
|
|
++++ b/Documentation/ABI/testing/sysfs-class-net-batman-adv
|
|
|
-+@@ -13,3 +13,13 @@ Description:
|
|
|
++@@ -28,3 +28,14 @@ Description:
|
|
|
++ The /sys/class/net/<iface>/batman-adv/mesh_iface file
|
|
|
+ displays the batman mesh interface this <iface>
|
|
|
+ currently is associated with.
|
|
|
-+
|
|
|
+++
|
|
|
++What: /sys/class/net/<iface>/batman-adv/no_rebroadcast
|
|
|
++Date: Sep 2013
|
|
|
++Contact: Linus Lüssing <linus.luessing@web.de>
|
|
@@ -89,12 +93,12 @@ index 0000000..3324102
|
|
|
++ or wired links. Using this option wrongly is going to
|
|
|
++ break your mesh network, use at your own risk!
|
|
|
+diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
|
|
|
-+index aea4d06..66a703d 100644
|
|
|
++index 8c2f399..48e53d0 100644
|
|
|
+--- a/net/batman-adv/hard-interface.c
|
|
|
++++ b/net/batman-adv/hard-interface.c
|
|
|
-+@@ -657,6 +657,8 @@ batadv_hardif_add_interface(struct net_device *net_dev)
|
|
|
-+ /* extra reference for return */
|
|
|
-+ atomic_set(&hard_iface->refcount, 2);
|
|
|
++@@ -690,6 +690,8 @@ batadv_hardif_add_interface(struct net_device *net_dev)
|
|
|
++ kref_init(&hard_iface->refcount);
|
|
|
++ kref_get(&hard_iface->refcount);
|
|
|
+
|
|
|
++ atomic_set(&hard_iface->no_rebroadcast, 0);
|
|
|
++
|
|
@@ -102,10 +106,10 @@ index 0000000..3324102
|
|
|
+ list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list);
|
|
|
+
|
|
|
+diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
|
|
|
-+index c188f46..145f7cb 100644
|
|
|
++index f2f1256..3736d75 100644
|
|
|
+--- a/net/batman-adv/send.c
|
|
|
++++ b/net/batman-adv/send.c
|
|
|
-+@@ -535,6 +535,10 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
|
|
|
++@@ -578,6 +578,10 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
|
|
|
+ if (forw_packet->num_packets >= hard_iface->num_bcasts)
|
|
|
+ continue;
|
|
|
+
|
|
@@ -113,14 +117,14 @@ index 0000000..3324102
|
|
|
++ forw_packet->skb->dev == hard_iface->net_dev)
|
|
|
++ continue;
|
|
|
++
|
|
|
-+ /* send a copy of the saved skb */
|
|
|
-+ skb1 = skb_clone(forw_packet->skb, GFP_ATOMIC);
|
|
|
-+ if (skb1)
|
|
|
++ if (!kref_get_unless_zero(&hard_iface->refcount))
|
|
|
++ continue;
|
|
|
++
|
|
|
+diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c
|
|
|
-+index f38d7b7..600633c 100644
|
|
|
++index 414b207..9aa043f 100644
|
|
|
+--- a/net/batman-adv/sysfs.c
|
|
|
++++ b/net/batman-adv/sysfs.c
|
|
|
-+@@ -131,6 +131,17 @@ struct batadv_attribute batadv_attr_vlan_##_name = { \
|
|
|
++@@ -134,6 +134,17 @@ struct batadv_attribute batadv_attr_vlan_##_name = { \
|
|
|
+ .store = _store, \
|
|
|
+ }
|
|
|
+
|
|
@@ -138,9 +142,9 @@ index 0000000..3324102
|
|
|
+ /* Use this, if you have customized show and store functions */
|
|
|
+ #define BATADV_ATTR(_name, _mode, _show, _store) \
|
|
|
+ struct batadv_attribute batadv_attr_##_name = { \
|
|
|
-+@@ -241,6 +252,52 @@ ssize_t batadv_show_vlan_##_name(struct kobject *kobj, \
|
|
|
-+ static BATADV_ATTR_VLAN(_name, _mode, batadv_show_vlan_##_name, \
|
|
|
-+ batadv_store_vlan_##_name)
|
|
|
++@@ -293,6 +304,52 @@ ssize_t batadv_show_##_name(struct kobject *kobj, \
|
|
|
++ static BATADV_ATTR(_name, _mode, batadv_show_##_name, \
|
|
|
++ batadv_store_##_name)
|
|
|
+
|
|
|
++#define BATADV_ATTR_HIF_STORE_BOOL(_name, _post_func) \
|
|
|
++ssize_t batadv_store_hif_##_name(struct kobject *kobj, \
|
|
@@ -158,7 +162,7 @@ index 0000000..3324102
|
|
|
++ res = __batadv_store_bool_attr(buff, count, _post_func, \
|
|
|
++ attr, &hard_iface->_name, \
|
|
|
++ hard_iface->soft_iface); \
|
|
|
-++ batadv_hardif_free_ref(hard_iface); \
|
|
|
+++ batadv_hardif_put(hard_iface); \
|
|
|
++ return res; \
|
|
|
++}
|
|
|
++
|
|
@@ -177,7 +181,7 @@ index 0000000..3324102
|
|
|
++ res = sprintf(buff, "%s\n", \
|
|
|
++ atomic_read(&hard_iface->_name) == 0 ? \
|
|
|
++ "disabled" : "enabled"); \
|
|
|
-++ batadv_hardif_free_ref(hard_iface); \
|
|
|
+++ batadv_hardif_put(hard_iface); \
|
|
|
++ return res; \
|
|
|
++}
|
|
|
++
|
|
@@ -191,24 +195,27 @@ index 0000000..3324102
|
|
|
+ static int batadv_store_bool_attr(char *buff, size_t count,
|
|
|
+ struct net_device *net_dev,
|
|
|
+ const char *attr_name, atomic_t *attr,
|
|
|
-+@@ -870,10 +927,12 @@ static ssize_t batadv_show_iface_status(struct kobject *kobj,
|
|
|
++@@ -993,6 +1050,7 @@ static ssize_t batadv_show_throughput_override(struct kobject *kobj,
|
|
|
+ static BATADV_ATTR(mesh_iface, S_IRUGO | S_IWUSR, batadv_show_mesh_iface,
|
|
|
+ batadv_store_mesh_iface);
|
|
|
+ static BATADV_ATTR(iface_status, S_IRUGO, batadv_show_iface_status, NULL);
|
|
|
++BATADV_ATTR_HIF_BOOL(no_rebroadcast, S_IRUGO | S_IWUSR, NULL);
|
|
|
-+
|
|
|
++ #ifdef CONFIG_BATMAN_ADV_BATMAN_V
|
|
|
++ BATADV_ATTR_HIF_UINT(elp_interval, bat_v.elp_interval, S_IRUGO | S_IWUSR,
|
|
|
++ 2 * BATADV_JITTER, INT_MAX, NULL);
|
|
|
++@@ -1004,6 +1062,7 @@ static BATADV_ATTR(throughput_override, S_IRUGO | S_IWUSR,
|
|
|
+ static struct batadv_attribute *batadv_batman_attrs[] = {
|
|
|
+ &batadv_attr_mesh_iface,
|
|
|
+ &batadv_attr_iface_status,
|
|
|
++ &batadv_attr_hif_no_rebroadcast,
|
|
|
-+ NULL,
|
|
|
-+ };
|
|
|
-+
|
|
|
++ #ifdef CONFIG_BATMAN_ADV_BATMAN_V
|
|
|
++ &batadv_attr_elp_interval,
|
|
|
++ &batadv_attr_throughput_override,
|
|
|
+diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
|
|
|
-+index 5e8c8df..913f104 100644
|
|
|
++index ba846b0..1a596c5 100644
|
|
|
+--- a/net/batman-adv/types.h
|
|
|
++++ b/net/batman-adv/types.h
|
|
|
-+@@ -120,6 +120,7 @@ struct batadv_hard_iface {
|
|
|
++@@ -156,6 +156,7 @@ struct batadv_hard_iface {
|
|
|
+ struct hlist_head neigh_list;
|
|
|
+ /* neigh_list_lock protects: neigh_list */
|
|
|
+ spinlock_t neigh_list_lock;
|
|
@@ -217,5 +224,5 @@ index 0000000..3324102
|
|
|
+
|
|
|
+ /**
|
|
|
+--
|
|
|
-+2.7.0
|
|
|
++2.8.3
|
|
|
+
|