From 13473e5259f64d394f3ce8390cd11804b5f9e145 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 20 Oct 2018 10:53:29 +0200 Subject: [PATCH 1/2] Fix issue #39, configure interfaces after daemonization, as otherwise we loose the ALLMULTI flag on the listening interfaces during the whole process. Probable cause is the parent restoring the original state of the interface flags before exitting. --- src/ndppd.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ndppd.cc b/src/ndppd.cc index d54718f..e00153e 100644 --- a/src/ndppd.cc +++ b/src/ndppd.cc @@ -351,9 +351,6 @@ int main(int argc, char* argv[], char* env[]) if (cf.is_null()) return -1; - if (!configure(cf)) - return -1; - if (daemon) { logger::syslog(true); @@ -361,6 +358,9 @@ int main(int argc, char* argv[], char* env[]) return 1; } + if (!configure(cf)) + return -1; + if (!pidfile.empty()) { std::ofstream pf; pf.open(pidfile.c_str(), std::ios::out | std::ios::trunc); From caef398f85f09d9a980162a1776b290b32db77f8 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 20 Oct 2018 11:02:21 +0200 Subject: [PATCH 2/2] Added init script working on Debian Jessie, just copy the file to /etc/init.d/ndppd. Probably works on current stable as well, but I couldn't test this so far. --- ndppd-init-debian-jessi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 ndppd-init-debian-jessi diff --git a/ndppd-init-debian-jessi b/ndppd-init-debian-jessi new file mode 100755 index 0000000..10badec --- /dev/null +++ b/ndppd-init-debian-jessi @@ -0,0 +1,21 @@ +#!/bin/sh +# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing. +if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then + set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script +fi + +### BEGIN INIT INFO +# Provides: ndppd +# Required-Start: $remote_fs $syslog $network +# Required-Stop: $remote_fs $syslog $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: ndppd init script +# Description: NDP Proxy Daemon init script +### END INIT INFO +# Author: Torben Nehmer + +DESC="NDP Proxy Daemon" +PIDFILE=/run/ndppd.pid +DAEMON=/usr/local/sbin/ndppd +DAEMON_ARGS="-d -p $PIDFILE"