1998-12-07 02:21:23 +08:00
|
|
|
/*
|
|
|
|
* BIRD -- Static Protocol Configuration
|
|
|
|
*
|
1999-02-06 05:38:22 +08:00
|
|
|
* (c) 1998--1999 Martin Mares <mj@ucw.cz>
|
1998-12-07 02:21:23 +08:00
|
|
|
*
|
|
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
CF_HDR
|
|
|
|
|
|
|
|
#include "proto/static/static.h"
|
|
|
|
|
1998-12-07 07:13:31 +08:00
|
|
|
static struct static_route *this_srt;
|
|
|
|
|
1998-12-07 02:21:23 +08:00
|
|
|
CF_DECLS
|
|
|
|
|
1998-12-07 07:13:31 +08:00
|
|
|
CF_KEYWORDS(STATIC, ROUTE, VIA, DROP, REJECT, PROHIBIT, PREFERENCE)
|
1998-12-07 02:21:23 +08:00
|
|
|
|
|
|
|
CF_GRAMMAR
|
|
|
|
|
|
|
|
CF_ADDTO(proto, static_proto '}')
|
|
|
|
|
|
|
|
static_proto_start: proto_start STATIC {
|
1999-02-06 05:38:22 +08:00
|
|
|
this_proto = proto_config_new(&proto_static, sizeof(struct static_config));
|
|
|
|
static_init_config((struct static_config *) this_proto);
|
1998-12-07 02:21:23 +08:00
|
|
|
}
|
|
|
|
;
|
|
|
|
|
|
|
|
static_proto:
|
|
|
|
static_proto_start proto_name '{'
|
|
|
|
| static_proto proto_item ';'
|
1998-12-07 07:13:31 +08:00
|
|
|
| static_proto stat_route ';'
|
|
|
|
;
|
|
|
|
|
|
|
|
stat_route0: ROUTE IPA pxlen {
|
|
|
|
this_srt = cfg_allocz(sizeof(struct static_route));
|
1999-02-06 05:38:22 +08:00
|
|
|
add_tail(&((struct static_config *) this_proto)->other_routes, &this_srt->n);
|
1998-12-07 07:13:31 +08:00
|
|
|
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);
|
1999-02-06 05:38:22 +08:00
|
|
|
add_tail(&((struct static_config *) this_proto)->iface_routes, &this_srt->n);
|
1998-12-07 07:13:31 +08:00
|
|
|
}
|
|
|
|
| stat_route0 DROP { this_srt->dest = RTD_BLACKHOLE; }
|
|
|
|
| stat_route0 REJECT { this_srt->dest = RTD_UNREACHABLE; }
|
|
|
|
| stat_route0 PROHIBIT { this_srt->dest = RTD_PROHIBIT; }
|
1998-12-07 02:21:23 +08:00
|
|
|
;
|
|
|
|
|
|
|
|
CF_CODE
|
|
|
|
|
|
|
|
CF_END
|