lldpd: update to v0.7.15 and add support for parsing /etc/openwrt_release
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 28 May 2015 16:19:38 +0000 (16:19 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 28 May 2015 16:19:38 +0000 (16:19 +0000)
Also drop superseded patches.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
SVN-Revision: 45810

package/network/services/lldpd/Makefile
package/network/services/lldpd/patches/001-priv-don-t-lookup-for-_lldpd-when-privsep-is-disable.patch [deleted file]
package/network/services/lldpd/patches/002-no-stack-protector.patch [deleted file]
package/network/services/lldpd/patches/100-os-release.patch [new file with mode: 0644]

index d80840e..69f7022 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=lldpd
-PKG_VERSION:=0.7.13
-PKG_RELEASE:=2
+PKG_VERSION:=0.7.15
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://media.luffy.cx/files/lldpd
-PKG_MD5SUM:=13e8be761753eac9a8e12128acba40b4
+PKG_MD5SUM:=46f7ad97fc1d04084ab11b32fc0ed708
 
 PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
 PKG_LICENSE:=ISC
@@ -92,6 +92,7 @@ CONFIGURE_ARGS += \
        ,--disable-privsep) \
        --with-readline=no \
        --with-embedded-libevent=no \
+       --disable-hardening \
        $(if $(CONFIG_LLDPD_WITH_CDP),,--disable-cdp) \
        $(if $(CONFIG_LLDPD_WITH_FDP),,--disable-fdp) \
        $(if $(CONFIG_LLDPD_WITH_EDP),,--disable-edp) \
@@ -99,7 +100,7 @@ CONFIGURE_ARGS += \
        $(if $(CONFIG_LLDPD_WITH_DOT1),,--disable-dot1) \
        $(if $(CONFIG_LLDPD_WITH_DOT3),,--disable-dot3) \
        $(if $(CONFIG_LLDPD_WITH_SONMP),,--disable-sonmp) \
-       $(if $(CONFIG_LLDPD_WITH_JSON),--with-json=json-c)
+       $(if $(CONFIG_LLDPD_WITH_JSON),--with-json=json-c,--with-json=no)
 
 
 $(eval $(call BuildPackage,lldpd))
