Skip to content

Commit

Permalink
Bug #83/#89: Print even more data
Browse files Browse the repository at this point in the history
  • Loading branch information
ydahhrk committed Feb 3, 2023
1 parent dacf438 commit dd3b144
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/output_printer.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ print_roa_csv(struct vrp const *vrp, void *arg)
{
FILE *out = arg;

if (vrp->addr_fam != AF_INET && vrp->addr_fam != AF_INET6)
pr_crit("Unknown family type");
if (vrp->addr_fam != AF_INET && vrp->addr_fam != AF_INET6) {
/* pr_crit("Unknown family type"); TODO (issue83) */
return 0;
}

fprintf(out, "AS%u,%s/%u,%u\n", vrp->asn,
inet_ntop(vrp->addr_fam, &vrp->prefix, addr_buf, INET6_ADDRSTRLEN),
Expand Down
27 changes: 21 additions & 6 deletions src/rtr/db/db_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,34 @@ add_roa_deltas(struct hashable_roa *roas1, struct hashable_roa *roas2,
void
find_bad_vrp(char const *prefix, struct db_table *table)
{
struct hashable_roa *cursor;
struct hashable_roa *node;
struct hashable_roa *tmp;
uint8_t family;
struct vrp const *vrp;
unsigned int roa_counter;
unsigned int roa_count;
char buffer[INET6_ADDRSTRLEN];

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);
roa_counter = 0;
roa_count = HASH_COUNT(table->roas);

HASH_ITER(hh, table->roas, node, tmp) {
vrp = &node->data;
if (vrp->addr_fam != AF_INET && vrp->addr_fam != AF_INET6) {
pr_op_err("%s: VRP corrupted! [%u %s/%u-%u %u] %u/%u",
prefix,
vrp->asn,
addr2str6(&vrp->prefix.v6, buffer),
vrp->prefix_length,
vrp->max_prefix_length,
vrp->addr_fam,
roa_counter,
roa_count);
return;
}
roa_counter++;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/rtr/db/delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ deltas_add_roa(struct deltas *deltas, struct vrp const *vrp, int op,
return deltas_v6_add(get_deltas_array6(deltas, op), &delta.v6);
}

pr_val_err("Unknown protocol: [%u %s/%u-%u %u] %c %u %u",
pr_val_err("Unknown protocol: [%u %s/%u-%u %u] %c %u/%u",
vrp->asn,
addr2str6(&vrp->prefix.v6, buffer),
vrp->prefix_length,
Expand Down

0 comments on commit dd3b144

Please sign in to comment.