diff options
| author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2023-01-19 12:16:11 -0300 | 
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2023-01-20 15:40:28 -0300 | 
| commit | fce7f209fce60f0d8aff7af3df3e0a5434fc456f (patch) | |
| tree | 5eeb8b5b75b964ddbd3a76379c6c98c6cd5cf560 /ospf6d | |
| parent | b6ee94b5b1f0a0652455264fa62a92ed5abbf855 (diff) | |
*: introduce function for sequence numbers
Don't directly use `time()` for generating sequence numbers for two
reasons:
1. `time()` can go backwards (due to NTP or time adjustments)
2. Coverity Scan warns every time we truncate a `time_t` variable for
   good reason (verify that we are Y2K38 ready).
Found by Coverity Scan (CID 1519812, 1519786, 1519783 and 1519772)
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'ospf6d')
| -rw-r--r-- | ospf6d/ospf6_message.c | 3 | 
1 files changed, 2 insertions, 1 deletions
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index fb54ebab15..3d29a65d1b 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -28,6 +28,7 @@  #include "linklist.h"  #include "lib_errors.h"  #include "checksum.h" +#include "network.h"  #include "ospf6_proto.h"  #include "ospf6_lsa.h" @@ -2300,7 +2301,7 @@ static uint16_t ospf6_make_dbdesc(struct ospf6_neighbor *on, struct stream *s)  	/* if this is initial one, initialize sequence number for DbDesc */  	if (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT)  	    && (on->dbdesc_seqnum == 0)) { -		on->dbdesc_seqnum = monotime(NULL); +		on->dbdesc_seqnum = frr_sequence32_next();  	}  	/* reserved */  | 
