Developing lightweight computation at the DSG edge

Commit b2b01b61 authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

Fix wireless adhoc_ap mode (the adhoc interface was added to the LAN network)

parent d9d8c6aa
...@@ -16,6 +16,7 @@ fi ...@@ -16,6 +16,7 @@ fi
[ -z "$SOURCE_NET" ] && . $QMP_PATH/qmp_network.sh [ -z "$SOURCE_NET" ] && . $QMP_PATH/qmp_network.sh
[ -z "$SOURCE_SYS" ] && . $QMP_PATH/qmp_system.sh [ -z "$SOURCE_SYS" ] && . $QMP_PATH/qmp_system.sh
[ -z "$SOURCE_WIRELESS" ] && . $QMP_PATH/qmp_wireless.sh [ -z "$SOURCE_WIRELESS" ] && . $QMP_PATH/qmp_wireless.sh
[ -z "$SOURCE_COMMON" ] && . $QMP_PATH/qmp_common.sh
qmp_get_llocal_for_dev() { qmp_get_llocal_for_dev() {
local dev=$1 local dev=$1
...@@ -69,45 +70,52 @@ qmp_get_virtual_iface() { ...@@ -69,45 +70,52 @@ qmp_get_virtual_iface() {
fi fi
fi fi
# is lan? # is lan?
if [ "$device" == "br-lan" ]; then if [ "$device" == "br-lan" ]; then
viface="lan" viface="lan"
echo $viface if [ ! -e "/sys/class/net/$device/phy80211" ]; then
return echo $viface
fi return
fi
fi
for l in $(qmp_get_devices lan); do
if [ "$l" == "$device" ]; then
viface="lan"
if [ ! -e "/sys/class/net/$device/phy80211" ]; then
echo $viface
return
fi
fi
done
for l in $(qmp_get_devices lan); do [ ! -e "/sys/class/net/$device/phy80211" ] && [ -n "$viface" ] && { echo $viface; return; }
if [ "$l" == "$device" ]; then
viface="lan"
echo $viface
return
fi
done
[ -n "$viface" ] && { echo $viface; return; } # id is the first char and the numbers of the device [e]th[0] [w]lan[1]
local id_num=$(echo $device | tr -d "[A-z]" | tr - _ | tr . _)
local id_char=$(echo $device | cut -c 1)
# id is the first char and the numbers of the device [e]th[0] [w]lan[1] # is wan?
local id_num=$(echo $device | tr -d "[A-z]" | tr - _ | tr . _) for w in $(qmp_get_devices wan); do
local id_char=$(echo $device | cut -c 1) if [ "$w" == "$device" ]; then
viface="wan_${id_char}${id_num}"
echo $viface
return
fi
done
# is wan qmp_log "LOG: 5"
for w in $(qmp_get_devices wan); do qmp_log "Viface: $viface"
if [ "$w" == "$device" ]; then
viface="wan_${id_char}${id_num}"
echo $viface
return
fi
done
# is mesh # is mesh?
for w in $(qmp_get_devices mesh); do for w in $(qmp_get_devices mesh); do
if [ "$w" == "$device" ]; then if [ "$w" == "$device" ]; then
viface="mesh_${id_char}${id_num}" viface="mesh_${id_char}${id_num}"
break break
fi fi
done done
echo "$viface" echo "$viface"
} }
# arg1=<mesh|lan|wan>, returns the devices which have to be configured in such mode # arg1=<mesh|lan|wan>, returns the devices which have to be configured in such mode
...@@ -122,7 +130,7 @@ qmp_get_devices() { ...@@ -122,7 +130,7 @@ qmp_get_devices() {
# except eth1 for RouterStation Pro # except eth1 for RouterStation Pro
if ! ( [[ "$dev" == "eth1" ]] && qmp_is_routerstationpro ) ; then if ! ( [[ "$dev" == "eth1" ]] && qmp_is_routerstationpro ) ; then
for landev in $(uci get qmp.interfaces.lan_devices 2>/dev/null); do for landev in $(uci get qmp.interfaces.lan_devices 2>/dev/null); do
if [ "$landev" == "$dev" ]; then if [ "$landev" == "$dev" ] && [ ! -e "/sys/class/net/$dev/phy80211" ] ; then
if [ $brlan_enabled -eq 0 ]; then if [ $brlan_enabled -eq 0 ]; then
dev="br-lan" dev="br-lan"
brlan_enabled=1 brlan_enabled=1
......
...@@ -346,7 +346,7 @@ qmp_configure_mesh() { ...@@ -346,7 +346,7 @@ qmp_configure_mesh() {
for protocol_vid in $protocol_vids; do for protocol_vid in $protocol_vids; do
local protocol_name="$(echo $protocol_vid | awk -F':' '{print $1}')" local protocol_name="$(echo $protocol_vid | awk -F':' '{print $1}')"
local vid="$(echo $protocol_vid | awk -F':' '{print $2}')" local vid="$(echo $protocol_vid | awk -F':' '{print $2}')"
# if no vlan is specified do not use vlan # if no vlan is specified do not use vlan
[ -z "$vid" ] && vid=1 && use_vlan=0 [ -z "$vid" ] && vid=1 && use_vlan=0
......
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