Developing lightweight computation at the DSG edge

Commit 5c8082be authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

Use rescue virtual interface for VLAN tagging in WAN+MESH mode to have the...

Use rescue virtual interface for VLAN tagging in WAN+MESH mode to have the interface despite not having DHCP lease
parent 35d10a6f
......@@ -765,10 +765,13 @@ qmp_configure_bmx6() {
for no_vlan_int in $(qmp_uci_get interfaces.no_vlan_devices); do
[ "$no_vlan_int" == "$dev" ] && use_vlan=0
done
# Check if the protocol has VLAN tag configured
local vid="$(echo $protocol_vid | awk -F':' '{print $2}')"
[ -z "$vid" -o $vid -lt 1 ] && use_vlan=0
# If vlan tagging
if [ $use_vlan -eq 1 ]; then
local vid="$(echo $protocol_vid | awk -F':' '{print $2}')"
local ifname="$dev.$vid"
# If not vlan tagging
......
......@@ -24,7 +24,7 @@ qmp_set_mss_clamping_and_masq() {
"iptables -t nat -A POSTROUTING -o $dev ! -d 10.0.0.0/8 -j MASQUERADE"; do
[ -z "$dev" ] && return
if [ "$rm" == "remove" ]; then
sed -i /"${rule}"/d $fw
sed -i /"$(echo $rule | sed s?'/'?'\\/'?g)"/d $fw
else if [ $(cat $fw | grep "$rule" -c) -eq 0 ]; then
qmp_log "Adding TCP ClampMSS rule for $dev"
echo "$rule" >> $fw
......@@ -346,6 +346,9 @@ qmp_configure_mesh() {
for protocol_vid in $protocol_vids; do
local protocol_name="$(echo $protocol_vid | awk -F':' '{print $1}')"
local vid="$(echo $protocol_vid | awk -F':' '{print $2}')"
# if no vlan is specified do not use vlan
[ -z "$vid" ] && vid=1 && use_vlan=0
# virtual interface
local viface=$(qmp_get_virtual_iface $dev)
......@@ -355,7 +358,14 @@ qmp_configure_mesh() {
# Since all interfaces are defined somewhere (LAN, WAN or with Rescue IP),
# in case of not use vlan tag, device definition is not needed.
[ $use_vlan -eq 1 ] || [ $vid -gt 0 ] && qmp_set_vlan $viface $vid
[ $use_vlan -eq 1 ] && {
# If device is WAN use rescue for the VLAN tag
if [ $(qmp_get_devices wan | grep -c $dev) -gt 0 ]; then
qmp_set_vlan ${viface}_rescue $vid
else
qmp_set_vlan $viface $vid
fi
}
# Configure IPv6 address only if mesh_prefix48 is defined (bmx6 does not need it)
if qmp_uci_test qmp.networks.${protocol_name}_mesh_prefix48; then
......
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