]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Merge branch 'issue83'
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 30 Jan 2023 21:50:20 +0000 (15:50 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 30 Jan 2023 22:03:18 +0000 (16:03 -0600)
I was hesitant to put this on main because it seemed like a performance
tank, but truth be told, I'm being a wuss. these table iterations are
nothing compared to the amount of time Fort has to spend downloading.

And it looks like I'm never going to find this bug with the stack trace
alone.

Does not fix #83 nor #89, but prevents the crash at least.

1  2 
src/rtr/db/db_table.c

index f18ee15bba6ae0739bfd614eada4b343d8e03539,8fbe21ce9ea5aeaac32000ac49f7beec80c9ba99..a0b85705b8c167705c4d4e56b2088126a1f82045
@@@ -269,6 -269,25 +269,25 @@@ add_roa_deltas(struct hashable_roa *roa
        return 0;
  }
  
 -                      pr_val_err("%s: VRP corrupted!", prefix);
+ void
+ find_bad_vrp(char const *prefix, struct db_table *table)
+ {
+       struct hashable_roa *cursor;
+       struct hashable_roa *tmp;
+       uint8_t family;
+       if (table == NULL)
+               return;
+       HASH_ITER(hh, table->roas, cursor, tmp) {
+               family = cursor->data.addr_fam;
+               if (family != AF_INET && family != AF_INET6) {
++                      pr_op_err("%s: VRP corrupted!", prefix);
+                       return;
+               }
+       }
+ }
  static int
  add_router_key_delta(struct deltas *deltas, struct hashable_key *key, int op)
  {