]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
L3VPN: Fix missing rte_owner_class registration
authorOndrej Zajicek <santiago@crfreenet.org>
Wed, 27 Mar 2024 23:55:19 +0000 (00:55 +0100)
committerOndrej Zajicek <santiago@crfreenet.org>
Wed, 27 Mar 2024 23:55:19 +0000 (00:55 +0100)
proto/l3vpn/l3vpn.c

index 19e3b3894ddfb84d70b6939df40df9520c251d65..8b9fb9f49f70d38afdc0faa6e39eab1b4683fef6 100644 (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);
 }
 
+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
 l3vpn_postconfig(struct proto_config *CF)
 {
@@ -395,6 +412,8 @@ l3vpn_init(struct proto_config *CF)
   P->preexport = l3vpn_preexport;
   P->reload_routes = l3vpn_reload_routes;
 
+  P->sources.class = &l3vpn_rte_owner_class;
+
   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 */
 }
 
-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 = {
   .name =              "L3VPN",
   .template =          "l3vpn%d",