return (u_char *)&long_ret;
case LLDP_SNMP_LASTUPDATE:
long_ret = 0;
- TAILQ_FOREACH(hardware, &scfg->g_hardware, h_entries)
- TAILQ_FOREACH(port, &hardware->h_rports, p_entries) {
- if (SMART_HIDDEN(port)) continue;
- if (port->p_lastchange > long_ret)
- long_ret = port->p_lastchange;
+ TAILQ_FOREACH(hardware, &scfg->g_hardware, h_entries) {
+ /* Check if the last removal of a remote port on this local port was the last change. */
+ if (hardware->h_lport.p_lastremove > long_ret)
+ long_ret = hardware->h_lport.p_lastremove;
+ /* Check if any change on the existing remote ports was the last change. */
+ TAILQ_FOREACH(port, &hardware->h_rports, p_entries) {
+ if (SMART_HIDDEN(port)) continue;
+ if (port->p_lastchange > long_ret)
+ long_ret = port->p_lastchange;
+ }
}
if (long_ret)
long_ret = (long_ret - starttime.tv_sec) * 100;
if (!all && expire &&
(now >= port->p_lastupdate + port->p_ttl)) {
hardware->h_ageout_cnt++;
- hardware->h_delete_cnt++;
del = 1;
}
if (del) {
* real list. It is only needed to be called when we
* don't delete the entire list. */
if (!all) TAILQ_REMOVE(&hardware->h_rports, port, p_entries);
+
+ hardware->h_delete_cnt++;
+ /* Register last removal to be able to report lldpStatsRemTablesLastChangeTime */
+ hardware->h_lport.p_lastremove = time(NULL);
lldpd_port_cleanup(port, 1);
free(port);
}
struct lldpd_chassis *p_chassis; /* Attached chassis */
time_t p_lastchange; /* Time of last change of values */
time_t p_lastupdate; /* Time of last update received */
+ time_t p_lastremove; /* Time of last removal of a remote port. Used for local ports only
+ * Used for deciding lldpStatsRemTablesLastChangeTime */
struct lldpd_frame *p_lastframe; /* Frame received during last update */
u_int8_t p_protocol; /* Protocol used to get this port */
u_int8_t p_hidden_in:1; /* Considered as hidden for reception */