Statistics
| Branch: | Revision:

iof-bird-daemon / sysdep / unix / krt.Y @ 04632fd7

History | View | Annotate | Download (2.22 KB)

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
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
 | MERGE PATHS bool { THIS_KRT->merge_paths = $3 ? KRT_DEFAULT_ECMP_LIMIT : 0; }
51
 | MERGE PATHS bool LIMIT expr { THIS_KRT->merge_paths = $3 ? $5 : 0; if (($5 <= 0) || ($5 > 255)) cf_error("Merge paths limit must be in range 1-255"); }
52
 ;
53

    
54
/* Kernel interface protocol */
55

    
56
CF_ADDTO(proto, kif_proto '}')
57

    
58
kif_proto_start: proto_start DEVICE { this_proto = kif_init_config($1); }
59
 ;
60

    
61
CF_ADDTO(kif_proto, kif_proto_start proto_name '{')
62
CF_ADDTO(kif_proto, kif_proto proto_item ';')
63
CF_ADDTO(kif_proto, kif_proto kif_item ';')
64

    
65
kif_item:
66
   SCAN TIME expr {
67
      /* Scan time of 0 means scan on startup only */
68
      THIS_KIF->scan_time = $3;
69
   }
70
 | PRIMARY opttext net_or_ipa {
71
     struct kif_primary_item *kpi = cfg_alloc(sizeof (struct kif_primary_item));
72
     kpi->addr = $3;
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