Developing lightweight computation at the DSG edge

Commit 4835bf9d authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

[qmp-system] 802.1ad VLANs for the routing protocol are created on top of the...

[qmp-system] 802.1ad VLANs for the routing protocol are created on top of the physical interface (II)

Fix VLANs for wireless interfaces, which were broken by previous commit.
parent 8d26005d
...@@ -51,39 +51,41 @@ qmp_check_device() { ...@@ -51,39 +51,41 @@ qmp_check_device() {
# - 802.1 VLANs are used for wireless interfaces. # - 802.1 VLANs are used for wireless interfaces.
# - 802.1ad (QinQ) VLANs are used for wired devices since qMp > 3.2.1 # - 802.1ad (QinQ) VLANs are used for wired devices since qMp > 3.2.1
qmp_set_vlan() { qmp_set_vlan() {
local viface="$1" # lan/wan/meshX local iface="$1" # The physical interface
local vid=$2 local vid=$2 # The VLAN
local liface=$3 # The logical interface lan/wan_X/mesh_Y
echo "Setting VLAN $vid for interface $viface" echo "Setting VLAN $vid for interface $iface"
[ -z "$viface" ] || [ -z "$vid" ] && return [ -z "$iface" ] || [ -z "$vid" ] && return
or_viface="$viface" # Replace dots by underscores to use the interface name as part of another one
viface="$(echo $viface | sed -r 's/\./_/g')" local uiface="$(echo $iface | sed -r 's/\./_/g')"
uci set network.${viface}_${vid}=device uci set network.${uiface}_${vid}=device
if [ -e "/sys/class/net/$dev/phy80211" ]; then if [ -e "/sys/class/net/$dev/phy80211" ]; then
# 802.1q VLANs for wireless interfaces # 802.1q VLANs for wireless interfaces
uci set network.${viface}_${vid}.type=8021q uci set network.${uiface}_${vid}.type=8021q
else else
# 802.1ad VLANs for wired interfaces # 802.1ad VLANs for wired interfaces
uci set network.${viface}_${vid}.type=8021ad uci set network.${uiface}_${vid}.type=8021ad
fi fi
uci set network.${viface}_${vid}.name=${viface}_${vid} uci set network.${uiface}_${vid}.name=${uiface}_${vid}
if [ -e "/sys/class/net/$dev/phy80211" ]; then if [ -e "/sys/class/net/$dev/phy80211" ]; then
# 802.1q VLANs for wireless interfaces # VLANs for wireless interfaces need to be configured on top of the
uci set network.${viface}_${vid}.ifname='@'${or_viface} # logical interface the radio is put in (e.g. mesh_w0 for wlan0)
uci set network.${uiface}_${vid}.ifname='@'${liface}
else else
# 802.1ad VLANs for wired interfaces # VLANs for wired interfaces are configured directly on top of the physical
uci set network.${viface}_${vid}.ifname=$or_viface # interface (e.g. eth0.2, eth1)
uci set network.${uiface}_${vid}.ifname=${iface}
fi fi
uci set network.${viface}_${vid}.vid=${vid} uci set network.${uiface}_${vid}.vid=${vid}
uci set network.${viface}_${vid}_ad=interface uci set network.${uiface}_${vid}_ad=interface
uci set network.${viface}_${vid}_ad.ifname=${viface}_${vid} uci set network.${uiface}_${vid}_ad.ifname=${uiface}_${vid}
uci set network.${viface}_${vid}_ad.proto=${none} uci set network.${uiface}_${vid}_ad.proto=${none}
uci set network.${viface}_${vid}_ad.auto=1 uci set network.${uiface}_${vid}_ad.auto=1
uci commit network uci commit network
} }
......
...@@ -367,7 +367,7 @@ qmp_configure_mesh() { ...@@ -367,7 +367,7 @@ qmp_configure_mesh() {
# in case of not use vlan tag, device definition is not needed. # in case of not use vlan tag, device definition is not needed.
[ $use_vlan -eq 1 ] && { [ $use_vlan -eq 1 ] && {
qmp_set_vlan $dev $vid qmp_set_vlan $dev $vid $viface
} }
dev="$(echo $dev | sed -r 's/\./_/g')" dev="$(echo $dev | sed -r 's/\./_/g')"
...@@ -383,7 +383,13 @@ qmp_configure_mesh() { ...@@ -383,7 +383,13 @@ qmp_configure_mesh() {
fi fi
done done
echo qmp_configure_rescue_ip_device "$dev" "$viface" # Rescue IPs are no longer needed since all the interfaces have link-local
# IPv6 address. However, the radios must be "assigned" to some interface to
# bring them up; otherwise the VLAN interface on top of the radio interface
# can't be brought up
if [ -e "/sys/class/net/$dev/phy80211" ]; then
qmp_configure_rescue_ip_device "$dev" "$viface"
fi
counter=$(( $counter + 1 )) counter=$(( $counter + 1 ))
done done
fi fi
......
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