blob: 81c60762c67d42c1c45baa4eee5df14a78bb477a [file] [log] [blame]
jardineb5d44e2003-12-23 08:09:43 +00001/*
2 * IS-IS Rout(e)ing protocol - isis_circuit.h
3 *
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
7 *
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)
11 * any later version.
12 *
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
16 * more details.
17
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.
21 */
jardineb5d44e2003-12-23 08:09:43 +000022#include <zebra.h>
hasso37da8c02004-05-19 11:38:40 +000023#ifdef GNU_LINUX
jardineb5d44e2003-12-23 08:09:43 +000024#include <net/ethernet.h>
hasso37da8c02004-05-19 11:38:40 +000025#else
26#include <netinet/if_ether.h>
27#endif
jardineb5d44e2003-12-23 08:09:43 +000028
Paul Jakma238497f2007-08-07 18:49:18 +000029#ifndef ETHER_ADDR_LEN
30#define ETHER_ADDR_LEN ETHERADDRL
31#endif
32
jardineb5d44e2003-12-23 08:09:43 +000033#include "log.h"
34#include "memory.h"
35#include "if.h"
36#include "linklist.h"
37#include "command.h"
38#include "thread.h"
39#include "hash.h"
40#include "prefix.h"
41#include "stream.h"
42
43#include "isisd/dict.h"
44#include "isisd/include-netbsd/iso.h"
45#include "isisd/isis_constants.h"
46#include "isisd/isis_common.h"
Josh Bailey3f045a02012-03-24 08:35:20 -070047#include "isisd/isis_flags.h"
jardineb5d44e2003-12-23 08:09:43 +000048#include "isisd/isis_circuit.h"
49#include "isisd/isis_tlv.h"
50#include "isisd/isis_lsp.h"
51#include "isisd/isis_pdu.h"
52#include "isisd/isis_network.h"
53#include "isisd/isis_misc.h"
54#include "isisd/isis_constants.h"
55#include "isisd/isis_adjacency.h"
56#include "isisd/isis_dr.h"
jardineb5d44e2003-12-23 08:09:43 +000057#include "isisd/isisd.h"
58#include "isisd/isis_csm.h"
59#include "isisd/isis_events.h"
60
Paul Jakma41b36e92006-12-08 01:09:50 +000061/*
62 * Prototypes.
63 */
Paul Jakma41b36e92006-12-08 01:09:50 +000064int isis_interface_config_write(struct vty *);
65int isis_if_new_hook(struct interface *);
66int isis_if_delete_hook(struct interface *);
67
jardineb5d44e2003-12-23 08:09:43 +000068struct isis_circuit *
69isis_circuit_new ()
70{
71 struct isis_circuit *circuit;
72 int i;
73
hasso3fdb2dd2005-09-28 18:45:54 +000074 circuit = XCALLOC (MTYPE_ISIS_CIRCUIT, sizeof (struct isis_circuit));
Josh Bailey3f045a02012-03-24 08:35:20 -070075 if (circuit == NULL)
hassof390d2c2004-09-10 20:48:21 +000076 {
77 zlog_err ("Can't malloc isis circuit");
78 return NULL;
79 }
80
Josh Bailey3f045a02012-03-24 08:35:20 -070081 /*
82 * Default values
83 */
84 circuit->is_type = IS_LEVEL_1_AND_2;
85 circuit->flags = 0;
86 circuit->pad_hellos = 1;
87 for (i = 0; i < 2; i++)
88 {
89 circuit->hello_interval[i] = DEFAULT_HELLO_INTERVAL;
90 circuit->hello_multiplier[i] = DEFAULT_HELLO_MULTIPLIER;
91 circuit->csnp_interval[i] = DEFAULT_CSNP_INTERVAL;
92 circuit->psnp_interval[i] = DEFAULT_PSNP_INTERVAL;
93 circuit->priority[i] = DEFAULT_PRIORITY;
94 circuit->metrics[i].metric_default = DEFAULT_CIRCUIT_METRIC;
95 circuit->metrics[i].metric_expense = METRICS_UNSUPPORTED;
96 circuit->metrics[i].metric_error = METRICS_UNSUPPORTED;
97 circuit->metrics[i].metric_delay = METRICS_UNSUPPORTED;
98 circuit->te_metric[i] = DEFAULT_CIRCUIT_METRIC;
99 }
100
jardineb5d44e2003-12-23 08:09:43 +0000101 return circuit;
102}
103
jardineb5d44e2003-12-23 08:09:43 +0000104void
Josh Bailey3f045a02012-03-24 08:35:20 -0700105isis_circuit_del (struct isis_circuit *circuit)
106{
107 if (!circuit)
108 return;
109
110 isis_circuit_if_unbind (circuit, circuit->interface);
111
112 /* and lastly the circuit itself */
113 XFREE (MTYPE_ISIS_CIRCUIT, circuit);
114
115 return;
116}
117
118void
jardineb5d44e2003-12-23 08:09:43 +0000119isis_circuit_configure (struct isis_circuit *circuit, struct isis_area *area)
120{
Josh Bailey3f045a02012-03-24 08:35:20 -0700121 assert (area);
jardineb5d44e2003-12-23 08:09:43 +0000122 circuit->area = area;
Josh Bailey3f045a02012-03-24 08:35:20 -0700123
jardineb5d44e2003-12-23 08:09:43 +0000124 /*
Christian Franke7324ae12015-11-10 18:04:48 +0100125 * Whenever the is-type of an area is changed, the is-type of each circuit
126 * in that area is updated to a non-empty subset of the area is-type.
127 * Inversely, when configuring a new circuit, this property should be
128 * ensured as well.
jardineb5d44e2003-12-23 08:09:43 +0000129 */
Christian Franke7324ae12015-11-10 18:04:48 +0100130 if (area->is_type != IS_LEVEL_1_AND_2)
131 circuit->is_type = area->is_type;
jardineb5d44e2003-12-23 08:09:43 +0000132
133 /*
134 * Add the circuit into area
135 */
136 listnode_add (area->circuit_list, circuit);
137
138 circuit->idx = flags_get_index (&area->flags);
jardineb5d44e2003-12-23 08:09:43 +0000139
140 return;
141}
142
hassof390d2c2004-09-10 20:48:21 +0000143void
Josh Bailey3f045a02012-03-24 08:35:20 -0700144isis_circuit_deconfigure (struct isis_circuit *circuit, struct isis_area *area)
jardineb5d44e2003-12-23 08:09:43 +0000145{
jardineb5d44e2003-12-23 08:09:43 +0000146 /* Free the index of SRM and SSN flags */
147 flags_free_index (&area->flags, circuit->idx);
Josh Bailey3f045a02012-03-24 08:35:20 -0700148 circuit->idx = 0;
149 /* Remove circuit from area */
150 assert (circuit->area == area);
151 listnode_delete (area->circuit_list, circuit);
152 circuit->area = NULL;
jardineb5d44e2003-12-23 08:09:43 +0000153
154 return;
155}
156
157struct isis_circuit *
158circuit_lookup_by_ifp (struct interface *ifp, struct list *list)
159{
160 struct isis_circuit *circuit = NULL;
161 struct listnode *node;
hassof390d2c2004-09-10 20:48:21 +0000162
jardineb5d44e2003-12-23 08:09:43 +0000163 if (!list)
164 return NULL;
hassof390d2c2004-09-10 20:48:21 +0000165
paul1eb8ef22005-04-07 07:30:20 +0000166 for (ALL_LIST_ELEMENTS_RO (list, node, circuit))
167 if (circuit->interface == ifp)
Josh Bailey3f045a02012-03-24 08:35:20 -0700168 {
169 assert (ifp->info == circuit);
170 return circuit;
171 }
172
jardineb5d44e2003-12-23 08:09:43 +0000173 return NULL;
174}
175
176struct isis_circuit *
177circuit_scan_by_ifp (struct interface *ifp)
178{
179 struct isis_area *area;
180 struct listnode *node;
181 struct isis_circuit *circuit;
182
Josh Bailey3f045a02012-03-24 08:35:20 -0700183 if (ifp->info)
184 return (struct isis_circuit *)ifp->info;
jardineb5d44e2003-12-23 08:09:43 +0000185
Josh Bailey3f045a02012-03-24 08:35:20 -0700186 if (isis->area_list)
hassof390d2c2004-09-10 20:48:21 +0000187 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700188 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
189 {
190 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
191 if (circuit)
192 return circuit;
193 }
hassof390d2c2004-09-10 20:48:21 +0000194 }
jardineb5d44e2003-12-23 08:09:43 +0000195 return circuit_lookup_by_ifp (ifp, isis->init_circ_list);
196}
197
Josh Bailey3f045a02012-03-24 08:35:20 -0700198static struct isis_circuit *
199isis_circuit_lookup (struct vty *vty)
jardineb5d44e2003-12-23 08:09:43 +0000200{
Josh Bailey3f045a02012-03-24 08:35:20 -0700201 struct interface *ifp;
202 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +0000203
Josh Bailey3f045a02012-03-24 08:35:20 -0700204 ifp = (struct interface *) vty->index;
205 if (!ifp)
hassof390d2c2004-09-10 20:48:21 +0000206 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700207 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
208 return NULL;
hassof390d2c2004-09-10 20:48:21 +0000209 }
hassof390d2c2004-09-10 20:48:21 +0000210
Josh Bailey3f045a02012-03-24 08:35:20 -0700211 circuit = circuit_scan_by_ifp (ifp);
212 if (!circuit)
213 {
214 vty_out (vty, "ISIS is not enabled on circuit %s%s",
215 ifp->name, VTY_NEWLINE);
216 return NULL;
217 }
jardineb5d44e2003-12-23 08:09:43 +0000218
Josh Bailey3f045a02012-03-24 08:35:20 -0700219 return circuit;
jardineb5d44e2003-12-23 08:09:43 +0000220}
221
222void
hassof891f442004-09-14 13:54:30 +0000223isis_circuit_add_addr (struct isis_circuit *circuit,
224 struct connected *connected)
jardineb5d44e2003-12-23 08:09:43 +0000225{
Josh Bailey3f045a02012-03-24 08:35:20 -0700226 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000227 struct prefix_ipv4 *ipv4;
hassof390d2c2004-09-10 20:48:21 +0000228 u_char buf[BUFSIZ];
jardineb5d44e2003-12-23 08:09:43 +0000229#ifdef HAVE_IPV6
230 struct prefix_ipv6 *ipv6;
231#endif /* HAVE_IPV6 */
hassof891f442004-09-14 13:54:30 +0000232
jardineb5d44e2003-12-23 08:09:43 +0000233 memset (&buf, 0, BUFSIZ);
hassof891f442004-09-14 13:54:30 +0000234 if (connected->address->family == AF_INET)
hassof390d2c2004-09-10 20:48:21 +0000235 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700236 u_int32_t addr = connected->address->u.prefix4.s_addr;
237 addr = ntohl (addr);
238 if (IPV4_NET0(addr) ||
239 IPV4_NET127(addr) ||
240 IN_CLASSD(addr) ||
241 IPV4_LINKLOCAL(addr))
242 return;
243
244 for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ipv4))
245 if (prefix_same ((struct prefix *) ipv4, connected->address))
246 return;
247
hassof390d2c2004-09-10 20:48:21 +0000248 ipv4 = prefix_ipv4_new ();
hassof891f442004-09-14 13:54:30 +0000249 ipv4->prefixlen = connected->address->prefixlen;
250 ipv4->prefix = connected->address->u.prefix4;
hassof390d2c2004-09-10 20:48:21 +0000251 listnode_add (circuit->ip_addrs, ipv4);
hasso0dae85e2004-09-26 19:53:47 +0000252 if (circuit->area)
Josh Bailey3f045a02012-03-24 08:35:20 -0700253 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
hassof891f442004-09-14 13:54:30 +0000254
jardineb5d44e2003-12-23 08:09:43 +0000255#ifdef EXTREME_DEBUG
hassof891f442004-09-14 13:54:30 +0000256 prefix2str (connected->address, buf, BUFSIZ);
hasso529d65b2004-12-24 00:14:50 +0000257 zlog_debug ("Added IP address %s to circuit %d", buf,
hassof390d2c2004-09-10 20:48:21 +0000258 circuit->circuit_id);
259#endif /* EXTREME_DEBUG */
jardineb5d44e2003-12-23 08:09:43 +0000260 }
hassof390d2c2004-09-10 20:48:21 +0000261#ifdef HAVE_IPV6
hassof891f442004-09-14 13:54:30 +0000262 if (connected->address->family == AF_INET6)
hassof390d2c2004-09-10 20:48:21 +0000263 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700264 if (IN6_IS_ADDR_LOOPBACK(&connected->address->u.prefix6))
265 return;
266
267 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_link, node, ipv6))
268 if (prefix_same ((struct prefix *) ipv6, connected->address))
269 return;
270 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, node, ipv6))
271 if (prefix_same ((struct prefix *) ipv6, connected->address))
272 return;
273
hassof390d2c2004-09-10 20:48:21 +0000274 ipv6 = prefix_ipv6_new ();
hassof891f442004-09-14 13:54:30 +0000275 ipv6->prefixlen = connected->address->prefixlen;
276 ipv6->prefix = connected->address->u.prefix6;
277
hassof390d2c2004-09-10 20:48:21 +0000278 if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix))
hassof891f442004-09-14 13:54:30 +0000279 listnode_add (circuit->ipv6_link, ipv6);
hassof390d2c2004-09-10 20:48:21 +0000280 else
hassof891f442004-09-14 13:54:30 +0000281 listnode_add (circuit->ipv6_non_link, ipv6);
hasso0dae85e2004-09-26 19:53:47 +0000282 if (circuit->area)
Josh Bailey3f045a02012-03-24 08:35:20 -0700283 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
hassof891f442004-09-14 13:54:30 +0000284
jardineb5d44e2003-12-23 08:09:43 +0000285#ifdef EXTREME_DEBUG
hassof891f442004-09-14 13:54:30 +0000286 prefix2str (connected->address, buf, BUFSIZ);
hasso529d65b2004-12-24 00:14:50 +0000287 zlog_debug ("Added IPv6 address %s to circuit %d", buf,
hassof390d2c2004-09-10 20:48:21 +0000288 circuit->circuit_id);
289#endif /* EXTREME_DEBUG */
290 }
jardineb5d44e2003-12-23 08:09:43 +0000291#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000292 return;
293}
294
295void
296isis_circuit_del_addr (struct isis_circuit *circuit,
hassof390d2c2004-09-10 20:48:21 +0000297 struct connected *connected)
jardineb5d44e2003-12-23 08:09:43 +0000298{
hassof891f442004-09-14 13:54:30 +0000299 struct prefix_ipv4 *ipv4, *ip = NULL;
300 struct listnode *node;
hassof891f442004-09-14 13:54:30 +0000301 u_char buf[BUFSIZ];
302#ifdef HAVE_IPV6
303 struct prefix_ipv6 *ipv6, *ip6 = NULL;
Paul Jakma41b36e92006-12-08 01:09:50 +0000304 int found = 0;
hassof891f442004-09-14 13:54:30 +0000305#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000306
hassof891f442004-09-14 13:54:30 +0000307 memset (&buf, 0, BUFSIZ);
308 if (connected->address->family == AF_INET)
309 {
310 ipv4 = prefix_ipv4_new ();
311 ipv4->prefixlen = connected->address->prefixlen;
312 ipv4->prefix = connected->address->u.prefix4;
313
paul1eb8ef22005-04-07 07:30:20 +0000314 for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip))
Josh Bailey3f045a02012-03-24 08:35:20 -0700315 if (prefix_same ((struct prefix *) ip, (struct prefix *) ipv4))
paul1eb8ef22005-04-07 07:30:20 +0000316 break;
hassof891f442004-09-14 13:54:30 +0000317
318 if (ip)
319 {
320 listnode_delete (circuit->ip_addrs, ip);
Josh Bailey3f045a02012-03-24 08:35:20 -0700321 if (circuit->area)
322 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
hassof891f442004-09-14 13:54:30 +0000323 }
324 else
325 {
hassof7c43dc2004-09-26 16:24:14 +0000326 prefix2str (connected->address, (char *)buf, BUFSIZ);
Josh Bailey3f045a02012-03-24 08:35:20 -0700327 zlog_warn ("Nonexitant ip address %s removal attempt from \
328 circuit %d", buf, circuit->circuit_id);
hassof891f442004-09-14 13:54:30 +0000329 }
David Lampartere8aca322012-11-27 01:10:30 +0000330
331 prefix_ipv4_free (ipv4);
hassof891f442004-09-14 13:54:30 +0000332 }
333#ifdef HAVE_IPV6
334 if (connected->address->family == AF_INET6)
335 {
336 ipv6 = prefix_ipv6_new ();
337 ipv6->prefixlen = connected->address->prefixlen;
338 ipv6->prefix = connected->address->u.prefix6;
339
340 if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix))
341 {
paul1eb8ef22005-04-07 07:30:20 +0000342 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_link, node, ip6))
hassof891f442004-09-14 13:54:30 +0000343 {
hassof891f442004-09-14 13:54:30 +0000344 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
345 break;
346 }
347 if (ip6)
348 {
349 listnode_delete (circuit->ipv6_link, ip6);
350 found = 1;
351 }
352 }
353 else
354 {
paul1eb8ef22005-04-07 07:30:20 +0000355 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, node, ip6))
hassof891f442004-09-14 13:54:30 +0000356 {
hassof891f442004-09-14 13:54:30 +0000357 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
358 break;
359 }
360 if (ip6)
361 {
362 listnode_delete (circuit->ipv6_non_link, ip6);
363 found = 1;
364 }
365 }
366
367 if (!found)
368 {
hassof7c43dc2004-09-26 16:24:14 +0000369 prefix2str (connected->address, (char *)buf, BUFSIZ);
Josh Bailey3f045a02012-03-24 08:35:20 -0700370 zlog_warn ("Nonexitant ip address %s removal attempt from \
371 circuit %d", buf, circuit->circuit_id);
hassof891f442004-09-14 13:54:30 +0000372 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700373 else if (circuit->area)
374 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
David Lampartere8aca322012-11-27 01:10:30 +0000375
376 prefix_ipv6_free (ipv6);
hassof891f442004-09-14 13:54:30 +0000377 }
378#endif /* HAVE_IPV6 */
379 return;
jardineb5d44e2003-12-23 08:09:43 +0000380}
381
Josh Bailey3f045a02012-03-24 08:35:20 -0700382static u_char
383isis_circuit_id_gen (struct interface *ifp)
384{
385 u_char id = 0;
386 char ifname[16];
387 unsigned int i;
388 int start = -1, end = -1;
389
390 /*
391 * Get a stable circuit id from ifname. This makes
392 * the ifindex from flapping when netdevs are created
393 * and deleted on the fly. Note that this circuit id
394 * is used in pseudo lsps so it is better to be stable.
395 * The following code works on any reasonanle ifname
396 * like: eth1 or trk-1.1 etc.
397 */
398 for (i = 0; i < strlen (ifp->name); i++)
399 {
David Lamparter52f02b42015-04-10 09:14:30 +0200400 if (isdigit((unsigned char)ifp->name[i]))
Josh Bailey3f045a02012-03-24 08:35:20 -0700401 {
402 if (start < 0)
403 {
404 start = i;
405 end = i + 1;
406 }
407 else
408 {
409 end = i + 1;
410 }
411 }
412 else if (start >= 0)
413 break;
414 }
415
416 if ((start >= 0) && (end >= start) && (end - start) < 16)
417 {
418 memset (ifname, 0, 16);
419 strncpy (ifname, &ifp->name[start], end - start);
420 id = (u_char)atoi(ifname);
421 }
422
423 /* Try to be unique. */
424 if (!id)
425 id = (u_char)((ifp->ifindex & 0xff) | 0x80);
426
427 return id;
428}
429
jardineb5d44e2003-12-23 08:09:43 +0000430void
431isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp)
432{
paul1eb8ef22005-04-07 07:30:20 +0000433 struct listnode *node, *nnode;
jardineb5d44e2003-12-23 08:09:43 +0000434 struct connected *conn;
435
Josh Bailey3f045a02012-03-24 08:35:20 -0700436 circuit->circuit_id = isis_circuit_id_gen (ifp);
hassof390d2c2004-09-10 20:48:21 +0000437
Josh Bailey3f045a02012-03-24 08:35:20 -0700438 isis_circuit_if_bind (circuit, ifp);
jardineb5d44e2003-12-23 08:09:43 +0000439 /* isis_circuit_update_addrs (circuit, ifp); */
440
hassof390d2c2004-09-10 20:48:21 +0000441 if (if_is_broadcast (ifp))
442 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700443 if (circuit->circ_type_config == CIRCUIT_T_P2P)
444 circuit->circ_type = CIRCUIT_T_P2P;
hassof390d2c2004-09-10 20:48:21 +0000445 else
Josh Bailey3f045a02012-03-24 08:35:20 -0700446 circuit->circ_type = CIRCUIT_T_BROADCAST;
hassof390d2c2004-09-10 20:48:21 +0000447 }
448 else if (if_is_pointopoint (ifp))
449 {
450 circuit->circ_type = CIRCUIT_T_P2P;
451 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700452 else if (if_is_loopback (ifp))
453 {
454 circuit->circ_type = CIRCUIT_T_LOOPBACK;
455 circuit->is_passive = 1;
456 }
hassof390d2c2004-09-10 20:48:21 +0000457 else
458 {
hassoc89c05d2005-09-04 21:36:36 +0000459 /* It's normal in case of loopback etc. */
460 if (isis->debugs & DEBUG_EVENTS)
Josh Bailey3f045a02012-03-24 08:35:20 -0700461 zlog_debug ("isis_circuit_if_add: unsupported media");
462 circuit->circ_type = CIRCUIT_T_UNKNOWN;
hassof390d2c2004-09-10 20:48:21 +0000463 }
464
Josh Bailey3f045a02012-03-24 08:35:20 -0700465 circuit->ip_addrs = list_new ();
466#ifdef HAVE_IPV6
467 circuit->ipv6_link = list_new ();
468 circuit->ipv6_non_link = list_new ();
469#endif /* HAVE_IPV6 */
470
paul1eb8ef22005-04-07 07:30:20 +0000471 for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn))
472 isis_circuit_add_addr (circuit, conn);
jardineb5d44e2003-12-23 08:09:43 +0000473
474 return;
475}
476
477void
Josh Bailey3f045a02012-03-24 08:35:20 -0700478isis_circuit_if_del (struct isis_circuit *circuit, struct interface *ifp)
jardineb5d44e2003-12-23 08:09:43 +0000479{
Josh Bailey3f045a02012-03-24 08:35:20 -0700480 struct listnode *node, *nnode;
481 struct connected *conn;
hassof390d2c2004-09-10 20:48:21 +0000482
Josh Bailey3f045a02012-03-24 08:35:20 -0700483 assert (circuit->interface == ifp);
484
485 /* destroy addresses */
486 for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn))
487 isis_circuit_del_addr (circuit, conn);
488
489 if (circuit->ip_addrs)
hassof390d2c2004-09-10 20:48:21 +0000490 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700491 assert (listcount(circuit->ip_addrs) == 0);
492 list_delete (circuit->ip_addrs);
493 circuit->ip_addrs = NULL;
hassof390d2c2004-09-10 20:48:21 +0000494 }
jardineb5d44e2003-12-23 08:09:43 +0000495
Josh Bailey3f045a02012-03-24 08:35:20 -0700496#ifdef HAVE_IPV6
497 if (circuit->ipv6_link)
hassof390d2c2004-09-10 20:48:21 +0000498 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700499 assert (listcount(circuit->ipv6_link) == 0);
500 list_delete (circuit->ipv6_link);
501 circuit->ipv6_link = NULL;
jardineb5d44e2003-12-23 08:09:43 +0000502 }
jardineb5d44e2003-12-23 08:09:43 +0000503
Josh Bailey3f045a02012-03-24 08:35:20 -0700504 if (circuit->ipv6_non_link)
hassof390d2c2004-09-10 20:48:21 +0000505 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700506 assert (listcount(circuit->ipv6_non_link) == 0);
507 list_delete (circuit->ipv6_non_link);
508 circuit->ipv6_non_link = NULL;
hassof390d2c2004-09-10 20:48:21 +0000509 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700510#endif /* HAVE_IPV6 */
511
512 circuit->circ_type = CIRCUIT_T_UNKNOWN;
513 circuit->circuit_id = 0;
jardineb5d44e2003-12-23 08:09:43 +0000514
jardineb5d44e2003-12-23 08:09:43 +0000515 return;
516}
517
518void
Josh Bailey3f045a02012-03-24 08:35:20 -0700519isis_circuit_if_bind (struct isis_circuit *circuit, struct interface *ifp)
jardineb5d44e2003-12-23 08:09:43 +0000520{
Josh Bailey3f045a02012-03-24 08:35:20 -0700521 assert (circuit != NULL);
522 assert (ifp != NULL);
523 if (circuit->interface)
524 assert (circuit->interface == ifp);
525 else
526 circuit->interface = ifp;
527 if (ifp->info)
528 assert (ifp->info == circuit);
529 else
530 ifp->info = circuit;
531}
532
533void
534isis_circuit_if_unbind (struct isis_circuit *circuit, struct interface *ifp)
535{
536 assert (circuit != NULL);
537 assert (ifp != NULL);
538 assert (circuit->interface == ifp);
539 assert (ifp->info == circuit);
jardineb5d44e2003-12-23 08:09:43 +0000540 circuit->interface = NULL;
Josh Bailey3f045a02012-03-24 08:35:20 -0700541 ifp->info = NULL;
jardineb5d44e2003-12-23 08:09:43 +0000542}
543
Josh Bailey3f045a02012-03-24 08:35:20 -0700544static void
545isis_circuit_update_all_srmflags (struct isis_circuit *circuit, int is_set)
546{
547 struct isis_area *area;
548 struct isis_lsp *lsp;
549 dnode_t *dnode, *dnode_next;
550 int level;
551
552 assert (circuit);
553 area = circuit->area;
554 assert (area);
555 for (level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++)
556 {
557 if (level & circuit->is_type)
558 {
559 if (area->lspdb[level - 1] &&
560 dict_count (area->lspdb[level - 1]) > 0)
561 {
562 for (dnode = dict_first (area->lspdb[level - 1]);
563 dnode != NULL; dnode = dnode_next)
564 {
565 dnode_next = dict_next (area->lspdb[level - 1], dnode);
566 lsp = dnode_get (dnode);
567 if (is_set)
568 {
569 ISIS_SET_FLAG (lsp->SRMflags, circuit);
570 }
571 else
572 {
573 ISIS_CLEAR_FLAG (lsp->SRMflags, circuit);
574 }
575 }
576 }
577 }
578 }
579}
580
Christian Frankef1fc1db2015-11-10 18:43:31 +0100581size_t
582isis_circuit_pdu_size(struct isis_circuit *circuit)
583{
584 return ISO_MTU(circuit);
585}
586
587void
588isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream)
589{
590 size_t stream_size = isis_circuit_pdu_size(circuit);
591
592 if (!*stream)
593 {
594 *stream = stream_new(stream_size);
595 }
596 else
597 {
598 if (STREAM_SIZE(*stream) != stream_size)
599 stream_resize(*stream, stream_size);
600 stream_reset(*stream);
601 }
602}
603
Josh Bailey3f045a02012-03-24 08:35:20 -0700604int
jardineb5d44e2003-12-23 08:09:43 +0000605isis_circuit_up (struct isis_circuit *circuit)
606{
Josh Bailey3f045a02012-03-24 08:35:20 -0700607 int retv;
608
609 /* Set the flags for all the lsps of the circuit. */
610 isis_circuit_update_all_srmflags (circuit, 1);
611
612 if (circuit->state == C_STATE_UP)
613 return ISIS_OK;
614
615 if (circuit->is_passive)
616 return ISIS_OK;
jardineb5d44e2003-12-23 08:09:43 +0000617
Christian Frankef1fc1db2015-11-10 18:43:31 +0100618 if (circuit->area->lsp_mtu > isis_circuit_pdu_size(circuit))
619 {
620 zlog_err("Interface MTU %zu on %s is too low to support area lsp mtu %u!",
621 isis_circuit_pdu_size(circuit), circuit->interface->name,
622 circuit->area->lsp_mtu);
623 isis_circuit_down(circuit);
624 return ISIS_ERROR;
625 }
626
hassof390d2c2004-09-10 20:48:21 +0000627 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
628 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700629 /*
630 * Get the Hardware Address
631 */
632#ifdef HAVE_STRUCT_SOCKADDR_DL
633#ifndef SUNOS_5
634 if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN)
635 zlog_warn ("unsupported link layer");
636 else
637 memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl),
638 ETH_ALEN);
639#endif
640#else
641 if (circuit->interface->hw_addr_len != ETH_ALEN)
642 {
643 zlog_warn ("unsupported link layer");
644 }
645 else
646 {
647 memcpy (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN);
648 }
649#ifdef EXTREME_DEGUG
650 zlog_debug ("isis_circuit_if_add: if_id %d, isomtu %d snpa %s",
651 circuit->interface->ifindex, ISO_MTU (circuit),
652 snpa_print (circuit->u.bc.snpa));
653#endif /* EXTREME_DEBUG */
654#endif /* HAVE_STRUCT_SOCKADDR_DL */
655
656 circuit->u.bc.adjdb[0] = list_new ();
657 circuit->u.bc.adjdb[1] = list_new ();
658
hassof390d2c2004-09-10 20:48:21 +0000659 /*
660 * ISO 10589 - 8.4.1 Enabling of broadcast circuits
661 */
jardineb5d44e2003-12-23 08:09:43 +0000662
hassof390d2c2004-09-10 20:48:21 +0000663 /* initilizing the hello sending threads
664 * for a broadcast IF
665 */
jardineb5d44e2003-12-23 08:09:43 +0000666
hassof390d2c2004-09-10 20:48:21 +0000667 /* 8.4.1 a) commence sending of IIH PDUs */
668
Josh Bailey3f045a02012-03-24 08:35:20 -0700669 if (circuit->is_type & IS_LEVEL_1)
670 {
671 thread_add_event (master, send_lan_l1_hello, circuit, 0);
672 circuit->u.bc.lan_neighs[0] = list_new ();
673 }
hassof390d2c2004-09-10 20:48:21 +0000674
Josh Bailey3f045a02012-03-24 08:35:20 -0700675 if (circuit->is_type & IS_LEVEL_2)
676 {
677 thread_add_event (master, send_lan_l2_hello, circuit, 0);
678 circuit->u.bc.lan_neighs[1] = list_new ();
679 }
hassof390d2c2004-09-10 20:48:21 +0000680
681 /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */
682 /* 8.4.1 c) FIXME: listen for ESH PDUs */
683
684 /* 8.4.1 d) */
685 /* dr election will commence in... */
Josh Bailey3f045a02012-03-24 08:35:20 -0700686 if (circuit->is_type & IS_LEVEL_1)
687 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
688 circuit, 2 * circuit->hello_interval[0]);
689 if (circuit->is_type & IS_LEVEL_2)
690 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
691 circuit, 2 * circuit->hello_interval[1]);
jardineb5d44e2003-12-23 08:09:43 +0000692 }
hassof390d2c2004-09-10 20:48:21 +0000693 else
694 {
695 /* initializing the hello send threads
696 * for a ptp IF
697 */
Josh Bailey3f045a02012-03-24 08:35:20 -0700698 circuit->u.p2p.neighbor = NULL;
hassof390d2c2004-09-10 20:48:21 +0000699 thread_add_event (master, send_p2p_hello, circuit, 0);
jardineb5d44e2003-12-23 08:09:43 +0000700 }
701
jardineb5d44e2003-12-23 08:09:43 +0000702 /* initializing PSNP timers */
Josh Bailey3f045a02012-03-24 08:35:20 -0700703 if (circuit->is_type & IS_LEVEL_1)
704 THREAD_TIMER_ON (master, circuit->t_send_psnp[0], send_l1_psnp, circuit,
705 isis_jitter (circuit->psnp_interval[0], PSNP_JITTER));
706
707 if (circuit->is_type & IS_LEVEL_2)
708 THREAD_TIMER_ON (master, circuit->t_send_psnp[1], send_l2_psnp, circuit,
709 isis_jitter (circuit->psnp_interval[1], PSNP_JITTER));
710
711 /* unified init for circuits; ignore warnings below this level */
712 retv = isis_sock_init (circuit);
713 if (retv != ISIS_OK)
hassof390d2c2004-09-10 20:48:21 +0000714 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700715 isis_circuit_down (circuit);
716 return retv;
hassof390d2c2004-09-10 20:48:21 +0000717 }
718
Josh Bailey3f045a02012-03-24 08:35:20 -0700719 /* initialize the circuit streams after opening connection */
Christian Frankef1fc1db2015-11-10 18:43:31 +0100720 isis_circuit_stream(circuit, &circuit->rcv_stream);
721 isis_circuit_stream(circuit, &circuit->snd_stream);
jardineb5d44e2003-12-23 08:09:43 +0000722
jardineb5d44e2003-12-23 08:09:43 +0000723#ifdef GNU_LINUX
hassof390d2c2004-09-10 20:48:21 +0000724 THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit,
Josh Bailey3f045a02012-03-24 08:35:20 -0700725 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000726#else
hassof390d2c2004-09-10 20:48:21 +0000727 THREAD_TIMER_ON (master, circuit->t_read, isis_receive, circuit,
Josh Bailey3f045a02012-03-24 08:35:20 -0700728 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000729#endif
Josh Bailey3f045a02012-03-24 08:35:20 -0700730
731 circuit->lsp_queue = list_new ();
732 circuit->lsp_queue_last_cleared = time (NULL);
733
734 return ISIS_OK;
jardineb5d44e2003-12-23 08:09:43 +0000735}
736
737void
738isis_circuit_down (struct isis_circuit *circuit)
739{
Josh Bailey3f045a02012-03-24 08:35:20 -0700740 if (circuit->state != C_STATE_UP)
741 return;
742
743 /* Clear the flags for all the lsps of the circuit. */
744 isis_circuit_update_all_srmflags (circuit, 0);
745
hassof390d2c2004-09-10 20:48:21 +0000746 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
747 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700748 /* destroy neighbour lists */
749 if (circuit->u.bc.lan_neighs[0])
750 {
751 list_delete (circuit->u.bc.lan_neighs[0]);
752 circuit->u.bc.lan_neighs[0] = NULL;
753 }
754 if (circuit->u.bc.lan_neighs[1])
755 {
756 list_delete (circuit->u.bc.lan_neighs[1]);
757 circuit->u.bc.lan_neighs[1] = NULL;
758 }
759 /* destroy adjacency databases */
760 if (circuit->u.bc.adjdb[0])
761 {
762 circuit->u.bc.adjdb[0]->del = isis_delete_adj;
763 list_delete (circuit->u.bc.adjdb[0]);
764 circuit->u.bc.adjdb[0] = NULL;
765 }
766 if (circuit->u.bc.adjdb[1])
767 {
768 circuit->u.bc.adjdb[1]->del = isis_delete_adj;
769 list_delete (circuit->u.bc.adjdb[1]);
770 circuit->u.bc.adjdb[1] = NULL;
771 }
772 if (circuit->u.bc.is_dr[0])
773 {
774 isis_dr_resign (circuit, 1);
775 circuit->u.bc.is_dr[0] = 0;
776 }
777 memset (circuit->u.bc.l1_desig_is, 0, ISIS_SYS_ID_LEN + 1);
778 if (circuit->u.bc.is_dr[1])
779 {
780 isis_dr_resign (circuit, 2);
781 circuit->u.bc.is_dr[1] = 0;
782 }
783 memset (circuit->u.bc.l2_desig_is, 0, ISIS_SYS_ID_LEN + 1);
784 memset (circuit->u.bc.snpa, 0, ETH_ALEN);
785
hassof390d2c2004-09-10 20:48:21 +0000786 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[0]);
787 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[1]);
hassof891f442004-09-14 13:54:30 +0000788 THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[0]);
789 THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[1]);
Josh Bailey3f045a02012-03-24 08:35:20 -0700790 THREAD_TIMER_OFF (circuit->u.bc.t_refresh_pseudo_lsp[0]);
791 THREAD_TIMER_OFF (circuit->u.bc.t_refresh_pseudo_lsp[1]);
Christian Franke61010c32015-11-10 18:43:34 +0100792 circuit->lsp_regenerate_pending[0] = 0;
793 circuit->lsp_regenerate_pending[1] = 0;
hassof390d2c2004-09-10 20:48:21 +0000794 }
795 else if (circuit->circ_type == CIRCUIT_T_P2P)
796 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700797 isis_delete_adj (circuit->u.p2p.neighbor);
798 circuit->u.p2p.neighbor = NULL;
hassof390d2c2004-09-10 20:48:21 +0000799 THREAD_TIMER_OFF (circuit->u.p2p.t_send_p2p_hello);
800 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700801
802 /* Cancel all active threads */
803 THREAD_TIMER_OFF (circuit->t_send_csnp[0]);
804 THREAD_TIMER_OFF (circuit->t_send_csnp[1]);
805 THREAD_TIMER_OFF (circuit->t_send_psnp[0]);
806 THREAD_TIMER_OFF (circuit->t_send_psnp[1]);
807 THREAD_OFF (circuit->t_read);
808
809 if (circuit->lsp_queue)
810 {
811 circuit->lsp_queue->del = NULL;
812 list_delete (circuit->lsp_queue);
813 circuit->lsp_queue = NULL;
814 }
815
816 /* send one gratuitous hello to spead up convergence */
817 if (circuit->is_type & IS_LEVEL_1)
818 send_hello (circuit, IS_LEVEL_1);
819 if (circuit->is_type & IS_LEVEL_2)
820 send_hello (circuit, IS_LEVEL_2);
821
822 circuit->upadjcount[0] = 0;
823 circuit->upadjcount[1] = 0;
824
jardineb5d44e2003-12-23 08:09:43 +0000825 /* close the socket */
Josh Bailey3f045a02012-03-24 08:35:20 -0700826 if (circuit->fd)
827 {
828 close (circuit->fd);
829 circuit->fd = 0;
830 }
831
832 if (circuit->rcv_stream != NULL)
833 {
834 stream_free (circuit->rcv_stream);
835 circuit->rcv_stream = NULL;
836 }
837
838 if (circuit->snd_stream != NULL)
839 {
840 stream_free (circuit->snd_stream);
841 circuit->snd_stream = NULL;
842 }
843
844 thread_cancel_event (master, circuit);
jardineb5d44e2003-12-23 08:09:43 +0000845
846 return;
847}
848
849void
850circuit_update_nlpids (struct isis_circuit *circuit)
851{
852 circuit->nlpids.count = 0;
hassof390d2c2004-09-10 20:48:21 +0000853
854 if (circuit->ip_router)
855 {
856 circuit->nlpids.nlpids[0] = NLPID_IP;
857 circuit->nlpids.count++;
858 }
jardineb5d44e2003-12-23 08:09:43 +0000859#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000860 if (circuit->ipv6_router)
861 {
862 circuit->nlpids.nlpids[circuit->nlpids.count] = NLPID_IPV6;
863 circuit->nlpids.count++;
864 }
jardineb5d44e2003-12-23 08:09:43 +0000865#endif /* HAVE_IPV6 */
866 return;
867}
868
Josh Bailey3f045a02012-03-24 08:35:20 -0700869void
870isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty,
871 char detail)
872{
873 if (detail == ISIS_UI_LEVEL_BRIEF)
874 {
875 vty_out (vty, " %-12s", circuit->interface->name);
876 vty_out (vty, "0x%-7x", circuit->circuit_id);
877 vty_out (vty, "%-9s", circuit_state2string (circuit->state));
878 vty_out (vty, "%-9s", circuit_type2string (circuit->circ_type));
879 vty_out (vty, "%-9s", circuit_t2string (circuit->is_type));
880 vty_out (vty, "%s", VTY_NEWLINE);
881 }
882
883 if (detail == ISIS_UI_LEVEL_DETAIL)
884 {
885 vty_out (vty, " Interface: %s", circuit->interface->name);
886 vty_out (vty, ", State: %s", circuit_state2string (circuit->state));
887 if (circuit->is_passive)
888 vty_out (vty, ", Passive");
889 else
890 vty_out (vty, ", Active");
891 vty_out (vty, ", Circuit Id: 0x%x", circuit->circuit_id);
892 vty_out (vty, "%s", VTY_NEWLINE);
893 vty_out (vty, " Type: %s", circuit_type2string (circuit->circ_type));
894 vty_out (vty, ", Level: %s", circuit_t2string (circuit->is_type));
895 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
896 vty_out (vty, ", SNPA: %-10s", snpa_print (circuit->u.bc.snpa));
897 vty_out (vty, "%s", VTY_NEWLINE);
898 if (circuit->is_type & IS_LEVEL_1)
899 {
900 vty_out (vty, " Level-1 Information:%s", VTY_NEWLINE);
901 if (circuit->area->newmetric)
902 vty_out (vty, " Metric: %d", circuit->te_metric[0]);
903 else
904 vty_out (vty, " Metric: %d",
905 circuit->metrics[0].metric_default);
906 if (!circuit->is_passive)
907 {
908 vty_out (vty, ", Active neighbors: %u%s",
909 circuit->upadjcount[0], VTY_NEWLINE);
910 vty_out (vty, " Hello interval: %u, "
911 "Holddown count: %u %s%s",
912 circuit->hello_interval[0],
913 circuit->hello_multiplier[0],
914 (circuit->pad_hellos ? "(pad)" : "(no-pad)"),
915 VTY_NEWLINE);
916 vty_out (vty, " CNSP interval: %u, "
917 "PSNP interval: %u%s",
918 circuit->csnp_interval[0],
919 circuit->psnp_interval[0], VTY_NEWLINE);
920 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
921 vty_out (vty, " LAN Priority: %u, %s%s",
922 circuit->priority[0],
923 (circuit->u.bc.is_dr[0] ? \
924 "is DIS" : "is not DIS"), VTY_NEWLINE);
925 }
926 else
927 {
928 vty_out (vty, "%s", VTY_NEWLINE);
929 }
930 }
931 if (circuit->is_type & IS_LEVEL_2)
932 {
933 vty_out (vty, " Level-2 Information:%s", VTY_NEWLINE);
934 if (circuit->area->newmetric)
935 vty_out (vty, " Metric: %d", circuit->te_metric[1]);
936 else
937 vty_out (vty, " Metric: %d",
938 circuit->metrics[1].metric_default);
939 if (!circuit->is_passive)
940 {
941 vty_out (vty, ", Active neighbors: %u%s",
942 circuit->upadjcount[1], VTY_NEWLINE);
943 vty_out (vty, " Hello interval: %u, "
944 "Holddown count: %u %s%s",
945 circuit->hello_interval[1],
946 circuit->hello_multiplier[1],
947 (circuit->pad_hellos ? "(pad)" : "(no-pad)"),
948 VTY_NEWLINE);
949 vty_out (vty, " CNSP interval: %u, "
950 "PSNP interval: %u%s",
951 circuit->csnp_interval[1],
952 circuit->psnp_interval[1], VTY_NEWLINE);
953 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
954 vty_out (vty, " LAN Priority: %u, %s%s",
955 circuit->priority[1],
956 (circuit->u.bc.is_dr[1] ? \
957 "is DIS" : "is not DIS"), VTY_NEWLINE);
958 }
959 else
960 {
961 vty_out (vty, "%s", VTY_NEWLINE);
962 }
963 }
964 if (circuit->ip_addrs && listcount (circuit->ip_addrs) > 0)
965 {
966 struct listnode *node;
967 struct prefix *ip_addr;
968 u_char buf[BUFSIZ];
969 vty_out (vty, " IP Prefix(es):%s", VTY_NEWLINE);
970 for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip_addr))
971 {
972 prefix2str (ip_addr, (char*)buf, BUFSIZ),
973 vty_out (vty, " %s%s", buf, VTY_NEWLINE);
974 }
975 }
976 vty_out (vty, "%s", VTY_NEWLINE);
977 }
978 return;
979}
980
jardineb5d44e2003-12-23 08:09:43 +0000981int
hassof390d2c2004-09-10 20:48:21 +0000982isis_interface_config_write (struct vty *vty)
jardineb5d44e2003-12-23 08:09:43 +0000983{
jardineb5d44e2003-12-23 08:09:43 +0000984 int write = 0;
hasso3fdb2dd2005-09-28 18:45:54 +0000985 struct listnode *node, *node2;
jardineb5d44e2003-12-23 08:09:43 +0000986 struct interface *ifp;
987 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -0700988 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +0000989 int i;
jardineb5d44e2003-12-23 08:09:43 +0000990
hasso3fdb2dd2005-09-28 18:45:54 +0000991 for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
jardineb5d44e2003-12-23 08:09:43 +0000992 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700993 /* IF name */
994 vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE);
995 write++;
996 /* IF desc */
997 if (ifp->desc)
998 {
999 vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE);
1000 write++;
1001 }
1002 /* ISIS Circuit */
1003 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node2, area))
1004 {
1005 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
1006 if (circuit == NULL)
1007 continue;
1008 if (circuit->ip_router)
1009 {
1010 vty_out (vty, " ip router isis %s%s", area->area_tag,
1011 VTY_NEWLINE);
1012 write++;
1013 }
1014 if (circuit->is_passive)
1015 {
1016 vty_out (vty, " isis passive%s", VTY_NEWLINE);
1017 write++;
1018 }
1019 if (circuit->circ_type_config == CIRCUIT_T_P2P)
1020 {
1021 vty_out (vty, " isis network point-to-point%s", VTY_NEWLINE);
1022 write++;
1023 }
jardineb5d44e2003-12-23 08:09:43 +00001024#ifdef HAVE_IPV6
Josh Bailey3f045a02012-03-24 08:35:20 -07001025 if (circuit->ipv6_router)
1026 {
1027 vty_out (vty, " ipv6 router isis %s%s", area->area_tag,
1028 VTY_NEWLINE);
1029 write++;
1030 }
jardineb5d44e2003-12-23 08:09:43 +00001031#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +00001032
Josh Bailey3f045a02012-03-24 08:35:20 -07001033 /* ISIS - circuit type */
1034 if (circuit->is_type == IS_LEVEL_1)
1035 {
1036 vty_out (vty, " isis circuit-type level-1%s", VTY_NEWLINE);
1037 write++;
1038 }
1039 else
1040 {
1041 if (circuit->is_type == IS_LEVEL_2)
1042 {
1043 vty_out (vty, " isis circuit-type level-2-only%s",
1044 VTY_NEWLINE);
1045 write++;
1046 }
1047 }
jardineb5d44e2003-12-23 08:09:43 +00001048
Josh Bailey3f045a02012-03-24 08:35:20 -07001049 /* ISIS - CSNP interval */
1050 if (circuit->csnp_interval[0] == circuit->csnp_interval[1])
1051 {
1052 if (circuit->csnp_interval[0] != DEFAULT_CSNP_INTERVAL)
1053 {
1054 vty_out (vty, " isis csnp-interval %d%s",
1055 circuit->csnp_interval[0], VTY_NEWLINE);
1056 write++;
1057 }
1058 }
1059 else
1060 {
1061 for (i = 0; i < 2; i++)
1062 {
1063 if (circuit->csnp_interval[i] != DEFAULT_CSNP_INTERVAL)
1064 {
1065 vty_out (vty, " isis csnp-interval %d level-%d%s",
1066 circuit->csnp_interval[i], i + 1, VTY_NEWLINE);
1067 write++;
1068 }
1069 }
1070 }
jardineb5d44e2003-12-23 08:09:43 +00001071
Josh Bailey3f045a02012-03-24 08:35:20 -07001072 /* ISIS - PSNP interval */
1073 if (circuit->psnp_interval[0] == circuit->psnp_interval[1])
1074 {
1075 if (circuit->psnp_interval[0] != DEFAULT_PSNP_INTERVAL)
1076 {
1077 vty_out (vty, " isis psnp-interval %d%s",
1078 circuit->psnp_interval[0], VTY_NEWLINE);
1079 write++;
1080 }
1081 }
1082 else
1083 {
1084 for (i = 0; i < 2; i++)
1085 {
1086 if (circuit->psnp_interval[i] != DEFAULT_PSNP_INTERVAL)
1087 {
1088 vty_out (vty, " isis psnp-interval %d level-%d%s",
1089 circuit->psnp_interval[i], i + 1, VTY_NEWLINE);
1090 write++;
1091 }
1092 }
1093 }
jardineb5d44e2003-12-23 08:09:43 +00001094
Josh Bailey3f045a02012-03-24 08:35:20 -07001095 /* ISIS - Hello padding - Defaults to true so only display if false */
1096 if (circuit->pad_hellos == 0)
1097 {
1098 vty_out (vty, " no isis hello padding%s", VTY_NEWLINE);
1099 write++;
1100 }
jardineb5d44e2003-12-23 08:09:43 +00001101
Josh Bailey3f045a02012-03-24 08:35:20 -07001102 /* ISIS - Hello interval */
1103 if (circuit->hello_interval[0] == circuit->hello_interval[1])
1104 {
1105 if (circuit->hello_interval[0] != DEFAULT_HELLO_INTERVAL)
1106 {
1107 vty_out (vty, " isis hello-interval %d%s",
1108 circuit->hello_interval[0], VTY_NEWLINE);
1109 write++;
1110 }
1111 }
1112 else
1113 {
1114 for (i = 0; i < 2; i++)
1115 {
1116 if (circuit->hello_interval[i] != DEFAULT_HELLO_INTERVAL)
1117 {
1118 vty_out (vty, " isis hello-interval %d level-%d%s",
1119 circuit->hello_interval[i], i + 1, VTY_NEWLINE);
1120 write++;
1121 }
1122 }
1123 }
jardineb5d44e2003-12-23 08:09:43 +00001124
Josh Bailey3f045a02012-03-24 08:35:20 -07001125 /* ISIS - Hello Multiplier */
1126 if (circuit->hello_multiplier[0] == circuit->hello_multiplier[1])
1127 {
1128 if (circuit->hello_multiplier[0] != DEFAULT_HELLO_MULTIPLIER)
1129 {
1130 vty_out (vty, " isis hello-multiplier %d%s",
1131 circuit->hello_multiplier[0], VTY_NEWLINE);
1132 write++;
1133 }
1134 }
1135 else
1136 {
1137 for (i = 0; i < 2; i++)
1138 {
1139 if (circuit->hello_multiplier[i] != DEFAULT_HELLO_MULTIPLIER)
1140 {
1141 vty_out (vty, " isis hello-multiplier %d level-%d%s",
1142 circuit->hello_multiplier[i], i + 1,
1143 VTY_NEWLINE);
1144 write++;
1145 }
1146 }
1147 }
1148
1149 /* ISIS - Priority */
1150 if (circuit->priority[0] == circuit->priority[1])
1151 {
1152 if (circuit->priority[0] != DEFAULT_PRIORITY)
1153 {
1154 vty_out (vty, " isis priority %d%s",
1155 circuit->priority[0], VTY_NEWLINE);
1156 write++;
1157 }
1158 }
1159 else
1160 {
1161 for (i = 0; i < 2; i++)
1162 {
1163 if (circuit->priority[i] != DEFAULT_PRIORITY)
1164 {
1165 vty_out (vty, " isis priority %d level-%d%s",
1166 circuit->priority[i], i + 1, VTY_NEWLINE);
1167 write++;
1168 }
1169 }
1170 }
1171
1172 /* ISIS - Metric */
1173 if (circuit->te_metric[0] == circuit->te_metric[1])
1174 {
1175 if (circuit->te_metric[0] != DEFAULT_CIRCUIT_METRIC)
1176 {
1177 vty_out (vty, " isis metric %d%s", circuit->te_metric[0],
1178 VTY_NEWLINE);
1179 write++;
1180 }
1181 }
1182 else
1183 {
1184 for (i = 0; i < 2; i++)
1185 {
1186 if (circuit->te_metric[i] != DEFAULT_CIRCUIT_METRIC)
1187 {
1188 vty_out (vty, " isis metric %d level-%d%s",
1189 circuit->te_metric[i], i + 1, VTY_NEWLINE);
1190 write++;
1191 }
1192 }
1193 }
1194 if (circuit->passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
1195 {
1196 vty_out (vty, " isis password md5 %s%s", circuit->passwd.passwd,
1197 VTY_NEWLINE);
1198 write++;
1199 }
1200 else if (circuit->passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
1201 {
1202 vty_out (vty, " isis password clear %s%s", circuit->passwd.passwd,
1203 VTY_NEWLINE);
1204 write++;
1205 }
1206 }
1207 vty_out (vty, "!%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001208 }
hassof390d2c2004-09-10 20:48:21 +00001209
jardineb5d44e2003-12-23 08:09:43 +00001210 return write;
1211}
jardineb5d44e2003-12-23 08:09:43 +00001212
1213DEFUN (ip_router_isis,
1214 ip_router_isis_cmd,
1215 "ip router isis WORD",
1216 "Interface Internet Protocol config commands\n"
1217 "IP router interface commands\n"
1218 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +00001219 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +00001220{
Josh Bailey3f045a02012-03-24 08:35:20 -07001221 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +00001222 struct interface *ifp;
1223 struct isis_area *area;
Christian Frankef1fc1db2015-11-10 18:43:31 +01001224 int rv;
hassof390d2c2004-09-10 20:48:21 +00001225
1226 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001227 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +00001228
Josh Bailey3f045a02012-03-24 08:35:20 -07001229 /* Prevent more than one area per circuit */
1230 circuit = circuit_scan_by_ifp (ifp);
1231 if (circuit)
hassof390d2c2004-09-10 20:48:21 +00001232 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001233 if (circuit->ip_router == 1)
1234 {
1235 if (strcmp (circuit->area->area_tag, argv[0]))
1236 {
1237 vty_out (vty, "ISIS circuit is already defined on %s%s",
1238 circuit->area->area_tag, VTY_NEWLINE);
1239 return CMD_ERR_NOTHING_TODO;
1240 }
1241 return CMD_SUCCESS;
1242 }
jardineb5d44e2003-12-23 08:09:43 +00001243 }
hassof390d2c2004-09-10 20:48:21 +00001244
Josh Bailey3f045a02012-03-24 08:35:20 -07001245 if (isis_area_get (vty, argv[0]) != CMD_SUCCESS)
hassof390d2c2004-09-10 20:48:21 +00001246 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001247 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1248 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001249 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001250 area = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001251
Josh Bailey3f045a02012-03-24 08:35:20 -07001252 circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area);
Christian Frankef1fc1db2015-11-10 18:43:31 +01001253 if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP)
1254 {
1255 vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE);
1256 rv = CMD_WARNING;
1257 }
1258 else
1259 {
1260 isis_circuit_if_bind (circuit, ifp);
jardineb5d44e2003-12-23 08:09:43 +00001261
Christian Frankef1fc1db2015-11-10 18:43:31 +01001262 circuit->ip_router = 1;
1263 area->ip_circuits++;
1264 circuit_update_nlpids (circuit);
1265 rv = CMD_SUCCESS;
1266 }
jardineb5d44e2003-12-23 08:09:43 +00001267
1268 vty->node = INTERFACE_NODE;
Josh Bailey3f045a02012-03-24 08:35:20 -07001269 vty->index = ifp;
hassof390d2c2004-09-10 20:48:21 +00001270
Christian Frankef1fc1db2015-11-10 18:43:31 +01001271 return rv;
jardineb5d44e2003-12-23 08:09:43 +00001272}
1273
1274DEFUN (no_ip_router_isis,
1275 no_ip_router_isis_cmd,
1276 "no ip router isis WORD",
1277 NO_STR
1278 "Interface Internet Protocol config commands\n"
1279 "IP router interface commands\n"
1280 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +00001281 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +00001282{
jardineb5d44e2003-12-23 08:09:43 +00001283 struct interface *ifp;
1284 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001285 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +00001286
hassof390d2c2004-09-10 20:48:21 +00001287 ifp = (struct interface *) vty->index;
Josh Bailey3f045a02012-03-24 08:35:20 -07001288 if (!ifp)
1289 {
1290 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1291 return CMD_ERR_NO_MATCH;
1292 }
hassof390d2c2004-09-10 20:48:21 +00001293
jardineb5d44e2003-12-23 08:09:43 +00001294 area = isis_area_lookup (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001295 if (!area)
1296 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001297 vty_out (vty, "Can't find ISIS instance %s%s",
1298 argv[0], VTY_NEWLINE);
1299 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001300 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001301
1302 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +00001303 if (!circuit)
1304 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001305 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1306 ifp->name, VTY_NEWLINE);
1307 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001308 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001309
jardineb5d44e2003-12-23 08:09:43 +00001310 circuit->ip_router = 0;
1311 area->ip_circuits--;
1312#ifdef HAVE_IPV6
1313 if (circuit->ipv6_router == 0)
1314#endif
1315 isis_csm_state_change (ISIS_DISABLE, circuit, area);
hassof390d2c2004-09-10 20:48:21 +00001316
jardineb5d44e2003-12-23 08:09:43 +00001317 return CMD_SUCCESS;
1318}
1319
Josh Bailey3f045a02012-03-24 08:35:20 -07001320#ifdef HAVE_IPV6
1321DEFUN (ipv6_router_isis,
1322 ipv6_router_isis_cmd,
1323 "ipv6 router isis WORD",
1324 "IPv6 interface subcommands\n"
1325 "IPv6 Router interface commands\n"
1326 "IS-IS Routing for IPv6\n"
1327 "Routing process tag\n")
1328{
1329 struct isis_circuit *circuit;
1330 struct interface *ifp;
1331 struct isis_area *area;
Christian Frankef1fc1db2015-11-10 18:43:31 +01001332 int rv;
Josh Bailey3f045a02012-03-24 08:35:20 -07001333
1334 ifp = (struct interface *) vty->index;
1335 assert (ifp);
1336
1337 /* Prevent more than one area per circuit */
1338 circuit = circuit_scan_by_ifp (ifp);
1339 if (circuit)
1340 {
1341 if (circuit->ipv6_router == 1)
1342 {
1343 if (strcmp (circuit->area->area_tag, argv[0]))
1344 {
1345 vty_out (vty, "ISIS circuit is already defined for IPv6 on %s%s",
1346 circuit->area->area_tag, VTY_NEWLINE);
1347 return CMD_ERR_NOTHING_TODO;
1348 }
1349 return CMD_SUCCESS;
1350 }
1351 }
1352
1353 if (isis_area_get (vty, argv[0]) != CMD_SUCCESS)
1354 {
1355 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1356 return CMD_ERR_NO_MATCH;
1357 }
1358 area = vty->index;
1359
1360 circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area);
Christian Frankef1fc1db2015-11-10 18:43:31 +01001361 if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP)
1362 {
1363 vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE);
1364 rv = CMD_WARNING;
1365 }
1366 else
1367 {
1368 isis_circuit_if_bind (circuit, ifp);
Josh Bailey3f045a02012-03-24 08:35:20 -07001369
Christian Frankef1fc1db2015-11-10 18:43:31 +01001370 circuit->ipv6_router = 1;
1371 area->ipv6_circuits++;
1372 circuit_update_nlpids (circuit);
1373 rv = CMD_SUCCESS;
1374 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001375
1376 vty->node = INTERFACE_NODE;
1377 vty->index = ifp;
1378
Christian Frankef1fc1db2015-11-10 18:43:31 +01001379 return rv;
Josh Bailey3f045a02012-03-24 08:35:20 -07001380}
1381
1382DEFUN (no_ipv6_router_isis,
1383 no_ipv6_router_isis_cmd,
1384 "no ipv6 router isis WORD",
1385 NO_STR
1386 "IPv6 interface subcommands\n"
1387 "IPv6 Router interface commands\n"
1388 "IS-IS Routing for IPv6\n"
1389 "Routing process tag\n")
1390{
1391 struct interface *ifp;
1392 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001393 struct isis_circuit *circuit;
1394
1395 ifp = (struct interface *) vty->index;
1396 if (!ifp)
1397 {
1398 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1399 return CMD_ERR_NO_MATCH;
1400 }
1401
1402 area = isis_area_lookup (argv[0]);
1403 if (!area)
1404 {
1405 vty_out (vty, "Can't find ISIS instance %s%s",
1406 argv[0], VTY_NEWLINE);
1407 return CMD_ERR_NO_MATCH;
1408 }
1409
1410 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
1411 if (!circuit)
1412 {
1413 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1414 ifp->name, VTY_NEWLINE);
1415 return CMD_ERR_NO_MATCH;
1416 }
1417
1418 circuit->ipv6_router = 0;
1419 area->ipv6_circuits--;
1420 if (circuit->ip_router == 0)
1421 isis_csm_state_change (ISIS_DISABLE, circuit, area);
1422
1423 return CMD_SUCCESS;
1424}
1425#endif /* HAVE_IPV6 */
1426
1427DEFUN (isis_passive,
1428 isis_passive_cmd,
1429 "isis passive",
1430 "IS-IS commands\n"
1431 "Configure the passive mode for interface\n")
1432{
1433 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1434 if (!circuit)
1435 return CMD_ERR_NO_MATCH;
1436
1437 if (circuit->is_passive == 1)
1438 return CMD_SUCCESS;
1439
1440 if (circuit->state != C_STATE_UP)
1441 {
1442 circuit->is_passive = 1;
1443 }
1444 else
1445 {
1446 struct isis_area *area = circuit->area;
1447 isis_csm_state_change (ISIS_DISABLE, circuit, area);
1448 circuit->is_passive = 1;
1449 isis_csm_state_change (ISIS_ENABLE, circuit, area);
1450 }
1451
1452 return CMD_SUCCESS;
1453}
1454
1455DEFUN (no_isis_passive,
1456 no_isis_passive_cmd,
1457 "no isis passive",
1458 NO_STR
1459 "IS-IS commands\n"
1460 "Configure the passive mode for interface\n")
1461{
1462 struct interface *ifp;
1463 struct isis_circuit *circuit;
1464
1465 ifp = (struct interface *) vty->index;
1466 if (!ifp)
1467 {
1468 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1469 return CMD_ERR_NO_MATCH;
1470 }
1471
1472 /* FIXME: what is wrong with circuit = ifp->info ? */
1473 circuit = circuit_scan_by_ifp (ifp);
1474 if (!circuit)
1475 {
1476 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1477 ifp->name, VTY_NEWLINE);
1478 return CMD_ERR_NO_MATCH;
1479 }
1480
1481 if (if_is_loopback(ifp))
1482 {
1483 vty_out (vty, "Can't set no passive for loopback interface%s",
1484 VTY_NEWLINE);
1485 return CMD_ERR_AMBIGUOUS;
1486 }
1487
1488 if (circuit->is_passive == 0)
1489 return CMD_SUCCESS;
1490
1491 if (circuit->state != C_STATE_UP)
1492 {
1493 circuit->is_passive = 0;
1494 }
1495 else
1496 {
1497 struct isis_area *area = circuit->area;
1498 isis_csm_state_change (ISIS_DISABLE, circuit, area);
1499 circuit->is_passive = 0;
1500 isis_csm_state_change (ISIS_ENABLE, circuit, area);
1501 }
1502
1503 return CMD_SUCCESS;
1504}
1505
jardineb5d44e2003-12-23 08:09:43 +00001506DEFUN (isis_circuit_type,
1507 isis_circuit_type_cmd,
1508 "isis circuit-type (level-1|level-1-2|level-2-only)",
1509 "IS-IS commands\n"
1510 "Configure circuit type for interface\n"
1511 "Level-1 only adjacencies are formed\n"
1512 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +00001513 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +00001514{
Josh Bailey3f045a02012-03-24 08:35:20 -07001515 int circuit_type;
1516 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1517 if (!circuit)
1518 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001519
Josh Bailey3f045a02012-03-24 08:35:20 -07001520 circuit_type = string2circuit_t (argv[0]);
1521 if (!circuit_type)
hassof390d2c2004-09-10 20:48:21 +00001522 {
1523 vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -07001524 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001525 }
1526
Josh Bailey3f045a02012-03-24 08:35:20 -07001527 if (circuit->state == C_STATE_UP &&
1528 circuit->area->is_type != IS_LEVEL_1_AND_2 &&
1529 circuit->area->is_type != circuit_type)
hassof390d2c2004-09-10 20:48:21 +00001530 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001531 vty_out (vty, "Invalid circuit level for area %s.%s",
1532 circuit->area->area_tag, VTY_NEWLINE);
1533 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001534 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001535 isis_event_circuit_type_change (circuit, circuit_type);
hassof390d2c2004-09-10 20:48:21 +00001536
jardineb5d44e2003-12-23 08:09:43 +00001537 return CMD_SUCCESS;
1538}
1539
1540DEFUN (no_isis_circuit_type,
1541 no_isis_circuit_type_cmd,
1542 "no isis circuit-type (level-1|level-1-2|level-2-only)",
1543 NO_STR
1544 "IS-IS commands\n"
1545 "Configure circuit type for interface\n"
1546 "Level-1 only adjacencies are formed\n"
1547 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +00001548 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +00001549{
Josh Bailey3f045a02012-03-24 08:35:20 -07001550 int circuit_type;
1551 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1552 if (!circuit)
1553 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001554
jardineb5d44e2003-12-23 08:09:43 +00001555 /*
Josh Bailey3f045a02012-03-24 08:35:20 -07001556 * Set the circuits level to its default value
jardineb5d44e2003-12-23 08:09:43 +00001557 */
Josh Bailey3f045a02012-03-24 08:35:20 -07001558 if (circuit->state == C_STATE_UP)
1559 circuit_type = circuit->area->is_type;
1560 else
1561 circuit_type = IS_LEVEL_1_AND_2;
1562 isis_event_circuit_type_change (circuit, circuit_type);
hassof390d2c2004-09-10 20:48:21 +00001563
jardineb5d44e2003-12-23 08:09:43 +00001564 return CMD_SUCCESS;
1565}
1566
Josh Bailey3f045a02012-03-24 08:35:20 -07001567DEFUN (isis_passwd_md5,
1568 isis_passwd_md5_cmd,
1569 "isis password md5 WORD",
jardineb5d44e2003-12-23 08:09:43 +00001570 "IS-IS commands\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001571 "Configure the authentication password for a circuit\n"
1572 "Authentication type\n"
1573 "Circuit password\n")
jardineb5d44e2003-12-23 08:09:43 +00001574{
jardineb5d44e2003-12-23 08:09:43 +00001575 int len;
Josh Bailey3f045a02012-03-24 08:35:20 -07001576 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1577 if (!circuit)
1578 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001579
jardineb5d44e2003-12-23 08:09:43 +00001580 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001581 if (len > 254)
1582 {
1583 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -07001584 return CMD_ERR_AMBIGUOUS;
1585 }
1586 circuit->passwd.len = len;
1587 circuit->passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
1588 strncpy ((char *)circuit->passwd.passwd, argv[0], 255);
1589
1590 return CMD_SUCCESS;
1591}
1592
1593DEFUN (isis_passwd_clear,
1594 isis_passwd_clear_cmd,
1595 "isis password clear WORD",
1596 "IS-IS commands\n"
1597 "Configure the authentication password for a circuit\n"
1598 "Authentication type\n"
1599 "Circuit password\n")
1600{
1601 int len;
1602 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1603 if (!circuit)
1604 return CMD_ERR_NO_MATCH;
1605
1606 len = strlen (argv[0]);
1607 if (len > 254)
1608 {
1609 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
1610 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001611 }
jardineb5d44e2003-12-23 08:09:43 +00001612 circuit->passwd.len = len;
1613 circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001614 strncpy ((char *)circuit->passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001615
jardineb5d44e2003-12-23 08:09:43 +00001616 return CMD_SUCCESS;
1617}
1618
1619DEFUN (no_isis_passwd,
1620 no_isis_passwd_cmd,
1621 "no isis password",
1622 NO_STR
1623 "IS-IS commands\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001624 "Configure the authentication password for a circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001625{
Josh Bailey3f045a02012-03-24 08:35:20 -07001626 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1627 if (!circuit)
1628 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001629
jardineb5d44e2003-12-23 08:09:43 +00001630 memset (&circuit->passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +00001631
jardineb5d44e2003-12-23 08:09:43 +00001632 return CMD_SUCCESS;
1633}
1634
jardineb5d44e2003-12-23 08:09:43 +00001635DEFUN (isis_priority,
1636 isis_priority_cmd,
1637 "isis priority <0-127>",
1638 "IS-IS commands\n"
1639 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001640 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001641{
jardineb5d44e2003-12-23 08:09:43 +00001642 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001643 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1644 if (!circuit)
1645 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001646
1647 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001648 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1649 {
1650 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1651 prio, VTY_NEWLINE);
1652 return CMD_ERR_AMBIGUOUS;
1653 }
jardineb5d44e2003-12-23 08:09:43 +00001654
Josh Bailey3f045a02012-03-24 08:35:20 -07001655 circuit->priority[0] = prio;
1656 circuit->priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001657
jardineb5d44e2003-12-23 08:09:43 +00001658 return CMD_SUCCESS;
1659}
1660
1661DEFUN (no_isis_priority,
1662 no_isis_priority_cmd,
1663 "no isis priority",
1664 NO_STR
1665 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001666 "Set priority for Designated Router election\n")
jardineb5d44e2003-12-23 08:09:43 +00001667{
Josh Bailey3f045a02012-03-24 08:35:20 -07001668 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1669 if (!circuit)
1670 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001671
Josh Bailey3f045a02012-03-24 08:35:20 -07001672 circuit->priority[0] = DEFAULT_PRIORITY;
1673 circuit->priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001674
jardineb5d44e2003-12-23 08:09:43 +00001675 return CMD_SUCCESS;
1676}
1677
1678ALIAS (no_isis_priority,
1679 no_isis_priority_arg_cmd,
1680 "no isis priority <0-127>",
1681 NO_STR
1682 "IS-IS commands\n"
1683 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001684 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001685
1686DEFUN (isis_priority_l1,
1687 isis_priority_l1_cmd,
hassof390d2c2004-09-10 20:48:21 +00001688 "isis priority <0-127> level-1",
jardineb5d44e2003-12-23 08:09:43 +00001689 "IS-IS commands\n"
1690 "Set priority for Designated Router election\n"
1691 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001692 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001693{
jardineb5d44e2003-12-23 08:09:43 +00001694 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001695 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1696 if (!circuit)
1697 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001698
1699 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001700 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1701 {
1702 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1703 prio, VTY_NEWLINE);
1704 return CMD_ERR_AMBIGUOUS;
1705 }
jardineb5d44e2003-12-23 08:09:43 +00001706
Josh Bailey3f045a02012-03-24 08:35:20 -07001707 circuit->priority[0] = prio;
hassof390d2c2004-09-10 20:48:21 +00001708
jardineb5d44e2003-12-23 08:09:43 +00001709 return CMD_SUCCESS;
1710}
1711
1712DEFUN (no_isis_priority_l1,
1713 no_isis_priority_l1_cmd,
1714 "no isis priority level-1",
1715 NO_STR
1716 "IS-IS commands\n"
1717 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001718 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001719{
Josh Bailey3f045a02012-03-24 08:35:20 -07001720 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1721 if (!circuit)
1722 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001723
Josh Bailey3f045a02012-03-24 08:35:20 -07001724 circuit->priority[0] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001725
jardineb5d44e2003-12-23 08:09:43 +00001726 return CMD_SUCCESS;
1727}
1728
1729ALIAS (no_isis_priority_l1,
1730 no_isis_priority_l1_arg_cmd,
1731 "no isis priority <0-127> level-1",
1732 NO_STR
1733 "IS-IS commands\n"
1734 "Set priority for Designated Router election\n"
1735 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001736 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001737
1738DEFUN (isis_priority_l2,
1739 isis_priority_l2_cmd,
hassof390d2c2004-09-10 20:48:21 +00001740 "isis priority <0-127> level-2",
jardineb5d44e2003-12-23 08:09:43 +00001741 "IS-IS commands\n"
1742 "Set priority for Designated Router election\n"
1743 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001744 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001745{
jardineb5d44e2003-12-23 08:09:43 +00001746 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001747 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1748 if (!circuit)
1749 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001750
1751 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001752 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1753 {
1754 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1755 prio, VTY_NEWLINE);
1756 return CMD_ERR_AMBIGUOUS;
1757 }
jardineb5d44e2003-12-23 08:09:43 +00001758
Josh Bailey3f045a02012-03-24 08:35:20 -07001759 circuit->priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001760
jardineb5d44e2003-12-23 08:09:43 +00001761 return CMD_SUCCESS;
1762}
1763
1764DEFUN (no_isis_priority_l2,
1765 no_isis_priority_l2_cmd,
1766 "no isis priority level-2",
1767 NO_STR
1768 "IS-IS commands\n"
1769 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001770 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001771{
Josh Bailey3f045a02012-03-24 08:35:20 -07001772 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1773 if (!circuit)
1774 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001775
Josh Bailey3f045a02012-03-24 08:35:20 -07001776 circuit->priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001777
jardineb5d44e2003-12-23 08:09:43 +00001778 return CMD_SUCCESS;
1779}
1780
1781ALIAS (no_isis_priority_l2,
1782 no_isis_priority_l2_arg_cmd,
1783 "no isis priority <0-127> level-2",
1784 NO_STR
1785 "IS-IS commands\n"
1786 "Set priority for Designated Router election\n"
1787 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001788 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001789
1790/* Metric command */
Josh Bailey3f045a02012-03-24 08:35:20 -07001791DEFUN (isis_metric,
jardineb5d44e2003-12-23 08:09:43 +00001792 isis_metric_cmd,
hassof21fb272005-09-26 17:05:55 +00001793 "isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001794 "IS-IS commands\n"
1795 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001796 "Default metric value\n")
jardineb5d44e2003-12-23 08:09:43 +00001797{
jardineb5d44e2003-12-23 08:09:43 +00001798 int met;
Josh Bailey3f045a02012-03-24 08:35:20 -07001799 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1800 if (!circuit)
1801 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001802
1803 met = atoi (argv[0]);
1804
Josh Bailey3f045a02012-03-24 08:35:20 -07001805 /* RFC3787 section 5.1 */
1806 if (circuit->area && circuit->area->oldmetric == 1 &&
1807 met > MAX_NARROW_LINK_METRIC)
1808 {
1809 vty_out (vty, "Invalid metric %d - should be <0-63> "
1810 "when narrow metric type enabled%s",
1811 met, VTY_NEWLINE);
1812 return CMD_ERR_AMBIGUOUS;
1813 }
1814
1815 /* RFC4444 */
1816 if (circuit->area && circuit->area->newmetric == 1 &&
1817 met > MAX_WIDE_LINK_METRIC)
1818 {
1819 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
1820 "when wide metric type enabled%s",
1821 met, VTY_NEWLINE);
1822 return CMD_ERR_AMBIGUOUS;
1823 }
1824
hassof21fb272005-09-26 17:05:55 +00001825 circuit->te_metric[0] = met;
1826 circuit->te_metric[1] = met;
1827
jardineb5d44e2003-12-23 08:09:43 +00001828 circuit->metrics[0].metric_default = met;
1829 circuit->metrics[1].metric_default = met;
1830
Josh Bailey3f045a02012-03-24 08:35:20 -07001831 if (circuit->area)
1832 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
1833
jardineb5d44e2003-12-23 08:09:43 +00001834 return CMD_SUCCESS;
1835}
1836
1837DEFUN (no_isis_metric,
1838 no_isis_metric_cmd,
1839 "no isis metric",
1840 NO_STR
1841 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001842 "Set default metric for circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001843{
Josh Bailey3f045a02012-03-24 08:35:20 -07001844 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1845 if (!circuit)
1846 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001847
Josh Bailey3f045a02012-03-24 08:35:20 -07001848 circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC;
1849 circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC;
1850 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC;
1851 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC;
jardineb5d44e2003-12-23 08:09:43 +00001852
Josh Bailey3f045a02012-03-24 08:35:20 -07001853 if (circuit->area)
1854 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
jardineb5d44e2003-12-23 08:09:43 +00001855
1856 return CMD_SUCCESS;
1857}
1858
1859ALIAS (no_isis_metric,
1860 no_isis_metric_arg_cmd,
hassof21fb272005-09-26 17:05:55 +00001861 "no isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001862 NO_STR
1863 "IS-IS commands\n"
1864 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001865 "Default metric value\n")
1866
Josh Bailey3f045a02012-03-24 08:35:20 -07001867DEFUN (isis_metric_l1,
1868 isis_metric_l1_cmd,
1869 "isis metric <0-16777215> level-1",
1870 "IS-IS commands\n"
1871 "Set default metric for circuit\n"
1872 "Default metric value\n"
1873 "Specify metric for level-1 routing\n")
1874{
1875 int met;
1876 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1877 if (!circuit)
1878 return CMD_ERR_NO_MATCH;
1879
1880 met = atoi (argv[0]);
1881
1882 /* RFC3787 section 5.1 */
1883 if (circuit->area && circuit->area->oldmetric == 1 &&
1884 met > MAX_NARROW_LINK_METRIC)
1885 {
1886 vty_out (vty, "Invalid metric %d - should be <0-63> "
1887 "when narrow metric type enabled%s",
1888 met, VTY_NEWLINE);
1889 return CMD_ERR_AMBIGUOUS;
1890 }
1891
1892 /* RFC4444 */
1893 if (circuit->area && circuit->area->newmetric == 1 &&
1894 met > MAX_WIDE_LINK_METRIC)
1895 {
1896 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
1897 "when wide metric type enabled%s",
1898 met, VTY_NEWLINE);
1899 return CMD_ERR_AMBIGUOUS;
1900 }
1901
1902 circuit->te_metric[0] = met;
1903 circuit->metrics[0].metric_default = met;
1904
1905 if (circuit->area)
1906 lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0);
1907
1908 return CMD_SUCCESS;
1909}
1910
1911DEFUN (no_isis_metric_l1,
1912 no_isis_metric_l1_cmd,
1913 "no isis metric level-1",
1914 NO_STR
1915 "IS-IS commands\n"
1916 "Set default metric for circuit\n"
1917 "Specify metric for level-1 routing\n")
1918{
1919 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1920 if (!circuit)
1921 return CMD_ERR_NO_MATCH;
1922
1923 circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC;
1924 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC;
1925
1926 if (circuit->area)
1927 lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0);
1928
1929 return CMD_SUCCESS;
1930}
1931
1932ALIAS (no_isis_metric_l1,
1933 no_isis_metric_l1_arg_cmd,
1934 "no isis metric <0-16777215> level-1",
1935 NO_STR
1936 "IS-IS commands\n"
1937 "Set default metric for circuit\n"
1938 "Default metric value\n"
1939 "Specify metric for level-1 routing\n")
1940
1941DEFUN (isis_metric_l2,
1942 isis_metric_l2_cmd,
1943 "isis metric <0-16777215> level-2",
1944 "IS-IS commands\n"
1945 "Set default metric for circuit\n"
1946 "Default metric value\n"
1947 "Specify metric for level-2 routing\n")
1948{
1949 int met;
1950 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1951 if (!circuit)
1952 return CMD_ERR_NO_MATCH;
1953
1954 met = atoi (argv[0]);
1955
1956 /* RFC3787 section 5.1 */
1957 if (circuit->area && circuit->area->oldmetric == 1 &&
1958 met > MAX_NARROW_LINK_METRIC)
1959 {
1960 vty_out (vty, "Invalid metric %d - should be <0-63> "
1961 "when narrow metric type enabled%s",
1962 met, VTY_NEWLINE);
1963 return CMD_ERR_AMBIGUOUS;
1964 }
1965
1966 /* RFC4444 */
1967 if (circuit->area && circuit->area->newmetric == 1 &&
1968 met > MAX_WIDE_LINK_METRIC)
1969 {
1970 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
1971 "when wide metric type enabled%s",
1972 met, VTY_NEWLINE);
1973 return CMD_ERR_AMBIGUOUS;
1974 }
1975
1976 circuit->te_metric[1] = met;
1977 circuit->metrics[1].metric_default = met;
1978
1979 if (circuit->area)
1980 lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0);
1981
1982 return CMD_SUCCESS;
1983}
1984
1985DEFUN (no_isis_metric_l2,
1986 no_isis_metric_l2_cmd,
1987 "no isis metric level-2",
1988 NO_STR
1989 "IS-IS commands\n"
1990 "Set default metric for circuit\n"
1991 "Specify metric for level-2 routing\n")
1992{
1993 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1994 if (!circuit)
1995 return CMD_ERR_NO_MATCH;
1996
1997 circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC;
1998 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC;
1999
2000 if (circuit->area)
2001 lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0);
2002
2003 return CMD_SUCCESS;
2004}
2005
2006ALIAS (no_isis_metric_l2,
2007 no_isis_metric_l2_arg_cmd,
2008 "no isis metric <0-16777215> level-2",
2009 NO_STR
2010 "IS-IS commands\n"
2011 "Set default metric for circuit\n"
2012 "Default metric value\n"
2013 "Specify metric for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00002014/* end of metrics */
Josh Bailey3f045a02012-03-24 08:35:20 -07002015
hassof21fb272005-09-26 17:05:55 +00002016DEFUN (isis_hello_interval,
jardineb5d44e2003-12-23 08:09:43 +00002017 isis_hello_interval_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002018 "isis hello-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002019 "IS-IS commands\n"
2020 "Set Hello interval\n"
2021 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00002022 "Holdtime 1 seconds, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00002023{
jardineb5d44e2003-12-23 08:09:43 +00002024 int interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002025 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2026 if (!circuit)
2027 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002028
Josh Bailey3f045a02012-03-24 08:35:20 -07002029 interval = atoi (argv[0]);
2030 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002031 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002032 vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s",
2033 interval, VTY_NEWLINE);
2034 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002035 }
jardineb5d44e2003-12-23 08:09:43 +00002036
hassof390d2c2004-09-10 20:48:21 +00002037 circuit->hello_interval[0] = (u_int16_t) interval;
2038 circuit->hello_interval[1] = (u_int16_t) interval;
2039
jardineb5d44e2003-12-23 08:09:43 +00002040 return CMD_SUCCESS;
2041}
2042
2043DEFUN (no_isis_hello_interval,
2044 no_isis_hello_interval_cmd,
2045 "no isis hello-interval",
2046 NO_STR
2047 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002048 "Set Hello interval\n")
jardineb5d44e2003-12-23 08:09:43 +00002049{
Josh Bailey3f045a02012-03-24 08:35:20 -07002050 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2051 if (!circuit)
2052 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002053
Josh Bailey3f045a02012-03-24 08:35:20 -07002054 circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL;
2055 circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002056
jardineb5d44e2003-12-23 08:09:43 +00002057 return CMD_SUCCESS;
2058}
2059
2060ALIAS (no_isis_hello_interval,
2061 no_isis_hello_interval_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002062 "no isis hello-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002063 NO_STR
2064 "IS-IS commands\n"
2065 "Set Hello interval\n"
2066 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00002067 "Holdtime 1 second, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00002068
2069DEFUN (isis_hello_interval_l1,
2070 isis_hello_interval_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002071 "isis hello-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002072 "IS-IS commands\n"
2073 "Set Hello interval\n"
2074 "Hello interval value\n"
2075 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002076 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002077{
jardineb5d44e2003-12-23 08:09:43 +00002078 long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002079 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2080 if (!circuit)
2081 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002082
Josh Bailey3f045a02012-03-24 08:35:20 -07002083 interval = atoi (argv[0]);
2084 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002085 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002086 vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
2087 interval, VTY_NEWLINE);
2088 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002089 }
jardineb5d44e2003-12-23 08:09:43 +00002090
hassof390d2c2004-09-10 20:48:21 +00002091 circuit->hello_interval[0] = (u_int16_t) interval;
2092
jardineb5d44e2003-12-23 08:09:43 +00002093 return CMD_SUCCESS;
2094}
2095
2096DEFUN (no_isis_hello_interval_l1,
2097 no_isis_hello_interval_l1_cmd,
2098 "no isis hello-interval level-1",
2099 NO_STR
2100 "IS-IS commands\n"
2101 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00002102 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002103{
Josh Bailey3f045a02012-03-24 08:35:20 -07002104 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2105 if (!circuit)
2106 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002107
Josh Bailey3f045a02012-03-24 08:35:20 -07002108 circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002109
jardineb5d44e2003-12-23 08:09:43 +00002110 return CMD_SUCCESS;
2111}
2112
2113ALIAS (no_isis_hello_interval_l1,
2114 no_isis_hello_interval_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002115 "no isis hello-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002116 NO_STR
2117 "IS-IS commands\n"
2118 "Set Hello interval\n"
2119 "Hello interval value\n"
2120 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002121 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002122
2123DEFUN (isis_hello_interval_l2,
2124 isis_hello_interval_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002125 "isis hello-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002126 "IS-IS commands\n"
2127 "Set Hello interval\n"
2128 "Hello interval value\n"
2129 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002130 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002131{
jardineb5d44e2003-12-23 08:09:43 +00002132 long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002133 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2134 if (!circuit)
2135 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002136
Josh Bailey3f045a02012-03-24 08:35:20 -07002137 interval = atoi (argv[0]);
2138 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002139 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002140 vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
2141 interval, VTY_NEWLINE);
2142 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002143 }
jardineb5d44e2003-12-23 08:09:43 +00002144
hassof390d2c2004-09-10 20:48:21 +00002145 circuit->hello_interval[1] = (u_int16_t) interval;
2146
jardineb5d44e2003-12-23 08:09:43 +00002147 return CMD_SUCCESS;
2148}
2149
2150DEFUN (no_isis_hello_interval_l2,
2151 no_isis_hello_interval_l2_cmd,
2152 "no isis hello-interval level-2",
2153 NO_STR
2154 "IS-IS commands\n"
2155 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00002156 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002157{
Josh Bailey3f045a02012-03-24 08:35:20 -07002158 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2159 if (!circuit)
2160 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002161
Josh Bailey3f045a02012-03-24 08:35:20 -07002162 circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002163
jardineb5d44e2003-12-23 08:09:43 +00002164 return CMD_SUCCESS;
2165}
2166
2167ALIAS (no_isis_hello_interval_l2,
2168 no_isis_hello_interval_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002169 "no isis hello-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002170 NO_STR
2171 "IS-IS commands\n"
2172 "Set Hello interval\n"
2173 "Hello interval value\n"
2174 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002175 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002176
2177DEFUN (isis_hello_multiplier,
2178 isis_hello_multiplier_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002179 "isis hello-multiplier <2-100>",
jardineb5d44e2003-12-23 08:09:43 +00002180 "IS-IS commands\n"
2181 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002182 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00002183{
jardineb5d44e2003-12-23 08:09:43 +00002184 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002185 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2186 if (!circuit)
2187 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002188
2189 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002190 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2191 {
2192 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2193 mult, VTY_NEWLINE);
2194 return CMD_ERR_AMBIGUOUS;
2195 }
jardineb5d44e2003-12-23 08:09:43 +00002196
hassof390d2c2004-09-10 20:48:21 +00002197 circuit->hello_multiplier[0] = (u_int16_t) mult;
2198 circuit->hello_multiplier[1] = (u_int16_t) mult;
2199
jardineb5d44e2003-12-23 08:09:43 +00002200 return CMD_SUCCESS;
2201}
2202
2203DEFUN (no_isis_hello_multiplier,
2204 no_isis_hello_multiplier_cmd,
2205 "no isis hello-multiplier",
2206 NO_STR
2207 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002208 "Set multiplier for Hello holding time\n")
jardineb5d44e2003-12-23 08:09:43 +00002209{
Josh Bailey3f045a02012-03-24 08:35:20 -07002210 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2211 if (!circuit)
2212 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002213
Josh Bailey3f045a02012-03-24 08:35:20 -07002214 circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER;
2215 circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002216
2217 return CMD_SUCCESS;
2218}
2219
2220ALIAS (no_isis_hello_multiplier,
2221 no_isis_hello_multiplier_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002222 "no isis hello-multiplier <2-100>",
jardineb5d44e2003-12-23 08:09:43 +00002223 NO_STR
2224 "IS-IS commands\n"
2225 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002226 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00002227
2228DEFUN (isis_hello_multiplier_l1,
2229 isis_hello_multiplier_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002230 "isis hello-multiplier <2-100> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002231 "IS-IS commands\n"
2232 "Set multiplier for Hello holding time\n"
2233 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002234 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002235{
jardineb5d44e2003-12-23 08:09:43 +00002236 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002237 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2238 if (!circuit)
2239 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002240
2241 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002242 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2243 {
2244 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2245 mult, VTY_NEWLINE);
2246 return CMD_ERR_AMBIGUOUS;
2247 }
jardineb5d44e2003-12-23 08:09:43 +00002248
hassof390d2c2004-09-10 20:48:21 +00002249 circuit->hello_multiplier[0] = (u_int16_t) mult;
2250
jardineb5d44e2003-12-23 08:09:43 +00002251 return CMD_SUCCESS;
2252}
2253
2254DEFUN (no_isis_hello_multiplier_l1,
2255 no_isis_hello_multiplier_l1_cmd,
2256 "no isis hello-multiplier level-1",
2257 NO_STR
2258 "IS-IS commands\n"
2259 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002260 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002261{
Josh Bailey3f045a02012-03-24 08:35:20 -07002262 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2263 if (!circuit)
2264 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002265
Josh Bailey3f045a02012-03-24 08:35:20 -07002266 circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002267
2268 return CMD_SUCCESS;
2269}
2270
2271ALIAS (no_isis_hello_multiplier_l1,
2272 no_isis_hello_multiplier_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002273 "no isis hello-multiplier <2-100> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002274 NO_STR
2275 "IS-IS commands\n"
2276 "Set multiplier for Hello holding time\n"
2277 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002278 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002279
2280DEFUN (isis_hello_multiplier_l2,
2281 isis_hello_multiplier_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002282 "isis hello-multiplier <2-100> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002283 "IS-IS commands\n"
2284 "Set multiplier for Hello holding time\n"
2285 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002286 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002287{
jardineb5d44e2003-12-23 08:09:43 +00002288 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002289 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2290 if (!circuit)
2291 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002292
2293 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002294 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2295 {
2296 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2297 mult, VTY_NEWLINE);
2298 return CMD_ERR_AMBIGUOUS;
2299 }
jardineb5d44e2003-12-23 08:09:43 +00002300
hassof390d2c2004-09-10 20:48:21 +00002301 circuit->hello_multiplier[1] = (u_int16_t) mult;
2302
jardineb5d44e2003-12-23 08:09:43 +00002303 return CMD_SUCCESS;
2304}
2305
2306DEFUN (no_isis_hello_multiplier_l2,
2307 no_isis_hello_multiplier_l2_cmd,
2308 "no isis hello-multiplier level-2",
2309 NO_STR
2310 "IS-IS commands\n"
2311 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002312 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002313{
Josh Bailey3f045a02012-03-24 08:35:20 -07002314 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2315 if (!circuit)
2316 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002317
Josh Bailey3f045a02012-03-24 08:35:20 -07002318 circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002319
2320 return CMD_SUCCESS;
2321}
2322
2323ALIAS (no_isis_hello_multiplier_l2,
2324 no_isis_hello_multiplier_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002325 "no isis hello-multiplier <2-100> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002326 NO_STR
2327 "IS-IS commands\n"
2328 "Set multiplier for Hello holding time\n"
2329 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002330 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002331
Josh Bailey3f045a02012-03-24 08:35:20 -07002332DEFUN (isis_hello_padding,
2333 isis_hello_padding_cmd,
jardineb5d44e2003-12-23 08:09:43 +00002334 "isis hello padding",
2335 "IS-IS commands\n"
2336 "Add padding to IS-IS hello packets\n"
2337 "Pad hello packets\n"
2338 "<cr>\n")
2339{
Josh Bailey3f045a02012-03-24 08:35:20 -07002340 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2341 if (!circuit)
2342 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002343
Josh Bailey3f045a02012-03-24 08:35:20 -07002344 circuit->pad_hellos = 1;
hassof390d2c2004-09-10 20:48:21 +00002345
jardineb5d44e2003-12-23 08:09:43 +00002346 return CMD_SUCCESS;
2347}
2348
Josh Bailey3f045a02012-03-24 08:35:20 -07002349DEFUN (no_isis_hello_padding,
2350 no_isis_hello_padding_cmd,
jardineb5d44e2003-12-23 08:09:43 +00002351 "no isis hello padding",
2352 NO_STR
2353 "IS-IS commands\n"
2354 "Add padding to IS-IS hello packets\n"
2355 "Pad hello packets\n"
2356 "<cr>\n")
2357{
Josh Bailey3f045a02012-03-24 08:35:20 -07002358 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2359 if (!circuit)
2360 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002361
Josh Bailey3f045a02012-03-24 08:35:20 -07002362 circuit->pad_hellos = 0;
hassof390d2c2004-09-10 20:48:21 +00002363
jardineb5d44e2003-12-23 08:09:43 +00002364 return CMD_SUCCESS;
2365}
2366
2367DEFUN (csnp_interval,
2368 csnp_interval_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002369 "isis csnp-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002370 "IS-IS commands\n"
2371 "Set CSNP interval in seconds\n"
2372 "CSNP interval value\n")
2373{
jardineb5d44e2003-12-23 08:09:43 +00002374 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002375 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2376 if (!circuit)
2377 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002378
jardineb5d44e2003-12-23 08:09:43 +00002379 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002380 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2381 {
2382 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2383 interval, VTY_NEWLINE);
2384 return CMD_ERR_AMBIGUOUS;
2385 }
jardineb5d44e2003-12-23 08:09:43 +00002386
hassof390d2c2004-09-10 20:48:21 +00002387 circuit->csnp_interval[0] = (u_int16_t) interval;
2388 circuit->csnp_interval[1] = (u_int16_t) interval;
2389
jardineb5d44e2003-12-23 08:09:43 +00002390 return CMD_SUCCESS;
2391}
2392
2393DEFUN (no_csnp_interval,
2394 no_csnp_interval_cmd,
2395 "no isis csnp-interval",
2396 NO_STR
2397 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002398 "Set CSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002399{
Josh Bailey3f045a02012-03-24 08:35:20 -07002400 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2401 if (!circuit)
2402 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002403
Josh Bailey3f045a02012-03-24 08:35:20 -07002404 circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL;
2405 circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002406
jardineb5d44e2003-12-23 08:09:43 +00002407 return CMD_SUCCESS;
2408}
2409
2410ALIAS (no_csnp_interval,
2411 no_csnp_interval_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002412 "no isis csnp-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002413 NO_STR
2414 "IS-IS commands\n"
2415 "Set CSNP interval in seconds\n"
2416 "CSNP interval value\n")
2417
jardineb5d44e2003-12-23 08:09:43 +00002418DEFUN (csnp_interval_l1,
2419 csnp_interval_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002420 "isis csnp-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002421 "IS-IS commands\n"
2422 "Set CSNP interval in seconds\n"
2423 "CSNP interval value\n"
2424 "Specify interval for level-1 CSNPs\n")
2425{
jardineb5d44e2003-12-23 08:09:43 +00002426 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002427 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2428 if (!circuit)
2429 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002430
jardineb5d44e2003-12-23 08:09:43 +00002431 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002432 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2433 {
2434 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2435 interval, VTY_NEWLINE);
2436 return CMD_ERR_AMBIGUOUS;
2437 }
hassof390d2c2004-09-10 20:48:21 +00002438
2439 circuit->csnp_interval[0] = (u_int16_t) interval;
2440
jardineb5d44e2003-12-23 08:09:43 +00002441 return CMD_SUCCESS;
2442}
2443
2444DEFUN (no_csnp_interval_l1,
2445 no_csnp_interval_l1_cmd,
2446 "no isis csnp-interval level-1",
2447 NO_STR
2448 "IS-IS commands\n"
2449 "Set CSNP interval in seconds\n"
2450 "Specify interval for level-1 CSNPs\n")
2451{
Josh Bailey3f045a02012-03-24 08:35:20 -07002452 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2453 if (!circuit)
2454 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002455
Josh Bailey3f045a02012-03-24 08:35:20 -07002456 circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002457
jardineb5d44e2003-12-23 08:09:43 +00002458 return CMD_SUCCESS;
2459}
2460
2461ALIAS (no_csnp_interval_l1,
2462 no_csnp_interval_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002463 "no isis csnp-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002464 NO_STR
2465 "IS-IS commands\n"
2466 "Set CSNP interval in seconds\n"
2467 "CSNP interval value\n"
2468 "Specify interval for level-1 CSNPs\n")
2469
jardineb5d44e2003-12-23 08:09:43 +00002470DEFUN (csnp_interval_l2,
2471 csnp_interval_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002472 "isis csnp-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002473 "IS-IS commands\n"
2474 "Set CSNP interval in seconds\n"
2475 "CSNP interval value\n"
2476 "Specify interval for level-2 CSNPs\n")
2477{
jardineb5d44e2003-12-23 08:09:43 +00002478 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002479 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2480 if (!circuit)
2481 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002482
jardineb5d44e2003-12-23 08:09:43 +00002483 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002484 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2485 {
2486 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2487 interval, VTY_NEWLINE);
2488 return CMD_ERR_AMBIGUOUS;
2489 }
hassof390d2c2004-09-10 20:48:21 +00002490
2491 circuit->csnp_interval[1] = (u_int16_t) interval;
2492
jardineb5d44e2003-12-23 08:09:43 +00002493 return CMD_SUCCESS;
2494}
2495
2496DEFUN (no_csnp_interval_l2,
2497 no_csnp_interval_l2_cmd,
2498 "no isis csnp-interval level-2",
2499 NO_STR
2500 "IS-IS commands\n"
2501 "Set CSNP interval in seconds\n"
2502 "Specify interval for level-2 CSNPs\n")
2503{
Josh Bailey3f045a02012-03-24 08:35:20 -07002504 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2505 if (!circuit)
2506 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002507
Josh Bailey3f045a02012-03-24 08:35:20 -07002508 circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002509
jardineb5d44e2003-12-23 08:09:43 +00002510 return CMD_SUCCESS;
2511}
2512
2513ALIAS (no_csnp_interval_l2,
2514 no_csnp_interval_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002515 "no isis csnp-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002516 NO_STR
2517 "IS-IS commands\n"
2518 "Set CSNP interval in seconds\n"
2519 "CSNP interval value\n"
2520 "Specify interval for level-2 CSNPs\n")
2521
Josh Bailey3f045a02012-03-24 08:35:20 -07002522DEFUN (psnp_interval,
2523 psnp_interval_cmd,
2524 "isis psnp-interval <1-120>",
2525 "IS-IS commands\n"
2526 "Set PSNP interval in seconds\n"
2527 "PSNP interval value\n")
jardineb5d44e2003-12-23 08:09:43 +00002528{
Josh Bailey3f045a02012-03-24 08:35:20 -07002529 unsigned long interval;
2530 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2531 if (!circuit)
2532 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002533
Josh Bailey3f045a02012-03-24 08:35:20 -07002534 interval = atol (argv[0]);
2535 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002536 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002537 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2538 interval, VTY_NEWLINE);
2539 return CMD_ERR_AMBIGUOUS;
jardineb5d44e2003-12-23 08:09:43 +00002540 }
jardineb5d44e2003-12-23 08:09:43 +00002541
Josh Bailey3f045a02012-03-24 08:35:20 -07002542 circuit->psnp_interval[0] = (u_int16_t) interval;
2543 circuit->psnp_interval[1] = (u_int16_t) interval;
jardineb5d44e2003-12-23 08:09:43 +00002544
2545 return CMD_SUCCESS;
2546}
2547
Josh Bailey3f045a02012-03-24 08:35:20 -07002548DEFUN (no_psnp_interval,
2549 no_psnp_interval_cmd,
2550 "no isis psnp-interval",
jardineb5d44e2003-12-23 08:09:43 +00002551 NO_STR
Josh Bailey3f045a02012-03-24 08:35:20 -07002552 "IS-IS commands\n"
2553 "Set PSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002554{
Josh Bailey3f045a02012-03-24 08:35:20 -07002555 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2556 if (!circuit)
2557 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002558
Josh Bailey3f045a02012-03-24 08:35:20 -07002559 circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL;
2560 circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL;
jardineb5d44e2003-12-23 08:09:43 +00002561
2562 return CMD_SUCCESS;
2563}
jardineb5d44e2003-12-23 08:09:43 +00002564
Josh Bailey3f045a02012-03-24 08:35:20 -07002565ALIAS (no_psnp_interval,
2566 no_psnp_interval_arg_cmd,
2567 "no isis psnp-interval <1-120>",
2568 NO_STR
2569 "IS-IS commands\n"
2570 "Set PSNP interval in seconds\n"
2571 "PSNP interval value\n")
2572
2573DEFUN (psnp_interval_l1,
2574 psnp_interval_l1_cmd,
2575 "isis psnp-interval <1-120> level-1",
2576 "IS-IS commands\n"
2577 "Set PSNP interval in seconds\n"
2578 "PSNP interval value\n"
2579 "Specify interval for level-1 PSNPs\n")
2580{
2581 unsigned long interval;
2582 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2583 if (!circuit)
2584 return CMD_ERR_NO_MATCH;
2585
2586 interval = atol (argv[0]);
2587 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
2588 {
2589 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2590 interval, VTY_NEWLINE);
2591 return CMD_ERR_AMBIGUOUS;
2592 }
2593
2594 circuit->psnp_interval[0] = (u_int16_t) interval;
2595
2596 return CMD_SUCCESS;
2597}
2598
2599DEFUN (no_psnp_interval_l1,
2600 no_psnp_interval_l1_cmd,
2601 "no isis psnp-interval level-1",
2602 NO_STR
2603 "IS-IS commands\n"
2604 "Set PSNP interval in seconds\n"
2605 "Specify interval for level-1 PSNPs\n")
2606{
2607 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2608 if (!circuit)
2609 return CMD_ERR_NO_MATCH;
2610
2611 circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL;
2612
2613 return CMD_SUCCESS;
2614}
2615
2616ALIAS (no_psnp_interval_l1,
2617 no_psnp_interval_l1_arg_cmd,
2618 "no isis psnp-interval <1-120> level-1",
2619 NO_STR
2620 "IS-IS commands\n"
2621 "Set PSNP interval in seconds\n"
2622 "PSNP interval value\n"
2623 "Specify interval for level-1 PSNPs\n")
2624
2625DEFUN (psnp_interval_l2,
2626 psnp_interval_l2_cmd,
2627 "isis psnp-interval <1-120> level-2",
2628 "IS-IS commands\n"
2629 "Set PSNP interval in seconds\n"
2630 "PSNP interval value\n"
2631 "Specify interval for level-2 PSNPs\n")
2632{
2633 unsigned long interval;
2634 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2635 if (!circuit)
2636 return CMD_ERR_NO_MATCH;
2637
2638 interval = atol (argv[0]);
2639 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
2640 {
2641 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2642 interval, VTY_NEWLINE);
2643 return CMD_ERR_AMBIGUOUS;
2644 }
2645
2646 circuit->psnp_interval[1] = (u_int16_t) interval;
2647
2648 return CMD_SUCCESS;
2649}
2650
2651DEFUN (no_psnp_interval_l2,
2652 no_psnp_interval_l2_cmd,
2653 "no isis psnp-interval level-2",
2654 NO_STR
2655 "IS-IS commands\n"
2656 "Set PSNP interval in seconds\n"
2657 "Specify interval for level-2 PSNPs\n")
2658{
2659 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2660 if (!circuit)
2661 return CMD_ERR_NO_MATCH;
2662
2663 circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL;
2664
2665 return CMD_SUCCESS;
2666}
2667
2668ALIAS (no_psnp_interval_l2,
2669 no_psnp_interval_l2_arg_cmd,
2670 "no isis psnp-interval <1-120> level-2",
2671 NO_STR
2672 "IS-IS commands\n"
2673 "Set PSNP interval in seconds\n"
2674 "PSNP interval value\n"
2675 "Specify interval for level-2 PSNPs\n")
2676
2677struct cmd_node interface_node = {
jardineb5d44e2003-12-23 08:09:43 +00002678 INTERFACE_NODE,
2679 "%s(config-if)# ",
2680 1,
2681};
2682
Josh Bailey3f045a02012-03-24 08:35:20 -07002683DEFUN (isis_network,
2684 isis_network_cmd,
2685 "isis network point-to-point",
2686 "IS-IS commands\n"
2687 "Set network type\n"
2688 "point-to-point network type\n")
2689{
2690 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2691 if (!circuit)
2692 return CMD_ERR_NO_MATCH;
2693
2694 /* RFC5309 section 4 */
2695 if (circuit->circ_type == CIRCUIT_T_P2P)
2696 return CMD_SUCCESS;
2697
2698 if (circuit->state != C_STATE_UP)
2699 {
2700 circuit->circ_type = CIRCUIT_T_P2P;
2701 circuit->circ_type_config = CIRCUIT_T_P2P;
2702 }
2703 else
2704 {
2705 struct isis_area *area = circuit->area;
2706 if (!if_is_broadcast (circuit->interface))
2707 {
2708 vty_out (vty, "isis network point-to-point "
2709 "is valid only on broadcast interfaces%s",
2710 VTY_NEWLINE);
2711 return CMD_ERR_AMBIGUOUS;
2712 }
2713
2714 isis_csm_state_change (ISIS_DISABLE, circuit, area);
2715 circuit->circ_type = CIRCUIT_T_P2P;
2716 circuit->circ_type_config = CIRCUIT_T_P2P;
2717 isis_csm_state_change (ISIS_ENABLE, circuit, area);
2718 }
2719
2720 return CMD_SUCCESS;
2721}
2722
2723DEFUN (no_isis_network,
2724 no_isis_network_cmd,
2725 "no isis network point-to-point",
2726 NO_STR
2727 "IS-IS commands\n"
2728 "Set network type for circuit\n"
2729 "point-to-point network type\n")
2730{
2731 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2732 if (!circuit)
2733 return CMD_ERR_NO_MATCH;
2734
2735 /* RFC5309 section 4 */
2736 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
2737 return CMD_SUCCESS;
2738
2739 if (circuit->state != C_STATE_UP)
2740 {
2741 circuit->circ_type = CIRCUIT_T_BROADCAST;
2742 circuit->circ_type_config = CIRCUIT_T_BROADCAST;
2743 }
2744 else
2745 {
2746 struct isis_area *area = circuit->area;
2747 if (circuit->interface &&
2748 !if_is_broadcast (circuit->interface))
2749 {
2750 vty_out (vty, "no isis network point-to-point "
2751 "is valid only on broadcast interfaces%s",
2752 VTY_NEWLINE);
2753 return CMD_ERR_AMBIGUOUS;
2754 }
2755
2756 isis_csm_state_change (ISIS_DISABLE, circuit, area);
2757 circuit->circ_type = CIRCUIT_T_BROADCAST;
2758 circuit->circ_type_config = CIRCUIT_T_BROADCAST;
2759 isis_csm_state_change (ISIS_ENABLE, circuit, area);
2760 }
2761
2762 return CMD_SUCCESS;
2763}
2764
jardineb5d44e2003-12-23 08:09:43 +00002765int
2766isis_if_new_hook (struct interface *ifp)
2767{
jardineb5d44e2003-12-23 08:09:43 +00002768 return 0;
2769}
2770
2771int
2772isis_if_delete_hook (struct interface *ifp)
2773{
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002774 struct isis_circuit *circuit;
2775 /* Clean up the circuit data */
2776 if (ifp && ifp->info)
2777 {
2778 circuit = ifp->info;
2779 isis_csm_state_change (IF_DOWN_FROM_Z, circuit, circuit->area);
2780 isis_csm_state_change (ISIS_DISABLE, circuit, circuit->area);
2781 }
2782
jardineb5d44e2003-12-23 08:09:43 +00002783 return 0;
2784}
2785
jardineb5d44e2003-12-23 08:09:43 +00002786void
2787isis_circuit_init ()
2788{
jardineb5d44e2003-12-23 08:09:43 +00002789 /* Initialize Zebra interface data structure */
jardineb5d44e2003-12-23 08:09:43 +00002790 if_add_hook (IF_NEW_HOOK, isis_if_new_hook);
2791 if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook);
2792
2793 /* Install interface node */
2794 install_node (&interface_node, isis_interface_config_write);
2795 install_element (CONFIG_NODE, &interface_cmd);
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002796 install_element (CONFIG_NODE, &no_interface_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002797
2798 install_default (INTERFACE_NODE);
2799 install_element (INTERFACE_NODE, &interface_desc_cmd);
2800 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
2801
2802 install_element (INTERFACE_NODE, &ip_router_isis_cmd);
2803 install_element (INTERFACE_NODE, &no_ip_router_isis_cmd);
2804
Josh Bailey3f045a02012-03-24 08:35:20 -07002805 install_element (INTERFACE_NODE, &isis_passive_cmd);
2806 install_element (INTERFACE_NODE, &no_isis_passive_cmd);
2807
jardineb5d44e2003-12-23 08:09:43 +00002808 install_element (INTERFACE_NODE, &isis_circuit_type_cmd);
2809 install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd);
2810
Josh Bailey3f045a02012-03-24 08:35:20 -07002811 install_element (INTERFACE_NODE, &isis_passwd_clear_cmd);
2812 install_element (INTERFACE_NODE, &isis_passwd_md5_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002813 install_element (INTERFACE_NODE, &no_isis_passwd_cmd);
2814
2815 install_element (INTERFACE_NODE, &isis_priority_cmd);
2816 install_element (INTERFACE_NODE, &no_isis_priority_cmd);
2817 install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd);
2818 install_element (INTERFACE_NODE, &isis_priority_l1_cmd);
2819 install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd);
2820 install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd);
2821 install_element (INTERFACE_NODE, &isis_priority_l2_cmd);
2822 install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd);
2823 install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd);
2824
2825 install_element (INTERFACE_NODE, &isis_metric_cmd);
2826 install_element (INTERFACE_NODE, &no_isis_metric_cmd);
2827 install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07002828 install_element (INTERFACE_NODE, &isis_metric_l1_cmd);
2829 install_element (INTERFACE_NODE, &no_isis_metric_l1_cmd);
2830 install_element (INTERFACE_NODE, &no_isis_metric_l1_arg_cmd);
2831 install_element (INTERFACE_NODE, &isis_metric_l2_cmd);
2832 install_element (INTERFACE_NODE, &no_isis_metric_l2_cmd);
2833 install_element (INTERFACE_NODE, &no_isis_metric_l2_arg_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002834
2835 install_element (INTERFACE_NODE, &isis_hello_interval_cmd);
2836 install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd);
2837 install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd);
2838 install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd);
2839 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd);
2840 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd);
2841 install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd);
2842 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd);
2843 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd);
2844
2845 install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd);
2846 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
2847 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd);
2848 install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd);
2849 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd);
2850 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd);
2851 install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd);
2852 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd);
2853 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd);
2854
Josh Bailey3f045a02012-03-24 08:35:20 -07002855 install_element (INTERFACE_NODE, &isis_hello_padding_cmd);
2856 install_element (INTERFACE_NODE, &no_isis_hello_padding_cmd);
2857
jardineb5d44e2003-12-23 08:09:43 +00002858 install_element (INTERFACE_NODE, &csnp_interval_cmd);
2859 install_element (INTERFACE_NODE, &no_csnp_interval_cmd);
2860 install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd);
2861 install_element (INTERFACE_NODE, &csnp_interval_l1_cmd);
2862 install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd);
2863 install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd);
2864 install_element (INTERFACE_NODE, &csnp_interval_l2_cmd);
2865 install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd);
2866 install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd);
2867
Josh Bailey3f045a02012-03-24 08:35:20 -07002868 install_element (INTERFACE_NODE, &psnp_interval_cmd);
2869 install_element (INTERFACE_NODE, &no_psnp_interval_cmd);
2870 install_element (INTERFACE_NODE, &no_psnp_interval_arg_cmd);
2871 install_element (INTERFACE_NODE, &psnp_interval_l1_cmd);
2872 install_element (INTERFACE_NODE, &no_psnp_interval_l1_cmd);
2873 install_element (INTERFACE_NODE, &no_psnp_interval_l1_arg_cmd);
2874 install_element (INTERFACE_NODE, &psnp_interval_l2_cmd);
2875 install_element (INTERFACE_NODE, &no_psnp_interval_l2_cmd);
2876 install_element (INTERFACE_NODE, &no_psnp_interval_l2_arg_cmd);
2877
2878 install_element (INTERFACE_NODE, &isis_network_cmd);
2879 install_element (INTERFACE_NODE, &no_isis_network_cmd);
2880
jardineb5d44e2003-12-23 08:09:43 +00002881#ifdef HAVE_IPV6
2882 install_element (INTERFACE_NODE, &ipv6_router_isis_cmd);
2883 install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002884#endif
jardineb5d44e2003-12-23 08:09:43 +00002885}