1998-12-07 01:40:42 +08:00
|
|
|
/*
|
|
|
|
* BIRD -- UNIX Kernel Syncer Configuration
|
|
|
|
*
|
2000-01-17 19:52:50 +08:00
|
|
|
* (c) 1998--2000 Martin Mares <mj@ucw.cz>
|
1998-12-07 01:40:42 +08:00
|
|
|
*
|
|
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
CF_HDR
|
|
|
|
|
2016-04-12 17:14:54 +08:00
|
|
|
#include "sysdep/unix/krt.h"
|
1998-12-07 01:40:42 +08:00
|
|
|
|
2000-04-28 23:11:10 +08:00
|
|
|
CF_DEFINES
|
|
|
|
|
1999-03-04 03:49:56 +08:00
|
|
|
#define THIS_KRT ((struct krt_config *) this_proto)
|
1999-03-27 05:44:38 +08:00
|
|
|
#define THIS_KIF ((struct kif_config *) this_proto)
|
1999-03-04 03:49:56 +08:00
|
|
|
|
2016-01-26 18:48:58 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
1998-12-07 01:40:42 +08:00
|
|
|
CF_DECLS
|
|
|
|
|
2015-06-08 08:20:43 +08:00
|
|
|
CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE, ROUTES, GRACEFUL, RESTART, KRT_SOURCE, KRT_METRIC, MERGE, PATHS)
|
1998-12-07 01:40:42 +08:00
|
|
|
|
2016-08-30 18:43:46 +08:00
|
|
|
%type <i> kern_mp_limit
|
|
|
|
|
1998-12-07 01:40:42 +08:00
|
|
|
CF_GRAMMAR
|
|
|
|
|
1999-03-27 05:44:38 +08:00
|
|
|
/* Kernel syncer protocol */
|
1998-12-07 01:40:42 +08:00
|
|
|
|
|
|
|
CF_ADDTO(proto, kern_proto '}')
|
|
|
|
|
2016-01-26 18:48:58 +08:00
|
|
|
kern_proto_start: proto_start KERNEL {
|
|
|
|
this_proto = krt_init_config($1);
|
|
|
|
}
|
1998-12-07 01:40:42 +08:00
|
|
|
;
|
|
|
|
|
1999-03-27 05:44:38 +08:00
|
|
|
CF_ADDTO(kern_proto, kern_proto_start proto_name '{')
|
1999-03-04 03:49:56 +08:00
|
|
|
CF_ADDTO(kern_proto, kern_proto kern_item ';')
|
|
|
|
|
2016-08-30 18:43:46 +08:00
|
|
|
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"); }
|
|
|
|
;
|
|
|
|
|
1999-03-04 03:49:56 +08:00
|
|
|
kern_item:
|
2016-01-26 18:48:58 +08:00
|
|
|
proto_item
|
|
|
|
| proto_channel { this_proto->net_type = $1->net_type; }
|
|
|
|
| PERSIST bool { THIS_KRT->persist = $2; }
|
1999-03-04 03:49:56 +08:00
|
|
|
| SCAN TIME expr {
|
|
|
|
/* Scan time of 0 means scan on startup only */
|
|
|
|
THIS_KRT->scan_time = $3;
|
|
|
|
}
|
1999-04-03 21:05:18 +08:00
|
|
|
| LEARN bool {
|
|
|
|
THIS_KRT->learn = $2;
|
|
|
|
#ifndef KRT_ALLOW_LEARN
|
|
|
|
if ($2)
|
2016-08-30 18:43:46 +08:00
|
|
|
cf_error("Learning of kernel routes not supported on this platform");
|
1999-04-03 21:05:18 +08:00
|
|
|
#endif
|
|
|
|
}
|
2010-04-04 21:41:31 +08:00
|
|
|
| DEVICE ROUTES bool { THIS_KRT->devroutes = $3; }
|
2014-03-20 21:07:12 +08:00
|
|
|
| GRACEFUL RESTART bool { THIS_KRT->graceful_restart = $3; }
|
2016-08-30 18:43:46 +08:00
|
|
|
| MERGE PATHS bool kern_mp_limit {
|
2016-11-09 00:03:31 +08:00
|
|
|
krt_set_merge_paths(this_channel, $3, $4);
|
2016-08-31 20:02:41 +08:00
|
|
|
#ifndef KRT_ALLOW_MERGE_PATHS
|
2016-08-30 18:43:46 +08:00
|
|
|
if ($3)
|
|
|
|
cf_error("Path merging not supported on this platform");
|
|
|
|
#endif
|
|
|
|
}
|
1999-03-04 03:49:56 +08:00
|
|
|
;
|
1998-12-07 01:40:42 +08:00
|
|
|
|
1999-03-27 05:44:38 +08:00
|
|
|
/* Kernel interface protocol */
|
|
|
|
|
|
|
|
CF_ADDTO(proto, kif_proto '}')
|
|
|
|
|
2012-04-30 21:31:32 +08:00
|
|
|
kif_proto_start: proto_start DEVICE { this_proto = kif_init_config($1); }
|
1999-03-27 05:44:38 +08:00
|
|
|
;
|
|
|
|
|
2000-01-17 19:52:50 +08:00
|
|
|
CF_ADDTO(kif_proto, kif_proto_start proto_name '{')
|
1999-03-27 05:44:38 +08:00
|
|
|
CF_ADDTO(kif_proto, kif_proto kif_item ';')
|
|
|
|
|
|
|
|
kif_item:
|
2016-01-26 18:48:58 +08:00
|
|
|
proto_item
|
|
|
|
| SCAN TIME expr {
|
1999-03-27 05:44:38 +08:00
|
|
|
/* Scan time of 0 means scan on startup only */
|
|
|
|
THIS_KIF->scan_time = $3;
|
|
|
|
}
|
2015-11-12 09:03:59 +08:00
|
|
|
| PRIMARY opttext net_or_ipa {
|
2009-05-29 19:32:24 +08:00
|
|
|
struct kif_primary_item *kpi = cfg_alloc(sizeof (struct kif_primary_item));
|
2017-05-03 18:56:17 +08:00
|
|
|
kpi->pattern = $2;
|
2015-12-24 22:52:03 +08:00
|
|
|
kpi->addr = $3;
|
2009-05-29 19:32:24 +08:00
|
|
|
add_tail(&THIS_KIF->primary, &kpi->n);
|
|
|
|
}
|
1999-03-27 05:44:38 +08:00
|
|
|
;
|
|
|
|
|
2012-03-23 08:17:02 +08: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-23 07:26:26 +08:00
|
|
|
|
1998-12-07 01:40:42 +08:00
|
|
|
CF_CODE
|
|
|
|
|
|
|
|
CF_END
|