diff --git a/package/network/services/lldpd/patches/001-priv-don-t-lookup-for-_lldpd-when-privsep-is-disable.patch b/package/network/services/lldpd/patches/001-priv-don-t-lookup-for-_lldpd-when-privsep-is-disable.patch
deleted file mode 100644 (file)
index 907c21b..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-From 28bf40220840c277d70ed66f6d58729ebb975de8 Mon Sep 17 00:00:00 2001
-From: Vincent Bernat <vincent@bernat.im>
-Date: Thu, 12 Feb 2015 08:07:43 +0100
-Subject: [PATCH] priv: don't lookup for _lldpd when privsep is disabled
-
-Closes #95
----
- src/daemon/lldpd.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/src/daemon/lldpd.c b/src/daemon/lldpd.c
-index f868fc7..6a3a160 100644
---- a/src/daemon/lldpd.c
-+++ b/src/daemon/lldpd.c
-@@ -1335,11 +1335,13 @@ lldpd_main(int argc, char *argv[], char *envp[])
-       int receiveonly = 0;
-       int ctl;
-+#ifdef ENABLE_PRIVSEP
-       /* Non privileged user */
-       struct passwd *user;
-       struct group *group;
-       uid_t uid;
-       gid_t gid;
-+#endif
-       saved_argv = argv;
-@@ -1493,12 +1495,14 @@ lldpd_main(int argc, char *argv[], char *envp[])
-       log_debug("main", "lldpd starting...");
-       /* Grab uid and gid to use for priv sep */
-+#ifdef ENABLE_PRIVSEP
-       if ((user = getpwnam(PRIVSEP_USER)) == NULL)
-               fatal("main", "no " PRIVSEP_USER " user for privilege separation");
-       uid = user->pw_uid;
-       if ((group = getgrnam(PRIVSEP_GROUP)) == NULL)
-               fatal("main", "no " PRIVSEP_GROUP " group for privilege separation");
-       gid = group->gr_gid;
-+#endif
-       /* Create and setup socket */
-       int retry = 1;
-@@ -1526,12 +1530,14 @@ lldpd_main(int argc, char *argv[], char *envp[])
-               log_warn("main", "unable to create control socket");
-               fatalx("giving up");
-       }
-+#ifdef ENABLE_PRIVSEP
-       if (chown(ctlname, uid, gid) == -1)
-               log_warn("main", "unable to chown control socket");
-       if (chmod(ctlname,
-               S_IRUSR | S_IWUSR | S_IXUSR |
-               S_IRGRP | S_IWGRP | S_IXGRP) == -1)
-               log_warn("main", "unable to chmod control socket");
-+#endif
-       /* Disable SIGPIPE */
-       signal(SIGPIPE, SIG_IGN);
-@@ -1576,7 +1582,11 @@ lldpd_main(int argc, char *argv[], char *envp[])
-       }
-       log_debug("main", "initialize privilege separation");
-+#ifdef ENABLE_PRIVSEP
-       priv_init(PRIVSEP_CHROOT, ctl, uid, gid);
-+#else
-+      priv_init(PRIVSEP_CHROOT, ctl, 0, 0);
-+#endif
-       /* Initialization of global configuration */
-       if ((cfg = (struct lldpd *)
--- 
-2.1.2
-
diff --git a/package/network/services/lldpd/patches/002-no-stack-protector.patch b/package/network/services/lldpd/patches/002-no-stack-protector.patch
deleted file mode 100644 (file)
index e0db485..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -75,8 +75,6 @@ AX_CFLAGS_GCC_OPTION([-Wformat-security]
- AX_CFLAGS_GCC_OPTION([-Wfatal-errors])
- AX_CFLAGS_GCC_OPTION([-Wcast-align])
- AX_CFLAGS_GCC_OPTION([-Winline])
--AX_CFLAGS_GCC_OPTION([-fstack-protector])
--AX_CFLAGS_GCC_OPTION([-fstack-protector-strong])
- AX_CFLAGS_GCC_OPTION([-fno-omit-frame-pointer])
- AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
- AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])
diff --git a/package/network/services/lldpd/patches/100-os-release.patch b/package/network/services/lldpd/patches/100-os-release.patch
new file mode 100644 (file)
index 0000000..a906f39
--- /dev/null
@@ -0,0 +1,39 @@
+Index: lldpd-0.7.15/src/daemon/lldpd.c
+===================================================================
+--- lldpd-0.7.15.orig/src/daemon/lldpd.c
++++ lldpd-0.7.15/src/daemon/lldpd.c
+@@ -736,6 +736,10 @@ lldpd_get_os_release() {
+               fp = fopen("/usr/lib/os-release", "r");
+       }
+       if (!fp) {
++              log_debug("localchassis", "could not open /usr/lib/os-release");
++              fp = fopen("/etc/openwrt_release", "r");
++      }
++      if (!fp) {
+               log_info("localchassis",
+                   "could not open either /etc/os-release or /usr/lib/os-release");
+               return NULL;
+@@ -745,7 +749,8 @@ lldpd_get_os_release() {
+               key = strtok(line, "=");
+               val = strtok(NULL, "=");
+-              if (strncmp(key, "PRETTY_NAME", sizeof(line)) == 0) {
++              if (strncmp(key, "PRETTY_NAME", sizeof(line)) == 0 ||
++                  strncmp(key, "DISTRIB_DESCRIPTION", sizeof(line)) == 0) {
+                       strlcpy(release, val, sizeof(line));
+                       break;
+               }
+@@ -755,11 +760,11 @@ lldpd_get_os_release() {
+       /* Remove trailing newline and all " in the string. */
+       ptr1 = release + strlen(release) - 1;
+       while (ptr1 != release &&
+-          ((*ptr1 == '"') || (*ptr1 == '\n'))) {
++          ((*ptr1 == '"') || (*ptr1 == '\n') || (*ptr1 == '\''))) {
+               *ptr1 = '\0';
+               ptr1--;
+       }
+-      if (release[0] == '"')
++      if (release[0] == '"' || release[0] == '\'')
+               return release+1;
+       return release;
+ }