Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ansible
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
infrastruktur
ansible
Commits
5695dea2
Commit
5695dea2
authored
Sep 23, 2021
by
Nico
Browse files
Options
Downloads
Patches
Plain Diff
ffs-set-segment: remove old shell code
parent
114d9c26
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
roles/localgw/files/ffs-set-segment.py
+0
-79
0 additions, 79 deletions
roles/localgw/files/ffs-set-segment.py
with
0 additions
and
79 deletions
roles/localgw/files/ffs-set-segment.py
+
0
−
79
View file @
5695dea2
...
@@ -146,82 +146,3 @@ if __name__ == "__main__":
...
@@ -146,82 +146,3 @@ if __name__ == "__main__":
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
main
()
main
()
"""
set -eu
set -o pipefail
NODEID=$(uci get network.bat-1.macaddr | sed
'
s/://g
'
)
PUBKEY=$(/etc/init.d/fastd show_key mesh_vpn | cut -c1-12)
DNSDOM=
"
freifunk-stuttgart.de
"
DNSREQ=
"
ffs-${NODEID}-${PUBKEY}.segassign.${DNSDOM}
"
DNSLIST=
"
::1#54 $(cat /var/gluon/wan-dnsmasq/resolv.conf | cut -d
'
'
-f2)
"
for ip in $DNSLIST;
do
if [
"
$(echo ${ip} | cut -d
'
:
'
-f1)
"
=
"
fe80
"
]; then
DNSSRV=${ip}%br-wan
else
DNSSRV=${ip}
fi
logger -t $ME
"
DNSv6 on ${DNSSRV} for ${DNSREQ} ...
"
GITSEG=$(nslookup ${DNSREQ} ${DNSSRV} | grep
"
2001:2:0:711::
"
| cut -d
'
:
'
-f7)
if [ -z
"
$GITSEG
"
]; then
logger -t $ME
"
DNSv4 on ${DNSSRV} for ${DNSREQ} ...
"
GITSEG=$(nslookup ${DNSREQ} ::1#54 | grep
"
198.18.190.
"
| cut -d
'
.
'
-f4)
fi
if [ -n
"
$GITSEG
"
]; then
break
fi
done
if [ -z
"
$GITSEG
"
]; then
DNSERR=$(nslookup ${DNSREQ} ::1#54 2>&1)
logger -t $ME
"
DNS not working: $DNSERR
"
logger -t $ME
"
DNS settings: $(cat /var/gluon/wan-dnsmasq/resolv.conf)
"
exit 1
else
if [
"
$DNSSRV
"
!=
"
::1#54
"
]; then
logger -t $ME
"
DNSMASQ not working - will be restarted
"
/etc/init.d/gluon-wan-dnsmasq stop
/etc/init.d/gluon-wan-dnsmasq start
fi
fi
if [ -n
"
$BATSEG
"
] && [
"
$BATSEG
"
!=
"
$GITSEG
"
]; then
logger -t $ME
"
Avoiding Shortcut: $BATSEG - $GITSEG
"
GITSEG=99
else
if [
"
$GITSEG
"
=
"
99
"
]; then
logger -t $ME
"
Node not registered
"
else
logger -t $ME
"
Node is in Segment $GITSEG
"
fi
fi
let PORT=GITSEG+10200
CHANGED=0
for i in `seq 1 10`;
do
GW=$(printf
"
gw%02d
"
$i)
OLDPEER=$(uci get fastd.mesh_vpn_backbone_peer_${GW}.remote)
NEWPEER=$(printf
"
\"
gw%02ds%02d.gw.${DNSDOM}
\"
port %d
"
$i $GITSEG $PORT)
if [
"
$NEWPEER
"
!=
"
$OLDPEER
"
]; then
uci set fastd.mesh_vpn_backbone_peer_${GW}.remote=
"
$NEWPEER
"
CHANGED=1
fi
done
if [
"
$CHANGED
"
=
"
1
"
]; then
/sbin/ifdown client
/etc/init.d/fastd restart
/sbin/ifup client
logger -t $ME
"
Set Segment: $GITSEG
"
else
logger -t $ME
"
No changes
"
fi
"""
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