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"
|
|
|
|
|
2000-04-28 23:11:10 +08:00
|
|
|
CF_DEFINES
|
|
|
|
|
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 ';'
|
|
|
|
;
|
|
|
|
|
2000-05-13 19:17:49 +08:00
|
|
|
stat_route0: ROUTE prefix {
|
1998-12-07 07:13:31 +08:00
|
|
|
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);
|
2000-05-13 19:17:49 +08:00
|
|
|
this_srt->net = $2.addr;
|
|
|
|
this_srt->masklen = $2.len;
|
1998-12-07 07:13:31 +08:00
|
|
|
}
|
|
|
|
;
|
|
|
|
|
|
|
|
stat_route:
|
2000-05-15 19:48:23 +08:00
|
|
|
stat_route0 VIA ipa {
|
1998-12-07 07:13:31 +08:00
|
|
|
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
|
|
|
;
|
|
|
|
|
1999-12-03 19:41:23 +08:00
|
|
|
CF_CLI(SHOW STATIC, optsym, [<name>], [[Show details of static protocol]])
|
|
|
|
{ static_show(proto_get_named($3, &proto_static)); } ;
|
|
|
|
|
1998-12-07 02:21:23 +08:00
|
|
|
CF_CODE
|
|
|
|
|
|
|
|
CF_END
|