Statistics
| Branch: | Revision:

iof-bird-daemon / proto / static / config.Y @ feed8226

History | View | Annotate | Download (1.6 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
static struct static_route *this_srt;
14

    
15
CF_DECLS
16

    
17
CF_KEYWORDS(STATIC, ROUTE, VIA, DROP, REJECT, PROHIBIT, PREFERENCE)
18

    
19
CF_GRAMMAR
20

    
21
CF_ADDTO(proto, static_proto '}')
22

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

    
29
static_proto:
30
   static_proto_start proto_name '{'
31
 | static_proto proto_item ';'
32
 | static_proto stat_route ';'
33
 ;
34

    
35
stat_route0: ROUTE IPA pxlen {
36
     this_srt = cfg_allocz(sizeof(struct static_route));
37
     add_tail(&((struct static_config *) this_proto)->other_routes, &this_srt->n);
38
     if (!ip_is_prefix($2, $3)) cf_error("Invalid network prefix: %I/%d", $2, $3);
39
     this_srt->net = $2;
40
     this_srt->masklen = $3;
41
  }
42
 ;
43

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

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

    
63
CF_CODE
64

    
65
CF_END