KRT: Fix option 'merge paths'
This commit is contained in:
parent
e5ff7929c4
commit
ace3072e09
3 changed files with 10 additions and 12 deletions
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue