aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berton <fabio.berton@ossystems.com.br>2015-09-18 14:23:35 -0300
committerJoe MacDonald <joe_macdonald@mentor.com>2015-10-21 15:57:26 -0400
commit0289eac721085563ff727515022e8c61b2ecf30d (patch)
tree2c9745482d515b75c4ca2a1ef755aa4671a74a86
parent395519075d3b713f13e8b695b3783c9ca5c7f821 (diff)
downloadmeta-openembedded-0289eac721085563ff727515022e8c61b2ecf30d.tar.gz
lldpd: Add recipe
lldpd is a 802.1AB implementation, a L2 network discovery protocol. It also supports CDP, EDP and various other protocols. Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
-rw-r--r--meta-networking/recipes-daemons/lldpd/files/fix-libevent-configure.patch39
-rw-r--r--meta-networking/recipes-daemons/lldpd/files/lldpd.default2
-rw-r--r--meta-networking/recipes-daemons/lldpd/files/lldpd.init.d128
-rw-r--r--meta-networking/recipes-daemons/lldpd/lldpd_0.7.17.bb68
4 files changed, 237 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/lldpd/files/fix-libevent-configure.patch b/meta-networking/recipes-daemons/lldpd/files/fix-libevent-configure.patch
new file mode 100644
index 0000000000..42d6b290ae
--- /dev/null
+++ b/meta-networking/recipes-daemons/lldpd/files/fix-libevent-configure.patch
@@ -0,0 +1,39 @@
+Upstream-Status: Submitted [https://github.com/vincentbernat/lldpd/issues/133]
+
+Subject: [PATCH] fix libevent configure
+
+Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
+---
+ m4/libevent.m4 | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/m4/libevent.m4 b/m4/libevent.m4
+index 275e5a5..dcd3309 100644
+--- a/m4/libevent.m4
++++ b/m4/libevent.m4
+@@ -45,13 +45,11 @@ AC_DEFUN([lldp_CHECK_LIBEVENT], [
+ AC_MSG_ERROR([*** libevent not found])
+ fi
+ ])
+- fi
+
+ if test x"$LIBEVENT_EMBEDDED" != x; then
+ unset LIBEVENT_LIBS
+ LIBEVENT_CFLAGS="-I\$(top_srcdir)/libevent/include -I\$(top_builddir)/libevent/include"
+ LIBEVENT_LDFLAGS="\$(top_builddir)/libevent/libevent.la"
+- fi
+
+ # Call ./configure in libevent. Need it for make dist...
+ libevent_configure_args="$libevent_configure_args --disable-libevent-regress"
+@@ -64,6 +62,8 @@ AC_DEFUN([lldp_CHECK_LIBEVENT], [
+ libevent_configure_args="$libevent_configure_args --with-pic"
+ libevent_configure_args="$libevent_configure_args --enable-static"
+ lldp_CONFIG_SUBDIRS([libevent], [$libevent_configure_args])
++ fi
++ fi
+
+ AM_CONDITIONAL([LIBEVENT_EMBEDDED], [test x"$LIBEVENT_EMBEDDED" != x])
+ AC_SUBST([LIBEVENT_LIBS])
+--
+2.1.4
+
diff --git a/meta-networking/recipes-daemons/lldpd/files/lldpd.default b/meta-networking/recipes-daemons/lldpd/files/lldpd.default
new file mode 100644
index 0000000000..3acacfd90b
--- /dev/null
+++ b/meta-networking/recipes-daemons/lldpd/files/lldpd.default
@@ -0,0 +1,2 @@
+# Uncomment to start SNMP subagent and enable CDP, SONMP and EDP protocol
+#DAEMON_ARGS="-x -c -s -e"
diff --git a/meta-networking/recipes-daemons/lldpd/files/lldpd.init.d b/meta-networking/recipes-daemons/lldpd/files/lldpd.init.d
new file mode 100644
index 0000000000..88bf958989
--- /dev/null
+++ b/meta-networking/recipes-daemons/lldpd/files/lldpd.init.d
@@ -0,0 +1,128 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: lldpd
+# Required-Start: $remote_fs $network $syslog
+# Required-Stop: $network $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: LLDP daemon
+# Description: lldpd is a 802.1AB implementation, a L2 network
+# discovery protocol. It also supports CDP, EDP and
+# various other protocols.
+### END INIT INFO
+
+# Do NOT "set -e"
+
+log_daemon_msg() {
+ echo $*
+}
+
+log_end_msg() {
+ if [ $1 -eq 0 ]; then
+ success $*
+ else
+ failure $*
+ fi
+}
+
+log_failure_msg() {
+ echo $*
+}
+
+log_success_msg() {
+ echo $*
+}
+
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="LLDP daemon"
+NAME=lldpd
+DAEMON=/usr/sbin/$NAME
+DAEMON_ARGS=""
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+CHROOT=/var/run/$NAME
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# LSB log_* functions
+. /etc/init.d/functions
+
+do_start()
+{
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+ $DAEMON_ARGS \
+ || return 2
+}
+
+do_stop()
+{
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+ [ "$?" = 2 ] && return 2
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+do_reload() {
+ start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+ return 0
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ reload)
+ log_daemon_msg "Reloading $DESC" "$NAME"
+ do_reload
+ log_end_msg $?
+ ;;
+ restart|force-reload)
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ status)
+ status_of_proc $DAEMON $NAME -p $PIDFILE && exit 0 || exit $?
+ ;;
+ *)
+ echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/meta-networking/recipes-daemons/lldpd/lldpd_0.7.17.bb b/meta-networking/recipes-daemons/lldpd/lldpd_0.7.17.bb
new file mode 100644
index 0000000000..47d3c38ed0
--- /dev/null
+++ b/meta-networking/recipes-daemons/lldpd/lldpd_0.7.17.bb
@@ -0,0 +1,68 @@
+SUMMARY = "A 802.1ab implementation (LLDP) to help you locate neighbors of all your equipments"
+SECTION = "net/misc"
+LICENSE = "ISC"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/ISC;md5=f3b90e78ea0cffb20bf5cca7947a896d"
+
+DEPENDS = "libbsd libevent"
+
+SRC_URI = "\
+ http://media.luffy.cx/files/${PN}/${PN}-${PV}.tar.gz \
+ file://lldpd.init.d \
+ file://lldpd.default \
+ file://fix-libevent-configure.patch \
+ "
+
+SRC_URI[md5sum] = "8cb74065956bc32a575ee5203b0e0fb5"
+SRC_URI[sha256sum] = "6b50b8aa47d1424a93ba3df55af26da41f7d5718db8d25e99291c4a6cd09c20e"
+
+inherit autotools update-rc.d useradd systemd pkgconfig
+
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM_${PN} = "--system -g lldpd --shell /bin/false lldpd"
+GROUPADD_PARAM_${PN} = "--system lldpd"
+
+EXTRA_OECONF += "--without-embedded-libevent \
+ --disable-oldies \
+ --with-privsep-user=lldpd \
+ --with-privsep-group=lldpd"
+
+PACKAGECONFIG ??= "cdp fdp edp sonmp lldpmed dot1 dot3"
+PACKAGECONFIG[json] = "--with-json,--without-json,jansson"
+PACKAGECONFIG[xml] = "--with-xml,--without-xml,libxm2"
+PACKAGECONFIG[snmp] = "--with-snmp,--without-snmp,net-snmp"
+PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
+PACKAGECONFIG[seccomp] = "--with-seccomp,--without-seccomp,libseccomp"
+PACKAGECONFIG[cdp] = "--enable-cdp,--disable-cdp"
+PACKAGECONFIG[fdp] = "--enable-fdp,--disable-fdp"
+PACKAGECONFIG[edp] = "--enable-edp,--disable-edp"
+PACKAGECONFIG[sonmp] = "--enable-sonmp,--disable-sonmp"
+PACKAGECONFIG[lldpmed] = "--enable-lldpmed,--disable-lldpmed"
+PACKAGECONFIG[dot1] = "--enable-dot1,--disable-dot1"
+PACKAGECONFIG[dot3] = "--enable-dot3,--disable-dot3"
+PACKAGECONFIG[custom] = "--enable-custom,--disable-custom"
+
+INITSCRIPT_NAME = "lldpd"
+INITSCRIPT_PARAMS = "defaults"
+
+SYSTEMD_SERVICE_${PN} = "lldpd.service"
+
+do_install_append() {
+ install -Dm 0755 ${WORKDIR}/lldpd.init.d ${D}${sysconfdir}/init.d/lldpd
+ install -Dm 0644 ${WORKDIR}/lldpd.default ${D}${sysconfdir}/default/lldpd
+ # Make an empty configuration file
+ touch ${D}${sysconfdir}/lldpd.conf
+}
+
+PACKAGES =+ "${PN}-bash-completion ${PN}-zsh-completion"
+
+FILES_${PN} += "${libdir}/sysusers.d"
+RDEPENDS_${PN} += "os-release"
+
+FILES_${PN}-bash-completion += "${sysconfdir}/bash_completion.d/ \
+ ${datadir}/bash-completion/ \
+ "
+RDEPENDS_${PN}-bash-completion += "bash"
+
+FILES_${PN}-zsh-completion += "${datadir}/zsh/"
+# FIXME: zsh is broken in meta-oe so this cannot be enabled for now
+#RDEPENDS_${PN}-zsh-completion += "zsh"