CF_DECLS
-CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE, ROUTES)
+CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE, ROUTES, GRACEFUL, RESTART, KRT_SOURCE, KRT_METRIC, MERGE, PATHS)
+
+%type <i> kern_mp_limit
CF_GRAMMAR
CF_ADDTO(proto, kern_proto '}')
-kern_proto_start: proto_start KERNEL {
-#ifndef CONFIG_MULTIPLE_TABLES
- if (cf_krt)
- cf_error("Kernel protocol already defined");
-#endif
- cf_krt = this_proto = proto_config_new(&proto_unix_kernel, sizeof(struct krt_config), $1);
- THIS_KRT->scan_time = 60;
- THIS_KRT->learn = THIS_KRT->persist = 0;
- krt_scan_construct(THIS_KRT);
- krt_set_construct(THIS_KRT);
- }
+kern_proto_start: proto_start KERNEL { this_proto = krt_init_config($1); }
;
CF_ADDTO(kern_proto, kern_proto_start proto_name '{')
CF_ADDTO(kern_proto, kern_proto proto_item ';')
CF_ADDTO(kern_proto, kern_proto kern_item ';')
+kern_mp_limit:
+ /* empty */ { $$ = KRT_DEFAULT_ECMP_LIMIT; }
+ | LIMIT expr { $$ = $2; if (($2 <= 0) || ($2 > 255)) cf_error("Merge paths limit must be in range 1-255"); }
+ ;
+
kern_item:
PERSIST bool { THIS_KRT->persist = $2; }
| SCAN TIME expr {
THIS_KRT->learn = $2;
#ifndef KRT_ALLOW_LEARN
if ($2)
- cf_error("Learning of kernel routes not supported in this configuration");
+ cf_error("Learning of kernel routes not supported on this platform");
#endif
}
| DEVICE ROUTES bool { THIS_KRT->devroutes = $3; }
+ | GRACEFUL RESTART bool { THIS_KRT->graceful_restart = $3; }
+ | MERGE PATHS bool kern_mp_limit {
+ THIS_KRT->merge_paths = $3 ? $4 : 0;
+#ifndef KRT_ALLOW_LEARN
+ if ($3)
+ cf_error("Path merging not supported on this platform");
+#endif
+ }
;
/* Kernel interface protocol */
CF_ADDTO(proto, kif_proto '}')
-kif_proto_start: proto_start DEVICE {
- if (cf_kif)
- cf_error("Kernel device protocol already defined");
- cf_kif = this_proto = proto_config_new(&proto_unix_iface, sizeof(struct kif_config), $1);
- THIS_KIF->scan_time = 60;
- init_list(&THIS_KIF->primary);
- krt_if_construct(THIS_KIF);
- }
+kif_proto_start: proto_start DEVICE { this_proto = kif_init_config($1); }
;
CF_ADDTO(kif_proto, kif_proto_start proto_name '{')
}
;
+CF_ADDTO(dynamic_attr, KRT_SOURCE { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_KRT_SOURCE); })
+CF_ADDTO(dynamic_attr, KRT_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_KRT_METRIC); })
+
CF_CODE
CF_END