1998-12-06 17:40:42 +00:00
|
|
|
/*
|
|
|
|
* BIRD -- UNIX Kernel Syncer Configuration
|
|
|
|
*
|
2000-01-17 11:52:50 +00:00
|
|
|
* (c) 1998--2000 Martin Mares <mj@ucw.cz>
|
1998-12-06 17:40:42 +00:00
|
|
|
*
|
|
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
CF_HDR
|
|
|
|
|
|
|
|
#include "lib/krt.h"
|
|
|
|
|
2000-04-28 15:11:10 +00:00
|
|
|
CF_DEFINES
|
|
|
|
|
1999-03-03 19:49:56 +00:00
|
|
|
#define THIS_KRT ((struct krt_config *) this_proto)
|
1999-03-26 21:44:38 +00:00
|
|
|
#define THIS_KIF ((struct kif_config *) this_proto)
|
1999-03-03 19:49:56 +00:00
|
|
|
|
1998-12-06 17:40:42 +00:00
|
|
|
CF_DECLS
|
|
|
|
|
2015-06-08 00:20:43 +00:00
|
|
|
CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE, ROUTES, GRACEFUL, RESTART, KRT_SOURCE, KRT_METRIC, MERGE, PATHS)
|
1998-12-06 17:40:42 +00:00
|
|
|
|
|
|
|
CF_GRAMMAR
|
|
|
|
|
1999-03-26 21:44:38 +00:00
|
|
|
/* Kernel syncer protocol */
|
1998-12-06 17:40:42 +00:00
|
|
|
|
|
|
|
CF_ADDTO(proto, kern_proto '}')
|
|
|
|
|
2012-04-30 13:31:32 +00:00
|
|
|
kern_proto_start: proto_start KERNEL { this_proto = krt_init_config($1); }
|
1998-12-06 17:40:42 +00:00
|
|
|
;
|
|
|
|
|
1999-03-26 21:44:38 +00:00
|
|
|
CF_ADDTO(kern_proto, kern_proto_start proto_name '{')
|
1998-12-06 17:40:42 +00:00
|
|
|
CF_ADDTO(kern_proto, kern_proto proto_item ';')
|
1999-03-03 19:49:56 +00:00
|
|
|
CF_ADDTO(kern_proto, kern_proto kern_item ';')
|
|
|
|
|
|
|
|
kern_item:
|
|
|
|
PERSIST bool { THIS_KRT->persist = $2; }
|
|
|
|
| SCAN TIME expr {
|
|
|
|
/* Scan time of 0 means scan on startup only */
|
|
|
|
THIS_KRT->scan_time = $3;
|
|
|
|
}
|
1999-04-03 13:05:18 +00:00
|
|
|
| LEARN bool {
|
|
|
|
THIS_KRT->learn = $2;
|
|
|
|
#ifndef KRT_ALLOW_LEARN
|
|
|
|
if ($2)
|
|
|
|
cf_error("Learning of kernel routes not supported in this configuration");
|
|
|
|
#endif
|
|
|
|
}
|
2010-04-04 13:41:31 +00:00
|
|
|
| DEVICE ROUTES bool { THIS_KRT->devroutes = $3; }
|
2014-03-20 13:07:12 +00:00
|
|
|
| GRACEFUL RESTART bool { THIS_KRT->graceful_restart = $3; }
|
2015-06-08 00:20:43 +00:00
|
|
|
| MERGE PATHS bool { THIS_KRT->merge_paths = $3 ? KRT_DEFAULT_ECMP_LIMIT : 0; }
|
|
|
|
| MERGE PATHS bool LIMIT expr { THIS_KRT->merge_paths = $3 ? $5 : 0; if (($5 <= 0) || ($5 > 255)) cf_error("Merge paths limit must be in range 1-255"); }
|
1999-03-03 19:49:56 +00:00
|
|
|
;
|
1998-12-06 17:40:42 +00:00
|
|
|
|
1999-03-26 21:44:38 +00:00
|
|
|
/* Kernel interface protocol */
|
|
|
|
|
|
|
|
CF_ADDTO(proto, kif_proto '}')
|
|
|
|
|
2012-04-30 13:31:32 +00:00
|
|
|
kif_proto_start: proto_start DEVICE { this_proto = kif_init_config($1); }
|
1999-03-26 21:44:38 +00:00
|
|
|
;
|
|
|
|
|
2000-01-17 11:52:50 +00:00
|
|
|
CF_ADDTO(kif_proto, kif_proto_start proto_name '{')
|
1999-03-26 21:44:38 +00:00
|
|
|
CF_ADDTO(kif_proto, kif_proto proto_item ';')
|
|
|
|
CF_ADDTO(kif_proto, kif_proto kif_item ';')
|
|
|
|
|
|
|
|
kif_item:
|
|
|
|
SCAN TIME expr {
|
|
|
|
/* Scan time of 0 means scan on startup only */
|
|
|
|
THIS_KIF->scan_time = $3;
|
|
|
|
}
|
2015-11-12 01:03:59 +00:00
|
|
|
| PRIMARY opttext net_or_ipa {
|
2009-05-29 11:32:24 +00:00
|
|
|
struct kif_primary_item *kpi = cfg_alloc(sizeof (struct kif_primary_item));
|
2015-11-12 01:03:59 +00:00
|
|
|
kpi->prefix = IPA_NONE; /* XXXX */
|
|
|
|
kpi->pxlen = 0; /* XXXX */
|
2009-05-29 11:32:24 +00:00
|
|
|
add_tail(&THIS_KIF->primary, &kpi->n);
|
|
|
|
}
|
1999-03-26 21:44:38 +00:00
|
|
|
;
|
|
|
|
|
2012-03-23 00:17:02 +00:00
|
|
|
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); })
|
2012-03-22 23:26:26 +00:00
|
|
|
|
1998-12-06 17:40:42 +00:00
|
|
|
CF_CODE
|
|
|
|
|
|
|
|
CF_END
|