Commit ace3072e authored by Ondrej Zajicek (work)'s avatar Ondrej Zajicek (work)
Browse files

KRT: Fix option 'merge paths'

parent e5ff7929
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -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");
+8 −1
Original line number Diff line number Diff line
@@ -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);
}

+1 −0
Original line number Diff line number Diff line
@@ -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 {