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
44 #include "isisd/dict.h"
45 #include "isisd/include-netbsd/iso.h"
46 #include "isisd/isis_constants.h"
47 #include "isisd/isis_common.h"
48 #include "isisd/isis_flags.h"
49 #include "isisd/isis_circuit.h"
50 #include "isisd/isis_tlv.h"
51 #include "isisd/isis_lsp.h"
52 #include "isisd/isis_pdu.h"
53 #include "isisd/isis_network.h"
54 #include "isisd/isis_misc.h"
55 #include "isisd/isis_constants.h"
56 #include "isisd/isis_adjacency.h"
57 #include "isisd/isis_dr.h"
58 #include "isisd/isisd.h"
59 #include "isisd/isis_csm.h"
60 #include "isisd/isis_events.h"
65 int isis_interface_config_write(struct vty
*);
66 int isis_if_new_hook(struct interface
*);
67 int isis_if_delete_hook(struct interface
*);
72 struct isis_circuit
*circuit
;
75 circuit
= XCALLOC (MTYPE_ISIS_CIRCUIT
, sizeof (struct isis_circuit
));
78 zlog_err ("Can't malloc isis circuit");
85 circuit
->is_type
= IS_LEVEL_1_AND_2
;
87 circuit
->pad_hellos
= 1;
88 for (i
= 0; i
< 2; i
++)
90 circuit
->hello_interval
[i
] = DEFAULT_HELLO_INTERVAL
;
91 circuit
->hello_multiplier
[i
] = DEFAULT_HELLO_MULTIPLIER
;
92 circuit
->csnp_interval
[i
] = DEFAULT_CSNP_INTERVAL
;
93 circuit
->psnp_interval
[i
] = DEFAULT_PSNP_INTERVAL
;
94 circuit
->priority
[i
] = DEFAULT_PRIORITY
;
95 circuit
->metrics
[i
].metric_default
= DEFAULT_CIRCUIT_METRIC
;
96 circuit
->metrics
[i
].metric_expense
= METRICS_UNSUPPORTED
;
97 circuit
->metrics
[i
].metric_error
= METRICS_UNSUPPORTED
;
98 circuit
->metrics
[i
].metric_delay
= METRICS_UNSUPPORTED
;
99 circuit
->te_metric
[i
] = DEFAULT_CIRCUIT_METRIC
;
106 isis_circuit_del (struct isis_circuit
*circuit
)
111 isis_circuit_if_unbind (circuit
, circuit
->interface
);
113 /* and lastly the circuit itself */
114 XFREE (MTYPE_ISIS_CIRCUIT
, circuit
);
120 isis_circuit_configure (struct isis_circuit
*circuit
, struct isis_area
*area
)
123 circuit
->area
= area
;
126 * Whenever the is-type of an area is changed, the is-type of each circuit
127 * in that area is updated to a non-empty subset of the area is-type.
128 * Inversely, when configuring a new circuit, this property should be
131 if (area
->is_type
!= IS_LEVEL_1_AND_2
)
132 circuit
->is_type
= area
->is_type
;
135 * Add the circuit into area
137 listnode_add (area
->circuit_list
, circuit
);
139 circuit
->idx
= flags_get_index (&area
->flags
);
145 isis_circuit_deconfigure (struct isis_circuit
*circuit
, struct isis_area
*area
)
147 /* Free the index of SRM and SSN flags */
148 flags_free_index (&area
->flags
, circuit
->idx
);
150 /* Remove circuit from area */
151 assert (circuit
->area
== area
);
152 listnode_delete (area
->circuit_list
, circuit
);
153 circuit
->area
= NULL
;
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
)
170 assert (ifp
->info
== circuit
);
177 struct isis_circuit
*
178 circuit_scan_by_ifp (struct interface
*ifp
)
180 struct isis_area
*area
;
181 struct listnode
*node
;
182 struct isis_circuit
*circuit
;
185 return (struct isis_circuit
*)ifp
->info
;
189 for (ALL_LIST_ELEMENTS_RO (isis
->area_list
, node
, area
))
191 circuit
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
196 return circuit_lookup_by_ifp (ifp
, isis
->init_circ_list
);
199 static struct isis_circuit
*
200 isis_circuit_lookup (struct vty
*vty
)
202 struct interface
*ifp
;
203 struct isis_circuit
*circuit
;
205 ifp
= (struct interface
*) vty
->index
;
208 vty_out (vty
, "Invalid interface %s", VTY_NEWLINE
);
212 circuit
= circuit_scan_by_ifp (ifp
);
215 vty_out (vty
, "ISIS is not enabled on circuit %s%s",
216 ifp
->name
, VTY_NEWLINE
);
224 isis_circuit_add_addr (struct isis_circuit
*circuit
,
225 struct connected
*connected
)
227 struct listnode
*node
;
228 struct prefix_ipv4
*ipv4
;
229 #if defined(EXTREME_DEBUG)
230 char buf
[PREFIX2STR_BUFFER
];
232 struct prefix_ipv6
*ipv6
;
234 if (connected
->address
->family
== AF_INET
)
236 u_int32_t addr
= connected
->address
->u
.prefix4
.s_addr
;
238 if (IPV4_NET0(addr
) ||
241 IPV4_LINKLOCAL(addr
))
244 for (ALL_LIST_ELEMENTS_RO (circuit
->ip_addrs
, node
, ipv4
))
245 if (prefix_same ((struct prefix
*) ipv4
, connected
->address
))
248 ipv4
= prefix_ipv4_new ();
249 ipv4
->prefixlen
= connected
->address
->prefixlen
;
250 ipv4
->prefix
= connected
->address
->u
.prefix4
;
251 listnode_add (circuit
->ip_addrs
, ipv4
);
253 lsp_regenerate_schedule (circuit
->area
, circuit
->is_type
, 0);
256 prefix2str (connected
->address
, buf
, sizeof (buf
));
257 zlog_debug ("Added IP address %s to circuit %d", buf
,
258 circuit
->circuit_id
);
259 #endif /* EXTREME_DEBUG */
261 if (connected
->address
->family
== AF_INET6
)
263 if (IN6_IS_ADDR_LOOPBACK(&connected
->address
->u
.prefix6
))
266 for (ALL_LIST_ELEMENTS_RO (circuit
->ipv6_link
, node
, ipv6
))
267 if (prefix_same ((struct prefix
*) ipv6
, connected
->address
))
269 for (ALL_LIST_ELEMENTS_RO (circuit
->ipv6_non_link
, node
, ipv6
))
270 if (prefix_same ((struct prefix
*) ipv6
, connected
->address
))
273 ipv6
= prefix_ipv6_new ();
274 ipv6
->prefixlen
= connected
->address
->prefixlen
;
275 ipv6
->prefix
= connected
->address
->u
.prefix6
;
277 if (IN6_IS_ADDR_LINKLOCAL (&ipv6
->prefix
))
278 listnode_add (circuit
->ipv6_link
, ipv6
);
280 listnode_add (circuit
->ipv6_non_link
, ipv6
);
282 lsp_regenerate_schedule (circuit
->area
, circuit
->is_type
, 0);
285 prefix2str (connected
->address
, buf
, sizeof (buf
));
286 zlog_debug ("Added IPv6 address %s to circuit %d", buf
,
287 circuit
->circuit_id
);
288 #endif /* EXTREME_DEBUG */
294 isis_circuit_del_addr (struct isis_circuit
*circuit
,
295 struct connected
*connected
)
297 struct prefix_ipv4
*ipv4
, *ip
= NULL
;
298 struct listnode
*node
;
299 char buf
[PREFIX2STR_BUFFER
];
301 struct prefix_ipv6
*ipv6
, *ip6
= NULL
;
303 #endif /* HAVE_IPV6 */
305 if (connected
->address
->family
== AF_INET
)
307 ipv4
= prefix_ipv4_new ();
308 ipv4
->prefixlen
= connected
->address
->prefixlen
;
309 ipv4
->prefix
= connected
->address
->u
.prefix4
;
311 for (ALL_LIST_ELEMENTS_RO (circuit
->ip_addrs
, node
, ip
))
312 if (prefix_same ((struct prefix
*) ip
, (struct prefix
*) ipv4
))
317 listnode_delete (circuit
->ip_addrs
, ip
);
319 lsp_regenerate_schedule (circuit
->area
, circuit
->is_type
, 0);
323 prefix2str (connected
->address
, buf
, sizeof (buf
));
324 zlog_warn ("Nonexitant ip address %s removal attempt from \
325 circuit %d", buf
, circuit
->circuit_id
);
326 zlog_warn ("Current ip addresses on %s:", circuit
->interface
->name
);
327 for (ALL_LIST_ELEMENTS_RO(circuit
->ip_addrs
, node
, ip
))
329 prefix2str((struct prefix
*)ip
, (char *)buf
, BUFSIZ
);
330 zlog_warn(" %s", buf
);
332 zlog_warn("End of addresses");
335 prefix_ipv4_free (ipv4
);
338 if (connected
->address
->family
== AF_INET6
)
340 ipv6
= prefix_ipv6_new ();
341 ipv6
->prefixlen
= connected
->address
->prefixlen
;
342 ipv6
->prefix
= connected
->address
->u
.prefix6
;
344 if (IN6_IS_ADDR_LINKLOCAL (&ipv6
->prefix
))
346 for (ALL_LIST_ELEMENTS_RO (circuit
->ipv6_link
, node
, ip6
))
348 if (prefix_same ((struct prefix
*) ip6
, (struct prefix
*) ipv6
))
353 listnode_delete (circuit
->ipv6_link
, ip6
);
359 for (ALL_LIST_ELEMENTS_RO (circuit
->ipv6_non_link
, node
, ip6
))
361 if (prefix_same ((struct prefix
*) ip6
, (struct prefix
*) ipv6
))
366 listnode_delete (circuit
->ipv6_non_link
, ip6
);
373 prefix2str (connected
->address
, buf
, sizeof (buf
));
374 zlog_warn ("Nonexitant ip address %s removal attempt from \
375 circuit %d", buf
, circuit
->circuit_id
);
376 zlog_warn ("Current ip addresses on %s:", circuit
->interface
->name
);
377 for (ALL_LIST_ELEMENTS_RO(circuit
->ipv6_link
, node
, ip6
))
379 prefix2str((struct prefix
*)ip6
, (char *)buf
, BUFSIZ
);
380 zlog_warn(" %s", buf
);
383 for (ALL_LIST_ELEMENTS_RO(circuit
->ipv6_non_link
, node
, ip6
))
385 prefix2str((struct prefix
*)ip6
, (char *)buf
, BUFSIZ
);
386 zlog_warn(" %s", buf
);
388 zlog_warn("End of addresses");
390 else if (circuit
->area
)
391 lsp_regenerate_schedule (circuit
->area
, circuit
->is_type
, 0);
393 prefix_ipv6_free (ipv6
);
395 #endif /* HAVE_IPV6 */
400 isis_circuit_id_gen (struct interface
*ifp
)
405 int start
= -1, end
= -1;
408 * Get a stable circuit id from ifname. This makes
409 * the ifindex from flapping when netdevs are created
410 * and deleted on the fly. Note that this circuit id
411 * is used in pseudo lsps so it is better to be stable.
412 * The following code works on any reasonanle ifname
413 * like: eth1 or trk-1.1 etc.
415 for (i
= 0; i
< strlen (ifp
->name
); i
++)
417 if (isdigit((unsigned char)ifp
->name
[i
]))
433 if ((start
>= 0) && (end
>= start
) && (end
- start
) < 16)
435 memset (ifname
, 0, 16);
436 strncpy (ifname
, &ifp
->name
[start
], end
- start
);
437 id
= (u_char
)atoi(ifname
);
440 /* Try to be unique. */
442 id
= (u_char
)((ifp
->ifindex
& 0xff) | 0x80);
448 isis_circuit_if_add (struct isis_circuit
*circuit
, struct interface
*ifp
)
450 struct listnode
*node
, *nnode
;
451 struct connected
*conn
;
453 circuit
->circuit_id
= isis_circuit_id_gen (ifp
);
455 isis_circuit_if_bind (circuit
, ifp
);
456 /* isis_circuit_update_addrs (circuit, ifp); */
458 if (if_is_broadcast (ifp
))
460 if (circuit
->circ_type_config
== CIRCUIT_T_P2P
)
461 circuit
->circ_type
= CIRCUIT_T_P2P
;
463 circuit
->circ_type
= CIRCUIT_T_BROADCAST
;
465 else if (if_is_pointopoint (ifp
))
467 circuit
->circ_type
= CIRCUIT_T_P2P
;
469 else if (if_is_loopback (ifp
))
471 circuit
->circ_type
= CIRCUIT_T_LOOPBACK
;
472 circuit
->is_passive
= 1;
476 /* It's normal in case of loopback etc. */
477 if (isis
->debugs
& DEBUG_EVENTS
)
478 zlog_debug ("isis_circuit_if_add: unsupported media");
479 circuit
->circ_type
= CIRCUIT_T_UNKNOWN
;
482 circuit
->ip_addrs
= list_new ();
484 circuit
->ipv6_link
= list_new ();
485 circuit
->ipv6_non_link
= list_new ();
486 #endif /* HAVE_IPV6 */
488 for (ALL_LIST_ELEMENTS (ifp
->connected
, node
, nnode
, conn
))
489 isis_circuit_add_addr (circuit
, conn
);
495 isis_circuit_if_del (struct isis_circuit
*circuit
, struct interface
*ifp
)
497 struct listnode
*node
, *nnode
;
498 struct connected
*conn
;
500 assert (circuit
->interface
== ifp
);
502 /* destroy addresses */
503 for (ALL_LIST_ELEMENTS (ifp
->connected
, node
, nnode
, conn
))
504 isis_circuit_del_addr (circuit
, conn
);
506 if (circuit
->ip_addrs
)
508 assert (listcount(circuit
->ip_addrs
) == 0);
509 list_delete (circuit
->ip_addrs
);
510 circuit
->ip_addrs
= NULL
;
514 if (circuit
->ipv6_link
)
516 assert (listcount(circuit
->ipv6_link
) == 0);
517 list_delete (circuit
->ipv6_link
);
518 circuit
->ipv6_link
= NULL
;
521 if (circuit
->ipv6_non_link
)
523 assert (listcount(circuit
->ipv6_non_link
) == 0);
524 list_delete (circuit
->ipv6_non_link
);
525 circuit
->ipv6_non_link
= NULL
;
527 #endif /* HAVE_IPV6 */
529 circuit
->circ_type
= CIRCUIT_T_UNKNOWN
;
530 circuit
->circuit_id
= 0;
536 isis_circuit_if_bind (struct isis_circuit
*circuit
, struct interface
*ifp
)
538 assert (circuit
!= NULL
);
539 assert (ifp
!= NULL
);
540 if (circuit
->interface
)
541 assert (circuit
->interface
== ifp
);
543 circuit
->interface
= ifp
;
545 assert (ifp
->info
== circuit
);
551 isis_circuit_if_unbind (struct isis_circuit
*circuit
, struct interface
*ifp
)
553 assert (circuit
!= NULL
);
554 assert (ifp
!= NULL
);
555 assert (circuit
->interface
== ifp
);
556 assert (ifp
->info
== circuit
);
557 circuit
->interface
= NULL
;
562 isis_circuit_update_all_srmflags (struct isis_circuit
*circuit
, int is_set
)
564 struct isis_area
*area
;
565 struct isis_lsp
*lsp
;
566 dnode_t
*dnode
, *dnode_next
;
570 area
= circuit
->area
;
572 for (level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
; level
++)
574 if (level
& circuit
->is_type
)
576 if (area
->lspdb
[level
- 1] &&
577 dict_count (area
->lspdb
[level
- 1]) > 0)
579 for (dnode
= dict_first (area
->lspdb
[level
- 1]);
580 dnode
!= NULL
; dnode
= dnode_next
)
582 dnode_next
= dict_next (area
->lspdb
[level
- 1], dnode
);
583 lsp
= dnode_get (dnode
);
586 ISIS_SET_FLAG (lsp
->SRMflags
, circuit
);
590 ISIS_CLEAR_FLAG (lsp
->SRMflags
, circuit
);
599 isis_circuit_pdu_size(struct isis_circuit
*circuit
)
601 return ISO_MTU(circuit
);
605 isis_circuit_stream(struct isis_circuit
*circuit
, struct stream
**stream
)
607 size_t stream_size
= isis_circuit_pdu_size(circuit
);
611 *stream
= stream_new(stream_size
);
615 if (STREAM_SIZE(*stream
) != stream_size
)
616 stream_resize(*stream
, stream_size
);
617 stream_reset(*stream
);
622 isis_circuit_up (struct isis_circuit
*circuit
)
626 /* Set the flags for all the lsps of the circuit. */
627 isis_circuit_update_all_srmflags (circuit
, 1);
629 if (circuit
->state
== C_STATE_UP
)
632 if (circuit
->is_passive
)
635 if (circuit
->area
->lsp_mtu
> isis_circuit_pdu_size(circuit
))
637 zlog_err("Interface MTU %zu on %s is too low to support area lsp mtu %u!",
638 isis_circuit_pdu_size(circuit
), circuit
->interface
->name
,
639 circuit
->area
->lsp_mtu
);
640 isis_circuit_update_all_srmflags(circuit
, 0);
644 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
)
647 * Get the Hardware Address
649 #ifdef HAVE_STRUCT_SOCKADDR_DL
651 if (circuit
->interface
->sdl
.sdl_alen
!= ETHER_ADDR_LEN
)
652 zlog_warn ("unsupported link layer");
654 memcpy (circuit
->u
.bc
.snpa
, LLADDR (&circuit
->interface
->sdl
),
658 if (circuit
->interface
->hw_addr_len
!= ETH_ALEN
)
660 zlog_warn ("unsupported link layer");
664 memcpy (circuit
->u
.bc
.snpa
, circuit
->interface
->hw_addr
, ETH_ALEN
);
667 zlog_debug ("isis_circuit_if_add: if_id %d, isomtu %d snpa %s",
668 circuit
->interface
->ifindex
, ISO_MTU (circuit
),
669 snpa_print (circuit
->u
.bc
.snpa
));
670 #endif /* EXTREME_DEBUG */
671 #endif /* HAVE_STRUCT_SOCKADDR_DL */
673 circuit
->u
.bc
.adjdb
[0] = list_new ();
674 circuit
->u
.bc
.adjdb
[1] = list_new ();
677 * ISO 10589 - 8.4.1 Enabling of broadcast circuits
680 /* initilizing the hello sending threads
684 /* 8.4.1 a) commence sending of IIH PDUs */
686 if (circuit
->is_type
& IS_LEVEL_1
)
688 thread_add_event (master
, send_lan_l1_hello
, circuit
, 0);
689 circuit
->u
.bc
.lan_neighs
[0] = list_new ();
692 if (circuit
->is_type
& IS_LEVEL_2
)
694 thread_add_event (master
, send_lan_l2_hello
, circuit
, 0);
695 circuit
->u
.bc
.lan_neighs
[1] = list_new ();
698 /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */
699 /* 8.4.1 c) FIXME: listen for ESH PDUs */
702 /* dr election will commence in... */
703 if (circuit
->is_type
& IS_LEVEL_1
)
704 THREAD_TIMER_ON (master
, circuit
->u
.bc
.t_run_dr
[0], isis_run_dr_l1
,
705 circuit
, 2 * circuit
->hello_interval
[0]);
706 if (circuit
->is_type
& IS_LEVEL_2
)
707 THREAD_TIMER_ON (master
, circuit
->u
.bc
.t_run_dr
[1], isis_run_dr_l2
,
708 circuit
, 2 * circuit
->hello_interval
[1]);
712 /* initializing the hello send threads
715 circuit
->u
.p2p
.neighbor
= NULL
;
716 thread_add_event (master
, send_p2p_hello
, circuit
, 0);
719 /* initializing PSNP timers */
720 if (circuit
->is_type
& IS_LEVEL_1
)
721 THREAD_TIMER_ON (master
, circuit
->t_send_psnp
[0], send_l1_psnp
, circuit
,
722 isis_jitter (circuit
->psnp_interval
[0], PSNP_JITTER
));
724 if (circuit
->is_type
& IS_LEVEL_2
)
725 THREAD_TIMER_ON (master
, circuit
->t_send_psnp
[1], send_l2_psnp
, circuit
,
726 isis_jitter (circuit
->psnp_interval
[1], PSNP_JITTER
));
728 /* unified init for circuits; ignore warnings below this level */
729 retv
= isis_sock_init (circuit
);
732 isis_circuit_down (circuit
);
736 /* initialize the circuit streams after opening connection */
737 isis_circuit_stream(circuit
, &circuit
->rcv_stream
);
738 isis_circuit_stream(circuit
, &circuit
->snd_stream
);
741 THREAD_READ_ON (master
, circuit
->t_read
, isis_receive
, circuit
,
744 THREAD_TIMER_ON (master
, circuit
->t_read
, isis_receive
, circuit
,
748 circuit
->lsp_queue
= list_new ();
749 circuit
->lsp_queue_last_cleared
= time (NULL
);
755 isis_circuit_down (struct isis_circuit
*circuit
)
757 if (circuit
->state
!= C_STATE_UP
)
760 /* Clear the flags for all the lsps of the circuit. */
761 isis_circuit_update_all_srmflags (circuit
, 0);
763 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
)
765 /* destroy neighbour lists */
766 if (circuit
->u
.bc
.lan_neighs
[0])
768 list_delete (circuit
->u
.bc
.lan_neighs
[0]);
769 circuit
->u
.bc
.lan_neighs
[0] = NULL
;
771 if (circuit
->u
.bc
.lan_neighs
[1])
773 list_delete (circuit
->u
.bc
.lan_neighs
[1]);
774 circuit
->u
.bc
.lan_neighs
[1] = NULL
;
776 /* destroy adjacency databases */
777 if (circuit
->u
.bc
.adjdb
[0])
779 circuit
->u
.bc
.adjdb
[0]->del
= isis_delete_adj
;
780 list_delete (circuit
->u
.bc
.adjdb
[0]);
781 circuit
->u
.bc
.adjdb
[0] = NULL
;
783 if (circuit
->u
.bc
.adjdb
[1])
785 circuit
->u
.bc
.adjdb
[1]->del
= isis_delete_adj
;
786 list_delete (circuit
->u
.bc
.adjdb
[1]);
787 circuit
->u
.bc
.adjdb
[1] = NULL
;
789 if (circuit
->u
.bc
.is_dr
[0])
791 isis_dr_resign (circuit
, 1);
792 circuit
->u
.bc
.is_dr
[0] = 0;
794 memset (circuit
->u
.bc
.l1_desig_is
, 0, ISIS_SYS_ID_LEN
+ 1);
795 if (circuit
->u
.bc
.is_dr
[1])
797 isis_dr_resign (circuit
, 2);
798 circuit
->u
.bc
.is_dr
[1] = 0;
800 memset (circuit
->u
.bc
.l2_desig_is
, 0, ISIS_SYS_ID_LEN
+ 1);
801 memset (circuit
->u
.bc
.snpa
, 0, ETH_ALEN
);
803 THREAD_TIMER_OFF (circuit
->u
.bc
.t_send_lan_hello
[0]);
804 THREAD_TIMER_OFF (circuit
->u
.bc
.t_send_lan_hello
[1]);
805 THREAD_TIMER_OFF (circuit
->u
.bc
.t_run_dr
[0]);
806 THREAD_TIMER_OFF (circuit
->u
.bc
.t_run_dr
[1]);
807 THREAD_TIMER_OFF (circuit
->u
.bc
.t_refresh_pseudo_lsp
[0]);
808 THREAD_TIMER_OFF (circuit
->u
.bc
.t_refresh_pseudo_lsp
[1]);
809 circuit
->lsp_regenerate_pending
[0] = 0;
810 circuit
->lsp_regenerate_pending
[1] = 0;
812 else if (circuit
->circ_type
== CIRCUIT_T_P2P
)
814 isis_delete_adj (circuit
->u
.p2p
.neighbor
);
815 circuit
->u
.p2p
.neighbor
= NULL
;
816 THREAD_TIMER_OFF (circuit
->u
.p2p
.t_send_p2p_hello
);
819 /* Cancel all active threads */
820 THREAD_TIMER_OFF (circuit
->t_send_csnp
[0]);
821 THREAD_TIMER_OFF (circuit
->t_send_csnp
[1]);
822 THREAD_TIMER_OFF (circuit
->t_send_psnp
[0]);
823 THREAD_TIMER_OFF (circuit
->t_send_psnp
[1]);
824 THREAD_OFF (circuit
->t_read
);
826 if (circuit
->lsp_queue
)
828 circuit
->lsp_queue
->del
= NULL
;
829 list_delete (circuit
->lsp_queue
);
830 circuit
->lsp_queue
= NULL
;
833 /* send one gratuitous hello to spead up convergence */
834 if (circuit
->is_type
& IS_LEVEL_1
)
835 send_hello (circuit
, IS_LEVEL_1
);
836 if (circuit
->is_type
& IS_LEVEL_2
)
837 send_hello (circuit
, IS_LEVEL_2
);
839 circuit
->upadjcount
[0] = 0;
840 circuit
->upadjcount
[1] = 0;
842 /* close the socket */
849 if (circuit
->rcv_stream
!= NULL
)
851 stream_free (circuit
->rcv_stream
);
852 circuit
->rcv_stream
= NULL
;
855 if (circuit
->snd_stream
!= NULL
)
857 stream_free (circuit
->snd_stream
);
858 circuit
->snd_stream
= NULL
;
861 thread_cancel_event (master
, circuit
);
867 circuit_update_nlpids (struct isis_circuit
*circuit
)
869 circuit
->nlpids
.count
= 0;
871 if (circuit
->ip_router
)
873 circuit
->nlpids
.nlpids
[0] = NLPID_IP
;
874 circuit
->nlpids
.count
++;
877 if (circuit
->ipv6_router
)
879 circuit
->nlpids
.nlpids
[circuit
->nlpids
.count
] = NLPID_IPV6
;
880 circuit
->nlpids
.count
++;
882 #endif /* HAVE_IPV6 */
887 isis_circuit_print_vty (struct isis_circuit
*circuit
, struct vty
*vty
,
890 if (detail
== ISIS_UI_LEVEL_BRIEF
)
892 vty_out (vty
, " %-12s", circuit
->interface
->name
);
893 vty_out (vty
, "0x%-7x", circuit
->circuit_id
);
894 vty_out (vty
, "%-9s", circuit_state2string (circuit
->state
));
895 vty_out (vty
, "%-9s", circuit_type2string (circuit
->circ_type
));
896 vty_out (vty
, "%-9s", circuit_t2string (circuit
->is_type
));
897 vty_out (vty
, "%s", VTY_NEWLINE
);
900 if (detail
== ISIS_UI_LEVEL_DETAIL
)
902 struct listnode
*node
;
903 struct prefix
*ip_addr
;
906 vty_out (vty
, " Interface: %s", circuit
->interface
->name
);
907 vty_out (vty
, ", State: %s", circuit_state2string (circuit
->state
));
908 if (circuit
->is_passive
)
909 vty_out (vty
, ", Passive");
911 vty_out (vty
, ", Active");
912 vty_out (vty
, ", Circuit Id: 0x%x", circuit
->circuit_id
);
913 vty_out (vty
, "%s", VTY_NEWLINE
);
914 vty_out (vty
, " Type: %s", circuit_type2string (circuit
->circ_type
));
915 vty_out (vty
, ", Level: %s", circuit_t2string (circuit
->is_type
));
916 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
)
917 vty_out (vty
, ", SNPA: %-10s", snpa_print (circuit
->u
.bc
.snpa
));
918 vty_out (vty
, "%s", VTY_NEWLINE
);
919 if (circuit
->is_type
& IS_LEVEL_1
)
921 vty_out (vty
, " Level-1 Information:%s", VTY_NEWLINE
);
922 if (circuit
->area
->newmetric
)
923 vty_out (vty
, " Metric: %d", circuit
->te_metric
[0]);
925 vty_out (vty
, " Metric: %d",
926 circuit
->metrics
[0].metric_default
);
927 if (!circuit
->is_passive
)
929 vty_out (vty
, ", Active neighbors: %u%s",
930 circuit
->upadjcount
[0], VTY_NEWLINE
);
931 vty_out (vty
, " Hello interval: %u, "
932 "Holddown count: %u %s%s",
933 circuit
->hello_interval
[0],
934 circuit
->hello_multiplier
[0],
935 (circuit
->pad_hellos
? "(pad)" : "(no-pad)"),
937 vty_out (vty
, " CNSP interval: %u, "
938 "PSNP interval: %u%s",
939 circuit
->csnp_interval
[0],
940 circuit
->psnp_interval
[0], VTY_NEWLINE
);
941 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
)
942 vty_out (vty
, " LAN Priority: %u, %s%s",
943 circuit
->priority
[0],
944 (circuit
->u
.bc
.is_dr
[0] ? \
945 "is DIS" : "is not DIS"), VTY_NEWLINE
);
949 vty_out (vty
, "%s", VTY_NEWLINE
);
952 if (circuit
->is_type
& IS_LEVEL_2
)
954 vty_out (vty
, " Level-2 Information:%s", VTY_NEWLINE
);
955 if (circuit
->area
->newmetric
)
956 vty_out (vty
, " Metric: %d", circuit
->te_metric
[1]);
958 vty_out (vty
, " Metric: %d",
959 circuit
->metrics
[1].metric_default
);
960 if (!circuit
->is_passive
)
962 vty_out (vty
, ", Active neighbors: %u%s",
963 circuit
->upadjcount
[1], VTY_NEWLINE
);
964 vty_out (vty
, " Hello interval: %u, "
965 "Holddown count: %u %s%s",
966 circuit
->hello_interval
[1],
967 circuit
->hello_multiplier
[1],
968 (circuit
->pad_hellos
? "(pad)" : "(no-pad)"),
970 vty_out (vty
, " CNSP interval: %u, "
971 "PSNP interval: %u%s",
972 circuit
->csnp_interval
[1],
973 circuit
->psnp_interval
[1], VTY_NEWLINE
);
974 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
)
975 vty_out (vty
, " LAN Priority: %u, %s%s",
976 circuit
->priority
[1],
977 (circuit
->u
.bc
.is_dr
[1] ? \
978 "is DIS" : "is not DIS"), VTY_NEWLINE
);
982 vty_out (vty
, "%s", VTY_NEWLINE
);
985 if (circuit
->ip_addrs
&& listcount (circuit
->ip_addrs
) > 0)
987 vty_out (vty
, " IP Prefix(es):%s", VTY_NEWLINE
);
988 for (ALL_LIST_ELEMENTS_RO (circuit
->ip_addrs
, node
, ip_addr
))
990 prefix2str (ip_addr
, buf
, sizeof (buf
)),
991 vty_out (vty
, " %s%s", buf
, VTY_NEWLINE
);
994 if (circuit
->ipv6_link
&& listcount(circuit
->ipv6_link
) > 0)
996 vty_out(vty
, " IPv6 Link-Locals:%s", VTY_NEWLINE
);
997 for (ALL_LIST_ELEMENTS_RO(circuit
->ipv6_link
, node
, ip_addr
))
999 prefix2str(ip_addr
, (char*)buf
, BUFSIZ
),
1000 vty_out(vty
, " %s%s", buf
, VTY_NEWLINE
);
1003 if (circuit
->ipv6_link
&& listcount(circuit
->ipv6_non_link
) > 0)
1005 vty_out(vty
, " IPv6 Prefixes:%s", VTY_NEWLINE
);
1006 for (ALL_LIST_ELEMENTS_RO(circuit
->ipv6_non_link
, node
, ip_addr
))
1008 prefix2str(ip_addr
, (char*)buf
, BUFSIZ
),
1009 vty_out(vty
, " %s%s", buf
, VTY_NEWLINE
);
1013 vty_out (vty
, "%s", VTY_NEWLINE
);
1019 isis_interface_config_write (struct vty
*vty
)
1022 struct listnode
*node
, *node2
;
1023 struct interface
*ifp
;
1024 struct isis_area
*area
;
1025 struct isis_circuit
*circuit
;
1028 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
))
1030 if (ifp
->ifindex
== IFINDEX_DELETED
)
1034 vty_out (vty
, "interface %s%s", ifp
->name
, VTY_NEWLINE
);
1039 vty_out (vty
, " description %s%s", ifp
->desc
, VTY_NEWLINE
);
1043 for (ALL_LIST_ELEMENTS_RO (isis
->area_list
, node2
, area
))
1045 circuit
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
1046 if (circuit
== NULL
)
1048 if (circuit
->ip_router
)
1050 vty_out (vty
, " ip router isis %s%s", area
->area_tag
,
1054 if (circuit
->is_passive
)
1056 vty_out (vty
, " isis passive%s", VTY_NEWLINE
);
1059 if (circuit
->circ_type_config
== CIRCUIT_T_P2P
)
1061 vty_out (vty
, " isis network point-to-point%s", VTY_NEWLINE
);
1065 if (circuit
->ipv6_router
)
1067 vty_out (vty
, " ipv6 router isis %s%s", area
->area_tag
,
1071 #endif /* HAVE_IPV6 */
1073 /* ISIS - circuit type */
1074 if (circuit
->is_type
== IS_LEVEL_1
)
1076 vty_out (vty
, " isis circuit-type level-1%s", VTY_NEWLINE
);
1081 if (circuit
->is_type
== IS_LEVEL_2
)
1083 vty_out (vty
, " isis circuit-type level-2-only%s",
1089 /* ISIS - CSNP interval */
1090 if (circuit
->csnp_interval
[0] == circuit
->csnp_interval
[1])
1092 if (circuit
->csnp_interval
[0] != DEFAULT_CSNP_INTERVAL
)
1094 vty_out (vty
, " isis csnp-interval %d%s",
1095 circuit
->csnp_interval
[0], VTY_NEWLINE
);
1101 for (i
= 0; i
< 2; i
++)
1103 if (circuit
->csnp_interval
[i
] != DEFAULT_CSNP_INTERVAL
)
1105 vty_out (vty
, " isis csnp-interval %d level-%d%s",
1106 circuit
->csnp_interval
[i
], i
+ 1, VTY_NEWLINE
);
1112 /* ISIS - PSNP interval */
1113 if (circuit
->psnp_interval
[0] == circuit
->psnp_interval
[1])
1115 if (circuit
->psnp_interval
[0] != DEFAULT_PSNP_INTERVAL
)
1117 vty_out (vty
, " isis psnp-interval %d%s",
1118 circuit
->psnp_interval
[0], VTY_NEWLINE
);
1124 for (i
= 0; i
< 2; i
++)
1126 if (circuit
->psnp_interval
[i
] != DEFAULT_PSNP_INTERVAL
)
1128 vty_out (vty
, " isis psnp-interval %d level-%d%s",
1129 circuit
->psnp_interval
[i
], i
+ 1, VTY_NEWLINE
);
1135 /* ISIS - Hello padding - Defaults to true so only display if false */
1136 if (circuit
->pad_hellos
== 0)
1138 vty_out (vty
, " no isis hello padding%s", VTY_NEWLINE
);
1142 /* ISIS - Hello interval */
1143 if (circuit
->hello_interval
[0] == circuit
->hello_interval
[1])
1145 if (circuit
->hello_interval
[0] != DEFAULT_HELLO_INTERVAL
)
1147 vty_out (vty
, " isis hello-interval %d%s",
1148 circuit
->hello_interval
[0], VTY_NEWLINE
);
1154 for (i
= 0; i
< 2; i
++)
1156 if (circuit
->hello_interval
[i
] != DEFAULT_HELLO_INTERVAL
)
1158 vty_out (vty
, " isis hello-interval %d level-%d%s",
1159 circuit
->hello_interval
[i
], i
+ 1, VTY_NEWLINE
);
1165 /* ISIS - Hello Multiplier */
1166 if (circuit
->hello_multiplier
[0] == circuit
->hello_multiplier
[1])
1168 if (circuit
->hello_multiplier
[0] != DEFAULT_HELLO_MULTIPLIER
)
1170 vty_out (vty
, " isis hello-multiplier %d%s",
1171 circuit
->hello_multiplier
[0], VTY_NEWLINE
);
1177 for (i
= 0; i
< 2; i
++)
1179 if (circuit
->hello_multiplier
[i
] != DEFAULT_HELLO_MULTIPLIER
)
1181 vty_out (vty
, " isis hello-multiplier %d level-%d%s",
1182 circuit
->hello_multiplier
[i
], i
+ 1,
1189 /* ISIS - Priority */
1190 if (circuit
->priority
[0] == circuit
->priority
[1])
1192 if (circuit
->priority
[0] != DEFAULT_PRIORITY
)
1194 vty_out (vty
, " isis priority %d%s",
1195 circuit
->priority
[0], VTY_NEWLINE
);
1201 for (i
= 0; i
< 2; i
++)
1203 if (circuit
->priority
[i
] != DEFAULT_PRIORITY
)
1205 vty_out (vty
, " isis priority %d level-%d%s",
1206 circuit
->priority
[i
], i
+ 1, VTY_NEWLINE
);
1213 if (circuit
->te_metric
[0] == circuit
->te_metric
[1])
1215 if (circuit
->te_metric
[0] != DEFAULT_CIRCUIT_METRIC
)
1217 vty_out (vty
, " isis metric %d%s", circuit
->te_metric
[0],
1224 for (i
= 0; i
< 2; i
++)
1226 if (circuit
->te_metric
[i
] != DEFAULT_CIRCUIT_METRIC
)
1228 vty_out (vty
, " isis metric %d level-%d%s",
1229 circuit
->te_metric
[i
], i
+ 1, VTY_NEWLINE
);
1234 if (circuit
->passwd
.type
== ISIS_PASSWD_TYPE_HMAC_MD5
)
1236 vty_out (vty
, " isis password md5 %s%s", circuit
->passwd
.passwd
,
1240 else if (circuit
->passwd
.type
== ISIS_PASSWD_TYPE_CLEARTXT
)
1242 vty_out (vty
, " isis password clear %s%s", circuit
->passwd
.passwd
,
1247 vty_out (vty
, "!%s", VTY_NEWLINE
);
1253 DEFUN (ip_router_isis
,
1255 "ip router isis WORD",
1256 "Interface Internet Protocol config commands\n"
1257 "IP router interface commands\n"
1258 "IS-IS Routing for IP\n"
1259 "Routing process tag\n")
1261 struct isis_circuit
*circuit
;
1262 struct interface
*ifp
;
1263 struct isis_area
*area
;
1266 ifp
= (struct interface
*) vty
->index
;
1269 /* Prevent more than one area per circuit */
1270 circuit
= circuit_scan_by_ifp (ifp
);
1273 if (circuit
->ip_router
== 1)
1275 if (strcmp (circuit
->area
->area_tag
, argv
[0]))
1277 vty_out (vty
, "ISIS circuit is already defined on %s%s",
1278 circuit
->area
->area_tag
, VTY_NEWLINE
);
1279 return CMD_ERR_NOTHING_TODO
;
1285 if (isis_area_get (vty
, argv
[0]) != CMD_SUCCESS
)
1287 vty_out (vty
, "Can't find ISIS instance %s", VTY_NEWLINE
);
1288 return CMD_ERR_NO_MATCH
;
1292 circuit
= isis_csm_state_change (ISIS_ENABLE
, circuit
, area
);
1293 if (circuit
->state
!= C_STATE_CONF
&& circuit
->state
!= C_STATE_UP
)
1295 vty_out(vty
, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE
);
1300 isis_circuit_if_bind (circuit
, ifp
);
1302 circuit
->ip_router
= 1;
1303 area
->ip_circuits
++;
1304 circuit_update_nlpids (circuit
);
1308 vty
->node
= INTERFACE_NODE
;
1311 if (circuit
->ipv6_router
)
1312 lsp_regenerate_schedule(circuit
->area
, circuit
->is_type
, 0);
1316 DEFUN (no_ip_router_isis
,
1317 no_ip_router_isis_cmd
,
1318 "no ip router isis WORD",
1320 "Interface Internet Protocol config commands\n"
1321 "IP router interface commands\n"
1322 "IS-IS Routing for IP\n"
1323 "Routing process tag\n")
1325 struct interface
*ifp
;
1326 struct isis_area
*area
;
1327 struct isis_circuit
*circuit
;
1329 ifp
= (struct interface
*) vty
->index
;
1332 vty_out (vty
, "Invalid interface %s", VTY_NEWLINE
);
1333 return CMD_ERR_NO_MATCH
;
1336 area
= isis_area_lookup (argv
[0]);
1339 vty_out (vty
, "Can't find ISIS instance %s%s",
1340 argv
[0], VTY_NEWLINE
);
1341 return CMD_ERR_NO_MATCH
;
1344 circuit
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
1347 vty_out (vty
, "ISIS is not enabled on circuit %s%s",
1348 ifp
->name
, VTY_NEWLINE
);
1349 return CMD_ERR_NO_MATCH
;
1352 circuit
->ip_router
= 0;
1353 area
->ip_circuits
--;
1354 if (circuit
->ipv6_router
== 0)
1355 isis_csm_state_change (ISIS_DISABLE
, circuit
, area
);
1357 lsp_regenerate_schedule(area
, circuit
->is_type
, 0);
1363 DEFUN (ipv6_router_isis
,
1364 ipv6_router_isis_cmd
,
1365 "ipv6 router isis WORD",
1366 "IPv6 interface subcommands\n"
1367 "IPv6 Router interface commands\n"
1368 "IS-IS Routing for IPv6\n"
1369 "Routing process tag\n")
1371 struct isis_circuit
*circuit
;
1372 struct interface
*ifp
;
1373 struct isis_area
*area
;
1376 ifp
= (struct interface
*) vty
->index
;
1379 /* Prevent more than one area per circuit */
1380 circuit
= circuit_scan_by_ifp (ifp
);
1383 if (circuit
->ipv6_router
== 1)
1385 if (strcmp (circuit
->area
->area_tag
, argv
[0]))
1387 vty_out (vty
, "ISIS circuit is already defined for IPv6 on %s%s",
1388 circuit
->area
->area_tag
, VTY_NEWLINE
);
1389 return CMD_ERR_NOTHING_TODO
;
1395 if (isis_area_get (vty
, argv
[0]) != CMD_SUCCESS
)
1397 vty_out (vty
, "Can't find ISIS instance %s", VTY_NEWLINE
);
1398 return CMD_ERR_NO_MATCH
;
1402 circuit
= isis_csm_state_change (ISIS_ENABLE
, circuit
, area
);
1403 if (circuit
->state
!= C_STATE_CONF
&& circuit
->state
!= C_STATE_UP
)
1405 vty_out(vty
, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE
);
1410 isis_circuit_if_bind (circuit
, ifp
);
1412 circuit
->ipv6_router
= 1;
1413 area
->ipv6_circuits
++;
1414 circuit_update_nlpids (circuit
);
1418 vty
->node
= INTERFACE_NODE
;
1421 if (circuit
->ip_router
)
1422 lsp_regenerate_schedule(circuit
->area
, circuit
->is_type
, 0);
1426 DEFUN (no_ipv6_router_isis
,
1427 no_ipv6_router_isis_cmd
,
1428 "no ipv6 router isis WORD",
1430 "IPv6 interface subcommands\n"
1431 "IPv6 Router interface commands\n"
1432 "IS-IS Routing for IPv6\n"
1433 "Routing process tag\n")
1435 struct interface
*ifp
;
1436 struct isis_area
*area
;
1437 struct isis_circuit
*circuit
;
1439 ifp
= (struct interface
*) vty
->index
;
1442 vty_out (vty
, "Invalid interface %s", VTY_NEWLINE
);
1443 return CMD_ERR_NO_MATCH
;
1446 area
= isis_area_lookup (argv
[0]);
1449 vty_out (vty
, "Can't find ISIS instance %s%s",
1450 argv
[0], VTY_NEWLINE
);
1451 return CMD_ERR_NO_MATCH
;
1454 circuit
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
1457 vty_out (vty
, "ISIS is not enabled on circuit %s%s",
1458 ifp
->name
, VTY_NEWLINE
);
1459 return CMD_ERR_NO_MATCH
;
1462 circuit
->ipv6_router
= 0;
1463 area
->ipv6_circuits
--;
1464 if (circuit
->ip_router
== 0)
1465 isis_csm_state_change (ISIS_DISABLE
, circuit
, area
);
1467 lsp_regenerate_schedule(area
, circuit
->is_type
, 0);
1471 #endif /* HAVE_IPV6 */
1473 DEFUN (isis_passive
,
1477 "Configure the passive mode for interface\n")
1479 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1481 return CMD_ERR_NO_MATCH
;
1483 if (circuit
->is_passive
== 1)
1486 if (circuit
->state
!= C_STATE_UP
)
1488 circuit
->is_passive
= 1;
1492 struct isis_area
*area
= circuit
->area
;
1493 isis_csm_state_change (ISIS_DISABLE
, circuit
, area
);
1494 circuit
->is_passive
= 1;
1495 isis_csm_state_change (ISIS_ENABLE
, circuit
, area
);
1501 DEFUN (no_isis_passive
,
1502 no_isis_passive_cmd
,
1506 "Configure the passive mode for interface\n")
1508 struct interface
*ifp
;
1509 struct isis_circuit
*circuit
;
1511 ifp
= (struct interface
*) vty
->index
;
1514 vty_out (vty
, "Invalid interface %s", VTY_NEWLINE
);
1515 return CMD_ERR_NO_MATCH
;
1518 /* FIXME: what is wrong with circuit = ifp->info ? */
1519 circuit
= circuit_scan_by_ifp (ifp
);
1522 vty_out (vty
, "ISIS is not enabled on circuit %s%s",
1523 ifp
->name
, VTY_NEWLINE
);
1524 return CMD_ERR_NO_MATCH
;
1527 if (if_is_loopback(ifp
))
1529 vty_out (vty
, "Can't set no passive for loopback interface%s",
1531 return CMD_ERR_AMBIGUOUS
;
1534 if (circuit
->is_passive
== 0)
1537 if (circuit
->state
!= C_STATE_UP
)
1539 circuit
->is_passive
= 0;
1543 struct isis_area
*area
= circuit
->area
;
1544 isis_csm_state_change (ISIS_DISABLE
, circuit
, area
);
1545 circuit
->is_passive
= 0;
1546 isis_csm_state_change (ISIS_ENABLE
, circuit
, area
);
1552 DEFUN (isis_circuit_type
,
1553 isis_circuit_type_cmd
,
1554 "isis circuit-type (level-1|level-1-2|level-2-only)",
1556 "Configure circuit type for interface\n"
1557 "Level-1 only adjacencies are formed\n"
1558 "Level-1-2 adjacencies are formed\n"
1559 "Level-2 only adjacencies are formed\n")
1562 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1564 return CMD_ERR_NO_MATCH
;
1566 circuit_type
= string2circuit_t (argv
[0]);
1569 vty_out (vty
, "Unknown circuit-type %s", VTY_NEWLINE
);
1570 return CMD_ERR_AMBIGUOUS
;
1573 if (circuit
->state
== C_STATE_UP
&&
1574 circuit
->area
->is_type
!= IS_LEVEL_1_AND_2
&&
1575 circuit
->area
->is_type
!= circuit_type
)
1577 vty_out (vty
, "Invalid circuit level for area %s.%s",
1578 circuit
->area
->area_tag
, VTY_NEWLINE
);
1579 return CMD_ERR_AMBIGUOUS
;
1581 isis_event_circuit_type_change (circuit
, circuit_type
);
1586 DEFUN (no_isis_circuit_type
,
1587 no_isis_circuit_type_cmd
,
1588 "no isis circuit-type (level-1|level-1-2|level-2-only)",
1591 "Configure circuit type for interface\n"
1592 "Level-1 only adjacencies are formed\n"
1593 "Level-1-2 adjacencies are formed\n"
1594 "Level-2 only adjacencies are formed\n")
1597 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1599 return CMD_ERR_NO_MATCH
;
1602 * Set the circuits level to its default value
1604 if (circuit
->state
== C_STATE_UP
)
1605 circuit_type
= circuit
->area
->is_type
;
1607 circuit_type
= IS_LEVEL_1_AND_2
;
1608 isis_event_circuit_type_change (circuit
, circuit_type
);
1613 DEFUN (isis_passwd_md5
,
1614 isis_passwd_md5_cmd
,
1615 "isis password md5 WORD",
1617 "Configure the authentication password for a circuit\n"
1618 "Authentication type\n"
1619 "Circuit password\n")
1622 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1624 return CMD_ERR_NO_MATCH
;
1626 len
= strlen (argv
[0]);
1629 vty_out (vty
, "Too long circuit password (>254)%s", VTY_NEWLINE
);
1630 return CMD_ERR_AMBIGUOUS
;
1632 circuit
->passwd
.len
= len
;
1633 circuit
->passwd
.type
= ISIS_PASSWD_TYPE_HMAC_MD5
;
1634 strncpy ((char *)circuit
->passwd
.passwd
, argv
[0], 255);
1639 DEFUN (isis_passwd_clear
,
1640 isis_passwd_clear_cmd
,
1641 "isis password clear WORD",
1643 "Configure the authentication password for a circuit\n"
1644 "Authentication type\n"
1645 "Circuit password\n")
1648 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1650 return CMD_ERR_NO_MATCH
;
1652 len
= strlen (argv
[0]);
1655 vty_out (vty
, "Too long circuit password (>254)%s", VTY_NEWLINE
);
1656 return CMD_ERR_AMBIGUOUS
;
1658 circuit
->passwd
.len
= len
;
1659 circuit
->passwd
.type
= ISIS_PASSWD_TYPE_CLEARTXT
;
1660 strncpy ((char *)circuit
->passwd
.passwd
, argv
[0], 255);
1665 DEFUN (no_isis_passwd
,
1670 "Configure the authentication password for a circuit\n")
1672 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1674 return CMD_ERR_NO_MATCH
;
1676 memset (&circuit
->passwd
, 0, sizeof (struct isis_passwd
));
1681 DEFUN (isis_priority
,
1683 "isis priority <0-127>",
1685 "Set priority for Designated Router election\n"
1689 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1691 return CMD_ERR_NO_MATCH
;
1693 prio
= atoi (argv
[0]);
1694 if (prio
< MIN_PRIORITY
|| prio
> MAX_PRIORITY
)
1696 vty_out (vty
, "Invalid priority %d - should be <0-127>%s",
1698 return CMD_ERR_AMBIGUOUS
;
1701 circuit
->priority
[0] = prio
;
1702 circuit
->priority
[1] = prio
;
1707 DEFUN (no_isis_priority
,
1708 no_isis_priority_cmd
,
1712 "Set priority for Designated Router election\n")
1714 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1716 return CMD_ERR_NO_MATCH
;
1718 circuit
->priority
[0] = DEFAULT_PRIORITY
;
1719 circuit
->priority
[1] = DEFAULT_PRIORITY
;
1724 ALIAS (no_isis_priority
,
1725 no_isis_priority_arg_cmd
,
1726 "no isis priority <0-127>",
1729 "Set priority for Designated Router election\n"
1732 DEFUN (isis_priority_l1
,
1733 isis_priority_l1_cmd
,
1734 "isis priority <0-127> level-1",
1736 "Set priority for Designated Router election\n"
1738 "Specify priority for level-1 routing\n")
1741 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1743 return CMD_ERR_NO_MATCH
;
1745 prio
= atoi (argv
[0]);
1746 if (prio
< MIN_PRIORITY
|| prio
> MAX_PRIORITY
)
1748 vty_out (vty
, "Invalid priority %d - should be <0-127>%s",
1750 return CMD_ERR_AMBIGUOUS
;
1753 circuit
->priority
[0] = prio
;
1758 DEFUN (no_isis_priority_l1
,
1759 no_isis_priority_l1_cmd
,
1760 "no isis priority level-1",
1763 "Set priority for Designated Router election\n"
1764 "Specify priority for level-1 routing\n")
1766 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1768 return CMD_ERR_NO_MATCH
;
1770 circuit
->priority
[0] = DEFAULT_PRIORITY
;
1775 ALIAS (no_isis_priority_l1
,
1776 no_isis_priority_l1_arg_cmd
,
1777 "no isis priority <0-127> level-1",
1780 "Set priority for Designated Router election\n"
1782 "Specify priority for level-1 routing\n")
1784 DEFUN (isis_priority_l2
,
1785 isis_priority_l2_cmd
,
1786 "isis priority <0-127> level-2",
1788 "Set priority for Designated Router election\n"
1790 "Specify priority for level-2 routing\n")
1793 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1795 return CMD_ERR_NO_MATCH
;
1797 prio
= atoi (argv
[0]);
1798 if (prio
< MIN_PRIORITY
|| prio
> MAX_PRIORITY
)
1800 vty_out (vty
, "Invalid priority %d - should be <0-127>%s",
1802 return CMD_ERR_AMBIGUOUS
;
1805 circuit
->priority
[1] = prio
;
1810 DEFUN (no_isis_priority_l2
,
1811 no_isis_priority_l2_cmd
,
1812 "no isis priority level-2",
1815 "Set priority for Designated Router election\n"
1816 "Specify priority for level-2 routing\n")
1818 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1820 return CMD_ERR_NO_MATCH
;
1822 circuit
->priority
[1] = DEFAULT_PRIORITY
;
1827 ALIAS (no_isis_priority_l2
,
1828 no_isis_priority_l2_arg_cmd
,
1829 "no isis priority <0-127> level-2",
1832 "Set priority for Designated Router election\n"
1834 "Specify priority for level-2 routing\n")
1836 /* Metric command */
1839 "isis metric <0-16777215>",
1841 "Set default metric for circuit\n"
1842 "Default metric value\n")
1845 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1847 return CMD_ERR_NO_MATCH
;
1849 met
= atoi (argv
[0]);
1851 /* RFC3787 section 5.1 */
1852 if (circuit
->area
&& circuit
->area
->oldmetric
== 1 &&
1853 met
> MAX_NARROW_LINK_METRIC
)
1855 vty_out (vty
, "Invalid metric %d - should be <0-63> "
1856 "when narrow metric type enabled%s",
1858 return CMD_ERR_AMBIGUOUS
;
1862 if (circuit
->area
&& circuit
->area
->newmetric
== 1 &&
1863 met
> MAX_WIDE_LINK_METRIC
)
1865 vty_out (vty
, "Invalid metric %d - should be <0-16777215> "
1866 "when wide metric type enabled%s",
1868 return CMD_ERR_AMBIGUOUS
;
1871 circuit
->te_metric
[0] = met
;
1872 circuit
->te_metric
[1] = met
;
1874 circuit
->metrics
[0].metric_default
= met
;
1875 circuit
->metrics
[1].metric_default
= met
;
1878 lsp_regenerate_schedule (circuit
->area
, circuit
->is_type
, 0);
1883 DEFUN (no_isis_metric
,
1888 "Set default metric for circuit\n")
1890 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1892 return CMD_ERR_NO_MATCH
;
1894 circuit
->te_metric
[0] = DEFAULT_CIRCUIT_METRIC
;
1895 circuit
->te_metric
[1] = DEFAULT_CIRCUIT_METRIC
;
1896 circuit
->metrics
[0].metric_default
= DEFAULT_CIRCUIT_METRIC
;
1897 circuit
->metrics
[1].metric_default
= DEFAULT_CIRCUIT_METRIC
;
1900 lsp_regenerate_schedule (circuit
->area
, circuit
->is_type
, 0);
1905 ALIAS (no_isis_metric
,
1906 no_isis_metric_arg_cmd
,
1907 "no isis metric <0-16777215>",
1910 "Set default metric for circuit\n"
1911 "Default metric value\n")
1913 DEFUN (isis_metric_l1
,
1915 "isis metric <0-16777215> level-1",
1917 "Set default metric for circuit\n"
1918 "Default metric value\n"
1919 "Specify metric for level-1 routing\n")
1922 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1924 return CMD_ERR_NO_MATCH
;
1926 met
= atoi (argv
[0]);
1928 /* RFC3787 section 5.1 */
1929 if (circuit
->area
&& circuit
->area
->oldmetric
== 1 &&
1930 met
> MAX_NARROW_LINK_METRIC
)
1932 vty_out (vty
, "Invalid metric %d - should be <0-63> "
1933 "when narrow metric type enabled%s",
1935 return CMD_ERR_AMBIGUOUS
;
1939 if (circuit
->area
&& circuit
->area
->newmetric
== 1 &&
1940 met
> MAX_WIDE_LINK_METRIC
)
1942 vty_out (vty
, "Invalid metric %d - should be <0-16777215> "
1943 "when wide metric type enabled%s",
1945 return CMD_ERR_AMBIGUOUS
;
1948 circuit
->te_metric
[0] = met
;
1949 circuit
->metrics
[0].metric_default
= met
;
1952 lsp_regenerate_schedule (circuit
->area
, IS_LEVEL_1
, 0);
1957 DEFUN (no_isis_metric_l1
,
1958 no_isis_metric_l1_cmd
,
1959 "no isis metric level-1",
1962 "Set default metric for circuit\n"
1963 "Specify metric for level-1 routing\n")
1965 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1967 return CMD_ERR_NO_MATCH
;
1969 circuit
->te_metric
[0] = DEFAULT_CIRCUIT_METRIC
;
1970 circuit
->metrics
[0].metric_default
= DEFAULT_CIRCUIT_METRIC
;
1973 lsp_regenerate_schedule (circuit
->area
, IS_LEVEL_1
, 0);
1978 ALIAS (no_isis_metric_l1
,
1979 no_isis_metric_l1_arg_cmd
,
1980 "no isis metric <0-16777215> level-1",
1983 "Set default metric for circuit\n"
1984 "Default metric value\n"
1985 "Specify metric for level-1 routing\n")
1987 DEFUN (isis_metric_l2
,
1989 "isis metric <0-16777215> level-2",
1991 "Set default metric for circuit\n"
1992 "Default metric value\n"
1993 "Specify metric for level-2 routing\n")
1996 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1998 return CMD_ERR_NO_MATCH
;
2000 met
= atoi (argv
[0]);
2002 /* RFC3787 section 5.1 */
2003 if (circuit
->area
&& circuit
->area
->oldmetric
== 1 &&
2004 met
> MAX_NARROW_LINK_METRIC
)
2006 vty_out (vty
, "Invalid metric %d - should be <0-63> "
2007 "when narrow metric type enabled%s",
2009 return CMD_ERR_AMBIGUOUS
;
2013 if (circuit
->area
&& circuit
->area
->newmetric
== 1 &&
2014 met
> MAX_WIDE_LINK_METRIC
)
2016 vty_out (vty
, "Invalid metric %d - should be <0-16777215> "
2017 "when wide metric type enabled%s",
2019 return CMD_ERR_AMBIGUOUS
;
2022 circuit
->te_metric
[1] = met
;
2023 circuit
->metrics
[1].metric_default
= met
;
2026 lsp_regenerate_schedule (circuit
->area
, IS_LEVEL_2
, 0);
2031 DEFUN (no_isis_metric_l2
,
2032 no_isis_metric_l2_cmd
,
2033 "no isis metric level-2",
2036 "Set default metric for circuit\n"
2037 "Specify metric for level-2 routing\n")
2039 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2041 return CMD_ERR_NO_MATCH
;
2043 circuit
->te_metric
[1] = DEFAULT_CIRCUIT_METRIC
;
2044 circuit
->metrics
[1].metric_default
= DEFAULT_CIRCUIT_METRIC
;
2047 lsp_regenerate_schedule (circuit
->area
, IS_LEVEL_2
, 0);
2052 ALIAS (no_isis_metric_l2
,
2053 no_isis_metric_l2_arg_cmd
,
2054 "no isis metric <0-16777215> level-2",
2057 "Set default metric for circuit\n"
2058 "Default metric value\n"
2059 "Specify metric for level-2 routing\n")
2060 /* end of metrics */
2062 DEFUN (isis_hello_interval
,
2063 isis_hello_interval_cmd
,
2064 "isis hello-interval <1-600>",
2066 "Set Hello interval\n"
2067 "Hello interval value\n"
2068 "Holdtime 1 seconds, interval depends on multiplier\n")
2071 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2073 return CMD_ERR_NO_MATCH
;
2075 interval
= atoi (argv
[0]);
2076 if (interval
< MIN_HELLO_INTERVAL
|| interval
> MAX_HELLO_INTERVAL
)
2078 vty_out (vty
, "Invalid hello-interval %d - should be <1-600>%s",
2079 interval
, VTY_NEWLINE
);
2080 return CMD_ERR_AMBIGUOUS
;
2083 circuit
->hello_interval
[0] = (u_int16_t
) interval
;
2084 circuit
->hello_interval
[1] = (u_int16_t
) interval
;
2089 DEFUN (no_isis_hello_interval
,
2090 no_isis_hello_interval_cmd
,
2091 "no isis hello-interval",
2094 "Set Hello interval\n")
2096 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2098 return CMD_ERR_NO_MATCH
;
2100 circuit
->hello_interval
[0] = DEFAULT_HELLO_INTERVAL
;
2101 circuit
->hello_interval
[1] = DEFAULT_HELLO_INTERVAL
;
2106 ALIAS (no_isis_hello_interval
,
2107 no_isis_hello_interval_arg_cmd
,
2108 "no isis hello-interval <1-600>",
2111 "Set Hello interval\n"
2112 "Hello interval value\n"
2113 "Holdtime 1 second, interval depends on multiplier\n")
2115 DEFUN (isis_hello_interval_l1
,
2116 isis_hello_interval_l1_cmd
,
2117 "isis hello-interval <1-600> level-1",
2119 "Set Hello interval\n"
2120 "Hello interval value\n"
2121 "Holdtime 1 second, interval depends on multiplier\n"
2122 "Specify hello-interval for level-1 IIHs\n")
2125 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2127 return CMD_ERR_NO_MATCH
;
2129 interval
= atoi (argv
[0]);
2130 if (interval
< MIN_HELLO_INTERVAL
|| interval
> MAX_HELLO_INTERVAL
)
2132 vty_out (vty
, "Invalid hello-interval %ld - should be <1-600>%s",
2133 interval
, VTY_NEWLINE
);
2134 return CMD_ERR_AMBIGUOUS
;
2137 circuit
->hello_interval
[0] = (u_int16_t
) interval
;
2142 DEFUN (no_isis_hello_interval_l1
,
2143 no_isis_hello_interval_l1_cmd
,
2144 "no isis hello-interval level-1",
2147 "Set Hello interval\n"
2148 "Specify hello-interval for level-1 IIHs\n")
2150 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2152 return CMD_ERR_NO_MATCH
;
2154 circuit
->hello_interval
[0] = DEFAULT_HELLO_INTERVAL
;
2159 ALIAS (no_isis_hello_interval_l1
,
2160 no_isis_hello_interval_l1_arg_cmd
,
2161 "no isis hello-interval <1-600> level-1",
2164 "Set Hello interval\n"
2165 "Hello interval value\n"
2166 "Holdtime 1 second, interval depends on multiplier\n"
2167 "Specify hello-interval for level-1 IIHs\n")
2169 DEFUN (isis_hello_interval_l2
,
2170 isis_hello_interval_l2_cmd
,
2171 "isis hello-interval <1-600> level-2",
2173 "Set Hello interval\n"
2174 "Hello interval value\n"
2175 "Holdtime 1 second, interval depends on multiplier\n"
2176 "Specify hello-interval for level-2 IIHs\n")
2179 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2181 return CMD_ERR_NO_MATCH
;
2183 interval
= atoi (argv
[0]);
2184 if (interval
< MIN_HELLO_INTERVAL
|| interval
> MAX_HELLO_INTERVAL
)
2186 vty_out (vty
, "Invalid hello-interval %ld - should be <1-600>%s",
2187 interval
, VTY_NEWLINE
);
2188 return CMD_ERR_AMBIGUOUS
;
2191 circuit
->hello_interval
[1] = (u_int16_t
) interval
;
2196 DEFUN (no_isis_hello_interval_l2
,
2197 no_isis_hello_interval_l2_cmd
,
2198 "no isis hello-interval level-2",
2201 "Set Hello interval\n"
2202 "Specify hello-interval for level-2 IIHs\n")
2204 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2206 return CMD_ERR_NO_MATCH
;
2208 circuit
->hello_interval
[1] = DEFAULT_HELLO_INTERVAL
;
2213 ALIAS (no_isis_hello_interval_l2
,
2214 no_isis_hello_interval_l2_arg_cmd
,
2215 "no isis hello-interval <1-600> level-2",
2218 "Set Hello interval\n"
2219 "Hello interval value\n"
2220 "Holdtime 1 second, interval depends on multiplier\n"
2221 "Specify hello-interval for level-2 IIHs\n")
2223 DEFUN (isis_hello_multiplier
,
2224 isis_hello_multiplier_cmd
,
2225 "isis hello-multiplier <2-100>",
2227 "Set multiplier for Hello holding time\n"
2228 "Hello multiplier value\n")
2231 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2233 return CMD_ERR_NO_MATCH
;
2235 mult
= atoi (argv
[0]);
2236 if (mult
< MIN_HELLO_MULTIPLIER
|| mult
> MAX_HELLO_MULTIPLIER
)
2238 vty_out (vty
, "Invalid hello-multiplier %d - should be <2-100>%s",
2240 return CMD_ERR_AMBIGUOUS
;
2243 circuit
->hello_multiplier
[0] = (u_int16_t
) mult
;
2244 circuit
->hello_multiplier
[1] = (u_int16_t
) mult
;
2249 DEFUN (no_isis_hello_multiplier
,
2250 no_isis_hello_multiplier_cmd
,
2251 "no isis hello-multiplier",
2254 "Set multiplier for Hello holding time\n")
2256 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2258 return CMD_ERR_NO_MATCH
;
2260 circuit
->hello_multiplier
[0] = DEFAULT_HELLO_MULTIPLIER
;
2261 circuit
->hello_multiplier
[1] = DEFAULT_HELLO_MULTIPLIER
;
2266 ALIAS (no_isis_hello_multiplier
,
2267 no_isis_hello_multiplier_arg_cmd
,
2268 "no isis hello-multiplier <2-100>",
2271 "Set multiplier for Hello holding time\n"
2272 "Hello multiplier value\n")
2274 DEFUN (isis_hello_multiplier_l1
,
2275 isis_hello_multiplier_l1_cmd
,
2276 "isis hello-multiplier <2-100> level-1",
2278 "Set multiplier for Hello holding time\n"
2279 "Hello multiplier value\n"
2280 "Specify hello multiplier for level-1 IIHs\n")
2283 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2285 return CMD_ERR_NO_MATCH
;
2287 mult
= atoi (argv
[0]);
2288 if (mult
< MIN_HELLO_MULTIPLIER
|| mult
> MAX_HELLO_MULTIPLIER
)
2290 vty_out (vty
, "Invalid hello-multiplier %d - should be <2-100>%s",
2292 return CMD_ERR_AMBIGUOUS
;
2295 circuit
->hello_multiplier
[0] = (u_int16_t
) mult
;
2300 DEFUN (no_isis_hello_multiplier_l1
,
2301 no_isis_hello_multiplier_l1_cmd
,
2302 "no isis hello-multiplier level-1",
2305 "Set multiplier for Hello holding time\n"
2306 "Specify hello multiplier for level-1 IIHs\n")
2308 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2310 return CMD_ERR_NO_MATCH
;
2312 circuit
->hello_multiplier
[0] = DEFAULT_HELLO_MULTIPLIER
;
2317 ALIAS (no_isis_hello_multiplier_l1
,
2318 no_isis_hello_multiplier_l1_arg_cmd
,
2319 "no isis hello-multiplier <2-100> level-1",
2322 "Set multiplier for Hello holding time\n"
2323 "Hello multiplier value\n"
2324 "Specify hello multiplier for level-1 IIHs\n")
2326 DEFUN (isis_hello_multiplier_l2
,
2327 isis_hello_multiplier_l2_cmd
,
2328 "isis hello-multiplier <2-100> level-2",
2330 "Set multiplier for Hello holding time\n"
2331 "Hello multiplier value\n"
2332 "Specify hello multiplier for level-2 IIHs\n")
2335 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2337 return CMD_ERR_NO_MATCH
;
2339 mult
= atoi (argv
[0]);
2340 if (mult
< MIN_HELLO_MULTIPLIER
|| mult
> MAX_HELLO_MULTIPLIER
)
2342 vty_out (vty
, "Invalid hello-multiplier %d - should be <2-100>%s",
2344 return CMD_ERR_AMBIGUOUS
;
2347 circuit
->hello_multiplier
[1] = (u_int16_t
) mult
;
2352 DEFUN (no_isis_hello_multiplier_l2
,
2353 no_isis_hello_multiplier_l2_cmd
,
2354 "no isis hello-multiplier level-2",
2357 "Set multiplier for Hello holding time\n"
2358 "Specify hello multiplier for level-2 IIHs\n")
2360 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2362 return CMD_ERR_NO_MATCH
;
2364 circuit
->hello_multiplier
[1] = DEFAULT_HELLO_MULTIPLIER
;
2369 ALIAS (no_isis_hello_multiplier_l2
,
2370 no_isis_hello_multiplier_l2_arg_cmd
,
2371 "no isis hello-multiplier <2-100> level-2",
2374 "Set multiplier for Hello holding time\n"
2375 "Hello multiplier value\n"
2376 "Specify hello multiplier for level-2 IIHs\n")
2378 DEFUN (isis_hello_padding
,
2379 isis_hello_padding_cmd
,
2380 "isis hello padding",
2382 "Add padding to IS-IS hello packets\n"
2383 "Pad hello packets\n"
2386 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2388 return CMD_ERR_NO_MATCH
;
2390 circuit
->pad_hellos
= 1;
2395 DEFUN (no_isis_hello_padding
,
2396 no_isis_hello_padding_cmd
,
2397 "no isis hello padding",
2400 "Add padding to IS-IS hello packets\n"
2401 "Pad hello packets\n"
2404 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2406 return CMD_ERR_NO_MATCH
;
2408 circuit
->pad_hellos
= 0;
2413 DEFUN (csnp_interval
,
2415 "isis csnp-interval <1-600>",
2417 "Set CSNP interval in seconds\n"
2418 "CSNP interval value\n")
2420 unsigned long interval
;
2421 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2423 return CMD_ERR_NO_MATCH
;
2425 interval
= atol (argv
[0]);
2426 if (interval
< MIN_CSNP_INTERVAL
|| interval
> MAX_CSNP_INTERVAL
)
2428 vty_out (vty
, "Invalid csnp-interval %lu - should be <1-600>%s",
2429 interval
, VTY_NEWLINE
);
2430 return CMD_ERR_AMBIGUOUS
;
2433 circuit
->csnp_interval
[0] = (u_int16_t
) interval
;
2434 circuit
->csnp_interval
[1] = (u_int16_t
) interval
;
2439 DEFUN (no_csnp_interval
,
2440 no_csnp_interval_cmd
,
2441 "no isis csnp-interval",
2444 "Set CSNP interval in seconds\n")
2446 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2448 return CMD_ERR_NO_MATCH
;
2450 circuit
->csnp_interval
[0] = DEFAULT_CSNP_INTERVAL
;
2451 circuit
->csnp_interval
[1] = DEFAULT_CSNP_INTERVAL
;
2456 ALIAS (no_csnp_interval
,
2457 no_csnp_interval_arg_cmd
,
2458 "no isis csnp-interval <1-600>",
2461 "Set CSNP interval in seconds\n"
2462 "CSNP interval value\n")
2464 DEFUN (csnp_interval_l1
,
2465 csnp_interval_l1_cmd
,
2466 "isis csnp-interval <1-600> level-1",
2468 "Set CSNP interval in seconds\n"
2469 "CSNP interval value\n"
2470 "Specify interval for level-1 CSNPs\n")
2472 unsigned long interval
;
2473 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2475 return CMD_ERR_NO_MATCH
;
2477 interval
= atol (argv
[0]);
2478 if (interval
< MIN_CSNP_INTERVAL
|| interval
> MAX_CSNP_INTERVAL
)
2480 vty_out (vty
, "Invalid csnp-interval %lu - should be <1-600>%s",
2481 interval
, VTY_NEWLINE
);
2482 return CMD_ERR_AMBIGUOUS
;
2485 circuit
->csnp_interval
[0] = (u_int16_t
) interval
;
2490 DEFUN (no_csnp_interval_l1
,
2491 no_csnp_interval_l1_cmd
,
2492 "no isis csnp-interval level-1",
2495 "Set CSNP interval in seconds\n"
2496 "Specify interval for level-1 CSNPs\n")
2498 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2500 return CMD_ERR_NO_MATCH
;
2502 circuit
->csnp_interval
[0] = DEFAULT_CSNP_INTERVAL
;
2507 ALIAS (no_csnp_interval_l1
,
2508 no_csnp_interval_l1_arg_cmd
,
2509 "no isis csnp-interval <1-600> level-1",
2512 "Set CSNP interval in seconds\n"
2513 "CSNP interval value\n"
2514 "Specify interval for level-1 CSNPs\n")
2516 DEFUN (csnp_interval_l2
,
2517 csnp_interval_l2_cmd
,
2518 "isis csnp-interval <1-600> level-2",
2520 "Set CSNP interval in seconds\n"
2521 "CSNP interval value\n"
2522 "Specify interval for level-2 CSNPs\n")
2524 unsigned long interval
;
2525 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2527 return CMD_ERR_NO_MATCH
;
2529 interval
= atol (argv
[0]);
2530 if (interval
< MIN_CSNP_INTERVAL
|| interval
> MAX_CSNP_INTERVAL
)
2532 vty_out (vty
, "Invalid csnp-interval %lu - should be <1-600>%s",
2533 interval
, VTY_NEWLINE
);
2534 return CMD_ERR_AMBIGUOUS
;
2537 circuit
->csnp_interval
[1] = (u_int16_t
) interval
;
2542 DEFUN (no_csnp_interval_l2
,
2543 no_csnp_interval_l2_cmd
,
2544 "no isis csnp-interval level-2",
2547 "Set CSNP interval in seconds\n"
2548 "Specify interval for level-2 CSNPs\n")
2550 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2552 return CMD_ERR_NO_MATCH
;
2554 circuit
->csnp_interval
[1] = DEFAULT_CSNP_INTERVAL
;
2559 ALIAS (no_csnp_interval_l2
,
2560 no_csnp_interval_l2_arg_cmd
,
2561 "no isis csnp-interval <1-600> level-2",
2564 "Set CSNP interval in seconds\n"
2565 "CSNP interval value\n"
2566 "Specify interval for level-2 CSNPs\n")
2568 DEFUN (psnp_interval
,
2570 "isis psnp-interval <1-120>",
2572 "Set PSNP interval in seconds\n"
2573 "PSNP interval value\n")
2575 unsigned long interval
;
2576 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2578 return CMD_ERR_NO_MATCH
;
2580 interval
= atol (argv
[0]);
2581 if (interval
< MIN_PSNP_INTERVAL
|| interval
> MAX_PSNP_INTERVAL
)
2583 vty_out (vty
, "Invalid psnp-interval %lu - should be <1-120>%s",
2584 interval
, VTY_NEWLINE
);
2585 return CMD_ERR_AMBIGUOUS
;
2588 circuit
->psnp_interval
[0] = (u_int16_t
) interval
;
2589 circuit
->psnp_interval
[1] = (u_int16_t
) interval
;
2594 DEFUN (no_psnp_interval
,
2595 no_psnp_interval_cmd
,
2596 "no isis psnp-interval",
2599 "Set PSNP interval in seconds\n")
2601 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2603 return CMD_ERR_NO_MATCH
;
2605 circuit
->psnp_interval
[0] = DEFAULT_PSNP_INTERVAL
;
2606 circuit
->psnp_interval
[1] = DEFAULT_PSNP_INTERVAL
;
2611 ALIAS (no_psnp_interval
,
2612 no_psnp_interval_arg_cmd
,
2613 "no isis psnp-interval <1-120>",
2616 "Set PSNP interval in seconds\n"
2617 "PSNP interval value\n")
2619 DEFUN (psnp_interval_l1
,
2620 psnp_interval_l1_cmd
,
2621 "isis psnp-interval <1-120> level-1",
2623 "Set PSNP interval in seconds\n"
2624 "PSNP interval value\n"
2625 "Specify interval for level-1 PSNPs\n")
2627 unsigned long interval
;
2628 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2630 return CMD_ERR_NO_MATCH
;
2632 interval
= atol (argv
[0]);
2633 if (interval
< MIN_PSNP_INTERVAL
|| interval
> MAX_PSNP_INTERVAL
)
2635 vty_out (vty
, "Invalid psnp-interval %lu - should be <1-120>%s",
2636 interval
, VTY_NEWLINE
);
2637 return CMD_ERR_AMBIGUOUS
;
2640 circuit
->psnp_interval
[0] = (u_int16_t
) interval
;
2645 DEFUN (no_psnp_interval_l1
,
2646 no_psnp_interval_l1_cmd
,
2647 "no isis psnp-interval level-1",
2650 "Set PSNP interval in seconds\n"
2651 "Specify interval for level-1 PSNPs\n")
2653 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2655 return CMD_ERR_NO_MATCH
;
2657 circuit
->psnp_interval
[0] = DEFAULT_PSNP_INTERVAL
;
2662 ALIAS (no_psnp_interval_l1
,
2663 no_psnp_interval_l1_arg_cmd
,
2664 "no isis psnp-interval <1-120> level-1",
2667 "Set PSNP interval in seconds\n"
2668 "PSNP interval value\n"
2669 "Specify interval for level-1 PSNPs\n")
2671 DEFUN (psnp_interval_l2
,
2672 psnp_interval_l2_cmd
,
2673 "isis psnp-interval <1-120> level-2",
2675 "Set PSNP interval in seconds\n"
2676 "PSNP interval value\n"
2677 "Specify interval for level-2 PSNPs\n")
2679 unsigned long interval
;
2680 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2682 return CMD_ERR_NO_MATCH
;
2684 interval
= atol (argv
[0]);
2685 if (interval
< MIN_PSNP_INTERVAL
|| interval
> MAX_PSNP_INTERVAL
)
2687 vty_out (vty
, "Invalid psnp-interval %lu - should be <1-120>%s",
2688 interval
, VTY_NEWLINE
);
2689 return CMD_ERR_AMBIGUOUS
;
2692 circuit
->psnp_interval
[1] = (u_int16_t
) interval
;
2697 DEFUN (no_psnp_interval_l2
,
2698 no_psnp_interval_l2_cmd
,
2699 "no isis psnp-interval level-2",
2702 "Set PSNP interval in seconds\n"
2703 "Specify interval for level-2 PSNPs\n")
2705 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2707 return CMD_ERR_NO_MATCH
;
2709 circuit
->psnp_interval
[1] = DEFAULT_PSNP_INTERVAL
;
2714 ALIAS (no_psnp_interval_l2
,
2715 no_psnp_interval_l2_arg_cmd
,
2716 "no isis psnp-interval <1-120> level-2",
2719 "Set PSNP interval in seconds\n"
2720 "PSNP interval value\n"
2721 "Specify interval for level-2 PSNPs\n")
2723 struct cmd_node interface_node
= {
2729 DEFUN (isis_network
,
2731 "isis network point-to-point",
2733 "Set network type\n"
2734 "point-to-point network type\n")
2736 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2738 return CMD_ERR_NO_MATCH
;
2740 /* RFC5309 section 4 */
2741 if (circuit
->circ_type
== CIRCUIT_T_P2P
)
2744 if (circuit
->state
!= C_STATE_UP
)
2746 circuit
->circ_type
= CIRCUIT_T_P2P
;
2747 circuit
->circ_type_config
= CIRCUIT_T_P2P
;
2751 struct isis_area
*area
= circuit
->area
;
2752 if (!if_is_broadcast (circuit
->interface
))
2754 vty_out (vty
, "isis network point-to-point "
2755 "is valid only on broadcast interfaces%s",
2757 return CMD_ERR_AMBIGUOUS
;
2760 isis_csm_state_change (ISIS_DISABLE
, circuit
, area
);
2761 circuit
->circ_type
= CIRCUIT_T_P2P
;
2762 circuit
->circ_type_config
= CIRCUIT_T_P2P
;
2763 isis_csm_state_change (ISIS_ENABLE
, circuit
, area
);
2769 DEFUN (no_isis_network
,
2770 no_isis_network_cmd
,
2771 "no isis network point-to-point",
2774 "Set network type for circuit\n"
2775 "point-to-point network type\n")
2777 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
2779 return CMD_ERR_NO_MATCH
;
2781 /* RFC5309 section 4 */
2782 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
)
2785 if (circuit
->state
!= C_STATE_UP
)
2787 circuit
->circ_type
= CIRCUIT_T_BROADCAST
;
2788 circuit
->circ_type_config
= CIRCUIT_T_BROADCAST
;
2792 struct isis_area
*area
= circuit
->area
;
2793 if (circuit
->interface
&&
2794 !if_is_broadcast (circuit
->interface
))
2796 vty_out (vty
, "no isis network point-to-point "
2797 "is valid only on broadcast interfaces%s",
2799 return CMD_ERR_AMBIGUOUS
;
2802 isis_csm_state_change (ISIS_DISABLE
, circuit
, area
);
2803 circuit
->circ_type
= CIRCUIT_T_BROADCAST
;
2804 circuit
->circ_type_config
= CIRCUIT_T_BROADCAST
;
2805 isis_csm_state_change (ISIS_ENABLE
, circuit
, area
);
2812 isis_if_new_hook (struct interface
*ifp
)
2818 isis_if_delete_hook (struct interface
*ifp
)
2820 struct isis_circuit
*circuit
;
2821 /* Clean up the circuit data */
2822 if (ifp
&& ifp
->info
)
2824 circuit
= ifp
->info
;
2825 isis_csm_state_change (IF_DOWN_FROM_Z
, circuit
, circuit
->area
);
2826 isis_csm_state_change (ISIS_DISABLE
, circuit
, circuit
->area
);
2833 isis_circuit_init ()
2835 /* Initialize Zebra interface data structure */
2836 if_add_hook (IF_NEW_HOOK
, isis_if_new_hook
);
2837 if_add_hook (IF_DELETE_HOOK
, isis_if_delete_hook
);
2839 /* Install interface node */
2840 install_node (&interface_node
, isis_interface_config_write
);
2841 install_element (CONFIG_NODE
, &interface_cmd
);
2842 install_element (CONFIG_NODE
, &no_interface_cmd
);
2844 install_default (INTERFACE_NODE
);
2845 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
2846 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
2848 install_element (INTERFACE_NODE
, &ip_router_isis_cmd
);
2849 install_element (INTERFACE_NODE
, &no_ip_router_isis_cmd
);
2851 install_element (INTERFACE_NODE
, &isis_passive_cmd
);
2852 install_element (INTERFACE_NODE
, &no_isis_passive_cmd
);
2854 install_element (INTERFACE_NODE
, &isis_circuit_type_cmd
);
2855 install_element (INTERFACE_NODE
, &no_isis_circuit_type_cmd
);
2857 install_element (INTERFACE_NODE
, &isis_passwd_clear_cmd
);
2858 install_element (INTERFACE_NODE
, &isis_passwd_md5_cmd
);
2859 install_element (INTERFACE_NODE
, &no_isis_passwd_cmd
);
2861 install_element (INTERFACE_NODE
, &isis_priority_cmd
);
2862 install_element (INTERFACE_NODE
, &no_isis_priority_cmd
);
2863 install_element (INTERFACE_NODE
, &no_isis_priority_arg_cmd
);
2864 install_element (INTERFACE_NODE
, &isis_priority_l1_cmd
);
2865 install_element (INTERFACE_NODE
, &no_isis_priority_l1_cmd
);
2866 install_element (INTERFACE_NODE
, &no_isis_priority_l1_arg_cmd
);
2867 install_element (INTERFACE_NODE
, &isis_priority_l2_cmd
);
2868 install_element (INTERFACE_NODE
, &no_isis_priority_l2_cmd
);
2869 install_element (INTERFACE_NODE
, &no_isis_priority_l2_arg_cmd
);
2871 install_element (INTERFACE_NODE
, &isis_metric_cmd
);
2872 install_element (INTERFACE_NODE
, &no_isis_metric_cmd
);
2873 install_element (INTERFACE_NODE
, &no_isis_metric_arg_cmd
);
2874 install_element (INTERFACE_NODE
, &isis_metric_l1_cmd
);
2875 install_element (INTERFACE_NODE
, &no_isis_metric_l1_cmd
);
2876 install_element (INTERFACE_NODE
, &no_isis_metric_l1_arg_cmd
);
2877 install_element (INTERFACE_NODE
, &isis_metric_l2_cmd
);
2878 install_element (INTERFACE_NODE
, &no_isis_metric_l2_cmd
);
2879 install_element (INTERFACE_NODE
, &no_isis_metric_l2_arg_cmd
);
2881 install_element (INTERFACE_NODE
, &isis_hello_interval_cmd
);
2882 install_element (INTERFACE_NODE
, &no_isis_hello_interval_cmd
);
2883 install_element (INTERFACE_NODE
, &no_isis_hello_interval_arg_cmd
);
2884 install_element (INTERFACE_NODE
, &isis_hello_interval_l1_cmd
);
2885 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l1_cmd
);
2886 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l1_arg_cmd
);
2887 install_element (INTERFACE_NODE
, &isis_hello_interval_l2_cmd
);
2888 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l2_cmd
);
2889 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l2_arg_cmd
);
2891 install_element (INTERFACE_NODE
, &isis_hello_multiplier_cmd
);
2892 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_cmd
);
2893 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_arg_cmd
);
2894 install_element (INTERFACE_NODE
, &isis_hello_multiplier_l1_cmd
);
2895 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l1_cmd
);
2896 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l1_arg_cmd
);
2897 install_element (INTERFACE_NODE
, &isis_hello_multiplier_l2_cmd
);
2898 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l2_cmd
);
2899 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l2_arg_cmd
);
2901 install_element (INTERFACE_NODE
, &isis_hello_padding_cmd
);
2902 install_element (INTERFACE_NODE
, &no_isis_hello_padding_cmd
);
2904 install_element (INTERFACE_NODE
, &csnp_interval_cmd
);
2905 install_element (INTERFACE_NODE
, &no_csnp_interval_cmd
);
2906 install_element (INTERFACE_NODE
, &no_csnp_interval_arg_cmd
);
2907 install_element (INTERFACE_NODE
, &csnp_interval_l1_cmd
);
2908 install_element (INTERFACE_NODE
, &no_csnp_interval_l1_cmd
);
2909 install_element (INTERFACE_NODE
, &no_csnp_interval_l1_arg_cmd
);
2910 install_element (INTERFACE_NODE
, &csnp_interval_l2_cmd
);
2911 install_element (INTERFACE_NODE
, &no_csnp_interval_l2_cmd
);
2912 install_element (INTERFACE_NODE
, &no_csnp_interval_l2_arg_cmd
);
2914 install_element (INTERFACE_NODE
, &psnp_interval_cmd
);
2915 install_element (INTERFACE_NODE
, &no_psnp_interval_cmd
);
2916 install_element (INTERFACE_NODE
, &no_psnp_interval_arg_cmd
);
2917 install_element (INTERFACE_NODE
, &psnp_interval_l1_cmd
);
2918 install_element (INTERFACE_NODE
, &no_psnp_interval_l1_cmd
);
2919 install_element (INTERFACE_NODE
, &no_psnp_interval_l1_arg_cmd
);
2920 install_element (INTERFACE_NODE
, &psnp_interval_l2_cmd
);
2921 install_element (INTERFACE_NODE
, &no_psnp_interval_l2_cmd
);
2922 install_element (INTERFACE_NODE
, &no_psnp_interval_l2_arg_cmd
);
2924 install_element (INTERFACE_NODE
, &isis_network_cmd
);
2925 install_element (INTERFACE_NODE
, &no_isis_network_cmd
);
2928 install_element (INTERFACE_NODE
, &ipv6_router_isis_cmd
);
2929 install_element (INTERFACE_NODE
, &no_ipv6_router_isis_cmd
);