commit 4505d9aeb869ce46b415e9652b6f1770e88208ad
parent 0a7e6c4b2ab470a786ecfbd97e0e1df07567d527
Author: Robin Bron <robin@finwo.nl>
Date: Mon, 27 Feb 2023 23:13:06 +0100
Added debug print and assert
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/util/routing-table.c b/src/util/routing-table.c
@@ -35,7 +35,9 @@ int rt_upsert(
// Attempt to fetch the rt entry
rt_entry = btree_get(rt, &((struct pmlag_rt_entry){ .mac = mac }));
+ int16_t obcidx = 0;
if (rt_entry) {
+ obcidx = rt_entry->bcidx;
printf(" Found, %d\n", rt_entry->bcidx);
}
@@ -50,6 +52,11 @@ int rt_upsert(
}
printf(" Old bcidx, %d\n", rt_entry->bcidx);
+ if ((!isnew) && (obcidx != rt_entry->bcidx)) {
+ printf(" BORKED\n");
+ exit(1);
+ }
+
// Bail if
if (