diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2010-12-07 23:34:36 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2010-12-07 23:34:36 +0100 |
commit | 9852f81064a38d35ff1bd5cc9fab7fc33926c83c (patch) | |
tree | 91917f1bc0e06922ddde315e640d525ac7d5e3e6 /proto/static/config.Y | |
parent | 7e95c05d889f22be44aef5051eb07d35a4a8f579 (diff) |
Multipath support for static protocol.
Diffstat (limited to 'proto/static/config.Y')
-rw-r--r-- | proto/static/config.Y | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/proto/static/config.Y b/proto/static/config.Y index 2849015b..46debbc3 100644 --- a/proto/static/config.Y +++ b/proto/static/config.Y @@ -13,11 +13,13 @@ CF_HDR CF_DEFINES #define STATIC_CFG ((struct static_config *) this_proto) -static struct static_route *this_srt; +static struct static_route *this_srt, *this_srt_nh, *last_srt_nh; CF_DECLS CF_KEYWORDS(STATIC, ROUTE, VIA, DROP, REJECT, PROHIBIT, PREFERENCE, CHECK, LINK) +CF_KEYWORDS(MULTIPATH, WEIGHT) + CF_GRAMMAR @@ -44,6 +46,25 @@ stat_route0: ROUTE prefix { } ; +stat_multipath1: + VIA ipa { + last_srt_nh = this_srt_nh; + this_srt_nh = cfg_allocz(sizeof(struct static_route)); + this_srt_nh->dest = RTD_NONE; + this_srt_nh->via = $2; + this_srt_nh->if_name = (void *) this_srt; /* really */ + } + | stat_multipath1 WEIGHT expr { + this_srt_nh->masklen = $3 - 1; /* really */ + if (($3<1) || ($3>256)) cf_error("Weight must be in range 1-256"); + } + ; + +stat_multipath: + stat_multipath1 { this_srt->mp_next = this_srt_nh; } + | stat_multipath stat_multipath1 { last_srt_nh->mp_next = this_srt_nh; } + ; + stat_route: stat_route0 VIA ipa { this_srt->dest = RTD_ROUTER; @@ -55,6 +76,9 @@ stat_route: rem_node(&this_srt->n); add_tail(&STATIC_CFG->iface_routes, &this_srt->n); } + | stat_route0 MULTIPATH stat_multipath { + this_srt->dest = RTD_MULTIPATH; + } | stat_route0 DROP { this_srt->dest = RTD_BLACKHOLE; } | stat_route0 REJECT { this_srt->dest = RTD_UNREACHABLE; } | stat_route0 PROHIBIT { this_srt->dest = RTD_PROHIBIT; } |