Commit cfb8b7df authored by Adam Wujek's avatar Adam Wujek 💬

Merge branch 'adam-lldp'

parents a268d82d 5ce42be7
...@@ -920,6 +920,37 @@ config CUSTOM_BOOT_SCRIPT_SOURCE_REMOTE_URL ...@@ -920,6 +920,37 @@ config CUSTOM_BOOT_SCRIPT_SOURCE_REMOTE_URL
endmenu endmenu
menu "LLDP options"
config LLDPD_DISABLE
bool "Disable LLDP daemon"
default n
help
Disable LLDP daemon to prevent sending LLDP frames. It may be useful
for networks not using LLDP or with a low latency requirement.
config LLDPD_TX_INTERVAL
int "LLDP TX interval"
default 5
depends on !LLDPD_DISABLE
help
Define how often LLDP frames are sent.
config LLDPD_MANAGEMENT_PORT_DISABLE
bool "Disable LLDP on the management port"
default n
depends on !LLDPD_DISABLE
help
Disable LLDP traffic on management port.
config LLDPD_MINIMUM_FRAME_SIZE
bool "Send only minimum information via LLDP"
default n
depends on !LLDPD_DISABLE
help
Send only minimum information via LLDP. May be useful in networks
which require low latency.
endmenu
config HTTPD_DISABLE config HTTPD_DISABLE
bool "Disable web interface" bool "Disable web interface"
default n default n
......
...@@ -1938,7 +1938,7 @@ BR2_PACKAGE_LIBDAEMON=y ...@@ -1938,7 +1938,7 @@ BR2_PACKAGE_LIBDAEMON=y
# BR2_PACKAGE_LIBEE is not set # BR2_PACKAGE_LIBEE is not set
# BR2_PACKAGE_LIBEV is not set # BR2_PACKAGE_LIBEV is not set
# BR2_PACKAGE_LIBEVDEV is not set # BR2_PACKAGE_LIBEVDEV is not set
# BR2_PACKAGE_LIBEVENT is not set BR2_PACKAGE_LIBEVENT=y
BR2_PACKAGE_LIBFFI=y BR2_PACKAGE_LIBFFI=y
# BR2_PACKAGE_LIBGLIB2 is not set # BR2_PACKAGE_LIBGLIB2 is not set
...@@ -2226,7 +2226,15 @@ BR2_PACKAGE_LIGHTTPD_PCRE=y ...@@ -2226,7 +2226,15 @@ BR2_PACKAGE_LIGHTTPD_PCRE=y
# linphone needs a toolchain w/ threads, C++ # linphone needs a toolchain w/ threads, C++
# #
# BR2_PACKAGE_LINUX_ZIGBEE is not set # BR2_PACKAGE_LINUX_ZIGBEE is not set
# BR2_PACKAGE_LLDPD is not set BR2_PACKAGE_LLDPD=y
# BR2_PACKAGE_LLDPD_CDP is not set
# BR2_PACKAGE_LLDPD_FDP is not set
# BR2_PACKAGE_LLDPD_EDP is not set
# BR2_PACKAGE_LLDPD_SONMP is not set
# BR2_PACKAGE_LLDPD_LLDPMED is not set
BR2_PACKAGE_LLDPD_DOT1=y
# BR2_PACKAGE_LLDPD_DOT3 is not set
BR2_PACKAGE_LLDPD_CUSTOM_TLV=y
# BR2_PACKAGE_LRZSZ is not set # BR2_PACKAGE_LRZSZ is not set
# BR2_PACKAGE_MACCHANGER is not set # BR2_PACKAGE_MACCHANGER is not set
# BR2_PACKAGE_MEMCACHED is not set # BR2_PACKAGE_MEMCACHED is not set
...@@ -2264,7 +2272,7 @@ BR2_PACKAGE_NETSNMP=y ...@@ -2264,7 +2272,7 @@ BR2_PACKAGE_NETSNMP=y
BR2_PACKAGE_NETSNMP_SERVER=y BR2_PACKAGE_NETSNMP_SERVER=y
BR2_PACKAGE_NETSNMP_CLIENTS=y BR2_PACKAGE_NETSNMP_CLIENTS=y
# BR2_PACKAGE_NETSNMP_ENABLE_MIBS is not set # BR2_PACKAGE_NETSNMP_ENABLE_MIBS is not set
BR2_PACKAGE_NETSNMP_WITH_MIB_MODULES="host ucd-snmp/dlmod if-mib/ifXTable" BR2_PACKAGE_NETSNMP_WITH_MIB_MODULES="host ucd-snmp/dlmod if-mib/ifXTable agentx"
BR2_PACKAGE_NETSNMP_WITHOUT_MIB_MODULES="disman/event disman/schedule utilities" BR2_PACKAGE_NETSNMP_WITHOUT_MIB_MODULES="disman/event disman/schedule utilities"
# BR2_PACKAGE_NETSNMP_ENABLE_DEBUGGING is not set # BR2_PACKAGE_NETSNMP_ENABLE_DEBUGGING is not set
# BR2_PACKAGE_NETSTAT_NAT is not set # BR2_PACKAGE_NETSTAT_NAT is not set
......
...@@ -926,7 +926,80 @@ appropriate way, before the respective service is started. ...@@ -926,7 +926,80 @@ appropriate way, before the respective service is started.
up a batch of switches with different configurations (similar to the up a batch of switches with different configurations (similar to the
@t{CONFIG_DOTCONF_URL}, please refer to @ref{The Configuration File}). @t{CONFIG_DOTCONF_URL}, please refer to @ref{The Configuration File}).
@item CONFIG_LLDPD_DISABLE
@itemx CONFIG_LLDPD_TX_INTERVAL
@itemx CONFIG_LLDPD_MANAGEMENT_PORT_DISABLE
@itemx CONFIG_LLDPD_MINIMUM_FRAME_SIZE
Set of parameters related to the LLDP daemon (lldpd) configuration.
From the version 5.1 switch by default sends LLDP frames on its all
ports (including management). In some installations it may be necessary
to disable LLDP traffic on the management port (option
@t{CONFIG_LLDPD_MANAGEMENT_PORT_DISABLE}). Additionally, in some cases
(like networks that needs low latency) it may be necessary to disable
LLDP at all (@t{CONFIG_LLDPD_DISABLE}).
The transmission frequency of LLDP frames can be changed using option
@t{CONFIG_LLDPD_TX_INTERVAL}.
Networks that would benefit from the LLDP, but have low latency
constraints can use option @t{CONFIG_LLDPD_MINIMUM_FRAME_SIZE}. With
this option LLPD daemon includes only minimal set of information into
LLPD frames.
The table below contains comparison of LLDP frame's fields for standard
frame size and minimal frame size (with
@t{CONFIG_LLDPD_MINIMUM_FRAME_SIZE} option enabled). Size of some of
fields (like @t{System name} or @t{System Description}) depends on
a network configuration.
@multitable @columnfractions .25 .25 .35
@headitem Standard frame @tab Minimum frame @tab Description
@item 14
@tab 14
@tab ETH header
@item 9
@tab 9
@tab Chasis ID (with MAC)
@item 9
@tab 9
@tab Port ID (with MAC)
@item 4
@tab 4
@tab Time To Live
@item 2+len(System name)
@tab 2+len(System name)
@tab System name
@item 2+len(System desc.)
@tab 2+len(@t{WR-SWITCH})
@tab System description
@item 6
@tab 0
@tab Capabilities
@item 14
@tab 0
@tab Management Address
@item 7
@tab 7
@tab Port description
@item 2
@tab 2
@tab End of LLDP frame
@item 69
+len(System name)
+len(System desc.)
@tab 58
+len(System name)
@tab Total length
@end multitable
@item CONFIG_HTTPD_DISABLE @item CONFIG_HTTPD_DISABLE
Disable web interface on a switch. Disable web interface on a switch.
@item CONFIG_MONIT_DISABLE @item CONFIG_MONIT_DISABLE
......
...@@ -706,6 +706,7 @@ list of faults leading to a data error. ...@@ -706,6 +706,7 @@ list of faults leading to a data error.
\snmpadd{WR-SWITCH-MIB::wrsStartCntSnmpd}\\ \snmpadd{WR-SWITCH-MIB::wrsStartCntSnmpd}\\
\snmpadd{WR-SWITCH-MIB::wrsStartCntSyslogd}\\ \snmpadd{WR-SWITCH-MIB::wrsStartCntSyslogd}\\
\snmpadd{WR-SWITCH-MIB::wrsStartCntWrsWatchdog}\\ \snmpadd{WR-SWITCH-MIB::wrsStartCntWrsWatchdog}\\
\snmpadd{WR-SWITCH-MIB::wrsStartCntLldpd}\\
\snmpadd{WR-SWITCH-MIB::wrsStartCntSPLL}\\ \snmpadd{WR-SWITCH-MIB::wrsStartCntSPLL}\\
\snmpadd{WR-SWITCH-MIB::wrsBootUserspaceDaemonsMissing}\\ \snmpadd{WR-SWITCH-MIB::wrsBootUserspaceDaemonsMissing}\\
\snmpadd{WR-SWITCH-MIB::wrsBootSuccessful} \\ \snmpadd{WR-SWITCH-MIB::wrsBootSuccessful} \\
...@@ -735,6 +736,7 @@ list of faults leading to a data error. ...@@ -735,6 +736,7 @@ list of faults leading to a data error.
\item \emph{rsyslogd} \item \emph{rsyslogd}
\item \emph{snmpd} \item \emph{snmpd}
\item \emph{lighttpd} \item \emph{lighttpd}
\item \emph{lldpd}
\item \emph{TRUd/eRSTPd} -- not yet implemented \item \emph{TRUd/eRSTPd} -- not yet implemented
\end{itemize} \end{itemize}
......
...@@ -506,6 +506,7 @@ ...@@ -506,6 +506,7 @@
\snmpentrye{WR-SWITCH-MIB}{wrsStartCntGroup}{wrsStartCntSnmpd}{} \snmpentrye{WR-SWITCH-MIB}{wrsStartCntGroup}{wrsStartCntSnmpd}{}
\snmpentrye{WR-SWITCH-MIB}{wrsStartCntGroup}{wrsStartCntSyslogd}{} \snmpentrye{WR-SWITCH-MIB}{wrsStartCntGroup}{wrsStartCntSyslogd}{}
\snmpentrye{WR-SWITCH-MIB}{wrsStartCntGroup}{wrsStartCntWrsWatchdog}{} \snmpentrye{WR-SWITCH-MIB}{wrsStartCntGroup}{wrsStartCntWrsWatchdog}{}
\snmpentrye{WR-SWITCH-MIB}{wrsStartCntGroup}{wrsStartCntLldpd}{}
\snmpentrye{WR-SWITCH-MIB}{wrsStartCntGroup}{wrsStartCntSPLL}{Not implemented} \snmpentrye{WR-SWITCH-MIB}{wrsStartCntGroup}{wrsStartCntSPLL}{Not implemented}
\snmpentrye{WR-SWITCH-MIB}{}{wrsSpllState}{} \snmpentrye{WR-SWITCH-MIB}{}{wrsSpllState}{}
......
From c136c356d98fdea387581774f609269d276777aa Mon Sep 17 00:00:00 2001
From: Cesar Prados <c.prados@gsi.de>
Date: Thu, 8 Jun 2017 13:50:15 +0200
Subject: [PATCH] lldp: add snmp support and netsnmp config path
uses the lldp buildroot package of the commit 019ad60
---
...generation-of-atom-glue-compatible-with-o.patch | 43 +++++++++++++++
.../0002-configure-do-not-check-for-libbsd.patch | 61 ++++++++++++++++++++++
package/lldpd/S60lldpd | 25 +++++++++
package/lldpd/lldpd.hash | 2 +-
package/lldpd/lldpd.mk | 22 ++++++--
5 files changed, 149 insertions(+), 4 deletions(-)
create mode 100644 package/lldpd/0001-build-make-generation-of-atom-glue-compatible-with-o.patch
create mode 100644 package/lldpd/0002-configure-do-not-check-for-libbsd.patch
create mode 100644 package/lldpd/S60lldpd
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
new file mode 100644
index 0000000..d5675d3
--- /dev/null
+++ b/package/lldpd/0001-build-make-generation-of-atom-glue-compatible-with-o.patch
@@ -0,0 +1,43 @@
+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
new file mode 100644
index 0000000..4d63274
--- /dev/null
+++ b/package/lldpd/0002-configure-do-not-check-for-libbsd.patch
@@ -0,0 +1,61 @@
+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/S60lldpd b/package/lldpd/S60lldpd
new file mode 100644
index 0000000..3dfa6c1
--- /dev/null
+++ b/package/lldpd/S60lldpd
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Controls lldpd.
+#
+
+case $1 in
+ start)
+ printf "Starting lldpd: "
+ start-stop-daemon -S -q -p /var/run/lldpd.pid --exec /usr/sbin/lldpd
+ [ $? = 0 ] && echo "OK" || echo "FAIL"
+ ;;
+ stop)
+ printf "Stopping lldpd: "
+ start-stop-daemon -K -q -p /var/run/lldpd.pid
+ [ $? = 0 ] && echo "OK" || echo "FAIL"
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+ ;;
+esac
diff --git a/package/lldpd/lldpd.hash b/package/lldpd/lldpd.hash
index a6d905b..fc3d21f 100644
--- a/package/lldpd/lldpd.hash
+++ b/package/lldpd/lldpd.hash
@@ -1,2 +1,2 @@
# Locally computed
-sha256 aac11cb1fdc037709517372c70c9bf89c752ab8e5eaab9ce140b84ed5a0507c8 lldpd-0.7.19.tar.gz
+sha256 eb1f5beff2ff5c13c5e0342b5b9da815ed4a63866262445e1168a79ee65c9079 lldpd-0.9.4.tar.gz
diff --git a/package/lldpd/lldpd.mk b/package/lldpd/lldpd.mk
index 416967b..5ee5122 100644
--- a/package/lldpd/lldpd.mk
+++ b/package/lldpd/lldpd.mk
@@ -4,11 +4,21 @@
#
################################################################################
-LLDPD_VERSION = 0.7.19
+LLDPD_VERSION = 0.9.4
LLDPD_SITE = http://media.luffy.cx/files/lldpd
-LLDPD_DEPENDENCIES = host-pkgconf libevent
+LLDPD_DEPENDENCIES = host-pkgconf libevent netsnmp
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
# Detection of c99 support in configure fails without WCHAR. To enable
# automatic detection of c99 support by configure, we need to enable
@@ -16,11 +26,12 @@ LLDPD_LICENSE_FILES = README.md
# 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 = \
--without-readline \
--without-embedded-libevent \
- --without-snmp \
+ --with-snmp \
--without-xml \
--without-json \
--without-seccomp \
@@ -35,4 +46,9 @@ LLDPD_CONF_OPTS = \
$(if $(BR2_PACKAGE_LLDPD_DOT3),--enable-dot3,--disable-dot3) \
$(if $(BR2_PACKAGE_LLDPD_CUSTOM_TLV),--enable-custom,--disable-custom)
+define LLDPD_INSTALL_INIT_SYSV
+ $(INSTALL) -D -m 0755 package/lldpd/S60lldpd \
+ $(TARGET_DIR)/etc/init.d/S60lldpd
+endef
+
$(eval $(autotools-package))
--
2.1.4
#!/bin/sh
#
# Controls lldpd.
#
LLDPD_CONFIG=/etc/lldpd.conf
LLDPD=/usr/sbin/lldpd
LLDPD_CLI=/usr/sbin/lldpcli
# -x -- Enable SNMP subagent.
LLDPD_OPT=-x
MONIT=/usr/bin/monit
dotconfig=/wr/etc/dot-config
start_counter() {
# increase start counter
COUNTER_FILE="/tmp/start_cnt_lldpd"
START_COUNTER=1
if [ -f "$COUNTER_FILE" ];
then
read -r START_COUNTER < $COUNTER_FILE
START_COUNTER=$((START_COUNTER+1))
fi
echo "$START_COUNTER" > $COUNTER_FILE
}
start() {
echo -n "Starting lldpd: "
if [ -f $dotconfig ]; then
. $dotconfig
else
echo "$0 unable to source dot-config ($dotconfig)!"
fi
if [ "$CONFIG_LLDPD_DISABLE" = "y" ]; then
echo "lldpd disabled in dot-config!"
if [ "$1" != "force" ]; then
# Unmonitor lldpd, ignore all printouts from monit.
# Run in background since monit may wait for a timeout.
$MONIT unmonitor lldpd &>/dev/null &
exit 0
fi
echo -n "Force start of lldpd: "
fi
# Creating lldpd config
echo "# This configuration file was generated by $0 at startup" > $LLDPD_CONFIG
echo "# If you would like to change a lldpd configuration in runtime please consider using lldpcli" >> $LLDPD_CONFIG
echo "configure system hostname '$(hostname)'" >> $LLDPD_CONFIG
tx_interval=5
if [ ! -z "$CONFIG_LLDPD_TX_INTERVAL" ]; then
tx_int=$CONFIG_LLDPD_TX_INTERVAL
# check if given value is an int
case $tx_int in
''|*[!0-9]*) echo -n "wrong CONFIG_LLDPD_TX_INTERVAL "$tx_int". Using 5 as the default interval. " ;;
*) echo tx_interval=$tx_int ;;
esac
fi
echo "configure lldp tx-interval $tx_interval" >> $LLDPD_CONFIG
if [ "$CONFIG_LLDPD_MINIMUM_FRAME_SIZE" = "y" ]; then
echo "configure system description 'WR-SWITCH'" >> $LLDPD_CONFIG
# disable capabilities-advertisements
echo "unconfigure ports all lldp capabilities-advertisements" >> $LLDPD_CONFIG
# disable management ip advertisements
echo "unconfigure ports all lldp management-addresses-advertisements" >> $LLDPD_CONFIG
else
echo "configure system description 'WR-SWITCH: $(/wr/bin/wrsw_version)'" >> $LLDPD_CONFIG
fi
if [ "$CONFIG_LLDPD_MANAGEMENT_PORT_DISABLE" = "y" ]; then
echo "configure system interface pattern '!eth*'" >> $LLDPD_CONFIG
fi
echo "resume" >> $LLDPD_CONFIG
start-stop-daemon -S -q -p /var/run/lldpd.pid --exec $LLDPD -- $LLDPD_OPT
ret=$?
if [ $ret -eq 0 ]; then
start_counter
echo "OK"
elif [ $ret -eq 1 ]; then
echo "Failed (already running?)"
else
echo "Failed"
fi
# check whether the process was monitored
$MONIT summary 2>&1 | grep lldpd | grep "Not monitored" &> /dev/null
if [ $? -eq 0 ]; then
echo "lldpd was not monitored, enabling monitoring"
# the process was not monitored, enable monitoring
# this will generate extra log entries from monit
$MONIT monitor lldpd
fi
}
stop() {
echo -n "Stopping lldpd: "
start-stop-daemon -K -q -p /var/run/lldpd.pid
if [ $? -eq 0 ]; then
echo "OK"
else
echo "Failed"
fi
}
restart() {
stop
start
}
case "$1" in
start)
start "$2"
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo "Usage: $0 {start <force>|stop|restart}"
echo " start force -- enable lldpd even it is disabled in the dot-config"
exit 1
;;
esac
check process lldpd matching /usr/sbin/lldpd
start program = "/etc/init.d/lldpd.sh start"
stop program = "/etc/init.d/lldpd.sh stop"
if 5 restarts within 10 cycles then exec "/etc/init.d/reboot.sh lldpd"
../init.d/lldpd.sh
\ No newline at end of file
...@@ -16,6 +16,8 @@ authtrapenable 1 ...@@ -16,6 +16,8 @@ authtrapenable 1
#rocommunity CONFIG_SNMP_RO_COMMUNITY #rocommunity CONFIG_SNMP_RO_COMMUNITY
#rwcommunity CONFIG_SNMP_RW_COMMUNITY #rwcommunity CONFIG_SNMP_RW_COMMUNITY
master agentx
# This is picked from /usr/lib, and the first argument is said to be the # This is picked from /usr/lib, and the first argument is said to be the
# "init function", but it is not, because the daemon adds a leading "init_" # "init function", but it is not, because the daemon adds a leading "init_"
dlmod wrsSnmp /wr/lib/wrsSnmp.so dlmod wrsSnmp /wr/lib/wrsSnmp.so
...@@ -18,13 +18,17 @@ IMPORTS ...@@ -18,13 +18,17 @@ IMPORTS
-- (I follow the CamelCase to be sure I don't mistype. Who knows the rules... -- (I follow the CamelCase to be sure I don't mistype. Who knows the rules...
wrSwitchMIB MODULE-IDENTITY wrSwitchMIB MODULE-IDENTITY
LAST-UPDATED "201602171600Z" LAST-UPDATED "201807181400Z"
ORGANIZATION "CERN" ORGANIZATION "CERN"
CONTACT-INFO "postal: BE-CO-HT, CERN, Geneva CONTACT-INFO "postal: BE-CO-HT, CERN, Geneva
email: ht-drivers@cern.ch email: ht-drivers@cern.ch
" "
DESCRIPTION "White Rabbit Switch internal details DESCRIPTION "White Rabbit Switch internal details
" "
REVISION "201807181400Z"
DESCRIPTION
"Add wrsStartCntLldpd"
REVISION "201602171600Z" REVISION "201602171600Z"
DESCRIPTION DESCRIPTION
"Use 64bit counters for pstats. Make wrsPstats* obsolete, "Use 64bit counters for pstats. Make wrsPstats* obsolete,
...@@ -1146,6 +1150,14 @@ wrsStartCntWrsWatchdog OBJECT-TYPE ...@@ -1146,6 +1150,14 @@ wrsStartCntWrsWatchdog OBJECT-TYPE
"Number of wrs_watchdog daemon starts" "Number of wrs_watchdog daemon starts"
::= { wrsStartCntGroup 8 } ::= { wrsStartCntGroup 8 }
wrsStartCntLldpd OBJECT-TYPE
SYNTAX Counter32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Number of LLDP daemon starts"
::= { wrsStartCntGroup 9 }
-- wrsSpllState (.7.3) -- wrsSpllState (.7.3)
wrsSpllState OBJECT IDENTIFIER ::= { wrsExpertStatus 3 } wrsSpllState OBJECT IDENTIFIER ::= { wrsExpertStatus 3 }
......
...@@ -95,6 +95,7 @@ struct wrs_usd_item { ...@@ -95,6 +95,7 @@ struct wrs_usd_item {
#define UDI_HTTP 4 /* index of web server in userspace_daemons array */ #define UDI_HTTP 4 /* index of web server in userspace_daemons array */
#define UDI_MONIT 5 /* index of MONIT in userspace_daemons array */ #define UDI_MONIT 5 /* index of MONIT in userspace_daemons array */
#define UDI_LLDP 8 /* index of LLDP in userspace_daemons array */
/* user space daemon list */ /* user space daemon list */
/* - key contain process name reported by ps command /* - key contain process name reported by ps command
* - positive exp describe exact number of expected processes * - positive exp describe exact number of expected processes
...@@ -114,6 +115,8 @@ static struct wrs_usd_item userspace_daemons[] = { ...@@ -114,6 +115,8 @@ static struct wrs_usd_item userspace_daemons[] = {
* dot-config */ * dot-config */
[6] = {"/usr/sbin/snmpd", 1}, [6] = {"/usr/sbin/snmpd", 1},
[7] = {"/wr/bin/wrs_watchdog", 1}, [7] = {"/wr/bin/wrs_watchdog", 1},
[UDI_LLDP] = {"/usr/sbin/lldpd", 1}, /* LLDP can be disabled in
dot-config */
}; };
struct wrs_bc_item { struct wrs_bc_item {
...@@ -485,6 +488,14 @@ static void update_daemon_expectancy(struct wrs_usd_item *daemon_array) ...@@ -485,6 +488,14 @@ static void update_daemon_expectancy(struct wrs_usd_item *daemon_array)
snmp_log(LOG_INFO, "SNMP: Info wrsBootUserspaceDaemonsMissing:" snmp_log(LOG_INFO, "SNMP: Info wrsBootUserspaceDaemonsMissing:"
" CONFIG_HTTPD_DISABLE=y in dot-config\n"); " CONFIG_HTTPD_DISABLE=y in dot-config\n");
} }
tmp = libwr_cfg_get("LLDPD_DISABLE");
if (tmp && !strcmp(tmp, "y")) {
/* SNMP should not expect lldpd to be running */
daemon_array[UDI_LLDP].exp = 0;
snmp_log(LOG_INFO, "SNMP: Info wrsBootUserspaceDaemonsMissing:"
" CONFIG_LLDPD_DISABLE=y in dot-config\n");
}
} }
/* check if daemons from userspace_daemons array are running */ /* check if daemons from userspace_daemons array are running */
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define START_CNT_SNMPD "/tmp/start_cnt_snmpd" #define START_CNT_SNMPD "/tmp/start_cnt_snmpd"
#define START_CNT_SYSLOGD "/tmp/start_cnt_syslogd" #define START_CNT_SYSLOGD "/tmp/start_cnt_syslogd"
#define START_CNT_WRSWATCHDOG "/tmp/start_cnt_wrs_watchdog" #define START_CNT_WRSWATCHDOG "/tmp/start_cnt_wrs_watchdog"
#define START_CNT_LLDPD "/tmp/start_cnt_lldpd"
static struct pickinfo wrsStartCnt_pickinfo[] = { static struct pickinfo wrsStartCnt_pickinfo[] = {
FIELD(wrsStartCnt_s, ASN_COUNTER, wrsStartCntHAL), FIELD(wrsStartCnt_s, ASN_COUNTER, wrsStartCntHAL),
...@@ -17,6 +18,7 @@ static struct pickinfo wrsStartCnt_pickinfo[] = { ...@@ -17,6 +18,7 @@ static struct pickinfo wrsStartCnt_pickinfo[] = {
FIELD(wrsStartCnt_s, ASN_COUNTER, wrsStartCntSnmpd), FIELD(wrsStartCnt_s, ASN_COUNTER, wrsStartCntSnmpd),
FIELD(wrsStartCnt_s, ASN_COUNTER, wrsStartCntSyslogd), FIELD(wrsStartCnt_s, ASN_COUNTER, wrsStartCntSyslogd),
FIELD(wrsStartCnt_s, ASN_COUNTER, wrsStartCntWrsWatchdog), FIELD(wrsStartCnt_s, ASN_COUNTER, wrsStartCntWrsWatchdog),
FIELD(wrsStartCnt_s, ASN_COUNTER, wrsStartCntLldpd),
}; };
struct wrsStartCnt_s wrsStartCnt_s; struct wrsStartCnt_s wrsStartCnt_s;
...@@ -74,6 +76,7 @@ time_t wrsStartCnt_data_fill(void){ ...@@ -74,6 +76,7 @@ time_t wrsStartCnt_data_fill(void){
read_start_count(START_CNT_SNMPD, &wrsStartCnt_s.wrsStartCntSnmpd); read_start_count(START_CNT_SNMPD, &wrsStartCnt_s.wrsStartCntSnmpd);
read_start_count(START_CNT_SYSLOGD, &wrsStartCnt_s.wrsStartCntSyslogd); read_start_count(START_CNT_SYSLOGD, &wrsStartCnt_s.wrsStartCntSyslogd);
read_start_count(START_CNT_WRSWATCHDOG, &wrsStartCnt_s.wrsStartCntWrsWatchdog); read_start_count(START_CNT_WRSWATCHDOG, &wrsStartCnt_s.wrsStartCntWrsWatchdog);
read_start_count(START_CNT_LLDPD, &wrsStartCnt_s.wrsStartCntLldpd);
/* there was an update, return current time */ /* there was an update, return current time */
return time_update; return time_update;
......
...@@ -13,6 +13,7 @@ struct wrsStartCnt_s { ...@@ -13,6 +13,7 @@ struct wrsStartCnt_s {
uint32_t wrsStartCntSnmpd; uint32_t wrsStartCntSnmpd;
uint32_t wrsStartCntSyslogd; uint32_t wrsStartCntSyslogd;
uint32_t wrsStartCntWrsWatchdog; uint32_t wrsStartCntWrsWatchdog;
uint32_t wrsStartCntLldpd;
}; };
extern struct wrsStartCnt_s wrsStartCnt_s; extern struct wrsStartCnt_s wrsStartCnt_s;
......