diff --git a/package/gluon-core/generate/lib/gluon/upgrade/core/initial/020-wireless b/package/gluon-core/generate/lib/gluon/upgrade/core/initial/020-wireless index 944d84a40ec05c20c56147393544d16e52055136..0196b9519787ccd4b8b3ff7aa01ad6049bbac148 100755 --- a/package/gluon-core/generate/lib/gluon/upgrade/core/initial/020-wireless +++ b/package/gluon-core/generate/lib/gluon/upgrade/core/initial/020-wireless @@ -1,26 +1,14 @@ #!/bin/sh -uci -q batch <<EOF -delete wireless.radio0.disabled -delete wireless.@wifi-iface[0] +. /lib/functions.sh -set wireless.radio0.channel='@wifi24.channel@' -set wireless.radio0.htmode='@wifi24.htmode@' -set wireless.radio0.country='DE' +config_load wireless -set wireless.wifi_client='wifi-iface' -set wireless.wifi_client.device='radio0' -set wireless.wifi_client.network='client' -set wireless.wifi_client.mode='ap' -set wireless.wifi_client.ssid='@wifi24.ssid@' +delete_iface() { + local iface="$1" -set wireless.wifi_mesh='wifi-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' + uci_remove wireless "$iface" +} -commit wireless -EOF +config_foreach delete_iface 'wifi-iface' +uci_commit wireless diff --git a/package/gluon-mesh-batman-adv/Makefile b/package/gluon-mesh-batman-adv/Makefile index 7bb38bb1132dd99a9bce83d7a9cb567de4ff3ea0..708c7c4a96a777a0f1ea6c0b127d3a1c70d9285a 100644 --- a/package/gluon-mesh-batman-adv/Makefile +++ b/package/gluon-mesh-batman-adv/Makefile @@ -31,6 +31,7 @@ endef define Package/gluon-mesh-batman-adv/install $(CP) ./files/* $(1)/ + $(GLUON_GENERATE) ./generate/* $(1)/ endef $(eval $(call BuildPackage,gluon-mesh-batman-adv)) diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/011-mesh b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh similarity index 72% rename from package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/011-mesh rename to package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh index 1fc2b91ff3d94e7fe9ba89e91b43e76956deb0d6..b18c975de53f0df07f10e43f54557c4f3158f63b 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/011-mesh +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/upgrade/mesh-batman-adv/initial/010-mesh @@ -11,25 +11,13 @@ 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 diff --git a/package/gluon-mesh-batman-adv/generate/lib/gluon/upgrade/mesh-batman-adv/initial/020-wireless b/package/gluon-mesh-batman-adv/generate/lib/gluon/upgrade/mesh-batman-adv/initial/020-wireless new file mode 100755 index 0000000000000000000000000000000000000000..dbca73d7d3cca544a036532977400045a9e087c5 --- /dev/null +++ b/package/gluon-mesh-batman-adv/generate/lib/gluon/upgrade/mesh-batman-adv/initial/020-wireless @@ -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 diff --git a/package/gluon-mesh-vpn-fastd/fastd.pl b/package/gluon-mesh-vpn-fastd/fastd.pl index 85bc7e28fc7a79b82138fcc2975259721bf7459b..dd2f64ed4234954c7a236e1a92e7a469a569cc29 100644 --- a/package/gluon-mesh-vpn-fastd/fastd.pl +++ b/package/gluon-mesh-vpn-fastd/fastd.pl @@ -55,5 +55,11 @@ EOF print <<END; 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 END