Statistics
| Branch: | Revision:

iof-bird-daemon / proto / static / config.Y @ 758458be

History | View | Annotate | Download (1.54 KB)

1
/*
2
 *	BIRD -- Static Protocol Configuration
3
 *
4
 *	(c) 1998--1999 Martin Mares <mj@ucw.cz>
5
 *
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
CF_DEFINES
14

    
15
static struct static_route *this_srt;
16

    
17
CF_DECLS
18

    
19
CF_KEYWORDS(STATIC, ROUTE, VIA, DROP, REJECT, PROHIBIT, PREFERENCE)
20

    
21
CF_GRAMMAR
22

    
23
CF_ADDTO(proto, static_proto '}')
24

    
25
static_proto_start: proto_start STATIC {
26
     this_proto = proto_config_new(&proto_static, sizeof(struct static_config));
27
     static_init_config((struct static_config *) this_proto);
28
  }
29
 ;
30

    
31
static_proto:
32
   static_proto_start proto_name '{'
33
 | static_proto proto_item ';'
34
 | static_proto stat_route ';'
35
 ;
36

    
37
stat_route0: ROUTE prefix {
38
     this_srt = cfg_allocz(sizeof(struct static_route));
39
     add_tail(&((struct static_config *) this_proto)->other_routes, &this_srt->n);
40
     this_srt->net = $2.addr;
41
     this_srt->masklen = $2.len;
42
  }
43
 ;
44

    
45
stat_route:
46
   stat_route0 VIA IPA {
47
      this_srt->dest = RTD_ROUTER;
48
      this_srt->via = $3;
49
   }
50
 | stat_route0 VIA TEXT {
51
      this_srt->dest = RTD_DEVICE;
52
      this_srt->if_name = $3;
53
      rem_node(&this_srt->n);
54
      add_tail(&((struct static_config *) this_proto)->iface_routes, &this_srt->n);
55
   }
56
 | stat_route0 DROP { this_srt->dest = RTD_BLACKHOLE; }
57
 | stat_route0 REJECT { this_srt->dest = RTD_UNREACHABLE; }
58
 | stat_route0 PROHIBIT { this_srt->dest = RTD_PROHIBIT; }
59
 ;
60

    
61
CF_CLI(SHOW STATIC, optsym, [<name>], [[Show details of static protocol]])
62
{ static_show(proto_get_named($3, &proto_static)); } ;
63

    
64
CF_CODE
65

    
66
CF_END