From 7e5f5ffdda7232048c4baf3fdec358afb494a29d Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 26 Mar 1999 21:44:38 +0000 Subject: Moved to a much more systematic way of configuring kernel protocols. o Nothing is configured automatically. You _need_ to specify the kernel syncer in config file in order to get it started. o Syncing has been split to route syncer (protocol "Kernel") and interface syncer (protocol "Device"), device routes are generated by protocol "Direct" (now can exist in multiple instances, so that it will be possible to feed different device routes to different routing tables once multiple tables get supported). See doc/bird.conf.example for a living example of these shiny features. --- sysdep/unix/krt.Y | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) (limited to 'sysdep/unix/krt.Y') diff --git a/sysdep/unix/krt.Y b/sysdep/unix/krt.Y index 661e5052..083df7d6 100644 --- a/sysdep/unix/krt.Y +++ b/sysdep/unix/krt.Y @@ -1,7 +1,7 @@ /* * BIRD -- UNIX Kernel Syncer Configuration * - * (c) 1998 Martin Mares + * (c) 1998--1999 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -11,24 +11,31 @@ CF_HDR #include "lib/krt.h" #define THIS_KRT ((struct krt_config *) this_proto) +#define THIS_KIF ((struct kif_config *) this_proto) CF_DECLS -CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, ROUTE, LEARN) +CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE) CF_GRAMMAR -/* Kernel protocol */ +/* Kernel syncer protocol */ CF_ADDTO(proto, kern_proto '}') kern_proto_start: proto_start KERNEL { - if (!(this_proto = cf_krt)) cf_error("Kernel protocol already defined"); - cf_krt = NULL; + if (cf_krt) + cf_error("Kernel protocol already defined"); + cf_krt = this_proto = proto_config_new(&proto_unix_kernel, sizeof(struct krt_config)); + this_proto->preference = 0; + THIS_KRT->scan_time = 60; + THIS_KRT->learn = THIS_KRT->persist = 0; + krt_scan_preconfig(THIS_KRT); + krt_set_preconfig(THIS_KRT); } ; -CF_ADDTO(kern_proto, kern_proto_start '{') +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 ';') @@ -38,10 +45,34 @@ kern_item: /* Scan time of 0 means scan on startup only */ THIS_KRT->scan_time = $3; } - | ROUTE SCAN TIME expr { THIS_KRT->route_scan_time = $4; } | LEARN bool { THIS_KRT->learn = $2; } ; +/* 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)); + this_proto->preference = DEF_PREF_DIRECT; + THIS_KIF->scan_time = 60; + krt_if_preconfig(THIS_KIF); + } + ; + +CF_ADDTO(kif_proto, kif_proto_start '{') +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; + } + ; + CF_CODE CF_END -- cgit v1.2.3