mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Clemens Gruber <clemens.gruber@pqgruber.com>
To: ptxdist@pengutronix.de
Cc: Michael Olbrich <m.olbrich@pengutronix.de>,
	Clemens Gruber <clemens.gruber@pqgruber.com>
Subject: [ptxdist] [PATCH v2] lldpd: update to 0.7.19 and add systemd support
Date: Sun,  6 Dec 2015 17:54:22 +0100	[thread overview]
Message-ID: <1449420862-6902-1-git-send-email-clemens.gruber@pqgruber.com> (raw)

Bump version to current stable version 0.7.19.
Add options for custom TLV and JSON support.
Add systemd unit and adapt rule file accordingly.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---

This was tested with systemd and busybox init. Several Cisco switches 
were detected correctly via LLDP and CDPv2. (And vice-versa the switches
did also successfully detect the host)

Changes in v2:
- Changed permissions of lldpd.service file from 755 to 644

---
 projectroot/lib/systemd/system/lldpd.service | 13 ++++++++++++
 rules/lldpd.in                               | 18 +++++++++++++++-
 rules/lldpd.make                             | 31 +++++++++++++++++++++++-----
 3 files changed, 56 insertions(+), 6 deletions(-)
 create mode 100644 projectroot/lib/systemd/system/lldpd.service

diff --git a/projectroot/lib/systemd/system/lldpd.service b/projectroot/lib/systemd/system/lldpd.service
new file mode 100644
index 0000000..9b51165
--- /dev/null
+++ b/projectroot/lib/systemd/system/lldpd.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=LLDP daemon
+After=network.target
+RequiresMountsFor=@PRIVSEP_CHROOT@
+
+[Service]
+Type=notify
+NotifyAccess=main
+ExecStart=/usr/sbin/lldpd @DAEMON_ARGS@
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/rules/lldpd.in b/rules/lldpd.in
index c4b4434..e7d3f51 100644
--- a/rules/lldpd.in
+++ b/rules/lldpd.in
@@ -7,6 +7,7 @@ menuconfig LLDPD
 	select LIBEVENT
 	select NET_SNMP if LLDPD_SNMP
 	select NET_SNMP_MIB_MODULES_AGENTX if LLDPD_SNMP
+	select JSON_C if LLDPD_JSON
 	select LIBXML2 if LLDPD_XML
 	select BUSYBOX_START_STOP_DAEMON if LLDPD_STARTSCRIPT
 	select BUSYBOX_FEATURE_START_STOP_DAEMON_LONG_OPTIONS if LLDPD_STARTSCRIPT
@@ -66,14 +67,23 @@ config LLDPD_DOT3
 	prompt "Enable Dot3 extension (PHY stuff)"
 	default y
 
+config LLDPD_CUSTOM_TLV
+	bool
+	prompt "Enable Custom TLV support"
+	default y
+
 config LLDPD_OLDIES
 	bool
-	prompt "Enable compatibility with Linux kernel older than 2.6.18"
+	prompt "Enable compatibility with Linux kernel older than 2.6.32"
 
 config LLDPD_SNMP
 	bool
 	prompt "Enable the use of SNMP"
 
+config LLDPD_JSON
+	bool
+	prompt "Enable JSON output via json-c"
+
 config LLDPD_XML
 	bool
 	prompt "Enable XML output via libxml2"
@@ -83,6 +93,12 @@ config LLDPD_STARTSCRIPT
 	prompt "install /etc/init.d/lldpd"
 	default y
 
+config LLDPD_SYSTEMD_UNIT
+	bool
+	prompt "install systemd service file"
+	default y
+	depends on SYSTEMD
+
 config LLDPD_DAEMON_ARGS
 	string
 	prompt "additional arguments for daemon startup"
diff --git a/rules/lldpd.make b/rules/lldpd.make
index 37ba590..ca3cfc9 100644
--- a/rules/lldpd.make
+++ b/rules/lldpd.make
@@ -1,6 +1,7 @@
 # -*-makefile-*-
 #
 # Copyright (C) 2013 by Alexander Dahl <post@lespocky.de>
+# Copyright (C) 2015 by Clemens Gruber <clemens.gruber@pqgruber.com>
 #
 # See CREDITS for details about who has contributed to this project.
 #
@@ -16,13 +17,13 @@ PACKAGES-$(PTXCONF_LLDPD) += lldpd
 #
 # Paths and names
 #
-LLDPD_VERSION	:= 0.7.6
-LLDPD_MD5		:= dbd90a68b91448dcb94a4a77c5d8ef65
-LLDPD			:= lldpd-$(LLDPD_VERSION)
+LLDPD_VERSION	:= 0.7.19
+LLDPD_MD5	:= 4e924420e00ccd5dc289506f43221820
+LLDPD		:= lldpd-$(LLDPD_VERSION)
 LLDPD_SUFFIX	:= tar.gz
-LLDPD_URL		:= http://media.luffy.cx/files/lldpd//$(LLDPD).$(LLDPD_SUFFIX)
+LLDPD_URL	:= http://media.luffy.cx/files/lldpd//$(LLDPD).$(LLDPD_SUFFIX)
 LLDPD_SOURCE	:= $(SRCDIR)/$(LLDPD).$(LLDPD_SUFFIX)
-LLDPD_DIR		:= $(BUILDDIR)/$(LLDPD)
+LLDPD_DIR	:= $(BUILDDIR)/$(LLDPD)
 LLDPD_LICENSE	:= ISC
 
 # ----------------------------------------------------------------------------
@@ -40,13 +41,21 @@ LLDPD_CONF_OPT	:= $(CROSS_AUTOCONF_USR) \
 	--$(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_CUSTOM_TLV)-custom \
 	--$(call ptx/endis, PTXCONF_LLDPD_OLDIES)-oldies \
 	--$(call ptx/wwo, PTXCONF_LLDPD_SNMP)-snmp \
+	--$(call ptx/wwo, PTXCONF_LLDPD_JSON)-json \
 	--$(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)"
 
+ifdef PTXCONF_LLDPD_SYSTEMD_UNIT
+LLDPD_CONF_OPT += --with-systemdsystemunitdir=/lib/systemd/system
+else
+LLDPD_CONF_OPT += --without-systemdsystemunitdir
+endif
+
 # ----------------------------------------------------------------------------
 # Target-Install
 # ----------------------------------------------------------------------------
@@ -82,6 +91,18 @@ endif
 endif
 endif
 
+ifdef PTXCONF_LLDPD_SYSTEMD_UNIT
+	@$(call install_alternative, lldpd, 0, 0, 0644, /lib/systemd/system/lldpd.service)
+	@$(call install_replace, lldpd, /lib/systemd/system/lldpd.service, \
+		@DAEMON_ARGS@, $(PTXCONF_LLDPD_DAEMON_ARGS))
+	@$(call install_replace, lldpd, /lib/systemd/system/lldpd.service, \
+		@PRIVSEP_CHROOT@, $(PTXCONF_LLDPD_PRIVSEP_CHROOT))
+	@$(call install_link, lldpd, \
+		../lldpd.service, \
+		/lib/systemd/system/multi-user.target.wants/lldpd.service \
+	)
+endif
+
 	@$(call install_finish, lldpd)
 
 	@$(call touch)
-- 
2.6.3


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

                 reply	other threads:[~2015-12-06 16:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1449420862-6902-1-git-send-email-clemens.gruber@pqgruber.com \
    --to=clemens.gruber@pqgruber.com \
    --cc=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