]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lldpd: tell `lldpcli` to use the appropriate control socket
authorVincent Bernat <vincent.bernat@dailymotion.com>
Fri, 8 Nov 2013 13:26:34 +0000 (14:26 +0100)
committerVincent Bernat <vincent.bernat@dailymotion.com>
Fri, 8 Nov 2013 13:29:08 +0000 (14:29 +0100)
When using a non-default control socket, lldpd was not providing the
appropriate name to lldpcli which was then not able to configure lldpd
during startup.

This fixes #48.

src/daemon/lldpd.c

index fb91fd38f1fbf51c1073705d0b726c648ed45503..2c143cd43b9457d3f0508ebd25cd9d8f52578fd2 100644 (file)
@@ -1102,7 +1102,7 @@ lldpd_exit(struct lldpd *cfg)
  * @return PID of running lldpcli or -1 if error.
  */
 static pid_t
-lldpd_configure(int debug, const char *path)
+lldpd_configure(int debug, const char *path, const char *ctlname)
 {
        pid_t lldpcli = fork();
        int devnull;
@@ -1125,6 +1125,7 @@ lldpd_configure(int debug, const char *path)
 
                        log_debug("main", "invoke %s %s", path, sdebug);
                        if (execl(path, "lldpcli", sdebug,
+                               "-u", ctlname,
                                "-c", SYSCONFDIR "/lldpd.conf",
                                "-c", SYSCONFDIR "/lldpd.d",
                                "resume",
@@ -1448,7 +1449,7 @@ lldpd_main(int argc, char *argv[], char *envp[])
        /* Configuration with lldpcli */
        if (lldpcli) {
                log_debug("main", "invoking lldpcli for configuration");
-               if (lldpd_configure(debug, lldpcli) == -1)
+               if (lldpd_configure(debug, lldpcli, ctlname) == -1)
                        fatal("main", "unable to spawn lldpcli");
        }