From 00da8bf7bab88a3827af4110fb27df9cde542e32 Mon Sep 17 00:00:00 2001 From: Daniel Adolfsson Date: Tue, 12 Feb 2013 13:25:22 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20issue=20#2=20-=20ndppd=20d=C3=A6monizes=20t?= =?UTF-8?q?oo=20early?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ndppd.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) --- a/src/ndppd.cc +++ b/src/ndppd.cc @@ -201,15 +201,6 @@ int main(int argc, char* argv[], char* e } } - if (daemon) { - logger::syslog(true); - - if (daemonize() < 0) { - logger::error() << "Failed to daemonize process"; - return 1; - } - } - if (!pidfile.empty()) { std::ofstream pf; pf.open(pidfile.c_str(), std::ios::out | std::ios::trunc); @@ -225,8 +216,15 @@ int main(int argc, char* argv[], char* e if (!configure(config_path)) return -1; + + if (daemon) { + logger::syslog(true); - //route::load("/proc/net/ipv6_route"); + if (daemonize() < 0) { + logger::error() << "Failed to daemonize process"; + return 1; + } + } // Time stuff. --- a/src/iface.cc +++ b/src/iface.cc @@ -147,7 +147,7 @@ ptr iface::open_pfd(const std::st // Bail if it's* not* ND_NEIGHBOR_SOLICIT. BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, ND_NEIGHBOR_SOLICIT, 0, 1), // Keep packet. - BPF_STMT(BPF_RET | BPF_K, -1), + BPF_STMT(BPF_RET | BPF_K, 0xFFFFFFFF), // Drop packet. BPF_STMT(BPF_RET | BPF_K, 0) };