From 5cf2f3b3b09cca4d98169eaada884cfffd08237c Mon Sep 17 00:00:00 2001 From: marek Date: Sat, 11 Feb 2012 18:15:36 +0000 Subject: [PATCH] batman-adv: hotplug script fixes * call bat_config() instead of config_bat() (which does not exist) * support ap isolation config option * remove /etc/rc.common from script since it is not an init script anymore Signed-off-by: Filippo Sallemi git-svn-id: svn://svn.openwrt.org/openwrt/packages@30457 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../files/etc/hotplug.d/net/99-batman-adv | 2 +- net/batman-adv/files/lib/batman-adv/config.sh | 3 +++ net/batman-adv/files/usr/sbin/batman-adv | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/net/batman-adv/files/etc/hotplug.d/net/99-batman-adv b/net/batman-adv/files/etc/hotplug.d/net/99-batman-adv index 2ad83cf4e..fe19e6470 100644 --- a/net/batman-adv/files/etc/hotplug.d/net/99-batman-adv +++ b/net/batman-adv/files/etc/hotplug.d/net/99-batman-adv @@ -6,7 +6,7 @@ config_load batman-adv case "$ACTION" in add) - [ -d /sys/class/net/$INTERFACE/mesh/ ] && config_bat "$INTERFACE" + [ -d /sys/class/net/$INTERFACE/mesh/ ] && bat_config "$INTERFACE" [ -d /sys/class/net/$INTERFACE/batman_adv/ ] && config_foreach bat_add_interface mesh "$INTERFACE" ;; remove) diff --git a/net/batman-adv/files/lib/batman-adv/config.sh b/net/batman-adv/files/lib/batman-adv/config.sh index d0569bc77..044c2f64b 100644 --- a/net/batman-adv/files/lib/batman-adv/config.sh +++ b/net/batman-adv/files/lib/batman-adv/config.sh @@ -14,6 +14,7 @@ bat_config(){ config_get orig_interval "$mesh" orig_interval config_get hop_penalty "$mesh" hop_penalty config_get vis_mode "$mesh" vis_mode + config_get ap_isolation "$mesh" ap_isolation [ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval [ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty @@ -25,6 +26,8 @@ bat_config(){ [ -n "$gw_mode" ] && echo $gw_mode > /sys/class/net/$mesh/mesh/gw_mode [ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class [ -n "$vis_mode" ] && echo $vis_mode > /sys/class/net/$mesh/mesh/vis_mode + [ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation + } bat_add_interface(){ diff --git a/net/batman-adv/files/usr/sbin/batman-adv b/net/batman-adv/files/usr/sbin/batman-adv index 4f1799171..6580756ab 100644 --- a/net/batman-adv/files/usr/sbin/batman-adv +++ b/net/batman-adv/files/usr/sbin/batman-adv @@ -1,6 +1,7 @@ -#!/bin/sh /etc/rc.common +#!/bin/sh # Copyright (C) 2011 OpenWrt.org +. /etc/functions.sh . /lib/batman-adv/config.sh start_mesh() { @@ -44,3 +45,15 @@ stop () { config_foreach stop_mesh mesh fi } + +restart() { + stop $1 + start $1 +} + +case "$1" in + start) start $2 ;; + stop) stop $2 ;; + restart) restart $2 ;; + *) echo "Usage: batman-adv [mesh instance]" +esac