aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-10-10 13:17:14 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-10-10 13:17:14 +0000
commit47ea3c7feeb6d1a97511c4f4e2f663c36e09d3db (patch)
tree847d30496df1f25414a9e97afc1b1ab9f188d80e
parent11549e1b7342c4d64391f3f5f05a1a97828725b0 (diff)
downloadupstream-47ea3c7feeb6d1a97511c4f4e2f663c36e09d3db.tar.gz
upstream-47ea3c7feeb6d1a97511c4f4e2f663c36e09d3db.tar.bz2
upstream-47ea3c7feeb6d1a97511c4f4e2f663c36e09d3db.zip
lldpd: move to trunk and add myself as maintainer
SVN-Revision: 33700
-rw-r--r--package/network/services/lldpd/Makefile56
-rw-r--r--package/network/services/lldpd/files/lldpd.config8
-rw-r--r--package/network/services/lldpd/files/lldpd.init40
-rw-r--r--package/network/services/lldpd/patches/001-no-multiuser.patch40
-rw-r--r--package/network/services/lldpd/patches/002-no-stack-protector.patch10
5 files changed, 154 insertions, 0 deletions
diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile
new file mode 100644
index 0000000000..0e62e35338
--- /dev/null
+++ b/package/network/services/lldpd/Makefile
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2008-2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=lldpd
+PKG_VERSION:=0.6.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://media.luffy.cx/files/lldpd
+PKG_MD5SUM:=77279577e3b6d85a33dc0afe7c960b27
+
+PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lldpd
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=Routing and Redirection
+ TITLE:=Link Layer Discovery Protocol daemon
+ URL:=https://github.com/vincentbernat/lldpd/wiki
+ DEPENDS:=+libevent2
+endef
+
+define Package/lldpd/description
+ LLDP (Link Layer Discovery Protocol) is an industry standard protocol designed
+ to supplant proprietary Link-Layer protocols such as
+ Extreme's EDP (Extreme Discovery Protocol) and
+ CDP (Cisco Discovery Protocol).
+ The goal of LLDP is to provide an inter-vendor compatible mechanism to deliver
+ Link-Layer notifications to adjacent network devices.
+endef
+
+define Package/lldpd/install
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/lldp{ctl,d} $(1)/usr/sbin/
+ $(INSTALL_BIN) ./files/lldpd.init $(1)/etc/init.d/lldpd
+ $(INSTALL_DATA) ./files/lldpd.config $(1)/etc/config/lldpd
+endef
+
+define Package/lldpd/conffiles
+/etc/config/lldpd
+endef
+
+$(eval $(call BuildPackage,lldpd))
diff --git a/package/network/services/lldpd/files/lldpd.config b/package/network/services/lldpd/files/lldpd.config
new file mode 100644
index 0000000000..14ba02fcc4
--- /dev/null
+++ b/package/network/services/lldpd/files/lldpd.config
@@ -0,0 +1,8 @@
+config lldpd config
+ option enable_cdp 1
+ option enable_fdp 1
+ option enable_sonmp 1
+ option enable_edp 1
+
+ option lldp_class 4
+ option lldp_location "2:FR:6:Commercial Rd:3:Roseville:19:4"
diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init
new file mode 100644
index 0000000000..5d34283883
--- /dev/null
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -0,0 +1,40 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2012 OpenWrt.org
+
+START=90
+
+SERVICE_USE_PID=1
+
+start() {
+ local enable_cdp
+ local enable_fdp
+ local enable_sonmp
+ local enable_edp
+ local lldp_class
+ local lldp_location
+
+ config_load 'lldpd'
+ config_get_bool enable_cdp 'config' 'enable_cdp' 0
+ config_get_bool enable_fdp 'config' 'enable_fdp' 0
+ config_get_bool enable_sonmp 'config' 'enable_sonmp' 0
+ config_get_bool enable_edp 'config' 'enable_edp' 0
+ config_get lldp_class 'config' 'lldp_class'
+ config_get lldp_location 'config' 'lldp_location'
+
+ [ $enable_cdp -gt 0 ] && append args '-c'
+ [ $enable_fdp -gt 0 ] && append args '-f'
+ [ $enable_sonmp -gt 0 ] && append args '-s'
+ [ $enable_edp -gt 0 ] && append args '-e'
+
+ service_start /usr/sbin/lldpd $args \
+ ${lldp_class:+ -M $lldp_class}
+
+ [ -n "$lldp_location" ] && {
+ sleep 1
+ /usr/sbin/lldpctl -L "$lldp_location" > /dev/null 2>&1
+ }
+}
+
+stop() {
+ service_stop /usr/sbin/lldpd
+}
diff --git a/package/network/services/lldpd/patches/001-no-multiuser.patch b/package/network/services/lldpd/patches/001-no-multiuser.patch
new file mode 100644
index 0000000000..5f216c4289
--- /dev/null
+++ b/package/network/services/lldpd/patches/001-no-multiuser.patch
@@ -0,0 +1,40 @@
+--- a/src/priv.c
++++ b/src/priv.c
+@@ -518,12 +518,14 @@ priv_init(char *chrootdir)
+ fatal("[priv]: unable to create socket pair for privilege separation");
+
+ /* Get users */
++ /*
+ if ((user = getpwnam(PRIVSEP_USER)) == NULL)
+ fatal("[priv]: no " PRIVSEP_USER " user for privilege separation");
+ uid = user->pw_uid;
+ if ((group = getgrnam(PRIVSEP_GROUP)) == NULL)
+ fatal("[priv]: no " PRIVSEP_GROUP " group for privilege separation");
+ gid = group->gr_gid;
++ */
+
+ /* Spawn off monitor */
+ if ((monitored = fork()) < 0)
+@@ -534,17 +536,17 @@ priv_init(char *chrootdir)
+ if (RUNNING_ON_VALGRIND)
+ LLOG_WARNX("[priv]: running on valgrind, keep privileges");
+ else {
+- if (chroot(chrootdir) == -1)
+- fatal("[priv]: unable to chroot");
+- if (chdir("/") != 0)
++ /*if (chroot(chrootdir) == -1)
++ fatal("[priv]: unable to chroot");*/
++ if (chdir("/tmp") != 0)
+ fatal("[priv]: unable to chdir");
+ gidset[0] = gid;
+- if (setresgid(gid, gid, gid) == -1)
++ /*if (setresgid(gid, gid, gid) == -1)
+ fatal("[priv]: setresgid() failed");
+ if (setgroups(1, gidset) == -1)
+ fatal("[priv]: setgroups() failed");
+ if (setresuid(uid, uid, uid) == -1)
+- fatal("[priv]: setresuid() failed");
++ fatal("[priv]: setresuid() failed");*/
+ }
+ remote = pair[0];
+ close(pair[1]);
diff --git a/package/network/services/lldpd/patches/002-no-stack-protector.patch b/package/network/services/lldpd/patches/002-no-stack-protector.patch
new file mode 100644
index 0000000000..0a0c6fbb69
--- /dev/null
+++ b/package/network/services/lldpd/patches/002-no-stack-protector.patch
@@ -0,0 +1,10 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -48,7 +48,6 @@ AX_CFLAGS_GCC_OPTION([-Wformat])
+ AX_CFLAGS_GCC_OPTION([-Wformat-security])
+ AX_CFLAGS_GCC_OPTION([-Wcast-align])
+ AX_CFLAGS_GCC_OPTION([-Winline])
+-AX_CFLAGS_GCC_OPTION([-fstack-protector])
+ AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
+ AX_CFLAGS_GCC_OPTION([-Wdeclaration-after-statement])
+ AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])