Revision f4a60a9b sysdep/unix/krt.Y

View differences:

sysdep/unix/krt.Y
15 15
#define THIS_KRT ((struct krt_config *) this_proto)
16 16
#define THIS_KIF ((struct kif_config *) this_proto)
17 17

  
18
static void
19
krt_set_merge_paths(struct channel_config *cc, uint merge, uint limit)
20
{
21
  if ((limit <= 0) || (limit > 255))
22
    cf_error("Merge paths limit must be in range 1-255");
23

  
24
  cc->ra_mode = merge ? RA_MERGED : RA_OPTIMAL;
25
  cc->merge_limit = limit;
26
}
27

  
18 28
CF_DECLS
19 29

  
20 30
CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE, ROUTES, GRACEFUL, RESTART, KRT_SOURCE, KRT_METRIC, MERGE, PATHS)
......
25 35

  
26 36
CF_ADDTO(proto, kern_proto '}')
27 37

  
28
kern_proto_start: proto_start KERNEL { this_proto = krt_init_config($1); }
38
kern_proto_start: proto_start KERNEL {
39
     this_proto = krt_init_config($1);
40
}
29 41
 ;
30 42

  
31 43
CF_ADDTO(kern_proto, kern_proto_start proto_name '{')
32
CF_ADDTO(kern_proto, kern_proto proto_item ';')
33 44
CF_ADDTO(kern_proto, kern_proto kern_item ';')
34 45

  
35 46
kern_item:
36
   PERSIST bool { THIS_KRT->persist = $2; }
47
   proto_item
48
 | proto_channel { this_proto->net_type = $1->net_type; }
49
 | PERSIST bool { THIS_KRT->persist = $2; }
37 50
 | SCAN TIME expr {
38 51
      /* Scan time of 0 means scan on startup only */
39 52
      THIS_KRT->scan_time = $3;
......
47 60
   }
48 61
 | DEVICE ROUTES bool { THIS_KRT->devroutes = $3; }
49 62
 | 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"); }
63
 | MERGE PATHS bool { krt_set_merge_paths(this_channel, $3, KRT_DEFAULT_ECMP_LIMIT); }
64
 | MERGE PATHS bool LIMIT expr { krt_set_merge_paths(this_channel, $3, $5); }
52 65
 ;
53 66

  
54 67
/* Kernel interface protocol */
......
59 72
 ;
60 73

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

  
65 77
kif_item:
66
   SCAN TIME expr {
78
   proto_item
79
 | SCAN TIME expr {
67 80
      /* Scan time of 0 means scan on startup only */
68 81
      THIS_KIF->scan_time = $3;
69 82
   }

Also available in: Unified diff