gluon-mesh-batman-adv: configure batman-adv
This commit is contained in:
parent
00a97602a4
commit
54ba93f4bf
@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
local interfaces=''
|
||||
local interfaces_old="$(uci get batman-adv.bat0.interfaces)"
|
||||
|
||||
for interface in $interfaces_old; do
|
||||
if [ $interface != br-wan ]; then interfaces="${interfaces:+${interfaces} }$interface"; fi
|
||||
done
|
||||
|
||||
uci set batman-adv.bat0.interfaces="$interfaces"
|
||||
|
||||
old_interval="$(uci -q get batman-adv.bat0.orig_interval)"
|
||||
if [ -z "$old_interval" -o "$old_interval" = 1000 ]; then
|
||||
uci set batman-adv.bat0.orig_interval=5000
|
||||
fi
|
||||
|
||||
uci commit batman-adv
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
uci set batman-adv.bat0.interfaces="mesh-vpn $(uci -q get batman-adv.bat0.interfaces)"
|
||||
uci commit batman-adv
|
@ -1,38 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/ar71xx.sh
|
||||
|
||||
local board="$(ar71xx_board_name)"
|
||||
|
||||
uci -q batch <<EOF
|
||||
set network.mesh.proto='batadv'
|
||||
set network.mesh.mesh='bat0'
|
||||
|
||||
set network.mesh_vpn='interface'
|
||||
set network.mesh_vpn.ifname='mesh-vpn'
|
||||
set network.mesh_vpn.proto='batadv'
|
||||
set network.mesh_vpn.mesh='bat0'
|
||||
EOF
|
||||
|
||||
get_main_address() {
|
||||
case "$board" in
|
||||
tl-wdr3600|tl-wdr4300)
|
||||
uci get wireless.radio1.macaddr
|
||||
;;
|
||||
*)
|
||||
uci get wireless.radio0.macaddr
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
local mainaddr=$(get_main_address)
|
||||
local oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS"
|
||||
local b2mask=0x02
|
||||
|
||||
local vpnaddr=$(printf "%02x:%s:%s:%02x:%s:%s" $(( 0x$1 | $b2mask )) $2 $3 $(( (0x$4 + 1) % 0x100 )) $5 $6)
|
||||
|
||||
uci set network.mesh_vpn.macaddr="$vpnaddr"
|
||||
uci commit network
|
||||
|
||||
uci delete batman-adv.bat0.interfaces
|
||||
uci commit batman-adv
|
@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
. /lib/gluon/functions/sysconfig.sh
|
||||
|
||||
|
||||
uci -q batch <<EOF
|
||||
delete batman-adv.bat0
|
||||
|
||||
set batman-adv.bat0='mesh'
|
||||
set batman-adv.bat0.orig_interval='5000'
|
||||
|
||||
commit batman-adv
|
||||
EOF
|
||||
|
||||
uci -q batch <<EOF
|
||||
set network.client='interface'
|
||||
set network.client.ifname='$(sysconfig lan_ifname) bat0'
|
||||
set network.client.type='bridge'
|
||||
set network.client.proto='dhcpv6'
|
||||
set network.client.reqprefix='no'
|
||||
set network.client.peerdns='0'
|
||||
|
||||
set network.mesh='interface'
|
||||
set network.mesh.proto='batadv'
|
||||
set network.mesh.mtu='1528'
|
||||
set network.mesh.mesh='bat0'
|
||||
|
||||
set network.mesh_vpn='interface'
|
||||
set network.mesh_vpn.ifname='mesh-vpn'
|
||||
set network.mesh_vpn.proto='batadv'
|
||||
set network.mesh_vpn.mesh='bat0'
|
||||
EOF
|
||||
|
||||
|
||||
local mainaddr=$(sysconfig primary_mac)
|
||||
local oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS"
|
||||
local b2mask=0x02
|
||||
|
||||
local vpnaddr=$(printf "%02x:%s:%s:%02x:%s:%s" $(( 0x$1 | $b2mask )) $2 $3 $(( (0x$4 + 1) % 0x100 )) $5 $6)
|
||||
|
||||
uci set network.client.macaddr="$mainaddr"
|
||||
uci set network.mesh_vpn.macaddr="$vpnaddr"
|
||||
|
||||
uci commit network
|
Loading…
Reference in New Issue
Block a user