Statistics
| Branch: | Revision:

iof-bird-daemon / proto / static / config.Y @ 7e95c05d

History | View | Annotate | Download (1.62 KB)

1 a1bf6440 Martin Mares
/*
2
 *	BIRD -- Static Protocol Configuration
3
 *
4 e9e3dc26 Martin Mares
 *	(c) 1998--1999 Martin Mares <mj@ucw.cz>
5 a1bf6440 Martin Mares
 *
6
 *	Can be freely distributed and used under the terms of the GNU GPL.
7
 */
8
9
CF_HDR
10
11
#include "proto/static/static.h"
12
13 2edb31b0 Martin Mares
CF_DEFINES
14
15 fe181e7c Ondrej Zajicek
#define STATIC_CFG ((struct static_config *) this_proto)
16 f6bd2066 Martin Mares
static struct static_route *this_srt;
17
18 a1bf6440 Martin Mares
CF_DECLS
19
20 fe181e7c Ondrej Zajicek
CF_KEYWORDS(STATIC, ROUTE, VIA, DROP, REJECT, PROHIBIT, PREFERENCE, CHECK, LINK)
21 a1bf6440 Martin Mares
22
CF_GRAMMAR
23
24
CF_ADDTO(proto, static_proto '}')
25
26
static_proto_start: proto_start STATIC {
27 e9e3dc26 Martin Mares
     this_proto = proto_config_new(&proto_static, sizeof(struct static_config));
28
     static_init_config((struct static_config *) this_proto);
29 a1bf6440 Martin Mares
  }
30
 ;
31
32
static_proto:
33
   static_proto_start proto_name '{'
34
 | static_proto proto_item ';'
35 391931d4 Ondrej Zajicek
 | static_proto CHECK LINK bool ';' { STATIC_CFG->check_link = $4; }
36 f6bd2066 Martin Mares
 | static_proto stat_route ';'
37
 ;
38
39 758458be Martin Mares
stat_route0: ROUTE prefix {
40 f6bd2066 Martin Mares
     this_srt = cfg_allocz(sizeof(struct static_route));
41 fe181e7c Ondrej Zajicek
     add_tail(&STATIC_CFG->other_routes, &this_srt->n);
42 758458be Martin Mares
     this_srt->net = $2.addr;
43
     this_srt->masklen = $2.len;
44 f6bd2066 Martin Mares
  }
45
 ;
46
47
stat_route:
48 e3f2d5fc Martin Mares
   stat_route0 VIA ipa {
49 f6bd2066 Martin Mares
      this_srt->dest = RTD_ROUTER;
50
      this_srt->via = $3;
51
   }
52
 | stat_route0 VIA TEXT {
53
      this_srt->dest = RTD_DEVICE;
54
      this_srt->if_name = $3;
55
      rem_node(&this_srt->n);
56 fe181e7c Ondrej Zajicek
      add_tail(&STATIC_CFG->iface_routes, &this_srt->n);
57 f6bd2066 Martin Mares
   }
58
 | stat_route0 DROP { this_srt->dest = RTD_BLACKHOLE; }
59
 | stat_route0 REJECT { this_srt->dest = RTD_UNREACHABLE; }
60
 | stat_route0 PROHIBIT { this_srt->dest = RTD_PROHIBIT; }
61 a1bf6440 Martin Mares
 ;
62
63 feed8226 Martin Mares
CF_CLI(SHOW STATIC, optsym, [<name>], [[Show details of static protocol]])
64
{ static_show(proto_get_named($3, &proto_static)); } ;
65
66 a1bf6440 Martin Mares
CF_CODE
67
68
CF_END