|
|
@ -10,7 +10,7 @@ load_easymesh_config() {
|
|
|
|
gateway=$(uci -q get easymesh.config.gateway)
|
|
|
|
gateway=$(uci -q get easymesh.config.gateway)
|
|
|
|
dns=$(uci -q get easymesh.config.dns)
|
|
|
|
dns=$(uci -q get easymesh.config.dns)
|
|
|
|
ap_ipaddr=$(uci -q get network.lan.ipaddr)
|
|
|
|
ap_ipaddr=$(uci -q get network.lan.ipaddr)
|
|
|
|
ap_ipaddr1=$(sed -n '1p' /etc/easymesh 2>/dev/null)
|
|
|
|
#ap_ipaddr1=$(sed -n '1p' /etc/easymesh 2>/dev/null)
|
|
|
|
apRadio=$(uci -q get easymesh.config.apRadio)
|
|
|
|
apRadio=$(uci -q get easymesh.config.apRadio)
|
|
|
|
kvr=$(uci -q get easymesh.config.kvr)
|
|
|
|
kvr=$(uci -q get easymesh.config.kvr)
|
|
|
|
iapp=$(uci -q get easymesh.config.iapp)
|
|
|
|
iapp=$(uci -q get easymesh.config.iapp)
|
|
|
@ -23,25 +23,34 @@ load_easymesh_config() {
|
|
|
|
printf "enable: $enable\nmesh_bat0: $mesh_bat0\nap_mode: $ap_mode\nlan: $lan\nipaddr: $ipaddr\nnetmask: $netmask\ngateway: $gateway\ndns: $dns\nap_ipaddr: $ap_ipaddr\nap_ipaddr1: $ap_ipaddr1\napRadio: $apRadio\nkvr: $kvr\niapp: $iapp\nbrlan: $brlan\nrole: $role\nbackbone: $backbone\napname: $apname\nappass: $appass" > /root/.easymesh
|
|
|
|
printf "enable: $enable\nmesh_bat0: $mesh_bat0\nap_mode: $ap_mode\nlan: $lan\nipaddr: $ipaddr\nnetmask: $netmask\ngateway: $gateway\ndns: $dns\nap_ipaddr: $ap_ipaddr\nap_ipaddr1: $ap_ipaddr1\napRadio: $apRadio\nkvr: $kvr\niapp: $iapp\nbrlan: $brlan\nrole: $role\nbackbone: $backbone\napname: $apname\nappass: $appass" > /root/.easymesh
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ap_mode_stop() {
|
|
|
|
stop_node() {
|
|
|
|
ap_ipaddr=$(uci -q get network.lan.ipaddr)
|
|
|
|
cp /etc/config/wireless.meshbak /etc/config/wireless
|
|
|
|
ap_ipaddr1=$(sed -n '1p' /etc/easymesh 2>/dev/null)
|
|
|
|
cp /etc/config/network.meshbak /etc/config/network
|
|
|
|
dns1=$(sed -n '2p' /etc/easymesh 2>/dev/null)
|
|
|
|
cp /etc/config/dhcp.meshbak /etc/config/dhcp
|
|
|
|
if [ "$ap_ipaddr" = "$ap_ipaddr1" ]; then
|
|
|
|
|
|
|
|
uci -q delete network.lan.gateway
|
|
|
|
|
|
|
|
uci -q del_list network.lan.dns=$dns1
|
|
|
|
|
|
|
|
uci commit network
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "" >/etc/easymesh
|
|
|
|
/etc/init.d/network restart
|
|
|
|
|
|
|
|
/etc/init.d/system reload
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uci -q delete dhcp.lan.dynamicdhcp
|
|
|
|
# ap_mode_stop() {
|
|
|
|
uci -q delete dhcp.lan.ignore
|
|
|
|
# ap_ipaddr=$(uci -q get network.lan.ipaddr)
|
|
|
|
uci commit dhcp
|
|
|
|
# ap_ipaddr1=$(sed -n '1p' /etc/easymesh 2>/dev/null)
|
|
|
|
|
|
|
|
# dns1=$(sed -n '2p' /etc/easymesh 2>/dev/null)
|
|
|
|
|
|
|
|
# if [ "$ap_ipaddr" = "$ap_ipaddr1" ]; then
|
|
|
|
|
|
|
|
# uci -q delete network.lan.gateway
|
|
|
|
|
|
|
|
# uci -q del_list network.lan.dns=$dns1
|
|
|
|
|
|
|
|
# uci commit network
|
|
|
|
|
|
|
|
|
|
|
|
/etc/init.d/odhcpd enable && /etc/init.d/odhcpd start
|
|
|
|
# echo "" >/etc/easymesh
|
|
|
|
/etc/init.d/firewall enable && /etc/init.d/firewall start >/dev/null 2>&1
|
|
|
|
|
|
|
|
fi
|
|
|
|
# uci -q delete dhcp.lan.dynamicdhcp
|
|
|
|
}
|
|
|
|
# uci -q delete dhcp.lan.ignore
|
|
|
|
|
|
|
|
# uci commit dhcp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# /etc/init.d/odhcpd enable && /etc/init.d/odhcpd start
|
|
|
|
|
|
|
|
# /etc/init.d/firewall enable && /etc/init.d/firewall start >/dev/null 2>&1
|
|
|
|
|
|
|
|
# fi
|
|
|
|
|
|
|
|
# }
|
|
|
|
|
|
|
|
|
|
|
|
add_wifi_mesh() {
|
|
|
|
add_wifi_mesh() {
|
|
|
|
mesh_nwi_mesh=$(uci -q get network.nwi_mesh_${apall})
|
|
|
|
mesh_nwi_mesh=$(uci -q get network.nwi_mesh_${apall})
|
|
|
@ -274,9 +283,9 @@ set_easymesh() {
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$ap_mode" = 1 ]; then
|
|
|
|
if [ "$ap_mode" = 1 ]; then
|
|
|
|
# Backup Configurations if your scared
|
|
|
|
# Backup Configurations if your scared
|
|
|
|
cp /etc/config/wireless /etc/config/wireless.backup
|
|
|
|
cp /etc/config/wireless /etc/config/wireless.meshbak
|
|
|
|
cp /etc/config/network /etc/config/network.backup
|
|
|
|
cp /etc/config/network /etc/config/network.meshbak
|
|
|
|
cp /etc/config/dhcp /etc/config/dhcp.backup
|
|
|
|
cp /etc/config/dhcp /etc/config/dhcp.meshbak
|
|
|
|
|
|
|
|
|
|
|
|
# Generate a random IP in the same subnet for fun
|
|
|
|
# Generate a random IP in the same subnet for fun
|
|
|
|
ip_base=$(echo "$dns" | cut -d'.' -f1-3) # Get the first three octets of the DNS IP
|
|
|
|
ip_base=$(echo "$dns" | cut -d'.' -f1-3) # Get the first three octets of the DNS IP
|
|
|
@ -302,8 +311,9 @@ set_easymesh() {
|
|
|
|
uci delete network.lan.netmask
|
|
|
|
uci delete network.lan.netmask
|
|
|
|
|
|
|
|
|
|
|
|
# Set netmask and gateway (assuming $netmask and $dns didn't break more stuff)
|
|
|
|
# Set netmask and gateway (assuming $netmask and $dns didn't break more stuff)
|
|
|
|
uci set network.lan.netmask=$netmask
|
|
|
|
# Comment out because we want to pull this from dhcp
|
|
|
|
uci set network.lan.gateway=$dns
|
|
|
|
# uci set network.lan.netmask=$netmask
|
|
|
|
|
|
|
|
# uci set network.lan.gateway=$dns
|
|
|
|
uci set system.@system[0].hostname=$gateway
|
|
|
|
uci set system.@system[0].hostname=$gateway
|
|
|
|
|
|
|
|
|
|
|
|
# Configure LAN bridge and add ethernet interfaces to the bridge
|
|
|
|
# Configure LAN bridge and add ethernet interfaces to the bridge
|
|
|
@ -319,11 +329,7 @@ set_easymesh() {
|
|
|
|
uci set wireless.default_$apall.network='lan' # Make sure the Wi-Fi is part of the lan network
|
|
|
|
uci set wireless.default_$apall.network='lan' # Make sure the Wi-Fi is part of the lan network
|
|
|
|
|
|
|
|
|
|
|
|
# Commit all changes
|
|
|
|
# Commit all changes
|
|
|
|
uci commit network
|
|
|
|
uci commit
|
|
|
|
uci commit system
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# In case of separate wireless config, commit that too
|
|
|
|
|
|
|
|
uci commit wireless
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Restart the network to apply changes
|
|
|
|
# Restart the network to apply changes
|
|
|
|
/etc/init.d/network restart
|
|
|
|
/etc/init.d/network restart
|
|
|
@ -337,9 +343,12 @@ set_easymesh() {
|
|
|
|
mv /etc/config/firewall /etc/config/firewall.unused
|
|
|
|
mv /etc/config/firewall /etc/config/firewall.unused
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
ap_mode_stop
|
|
|
|
stop_node
|
|
|
|
fi # end if [ "$ap_mode" = 1 ]
|
|
|
|
fi # end if [ "$ap_mode" = 1 ]
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
# Disable the ap_mode settings
|
|
|
|
|
|
|
|
stop_node
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$mesh_bat0" = "interface" ]; then
|
|
|
|
if [ "$mesh_bat0" = "interface" ]; then
|
|
|
|
uci -q delete network.bat0
|
|
|
|
uci -q delete network.bat0
|
|
|
|
if [ "$brlan" = "br-lan" ]; then
|
|
|
|
if [ "$brlan" = "br-lan" ]; then
|
|
|
@ -366,10 +375,6 @@ set_easymesh() {
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$ap_mode" = 0 ]; then
|
|
|
|
|
|
|
|
ap_mode_stop
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/etc/init.d/network restart
|
|
|
|
/etc/init.d/network restart
|
|
|
|
} # end set_easymesh()
|
|
|
|
} # end set_easymesh()
|
|
|
|
|
|
|
|
|
|
|
|