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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
FFS Gluon
Commits
6729bf37
Commit
6729bf37
authored
11 years ago
by
Matthias Schiffer
Browse files
Options
Downloads
Patches
Plain Diff
gluon-mesh-vpn-fastd: clean up configuration script
parent
e73f79f3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
package/gluon-mesh-vpn-fastd/fastd.pl
+41
-32
41 additions, 32 deletions
package/gluon-mesh-vpn-fastd/fastd.pl
with
41 additions
and
32 deletions
package/gluon-mesh-vpn-fastd/fastd.pl
+
41
−
32
View file @
6729bf37
...
@@ -3,63 +3,72 @@ my $backbone = $cfg->{backbone};
...
@@ -3,63 +3,72 @@ my $backbone = $cfg->{backbone};
my
$add_methods
=
'';
my
$add_methods
=
'';
for
(
@
{
$cfg
->
{
methods
}})
{
for
(
@
{
$cfg
->
{
methods
}})
{
$add_methods
.=
"
add_list fastd.mesh_vpn.method='
$_
'
\n
";
$add_methods
.=
"
uci
add_list fastd.mesh_vpn.method='
$_
'
\n
";
}
}
my
$set_peer_limit
;
my
$set_peer_limit
;
if
(
$backbone
->
{
limit
})
{
if
(
$backbone
->
{
limit
})
{
$set_peer_limit
=
"
set fastd
.
mesh_vpn_backbone
.
peer_limit
=
'
$backbone
->{limit}'
\n
";
$set_peer_limit
=
"
uci_
set fastd
mesh_vpn_backbone
peer_limit
'
$backbone
->{limit}'
\n
";
}
}
else
{
else
{
$set_peer_limit
=
"
delet
e fastd
.
mesh_vpn_backbone
.
peer_limit
\n
";
$set_peer_limit
=
"
uci_remov
e fastd
mesh_vpn_backbone
peer_limit
\n
";
}
}
print
<<END;
print
<<END;
#/bin/sh
#/bin/sh
uci -q batch <<EOF
. /lib/functions.sh
set fastd.mesh_vpn='fastd'
. /lib/gluon/functions/sysconfig.sh
set fastd.mesh_vpn.syslog_level='verbose'
delete fastd.mesh_vpn.config
delete fastd.mesh_vpn.config_peer_dir
set fastd.mesh_vpn.interface='mesh-vpn'
uci_add fastd fastd mesh_vpn
set fastd.mesh_vpn.mode='tap'
set fastd.mesh_vpn.mtu='$cfg->{mtu}'
uci_remove fastd mesh_vpn config
delete fastd.mesh_vpn.method
uci_remove fastd mesh_vpn config_peer_dir
uci_set fastd mesh_vpn syslog_level 'verbose'
uci_set fastd mesh_vpn interface 'mesh-vpn'
uci_set fastd mesh_vpn mode 'tap'
uci_set fastd mesh_vpn mtu '$cfg->{mtu}'
uci_remove fastd mesh_vpn method
$add_methods
$add_methods
delete fastd.mesh_vpn_backbone
set fastd.mesh_vpn_backbone='peer_group'
uci_remove fastd mesh_vpn_backbone
set fastd.mesh_vpn_backbone.enabled='1'
uci_add fastd peer_group mesh_vpn_backbone
set fastd.mesh_vpn_backbone.net='mesh_vpn'
uci_set fastd mesh_vpn_backbone enabled '1'
uci_set fastd mesh_vpn_backbone net 'mesh_vpn'
$set_peer_limit
$set_peer_limit
END
END
foreach
my
$name
(
sort
keys
%
{
$backbone
->
{
peers
}})
{
foreach
my
$name
(
sort
keys
%
{
$backbone
->
{
peers
}})
{
my
$peer
=
$backbone
->
{
peers
}
->
{
$name
};
my
$peer
=
$backbone
->
{
peers
}
->
{
$name
};
print
<<EOF;
print
<<EOF;
uci_remove fastd 'mesh_vpn_backbone_peer_$name'
delete fastd.mesh_vpn_backbone_peer_$name
uci_add fastd peer 'mesh_vpn_backbone_peer_$name'
set fastd.mesh_vpn_backbone_peer_$name='peer'
uci_set fastd 'mesh_vpn_backbone_peer_$name' enabled '1'
set fastd.mesh_vpn_backbone_peer_$name.enabled='1'
uci_set fastd 'mesh_vpn_backbone_peer_$name' net 'mesh_vpn'
set fastd.mesh_vpn_backbone_peer_$name.net='mesh_vpn'
uci_set fastd 'mesh_vpn_backbone_peer_$name' group 'mesh_vpn_backbone'
set fastd.mesh_vpn_backbone_peer_$name.group='mesh_vpn_backbone'
uci_set fastd 'mesh_vpn_backbone_peer_$name' key '$peer->{key}'
set fastd.mesh_vpn_backbone_peer_$name.key='$peer->{key}'
EOF
EOF
for
(
@
{
$peer
->
{
remotes
}})
{
for
(
@
{
$peer
->
{
remotes
}})
{
print
"
add_list fastd.mesh_vpn_backbone_peer_
$name
.remote='
$_
'
\n
";
print
"
uci
add_list fastd.mesh_vpn_backbone_peer_
$name
.remote='
$_
'
\n
";
}
}
}
}
print
<<END;
print
<<
'
END
'
;
commit fastd
uci_add network interface mesh_vpn
uci_set network mesh_vpn ifname 'mesh-vpn'
uci_set network mesh_vpn proto 'batadv'
uci_set network mesh_vpn mesh 'bat0'
set network.mesh_vpn='interface'
mainaddr=$(sysconfig primary_mac)
set network.mesh_vpn.ifname='mesh-vpn'
oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS"
set network.mesh_vpn.proto='batadv'
b2mask=0x02
set network.mesh_vpn.mesh='bat0'
vpnaddr=$(printf "%02x:%s:%s:%02x:%s:%s" $(( 0x$1 | $b2mask )) $2 $3 $(( (0x$4 + 1) % 0x100 )) $5 $6)
commit network
uci_set network mesh_vpn macaddr "$vpnaddr"
EOF
uci_commit fastd
uci_commit network
END
END
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