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.
24 #include <net/ethernet.h>
26 #include <netinet/if_ether.h>
29 #ifndef ETHER_ADDR_LEN
30 #define ETHER_ADDR_LEN ETHERADDRL
43 #include "isisd/dict.h"
44 #include "isisd/include-netbsd/iso.h"
45 #include "isisd/isis_constants.h"
46 #include "isisd/isis_common.h"
47 #include "isisd/isis_circuit.h"
48 #include "isisd/isis_tlv.h"
49 #include "isisd/isis_lsp.h"
50 #include "isisd/isis_pdu.h"
51 #include "isisd/isis_network.h"
52 #include "isisd/isis_misc.h"
53 #include "isisd/isis_constants.h"
54 #include "isisd/isis_adjacency.h"
55 #include "isisd/isis_dr.h"
56 #include "isisd/isis_flags.h"
57 #include "isisd/isisd.h"
58 #include "isisd/isis_csm.h"
59 #include "isisd/isis_events.h"
61 extern struct thread_master
*master
;
62 extern struct isis
*isis
;
67 void isis_circuit_down(struct isis_circuit
*);
68 int isis_interface_config_write(struct vty
*);
69 int isis_if_new_hook(struct interface
*);
70 int isis_if_delete_hook(struct interface
*);
75 struct isis_circuit
*circuit
;
78 circuit
= XCALLOC (MTYPE_ISIS_CIRCUIT
, sizeof (struct isis_circuit
));
81 /* set default metrics for circuit */
82 for (i
= 0; i
< 2; i
++)
84 circuit
->metrics
[i
].metric_default
= DEFAULT_CIRCUIT_METRICS
;
85 circuit
->metrics
[i
].metric_expense
= METRICS_UNSUPPORTED
;
86 circuit
->metrics
[i
].metric_error
= METRICS_UNSUPPORTED
;
87 circuit
->metrics
[i
].metric_delay
= METRICS_UNSUPPORTED
;
88 circuit
->te_metric
[i
] = DEFAULT_CIRCUIT_METRICS
;
93 zlog_err ("Can't malloc isis circuit");
101 isis_circuit_configure (struct isis_circuit
*circuit
, struct isis_area
*area
)
104 circuit
->area
= area
;
106 * The level for the circuit is same as for the area, unless configured
109 circuit
->circuit_is_type
= area
->is_type
;
113 for (i
= 0; i
< 2; i
++)
115 circuit
->hello_interval
[i
] = HELLO_INTERVAL
;
116 circuit
->hello_multiplier
[i
] = HELLO_MULTIPLIER
;
117 circuit
->csnp_interval
[i
] = CSNP_INTERVAL
;
118 circuit
->psnp_interval
[i
] = PSNP_INTERVAL
;
119 circuit
->u
.bc
.priority
[i
] = DEFAULT_PRIORITY
;
121 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
)
123 circuit
->u
.bc
.adjdb
[0] = list_new ();
124 circuit
->u
.bc
.adjdb
[1] = list_new ();
125 circuit
->u
.bc
.pad_hellos
= 1;
127 circuit
->lsp_interval
= LSP_INTERVAL
;
130 * Add the circuit into area
132 listnode_add (area
->circuit_list
, circuit
);
134 circuit
->idx
= flags_get_index (&area
->flags
);
135 circuit
->lsp_queue
= list_new ();
141 isis_circuit_deconfigure (struct isis_circuit
*circuit
,
142 struct isis_area
*area
)
145 /* destroy adjacencies */
146 if (circuit
->u
.bc
.adjdb
[0])
147 isis_adjdb_iterate (circuit
->u
.bc
.adjdb
[0], (void(*) (struct isis_adjacency
*, void *)) isis_delete_adj
, circuit
->u
.bc
.adjdb
[0]);
148 if (circuit
->u
.bc
.adjdb
[1])
149 isis_adjdb_iterate (circuit
->u
.bc
.adjdb
[1], (void(*) (struct isis_adjacency
*, void *)) isis_delete_adj
, circuit
->u
.bc
.adjdb
[1]);
150 /* Remove circuit from area */
151 listnode_delete (area
->circuit_list
, circuit
);
152 /* Free the index of SRM and SSN flags */
153 flags_free_index (&area
->flags
, circuit
->idx
);
158 struct isis_circuit
*
159 circuit_lookup_by_ifp (struct interface
*ifp
, struct list
*list
)
161 struct isis_circuit
*circuit
= NULL
;
162 struct listnode
*node
;
167 for (ALL_LIST_ELEMENTS_RO (list
, node
, circuit
))
168 if (circuit
->interface
== ifp
)
174 struct isis_circuit
*
175 circuit_scan_by_ifp (struct interface
*ifp
)
177 struct isis_area
*area
;
178 struct listnode
*node
;
179 struct isis_circuit
*circuit
;
181 if (!isis
->area_list
)
184 for (ALL_LIST_ELEMENTS_RO (isis
->area_list
, node
, area
))
186 circuit
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
191 return circuit_lookup_by_ifp (ifp
, isis
->init_circ_list
);
195 isis_circuit_del (struct isis_circuit
*circuit
)
201 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
)
203 /* destroy adjacency databases */
204 if (circuit
->u
.bc
.adjdb
[0])
205 list_delete (circuit
->u
.bc
.adjdb
[0]);
206 if (circuit
->u
.bc
.adjdb
[1])
207 list_delete (circuit
->u
.bc
.adjdb
[1]);
208 /* destroy neighbour lists */
209 if (circuit
->u
.bc
.lan_neighs
[0])
210 list_delete (circuit
->u
.bc
.lan_neighs
[0]);
211 if (circuit
->u
.bc
.lan_neighs
[1])
212 list_delete (circuit
->u
.bc
.lan_neighs
[1]);
213 /* destroy addresses */
215 if (circuit
->ip_addrs
)
216 list_delete (circuit
->ip_addrs
);
218 if (circuit
->ipv6_link
)
219 list_delete (circuit
->ipv6_link
);
220 if (circuit
->ipv6_non_link
)
221 list_delete (circuit
->ipv6_non_link
);
222 #endif /* HAVE_IPV6 */
224 /* and lastly the circuit itself */
225 XFREE (MTYPE_ISIS_CIRCUIT
, circuit
);
231 isis_circuit_add_addr (struct isis_circuit
*circuit
,
232 struct connected
*connected
)
234 struct prefix_ipv4
*ipv4
;
237 struct prefix_ipv6
*ipv6
;
238 #endif /* HAVE_IPV6 */
240 if (!circuit
->ip_addrs
)
241 circuit
->ip_addrs
= list_new ();
243 if (!circuit
->ipv6_link
)
244 circuit
->ipv6_link
= list_new ();
245 if (!circuit
->ipv6_non_link
)
246 circuit
->ipv6_non_link
= list_new ();
247 #endif /* HAVE_IPV6 */
249 memset (&buf
, 0, BUFSIZ
);
250 if (connected
->address
->family
== AF_INET
)
252 ipv4
= prefix_ipv4_new ();
253 ipv4
->prefixlen
= connected
->address
->prefixlen
;
254 ipv4
->prefix
= connected
->address
->u
.prefix4
;
255 listnode_add (circuit
->ip_addrs
, ipv4
);
257 lsp_regenerate_schedule (circuit
->area
);
260 prefix2str (connected
->address
, buf
, BUFSIZ
);
261 zlog_debug ("Added IP address %s to circuit %d", buf
,
262 circuit
->circuit_id
);
263 #endif /* EXTREME_DEBUG */
266 if (connected
->address
->family
== AF_INET6
)
268 ipv6
= prefix_ipv6_new ();
269 ipv6
->prefixlen
= connected
->address
->prefixlen
;
270 ipv6
->prefix
= connected
->address
->u
.prefix6
;
272 if (IN6_IS_ADDR_LINKLOCAL (&ipv6
->prefix
))
273 listnode_add (circuit
->ipv6_link
, ipv6
);
275 listnode_add (circuit
->ipv6_non_link
, ipv6
);
277 lsp_regenerate_schedule (circuit
->area
);
280 prefix2str (connected
->address
, buf
, BUFSIZ
);
281 zlog_debug ("Added IPv6 address %s to circuit %d", buf
,
282 circuit
->circuit_id
);
283 #endif /* EXTREME_DEBUG */
285 #endif /* HAVE_IPV6 */
290 isis_circuit_del_addr (struct isis_circuit
*circuit
,
291 struct connected
*connected
)
293 struct prefix_ipv4
*ipv4
, *ip
= NULL
;
294 struct listnode
*node
;
297 struct prefix_ipv6
*ipv6
, *ip6
= NULL
;
299 #endif /* HAVE_IPV6 */
301 memset (&buf
, 0, BUFSIZ
);
302 if (connected
->address
->family
== AF_INET
)
304 ipv4
= prefix_ipv4_new ();
305 ipv4
->prefixlen
= connected
->address
->prefixlen
;
306 ipv4
->prefix
= connected
->address
->u
.prefix4
;
308 for (ALL_LIST_ELEMENTS_RO (circuit
->ip_addrs
, node
, ip
))
309 if (prefix_same ((struct prefix
*) ip
, (struct prefix
*) &ipv4
))
314 listnode_delete (circuit
->ip_addrs
, ip
);
316 lsp_regenerate_schedule (circuit
->area
);
320 prefix2str (connected
->address
, (char *)buf
, BUFSIZ
);
321 zlog_warn("Nonexitant ip address %s removal attempt from circuit \
322 %d", buf
, circuit
->circuit_id
);
326 if (connected
->address
->family
== AF_INET6
)
328 ipv6
= prefix_ipv6_new ();
329 ipv6
->prefixlen
= connected
->address
->prefixlen
;
330 ipv6
->prefix
= connected
->address
->u
.prefix6
;
332 if (IN6_IS_ADDR_LINKLOCAL (&ipv6
->prefix
))
334 for (ALL_LIST_ELEMENTS_RO (circuit
->ipv6_link
, node
, ip6
))
336 if (prefix_same ((struct prefix
*) ip6
, (struct prefix
*) ipv6
))
341 listnode_delete (circuit
->ipv6_link
, ip6
);
347 for (ALL_LIST_ELEMENTS_RO (circuit
->ipv6_non_link
, node
, ip6
))
349 if (prefix_same ((struct prefix
*) ip6
, (struct prefix
*) ipv6
))
354 listnode_delete (circuit
->ipv6_non_link
, ip6
);
361 prefix2str (connected
->address
, (char *)buf
, BUFSIZ
);
362 zlog_warn("Nonexitant ip address %s removal attempt from \
363 circuit %d", buf
, circuit
->circuit_id
);
367 lsp_regenerate_schedule (circuit
->area
);
369 #endif /* HAVE_IPV6 */
374 isis_circuit_if_add (struct isis_circuit
*circuit
, struct interface
*ifp
)
376 struct listnode
*node
, *nnode
;
377 struct connected
*conn
;
379 circuit
->interface
= ifp
;
382 circuit
->circuit_id
= ifp
->ifindex
% 255; /* FIXME: Why not ? */
384 /* isis_circuit_update_addrs (circuit, ifp); */
386 if (if_is_broadcast (ifp
))
388 circuit
->circ_type
= CIRCUIT_T_BROADCAST
;
390 * Get the Hardware Address
392 #ifdef HAVE_STRUCT_SOCKADDR_DL
394 if (circuit
->interface
->sdl
.sdl_alen
!= ETHER_ADDR_LEN
)
395 zlog_warn ("unsupported link layer");
397 memcpy (circuit
->u
.bc
.snpa
, LLADDR (&circuit
->interface
->sdl
),
401 if (circuit
->interface
->hw_addr_len
!= ETH_ALEN
)
403 zlog_warn ("unsupported link layer");
407 memcpy (circuit
->u
.bc
.snpa
, circuit
->interface
->hw_addr
, ETH_ALEN
);
410 zlog_debug ("isis_circuit_if_add: if_id %d, isomtu %d snpa %s",
411 circuit
->interface
->ifindex
, ISO_MTU (circuit
),
412 snpa_print (circuit
->u
.bc
.snpa
));
414 #endif /* EXTREME_DEBUG */
415 #endif /* HAVE_STRUCT_SOCKADDR_DL */
417 else if (if_is_pointopoint (ifp
))
419 circuit
->circ_type
= CIRCUIT_T_P2P
;
423 /* It's normal in case of loopback etc. */
424 if (isis
->debugs
& DEBUG_EVENTS
)
425 zlog_debug ("isis_circuit_if_add: unsupported media");
428 for (ALL_LIST_ELEMENTS (ifp
->connected
, node
, nnode
, conn
))
429 isis_circuit_add_addr (circuit
, conn
);
435 isis_circuit_update_params (struct isis_circuit
*circuit
,
436 struct interface
*ifp
)
440 if (circuit
->circuit_id
!= ifp
->ifindex
)
442 zlog_warn ("changing circuit_id %d->%d", circuit
->circuit_id
,
444 circuit
->circuit_id
= ifp
->ifindex
% 255;
447 /* FIXME: Why is this needed? shouldn't we compare to the area's mtu */
448 /* Ofer, this was here in case someone changes the mtu (e.g. with ifconfig)
449 The areas MTU is the minimum of mtu's of circuits in the area
450 now we can't catch the change
451 if (circuit->mtu != ifp->mtu) {
452 zlog_warn ("changing circuit mtu %d->%d", circuit->mtu,
454 circuit->mtu = ifp->mtu;
458 * Get the Hardware Address
460 #ifdef HAVE_STRUCT_SOCKADDR_DL
462 if (circuit
->interface
->sdl
.sdl_alen
!= ETHER_ADDR_LEN
)
463 zlog_warn ("unsupported link layer");
465 memcpy (circuit
->u
.bc
.snpa
, LLADDR (&circuit
->interface
->sdl
), ETH_ALEN
);
468 if (circuit
->interface
->hw_addr_len
!= ETH_ALEN
)
470 zlog_warn ("unsupported link layer");
474 if (memcmp (circuit
->u
.bc
.snpa
, circuit
->interface
->hw_addr
, ETH_ALEN
))
476 zlog_warn ("changing circuit snpa %s->%s",
477 snpa_print (circuit
->u
.bc
.snpa
),
478 snpa_print (circuit
->interface
->hw_addr
));
483 if (if_is_broadcast (ifp
))
485 circuit
->circ_type
= CIRCUIT_T_BROADCAST
;
487 else if (if_is_pointopoint (ifp
))
489 circuit
->circ_type
= CIRCUIT_T_P2P
;
493 zlog_warn ("isis_circuit_update_params: unsupported media");
500 isis_circuit_if_del (struct isis_circuit
*circuit
)
502 circuit
->interface
->info
= NULL
;
503 circuit
->interface
= NULL
;
509 isis_circuit_up (struct isis_circuit
*circuit
)
512 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
)
514 if (circuit
->area
->min_bcast_mtu
== 0 ||
515 ISO_MTU (circuit
) < circuit
->area
->min_bcast_mtu
)
516 circuit
->area
->min_bcast_mtu
= ISO_MTU (circuit
);
518 * ISO 10589 - 8.4.1 Enabling of broadcast circuits
521 /* initilizing the hello sending threads
525 /* 8.4.1 a) commence sending of IIH PDUs */
527 if (circuit
->circuit_is_type
& IS_LEVEL_1
)
529 thread_add_event (master
, send_lan_l1_hello
, circuit
, 0);
530 circuit
->u
.bc
.lan_neighs
[0] = list_new ();
533 if (circuit
->circuit_is_type
& IS_LEVEL_2
)
535 thread_add_event (master
, send_lan_l2_hello
, circuit
, 0);
536 circuit
->u
.bc
.lan_neighs
[1] = list_new ();
539 /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */
540 /* 8.4.1 c) FIXME: listen for ESH PDUs */
543 /* dr election will commence in... */
544 if (circuit
->circuit_is_type
& IS_LEVEL_1
)
545 THREAD_TIMER_ON (master
, circuit
->u
.bc
.t_run_dr
[0], isis_run_dr_l1
,
546 circuit
, 2 * circuit
->hello_interval
[0]);
547 if (circuit
->circuit_is_type
& IS_LEVEL_2
)
548 THREAD_TIMER_ON (master
, circuit
->u
.bc
.t_run_dr
[1], isis_run_dr_l2
,
549 circuit
, 2 * circuit
->hello_interval
[1]);
553 /* initializing the hello send threads
556 thread_add_event (master
, send_p2p_hello
, circuit
, 0);
560 /* initializing PSNP timers */
561 if (circuit
->circuit_is_type
& IS_LEVEL_1
)
563 THREAD_TIMER_ON (master
, circuit
->t_send_psnp
[0], send_l1_psnp
, circuit
,
564 isis_jitter (circuit
->psnp_interval
[0], PSNP_JITTER
));
567 if (circuit
->circuit_is_type
& IS_LEVEL_2
)
569 THREAD_TIMER_ON (master
, circuit
->t_send_psnp
[1], send_l2_psnp
, circuit
,
570 isis_jitter (circuit
->psnp_interval
[1], PSNP_JITTER
));
573 /* initialize the circuit streams */
574 if (circuit
->rcv_stream
== NULL
)
575 circuit
->rcv_stream
= stream_new (ISO_MTU (circuit
));
577 if (circuit
->snd_stream
== NULL
)
578 circuit
->snd_stream
= stream_new (ISO_MTU (circuit
));
580 /* unified init for circuits */
581 isis_sock_init (circuit
);
584 THREAD_READ_ON (master
, circuit
->t_read
, isis_receive
, circuit
,
587 THREAD_TIMER_ON (master
, circuit
->t_read
, isis_receive
, circuit
,
594 isis_circuit_down (struct isis_circuit
*circuit
)
596 /* Cancel all active threads -- FIXME: wrong place */
597 /* HT: Read thread if GNU_LINUX, TIMER thread otherwise. */
598 THREAD_OFF (circuit
->t_read
);
599 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
)
601 THREAD_TIMER_OFF (circuit
->u
.bc
.t_send_lan_hello
[0]);
602 THREAD_TIMER_OFF (circuit
->u
.bc
.t_send_lan_hello
[1]);
603 THREAD_TIMER_OFF (circuit
->u
.bc
.t_run_dr
[0]);
604 THREAD_TIMER_OFF (circuit
->u
.bc
.t_run_dr
[1]);
606 else if (circuit
->circ_type
== CIRCUIT_T_P2P
)
608 THREAD_TIMER_OFF (circuit
->u
.p2p
.t_send_p2p_hello
);
611 if (circuit
->t_send_psnp
[0]) {
612 THREAD_TIMER_OFF (circuit
->t_send_psnp
[0]);
614 if (circuit
->t_send_psnp
[1]) {
615 THREAD_TIMER_OFF (circuit
->t_send_psnp
[1]);
617 /* close the socket */
624 circuit_update_nlpids (struct isis_circuit
*circuit
)
626 circuit
->nlpids
.count
= 0;
628 if (circuit
->ip_router
)
630 circuit
->nlpids
.nlpids
[0] = NLPID_IP
;
631 circuit
->nlpids
.count
++;
634 if (circuit
->ipv6_router
)
636 circuit
->nlpids
.nlpids
[circuit
->nlpids
.count
] = NLPID_IPV6
;
637 circuit
->nlpids
.count
++;
639 #endif /* HAVE_IPV6 */
644 isis_interface_config_write (struct vty
*vty
)
648 struct listnode
*node
, *node2
;
649 struct interface
*ifp
;
650 struct isis_area
*area
;
651 struct isis_circuit
*c
;
654 for (ALL_LIST_ELEMENTS_RO (iflist
, node
, ifp
))
657 vty_out (vty
, "interface %s%s", ifp
->name
, VTY_NEWLINE
);
662 vty_out (vty
, " description %s%s", ifp
->desc
, VTY_NEWLINE
);
666 for (ALL_LIST_ELEMENTS_RO (isis
->area_list
, node2
, area
))
668 c
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
673 vty_out (vty
, " ip router isis %s%s", area
->area_tag
,
680 vty_out (vty
, " ipv6 router isis %s%s", area
->area_tag
,
684 #endif /* HAVE_IPV6 */
686 /* ISIS - circuit type */
687 if (c
->circuit_is_type
== IS_LEVEL_1
)
689 vty_out (vty
, " isis circuit-type level-1%s", VTY_NEWLINE
);
694 if (c
->circuit_is_type
== IS_LEVEL_2
)
696 vty_out (vty
, " isis circuit-type level-2-only%s",
702 /* ISIS - CSNP interval - FIXME: compare to cisco */
703 if (c
->csnp_interval
[0] == c
->csnp_interval
[1])
705 if (c
->csnp_interval
[0] != CSNP_INTERVAL
)
707 vty_out (vty
, " isis csnp-interval %d%s",
708 c
->csnp_interval
[0], VTY_NEWLINE
);
714 for (i
= 0; i
< 2; i
++)
716 if (c
->csnp_interval
[1] != CSNP_INTERVAL
)
718 vty_out (vty
, " isis csnp-interval %d level-%d%s",
719 c
->csnp_interval
[1], i
+ 1, VTY_NEWLINE
);
725 /* ISIS - Hello padding - Defaults to true so only display if false */
726 if (c
->circ_type
== CIRCUIT_T_BROADCAST
&& !c
->u
.bc
.pad_hellos
)
728 vty_out (vty
, " no isis hello padding%s", VTY_NEWLINE
);
732 /* ISIS - Hello interval - FIXME: compare to cisco */
733 if (c
->hello_interval
[0] == c
->hello_interval
[1])
735 if (c
->hello_interval
[0] != HELLO_INTERVAL
)
737 vty_out (vty
, " isis hello-interval %d%s",
738 c
->hello_interval
[0], VTY_NEWLINE
);
744 for (i
= 0; i
< 2; i
++)
746 if (c
->hello_interval
[i
] != HELLO_INTERVAL
)
748 if (c
->hello_interval
[i
] == HELLO_MINIMAL
)
751 " isis hello-interval minimal level-%d%s",
756 vty_out (vty
, " isis hello-interval %d level-%d%s",
757 c
->hello_interval
[i
], i
+ 1, VTY_NEWLINE
);
764 /* ISIS - Hello Multiplier */
765 if (c
->hello_multiplier
[0] == c
->hello_multiplier
[1])
767 if (c
->hello_multiplier
[0] != HELLO_MULTIPLIER
)
769 vty_out (vty
, " isis hello-multiplier %d%s",
770 c
->hello_multiplier
[0], VTY_NEWLINE
);
776 for (i
= 0; i
< 2; i
++)
778 if (c
->hello_multiplier
[i
] != HELLO_MULTIPLIER
)
780 vty_out (vty
, " isis hello-multiplier %d level-%d%s",
781 c
->hello_multiplier
[i
], i
+ 1, VTY_NEWLINE
);
786 /* ISIS - Priority */
787 if (c
->circ_type
== CIRCUIT_T_BROADCAST
)
789 if (c
->u
.bc
.priority
[0] == c
->u
.bc
.priority
[1])
791 if (c
->u
.bc
.priority
[0] != DEFAULT_PRIORITY
)
793 vty_out (vty
, " isis priority %d%s",
794 c
->u
.bc
.priority
[0], VTY_NEWLINE
);
800 for (i
= 0; i
< 2; i
++)
802 if (c
->u
.bc
.priority
[i
] != DEFAULT_PRIORITY
)
804 vty_out (vty
, " isis priority %d level-%d%s",
805 c
->u
.bc
.priority
[i
], i
+ 1, VTY_NEWLINE
);
812 if (c
->te_metric
[0] == c
->te_metric
[1])
814 if (c
->te_metric
[0] != DEFAULT_CIRCUIT_METRICS
)
816 vty_out (vty
, " isis metric %d%s", c
->te_metric
[0],
823 for (i
= 0; i
< 2; i
++)
825 if (c
->te_metric
[i
] != DEFAULT_CIRCUIT_METRICS
)
827 vty_out (vty
, " isis metric %d level-%d%s",
828 c
->te_metric
[i
], i
+ 1, VTY_NEWLINE
);
836 vty_out (vty
, "!%s", VTY_NEWLINE
);
842 DEFUN (ip_router_isis
,
844 "ip router isis WORD",
845 "Interface Internet Protocol config commands\n"
846 "IP router interface commands\n"
847 "IS-IS Routing for IP\n"
848 "Routing process tag\n")
850 struct isis_circuit
*c
;
851 struct interface
*ifp
;
852 struct isis_area
*area
;
854 ifp
= (struct interface
*) vty
->index
;
857 area
= isis_area_lookup (argv
[0]);
859 /* Prevent more than one circuit per interface */
861 c
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
864 if (c
&& (ifp
->info
!= NULL
))
867 if (c
->ipv6_router
== 0)
869 #endif /* HAVE_IPV6 */
870 /* FIXME: Find the way to warn only vty users. */
871 /* vty_out (vty, "ISIS circuit is already defined%s", VTY_NEWLINE); */
875 #endif /* HAVE_IPV6 */
878 /* this is here for ciscopability */
881 /* FIXME: Find the way to warn only vty users. */
882 /* vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); */
888 c
= circuit_lookup_by_ifp (ifp
, isis
->init_circ_list
);
889 c
= isis_csm_state_change (ISIS_ENABLE
, c
, area
);
890 c
->interface
= ifp
; /* this is automatic */
891 ifp
->info
= c
; /* hardly related to the FSM */
899 circuit_update_nlpids (c
);
901 vty
->node
= INTERFACE_NODE
;
906 DEFUN (no_ip_router_isis
,
907 no_ip_router_isis_cmd
,
908 "no ip router isis WORD",
910 "Interface Internet Protocol config commands\n"
911 "IP router interface commands\n"
912 "IS-IS Routing for IP\n"
913 "Routing process tag\n")
915 struct isis_circuit
*circuit
= NULL
;
916 struct interface
*ifp
;
917 struct isis_area
*area
;
918 struct listnode
*node
;
920 ifp
= (struct interface
*) vty
->index
;
923 area
= isis_area_lookup (argv
[0]);
926 vty_out (vty
, "Can't find ISIS instance %s", VTY_NEWLINE
);
929 for (ALL_LIST_ELEMENTS_RO (area
->circuit_list
, node
, circuit
))
930 if (circuit
->interface
== ifp
)
934 vty_out (vty
, "Can't find ISIS interface %s", VTY_NEWLINE
);
937 circuit
->ip_router
= 0;
940 if (circuit
->ipv6_router
== 0)
942 isis_csm_state_change (ISIS_DISABLE
, circuit
, area
);
947 DEFUN (isis_circuit_type
,
948 isis_circuit_type_cmd
,
949 "isis circuit-type (level-1|level-1-2|level-2-only)",
951 "Configure circuit type for interface\n"
952 "Level-1 only adjacencies are formed\n"
953 "Level-1-2 adjacencies are formed\n"
954 "Level-2 only adjacencies are formed\n")
956 struct isis_circuit
*circuit
;
957 struct interface
*ifp
;
963 /* UGLY - will remove l8r */
969 /* XXX what to do when ip_router_isis is not executed */
970 if (circuit
->area
== NULL
)
975 circuit_t
= string2circuit_t (argv
[0]);
979 vty_out (vty
, "Unknown circuit-type %s", VTY_NEWLINE
);
983 is_type
= circuit
->area
->is_type
;
984 if (is_type
== IS_LEVEL_1_AND_2
|| is_type
== circuit_t
)
985 isis_event_circuit_type_change (circuit
, circuit_t
);
988 vty_out (vty
, "invalid circuit level for area %s.%s",
989 circuit
->area
->area_tag
, VTY_NEWLINE
);
995 DEFUN (no_isis_circuit_type
,
996 no_isis_circuit_type_cmd
,
997 "no isis circuit-type (level-1|level-1-2|level-2-only)",
1000 "Configure circuit type for interface\n"
1001 "Level-1 only adjacencies are formed\n"
1002 "Level-1-2 adjacencies are formed\n"
1003 "Level-2 only adjacencies are formed\n")
1005 struct isis_circuit
*circuit
;
1006 struct interface
*ifp
;
1009 circuit
= ifp
->info
;
1010 if (circuit
== NULL
)
1018 * Set the circuits level to its default value which is that of the area
1020 isis_event_circuit_type_change (circuit
, circuit
->area
->is_type
);
1027 "isis password WORD",
1029 "Configure the authentication password for interface\n"
1032 struct isis_circuit
*circuit
;
1033 struct interface
*ifp
;
1037 circuit
= ifp
->info
;
1038 if (circuit
== NULL
)
1043 len
= strlen (argv
[0]);
1046 vty_out (vty
, "Too long circuit password (>254)%s", VTY_NEWLINE
);
1049 circuit
->passwd
.len
= len
;
1050 circuit
->passwd
.type
= ISIS_PASSWD_TYPE_CLEARTXT
;
1051 strncpy ((char *)circuit
->passwd
.passwd
, argv
[0], 255);
1056 DEFUN (no_isis_passwd
,
1061 "Configure the authentication password for interface\n")
1063 struct isis_circuit
*circuit
;
1064 struct interface
*ifp
;
1067 circuit
= ifp
->info
;
1068 if (circuit
== NULL
)
1073 memset (&circuit
->passwd
, 0, sizeof (struct isis_passwd
));
1079 DEFUN (isis_priority
,
1081 "isis priority <0-127>",
1083 "Set priority for Designated Router election\n"
1086 struct isis_circuit
*circuit
;
1087 struct interface
*ifp
;
1091 circuit
= ifp
->info
;
1092 if (circuit
== NULL
)
1098 prio
= atoi (argv
[0]);
1100 circuit
->u
.bc
.priority
[0] = prio
;
1101 circuit
->u
.bc
.priority
[1] = prio
;
1106 DEFUN (no_isis_priority
,
1107 no_isis_priority_cmd
,
1111 "Set priority for Designated Router election\n")
1113 struct isis_circuit
*circuit
;
1114 struct interface
*ifp
;
1117 circuit
= ifp
->info
;
1118 if (circuit
== NULL
)
1124 circuit
->u
.bc
.priority
[0] = DEFAULT_PRIORITY
;
1125 circuit
->u
.bc
.priority
[1] = DEFAULT_PRIORITY
;
1130 ALIAS (no_isis_priority
,
1131 no_isis_priority_arg_cmd
,
1132 "no isis priority <0-127>",
1135 "Set priority for Designated Router election\n"
1138 DEFUN (isis_priority_l1
,
1139 isis_priority_l1_cmd
,
1140 "isis priority <0-127> level-1",
1142 "Set priority for Designated Router election\n"
1144 "Specify priority for level-1 routing\n")
1146 struct isis_circuit
*circuit
;
1147 struct interface
*ifp
;
1151 circuit
= ifp
->info
;
1152 if (circuit
== NULL
)
1158 prio
= atoi (argv
[0]);
1160 circuit
->u
.bc
.priority
[0] = prio
;
1165 DEFUN (no_isis_priority_l1
,
1166 no_isis_priority_l1_cmd
,
1167 "no isis priority level-1",
1170 "Set priority for Designated Router election\n"
1171 "Specify priority for level-1 routing\n")
1173 struct isis_circuit
*circuit
;
1174 struct interface
*ifp
;
1177 circuit
= ifp
->info
;
1178 if (circuit
== NULL
)
1184 circuit
->u
.bc
.priority
[0] = DEFAULT_PRIORITY
;
1189 ALIAS (no_isis_priority_l1
,
1190 no_isis_priority_l1_arg_cmd
,
1191 "no isis priority <0-127> level-1",
1194 "Set priority for Designated Router election\n"
1196 "Specify priority for level-1 routing\n")
1198 DEFUN (isis_priority_l2
,
1199 isis_priority_l2_cmd
,
1200 "isis priority <0-127> level-2",
1202 "Set priority for Designated Router election\n"
1204 "Specify priority for level-2 routing\n")
1206 struct isis_circuit
*circuit
;
1207 struct interface
*ifp
;
1211 circuit
= ifp
->info
;
1212 if (circuit
== NULL
)
1218 prio
= atoi (argv
[0]);
1220 circuit
->u
.bc
.priority
[1] = prio
;
1225 DEFUN (no_isis_priority_l2
,
1226 no_isis_priority_l2_cmd
,
1227 "no isis priority level-2",
1230 "Set priority for Designated Router election\n"
1231 "Specify priority for level-2 routing\n")
1233 struct isis_circuit
*circuit
;
1234 struct interface
*ifp
;
1237 circuit
= ifp
->info
;
1238 if (circuit
== NULL
)
1244 circuit
->u
.bc
.priority
[1] = DEFAULT_PRIORITY
;
1249 ALIAS (no_isis_priority_l2
,
1250 no_isis_priority_l2_arg_cmd
,
1251 "no isis priority <0-127> level-2",
1254 "Set priority for Designated Router election\n"
1256 "Specify priority for level-2 routing\n")
1258 /* Metric command */
1261 "isis metric <0-16777215>",
1263 "Set default metric for circuit\n"
1264 "Default metric value\n")
1266 struct isis_circuit
*circuit
;
1267 struct interface
*ifp
;
1271 circuit
= ifp
->info
;
1272 if (circuit
== NULL
)
1278 met
= atoi (argv
[0]);
1280 circuit
->te_metric
[0] = met
;
1281 circuit
->te_metric
[1] = met
;
1286 circuit
->metrics
[0].metric_default
= met
;
1287 circuit
->metrics
[1].metric_default
= met
;
1292 DEFUN (no_isis_metric
,
1297 "Set default metric for circuit\n")
1299 struct isis_circuit
*circuit
;
1300 struct interface
*ifp
;
1303 circuit
= ifp
->info
;
1304 if (circuit
== NULL
)
1310 circuit
->te_metric
[0] = DEFAULT_CIRCUIT_METRICS
;
1311 circuit
->te_metric
[1] = DEFAULT_CIRCUIT_METRICS
;
1312 circuit
->metrics
[0].metric_default
= DEFAULT_CIRCUIT_METRICS
;
1313 circuit
->metrics
[1].metric_default
= DEFAULT_CIRCUIT_METRICS
;
1318 ALIAS (no_isis_metric
,
1319 no_isis_metric_arg_cmd
,
1320 "no isis metric <0-16777215>",
1323 "Set default metric for circuit\n"
1324 "Default metric value\n")
1326 /* end of metrics */
1327 DEFUN (isis_hello_interval
,
1328 isis_hello_interval_cmd
,
1329 "isis hello-interval (<1-65535>|minimal)",
1331 "Set Hello interval\n"
1332 "Hello interval value\n"
1333 "Holdtime 1 seconds, interval depends on multiplier\n")
1335 struct isis_circuit
*circuit
;
1336 struct interface
*ifp
;
1341 circuit
= ifp
->info
;
1342 if (circuit
== NULL
)
1348 if (isdigit ((int) c
))
1350 interval
= atoi (argv
[0]);
1353 interval
= HELLO_MINIMAL
; /* FIXME: should be calculated */
1355 circuit
->hello_interval
[0] = (u_int16_t
) interval
;
1356 circuit
->hello_interval
[1] = (u_int16_t
) interval
;
1361 DEFUN (no_isis_hello_interval
,
1362 no_isis_hello_interval_cmd
,
1363 "no isis hello-interval",
1366 "Set Hello interval\n")
1368 struct isis_circuit
*circuit
;
1369 struct interface
*ifp
;
1372 circuit
= ifp
->info
;
1373 if (circuit
== NULL
)
1380 circuit
->hello_interval
[0] = HELLO_INTERVAL
; /* Default is 1 sec. */
1381 circuit
->hello_interval
[1] = HELLO_INTERVAL
;
1386 ALIAS (no_isis_hello_interval
,
1387 no_isis_hello_interval_arg_cmd
,
1388 "no isis hello-interval (<1-65535>|minimal)",
1391 "Set Hello interval\n"
1392 "Hello interval value\n"
1393 "Holdtime 1 second, interval depends on multiplier\n")
1395 DEFUN (isis_hello_interval_l1
,
1396 isis_hello_interval_l1_cmd
,
1397 "isis hello-interval (<1-65535>|minimal) level-1",
1399 "Set Hello interval\n"
1400 "Hello interval value\n"
1401 "Holdtime 1 second, interval depends on multiplier\n"
1402 "Specify hello-interval for level-1 IIHs\n")
1404 struct isis_circuit
*circuit
;
1405 struct interface
*ifp
;
1410 circuit
= ifp
->info
;
1411 if (circuit
== NULL
)
1418 if (isdigit ((int) c
))
1420 interval
= atoi (argv
[0]);
1423 interval
= HELLO_MINIMAL
;
1425 circuit
->hello_interval
[0] = (u_int16_t
) interval
;
1430 DEFUN (no_isis_hello_interval_l1
,
1431 no_isis_hello_interval_l1_cmd
,
1432 "no isis hello-interval level-1",
1435 "Set Hello interval\n"
1436 "Specify hello-interval for level-1 IIHs\n")
1438 struct isis_circuit
*circuit
;
1439 struct interface
*ifp
;
1442 circuit
= ifp
->info
;
1443 if (circuit
== NULL
)
1450 circuit
->hello_interval
[0] = HELLO_INTERVAL
; /* Default is 1 sec. */
1455 ALIAS (no_isis_hello_interval_l1
,
1456 no_isis_hello_interval_l1_arg_cmd
,
1457 "no isis hello-interval (<1-65535>|minimal) level-1",
1460 "Set Hello interval\n"
1461 "Hello interval value\n"
1462 "Holdtime 1 second, interval depends on multiplier\n"
1463 "Specify hello-interval for level-1 IIHs\n")
1465 DEFUN (isis_hello_interval_l2
,
1466 isis_hello_interval_l2_cmd
,
1467 "isis hello-interval (<1-65535>|minimal) level-2",
1469 "Set Hello interval\n"
1470 "Hello interval value\n"
1471 "Holdtime 1 second, interval depends on multiplier\n"
1472 "Specify hello-interval for level-2 IIHs\n")
1474 struct isis_circuit
*circuit
;
1475 struct interface
*ifp
;
1480 circuit
= ifp
->info
;
1481 if (circuit
== NULL
)
1488 if (isdigit ((int) c
))
1490 interval
= atoi (argv
[0]);
1493 interval
= HELLO_MINIMAL
;
1495 circuit
->hello_interval
[1] = (u_int16_t
) interval
;
1500 DEFUN (no_isis_hello_interval_l2
,
1501 no_isis_hello_interval_l2_cmd
,
1502 "no isis hello-interval level-2",
1505 "Set Hello interval\n"
1506 "Specify hello-interval for level-2 IIHs\n")
1508 struct isis_circuit
*circuit
;
1509 struct interface
*ifp
;
1512 circuit
= ifp
->info
;
1513 if (circuit
== NULL
)
1520 circuit
->hello_interval
[1] = HELLO_INTERVAL
; /* Default is 1 sec. */
1525 ALIAS (no_isis_hello_interval_l2
,
1526 no_isis_hello_interval_l2_arg_cmd
,
1527 "no isis hello-interval (<1-65535>|minimal) level-2",
1530 "Set Hello interval\n"
1531 "Hello interval value\n"
1532 "Holdtime 1 second, interval depends on multiplier\n"
1533 "Specify hello-interval for level-2 IIHs\n")
1535 DEFUN (isis_hello_multiplier
,
1536 isis_hello_multiplier_cmd
,
1537 "isis hello-multiplier <3-1000>",
1539 "Set multiplier for Hello holding time\n"
1540 "Hello multiplier value\n")
1542 struct isis_circuit
*circuit
;
1543 struct interface
*ifp
;
1547 circuit
= ifp
->info
;
1548 if (circuit
== NULL
)
1554 mult
= atoi (argv
[0]);
1556 circuit
->hello_multiplier
[0] = (u_int16_t
) mult
;
1557 circuit
->hello_multiplier
[1] = (u_int16_t
) mult
;
1562 DEFUN (no_isis_hello_multiplier
,
1563 no_isis_hello_multiplier_cmd
,
1564 "no isis hello-multiplier",
1567 "Set multiplier for Hello holding time\n")
1569 struct isis_circuit
*circuit
;
1570 struct interface
*ifp
;
1573 circuit
= ifp
->info
;
1574 if (circuit
== NULL
)
1580 circuit
->hello_multiplier
[0] = HELLO_MULTIPLIER
;
1581 circuit
->hello_multiplier
[1] = HELLO_MULTIPLIER
;
1586 ALIAS (no_isis_hello_multiplier
,
1587 no_isis_hello_multiplier_arg_cmd
,
1588 "no isis hello-multiplier <3-1000>",
1591 "Set multiplier for Hello holding time\n"
1592 "Hello multiplier value\n")
1594 DEFUN (isis_hello_multiplier_l1
,
1595 isis_hello_multiplier_l1_cmd
,
1596 "isis hello-multiplier <3-1000> level-1",
1598 "Set multiplier for Hello holding time\n"
1599 "Hello multiplier value\n"
1600 "Specify hello multiplier for level-1 IIHs\n")
1602 struct isis_circuit
*circuit
;
1603 struct interface
*ifp
;
1607 circuit
= ifp
->info
;
1608 if (circuit
== NULL
)
1614 mult
= atoi (argv
[0]);
1616 circuit
->hello_multiplier
[0] = (u_int16_t
) mult
;
1621 DEFUN (no_isis_hello_multiplier_l1
,
1622 no_isis_hello_multiplier_l1_cmd
,
1623 "no isis hello-multiplier level-1",
1626 "Set multiplier for Hello holding time\n"
1627 "Specify hello multiplier for level-1 IIHs\n")
1629 struct isis_circuit
*circuit
;
1630 struct interface
*ifp
;
1633 circuit
= ifp
->info
;
1634 if (circuit
== NULL
)
1640 circuit
->hello_multiplier
[0] = HELLO_MULTIPLIER
;
1645 ALIAS (no_isis_hello_multiplier_l1
,
1646 no_isis_hello_multiplier_l1_arg_cmd
,
1647 "no isis hello-multiplier <3-1000> level-1",
1650 "Set multiplier for Hello holding time\n"
1651 "Hello multiplier value\n"
1652 "Specify hello multiplier for level-1 IIHs\n")
1654 DEFUN (isis_hello_multiplier_l2
,
1655 isis_hello_multiplier_l2_cmd
,
1656 "isis hello-multiplier <3-1000> level-2",
1658 "Set multiplier for Hello holding time\n"
1659 "Hello multiplier value\n"
1660 "Specify hello multiplier for level-2 IIHs\n")
1662 struct isis_circuit
*circuit
;
1663 struct interface
*ifp
;
1667 circuit
= ifp
->info
;
1668 if (circuit
== NULL
)
1674 mult
= atoi (argv
[0]);
1676 circuit
->hello_multiplier
[1] = (u_int16_t
) mult
;
1681 DEFUN (no_isis_hello_multiplier_l2
,
1682 no_isis_hello_multiplier_l2_cmd
,
1683 "no isis hello-multiplier level-2",
1686 "Set multiplier for Hello holding time\n"
1687 "Specify hello multiplier for level-2 IIHs\n")
1689 struct isis_circuit
*circuit
;
1690 struct interface
*ifp
;
1693 circuit
= ifp
->info
;
1694 if (circuit
== NULL
)
1700 circuit
->hello_multiplier
[1] = HELLO_MULTIPLIER
;
1705 ALIAS (no_isis_hello_multiplier_l2
,
1706 no_isis_hello_multiplier_l2_arg_cmd
,
1707 "no isis hello-multiplier <3-1000> level-2",
1710 "Set multiplier for Hello holding time\n"
1711 "Hello multiplier value\n"
1712 "Specify hello multiplier for level-2 IIHs\n")
1716 "isis hello padding",
1718 "Add padding to IS-IS hello packets\n"
1719 "Pad hello packets\n"
1722 struct interface
*ifp
;
1723 struct isis_circuit
*circuit
;
1726 circuit
= ifp
->info
;
1727 if (circuit
== NULL
)
1733 circuit
->u
.bc
.pad_hellos
= 1;
1738 DEFUN (no_isis_hello
,
1740 "no isis hello padding",
1743 "Add padding to IS-IS hello packets\n"
1744 "Pad hello packets\n"
1747 struct isis_circuit
*circuit
;
1748 struct interface
*ifp
;
1751 circuit
= ifp
->info
;
1752 if (circuit
== NULL
)
1758 circuit
->u
.bc
.pad_hellos
= 0;
1763 DEFUN (csnp_interval
,
1765 "isis csnp-interval <0-65535>",
1767 "Set CSNP interval in seconds\n"
1768 "CSNP interval value\n")
1770 struct isis_circuit
*circuit
;
1771 struct interface
*ifp
;
1772 unsigned long interval
;
1775 circuit
= ifp
->info
;
1776 if (circuit
== NULL
)
1782 interval
= atol (argv
[0]);
1784 circuit
->csnp_interval
[0] = (u_int16_t
) interval
;
1785 circuit
->csnp_interval
[1] = (u_int16_t
) interval
;
1790 DEFUN (no_csnp_interval
,
1791 no_csnp_interval_cmd
,
1792 "no isis csnp-interval",
1795 "Set CSNP interval in seconds\n")
1797 struct isis_circuit
*circuit
;
1798 struct interface
*ifp
;
1801 circuit
= ifp
->info
;
1802 if (circuit
== NULL
)
1808 circuit
->csnp_interval
[0] = CSNP_INTERVAL
;
1809 circuit
->csnp_interval
[1] = CSNP_INTERVAL
;
1814 ALIAS (no_csnp_interval
,
1815 no_csnp_interval_arg_cmd
,
1816 "no isis csnp-interval <0-65535>",
1819 "Set CSNP interval in seconds\n"
1820 "CSNP interval value\n")
1822 DEFUN (csnp_interval_l1
,
1823 csnp_interval_l1_cmd
,
1824 "isis csnp-interval <0-65535> level-1",
1826 "Set CSNP interval in seconds\n"
1827 "CSNP interval value\n"
1828 "Specify interval for level-1 CSNPs\n")
1830 struct isis_circuit
*circuit
;
1831 struct interface
*ifp
;
1832 unsigned long interval
;
1835 circuit
= ifp
->info
;
1836 if (circuit
== NULL
)
1842 interval
= atol (argv
[0]);
1844 circuit
->csnp_interval
[0] = (u_int16_t
) interval
;
1849 DEFUN (no_csnp_interval_l1
,
1850 no_csnp_interval_l1_cmd
,
1851 "no isis csnp-interval level-1",
1854 "Set CSNP interval in seconds\n"
1855 "Specify interval for level-1 CSNPs\n")
1857 struct isis_circuit
*circuit
;
1858 struct interface
*ifp
;
1861 circuit
= ifp
->info
;
1862 if (circuit
== NULL
)
1868 circuit
->csnp_interval
[0] = CSNP_INTERVAL
;
1873 ALIAS (no_csnp_interval_l1
,
1874 no_csnp_interval_l1_arg_cmd
,
1875 "no isis csnp-interval <0-65535> level-1",
1878 "Set CSNP interval in seconds\n"
1879 "CSNP interval value\n"
1880 "Specify interval for level-1 CSNPs\n")
1882 DEFUN (csnp_interval_l2
,
1883 csnp_interval_l2_cmd
,
1884 "isis csnp-interval <0-65535> level-2",
1886 "Set CSNP interval in seconds\n"
1887 "CSNP interval value\n"
1888 "Specify interval for level-2 CSNPs\n")
1890 struct isis_circuit
*circuit
;
1891 struct interface
*ifp
;
1892 unsigned long interval
;
1895 circuit
= ifp
->info
;
1896 if (circuit
== NULL
)
1902 interval
= atol (argv
[0]);
1904 circuit
->csnp_interval
[1] = (u_int16_t
) interval
;
1909 DEFUN (no_csnp_interval_l2
,
1910 no_csnp_interval_l2_cmd
,
1911 "no isis csnp-interval level-2",
1914 "Set CSNP interval in seconds\n"
1915 "Specify interval for level-2 CSNPs\n")
1917 struct isis_circuit
*circuit
;
1918 struct interface
*ifp
;
1921 circuit
= ifp
->info
;
1922 if (circuit
== NULL
)
1928 circuit
->csnp_interval
[1] = CSNP_INTERVAL
;
1933 ALIAS (no_csnp_interval_l2
,
1934 no_csnp_interval_l2_arg_cmd
,
1935 "no isis csnp-interval <0-65535> level-2",
1938 "Set CSNP interval in seconds\n"
1939 "CSNP interval value\n"
1940 "Specify interval for level-2 CSNPs\n")
1943 DEFUN (ipv6_router_isis
,
1944 ipv6_router_isis_cmd
,
1945 "ipv6 router isis WORD",
1946 "IPv6 interface subcommands\n"
1947 "IPv6 Router interface commands\n"
1948 "IS-IS Routing for IPv6\n"
1949 "Routing process tag\n")
1951 struct isis_circuit
*c
;
1952 struct interface
*ifp
;
1953 struct isis_area
*area
;
1955 ifp
= (struct interface
*) vty
->index
;
1958 area
= isis_area_lookup (argv
[0]);
1960 /* Prevent more than one circuit per interface */
1962 c
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
1966 if (c
&& (ifp
->info
!= NULL
))
1968 if (c
->ipv6_router
== 1)
1970 vty_out (vty
, "ISIS circuit is already defined for IPv6%s",
1976 /* this is here for ciscopability */
1979 vty_out (vty
, "Can't find ISIS instance %s", VTY_NEWLINE
);
1985 c
= circuit_lookup_by_ifp (ifp
, isis
->init_circ_list
);
1986 c
= isis_csm_state_change (ISIS_ENABLE
, c
, area
);
1995 area
->ipv6_circuits
++;
1996 circuit_update_nlpids (c
);
1998 vty
->node
= INTERFACE_NODE
;
2003 DEFUN (no_ipv6_router_isis
,
2004 no_ipv6_router_isis_cmd
,
2005 "no ipv6 router isis WORD",
2007 "IPv6 interface subcommands\n"
2008 "IPv6 Router interface commands\n"
2009 "IS-IS Routing for IPv6\n"
2010 "Routing process tag\n")
2012 struct isis_circuit
*c
;
2013 struct interface
*ifp
;
2014 struct isis_area
*area
;
2016 ifp
= (struct interface
*) vty
->index
;
2017 /* UGLY - will remove l8r
2018 if (circuit == NULL) {
2023 area
= isis_area_lookup (argv
[0]);
2026 vty_out (vty
, "Can't find ISIS instance %s", VTY_NEWLINE
);
2030 c
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
2035 area
->ipv6_circuits
--;
2036 if (c
->ip_router
== 0)
2037 isis_csm_state_change (ISIS_DISABLE
, c
, area
);
2041 #endif /* HAVE_IPV6 */
2043 static struct cmd_node interface_node
= {
2050 isis_if_new_hook (struct interface
*ifp
)
2052 /* FIXME: Discuss if the circuit should be created here
2053 ifp->info = XMALLOC (MTYPE_ISIS_IF_INFO, sizeof (struct isis_if_info)); */
2059 isis_if_delete_hook (struct interface
*ifp
)
2061 /* FIXME: Discuss if the circuit should be created here
2062 XFREE (MTYPE_ISIS_IF_INFO, ifp->info);*/
2068 isis_circuit_init ()
2070 /* Initialize Zebra interface data structure */
2072 if_add_hook (IF_NEW_HOOK
, isis_if_new_hook
);
2073 if_add_hook (IF_DELETE_HOOK
, isis_if_delete_hook
);
2075 /* Install interface node */
2076 install_node (&interface_node
, isis_interface_config_write
);
2077 install_element (CONFIG_NODE
, &interface_cmd
);
2079 install_default (INTERFACE_NODE
);
2080 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
2081 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
2083 install_element (INTERFACE_NODE
, &ip_router_isis_cmd
);
2084 install_element (INTERFACE_NODE
, &no_ip_router_isis_cmd
);
2086 install_element (INTERFACE_NODE
, &isis_circuit_type_cmd
);
2087 install_element (INTERFACE_NODE
, &no_isis_circuit_type_cmd
);
2089 install_element (INTERFACE_NODE
, &isis_passwd_cmd
);
2090 install_element (INTERFACE_NODE
, &no_isis_passwd_cmd
);
2092 install_element (INTERFACE_NODE
, &isis_priority_cmd
);
2093 install_element (INTERFACE_NODE
, &no_isis_priority_cmd
);
2094 install_element (INTERFACE_NODE
, &no_isis_priority_arg_cmd
);
2095 install_element (INTERFACE_NODE
, &isis_priority_l1_cmd
);
2096 install_element (INTERFACE_NODE
, &no_isis_priority_l1_cmd
);
2097 install_element (INTERFACE_NODE
, &no_isis_priority_l1_arg_cmd
);
2098 install_element (INTERFACE_NODE
, &isis_priority_l2_cmd
);
2099 install_element (INTERFACE_NODE
, &no_isis_priority_l2_cmd
);
2100 install_element (INTERFACE_NODE
, &no_isis_priority_l2_arg_cmd
);
2102 install_element (INTERFACE_NODE
, &isis_metric_cmd
);
2103 install_element (INTERFACE_NODE
, &no_isis_metric_cmd
);
2104 install_element (INTERFACE_NODE
, &no_isis_metric_arg_cmd
);
2106 install_element (INTERFACE_NODE
, &isis_hello_interval_cmd
);
2107 install_element (INTERFACE_NODE
, &no_isis_hello_interval_cmd
);
2108 install_element (INTERFACE_NODE
, &no_isis_hello_interval_arg_cmd
);
2109 install_element (INTERFACE_NODE
, &isis_hello_interval_l1_cmd
);
2110 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l1_cmd
);
2111 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l1_arg_cmd
);
2112 install_element (INTERFACE_NODE
, &isis_hello_interval_l2_cmd
);
2113 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l2_cmd
);
2114 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l2_arg_cmd
);
2116 install_element (INTERFACE_NODE
, &isis_hello_multiplier_cmd
);
2117 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_cmd
);
2118 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_arg_cmd
);
2119 install_element (INTERFACE_NODE
, &isis_hello_multiplier_l1_cmd
);
2120 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l1_cmd
);
2121 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l1_arg_cmd
);
2122 install_element (INTERFACE_NODE
, &isis_hello_multiplier_l2_cmd
);
2123 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l2_cmd
);
2124 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l2_arg_cmd
);
2126 install_element (INTERFACE_NODE
, &isis_hello_cmd
);
2127 install_element (INTERFACE_NODE
, &no_isis_hello_cmd
);
2128 install_element (INTERFACE_NODE
, &csnp_interval_cmd
);
2129 install_element (INTERFACE_NODE
, &no_csnp_interval_cmd
);
2130 install_element (INTERFACE_NODE
, &no_csnp_interval_arg_cmd
);
2131 install_element (INTERFACE_NODE
, &csnp_interval_l1_cmd
);
2132 install_element (INTERFACE_NODE
, &no_csnp_interval_l1_cmd
);
2133 install_element (INTERFACE_NODE
, &no_csnp_interval_l1_arg_cmd
);
2134 install_element (INTERFACE_NODE
, &csnp_interval_l2_cmd
);
2135 install_element (INTERFACE_NODE
, &no_csnp_interval_l2_cmd
);
2136 install_element (INTERFACE_NODE
, &no_csnp_interval_l2_arg_cmd
);
2139 install_element (INTERFACE_NODE
, &ipv6_router_isis_cmd
);
2140 install_element (INTERFACE_NODE
, &no_ipv6_router_isis_cmd
);