Developing lightweight computation at the DSG edge

Commit aad32fe8 authored by Pau Escrich's avatar Pau Escrich
Browse files

Add hook for wrtnode to set up wlan0 only in mesh mode (ap+adhoc not supported)

Add new option to enable dhcp server in mesh interfaces (so dhcp client to adhoc devices is possible)
parent 98a9f3d9
#!/bin/sh
# Stage = [birth|firstboot|anyboot|preconf|postconf]
STAGE="$1"
[ "$STAGE" == "firstboot" ] && {
echo "Configuring adhoc wifi device for WRTnode"
uci set qmp.interfaces.mesh_devices="wlan0"
uci set qmp.interfaces.lan_devices="eth0"
uci set qmp.networks.disable_mesh_dhcp="0"
uci set qmp.@wireless[0]=wireless
uci set qmp.@wireless[0].mode=adhoc
uci set qmp.@wireless[0].device=wlan0
uci commit qmp
}
../scripts/wrtnode.sh
\ No newline at end of file
......@@ -101,6 +101,7 @@ config 'qmp' 'networks'
option lan_address '172.30.22.1'
option lan_netmask '255.255.0.0'
option disable_lan_dhcp '0'
option disable_mesh_dhcp '0'
# Rescue IPv4 network prefix (/16 bits).
# Missing 16 bits are taken from primary device MAC.
......
......@@ -35,7 +35,7 @@ qmp_set_mss_clamping_and_masq() {
# Prepare config files
qmp_configure_prepare_network() {
local toRemove="$(uci show network | egrep "network.(lan|wan|mesh_).*=interface" | cut -d. -f2 | cut -d= -f1)"
echo "Removing current network configuration"
qmp_log "Removing current network configuration"
for i in $toRemove; do
uci del network.$i
done
......@@ -479,6 +479,21 @@ qmp_configure_dhcp() {
else
qmp_uci_set_raw dhcp.lan.ignore="0"
fi
# Set dhcp server in mesh devices if enabled
if [ "$(qmp_uci_get networks.disable_mesh_dhcp)" == "0" ]; then
local dev
for dev in $(qmp_get_devices mesh); do
local vif="$(qmp_get_virtual_iface $dev)"
[ -n "$vif" ] && {
qmp_log "Configuring dhcp server for mesh device $dev/$vif"
qmp_uci_set_raw dhcp.$vif="dhcp"
qmp_uci_set_raw dhcp.$vif.interface="$vif"
qmp_uci_set_raw dhcp.$vif.leasetime="10m"
qmp_uci_set_raw dhcp.$vif.ignore="0"
}
done
fi
}
qmp_bmx6_reload() {
......
......@@ -40,11 +40,15 @@ eth_section:option(Value, "lan_netmask", "LAN netmask",translate("IPv4 netmask f
-- Option: publish lan
--eth_section:option(Flag, "publish_lan", "Publish LAN", "Publish LAN network through the mesh")
-- Option: disable dhcp
eth_section:option(Flag, "disable_lan_dhcp", "Disable DHCP in LAN",
-- Option: disable dhcp lan
eth_section:option(Flag, "disable_lan_dhcp", "Disable DHCP server in LAN",
translate("Disable DHCP server in LAN network (not recommended)."))
-- Option: disable dhcp mesh
eth_section:option(Flag, "disable_mesh_dhcp", "Disable DHCP server in MESH",
translate("Disable DHCP server in MESH network devices."))
-- Option bmx6_ipv4_address
eth_section:option(Value, "bmx6_ipv4_address", "Main IPv4 address",
translate("Main IPv4 address used in bmx6. Leave it blank to get a random one."))
......@@ -57,7 +61,6 @@ translate("Network prefix used to calculate a random IP address if the field abo
eth_section:option(Value, "bmx6_ripe_prefix48", "Main IPv6 prefix",
translate("If you have a global IPv6 48bits prefix, specify it here. Otherwise leave it blank."))
-- Option force_internet
fint = eth_section:option(ListValue, "force_internet", "Force internet",
translate("Use it if you want force the system to share/unshare Internet (it is recommended to leave it as disabled)"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment