]> git.ipfire.org Git - thirdparty/bird.git/blame - proto/ospf/config.Y
Small typo changes.
[thirdparty/bird.git] / proto / ospf / config.Y
CommitLineData
c1f8dc91
OF
1/*
2 * BIRD -- OSPF Configuration
3 *
87f0d22e 4 * (c) 1999 - 2000 Ondrej Filip <feela@network.cz>
c1f8dc91
OF
5 *
6 * Can be freely distributed and used under the terms of the GNU GPL.
7 */
8
9CF_HDR
10
11#include "proto/ospf/ospf.h"
12
3fa5722d
OF
13CF_DEFINES
14
15#define OSPF_CFG ((struct ospf_config *) this_proto)
b36a0a79 16static struct ospf_area_config *this_area;
89d6782d
OF
17static struct iface_patt *this_ipatt;
18#define OSPF_PATT ((struct ospf_iface_patt *) this_ipatt)
e5b5d18c 19static struct nbma_node *this_nbma;
c926eee7 20static struct area_net *this_pref;
3fa5722d 21
c1f8dc91
OF
22CF_DECLS
23
5919c66e 24CF_KEYWORDS(OSPF, AREA, OSPF_METRIC1, OSPF_METRIC2, OSPF_TAG)
89d6782d 25CF_KEYWORDS(NEIGHBORS, RFC1583COMPAT, STUB, TICK, COST, RETRANSMIT)
bd457b8d 26CF_KEYWORDS(HELLO, TRANSMIT, PRIORITY, DEAD, NONBROADCAST, POINTOPOINT, TYPE)
c926eee7
OF
27CF_KEYWORDS(NONE, SIMPLE, AUTHENTICATION, PASSWORD, STRICT)
28CF_KEYWORDS(ELIGIBLE, POLL, NETWORKS, HIDDEN)
c1f8dc91 29
c4f0f014
OF
30%type <t> opttext
31
c1f8dc91
OF
32CF_GRAMMAR
33
34CF_ADDTO(proto, ospf_proto '}')
35
36ospf_proto_start: proto_start OSPF {
37 this_proto = proto_config_new(&proto_ospf, sizeof(struct ospf_config));
916c8c0a 38 this_proto->preference = DEF_PREF_OSPF;
b36a0a79 39 init_list(&OSPF_CFG->area_list);
d631698e 40 OSPF_CFG->rfc1583 = DEFAULT_RFC1583;
b8f17cf1 41 OSPF_CFG->tick = DEFAULT_OSPFTICK;
c1f8dc91
OF
42 }
43 ;
44
45ospf_proto:
46 ospf_proto_start proto_name '{'
f8032bbd
MM
47 | ospf_proto ospf_proto_item ';'
48 ;
49
50ospf_proto_item:
51 proto_item
52 | RFC1583COMPAT bool ';' { OSPF_CFG->rfc1583 = $2; }
b8f17cf1 53 | TICK expr { OSPF_CFG->tick = $2 ; if($2<=0) cf_error("Tick must be greater than zero"); }
f8032bbd
MM
54 | ospf_area '}'
55 ;
c1f8dc91 56
b36a0a79
OF
57ospf_area_start: AREA idval '{' {
58 this_area = cfg_allocz(sizeof(struct ospf_area_config));
59 add_tail(&OSPF_CFG->area_list, NODE this_area);
60 this_area->areaid = $2;
b8f17cf1 61 this_area->tick = DEFAULT_AREATICK;
b36a0a79 62 this_area->stub = 0;
89d6782d 63 init_list(&this_area->patt_list);
c926eee7 64 init_list(&this_area->net_list);
c1f8dc91 65 }
f8032bbd 66 ;
c4f0f014 67
71f7d043 68ospf_area: ospf_area_start ospf_area_opts
f8032bbd 69 ;
a789d814
OF
70
71ospf_area_opts:
f8032bbd
MM
72 /* empty */
73 | ospf_area_opts ospf_area_item ';'
74 ;
a789d814 75
b36a0a79 76ospf_area_item:
b2bdb406 77 STUB COST expr { this_area->stub = $3 ; if($3<=0) cf_error("Stub cost must be greater than zero"); }
bd457b8d 78 | TICK expr { this_area->tick = $2 ; if($2<=0) cf_error("Tick must be greater than zero"); }
c926eee7 79 | NETWORKS '{' pref_list '}'
f8032bbd
MM
80 | INTERFACE ospf_iface_list
81 ;
89d6782d
OF
82
83ospf_iface_item:
7df86c25
OF
84 COST expr { OSPF_PATT->cost = $2 ; if (($2<=0) || ($2>65535)) cf_error("Cost must be in range 1-65535"); }
85 | HELLO expr { OSPF_PATT->helloint = $2 ; if (($2<=0) || ($2>65535)) cf_error("Hello interval must be in range 1-65535"); }
86 | POLL expr { OSPF_PATT->pollint = $2 ; if ($2<=0) cf_error("Poll int must be greater than zero"); }
87 | RETRANSMIT expr { OSPF_PATT->rxmtint = $2 ; if ($2<=0) cf_error("Retransmit int must be greater than zero"); }
88 | TRANSMIT DELAY expr { OSPF_PATT->inftransdelay = $3 ; if (($3<=0) || ($3>65535)) cf_error("Transmit delay must be in range 1-65535"); }
89 | PRIORITY expr { OSPF_PATT->priority = $2 ; if (($2<0) || ($2>255)) cf_error("Priority must be in range 0-255")}
bd457b8d 90 | WAIT expr { OSPF_PATT->waitint = $2 ; }
7df86c25 91 | DEAD COUNT expr { OSPF_PATT->deadc = $3 ; if ($3<=1) cf_error("Dead count must be greater than one"); }
aaaff776
OF
92 | TYPE BROADCAST { OSPF_PATT->type = OSPF_IT_BCAST ; }
93 | TYPE NONBROADCAST { OSPF_PATT->type = OSPF_IT_NBMA ; }
94 | TYPE POINTOPOINT { OSPF_PATT->type = OSPF_IT_PTP ; }
a190e720 95 | STRICT NONBROADCAST bool { OSPF_PATT->strictnbma = $3 ; }
e3bc10fd 96 | STUB bool { OSPF_PATT->stub = $2 ; }
e5b5d18c 97 | NEIGHBORS '{' ipa_list '}'
c1824c4d
OF
98 | AUTHENTICATION NONE { OSPF_PATT->autype=AU_NONE ; }
99 | AUTHENTICATION SIMPLE { OSPF_PATT->autype=AU_SIMPLE ; }
100 | PASSWORD TEXT { memcpy(OSPF_PATT->password, $2, 8); }
f8032bbd 101 ;
e5b5d18c 102
c926eee7
OF
103pref_list:
104 /* empty */
105 | pref_list pref_item
106 ;
107
108pref_item:
de259a41 109 pref_el
c926eee7
OF
110 | pref_hid;
111
112pref_el: prefix ';'
113 {
114 this_pref = cfg_allocz(sizeof(struct area_net));
115 add_tail(&this_area->net_list, NODE this_pref);
66261211
OF
116 this_pref->px.addr = $1.addr;
117 this_pref->px.len = $1.len;
c926eee7
OF
118 }
119;
120
121pref_hid: prefix HIDDEN ';'
122 {
123 this_pref = cfg_allocz(sizeof(struct area_net));
124 add_tail(&this_area->net_list, NODE this_pref);
66261211
OF
125 this_pref->px.addr = $1.addr;
126 this_pref->px.len = $1.len;
c926eee7
OF
127 this_pref->hidden = 1;
128 }
129;
130
e5b5d18c
OF
131ipa_list:
132 /* empty */
133 | ipa_list ipa_item
134 ;
a190e720
OF
135
136ipa_item:
de259a41 137 ipa_el
a190e720 138 | ipa_ne;
e5b5d18c 139
a190e720
OF
140ipa_el: IPA ';'
141 {
142 this_nbma = cfg_allocz(sizeof(struct nbma_node));
143 add_tail(&OSPF_PATT->nbma_list, NODE this_nbma);
144 this_nbma->ip=$1;
145 this_nbma->eligible=0;
146 }
147;
148
149ipa_ne: IPA ELIGIBLE ';'
e5b5d18c
OF
150 {
151 this_nbma = cfg_allocz(sizeof(struct nbma_node));
152 add_tail(&OSPF_PATT->nbma_list, NODE this_nbma);
153 this_nbma->ip=$1;
a190e720 154 this_nbma->eligible=1;
e5b5d18c
OF
155 }
156;
157
b36a0a79 158
aaaff776
OF
159ospf_iface_start:
160 {
161 this_ipatt = cfg_allocz(sizeof(struct ospf_iface_patt));
162 add_tail(&this_area->patt_list, NODE this_ipatt);
163 OSPF_PATT->cost = COST_D;
164 OSPF_PATT->helloint = HELLOINT_D;
a190e720 165 OSPF_PATT->pollint = POLLINT_D;
aaaff776
OF
166 OSPF_PATT->rxmtint = RXMTINT_D;
167 OSPF_PATT->inftransdelay = INFTRANSDELAY_D;
168 OSPF_PATT->priority = PRIORITY_D;
169 OSPF_PATT->waitint = WAIT_DMH*HELLOINT_D;
170 OSPF_PATT->deadc = DEADC_D;
171 OSPF_PATT->type = OSPF_IT_UNDEF;
a190e720 172 OSPF_PATT->strictnbma = 0;
e3bc10fd 173 OSPF_PATT->stub = 0;
e5b5d18c 174 init_list(&OSPF_PATT->nbma_list);
c1824c4d 175 OSPF_PATT->autype=AU_NONE;
aaaff776
OF
176 }
177;
178
89d6782d 179ospf_iface_opts:
f8032bbd 180 /* empty */
89d6782d
OF
181 | ospf_iface_opts ospf_iface_item ';'
182 ;
183
f8032bbd
MM
184ospf_iface_opt_list:
185 /* empty */
186 | '{' ospf_iface_opts '}'
187 ;
89d6782d 188
89d6782d
OF
189ospf_iface:
190 ospf_iface_start iface_patt ospf_iface_opt_list
f8032bbd 191 ;
89d6782d
OF
192
193ospf_iface_list:
f8032bbd 194 ospf_iface
89d6782d
OF
195 | ospf_iface_list ',' ospf_iface
196 ;
197
c4f0f014
OF
198opttext:
199 TEXT
f8032bbd
MM
200 | /* empty */ { $$ = NULL; }
201 ;
c1f8dc91 202
5919c66e
MM
203CF_ADDTO(dynamic_attr, OSPF_METRIC1 { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_OSPF_METRIC1); })
204CF_ADDTO(dynamic_attr, OSPF_METRIC2 { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_OSPF_METRIC2); })
205CF_ADDTO(dynamic_attr, OSPF_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_OSPF_TAG); })
206
ec423cc7 207CF_CLI(SHOW OSPF, optsym, [<name>], [[Show information about OSPF protocol]])
4ab4e977
OF
208{ ospf_sh(proto_get_named($3, &proto_ospf)); } ;
209
ec423cc7 210CF_CLI(SHOW OSPF NEIGHBORS, optsym opttext, [<name>] [\"<interface>\"], [[Show information about OSPF neighbors]])
c4f0f014
OF
211{ ospf_sh_neigh(proto_get_named($4, &proto_ospf), $5); } ;
212
ec423cc7 213CF_CLI(SHOW OSPF INTERFACE, optsym opttext, [<name>] [\"<interface>\"], [[Show information about interface]])
c4f0f014 214{ ospf_sh_iface(proto_get_named($4, &proto_ospf), $5); };
a783e259 215
c1f8dc91
OF
216CF_CODE
217
218CF_END