]> git.ipfire.org Git - thirdparty/bird.git/blame - proto/bfd/config.Y
BFD work in progress.
[thirdparty/bird.git] / proto / bfd / config.Y
CommitLineData
bf139664
OZ
1/*
2 * BIRD -- Router Advertisement Configuration
3 *
4 *
5 * Can be freely distributed and used under the terms of the GNU GPL.
6 */
7
8CF_HDR
9
10#include "proto/bfd/bfd.h"
11
12CF_DEFINES
13
14#define BFD_CFG ((struct bfd_config *) this_proto)
15#define BFD_SESSION this_bfd_session
16#define BFD_NEIGHBOR this_bfd_neighbor
17
18static struct bfd_session_config *this_bfd_session;
19static struct bfd_neighbor *this_bfd_neighbor;
20
21
22CF_DECLS
23
24CF_KEYWORDS(BFD, MIN, IDLE, RX, TX, INTERVAL, MULTIPLIER, MULTIHOP, PASSIVE,
6a8d3f1c 25 NEIGHBOR, DEV)
bf139664
OZ
26
27%type <iface> bfd_neigh_iface
28%type <a> bfd_neigh_local
29
30CF_GRAMMAR
31
32CF_ADDTO(proto, bfd_proto)
33
34bfd_proto_start: proto_start BFD
35{
36 this_proto = proto_config_new(&proto_bfd, sizeof(struct bfd_config), $1);
6a8d3f1c 37 init_list(&BFD_CFG->neigh_list);
bf139664
OZ
38};
39
40bfd_proto_item:
41 proto_item
42 | bfd_neighbor
43 ;
44
45bfd_proto_opts:
46 /* empty */
47 | bfd_proto_opts bfd_proto_item ';'
48 ;
49
50bfd_proto:
51 bfd_proto_start proto_name '{' bfd_proto_opts '}';
52
53
54bfd_session_start:
55{
56 this_bfd_session = cfg_allocz(sizeof(struct bfd_session_config));
57
58 BFD_SESSION->min_rx_int = BFD_DEFAULT_MIN_RX_INT;
59 BFD_SESSION->min_tx_int = BFD_DEFAULT_MIN_TX_INT;
60 BFD_SESSION->idle_tx_int = BFD_DEFAULT_IDLE_TX_INT;
61 BFD_SESSION->multiplier = BFD_DEFAULT_MULTIPLIER;
62};
63
64bfd_session_item:
65 INTERVAL expr_us { BFD_SESSION->min_rx_int = BFD_SESSION->min_tx_int = $2; }
66 | MIN RX INTERVAL expr_us { BFD_SESSION->min_rx_int = $4; }
67 | MIN TX INTERVAL expr_us { BFD_SESSION->min_tx_int = $4; }
68 | IDLE TX INTERVAL expr_us { BFD_SESSION->idle_tx_int = $4; }
69 | MULTIPLIER expr { BFD_SESSION->multiplier = $2; }
70 | MULTIHOP bool { BFD_SESSION->multihop = $2; }
71 | PASSIVE bool { BFD_SESSION->passive = $2; }
72 ;
73
74bfd_session_opts:
75 /* empty */
76 | bfd_session_opts bfd_session_item ';'
77 ;
78
79bfd_session_opt_list:
80 /* empty */
81 | '{' bfd_session_opts '}'
82 ;
83
84bfd_session:
85 bfd_session_start bfd_session_opt_list;
86
87
88bfd_neigh_iface:
89 /* empty */ { $$ = NULL; }
90 | '%' SYM { $$ = if_get_by_name($2->name); }
91 | DEV TEXT { $$ = if_get_by_name($2); }
92 ;
93
94bfd_neigh_local:
95 /* empty */ { $$ = IPA_NONE; }
96 | LOCAL ipa { $$ = $2; }
97 ;
98
99bfd_neighbor: NEIGHBOR ipa bfd_neigh_iface bfd_neigh_local bfd_session
100{
101 this_bfd_neighbor = cfg_allocz(sizeof(struct bfd_neighbor));
6a8d3f1c 102 add_tail(&BFD_CFG->neigh_list, NODE this_bfd_neighbor);
bf139664
OZ
103
104 BFD_NEIGHBOR->addr = $2;
105 BFD_NEIGHBOR->local = $4;
106 BFD_NEIGHBOR->iface = $3;
107 BFD_NEIGHBOR->opts = BFD_SESSION;
108};
109
110
6a8d3f1c
OZ
111CF_CLI(SHOW BFD SESSIONS, optsym, [<name>], [[Show information about BFD sessions]])
112{ bfd_show_sessions(proto_get_named($4, &proto_bfd)); };
113
bf139664
OZ
114CF_CODE
115
116CF_END