Move some more configuration into the corrent packages, correctly configure multiple radios

This commit is contained in:
Matthias Schiffer 2013-10-03 18:04:03 +02:00
parent a5c042c294
commit e73f79f392
5 changed files with 79 additions and 32 deletions

View File

@ -1,26 +1,14 @@
#!/bin/sh #!/bin/sh
uci -q batch <<EOF . /lib/functions.sh
delete wireless.radio0.disabled
delete wireless.@wifi-iface[0]
set wireless.radio0.channel='@wifi24.channel@' config_load wireless
set wireless.radio0.htmode='@wifi24.htmode@'
set wireless.radio0.country='DE'
set wireless.wifi_client='wifi-iface' delete_iface() {
set wireless.wifi_client.device='radio0' local iface="$1"
set wireless.wifi_client.network='client'
set wireless.wifi_client.mode='ap'
set wireless.wifi_client.ssid='@wifi24.ssid@'
set wireless.wifi_mesh='wifi-iface' uci_remove wireless "$iface"
set wireless.wifi_mesh.device='radio0' }
set wireless.wifi_mesh.network='mesh'
set wireless.wifi_mesh.mode='adhoc'
set wireless.wifi_mesh.ssid='@wifi24.mesh_ssid@'
set wireless.wifi_mesh.bssid='@wifi24.mesh_bssid@'
set wireless.wifi_mesh.mcast_rate='12000'
commit wireless config_foreach delete_iface 'wifi-iface'
EOF uci_commit wireless

View File

@ -31,6 +31,7 @@ endef
define Package/gluon-mesh-batman-adv/install define Package/gluon-mesh-batman-adv/install
$(CP) ./files/* $(1)/ $(CP) ./files/* $(1)/
$(GLUON_GENERATE) ./generate/* $(1)/
endef endef
$(eval $(call BuildPackage,gluon-mesh-batman-adv)) $(eval $(call BuildPackage,gluon-mesh-batman-adv))

View File

@ -11,25 +11,13 @@ set batman-adv.bat0='mesh'
set batman-adv.bat0.orig_interval='5000' set batman-adv.bat0.orig_interval='5000'
commit batman-adv commit batman-adv
EOF
uci -q batch <<EOF
set network.client='interface' set network.client='interface'
set network.client.ifname='$(sysconfig lan_ifname) bat0' set network.client.ifname='$(sysconfig lan_ifname) bat0'
set network.client.type='bridge' set network.client.type='bridge'
set network.client.proto='dhcpv6' set network.client.proto='dhcpv6'
set network.client.reqprefix='no' set network.client.reqprefix='no'
set network.client.peerdns='0' 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

View File

@ -0,0 +1,64 @@
#!/bin/sh
. /lib/functions.sh
config_load wireless
configure_radio() {
local radio="$1"
local channel; local htmode; local ssid; local mesh_ssid; local mesh_bssid; local mesh_mcast_rate
config_get hwmode "$radio" 'hwmode'
case "$hwmode" in
11g|11ng)
channel='@wifi24.channel@'
htmode='@wifi24.htmode@'
ssid='@wifi24.ssid@'
mesh_ssid='@wifi24.mesh_ssid@'
mesh_bssid='@wifi24.mesh_bssid@'
mesh_mcast_rate='@wifi24.mesh_mcast_rate@'
;;
11a|11na)
channel='@wifi5.channel@'
htmode='@wifi5.htmode@'
ssid='@wifi5.ssid@'
mesh_ssid='@wifi5.mesh_ssid@'
mesh_bssid='@wifi5.mesh_bssid@'
mesh_mcast_rate='@wifi5.mesh_mcast_rate@'
;;
*)
return
esac
uci_remove wireless "$radio" 'disabled'
uci_set wireless "$radio" channel "$channel"
uci_set wireless "$radio" htmode "$htmode"
uci_set wireless "$radio" country '@regdom@'
uci_add wireless 'wifi-iface' "client_${radio}"
uci_set wireless "client_${radio}" device "$radio"
uci_set wireless "client_${radio}" network 'client'
uci_set wireless "client_${radio}" mode 'ap'
uci_set wireless "client_${radio}" ssid "$ssid"
uci_add network 'interface' "mesh_${radio}"
uci_set network "mesh_${radio}" proto 'batadv'
uci_set network "mesh_${radio}" mtu '1528'
uci_set network "mesh_${radio}" mesh 'bat0'
uci_add wireless 'wifi-iface' "mesh_${radio}"
uci_set wireless "mesh_${radio}" device "$radio"
uci_set wireless "mesh_${radio}" network "mesh_${radio}"
uci_set wireless "mesh_${radio}" mode 'adhoc'
uci_set wireless "mesh_${radio}" ssid "$mesh_ssid"
uci_set wireless "mesh_${radio}" bssid "$mesh_bssid"
uci_set wireless "mesh_${radio}" mcast_rate "$mesh_mcast_rate"
}
config_foreach configure_radio 'wifi-device'
uci_commit wireless
uci_commit network

View File

@ -55,5 +55,11 @@ EOF
print <<END; print <<END;
commit fastd commit fastd
set network.mesh_vpn='interface'
set network.mesh_vpn.ifname='mesh-vpn'
set network.mesh_vpn.proto='batadv'
set network.mesh_vpn.mesh='bat0'
commit network
EOF EOF
END END