1234567891011121314151617181920212223242526272829303132333435363738 |
- #!/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
|