Revision 153f02da sysdep/unix/krt.Y

View differences:

sysdep/unix/krt.Y
14 14

  
15 15
#define THIS_KRT ((struct krt_config *) this_proto)
16 16
#define THIS_KIF ((struct kif_config *) this_proto)
17
#define KIF_IFACE ((struct kif_iface_config *) this_ipatt)
17 18

  
18 19
static void
19 20
krt_set_merge_paths(struct channel_config *cc, uint merge, uint limit)
......
25 26
  cc->merge_limit = limit;
26 27
}
27 28

  
29
static void
30
kif_set_preferred(ip_addr ip)
31
{
32
  if (ipa_is_ip4(ip))
33
    KIF_IFACE->pref_v4 = ip;
34
  else if (!ipa_is_link_local(ip))
35
    KIF_IFACE->pref_v6 = ip;
36
  else
37
    KIF_IFACE->pref_ll = ip;
38
}
39

  
28 40
CF_DECLS
29 41

  
30 42
CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE, ROUTES, GRACEFUL, RESTART, KRT_SOURCE, KRT_METRIC, MERGE, PATHS)
......
88 100

  
89 101
kif_item:
90 102
   proto_item
103
 | INTERFACE kif_iface
91 104
 | SCAN TIME expr {
92 105
      /* Scan time of 0 means scan on startup only */
93 106
      THIS_KIF->scan_time = $3;
94 107
   }
95
 | PRIMARY opttext net_or_ipa {
96
     struct kif_primary_item *kpi = cfg_alloc(sizeof (struct kif_primary_item));
97
     kpi->pattern = $2;
98
     kpi->addr = $3;
99
     add_tail(&THIS_KIF->primary, &kpi->n);
100
   }
101 108
 ;
102 109

  
110
kif_iface_start:
111
{
112
  this_ipatt = cfg_allocz(sizeof(struct kif_iface_config));
113
  add_tail(&THIS_KIF->iface_list, NODE this_ipatt);
114
  init_list(&this_ipatt->ipn_list);
115
}
116

  
117
kif_iface_item:
118
   PREFERRED ipa { kif_set_preferred($2); }
119
 ;
120

  
121
kif_iface_opts:
122
   /* empty */
123
 | kif_iface_opts kif_iface_item ';'
124
 ;
125

  
126
kif_iface_opt_list:
127
   /* empty */
128
 | '{' kif_iface_opts '}'
129
 ;
130

  
131
kif_iface:
132
  kif_iface_start iface_patt_list_nopx kif_iface_opt_list;
133

  
134

  
103 135
CF_ADDTO(dynamic_attr, KRT_SOURCE { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_KRT_SOURCE); })
104 136
CF_ADDTO(dynamic_attr, KRT_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_KRT_METRIC); })
105 137

  

Also available in: Unified diff