Annotation of embedaddon/bird/sysdep/unix/krt.Y, revision 1.1.1.1
1.1 misho 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, MERGE, PATHS)
21:
22: %type <i> kern_mp_limit
23:
24: CF_GRAMMAR
25:
26: /* Kernel syncer protocol */
27:
28: CF_ADDTO(proto, kern_proto '}')
29:
30: kern_proto_start: proto_start KERNEL { this_proto = krt_init_config($1); }
31: ;
32:
33: CF_ADDTO(kern_proto, kern_proto_start proto_name '{')
34: CF_ADDTO(kern_proto, kern_proto proto_item ';')
35: CF_ADDTO(kern_proto, kern_proto kern_item ';')
36:
37: kern_mp_limit:
38: /* empty */ { $$ = KRT_DEFAULT_ECMP_LIMIT; }
39: | LIMIT expr { $$ = $2; if (($2 <= 0) || ($2 > 255)) cf_error("Merge paths limit must be in range 1-255"); }
40: ;
41:
42: kern_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: }
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 on this platform");
53: #endif
54: }
55: | DEVICE ROUTES bool { THIS_KRT->devroutes = $3; }
56: | GRACEFUL RESTART bool { THIS_KRT->graceful_restart = $3; }
57: | MERGE PATHS bool kern_mp_limit {
58: THIS_KRT->merge_paths = $3 ? $4 : 0;
59: #ifndef KRT_ALLOW_MERGE_PATHS
60: if ($3)
61: cf_error("Path merging not supported on this platform");
62: #endif
63: }
64: ;
65:
66: /* Kernel interface protocol */
67:
68: CF_ADDTO(proto, kif_proto '}')
69:
70: kif_proto_start: proto_start DEVICE { this_proto = kif_init_config($1); }
71: ;
72:
73: CF_ADDTO(kif_proto, kif_proto_start proto_name '{')
74: CF_ADDTO(kif_proto, kif_proto proto_item ';')
75: CF_ADDTO(kif_proto, kif_proto kif_item ';')
76:
77: kif_item:
78: SCAN TIME expr {
79: /* Scan time of 0 means scan on startup only */
80: THIS_KIF->scan_time = $3;
81: }
82: | PRIMARY text_or_none prefix_or_ipa {
83: struct kif_primary_item *kpi = cfg_alloc(sizeof (struct kif_primary_item));
84: kpi->pattern = $2;
85: kpi->prefix = $3.addr;
86: kpi->pxlen = $3.len;
87: add_tail(&THIS_KIF->primary, &kpi->n);
88: }
89: ;
90:
91: CF_ADDTO(dynamic_attr, KRT_SOURCE { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_KRT_SOURCE); })
92: CF_ADDTO(dynamic_attr, KRT_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_KRT_METRIC); })
93:
94: CF_CODE
95:
96: CF_END
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>