Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
FFS Gluon Packages
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
firmware
FFS Gluon Packages
Commits
cb5fd4bb
Commit
cb5fd4bb
authored
Sep 08, 2018
by
FFS-Roland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoiding lock out after manually changing /etc/conf/fastd with uci commit.
parent
a63d3c04
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
ffs-set-segment/files/usr/sbin/ffs-set-segment
ffs-set-segment/files/usr/sbin/ffs-set-segment
+18
-18
No files found.
ffs-set-segment/files/usr/sbin/ffs-set-segment
View file @
cb5fd4bb
...
...
@@ -12,34 +12,34 @@ if [ "$(uci get fastd.mesh_vpn_backbone.auto_segment)" = "0" ]; then
logger
-t
$ME
"auto_segment disabled"
exit
0
fi
if
[
"
$(
cat
/proc/uptime |
cut
-d
'.'
-f1
)
"
-lt
60
]
;
then
logger
-t
$ME
"waiting for batman"
exit
0
fi
BATSEG
=
$(
batctl gwl |
grep
'* '
|
cut
-d
' '
-f2
|
cut
-d
':'
-f4
)
NODEID
=
$(
uci get network.bat0.macaddr |
sed
's/://g'
)
PUBKEY
=
$(
/etc/init.d/fastd show_key mesh_vpn |
cut
-c1-12
)
SEGINFO
=
$(
nslookup ffs-
${
NODEID
}
-
${
PUBKEY
}
.segassign.freifunk-stuttgart.de ::1#54 |
grep
"2001:2:0:711::"
)
if
[
-z
"
$SEGINFO
"
]
;
then
logger
-t
$ME
"Node not registered"
exit
1
fi
SEGINFO
=
${
SEGINFO
/Address 1
:
2001
:2:0:711::/
}
SEGMENT
=
$(
echo
$SEGINFO
|cut
-d
' '
-f1
|
cut
-d
':'
-f2
)
let
PORT
=
SEGMENT+10200
if
[
$PORT
-le
10200
]
;
then
logger
-t
$ME
"Invalid Segment"
exit
1
fi
if
[
"
$(
cat
/proc/uptime |
cut
-d
'.'
-f1
)
"
-lt
60
]
;
then
logger
-t
$ME
"waiting for batman"
exit
0
GITSEG
=
00
else
GITSEG
=
$(
printf
"%02d"
$(
echo
${
SEGINFO
/Address 1
:
2001
:2:0:711::/
}
|cut
-d
' '
-f1
|
cut
-d
':'
-f2
))
fi
GITSEG
=
$(
printf
"%02d"
$SEGMENT
)
BATSEG
=
$(
batctl gwl |
grep
'* '
|
cut
-d
' '
-f2
|
cut
-d
':'
-f4
)
if
[
-n
"
$BATSEG
"
]
&&
[
"
$BATSEG
"
!=
"
$GITSEG
"
]
;
then
logger
-t
$ME
"Avoiding Shortcut"
exit
1
if
[
"
$GITSEG
"
==
"00"
]
;
then
logger
-t
$ME
"Unknown Segment"
GITSEG
=
99
else
if
[
-n
"
$BATSEG
"
]
&&
[
"
$BATSEG
"
!=
"
$GITSEG
"
]
;
then
logger
-t
$ME
"Avoiding Shortcut"
GITSEG
=
99
fi
fi
let
PORT
=
GITSEG+10200
CHANGED
=
0
for
i
in
`
seq
1 10
`
;
do
...
...
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