]> git.ipfire.org Git - thirdparty/bird.git/blame - sysdep/unix/krt.Y
More changes to the kernel syncer.
[thirdparty/bird.git] / sysdep / unix / krt.Y
CommitLineData
980ffedb
MM
1/*
2 * BIRD -- UNIX Kernel Syncer Configuration
3 *
7e5f5ffd 4 * (c) 1998--1999 Martin Mares <mj@ucw.cz>
980ffedb
MM
5 *
6 * Can be freely distributed and used under the terms of the GNU GPL.
7 */
8
9CF_HDR
10
11#include "lib/krt.h"
12
2d140452 13#define THIS_KRT ((struct krt_config *) this_proto)
7e5f5ffd 14#define THIS_KIF ((struct kif_config *) this_proto)
2d140452 15
980ffedb
MM
16CF_DECLS
17
7e5f5ffd 18CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE)
980ffedb
MM
19
20CF_GRAMMAR
21
7e5f5ffd 22/* Kernel syncer protocol */
980ffedb
MM
23
24CF_ADDTO(proto, kern_proto '}')
25
26kern_proto_start: proto_start KERNEL {
7e5f5ffd
MM
27 if (cf_krt)
28 cf_error("Kernel protocol already defined");
29 cf_krt = this_proto = proto_config_new(&proto_unix_kernel, sizeof(struct krt_config));
30 this_proto->preference = 0;
31 THIS_KRT->scan_time = 60;
32 THIS_KRT->learn = THIS_KRT->persist = 0;
33 krt_scan_preconfig(THIS_KRT);
34 krt_set_preconfig(THIS_KRT);
980ffedb
MM
35 }
36 ;
37
7e5f5ffd 38CF_ADDTO(kern_proto, kern_proto_start proto_name '{')
980ffedb 39CF_ADDTO(kern_proto, kern_proto proto_item ';')
2d140452
MM
40CF_ADDTO(kern_proto, kern_proto kern_item ';')
41
42kern_item:
43 PERSIST bool { THIS_KRT->persist = $2; }
44 | SCAN TIME expr {
45 /* Scan time of 0 means scan on startup only */
46 THIS_KRT->scan_time = $3;
47 }
c10421d3
MM
48 | LEARN bool {
49 THIS_KRT->learn = $2;
50#ifndef KRT_ALLOW_LEARN
51 if ($2)
52 cf_error("Learning of kernel routes not supported in this configuration");
53#endif
54 }
2d140452 55 ;
980ffedb 56
7e5f5ffd
MM
57/* Kernel interface protocol */
58
59CF_ADDTO(proto, kif_proto '}')
60
61kif_proto_start: proto_start DEVICE {
62 if (cf_kif)
63 cf_error("Kernel device protocol already defined");
64 cf_kif = this_proto = proto_config_new(&proto_unix_iface, sizeof(struct kif_config));
65 this_proto->preference = DEF_PREF_DIRECT;
66 THIS_KIF->scan_time = 60;
67 krt_if_preconfig(THIS_KIF);
68 }
69 ;
70
71CF_ADDTO(kif_proto, kif_proto_start '{')
72CF_ADDTO(kif_proto, kif_proto proto_item ';')
73CF_ADDTO(kif_proto, kif_proto kif_item ';')
74
75kif_item:
76 SCAN TIME expr {
77 /* Scan time of 0 means scan on startup only */
78 THIS_KIF->scan_time = $3;
79 }
80 ;
81
980ffedb
MM
82CF_CODE
83
84CF_END