Static routes should allow constants/expressions for interface names in
next hops.
;
stat_nexthop:
- VIA ipa ipa_scope {
+ VIA text_or_ipa {
this_snh = static_nexthop_new();
- this_snh->via = $2;
- this_snh->iface = $3;
- }
- | VIA TEXT {
- this_snh = static_nexthop_new();
- this_snh->via = IPA_NONE;
- this_snh->iface = if_get_by_name($2);
+ if ($2.type == T_IP)
+ this_snh->via = $2.val.ip;
+ else if ($2.type == T_STRING)
+ this_snh->iface = if_get_by_name($2.val.s);
+ } ipa_scope {
+ if ($2.type == T_IP)
+ this_snh->iface = $4;
+ else if ($4)
+ cf_error("syntax error, unexpected '%'");
}
| stat_nexthop DEV text {
this_snh->iface = if_get_by_name($3);