Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFS Gluon Packages
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 Packages
Commits
27195d8d
Commit
27195d8d
authored
6 years ago
by
FFS-Roland
Browse files
Options
Downloads
Patches
Plain Diff
corrected Bug in handling Segments with leading zeros, as they are interpreted as octal numbers.
parent
01982c40
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
ffs-set-segment/files/usr/sbin/ffs-set-segment
+5
-11
5 additions, 11 deletions
ffs-set-segment/files/usr/sbin/ffs-set-segment
with
5 additions
and
11 deletions
ffs-set-segment/files/usr/sbin/ffs-set-segment
+
5
−
11
View file @
27195d8d
...
...
@@ -17,20 +17,13 @@ if [ "$(cat /proc/uptime | cut -d'.' -f1)" -lt 60 ]; then
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::"
)
BATSEG
=
$(
batctl gwl |
grep
'* '
|
cut
-d
' '
-f2
|
sed
's/:0/:/g'
|
cut
-d
':'
-f4
)
GITSEG
=
$(
nslookup ffs-
${
NODEID
}
-
${
PUBKEY
}
.segassign.freifunk-stuttgart.de ::1#54 |
grep
"2001:2:0:711::"
|
cut
-d
':'
-f7
)
if
[
-z
"
$SEG
INFO
"
]
;
then
if
[
-z
"
$
GIT
SEG
"
]
;
then
logger
-t
$ME
"Node not registered"
GITSEG
=
00
else
GITSEG
=
$(
printf
"%02d"
$(
echo
${
SEGINFO
/Address 1
:
2001
:2:0:711::/
}
|cut
-d
' '
-f1
|
cut
-d
':'
-f2
))
fi
if
[
"
$GITSEG
"
==
"00"
]
;
then
logger
-t
$ME
"Unknown Segment"
GITSEG
=
99
else
if
[
-n
"
$BATSEG
"
]
&&
[
"
$BATSEG
"
!=
"
$GITSEG
"
]
;
then
...
...
@@ -41,11 +34,12 @@ 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
=
"
\"
${
GW
}
s
${
GITSEG
}
.gw.freifunk-stuttgart.de
\"
port
$PORT
"
NEWPEER
=
$(
printf
"
\"
gw%02ds%02d
.gw.freifunk-stuttgart.de
\"
port
%d"
$i
$GITSEG
$PORT
)
if
[
"
$NEWPEER
"
!=
"
$OLDPEER
"
]
;
then
uci
set
fastd.mesh_vpn_backbone_peer_
${
GW
}
.remote
=
"
$NEWPEER
"
...
...
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