Commit 9bc9dd16 authored by Michal Wasiak's avatar Michal Wasiak Committed by Kinga Wujek

[issue #28] make LLDP to work with VLANs

RX LLDP frames worked without any change.
Signed-off-by: 's avatarMichal Wasiak <michal.wasiak@gmail.com>
parent 18f6008c
This diff is collapsed.
......@@ -1528,6 +1528,17 @@ appropriate way, before the respective service is started.
For details please refer to the @ref{VLANs Configuration}
@item CONFIG_VLANS_PORT@i{xx}_LLDP_TX_VID
@itemx CONFIG_VLANS_PORT@i{xx}_LLDP_TX_PRIO
Notify lldpd which VLAN shall it use for sending LLDP frames.
Incoming LLDP frames are accepted on all VLANs.
This parameter is available for @t{MODE_TRUNK}, @t{MODE_DISABLED} and
@t{MODE_UNQUALIFIED} modes.
The range of a valid VID is from 0 to 4094.
@t{VLANS_PORTxx_LLDP_TX_PRIO} defines the priority to be inserted into
a VLAN tag of LLDP frames sent by lldpd.
@item CONFIG_VLANS_RAW_PORT_CONFIG
Expert mode. Allow to control all VLAN parameters (CONFIG_VLANS_PORT@i{xx}_PTP_VID,
......
From c9c24e10805d5aaef085940f732f74b214567517 Mon Sep 17 00:00:00 2001
From: Michal Wasiak <michal.wasiak@gmail.com>
Date: Sun, 12 Jul 2020 22:58:42 +0200
Subject: [PATCH 1/3] Uplift lldpd to 1.0.5
Signed-off-by: Michal Wasiak <michal.wasiak@gmail.com>
---
...generation-of-atom-glue-compatible-with-o.patch | 43 ---------------
.../0002-configure-do-not-check-for-libbsd.patch | 61 ----------------------
package/lldpd/lldpd.hash | 7 ++-
package/lldpd/lldpd.mk | 52 +++++++++++-------
4 files changed, 38 insertions(+), 125 deletions(-)
delete mode 100644 package/lldpd/0001-build-make-generation-of-atom-glue-compatible-with-o.patch
delete mode 100644 package/lldpd/0002-configure-do-not-check-for-libbsd.patch
diff --git a/package/lldpd/0001-build-make-generation-of-atom-glue-compatible-with-o.patch b/package/lldpd/0001-build-make-generation-of-atom-glue-compatible-with-o.patch
deleted file mode 100644
index d5675d3..0000000
--- a/package/lldpd/0001-build-make-generation-of-atom-glue-compatible-with-o.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 106aa50d4e5b336f7dd2d5cf4d882e692d205e91 Mon Sep 17 00:00:00 2001
-From: Vincent Bernat <vincent@bernat.im>
-Date: Sat, 18 Jun 2016 22:18:41 +0200
-Subject: [PATCH] build: make generation of atom-glue compatible with older gcc
- versions
-
-With old versions, cpp doesn't accept several files as input. See #186.
-
-Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
----
- src/lib/Makefile.am | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
-index 250e32a..2a5cdb3 100644
---- a/src/lib/Makefile.am
-+++ b/src/lib/Makefile.am
-@@ -20,8 +20,9 @@ nodist_liblldpctl_la_SOURCES = atom-glue.c
- liblldpctl_la_LIBADD = $(top_builddir)/src/libcommon-daemon-lib.la libfixedpoint.la
-
- atom-glue.c: $(ATOM_FILES) Makefile
-- $(AM_V_GEN)($(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(ATOM_FILES:%=$(srcdir)/%) | \
-+ $(AM_V_GEN)(for f in $(ATOM_FILES:%=$(srcdir)/%); do \
-+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $$f; done | \
- $(SED) -n 's+^void init_atom_builder_\([^(]*\)().*, \([0-9]*\)).*+\2 \1+p' | \
- sort | \
- $(AWK) '{ atoms[$$2] = 1 } \
-@@ -30,8 +31,9 @@ atom-glue.c: $(ATOM_FILES) Makefile
- print " static int init = 0; if (init) return; init++;"; \
- for (atom in atoms) { print " init_atom_builder_"atom"();" } \
- print "}"; }' && \
-+ for f in $(ATOM_FILES:%=$(srcdir)/%); do \
- $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(ATOM_FILES:%=$(srcdir)/%) | \
-+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $$f; done | \
- $(SED) -n 's+^void init_atom_map_\([^(]*\)().*, \([0-9]*\)).*+\2 \1+p' | \
- sort -n | \
- $(AWK) '{ atoms[$$2] = 1 } \
---
-2.9.0
-
diff --git a/package/lldpd/0002-configure-do-not-check-for-libbsd.patch b/package/lldpd/0002-configure-do-not-check-for-libbsd.patch
deleted file mode 100644
index 4d63274..0000000
--- a/package/lldpd/0002-configure-do-not-check-for-libbsd.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 0801a066cd4a24a858ddfa7c62c7802e0f5533a8 Mon Sep 17 00:00:00 2001
-From: "Yann E. MORIN" <yann.morin.1998@free.fr>
-Date: Sun, 14 Aug 2016 12:15:17 +0200
-Subject: [PATCH] configure: do not check for libbsd
-
-libbsd causes build issues because its libbsd-overlay.pc file is borked:
-it contains -isystem in CFLAGS, which is not munged by pkgconf, so we
-end up using the headers of the build machine, causing all sorts of
-hard-to-debug trouble at build time.
-
-lldpd uses libbsd-overlay for a few helper functions, but has fallbacks
-in case it is not available. The only feature that is lost when not using
-it is that the neighbour name is no longer displayed in /proc/self/cmdline.
-As the author of lldpd said on IRC: "people should survive! ;-)"
-
-So we just remove the detection of libbsd altogether.
-
-Fixes:
- http://autobuild.buildroot.org/results/6b7/6b70fa379e834ec71cc260ba6af771b531ca3511/
- http://autobuild.buildroot.org/results/769/769074c4bb67336ae6679f2c1cd2a8220d2bec24/
- http://autobuild.buildroot.org/results/c8a/c8a6001f437701ecc75f6c9252935645bda8a8c8/
- [...]
-
-Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
----
- configure.ac | 19 -------------------
- 1 file changed, 19 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index dd723b0..45498ce 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -165,25 +165,6 @@ AC_FUNC_MALLOC
- AC_FUNC_REALLOC
- AC_FUNC_FORK
-
--# Some functions can be in libbsd
--PKG_CHECK_MODULES([libbsd], [libbsd-overlay], [
-- _save_CFLAGS="$CFLAGS"
-- _save_LIBS="$LIBS"
-- CFLAGS="$CFLAGS $libbsd_CFLAGS"
-- LIBS="$LIBS $libbsd_LIBS"
-- AC_MSG_CHECKING([if libbsd can be linked correctly])
-- AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
-- [
-- AC_MSG_RESULT(yes)
-- LLDP_CFLAGS="$LLDP_CFLAGS $libbsd_CFLAGS"
-- LLDP_LDFLAGS="$LLDP_LDFLAGS $libbsd_LIBS"
-- ],[
-- AC_MSG_RESULT(no)
-- CFLAGS="$_save_CFLAGS"
-- LIBS="$_save_LIBS"
-- ])
--], [:])
--
- # setproctitle may have an _init function
- AC_REPLACE_FUNCS([setproctitle])
- AC_CHECK_FUNCS([setproctitle_init])
---
-2.7.4
-
diff --git a/package/lldpd/lldpd.hash b/package/lldpd/lldpd.hash
index fc3d21f..4283b4a 100644
--- a/package/lldpd/lldpd.hash
+++ b/package/lldpd/lldpd.hash
@@ -1,2 +1,5 @@
-# Locally computed
-sha256 eb1f5beff2ff5c13c5e0342b5b9da815ed4a63866262445e1168a79ee65c9079 lldpd-0.9.4.tar.gz
+# Locally computed after checking gpg key
+# https://media.luffy.cx/files/lldpd/lldpd-1.0.5.tar.gz.gpg
+# using key AEF2348766F371C689A7360095A42FE8353525F9
+sha256 2dd3b212f4dbabfcbb2794c0010b245f9f8e74b387984e757be6243a74c6cb99 lldpd-1.0.5.tar.gz
+sha256 0e96a5aea65f16e2239231ce4ab90497f8bc3bb8fe6abe9299aade4726ff7c8d LICENSE
diff --git a/package/lldpd/lldpd.mk b/package/lldpd/lldpd.mk
index af941cd..585d1ed 100644
--- a/package/lldpd/lldpd.mk
+++ b/package/lldpd/lldpd.mk
@@ -4,21 +4,16 @@
#
################################################################################
-LLDPD_VERSION = 0.9.4
-LLDPD_SITE = http://media.luffy.cx/files/lldpd
-LLDPD_DEPENDENCIES = host-pkgconf libevent netsnmp
+LLDPD_VERSION = 1.0.5
+LLDPD_SITE = https://media.luffy.cx/files/lldpd
+LLDPD_DEPENDENCIES = \
+ $(if $(BR2_PACKAGE_CHECK),check) \
+ host-pkgconf \
+ $(if $(BR2_PACKAGE_LIBCAP),libcap) \
+ libevent \
+ $(if $(BR2_PACKAGE_VALGRIND),valgrind)
LLDPD_LICENSE = ISC
-LLDPD_LICENSE_FILES = README.md
-# 0002-configure-do-not-check-for-libbsd.patch
-LLDPD_AUTORECONF = YES
-
-ifeq ($(BR2_PACKAGE_CHECK),y)
-LLDPD_DEPENDENCIES += check
-endif
-
-ifeq ($(BR2_PACKAGE_VALGRIND),y)
-LLDPD_DEPENDENCIES += valgrind
-endif
+LLDPD_LICENSE_FILES = LICENSE
# Detection of c99 support in configure fails without WCHAR. To enable
# automatic detection of c99 support by configure, we need to enable
@@ -26,15 +21,11 @@ endif
# runtime. So requesting WCHAR in toolchain just for automatic detection
# will be overkill. To solve this, explicitly -specify c99 here.
LLDPD_CONF_ENV = ac_cv_prog_cc_c99=-std=gnu99
-LLDPD_CONF_ENV += NETSNMP_CONFIG=$(STAGING_DIR)/usr/bin/net-snmp-config
LLDPD_CONF_OPTS = \
- --with-readline \
--without-embedded-libevent \
- --with-snmp \
- --without-xml \
- --without-json \
--without-seccomp \
+ --without-libbsd \
--disable-hardening \
--disable-privsep \
$(if $(BR2_PACKAGE_LLDPD_CDP),--enable-cdp,--disable-cdp) \
@@ -46,6 +37,29 @@ LLDPD_CONF_OPTS = \
$(if $(BR2_PACKAGE_LLDPD_DOT3),--enable-dot3,--disable-dot3) \
$(if $(BR2_PACKAGE_LLDPD_CUSTOM_TLV),--enable-custom,--disable-custom)
+ifeq ($(BR2_PACKAGE_LIBXML2),y)
+LLDPD_CONF_OPTS += --with-xml
+LLDPD_DEPENDENCIES += libxml2
+else
+LLDPD_CONF_OPTS += --without-xml
+endif
+
+ifeq ($(BR2_PACKAGE_NETSNMP),y)
+LLDPD_CONF_OPTS += --with-snmp
+LLDPD_DEPENDENCIES += netsnmp
+LLDPD_CONF_ENV += \
+ ac_cv_path_NETSNMP_CONFIG=$(STAGING_DIR)/usr/bin/net-snmp-config
+else
+LLDPD_CONF_OPTS += --without-snmp
+endif
+
+ifeq ($(BR2_PACKAGE_READLINE),y)
+LLDPD_CONF_OPTS += --with-readline
+LLDPD_DEPENDENCIES += readline
+else
+LLDPD_CONF_OPTS += --without-readline
+endif
+
define LLDPD_INSTALL_INIT_SYSV
$(INSTALL) -D -m 0755 package/lldpd/S60lldpd \
$(TARGET_DIR)/etc/init.d/S60lldpd
--
2.7.4
This diff is collapsed.
......@@ -138,7 +138,24 @@ function print_port_config() {
echo -e "\tdefault \"\""
echo -e "\thelp"
echo -e "\t VID used for the PTP messages"
echo -e "\nconfig VLANS_PORT${portStr}_LLDP_TX_VID"
echo -e "\tint \"LLDP TX VID\""
echo -e "\tdepends on !LLDPD_DISABLE && (VLANS_RAW_PORT_CONFIG || VLANS_PORT${portStr}_MODE_TRUNK || VLANS_PORT${portStr}_MODE_DISABLED || VLANS_PORT${portStr}_MODE_UNQUALIFIED)"
echo -e "\tdefault 4094 if VLANS_PORT${portStr}_MODE_TRUNK"
echo -e "\tdefault 1"
echo -e "\thelp"
echo -e "\t VID used for the transmission of LLDP frames. Incoming LLDP frames"
echo -e "\t are accepted on all VLANs."
echo -e "\t If unsure, put the same value as in VLANS_PORT${portStr}_PTP_VID."
echo -e "\nconfig VLANS_PORT${portStr}_LLDP_TX_PRIO"
echo -e "\tint \"LLDP TX VLAN priority\""
echo -e "\tdepends on !LLDPD_DISABLE && (VLANS_RAW_PORT_CONFIG || VLANS_PORT${portStr}_MODE_TRUNK || VLANS_PORT${portStr}_MODE_DISABLED || VLANS_PORT${portStr}_MODE_UNQUALIFIED)"
echo -e "\tdefault 0"
echo -e "\trange 0 7"
echo -e "\thelp"
echo -e "\t VLAN Priority used for the transmission of LLDP frames."
}
function help_vlan_port_mode() {
......
#!/bin/sh
#!/bin/bash
#
# Controls lldpd.
#
......@@ -69,6 +69,18 @@ start() {
if [ "$CONFIG_LLDPD_MANAGEMENT_PORT_DISABLE" = "y" ]; then
echo "configure system interface pattern '!eth*'" >> $LLDPD_CONFIG
fi
for i_port in {1..18}; do # scan all the physical ports
printf -v i_port_zero "%02d" $i_port
vlan=$(eval "echo \$CONFIG_VLANS_PORT"$i_port_zero"_LLDP_TX_VID")
if [ ! -z "$vlan" ]; then
prio=$(eval "echo \$CONFIG_VLANS_PORT"$i_port_zero"_LLDP_TX_PRIO")
# set default priority
if [ -z "$prio" ]; then
prio=0
fi
echo "configure ports wri$i_port lldp vlan-tx $vlan priority $prio" dei 0 >> $LLDPD_CONFIG
fi
done
echo "resume" >> $LLDPD_CONFIG
start-stop-daemon -S -q -p /var/run/lldpd.pid --exec $LLDPD -- $LLDPD_OPT
......
../init.d/lldpd.bash
\ No newline at end of file
../init.d/lldpd.sh
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment