aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2020-02-17 19:26:27 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2020-02-17 19:56:58 +0200
commitae96f310077191b50c5bb52d39c3ef4f0c2fa552 (patch)
tree6c3cf61681701c79d9971e5586ffabb53bdfc97f
parente4bf525fead9ab5f768b189ae913c78bcf8716ba (diff)
downloaddmvpn-tools-ae96f310077191b50c5bb52d39c3ef4f0c2fa552.tar.gz
dmvpn-tools-ae96f310077191b50c5bb52d39c3ef4f0c2fa552.tar.bz2
dmvpn-tools-ae96f310077191b50c5bb52d39c3ef4f0c2fa552.tar.xz
nhrp-events: wait for socket creation on startupv1.3.0
avoid race condition where an nhs-up message arrives before socket is ready
-rw-r--r--nhrp-events.initd15
1 files changed, 12 insertions, 3 deletions
diff --git a/nhrp-events.initd b/nhrp-events.initd
index c42124f..0b40ead 100644
--- a/nhrp-events.initd
+++ b/nhrp-events.initd
@@ -1,13 +1,22 @@
#!/sbin/openrc-run
# init.d file for nhrp-events
-# Copyright (c) 2017-2018 Kaarle Ritvanen
+# Copyright (c) 2017-2020 Kaarle Ritvanen
name=nhrp-events
-command=/usr/sbin/$name
pidfile=/var/run/$name.pid
-command_background=1
depend() {
need bgpd
}
+
+start() {
+ local rc
+ local socket=/var/run/$name.sock
+ ebegin "Starting $name"
+ rm -f $socket
+ start-stop-daemon -bmS -p $pidfile /usr/sbin/$name
+ rc=$?
+ ewaitfile 5 $socket
+ eend $rc
+}