2 * Copyright (C) 2003 Yasuhiro Ohara
4 * This file is part of GNU Zebra.
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
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.
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.
32 #include "ospf6_lsa.h"
33 #include "ospf6_lsdb.h"
34 #include "ospf6_network.h"
35 #include "ospf6_message.h"
36 #include "ospf6_route.h"
37 #include "ospf6_top.h"
38 #include "ospf6_area.h"
39 #include "ospf6_interface.h"
40 #include "ospf6_neighbor.h"
41 #include "ospf6_intra.h"
42 #include "ospf6_spf.h"
45 unsigned char conf_debug_ospf6_interface
= 0;
47 const char *ospf6_interface_state_str
[] =
60 struct ospf6_interface
*
61 ospf6_interface_lookup_by_ifindex (int ifindex
)
63 struct ospf6_interface
*oi
;
64 struct interface
*ifp
;
66 ifp
= if_lookup_by_index (ifindex
);
68 return (struct ospf6_interface
*) NULL
;
70 oi
= (struct ospf6_interface
*) ifp
->info
;
74 /* schedule routing table recalculation */
76 ospf6_interface_lsdb_hook (struct ospf6_lsa
*lsa
)
78 struct ospf6_interface
*oi
;
84 switch (ntohs (lsa
->header
->type
))
86 case OSPF6_LSTYPE_LINK
:
87 if (oi
->state
== OSPF6_INTERFACE_DR
)
88 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi
);
89 ospf6_spf_schedule (oi
->area
->ospf6
);
98 ospf6_default_iftype(struct interface
*ifp
)
100 if (if_is_pointopoint (ifp
))
101 return OSPF_IFTYPE_POINTOPOINT
;
102 else if (if_is_loopback (ifp
))
103 return OSPF_IFTYPE_LOOPBACK
;
105 return OSPF_IFTYPE_BROADCAST
;
108 /* Create new ospf6 interface structure */
109 struct ospf6_interface
*
110 ospf6_interface_create (struct interface
*ifp
)
112 struct ospf6_interface
*oi
;
113 unsigned int iobuflen
;
115 oi
= (struct ospf6_interface
*)
116 XCALLOC (MTYPE_OSPF6_IF
, sizeof (struct ospf6_interface
));
120 zlog_err ("Can't malloc ospf6_interface for ifindex %d", ifp
->ifindex
);
121 return (struct ospf6_interface
*) NULL
;
124 oi
->area
= (struct ospf6_area
*) NULL
;
125 oi
->neighbor_list
= list_new ();
126 oi
->neighbor_list
->cmp
= ospf6_neighbor_cmp
;
127 oi
->linklocal_addr
= (struct in6_addr
*) NULL
;
128 oi
->instance_id
= OSPF6_INTERFACE_INSTANCE_ID
;
129 oi
->transdelay
= OSPF6_INTERFACE_TRANSDELAY
;
130 oi
->priority
= OSPF6_INTERFACE_PRIORITY
;
132 oi
->hello_interval
= OSPF_HELLO_INTERVAL_DEFAULT
;
133 oi
->dead_interval
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
134 oi
->rxmt_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
135 oi
->cost
= OSPF6_INTERFACE_COST
;
136 oi
->type
= ospf6_default_iftype (ifp
);
137 oi
->state
= OSPF6_INTERFACE_DOWN
;
141 /* Try to adjust I/O buffer size with IfMtu */
142 oi
->ifmtu
= ifp
->mtu6
;
143 iobuflen
= ospf6_iobuf_size (ifp
->mtu6
);
144 if (oi
->ifmtu
> iobuflen
)
146 if (IS_OSPF6_DEBUG_INTERFACE
)
147 zlog_debug ("Interface %s: IfMtu is adjusted to I/O buffer size: %d.",
148 ifp
->name
, iobuflen
);
149 oi
->ifmtu
= iobuflen
;
152 oi
->lsupdate_list
= ospf6_lsdb_create (oi
);
153 oi
->lsack_list
= ospf6_lsdb_create (oi
);
154 oi
->lsdb
= ospf6_lsdb_create (oi
);
155 oi
->lsdb
->hook_add
= ospf6_interface_lsdb_hook
;
156 oi
->lsdb
->hook_remove
= ospf6_interface_lsdb_hook
;
157 oi
->lsdb_self
= ospf6_lsdb_create (oi
);
159 oi
->route_connected
= OSPF6_ROUTE_TABLE_CREATE (INTERFACE
, CONNECTED_ROUTES
);
160 oi
->route_connected
->scope
= oi
;
170 ospf6_interface_delete (struct ospf6_interface
*oi
)
172 struct listnode
*node
, *nnode
;
173 struct ospf6_neighbor
*on
;
175 for (ALL_LIST_ELEMENTS (oi
->neighbor_list
, node
, nnode
, on
))
176 ospf6_neighbor_delete (on
);
178 list_delete (oi
->neighbor_list
);
180 THREAD_OFF (oi
->thread_send_hello
);
181 THREAD_OFF (oi
->thread_send_lsupdate
);
182 THREAD_OFF (oi
->thread_send_lsack
);
184 ospf6_lsdb_remove_all (oi
->lsdb
);
185 ospf6_lsdb_remove_all (oi
->lsupdate_list
);
186 ospf6_lsdb_remove_all (oi
->lsack_list
);
188 ospf6_lsdb_delete (oi
->lsdb
);
189 ospf6_lsdb_delete (oi
->lsdb_self
);
191 ospf6_lsdb_delete (oi
->lsupdate_list
);
192 ospf6_lsdb_delete (oi
->lsack_list
);
194 ospf6_route_table_delete (oi
->route_connected
);
197 oi
->interface
->info
= NULL
;
201 XFREE (MTYPE_PREFIX_LIST_STR
, oi
->plist_name
);
203 XFREE (MTYPE_OSPF6_IF
, oi
);
207 ospf6_interface_enable (struct ospf6_interface
*oi
)
209 UNSET_FLAG (oi
->flag
, OSPF6_INTERFACE_DISABLE
);
211 oi
->thread_send_hello
=
212 thread_add_event (master
, ospf6_hello_send
, oi
, 0);
216 ospf6_interface_disable (struct ospf6_interface
*oi
)
218 struct listnode
*node
, *nnode
;
219 struct ospf6_neighbor
*on
;
221 SET_FLAG (oi
->flag
, OSPF6_INTERFACE_DISABLE
);
223 for (ALL_LIST_ELEMENTS (oi
->neighbor_list
, node
, nnode
, on
))
224 ospf6_neighbor_delete (on
);
226 list_delete_all_node (oi
->neighbor_list
);
228 ospf6_lsdb_remove_all (oi
->lsdb
);
229 ospf6_lsdb_remove_all (oi
->lsupdate_list
);
230 ospf6_lsdb_remove_all (oi
->lsack_list
);
232 THREAD_OFF (oi
->thread_send_hello
);
233 THREAD_OFF (oi
->thread_send_lsupdate
);
234 THREAD_OFF (oi
->thread_send_lsack
);
237 static struct in6_addr
*
238 ospf6_interface_get_linklocal_address (struct interface
*ifp
)
242 struct in6_addr
*l
= (struct in6_addr
*) NULL
;
244 /* for each connected address */
245 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, n
, c
))
247 /* if family not AF_INET6, ignore */
248 if (c
->address
->family
!= AF_INET6
)
251 /* linklocal scope check */
252 if (IN6_IS_ADDR_LINKLOCAL (&c
->address
->u
.prefix6
))
253 l
= &c
->address
->u
.prefix6
;
259 ospf6_interface_if_add (struct interface
*ifp
)
261 struct ospf6_interface
*oi
;
262 unsigned int iobuflen
;
264 oi
= (struct ospf6_interface
*) ifp
->info
;
268 /* Try to adjust I/O buffer size with IfMtu */
270 oi
->ifmtu
= ifp
->mtu6
;
271 iobuflen
= ospf6_iobuf_size (ifp
->mtu6
);
272 if (oi
->ifmtu
> iobuflen
)
274 if (IS_OSPF6_DEBUG_INTERFACE
)
275 zlog_debug ("Interface %s: IfMtu is adjusted to I/O buffer size: %d.",
276 ifp
->name
, iobuflen
);
277 oi
->ifmtu
= iobuflen
;
280 /* interface start */
282 thread_add_event (master
, interface_up
, oi
, 0);
286 ospf6_interface_if_del (struct interface
*ifp
)
288 struct ospf6_interface
*oi
;
290 oi
= (struct ospf6_interface
*) ifp
->info
;
296 thread_execute (master
, interface_down
, oi
, 0);
298 listnode_delete (oi
->area
->if_list
, oi
);
299 oi
->area
= (struct ospf6_area
*) NULL
;
302 oi
->interface
= NULL
;
305 ospf6_interface_delete (oi
);
309 ospf6_interface_state_update (struct interface
*ifp
)
311 struct ospf6_interface
*oi
;
313 oi
= (struct ospf6_interface
*) ifp
->info
;
316 if (oi
->area
== NULL
)
320 thread_add_event (master
, interface_up
, oi
, 0);
322 thread_add_event (master
, interface_down
, oi
, 0);
328 ospf6_interface_connected_route_update (struct interface
*ifp
)
330 struct ospf6_interface
*oi
;
331 struct ospf6_route
*route
;
333 struct listnode
*node
, *nnode
;
335 oi
= (struct ospf6_interface
*) ifp
->info
;
339 /* reset linklocal pointer */
340 oi
->linklocal_addr
= ospf6_interface_get_linklocal_address (ifp
);
342 /* if area is null, do not make connected-route list */
343 if (oi
->area
== NULL
)
346 /* update "route to advertise" interface route table */
347 ospf6_route_remove_all (oi
->route_connected
);
349 for (ALL_LIST_ELEMENTS (oi
->interface
->connected
, node
, nnode
, c
))
351 if (c
->address
->family
!= AF_INET6
)
354 CONTINUE_IF_ADDRESS_LINKLOCAL (IS_OSPF6_DEBUG_INTERFACE
, c
->address
);
355 CONTINUE_IF_ADDRESS_UNSPECIFIED (IS_OSPF6_DEBUG_INTERFACE
, c
->address
);
356 CONTINUE_IF_ADDRESS_LOOPBACK (IS_OSPF6_DEBUG_INTERFACE
, c
->address
);
357 CONTINUE_IF_ADDRESS_V4COMPAT (IS_OSPF6_DEBUG_INTERFACE
, c
->address
);
358 CONTINUE_IF_ADDRESS_V4MAPPED (IS_OSPF6_DEBUG_INTERFACE
, c
->address
);
363 struct prefix_list
*plist
;
364 enum prefix_list_type ret
;
367 prefix2str (c
->address
, buf
, sizeof (buf
));
368 plist
= prefix_list_lookup (AFI_IP6
, oi
->plist_name
);
369 ret
= prefix_list_apply (plist
, (void *) c
->address
);
370 if (ret
== PREFIX_DENY
)
372 if (IS_OSPF6_DEBUG_INTERFACE
)
373 zlog_debug ("%s on %s filtered by prefix-list %s ",
374 buf
, oi
->interface
->name
, oi
->plist_name
);
379 route
= ospf6_route_create ();
380 memcpy (&route
->prefix
, c
->address
, sizeof (struct prefix
));
381 apply_mask (&route
->prefix
);
382 route
->type
= OSPF6_DEST_TYPE_NETWORK
;
383 route
->path
.area_id
= oi
->area
->area_id
;
384 route
->path
.type
= OSPF6_PATH_TYPE_INTRA
;
385 route
->path
.cost
= oi
->cost
;
386 route
->nexthop
[0].ifindex
= oi
->interface
->ifindex
;
387 inet_pton (AF_INET6
, "::1", &route
->nexthop
[0].address
);
388 ospf6_route_add (route
, oi
->route_connected
);
391 /* create new Link-LSA */
392 OSPF6_LINK_LSA_SCHEDULE (oi
);
393 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi
);
394 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi
->area
);
398 ospf6_interface_state_change (u_char next_state
, struct ospf6_interface
*oi
)
402 prev_state
= oi
->state
;
403 oi
->state
= next_state
;
405 if (prev_state
== next_state
)
409 if (IS_OSPF6_DEBUG_INTERFACE
)
411 zlog_debug ("Interface state change %s: %s -> %s", oi
->interface
->name
,
412 ospf6_interface_state_str
[prev_state
],
413 ospf6_interface_state_str
[next_state
]);
417 if ((prev_state
== OSPF6_INTERFACE_DR
||
418 prev_state
== OSPF6_INTERFACE_BDR
) &&
419 (next_state
!= OSPF6_INTERFACE_DR
&&
420 next_state
!= OSPF6_INTERFACE_BDR
))
421 ospf6_sso (oi
->interface
->ifindex
, &alldrouters6
, IPV6_LEAVE_GROUP
);
423 if ((prev_state
!= OSPF6_INTERFACE_DR
&&
424 prev_state
!= OSPF6_INTERFACE_BDR
) &&
425 (next_state
== OSPF6_INTERFACE_DR
||
426 next_state
== OSPF6_INTERFACE_BDR
))
427 ospf6_sso (oi
->interface
->ifindex
, &alldrouters6
, IPV6_JOIN_GROUP
);
429 OSPF6_ROUTER_LSA_SCHEDULE (oi
->area
);
430 if (next_state
== OSPF6_INTERFACE_DOWN
)
432 OSPF6_NETWORK_LSA_EXECUTE (oi
);
433 OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT (oi
);
434 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi
->area
);
436 else if (prev_state
== OSPF6_INTERFACE_DR
||
437 next_state
== OSPF6_INTERFACE_DR
)
439 OSPF6_NETWORK_LSA_SCHEDULE (oi
);
440 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi
);
441 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi
->area
);
445 /* Terminal state or regression */
446 if ((next_state
== OSPF6_INTERFACE_POINTTOPOINT
) ||
447 (next_state
== OSPF6_INTERFACE_DROTHER
) ||
448 (next_state
== OSPF6_INTERFACE_BDR
) ||
449 (next_state
== OSPF6_INTERFACE_DR
) ||
450 (next_state
< prev_state
))
451 ospf6TrapIfStateChange (oi
);
457 /* DR Election, RFC2328 section 9.4 */
459 #define IS_ELIGIBLE(n) \
460 ((n)->state >= OSPF6_NEIGHBOR_TWOWAY && (n)->priority != 0)
462 static struct ospf6_neighbor
*
463 better_bdrouter (struct ospf6_neighbor
*a
, struct ospf6_neighbor
*b
)
465 if ((a
== NULL
|| ! IS_ELIGIBLE (a
) || a
->drouter
== a
->router_id
) &&
466 (b
== NULL
|| ! IS_ELIGIBLE (b
) || b
->drouter
== b
->router_id
))
468 else if (a
== NULL
|| ! IS_ELIGIBLE (a
) || a
->drouter
== a
->router_id
)
470 else if (b
== NULL
|| ! IS_ELIGIBLE (b
) || b
->drouter
== b
->router_id
)
473 if (a
->bdrouter
== a
->router_id
&& b
->bdrouter
!= b
->router_id
)
475 if (a
->bdrouter
!= a
->router_id
&& b
->bdrouter
== b
->router_id
)
478 if (a
->priority
> b
->priority
)
480 if (a
->priority
< b
->priority
)
483 if (ntohl (a
->router_id
) > ntohl (b
->router_id
))
485 if (ntohl (a
->router_id
) < ntohl (b
->router_id
))
488 zlog_warn ("Router-ID duplicate ?");
492 static struct ospf6_neighbor
*
493 better_drouter (struct ospf6_neighbor
*a
, struct ospf6_neighbor
*b
)
495 if ((a
== NULL
|| ! IS_ELIGIBLE (a
) || a
->drouter
!= a
->router_id
) &&
496 (b
== NULL
|| ! IS_ELIGIBLE (b
) || b
->drouter
!= b
->router_id
))
498 else if (a
== NULL
|| ! IS_ELIGIBLE (a
) || a
->drouter
!= a
->router_id
)
500 else if (b
== NULL
|| ! IS_ELIGIBLE (b
) || b
->drouter
!= b
->router_id
)
503 if (a
->drouter
== a
->router_id
&& b
->drouter
!= b
->router_id
)
505 if (a
->drouter
!= a
->router_id
&& b
->drouter
== b
->router_id
)
508 if (a
->priority
> b
->priority
)
510 if (a
->priority
< b
->priority
)
513 if (ntohl (a
->router_id
) > ntohl (b
->router_id
))
515 if (ntohl (a
->router_id
) < ntohl (b
->router_id
))
518 zlog_warn ("Router-ID duplicate ?");
523 dr_election (struct ospf6_interface
*oi
)
525 struct listnode
*node
, *nnode
;
526 struct ospf6_neighbor
*on
, *drouter
, *bdrouter
, myself
;
527 struct ospf6_neighbor
*best_drouter
, *best_bdrouter
;
528 u_char next_state
= 0;
530 drouter
= bdrouter
= NULL
;
531 best_drouter
= best_bdrouter
= NULL
;
533 /* pseudo neighbor myself, including noting current DR/BDR (1) */
534 memset (&myself
, 0, sizeof (myself
));
535 inet_ntop (AF_INET
, &oi
->area
->ospf6
->router_id
, myself
.name
,
536 sizeof (myself
.name
));
537 myself
.state
= OSPF6_NEIGHBOR_TWOWAY
;
538 myself
.drouter
= oi
->drouter
;
539 myself
.bdrouter
= oi
->bdrouter
;
540 myself
.priority
= oi
->priority
;
541 myself
.router_id
= oi
->area
->ospf6
->router_id
;
543 /* Electing BDR (2) */
544 for (ALL_LIST_ELEMENTS (oi
->neighbor_list
, node
, nnode
, on
))
545 bdrouter
= better_bdrouter (bdrouter
, on
);
547 best_bdrouter
= bdrouter
;
548 bdrouter
= better_bdrouter (best_bdrouter
, &myself
);
550 /* Electing DR (3) */
551 for (ALL_LIST_ELEMENTS (oi
->neighbor_list
, node
, nnode
, on
))
552 drouter
= better_drouter (drouter
, on
);
554 best_drouter
= drouter
;
555 drouter
= better_drouter (best_drouter
, &myself
);
559 /* the router itself is newly/no longer DR/BDR (4) */
560 if ((drouter
== &myself
&& myself
.drouter
!= myself
.router_id
) ||
561 (drouter
!= &myself
&& myself
.drouter
== myself
.router_id
) ||
562 (bdrouter
== &myself
&& myself
.bdrouter
!= myself
.router_id
) ||
563 (bdrouter
!= &myself
&& myself
.bdrouter
== myself
.router_id
))
565 myself
.drouter
= (drouter
? drouter
->router_id
: htonl (0));
566 myself
.bdrouter
= (bdrouter
? bdrouter
->router_id
: htonl (0));
568 /* compatible to Electing BDR (2) */
569 bdrouter
= better_bdrouter (best_bdrouter
, &myself
);
571 /* compatible to Electing DR (3) */
572 drouter
= better_drouter (best_drouter
, &myself
);
577 /* Set interface state accordingly (5) */
578 if (drouter
&& drouter
== &myself
)
579 next_state
= OSPF6_INTERFACE_DR
;
580 else if (bdrouter
&& bdrouter
== &myself
)
581 next_state
= OSPF6_INTERFACE_BDR
;
583 next_state
= OSPF6_INTERFACE_DROTHER
;
585 /* If NBMA, schedule Start for each neighbor having priority of 0 (6) */
588 /* If DR or BDR change, invoke AdjOK? for each neighbor (7) */
589 /* RFC 2328 section 12.4. Originating LSAs (3) will be handled
590 accordingly after AdjOK */
591 if (oi
->drouter
!= (drouter
? drouter
->router_id
: htonl (0)) ||
592 oi
->bdrouter
!= (bdrouter
? bdrouter
->router_id
: htonl (0)))
594 if (IS_OSPF6_DEBUG_INTERFACE
)
595 zlog_debug ("DR Election on %s: DR: %s BDR: %s", oi
->interface
->name
,
596 (drouter
? drouter
->name
: "0.0.0.0"),
597 (bdrouter
? bdrouter
->name
: "0.0.0.0"));
599 for (ALL_LIST_ELEMENTS_RO (oi
->neighbor_list
, node
, on
))
601 if (on
->state
< OSPF6_NEIGHBOR_TWOWAY
)
603 /* Schedule AdjOK. */
604 thread_add_event (master
, adj_ok
, on
, 0);
608 oi
->drouter
= (drouter
? drouter
->router_id
: htonl (0));
609 oi
->bdrouter
= (bdrouter
? bdrouter
->router_id
: htonl (0));
614 /* Interface State Machine */
616 interface_up (struct thread
*thread
)
618 struct ospf6_interface
*oi
;
620 oi
= (struct ospf6_interface
*) THREAD_ARG (thread
);
621 assert (oi
&& oi
->interface
);
623 if (IS_OSPF6_DEBUG_INTERFACE
)
624 zlog_debug ("Interface Event %s: [InterfaceUp]",
625 oi
->interface
->name
);
627 /* check physical interface is up */
628 if (! if_is_up (oi
->interface
))
630 if (IS_OSPF6_DEBUG_INTERFACE
)
631 zlog_debug ("Interface %s is down, can't execute [InterfaceUp]",
632 oi
->interface
->name
);
636 /* if already enabled, do nothing */
637 if (oi
->state
> OSPF6_INTERFACE_DOWN
)
639 if (IS_OSPF6_DEBUG_INTERFACE
)
640 zlog_debug ("Interface %s already enabled",
641 oi
->interface
->name
);
645 /* Join AllSPFRouters */
646 ospf6_sso (oi
->interface
->ifindex
, &allspfrouters6
, IPV6_JOIN_GROUP
);
648 /* Update interface route */
649 ospf6_interface_connected_route_update (oi
->interface
);
652 if (! CHECK_FLAG (oi
->flag
, OSPF6_INTERFACE_PASSIVE
))
653 thread_add_event (master
, ospf6_hello_send
, oi
, 0);
655 /* decide next interface state */
656 if ((if_is_pointopoint (oi
->interface
)) ||
657 (oi
->type
== OSPF_IFTYPE_POINTOPOINT
)) {
658 ospf6_interface_state_change (OSPF6_INTERFACE_POINTTOPOINT
, oi
);
660 else if (oi
->priority
== 0)
661 ospf6_interface_state_change (OSPF6_INTERFACE_DROTHER
, oi
);
664 ospf6_interface_state_change (OSPF6_INTERFACE_WAITING
, oi
);
665 thread_add_timer (master
, wait_timer
, oi
, oi
->dead_interval
);
672 wait_timer (struct thread
*thread
)
674 struct ospf6_interface
*oi
;
676 oi
= (struct ospf6_interface
*) THREAD_ARG (thread
);
677 assert (oi
&& oi
->interface
);
679 if (IS_OSPF6_DEBUG_INTERFACE
)
680 zlog_debug ("Interface Event %s: [WaitTimer]",
681 oi
->interface
->name
);
683 if (oi
->state
== OSPF6_INTERFACE_WAITING
)
684 ospf6_interface_state_change (dr_election (oi
), oi
);
690 backup_seen (struct thread
*thread
)
692 struct ospf6_interface
*oi
;
694 oi
= (struct ospf6_interface
*) THREAD_ARG (thread
);
695 assert (oi
&& oi
->interface
);
697 if (IS_OSPF6_DEBUG_INTERFACE
)
698 zlog_debug ("Interface Event %s: [BackupSeen]",
699 oi
->interface
->name
);
701 if (oi
->state
== OSPF6_INTERFACE_WAITING
)
702 ospf6_interface_state_change (dr_election (oi
), oi
);
708 neighbor_change (struct thread
*thread
)
710 struct ospf6_interface
*oi
;
712 oi
= (struct ospf6_interface
*) THREAD_ARG (thread
);
713 assert (oi
&& oi
->interface
);
715 if (IS_OSPF6_DEBUG_INTERFACE
)
716 zlog_debug ("Interface Event %s: [NeighborChange]",
717 oi
->interface
->name
);
719 if (oi
->state
== OSPF6_INTERFACE_DROTHER
||
720 oi
->state
== OSPF6_INTERFACE_BDR
||
721 oi
->state
== OSPF6_INTERFACE_DR
)
722 ospf6_interface_state_change (dr_election (oi
), oi
);
728 interface_down (struct thread
*thread
)
730 struct ospf6_interface
*oi
;
731 struct listnode
*node
, *nnode
;
732 struct ospf6_neighbor
*on
;
734 oi
= (struct ospf6_interface
*) THREAD_ARG (thread
);
735 assert (oi
&& oi
->interface
);
737 if (IS_OSPF6_DEBUG_INTERFACE
)
738 zlog_debug ("Interface Event %s: [InterfaceDown]",
739 oi
->interface
->name
);
741 /* Leave AllSPFRouters */
742 if (oi
->state
> OSPF6_INTERFACE_DOWN
)
743 ospf6_sso (oi
->interface
->ifindex
, &allspfrouters6
, IPV6_LEAVE_GROUP
);
745 ospf6_interface_state_change (OSPF6_INTERFACE_DOWN
, oi
);
747 for (ALL_LIST_ELEMENTS (oi
->neighbor_list
, node
, nnode
, on
))
748 ospf6_neighbor_delete (on
);
750 list_delete_all_node (oi
->neighbor_list
);
756 /* show specified interface structure */
758 ospf6_interface_show (struct vty
*vty
, struct interface
*ifp
)
760 struct ospf6_interface
*oi
;
764 char strbuf
[64], drouter
[32], bdrouter
[32];
765 const char *updown
[3] = {"down", "up", NULL
};
767 struct timeval res
, now
;
769 struct ospf6_lsa
*lsa
;
771 /* check physical interface type */
772 if (if_is_loopback (ifp
))
774 else if (if_is_broadcast (ifp
))
776 else if (if_is_pointopoint (ifp
))
777 type
= "POINTOPOINT";
781 vty_out (vty
, "%s is %s, type %s%s",
782 ifp
->name
, updown
[if_is_up (ifp
)], type
,
784 vty_out (vty
, " Interface ID: %d%s", ifp
->ifindex
, VNL
);
786 if (ifp
->info
== NULL
)
788 vty_out (vty
, " OSPF not enabled on this interface%s", VNL
);
792 oi
= (struct ospf6_interface
*) ifp
->info
;
794 vty_out (vty
, " Internet Address:%s", VNL
);
796 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, i
, c
))
799 prefix2str (p
, strbuf
, sizeof (strbuf
));
803 vty_out (vty
, " inet : %s%s", strbuf
,
807 vty_out (vty
, " inet6: %s%s", strbuf
,
811 vty_out (vty
, " ??? : %s%s", strbuf
,
819 vty_out (vty
, " Instance ID %d, Interface MTU %d (autodetect: %d)%s",
820 oi
->instance_id
, oi
->ifmtu
, ifp
->mtu6
, VNL
);
821 vty_out (vty
, " MTU mismatch detection: %s%s", oi
->mtu_ignore
?
822 "disabled" : "enabled", VNL
);
823 inet_ntop (AF_INET
, &oi
->area
->area_id
,
824 strbuf
, sizeof (strbuf
));
825 vty_out (vty
, " Area ID %s, Cost %hu%s", strbuf
, oi
->cost
,
829 vty_out (vty
, " Not Attached to Area%s", VNL
);
831 vty_out (vty
, " State %s, Transmit Delay %d sec, Priority %d%s",
832 ospf6_interface_state_str
[oi
->state
],
833 oi
->transdelay
, oi
->priority
,
835 vty_out (vty
, " Timer intervals configured:%s", VNL
);
836 vty_out (vty
, " Hello %d, Dead %d, Retransmit %d%s",
837 oi
->hello_interval
, oi
->dead_interval
, oi
->rxmt_interval
,
840 inet_ntop (AF_INET
, &oi
->drouter
, drouter
, sizeof (drouter
));
841 inet_ntop (AF_INET
, &oi
->bdrouter
, bdrouter
, sizeof (bdrouter
));
842 vty_out (vty
, " DR: %s BDR: %s%s", drouter
, bdrouter
, VNL
);
844 vty_out (vty
, " Number of I/F scoped LSAs is %u%s",
845 oi
->lsdb
->count
, VNL
);
847 quagga_gettime (QUAGGA_CLK_MONOTONIC
, &now
);
850 if (oi
->thread_send_lsupdate
)
851 timersub (&oi
->thread_send_lsupdate
->u
.sands
, &now
, &res
);
852 timerstring (&res
, duration
, sizeof (duration
));
853 vty_out (vty
, " %d Pending LSAs for LSUpdate in Time %s [thread %s]%s",
854 oi
->lsupdate_list
->count
, duration
,
855 (oi
->thread_send_lsupdate
? "on" : "off"),
857 for (lsa
= ospf6_lsdb_head (oi
->lsupdate_list
); lsa
;
858 lsa
= ospf6_lsdb_next (lsa
))
859 vty_out (vty
, " %s%s", lsa
->name
, VNL
);
862 if (oi
->thread_send_lsack
)
863 timersub (&oi
->thread_send_lsack
->u
.sands
, &now
, &res
);
864 timerstring (&res
, duration
, sizeof (duration
));
865 vty_out (vty
, " %d Pending LSAs for LSAck in Time %s [thread %s]%s",
866 oi
->lsack_list
->count
, duration
,
867 (oi
->thread_send_lsack
? "on" : "off"),
869 for (lsa
= ospf6_lsdb_head (oi
->lsack_list
); lsa
;
870 lsa
= ospf6_lsdb_next (lsa
))
871 vty_out (vty
, " %s%s", lsa
->name
, VNL
);
877 DEFUN (show_ipv6_ospf6_interface
,
878 show_ipv6_ospf6_interface_ifname_cmd
,
879 "show ipv6 ospf6 interface IFNAME",
887 struct interface
*ifp
;
892 ifp
= if_lookup_by_name (argv
[0]);
895 vty_out (vty
, "No such Interface: %s%s", argv
[0],
899 ospf6_interface_show (vty
, ifp
);
903 for (ALL_LIST_ELEMENTS_RO (iflist
, i
, ifp
))
904 ospf6_interface_show (vty
, ifp
);
910 ALIAS (show_ipv6_ospf6_interface
,
911 show_ipv6_ospf6_interface_cmd
,
912 "show ipv6 ospf6 interface",
919 DEFUN (show_ipv6_ospf6_interface_ifname_prefix
,
920 show_ipv6_ospf6_interface_ifname_prefix_cmd
,
921 "show ipv6 ospf6 interface IFNAME prefix",
927 "Display connected prefixes to advertise\n"
930 struct interface
*ifp
;
931 struct ospf6_interface
*oi
;
933 ifp
= if_lookup_by_name (argv
[0]);
936 vty_out (vty
, "No such Interface: %s%s", argv
[0], VNL
);
943 vty_out (vty
, "OSPFv3 is not enabled on %s%s", argv
[0], VNL
);
949 ospf6_route_table_show (vty
, argc
, argv
, oi
->route_connected
);
954 ALIAS (show_ipv6_ospf6_interface_ifname_prefix
,
955 show_ipv6_ospf6_interface_ifname_prefix_detail_cmd
,
956 "show ipv6 ospf6 interface IFNAME prefix (X:X::X:X|X:X::X:X/M|detail)",
962 "Display connected prefixes to advertise\n"
963 OSPF6_ROUTE_ADDRESS_STR
964 OSPF6_ROUTE_PREFIX_STR
965 "Display details of the prefixes\n"
968 ALIAS (show_ipv6_ospf6_interface_ifname_prefix
,
969 show_ipv6_ospf6_interface_ifname_prefix_match_cmd
,
970 "show ipv6 ospf6 interface IFNAME prefix X:X::X:X/M (match|detail)",
976 "Display connected prefixes to advertise\n"
977 OSPF6_ROUTE_PREFIX_STR
978 OSPF6_ROUTE_MATCH_STR
979 "Display details of the prefixes\n"
982 DEFUN (show_ipv6_ospf6_interface_prefix
,
983 show_ipv6_ospf6_interface_prefix_cmd
,
984 "show ipv6 ospf6 interface prefix",
989 "Display connected prefixes to advertise\n"
993 struct ospf6_interface
*oi
;
994 struct interface
*ifp
;
996 for (ALL_LIST_ELEMENTS_RO (iflist
, i
, ifp
))
998 oi
= (struct ospf6_interface
*) ifp
->info
;
1002 ospf6_route_table_show (vty
, argc
, argv
, oi
->route_connected
);
1008 ALIAS (show_ipv6_ospf6_interface_prefix
,
1009 show_ipv6_ospf6_interface_prefix_detail_cmd
,
1010 "show ipv6 ospf6 interface prefix (X:X::X:X|X:X::X:X/M|detail)",
1015 "Display connected prefixes to advertise\n"
1016 OSPF6_ROUTE_ADDRESS_STR
1017 OSPF6_ROUTE_PREFIX_STR
1018 "Display details of the prefixes\n"
1021 ALIAS (show_ipv6_ospf6_interface_prefix
,
1022 show_ipv6_ospf6_interface_prefix_match_cmd
,
1023 "show ipv6 ospf6 interface prefix X:X::X:X/M (match|detail)",
1028 "Display connected prefixes to advertise\n"
1029 OSPF6_ROUTE_PREFIX_STR
1030 OSPF6_ROUTE_MATCH_STR
1031 "Display details of the prefixes\n"
1035 /* interface variable set command */
1036 DEFUN (ipv6_ospf6_ifmtu
,
1037 ipv6_ospf6_ifmtu_cmd
,
1038 "ipv6 ospf6 ifmtu <1-65535>",
1042 "OSPFv3 Interface MTU\n"
1045 struct ospf6_interface
*oi
;
1046 struct interface
*ifp
;
1047 unsigned int ifmtu
, iobuflen
;
1048 struct listnode
*node
, *nnode
;
1049 struct ospf6_neighbor
*on
;
1051 ifp
= (struct interface
*) vty
->index
;
1054 oi
= (struct ospf6_interface
*) ifp
->info
;
1056 oi
= ospf6_interface_create (ifp
);
1059 ifmtu
= strtol (argv
[0], NULL
, 10);
1061 if (oi
->ifmtu
== ifmtu
)
1064 if (ifp
->mtu6
!= 0 && ifp
->mtu6
< ifmtu
)
1066 vty_out (vty
, "%s's ospf6 ifmtu cannot go beyond physical mtu (%d)%s",
1067 ifp
->name
, ifp
->mtu6
, VNL
);
1071 if (oi
->ifmtu
< ifmtu
)
1073 iobuflen
= ospf6_iobuf_size (ifmtu
);
1074 if (iobuflen
< ifmtu
)
1076 vty_out (vty
, "%s's ifmtu is adjusted to I/O buffer size (%d).%s",
1077 ifp
->name
, iobuflen
, VNL
);
1078 oi
->ifmtu
= iobuflen
;
1086 /* re-establish adjacencies */
1087 for (ALL_LIST_ELEMENTS (oi
->neighbor_list
, node
, nnode
, on
))
1089 THREAD_OFF (on
->inactivity_timer
);
1090 thread_add_event (master
, inactivity_timer
, on
, 0);
1096 DEFUN (no_ipv6_ospf6_ifmtu
,
1097 no_ipv6_ospf6_ifmtu_cmd
,
1098 "no ipv6 ospf6 ifmtu",
1105 struct ospf6_interface
*oi
;
1106 struct interface
*ifp
;
1107 unsigned int iobuflen
;
1108 struct listnode
*node
, *nnode
;
1109 struct ospf6_neighbor
*on
;
1111 ifp
= (struct interface
*) vty
->index
;
1114 oi
= (struct ospf6_interface
*) ifp
->info
;
1116 oi
= ospf6_interface_create (ifp
);
1119 if (oi
->ifmtu
< ifp
->mtu
)
1121 iobuflen
= ospf6_iobuf_size (ifp
->mtu
);
1122 if (iobuflen
< ifp
->mtu
)
1124 vty_out (vty
, "%s's ifmtu is adjusted to I/O buffer size (%d).%s",
1125 ifp
->name
, iobuflen
, VNL
);
1126 oi
->ifmtu
= iobuflen
;
1129 oi
->ifmtu
= ifp
->mtu
;
1132 oi
->ifmtu
= ifp
->mtu
;
1134 /* re-establish adjacencies */
1135 for (ALL_LIST_ELEMENTS (oi
->neighbor_list
, node
, nnode
, on
))
1137 THREAD_OFF (on
->inactivity_timer
);
1138 thread_add_event (master
, inactivity_timer
, on
, 0);
1144 DEFUN (ipv6_ospf6_cost
,
1145 ipv6_ospf6_cost_cmd
,
1146 "ipv6 ospf6 cost <1-65535>",
1150 "Outgoing metric of this interface\n"
1153 struct ospf6_interface
*oi
;
1154 struct interface
*ifp
;
1155 unsigned long int lcost
;
1157 ifp
= (struct interface
*) vty
->index
;
1160 oi
= (struct ospf6_interface
*) ifp
->info
;
1162 oi
= ospf6_interface_create (ifp
);
1165 lcost
= strtol (argv
[0], NULL
, 10);
1167 if (lcost
> UINT32_MAX
)
1169 vty_out (vty
, "Cost %ld is out of range%s", lcost
, VNL
);
1173 if (oi
->cost
== lcost
)
1178 /* update cost held in route_connected list in ospf6_interface */
1179 ospf6_interface_connected_route_update (oi
->interface
);
1181 /* execute LSA hooks */
1184 OSPF6_LINK_LSA_SCHEDULE (oi
);
1185 OSPF6_ROUTER_LSA_SCHEDULE (oi
->area
);
1186 OSPF6_NETWORK_LSA_SCHEDULE (oi
);
1187 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi
);
1188 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi
->area
);
1194 DEFUN (ipv6_ospf6_hellointerval
,
1195 ipv6_ospf6_hellointerval_cmd
,
1196 "ipv6 ospf6 hello-interval <1-65535>",
1199 "Interval time of Hello packets\n"
1203 struct ospf6_interface
*oi
;
1204 struct interface
*ifp
;
1206 ifp
= (struct interface
*) vty
->index
;
1209 oi
= (struct ospf6_interface
*) ifp
->info
;
1211 oi
= ospf6_interface_create (ifp
);
1214 oi
->hello_interval
= strtol (argv
[0], NULL
, 10);
1218 /* interface variable set command */
1219 DEFUN (ipv6_ospf6_deadinterval
,
1220 ipv6_ospf6_deadinterval_cmd
,
1221 "ipv6 ospf6 dead-interval <1-65535>",
1224 "Interval time after which a neighbor is declared down\n"
1228 struct ospf6_interface
*oi
;
1229 struct interface
*ifp
;
1231 ifp
= (struct interface
*) vty
->index
;
1234 oi
= (struct ospf6_interface
*) ifp
->info
;
1236 oi
= ospf6_interface_create (ifp
);
1239 oi
->dead_interval
= strtol (argv
[0], NULL
, 10);
1243 /* interface variable set command */
1244 DEFUN (ipv6_ospf6_transmitdelay
,
1245 ipv6_ospf6_transmitdelay_cmd
,
1246 "ipv6 ospf6 transmit-delay <1-3600>",
1249 "Transmit delay of this interface\n"
1253 struct ospf6_interface
*oi
;
1254 struct interface
*ifp
;
1256 ifp
= (struct interface
*) vty
->index
;
1259 oi
= (struct ospf6_interface
*) ifp
->info
;
1261 oi
= ospf6_interface_create (ifp
);
1264 oi
->transdelay
= strtol (argv
[0], NULL
, 10);
1268 /* interface variable set command */
1269 DEFUN (ipv6_ospf6_retransmitinterval
,
1270 ipv6_ospf6_retransmitinterval_cmd
,
1271 "ipv6 ospf6 retransmit-interval <1-65535>",
1274 "Time between retransmitting lost link state advertisements\n"
1278 struct ospf6_interface
*oi
;
1279 struct interface
*ifp
;
1281 ifp
= (struct interface
*) vty
->index
;
1284 oi
= (struct ospf6_interface
*) ifp
->info
;
1286 oi
= ospf6_interface_create (ifp
);
1289 oi
->rxmt_interval
= strtol (argv
[0], NULL
, 10);
1293 /* interface variable set command */
1294 DEFUN (ipv6_ospf6_priority
,
1295 ipv6_ospf6_priority_cmd
,
1296 "ipv6 ospf6 priority <0-255>",
1303 struct ospf6_interface
*oi
;
1304 struct interface
*ifp
;
1306 ifp
= (struct interface
*) vty
->index
;
1309 oi
= (struct ospf6_interface
*) ifp
->info
;
1311 oi
= ospf6_interface_create (ifp
);
1314 oi
->priority
= strtol (argv
[0], NULL
, 10);
1317 ospf6_interface_state_change (dr_election (oi
), oi
);
1322 DEFUN (ipv6_ospf6_instance
,
1323 ipv6_ospf6_instance_cmd
,
1324 "ipv6 ospf6 instance-id <0-255>",
1327 "Instance ID for this interface\n"
1328 "Instance ID value\n"
1331 struct ospf6_interface
*oi
;
1332 struct interface
*ifp
;
1334 ifp
= (struct interface
*)vty
->index
;
1337 oi
= (struct ospf6_interface
*)ifp
->info
;
1339 oi
= ospf6_interface_create (ifp
);
1342 oi
->instance_id
= strtol (argv
[0], NULL
, 10);
1346 DEFUN (ipv6_ospf6_passive
,
1347 ipv6_ospf6_passive_cmd
,
1348 "ipv6 ospf6 passive",
1351 "passive interface, No adjacency will be formed on this interface\n"
1354 struct ospf6_interface
*oi
;
1355 struct interface
*ifp
;
1356 struct listnode
*node
, *nnode
;
1357 struct ospf6_neighbor
*on
;
1359 ifp
= (struct interface
*) vty
->index
;
1362 oi
= (struct ospf6_interface
*) ifp
->info
;
1364 oi
= ospf6_interface_create (ifp
);
1367 SET_FLAG (oi
->flag
, OSPF6_INTERFACE_PASSIVE
);
1368 THREAD_OFF (oi
->thread_send_hello
);
1370 for (ALL_LIST_ELEMENTS (oi
->neighbor_list
, node
, nnode
, on
))
1372 THREAD_OFF (on
->inactivity_timer
);
1373 thread_add_event (master
, inactivity_timer
, on
, 0);
1379 DEFUN (no_ipv6_ospf6_passive
,
1380 no_ipv6_ospf6_passive_cmd
,
1381 "no ipv6 ospf6 passive",
1385 "passive interface: No Adjacency will be formed on this I/F\n"
1388 struct ospf6_interface
*oi
;
1389 struct interface
*ifp
;
1391 ifp
= (struct interface
*) vty
->index
;
1394 oi
= (struct ospf6_interface
*) ifp
->info
;
1396 oi
= ospf6_interface_create (ifp
);
1399 UNSET_FLAG (oi
->flag
, OSPF6_INTERFACE_PASSIVE
);
1400 THREAD_OFF (oi
->thread_send_hello
);
1401 oi
->thread_send_hello
=
1402 thread_add_event (master
, ospf6_hello_send
, oi
, 0);
1407 DEFUN (ipv6_ospf6_mtu_ignore
,
1408 ipv6_ospf6_mtu_ignore_cmd
,
1409 "ipv6 ospf6 mtu-ignore",
1412 "Ignore MTU mismatch on this interface\n"
1415 struct ospf6_interface
*oi
;
1416 struct interface
*ifp
;
1418 ifp
= (struct interface
*) vty
->index
;
1421 oi
= (struct ospf6_interface
*) ifp
->info
;
1423 oi
= ospf6_interface_create (ifp
);
1431 DEFUN (no_ipv6_ospf6_mtu_ignore
,
1432 no_ipv6_ospf6_mtu_ignore_cmd
,
1433 "no ipv6 ospf6 mtu-ignore",
1437 "Ignore MTU mismatch on this interface\n"
1440 struct ospf6_interface
*oi
;
1441 struct interface
*ifp
;
1443 ifp
= (struct interface
*) vty
->index
;
1446 oi
= (struct ospf6_interface
*) ifp
->info
;
1448 oi
= ospf6_interface_create (ifp
);
1456 DEFUN (ipv6_ospf6_advertise_prefix_list
,
1457 ipv6_ospf6_advertise_prefix_list_cmd
,
1458 "ipv6 ospf6 advertise prefix-list WORD",
1461 "Advertising options\n"
1462 "Filter prefix using prefix-list\n"
1463 "Prefix list name\n"
1466 struct ospf6_interface
*oi
;
1467 struct interface
*ifp
;
1469 ifp
= (struct interface
*) vty
->index
;
1472 oi
= (struct ospf6_interface
*) ifp
->info
;
1474 oi
= ospf6_interface_create (ifp
);
1478 XFREE (MTYPE_PREFIX_LIST_STR
, oi
->plist_name
);
1479 oi
->plist_name
= XSTRDUP (MTYPE_PREFIX_LIST_STR
, argv
[0]);
1481 ospf6_interface_connected_route_update (oi
->interface
);
1485 OSPF6_LINK_LSA_SCHEDULE (oi
);
1486 if (oi
->state
== OSPF6_INTERFACE_DR
)
1488 OSPF6_NETWORK_LSA_SCHEDULE (oi
);
1489 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi
);
1491 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi
->area
);
1497 DEFUN (no_ipv6_ospf6_advertise_prefix_list
,
1498 no_ipv6_ospf6_advertise_prefix_list_cmd
,
1499 "no ipv6 ospf6 advertise prefix-list",
1503 "Advertising options\n"
1504 "Filter prefix using prefix-list\n"
1507 struct ospf6_interface
*oi
;
1508 struct interface
*ifp
;
1510 ifp
= (struct interface
*) vty
->index
;
1513 oi
= (struct ospf6_interface
*) ifp
->info
;
1515 oi
= ospf6_interface_create (ifp
);
1520 XFREE (MTYPE_PREFIX_LIST_STR
, oi
->plist_name
);
1521 oi
->plist_name
= NULL
;
1524 ospf6_interface_connected_route_update (oi
->interface
);
1528 OSPF6_LINK_LSA_SCHEDULE (oi
);
1529 if (oi
->state
== OSPF6_INTERFACE_DR
)
1531 OSPF6_NETWORK_LSA_SCHEDULE (oi
);
1532 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi
);
1534 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi
->area
);
1540 DEFUN (ipv6_ospf6_network
,
1541 ipv6_ospf6_network_cmd
,
1542 "ipv6 ospf6 network (broadcast|point-to-point)",
1546 "Specify OSPFv6 broadcast network\n"
1547 "Specify OSPF6 point-to-point network\n"
1550 struct ospf6_interface
*oi
;
1551 struct interface
*ifp
;
1553 ifp
= (struct interface
*) vty
->index
;
1556 oi
= (struct ospf6_interface
*) ifp
->info
;
1558 oi
= ospf6_interface_create (ifp
);
1562 if (strncmp (argv
[0], "b", 1) == 0)
1564 if (oi
->type
== OSPF_IFTYPE_BROADCAST
)
1567 oi
->type
= OSPF_IFTYPE_BROADCAST
;
1569 else if (strncmp (argv
[0], "point-to-p", 10) == 0)
1571 if (oi
->type
== OSPF_IFTYPE_POINTOPOINT
) {
1574 oi
->type
= OSPF_IFTYPE_POINTOPOINT
;
1577 /* Reset the interface */
1578 thread_add_event (master
, interface_down
, oi
, 0);
1579 thread_add_event (master
, interface_up
, oi
, 0);
1584 DEFUN (no_ipv6_ospf6_network
,
1585 no_ipv6_ospf6_network_cmd
,
1586 "no ipv6 ospf6 network",
1591 "Default to whatever interface type system specifies"
1594 struct ospf6_interface
*oi
;
1595 struct interface
*ifp
;
1598 ifp
= (struct interface
*) vty
->index
;
1601 oi
= (struct ospf6_interface
*) ifp
->info
;
1606 type
= ospf6_default_iftype (ifp
);
1607 if (oi
->type
== type
)
1613 /* Reset the interface */
1614 thread_add_event (master
, interface_down
, oi
, 0);
1615 thread_add_event (master
, interface_up
, oi
, 0);
1621 config_write_ospf6_interface (struct vty
*vty
)
1624 struct ospf6_interface
*oi
;
1625 struct interface
*ifp
;
1627 for (ALL_LIST_ELEMENTS_RO (iflist
, i
, ifp
))
1629 oi
= (struct ospf6_interface
*) ifp
->info
;
1633 vty_out (vty
, "interface %s%s",
1634 oi
->interface
->name
, VNL
);
1637 vty_out (vty
, " description %s%s", ifp
->desc
, VNL
);
1638 if (ifp
->mtu6
!= oi
->ifmtu
)
1639 vty_out (vty
, " ipv6 ospf6 ifmtu %d%s", oi
->ifmtu
, VNL
);
1641 if (oi
->cost
!= OSPF6_INTERFACE_COST
)
1642 vty_out (vty
, " ipv6 ospf6 cost %d%s",
1645 if (oi
->hello_interval
!= OSPF6_INTERFACE_HELLO_INTERVAL
)
1646 vty_out (vty
, " ipv6 ospf6 hello-interval %d%s",
1647 oi
->hello_interval
, VNL
);
1649 if (oi
->dead_interval
!= OSPF6_INTERFACE_DEAD_INTERVAL
)
1650 vty_out (vty
, " ipv6 ospf6 dead-interval %d%s",
1651 oi
->dead_interval
, VNL
);
1653 if (oi
->rxmt_interval
!= OSPF6_INTERFACE_RXMT_INTERVAL
)
1654 vty_out (vty
, " ipv6 ospf6 retransmit-interval %d%s",
1655 oi
->rxmt_interval
, VNL
);
1657 if (oi
->priority
!= OSPF6_INTERFACE_PRIORITY
)
1658 vty_out (vty
, " ipv6 ospf6 priority %d%s",
1661 if (oi
->transdelay
!= OSPF6_INTERFACE_TRANSDELAY
)
1662 vty_out (vty
, " ipv6 ospf6 transmit-delay %d%s",
1663 oi
->transdelay
, VNL
);
1665 if (oi
->instance_id
!= OSPF6_INTERFACE_INSTANCE_ID
)
1666 vty_out (vty
, " ipv6 ospf6 instance-id %d%s",
1667 oi
->instance_id
, VNL
);
1670 vty_out (vty
, " ipv6 ospf6 advertise prefix-list %s%s",
1671 oi
->plist_name
, VNL
);
1673 if (CHECK_FLAG (oi
->flag
, OSPF6_INTERFACE_PASSIVE
))
1674 vty_out (vty
, " ipv6 ospf6 passive%s", VNL
);
1677 vty_out (vty
, " ipv6 ospf6 mtu-ignore%s", VNL
);
1679 if (oi
->type
== OSPF_IFTYPE_POINTOPOINT
)
1680 vty_out (vty
, " ipv6 ospf6 network point-to-point%s", VNL
);
1681 else if (oi
->type
== OSPF_IFTYPE_BROADCAST
)
1682 vty_out (vty
, " ipv6 ospf6 network broadcast%s", VNL
);
1684 vty_out (vty
, "!%s", VNL
);
1689 static struct cmd_node interface_node
=
1697 ospf6_interface_init (void)
1699 /* Install interface node. */
1700 install_node (&interface_node
, config_write_ospf6_interface
);
1702 install_element (VIEW_NODE
, &show_ipv6_ospf6_interface_cmd
);
1703 install_element (VIEW_NODE
, &show_ipv6_ospf6_interface_prefix_cmd
);
1704 install_element (VIEW_NODE
, &show_ipv6_ospf6_interface_prefix_detail_cmd
);
1705 install_element (VIEW_NODE
, &show_ipv6_ospf6_interface_prefix_match_cmd
);
1706 install_element (VIEW_NODE
, &show_ipv6_ospf6_interface_ifname_cmd
);
1707 install_element (VIEW_NODE
, &show_ipv6_ospf6_interface_ifname_prefix_cmd
);
1708 install_element (VIEW_NODE
, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd
);
1709 install_element (VIEW_NODE
, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd
);
1710 install_element (ENABLE_NODE
, &show_ipv6_ospf6_interface_cmd
);
1711 install_element (ENABLE_NODE
, &show_ipv6_ospf6_interface_prefix_cmd
);
1712 install_element (ENABLE_NODE
, &show_ipv6_ospf6_interface_prefix_detail_cmd
);
1713 install_element (ENABLE_NODE
, &show_ipv6_ospf6_interface_prefix_match_cmd
);
1714 install_element (ENABLE_NODE
, &show_ipv6_ospf6_interface_ifname_cmd
);
1715 install_element (ENABLE_NODE
, &show_ipv6_ospf6_interface_ifname_prefix_cmd
);
1716 install_element (ENABLE_NODE
, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd
);
1717 install_element (ENABLE_NODE
, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd
);
1719 install_element (CONFIG_NODE
, &interface_cmd
);
1720 install_default (INTERFACE_NODE
);
1721 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
1722 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
1723 install_element (INTERFACE_NODE
, &ipv6_ospf6_cost_cmd
);
1724 install_element (INTERFACE_NODE
, &ipv6_ospf6_ifmtu_cmd
);
1725 install_element (INTERFACE_NODE
, &no_ipv6_ospf6_ifmtu_cmd
);
1726 install_element (INTERFACE_NODE
, &ipv6_ospf6_deadinterval_cmd
);
1727 install_element (INTERFACE_NODE
, &ipv6_ospf6_hellointerval_cmd
);
1728 install_element (INTERFACE_NODE
, &ipv6_ospf6_priority_cmd
);
1729 install_element (INTERFACE_NODE
, &ipv6_ospf6_retransmitinterval_cmd
);
1730 install_element (INTERFACE_NODE
, &ipv6_ospf6_transmitdelay_cmd
);
1731 install_element (INTERFACE_NODE
, &ipv6_ospf6_instance_cmd
);
1733 install_element (INTERFACE_NODE
, &ipv6_ospf6_passive_cmd
);
1734 install_element (INTERFACE_NODE
, &no_ipv6_ospf6_passive_cmd
);
1736 install_element (INTERFACE_NODE
, &ipv6_ospf6_mtu_ignore_cmd
);
1737 install_element (INTERFACE_NODE
, &no_ipv6_ospf6_mtu_ignore_cmd
);
1739 install_element (INTERFACE_NODE
, &ipv6_ospf6_advertise_prefix_list_cmd
);
1740 install_element (INTERFACE_NODE
, &no_ipv6_ospf6_advertise_prefix_list_cmd
);
1742 install_element (INTERFACE_NODE
, &ipv6_ospf6_network_cmd
);
1743 install_element (INTERFACE_NODE
, &no_ipv6_ospf6_network_cmd
);
1746 DEFUN (debug_ospf6_interface
,
1747 debug_ospf6_interface_cmd
,
1748 "debug ospf6 interface",
1751 "Debug OSPFv3 Interface\n"
1754 OSPF6_DEBUG_INTERFACE_ON ();
1758 DEFUN (no_debug_ospf6_interface
,
1759 no_debug_ospf6_interface_cmd
,
1760 "no debug ospf6 interface",
1764 "Debug OSPFv3 Interface\n"
1767 OSPF6_DEBUG_INTERFACE_OFF ();
1772 config_write_ospf6_debug_interface (struct vty
*vty
)
1774 if (IS_OSPF6_DEBUG_INTERFACE
)
1775 vty_out (vty
, "debug ospf6 interface%s", VNL
);
1780 install_element_ospf6_debug_interface (void)
1782 install_element (ENABLE_NODE
, &debug_ospf6_interface_cmd
);
1783 install_element (ENABLE_NODE
, &no_debug_ospf6_interface_cmd
);
1784 install_element (CONFIG_NODE
, &debug_ospf6_interface_cmd
);
1785 install_element (CONFIG_NODE
, &no_debug_ospf6_interface_cmd
);