Developing lightweight computation at the DSG edge
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Quick Mesh Project
qMp packages
Commits
f20965ac
Commit
f20965ac
authored
Aug 23, 2013
by
p4u
Browse files
Adapt more functions to the new gateway configuration syntax
parent
61adbd3f
Changes
3
Hide whitespace changes
Inline
Side-by-side
packages/qmp-system/files/etc/qmp/qmp_control.sh
View file @
f20965ac
...
...
@@ -61,6 +61,10 @@ configure_wifi() {
fi
}
configure_gw
()
{
qmp_gw_apply
}
apply_netserver
()
{
[
"
$(
qmp_uci_get networks.netserver
)
"
==
"1"
]
&&
qmp_enable_netserver
||
qmp_disable_netserver
}
...
...
@@ -168,6 +172,7 @@ help() {
echo
" configure_system : Configure and apply system settings (qmp.node section and so on)"
echo
" configure_wifi : Configure all WiFi devices"
echo
" reset_wifi : Reset, rescan and configure all the WiFi devices"
echo
" configure_gw : Configure and apply gateways settings"
echo
""
echo
"Safe configuration:"
...
...
packages/qmp-system/files/etc/qmp/qmp_functions.sh
View file @
f20965ac
...
...
@@ -922,15 +922,13 @@ qmp_add_qmp_bmx6_tunnels()
config_get
type
"
$section
"
type
if
[
"
$type
"
=
"offer"
]
then
bmx6_type
=
tunInNet
# Future configuration
#bmx6_type=tunIn
bmx6_type
=
tunIn
uci
set
$config
.
$name
=
"
$bmx6_type
"
uci
set
$config
.
$name
.
$bmx6_type
=
"
$section
"
qmp_translate_configuration gateways
$section
network
$config
$name
$bmx6_type
# Future configuration
#qmp_translate_configuration gateways $section network $config $name
qmp_translate_configuration gateways
$section
bandwidth
$config
$name
qmp_translate_configuration gateways
$section
network
$config
$name
#qmp_translate_configuration gateways $section bandwidth $config $name
else
# if [ "$type" = "search" ]
bmx6_type
=
tunOut
...
...
packages/qmp-system/files/etc/qmp/qmp_gw.sh
View file @
f20965ac
...
...
@@ -33,57 +33,27 @@ fi
[
-z
"
$SOURCE_COMMON
"
]
&&
.
$QMP_PATH
/qmp_common.sh
[
-z
"
$SOURCE_FUNCTIONS
"
]
&&
.
$QMP_PATH
/qmp_functions.sh
qmp_exists_gateway
()
qmp_exists_gateway
()
{
qmp_uci_test gateways.
$1
return
$?
}
# set a gateway with given name and values
# <name> [arg1name arg1value] [arg2name arg2value] ...
qmp_set_gateway
()
{
local
config
=
$1
local
name
=
"
$1
"
shift
local
ignore
=
0
local
exists
args_key_values
=
"
$(
echo
$@
|
awk
-v
RS
=
' '
'NR % 2 == 1 && $0 !~ "^(ignore|(minB|b)andwidth)$" {a+=1} END {print a}'
)
"
uci_key_values
=
$(
env
|
grep
-v
-e
"^CONFIG_
${
config
}
_
\(
TYPE
\|
ignore
\|\(
minB
\|
b
\)
andwidth
\)
="
|
grep
-c
"^CONFIG_
${
config
}
_"
)
[
"
$args_key_values
"
!=
"
$uci_key_values
"
]
&&
return
while
[
$#
-ge
2
]
do
if
[
"
$1
"
=
"ignore"
]
then
ignore
=
"
$2
"
else
config_get exists
"
$config
"
$1
if
[
"
$exists
"
!=
"
$2
"
]
then
return
fi
fi
qmp_uci_set_raw gateways.
$name
.
$1
=
"
$2
"
shift
shift
done
uci_set gateways
"
$config
"
ignore
"
$ignore
"
uci_commit
qmp_gateway_found
=
true
qmp_uci_commit gateways
}
qmp_set_gateway
()
{
config_load gateways
qmp_gateway_found
=
false
config_foreach qmp_exists_gateway gateway
$@
if
!
$qmp_gateway_found
then
local
config
config
=
"
$(
uci add gateways gateway
)
"
while
[
$#
-ge
2
]
do
uci_set gateways
"
$config
"
"
$1
"
"
$2
"
shift
shift
done
uci_commit
fi
}
qmp_gw_search_default_ipv4
()
{
qmp_set_gateway ignore 1
type
offer network 0.0.0.0/0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment