From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] [lldpd] add package
Date: Mon, 9 Sep 2013 11:49:51 +0200 [thread overview]
Message-ID: <20130909094951.GF31967@pengutronix.de> (raw)
In-Reply-To: <1378388934-7790-1-git-send-email-post@lespocky.de>
On Thu, Sep 05, 2013 at 03:48:54PM +0200, Alexander Dahl wrote:
> This adds a package lldpd implementing 802.1ab aka LLDP protocol. It's
> the daemon written by Vincent Bernat licensed under ISC license from
> http://vincentbernat.github.io/lldpd/
>
> The init script is inspired by the one in Debian Wheezy and adapted
> for busybox. It uses mkdir, seq, sleep, echo, rm and cat from busybox
> so maybe those should be added as dependency.
This fail to compile here:
[...]
checking for snmp_register_callback in -lnetsnmp... yes
checking for netsnmp_enable_subagent... no
configure: error: *** no subagent support in net-snmp
make: *** [..../state/lldpd.prepare] Error 1
[...]
Any idea what might go wrong here?
> Signed-off-by: Alexander Dahl <post@lespocky.de>
> ---
> generic/etc/init.d/lldpd | 139 ++++++++++++++++++++++++++++++++++++++++++++++
> rules/lldpd-bbinit.in | 9 +++
> rules/lldpd.in | 97 ++++++++++++++++++++++++++++++++
> rules/lldpd.make | 89 +++++++++++++++++++++++++++++
> 4 files changed, 334 insertions(+)
> create mode 100644 generic/etc/init.d/lldpd
> create mode 100644 rules/lldpd-bbinit.in
> create mode 100644 rules/lldpd.in
> create mode 100644 rules/lldpd.make
>
> diff --git a/generic/etc/init.d/lldpd b/generic/etc/init.d/lldpd
> new file mode 100644
> index 0000000..8fd0d28
> --- /dev/null
> +++ b/generic/etc/init.d/lldpd
> @@ -0,0 +1,139 @@
> +#!/bin/sh
> +
> +PATH=/sbin:/usr/sbin:/bin:/usr/bin
> +DESC="LLDP daemon"
> +NAME=lldpd
> +DAEMON=/usr/sbin/$NAME
> +DAEMON_ARGS="@DAEMON_ARGS@"
> +PIDFILE=/var/run/$NAME.pid
> +SCRIPTNAME=/etc/init.d/$NAME
> +CHROOT=@PRIVSEP_CHROOT@
> +
> +# exit if binary is missing
> +[ -x "$DAEMON" ] || exit 0
> +
> +# read further config if present
> +[ -r /etc/default/$NAME ] && . /etc/default/$NAME
> +
> +is_running() {
> + start-stop-daemon -K --quiet --test --exec $DAEMON --pidfile $PIDFILE
> +}
> +
> +do_chroot() {
> + oldumask=$(umask)
> + umask 022
> + [ -d $CHROOT/etc ] || mkdir -p $CHROOT/etc
> + [ -f $CHROOT/etc/localtime ] || [ ! -f /etc/localtime ] || \
> + cp /etc/localtime $CHROOT/etc/localtime
> + umask $oldumask
> +}
> +
> +do_start() {
> + do_chroot
> + is_running && return 1
> + start-stop-daemon -S --quiet --pidfile $PIDFILE --exec $DAEMON -- \
> + $DAEMON_ARGS \
> + || return 2
> +}
> +
> +do_stop() {
> + is_running || return 0
> + start-stop-daemon -K --quiet --pidfile $PIDFILE --name $NAME
> + RETVAL="$?"
> +
> + # wait up to 30 seconds until daemon stopped
> + for i in $(seq 30)
> + do
> + sleep 1
> + echo -n '.'
> + if ! is_running
> + then
> + break
> + fi
> + done
> +
> + # see if it's still running
> + if is_running
> + then
> + start-stop-daemon -K --quiet --signal KILL --pidfile $PIDFILE --name $NAME
> +
> + for i in $(seq 5)
> + do
> + sleep 1
> + echo -n '.'
> + if ! is_running
> + then
> + break
> + fi
> + done
> +
> + if is_running
> + then
> + return 2
> + fi
> + fi
> +
> + rm -f $PIDFILE
> + return "$RETVAL"
> +}
> +
> +do_reload() {
> + # send SIGHUP
> + start-stop-daemon -K --signal 1 --quiet --pidfile $PIDFILE --name $NAME
> + return 0
> +}
> +
> +case "$1" in
> + start)
> + echo -n "Starting $DESC ..."
> + do_start
> + case "$?" in
> + 0|1) echo " Done." ;;
> + 2) echo " Failed." ;;
> + esac
> + ;;
> + stop)
> + echo -n "Stopping $DESC ."
> + do_stop
> + case "$?" in
> + 0|1) echo " Done." ;;
> + 2) echo " Failed." ;;
> + esac
> + ;;
> + reload)
> + echo -n "Reloading $DESC ..."
> + do_reload
> + echo " Done."
> + ;;
> + restart|force-reload)
> + echo -n "Restarting $DESC .."
> + do_stop
> + case "$?" in
> + 0|1)
> + do_start
> + case "$?" in
> + 0) echo " Done." ;;
> + 1) echo " Failed." ;; # Old process still running
> + *) echo " Failed." ;; # Failed to start
> + esac
> + ;;
> + *)
> + echo " Failed." # Failed to stop
> + ;;
> + esac
> + ;;
> + status)
> + if is_running
> + then
> + echo "$NAME is running with PID $(cat $PIDFILE) ..."
> + else
> + echo "$NAME is not running"
> + fi
> + ;;
> + *)
> + echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2
> + exit 3
> + ;;
> +esac
> +
> +:
> diff --git a/rules/lldpd-bbinit.in b/rules/lldpd-bbinit.in
> new file mode 100644
> index 0000000..103452a
> --- /dev/null
> +++ b/rules/lldpd-bbinit.in
> @@ -0,0 +1,9 @@
> +## SECTION=initmethod_bbinit
> +
> +config LLDPD_BBINIT_LINK
> + string
> + depends on LLDPD_STARTSCRIPT
> + prompt "lldpd"
> + default "S28lldpd"
> +
> +# vim: ft=kconfig noet tw=72
> diff --git a/rules/lldpd.in b/rules/lldpd.in
> new file mode 100644
> index 0000000..7d19712
> --- /dev/null
> +++ b/rules/lldpd.in
> @@ -0,0 +1,97 @@
> +## SECTION=networking
> +
> +menuconfig LLDPD
> + tristate
> + prompt "lldpd "
> + select INITMETHOD
> + select LIBEVENT
> + select NET_SNMP if LLDPD_SNMP
> + select LIBXML2 if LLDPD_XML
> + select BUSYBOX_START_STOP_DAEMON if LLDPD_STARTSCRIPT
> + select BUSYBOX_FEATURE_START_STOP_DAEMON_LONG_OPTIONS if LLDPD_STARTSCRIPT
> + help
> + lldpd is an ISC-licensed implementation of LLDP for various
> + Unixes. It also supports some proprietary protocols.
> +
> +if LLDPD
> +
> +config LLDPD_PRIVSEP_USER
> + string
> + prompt "Which user to use for privilege separation"
> + default "_lldpd"
this seems to be a strange user. Why with '_'?
> +
> +config LLDPD_PRIVSEP_GROUP
> + string
> + prompt "Which group to use for privilege separation"
> + default "_lldpd"
> +
> +config LLDPD_PRIVSEP_CHROOT
> + string
> + prompt "Which directory to use to chroot lldpd"
> + default "/var/run/lldpd"
> +
> +config LLDPD_CDP
> + bool
> + prompt "Enable Cisco Discovery Protocol"
> + default y
> +
> +config LLDPD_FDP
> + bool
> + prompt "Enable Foundry Discovery Protocol"
> + default y
> +
> +config LLDPD_EDP
> + bool
> + prompt "Enable Extreme Discovery Protocol"
> + default y
> +
> +config LLDPD_SONMP
> + bool
> + prompt "Enable SynOptics Network Management Protocol"
> + default y
> +
> +config LLDPD_LLDPMED
> + bool
> + prompt "Enable LLDP-MED extension"
> + default y
> +
> +config LLDPD_DOT1
> + bool
> + prompt "Enable Dot1 extension (VLAN stuff)"
> + default y
> +
> +config LLDPD_DOT3
> + bool
> + prompt "Enable Dot3 extension (PHY stuff)"
> + default y
> +
> +config LLDPD_OLDIES
> + bool
> + prompt "Enable compatibility with Linux kernel older than 2.6.18"
> + default n
no "default n" needed. Thats the default anyways.
> +
> +config LLDPD_SNMP
> + bool
> + prompt "Enable the use of SNMP"
> + default n
> +
> +config LLDPD_XML
> + bool
> + prompt "Enable XML output via libxml2"
> + default n
> +
> +config LLDPD_STARTSCRIPT
> + bool
> + prompt "install /etc/init.d/lldpd"
> + default y
> +
> +config LLDPD_DAEMON_ARGS
> + string
> + prompt "additional arguments for daemon startup"
> + default ""
> + help
> + This could be -c -e -f -s …
> +
> +endif
> +
> +# vim: ft=kconfig noet tw=72
> diff --git a/rules/lldpd.make b/rules/lldpd.make
> new file mode 100644
> index 0000000..a999100
> --- /dev/null
> +++ b/rules/lldpd.make
> @@ -0,0 +1,89 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2013 by Alexander Dahl <post@lespocky.de>
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_LLDPD) += lldpd
> +
> +#
> +# Paths and names
> +#
> +LLDPD_VERSION := 0.7.6
> +LLDPD_MD5 := dbd90a68b91448dcb94a4a77c5d8ef65
> +LLDPD := lldpd-$(LLDPD_VERSION)
> +LLDPD_SUFFIX := tar.gz
> +LLDPD_URL := http://media.luffy.cx/files/lldpd//$(LLDPD).$(LLDPD_SUFFIX)
> +LLDPD_SOURCE := $(SRCDIR)/$(LLDPD).$(LLDPD_SUFFIX)
> +LLDPD_DIR := $(BUILDDIR)/$(LLDPD)
> +LLDPD_LICENSE := ICS
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +LLDPD_CONF_TOOL := autoconf
> +LLDPD_CONF_OPT := $(CROSS_AUTOCONF_USR) \
> + --disable-doxygen-doc \
> + --without-embedded-libevent \
> + --$(call ptx/endis, PTXCONF_LLDPD_CDP)-cdp \
> + --$(call ptx/endis, PTXCONF_LLDPD_FDP)-fdp \
> + --$(call ptx/endis, PTXCONF_LLDPD_EDP)-edp \
> + --$(call ptx/endis, PTXCONF_LLDPD_SONMP)-sonmp \
> + --$(call ptx/endis, PTXCONF_LLDPD_LLDPMED)-lldpmed \
> + --$(call ptx/endis, PTXCONF_LLDPD_DOT1)-dot1 \
> + --$(call ptx/endis, PTXCONF_LLDPD_DOT3)-dot3 \
> + --$(call ptx/endis, PTXCONF_LLDPD_OLDIES)-oldies \
> + --$(call ptx/wwo, PTXCONF_LLDPD_SNMP)-snmp \
> + --$(call ptx/wwo, PTXCONF_LLDPD_XML)-xml \
> + --with-privsep-user="$(PTXCONF_LLDPD_PRIVSEP_USER)" \
> + --with-privsep-group="$(PTXCONF_LLDPD_PRIVSEP_GROUP)" \
> + --with-privsep-chroot="$(PTXCONF_LLDPD_PRIVSEP_CHROOT)"
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/lldpd.targetinstall:
> + @$(call targetinfo)
> +
> + @$(call install_init, lldpd)
> + @$(call install_fixup, lldpd,PRIORITY,optional)
> + @$(call install_fixup, lldpd,SECTION,base)
> + @$(call install_fixup, lldpd,AUTHOR,"Alexander Dahl <post@lespocky.de>")
> + @$(call install_fixup, lldpd,DESCRIPTION,missing)
> +
> + @$(call install_copy, lldpd, 0, 0, 0755, -, /usr/sbin/lldpd)
> + @$(call install_copy, lldpd, $(PTXCONF_LLDPD_PRIVSEP_USER), \
> + $(PTXCONF_LLDPD_PRIVSEP_GROUP), 4750, -, /usr/sbin/lldpcli)
> + @$(call install_link, lldpd, lldpcli, /usr/sbin/lldpctl)
> +
> + @$(call install_lib, lldpd, 0, 0, 0644, liblldpctl)
> +
> +ifdef PTXCONF_INITMETHOD_BBINIT
> +ifdef PTXCONF_LLDPD_STARTSCRIPT
> + @$(call install_alternative, lldpd, 0, 0, 0755, /etc/init.d/lldpd)
> + @$(call install_replace, lldpd, /etc/init.d/lldpd, \
> + @DAEMON_ARGS@, $(PTXCONF_LLDPD_DAEMON_ARGS))
> + @$(call install_replace, lldpd, /etc/init.d/lldpd, \
> + @PRIVSEP_CHROOT@, $(PTXCONF_LLDPD_PRIVSEP_CHROOT))
> +
> +ifneq ($(call remove_quotes,$(PTXCONF_LLDPD_BBINIT_LINK)),)
> + @$(call install_link, lldpd, ../init.d/lldpd, \
> + /etc/rc.d/$(PTXCONF_LLDPD_BBINIT_LINK))
> +endif
> +endif
> +endif
> +
> + @$(call install_finish, lldpd)
> +
> + @$(call touch)
> +
> +# vim: ft=make noet
> --
> 1.7.10.4
>
>
> --
> ptxdist mailing list
> ptxdist@pengutronix.de
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
--
ptxdist mailing list
ptxdist@pengutronix.de
next prev parent reply other threads:[~2013-09-09 9:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-05 13:48 Alexander Dahl
2013-09-09 9:49 ` Michael Olbrich [this message]
2013-09-09 10:43 ` Alexander Dahl
2013-09-09 14:45 ` Michael Olbrich
2013-09-09 15:20 ` [ptxdist] [PATCH] lldpd: " Alexander Dahl
2013-09-09 16:01 ` Michael Olbrich
2013-09-27 14:37 ` Alexander Dahl
2013-09-11 13:16 ` [ptxdist] [PATCH] [lldpd] " Alexander Dahl
2013-09-16 8:21 ` Michael Olbrich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130909094951.GF31967@pengutronix.de \
--to=m.olbrich@pengutronix.de \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox