]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
daemon: invoke lldpcli after dropping privileges
authorVincent Bernat <vincent@bernat.im>
Wed, 28 Sep 2016 20:43:48 +0000 (22:43 +0200)
committerVincent Bernat <vincent@bernat.im>
Wed, 28 Sep 2016 20:43:48 +0000 (22:43 +0200)
We don't need to run it as root. Moreover, it will happen after
daemonization and won't clutter the screen in case lldpd dies too
early. On the other hand, if we fail to spawn it, the error message may
be hidden in the logs. Though choice.

NEWS
src/daemon/lldpd.c

diff --git a/NEWS b/NEWS
index d104d7c39b9b584454d6b88bddbac23af2b907cc..8a49828e8dfcd591a83a8141355329c25738d1cf 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ lldpd (0.9.5)
       the privileged process.
     + LLDP-MED capability TLV is not sent when LLDP-MED is not enabled,
       even if other LLDP-MED TLV are present.
+    + Invoke lldpcli for initial configuration later (after dropping
+      privileges).
   * Fix:
     + Compilation fix with older versions of GCC.
     + Don't use ethtool at all to get real MAC address for enslaved
index 1ab76663a02059e35f46c54bd2dfec4e619137a2..b3a8ada5240261f7bb566c4a3e76c8c47b26f69f 100644 (file)
@@ -1694,13 +1694,6 @@ lldpd_main(int argc, char *argv[], char *envp[])
        /* Disable SIGHUP, until handlers are installed */
        signal(SIGHUP, SIG_IGN);
 
-       /* Configuration with lldpcli */
-       if (lldpcli) {
-               log_debug("main", "invoking lldpcli for configuration");
-               if (lldpd_configure(use_syslog, debug, lldpcli, ctlname) == -1)
-                       fatal("main", "unable to spawn lldpcli");
-       }
-
        /* Try to read system information from /etc/os-release if possible.
           Fall back to lsb_release for compatibility. */
        log_debug("main", "get OS/LSB release information");
@@ -1851,6 +1844,13 @@ lldpd_main(int argc, char *argv[], char *envp[])
        priv_init(PRIVSEP_CHROOT, ctl, 0, 0);
 #endif
 
+       /* Configuration with lldpcli */
+       if (lldpcli) {
+               log_debug("main", "invoking lldpcli for configuration");
+               if (lldpd_configure(use_syslog, debug, lldpcli, ctlname) == -1)
+                       fatal("main", "unable to spawn lldpcli");
+       }
+
        /* Main loop */
        log_debug("main", "start main loop");
        levent_loop(cfg);