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
|
|
|
|
|
|
|
|
#include "lib/krt.h"
|
|
|
|
|
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
|
|
|
|
1998-12-07 01:40:42 +08:00
|
|
|
CF_DECLS
|
|
|
|
|
2010-04-04 21:41:31 +08:00
|
|
|
CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE, ROUTES)
|
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 '}')
|
|
|
|
|
|
|
|
kern_proto_start: proto_start KERNEL {
|
1999-08-04 03:33:22 +08:00
|
|
|
#ifndef CONFIG_MULTIPLE_TABLES
|
1999-03-27 05:44:38 +08:00
|
|
|
if (cf_krt)
|
|
|
|
cf_error("Kernel protocol already defined");
|
1999-08-04 03:33:22 +08:00
|
|
|
#endif
|
2011-11-07 07:31:23 +08:00
|
|
|
cf_krt = this_proto = proto_config_new(&proto_unix_kernel, sizeof(struct krt_config), $1);
|
1999-03-27 05:44:38 +08:00
|
|
|
THIS_KRT->scan_time = 60;
|
|
|
|
THIS_KRT->learn = THIS_KRT->persist = 0;
|
1999-08-04 03:33:22 +08:00
|
|
|
krt_scan_construct(THIS_KRT);
|
|
|
|
krt_set_construct(THIS_KRT);
|
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 '{')
|
1998-12-07 01:40:42 +08:00
|
|
|
CF_ADDTO(kern_proto, kern_proto proto_item ';')
|
1999-03-04 03:49:56 +08: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 21:05:18 +08: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 21:41:31 +08:00
|
|
|
| DEVICE ROUTES bool { THIS_KRT->devroutes = $3; }
|
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 '}')
|
|
|
|
|
|
|
|
kif_proto_start: proto_start DEVICE {
|
|
|
|
if (cf_kif)
|
|
|
|
cf_error("Kernel device protocol already defined");
|
2011-11-07 07:31:23 +08:00
|
|
|
cf_kif = this_proto = proto_config_new(&proto_unix_iface, sizeof(struct kif_config), $1);
|
1999-03-27 05:44:38 +08:00
|
|
|
THIS_KIF->scan_time = 60;
|
2009-05-29 19:32:24 +08:00
|
|
|
init_list(&THIS_KIF->primary);
|
1999-08-04 03:33:22 +08:00
|
|
|
krt_if_construct(THIS_KIF);
|
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 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;
|
|
|
|
}
|
2009-05-30 04:49:30 +08:00
|
|
|
| PRIMARY text_or_none prefix_or_ipa {
|
2009-05-29 19:32:24 +08:00
|
|
|
struct kif_primary_item *kpi = cfg_alloc(sizeof (struct kif_primary_item));
|
|
|
|
kpi->pattern = $2;
|
|
|
|
kpi->prefix = $3.addr;
|
|
|
|
kpi->pxlen = $3.len;
|
|
|
|
add_tail(&THIS_KIF->primary, &kpi->n);
|
|
|
|
}
|
1999-03-27 05:44:38 +08:00
|
|
|
;
|
|
|
|
|
1998-12-07 01:40:42 +08:00
|
|
|
CF_CODE
|
|
|
|
|
|
|
|
CF_END
|