]> git.proxmox.com Git - mirror_frr.git/blame - ospf6d/ospf6_intra.c
ospf6d: fix linkdown handling
[mirror_frr.git] / ospf6d / ospf6_intra.c
CommitLineData
718e3744 1/*
508e53e2 2 * Copyright (C) 2003 Yasuhiro Ohara
718e3744 3 *
4 * This file is part of GNU Zebra.
5 *
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21
508e53e2 22#include <zebra.h>
718e3744 23
508e53e2 24#include "log.h"
25#include "linklist.h"
26#include "thread.h"
27#include "memory.h"
28#include "if.h"
29#include "prefix.h"
30#include "table.h"
31#include "vty.h"
32#include "command.h"
718e3744 33
508e53e2 34#include "ospf6_proto.h"
35#include "ospf6_message.h"
36#include "ospf6_route.h"
37#include "ospf6_lsa.h"
38#include "ospf6_lsdb.h"
39
40#include "ospf6_top.h"
41#include "ospf6_area.h"
42#include "ospf6_interface.h"
43#include "ospf6_neighbor.h"
44#include "ospf6_intra.h"
45#include "ospf6_asbr.h"
6452df09 46#include "ospf6_abr.h"
47#include "ospf6_flood.h"
049207c3 48#include "ospf6d.h"
508e53e2 49
cb4b8845
PJ
50
51unsigned char conf_debug_ospf6_brouter = 0;
52u_int32_t conf_debug_ospf6_brouter_specific_router_id;
53u_int32_t conf_debug_ospf6_brouter_specific_area_id;
54
508e53e2 55/******************************/
56/* RFC2740 3.4.3.1 Router-LSA */
57/******************************/
718e3744 58
6ac29a51 59static int
508e53e2 60ospf6_router_lsa_show (struct vty *vty, struct ospf6_lsa *lsa)
718e3744 61{
508e53e2 62 char *start, *end, *current;
63 char buf[32], name[32], bits[16], options[32];
64 struct ospf6_router_lsa *router_lsa;
65 struct ospf6_router_lsdesc *lsdesc;
718e3744 66
508e53e2 67 router_lsa = (struct ospf6_router_lsa *)
68 ((char *) lsa->header + sizeof (struct ospf6_lsa_header));
718e3744 69
508e53e2 70 ospf6_capability_printbuf (router_lsa->bits, bits, sizeof (bits));
71 ospf6_options_printbuf (router_lsa->options, options, sizeof (options));
049207c3 72 vty_out (vty, " Bits: %s Options: %s%s", bits, options, VNL);
718e3744 73
508e53e2 74 start = (char *) router_lsa + sizeof (struct ospf6_router_lsa);
718e3744 75 end = (char *) lsa->header + ntohs (lsa->header->length);
508e53e2 76 for (current = start; current + sizeof (struct ospf6_router_lsdesc) <= end;
77 current += sizeof (struct ospf6_router_lsdesc))
78 {
79 lsdesc = (struct ospf6_router_lsdesc *) current;
80
81 if (lsdesc->type == OSPF6_ROUTER_LSDESC_POINTTOPOINT)
82 snprintf (name, sizeof (name), "Point-To-Point");
83 else if (lsdesc->type == OSPF6_ROUTER_LSDESC_TRANSIT_NETWORK)
84 snprintf (name, sizeof (name), "Transit-Network");
85 else if (lsdesc->type == OSPF6_ROUTER_LSDESC_STUB_NETWORK)
86 snprintf (name, sizeof (name), "Stub-Network");
87 else if (lsdesc->type == OSPF6_ROUTER_LSDESC_VIRTUAL_LINK)
88 snprintf (name, sizeof (name), "Virtual-Link");
718e3744 89 else
508e53e2 90 snprintf (name, sizeof (name), "Unknown (%#x)", lsdesc->type);
91
92 vty_out (vty, " Type: %s Metric: %d%s",
049207c3 93 name, ntohs (lsdesc->metric), VNL);
508e53e2 94 vty_out (vty, " Interface ID: %s%s",
95 inet_ntop (AF_INET, &lsdesc->interface_id,
049207c3 96 buf, sizeof (buf)), VNL);
508e53e2 97 vty_out (vty, " Neighbor Interface ID: %s%s",
98 inet_ntop (AF_INET, &lsdesc->neighbor_interface_id,
049207c3 99 buf, sizeof (buf)), VNL);
508e53e2 100 vty_out (vty, " Neighbor Router ID: %s%s",
101 inet_ntop (AF_INET, &lsdesc->neighbor_router_id,
049207c3 102 buf, sizeof (buf)), VNL);
718e3744 103 }
508e53e2 104 return 0;
718e3744 105}
106
6452df09 107int
108ospf6_router_lsa_originate (struct thread *thread)
718e3744 109{
6452df09 110 struct ospf6_area *oa;
111
508e53e2 112 char buffer [OSPF6_MAX_LSASIZE];
113 struct ospf6_lsa_header *lsa_header;
114 struct ospf6_lsa *lsa;
115
116 u_int32_t link_state_id = 0;
1eb8ef25 117 struct listnode *node, *nnode;
118 struct listnode *j;
508e53e2 119 struct ospf6_interface *oi;
120 struct ospf6_neighbor *on, *drouter = NULL;
121 struct ospf6_router_lsa *router_lsa;
122 struct ospf6_router_lsdesc *lsdesc;
123 u_int16_t type;
124 u_int32_t router;
125 int count;
718e3744 126
6452df09 127 oa = (struct ospf6_area *) THREAD_ARG (thread);
128 oa->thread_router_lsa = NULL;
129
1e05838a 130 if (IS_OSPF6_DEBUG_ORIGINATE (ROUTER))
c6487d61 131 zlog_debug ("Originate Router-LSA for Area %s", oa->name);
718e3744 132
508e53e2 133 memset (buffer, 0, sizeof (buffer));
134 lsa_header = (struct ospf6_lsa_header *) buffer;
135 router_lsa = (struct ospf6_router_lsa *)
136 ((caddr_t) lsa_header + sizeof (struct ospf6_lsa_header));
137
138 OSPF6_OPT_SET (router_lsa->options, OSPF6_OPT_V6);
139 OSPF6_OPT_SET (router_lsa->options, OSPF6_OPT_E);
140 OSPF6_OPT_CLEAR (router_lsa->options, OSPF6_OPT_MC);
141 OSPF6_OPT_CLEAR (router_lsa->options, OSPF6_OPT_N);
142 OSPF6_OPT_SET (router_lsa->options, OSPF6_OPT_R);
143 OSPF6_OPT_CLEAR (router_lsa->options, OSPF6_OPT_DC);
144
6452df09 145 if (ospf6_is_router_abr (ospf6))
146 SET_FLAG (router_lsa->bits, OSPF6_ROUTER_BIT_B);
147 else
148 UNSET_FLAG (router_lsa->bits, OSPF6_ROUTER_BIT_B);
508e53e2 149 if (ospf6_asbr_is_asbr (ospf6))
150 SET_FLAG (router_lsa->bits, OSPF6_ROUTER_BIT_E);
151 else
152 UNSET_FLAG (router_lsa->bits, OSPF6_ROUTER_BIT_E);
153 UNSET_FLAG (router_lsa->bits, OSPF6_ROUTER_BIT_V);
154 UNSET_FLAG (router_lsa->bits, OSPF6_ROUTER_BIT_W);
718e3744 155
508e53e2 156 /* describe links for each interfaces */
157 lsdesc = (struct ospf6_router_lsdesc *)
158 ((caddr_t) router_lsa + sizeof (struct ospf6_router_lsa));
718e3744 159
1eb8ef25 160 for (ALL_LIST_ELEMENTS (oa->if_list, node, nnode, oi))
718e3744 161 {
508e53e2 162 /* Interfaces in state Down or Loopback are not described */
163 if (oi->state == OSPF6_INTERFACE_DOWN ||
164 oi->state == OSPF6_INTERFACE_LOOPBACK)
165 continue;
166
167 /* Nor are interfaces without any full adjacencies described */
168 count = 0;
1eb8ef25 169 for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, j, on))
170 if (on->state == OSPF6_NEIGHBOR_FULL)
171 count++;
172
508e53e2 173 if (count == 0)
174 continue;
175
176 /* Multiple Router-LSA instance according to size limit setting */
0c083ee9 177 if ( (oa->router_lsa_size_limit != 0)
178 && ((caddr_t) lsdesc + sizeof (struct ospf6_router_lsdesc) -
1686f93f 179 /* XXX warning: comparison between signed and unsigned */
0c083ee9 180 (caddr_t) buffer > oa->router_lsa_size_limit))
508e53e2 181 {
182 if ((caddr_t) lsdesc == (caddr_t) router_lsa +
183 sizeof (struct ospf6_router_lsa))
184 {
1e05838a 185 if (IS_OSPF6_DEBUG_ORIGINATE (ROUTER))
c6487d61 186 zlog_debug ("Size limit setting for Router-LSA too short");
6452df09 187 return 0;
508e53e2 188 }
189
190 /* Fill LSA Header */
191 lsa_header->age = 0;
192 lsa_header->type = htons (OSPF6_LSTYPE_ROUTER);
193 lsa_header->id = htonl (link_state_id);
194 lsa_header->adv_router = oa->ospf6->router_id;
195 lsa_header->seqnum =
049207c3 196 ospf6_new_ls_seqnum (lsa_header->type, lsa_header->id,
197 lsa_header->adv_router, oa->lsdb);
508e53e2 198 lsa_header->length = htons ((caddr_t) lsdesc - (caddr_t) buffer);
199
200 /* LSA checksum */
201 ospf6_lsa_checksum (lsa_header);
202
203 /* create LSA */
204 lsa = ospf6_lsa_create (lsa_header);
508e53e2 205
206 /* Originate */
6452df09 207 ospf6_lsa_originate_area (lsa, oa);
508e53e2 208
209 /* Reset setting for consecutive origination */
210 memset ((caddr_t) router_lsa + sizeof (struct ospf6_router_lsa),
211 0, (caddr_t) lsdesc - (caddr_t) router_lsa);
212 lsdesc = (struct ospf6_router_lsdesc *)
213 ((caddr_t) router_lsa + sizeof (struct ospf6_router_lsa));
214 link_state_id ++;
215 }
216
217 /* Point-to-Point interfaces */
c5926a92 218 if (oi->type == OSPF_IFTYPE_POINTOPOINT)
508e53e2 219 {
1eb8ef25 220 for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, j, on))
508e53e2 221 {
508e53e2 222 if (on->state != OSPF6_NEIGHBOR_FULL)
223 continue;
224
225 lsdesc->type = OSPF6_ROUTER_LSDESC_POINTTOPOINT;
226 lsdesc->metric = htons (oi->cost);
227 lsdesc->interface_id = htonl (oi->interface->ifindex);
228 lsdesc->neighbor_interface_id = htonl (on->ifindex);
229 lsdesc->neighbor_router_id = on->router_id;
230
231 lsdesc++;
232 }
233 }
234
235 /* Broadcast and NBMA interfaces */
c5926a92 236 else if (oi->type == OSPF_IFTYPE_BROADCAST)
508e53e2 237 {
238 /* If this router is not DR,
239 and If this router not fully adjacent with DR,
240 this interface is not transit yet: ignore. */
241 if (oi->state != OSPF6_INTERFACE_DR)
242 {
243 drouter = ospf6_neighbor_lookup (oi->drouter, oi);
244 if (drouter == NULL || drouter->state != OSPF6_NEIGHBOR_FULL)
245 continue;
246 }
247
248 lsdesc->type = OSPF6_ROUTER_LSDESC_TRANSIT_NETWORK;
249 lsdesc->metric = htons (oi->cost);
250 lsdesc->interface_id = htonl (oi->interface->ifindex);
251 if (oi->state != OSPF6_INTERFACE_DR)
252 {
253 lsdesc->neighbor_interface_id = htonl (drouter->ifindex);
254 lsdesc->neighbor_router_id = drouter->router_id;
255 }
256 else
257 {
258 lsdesc->neighbor_interface_id = htonl (oi->interface->ifindex);
259 lsdesc->neighbor_router_id = oi->area->ospf6->router_id;
260 }
261
262 lsdesc++;
263 }
c5926a92
DD
264 else
265 {
266 assert (0); /* Unknown interface type */
267 }
508e53e2 268
269 /* Virtual links */
270 /* xxx */
271 /* Point-to-Multipoint interfaces */
272 /* xxx */
718e3744 273 }
274
17d003da
DD
275 /* Fill LSA Header */
276 lsa_header->age = 0;
277 lsa_header->type = htons (OSPF6_LSTYPE_ROUTER);
278 lsa_header->id = htonl (link_state_id);
279 lsa_header->adv_router = oa->ospf6->router_id;
280 lsa_header->seqnum =
281 ospf6_new_ls_seqnum (lsa_header->type, lsa_header->id,
282 lsa_header->adv_router, oa->lsdb);
283 lsa_header->length = htons ((caddr_t) lsdesc - (caddr_t) buffer);
284
285 /* LSA checksum */
286 ospf6_lsa_checksum (lsa_header);
287
288 /* create LSA */
289 lsa = ospf6_lsa_create (lsa_header);
290
291 /* Originate */
292 ospf6_lsa_originate_area (lsa, oa);
293
294 link_state_id ++;
718e3744 295
508e53e2 296 /* Do premature-aging of rest, undesired Router-LSAs */
297 type = ntohs (OSPF6_LSTYPE_ROUTER);
298 router = oa->ospf6->router_id;
299 for (lsa = ospf6_lsdb_type_router_head (type, router, oa->lsdb); lsa;
300 lsa = ospf6_lsdb_type_router_next (type, router, lsa))
718e3744 301 {
508e53e2 302 if (ntohl (lsa->header->id) < link_state_id)
303 continue;
6452df09 304 ospf6_lsa_purge (lsa);
718e3744 305 }
718e3744 306
508e53e2 307 return 0;
308}
718e3744 309
508e53e2 310/*******************************/
311/* RFC2740 3.4.3.2 Network-LSA */
312/*******************************/
718e3744 313
6ac29a51 314static int
508e53e2 315ospf6_network_lsa_show (struct vty *vty, struct ospf6_lsa *lsa)
316{
317 char *start, *end, *current;
318 struct ospf6_network_lsa *network_lsa;
319 struct ospf6_network_lsdesc *lsdesc;
320 char buf[128], options[32];
321
322 network_lsa = (struct ospf6_network_lsa *)
323 ((caddr_t) lsa->header + sizeof (struct ospf6_lsa_header));
324
325 ospf6_options_printbuf (network_lsa->options, options, sizeof (options));
049207c3 326 vty_out (vty, " Options: %s%s", options, VNL);
718e3744 327
508e53e2 328 start = (char *) network_lsa + sizeof (struct ospf6_network_lsa);
329 end = (char *) lsa->header + ntohs (lsa->header->length);
330 for (current = start; current + sizeof (struct ospf6_network_lsdesc) <= end;
331 current += sizeof (struct ospf6_network_lsdesc))
718e3744 332 {
508e53e2 333 lsdesc = (struct ospf6_network_lsdesc *) current;
334 inet_ntop (AF_INET, &lsdesc->router_id, buf, sizeof (buf));
049207c3 335 vty_out (vty, " Attached Router: %s%s", buf, VNL);
718e3744 336 }
337 return 0;
338}
339
6452df09 340int
341ospf6_network_lsa_originate (struct thread *thread)
718e3744 342{
6452df09 343 struct ospf6_interface *oi;
344
508e53e2 345 char buffer [OSPF6_MAX_LSASIZE];
346 struct ospf6_lsa_header *lsa_header;
718e3744 347
508e53e2 348 int count;
349 struct ospf6_lsa *old, *lsa;
350 struct ospf6_network_lsa *network_lsa;
351 struct ospf6_network_lsdesc *lsdesc;
352 struct ospf6_neighbor *on;
353 struct ospf6_link_lsa *link_lsa;
52dc7ee6 354 struct listnode *i;
508e53e2 355 u_int16_t type;
356
6452df09 357 oi = (struct ospf6_interface *) THREAD_ARG (thread);
358 oi->thread_network_lsa = NULL;
359
360 /* The interface must be enabled until here. A Network-LSA of a
361 disabled interface (but was once enabled) should be flushed
362 by ospf6_lsa_refresh (), and does not come here. */
363 assert (oi->area);
718e3744 364
508e53e2 365 old = ospf6_lsdb_lookup (htons (OSPF6_LSTYPE_NETWORK),
366 htonl (oi->interface->ifindex),
367 oi->area->ospf6->router_id, oi->area->lsdb);
718e3744 368
508e53e2 369 /* Do not originate Network-LSA if not DR */
370 if (oi->state != OSPF6_INTERFACE_DR)
718e3744 371 {
508e53e2 372 if (old)
6452df09 373 ospf6_lsa_purge (old);
374 return 0;
508e53e2 375 }
718e3744 376
1e05838a 377 if (IS_OSPF6_DEBUG_ORIGINATE (NETWORK))
c6487d61 378 zlog_debug ("Originate Network-LSA for Interface %s", oi->interface->name);
718e3744 379
508e53e2 380 /* If none of neighbor is adjacent to us */
381 count = 0;
1eb8ef25 382
383 for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, i, on))
384 if (on->state == OSPF6_NEIGHBOR_FULL)
385 count++;
386
508e53e2 387 if (count == 0)
388 {
1e05838a 389 if (IS_OSPF6_DEBUG_ORIGINATE (NETWORK))
c6487d61 390 zlog_debug ("Interface stub, ignore");
508e53e2 391 if (old)
6452df09 392 ospf6_lsa_purge (old);
393 return 0;
718e3744 394 }
718e3744 395
508e53e2 396 /* prepare buffer */
397 memset (buffer, 0, sizeof (buffer));
398 lsa_header = (struct ospf6_lsa_header *) buffer;
399 network_lsa = (struct ospf6_network_lsa *)
400 ((caddr_t) lsa_header + sizeof (struct ospf6_lsa_header));
401
402 /* Collect the interface's Link-LSAs to describe
403 network's optional capabilities */
404 type = htons (OSPF6_LSTYPE_LINK);
405 for (lsa = ospf6_lsdb_type_head (type, oi->lsdb); lsa;
406 lsa = ospf6_lsdb_type_next (type, lsa))
407 {
408 link_lsa = (struct ospf6_link_lsa *)
409 ((caddr_t) lsa->header + sizeof (struct ospf6_lsa_header));
410 network_lsa->options[0] |= link_lsa->options[0];
411 network_lsa->options[1] |= link_lsa->options[1];
412 network_lsa->options[2] |= link_lsa->options[2];
413 }
718e3744 414
508e53e2 415 lsdesc = (struct ospf6_network_lsdesc *)
416 ((caddr_t) network_lsa + sizeof (struct ospf6_network_lsa));
718e3744 417
508e53e2 418 /* set Link Description to the router itself */
419 lsdesc->router_id = oi->area->ospf6->router_id;
420 lsdesc++;
718e3744 421
508e53e2 422 /* Walk through the neighbors */
1eb8ef25 423 for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, i, on))
718e3744 424 {
508e53e2 425 if (on->state != OSPF6_NEIGHBOR_FULL)
718e3744 426 continue;
427
508e53e2 428 /* set this neighbor's Router-ID to LSA */
429 lsdesc->router_id = on->router_id;
430 lsdesc++;
431 }
718e3744 432
508e53e2 433 /* Fill LSA Header */
434 lsa_header->age = 0;
435 lsa_header->type = htons (OSPF6_LSTYPE_NETWORK);
436 lsa_header->id = htonl (oi->interface->ifindex);
437 lsa_header->adv_router = oi->area->ospf6->router_id;
438 lsa_header->seqnum =
049207c3 439 ospf6_new_ls_seqnum (lsa_header->type, lsa_header->id,
440 lsa_header->adv_router, oi->area->lsdb);
508e53e2 441 lsa_header->length = htons ((caddr_t) lsdesc - (caddr_t) buffer);
442
443 /* LSA checksum */
444 ospf6_lsa_checksum (lsa_header);
445
446 /* create LSA */
447 lsa = ospf6_lsa_create (lsa_header);
508e53e2 448
449 /* Originate */
6452df09 450 ospf6_lsa_originate_area (lsa, oi->area);
508e53e2 451
452 return 0;
453}
718e3744 454
455
508e53e2 456/****************************/
457/* RFC2740 3.4.3.6 Link-LSA */
458/****************************/
459
6ac29a51 460static int
508e53e2 461ospf6_link_lsa_show (struct vty *vty, struct ospf6_lsa *lsa)
718e3744 462{
508e53e2 463 char *start, *end, *current;
464 struct ospf6_link_lsa *link_lsa;
465 int prefixnum;
466 char buf[128], options[32];
718e3744 467 struct ospf6_prefix *prefix;
0c083ee9 468 const char *p, *mc, *la, *nu;
718e3744 469 struct in6_addr in6;
718e3744 470
508e53e2 471 link_lsa = (struct ospf6_link_lsa *)
472 ((caddr_t) lsa->header + sizeof (struct ospf6_lsa_header));
718e3744 473
508e53e2 474 ospf6_options_printbuf (link_lsa->options, options, sizeof (options));
475 inet_ntop (AF_INET6, &link_lsa->linklocal_addr, buf, sizeof (buf));
476 prefixnum = ntohl (link_lsa->prefix_num);
718e3744 477
508e53e2 478 vty_out (vty, " Priority: %d Options: %s%s",
049207c3 479 link_lsa->priority, options, VNL);
480 vty_out (vty, " LinkLocal Address: %s%s", buf, VNL);
481 vty_out (vty, " Number of Prefix: %d%s", prefixnum, VNL);
718e3744 482
508e53e2 483 start = (char *) link_lsa + sizeof (struct ospf6_link_lsa);
484 end = (char *) lsa->header + ntohs (lsa->header->length);
718e3744 485 for (current = start; current < end; current += OSPF6_PREFIX_SIZE (prefix))
486 {
487 prefix = (struct ospf6_prefix *) current;
508e53e2 488 if (prefix->prefix_length == 0 ||
489 current + OSPF6_PREFIX_SIZE (prefix) > end)
490 break;
491
492 p = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_P) ?
493 "P" : "--");
494 mc = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_MC) ?
495 "MC" : "--");
496 la = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_LA) ?
497 "LA" : "--");
498 nu = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_NU) ?
499 "NU" : "--");
500 vty_out (vty, " Prefix Options: %s|%s|%s|%s%s",
049207c3 501 p, mc, la, nu, VNL);
508e53e2 502
503 memset (&in6, 0, sizeof (in6));
504 memcpy (&in6, OSPF6_PREFIX_BODY (prefix),
505 OSPF6_PREFIX_SPACE (prefix->prefix_length));
718e3744 506 inet_ntop (AF_INET6, &in6, buf, sizeof (buf));
507 vty_out (vty, " Prefix: %s/%d%s",
049207c3 508 buf, prefix->prefix_length, VNL);
718e3744 509 }
510
511 return 0;
512}
513
6452df09 514int
515ospf6_link_lsa_originate (struct thread *thread)
718e3744 516{
6452df09 517 struct ospf6_interface *oi;
518
508e53e2 519 char buffer[OSPF6_MAX_LSASIZE];
520 struct ospf6_lsa_header *lsa_header;
521 struct ospf6_lsa *old, *lsa;
718e3744 522
508e53e2 523 struct ospf6_link_lsa *link_lsa;
524 struct ospf6_route *route;
525 struct ospf6_prefix *op;
718e3744 526
6452df09 527 oi = (struct ospf6_interface *) THREAD_ARG (thread);
528 oi->thread_link_lsa = NULL;
529
530 assert (oi->area);
718e3744 531
532 /* find previous LSA */
508e53e2 533 old = ospf6_lsdb_lookup (htons (OSPF6_LSTYPE_LINK),
534 htonl (oi->interface->ifindex),
535 oi->area->ospf6->router_id, oi->lsdb);
718e3744 536
508e53e2 537 if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE))
718e3744 538 {
539 if (old)
6452df09 540 ospf6_lsa_purge (old);
541 return 0;
718e3744 542 }
543
1e05838a 544 if (IS_OSPF6_DEBUG_ORIGINATE (LINK))
c6487d61 545 zlog_debug ("Originate Link-LSA for Interface %s", oi->interface->name);
508e53e2 546
547 /* can't make Link-LSA if linklocal address not set */
548 if (oi->linklocal_addr == NULL)
718e3744 549 {
1e05838a 550 if (IS_OSPF6_DEBUG_ORIGINATE (LINK))
c6487d61 551 zlog_debug ("No Linklocal address on %s, defer originating",
508e53e2 552 oi->interface->name);
718e3744 553 if (old)
6452df09 554 ospf6_lsa_purge (old);
555 return 0;
718e3744 556 }
557
508e53e2 558 /* prepare buffer */
559 memset (buffer, 0, sizeof (buffer));
560 lsa_header = (struct ospf6_lsa_header *) buffer;
561 link_lsa = (struct ospf6_link_lsa *)
562 ((caddr_t) lsa_header + sizeof (struct ospf6_lsa_header));
563
564 /* Fill Link-LSA */
565 link_lsa->priority = oi->priority;
566 memcpy (link_lsa->options, oi->area->options, 3);
567 memcpy (&link_lsa->linklocal_addr, oi->linklocal_addr,
568 sizeof (struct in6_addr));
569 link_lsa->prefix_num = htonl (oi->route_connected->count);
570
571 op = (struct ospf6_prefix *)
572 ((caddr_t) link_lsa + sizeof (struct ospf6_link_lsa));
573
574 /* connected prefix to advertise */
575 for (route = ospf6_route_head (oi->route_connected); route;
576 route = ospf6_route_next (route))
718e3744 577 {
508e53e2 578 op->prefix_length = route->prefix.prefixlen;
579 op->prefix_options = route->path.prefix_options;
580 op->prefix_metric = htons (0);
581 memcpy (OSPF6_PREFIX_BODY (op), &route->prefix.u.prefix6,
582 OSPF6_PREFIX_SPACE (op->prefix_length));
583 op = OSPF6_PREFIX_NEXT (op);
584 }
718e3744 585
508e53e2 586 /* Fill LSA Header */
587 lsa_header->age = 0;
588 lsa_header->type = htons (OSPF6_LSTYPE_LINK);
589 lsa_header->id = htonl (oi->interface->ifindex);
590 lsa_header->adv_router = oi->area->ospf6->router_id;
591 lsa_header->seqnum =
049207c3 592 ospf6_new_ls_seqnum (lsa_header->type, lsa_header->id,
593 lsa_header->adv_router, oi->lsdb);
508e53e2 594 lsa_header->length = htons ((caddr_t) op - (caddr_t) buffer);
595
596 /* LSA checksum */
597 ospf6_lsa_checksum (lsa_header);
598
599 /* create LSA */
600 lsa = ospf6_lsa_create (lsa_header);
508e53e2 601
602 /* Originate */
6452df09 603 ospf6_lsa_originate_interface (lsa, oi);
718e3744 604
508e53e2 605 return 0;
606}
718e3744 607
718e3744 608
508e53e2 609/*****************************************/
610/* RFC2740 3.4.3.7 Intra-Area-Prefix-LSA */
611/*****************************************/
718e3744 612
6ac29a51 613static int
508e53e2 614ospf6_intra_prefix_lsa_show (struct vty *vty, struct ospf6_lsa *lsa)
615{
616 char *start, *end, *current;
617 struct ospf6_intra_prefix_lsa *intra_prefix_lsa;
618 int prefixnum;
619 char buf[128];
620 struct ospf6_prefix *prefix;
621 char id[16], adv_router[16];
0c083ee9 622 const char *p, *mc, *la, *nu;
508e53e2 623 struct in6_addr in6;
718e3744 624
508e53e2 625 intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)
626 ((caddr_t) lsa->header + sizeof (struct ospf6_lsa_header));
718e3744 627
508e53e2 628 prefixnum = ntohs (intra_prefix_lsa->prefix_num);
718e3744 629
049207c3 630 vty_out (vty, " Number of Prefix: %d%s", prefixnum, VNL);
718e3744 631
508e53e2 632 inet_ntop (AF_INET, &intra_prefix_lsa->ref_id, id, sizeof (id));
633 inet_ntop (AF_INET, &intra_prefix_lsa->ref_adv_router,
634 adv_router, sizeof (adv_router));
635 vty_out (vty, " Reference: %s Id: %s Adv: %s%s",
1e05838a 636 ospf6_lstype_name (intra_prefix_lsa->ref_type), id, adv_router,
049207c3 637 VNL);
718e3744 638
508e53e2 639 start = (char *) intra_prefix_lsa + sizeof (struct ospf6_intra_prefix_lsa);
640 end = (char *) lsa->header + ntohs (lsa->header->length);
641 for (current = start; current < end; current += OSPF6_PREFIX_SIZE (prefix))
718e3744 642 {
508e53e2 643 prefix = (struct ospf6_prefix *) current;
644 if (prefix->prefix_length == 0 ||
645 current + OSPF6_PREFIX_SIZE (prefix) > end)
646 break;
647
648 p = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_P) ?
649 "P" : "--");
650 mc = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_MC) ?
651 "MC" : "--");
652 la = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_LA) ?
653 "LA" : "--");
654 nu = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_NU) ?
655 "NU" : "--");
656 vty_out (vty, " Prefix Options: %s|%s|%s|%s%s",
049207c3 657 p, mc, la, nu, VNL);
508e53e2 658
659 memset (&in6, 0, sizeof (in6));
660 memcpy (&in6, OSPF6_PREFIX_BODY (prefix),
661 OSPF6_PREFIX_SPACE (prefix->prefix_length));
662 inet_ntop (AF_INET6, &in6, buf, sizeof (buf));
663 vty_out (vty, " Prefix: %s/%d%s",
049207c3 664 buf, prefix->prefix_length, VNL);
718e3744 665 }
718e3744 666
508e53e2 667 return 0;
718e3744 668}
669
6452df09 670int
671ospf6_intra_prefix_lsa_originate_stub (struct thread *thread)
718e3744 672{
6452df09 673 struct ospf6_area *oa;
674
508e53e2 675 char buffer[OSPF6_MAX_LSASIZE];
676 struct ospf6_lsa_header *lsa_header;
677 struct ospf6_lsa *old, *lsa;
678
679 struct ospf6_intra_prefix_lsa *intra_prefix_lsa;
680 struct ospf6_interface *oi;
681 struct ospf6_neighbor *on;
682 struct ospf6_route *route;
683 struct ospf6_prefix *op;
52dc7ee6 684 struct listnode *i, *j;
508e53e2 685 int full_count = 0;
686 unsigned short prefix_num = 0;
687 char buf[BUFSIZ];
688 struct ospf6_route_table *route_advertise;
718e3744 689
6452df09 690 oa = (struct ospf6_area *) THREAD_ARG (thread);
691 oa->thread_intra_prefix_lsa = NULL;
692
508e53e2 693 /* find previous LSA */
694 old = ospf6_lsdb_lookup (htons (OSPF6_LSTYPE_INTRA_PREFIX),
695 htonl (0), oa->ospf6->router_id, oa->lsdb);
718e3744 696
6452df09 697 if (! IS_AREA_ENABLED (oa))
718e3744 698 {
508e53e2 699 if (old)
6452df09 700 ospf6_lsa_purge (old);
701 return 0;
718e3744 702 }
718e3744 703
1e05838a 704 if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX))
c6487d61 705 zlog_debug ("Originate Intra-Area-Prefix-LSA for area %s's stub prefix",
508e53e2 706 oa->name);
707
708 /* prepare buffer */
709 memset (buffer, 0, sizeof (buffer));
710 lsa_header = (struct ospf6_lsa_header *) buffer;
711 intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)
712 ((caddr_t) lsa_header + sizeof (struct ospf6_lsa_header));
713
714 /* Fill Intra-Area-Prefix-LSA */
715 intra_prefix_lsa->ref_type = htons (OSPF6_LSTYPE_ROUTER);
716 intra_prefix_lsa->ref_id = htonl (0);
717 intra_prefix_lsa->ref_adv_router = oa->ospf6->router_id;
718e3744 718
cf1ce250 719 route_advertise = ospf6_route_table_create (0, 0);
718e3744 720
1eb8ef25 721 for (ALL_LIST_ELEMENTS_RO (oa->if_list, i, oi))
718e3744 722 {
508e53e2 723 if (oi->state == OSPF6_INTERFACE_DOWN)
718e3744 724 {
1e05838a 725 if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX))
c6487d61 726 zlog_debug (" Interface %s is down, ignore", oi->interface->name);
718e3744 727 continue;
728 }
729
508e53e2 730 full_count = 0;
1eb8ef25 731
732 for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, j, on))
733 if (on->state == OSPF6_NEIGHBOR_FULL)
734 full_count++;
735
508e53e2 736 if (oi->state != OSPF6_INTERFACE_LOOPBACK &&
737 oi->state != OSPF6_INTERFACE_POINTTOPOINT &&
738 full_count != 0)
718e3744 739 {
1e05838a 740 if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX))
c6487d61 741 zlog_debug (" Interface %s is not stub, ignore",
508e53e2 742 oi->interface->name);
718e3744 743 continue;
744 }
745
1e05838a 746 if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX))
c6487d61 747 zlog_debug (" Interface %s:", oi->interface->name);
718e3744 748
508e53e2 749 /* connected prefix to advertise */
750 for (route = ospf6_route_head (oi->route_connected); route;
751 route = ospf6_route_best_next (route))
718e3744 752 {
1e05838a 753 if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX))
508e53e2 754 {
755 prefix2str (&route->prefix, buf, sizeof (buf));
c6487d61 756 zlog_debug (" include %s", buf);
508e53e2 757 }
758 ospf6_route_add (ospf6_route_copy (route), route_advertise);
759 }
760 }
718e3744 761
508e53e2 762 if (route_advertise->count == 0)
763 {
764 if (old)
6452df09 765 ospf6_lsa_purge (old);
508e53e2 766 ospf6_route_table_delete (route_advertise);
6452df09 767 return 0;
508e53e2 768 }
718e3744 769
508e53e2 770 /* put prefixes to advertise */
771 prefix_num = 0;
772 op = (struct ospf6_prefix *)
773 ((caddr_t) intra_prefix_lsa + sizeof (struct ospf6_intra_prefix_lsa));
774 for (route = ospf6_route_head (route_advertise); route;
775 route = ospf6_route_best_next (route))
776 {
777 op->prefix_length = route->prefix.prefixlen;
778 op->prefix_options = route->path.prefix_options;
779 op->prefix_metric = htons (route->path.cost);
780 memcpy (OSPF6_PREFIX_BODY (op), &route->prefix.u.prefix6,
781 OSPF6_PREFIX_SPACE (op->prefix_length));
782 op = OSPF6_PREFIX_NEXT (op);
783 prefix_num++;
784 }
718e3744 785
508e53e2 786 ospf6_route_table_delete (route_advertise);
718e3744 787
508e53e2 788 if (prefix_num == 0)
789 {
1e05838a 790 if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX))
c6487d61 791 zlog_debug ("Quit to Advertise Intra-Prefix: no route to advertise");
6452df09 792 return 0;
508e53e2 793 }
718e3744 794
508e53e2 795 intra_prefix_lsa->prefix_num = htons (prefix_num);
796
797 /* Fill LSA Header */
798 lsa_header->age = 0;
799 lsa_header->type = htons (OSPF6_LSTYPE_INTRA_PREFIX);
800 lsa_header->id = htonl (0);
801 lsa_header->adv_router = oa->ospf6->router_id;
802 lsa_header->seqnum =
049207c3 803 ospf6_new_ls_seqnum (lsa_header->type, lsa_header->id,
804 lsa_header->adv_router, oa->lsdb);
508e53e2 805 lsa_header->length = htons ((caddr_t) op - (caddr_t) lsa_header);
806
807 /* LSA checksum */
808 ospf6_lsa_checksum (lsa_header);
809
810 /* create LSA */
811 lsa = ospf6_lsa_create (lsa_header);
508e53e2 812
813 /* Originate */
6452df09 814 ospf6_lsa_originate_area (lsa, oa);
815
816 return 0;
508e53e2 817}
718e3744 818
6452df09 819
820int
821ospf6_intra_prefix_lsa_originate_transit (struct thread *thread)
508e53e2 822{
6452df09 823 struct ospf6_interface *oi;
824
508e53e2 825 char buffer[OSPF6_MAX_LSASIZE];
826 struct ospf6_lsa_header *lsa_header;
827 struct ospf6_lsa *old, *lsa;
828
829 struct ospf6_intra_prefix_lsa *intra_prefix_lsa;
830 struct ospf6_neighbor *on;
831 struct ospf6_route *route;
832 struct ospf6_prefix *op;
52dc7ee6 833 struct listnode *i;
508e53e2 834 int full_count = 0;
835 unsigned short prefix_num = 0;
836 struct ospf6_route_table *route_advertise;
837 struct ospf6_link_lsa *link_lsa;
838 char *start, *end, *current;
839 u_int16_t type;
840 char buf[BUFSIZ];
718e3744 841
6452df09 842 oi = (struct ospf6_interface *) THREAD_ARG (thread);
843 oi->thread_intra_prefix_lsa = NULL;
844
845 assert (oi->area);
718e3744 846
508e53e2 847 /* find previous LSA */
848 old = ospf6_lsdb_lookup (htons (OSPF6_LSTYPE_INTRA_PREFIX),
849 htonl (oi->interface->ifindex),
850 oi->area->ospf6->router_id, oi->area->lsdb);
718e3744 851
508e53e2 852 if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE))
718e3744 853 {
718e3744 854 if (old)
6452df09 855 ospf6_lsa_purge (old);
856 return 0;
718e3744 857 }
858
1e05838a 859 if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX))
c6487d61 860 zlog_debug ("Originate Intra-Area-Prefix-LSA for interface %s's prefix",
508e53e2 861 oi->interface->name);
862
718e3744 863 /* prepare buffer */
864 memset (buffer, 0, sizeof (buffer));
508e53e2 865 lsa_header = (struct ospf6_lsa_header *) buffer;
866 intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)
867 ((caddr_t) lsa_header + sizeof (struct ospf6_lsa_header));
718e3744 868
508e53e2 869 /* Fill Intra-Area-Prefix-LSA */
870 intra_prefix_lsa->ref_type = htons (OSPF6_LSTYPE_NETWORK);
871 intra_prefix_lsa->ref_id = htonl (oi->interface->ifindex);
872 intra_prefix_lsa->ref_adv_router = oi->area->ospf6->router_id;
718e3744 873
508e53e2 874 if (oi->state != OSPF6_INTERFACE_DR)
718e3744 875 {
1e05838a 876 if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX))
c6487d61 877 zlog_debug (" Interface is not DR");
508e53e2 878 if (old)
6452df09 879 ospf6_lsa_purge (old);
880 return 0;
508e53e2 881 }
882
883 full_count = 0;
1eb8ef25 884 for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, i, on))
885 if (on->state == OSPF6_NEIGHBOR_FULL)
886 full_count++;
887
508e53e2 888 if (full_count == 0)
889 {
1e05838a 890 if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX))
c6487d61 891 zlog_debug (" Interface is stub");
508e53e2 892 if (old)
6452df09 893 ospf6_lsa_purge (old);
894 return 0;
508e53e2 895 }
896
897 /* connected prefix to advertise */
cf1ce250 898 route_advertise = ospf6_route_table_create (0, 0);
508e53e2 899
900 type = ntohs (OSPF6_LSTYPE_LINK);
901 for (lsa = ospf6_lsdb_type_head (type, oi->lsdb); lsa;
902 lsa = ospf6_lsdb_type_next (type, lsa))
903 {
904 if (OSPF6_LSA_IS_MAXAGE (lsa))
905 continue;
718e3744 906
1e05838a 907 if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX))
c6487d61 908 zlog_debug (" include prefix from %s", lsa->name);
718e3744 909
508e53e2 910 if (lsa->header->adv_router != oi->area->ospf6->router_id)
911 {
912 on = ospf6_neighbor_lookup (lsa->header->adv_router, oi);
913 if (on == NULL || on->state != OSPF6_NEIGHBOR_FULL)
914 {
1e05838a 915 if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX))
c6487d61 916 zlog_debug (" Neighbor not found or not Full, ignore");
508e53e2 917 continue;
918 }
919 }
920
921 link_lsa = (struct ospf6_link_lsa *)
922 ((caddr_t) lsa->header + sizeof (struct ospf6_lsa_header));
923
924 prefix_num = (unsigned short) ntohl (link_lsa->prefix_num);
925 start = (char *) link_lsa + sizeof (struct ospf6_link_lsa);
926 end = (char *) lsa->header + ntohs (lsa->header->length);
927 for (current = start; current < end && prefix_num;
928 current += OSPF6_PREFIX_SIZE (op))
929 {
930 op = (struct ospf6_prefix *) current;
931 if (op->prefix_length == 0 ||
932 current + OSPF6_PREFIX_SIZE (op) > end)
933 break;
934
935 route = ospf6_route_create ();
936
937 route->type = OSPF6_DEST_TYPE_NETWORK;
938 route->prefix.family = AF_INET6;
939 route->prefix.prefixlen = op->prefix_length;
940 memset (&route->prefix.u.prefix6, 0, sizeof (struct in6_addr));
941 memcpy (&route->prefix.u.prefix6, OSPF6_PREFIX_BODY (op),
942 OSPF6_PREFIX_SPACE (op->prefix_length));
943
944 route->path.origin.type = lsa->header->type;
945 route->path.origin.id = lsa->header->id;
946 route->path.origin.adv_router = lsa->header->adv_router;
947 route->path.options[0] = link_lsa->options[0];
948 route->path.options[1] = link_lsa->options[1];
949 route->path.options[2] = link_lsa->options[2];
950 route->path.prefix_options = op->prefix_options;
951 route->path.area_id = oi->area->area_id;
952 route->path.type = OSPF6_PATH_TYPE_INTRA;
953
1e05838a 954 if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX))
508e53e2 955 {
956 prefix2str (&route->prefix, buf, sizeof (buf));
c6487d61 957 zlog_debug (" include %s", buf);
508e53e2 958 }
959
960 ospf6_route_add (route, route_advertise);
961 prefix_num--;
962 }
1e05838a 963 if (current != end && IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX))
c6487d61 964 zlog_debug ("Trailing garbage in %s", lsa->name);
718e3744 965 }
718e3744 966
508e53e2 967 op = (struct ospf6_prefix *)
968 ((caddr_t) intra_prefix_lsa + sizeof (struct ospf6_intra_prefix_lsa));
969
970 prefix_num = 0;
971 for (route = ospf6_route_head (route_advertise); route;
972 route = ospf6_route_best_next (route))
718e3744 973 {
508e53e2 974 op->prefix_length = route->prefix.prefixlen;
975 op->prefix_options = route->path.prefix_options;
976 op->prefix_metric = htons (0);
977 memcpy (OSPF6_PREFIX_BODY (op), &route->prefix.u.prefix6,
978 OSPF6_PREFIX_SPACE (op->prefix_length));
979 op = OSPF6_PREFIX_NEXT (op);
980 prefix_num++;
718e3744 981 }
718e3744 982
508e53e2 983 ospf6_route_table_delete (route_advertise);
718e3744 984
508e53e2 985 if (prefix_num == 0)
718e3744 986 {
1e05838a 987 if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX))
c6487d61 988 zlog_debug ("Quit to Advertise Intra-Prefix: no route to advertise");
6452df09 989 return 0;
718e3744 990 }
508e53e2 991
992 intra_prefix_lsa->prefix_num = htons (prefix_num);
993
994 /* Fill LSA Header */
995 lsa_header->age = 0;
996 lsa_header->type = htons (OSPF6_LSTYPE_INTRA_PREFIX);
997 lsa_header->id = htonl (oi->interface->ifindex);
998 lsa_header->adv_router = oi->area->ospf6->router_id;
999 lsa_header->seqnum =
049207c3 1000 ospf6_new_ls_seqnum (lsa_header->type, lsa_header->id,
1001 lsa_header->adv_router, oi->area->lsdb);
508e53e2 1002 lsa_header->length = htons ((caddr_t) op - (caddr_t) lsa_header);
1003
1004 /* LSA checksum */
1005 ospf6_lsa_checksum (lsa_header);
1006
1007 /* create LSA */
1008 lsa = ospf6_lsa_create (lsa_header);
508e53e2 1009
1010 /* Originate */
6452df09 1011 ospf6_lsa_originate_area (lsa, oi->area);
508e53e2 1012
1013 return 0;
1014}
1015
1016void
1017ospf6_intra_prefix_lsa_add (struct ospf6_lsa *lsa)
1018{
1019 struct ospf6_area *oa;
1020 struct ospf6_intra_prefix_lsa *intra_prefix_lsa;
1021 struct prefix ls_prefix;
1022 struct ospf6_route *route, *ls_entry;
1023 int i, prefix_num;
1024 struct ospf6_prefix *op;
1025 char *start, *current, *end;
1026 char buf[64];
b81e97a8
DD
1027 struct interface *ifp;
1028 int direct_connect = 0;
508e53e2 1029
ccb59b11 1030 if (OSPF6_LSA_IS_MAXAGE (lsa))
1031 return;
1032
1e05838a 1033 if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX))
c6487d61 1034 zlog_debug ("%s found", lsa->name);
508e53e2 1035
6452df09 1036 oa = OSPF6_AREA (lsa->lsdb->data);
1037
508e53e2 1038 intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)
1039 OSPF6_LSA_HEADER_END (lsa->header);
1040 if (intra_prefix_lsa->ref_type == htons (OSPF6_LSTYPE_ROUTER))
1041 ospf6_linkstate_prefix (intra_prefix_lsa->ref_adv_router,
1042 htonl (0), &ls_prefix);
1043 else if (intra_prefix_lsa->ref_type == htons (OSPF6_LSTYPE_NETWORK))
1044 ospf6_linkstate_prefix (intra_prefix_lsa->ref_adv_router,
1045 intra_prefix_lsa->ref_id, &ls_prefix);
718e3744 1046 else
1047 {
1e05838a 1048 if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX))
c6487d61 1049 zlog_debug ("Unknown reference LS-type: %#hx",
1050 ntohs (intra_prefix_lsa->ref_type));
508e53e2 1051 return;
718e3744 1052 }
1053
508e53e2 1054 ls_entry = ospf6_route_lookup (&ls_prefix, oa->spf_table);
1055 if (ls_entry == NULL)
1056 {
1e05838a 1057 if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX))
508e53e2 1058 {
1059 ospf6_linkstate_prefix2str (&ls_prefix, buf, sizeof (buf));
c6487d61 1060 zlog_debug ("LS entry does not exist: %s", buf);
508e53e2 1061 }
1062 return;
1063 }
1064
b81e97a8
DD
1065 if (intra_prefix_lsa->ref_adv_router == oa->ospf6->router_id)
1066 {
1067 /* the intra-prefix are directly connected */
1068 direct_connect = 1;
1069 }
1070
508e53e2 1071 prefix_num = ntohs (intra_prefix_lsa->prefix_num);
1072 start = (caddr_t) intra_prefix_lsa +
1073 sizeof (struct ospf6_intra_prefix_lsa);
1074 end = OSPF6_LSA_END (lsa->header);
1075 for (current = start; current < end; current += OSPF6_PREFIX_SIZE (op))
1076 {
1077 op = (struct ospf6_prefix *) current;
1078 if (prefix_num == 0)
1079 break;
1080 if (end < current + OSPF6_PREFIX_SIZE (op))
1081 break;
1082
1083 route = ospf6_route_create ();
ccb59b11 1084
1085 memset (&route->prefix, 0, sizeof (struct prefix));
508e53e2 1086 route->prefix.family = AF_INET6;
ccb59b11 1087 route->prefix.prefixlen = op->prefix_length;
1088 ospf6_prefix_in6_addr (&route->prefix.u.prefix6, op);
1089
508e53e2 1090 route->type = OSPF6_DEST_TYPE_NETWORK;
1091 route->path.origin.type = lsa->header->type;
1092 route->path.origin.id = lsa->header->id;
1093 route->path.origin.adv_router = lsa->header->adv_router;
1094 route->path.prefix_options = op->prefix_options;
1095 route->path.area_id = oa->area_id;
1096 route->path.type = OSPF6_PATH_TYPE_INTRA;
1097 route->path.metric_type = 1;
1098 route->path.cost = ls_entry->path.cost +
1099 ntohs (op->prefix_metric);
1100
b81e97a8
DD
1101 if (direct_connect)
1102 {
1103 ifp = if_lookup_prefix(&route->prefix);
1104 if (ifp)
1105 route->nexthop[0].ifindex = ifp->ifindex;
1106 }
1107 else
1108 {
1109 for (i = 0; ospf6_nexthop_is_set (&ls_entry->nexthop[i]) &&
1110 i < OSPF6_MULTI_PATH_LIMIT; i++)
1111 ospf6_nexthop_copy (&route->nexthop[i], &ls_entry->nexthop[i]);
1112 }
508e53e2 1113
1e05838a 1114 if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX))
508e53e2 1115 {
1116 prefix2str (&route->prefix, buf, sizeof (buf));
c6487d61 1117 zlog_debug (" add %s", buf);
508e53e2 1118 }
1119
1120 ospf6_route_add (route, oa->route_table);
1121 prefix_num--;
1122 }
1123
1e05838a 1124 if (current != end && IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX))
c6487d61 1125 zlog_debug ("Trailing garbage ignored");
718e3744 1126}
1127
1128void
508e53e2 1129ospf6_intra_prefix_lsa_remove (struct ospf6_lsa *lsa)
718e3744 1130{
508e53e2 1131 struct ospf6_area *oa;
1132 struct ospf6_intra_prefix_lsa *intra_prefix_lsa;
1133 struct prefix prefix;
1134 struct ospf6_route *route;
1135 int prefix_num;
1136 struct ospf6_prefix *op;
1137 char *start, *current, *end;
1138 char buf[64];
1139
1e05838a 1140 if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX))
c6487d61 1141 zlog_debug ("%s disappearing", lsa->name);
508e53e2 1142
6452df09 1143 oa = OSPF6_AREA (lsa->lsdb->data);
1144
508e53e2 1145 intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)
1146 OSPF6_LSA_HEADER_END (lsa->header);
1147
1148 prefix_num = ntohs (intra_prefix_lsa->prefix_num);
1149 start = (caddr_t) intra_prefix_lsa +
1150 sizeof (struct ospf6_intra_prefix_lsa);
1151 end = OSPF6_LSA_END (lsa->header);
1152 for (current = start; current < end; current += OSPF6_PREFIX_SIZE (op))
1153 {
1154 op = (struct ospf6_prefix *) current;
1155 if (prefix_num == 0)
1156 break;
1157 if (end < current + OSPF6_PREFIX_SIZE (op))
1158 break;
1159 prefix_num--;
1160
ccb59b11 1161 memset (&prefix, 0, sizeof (struct prefix));
508e53e2 1162 prefix.family = AF_INET6;
1163 prefix.prefixlen = op->prefix_length;
1164 ospf6_prefix_in6_addr (&prefix.u.prefix6, op);
1165
1166 route = ospf6_route_lookup (&prefix, oa->route_table);
1167 if (route == NULL)
1168 continue;
1169
1170 for (ospf6_route_lock (route);
1171 route && ospf6_route_is_prefix (&prefix, route);
1172 route = ospf6_route_next (route))
1173 {
1174 if (route->type != OSPF6_DEST_TYPE_NETWORK)
1175 continue;
1176 if (route->path.area_id != oa->area_id)
1177 continue;
1178 if (route->path.type != OSPF6_PATH_TYPE_INTRA)
1179 continue;
1180 if (route->path.origin.type != lsa->header->type ||
1181 route->path.origin.id != lsa->header->id ||
1182 route->path.origin.adv_router != lsa->header->adv_router)
1183 continue;
1184
1e05838a 1185 if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX))
508e53e2 1186 {
1187 prefix2str (&route->prefix, buf, sizeof (buf));
c6487d61 1188 zlog_debug ("remove %s", buf);
508e53e2 1189 }
1190 ospf6_route_remove (route, oa->route_table);
1191 }
e7a6d80d
TG
1192 if (route)
1193 ospf6_route_unlock (route);
508e53e2 1194 }
1195
1e05838a 1196 if (current != end && IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX))
c6487d61 1197 zlog_debug ("Trailing garbage ignored");
718e3744 1198}
1199
1200void
508e53e2 1201ospf6_intra_route_calculation (struct ospf6_area *oa)
718e3744 1202{
508e53e2 1203 struct ospf6_route *route;
1204 u_int16_t type;
1205 struct ospf6_lsa *lsa;
1206 void (*hook_add) (struct ospf6_route *) = NULL;
1207 void (*hook_remove) (struct ospf6_route *) = NULL;
1208
1e05838a 1209 if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX))
c6487d61 1210 zlog_debug ("Re-examin intra-routes for area %s", oa->name);
508e53e2 1211
1212 hook_add = oa->route_table->hook_add;
1213 hook_remove = oa->route_table->hook_remove;
1214 oa->route_table->hook_add = NULL;
1215 oa->route_table->hook_remove = NULL;
1216
1217 for (route = ospf6_route_head (oa->route_table); route;
1218 route = ospf6_route_next (route))
1219 route->flag = OSPF6_ROUTE_REMOVE;
1220
1221 type = htons (OSPF6_LSTYPE_INTRA_PREFIX);
1222 for (lsa = ospf6_lsdb_type_head (type, oa->lsdb); lsa;
1223 lsa = ospf6_lsdb_type_next (type, lsa))
1224 ospf6_intra_prefix_lsa_add (lsa);
1225
1226 oa->route_table->hook_add = hook_add;
1227 oa->route_table->hook_remove = hook_remove;
1228
1229 for (route = ospf6_route_head (oa->route_table); route;
1230 route = ospf6_route_next (route))
1231 {
1232 if (CHECK_FLAG (route->flag, OSPF6_ROUTE_REMOVE) &&
1233 CHECK_FLAG (route->flag, OSPF6_ROUTE_ADD))
1234 {
1235 UNSET_FLAG (route->flag, OSPF6_ROUTE_REMOVE);
1236 UNSET_FLAG (route->flag, OSPF6_ROUTE_ADD);
1237 }
1238
1239 if (CHECK_FLAG (route->flag, OSPF6_ROUTE_REMOVE))
1240 ospf6_route_remove (route, oa->route_table);
1241 else if (CHECK_FLAG (route->flag, OSPF6_ROUTE_ADD) ||
1242 CHECK_FLAG (route->flag, OSPF6_ROUTE_CHANGE))
1243 {
1244 if (hook_add)
1245 (*hook_add) (route);
1246 }
1247
1248 route->flag = 0;
1249 }
1250
1e05838a 1251 if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX))
c6487d61 1252 zlog_debug ("Re-examin intra-routes for area %s: Done", oa->name);
718e3744 1253}
1254
6ac29a51 1255static void
cf1ce250
PJ
1256ospf6_brouter_debug_print (struct ospf6_route *brouter)
1257{
1258 u_int32_t brouter_id;
1259 char brouter_name[16];
1260 char area_name[16];
1261 char destination[64];
1262 char installed[16], changed[16];
1263 struct timeval now, res;
1264 char id[16], adv_router[16];
1265 char capa[16], options[16];
1266
1267 brouter_id = ADV_ROUTER_IN_PREFIX (&brouter->prefix);
1268 inet_ntop (AF_INET, &brouter_id, brouter_name, sizeof (brouter_name));
1269 inet_ntop (AF_INET, &brouter->path.area_id, area_name, sizeof (area_name));
1270 ospf6_linkstate_prefix2str (&brouter->prefix, destination,
1271 sizeof (destination));
1272
86f72dcb 1273 quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
cf1ce250
PJ
1274 timersub (&now, &brouter->installed, &res);
1275 timerstring (&res, installed, sizeof (installed));
1276
86f72dcb 1277 quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
cf1ce250
PJ
1278 timersub (&now, &brouter->changed, &res);
1279 timerstring (&res, changed, sizeof (changed));
1280
1281 inet_ntop (AF_INET, &brouter->path.origin.id, id, sizeof (id));
1282 inet_ntop (AF_INET, &brouter->path.origin.adv_router, adv_router,
1283 sizeof (adv_router));
1284
1285 ospf6_options_printbuf (brouter->path.options, options, sizeof (options));
1286 ospf6_capability_printbuf (brouter->path.router_bits, capa, sizeof (capa));
1287
1288 zlog_info ("Brouter: %s via area %s", brouter_name, area_name);
1289 zlog_info (" memory: prev: %p this: %p next: %p parent rnode: %p",
1290 brouter->prev, brouter, brouter->next, brouter->rnode);
1291 zlog_info (" type: %d prefix: %s installed: %s changed: %s",
1292 brouter->type, destination, installed, changed);
1293 zlog_info (" lock: %d flags: %s%s%s%s", brouter->lock,
1294 (CHECK_FLAG (brouter->flag, OSPF6_ROUTE_BEST) ? "B" : "-"),
1295 (CHECK_FLAG (brouter->flag, OSPF6_ROUTE_ADD) ? "A" : "-"),
1296 (CHECK_FLAG (brouter->flag, OSPF6_ROUTE_REMOVE) ? "R" : "-"),
1297 (CHECK_FLAG (brouter->flag, OSPF6_ROUTE_CHANGE) ? "C" : "-"));
1298 zlog_info (" path type: %s ls-origin %s id: %s adv-router %s",
1299 OSPF6_PATH_TYPE_NAME (brouter->path.type),
1300 ospf6_lstype_name (brouter->path.origin.type),
1301 id, adv_router);
1302 zlog_info (" options: %s router-bits: %s metric-type: %d metric: %d/%d",
1303 options, capa, brouter->path.metric_type,
1304 brouter->path.cost, brouter->path.cost_e2);
1305}
1306
718e3744 1307void
6452df09 1308ospf6_intra_brouter_calculation (struct ospf6_area *oa)
718e3744 1309{
cb4b8845 1310 struct ospf6_route *brouter, *copy;
508e53e2 1311 void (*hook_add) (struct ospf6_route *) = NULL;
1312 void (*hook_remove) (struct ospf6_route *) = NULL;
cb4b8845
PJ
1313 u_int32_t brouter_id;
1314 char brouter_name[16];
1315
1316 if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID (oa->area_id))
1317 zlog_info ("border-router calculation for area %s", oa->name);
1318
6452df09 1319 hook_add = oa->ospf6->brouter_table->hook_add;
1320 hook_remove = oa->ospf6->brouter_table->hook_remove;
1321 oa->ospf6->brouter_table->hook_add = NULL;
1322 oa->ospf6->brouter_table->hook_remove = NULL;
508e53e2 1323
6452df09 1324 /* withdraw the previous router entries for the area */
cb4b8845
PJ
1325 for (brouter = ospf6_route_head (oa->ospf6->brouter_table); brouter;
1326 brouter = ospf6_route_next (brouter))
508e53e2 1327 {
cf1ce250
PJ
1328 brouter_id = ADV_ROUTER_IN_PREFIX (&brouter->prefix);
1329 inet_ntop (AF_INET, &brouter_id, brouter_name, sizeof (brouter_name));
cb4b8845 1330 if (brouter->path.area_id != oa->area_id)
508e53e2 1331 continue;
cb4b8845 1332 brouter->flag = OSPF6_ROUTE_REMOVE;
cf1ce250
PJ
1333
1334 if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID (brouter_id) ||
1335 IS_OSPF6_DEBUG_ROUTE (MEMORY))
1336 {
1337 zlog_info ("%p: mark as removing: area %s brouter %s",
1338 brouter, oa->name, brouter_name);
1339 ospf6_brouter_debug_print (brouter);
1340 }
508e53e2 1341 }
1342
cb4b8845
PJ
1343 for (brouter = ospf6_route_head (oa->spf_table); brouter;
1344 brouter = ospf6_route_next (brouter))
508e53e2 1345 {
cf1ce250
PJ
1346 brouter_id = ADV_ROUTER_IN_PREFIX (&brouter->prefix);
1347 inet_ntop (AF_INET, &brouter_id, brouter_name, sizeof (brouter_name));
1348
cb4b8845 1349 if (brouter->type != OSPF6_DEST_TYPE_LINKSTATE)
508e53e2 1350 continue;
cb4b8845 1351 if (ospf6_linkstate_prefix_id (&brouter->prefix) != htonl (0))
508e53e2 1352 continue;
cb4b8845
PJ
1353 if (! CHECK_FLAG (brouter->path.router_bits, OSPF6_ROUTER_BIT_E) &&
1354 ! CHECK_FLAG (brouter->path.router_bits, OSPF6_ROUTER_BIT_B))
508e53e2 1355 continue;
1356
cb4b8845 1357 copy = ospf6_route_copy (brouter);
508e53e2 1358 copy->type = OSPF6_DEST_TYPE_ROUTER;
ccb59b11 1359 copy->path.area_id = oa->area_id;
6452df09 1360 ospf6_route_add (copy, oa->ospf6->brouter_table);
cf1ce250
PJ
1361
1362 if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID (brouter_id) ||
1363 IS_OSPF6_DEBUG_ROUTE (MEMORY))
1364 {
1365 zlog_info ("%p: transfer: area %s brouter %s",
1366 brouter, oa->name, brouter_name);
1367 ospf6_brouter_debug_print (brouter);
1368 }
508e53e2 1369 }
1370
6452df09 1371 oa->ospf6->brouter_table->hook_add = hook_add;
1372 oa->ospf6->brouter_table->hook_remove = hook_remove;
508e53e2 1373
cb4b8845
PJ
1374 for (brouter = ospf6_route_head (oa->ospf6->brouter_table); brouter;
1375 brouter = ospf6_route_next (brouter))
508e53e2 1376 {
cb4b8845
PJ
1377 brouter_id = ADV_ROUTER_IN_PREFIX (&brouter->prefix);
1378 inet_ntop (AF_INET, &brouter_id, brouter_name, sizeof (brouter_name));
1379
1380 if (brouter->path.area_id != oa->area_id)
508e53e2 1381 continue;
1382
cb4b8845 1383 if (CHECK_FLAG (brouter->flag, OSPF6_ROUTE_WAS_REMOVED))
9428f2dc 1384 continue;
1385
cb4b8845
PJ
1386 if (CHECK_FLAG (brouter->flag, OSPF6_ROUTE_REMOVE) &&
1387 CHECK_FLAG (brouter->flag, OSPF6_ROUTE_ADD))
508e53e2 1388 {
cb4b8845
PJ
1389 UNSET_FLAG (brouter->flag, OSPF6_ROUTE_REMOVE);
1390 UNSET_FLAG (brouter->flag, OSPF6_ROUTE_ADD);
508e53e2 1391 }
1392
cb4b8845 1393 if (CHECK_FLAG (brouter->flag, OSPF6_ROUTE_REMOVE))
508e53e2 1394 {
cb4b8845
PJ
1395 if (IS_OSPF6_DEBUG_BROUTER ||
1396 IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID (brouter_id) ||
1397 IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID (oa->area_id))
1398 zlog_info ("brouter %s disappears via area %s",
1399 brouter_name, oa->name);
1400 ospf6_route_remove (brouter, oa->ospf6->brouter_table);
1401 }
1402 else if (CHECK_FLAG (brouter->flag, OSPF6_ROUTE_ADD) ||
1403 CHECK_FLAG (brouter->flag, OSPF6_ROUTE_CHANGE))
1404 {
1405 if (IS_OSPF6_DEBUG_BROUTER ||
1406 IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID (brouter_id) ||
1407 IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID (oa->area_id))
1408 zlog_info ("brouter %s appears via area %s",
1409 brouter_name, oa->name);
cf1ce250 1410
cb4b8845 1411 /* newly added */
508e53e2 1412 if (hook_add)
cb4b8845
PJ
1413 (*hook_add) (brouter);
1414 }
1415 else
1416 {
1417 if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID (brouter_id) ||
1418 IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID (oa->area_id))
1419 zlog_info ("brouter %s still exists via area %s",
1420 brouter_name, oa->name);
508e53e2 1421 }
1422
cb4b8845 1423 brouter->flag = 0;
508e53e2 1424 }
1425
cb4b8845
PJ
1426 if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID (oa->area_id))
1427 zlog_info ("border-router calculation for area %s: done", oa->name);
718e3744 1428}
1429
6452df09 1430struct ospf6_lsa_handler router_handler =
1431{
1432 OSPF6_LSTYPE_ROUTER,
1433 "Router",
1434 ospf6_router_lsa_show
1435};
1436
1437struct ospf6_lsa_handler network_handler =
1438{
1439 OSPF6_LSTYPE_NETWORK,
1440 "Network",
1441 ospf6_network_lsa_show
1442};
1443
1444struct ospf6_lsa_handler link_handler =
1445{
1446 OSPF6_LSTYPE_LINK,
1447 "Link",
1448 ospf6_link_lsa_show
1449};
1450
1451struct ospf6_lsa_handler intra_prefix_handler =
1452{
1453 OSPF6_LSTYPE_INTRA_PREFIX,
1454 "Intra-Prefix",
1455 ospf6_intra_prefix_lsa_show
1456};
1457
718e3744 1458void
cb4b8845 1459ospf6_intra_init (void)
718e3744 1460{
6452df09 1461 ospf6_install_lsa_handler (&router_handler);
1462 ospf6_install_lsa_handler (&network_handler);
1463 ospf6_install_lsa_handler (&link_handler);
1464 ospf6_install_lsa_handler (&intra_prefix_handler);
718e3744 1465}
1466
cb4b8845
PJ
1467DEFUN (debug_ospf6_brouter,
1468 debug_ospf6_brouter_cmd,
1469 "debug ospf6 border-routers",
1470 DEBUG_STR
1471 OSPF6_STR
1472 "Debug border router\n"
1473 )
1474{
1475 OSPF6_DEBUG_BROUTER_ON ();
1476 return CMD_SUCCESS;
1477}
1478
1479DEFUN (no_debug_ospf6_brouter,
1480 no_debug_ospf6_brouter_cmd,
1481 "no debug ospf6 border-routers",
1482 NO_STR
1483 DEBUG_STR
1484 OSPF6_STR
1485 "Debug border router\n"
1486 )
1487{
1488 OSPF6_DEBUG_BROUTER_OFF ();
1489 return CMD_SUCCESS;
1490}
1491
1492DEFUN (debug_ospf6_brouter_router,
1493 debug_ospf6_brouter_router_cmd,
1494 "debug ospf6 border-routers router-id A.B.C.D",
1495 DEBUG_STR
1496 OSPF6_STR
1497 "Debug border router\n"
1498 "Debug specific border router\n"
1499 "Specify border-router's router-id\n"
1500 )
1501{
1502 u_int32_t router_id;
1503 inet_pton (AF_INET, argv[0], &router_id);
1504 OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ON (router_id);
1505 return CMD_SUCCESS;
1506}
1507
1508DEFUN (no_debug_ospf6_brouter_router,
1509 no_debug_ospf6_brouter_router_cmd,
1510 "no debug ospf6 border-routers router-id",
1511 NO_STR
1512 DEBUG_STR
1513 OSPF6_STR
1514 "Debug border router\n"
1515 "Debug specific border router\n"
1516 )
1517{
1518 OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_OFF ();
1519 return CMD_SUCCESS;
1520}
1521
1522DEFUN (debug_ospf6_brouter_area,
1523 debug_ospf6_brouter_area_cmd,
1524 "debug ospf6 border-routers area-id A.B.C.D",
1525 DEBUG_STR
1526 OSPF6_STR
1527 "Debug border router\n"
1528 "Debug border routers in specific Area\n"
1529 "Specify Area-ID\n"
1530 )
1531{
1532 u_int32_t area_id;
1533 inet_pton (AF_INET, argv[0], &area_id);
1534 OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ON (area_id);
1535 return CMD_SUCCESS;
1536}
1537
1538DEFUN (no_debug_ospf6_brouter_area,
1539 no_debug_ospf6_brouter_area_cmd,
1540 "no debug ospf6 border-routers area-id",
1541 NO_STR
1542 DEBUG_STR
1543 OSPF6_STR
1544 "Debug border router\n"
1545 "Debug border routers in specific Area\n"
1546 )
1547{
1548 OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_OFF ();
1549 return CMD_SUCCESS;
1550}
1551
1552int
1553config_write_ospf6_debug_brouter (struct vty *vty)
1554{
1555 char buf[16];
1556 if (IS_OSPF6_DEBUG_BROUTER)
1557 vty_out (vty, "debug ospf6 border-routers%s", VNL);
1558 if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER)
1559 {
1560 inet_ntop (AF_INET, &conf_debug_ospf6_brouter_specific_router_id,
1561 buf, sizeof (buf));
1562 vty_out (vty, "debug ospf6 border-routers router-id %s%s", buf, VNL);
1563 }
1564 if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA)
1565 {
1566 inet_ntop (AF_INET, &conf_debug_ospf6_brouter_specific_area_id,
1567 buf, sizeof (buf));
1568 vty_out (vty, "debug ospf6 border-routers area-id %s%s", buf, VNL);
1569 }
1570 return 0;
1571}
1572
1573void
1574install_element_ospf6_debug_brouter (void)
1575{
1576 install_element (ENABLE_NODE, &debug_ospf6_brouter_cmd);
1577 install_element (ENABLE_NODE, &debug_ospf6_brouter_router_cmd);
1578 install_element (ENABLE_NODE, &debug_ospf6_brouter_area_cmd);
1579 install_element (ENABLE_NODE, &no_debug_ospf6_brouter_cmd);
1580 install_element (ENABLE_NODE, &no_debug_ospf6_brouter_router_cmd);
1581 install_element (ENABLE_NODE, &no_debug_ospf6_brouter_area_cmd);
1582 install_element (CONFIG_NODE, &debug_ospf6_brouter_cmd);
1583 install_element (CONFIG_NODE, &debug_ospf6_brouter_router_cmd);
1584 install_element (CONFIG_NODE, &debug_ospf6_brouter_area_cmd);
1585 install_element (CONFIG_NODE, &no_debug_ospf6_brouter_cmd);
1586 install_element (CONFIG_NODE, &no_debug_ospf6_brouter_router_cmd);
1587 install_element (CONFIG_NODE, &no_debug_ospf6_brouter_area_cmd);
1588}
1589
718e3744 1590