]> git.ipfire.org Git - thirdparty/bird.git/blame - proto/ospf/config.Y
Fixes a bug in primary IP selection.
[thirdparty/bird.git] / proto / ospf / config.Y
CommitLineData
c1f8dc91
OF
1/*
2 * BIRD -- OSPF Configuration
3 *
32d3228d 4 * (c) 1999--2004 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)
89d6782d 16#define OSPF_PATT ((struct ospf_iface_patt *) this_ipatt)
20e94fb8
OZ
17
18static struct ospf_area_config *this_area;
e5b5d18c 19static struct nbma_node *this_nbma;
ed317862 20static list *this_nets;
98ac6176 21static struct area_net_config *this_pref;
38675202 22static struct ospf_stubnet_config *this_stubnet;
3fa5722d 23
c3226991 24#ifdef OSPFv2
024c310b 25static void
8e48831a 26ospf_iface_finish(void)
024c310b 27{
8e48831a
OZ
28 struct ospf_iface_patt *ip = OSPF_PATT;
29
30 if (ip->deadint == 0)
31 ip->deadint = ip->deadc * ip->helloint;
32
024c310b
OZ
33 ip->passwords = get_passwords();
34
35 if ((ip->autype == OSPF_AUTH_CRYPT) && (ip->helloint < 5))
36 log(L_WARN "Hello or poll interval less that 5 makes cryptographic authenication prone to replay attacks");
37
38 if ((ip->autype == OSPF_AUTH_NONE) && (ip->passwords != NULL))
39 log(L_WARN "Password option without authentication option does not make sense");
40}
c3226991
OZ
41#endif
42
43#ifdef OSPFv3
44static void
8e48831a 45ospf_iface_finish(void)
c3226991 46{
8e48831a
OZ
47 struct ospf_iface_patt *ip = OSPF_PATT;
48
49 if (ip->deadint == 0)
50 ip->deadint = ip->deadc * ip->helloint;
51
c3226991 52 if ((ip->autype != OSPF_AUTH_NONE) || (get_passwords() != NULL))
e4a810b0 53 cf_error("Authentication not supported in OSPFv3");
c3226991
OZ
54}
55#endif
024c310b 56
8e48831a
OZ
57static void
58ospf_area_finish(void)
59{
41b612c3 60 if ((this_area->areaid == 0) && (this_area->type != OPT_E))
2918e610
OZ
61 cf_error("Backbone area cannot be stub/NSSA");
62
63 if (this_area->summary && (this_area->type == OPT_E))
64 cf_error("Only Stub/NSSA areas can use summary propagation");
65
66 if (this_area->default_nssa && ((this_area->type != OPT_N) || ! this_area->summary))
67 cf_error("Only NSSA areas with summary propagation can use NSSA default route");
68
69 if ((this_area->default_cost & LSA_EXT_EBIT) && ! this_area->default_nssa)
70 cf_error("Only NSSA default route can use type 2 metric");
8e48831a
OZ
71}
72
73static void
74ospf_proto_finish(void)
75{
76 struct ospf_config *cf = OSPF_CFG;
77
78 if (EMPTY_LIST(cf->area_list))
79 cf_error( "No configured areas in OSPF");
80
81 int areano = 0;
82 int backbone = 0;
83 struct ospf_area_config *ac;
84 WALK_LIST(ac, cf->area_list)
85 {
86 areano++;
87 if (ac->areaid == 0)
88 backbone = 1;
89 }
90 cf->abr = areano > 1;
91
92 if (cf->abr && !backbone)
93 {
94 struct ospf_area_config *ac = cfg_allocz(sizeof(struct ospf_area_config));
95 add_head(&cf->area_list, NODE ac);
96 init_list(&ac->patt_list);
97 init_list(&ac->net_list);
ed317862 98 init_list(&ac->enet_list);
8e48831a
OZ
99 init_list(&ac->stubnet_list);
100 }
101
102 if (!cf->abr && !EMPTY_LIST(cf->vlink_list))
41b612c3 103 cf_error( "Vlinks cannot be used on single area router");
8e48831a
OZ
104}
105
2918e610
OZ
106static inline void
107check_defcost(int cost)
108{
109 if ((cost <= 0) || (cost >= LSINFINITY))
0ec031f7
OZ
110 cf_error("Default cost must be in range 1-%d", LSINFINITY-1);
111}
112
113static inline void
114set_instance_id(unsigned id)
115{
116#ifdef OSPFv3
117 OSPF_PATT->instance_id = id;
118#else
119 cf_error("Instance ID requires OSPFv3");
120#endif
2918e610
OZ
121}
122
c1f8dc91
OF
123CF_DECLS
124
c27b2449 125CF_KEYWORDS(OSPF, AREA, OSPF_METRIC1, OSPF_METRIC2, OSPF_TAG, OSPF_ROUTER_ID)
2918e610 126CF_KEYWORDS(NEIGHBORS, RFC1583COMPAT, STUB, TICK, COST, COST2, RETRANSMIT)
919f5411
OZ
127CF_KEYWORDS(HELLO, TRANSMIT, PRIORITY, DEAD, TYPE, BROADCAST, BCAST)
128CF_KEYWORDS(NONBROADCAST, NBMA, POINTOPOINT, PTP, POINTOMULTIPOINT, PTMP)
ea357b8b 129CF_KEYWORDS(NONE, SIMPLE, AUTHENTICATION, STRICT, CRYPTOGRAPHIC)
391931d4 130CF_KEYWORDS(ELIGIBLE, POLL, NETWORKS, HIDDEN, VIRTUAL, CHECK, LINK)
ed317862 131CF_KEYWORDS(RX, BUFFER, LARGE, NORMAL, STUBNET, HIDDEN, SUMMARY, TAG, EXTERNAL)
4160a9dd 132CF_KEYWORDS(WAIT, DELAY, LSADB, ECMP, LIMIT, WEIGHT, NSSA, TRANSLATOR, STABILITY)
95127cbb 133CF_KEYWORDS(GLOBAL, LSID, ROUTER, SELF, INSTANCE, REAL)
c1f8dc91 134
c4f0f014 135%type <t> opttext
20ab192b 136%type <ld> lsadb_args
c4f0f014 137
c1f8dc91
OF
138CF_GRAMMAR
139
8e48831a 140CF_ADDTO(proto, ospf_proto '}' { ospf_proto_finish(); } )
c1f8dc91
OF
141
142ospf_proto_start: proto_start OSPF {
a7f23f58 143 this_proto = proto_config_new(&proto_ospf, sizeof(struct ospf_config), $1);
b36a0a79 144 init_list(&OSPF_CFG->area_list);
8e48831a 145 init_list(&OSPF_CFG->vlink_list);
d631698e 146 OSPF_CFG->rfc1583 = DEFAULT_RFC1583;
b8f17cf1 147 OSPF_CFG->tick = DEFAULT_OSPFTICK;
c1f8dc91
OF
148 }
149 ;
150
151ospf_proto:
152 ospf_proto_start proto_name '{'
f8032bbd
MM
153 | ospf_proto ospf_proto_item ';'
154 ;
155
156ospf_proto_item:
157 proto_item
002ecc06 158 | RFC1583COMPAT bool { OSPF_CFG->rfc1583 = $2; }
57c574d8
OZ
159 | ECMP bool { OSPF_CFG->ecmp = $2 ? DEFAULT_ECMP_LIMIT : 0; }
160 | ECMP bool LIMIT expr { OSPF_CFG->ecmp = $2 ? $4 : 0; if ($4 < 0) cf_error("ECMP limit cannot be negative"); }
161 | TICK expr { OSPF_CFG->tick = $2; if($2<=0) cf_error("Tick must be greater than zero"); }
8e48831a 162 | ospf_area
f8032bbd 163 ;
c1f8dc91 164
8e48831a 165ospf_area_start: AREA idval {
b36a0a79
OF
166 this_area = cfg_allocz(sizeof(struct ospf_area_config));
167 add_tail(&OSPF_CFG->area_list, NODE this_area);
168 this_area->areaid = $2;
2918e610 169 this_area->default_cost = DEFAULT_STUB_COST;
41b612c3 170 this_area->type = OPT_E;
ed317862 171 this_area->transint = DEFAULT_TRANSINT;
41b612c3 172
89d6782d 173 init_list(&this_area->patt_list);
c926eee7 174 init_list(&this_area->net_list);
ed317862 175 init_list(&this_area->enet_list);
38675202 176 init_list(&this_area->stubnet_list);
c1f8dc91 177 }
f8032bbd 178 ;
c4f0f014 179
8e48831a 180ospf_area: ospf_area_start '{' ospf_area_opts '}' { ospf_area_finish(); }
f8032bbd 181 ;
a789d814
OF
182
183ospf_area_opts:
f8032bbd
MM
184 /* empty */
185 | ospf_area_opts ospf_area_item ';'
186 ;
a789d814 187
b36a0a79 188ospf_area_item:
2918e610 189 STUB bool { this_area->type = $2 ? 0 : OPT_E; /* We should remove the option */ }
41b612c3
OZ
190 | NSSA { this_area->type = OPT_N; }
191 | SUMMARY bool { this_area->summary = $2; }
2918e610
OZ
192 | DEFAULT NSSA bool { this_area->default_nssa = $3; }
193 | DEFAULT COST expr { this_area->default_cost = $3; check_defcost($3); }
194 | DEFAULT COST2 expr { this_area->default_cost = $3 | LSA_EXT_EBIT; check_defcost($3); }
195 | STUB COST expr { this_area->default_cost = $3; check_defcost($3); }
4160a9dd 196 | TRANSLATOR bool { this_area->translator = $2; }
ed317862
OZ
197 | TRANSLATOR STABILITY expr { this_area->transint = $3; }
198 | NETWORKS { this_nets = &this_area->net_list; } '{' pref_list '}'
199 | EXTERNAL { this_nets = &this_area->enet_list; } '{' pref_list '}'
38675202 200 | STUBNET ospf_stubnet
20e94fb8 201 | INTERFACE ospf_iface
3b16080c 202 | ospf_vlink
f8032bbd 203 ;
89d6782d 204
38675202
OZ
205ospf_stubnet:
206 ospf_stubnet_start '{' ospf_stubnet_opts '}'
207 | ospf_stubnet_start
208 ;
209
210ospf_stubnet_start:
211 prefix {
1b3b3e34 212 this_stubnet = cfg_allocz(sizeof(struct ospf_stubnet_config));
38675202
OZ
213 add_tail(&this_area->stubnet_list, NODE this_stubnet);
214 this_stubnet->px = $1;
215 this_stubnet->cost = COST_D;
216 }
217 ;
218
219ospf_stubnet_opts:
220 /* empty */
221 | ospf_stubnet_opts ospf_stubnet_item ';'
222 ;
223
224ospf_stubnet_item:
225 HIDDEN bool { this_stubnet->hidden = $2; }
226 | SUMMARY bool { this_stubnet->summary = $2; }
227 | COST expr { this_stubnet->cost = $2; }
228 ;
229
3b16080c 230ospf_vlink:
0ec031f7
OZ
231 ospf_vlink_start ospf_instance_id '{' ospf_vlink_opts '}' { ospf_iface_finish(); }
232 | ospf_vlink_start ospf_instance_id { ospf_iface_finish(); }
98ac6176
OF
233 ;
234
235ospf_vlink_opts:
236 /* empty */
237 | ospf_vlink_opts ospf_vlink_item ';'
238 ;
239
240ospf_vlink_item:
3b16080c 241 | HELLO expr { OSPF_PATT->helloint = $2 ; if (($2<=0) || ($2>65535)) cf_error("Hello interval must be in range 1-65535"); }
98ac6176
OF
242 | RETRANSMIT expr { OSPF_PATT->rxmtint = $2 ; if ($2<=0) cf_error("Retransmit int must be greater than zero"); }
243 | TRANSMIT DELAY expr { OSPF_PATT->inftransdelay = $3 ; if (($3<=0) || ($3>65535)) cf_error("Transmit delay must be in range 1-65535"); }
244 | WAIT expr { OSPF_PATT->waitint = $2 ; }
8e48831a 245 | DEAD expr { OSPF_PATT->deadint = $2 ; if ($2<=1) cf_error("Dead interval must be greater than one"); }
98ac6176 246 | DEAD COUNT expr { OSPF_PATT->deadc = $3 ; if ($3<=1) cf_error("Dead count must be greater than one"); }
3e2bd0f1
OF
247 | AUTHENTICATION NONE { OSPF_PATT->autype = OSPF_AUTH_NONE ; }
248 | AUTHENTICATION SIMPLE { OSPF_PATT->autype = OSPF_AUTH_SIMPLE ; }
32d3228d 249 | AUTHENTICATION CRYPTOGRAPHIC { OSPF_PATT->autype = OSPF_AUTH_CRYPT ; }
b21f68b4 250 | password_list
98ac6176
OF
251 ;
252
3b16080c 253ospf_vlink_start: VIRTUAL LINK idval
98ac6176
OF
254 {
255 if (this_area->areaid == 0) cf_error("Virtual link cannot be in backbone");
256 this_ipatt = cfg_allocz(sizeof(struct ospf_iface_patt));
8e48831a 257 add_tail(&OSPF_CFG->vlink_list, NODE this_ipatt);
20e94fb8 258 init_list(&this_ipatt->ipn_list);
8e48831a 259 OSPF_PATT->voa = this_area->areaid;
3b16080c 260 OSPF_PATT->vid = $3;
98ac6176 261 OSPF_PATT->helloint = HELLOINT_D;
98ac6176
OF
262 OSPF_PATT->rxmtint = RXMTINT_D;
263 OSPF_PATT->inftransdelay = INFTRANSDELAY_D;
264 OSPF_PATT->waitint = WAIT_DMH*HELLOINT_D;
265 OSPF_PATT->deadc = DEADC_D;
8e48831a 266 OSPF_PATT->deadint = 0;
98ac6176 267 OSPF_PATT->type = OSPF_IT_VLINK;
3b16080c 268 init_list(&OSPF_PATT->nbma_list);
3e2bd0f1 269 OSPF_PATT->autype = OSPF_AUTH_NONE;
024c310b 270 reset_passwords();
98ac6176
OF
271 }
272;
273
89d6782d 274ospf_iface_item:
7df86c25
OF
275 COST expr { OSPF_PATT->cost = $2 ; if (($2<=0) || ($2>65535)) cf_error("Cost must be in range 1-65535"); }
276 | HELLO expr { OSPF_PATT->helloint = $2 ; if (($2<=0) || ($2>65535)) cf_error("Hello interval must be in range 1-65535"); }
277 | POLL expr { OSPF_PATT->pollint = $2 ; if ($2<=0) cf_error("Poll int must be greater than zero"); }
278 | RETRANSMIT expr { OSPF_PATT->rxmtint = $2 ; if ($2<=0) cf_error("Retransmit int must be greater than zero"); }
bd457b8d 279 | WAIT expr { OSPF_PATT->waitint = $2 ; }
8e48831a 280 | DEAD expr { OSPF_PATT->deadint = $2 ; if ($2<=1) cf_error("Dead interval must be greater than one"); }
7df86c25 281 | DEAD COUNT expr { OSPF_PATT->deadc = $3 ; if ($3<=1) cf_error("Dead count must be greater than one"); }
aaaff776 282 | TYPE BROADCAST { OSPF_PATT->type = OSPF_IT_BCAST ; }
919f5411 283 | TYPE BCAST { OSPF_PATT->type = OSPF_IT_BCAST ; }
aaaff776 284 | TYPE NONBROADCAST { OSPF_PATT->type = OSPF_IT_NBMA ; }
919f5411 285 | TYPE NBMA { OSPF_PATT->type = OSPF_IT_NBMA ; }
aaaff776 286 | TYPE POINTOPOINT { OSPF_PATT->type = OSPF_IT_PTP ; }
919f5411
OZ
287 | TYPE PTP { OSPF_PATT->type = OSPF_IT_PTP ; }
288 | TYPE POINTOMULTIPOINT { OSPF_PATT->type = OSPF_IT_PTMP ; }
289 | TYPE PTMP { OSPF_PATT->type = OSPF_IT_PTMP ; }
95127cbb 290 | REAL BROADCAST bool { OSPF_PATT->real_bcast = $3; if (OSPF_VERSION != 2) cf_error("Real broadcast option requires OSPFv2"); }
8e48831a
OZ
291 | TRANSMIT DELAY expr { OSPF_PATT->inftransdelay = $3 ; if (($3<=0) || ($3>65535)) cf_error("Transmit delay must be in range 1-65535"); }
292 | PRIORITY expr { OSPF_PATT->priority = $2 ; if (($2<0) || ($2>255)) cf_error("Priority must be in range 0-255"); }
a190e720 293 | STRICT NONBROADCAST bool { OSPF_PATT->strictnbma = $3 ; }
e3bc10fd 294 | STUB bool { OSPF_PATT->stub = $2 ; }
391931d4 295 | CHECK LINK bool { OSPF_PATT->check_link = $3; }
57c574d8 296 | ECMP WEIGHT expr { OSPF_PATT->ecmp_weight = $3 - 1; if (($3<1) || ($3>256)) cf_error("ECMP weight must be in range 1-256"); }
e5b5d18c 297 | NEIGHBORS '{' ipa_list '}'
3e2bd0f1
OF
298 | AUTHENTICATION NONE { OSPF_PATT->autype = OSPF_AUTH_NONE ; }
299 | AUTHENTICATION SIMPLE { OSPF_PATT->autype = OSPF_AUTH_SIMPLE ; }
ea357b8b 300 | AUTHENTICATION CRYPTOGRAPHIC { OSPF_PATT->autype = OSPF_AUTH_CRYPT ; }
94c42054
OF
301 | RX BUFFER LARGE { OSPF_PATT->rxbuf = OSPF_RXBUF_LARGE ; }
302 | RX BUFFER NORMAL { OSPF_PATT->rxbuf = OSPF_RXBUF_NORMAL ; }
d9e7e1b1 303 | RX BUFFER expr { OSPF_PATT->rxbuf = $3 ; if (($3 < OSPF_RXBUF_MINSIZE) || ($3 > OSPF_MAX_PKT_SIZE)) cf_error("Buffer size must be in range 256-65535"); }
b21f68b4 304 | password_list
f8032bbd 305 ;
e5b5d18c 306
c926eee7
OF
307pref_list:
308 /* empty */
309 | pref_list pref_item
310 ;
311
ed317862 312pref_item: pref_base pref_opt ';' ;
c926eee7 313
ed317862 314pref_base: prefix
c926eee7 315 {
98ac6176 316 this_pref = cfg_allocz(sizeof(struct area_net_config));
ed317862 317 add_tail(this_nets, NODE this_pref);
66261211
OF
318 this_pref->px.addr = $1.addr;
319 this_pref->px.len = $1.len;
c926eee7
OF
320 }
321;
322
ed317862
OZ
323pref_opt:
324 /* empty */
325 | HIDDEN { this_pref->hidden = 1; }
326 | TAG expr { this_pref->tag = $2; }
327 ;
c926eee7 328
e5b5d18c
OF
329ipa_list:
330 /* empty */
331 | ipa_list ipa_item
332 ;
a190e720
OF
333
334ipa_item:
de259a41 335 ipa_el
a190e720 336 | ipa_ne;
e5b5d18c 337
a190e720
OF
338ipa_el: IPA ';'
339 {
340 this_nbma = cfg_allocz(sizeof(struct nbma_node));
341 add_tail(&OSPF_PATT->nbma_list, NODE this_nbma);
342 this_nbma->ip=$1;
343 this_nbma->eligible=0;
344 }
345;
346
347ipa_ne: IPA ELIGIBLE ';'
e5b5d18c
OF
348 {
349 this_nbma = cfg_allocz(sizeof(struct nbma_node));
350 add_tail(&OSPF_PATT->nbma_list, NODE this_nbma);
351 this_nbma->ip=$1;
a190e720 352 this_nbma->eligible=1;
e5b5d18c
OF
353 }
354;
355
b36a0a79 356
aaaff776
OF
357ospf_iface_start:
358 {
359 this_ipatt = cfg_allocz(sizeof(struct ospf_iface_patt));
360 add_tail(&this_area->patt_list, NODE this_ipatt);
20e94fb8 361 init_list(&this_ipatt->ipn_list);
aaaff776
OF
362 OSPF_PATT->cost = COST_D;
363 OSPF_PATT->helloint = HELLOINT_D;
a190e720 364 OSPF_PATT->pollint = POLLINT_D;
aaaff776
OF
365 OSPF_PATT->rxmtint = RXMTINT_D;
366 OSPF_PATT->inftransdelay = INFTRANSDELAY_D;
367 OSPF_PATT->priority = PRIORITY_D;
368 OSPF_PATT->waitint = WAIT_DMH*HELLOINT_D;
369 OSPF_PATT->deadc = DEADC_D;
8e48831a 370 OSPF_PATT->deadint = 0;
aaaff776 371 OSPF_PATT->type = OSPF_IT_UNDEF;
e5b5d18c 372 init_list(&OSPF_PATT->nbma_list);
3e2bd0f1 373 OSPF_PATT->autype = OSPF_AUTH_NONE;
024c310b 374 reset_passwords();
aaaff776
OF
375 }
376;
377
0ec031f7
OZ
378ospf_instance_id:
379 /* empty */
380 | INSTANCE expr { set_instance_id($2); }
381 ;
382
89d6782d 383ospf_iface_opts:
f8032bbd 384 /* empty */
89d6782d
OF
385 | ospf_iface_opts ospf_iface_item ';'
386 ;
387
f8032bbd
MM
388ospf_iface_opt_list:
389 /* empty */
390 | '{' ospf_iface_opts '}'
391 ;
89d6782d 392
89d6782d 393ospf_iface:
0ec031f7 394 ospf_iface_start iface_patt_list ospf_instance_id ospf_iface_opt_list { ospf_iface_finish(); }
89d6782d
OF
395 ;
396
c4f0f014
OF
397opttext:
398 TEXT
f8032bbd
MM
399 | /* empty */ { $$ = NULL; }
400 ;
c1f8dc91 401
5919c66e
MM
402CF_ADDTO(dynamic_attr, OSPF_METRIC1 { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_OSPF_METRIC1); })
403CF_ADDTO(dynamic_attr, OSPF_METRIC2 { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_OSPF_METRIC2); })
404CF_ADDTO(dynamic_attr, OSPF_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_OSPF_TAG); })
126683fe 405CF_ADDTO(dynamic_attr, OSPF_ROUTER_ID { $$ = f_new_dynamic_attr(EAF_TYPE_ROUTER_ID | EAF_TEMP, T_QUAD, EA_OSPF_ROUTER_ID); })
5919c66e 406
c47d037e
OZ
407CF_CLI_HELP(SHOW OSPF, ..., [[Show information about OSPF protocol]]);
408CF_CLI(SHOW OSPF, optsym, [<name>], [[Show information about OSPF protocol XXX]])
a3b70dc4 409{ ospf_sh(proto_get_named($3, &proto_ospf)); };
4ab4e977 410
ec423cc7 411CF_CLI(SHOW OSPF NEIGHBORS, optsym opttext, [<name>] [\"<interface>\"], [[Show information about OSPF neighbors]])
a3b70dc4 412{ ospf_sh_neigh(proto_get_named($4, &proto_ospf), $5); };
c4f0f014 413
ec423cc7 414CF_CLI(SHOW OSPF INTERFACE, optsym opttext, [<name>] [\"<interface>\"], [[Show information about interface]])
c4f0f014 415{ ospf_sh_iface(proto_get_named($4, &proto_ospf), $5); };
a783e259 416
0ea8fb4a 417CF_CLI_HELP(SHOW OSPF TOPOLOGY, [all] [<name>], [[Show information about OSPF network topology]])
a3b70dc4 418
0ea8fb4a
OZ
419CF_CLI(SHOW OSPF TOPOLOGY, optsym opttext, [<name>], [[Show information about reachable OSPF network topology]])
420{ ospf_sh_state(proto_get_named($4, &proto_ospf), 0, 1); };
421
422CF_CLI(SHOW OSPF TOPOLOGY ALL, optsym opttext, [<name>], [[Show information about all OSPF network topology]])
423{ ospf_sh_state(proto_get_named($5, &proto_ospf), 0, 0); };
424
425CF_CLI_HELP(SHOW OSPF STATE, [all] [<name>], [[Show information about OSPF network state]])
426
427CF_CLI(SHOW OSPF STATE, optsym opttext, [<name>], [[Show information about reachable OSPF network state]])
428{ ospf_sh_state(proto_get_named($4, &proto_ospf), 1, 1); };
429
430CF_CLI(SHOW OSPF STATE ALL, optsym opttext, [<name>], [[Show information about all OSPF network state]])
431{ ospf_sh_state(proto_get_named($5, &proto_ospf), 1, 0); };
a3b70dc4 432
c47d037e 433CF_CLI_HELP(SHOW OSPF LSADB, ..., [[Show content of OSPF LSA database]]);
20ab192b
OZ
434CF_CLI(SHOW OSPF LSADB, lsadb_args, [global | area <id> | link] [type <num>] [lsid <id>] [self | router <id>] [<proto>], [[Show content of OSPF LSA database]])
435{ ospf_sh_lsadb($4); };
436
437lsadb_args:
438 /* empty */ {
439 $$ = cfg_allocz(sizeof(struct lsadb_show_data));
440 }
441 | lsadb_args GLOBAL { $$ = $1; $$->scope = LSA_SCOPE_AS; }
442 | lsadb_args AREA idval { $$ = $1; $$->scope = LSA_SCOPE_AREA; $$->area = $3 }
443 | lsadb_args LINK { $$ = $1; $$->scope = 1; /* hack, 0 is no filter */ }
444 | lsadb_args TYPE NUM { $$ = $1; $$->type = $3; }
445 | lsadb_args LSID idval { $$ = $1; $$->lsid = $3; }
446 | lsadb_args SELF { $$ = $1; $$->router = SH_ROUTER_SELF; }
447 | lsadb_args ROUTER idval { $$ = $1; $$->router = $3; }
448 | lsadb_args SYM { $$ = $1; $$->name = $2; }
449 ;
98899244 450
c1f8dc91
OF
451CF_CODE
452
453CF_END