batman-adv: upgrade package to latest release (2011.3.0)
Also split init script into lib and init script as suggested by Filippo Sallemi to allow including the lib from a hotplug script. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> git-svn-id: svn://svn.openwrt.org/openwrt/packages@28066 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
67815493c8
commit
7536d44ef0
@ -10,9 +10,9 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=batman-adv
|
PKG_NAME:=batman-adv
|
||||||
|
|
||||||
PKG_VERSION:=2011.2.0
|
PKG_VERSION:=2011.3.0
|
||||||
PKG_MD5SUM:=1ef45406201913cc08ac01e47ad2d034
|
PKG_MD5SUM:=0ba4b63f7fe9d2a561662cdc0378caa5
|
||||||
BATCTL_MD5SUM:=69e7fe915f2c1867b74e6efe7c627dd5
|
BATCTL_MD5SUM:=8eb197896049bb04a6beef56015a16b6
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
|
PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
|
||||||
@ -27,7 +27,7 @@ define KernelPackage/batman-adv
|
|||||||
URL:=http://www.open-mesh.org/
|
URL:=http://www.open-mesh.org/
|
||||||
MAINTAINER:=Marek Lindner <lindner_marek@yahoo.de>
|
MAINTAINER:=Marek Lindner <lindner_marek@yahoo.de>
|
||||||
SUBMENU:=Network Support
|
SUBMENU:=Network Support
|
||||||
DEPENDS:=@!LINUX_2_4
|
DEPENDS:=@!LINUX_2_4 +kmod-crc16
|
||||||
TITLE:=B.A.T.M.A.N. Adv
|
TITLE:=B.A.T.M.A.N. Adv
|
||||||
FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX)
|
FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX)
|
||||||
AUTOLOAD:=$(call AutoLoad,50,batman-adv)
|
AUTOLOAD:=$(call AutoLoad,50,batman-adv)
|
||||||
@ -61,7 +61,7 @@ MAKE_BATCTL_ARGS += \
|
|||||||
CC="$(TARGET_CC)" \
|
CC="$(TARGET_CC)" \
|
||||||
NODEBUG=1 \
|
NODEBUG=1 \
|
||||||
UNAME="Linux" \
|
UNAME="Linux" \
|
||||||
INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
|
DESTDIR="$(PKG_INSTALL_DIR)" \
|
||||||
STRIP="/bin/true" \
|
STRIP="/bin/true" \
|
||||||
batctl install
|
batctl install
|
||||||
|
|
||||||
@ -104,16 +104,18 @@ endef
|
|||||||
|
|
||||||
ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
|
ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
|
||||||
define KernelPackage/batman-adv/install
|
define KernelPackage/batman-adv/install
|
||||||
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d $(1)/lib/batman-adv
|
||||||
$(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d
|
$(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d
|
||||||
|
$(INSTALL_BIN) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv
|
||||||
$(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
|
$(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/batctl $(1)/usr/sbin/
|
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl $(1)/usr/sbin/
|
||||||
endef
|
endef
|
||||||
else
|
else
|
||||||
define KernelPackage/batman-adv/install
|
define KernelPackage/batman-adv/install
|
||||||
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d $(1)/lib/batman-adv
|
||||||
$(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d
|
$(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d
|
||||||
|
$(INSTALL_BIN) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv
|
||||||
$(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
|
$(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
|
||||||
endef
|
endef
|
||||||
endif
|
endif
|
||||||
|
@ -3,101 +3,7 @@
|
|||||||
|
|
||||||
START=90
|
START=90
|
||||||
|
|
||||||
is_module_loaded() {
|
. /lib/batman-adv/config.sh
|
||||||
|
|
||||||
if [ ! -d "/sys/module/batman_adv" ]; then
|
|
||||||
echo "batman-adv module directory not found - was the kernel module loaded ?" >&2
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
start_mesh () {
|
|
||||||
local meshif="$1"
|
|
||||||
local interfaces aggregated_ogms bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval vis_mode
|
|
||||||
|
|
||||||
is_module_loaded
|
|
||||||
[ $? -ne 1 ] && return
|
|
||||||
|
|
||||||
config_get interfaces "$meshif" interfaces
|
|
||||||
config_get aggregated_ogms "$meshif" aggregated_ogms
|
|
||||||
config_get bonding "$meshif" bonding
|
|
||||||
config_get fragmentation "$meshif" fragmentation
|
|
||||||
config_get gw_bandwidth "$meshif" gw_bandwidth
|
|
||||||
config_get gw_mode "$meshif" gw_mode
|
|
||||||
config_get gw_sel_class "$meshif" gw_sel_class
|
|
||||||
config_get log_level "$meshif" log_level
|
|
||||||
config_get orig_interval "$meshif" orig_interval
|
|
||||||
config_get vis_mode "$meshif" vis_mode
|
|
||||||
|
|
||||||
if [ "$interfaces" = "" ]; then
|
|
||||||
echo Error, you must specify at least a network interface
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
for interface in $interfaces
|
|
||||||
do
|
|
||||||
ifname=$(uci -P /var/state get network.$interface.ifname 2>&-)
|
|
||||||
[ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && {
|
|
||||||
ifname=${interface}
|
|
||||||
[ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && echo "Can't add interface $ifname - ignoring" && continue
|
|
||||||
}
|
|
||||||
|
|
||||||
echo $meshif > /sys/class/net/$ifname/batman_adv/mesh_iface
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ $orig_interval ]; then
|
|
||||||
echo $orig_interval > /sys/class/net/$meshif/mesh/orig_interval
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $log_level ]; then
|
|
||||||
echo $log_level > /sys/class/net/$meshif/mesh/log_level 2>&-
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $aggregated_ogms ]; then
|
|
||||||
echo $aggregated_ogms > /sys/class/net/$meshif/mesh/aggregated_ogms
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $bonding ]; then
|
|
||||||
echo $bonding > /sys/class/net/$meshif/mesh/bonding
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $fragmentation ]; then
|
|
||||||
echo $fragmentation > /sys/class/net/$meshif/mesh/fragmentation
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $gw_bandwidth ]; then
|
|
||||||
echo $gw_bandwidth > /sys/class/net/$meshif/mesh/gw_bandwidth
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $gw_mode ]; then
|
|
||||||
echo $gw_mode > /sys/class/net/$meshif/mesh/gw_mode
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $gw_sel_class ]; then
|
|
||||||
echo $gw_sel_class > /sys/class/net/$meshif/mesh/gw_sel_class
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $vis_mode ]; then
|
|
||||||
echo $vis_mode > /sys/class/net/$meshif/mesh/vis_mode
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_mesh() {
|
|
||||||
local meshif="$1"
|
|
||||||
|
|
||||||
is_module_loaded
|
|
||||||
[ $? -ne 1 ] && return
|
|
||||||
|
|
||||||
for iface in $(ls /sys/class/net/*)
|
|
||||||
do
|
|
||||||
[ ! -f "$iface/batman_adv/mesh_iface" ] && continue
|
|
||||||
[ "$(head -1 $iface/batman_adv/mesh_iface)" != "$meshif" ] && continue
|
|
||||||
|
|
||||||
echo "none" > $iface/batman_adv/mesh_iface
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# can also be used with "batman-adv start bat0"
|
# can also be used with "batman-adv start bat0"
|
||||||
start() {
|
start() {
|
||||||
@ -120,5 +26,3 @@ stop () {
|
|||||||
config_foreach stop_mesh mesh
|
config_foreach stop_mesh mesh
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
98
net/batman-adv/files/lib/batman-adv/config.sh
Normal file
98
net/batman-adv/files/lib/batman-adv/config.sh
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Copyright (C) 2011 OpenWrt.org
|
||||||
|
|
||||||
|
is_module_loaded() {
|
||||||
|
|
||||||
|
if [ ! -d "/sys/module/batman_adv" ]; then
|
||||||
|
echo "batman-adv module directory not found - was the kernel module loaded ?" >&2
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
start_mesh () {
|
||||||
|
local meshif="$1"
|
||||||
|
local interfaces aggregated_ogms bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval vis_mode
|
||||||
|
|
||||||
|
is_module_loaded
|
||||||
|
[ $? -ne 1 ] && return
|
||||||
|
|
||||||
|
config_get interfaces "$meshif" interfaces
|
||||||
|
config_get aggregated_ogms "$meshif" aggregated_ogms
|
||||||
|
config_get bonding "$meshif" bonding
|
||||||
|
config_get fragmentation "$meshif" fragmentation
|
||||||
|
config_get gw_bandwidth "$meshif" gw_bandwidth
|
||||||
|
config_get gw_mode "$meshif" gw_mode
|
||||||
|
config_get gw_sel_class "$meshif" gw_sel_class
|
||||||
|
config_get log_level "$meshif" log_level
|
||||||
|
config_get orig_interval "$meshif" orig_interval
|
||||||
|
config_get vis_mode "$meshif" vis_mode
|
||||||
|
|
||||||
|
if [ "$interfaces" = "" ]; then
|
||||||
|
echo Error, you must specify at least a network interface
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
for interface in $interfaces
|
||||||
|
do
|
||||||
|
ifname=$(uci -P /var/state get network.$interface.ifname 2>&-)
|
||||||
|
[ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && {
|
||||||
|
ifname=${interface}
|
||||||
|
[ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && echo "Can't add interface $ifname - ignoring" && continue
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $meshif > /sys/class/net/$ifname/batman_adv/mesh_iface
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $orig_interval ]; then
|
||||||
|
echo $orig_interval > /sys/class/net/$meshif/mesh/orig_interval
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $log_level ]; then
|
||||||
|
echo $log_level > /sys/class/net/$meshif/mesh/log_level 2>&-
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $aggregated_ogms ]; then
|
||||||
|
echo $aggregated_ogms > /sys/class/net/$meshif/mesh/aggregated_ogms
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $bonding ]; then
|
||||||
|
echo $bonding > /sys/class/net/$meshif/mesh/bonding
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $fragmentation ]; then
|
||||||
|
echo $fragmentation > /sys/class/net/$meshif/mesh/fragmentation
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $gw_bandwidth ]; then
|
||||||
|
echo $gw_bandwidth > /sys/class/net/$meshif/mesh/gw_bandwidth
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $gw_mode ]; then
|
||||||
|
echo $gw_mode > /sys/class/net/$meshif/mesh/gw_mode
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $gw_sel_class ]; then
|
||||||
|
echo $gw_sel_class > /sys/class/net/$meshif/mesh/gw_sel_class
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $vis_mode ]; then
|
||||||
|
echo $vis_mode > /sys/class/net/$meshif/mesh/vis_mode
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_mesh() {
|
||||||
|
local meshif="$1"
|
||||||
|
|
||||||
|
is_module_loaded
|
||||||
|
[ $? -ne 1 ] && return
|
||||||
|
|
||||||
|
for iface in $(ls /sys/class/net/*)
|
||||||
|
do
|
||||||
|
[ ! -f "$iface/batman_adv/mesh_iface" ] && continue
|
||||||
|
[ "$(head -1 $iface/batman_adv/mesh_iface)" != "$meshif" ] && continue
|
||||||
|
|
||||||
|
echo "none" > $iface/batman_adv/mesh_iface
|
||||||
|
done
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user