Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
ffbs-gluon
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
darkbit
ffbs-gluon
Commits
d432a0a2
Commit
d432a0a2
authored
9 years ago
by
Matthias Schiffer
Browse files
Options
Downloads
Patches
Plain Diff
alfred: not only wait for the interface, but also a link-local address
parent
0f928b08
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
patches/packages/routing/0004-alfred-not-only-wait-for-the-interface-but-also-a-link-local-address.patch
+62
-0
62 additions, 0 deletions
...ait-for-the-interface-but-also-a-link-local-address.patch
with
62 additions
and
0 deletions
patches/packages/routing/0004-alfred-not-only-wait-for-the-interface-but-also-a-link-local-address.patch
0 → 100644
+
62
−
0
View file @
d432a0a2
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 9 Aug 2015 18:03:28 +0200
Subject: alfred: not only wait for the interface, but also a link-local address
Changes between alfred 2015.0 and 2015.1 cause alfred to print an error
and exit when the interface to bind to is not completely set up (has no
non-tentative link-local address). As a workaround, wait for such an
address by reading /proc/net/if_inet6 before alfred is started.
In the long term, it would be nice to make alfred more robust against
missing interfaces (allowing alfred to start without the interface
existing, and keeping it working even when the interface is removed and
re-added while alfred is running).
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/alfred/files/alfred.init b/alfred/files/alfred.init
index 5ce06c0..8e1f11d 100755
--- a/alfred/files/alfred.init
+++ b/alfred/files/alfred.init
@@ -37,6 +37,32 @@
wait_for_dir()
fi
}
+wait_for_ll_address()
+{
+ local iface="$1"
+ local timeout
+
+ timeout=30
+ echo "${initscript}: waiting $timeout secs for $iface address..."
+ for i in $(seq $timeout); do
+ # We look for
+ # - the link-local address (starts with fe80)
+ # - without tentative flag (bit 0x40 in the flags field; the first char of the flags field begins 38 columns after the fe80 prefix
+ # - on interface $iface
+ if awk '
+ BEGIN { RET=1 }
+ /^fe80.{37} [012389ab]/ { if ($6 == "'"$iface"'") RET=0 }
+ END { exit RET }
+ ' /proc/net/if_inet6; then
+ return
+ fi
+ sleep 1
+ done
+
+ echo "${initscript}: $iface address not detected, alfred not starting."
+ exit 1
+}
+
alfred_start()
{
local args=""
@@ -62,7 +88,7 @@
alfred_start()
wait_for_dir "$batmanif" "/sys/class/net/$batmanif/mesh"
fi
- wait_for_dir "$interface" "/sys/class/net/$interface/"
+ wait_for_ll_address "$interface"
append alfred_args "$args"
enable=1
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