Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (1.62 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
#define STATIC_CFG ((struct static_config *) this_proto)
16
static struct static_route *this_srt;
17

    
18
CF_DECLS
19

    
20
CF_KEYWORDS(STATIC, ROUTE, VIA, DROP, REJECT, PROHIBIT, PREFERENCE, CHECK, LINK)
21

    
22
CF_GRAMMAR
23

    
24
CF_ADDTO(proto, static_proto '}')
25

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

    
32
static_proto:
33
   static_proto_start proto_name '{'
34
 | static_proto proto_item ';'
35
 | static_proto CHECK LINK bool ';' { STATIC_CFG->check_link = $4; }
36
 | static_proto stat_route ';'
37
 ;
38

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

    
47
stat_route:
48
   stat_route0 VIA ipa {
49
      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
      add_tail(&STATIC_CFG->iface_routes, &this_srt->n);
57
   }
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
 ;
62

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

    
66
CF_CODE
67

    
68
CF_END