Merge a5ff5808e3
into 040106786d
This commit is contained in:
commit
7aaa02640d
7 changed files with 101 additions and 84 deletions
|
@ -124,11 +124,10 @@ define Build/Clean
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define KernelPackage/batman-adv/install
|
define KernelPackage/batman-adv/install
|
||||||
$(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_DIR) $(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/lib/netifd/proto/batadv.sh $(1)/lib/netifd/proto
|
$(INSTALL_BIN) ./files/lib/netifd/proto/batadv.sh $(1)/lib/netifd/proto
|
||||||
|
$(INSTALL_BIN) ./files/lib/netifd/proto/batmesh.sh $(1)/lib/netifd/proto
|
||||||
|
$(INSTALL_BIN) ./files/etc/uci-defaults/batadv-netifd-uci-migrations $(1)/etc/uci-defaults/
|
||||||
$(BATCTL_INSTALL)
|
$(BATCTL_INSTALL)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
|
|
||||||
config 'mesh' 'bat0'
|
|
||||||
option 'aggregated_ogms'
|
|
||||||
option 'ap_isolation'
|
|
||||||
option 'bonding'
|
|
||||||
option 'fragmentation'
|
|
||||||
option 'gw_bandwidth'
|
|
||||||
option 'gw_mode'
|
|
||||||
option 'gw_sel_class'
|
|
||||||
option 'log_level'
|
|
||||||
option 'orig_interval'
|
|
||||||
option 'vis_mode'
|
|
||||||
option 'bridge_loop_avoidance'
|
|
||||||
option 'distributed_arp_table'
|
|
||||||
option 'network_coding'
|
|
||||||
option 'hop_penalty'
|
|
||||||
|
|
||||||
# yet another batX instance
|
|
||||||
# config 'mesh' 'bat5'
|
|
||||||
# option 'interfaces' 'second_mesh'
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
. /lib/batman-adv/config.sh
|
|
||||||
|
|
||||||
bat_load_module
|
|
||||||
config_load batman-adv
|
|
||||||
|
|
||||||
case "$ACTION" in
|
|
||||||
add)
|
|
||||||
[ -d /sys/class/net/$INTERFACE/mesh/ ] && bat_config "$INTERFACE"
|
|
||||||
;;
|
|
||||||
esac
|
|
38
batman-adv/files/etc/uci-defaults/batadv-netifd-uci-migrations
Executable file
38
batman-adv/files/etc/uci-defaults/batadv-netifd-uci-migrations
Executable file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Copyright (C) 2012 Gui Iribarren
|
||||||
|
# This is free software, licensed under the GNU General Public License v3.
|
||||||
|
|
||||||
|
local batmeshes="$(uci -q show batman-adv \
|
||||||
|
| sed -ne 's/^batman-adv.\([^.]*\)=mesh$/\1/p')"
|
||||||
|
|
||||||
|
for mesh in $batmeshes ; do
|
||||||
|
|
||||||
|
local batifaces="$(uci -q get batman-adv.$mesh.interfaces)"
|
||||||
|
|
||||||
|
for iface in $batifaces ; do
|
||||||
|
if [ "$(uci -q get "network.$iface")" == "interface" ] ; then
|
||||||
|
uci set network.$iface.proto=batadv
|
||||||
|
uci set network.$iface.mesh=$mesh
|
||||||
|
uci set batman-adv.$mesh.interfaces="$(echo $batifaces | sed "s/\<$iface\>//g")"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
local batparams="aggregated_ogms ap_isolation bonding bridge_loop_avoidance \
|
||||||
|
distributed_arp_table fragmentation gw_bandwidth gw_mode gw_sel_class \
|
||||||
|
hop_penalty network_coding log_level orig_interval vis_mode"
|
||||||
|
|
||||||
|
for param in $batparams ; do
|
||||||
|
local value="$(uci -q get batman-adv.$mesh.$param)"
|
||||||
|
if [ "$value" ] ; then
|
||||||
|
uci set network.$mesh=interface
|
||||||
|
uci set network.$mesh.proto=batmesh
|
||||||
|
uci set network.$mesh.ifname=$mesh
|
||||||
|
uci set network.$mesh.$param=$value
|
||||||
|
uci delete batman-adv.$mesh.$param
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
uci commit network
|
||||||
|
uci commit batman-adv
|
||||||
|
done
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
bat_load_module()
|
|
||||||
{
|
|
||||||
[ -d "/sys/module/batman_adv/" ] && return
|
|
||||||
|
|
||||||
. /lib/functions.sh
|
|
||||||
load_modules /etc/modules.d/*-crc16 /etc/modules.d/*-crypto* /etc/modules.d/*-lib-crc* /etc/modules.d/*-batman-adv*
|
|
||||||
}
|
|
||||||
|
|
||||||
bat_config()
|
|
||||||
{
|
|
||||||
local mesh="$1"
|
|
||||||
local aggregated_ogms ap_isolation bonding bridge_loop_avoidance distributed_arp_table fragmentation
|
|
||||||
local gw_bandwidth gw_mode gw_sel_class hop_penalty network_coding log_level orig_interval vis_mode
|
|
||||||
|
|
||||||
config_get aggregated_ogms "$mesh" aggregated_ogms
|
|
||||||
config_get ap_isolation "$mesh" ap_isolation
|
|
||||||
config_get bonding "$mesh" bonding
|
|
||||||
config_get bridge_loop_avoidance "$mesh" bridge_loop_avoidance
|
|
||||||
config_get distributed_arp_table "$mesh" distributed_arp_table
|
|
||||||
config_get fragmentation "$mesh" fragmentation
|
|
||||||
config_get gw_bandwidth "$mesh" gw_bandwidth
|
|
||||||
config_get gw_mode "$mesh" gw_mode
|
|
||||||
config_get gw_sel_class "$mesh" gw_sel_class
|
|
||||||
config_get hop_penalty "$mesh" hop_penalty
|
|
||||||
config_get network_coding "$mesh" network_coding
|
|
||||||
config_get log_level "$mesh" log_level
|
|
||||||
config_get orig_interval "$mesh" orig_interval
|
|
||||||
config_get vis_mode "$mesh" vis_mode
|
|
||||||
|
|
||||||
[ ! -f "/sys/class/net/$mesh/mesh/orig_interval" ] && echo "batman-adv mesh $mesh does not exist - check your interface configuration" && return 1
|
|
||||||
|
|
||||||
[ -n "$aggregate_ogms" ] && echo $aggregate_ogms > /sys/class/net/$mesh/mesh/aggregate_ogms
|
|
||||||
[ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation
|
|
||||||
[ -n "$bonding" ] && echo $bonding > /sys/class/net/$mesh/mesh/bonding
|
|
||||||
[ -n "$bridge_loop_avoidance" ] && echo $bridge_loop_avoidance > /sys/class/net/$mesh/mesh/bridge_loop_avoidance 2>&-
|
|
||||||
[ -n "$distributed_arp_table" ] && echo $distributed_arp_table > /sys/class/net/$mesh/mesh/distributed_arp_table 2>&-
|
|
||||||
[ -n "$fragmentation" ] && echo $fragmentation > /sys/class/net/$mesh/mesh/fragmentation
|
|
||||||
[ -n "$gw_bandwidth" ] && echo $gw_bandwidth > /sys/class/net/$mesh/mesh/gw_bandwidth
|
|
||||||
[ -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 "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty
|
|
||||||
[ -n "$network_coding" ] && echo $network_coding > /sys/class/net/$mesh/mesh/network_coding 2>&-
|
|
||||||
[ -n "$log_level" ] && echo $log_level > /sys/class/net/$mesh/mesh/log_level 2>&-
|
|
||||||
[ -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
|
|
||||||
}
|
|
|
@ -4,6 +4,12 @@
|
||||||
. ../netifd-proto.sh
|
. ../netifd-proto.sh
|
||||||
init_proto "$@"
|
init_proto "$@"
|
||||||
|
|
||||||
|
bat_load_module()
|
||||||
|
{
|
||||||
|
[ -d "/sys/module/batman_adv/" ] && return
|
||||||
|
load_modules /etc/modules.d/*-crc16 /etc/modules.d/*-crypto* /etc/modules.d/*-lib-crc* /etc/modules.d/*-batman-adv*
|
||||||
|
}
|
||||||
|
|
||||||
proto_batadv_init_config() {
|
proto_batadv_init_config() {
|
||||||
proto_config_add_string "mesh"
|
proto_config_add_string "mesh"
|
||||||
}
|
}
|
||||||
|
@ -15,6 +21,8 @@ proto_batadv_setup() {
|
||||||
local mesh
|
local mesh
|
||||||
json_get_vars mesh
|
json_get_vars mesh
|
||||||
|
|
||||||
|
bat_load_module
|
||||||
|
|
||||||
echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface"
|
echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface"
|
||||||
proto_init_update "$iface" 1
|
proto_init_update "$iface" 1
|
||||||
proto_send_update "$config"
|
proto_send_update "$config"
|
||||||
|
|
52
batman-adv/files/lib/netifd/proto/batmesh.sh
Executable file
52
batman-adv/files/lib/netifd/proto/batmesh.sh
Executable file
|
@ -0,0 +1,52 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
|
. ../netifd-proto.sh
|
||||||
|
init_proto "$@"
|
||||||
|
|
||||||
|
proto_batmesh_init_config() {
|
||||||
|
proto_config_add_string "aggregated_ogms"
|
||||||
|
proto_config_add_string "ap_isolation"
|
||||||
|
proto_config_add_string "bonding"
|
||||||
|
proto_config_add_string "bridge_loop_avoidance"
|
||||||
|
proto_config_add_string "distributed_arp_table"
|
||||||
|
proto_config_add_string "fragmentation"
|
||||||
|
proto_config_add_string "gw_bandwidth"
|
||||||
|
proto_config_add_string "gw_mode"
|
||||||
|
proto_config_add_string "gw_sel_class"
|
||||||
|
proto_config_add_string "hop_penalty"
|
||||||
|
proto_config_add_string "network_coding"
|
||||||
|
proto_config_add_string "log_level"
|
||||||
|
proto_config_add_string "orig_interval"
|
||||||
|
proto_config_add_string "vis_mode"
|
||||||
|
}
|
||||||
|
|
||||||
|
proto_batmesh_setup() {
|
||||||
|
local config="$1"
|
||||||
|
local iface="$2"
|
||||||
|
local aggregated_ogms ap_isolation bonding bridge_loop_avoidance distributed_arp_table fragmentation
|
||||||
|
local gw_bandwidth gw_mode gw_sel_class hop_penalty network_coding log_level orig_interval vis_mode
|
||||||
|
|
||||||
|
json_get_vars aggregated_ogms ap_isolation bonding bridge_loop_avoidance distributed_arp_table fragmentation
|
||||||
|
json_get_vars gw_bandwidth gw_mode gw_sel_class hop_penalty network_coding log_level orig_interval vis_mode
|
||||||
|
|
||||||
|
[ -n "$aggregate_ogms" ] && echo $aggregate_ogms > /sys/class/net/$iface/mesh/aggregate_ogms
|
||||||
|
[ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$iface/mesh/ap_isolation
|
||||||
|
[ -n "$bonding" ] && echo $bonding > /sys/class/net/$iface/mesh/bonding
|
||||||
|
[ -n "$bridge_loop_avoidance" ] && echo $bridge_loop_avoidance > /sys/class/net/$iface/mesh/bridge_loop_avoidance 2>&-
|
||||||
|
[ -n "$distributed_arp_table" ] && echo $distributed_arp_table > /sys/class/net/$iface/mesh/distributed_arp_table 2>&-
|
||||||
|
[ -n "$fragmentation" ] && echo $fragmentation > /sys/class/net/$iface/mesh/fragmentation
|
||||||
|
[ -n "$gw_bandwidth" ] && echo $gw_bandwidth > /sys/class/net/$iface/mesh/gw_bandwidth
|
||||||
|
[ -n "$gw_mode" ] && echo $gw_mode > /sys/class/net/$iface/mesh/gw_mode
|
||||||
|
[ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$iface/mesh/gw_sel_class
|
||||||
|
[ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$iface/mesh/hop_penalty
|
||||||
|
[ -n "$network_coding" ] && echo $network_coding > /sys/class/net/$iface/mesh/network_coding 2>&-
|
||||||
|
[ -n "$log_level" ] && echo $log_level > /sys/class/net/$iface/mesh/log_level 2>&-
|
||||||
|
[ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$iface/mesh/orig_interval
|
||||||
|
[ -n "$vis_mode" ] && echo $vis_mode > /sys/class/net/$iface/mesh/vis_mode
|
||||||
|
|
||||||
|
proto_init_update "$iface" 1
|
||||||
|
proto_send_update "$config"
|
||||||
|
}
|
||||||
|
|
||||||
|
add_protocol batmesh
|
Loading…
Reference in a new issue