2 * Copyright (C) 1999 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.
28 #include "ospf6_lsdb.h"
30 #include "ospf6_top.h"
31 #include "ospf6_area.h"
32 #include "ospf6_interface.h"
34 char *ospf6_interface_state_string
[] =
36 "None", "Down", "Loopback", "Waiting", "PointToPoint",
37 "DROther", "BDR", "DR", NULL
41 ospf6_interface_foreach_neighbor (struct ospf6_interface
*o6i
,
43 void (*func
) (void *, int, void *))
46 struct ospf6_neighbor
*nei
;
48 for (node
= listhead (o6i
->neighbor_list
); node
; nextnode (node
))
50 nei
= (struct ospf6_neighbor
*) getdata (node
);
51 (*func
) (arg
, val
, nei
);
56 ospf6_interface_maxage_remover (struct thread
*t
)
59 struct ospf6_interface
*o6i
= (struct ospf6_interface
*) THREAD_ARG (t
);
61 o6i
->maxage_remover
= (struct thread
*) NULL
;
64 o6i
->foreach_nei (o6i
, &count
, NBS_EXCHANGE
, ospf6_count_state
);
65 o6i
->foreach_nei (o6i
, &count
, NBS_LOADING
, ospf6_count_state
);
69 ospf6_lsdb_remove_maxage (o6i
->lsdb
);
74 ospf6_interface_schedule_maxage_remover (void *arg
, int val
, void *obj
)
76 struct ospf6_interface
*o6i
= (struct ospf6_interface
*) obj
;
78 if (o6i
->maxage_remover
!= NULL
)
82 thread_add_event (master
, ospf6_interface_maxage_remover
, o6i
, 0);
85 /* Create new ospf6 interface structure */
86 struct ospf6_interface
*
87 ospf6_interface_create (struct interface
*ifp
)
89 struct ospf6_interface
*o6i
;
91 o6i
= (struct ospf6_interface
*)
92 XMALLOC (MTYPE_OSPF6_IF
, sizeof (struct ospf6_interface
));
95 memset (o6i
, 0, sizeof (struct ospf6_interface
));
98 zlog_err ("Can't malloc ospf6_interface for ifindex %d", ifp
->ifindex
);
99 return (struct ospf6_interface
*) NULL
;
102 o6i
->instance_id
= 0;
103 o6i
->if_id
= ifp
->ifindex
;
104 o6i
->lladdr
= (struct in6_addr
*) NULL
;
105 o6i
->area
= (struct ospf6_area
*) NULL
;
106 o6i
->state
= IFS_DOWN
;
108 o6i
->neighbor_list
= list_new ();
110 o6i
->ack_list
= ospf6_lsdb_create ();
111 o6i
->lsdb
= ospf6_lsdb_create ();
115 o6i
->hello_interval
= 10;
116 o6i
->dead_interval
= 40;
117 o6i
->rxmt_interval
= 5;
121 o6i
->foreach_nei
= ospf6_interface_foreach_neighbor
;
124 o6i
->interface
= ifp
;
127 CALL_ADD_HOOK (&interface_hook
, o6i
);
129 /* Get the interface's link-local if any */
130 ospf6_interface_address_update(ifp
);
136 ospf6_interface_delete (struct ospf6_interface
*o6i
)
139 struct ospf6_neighbor
*o6n
;
141 CALL_REMOVE_HOOK (&interface_hook
, o6i
);
143 for (n
= listhead (o6i
->neighbor_list
); n
; nextnode (n
))
145 o6n
= (struct ospf6_neighbor
*) getdata (n
);
146 ospf6_neighbor_delete (o6n
);
148 list_delete (o6i
->neighbor_list
);
150 if (o6i
->thread_send_hello
)
152 thread_cancel (o6i
->thread_send_hello
);
153 o6i
->thread_send_hello
= NULL
;
155 if (o6i
->thread_send_lsack_delayed
)
157 thread_cancel (o6i
->thread_send_lsack_delayed
);
158 o6i
->thread_send_lsack_delayed
= NULL
;
161 ospf6_lsdb_delete (o6i
->ack_list
);
162 ospf6_lsdb_remove_all (o6i
->lsdb
);
163 ospf6_lsdb_delete (o6i
->lsdb
);
166 o6i
->interface
->info
= NULL
;
170 XFREE (MTYPE_PREFIX_LIST_STR
, o6i
->plist_name
);
172 XFREE (MTYPE_OSPF6_IF
, o6i
);
175 static struct in6_addr
*
176 ospf6_interface_update_linklocal_address (struct interface
*ifp
)
180 struct in6_addr
*l
= (struct in6_addr
*) NULL
;
182 /* for each connected address */
183 for (n
= listhead (ifp
->connected
); n
; nextnode (n
))
185 c
= (struct connected
*) getdata (n
);
187 /* if family not AF_INET6, ignore */
188 if (c
->address
->family
!= AF_INET6
)
191 /* linklocal scope check */
192 if (IN6_IS_ADDR_LINKLOCAL (&c
->address
->u
.prefix6
))
193 l
= &c
->address
->u
.prefix6
;
199 ospf6_interface_if_add (struct interface
*ifp
)
201 struct ospf6_interface
*o6i
;
203 o6i
= (struct ospf6_interface
*) ifp
->info
;
207 o6i
->if_id
= ifp
->ifindex
;
209 ospf6_interface_address_update (ifp
);
211 /* interface start */
213 thread_add_event (master
, interface_up
, o6i
, 0);
217 ospf6_interface_if_del (struct interface
*ifp
)
219 struct ospf6_interface
*o6i
;
221 o6i
= (struct ospf6_interface
*) ifp
->info
;
227 thread_execute (master
, interface_down
, o6i
, 0);
229 listnode_delete (o6i
->area
->if_list
, o6i
);
230 o6i
->area
= (struct ospf6_area
*) NULL
;
233 o6i
->interface
= NULL
;
236 ospf6_interface_delete (o6i
);
240 ospf6_interface_state_update (struct interface
*ifp
)
242 struct ospf6_interface
*o6i
;
244 o6i
= (struct ospf6_interface
*) ifp
->info
;
251 thread_add_event (master
, interface_up
, o6i
, 0);
253 thread_add_event (master
, interface_down
, o6i
, 0);
259 ospf6_interface_address_update (struct interface
*ifp
)
261 struct ospf6_interface
*o6i
;
263 o6i
= (struct ospf6_interface
*) ifp
->info
;
267 /* reset linklocal pointer */
268 o6i
->lladdr
= ospf6_interface_update_linklocal_address (ifp
);
270 /* if area is null, can't make link-lsa */
274 /* create new Link-LSA */
275 CALL_FOREACH_LSA_HOOK (hook_interface
, hook_change
, o6i
);
277 CALL_CHANGE_HOOK (&interface_hook
, o6i
);
280 struct ospf6_interface
*
281 ospf6_interface_lookup_by_index (int ifindex
)
283 struct ospf6_interface
*o6i
;
284 struct interface
*ifp
;
286 ifp
= if_lookup_by_index (ifindex
);
289 return (struct ospf6_interface
*) NULL
;
291 o6i
= (struct ospf6_interface
*) ifp
->info
;
295 struct ospf6_interface
*
296 ospf6_interface_lookup_by_name (char *ifname
)
298 struct ospf6_interface
*o6i
;
299 struct interface
*ifp
;
301 ifp
= if_lookup_by_name (ifname
);
304 return (struct ospf6_interface
*) NULL
;
306 o6i
= (struct ospf6_interface
*) ifp
->info
;
311 ospf6_interface_count_neighbor_in_state (u_char state
,
312 struct ospf6_interface
*o6i
)
315 struct ospf6_neighbor
*o6n
;
318 for (n
= listhead (o6i
->neighbor_list
); n
; nextnode (n
))
320 o6n
= (struct ospf6_neighbor
*) getdata (n
);
321 if (o6n
->state
== state
)
328 ospf6_interface_count_full_neighbor (struct ospf6_interface
*o6i
)
331 struct ospf6_neighbor
*o6n
;
334 for (n
= listhead (o6i
->neighbor_list
); n
; nextnode (n
))
336 o6n
= (struct ospf6_neighbor
*) getdata (n
);
337 if (o6n
->state
== NBS_FULL
)
344 ospf6_interface_is_enabled (unsigned int ifindex
)
346 struct ospf6_interface
*o6i
;
348 o6i
= ospf6_interface_lookup_by_index (ifindex
);
355 if (o6i
->state
<= IFS_DOWN
)
362 ospf6_interface_delayed_ack_add (struct ospf6_lsa
*lsa
,
363 struct ospf6_interface
*o6i
)
365 struct ospf6_lsa
*summary
;
366 summary
= ospf6_lsa_summary_create (lsa
->header
);
367 ospf6_lsdb_add (summary
, o6i
->ack_list
);
371 ospf6_interface_delayed_ack_remove (struct ospf6_lsa
*lsa
,
372 struct ospf6_interface
*o6i
)
374 struct ospf6_lsa
*summary
;
375 summary
= ospf6_lsdb_lookup_lsdb (lsa
->header
->type
, lsa
->header
->id
,
376 lsa
->header
->adv_router
, o6i
->ack_list
);
377 ospf6_lsdb_remove (summary
, o6i
->ack_list
);
380 /* show specified interface structure */
382 ospf6_interface_show (struct vty
*vty
, struct interface
*iface
)
384 struct ospf6_interface
*ospf6_interface
;
388 char strbuf
[64], dr
[32], bdr
[32];
389 char *updown
[3] = {"down", "up", NULL
};
392 /* check physical interface type */
393 if (if_is_loopback (iface
))
395 else if (if_is_broadcast (iface
))
397 else if (if_is_pointopoint (iface
))
398 type
= "POINTOPOINT";
402 vty_out (vty
, "%s is %s, type %s%s",
403 iface
->name
, updown
[if_is_up (iface
)], type
,
405 vty_out (vty
, " Interface ID: %d%s", iface
->ifindex
, VTY_NEWLINE
);
407 if (iface
->info
== NULL
)
409 vty_out (vty
, " OSPF not enabled on this interface%s", VTY_NEWLINE
);
413 ospf6_interface
= (struct ospf6_interface
*) iface
->info
;
415 vty_out (vty
, " Internet Address:%s", VTY_NEWLINE
);
416 for (i
= listhead (iface
->connected
); i
; nextnode (i
))
418 c
= (struct connected
*)getdata (i
);
420 prefix2str (p
, strbuf
, sizeof (strbuf
));
424 vty_out (vty
, " inet : %s%s", strbuf
,
428 vty_out (vty
, " inet6: %s%s", strbuf
,
432 vty_out (vty
, " ??? : %s%s", strbuf
,
438 if (ospf6_interface
->area
)
440 inet_ntop (AF_INET
, &ospf6_interface
->area
->ospf6
->router_id
,
441 strbuf
, sizeof (strbuf
));
442 vty_out (vty
, " Instance ID %d, Router ID %s%s",
443 ospf6_interface
->instance_id
, strbuf
,
445 inet_ntop (AF_INET
, &ospf6_interface
->area
->area_id
,
446 strbuf
, sizeof (strbuf
));
447 vty_out (vty
, " Area ID %s, Cost %hu%s", strbuf
,
448 ospf6_interface
->cost
, VTY_NEWLINE
);
451 vty_out (vty
, " Not Attached to Area%s", VTY_NEWLINE
);
453 vty_out (vty
, " State %s, Transmit Delay %d sec, Priority %d%s",
454 ospf6_interface_state_string
[ospf6_interface
->state
],
455 ospf6_interface
->transdelay
,
456 ospf6_interface
->priority
,
458 vty_out (vty
, " Timer intervals configured:%s", VTY_NEWLINE
);
459 vty_out (vty
, " Hello %d, Dead %d, Retransmit %d%s",
460 ospf6_interface
->hello_interval
,
461 ospf6_interface
->dead_interval
,
462 ospf6_interface
->rxmt_interval
,
465 inet_ntop (AF_INET
, &ospf6_interface
->dr
, dr
, sizeof (dr
));
466 inet_ntop (AF_INET
, &ospf6_interface
->bdr
, bdr
, sizeof (bdr
));
467 vty_out (vty
, " DR:%s BDR:%s%s", dr
, bdr
, VTY_NEWLINE
);
469 vty_out (vty
, " Number of I/F scoped LSAs is %u%s",
470 ospf6_interface
->lsdb
->count
, VTY_NEWLINE
);
471 vty_out (vty
, " %-16s %5d times, %-16s %5d times%s",
472 "DRElection", ospf6_interface
->ospf6_stat_dr_election
,
473 "DelayedLSAck", ospf6_interface
->ospf6_stat_delayed_lsack
,
480 ospf6_interface_statistics_show (struct vty
*vty
, struct ospf6_interface
*o6i
)
482 struct timeval now
, uptime
;
483 u_long recv_total
, send_total
;
484 u_long bps_total_avg
, bps_tx_avg
, bps_rx_avg
;
487 gettimeofday (&now
, (struct timezone
*) NULL
);
488 ospf6_timeval_sub (&now
, &ospf6
->starttime
, &uptime
);
490 recv_total
= send_total
= 0;
491 for (i
= 0; i
< OSPF6_MESSAGE_TYPE_MAX
; i
++)
493 recv_total
+= o6i
->message_stat
[i
].recv_octet
;
494 send_total
+= o6i
->message_stat
[i
].send_octet
;
496 bps_total_avg
= (recv_total
+ send_total
) * 8 / uptime
.tv_sec
;
497 bps_tx_avg
= send_total
* 8 / uptime
.tv_sec
;
498 bps_rx_avg
= recv_total
* 8 / uptime
.tv_sec
;
500 vty_out (vty
, " Statistics of interface %s%s",
501 o6i
->interface
->name
, VTY_NEWLINE
);
502 vty_out (vty
, " Number of Neighbor: %d%s",
503 listcount (o6i
->neighbor_list
), VTY_NEWLINE
);
505 vty_out (vty
, " %-8s %6s %6s %8s %8s%s",
506 "Type", "tx", "rx", "tx-byte", "rx-byte", VTY_NEWLINE
);
507 for (i
= 0; i
< OSPF6_MESSAGE_TYPE_MAX
; i
++)
509 vty_out (vty
, " %-8s %6d %6d %8d %8d%s",
510 ospf6_message_type_string
[i
],
511 o6i
->message_stat
[i
].send
,
512 o6i
->message_stat
[i
].recv
,
513 o6i
->message_stat
[i
].send_octet
,
514 o6i
->message_stat
[i
].recv_octet
,
518 vty_out (vty
, " Average Link bandwidth: %ldbps"
519 " (Tx: %ldbps Rx: %ldbps)%s",
520 bps_total_avg
, bps_tx_avg
, bps_rx_avg
, VTY_NEWLINE
);
524 DEFUN (show_ipv6_ospf6_interface
,
525 show_ipv6_ospf6_interface_ifname_cmd
,
526 "show ipv6 ospf6 interface IFNAME",
534 struct interface
*ifp
;
539 ifp
= if_lookup_by_name (argv
[0]);
542 vty_out (vty
, "No such Interface: %s%s", argv
[0],
546 ospf6_interface_show (vty
, ifp
);
550 for (i
= listhead (iflist
); i
; nextnode (i
))
552 ifp
= (struct interface
*)getdata (i
);
553 ospf6_interface_show (vty
, ifp
);
559 ALIAS (show_ipv6_ospf6_interface
,
560 show_ipv6_ospf6_interface_cmd
,
561 "show ipv6 ospf6 interface",
568 /* interface variable set command */
569 DEFUN (ipv6_ospf6_cost
,
571 "ipv6 ospf6 cost COST",
578 struct ospf6_interface
*o6i
;
579 struct interface
*ifp
;
581 ifp
= (struct interface
*)vty
->index
;
584 o6i
= (struct ospf6_interface
*)ifp
->info
;
586 o6i
= ospf6_interface_create (ifp
);
589 if (o6i
->cost
== strtol (argv
[0], NULL
, 10))
592 o6i
->cost
= strtol (argv
[0], NULL
, 10);
594 /* execute LSA hooks */
595 CALL_FOREACH_LSA_HOOK (hook_interface
, hook_change
, o6i
);
597 CALL_CHANGE_HOOK (&interface_hook
, o6i
);
602 /* interface variable set command */
603 DEFUN (ipv6_ospf6_hellointerval
,
604 ipv6_ospf6_hellointerval_cmd
,
605 "ipv6 ospf6 hello-interval HELLO_INTERVAL",
608 "Time between HELLO packets\n"
612 struct ospf6_interface
*ospf6_interface
;
613 struct interface
*ifp
;
615 ifp
= (struct interface
*) vty
->index
;
617 ospf6_interface
= (struct ospf6_interface
*) ifp
->info
;
618 if (!ospf6_interface
)
619 ospf6_interface
= ospf6_interface_create (ifp
);
620 assert (ospf6_interface
);
622 ospf6_interface
->hello_interval
= strtol (argv
[0], NULL
, 10);
626 /* interface variable set command */
627 DEFUN (ipv6_ospf6_deadinterval
,
628 ipv6_ospf6_deadinterval_cmd
,
629 "ipv6 ospf6 dead-interval ROUTER_DEAD_INTERVAL",
632 "Interval after which a neighbor is declared dead\n"
636 struct ospf6_interface
*ospf6_interface
;
637 struct interface
*ifp
;
639 ifp
= (struct interface
*) vty
->index
;
641 ospf6_interface
= (struct ospf6_interface
*) ifp
->info
;
642 if (!ospf6_interface
)
643 ospf6_interface
= ospf6_interface_create (ifp
);
644 assert (ospf6_interface
);
646 ospf6_interface
->dead_interval
= strtol (argv
[0], NULL
, 10);
650 /* interface variable set command */
651 DEFUN (ipv6_ospf6_transmitdelay
,
652 ipv6_ospf6_transmitdelay_cmd
,
653 "ipv6 ospf6 transmit-delay TRANSMITDELAY",
656 "Link state transmit delay\n"
660 struct ospf6_interface
*ospf6_interface
;
661 struct interface
*ifp
;
663 ifp
= (struct interface
*) vty
->index
;
665 ospf6_interface
= (struct ospf6_interface
*) ifp
->info
;
666 if (!ospf6_interface
)
667 ospf6_interface
= ospf6_interface_create (ifp
);
668 assert (ospf6_interface
);
670 ospf6_interface
->transdelay
= strtol (argv
[0], NULL
, 10);
674 /* interface variable set command */
675 DEFUN (ipv6_ospf6_retransmitinterval
,
676 ipv6_ospf6_retransmitinterval_cmd
,
677 "ipv6 ospf6 retransmit-interval RXMTINTERVAL",
680 "Time between retransmitting lost link state advertisements\n"
684 struct ospf6_interface
*ospf6_interface
;
685 struct interface
*ifp
;
687 ifp
= (struct interface
*) vty
->index
;
689 ospf6_interface
= (struct ospf6_interface
*) ifp
->info
;
690 if (!ospf6_interface
)
691 ospf6_interface
= ospf6_interface_create (ifp
);
692 assert (ospf6_interface
);
694 ospf6_interface
->rxmt_interval
= strtol (argv
[0], NULL
, 10);
698 /* interface variable set command */
699 DEFUN (ipv6_ospf6_priority
,
700 ipv6_ospf6_priority_cmd
,
701 "ipv6 ospf6 priority PRIORITY",
708 struct ospf6_interface
*ospf6_interface
;
709 struct interface
*ifp
;
711 ifp
= (struct interface
*) vty
->index
;
713 ospf6_interface
= (struct ospf6_interface
*) ifp
->info
;
714 if (!ospf6_interface
)
715 ospf6_interface
= ospf6_interface_create (ifp
);
716 assert (ospf6_interface
);
718 ospf6_interface
->priority
= strtol (argv
[0], NULL
, 10);
720 if (ospf6_interface
->area
)
721 ifs_change (dr_election (ospf6_interface
), "Priority reconfigured",
727 DEFUN (ipv6_ospf6_instance
,
728 ipv6_ospf6_instance_cmd
,
729 "ipv6 ospf6 instance-id INSTANCE",
733 "<0-255> Instance ID\n"
736 struct ospf6_interface
*ospf6_interface
;
737 struct interface
*ifp
;
739 ifp
= (struct interface
*)vty
->index
;
742 ospf6_interface
= (struct ospf6_interface
*)ifp
->info
;
743 if (!ospf6_interface
)
744 ospf6_interface
= ospf6_interface_create (ifp
);
745 assert (ospf6_interface
);
747 ospf6_interface
->instance_id
= strtol (argv
[0], NULL
, 10);
751 DEFUN (ipv6_ospf6_passive
,
752 ipv6_ospf6_passive_cmd
,
753 "ipv6 ospf6 passive",
756 "passive interface: No Adjacency will be formed on this I/F\n"
759 struct ospf6_interface
*o6i
;
760 struct interface
*ifp
;
762 struct ospf6_neighbor
*o6n
;
764 ifp
= (struct interface
*) vty
->index
;
766 o6i
= (struct ospf6_interface
*) ifp
->info
;
768 o6i
= ospf6_interface_create (ifp
);
771 SET_FLAG (o6i
->flag
, OSPF6_INTERFACE_FLAG_PASSIVE
);
772 if (o6i
->thread_send_hello
)
774 thread_cancel (o6i
->thread_send_hello
);
775 o6i
->thread_send_hello
= (struct thread
*) NULL
;
778 for (node
= listhead (o6i
->neighbor_list
); node
; nextnode (node
))
780 o6n
= getdata (node
);
781 if (o6n
->inactivity_timer
)
782 thread_cancel (o6n
->inactivity_timer
);
783 thread_execute (master
, inactivity_timer
, o6n
, 0);
789 DEFUN (no_ipv6_ospf6_passive
,
790 no_ipv6_ospf6_passive_cmd
,
791 "no ipv6 ospf6 passive",
795 "passive interface: No Adjacency will be formed on this I/F\n"
798 struct ospf6_interface
*o6i
;
799 struct interface
*ifp
;
801 ifp
= (struct interface
*) vty
->index
;
803 o6i
= (struct ospf6_interface
*) ifp
->info
;
805 o6i
= ospf6_interface_create (ifp
);
808 UNSET_FLAG (o6i
->flag
, OSPF6_INTERFACE_FLAG_PASSIVE
);
809 if (o6i
->thread_send_hello
== NULL
)
810 thread_add_event (master
, ospf6_send_hello
, o6i
, 0);
816 DEFUN (ipv6_ospf6_advertise_force_prefix
,
817 ipv6_ospf6_advertise_force_prefix_cmd
,
818 "ipv6 ospf6 advertise force-prefix",
821 "Advertising options\n"
822 "Force advertising prefix, applicable if Loopback or P-to-P\n"
825 struct ospf6_interface
*o6i
;
826 struct interface
*ifp
;
828 ifp
= (struct interface
*) vty
->index
;
830 o6i
= (struct ospf6_interface
*) ifp
->info
;
832 o6i
= ospf6_interface_create (ifp
);
835 if (! if_is_loopback (ifp
) && ! if_is_pointopoint (ifp
))
837 vty_out (vty
, "Interface not Loopback nor PointToPoint%s",
839 return CMD_ERR_NOTHING_TODO
;
842 SET_FLAG (o6i
->flag
, OSPF6_INTERFACE_FLAG_FORCE_PREFIX
);
844 /* execute LSA hooks */
845 CALL_FOREACH_LSA_HOOK (hook_interface
, hook_change
, o6i
);
847 CALL_CHANGE_HOOK (&interface_hook
, o6i
);
852 DEFUN (no_ipv6_ospf6_advertise_force_prefix
,
853 no_ipv6_ospf6_advertise_force_prefix_cmd
,
854 "no ipv6 ospf6 advertise force-prefix",
858 "Advertising options\n"
859 "Force to advertise prefix, applicable if Loopback or P-to-P\n"
862 struct ospf6_interface
*o6i
;
863 struct interface
*ifp
;
865 ifp
= (struct interface
*) vty
->index
;
867 o6i
= (struct ospf6_interface
*) ifp
->info
;
869 o6i
= ospf6_interface_create (ifp
);
872 UNSET_FLAG (o6i
->flag
, OSPF6_INTERFACE_FLAG_FORCE_PREFIX
);
874 /* execute LSA hooks */
875 CALL_FOREACH_LSA_HOOK (hook_interface
, hook_change
, o6i
);
877 CALL_CHANGE_HOOK (&interface_hook
, o6i
);
882 DEFUN (ipv6_ospf6_advertise_prefix_list
,
883 ipv6_ospf6_advertise_prefix_list_cmd
,
884 "ipv6 ospf6 advertise prefix-list WORD",
887 "Advertising options\n"
888 "Filter prefix using prefix-list\n"
892 struct ospf6_interface
*o6i
;
893 struct interface
*ifp
;
895 ifp
= (struct interface
*) vty
->index
;
897 o6i
= (struct ospf6_interface
*) ifp
->info
;
899 o6i
= ospf6_interface_create (ifp
);
903 XFREE (MTYPE_PREFIX_LIST_STR
, o6i
->plist_name
);
904 o6i
->plist_name
= XSTRDUP (MTYPE_PREFIX_LIST_STR
, argv
[0]);
906 /* execute LSA hooks */
907 CALL_FOREACH_LSA_HOOK (hook_interface
, hook_change
, o6i
);
909 CALL_CHANGE_HOOK (&interface_hook
, o6i
);
914 DEFUN (no_ipv6_ospf6_advertise_prefix_list
,
915 no_ipv6_ospf6_advertise_prefix_list_cmd
,
916 "no ipv6 ospf6 advertise prefix-list",
920 "Advertising options\n"
921 "Filter prefix using prefix-list\n"
924 struct ospf6_interface
*o6i
;
925 struct interface
*ifp
;
927 ifp
= (struct interface
*) vty
->index
;
929 o6i
= (struct ospf6_interface
*) ifp
->info
;
931 o6i
= ospf6_interface_create (ifp
);
936 XFREE (MTYPE_PREFIX_LIST_STR
, o6i
->plist_name
);
937 o6i
->plist_name
= NULL
;
940 /* execute LSA hooks */
941 CALL_FOREACH_LSA_HOOK (hook_interface
, hook_change
, o6i
);
943 CALL_CHANGE_HOOK (&interface_hook
, o6i
);
949 ospf6_interface_config_write (struct vty
*vty
)
952 struct ospf6_interface
*o6i
;
953 struct interface
*ifp
;
955 for (i
= listhead (iflist
); i
; nextnode (i
))
957 ifp
= (struct interface
*) getdata (i
);
958 o6i
= (struct ospf6_interface
*) ifp
->info
;
962 vty_out (vty
, "interface %s%s",
963 o6i
->interface
->name
, VTY_NEWLINE
);
964 vty_out (vty
, " ipv6 ospf6 cost %d%s",
965 o6i
->cost
, VTY_NEWLINE
);
966 vty_out (vty
, " ipv6 ospf6 hello-interval %d%s",
967 o6i
->hello_interval
, VTY_NEWLINE
);
968 vty_out (vty
, " ipv6 ospf6 dead-interval %d%s",
969 o6i
->dead_interval
, VTY_NEWLINE
);
970 vty_out (vty
, " ipv6 ospf6 retransmit-interval %d%s",
971 o6i
->rxmt_interval
, VTY_NEWLINE
);
972 vty_out (vty
, " ipv6 ospf6 priority %d%s",
973 o6i
->priority
, VTY_NEWLINE
);
974 vty_out (vty
, " ipv6 ospf6 transmit-delay %d%s",
975 o6i
->transdelay
, VTY_NEWLINE
);
976 vty_out (vty
, " ipv6 ospf6 instance-id %d%s",
977 o6i
->instance_id
, VTY_NEWLINE
);
979 if (CHECK_FLAG (o6i
->flag
, OSPF6_INTERFACE_FLAG_FORCE_PREFIX
))
980 vty_out (vty
, " ipv6 ospf6 advertise force-prefix%s", VTY_NEWLINE
);
982 vty_out (vty
, " ipv6 ospf6 advertise prefix-list %s%s",
983 o6i
->plist_name
, VTY_NEWLINE
);
985 if (CHECK_FLAG (o6i
->flag
, OSPF6_INTERFACE_FLAG_PASSIVE
))
986 vty_out (vty
, " ipv6 ospf6 passive%s", VTY_NEWLINE
);
988 vty_out (vty
, "!%s", VTY_NEWLINE
);
993 struct cmd_node interface_node
=
1000 ospf6_interface_init ()
1002 /* Install interface node. */
1003 install_node (&interface_node
, ospf6_interface_config_write
);
1005 install_element (VIEW_NODE
, &show_ipv6_ospf6_interface_cmd
);
1006 install_element (VIEW_NODE
, &show_ipv6_ospf6_interface_ifname_cmd
);
1007 install_element (ENABLE_NODE
, &show_ipv6_ospf6_interface_cmd
);
1008 install_element (ENABLE_NODE
, &show_ipv6_ospf6_interface_ifname_cmd
);
1010 install_default (INTERFACE_NODE
);
1011 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
1012 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
1013 install_element (INTERFACE_NODE
, &ipv6_ospf6_cost_cmd
);
1014 install_element (INTERFACE_NODE
, &ipv6_ospf6_deadinterval_cmd
);
1015 install_element (INTERFACE_NODE
, &ipv6_ospf6_hellointerval_cmd
);
1016 install_element (INTERFACE_NODE
, &ipv6_ospf6_priority_cmd
);
1017 install_element (INTERFACE_NODE
, &ipv6_ospf6_retransmitinterval_cmd
);
1018 install_element (INTERFACE_NODE
, &ipv6_ospf6_transmitdelay_cmd
);
1019 install_element (INTERFACE_NODE
, &ipv6_ospf6_instance_cmd
);
1020 install_element (INTERFACE_NODE
, &ipv6_ospf6_advertise_force_prefix_cmd
);
1021 install_element (INTERFACE_NODE
, &no_ipv6_ospf6_advertise_force_prefix_cmd
);
1022 install_element (INTERFACE_NODE
, &ipv6_ospf6_advertise_prefix_list_cmd
);
1023 install_element (INTERFACE_NODE
, &no_ipv6_ospf6_advertise_prefix_list_cmd
);
1024 install_element (INTERFACE_NODE
, &ipv6_ospf6_passive_cmd
);
1025 install_element (INTERFACE_NODE
, &no_ipv6_ospf6_passive_cmd
);