Remove batman-adv specific parts of gluon-core

This commit is contained in:
Matthias Schiffer 2013-10-01 20:16:24 +02:00
parent fd4222f65d
commit fa1774a4e6
5 changed files with 34 additions and 36 deletions

View File

@ -0,0 +1,10 @@
SYSCONFIGDIR=/lib/gluon/core/sysconfig
sysconfig() {
cat "$SYSCONFIGDIR/$1"
}
sysconfig_set() {
echo -n "$2" > "$SYSCONFIGDIR/$1"
}

View File

@ -0,0 +1,20 @@
#!/bin/sh
. /lib/gluon/functions/sysconfig.sh
. /lib/ar71xx.sh
get_primary_mac() {
case "$(ar71xx_board_name)" in
tl-wdr3600|tl-wdr4300)
cat /sys/class/ieee80211/phy1/macaddress
;;
*)
cat /sys/class/ieee80211/phy0/macaddress
;;
esac
}
sysconfig_set lan_ifname "$(uci get network.lan.ifname)"
sysconfig_set primary_mac "$(get_primary_mac)"

View File

@ -1,9 +1,7 @@
#!/bin/sh #!/bin/sh
. /lib/ar71xx.sh
local lan_ifname="$(uci get network.lan.ifname)" . /lib/gluon/functions/sysconfig.sh
local board="$(ar71xx_board_name)"
uci -q batch <<EOF uci -q batch <<EOF
delete network.lan delete network.lan
@ -11,45 +9,13 @@ delete network.lan
set network.wan.type='bridge' set network.wan.type='bridge'
set network.wan.proto='dhcp' set network.wan.proto='dhcp'
set network.wan.auto='1' set network.wan.auto='1'
set network.client='interface'
set network.client.ifname='$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 EOF
get_main_address() {
case "$board" in
tl-wdr3600|tl-wdr4300)
cat /sys/class/ieee80211/phy1/macaddress
;;
*)
cat /sys/class/ieee80211/phy0/macaddress
;;
esac
}
local mainaddr=$(get_main_address) local mainaddr=$(sysconfig primary_mac)
local oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS" local oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS"
local b2mask=0x02 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"
case "$board" in case "$board" in
tl-wr1043nd|\ tl-wr1043nd|\
tl-wdr3600|\ tl-wdr3600|\

View File

@ -1 +1,3 @@
/lib/gluon/version/ /lib/gluon/version/
/lib/gluon/core/sysconfig/