struct lldpd_port *port;
TAILQ_FOREACH(hardware, &cfg->g_hardware, h_entries) {
TAILQ_FOREACH(port, &hardware->h_rports, p_entries) {
+ if (now + port->p_chassis->c_ttl >= port->p_lastupdate) {
+ tv.tv_sec = 0;
+ break;
+ }
next = port->p_chassis->c_ttl - (now - port->p_lastupdate);
- if (next >= 0 && next < tv.tv_sec)
+ if (next < tv.tv_sec)
tv.tv_sec = next;
}
}
const char dot3[] = LLDP_TLV_ORG_DOT3;
const char med[] = LLDP_TLV_ORG_MED;
char orgid[3];
- int length, gotend = 0;
+ int length, gotend = 0, ttl_received = 0;
int tlv_size, tlv_type, tlv_subtype;
u_int8_t *pos, *tlv;
char *b;
case LLDP_TLV_TTL:
CHECK_TLV_SIZE(2, "TTL");
chassis->c_ttl = PEEK_UINT16;
+ ttl_received = 1;
break;
case LLDP_TLV_PORT_DESCR:
case LLDP_TLV_SYSTEM_NAME:
/* Some random check */
if ((chassis->c_id == NULL) ||
(port->p_id == NULL) ||
- (chassis->c_ttl == 0) ||
+ (!ttl_received) ||
(gotend == 0)) {
log_warnx("lldp", "some mandatory tlv are missing for frame received on %s",
hardware->h_ifname);
port_next = TAILQ_NEXT(port, p_entries);
del = all;
if (!all && expire &&
- (now - port->p_lastupdate >= port->p_chassis->c_ttl)) {
+ (now >= port->p_lastupdate + port->p_chassis->c_ttl)) {
hardware->h_ageout_cnt++;
hardware->h_delete_cnt++;
del = 1;