Compare commits
No commits in common. "c8s" and "c9-beta" have entirely different histories.
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,4 +1 @@
|
||||
SOURCES/lldpd-1.0.1.tar.gz
|
||||
/lldpd-1.0.1.tar.gz
|
||||
/lldpd-1.0.17.tar.gz
|
||||
/lldpd-1.0.17-free.tar.gz
|
||||
SOURCES/lldpd-1.0.18-free.tar.gz
|
||||
|
1
.lldpd.metadata
Normal file
1
.lldpd.metadata
Normal file
@ -0,0 +1 @@
|
||||
3552b6c8bea1077345bb29e75feb4646c847efad SOURCES/lldpd-1.0.18-free.tar.gz
|
96
SOURCES/0001-client-tx-hold-range.patch
Normal file
96
SOURCES/0001-client-tx-hold-range.patch
Normal file
@ -0,0 +1,96 @@
|
||||
From 7b9abb819337dd50583350105afbdc82302f00ff Mon Sep 17 00:00:00 2001
|
||||
From: Hangbin Liu <liuhangbin@gmail.com>
|
||||
Date: Wed, 10 Jul 2024 15:32:01 +0800
|
||||
Subject: [PATCH 1/2] client: add range restriction for tx hold and interval
|
||||
|
||||
Based on IEEE 802.1AB(2016) 9.2.5. The valid range of tx hold is 1-100,
|
||||
the valid range of tx interval is 1-3600.
|
||||
|
||||
Reported-by: Matt Lucius <malucius@redhat.com>
|
||||
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
|
||||
---
|
||||
src/client/lldpcli.8.in | 15 ++++++++-------
|
||||
src/lib/atoms/config.c | 13 +++++++++----
|
||||
2 files changed, 17 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/src/client/lldpcli.8.in b/src/client/lldpcli.8.in
|
||||
index 74a07eb4b806..39f936d1ceae 100644
|
||||
--- a/src/client/lldpcli.8.in
|
||||
+++ b/src/client/lldpcli.8.in
|
||||
@@ -555,8 +555,8 @@ Force port description to the provided string.
|
||||
.Cd lldp tx-interval Ar interval
|
||||
.Bd -ragged -offset XXXXXX
|
||||
Change transmit delay to the specified value in seconds. The transmit
|
||||
-delay is the delay between two transmissions of LLDP PDU. The default
|
||||
-value is 30 seconds. Note:
|
||||
+delay is the delay between two transmissions of LLDP PDU. The valid range
|
||||
+is 1 through 3600 in seconds. The default value is 30 seconds. Note:
|
||||
.Nm lldpd
|
||||
also starts another system based refresh timer on each port to detect
|
||||
changes such as a hostname. This is the value of the tx-interval
|
||||
@@ -576,8 +576,8 @@ system capabilities and CPU speed.
|
||||
.Bd -ragged -offset XXXXXX
|
||||
Change transmit hold value to the specified value. This value is used
|
||||
to compute the TTL of transmitted packets which is the product of this
|
||||
-value and of the transmit delay. The default value is 4 and therefore
|
||||
-the default TTL is 120 seconds.
|
||||
+value and of the transmit delay. The valid range is 1 through 100. The
|
||||
+default value is 4 and therefore the default TTL is 120 seconds.
|
||||
.Ed
|
||||
|
||||
.Cd configure
|
||||
@@ -676,9 +676,10 @@ to shorten the interval between two LLDPDU.
|
||||
.Cd enable
|
||||
should enable LLDP-MED fast start while
|
||||
.Cd tx-interval
|
||||
-specifies the interval between two LLDPDU in seconds. The default
|
||||
-interval is 1 second. Once 4 LLDPDU have been sent, the fast start
|
||||
-mechanism is disabled until a new neighbor is detected.
|
||||
+specifies the interval between two LLDPDU in seconds. The valid interval
|
||||
+range is 1 through 3600 in seconds. The default interval is 1 second. Once
|
||||
+4 LLDPDU have been sent, the fast start mechanism is disabled until a new
|
||||
+neighbor is detected.
|
||||
.Ed
|
||||
|
||||
.Cd unconfigure med fast-start
|
||||
diff --git a/src/lib/atoms/config.c b/src/lib/atoms/config.c
|
||||
index 8a4af2e8d1cd..305b5861de6e 100644
|
||||
--- a/src/lib/atoms/config.c
|
||||
+++ b/src/lib/atoms/config.c
|
||||
@@ -262,11 +262,13 @@ _lldpctl_atom_set_int_config(lldpctl_atom_t *atom, lldpctl_key_t key, long int v
|
||||
break;
|
||||
case lldpctl_k_config_tx_interval:
|
||||
config.c_tx_interval = value * 1000;
|
||||
- if (value > 0) c->config->c_tx_interval = value * 1000;
|
||||
+ if (value > 0 && value <= 3600 * 1000)
|
||||
+ c->config->c_tx_interval = value * 1000;
|
||||
break;
|
||||
case lldpctl_k_config_tx_interval_ms:
|
||||
config.c_tx_interval = value;
|
||||
- if (value > 0) c->config->c_tx_interval = value;
|
||||
+ if (value > 0 && value <= 3600 * 1000)
|
||||
+ c->config->c_tx_interval = value;
|
||||
break;
|
||||
case lldpctl_k_config_ifdescr_update:
|
||||
config.c_set_ifdescr = c->config->c_set_ifdescr = value;
|
||||
@@ -288,12 +290,15 @@ _lldpctl_atom_set_int_config(lldpctl_atom_t *atom, lldpctl_key_t key, long int v
|
||||
config.c_enable_fast_start = c->config->c_enable_fast_start = value;
|
||||
break;
|
||||
case lldpctl_k_config_fast_start_interval:
|
||||
- config.c_tx_fast_interval = c->config->c_tx_fast_interval = value;
|
||||
+ config.c_tx_fast_interval = value;
|
||||
+ if (value > 0 && value <= 3600)
|
||||
+ c->config->c_tx_fast_interval = value;
|
||||
break;
|
||||
#endif
|
||||
case lldpctl_k_config_tx_hold:
|
||||
config.c_tx_hold = value;
|
||||
- if (value > 0) c->config->c_tx_hold = value;
|
||||
+ if (value > 0 && value <= 100)
|
||||
+ c->config->c_tx_hold = value;
|
||||
break;
|
||||
case lldpctl_k_config_max_neighbors:
|
||||
config.c_max_neighbors = value;
|
||||
--
|
||||
2.46.0
|
||||
|
72
SOURCES/0002-lldpd-limit-tx-ttl-to-65535.patch
Normal file
72
SOURCES/0002-lldpd-limit-tx-ttl-to-65535.patch
Normal file
@ -0,0 +1,72 @@
|
||||
From a73e04f46ebe3d5e9d0805c52b9e5d0472e65069 Mon Sep 17 00:00:00 2001
|
||||
From: Hangbin Liu <liuhangbin@gmail.com>
|
||||
Date: Wed, 10 Jul 2024 15:49:32 +0800
|
||||
Subject: [PATCH 2/2] lldpd: limit tx ttl to 65535
|
||||
|
||||
Based on IEEE 802.1AB(2016) 9.2.5.22 txTTL:
|
||||
During normal operation, txTTL is set to whichever is the smaller of the
|
||||
values represented by Equation (1) and Equation (2):
|
||||
(msgTxInterval x msgTxHold) + 1 (1)
|
||||
65535 (2)
|
||||
|
||||
Reported-by: Matt Lucius <malucius@redhat.com>
|
||||
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
|
||||
---
|
||||
src/daemon/client.c | 5 +++--
|
||||
src/daemon/lldpd.c | 3 ++-
|
||||
2 files changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/daemon/client.c b/src/daemon/client.c
|
||||
index d9d907fd74dc..c4894ac112ea 100644
|
||||
--- a/src/daemon/client.c
|
||||
+++ b/src/daemon/client.c
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "lldpd.h"
|
||||
#include "trace.h"
|
||||
|
||||
+#include <sys/param.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
static ssize_t
|
||||
@@ -80,7 +81,7 @@ client_handle_set_configuration(struct lldpd *cfg, enum hmsg_type *type, void *i
|
||||
cfg->g_config.c_tx_interval = config->c_tx_interval;
|
||||
cfg->g_config.c_ttl =
|
||||
cfg->g_config.c_tx_interval * cfg->g_config.c_tx_hold;
|
||||
- cfg->g_config.c_ttl = (cfg->g_config.c_ttl + 999) / 1000;
|
||||
+ cfg->g_config.c_ttl = MIN((cfg->g_config.c_ttl + 999) / 1000, 65535);
|
||||
}
|
||||
levent_send_now(cfg);
|
||||
}
|
||||
@@ -90,7 +91,7 @@ client_handle_set_configuration(struct lldpd *cfg, enum hmsg_type *type, void *i
|
||||
cfg->g_config.c_tx_hold = config->c_tx_hold;
|
||||
cfg->g_config.c_ttl =
|
||||
cfg->g_config.c_tx_interval * cfg->g_config.c_tx_hold;
|
||||
- cfg->g_config.c_ttl = (cfg->g_config.c_ttl + 999) / 1000;
|
||||
+ cfg->g_config.c_ttl = MIN((cfg->g_config.c_ttl + 999) / 1000, 65535);
|
||||
}
|
||||
if (CHANGED(c_max_neighbors) && config->c_max_neighbors > 0) {
|
||||
log_debug("rpc", "client change maximum neighbors to %d",
|
||||
diff --git a/src/daemon/lldpd.c b/src/daemon/lldpd.c
|
||||
index 6b5721e2e336..c3b67c6dfeb2 100644
|
||||
--- a/src/daemon/lldpd.c
|
||||
+++ b/src/daemon/lldpd.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <time.h>
|
||||
#include <libgen.h>
|
||||
#include <assert.h>
|
||||
+#include <sys/param.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -1932,7 +1933,7 @@ lldpd_main(int argc, char *argv[], char *envp[])
|
||||
cfg->g_config.c_tx_interval = LLDPD_TX_INTERVAL * 1000;
|
||||
cfg->g_config.c_tx_hold = LLDPD_TX_HOLD;
|
||||
cfg->g_config.c_ttl = cfg->g_config.c_tx_interval * cfg->g_config.c_tx_hold;
|
||||
- cfg->g_config.c_ttl = (cfg->g_config.c_ttl + 999) / 1000;
|
||||
+ cfg->g_config.c_ttl = MIN((cfg->g_config.c_ttl + 999) / 1000, 65535);
|
||||
cfg->g_config.c_max_neighbors = LLDPD_MAX_NEIGHBORS;
|
||||
#ifdef ENABLE_LLDPMED
|
||||
cfg->g_config.c_enable_fast_start = enable_fast_start;
|
||||
--
|
||||
2.46.0
|
||||
|
83
SOURCES/0003-lldpd-fix-ttl-range.patch
Normal file
83
SOURCES/0003-lldpd-fix-ttl-range.patch
Normal file
@ -0,0 +1,83 @@
|
||||
From 54c057d1190d4405d66e752dff789a01b8612f9b Mon Sep 17 00:00:00 2001
|
||||
From: Hangbin Liu <liuhangbin@gmail.com>
|
||||
Date: Mon, 2 Dec 2024 14:33:16 +0800
|
||||
Subject: [PATCH 3/4] lldpd: fix ttl range on ports
|
||||
|
||||
In the following fixed commit, I forgot to fix the ttl range for
|
||||
interfaces/ports.
|
||||
|
||||
Fixes: a73e04f46ebe ("lldpd: limit tx ttl to 65535")
|
||||
Reported-by: Fei Liu <feliu@redhat.com>
|
||||
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
|
||||
---
|
||||
src/client/display.c | 3 ++-
|
||||
src/daemon/protocols/edp.c | 3 ++-
|
||||
src/daemon/protocols/sonmp.c | 3 ++-
|
||||
3 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/client/display.c b/src/client/display.c
|
||||
index 6b23ec5b9e33..978accf02eae 100644
|
||||
--- a/src/client/display.c
|
||||
+++ b/src/client/display.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
+#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
@@ -599,7 +600,7 @@ display_local_ttl(struct writer *w, lldpctl_conn_t *conn, int details)
|
||||
tx_interval =
|
||||
lldpctl_atom_get_int(configuration, lldpctl_k_config_tx_interval_ms);
|
||||
|
||||
- tx_interval = (tx_interval * tx_hold + 999) / 1000;
|
||||
+ tx_interval = MIN((tx_interval * tx_hold + 999) / 1000, 65535);
|
||||
|
||||
if (asprintf(&ttl, "%lu", tx_interval) == -1) {
|
||||
log_warnx("lldpctl", "not enough memory to build TTL.");
|
||||
diff --git a/src/daemon/protocols/edp.c b/src/daemon/protocols/edp.c
|
||||
index b55130b54806..773d210653f6 100644
|
||||
--- a/src/daemon/protocols/edp.c
|
||||
+++ b/src/daemon/protocols/edp.c
|
||||
@@ -25,6 +25,7 @@
|
||||
# include <errno.h>
|
||||
# include <arpa/inet.h>
|
||||
# include <fnmatch.h>
|
||||
+# include <sys/param.h>
|
||||
|
||||
static int seq = 0;
|
||||
|
||||
@@ -296,7 +297,7 @@ edp_decode(struct lldpd *cfg, char *frame, int s, struct lldpd_hardware *hardwar
|
||||
goto malformed;
|
||||
}
|
||||
port->p_ttl = cfg ? cfg->g_config.c_tx_interval * cfg->g_config.c_tx_hold : 0;
|
||||
- port->p_ttl = (port->p_ttl + 999) / 1000;
|
||||
+ port->p_ttl = MIN((port->p_ttl + 999) / 1000, 65535);
|
||||
chassis->c_id_subtype = LLDP_CHASSISID_SUBTYPE_LLADDR;
|
||||
chassis->c_id_len = ETHER_ADDR_LEN;
|
||||
if ((chassis->c_id = (char *)malloc(ETHER_ADDR_LEN)) == NULL) {
|
||||
diff --git a/src/daemon/protocols/sonmp.c b/src/daemon/protocols/sonmp.c
|
||||
index ddc2771d75c1..59636262ed28 100644
|
||||
--- a/src/daemon/protocols/sonmp.c
|
||||
+++ b/src/daemon/protocols/sonmp.c
|
||||
@@ -24,6 +24,7 @@
|
||||
# include <unistd.h>
|
||||
# include <errno.h>
|
||||
# include <arpa/inet.h>
|
||||
+# include <sys/param.h>
|
||||
|
||||
static struct sonmp_chassis sonmp_chassis_types[] = {
|
||||
{ 1, "unknown (via SONMP)" },
|
||||
@@ -369,7 +370,7 @@ sonmp_decode(struct lldpd *cfg, char *frame, int s, struct lldpd_hardware *hardw
|
||||
TAILQ_INSERT_TAIL(&chassis->c_mgmt, mgmt, m_entries);
|
||||
port->p_ttl =
|
||||
cfg ? (cfg->g_config.c_tx_interval * cfg->g_config.c_tx_hold) : LLDPD_TTL;
|
||||
- port->p_ttl = (port->p_ttl + 999) / 1000;
|
||||
+ port->p_ttl = MIN((port->p_ttl + 999) / 1000, 65535);
|
||||
|
||||
port->p_id_subtype = LLDP_PORTID_SUBTYPE_LOCAL;
|
||||
|
||||
--
|
||||
2.39.5 (Apple Git-154)
|
||||
|
41
SOURCES/0004-client-fix-tx-hold.patch
Normal file
41
SOURCES/0004-client-fix-tx-hold.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 7de43fe8b8993f01422cfc00dfb06bcaf5171eb0 Mon Sep 17 00:00:00 2001
|
||||
From: Hangbin Liu <liuhangbin@gmail.com>
|
||||
Date: Mon, 2 Dec 2024 14:34:44 +0800
|
||||
Subject: [PATCH 4/4] client: fix global tx hold and interval setting
|
||||
|
||||
In the following fixed commit, I forgot to fix the transmission (tx) hold
|
||||
and interval range in the global configuration setting.
|
||||
|
||||
Fixes: 7b9abb819337 ("client: add range restriction for tx hold and interval")
|
||||
Reported-by: Fei Liu <feliu@redhat.com>
|
||||
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
|
||||
---
|
||||
src/daemon/client.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/daemon/client.c b/src/daemon/client.c
|
||||
index 2112bdea6bef..091e1f4e4648 100644
|
||||
--- a/src/daemon/client.c
|
||||
+++ b/src/daemon/client.c
|
||||
@@ -75,7 +75,7 @@ client_handle_set_configuration(struct lldpd *cfg, enum hmsg_type *type, void *i
|
||||
if (CHANGED(c_tx_interval) && config->c_tx_interval != 0) {
|
||||
if (config->c_tx_interval < 0) {
|
||||
log_debug("rpc", "client asked for immediate retransmission");
|
||||
- } else {
|
||||
+ } else if (config->c_tx_interval <= 3600 * 1000) {
|
||||
log_debug("rpc", "client change transmit interval to %d ms",
|
||||
config->c_tx_interval);
|
||||
cfg->g_config.c_tx_interval = config->c_tx_interval;
|
||||
@@ -86,7 +86,8 @@ client_handle_set_configuration(struct lldpd *cfg, enum hmsg_type *type, void *i
|
||||
}
|
||||
levent_send_now(cfg);
|
||||
}
|
||||
- if (CHANGED(c_tx_hold) && config->c_tx_hold > 0) {
|
||||
+ if (CHANGED(c_tx_hold) && config->c_tx_hold > 0 &&
|
||||
+ config->c_tx_hold <= 100) {
|
||||
log_debug("rpc", "client change transmit hold to %d",
|
||||
config->c_tx_hold);
|
||||
cfg->g_config.c_tx_hold = config->c_tx_hold;
|
||||
--
|
||||
2.39.5 (Apple Git-154)
|
||||
|
31
SOURCES/lldpd-cleanup.sh
Executable file
31
SOURCES/lldpd-cleanup.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Process a lldpd tarball to remove proprietary source code.
|
||||
#
|
||||
# Yaakov Selkowitz <yselkowi@redhat.com> - 2021
|
||||
#
|
||||
|
||||
SOURCE="$1"
|
||||
NEW_SOURCE=`echo $SOURCE | sed 's/\.tar\.gz/-free&/'`
|
||||
DIRECTORY=`echo $SOURCE | sed 's/\.tar\.gz//'`
|
||||
|
||||
error()
|
||||
{
|
||||
MESSAGE=$1
|
||||
echo $MESSAGE
|
||||
exit 1
|
||||
}
|
||||
|
||||
rm -rf $DIRECTORY
|
||||
tar xzf $SOURCE || error "Cannot unpack $SOURCE"
|
||||
pushd $DIRECTORY > /dev/null || error "Cannot open directory \"$DIRECTORY\""
|
||||
|
||||
echo "Remove proprietary source files"
|
||||
find include/osx -type f -delete
|
||||
|
||||
echo
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
tar czf $NEW_SOURCE $DIRECTORY
|
||||
echo "$NEW_SOURCE is ready to use"
|
2
SOURCES/lldpd-systemd-sysusers.conf
Normal file
2
SOURCES/lldpd-systemd-sysusers.conf
Normal file
@ -0,0 +1,2 @@
|
||||
#Type Name ID GECOS Home directory Shell
|
||||
u lldpd - "Used by the lldpd daemon" /var/lib/lldpd /sbin/nologin
|
@ -1,48 +1,33 @@
|
||||
%if 0%{?el6}
|
||||
%bcond_with systemd
|
||||
%global rundir /var/run/
|
||||
%else
|
||||
%bcond_without systemd
|
||||
%global rundir /run/
|
||||
%endif
|
||||
|
||||
%global gh_owner vincentbernat
|
||||
|
||||
Name: lldpd
|
||||
Version: 1.0.17
|
||||
Release: 2%{?dist}
|
||||
Version: 1.0.18
|
||||
Release: 6%{?dist}
|
||||
Summary: ISC-licensed implementation of LLDP
|
||||
|
||||
License: ISC
|
||||
URL: https://%{gh_owner}.github.io/%{name}/
|
||||
Source0: https://media.luffy.cx/files/lldpd/lldpd-%{version}.tar.gz
|
||||
Source1: %{name}-fedora.service
|
||||
URL: https://github.com/lldpd/
|
||||
Source0: lldpd-%{version}-free.tar.gz
|
||||
Source1: %{name}.service
|
||||
Source2: %{name}-tmpfiles
|
||||
Source3: %{name}-fedora.sysconfig
|
||||
Source4: %{name}-el6.init
|
||||
Source5: %{name}-el7.service
|
||||
Source3: %{name}.sysconfig
|
||||
Source4: %{name}-systemd-sysusers.conf
|
||||
|
||||
Source100: lldpd-cleanup.sh
|
||||
|
||||
Patch1: 0001-client-tx-hold-range.patch
|
||||
Patch2: 0002-lldpd-limit-tx-ttl-to-65535.patch
|
||||
Patch3: 0003-lldpd-fix-ttl-range.patch
|
||||
Patch4: 0004-client-fix-tx-hold.patch
|
||||
|
||||
BuildRequires: readline-devel
|
||||
BuildRequires: check-devel
|
||||
BuildRequires: net-snmp-devel
|
||||
BuildRequires: gcc
|
||||
BuildRequires: libxml2-devel
|
||||
# EL6 needs libevent2 as the package
|
||||
%if 0%{?el6}
|
||||
BuildRequires: libevent2-devel
|
||||
%else
|
||||
BuildRequires: libevent-devel
|
||||
%endif
|
||||
|
||||
%if 0%{?with_systemd}
|
||||
# For systemd stuff
|
||||
BuildRequires: systemd
|
||||
BuildRequires: make
|
||||
BuildRequires: net-snmp-devel
|
||||
BuildRequires: readline-devel
|
||||
BuildRequires: systemd-rpm-macros
|
||||
%{?systemd_requires}
|
||||
%else
|
||||
Requires(post): chkconfig
|
||||
Requires(preun): chkconfig
|
||||
# This is for /sbin/service
|
||||
Requires(preun): initscripts
|
||||
%endif
|
||||
%{?sysusers_requires_compat}
|
||||
|
||||
Requires(pre): shadow-utils
|
||||
|
||||
@ -60,106 +45,69 @@ Summary: %{summary}
|
||||
%{name} development libraries and headers
|
||||
|
||||
%prep
|
||||
%autosetup
|
||||
|
||||
%autosetup -p1
|
||||
|
||||
%build
|
||||
%configure --disable-static --with-snmp --disable-silent-rules \
|
||||
--with-privsep-user=%{name} --with-privsep-group=%{name} \
|
||||
--with-privsep-chroot=%{rundir}%{name}/chroot \
|
||||
--with-lldpd-ctl-socket=%{rundir}%{name}/%{name}.socket \
|
||||
%if 0%{?with_systemd}
|
||||
--with-privsep-chroot=%{_rundir}/%{name}/chroot \
|
||||
--with-lldpd-ctl-socket=%{_rundir}/%{name}/%{name}.socket \
|
||||
--with-systemdsystemunitdir=%{_unitdir} --with-sysusersdir=no
|
||||
%endif
|
||||
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%make_build
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
||||
%if 0%{?with_systemd}
|
||||
%if 0%{?fedora} >= 26
|
||||
install -p -D -m644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
|
||||
%else
|
||||
install -p -D -m644 %{SOURCE5} %{buildroot}%{_unitdir}/%{name}.service
|
||||
%endif
|
||||
install -p -D -m644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/%{name}.conf
|
||||
%else
|
||||
install -p -D -m755 %{SOURCE4} %{buildroot}%{_initddir}/%{name}
|
||||
%endif
|
||||
install -p -D -m644 %{SOURCE3} %{buildroot}/etc/sysconfig/%{name}
|
||||
install -p -D -m644 %{SOURCE4} %{buildroot}%{_sysusersdir}/%{name}.conf
|
||||
|
||||
install -d -D -m 0755 %{buildroot}%{rundir}%{name}/chroot
|
||||
install -d -D -m 0755 %{buildroot}%{_rundir}/%{name}/chroot
|
||||
install -d -m 0755 %{buildroot}%{_sharedstatedir}/%{name}
|
||||
# remove the docs from buildroot
|
||||
rm -rf %{buildroot}/usr/share/doc/%{name}
|
||||
|
||||
|
||||
# don't include completion conf yet
|
||||
rm -f %{buildroot}/usr/share/bash-completion/completions/lldpcli
|
||||
rm -f %{buildroot}/usr/share/zsh/vendor-completions/_lldpcli
|
||||
rm -f %{buildroot}/usr/share/zsh/site-functions/_lldpcli
|
||||
|
||||
# remove static libtool archive
|
||||
rm -f %{buildroot}%{_libdir}/liblldpctl.la
|
||||
find %{buildroot} -type f -name "*.la" -delete
|
||||
|
||||
%ldconfig_scriptlets
|
||||
|
||||
%pre
|
||||
getent group %{name} >/dev/null || groupadd -r %{name}
|
||||
getent passwd %{name} >/dev/null || \
|
||||
useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \
|
||||
-c "Used by the %{name} daemon" %{name}
|
||||
exit 0
|
||||
%sysusers_create_compat %{SOURCE4}
|
||||
|
||||
%post
|
||||
/sbin/ldconfig
|
||||
%if 0%{?with_systemd}
|
||||
%systemd_post %{name}.service
|
||||
%else
|
||||
# This adds the proper /etc/rc*.d links for the script
|
||||
/sbin/chkconfig --add %{name}
|
||||
%endif
|
||||
|
||||
%preun
|
||||
%if 0%{?with_systemd}
|
||||
%systemd_preun %{name}.service
|
||||
%else
|
||||
if [ $1 -eq 0 ] ; then
|
||||
/sbin/service %{name} stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del %{name}
|
||||
fi
|
||||
%endif
|
||||
|
||||
%postun
|
||||
/sbin/ldconfig
|
||||
%if 0%{?with_systemd}
|
||||
%systemd_postun_with_restart %{name}.service
|
||||
%else
|
||||
if [ "$1" -ge "1" ] ; then
|
||||
/sbin/service %{name} condrestart >/dev/null 2>&1 || :
|
||||
fi
|
||||
%endif
|
||||
|
||||
%files
|
||||
%doc NEWS README.md
|
||||
%license LICENSE
|
||||
%doc NEWS README.md
|
||||
%config %{_sysconfdir}/%{name}.d
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
||||
%{_sbindir}/lldpcli
|
||||
%{_sbindir}/lldpctl
|
||||
%{_sbindir}/%{name}
|
||||
%config %{_sysconfdir}/%{name}.d
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
||||
%{_mandir}/man8/lldpcli.8*
|
||||
%{_mandir}/man8/lldpctl.8*
|
||||
%{_mandir}/man8/%{name}.8*
|
||||
%{_libdir}/liblldpctl.so.4*
|
||||
%dir %{rundir}%{name}
|
||||
%dir %{rundir}%{name}/chroot
|
||||
%if 0%{?with_systemd}
|
||||
%dir %{_rundir}/%{name}
|
||||
%dir %{_rundir}/%{name}/chroot
|
||||
%{_unitdir}/%{name}.service
|
||||
%{_tmpfilesdir}/%{name}.conf
|
||||
%else
|
||||
%{_initddir}/%{name}
|
||||
%endif
|
||||
%{_sysusersdir}/%{name}.conf
|
||||
%dir %attr(-,lldpd,lldpd) %{_sharedstatedir}/%{name}
|
||||
|
||||
%files devel
|
||||
@ -168,16 +116,74 @@ fi
|
||||
%{_libdir}/liblldpctl.so
|
||||
%{_libdir}/pkgconfig/lldpctl.pc
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Nov 06 2023 Hangbin Liu <haliu@redhat.com> - 1.0.17-2
|
||||
- Fix liblldpctl version [RHEL-2211]
|
||||
* Mon Dec 9 2024 Hangbin Liu <haliu@redhat.com> - 1.0.18-6
|
||||
- Add range checking for tx-interval and tx-hold [RHEL-40245]
|
||||
|
||||
* Wed Oct 16 2024 Hangbin Liu <haliu@redhat.com> - 1.0.18-5
|
||||
- Add range checking for tx-interval and tx-hold [RHEL-40245]
|
||||
|
||||
* Tue Mar 26 2024 Hangbin Liu <haliu@redhat.com> - 1.0.18-4
|
||||
- lldpd use systemd-sysusers [RHEL-5787]
|
||||
|
||||
* Mon May 20 2024 Hangbin Liu <haliu@redhat.com> - 1.0.18-3
|
||||
- Add lldpd-devel package [RHEL-22127]
|
||||
|
||||
* Sun Feb 18 2024 Hangbin Liu <haliu@redhat.com> - 1.0.18-2
|
||||
- Remove networkd gating test [RHEL-25990]
|
||||
|
||||
* Wed Jan 31 2024 Hangbin Liu <haliu@redhat.com> - 1.0.18-1
|
||||
- Rebased to 1.0.18 [RHEL-2211]
|
||||
|
||||
* Mon Nov 06 2023 Hangbin Liu <haliu@redhat.com> - 1.0.17-1
|
||||
- Rebased to 1.0.17 [RHEL-2211]
|
||||
- Rebased to 1.0.17 [RHEL-2211, RHEL-5791, RHEL-5796]
|
||||
|
||||
* Thu Aug 09 2018 Josef Ridky <jridky@redhat.com> - 1.0.1-2
|
||||
- Rebuild for Net-SNMP
|
||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.0.4-10
|
||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||
Related: rhbz#1991688
|
||||
|
||||
* Mon Jul 12 2021 Aaron Conole <aconole@redhat.com> - 1.0.4-9
|
||||
- Strip ASL components (#1982259)
|
||||
|
||||
* Tue Jun 22 2021 Mohan Boddu <mboddu@redhat.com> - 1.0.4-8
|
||||
- Rebuilt for RHEL 9 BETA for openssl 3.0
|
||||
Related: rhbz#1971065
|
||||
|
||||
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.0.4-7
|
||||
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Tue Sep 29 20:35:23 CEST 2020 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.0.4-5
|
||||
- Rebuilt for libevent 2.1.12
|
||||
|
||||
* Wed Sep 02 2020 Josef Ridky <jridky@redhat.com> - 1.0.4-4
|
||||
- Rebuilt for new net-snmp release
|
||||
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Tue Aug 13 2019 James Hogarth <james.hogarth@gmail.com> - 1.0.4-1
|
||||
- Updated to new upstream release 1.0.4
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.0.1-5
|
||||
- Rebuild for readline 8.0
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Tue Jul 24 2018 Adam Williamson <awilliam@redhat.com> - 1.0.1-3
|
||||
- Rebuild for new net-snmp
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Tue Apr 17 2018 James Hogarth <james.hogarth@gmail.com> - 1.0.1-1
|
||||
- Update to 1.0.1
|
104
lldpd-el6.init
104
lldpd-el6.init
@ -1,104 +0,0 @@
|
||||
#!/bin/bash
|
||||
# lldpd init file
|
||||
#
|
||||
# chkconfig: - 60 20
|
||||
# description: 802.1ab (LLDP) daemon
|
||||
#
|
||||
# processname: lldpd
|
||||
# pidfile: /var/run/lldpd.pid
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: lldpd
|
||||
# Required-Start: $local_fs $remote_fs
|
||||
# Required-Stop: $local_fs $remote_fs
|
||||
# Should-Start: $syslog $network $net-snmp
|
||||
# Should-Stop: $syslog $network $net-snmp
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: LLDP daemon
|
||||
# Description: 802.1ab (LLDP) daemon
|
||||
### END INIT INFO
|
||||
|
||||
# source function library
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
exec="/usr/sbin/lldpd"
|
||||
prog="lldpd"
|
||||
config="/etc/lldpd.d"
|
||||
|
||||
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
|
||||
|
||||
lockfile=/var/lock/subsys/$prog
|
||||
|
||||
start() {
|
||||
[ -x $exec ] || exit 4
|
||||
[ -d $config ] || exit 6
|
||||
echo -n $"Starting $prog: "
|
||||
daemon $exec $LLDPD_OPTIONS
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
killproc $exec
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && rm -f $lockfile
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
force_reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
rh_status() {
|
||||
# run checks to determine if the service is running or use generic status
|
||||
status $prog
|
||||
}
|
||||
|
||||
rh_status_q() {
|
||||
rh_status >/dev/null 2>&1
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
rh_status_q && exit 0
|
||||
$1
|
||||
;;
|
||||
stop)
|
||||
rh_status_q || exit 0
|
||||
$1
|
||||
;;
|
||||
restart)
|
||||
$1
|
||||
;;
|
||||
reload)
|
||||
rh_status_q || exit 7
|
||||
$1
|
||||
;;
|
||||
force-reload)
|
||||
force_reload
|
||||
;;
|
||||
status)
|
||||
rh_status
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
rh_status_q || exit 0
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
exit 2
|
||||
esac
|
||||
exit $?
|
@ -1,23 +0,0 @@
|
||||
[Unit]
|
||||
Description=LLDP daemon
|
||||
Documentation=man:lldpd(8)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
NotifyAccess=main
|
||||
EnvironmentFile=-/etc/sysconfig/lldpd
|
||||
ExecStart=/usr/sbin/lldpd $DAEMON_ARGS $LLDPD_OPTIONS
|
||||
Restart=on-failure
|
||||
PrivateTmp=yes
|
||||
RestrictAddressFamilies=AF_INET AF_INET6 AF_PACKET AF_NETLINK AF_UNIX
|
||||
ProtectHome=yes
|
||||
ReadWritePaths=/var/run/lldpd
|
||||
ProtectSystem=strict
|
||||
ProtectKernelTunables=yes
|
||||
ProtectControlGroups=yes
|
||||
ProtectKernelModules=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
Loading…
Reference in New Issue
Block a user