2 * BIRD -- UNIX Kernel Syncer Configuration
4 * (c) 1998--2000 Martin Mares <mj@ucw.cz>
6 * Can be freely distributed and used under the terms of the GNU GPL.
11 #include "sysdep/unix/krt.h"
15 #define THIS_KRT ((struct krt_config *) this_proto)
16 #define THIS_KIF ((struct kif_config *) this_proto)
17 #define KIF_IFACE ((struct kif_iface_config *) this_ipatt)
20 kif_set_preferred(ip_addr ip)
23 KIF_IFACE->pref_v4 = ip;
24 else if (!ipa_is_link_local(ip))
25 KIF_IFACE->pref_v6 = ip;
27 KIF_IFACE->pref_ll = ip;
32 CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE, ROUTES, GRACEFUL, RESTART, KRT_SOURCE, KRT_METRIC, MERGE, PATHS)
33 CF_KEYWORDS(INTERFACE, PREFERRED)
35 %type <i> kern_mp_limit
39 /* Kernel syncer protocol */
41 proto: kern_proto '}' ;
43 kern_proto_start: proto_start KERNEL {
44 this_proto = krt_init_config($1);
48 kern_proto: kern_proto_start proto_name '{' ;
49 kern_proto: kern_proto kern_item ';' ;
52 /* empty */ { $$ = KRT_DEFAULT_ECMP_LIMIT; }
53 | LIMIT expr { $$ = $2; if (($2 <= 0) || ($2 > 255)) cf_error("Merge paths limit must be in range 1-255"); }
58 | proto_channel { this_proto->net_type = $1->net_type; }
59 | PERSIST bool { THIS_KRT->persist = $2; }
61 /* Scan time of 0 means scan on startup only */
62 THIS_KRT->scan_time = $3 S_;
66 #ifndef KRT_ALLOW_LEARN
68 cf_error("Learning of kernel routes not supported on this platform");
71 | GRACEFUL RESTART bool { THIS_KRT->graceful_restart = $3; }
72 | MERGE PATHS bool kern_mp_limit {
73 THIS_KRT->merge_paths = $3 ? $4 : 0;
74 #ifndef KRT_ALLOW_MERGE_PATHS
76 cf_error("Path merging not supported on this platform");
81 /* Kernel interface protocol */
83 proto: kif_proto '}' ;
85 kif_proto_start: proto_start DEVICE { this_proto = kif_init_config($1); }
88 kif_proto: kif_proto_start proto_name '{' ;
89 kif_proto: kif_proto kif_item ';' ;
95 /* Scan time of 0 means scan on startup only */
96 THIS_KIF->scan_time = $3 S_;
102 this_ipatt = cfg_allocz(sizeof(struct kif_iface_config));
103 add_tail(&THIS_KIF->iface_list, NODE this_ipatt);
104 init_list(&this_ipatt->ipn_list);
108 PREFERRED ipa { kif_set_preferred($2); }
113 | kif_iface_opts kif_iface_item ';'
118 | '{' kif_iface_opts '}'
122 kif_iface_start iface_patt_list_nopx kif_iface_opt_list;
125 dynamic_attr: KRT_SOURCE { $$ = f_new_dynamic_attr(EAF_TYPE_INT, 0, T_INT, EA_KRT_SOURCE); } ;
126 dynamic_attr: KRT_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, 0, T_INT, EA_KRT_METRIC); } ;