summaryrefslogtreecommitdiff
path: root/proto/static/config.Y
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1998-12-06 23:13:31 +0000
committerMartin Mares <mj@ucw.cz>1998-12-06 23:13:31 +0000
commitf6bd206607d9fcad3572841813d7376bd2df4952 (patch)
treeb3d17192e9f0fed53bf8d85f56a3881e82aae55a /proto/static/config.Y
parent78d06cf2bc8ec8b9850802fc9d34afe4d1782c6c (diff)
All static routes except for device ones should work and appear/disappear
when their destination comes on/off link. Deserves better testing :) See example in bird.conf.
Diffstat (limited to 'proto/static/config.Y')
-rw-r--r--proto/static/config.Y30
1 files changed, 29 insertions, 1 deletions
diff --git a/proto/static/config.Y b/proto/static/config.Y
index a9eaa872..ff506511 100644
--- a/proto/static/config.Y
+++ b/proto/static/config.Y
@@ -10,9 +10,11 @@ CF_HDR
#include "proto/static/static.h"
+static struct static_route *this_srt;
+
CF_DECLS
-CF_KEYWORDS(STATIC)
+CF_KEYWORDS(STATIC, ROUTE, VIA, DROP, REJECT, PROHIBIT, PREFERENCE)
CF_GRAMMAR
@@ -27,6 +29,32 @@ static_proto_start: proto_start STATIC {
static_proto:
static_proto_start proto_name '{'
| static_proto proto_item ';'
+ | static_proto stat_route ';'
+ ;
+
+stat_route0: ROUTE IPA pxlen {
+ this_srt = cfg_allocz(sizeof(struct static_route));
+ add_tail(&((struct static_proto *) this_proto)->other_routes, &this_srt->n);
+ if (!ip_is_prefix($2, $3)) cf_error("Invalid network prefix: %I/%d", $2, $3);
+ this_srt->net = $2;
+ this_srt->masklen = $3;
+ }
+ ;
+
+stat_route:
+ stat_route0 VIA IPA {
+ this_srt->dest = RTD_ROUTER;
+ this_srt->via = $3;
+ }
+ | stat_route0 VIA TEXT {
+ this_srt->dest = RTD_DEVICE;
+ this_srt->if_name = $3;
+ rem_node(&this_srt->n);
+ add_tail(&((struct static_proto *) this_proto)->iface_routes, &this_srt->n);
+ }
+ | stat_route0 DROP { this_srt->dest = RTD_BLACKHOLE; }
+ | stat_route0 REJECT { this_srt->dest = RTD_UNREACHABLE; }
+ | stat_route0 PROHIBIT { this_srt->dest = RTD_PROHIBIT; }
;
CF_CODE