1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Merge commit 'de70474fed139f9acb4ed3f8e925d12de4edcdd0' into thread-next

This commit is contained in:
Maria Matejka
2023-10-31 09:58:42 +01:00
9 changed files with 98 additions and 66 deletions

View File

@@ -60,6 +60,8 @@ static const char * const f_type_str[] = {
[T_LCLIST] = "lclist",
[T_RD] = "rd",
[T_ROUTE] = "route",
[T_SET] = "set",
[T_PREFIX_SET] = "prefix set",
};
@@ -200,6 +202,7 @@ val_compare(const struct f_val *v1, const struct f_val *v2)
return net_compare(v1->val.net, v2->val.net);
case T_STRING:
return strcmp(v1->val.s, v2->val.s);
case T_ROUTE:
default:
return F_CMP_ERROR;
}
@@ -290,6 +293,8 @@ val_same(const struct f_val *v1, const struct f_val *v2)
return same_tree(v1->val.t, v2->val.t);
case T_PREFIX_SET:
return trie_same(v1->val.ti, v2->val.ti);
case T_ROUTE:
return rte_same(v1->val.rte, v2->val.rte);
default:
bug("Invalid type in val_same(): %x", v1->type);
}
@@ -563,6 +568,21 @@ val_in_range(const struct f_val *v1, const struct f_val *v2)
return F_CMP_ERROR;
}
/*
* rte_format - format route information
*/
static void
rte_format(const struct rte *rte, buffer *buf)
{
if (rte)
buffer_print(buf, "Route [%d] to %N from %s via %s",
rte->src->global_id, rte->net,
rte->sender->req->name,
rte->src->owner->name);
else
buffer_puts(buf, "[No route]");
}
/*
* val_format - format filter value
*/
@@ -592,6 +612,7 @@ val_format(const struct f_val *v, buffer *buf)
case T_ECLIST: ec_set_format(v->val.ad, -1, buf2, 1000); buffer_print(buf, "(eclist %s)", buf2); return;
case T_LCLIST: lc_set_format(v->val.ad, -1, buf2, 1000); buffer_print(buf, "(lclist %s)", buf2); return;
case T_PATH_MASK: pm_format(v->val.path_mask, buf); return;
case T_ROUTE: rte_format(v->val.rte, buf); return;
default: buffer_print(buf, "[unknown type %x]", v->type); return;
}
}