]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
KRT: Fix option 'merge paths'
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 23 Jan 2018 14:12:43 +0000 (15:12 +0100)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 23 Jan 2018 14:12:43 +0000 (15:12 +0100)
sysdep/unix/krt.Y
sysdep/unix/krt.c
sysdep/unix/krt.h

index 31f5f1d4b889c1efb8ad6a8c82a33f477f92c8b0..9aac866824ebf832dfbb50cd207e373f415e8898 100644 (file)
@@ -16,16 +16,6 @@ CF_DEFINES
 #define THIS_KIF ((struct kif_config *) this_proto)
 #define KIF_IFACE ((struct kif_iface_config *) this_ipatt)
 
-static void
-krt_set_merge_paths(struct channel_config *cc, uint merge, uint limit)
-{
-  if ((limit <= 0) || (limit > 255))
-    cf_error("Merge paths limit must be in range 1-255");
-
-  cc->ra_mode = merge ? RA_MERGED : RA_OPTIMAL;
-  cc->merge_limit = limit;
-}
-
 static void
 kif_set_preferred(ip_addr ip)
 {
@@ -80,7 +70,7 @@ kern_item:
    }
  | GRACEFUL RESTART bool { THIS_KRT->graceful_restart = $3; }
  | MERGE PATHS bool kern_mp_limit {
-      krt_set_merge_paths(this_channel, $3, $4);
+      THIS_KRT->merge_paths = $3 ? $4 : 0;
 #ifndef KRT_ALLOW_MERGE_PATHS
       if ($3)
        cf_error("Path merging not supported on this platform");
index d4c0db725e7b22d427f672812c5bf19e737f77d0..bfdbfa4e970125a007366aa944661a94ffa5c4e9 100644 (file)
@@ -1059,11 +1059,18 @@ krt_postconfig(struct proto_config *CF)
     cf_error("All kernel syncers must use the same table scan interval");
 #endif
 
-  struct rtable_config *tab = proto_cf_main_channel(CF)->table;
+  struct channel_config *cc = proto_cf_main_channel(CF);
+  struct rtable_config *tab = cc->table;
   if (tab->krt_attached)
     cf_error("Kernel syncer (%s) already attached to table %s", tab->krt_attached->name, tab->name);
   tab->krt_attached = CF;
 
+  if (cf->merge_paths)
+  {
+    cc->ra_mode = RA_MERGED;
+    cc->merge_limit = cf->merge_paths;
+  }
+
   krt_sys_postconfig(cf);
 }
 
index 8d3add0eb3ca132ca089d75179a6cf8a8a989097..b627882d655f42d977c4030c03bdcdc5fe8fb551 100644 (file)
@@ -50,6 +50,7 @@ struct krt_config {
   int persist;                 /* Keep routes when we exit */
   int learn;                   /* Learn routes from other sources */
   int graceful_restart;                /* Regard graceful restart recovery */
+  int merge_paths;             /* Exported routes are merged for ECMP */
 };
 
 struct krt_proto {