2 * IS-IS Rout(e)ing protocol - isis_circuit.h
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public Licenseas published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
13 * This program is distributed in the hope that it will be useful,but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include <net/ethernet.h>
38 #include "isisd/dict.h"
39 #include "isisd/include-netbsd/iso.h"
40 #include "isisd/isis_constants.h"
41 #include "isisd/isis_common.h"
42 #include "isisd/isis_circuit.h"
43 #include "isisd/isis_tlv.h"
44 #include "isisd/isis_lsp.h"
45 #include "isisd/isis_pdu.h"
46 #include "isisd/isis_network.h"
47 #include "isisd/isis_misc.h"
48 #include "isisd/isis_constants.h"
49 #include "isisd/isis_adjacency.h"
50 #include "isisd/isis_dr.h"
51 #include "isisd/isis_flags.h"
52 #include "isisd/isisd.h"
53 #include "isisd/isis_csm.h"
54 #include "isisd/isis_events.h"
56 extern struct thread_master
*master
;
57 extern struct isis
*isis
;
62 struct isis_circuit
*circuit
;
65 circuit
= XMALLOC (MTYPE_ISIS_CIRCUIT
, sizeof (struct isis_circuit
));
67 memset (circuit
, 0, sizeof (struct isis_circuit
));
68 /* set default metrics for circuit */
69 for (i
= 0; i
< 2; i
++) {
70 circuit
->metrics
[i
].metric_default
= DEFAULT_CIRCUIT_METRICS
;
71 circuit
->metrics
[i
].metric_expense
= METRICS_UNSUPPORTED
;
72 circuit
->metrics
[i
].metric_error
= METRICS_UNSUPPORTED
;
73 circuit
->metrics
[i
].metric_delay
= METRICS_UNSUPPORTED
;
76 zlog_err ("Can't malloc isis circuit");
85 isis_circuit_configure (struct isis_circuit
*circuit
, struct isis_area
*area
)
90 * The level for the circuit is same as for the area, unless configured
93 circuit
->circuit_is_type
= area
->is_type
;
97 for (i
= 0; i
< 2; i
++) {
98 circuit
->hello_interval
[i
] = HELLO_INTERVAL
;
99 circuit
->hello_multiplier
[i
] = HELLO_MULTIPLIER
;
100 circuit
->csnp_interval
[i
] = CSNP_INTERVAL
;
101 circuit
->psnp_interval
[i
] = PSNP_INTERVAL
;
102 circuit
->u
.bc
.priority
[i
] = DEFAULT_PRIORITY
;
104 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
105 circuit
->u
.bc
.adjdb
[0] = list_new ();
106 circuit
->u
.bc
.adjdb
[1] = list_new ();
107 circuit
->u
.bc
.pad_hellos
= 1;
109 circuit
->lsp_interval
= LSP_INTERVAL
;
112 * Add the circuit into area
114 listnode_add (area
->circuit_list
, circuit
);
116 circuit
->idx
= flags_get_index (&area
->flags
);
117 circuit
->lsp_queue
= list_new ();
123 isis_circuit_deconfigure (struct isis_circuit
*circuit
,
124 struct isis_area
*area
)
127 /* Remove circuit from area */
128 listnode_delete (area
->circuit_list
, circuit
);
129 /* Free the index of SRM and SSN flags */
130 flags_free_index (&area
->flags
, circuit
->idx
);
135 struct isis_circuit
*
136 circuit_lookup_by_ifp (struct interface
*ifp
, struct list
*list
)
138 struct isis_circuit
*circuit
= NULL
;
139 struct listnode
*node
;
144 for (node
= listhead (list
); node
; nextnode (node
)) {
145 circuit
= getdata (node
);
146 if (circuit
->interface
== ifp
)
153 struct isis_circuit
*
154 circuit_scan_by_ifp (struct interface
*ifp
)
156 struct isis_area
*area
;
157 struct listnode
*node
;
158 struct isis_circuit
*circuit
;
160 if (!isis
->area_list
)
163 for (node
= listhead (isis
->area_list
); node
; nextnode (node
)) {
164 area
= getdata (node
);
165 circuit
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
170 return circuit_lookup_by_ifp (ifp
, isis
->init_circ_list
);
174 isis_circuit_del (struct isis_circuit
*circuit
)
180 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
181 /* destroy adjacency databases */
182 list_delete (circuit
->u
.bc
.adjdb
[0]);
183 list_delete (circuit
->u
.bc
.adjdb
[1]);
184 /* destroy neighbour lists */
185 if (circuit
->u
.bc
.lan_neighs
[0])
186 list_delete (circuit
->u
.bc
.lan_neighs
[0]);
187 if (circuit
->u
.bc
.lan_neighs
[1])
188 list_delete (circuit
->u
.bc
.lan_neighs
[1]);
189 /* destroy addresses */
191 if (circuit
->ip_addrs
)
192 list_delete (circuit
->ip_addrs
);
194 if (circuit
->ipv6_link
)
195 list_delete (circuit
->ipv6_link
);
196 if (circuit
->ipv6_non_link
)
197 list_delete (circuit
->ipv6_non_link
);
198 #endif /* HAVE_IPV6 */
200 /* and lastly the circuit itself */
201 XFREE (MTYPE_ISIS_CIRCUIT
, circuit
);
207 isis_circuit_add_addr (struct isis_circuit
*circuit
,
208 struct connected
*conn
)
210 struct prefix_ipv4
*ipv4
;
213 struct prefix_ipv6
*ipv6
;
214 #endif /* HAVE_IPV6 */
215 if (!circuit
->ip_addrs
) {
216 circuit
->ip_addrs
= list_new ();
219 if (!circuit
->ipv6_link
) {
220 circuit
->ipv6_link
= list_new ();
222 if (!circuit
->ipv6_non_link
) {
223 circuit
->ipv6_non_link
= list_new ();
225 #endif /* HAVE_IPV6 */
227 memset (&buf
, 0, BUFSIZ
);
228 if (conn
->address
->family
== AF_INET
) {
229 ipv4
= prefix_ipv4_new ();
230 ipv4
->prefixlen
= conn
->address
->prefixlen
;
231 ipv4
->prefix
= conn
->address
->u
.prefix4
;
232 listnode_add (circuit
->ip_addrs
, ipv4
);
233 prefix2str (conn
->address
, buf
, BUFSIZ
);
235 zlog_info ("Added IP address %s to circuit %d", buf
,
236 circuit
->circuit_id
);
237 #endif /* EXTREME_DEBUG */
240 if (conn
->address
->family
== AF_INET6
) {
241 ipv6
= prefix_ipv6_new ();
242 ipv6
->prefixlen
= conn
->address
->prefixlen
;
243 ipv6
->prefix
= conn
->address
->u
.prefix6
;
244 if (IN6_IS_ADDR_LINKLOCAL(&ipv6
->prefix
)) {
245 listnode_add (circuit
->ipv6_link
, ipv6
);
247 listnode_add (circuit
->ipv6_non_link
, ipv6
);
249 prefix2str (conn
->address
, buf
, BUFSIZ
);
251 zlog_info ("Added IPv6 address %s to circuit %d", buf
,
252 circuit
->circuit_id
);
253 #endif /* EXTREME_DEBUG */
255 #endif /* HAVE_IPV6 */
262 isis_circuit_del_addr (struct isis_circuit
*circuit
,
263 struct connected
*connected
)
269 isis_circuit_if_add (struct isis_circuit
*circuit
, struct interface
*ifp
)
271 struct listnode
*node
;
272 struct connected
*conn
;
274 circuit
->interface
= ifp
;
277 circuit
->circuit_id
= ifp
->ifindex
% 255; /* FIXME: Why not ? */
279 /* isis_circuit_update_addrs (circuit, ifp); */
281 if (if_is_broadcast (ifp
)) {
282 circuit
->circ_type
= CIRCUIT_T_BROADCAST
;
284 * Get the Hardware Address
286 #ifdef HAVE_SOCKADDR_DL
287 if (circuit
->interface
->sdl
.sdl_alen
!= ETHER_ADDR_LEN
)
288 zlog_warn ("unsupported link layer");
290 memcpy (circuit
->u
.bc
.snpa
, LLADDR(&circuit
->interface
->sdl
), ETH_ALEN
);
292 if (circuit
->interface
->hw_addr_len
!= ETH_ALEN
) {
293 zlog_warn ("unsupported link layer");
295 memcpy (circuit
->u
.bc
.snpa
, circuit
->interface
->hw_addr
, ETH_ALEN
);
298 zlog_info ("isis_circuit_if_add: if_id %d, isomtu %d snpa %s",
299 circuit
->interface
->ifindex
, ISO_MTU (circuit
),
300 snpa_print (circuit
->u
.bc
.snpa
));
302 #endif /* EXTREME_DEBUG */
303 #endif /* HAVE_SOCKADDR_DL */
304 } else if (if_is_pointopoint (ifp
)) {
305 circuit
->circ_type
= CIRCUIT_T_P2P
;
307 zlog_warn ("isis_circuit_if_add: unsupported media");
310 for (node
= ifp
->connected
? listhead (ifp
->connected
) : NULL
; node
;
312 conn
= getdata (node
);
313 isis_circuit_add_addr (circuit
, conn
);
320 isis_circuit_update_params (struct isis_circuit
*circuit
,
321 struct interface
*ifp
)
325 if (circuit
->circuit_id
!= ifp
->ifindex
) {
326 zlog_warn ("changing circuit_id %d->%d", circuit
->circuit_id
,
328 circuit
->circuit_id
= ifp
->ifindex
% 255;
331 /* FIXME: Why is this needed? shouldn't we compare to the area's mtu */
332 /* Ofer, this was here in case someone changes the mtu (e.g. with ifconfig)
333 The areas MTU is the minimum of mtu's of circuits in the area
334 now we can't catch the change
335 if (circuit->mtu != ifp->mtu) {
336 zlog_warn ("changing circuit mtu %d->%d", circuit->mtu,
338 circuit->mtu = ifp->mtu;
342 * Get the Hardware Address
344 #ifdef HAVE_SOCKADDR_DL
345 if (circuit
->interface
->sdl
.sdl_alen
!= ETHER_ADDR_LEN
)
346 zlog_warn ("unsupported link layer");
348 memcpy (circuit
->u
.bc
.snpa
, LLADDR(&circuit
->interface
->sdl
), ETH_ALEN
);
350 if (circuit
->interface
->hw_addr_len
!= ETH_ALEN
) {
351 zlog_warn ("unsupported link layer");
353 if (memcmp(circuit
->u
.bc
.snpa
, circuit
->interface
->hw_addr
, ETH_ALEN
)) {
354 zlog_warn ("changing circuit snpa %s->%s",
355 snpa_print (circuit
->u
.bc
.snpa
),
356 snpa_print (circuit
->interface
->hw_addr
));
363 if (if_is_broadcast (ifp
)) {
364 circuit
->circ_type
= CIRCUIT_T_BROADCAST
;
365 } else if (if_is_pointopoint (ifp
)) {
366 circuit
->circ_type
= CIRCUIT_T_P2P
;
368 zlog_warn ("isis_circuit_update_params: unsupported media");
375 isis_circuit_if_del (struct isis_circuit
*circuit
)
377 circuit
->interface
->info
= NULL
;
378 circuit
->interface
= NULL
;
384 isis_circuit_up (struct isis_circuit
*circuit
)
387 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
388 if (circuit
->area
->min_bcast_mtu
== 0 ||
389 ISO_MTU(circuit
) < circuit
->area
->min_bcast_mtu
)
390 circuit
->area
->min_bcast_mtu
= ISO_MTU(circuit
);
392 * ISO 10589 - 8.4.1 Enabling of broadcast circuits
395 /* initilizing the hello sending threads
399 /* 8.4.1 a) commence sending of IIH PDUs */
401 if (circuit
->circuit_is_type
& IS_LEVEL_1
) {
402 thread_add_event (master
, send_lan_l1_hello
, circuit
, 0);
403 circuit
->u
.bc
.lan_neighs
[0] = list_new ();
406 if (circuit
->circuit_is_type
& IS_LEVEL_2
) {
407 thread_add_event (master
, send_lan_l2_hello
, circuit
, 0);
408 circuit
->u
.bc
.lan_neighs
[1] = list_new ();
411 /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */
412 /* 8.4.1 c) FIXME: listen for ESH PDUs */
415 /* dr election will commence in... */
416 if (circuit
->circuit_is_type
& IS_LEVEL_1
)
417 circuit
->u
.bc
.t_run_dr
[0] =
418 thread_add_timer (master
, isis_run_dr_l1
, circuit
,
419 2 * circuit
->hello_multiplier
[0] * circuit
->hello_interval
[0]);
420 if (circuit
->circuit_is_type
& IS_LEVEL_2
)
421 circuit
->u
.bc
.t_run_dr
[1] =
422 thread_add_timer (master
, isis_run_dr_l2
, circuit
,
423 2 * circuit
->hello_multiplier
[1] * circuit
->hello_interval
[1]);
425 /* initializing the hello send threads
428 thread_add_event (master
, send_p2p_hello
, circuit
, 0);
432 /* initializing PSNP timers */
433 if (circuit
->circuit_is_type
& IS_LEVEL_1
) {
434 circuit
->t_send_psnp
[0] = thread_add_timer (master
,
438 (circuit
->psnp_interval
[0],
442 if (circuit
->circuit_is_type
& IS_LEVEL_2
) {
443 circuit
->t_send_psnp
[1] = thread_add_timer (master
,
447 (circuit
->psnp_interval
[1],
452 /* initialize the circuit streams */
453 if (circuit
->rcv_stream
== NULL
)
454 circuit
->rcv_stream
= stream_new (ISO_MTU(circuit
));
456 if (circuit
->snd_stream
== NULL
)
457 circuit
->snd_stream
= stream_new (ISO_MTU(circuit
));
459 /* unified init for circuits */
460 isis_sock_init (circuit
);
463 circuit
->t_read
= thread_add_read (master
, isis_receive
, circuit
,
466 circuit
->t_read
= thread_add_timer (master
, isis_receive
, circuit
,
473 isis_circuit_down (struct isis_circuit
*circuit
)
475 /* Cancel all active threads -- FIXME: wrong place*/
477 thread_cancel (circuit
->t_read
);
478 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
479 if (circuit
->u
.bc
.t_send_lan_hello
[0])
480 thread_cancel (circuit
->u
.bc
.t_send_lan_hello
[0]);
481 if (circuit
->u
.bc
.t_send_lan_hello
[1])
482 thread_cancel (circuit
->u
.bc
.t_send_lan_hello
[1]);
483 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
) {
484 if (circuit
->u
.p2p
.t_send_p2p_hello
)
485 thread_cancel (circuit
->u
.p2p
.t_send_p2p_hello
);
487 /* close the socket */
494 circuit_update_nlpids (struct isis_circuit
*circuit
)
496 circuit
->nlpids
.count
= 0;
498 if (circuit
->ip_router
) {
499 circuit
->nlpids
.nlpids
[0] = NLPID_IP
;
500 circuit
->nlpids
.count
++;
503 if (circuit
->ipv6_router
) {
504 circuit
->nlpids
.nlpids
[circuit
->nlpids
.count
] = NLPID_IPV6
;
505 circuit
->nlpids
.count
++;
507 #endif /* HAVE_IPV6 */
512 isis_interface_config_write (struct vty
*vty
)
519 struct interface
*ifp
;
520 struct isis_area
*area
;
521 struct isis_circuit
*c
;
522 struct prefix_ipv4
*ip
;
525 struct prefix_ipv6
*ipv6
;
526 #endif /*HAVE_IPV6 */
531 LIST_LOOP (iflist
, ifp
, node
)
534 vty_out (vty
, "interface %s%s", ifp
->name
,VTY_NEWLINE
);
538 vty_out (vty
, " description %s%s", ifp
->desc
,VTY_NEWLINE
);
542 LIST_LOOP (isis
->area_list
, area
, node2
)
544 c
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
547 vty_out (vty
, " ip router isis %s%s",area
->area_tag
,VTY_NEWLINE
);
551 if (c
->ipv6_router
) {
552 vty_out (vty
, " ipv6 router isis %s%s",area
->area_tag
,VTY_NEWLINE
);
555 #endif /* HAVE_IPV6 */
556 /* ipv4 addresses - FIXME: those should be related to interface*/
557 if (c
->ip_addrs
) {LIST_LOOP (c
->ip_addrs
,ip
, node3
)
559 vty_out (vty
, " ip%s address %s/%d%s",
560 ip
->family
== AF_INET
? "" : "v6",
561 inet_ntop (ip
->family
, &ip
->prefix
, buf
, BUFSIZ
), ip
->prefixlen
,
566 /* ipv6 addresses - FIXME: those should be related to interface*/
568 if (c
->ipv6_link
) {LIST_LOOP (c
->ipv6_link
, ipv6
, node3
)
570 vty_out (vty
, " ip%s address %s/%d%s",
571 ipv6
->family
== AF_INET
? "" : "v6",
572 inet_ntop (ipv6
->family
, &ipv6
->prefix
, buf
, BUFSIZ
),
573 ipv6
->prefixlen
,VTY_NEWLINE
);
576 if (c
->ipv6_non_link
) {LIST_LOOP (c
->ipv6_non_link
, ipv6
, node3
)
578 vty_out (vty
, " ip%s address %s/%d%s",
579 ipv6
->family
== AF_INET
? "" : "v6",
580 inet_ntop (ipv6
->family
, &ipv6
->prefix
, buf
, BUFSIZ
),
581 ipv6
->prefixlen
, VTY_NEWLINE
);
584 #endif /* HAVE_IPV6 */
586 /* ISIS - circuit type */
587 if (c
->circuit_is_type
== IS_LEVEL_1
) {
588 vty_out (vty
, " isis circuit-type level-1%s", VTY_NEWLINE
);
590 } else {if (c
->circuit_is_type
== IS_LEVEL_2
) {
591 vty_out (vty
, " isis circuit-type level-2-only%s", VTY_NEWLINE
);
595 /* ISIS - CSNP interval - FIXME: compare to cisco*/
596 if (c
->csnp_interval
[0] == c
->csnp_interval
[1]) {
597 if (c
->csnp_interval
[0] != CSNP_INTERVAL
) {
598 vty_out (vty
, " isis csnp-interval %d%s", c
->csnp_interval
[0],
604 if (c
->csnp_interval
[1] != CSNP_INTERVAL
) {
605 vty_out (vty
, " isis csnp-interval %d level-%d%s",
606 c
->csnp_interval
[1],i
+1, VTY_NEWLINE
);
612 /* ISIS - Hello padding - Defaults to true so only display if false */
613 if (c
->circ_type
== CIRCUIT_T_BROADCAST
&& !c
->u
.bc
.pad_hellos
) {
614 vty_out (vty
, " no isis hello padding%s", VTY_NEWLINE
);
618 /* ISIS - Hello interval - FIXME: compare to cisco */
619 if (c
->hello_interval
[0] == c
->hello_interval
[1]) {
620 if (c
->hello_interval
[0] != HELLO_INTERVAL
) {
621 vty_out (vty
, " isis hello-interval %d%s", c
->hello_interval
[0],
627 if (c
->hello_interval
[i
] != HELLO_INTERVAL
) {
628 if (c
->hello_interval
[i
] == HELLO_MINIMAL
) {
629 vty_out (vty
, " isis hello-interval minimal level-%d%s", i
+1,
632 vty_out (vty
, " isis hello-interval %d level-%d%s",
633 c
->hello_interval
[i
],i
+1, VTY_NEWLINE
);
640 /* ISIS - Hello Multiplier */
641 if (c
->hello_multiplier
[0] == c
->hello_multiplier
[1]) {
642 if (c
->hello_multiplier
[0] != HELLO_MULTIPLIER
) {
643 vty_out (vty
, " isis hello-multiplier %d%s",
644 c
->hello_multiplier
[0], VTY_NEWLINE
);
649 if (c
->hello_multiplier
[i
] != HELLO_MULTIPLIER
) {
650 vty_out (vty
, " isis hello-multiplier %d level-%d%s",
651 c
->hello_multiplier
[i
],i
+1, VTY_NEWLINE
);
656 /* ISIS - Priority */
657 if (c
->circ_type
== CIRCUIT_T_BROADCAST
) {
658 if (c
->u
.bc
.priority
[0] == c
->u
.bc
.priority
[1]) {
659 if (c
->u
.bc
.priority
[0] != DEFAULT_PRIORITY
) {
660 vty_out (vty
, " isis priority %d%s", c
->u
.bc
.priority
[0],
666 if (c
->u
.bc
.priority
[i
] != DEFAULT_PRIORITY
) {
667 vty_out (vty
, " isis priority %d level-%d%s",
668 c
->u
.bc
.priority
[i
],i
+1, VTY_NEWLINE
);
675 if (c
->metrics
[0].metric_default
== c
->metrics
[1].metric_default
) {
676 if (c
->metrics
[0].metric_default
!= DEFAULT_CIRCUIT_METRICS
) {
677 vty_out (vty
, " isis metric %d%s", c
->metrics
[0].metric_default
,
683 if (c
->metrics
[i
].metric_default
!= DEFAULT_CIRCUIT_METRICS
) {
684 vty_out (vty
, " isis metric %d level-%d%s",
685 c
->metrics
[i
].metric_default
,i
+1, VTY_NEWLINE
);
699 DEFUN (ip_router_isis
,
701 "ip router isis WORD",
702 "Interface Internet Protocol config commands\n"
703 "IP router interface commands\n"
704 "IS-IS Routing for IP\n"
705 "Routing process tag\n"
708 struct isis_circuit
*c
;
709 struct interface
*ifp
;
710 struct isis_area
*area
;
712 ifp
= (struct interface
*)vty
->index
;
715 area
= isis_area_lookup (argv
[0]);
717 /* Prevent more than one circuit per interface */
719 c
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
721 if (c
&& (ifp
->info
!= NULL
)) {
723 if (c
->ipv6_router
== 0) {
724 #endif /* HAVE_IPV6 */
725 vty_out (vty
, "ISIS circuit is already defined%s", VTY_NEWLINE
);
729 #endif /* HAVE_IPV6 */
732 /* this is here for ciscopability */
734 vty_out (vty
, "Can't find ISIS instance %s", VTY_NEWLINE
);
739 c
= circuit_lookup_by_ifp (ifp
, isis
->init_circ_list
);
740 c
= isis_csm_state_change (ISIS_ENABLE
, c
, area
);
741 c
->interface
= ifp
; /* this is automatic */
742 ifp
->info
= c
; /* hardly related to the FSM */
750 circuit_update_nlpids (c
);
752 vty
->node
= INTERFACE_NODE
;
757 DEFUN (no_ip_router_isis
,
758 no_ip_router_isis_cmd
,
759 "no ip router isis WORD",
761 "Interface Internet Protocol config commands\n"
762 "IP router interface commands\n"
763 "IS-IS Routing for IP\n"
764 "Routing process tag\n"
767 struct isis_circuit
*circuit
= NULL
;
768 struct interface
*ifp
;
769 struct isis_area
*area
;
770 struct listnode
*node
;
772 ifp
= (struct interface
*)vty
->index
;
775 area
= isis_area_lookup (argv
[0]);
777 vty_out (vty
, "Can't find ISIS instance %s", VTY_NEWLINE
);
780 LIST_LOOP (area
->circuit_list
, circuit
, node
)
781 if (circuit
->interface
== ifp
)
784 vty_out (vty
, "Can't find ISIS interface %s", VTY_NEWLINE
);
787 circuit
->ip_router
= 0;
790 if (circuit
->ipv6_router
== 0)
792 isis_csm_state_change (ISIS_DISABLE
, circuit
, area
);
797 DEFUN (isis_circuit_type
,
798 isis_circuit_type_cmd
,
799 "isis circuit-type (level-1|level-1-2|level-2-only)",
801 "Configure circuit type for interface\n"
802 "Level-1 only adjacencies are formed\n"
803 "Level-1-2 adjacencies are formed\n"
804 "Level-2 only adjacencies are formed\n"
807 struct isis_circuit
*circuit
;
808 struct interface
*ifp
;
814 /* UGLY - will remove l8r */
815 if (circuit
== NULL
) {
821 circuit_t
= string2circuit_t (argv
[0]);
824 vty_out (vty
, "Unknown circuit-type %s", VTY_NEWLINE
);
828 is_type
= circuit
->area
->is_type
;
829 if (is_type
== IS_LEVEL_1_AND_2
|| is_type
== circuit_t
)
830 isis_event_circuit_type_change (circuit
, circuit_t
);
832 vty_out (vty
, "invalid circuit level for area %s.%s",
833 circuit
->area
->area_tag
, VTY_NEWLINE
);
839 DEFUN (no_isis_circuit_type
,
840 no_isis_circuit_type_cmd
,
841 "no isis circuit-type (level-1|level-1-2|level-2-only)",
844 "Configure circuit type for interface\n"
845 "Level-1 only adjacencies are formed\n"
846 "Level-1-2 adjacencies are formed\n"
847 "Level-2 only adjacencies are formed\n"
850 struct isis_circuit
*circuit
;
851 struct interface
*ifp
;
855 if (circuit
== NULL
) {
862 * Set the circuits level to its default value which is that of the area
864 isis_event_circuit_type_change (circuit
, circuit
->area
->is_type
);
871 "isis password WORD",
873 "Configure the authentication password for interface\n"
876 struct isis_circuit
*circuit
;
877 struct interface
*ifp
;
882 if (circuit
== NULL
) {
886 len
= strlen (argv
[0]);
888 vty_out (vty
, "Too long circuit password (>254)%s", VTY_NEWLINE
);
891 circuit
->passwd
.len
= len
;
892 circuit
->passwd
.type
= ISIS_PASSWD_TYPE_CLEARTXT
;
893 strncpy (circuit
->passwd
.passwd
, argv
[0], 255);
898 DEFUN (no_isis_passwd
,
903 "Configure the authentication password for interface\n")
905 struct isis_circuit
*circuit
;
906 struct interface
*ifp
;
910 if (circuit
== NULL
) {
914 memset (&circuit
->passwd
, 0, sizeof (struct isis_passwd
));
920 DEFUN (isis_priority
,
922 "isis priority <0-127>",
924 "Set priority for Designated Router election\n"
928 struct isis_circuit
*circuit
;
929 struct interface
*ifp
;
934 if (circuit
== NULL
) {
939 prio
= atoi (argv
[0]);
941 circuit
->u
.bc
.priority
[0] = prio
;
942 circuit
->u
.bc
.priority
[1] = prio
;
947 DEFUN (no_isis_priority
,
948 no_isis_priority_cmd
,
952 "Set priority for Designated Router election\n"
955 struct isis_circuit
*circuit
;
956 struct interface
*ifp
;
960 if (circuit
== NULL
) {
965 circuit
->u
.bc
.priority
[0] = DEFAULT_PRIORITY
;
966 circuit
->u
.bc
.priority
[1] = DEFAULT_PRIORITY
;
971 ALIAS (no_isis_priority
,
972 no_isis_priority_arg_cmd
,
973 "no isis priority <0-127>",
976 "Set priority for Designated Router election\n"
980 DEFUN (isis_priority_l1
,
981 isis_priority_l1_cmd
,
982 "isis priority <0-127> level-1",
984 "Set priority for Designated Router election\n"
986 "Specify priority for level-1 routing\n"
989 struct isis_circuit
*circuit
;
990 struct interface
*ifp
;
995 if (circuit
== NULL
) {
1000 prio
= atoi (argv
[0]);
1002 circuit
->u
.bc
.priority
[0] = prio
;
1007 DEFUN (no_isis_priority_l1
,
1008 no_isis_priority_l1_cmd
,
1009 "no isis priority level-1",
1012 "Set priority for Designated Router election\n"
1013 "Specify priority for level-1 routing\n"
1016 struct isis_circuit
*circuit
;
1017 struct interface
*ifp
;
1020 circuit
= ifp
->info
;
1021 if (circuit
== NULL
) {
1026 circuit
->u
.bc
.priority
[0] = DEFAULT_PRIORITY
;
1031 ALIAS (no_isis_priority_l1
,
1032 no_isis_priority_l1_arg_cmd
,
1033 "no isis priority <0-127> level-1",
1036 "Set priority for Designated Router election\n"
1038 "Specify priority for level-1 routing\n"
1041 DEFUN (isis_priority_l2
,
1042 isis_priority_l2_cmd
,
1043 "isis priority <0-127> level-2",
1045 "Set priority for Designated Router election\n"
1047 "Specify priority for level-2 routing\n"
1050 struct isis_circuit
*circuit
;
1051 struct interface
*ifp
;
1055 circuit
= ifp
->info
;
1056 if (circuit
== NULL
) {
1061 prio
= atoi (argv
[0]);
1063 circuit
->u
.bc
.priority
[1] = prio
;
1068 DEFUN (no_isis_priority_l2
,
1069 no_isis_priority_l2_cmd
,
1070 "no isis priority level-2",
1073 "Set priority for Designated Router election\n"
1074 "Specify priority for level-2 routing\n"
1077 struct isis_circuit
*circuit
;
1078 struct interface
*ifp
;
1081 circuit
= ifp
->info
;
1082 if (circuit
== NULL
) {
1087 circuit
->u
.bc
.priority
[1] = DEFAULT_PRIORITY
;
1092 ALIAS (no_isis_priority_l2
,
1093 no_isis_priority_l2_arg_cmd
,
1094 "no isis priority <0-127> level-2",
1097 "Set priority for Designated Router election\n"
1099 "Specify priority for level-2 routing\n"
1102 /* Metric command */
1106 "isis metric <0-63>",
1108 "Set default metric for circuit\n"
1109 "Default metric value\n"
1112 struct isis_circuit
*circuit
;
1113 struct interface
*ifp
;
1117 circuit
= ifp
->info
;
1118 if (circuit
== NULL
) {
1123 met
= atoi (argv
[0]);
1125 circuit
->metrics
[0].metric_default
= met
;
1126 circuit
->metrics
[1].metric_default
= met
;
1131 DEFUN (no_isis_metric
,
1136 "Set default metric for circuit\n"
1139 struct isis_circuit
*circuit
;
1140 struct interface
*ifp
;
1143 circuit
= ifp
->info
;
1144 if (circuit
== NULL
) {
1149 circuit
->metrics
[0].metric_default
= DEFAULT_CIRCUIT_METRICS
;
1150 circuit
->metrics
[1].metric_default
= DEFAULT_CIRCUIT_METRICS
;
1155 ALIAS (no_isis_metric
,
1156 no_isis_metric_arg_cmd
,
1157 "no isis metric <0-127>",
1160 "Set default metric for circuit\n"
1161 "Default metric value\n"
1163 /* end of metrics */
1166 DEFUN (isis_hello_interval
,
1167 isis_hello_interval_cmd
,
1168 "isis hello-interval (<1-65535>|minimal)",
1170 "Set Hello interval\n"
1171 "Hello interval value\n"
1172 "Holdtime 1 seconds, interval depends on multiplier\n"
1175 struct isis_circuit
*circuit
;
1176 struct interface
*ifp
;
1181 circuit
= ifp
->info
;
1182 if (circuit
== NULL
) {
1187 if (isdigit((int)c
)) {
1188 interval
= atoi (argv
[0]);
1190 interval
= HELLO_MINIMAL
; /* FIXME: should be calculated */
1192 circuit
->hello_interval
[0] = (u_int16_t
)interval
;
1193 circuit
->hello_interval
[1] = (u_int16_t
)interval
;
1198 DEFUN (no_isis_hello_interval
,
1199 no_isis_hello_interval_cmd
,
1200 "no isis hello-interval",
1203 "Set Hello interval\n"
1206 struct isis_circuit
*circuit
;
1207 struct interface
*ifp
;
1210 circuit
= ifp
->info
;
1211 if (circuit
== NULL
) {
1217 circuit
->hello_interval
[0] = HELLO_INTERVAL
; /* Default is 1 sec. */
1218 circuit
->hello_interval
[1] = HELLO_INTERVAL
;
1223 ALIAS (no_isis_hello_interval
,
1224 no_isis_hello_interval_arg_cmd
,
1225 "no isis hello-interval (<1-65535>|minimal)",
1228 "Set Hello interval\n"
1229 "Hello interval value\n"
1230 "Holdtime 1 second, interval depends on multiplier\n"
1233 DEFUN (isis_hello_interval_l1
,
1234 isis_hello_interval_l1_cmd
,
1235 "isis hello-interval (<1-65535>|minimal) level-1",
1237 "Set Hello interval\n"
1238 "Hello interval value\n"
1239 "Holdtime 1 second, interval depends on multiplier\n"
1240 "Specify hello-interval for level-1 IIHs\n"
1243 struct isis_circuit
*circuit
;
1244 struct interface
*ifp
;
1249 circuit
= ifp
->info
;
1250 if (circuit
== NULL
) {
1256 if (isdigit((int)c
)) {
1257 interval
= atoi (argv
[0]);
1259 interval
= HELLO_MINIMAL
;
1261 circuit
->hello_interval
[0] = (u_int16_t
)interval
;
1266 DEFUN (no_isis_hello_interval_l1
,
1267 no_isis_hello_interval_l1_cmd
,
1268 "no isis hello-interval level-1",
1271 "Set Hello interval\n"
1272 "Specify hello-interval for level-1 IIHs\n"
1275 struct isis_circuit
*circuit
;
1276 struct interface
*ifp
;
1279 circuit
= ifp
->info
;
1280 if (circuit
== NULL
) {
1286 circuit
->hello_interval
[0] = HELLO_INTERVAL
; /* Default is 1 sec. */
1291 ALIAS (no_isis_hello_interval_l1
,
1292 no_isis_hello_interval_l1_arg_cmd
,
1293 "no isis hello-interval (<1-65535>|minimal) level-1",
1296 "Set Hello interval\n"
1297 "Hello interval value\n"
1298 "Holdtime 1 second, interval depends on multiplier\n"
1299 "Specify hello-interval for level-1 IIHs\n"
1302 DEFUN (isis_hello_interval_l2
,
1303 isis_hello_interval_l2_cmd
,
1304 "isis hello-interval (<1-65535>|minimal) level-2",
1306 "Set Hello interval\n"
1307 "Hello interval value\n"
1308 "Holdtime 1 second, interval depends on multiplier\n"
1309 "Specify hello-interval for level-2 IIHs\n"
1312 struct isis_circuit
*circuit
;
1313 struct interface
*ifp
;
1318 circuit
= ifp
->info
;
1319 if (circuit
== NULL
) {
1325 if (isdigit((int)c
)) {
1326 interval
= atoi (argv
[0]);
1328 interval
= HELLO_MINIMAL
;
1330 circuit
->hello_interval
[1] = (u_int16_t
)interval
;
1335 DEFUN (no_isis_hello_interval_l2
,
1336 no_isis_hello_interval_l2_cmd
,
1337 "no isis hello-interval level-2",
1340 "Set Hello interval\n"
1341 "Specify hello-interval for level-2 IIHs\n"
1344 struct isis_circuit
*circuit
;
1345 struct interface
*ifp
;
1348 circuit
= ifp
->info
;
1349 if (circuit
== NULL
) {
1355 circuit
->hello_interval
[1] = HELLO_INTERVAL
; /* Default is 1 sec. */
1360 ALIAS (no_isis_hello_interval_l2
,
1361 no_isis_hello_interval_l2_arg_cmd
,
1362 "no isis hello-interval (<1-65535>|minimal) level-2",
1365 "Set Hello interval\n"
1366 "Hello interval value\n"
1367 "Holdtime 1 second, interval depends on multiplier\n"
1368 "Specify hello-interval for level-2 IIHs\n"
1372 DEFUN (isis_hello_multiplier
,
1373 isis_hello_multiplier_cmd
,
1374 "isis hello-multiplier <3-1000>",
1376 "Set multiplier for Hello holding time\n"
1377 "Hello multiplier value\n"
1380 struct isis_circuit
*circuit
;
1381 struct interface
*ifp
;
1385 circuit
= ifp
->info
;
1386 if (circuit
== NULL
) {
1391 mult
= atoi (argv
[0]);
1393 circuit
->hello_multiplier
[0] = (u_int16_t
)mult
;
1394 circuit
->hello_multiplier
[1] = (u_int16_t
)mult
;
1399 DEFUN (no_isis_hello_multiplier
,
1400 no_isis_hello_multiplier_cmd
,
1401 "no isis hello-multiplier",
1404 "Set multiplier for Hello holding time\n"
1407 struct isis_circuit
*circuit
;
1408 struct interface
*ifp
;
1411 circuit
= ifp
->info
;
1412 if (circuit
== NULL
) {
1417 circuit
->hello_multiplier
[0] = HELLO_MULTIPLIER
;
1418 circuit
->hello_multiplier
[1] = HELLO_MULTIPLIER
;
1423 ALIAS (no_isis_hello_multiplier
,
1424 no_isis_hello_multiplier_arg_cmd
,
1425 "no isis hello-multiplier <3-1000>",
1428 "Set multiplier for Hello holding time\n"
1429 "Hello multiplier value\n"
1432 DEFUN (isis_hello_multiplier_l1
,
1433 isis_hello_multiplier_l1_cmd
,
1434 "isis hello-multiplier <3-1000> level-1",
1436 "Set multiplier for Hello holding time\n"
1437 "Hello multiplier value\n"
1438 "Specify hello multiplier for level-1 IIHs\n"
1441 struct isis_circuit
*circuit
;
1442 struct interface
*ifp
;
1446 circuit
= ifp
->info
;
1447 if (circuit
== NULL
) {
1452 mult
= atoi (argv
[0]);
1454 circuit
->hello_multiplier
[0] = (u_int16_t
)mult
;
1459 DEFUN (no_isis_hello_multiplier_l1
,
1460 no_isis_hello_multiplier_l1_cmd
,
1461 "no isis hello-multiplier level-1",
1464 "Set multiplier for Hello holding time\n"
1465 "Specify hello multiplier for level-1 IIHs\n"
1468 struct isis_circuit
*circuit
;
1469 struct interface
*ifp
;
1472 circuit
= ifp
->info
;
1473 if (circuit
== NULL
) {
1478 circuit
->hello_multiplier
[0] = HELLO_MULTIPLIER
;
1483 ALIAS (no_isis_hello_multiplier_l1
,
1484 no_isis_hello_multiplier_l1_arg_cmd
,
1485 "no isis hello-multiplier <3-1000> level-1",
1488 "Set multiplier for Hello holding time\n"
1489 "Hello multiplier value\n"
1490 "Specify hello multiplier for level-1 IIHs\n"
1493 DEFUN (isis_hello_multiplier_l2
,
1494 isis_hello_multiplier_l2_cmd
,
1495 "isis hello-multiplier <3-1000> level-2",
1497 "Set multiplier for Hello holding time\n"
1498 "Hello multiplier value\n"
1499 "Specify hello multiplier for level-2 IIHs\n"
1502 struct isis_circuit
*circuit
;
1503 struct interface
*ifp
;
1507 circuit
= ifp
->info
;
1508 if (circuit
== NULL
) {
1513 mult
= atoi (argv
[0]);
1515 circuit
->hello_multiplier
[1] = (u_int16_t
)mult
;
1520 DEFUN (no_isis_hello_multiplier_l2
,
1521 no_isis_hello_multiplier_l2_cmd
,
1522 "no isis hello-multiplier level-2",
1525 "Set multiplier for Hello holding time\n"
1526 "Specify hello multiplier for level-2 IIHs\n"
1529 struct isis_circuit
*circuit
;
1530 struct interface
*ifp
;
1533 circuit
= ifp
->info
;
1534 if (circuit
== NULL
) {
1539 circuit
->hello_multiplier
[1] = HELLO_MULTIPLIER
;
1544 ALIAS (no_isis_hello_multiplier_l2
,
1545 no_isis_hello_multiplier_l2_arg_cmd
,
1546 "no isis hello-multiplier <3-1000> level-2",
1549 "Set multiplier for Hello holding time\n"
1550 "Hello multiplier value\n"
1551 "Specify hello multiplier for level-2 IIHs\n"
1556 "isis hello padding",
1558 "Add padding to IS-IS hello packets\n"
1559 "Pad hello packets\n"
1562 struct interface
*ifp
;
1563 struct isis_circuit
*circuit
;
1566 circuit
= ifp
->info
;
1567 if (circuit
== NULL
) {
1572 circuit
->u
.bc
.pad_hellos
= 1;
1579 "ip address A.B.C.D/A",
1580 "Interface Internet Protocol config commands\n"
1581 "Set the IP address of an interface\n"
1582 "IP address (e.g. 10.0.0.1/8\n")
1585 struct interface
*ifp
;
1586 struct isis_circuit
*circuit
;
1587 struct prefix_ipv4
*ipv4
, *ip
;
1588 struct listnode
*node
;
1592 circuit
= ifp
->info
;
1593 if (circuit
== NULL
) {
1599 zlog_info ("ip_address_cmd circuit %d", circuit
->interface
->ifindex
);
1600 #endif /* HAVE_IPV6 */
1602 ipv4
= prefix_ipv4_new ();
1604 ret
= str2prefix_ipv4 (argv
[0], ipv4
);
1606 zlog_warn ("ip_address_cmd(): malformed address");
1607 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
1611 if (!circuit
->ip_addrs
)
1612 circuit
->ip_addrs
= list_new ();
1614 for (node
= listhead (circuit
->ip_addrs
); node
; nextnode (node
)) {
1615 ip
= getdata (node
);
1616 if (prefix_same ((struct prefix
*)ip
, (struct prefix
*)ipv4
))
1620 prefix_ipv4_free (ipv4
);
1626 listnode_add (circuit
->ip_addrs
, ipv4
);
1627 #ifdef EXTREME_DEBUG
1628 zlog_info ("added IP address %s to circuit %d", argv
[0],
1629 circuit
->interface
->ifindex
);
1630 #endif /* EXTREME_DEBUG */
1634 DEFUN (no_ip_address
,
1636 "no ip address A.B.C.D/A",
1638 "Interface Internet Protocol config commands\n"
1639 "Set the IP address of an interface\n"
1640 "IP address (e.g. 10.0.0.1/8\n")
1642 struct interface
*ifp
;
1643 struct isis_circuit
*circuit
;
1644 struct prefix_ipv4 ipv4
, *ip
= NULL
;
1645 struct listnode
*node
;
1649 circuit
= ifp
->info
;
1650 /* UGLY - will remove l8r */
1651 if (circuit
== NULL
) {
1656 if (!circuit
->ip_addrs
|| circuit
->ip_addrs
->count
== 0) {
1657 vty_out (vty
, "Invalid address %s", VTY_NEWLINE
);
1660 ret
= str2prefix_ipv4 (argv
[0], &ipv4
);
1662 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
1666 for (node
= listhead (circuit
->ip_addrs
); node
; nextnode (node
)) {
1667 ip
= getdata (node
);
1668 if (prefix_same ((struct prefix
*)ip
, (struct prefix
*)&ipv4
))
1673 listnode_delete (circuit
->ip_addrs
, ip
);
1675 vty_out (vty
, "Invalid address %s", VTY_NEWLINE
);
1681 DEFUN (no_isis_hello
,
1683 "no isis hello padding",
1686 "Add padding to IS-IS hello packets\n"
1687 "Pad hello packets\n"
1690 struct isis_circuit
*circuit
;
1691 struct interface
*ifp
;
1694 circuit
= ifp
->info
;
1695 if (circuit
== NULL
) {
1700 circuit
->u
.bc
.pad_hellos
= 0;
1705 DEFUN (csnp_interval
,
1707 "isis csnp-interval <0-65535>",
1709 "Set CSNP interval in seconds\n"
1710 "CSNP interval value\n")
1712 struct isis_circuit
*circuit
;
1713 struct interface
*ifp
;
1714 unsigned long interval
;
1717 circuit
= ifp
->info
;
1718 if (circuit
== NULL
) {
1723 interval
= atol (argv
[0]);
1725 circuit
->csnp_interval
[0] = (u_int16_t
)interval
;
1726 circuit
->csnp_interval
[1] = (u_int16_t
)interval
;
1731 DEFUN (no_csnp_interval
,
1732 no_csnp_interval_cmd
,
1733 "no isis csnp-interval",
1736 "Set CSNP interval in seconds\n"
1739 struct isis_circuit
*circuit
;
1740 struct interface
*ifp
;
1743 circuit
= ifp
->info
;
1744 if (circuit
== NULL
) {
1749 circuit
->csnp_interval
[0] = CSNP_INTERVAL
;
1750 circuit
->csnp_interval
[1] = CSNP_INTERVAL
;
1755 ALIAS (no_csnp_interval
,
1756 no_csnp_interval_arg_cmd
,
1757 "no isis csnp-interval <0-65535>",
1760 "Set CSNP interval in seconds\n"
1761 "CSNP interval value\n")
1764 DEFUN (csnp_interval_l1
,
1765 csnp_interval_l1_cmd
,
1766 "isis csnp-interval <0-65535> level-1",
1768 "Set CSNP interval in seconds\n"
1769 "CSNP interval value\n"
1770 "Specify interval for level-1 CSNPs\n")
1772 struct isis_circuit
*circuit
;
1773 struct interface
*ifp
;
1774 unsigned long interval
;
1777 circuit
= ifp
->info
;
1778 if (circuit
== NULL
) {
1783 interval
= atol (argv
[0]);
1785 circuit
->csnp_interval
[0] = (u_int16_t
)interval
;
1790 DEFUN (no_csnp_interval_l1
,
1791 no_csnp_interval_l1_cmd
,
1792 "no isis csnp-interval level-1",
1795 "Set CSNP interval in seconds\n"
1796 "Specify interval for level-1 CSNPs\n")
1798 struct isis_circuit
*circuit
;
1799 struct interface
*ifp
;
1802 circuit
= ifp
->info
;
1803 if (circuit
== NULL
) {
1808 circuit
->csnp_interval
[0] = CSNP_INTERVAL
;
1813 ALIAS (no_csnp_interval_l1
,
1814 no_csnp_interval_l1_arg_cmd
,
1815 "no isis csnp-interval <0-65535> level-1",
1818 "Set CSNP interval in seconds\n"
1819 "CSNP interval value\n"
1820 "Specify interval for level-1 CSNPs\n")
1823 DEFUN (csnp_interval_l2
,
1824 csnp_interval_l2_cmd
,
1825 "isis csnp-interval <0-65535> level-2",
1827 "Set CSNP interval in seconds\n"
1828 "CSNP interval value\n"
1829 "Specify interval for level-2 CSNPs\n")
1831 struct isis_circuit
*circuit
;
1832 struct interface
*ifp
;
1833 unsigned long interval
;
1836 circuit
= ifp
->info
;
1837 if (circuit
== NULL
) {
1842 interval
= atol (argv
[0]);
1844 circuit
->csnp_interval
[1] = (u_int16_t
)interval
;
1849 DEFUN (no_csnp_interval_l2
,
1850 no_csnp_interval_l2_cmd
,
1851 "no isis csnp-interval level-2",
1854 "Set CSNP interval in seconds\n"
1855 "Specify interval for level-2 CSNPs\n")
1857 struct isis_circuit
*circuit
;
1858 struct interface
*ifp
;
1861 circuit
= ifp
->info
;
1862 if (circuit
== NULL
) {
1867 circuit
->csnp_interval
[1] = CSNP_INTERVAL
;
1872 ALIAS (no_csnp_interval_l2
,
1873 no_csnp_interval_l2_arg_cmd
,
1874 "no isis csnp-interval <0-65535> level-2",
1877 "Set CSNP interval in seconds\n"
1878 "CSNP interval value\n"
1879 "Specify interval for level-2 CSNPs\n")
1883 DEFUN (ipv6_router_isis
,
1884 ipv6_router_isis_cmd
,
1885 "ipv6 router isis WORD",
1886 "IPv6 interface subcommands\n"
1887 "IPv6 Router interface commands\n"
1888 "IS-IS Routing for IPv6\n"
1889 "Routing process tag\n")
1891 struct isis_circuit
*c
;
1892 struct interface
*ifp
;
1893 struct isis_area
*area
;
1895 ifp
= (struct interface
*)vty
->index
;
1898 area
= isis_area_lookup (argv
[0]);
1900 /* Prevent more than one circuit per interface */
1902 c
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
1905 if (c
&& (ifp
->info
!= NULL
)) {
1906 if (c
->ipv6_router
== 1) {
1907 vty_out (vty
, "ISIS circuit is already defined for IPv6%s", VTY_NEWLINE
);
1912 /* this is here for ciscopability */
1914 vty_out (vty
, "Can't find ISIS instance %s", VTY_NEWLINE
);
1919 c
= circuit_lookup_by_ifp (ifp
, isis
->init_circ_list
);
1920 c
= isis_csm_state_change (ISIS_ENABLE
, c
, area
);
1929 area
->ipv6_circuits
++;
1930 circuit_update_nlpids (c
);
1932 vty
->node
= INTERFACE_NODE
;
1937 DEFUN (no_ipv6_router_isis
,
1938 no_ipv6_router_isis_cmd
,
1939 "no ipv6 router isis WORD",
1941 "IPv6 interface subcommands\n"
1942 "IPv6 Router interface commands\n"
1943 "IS-IS Routing for IPv6\n"
1944 "Routing process tag\n")
1946 struct isis_circuit
*c
;
1947 struct interface
*ifp
;
1948 struct isis_area
*area
;
1950 ifp
= (struct interface
*)vty
->index
;
1951 /* UGLY - will remove l8r
1952 if (circuit == NULL) {
1957 area
= isis_area_lookup (argv
[0]);
1959 vty_out (vty
, "Can't find ISIS instance %s", VTY_NEWLINE
);
1963 c
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
1968 area
->ipv6_circuits
--;
1969 if (c
->ip_router
== 0)
1970 isis_csm_state_change (ISIS_DISABLE
, c
, area
);
1975 #if 0 /* Guess we don't really need these */
1977 DEFUN (ipv6_address
,
1979 "ipv6 address X:X::X:X/M",
1980 "Interface Internet Protocol config commands\n"
1981 "Set the IP address of an interface\n"
1982 "IPv6 address (e.g. 3ffe:506::1/48)\n")
1984 struct interface
*ifp
;
1985 struct isis_circuit
*circuit
;
1986 struct prefix_ipv6
*ipv6
, *ip6
;
1987 struct listnode
*node
;
1991 circuit
= ifp
->info
;
1992 /* UGLY - will remove l8r */
1993 if (circuit
== NULL
) {
1997 #ifdef EXTREME_DEBUG
1998 zlog_info ("ipv6_address_cmd circuit %d", circuit
->idx
);
1999 #endif /* EXTREME_DEBUG */
2001 if (circuit
== NULL
) {
2002 zlog_warn ("ipv6_address_cmd(): no circuit");
2007 ipv6
= prefix_ipv6_new ();
2009 ret
= str2prefix_ipv6 (argv
[0], ipv6
);
2011 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2015 if (!circuit
->ipv6_addrs
)
2016 circuit
->ipv6_addrs
= list_new ();
2018 for (node
= listhead (circuit
->ipv6_addrs
); node
; nextnode (node
)) {
2019 ip6
= getdata (node
);
2020 if (prefix_same ((struct prefix
*)ip6
, (struct prefix
*)ipv6
))
2024 prefix_ipv6_free (ipv6
);
2030 listnode_add (circuit
->ipv6_addrs
, ipv6
);
2031 #ifdef EXTREME_DEBUG
2032 zlog_info ("added IPv6 address %s to circuit %d", argv
[0], circuit
->idx
);
2033 #endif /* EXTREME_DEBUG */
2038 DEFUN (no_ipv6_address
,
2039 no_ipv6_address_cmd
,
2040 "no ipv6 address X:X::X:X/M",
2042 "Interface Internet Protocol config commands\n"
2043 "Set the IP address of an interface\n"
2044 "IPv6 address (e.g. 3ffe:506::1/48)\n")
2046 struct interface
*ifp
;
2047 struct isis_circuit
*circuit
;
2048 struct prefix_ipv6 ipv6
, *ip6
= NULL
;
2049 struct listnode
*node
;
2053 circuit
= ifp
->info
;
2054 /* UGLY - will remove l8r */
2055 if (circuit
== NULL
) {
2060 if (!circuit
->ipv6_addrs
|| circuit
->ipv6_addrs
->count
== 0) {
2061 vty_out (vty
, "Invalid address %s", VTY_NEWLINE
);
2064 ret
= str2prefix_ipv6 (argv
[0], &ipv6
);
2066 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2070 for (node
= listhead (circuit
->ipv6_addrs
); node
; nextnode (node
)) {
2071 ip6
= getdata (node
);
2072 if (prefix_same ((struct prefix
*)ip6
, (struct prefix
*)&ipv6
))
2077 listnode_delete (circuit
->ipv6_addrs
, ip6
);
2079 vty_out (vty
, "Invalid address %s", VTY_NEWLINE
);
2085 #endif /* HAVE_IPV6 */
2088 struct cmd_node interface_node
=
2097 isis_if_new_hook (struct interface
*ifp
)
2099 /* FIXME: Discuss if the circuit should be created here
2100 ifp->info = XMALLOC (MTYPE_ISIS_IF_INFO, sizeof (struct isis_if_info)); */
2106 isis_if_delete_hook (struct interface
*ifp
)
2108 /* FIXME: Discuss if the circuit should be created here
2109 XFREE (MTYPE_ISIS_IF_INFO, ifp->info);*/
2116 isis_circuit_init ()
2119 /* Initialize Zebra interface data structure */
2121 if_add_hook (IF_NEW_HOOK
, isis_if_new_hook
);
2122 if_add_hook (IF_DELETE_HOOK
, isis_if_delete_hook
);
2124 /* Install interface node */
2125 install_node (&interface_node
, isis_interface_config_write
);
2126 install_element (CONFIG_NODE
, &interface_cmd
);
2128 install_default (INTERFACE_NODE
);
2129 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
2130 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
2132 install_element (INTERFACE_NODE
, &ip_router_isis_cmd
);
2133 install_element (INTERFACE_NODE
, &no_ip_router_isis_cmd
);
2135 install_element (INTERFACE_NODE
, &isis_circuit_type_cmd
);
2136 install_element (INTERFACE_NODE
, &no_isis_circuit_type_cmd
);
2138 install_element (INTERFACE_NODE
, &isis_passwd_cmd
);
2139 install_element (INTERFACE_NODE
, &no_isis_passwd_cmd
);
2141 install_element (INTERFACE_NODE
, &isis_priority_cmd
);
2142 install_element (INTERFACE_NODE
, &no_isis_priority_cmd
);
2143 install_element (INTERFACE_NODE
, &no_isis_priority_arg_cmd
);
2144 install_element (INTERFACE_NODE
, &isis_priority_l1_cmd
);
2145 install_element (INTERFACE_NODE
, &no_isis_priority_l1_cmd
);
2146 install_element (INTERFACE_NODE
, &no_isis_priority_l1_arg_cmd
);
2147 install_element (INTERFACE_NODE
, &isis_priority_l2_cmd
);
2148 install_element (INTERFACE_NODE
, &no_isis_priority_l2_cmd
);
2149 install_element (INTERFACE_NODE
, &no_isis_priority_l2_arg_cmd
);
2151 install_element (INTERFACE_NODE
, &isis_metric_cmd
);
2152 install_element (INTERFACE_NODE
, &no_isis_metric_cmd
);
2153 install_element (INTERFACE_NODE
, &no_isis_metric_arg_cmd
);
2155 install_element (INTERFACE_NODE
, &isis_hello_interval_cmd
);
2156 install_element (INTERFACE_NODE
, &no_isis_hello_interval_cmd
);
2157 install_element (INTERFACE_NODE
, &no_isis_hello_interval_arg_cmd
);
2158 install_element (INTERFACE_NODE
, &isis_hello_interval_l1_cmd
);
2159 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l1_cmd
);
2160 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l1_arg_cmd
);
2161 install_element (INTERFACE_NODE
, &isis_hello_interval_l2_cmd
);
2162 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l2_cmd
);
2163 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l2_arg_cmd
);
2165 install_element (INTERFACE_NODE
, &isis_hello_multiplier_cmd
);
2166 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_cmd
);
2167 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_arg_cmd
);
2168 install_element (INTERFACE_NODE
, &isis_hello_multiplier_l1_cmd
);
2169 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l1_cmd
);
2170 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l1_arg_cmd
);
2171 install_element (INTERFACE_NODE
, &isis_hello_multiplier_l2_cmd
);
2172 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l2_cmd
);
2173 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l2_arg_cmd
);
2175 install_element (INTERFACE_NODE
, &isis_hello_cmd
);
2176 install_element (INTERFACE_NODE
, &no_isis_hello_cmd
);
2178 install_element (INTERFACE_NODE
, &ip_address_cmd
);
2179 install_element (INTERFACE_NODE
, &no_ip_address_cmd
);
2181 install_element (INTERFACE_NODE
, &csnp_interval_cmd
);
2182 install_element (INTERFACE_NODE
, &no_csnp_interval_cmd
);
2183 install_element (INTERFACE_NODE
, &no_csnp_interval_arg_cmd
);
2184 install_element (INTERFACE_NODE
, &csnp_interval_l1_cmd
);
2185 install_element (INTERFACE_NODE
, &no_csnp_interval_l1_cmd
);
2186 install_element (INTERFACE_NODE
, &no_csnp_interval_l1_arg_cmd
);
2187 install_element (INTERFACE_NODE
, &csnp_interval_l2_cmd
);
2188 install_element (INTERFACE_NODE
, &no_csnp_interval_l2_cmd
);
2189 install_element (INTERFACE_NODE
, &no_csnp_interval_l2_arg_cmd
);
2192 install_element (INTERFACE_NODE
, &ipv6_router_isis_cmd
);
2193 install_element (INTERFACE_NODE
, &no_ipv6_router_isis_cmd
);
2195 install_element (INTERFACE_NODE
, &ipv6_address_cmd
);
2196 install_element (INTERFACE_NODE
, &no_ipv6_address_cmd
);