Repository : ssh://git@open-mesh.org/openwrt-feed-batman-adv
On branch : master
commit 6bbb08cdf2a3126351646e77d1d1c6a1e77a9603 Author: Marek Lindner lindner_marek@yahoo.de Date: Sun Jan 13 20:38:20 2013 +0800
batman-adv-devel: netifd integration for batman-adv
Signed-off-by: Gui Iribarren gui@altermundi.net Signed-off-by: Moritz Warning moritzwarning@web.de Signed-off-by: Marek Lindner lindner_marek@yahoo.de
6bbb08cdf2a3126351646e77d1d1c6a1e77a9603 batman-adv-devel/Config.in | 4 +-- batman-adv-devel/Makefile | 4 +-- batman-adv-devel/files/etc/config/batman-adv | 1 - .../files/etc/hotplug.d/iface/99-batman-adv | 12 ------- .../files/etc/hotplug.d/net/99-batman-adv | 3 -- batman-adv-devel/files/lib/batman-adv/config.sh | 34 -------------------- batman-adv-devel/files/lib/netifd/proto/batadv.sh | 30 +++++++++++++++++ 7 files changed, 34 insertions(+), 54 deletions(-)
diff --git a/batman-adv-devel/Config.in b/batman-adv-devel/Config.in index d7404fb..c3a7162 100644 --- a/batman-adv-devel/Config.in +++ b/batman-adv-devel/Config.in @@ -27,7 +27,7 @@ config KMOD_BATMAN_ADV_DEVEL_BATMAN_REV string prompt "batman-adv git revision to build package with" depends PACKAGE_kmod-batman-adv-devel - default "59f8434" + default "a33c882" help Enter the full or shortened git revision to override package default value. This allows to build from non-master branches @@ -37,7 +37,7 @@ config KMOD_BATMAN_ADV_DEVEL_BATCTL_REV string prompt "batctl git revision to build package with" depends PACKAGE_kmod-batman-adv-devel - default "d81bf38" + default "0e2efdc" help Enter the full or shortened git revision to override package default value. This allows to build from non-master branches diff --git a/batman-adv-devel/Makefile b/batman-adv-devel/Makefile index e80b49a..7bbb75e 100644 --- a/batman-adv-devel/Makefile +++ b/batman-adv-devel/Makefile @@ -113,11 +113,11 @@ define Build/Clean endef
define KernelPackage/batman-adv-devel/install - $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(1)/lib/batman-adv $(1)/usr/sbin + $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(1)/lib/batman-adv $(1)/usr/sbin $(1)/lib/netifd/proto $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config $(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv $(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net - $(INSTALL_BIN) ./files/etc/hotplug.d/iface/99-batman-adv $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) ./files/lib/netifd/proto/batadv.sh $(1)/lib/netifd/proto $(INSTALL_BIN) ./files/usr/sbin/batman-adv $(1)/usr/sbin $(BATCTL_INSTALL) endef diff --git a/batman-adv-devel/files/etc/config/batman-adv b/batman-adv-devel/files/etc/config/batman-adv index 6ec9e03..6a62203 100644 --- a/batman-adv-devel/files/etc/config/batman-adv +++ b/batman-adv-devel/files/etc/config/batman-adv @@ -1,6 +1,5 @@
config 'mesh' 'bat0' - option 'interfaces' 'mesh' option 'aggregated_ogms' option 'ap_isolation' option 'bonding' diff --git a/batman-adv-devel/files/etc/hotplug.d/iface/99-batman-adv b/batman-adv-devel/files/etc/hotplug.d/iface/99-batman-adv deleted file mode 100644 index 9206c42..0000000 --- a/batman-adv-devel/files/etc/hotplug.d/iface/99-batman-adv +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -. /lib/batman-adv/config.sh - -bat_load_module -config_load batman-adv - -case "$ACTION" in - ifup) - [ -d /sys/class/net/$DEVICE/batman_adv/ ] && config_foreach bat_add_interface mesh "$DEVICE" - ;; -esac diff --git a/batman-adv-devel/files/etc/hotplug.d/net/99-batman-adv b/batman-adv-devel/files/etc/hotplug.d/net/99-batman-adv index 47132c1..f0c391f 100644 --- a/batman-adv-devel/files/etc/hotplug.d/net/99-batman-adv +++ b/batman-adv-devel/files/etc/hotplug.d/net/99-batman-adv @@ -9,7 +9,4 @@ case "$ACTION" in add) [ -d /sys/class/net/$INTERFACE/mesh/ ] && bat_config "$INTERFACE" ;; - remove) - [ -d /sys/class/net/$INTERFACE/batman_adv/ ] && config_foreach bat_del_interface mesh "$INTERFACE" - ;; esac diff --git a/batman-adv-devel/files/lib/batman-adv/config.sh b/batman-adv-devel/files/lib/batman-adv/config.sh index 5260c01..ae102e9 100644 --- a/batman-adv-devel/files/lib/batman-adv/config.sh +++ b/batman-adv-devel/files/lib/batman-adv/config.sh @@ -44,37 +44,3 @@ bat_config() [ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval [ -n "$vis_mode" ] && echo $vis_mode > /sys/class/net/$mesh/mesh/vis_mode } - -bat_add_interface() -{ - local mesh="$1" - local interface="$2" - local interfaces - - config_get interfaces $mesh interfaces - for iface in $interfaces; do - [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || { - iface=$(uci -q -P/var/state get network.$iface.ifname) - [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || continue - } - - [ "$iface" = "$interface" ] && echo $mesh > /sys/class/net/$iface/batman_adv/mesh_iface - done -} - -bat_del_interface() -{ - local mesh="$1" - local interface="$2" - local interfaces - - config_get interfaces $mesh interfaces - for iface in $interfaces; do - [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || { - iface=$(uci -q -P/var/state get network.$iface.ifname) - [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || continue - } - - [ "$iface" = "$interface" ] && echo none > /sys/class/net/$iface/batman_adv/mesh_iface - done -} diff --git a/batman-adv-devel/files/lib/netifd/proto/batadv.sh b/batman-adv-devel/files/lib/netifd/proto/batadv.sh new file mode 100644 index 0000000..632a209 --- /dev/null +++ b/batman-adv-devel/files/lib/netifd/proto/batadv.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +. /lib/functions.sh +. ../netifd-proto.sh +init_proto "$@" + +proto_batadv_init_config() { + proto_config_add_string "mesh" +} + +proto_batadv_setup() { + local config="$1" + local iface="$2" + + local mesh + json_get_vars mesh + + echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface" + proto_init_update "$iface" 1 + proto_send_update "$config" +} + +proto_batadv_teardown() { + local config="$1" + local iface="$2" + + echo "none" > "/sys/class/net/$iface/batman_adv/mesh_iface" || true +} + +add_protocol batadv