Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFS Gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
FFS Gluon
Commits
93791373
Unverified
Commit
93791373
authored
May 10, 2020
by
Matthias Schiffer
Committed by
GitHub
May 10, 2020
Browse files
Options
Downloads
Plain Diff
Merge pull request #2021 from freifunk-gluon/fastd-peer-cleanup
gluon-mesh-vpn-fastd: clean up peers and groups on update
parents
64725858
3ccf7fdd
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/user/site.rst
+6
-0
6 additions, 0 deletions
docs/user/site.rst
package/gluon-mesh-vpn-fastd/luasrc/lib/gluon/upgrade/400-mesh-vpn-fastd
+38
-15
38 additions, 15 deletions
...esh-vpn-fastd/luasrc/lib/gluon/upgrade/400-mesh-vpn-fastd
with
44 additions
and
15 deletions
docs/user/site.rst
+
6
−
0
View file @
93791373
...
@@ -302,6 +302,12 @@ mesh_vpn
...
@@ -302,6 +302,12 @@ mesh_vpn
You can set syslog_level from verbose (default) to warn to reduce syslog output.
You can set syslog_level from verbose (default) to warn to reduce syslog output.
fastd allows to configure a tree of peer groups and peers. By default, the
list of groups and peers configured in the *fastd* UCI config is completely
replaced by the list from site.conf on upgrades. To allow custom modifications
to the peer list, removal and modification of peers can be prevented by
setting the *preserve* option of a peer to ``1`` in UCI.
The `tunneldigger` section is used to define the *tunneldigger* broker list.
The `tunneldigger` section is used to define the *tunneldigger* broker list.
**Note:** It doesn't make sense to include both `fastd` and `tunneldigger`
**Note:** It doesn't make sense to include both `fastd` and `tunneldigger`
...
...
This diff is collapsed.
Click to expand it.
package/gluon-mesh-vpn-fastd/luasrc/lib/gluon/upgrade/400-mesh-vpn-fastd
+
38
−
15
View file @
93791373
...
@@ -48,10 +48,43 @@ uci:section('fastd', 'fastd', 'mesh_vpn', {
...
@@ -48,10 +48,43 @@ uci:section('fastd', 'fastd', 'mesh_vpn', {
uci
:
delete
(
'fastd'
,
'mesh_vpn'
,
'user'
)
uci
:
delete
(
'fastd'
,
'mesh_vpn'
,
'user'
)
-- Collect list of groups that have peers with 'preserve' flag
local
preserve_groups
=
{}
local
function
preserve_group
(
name
)
if
not
name
or
preserve_groups
[
name
]
then
return
end
preserve_groups
[
name
]
=
true
local
parent
=
uci
:
get
(
'fastd'
,
name
,
'group'
)
preserve_group
(
parent
)
end
uci
:
foreach
(
'fastd'
,
'peer'
,
function
(
peer
)
if
peer
.
net
==
'mesh_vpn'
and
peer
.
preserve
==
'1'
then
preserve_group
(
peer
.
group
)
end
end
)
-- Clean up previous configuration
uci
:
delete_all
(
'fastd'
,
'peer'
,
function
(
peer
)
return
(
peer
.
net
==
'mesh_vpn'
and
peer
.
preserve
~=
'1'
)
end
)
uci
:
delete_all
(
'fastd'
,
'peer_group'
,
function
(
group
)
return
(
group
.
net
==
'mesh_vpn'
and
not
preserve_groups
[
group
[
'.name'
]])
end
)
local
add_groups
local
add_groups
local
function
add_peer
(
group
,
name
,
config
)
local
function
add_peer
(
group
,
name
,
config
)
uci
:
section
(
'fastd'
,
'peer'
,
group
..
'_peer_'
..
name
,
{
local
uci_name
=
group
..
'_peer_'
..
name
if
uci
:
get_bool
(
'fastd'
,
uci_name
,
'preserve'
)
then
return
end
uci
:
section
(
'fastd'
,
'peer'
,
uci_name
,
{
enabled
=
true
,
enabled
=
true
,
net
=
'mesh_vpn'
,
net
=
'mesh_vpn'
,
group
=
group
,
group
=
group
,
...
@@ -61,12 +94,6 @@ local function add_peer(group, name, config)
...
@@ -61,12 +94,6 @@ local function add_peer(group, name, config)
end
end
local
function
add_group
(
name
,
config
,
parent
)
local
function
add_group
(
name
,
config
,
parent
)
uci
:
delete
(
'fastd'
,
name
)
uci
:
delete_all
(
'fastd'
,
'peer'
,
function
(
peer
)
return
(
peer
.
net
==
'mesh_vpn'
and
peer
.
group
==
name
)
end
)
uci
:
section
(
'fastd'
,
'peer_group'
,
name
,
{
uci
:
section
(
'fastd'
,
'peer_group'
,
name
,
{
enabled
=
true
,
enabled
=
true
,
net
=
'mesh_vpn'
,
net
=
'mesh_vpn'
,
...
@@ -74,23 +101,19 @@ local function add_group(name, config, parent)
...
@@ -74,23 +101,19 @@ local function add_group(name, config, parent)
peer_limit
=
config
.
limit
,
peer_limit
=
config
.
limit
,
})
})
if
config
.
peers
then
for
peername
,
peerconfig
in
pairs
(
config
.
peers
or
{})
do
for
peername
,
peerconfig
in
pairs
(
config
.
peers
)
do
add_peer
(
name
,
peername
,
peerconfig
)
add_peer
(
name
,
peername
,
peerconfig
)
end
end
end
add_groups
(
name
,
config
.
groups
,
name
)
add_groups
(
name
,
config
.
groups
,
name
)
end
end
-- declared local above
-- declared local above
function
add_groups
(
prefix
,
groups
,
parent
)
function
add_groups
(
prefix
,
groups
,
parent
)
if
groups
then
for
name
,
group
in
pairs
(
groups
or
{})
do
for
name
,
group
in
pairs
(
groups
)
do
add_group
(
prefix
..
'_'
..
name
,
group
,
parent
)
add_group
(
prefix
..
'_'
..
name
,
group
,
parent
)
end
end
end
end
end
add_groups
(
'mesh_vpn'
,
site
.
mesh_vpn
.
fastd
.
groups
())
add_groups
(
'mesh_vpn'
,
site
.
mesh_vpn
.
fastd
.
groups
())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment