#include "lib/memory.h"
#include "lib/queue.h"
#include "lib/zebra.h"
+#include "zebra/zebra_router.h"
#include "zebra/zebra_memory.h"
#include "zebra/zserv.h"
#include "zebra/zebra_dplane.h"
/* Trying out the sequence number idea, so we can try to detect
* when a result is stale.
*/
- re->dplane_sequence++;
+ re->dplane_sequence = zebra_router_get_next_sequence();
ctx->zd_seq = re->dplane_sequence;
ret = AOK;
old_re && (old_re != re)) {
ctx->zd_is_update = true;
- old_re->dplane_sequence++;
+ old_re->dplane_sequence =
+ zebra_router_get_next_sequence();
ctx->zd_old_seq = old_re->dplane_sequence;
ctx->u.rinfo.zd_old_tag = old_re->tag;
*/
#include "zebra.h"
+#include <pthread.h>
+#include "lib/frratomic.h"
+
#include "zebra_router.h"
#include "zebra_memory.h"
#include "zebra_pbr.h"
XFREE(MTYPE_ZEBRA_NS, zrt);
}
+uint32_t zebra_router_get_next_sequence(void)
+{
+ return 1
+ + atomic_fetch_add_explicit(&zrouter.sequence_num, 1,
+ memory_order_relaxed);
+}
+
void zebra_router_terminate(void)
{
struct zebra_router_table *zrt, *tmp;
void zebra_router_init(void)
{
+ zrouter.sequence_num = 0;
+
zebra_vxlan_init();
zebra_mlag_init();
#if defined(HAVE_RTADV)
struct rtadv rtadv;
#endif /* HAVE_RTADV */
+
+ /* A sequence number used for tracking routes */
+ _Atomic uint32_t sequence_num;
};
extern struct zebra_router zrouter;
extern void zebra_router_sweep_route(void);
extern void zebra_router_show_table_summary(struct vty *vty);
+
+extern uint32_t zebra_router_get_next_sequence(void);
#endif