0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

L3VPN: Fix missing rte_owner_class registration

This commit is contained in:
Ondrej Zajicek 2024-03-28 00:55:19 +01:00
parent 468f1d6547
commit d2a531a92b

View File

@ -338,6 +338,23 @@ l3vpn_rte_better(const rte *new, const rte *old)
return rt_get_igp_metric(new) < rt_get_igp_metric(old); return rt_get_igp_metric(new) < rt_get_igp_metric(old);
} }
static void
l3vpn_get_route_info(const rte *rte, byte *buf)
{
u32 pref = rt_get_preference(rte);
u32 metric = rt_get_igp_metric(rte);
if (metric < IGP_METRIC_UNKNOWN)
bsprintf(buf, " (%u/%u)", pref, metric);
else
bsprintf(buf, " (%u/?)", pref);
}
static struct rte_owner_class l3vpn_rte_owner_class = {
.get_route_info = l3vpn_get_route_info,
.rte_better = l3vpn_rte_better,
};
static void static void
l3vpn_postconfig(struct proto_config *CF) l3vpn_postconfig(struct proto_config *CF)
{ {
@ -395,6 +412,8 @@ l3vpn_init(struct proto_config *CF)
P->preexport = l3vpn_preexport; P->preexport = l3vpn_preexport;
P->reload_routes = l3vpn_reload_routes; P->reload_routes = l3vpn_reload_routes;
P->sources.class = &l3vpn_rte_owner_class;
return P; return P;
} }
@ -483,23 +502,6 @@ l3vpn_copy_config(struct proto_config *dest UNUSED, struct proto_config *src UNU
/* Just a shallow copy, not many items here */ /* Just a shallow copy, not many items here */
} }
static void
l3vpn_get_route_info(const rte *rte, byte *buf)
{
u32 metric = rt_get_igp_metric(rte);
u32 pref = rt_get_preference(rte);
if (metric < IGP_METRIC_UNKNOWN)
bsprintf(buf, " (%u/%u)", pref, metric);
else
bsprintf(buf, " (%u/?)", pref);
}
struct rte_owner_class l3vpn_rte_owner_class = {
.get_route_info = l3vpn_get_route_info,
.rte_better = l3vpn_rte_better,
};
struct protocol proto_l3vpn = { struct protocol proto_l3vpn = {
.name = "L3VPN", .name = "L3VPN",
.template = "l3vpn%d", .template = "l3vpn%d",