Developing lightweight computation at the DSG edge

Commit 934368ff authored by Simó Albert i Beltran's avatar Simó Albert i Beltran
Browse files

Change bmx6 tableRule parameter by WAN interfaces metric parameter. Closes #136.

parent 59d7ce09
......@@ -39,6 +39,7 @@ config 'qmp' 'networks'
option 'bmx6_ripe_prefix48' '2012:0:0' # suffix is autoconfigured based on community_node_id
option 'bmx6_ipv4_prefix24' '10.202.0' # last 8 bits are autoconfigured based on MAC
# option 'bmx6_ipv4_address' '' # specify it if you want to have a specific IPv4 address
# option 'wan_metric' '2048' # metric for WAN interfaces (default: 2048)
# Deprecated
# option 'bmx6_tablePrefTuns' '7000'
......@@ -51,7 +52,6 @@ config 'gateway'
option 'name' 'inet6'
option 'type' 'search'
option 'network' 'fc00::/7'
option 'tableRule' '32767/253'
option 'maxPrefixLen' '0'
config 'gateway'
......@@ -66,7 +66,6 @@ config 'gateway'
option 'type' 'search'
option 'network' '0.0.0.0/0'
option 'maxPrefixLen' '0'
option 'tableRule' '32767/253'
config 'gateway'
option 'name' 'inet4'
......
......@@ -757,6 +757,8 @@ qmp_configure_network() {
qmp_uci_set_raw network.$viface="interface"
qmp_attach_device_to_interface $i $viface
qmp_uci_set_raw network.$viface.proto="dhcp"
metric="$(qmp_uci_get network.wan_metric)"
qmp_uci_set_raw network.$viface.metric="${metric:-2048}"
done
# Set some important variables
......
......@@ -90,34 +90,34 @@ qmp_set_gateway()
qmp_gw_search_default_ipv4() {
qmp_set_gateway ignore 1 type offer network 0.0.0.0/0
qmp_set_gateway ignore 0 type search network 0.0.0.0/0 maxPrefixLen 0 tableRule 32767/253
qmp_set_gateway ignore 0 type search network 0.0.0.0/0 maxPrefixLen 0
qmp_gw_masq_wan 0
}
qmp_gw_search_default_ipv6() {
qmp_set_gateway ignore 1 type offer network ::/0
qmp_set_gateway ignore 0 type search network ::/0 maxPrefixLen 0 tableRule 32767/253
qmp_set_gateway ignore 0 type search network ::/0 maxPrefixLen 0
}
qmp_gw_offer_default_ipv4() {
qmp_set_gateway ignore 1 type search network 0.0.0.0/0 maxPrefixLen 0 tableRule 32767/253
qmp_set_gateway ignore 1 type search network 0.0.0.0/0 maxPrefixLen 0
qmp_set_gateway ignore 0 type offer network 0.0.0.0/0
qmp_gw_masq_wan 1
}
qmp_gw_offer_default_ipv6() {
qmp_set_gateway ignore 1 type search network ::/0 maxPrefixLen 0 tableRule 32767/253
qmp_set_gateway ignore 1 type search network ::/0 maxPrefixLen 0
qmp_set_gateway ignore 0 type offer network ::/0
}
qmp_gw_disable_default_ipv4() {
qmp_set_gateway ignore 1 type search network 0.0.0.0/0 maxPrefixLen 0 tableRule 32767/253
qmp_set_gateway ignore 1 type search network 0.0.0.0/0 maxPrefixLen 0
qmp_set_gateway ignore 1 type offer network 0.0.0.0/0
qmp_gw_masq_wan 0
}
qmp_gw_disable_default_ipv6() {
qmp_set_gateway ignore 1 type search network ::/0 maxPrefixLen 0 tableRule 32767/253
qmp_set_gateway ignore 1 type search network ::/0 maxPrefixLen 0
qmp_set_gateway ignore 1 type offer network ::/0
}
......
#
# Remove tableRule '32767/253' from search gateways.
#
# Copyright (C) 2013 Simó Albert i Beltran
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Remove tableRule '32767/253' from search gateways.
# See also: http://qmp.cat/issues/136
qmp_remove_tablerule()
{
local config=$1
config_get type "$config" type
config_get network "$config" network
config_get maxPrefixLen "$config" maxPrefixLen
if [ "$type" == "search" -a "$maxPrefixLen" == "0" -a \( "$network" == "0.0.0.0/0" -o "$network" == "fc00::/7" -o "$network" == "::/0" \) ]
then
uci_remove qmp "$config" tableRule "32767/2531"
fi
}
config_load qmp
config_foreach qmp_remove_tablerule gateway
......@@ -80,7 +80,7 @@ translate_tunnel()
type_no_ignore="search"
if [ "$ipv" = 4 ] && [ "$tunnel_network" = "0.0.0.0/0" ]
then
extra_args_no_ignore="maxPrefixLen 0 tableRule 32767/253"
extra_args_no_ignore="maxPrefixLen 0"
fi
else
config_get tunnel_network tunnels offer_ipv${ipv}_tunnel
......@@ -90,7 +90,7 @@ translate_tunnel()
type_no_ignore="offer"
if [ "$ipv" = 4 ] && [ "$tunnel_network" = "0.0.0.0/0" ]
then
extra_args_ignore="maxPrefixLen 0 tableRule 32767/253"
extra_args_ignore="maxPrefixLen 0"
fi
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