#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>
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.");
# include <errno.h>
# include <arpa/inet.h>
# include <fnmatch.h>
+# include <sys/param.h>
static int seq = 0;
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) {
# 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)" },
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;