]> git.ipfire.org Git - thirdparty/bird.git/blob - sysdep/unix/krt.Y
BGP graceful restart support.
[thirdparty/bird.git] / sysdep / unix / krt.Y
1 /*
2 * BIRD -- UNIX Kernel Syncer Configuration
3 *
4 * (c) 1998--2000 Martin Mares <mj@ucw.cz>
5 *
6 * Can be freely distributed and used under the terms of the GNU GPL.
7 */
8
9 CF_HDR
10
11 #include "lib/krt.h"
12
13 CF_DEFINES
14
15 #define THIS_KRT ((struct krt_config *) this_proto)
16 #define THIS_KIF ((struct kif_config *) this_proto)
17
18 CF_DECLS
19
20 CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE, ROUTES, GRACEFUL, RESTART, KRT_SOURCE, KRT_METRIC)
21
22 CF_GRAMMAR
23
24 /* Kernel syncer protocol */
25
26 CF_ADDTO(proto, kern_proto '}')
27
28 kern_proto_start: proto_start KERNEL { this_proto = krt_init_config($1); }
29 ;
30
31 CF_ADDTO(kern_proto, kern_proto_start proto_name '{')
32 CF_ADDTO(kern_proto, kern_proto proto_item ';')
33 CF_ADDTO(kern_proto, kern_proto kern_item ';')
34
35 kern_item:
36 PERSIST bool { THIS_KRT->persist = $2; }
37 | SCAN TIME expr {
38 /* Scan time of 0 means scan on startup only */
39 THIS_KRT->scan_time = $3;
40 }
41 | LEARN bool {
42 THIS_KRT->learn = $2;
43 #ifndef KRT_ALLOW_LEARN
44 if ($2)
45 cf_error("Learning of kernel routes not supported in this configuration");
46 #endif
47 }
48 | DEVICE ROUTES bool { THIS_KRT->devroutes = $3; }
49 | GRACEFUL RESTART bool { THIS_KRT->graceful_restart = $3; }
50 ;
51
52 /* Kernel interface protocol */
53
54 CF_ADDTO(proto, kif_proto '}')
55
56 kif_proto_start: proto_start DEVICE { this_proto = kif_init_config($1); }
57 ;
58
59 CF_ADDTO(kif_proto, kif_proto_start proto_name '{')
60 CF_ADDTO(kif_proto, kif_proto proto_item ';')
61 CF_ADDTO(kif_proto, kif_proto kif_item ';')
62
63 kif_item:
64 SCAN TIME expr {
65 /* Scan time of 0 means scan on startup only */
66 THIS_KIF->scan_time = $3;
67 }
68 | PRIMARY text_or_none prefix_or_ipa {
69 struct kif_primary_item *kpi = cfg_alloc(sizeof (struct kif_primary_item));
70 kpi->pattern = $2;
71 kpi->prefix = $3.addr;
72 kpi->pxlen = $3.len;
73 add_tail(&THIS_KIF->primary, &kpi->n);
74 }
75 ;
76
77 CF_ADDTO(dynamic_attr, KRT_SOURCE { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_KRT_SOURCE); })
78 CF_ADDTO(dynamic_attr, KRT_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_KRT_METRIC); })
79
80 CF_CODE
81
82 CF_END