lldpd-1.0.18-6
Fix global tx-interval and tx-hold range checking Resolves: RHEL-40245 Signed-off-by: Hangbin Liu <haliu@redhat.com>
This commit is contained in:
parent
7f4bc4b496
commit
56844987f0
83
0003-lldpd-fix-ttl-range.patch
Normal file
83
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
0004-client-fix-tx-hold.patch
Normal file
41
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)
|
||||||
|
|
14
lldpd.spec
14
lldpd.spec
@ -1,6 +1,6 @@
|
|||||||
Name: lldpd
|
Name: lldpd
|
||||||
Version: 1.0.18
|
Version: 1.0.18
|
||||||
Release: 5%{?dist}
|
Release: 6%{?dist}
|
||||||
Summary: ISC-licensed implementation of LLDP
|
Summary: ISC-licensed implementation of LLDP
|
||||||
|
|
||||||
License: ISC
|
License: ISC
|
||||||
@ -13,8 +13,10 @@ Source4: %{name}-systemd-sysusers.conf
|
|||||||
|
|
||||||
Source100: lldpd-cleanup.sh
|
Source100: lldpd-cleanup.sh
|
||||||
|
|
||||||
Patch1: 0001-client-add-range-restriction-for-tx-hold-and-interva.patch
|
Patch1: 0001-client-tx-hold-range.patch
|
||||||
Patch2: 0002-lldpd-limit-tx-ttl-to-65535.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: check-devel
|
BuildRequires: check-devel
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
@ -115,9 +117,15 @@ find %{buildroot} -type f -name "*.la" -delete
|
|||||||
%{_libdir}/pkgconfig/lldpctl.pc
|
%{_libdir}/pkgconfig/lldpctl.pc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed Oct 16 2024 Hangbin Liu <haliu@redhat.com> - 1.0.18-4
|
* Mon Dec 9 2024 Hangbin Liu <haliu@redhat.com> - 1.0.18-6
|
||||||
- Add range checking for tx-interval and tx-hold [RHEL-40245]
|
- 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
|
* Mon May 20 2024 Hangbin Liu <haliu@redhat.com> - 1.0.18-3
|
||||||
- Add lldpd-devel package [RHEL-22127]
|
- Add lldpd-devel package [RHEL-22127]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user