isisd: use time_t for last update and last flap

These variables are only assigned with time() which returns time_t.
This should also fix occasional CI build failures because of comparisons
of signed and unsigned integers.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
Igor Ryzhov 2021-11-03 12:40:40 +03:00
parent 0ac8055ca1
commit ac716cdffd
3 changed files with 5 additions and 7 deletions

View File

@ -480,8 +480,7 @@ void isis_adj_print_vty(struct isis_adjacency *adj, struct vty *vty,
vty_out(vty, "%-13s", adj_state2string(adj->adj_state)); vty_out(vty, "%-13s", adj_state2string(adj->adj_state));
now = time(NULL); now = time(NULL);
if (adj->last_upd) { if (adj->last_upd) {
if (adj->last_upd + adj->hold_time if (adj->last_upd + adj->hold_time < now)
< (unsigned long long)now)
vty_out(vty, " Expiring"); vty_out(vty, " Expiring");
else else
vty_out(vty, " %-9llu", vty_out(vty, " %-9llu",
@ -508,8 +507,7 @@ void isis_adj_print_vty(struct isis_adjacency *adj, struct vty *vty,
vty_out(vty, ", State: %s", adj_state2string(adj->adj_state)); vty_out(vty, ", State: %s", adj_state2string(adj->adj_state));
now = time(NULL); now = time(NULL);
if (adj->last_upd) { if (adj->last_upd) {
if (adj->last_upd + adj->hold_time if (adj->last_upd + adj->hold_time < now)
< (unsigned long long)now)
vty_out(vty, " Expiring"); vty_out(vty, " Expiring");
else else
vty_out(vty, ", Expires in %s", vty_out(vty, ", Expires in %s",

View File

@ -96,8 +96,8 @@ struct isis_adjacency {
int level; /* level (1 or 2) */ int level; /* level (1 or 2) */
enum isis_system_type sys_type; /* neighbourSystemType */ enum isis_system_type sys_type; /* neighbourSystemType */
uint16_t hold_time; /* entryRemainingTime */ uint16_t hold_time; /* entryRemainingTime */
uint32_t last_upd; time_t last_upd;
uint32_t last_flap; /* last time the adj flapped */ time_t last_flap; /* last time the adj flapped */
enum isis_threeway_state threeway_state; enum isis_threeway_state threeway_state;
uint32_t ext_circuit_id; uint32_t ext_circuit_id;
int flaps; /* number of adjacency flaps */ int flaps; /* number of adjacency flaps */

View File

@ -2571,7 +2571,7 @@ static uint8_t *isis_snmp_find_isadj(struct variable *v, oid *name,
*/ */
if (adj->last_upd != 0) { if (adj->last_upd != 0) {
val = time(NULL); val = time(NULL);
if (val < ((time_t)adj->last_upd + (time_t)adj->hold_time)) if (val < (adj->last_upd + adj->hold_time))
return SNMP_INTEGER(adj->last_upd return SNMP_INTEGER(adj->last_upd
+ adj->hold_time - val); + adj->hold_time - val);
} }