summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_netns_id.c
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2023-01-19 16:16:11 +0100
committerRafael Zalamena <rzalamena@opensourcerouting.org>2023-01-20 19:40:28 +0100
commitfce7f209fce60f0d8aff7af3df3e0a5434fc456f (patch)
tree5eeb8b5b75b964ddbd3a76379c6c98c6cd5cf560 /zebra/zebra_netns_id.c
parentldpd: fix time truncation (diff)
downloadfrr-fce7f209fce60f0d8aff7af3df3e0a5434fc456f.tar.xz
frr-fce7f209fce60f0d8aff7af3df3e0a5434fc456f.zip
*: 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 'zebra/zebra_netns_id.c')
-rw-r--r--zebra/zebra_netns_id.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/zebra/zebra_netns_id.c b/zebra/zebra_netns_id.c
index 73d585c1a..8905b72ec 100644
--- a/zebra/zebra_netns_id.c
+++ b/zebra/zebra_netns_id.c
@@ -23,6 +23,7 @@
#include "vrf.h"
#include "log.h"
#include "lib_errors.h"
+#include "network.h"
#include "zebra/rib.h"
#include "zebra/zebra_dplane.h"
@@ -73,7 +74,7 @@ static struct nlmsghdr *initiate_nlh(char *buf, unsigned int *seq, int type)
nlh->nlmsg_flags = NLM_F_REQUEST;
if (type == RTM_NEWNSID)
nlh->nlmsg_flags |= NLM_F_ACK;
- nlh->nlmsg_seq = *seq = time(NULL);
+ nlh->nlmsg_seq = *seq = frr_sequence32_next();
return nlh;
}