blob: a71ab2163415ca1953bafa60d8fdcab53af6ab4f [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);
Christian Frankeec874162015-11-10 18:33:12 +0100329 zlog_warn ("Current ip addresses on %s:", circuit->interface->name);
330 for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node, ip))
331 {
332 prefix2str((struct prefix*)ip, (char *)buf, BUFSIZ);
333 zlog_warn(" %s", buf);
334 }
335 zlog_warn("End of addresses");
hassof891f442004-09-14 13:54:30 +0000336 }
David Lampartere8aca322012-11-27 01:10:30 +0000337
338 prefix_ipv4_free (ipv4);
hassof891f442004-09-14 13:54:30 +0000339 }
340#ifdef HAVE_IPV6
341 if (connected->address->family == AF_INET6)
342 {
343 ipv6 = prefix_ipv6_new ();
344 ipv6->prefixlen = connected->address->prefixlen;
345 ipv6->prefix = connected->address->u.prefix6;
346
347 if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix))
348 {
paul1eb8ef22005-04-07 07:30:20 +0000349 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_link, node, ip6))
hassof891f442004-09-14 13:54:30 +0000350 {
hassof891f442004-09-14 13:54:30 +0000351 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
352 break;
353 }
354 if (ip6)
355 {
356 listnode_delete (circuit->ipv6_link, ip6);
357 found = 1;
358 }
359 }
360 else
361 {
paul1eb8ef22005-04-07 07:30:20 +0000362 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, node, ip6))
hassof891f442004-09-14 13:54:30 +0000363 {
hassof891f442004-09-14 13:54:30 +0000364 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
365 break;
366 }
367 if (ip6)
368 {
369 listnode_delete (circuit->ipv6_non_link, ip6);
370 found = 1;
371 }
372 }
373
374 if (!found)
375 {
hassof7c43dc2004-09-26 16:24:14 +0000376 prefix2str (connected->address, (char *)buf, BUFSIZ);
Josh Bailey3f045a02012-03-24 08:35:20 -0700377 zlog_warn ("Nonexitant ip address %s removal attempt from \
378 circuit %d", buf, circuit->circuit_id);
Christian Frankeec874162015-11-10 18:33:12 +0100379 zlog_warn ("Current ip addresses on %s:", circuit->interface->name);
380 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node, ip6))
381 {
382 prefix2str((struct prefix*)ip6, (char *)buf, BUFSIZ);
383 zlog_warn(" %s", buf);
384 }
385 zlog_warn(" -----");
386 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node, ip6))
387 {
388 prefix2str((struct prefix*)ip6, (char *)buf, BUFSIZ);
389 zlog_warn(" %s", buf);
390 }
391 zlog_warn("End of addresses");
hassof891f442004-09-14 13:54:30 +0000392 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700393 else if (circuit->area)
394 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
David Lampartere8aca322012-11-27 01:10:30 +0000395
396 prefix_ipv6_free (ipv6);
hassof891f442004-09-14 13:54:30 +0000397 }
398#endif /* HAVE_IPV6 */
399 return;
jardineb5d44e2003-12-23 08:09:43 +0000400}
401
Josh Bailey3f045a02012-03-24 08:35:20 -0700402static u_char
403isis_circuit_id_gen (struct interface *ifp)
404{
405 u_char id = 0;
406 char ifname[16];
407 unsigned int i;
408 int start = -1, end = -1;
409
410 /*
411 * Get a stable circuit id from ifname. This makes
412 * the ifindex from flapping when netdevs are created
413 * and deleted on the fly. Note that this circuit id
414 * is used in pseudo lsps so it is better to be stable.
415 * The following code works on any reasonanle ifname
416 * like: eth1 or trk-1.1 etc.
417 */
418 for (i = 0; i < strlen (ifp->name); i++)
419 {
David Lamparter52f02b42015-04-10 09:14:30 +0200420 if (isdigit((unsigned char)ifp->name[i]))
Josh Bailey3f045a02012-03-24 08:35:20 -0700421 {
422 if (start < 0)
423 {
424 start = i;
425 end = i + 1;
426 }
427 else
428 {
429 end = i + 1;
430 }
431 }
432 else if (start >= 0)
433 break;
434 }
435
436 if ((start >= 0) && (end >= start) && (end - start) < 16)
437 {
438 memset (ifname, 0, 16);
439 strncpy (ifname, &ifp->name[start], end - start);
440 id = (u_char)atoi(ifname);
441 }
442
443 /* Try to be unique. */
444 if (!id)
445 id = (u_char)((ifp->ifindex & 0xff) | 0x80);
446
447 return id;
448}
449
jardineb5d44e2003-12-23 08:09:43 +0000450void
451isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp)
452{
paul1eb8ef22005-04-07 07:30:20 +0000453 struct listnode *node, *nnode;
jardineb5d44e2003-12-23 08:09:43 +0000454 struct connected *conn;
455
Josh Bailey3f045a02012-03-24 08:35:20 -0700456 circuit->circuit_id = isis_circuit_id_gen (ifp);
hassof390d2c2004-09-10 20:48:21 +0000457
Josh Bailey3f045a02012-03-24 08:35:20 -0700458 isis_circuit_if_bind (circuit, ifp);
jardineb5d44e2003-12-23 08:09:43 +0000459 /* isis_circuit_update_addrs (circuit, ifp); */
460
hassof390d2c2004-09-10 20:48:21 +0000461 if (if_is_broadcast (ifp))
462 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700463 if (circuit->circ_type_config == CIRCUIT_T_P2P)
464 circuit->circ_type = CIRCUIT_T_P2P;
hassof390d2c2004-09-10 20:48:21 +0000465 else
Josh Bailey3f045a02012-03-24 08:35:20 -0700466 circuit->circ_type = CIRCUIT_T_BROADCAST;
hassof390d2c2004-09-10 20:48:21 +0000467 }
468 else if (if_is_pointopoint (ifp))
469 {
470 circuit->circ_type = CIRCUIT_T_P2P;
471 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700472 else if (if_is_loopback (ifp))
473 {
474 circuit->circ_type = CIRCUIT_T_LOOPBACK;
475 circuit->is_passive = 1;
476 }
hassof390d2c2004-09-10 20:48:21 +0000477 else
478 {
hassoc89c05d2005-09-04 21:36:36 +0000479 /* It's normal in case of loopback etc. */
480 if (isis->debugs & DEBUG_EVENTS)
Josh Bailey3f045a02012-03-24 08:35:20 -0700481 zlog_debug ("isis_circuit_if_add: unsupported media");
482 circuit->circ_type = CIRCUIT_T_UNKNOWN;
hassof390d2c2004-09-10 20:48:21 +0000483 }
484
Josh Bailey3f045a02012-03-24 08:35:20 -0700485 circuit->ip_addrs = list_new ();
486#ifdef HAVE_IPV6
487 circuit->ipv6_link = list_new ();
488 circuit->ipv6_non_link = list_new ();
489#endif /* HAVE_IPV6 */
490
paul1eb8ef22005-04-07 07:30:20 +0000491 for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn))
492 isis_circuit_add_addr (circuit, conn);
jardineb5d44e2003-12-23 08:09:43 +0000493
494 return;
495}
496
497void
Josh Bailey3f045a02012-03-24 08:35:20 -0700498isis_circuit_if_del (struct isis_circuit *circuit, struct interface *ifp)
jardineb5d44e2003-12-23 08:09:43 +0000499{
Josh Bailey3f045a02012-03-24 08:35:20 -0700500 struct listnode *node, *nnode;
501 struct connected *conn;
hassof390d2c2004-09-10 20:48:21 +0000502
Josh Bailey3f045a02012-03-24 08:35:20 -0700503 assert (circuit->interface == ifp);
504
505 /* destroy addresses */
506 for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn))
507 isis_circuit_del_addr (circuit, conn);
508
509 if (circuit->ip_addrs)
hassof390d2c2004-09-10 20:48:21 +0000510 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700511 assert (listcount(circuit->ip_addrs) == 0);
512 list_delete (circuit->ip_addrs);
513 circuit->ip_addrs = NULL;
hassof390d2c2004-09-10 20:48:21 +0000514 }
jardineb5d44e2003-12-23 08:09:43 +0000515
Josh Bailey3f045a02012-03-24 08:35:20 -0700516#ifdef HAVE_IPV6
517 if (circuit->ipv6_link)
hassof390d2c2004-09-10 20:48:21 +0000518 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700519 assert (listcount(circuit->ipv6_link) == 0);
520 list_delete (circuit->ipv6_link);
521 circuit->ipv6_link = NULL;
jardineb5d44e2003-12-23 08:09:43 +0000522 }
jardineb5d44e2003-12-23 08:09:43 +0000523
Josh Bailey3f045a02012-03-24 08:35:20 -0700524 if (circuit->ipv6_non_link)
hassof390d2c2004-09-10 20:48:21 +0000525 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700526 assert (listcount(circuit->ipv6_non_link) == 0);
527 list_delete (circuit->ipv6_non_link);
528 circuit->ipv6_non_link = NULL;
hassof390d2c2004-09-10 20:48:21 +0000529 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700530#endif /* HAVE_IPV6 */
531
532 circuit->circ_type = CIRCUIT_T_UNKNOWN;
533 circuit->circuit_id = 0;
jardineb5d44e2003-12-23 08:09:43 +0000534
jardineb5d44e2003-12-23 08:09:43 +0000535 return;
536}
537
538void
Josh Bailey3f045a02012-03-24 08:35:20 -0700539isis_circuit_if_bind (struct isis_circuit *circuit, struct interface *ifp)
jardineb5d44e2003-12-23 08:09:43 +0000540{
Josh Bailey3f045a02012-03-24 08:35:20 -0700541 assert (circuit != NULL);
542 assert (ifp != NULL);
543 if (circuit->interface)
544 assert (circuit->interface == ifp);
545 else
546 circuit->interface = ifp;
547 if (ifp->info)
548 assert (ifp->info == circuit);
549 else
550 ifp->info = circuit;
551}
552
553void
554isis_circuit_if_unbind (struct isis_circuit *circuit, struct interface *ifp)
555{
556 assert (circuit != NULL);
557 assert (ifp != NULL);
558 assert (circuit->interface == ifp);
559 assert (ifp->info == circuit);
jardineb5d44e2003-12-23 08:09:43 +0000560 circuit->interface = NULL;
Josh Bailey3f045a02012-03-24 08:35:20 -0700561 ifp->info = NULL;
jardineb5d44e2003-12-23 08:09:43 +0000562}
563
Josh Bailey3f045a02012-03-24 08:35:20 -0700564static void
565isis_circuit_update_all_srmflags (struct isis_circuit *circuit, int is_set)
566{
567 struct isis_area *area;
568 struct isis_lsp *lsp;
569 dnode_t *dnode, *dnode_next;
570 int level;
571
572 assert (circuit);
573 area = circuit->area;
574 assert (area);
575 for (level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++)
576 {
577 if (level & circuit->is_type)
578 {
579 if (area->lspdb[level - 1] &&
580 dict_count (area->lspdb[level - 1]) > 0)
581 {
582 for (dnode = dict_first (area->lspdb[level - 1]);
583 dnode != NULL; dnode = dnode_next)
584 {
585 dnode_next = dict_next (area->lspdb[level - 1], dnode);
586 lsp = dnode_get (dnode);
587 if (is_set)
588 {
589 ISIS_SET_FLAG (lsp->SRMflags, circuit);
590 }
591 else
592 {
593 ISIS_CLEAR_FLAG (lsp->SRMflags, circuit);
594 }
595 }
596 }
597 }
598 }
599}
600
Christian Frankef1fc1db2015-11-10 18:43:31 +0100601size_t
602isis_circuit_pdu_size(struct isis_circuit *circuit)
603{
604 return ISO_MTU(circuit);
605}
606
607void
608isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream)
609{
610 size_t stream_size = isis_circuit_pdu_size(circuit);
611
612 if (!*stream)
613 {
614 *stream = stream_new(stream_size);
615 }
616 else
617 {
618 if (STREAM_SIZE(*stream) != stream_size)
619 stream_resize(*stream, stream_size);
620 stream_reset(*stream);
621 }
622}
623
Josh Bailey3f045a02012-03-24 08:35:20 -0700624int
jardineb5d44e2003-12-23 08:09:43 +0000625isis_circuit_up (struct isis_circuit *circuit)
626{
Josh Bailey3f045a02012-03-24 08:35:20 -0700627 int retv;
628
629 /* Set the flags for all the lsps of the circuit. */
630 isis_circuit_update_all_srmflags (circuit, 1);
631
632 if (circuit->state == C_STATE_UP)
633 return ISIS_OK;
634
635 if (circuit->is_passive)
636 return ISIS_OK;
jardineb5d44e2003-12-23 08:09:43 +0000637
Christian Frankef1fc1db2015-11-10 18:43:31 +0100638 if (circuit->area->lsp_mtu > isis_circuit_pdu_size(circuit))
639 {
640 zlog_err("Interface MTU %zu on %s is too low to support area lsp mtu %u!",
641 isis_circuit_pdu_size(circuit), circuit->interface->name,
642 circuit->area->lsp_mtu);
643 isis_circuit_down(circuit);
644 return ISIS_ERROR;
645 }
646
hassof390d2c2004-09-10 20:48:21 +0000647 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
648 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700649 /*
650 * Get the Hardware Address
651 */
652#ifdef HAVE_STRUCT_SOCKADDR_DL
653#ifndef SUNOS_5
654 if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN)
655 zlog_warn ("unsupported link layer");
656 else
657 memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl),
658 ETH_ALEN);
659#endif
660#else
661 if (circuit->interface->hw_addr_len != ETH_ALEN)
662 {
663 zlog_warn ("unsupported link layer");
664 }
665 else
666 {
667 memcpy (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN);
668 }
669#ifdef EXTREME_DEGUG
670 zlog_debug ("isis_circuit_if_add: if_id %d, isomtu %d snpa %s",
671 circuit->interface->ifindex, ISO_MTU (circuit),
672 snpa_print (circuit->u.bc.snpa));
673#endif /* EXTREME_DEBUG */
674#endif /* HAVE_STRUCT_SOCKADDR_DL */
675
676 circuit->u.bc.adjdb[0] = list_new ();
677 circuit->u.bc.adjdb[1] = list_new ();
678
hassof390d2c2004-09-10 20:48:21 +0000679 /*
680 * ISO 10589 - 8.4.1 Enabling of broadcast circuits
681 */
jardineb5d44e2003-12-23 08:09:43 +0000682
hassof390d2c2004-09-10 20:48:21 +0000683 /* initilizing the hello sending threads
684 * for a broadcast IF
685 */
jardineb5d44e2003-12-23 08:09:43 +0000686
hassof390d2c2004-09-10 20:48:21 +0000687 /* 8.4.1 a) commence sending of IIH PDUs */
688
Josh Bailey3f045a02012-03-24 08:35:20 -0700689 if (circuit->is_type & IS_LEVEL_1)
690 {
691 thread_add_event (master, send_lan_l1_hello, circuit, 0);
692 circuit->u.bc.lan_neighs[0] = list_new ();
693 }
hassof390d2c2004-09-10 20:48:21 +0000694
Josh Bailey3f045a02012-03-24 08:35:20 -0700695 if (circuit->is_type & IS_LEVEL_2)
696 {
697 thread_add_event (master, send_lan_l2_hello, circuit, 0);
698 circuit->u.bc.lan_neighs[1] = list_new ();
699 }
hassof390d2c2004-09-10 20:48:21 +0000700
701 /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */
702 /* 8.4.1 c) FIXME: listen for ESH PDUs */
703
704 /* 8.4.1 d) */
705 /* dr election will commence in... */
Josh Bailey3f045a02012-03-24 08:35:20 -0700706 if (circuit->is_type & IS_LEVEL_1)
707 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
708 circuit, 2 * circuit->hello_interval[0]);
709 if (circuit->is_type & IS_LEVEL_2)
710 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
711 circuit, 2 * circuit->hello_interval[1]);
jardineb5d44e2003-12-23 08:09:43 +0000712 }
hassof390d2c2004-09-10 20:48:21 +0000713 else
714 {
715 /* initializing the hello send threads
716 * for a ptp IF
717 */
Josh Bailey3f045a02012-03-24 08:35:20 -0700718 circuit->u.p2p.neighbor = NULL;
hassof390d2c2004-09-10 20:48:21 +0000719 thread_add_event (master, send_p2p_hello, circuit, 0);
jardineb5d44e2003-12-23 08:09:43 +0000720 }
721
jardineb5d44e2003-12-23 08:09:43 +0000722 /* initializing PSNP timers */
Josh Bailey3f045a02012-03-24 08:35:20 -0700723 if (circuit->is_type & IS_LEVEL_1)
724 THREAD_TIMER_ON (master, circuit->t_send_psnp[0], send_l1_psnp, circuit,
725 isis_jitter (circuit->psnp_interval[0], PSNP_JITTER));
726
727 if (circuit->is_type & IS_LEVEL_2)
728 THREAD_TIMER_ON (master, circuit->t_send_psnp[1], send_l2_psnp, circuit,
729 isis_jitter (circuit->psnp_interval[1], PSNP_JITTER));
730
731 /* unified init for circuits; ignore warnings below this level */
732 retv = isis_sock_init (circuit);
733 if (retv != ISIS_OK)
hassof390d2c2004-09-10 20:48:21 +0000734 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700735 isis_circuit_down (circuit);
736 return retv;
hassof390d2c2004-09-10 20:48:21 +0000737 }
738
Josh Bailey3f045a02012-03-24 08:35:20 -0700739 /* initialize the circuit streams after opening connection */
Christian Frankef1fc1db2015-11-10 18:43:31 +0100740 isis_circuit_stream(circuit, &circuit->rcv_stream);
741 isis_circuit_stream(circuit, &circuit->snd_stream);
jardineb5d44e2003-12-23 08:09:43 +0000742
jardineb5d44e2003-12-23 08:09:43 +0000743#ifdef GNU_LINUX
hassof390d2c2004-09-10 20:48:21 +0000744 THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit,
Josh Bailey3f045a02012-03-24 08:35:20 -0700745 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000746#else
hassof390d2c2004-09-10 20:48:21 +0000747 THREAD_TIMER_ON (master, circuit->t_read, isis_receive, circuit,
Josh Bailey3f045a02012-03-24 08:35:20 -0700748 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000749#endif
Josh Bailey3f045a02012-03-24 08:35:20 -0700750
751 circuit->lsp_queue = list_new ();
752 circuit->lsp_queue_last_cleared = time (NULL);
753
754 return ISIS_OK;
jardineb5d44e2003-12-23 08:09:43 +0000755}
756
757void
758isis_circuit_down (struct isis_circuit *circuit)
759{
Josh Bailey3f045a02012-03-24 08:35:20 -0700760 if (circuit->state != C_STATE_UP)
761 return;
762
763 /* Clear the flags for all the lsps of the circuit. */
764 isis_circuit_update_all_srmflags (circuit, 0);
765
hassof390d2c2004-09-10 20:48:21 +0000766 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
767 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700768 /* destroy neighbour lists */
769 if (circuit->u.bc.lan_neighs[0])
770 {
771 list_delete (circuit->u.bc.lan_neighs[0]);
772 circuit->u.bc.lan_neighs[0] = NULL;
773 }
774 if (circuit->u.bc.lan_neighs[1])
775 {
776 list_delete (circuit->u.bc.lan_neighs[1]);
777 circuit->u.bc.lan_neighs[1] = NULL;
778 }
779 /* destroy adjacency databases */
780 if (circuit->u.bc.adjdb[0])
781 {
782 circuit->u.bc.adjdb[0]->del = isis_delete_adj;
783 list_delete (circuit->u.bc.adjdb[0]);
784 circuit->u.bc.adjdb[0] = NULL;
785 }
786 if (circuit->u.bc.adjdb[1])
787 {
788 circuit->u.bc.adjdb[1]->del = isis_delete_adj;
789 list_delete (circuit->u.bc.adjdb[1]);
790 circuit->u.bc.adjdb[1] = NULL;
791 }
792 if (circuit->u.bc.is_dr[0])
793 {
794 isis_dr_resign (circuit, 1);
795 circuit->u.bc.is_dr[0] = 0;
796 }
797 memset (circuit->u.bc.l1_desig_is, 0, ISIS_SYS_ID_LEN + 1);
798 if (circuit->u.bc.is_dr[1])
799 {
800 isis_dr_resign (circuit, 2);
801 circuit->u.bc.is_dr[1] = 0;
802 }
803 memset (circuit->u.bc.l2_desig_is, 0, ISIS_SYS_ID_LEN + 1);
804 memset (circuit->u.bc.snpa, 0, ETH_ALEN);
805
hassof390d2c2004-09-10 20:48:21 +0000806 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[0]);
807 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[1]);
hassof891f442004-09-14 13:54:30 +0000808 THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[0]);
809 THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[1]);
Josh Bailey3f045a02012-03-24 08:35:20 -0700810 THREAD_TIMER_OFF (circuit->u.bc.t_refresh_pseudo_lsp[0]);
811 THREAD_TIMER_OFF (circuit->u.bc.t_refresh_pseudo_lsp[1]);
Christian Franke61010c32015-11-10 18:43:34 +0100812 circuit->lsp_regenerate_pending[0] = 0;
813 circuit->lsp_regenerate_pending[1] = 0;
hassof390d2c2004-09-10 20:48:21 +0000814 }
815 else if (circuit->circ_type == CIRCUIT_T_P2P)
816 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700817 isis_delete_adj (circuit->u.p2p.neighbor);
818 circuit->u.p2p.neighbor = NULL;
hassof390d2c2004-09-10 20:48:21 +0000819 THREAD_TIMER_OFF (circuit->u.p2p.t_send_p2p_hello);
820 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700821
822 /* Cancel all active threads */
823 THREAD_TIMER_OFF (circuit->t_send_csnp[0]);
824 THREAD_TIMER_OFF (circuit->t_send_csnp[1]);
825 THREAD_TIMER_OFF (circuit->t_send_psnp[0]);
826 THREAD_TIMER_OFF (circuit->t_send_psnp[1]);
827 THREAD_OFF (circuit->t_read);
828
829 if (circuit->lsp_queue)
830 {
831 circuit->lsp_queue->del = NULL;
832 list_delete (circuit->lsp_queue);
833 circuit->lsp_queue = NULL;
834 }
835
836 /* send one gratuitous hello to spead up convergence */
837 if (circuit->is_type & IS_LEVEL_1)
838 send_hello (circuit, IS_LEVEL_1);
839 if (circuit->is_type & IS_LEVEL_2)
840 send_hello (circuit, IS_LEVEL_2);
841
842 circuit->upadjcount[0] = 0;
843 circuit->upadjcount[1] = 0;
844
jardineb5d44e2003-12-23 08:09:43 +0000845 /* close the socket */
Josh Bailey3f045a02012-03-24 08:35:20 -0700846 if (circuit->fd)
847 {
848 close (circuit->fd);
849 circuit->fd = 0;
850 }
851
852 if (circuit->rcv_stream != NULL)
853 {
854 stream_free (circuit->rcv_stream);
855 circuit->rcv_stream = NULL;
856 }
857
858 if (circuit->snd_stream != NULL)
859 {
860 stream_free (circuit->snd_stream);
861 circuit->snd_stream = NULL;
862 }
863
864 thread_cancel_event (master, circuit);
jardineb5d44e2003-12-23 08:09:43 +0000865
866 return;
867}
868
869void
870circuit_update_nlpids (struct isis_circuit *circuit)
871{
872 circuit->nlpids.count = 0;
hassof390d2c2004-09-10 20:48:21 +0000873
874 if (circuit->ip_router)
875 {
876 circuit->nlpids.nlpids[0] = NLPID_IP;
877 circuit->nlpids.count++;
878 }
jardineb5d44e2003-12-23 08:09:43 +0000879#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000880 if (circuit->ipv6_router)
881 {
882 circuit->nlpids.nlpids[circuit->nlpids.count] = NLPID_IPV6;
883 circuit->nlpids.count++;
884 }
jardineb5d44e2003-12-23 08:09:43 +0000885#endif /* HAVE_IPV6 */
886 return;
887}
888
Josh Bailey3f045a02012-03-24 08:35:20 -0700889void
890isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty,
891 char detail)
892{
893 if (detail == ISIS_UI_LEVEL_BRIEF)
894 {
895 vty_out (vty, " %-12s", circuit->interface->name);
896 vty_out (vty, "0x%-7x", circuit->circuit_id);
897 vty_out (vty, "%-9s", circuit_state2string (circuit->state));
898 vty_out (vty, "%-9s", circuit_type2string (circuit->circ_type));
899 vty_out (vty, "%-9s", circuit_t2string (circuit->is_type));
900 vty_out (vty, "%s", VTY_NEWLINE);
901 }
902
903 if (detail == ISIS_UI_LEVEL_DETAIL)
904 {
Christian Frankecb32a192015-11-10 18:33:13 +0100905 struct listnode *node;
906 struct prefix *ip_addr;
907 u_char buf[BUFSIZ];
908
Josh Bailey3f045a02012-03-24 08:35:20 -0700909 vty_out (vty, " Interface: %s", circuit->interface->name);
910 vty_out (vty, ", State: %s", circuit_state2string (circuit->state));
911 if (circuit->is_passive)
912 vty_out (vty, ", Passive");
913 else
914 vty_out (vty, ", Active");
915 vty_out (vty, ", Circuit Id: 0x%x", circuit->circuit_id);
916 vty_out (vty, "%s", VTY_NEWLINE);
917 vty_out (vty, " Type: %s", circuit_type2string (circuit->circ_type));
918 vty_out (vty, ", Level: %s", circuit_t2string (circuit->is_type));
919 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
920 vty_out (vty, ", SNPA: %-10s", snpa_print (circuit->u.bc.snpa));
921 vty_out (vty, "%s", VTY_NEWLINE);
922 if (circuit->is_type & IS_LEVEL_1)
923 {
924 vty_out (vty, " Level-1 Information:%s", VTY_NEWLINE);
925 if (circuit->area->newmetric)
926 vty_out (vty, " Metric: %d", circuit->te_metric[0]);
927 else
928 vty_out (vty, " Metric: %d",
929 circuit->metrics[0].metric_default);
930 if (!circuit->is_passive)
931 {
932 vty_out (vty, ", Active neighbors: %u%s",
933 circuit->upadjcount[0], VTY_NEWLINE);
934 vty_out (vty, " Hello interval: %u, "
935 "Holddown count: %u %s%s",
936 circuit->hello_interval[0],
937 circuit->hello_multiplier[0],
938 (circuit->pad_hellos ? "(pad)" : "(no-pad)"),
939 VTY_NEWLINE);
940 vty_out (vty, " CNSP interval: %u, "
941 "PSNP interval: %u%s",
942 circuit->csnp_interval[0],
943 circuit->psnp_interval[0], VTY_NEWLINE);
944 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
945 vty_out (vty, " LAN Priority: %u, %s%s",
946 circuit->priority[0],
947 (circuit->u.bc.is_dr[0] ? \
948 "is DIS" : "is not DIS"), VTY_NEWLINE);
949 }
950 else
951 {
952 vty_out (vty, "%s", VTY_NEWLINE);
953 }
954 }
955 if (circuit->is_type & IS_LEVEL_2)
956 {
957 vty_out (vty, " Level-2 Information:%s", VTY_NEWLINE);
958 if (circuit->area->newmetric)
959 vty_out (vty, " Metric: %d", circuit->te_metric[1]);
960 else
961 vty_out (vty, " Metric: %d",
962 circuit->metrics[1].metric_default);
963 if (!circuit->is_passive)
964 {
965 vty_out (vty, ", Active neighbors: %u%s",
966 circuit->upadjcount[1], VTY_NEWLINE);
967 vty_out (vty, " Hello interval: %u, "
968 "Holddown count: %u %s%s",
969 circuit->hello_interval[1],
970 circuit->hello_multiplier[1],
971 (circuit->pad_hellos ? "(pad)" : "(no-pad)"),
972 VTY_NEWLINE);
973 vty_out (vty, " CNSP interval: %u, "
974 "PSNP interval: %u%s",
975 circuit->csnp_interval[1],
976 circuit->psnp_interval[1], VTY_NEWLINE);
977 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
978 vty_out (vty, " LAN Priority: %u, %s%s",
979 circuit->priority[1],
980 (circuit->u.bc.is_dr[1] ? \
981 "is DIS" : "is not DIS"), VTY_NEWLINE);
982 }
983 else
984 {
985 vty_out (vty, "%s", VTY_NEWLINE);
986 }
987 }
988 if (circuit->ip_addrs && listcount (circuit->ip_addrs) > 0)
989 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700990 vty_out (vty, " IP Prefix(es):%s", VTY_NEWLINE);
991 for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip_addr))
992 {
993 prefix2str (ip_addr, (char*)buf, BUFSIZ),
994 vty_out (vty, " %s%s", buf, VTY_NEWLINE);
995 }
996 }
Christian Frankecb32a192015-11-10 18:33:13 +0100997 if (circuit->ipv6_link && listcount(circuit->ipv6_link) > 0)
998 {
999 vty_out(vty, " IPv6 Link-Locals:%s", VTY_NEWLINE);
1000 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node, ip_addr))
1001 {
1002 prefix2str(ip_addr, (char*)buf, BUFSIZ),
1003 vty_out(vty, " %s%s", buf, VTY_NEWLINE);
1004 }
1005 }
1006 if (circuit->ipv6_link && listcount(circuit->ipv6_non_link) > 0)
1007 {
1008 vty_out(vty, " IPv6 Prefixes:%s", VTY_NEWLINE);
1009 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node, ip_addr))
1010 {
1011 prefix2str(ip_addr, (char*)buf, BUFSIZ),
1012 vty_out(vty, " %s%s", buf, VTY_NEWLINE);
1013 }
1014 }
1015
Josh Bailey3f045a02012-03-24 08:35:20 -07001016 vty_out (vty, "%s", VTY_NEWLINE);
1017 }
1018 return;
1019}
1020
jardineb5d44e2003-12-23 08:09:43 +00001021int
hassof390d2c2004-09-10 20:48:21 +00001022isis_interface_config_write (struct vty *vty)
jardineb5d44e2003-12-23 08:09:43 +00001023{
jardineb5d44e2003-12-23 08:09:43 +00001024 int write = 0;
hasso3fdb2dd2005-09-28 18:45:54 +00001025 struct listnode *node, *node2;
jardineb5d44e2003-12-23 08:09:43 +00001026 struct interface *ifp;
1027 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001028 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +00001029 int i;
jardineb5d44e2003-12-23 08:09:43 +00001030
hasso3fdb2dd2005-09-28 18:45:54 +00001031 for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
jardineb5d44e2003-12-23 08:09:43 +00001032 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001033 /* IF name */
1034 vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE);
1035 write++;
1036 /* IF desc */
1037 if (ifp->desc)
1038 {
1039 vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE);
1040 write++;
1041 }
1042 /* ISIS Circuit */
1043 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node2, area))
1044 {
1045 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
1046 if (circuit == NULL)
1047 continue;
1048 if (circuit->ip_router)
1049 {
1050 vty_out (vty, " ip router isis %s%s", area->area_tag,
1051 VTY_NEWLINE);
1052 write++;
1053 }
1054 if (circuit->is_passive)
1055 {
1056 vty_out (vty, " isis passive%s", VTY_NEWLINE);
1057 write++;
1058 }
1059 if (circuit->circ_type_config == CIRCUIT_T_P2P)
1060 {
1061 vty_out (vty, " isis network point-to-point%s", VTY_NEWLINE);
1062 write++;
1063 }
jardineb5d44e2003-12-23 08:09:43 +00001064#ifdef HAVE_IPV6
Josh Bailey3f045a02012-03-24 08:35:20 -07001065 if (circuit->ipv6_router)
1066 {
1067 vty_out (vty, " ipv6 router isis %s%s", area->area_tag,
1068 VTY_NEWLINE);
1069 write++;
1070 }
jardineb5d44e2003-12-23 08:09:43 +00001071#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +00001072
Josh Bailey3f045a02012-03-24 08:35:20 -07001073 /* ISIS - circuit type */
1074 if (circuit->is_type == IS_LEVEL_1)
1075 {
1076 vty_out (vty, " isis circuit-type level-1%s", VTY_NEWLINE);
1077 write++;
1078 }
1079 else
1080 {
1081 if (circuit->is_type == IS_LEVEL_2)
1082 {
1083 vty_out (vty, " isis circuit-type level-2-only%s",
1084 VTY_NEWLINE);
1085 write++;
1086 }
1087 }
jardineb5d44e2003-12-23 08:09:43 +00001088
Josh Bailey3f045a02012-03-24 08:35:20 -07001089 /* ISIS - CSNP interval */
1090 if (circuit->csnp_interval[0] == circuit->csnp_interval[1])
1091 {
1092 if (circuit->csnp_interval[0] != DEFAULT_CSNP_INTERVAL)
1093 {
1094 vty_out (vty, " isis csnp-interval %d%s",
1095 circuit->csnp_interval[0], VTY_NEWLINE);
1096 write++;
1097 }
1098 }
1099 else
1100 {
1101 for (i = 0; i < 2; i++)
1102 {
1103 if (circuit->csnp_interval[i] != DEFAULT_CSNP_INTERVAL)
1104 {
1105 vty_out (vty, " isis csnp-interval %d level-%d%s",
1106 circuit->csnp_interval[i], i + 1, VTY_NEWLINE);
1107 write++;
1108 }
1109 }
1110 }
jardineb5d44e2003-12-23 08:09:43 +00001111
Josh Bailey3f045a02012-03-24 08:35:20 -07001112 /* ISIS - PSNP interval */
1113 if (circuit->psnp_interval[0] == circuit->psnp_interval[1])
1114 {
1115 if (circuit->psnp_interval[0] != DEFAULT_PSNP_INTERVAL)
1116 {
1117 vty_out (vty, " isis psnp-interval %d%s",
1118 circuit->psnp_interval[0], VTY_NEWLINE);
1119 write++;
1120 }
1121 }
1122 else
1123 {
1124 for (i = 0; i < 2; i++)
1125 {
1126 if (circuit->psnp_interval[i] != DEFAULT_PSNP_INTERVAL)
1127 {
1128 vty_out (vty, " isis psnp-interval %d level-%d%s",
1129 circuit->psnp_interval[i], i + 1, VTY_NEWLINE);
1130 write++;
1131 }
1132 }
1133 }
jardineb5d44e2003-12-23 08:09:43 +00001134
Josh Bailey3f045a02012-03-24 08:35:20 -07001135 /* ISIS - Hello padding - Defaults to true so only display if false */
1136 if (circuit->pad_hellos == 0)
1137 {
1138 vty_out (vty, " no isis hello padding%s", VTY_NEWLINE);
1139 write++;
1140 }
jardineb5d44e2003-12-23 08:09:43 +00001141
Josh Bailey3f045a02012-03-24 08:35:20 -07001142 /* ISIS - Hello interval */
1143 if (circuit->hello_interval[0] == circuit->hello_interval[1])
1144 {
1145 if (circuit->hello_interval[0] != DEFAULT_HELLO_INTERVAL)
1146 {
1147 vty_out (vty, " isis hello-interval %d%s",
1148 circuit->hello_interval[0], VTY_NEWLINE);
1149 write++;
1150 }
1151 }
1152 else
1153 {
1154 for (i = 0; i < 2; i++)
1155 {
1156 if (circuit->hello_interval[i] != DEFAULT_HELLO_INTERVAL)
1157 {
1158 vty_out (vty, " isis hello-interval %d level-%d%s",
1159 circuit->hello_interval[i], i + 1, VTY_NEWLINE);
1160 write++;
1161 }
1162 }
1163 }
jardineb5d44e2003-12-23 08:09:43 +00001164
Josh Bailey3f045a02012-03-24 08:35:20 -07001165 /* ISIS - Hello Multiplier */
1166 if (circuit->hello_multiplier[0] == circuit->hello_multiplier[1])
1167 {
1168 if (circuit->hello_multiplier[0] != DEFAULT_HELLO_MULTIPLIER)
1169 {
1170 vty_out (vty, " isis hello-multiplier %d%s",
1171 circuit->hello_multiplier[0], VTY_NEWLINE);
1172 write++;
1173 }
1174 }
1175 else
1176 {
1177 for (i = 0; i < 2; i++)
1178 {
1179 if (circuit->hello_multiplier[i] != DEFAULT_HELLO_MULTIPLIER)
1180 {
1181 vty_out (vty, " isis hello-multiplier %d level-%d%s",
1182 circuit->hello_multiplier[i], i + 1,
1183 VTY_NEWLINE);
1184 write++;
1185 }
1186 }
1187 }
1188
1189 /* ISIS - Priority */
1190 if (circuit->priority[0] == circuit->priority[1])
1191 {
1192 if (circuit->priority[0] != DEFAULT_PRIORITY)
1193 {
1194 vty_out (vty, " isis priority %d%s",
1195 circuit->priority[0], VTY_NEWLINE);
1196 write++;
1197 }
1198 }
1199 else
1200 {
1201 for (i = 0; i < 2; i++)
1202 {
1203 if (circuit->priority[i] != DEFAULT_PRIORITY)
1204 {
1205 vty_out (vty, " isis priority %d level-%d%s",
1206 circuit->priority[i], i + 1, VTY_NEWLINE);
1207 write++;
1208 }
1209 }
1210 }
1211
1212 /* ISIS - Metric */
1213 if (circuit->te_metric[0] == circuit->te_metric[1])
1214 {
1215 if (circuit->te_metric[0] != DEFAULT_CIRCUIT_METRIC)
1216 {
1217 vty_out (vty, " isis metric %d%s", circuit->te_metric[0],
1218 VTY_NEWLINE);
1219 write++;
1220 }
1221 }
1222 else
1223 {
1224 for (i = 0; i < 2; i++)
1225 {
1226 if (circuit->te_metric[i] != DEFAULT_CIRCUIT_METRIC)
1227 {
1228 vty_out (vty, " isis metric %d level-%d%s",
1229 circuit->te_metric[i], i + 1, VTY_NEWLINE);
1230 write++;
1231 }
1232 }
1233 }
1234 if (circuit->passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
1235 {
1236 vty_out (vty, " isis password md5 %s%s", circuit->passwd.passwd,
1237 VTY_NEWLINE);
1238 write++;
1239 }
1240 else if (circuit->passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
1241 {
1242 vty_out (vty, " isis password clear %s%s", circuit->passwd.passwd,
1243 VTY_NEWLINE);
1244 write++;
1245 }
1246 }
1247 vty_out (vty, "!%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001248 }
hassof390d2c2004-09-10 20:48:21 +00001249
jardineb5d44e2003-12-23 08:09:43 +00001250 return write;
1251}
jardineb5d44e2003-12-23 08:09:43 +00001252
1253DEFUN (ip_router_isis,
1254 ip_router_isis_cmd,
1255 "ip router isis WORD",
1256 "Interface Internet Protocol config commands\n"
1257 "IP router interface commands\n"
1258 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +00001259 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +00001260{
Josh Bailey3f045a02012-03-24 08:35:20 -07001261 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +00001262 struct interface *ifp;
1263 struct isis_area *area;
Christian Frankef1fc1db2015-11-10 18:43:31 +01001264 int rv;
hassof390d2c2004-09-10 20:48:21 +00001265
1266 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001267 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +00001268
Josh Bailey3f045a02012-03-24 08:35:20 -07001269 /* Prevent more than one area per circuit */
1270 circuit = circuit_scan_by_ifp (ifp);
1271 if (circuit)
hassof390d2c2004-09-10 20:48:21 +00001272 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001273 if (circuit->ip_router == 1)
1274 {
1275 if (strcmp (circuit->area->area_tag, argv[0]))
1276 {
1277 vty_out (vty, "ISIS circuit is already defined on %s%s",
1278 circuit->area->area_tag, VTY_NEWLINE);
1279 return CMD_ERR_NOTHING_TODO;
1280 }
1281 return CMD_SUCCESS;
1282 }
jardineb5d44e2003-12-23 08:09:43 +00001283 }
hassof390d2c2004-09-10 20:48:21 +00001284
Josh Bailey3f045a02012-03-24 08:35:20 -07001285 if (isis_area_get (vty, argv[0]) != CMD_SUCCESS)
hassof390d2c2004-09-10 20:48:21 +00001286 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001287 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1288 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001289 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001290 area = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001291
Josh Bailey3f045a02012-03-24 08:35:20 -07001292 circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area);
Christian Frankef1fc1db2015-11-10 18:43:31 +01001293 if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP)
1294 {
1295 vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE);
1296 rv = CMD_WARNING;
1297 }
1298 else
1299 {
1300 isis_circuit_if_bind (circuit, ifp);
jardineb5d44e2003-12-23 08:09:43 +00001301
Christian Frankef1fc1db2015-11-10 18:43:31 +01001302 circuit->ip_router = 1;
1303 area->ip_circuits++;
1304 circuit_update_nlpids (circuit);
1305 rv = CMD_SUCCESS;
1306 }
jardineb5d44e2003-12-23 08:09:43 +00001307
1308 vty->node = INTERFACE_NODE;
Josh Bailey3f045a02012-03-24 08:35:20 -07001309 vty->index = ifp;
hassof390d2c2004-09-10 20:48:21 +00001310
Christian Frankef1fc1db2015-11-10 18:43:31 +01001311 return rv;
jardineb5d44e2003-12-23 08:09:43 +00001312}
1313
1314DEFUN (no_ip_router_isis,
1315 no_ip_router_isis_cmd,
1316 "no ip router isis WORD",
1317 NO_STR
1318 "Interface Internet Protocol config commands\n"
1319 "IP router interface commands\n"
1320 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +00001321 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +00001322{
jardineb5d44e2003-12-23 08:09:43 +00001323 struct interface *ifp;
1324 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001325 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +00001326
hassof390d2c2004-09-10 20:48:21 +00001327 ifp = (struct interface *) vty->index;
Josh Bailey3f045a02012-03-24 08:35:20 -07001328 if (!ifp)
1329 {
1330 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1331 return CMD_ERR_NO_MATCH;
1332 }
hassof390d2c2004-09-10 20:48:21 +00001333
jardineb5d44e2003-12-23 08:09:43 +00001334 area = isis_area_lookup (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001335 if (!area)
1336 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001337 vty_out (vty, "Can't find ISIS instance %s%s",
1338 argv[0], VTY_NEWLINE);
1339 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001340 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001341
1342 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +00001343 if (!circuit)
1344 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001345 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1346 ifp->name, VTY_NEWLINE);
1347 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001348 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001349
jardineb5d44e2003-12-23 08:09:43 +00001350 circuit->ip_router = 0;
1351 area->ip_circuits--;
1352#ifdef HAVE_IPV6
1353 if (circuit->ipv6_router == 0)
1354#endif
1355 isis_csm_state_change (ISIS_DISABLE, circuit, area);
hassof390d2c2004-09-10 20:48:21 +00001356
jardineb5d44e2003-12-23 08:09:43 +00001357 return CMD_SUCCESS;
1358}
1359
Josh Bailey3f045a02012-03-24 08:35:20 -07001360#ifdef HAVE_IPV6
1361DEFUN (ipv6_router_isis,
1362 ipv6_router_isis_cmd,
1363 "ipv6 router isis WORD",
1364 "IPv6 interface subcommands\n"
1365 "IPv6 Router interface commands\n"
1366 "IS-IS Routing for IPv6\n"
1367 "Routing process tag\n")
1368{
1369 struct isis_circuit *circuit;
1370 struct interface *ifp;
1371 struct isis_area *area;
Christian Frankef1fc1db2015-11-10 18:43:31 +01001372 int rv;
Josh Bailey3f045a02012-03-24 08:35:20 -07001373
1374 ifp = (struct interface *) vty->index;
1375 assert (ifp);
1376
1377 /* Prevent more than one area per circuit */
1378 circuit = circuit_scan_by_ifp (ifp);
1379 if (circuit)
1380 {
1381 if (circuit->ipv6_router == 1)
1382 {
1383 if (strcmp (circuit->area->area_tag, argv[0]))
1384 {
1385 vty_out (vty, "ISIS circuit is already defined for IPv6 on %s%s",
1386 circuit->area->area_tag, VTY_NEWLINE);
1387 return CMD_ERR_NOTHING_TODO;
1388 }
1389 return CMD_SUCCESS;
1390 }
1391 }
1392
1393 if (isis_area_get (vty, argv[0]) != CMD_SUCCESS)
1394 {
1395 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1396 return CMD_ERR_NO_MATCH;
1397 }
1398 area = vty->index;
1399
1400 circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area);
Christian Frankef1fc1db2015-11-10 18:43:31 +01001401 if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP)
1402 {
1403 vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE);
1404 rv = CMD_WARNING;
1405 }
1406 else
1407 {
1408 isis_circuit_if_bind (circuit, ifp);
Josh Bailey3f045a02012-03-24 08:35:20 -07001409
Christian Frankef1fc1db2015-11-10 18:43:31 +01001410 circuit->ipv6_router = 1;
1411 area->ipv6_circuits++;
1412 circuit_update_nlpids (circuit);
1413 rv = CMD_SUCCESS;
1414 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001415
1416 vty->node = INTERFACE_NODE;
1417 vty->index = ifp;
1418
Christian Frankef1fc1db2015-11-10 18:43:31 +01001419 return rv;
Josh Bailey3f045a02012-03-24 08:35:20 -07001420}
1421
1422DEFUN (no_ipv6_router_isis,
1423 no_ipv6_router_isis_cmd,
1424 "no ipv6 router isis WORD",
1425 NO_STR
1426 "IPv6 interface subcommands\n"
1427 "IPv6 Router interface commands\n"
1428 "IS-IS Routing for IPv6\n"
1429 "Routing process tag\n")
1430{
1431 struct interface *ifp;
1432 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001433 struct isis_circuit *circuit;
1434
1435 ifp = (struct interface *) vty->index;
1436 if (!ifp)
1437 {
1438 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1439 return CMD_ERR_NO_MATCH;
1440 }
1441
1442 area = isis_area_lookup (argv[0]);
1443 if (!area)
1444 {
1445 vty_out (vty, "Can't find ISIS instance %s%s",
1446 argv[0], VTY_NEWLINE);
1447 return CMD_ERR_NO_MATCH;
1448 }
1449
1450 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
1451 if (!circuit)
1452 {
1453 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1454 ifp->name, VTY_NEWLINE);
1455 return CMD_ERR_NO_MATCH;
1456 }
1457
1458 circuit->ipv6_router = 0;
1459 area->ipv6_circuits--;
1460 if (circuit->ip_router == 0)
1461 isis_csm_state_change (ISIS_DISABLE, circuit, area);
1462
1463 return CMD_SUCCESS;
1464}
1465#endif /* HAVE_IPV6 */
1466
1467DEFUN (isis_passive,
1468 isis_passive_cmd,
1469 "isis passive",
1470 "IS-IS commands\n"
1471 "Configure the passive mode for interface\n")
1472{
1473 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1474 if (!circuit)
1475 return CMD_ERR_NO_MATCH;
1476
1477 if (circuit->is_passive == 1)
1478 return CMD_SUCCESS;
1479
1480 if (circuit->state != C_STATE_UP)
1481 {
1482 circuit->is_passive = 1;
1483 }
1484 else
1485 {
1486 struct isis_area *area = circuit->area;
1487 isis_csm_state_change (ISIS_DISABLE, circuit, area);
1488 circuit->is_passive = 1;
1489 isis_csm_state_change (ISIS_ENABLE, circuit, area);
1490 }
1491
1492 return CMD_SUCCESS;
1493}
1494
1495DEFUN (no_isis_passive,
1496 no_isis_passive_cmd,
1497 "no isis passive",
1498 NO_STR
1499 "IS-IS commands\n"
1500 "Configure the passive mode for interface\n")
1501{
1502 struct interface *ifp;
1503 struct isis_circuit *circuit;
1504
1505 ifp = (struct interface *) vty->index;
1506 if (!ifp)
1507 {
1508 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1509 return CMD_ERR_NO_MATCH;
1510 }
1511
1512 /* FIXME: what is wrong with circuit = ifp->info ? */
1513 circuit = circuit_scan_by_ifp (ifp);
1514 if (!circuit)
1515 {
1516 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1517 ifp->name, VTY_NEWLINE);
1518 return CMD_ERR_NO_MATCH;
1519 }
1520
1521 if (if_is_loopback(ifp))
1522 {
1523 vty_out (vty, "Can't set no passive for loopback interface%s",
1524 VTY_NEWLINE);
1525 return CMD_ERR_AMBIGUOUS;
1526 }
1527
1528 if (circuit->is_passive == 0)
1529 return CMD_SUCCESS;
1530
1531 if (circuit->state != C_STATE_UP)
1532 {
1533 circuit->is_passive = 0;
1534 }
1535 else
1536 {
1537 struct isis_area *area = circuit->area;
1538 isis_csm_state_change (ISIS_DISABLE, circuit, area);
1539 circuit->is_passive = 0;
1540 isis_csm_state_change (ISIS_ENABLE, circuit, area);
1541 }
1542
1543 return CMD_SUCCESS;
1544}
1545
jardineb5d44e2003-12-23 08:09:43 +00001546DEFUN (isis_circuit_type,
1547 isis_circuit_type_cmd,
1548 "isis circuit-type (level-1|level-1-2|level-2-only)",
1549 "IS-IS commands\n"
1550 "Configure circuit type for interface\n"
1551 "Level-1 only adjacencies are formed\n"
1552 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +00001553 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +00001554{
Josh Bailey3f045a02012-03-24 08:35:20 -07001555 int circuit_type;
1556 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1557 if (!circuit)
1558 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001559
Josh Bailey3f045a02012-03-24 08:35:20 -07001560 circuit_type = string2circuit_t (argv[0]);
1561 if (!circuit_type)
hassof390d2c2004-09-10 20:48:21 +00001562 {
1563 vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -07001564 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001565 }
1566
Josh Bailey3f045a02012-03-24 08:35:20 -07001567 if (circuit->state == C_STATE_UP &&
1568 circuit->area->is_type != IS_LEVEL_1_AND_2 &&
1569 circuit->area->is_type != circuit_type)
hassof390d2c2004-09-10 20:48:21 +00001570 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001571 vty_out (vty, "Invalid circuit level for area %s.%s",
1572 circuit->area->area_tag, VTY_NEWLINE);
1573 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001574 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001575 isis_event_circuit_type_change (circuit, circuit_type);
hassof390d2c2004-09-10 20:48:21 +00001576
jardineb5d44e2003-12-23 08:09:43 +00001577 return CMD_SUCCESS;
1578}
1579
1580DEFUN (no_isis_circuit_type,
1581 no_isis_circuit_type_cmd,
1582 "no isis circuit-type (level-1|level-1-2|level-2-only)",
1583 NO_STR
1584 "IS-IS commands\n"
1585 "Configure circuit type for interface\n"
1586 "Level-1 only adjacencies are formed\n"
1587 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +00001588 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +00001589{
Josh Bailey3f045a02012-03-24 08:35:20 -07001590 int circuit_type;
1591 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1592 if (!circuit)
1593 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001594
jardineb5d44e2003-12-23 08:09:43 +00001595 /*
Josh Bailey3f045a02012-03-24 08:35:20 -07001596 * Set the circuits level to its default value
jardineb5d44e2003-12-23 08:09:43 +00001597 */
Josh Bailey3f045a02012-03-24 08:35:20 -07001598 if (circuit->state == C_STATE_UP)
1599 circuit_type = circuit->area->is_type;
1600 else
1601 circuit_type = IS_LEVEL_1_AND_2;
1602 isis_event_circuit_type_change (circuit, circuit_type);
hassof390d2c2004-09-10 20:48:21 +00001603
jardineb5d44e2003-12-23 08:09:43 +00001604 return CMD_SUCCESS;
1605}
1606
Josh Bailey3f045a02012-03-24 08:35:20 -07001607DEFUN (isis_passwd_md5,
1608 isis_passwd_md5_cmd,
1609 "isis password md5 WORD",
jardineb5d44e2003-12-23 08:09:43 +00001610 "IS-IS commands\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001611 "Configure the authentication password for a circuit\n"
1612 "Authentication type\n"
1613 "Circuit password\n")
jardineb5d44e2003-12-23 08:09:43 +00001614{
jardineb5d44e2003-12-23 08:09:43 +00001615 int len;
Josh Bailey3f045a02012-03-24 08:35:20 -07001616 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1617 if (!circuit)
1618 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001619
jardineb5d44e2003-12-23 08:09:43 +00001620 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001621 if (len > 254)
1622 {
1623 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -07001624 return CMD_ERR_AMBIGUOUS;
1625 }
1626 circuit->passwd.len = len;
1627 circuit->passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
1628 strncpy ((char *)circuit->passwd.passwd, argv[0], 255);
1629
1630 return CMD_SUCCESS;
1631}
1632
1633DEFUN (isis_passwd_clear,
1634 isis_passwd_clear_cmd,
1635 "isis password clear WORD",
1636 "IS-IS commands\n"
1637 "Configure the authentication password for a circuit\n"
1638 "Authentication type\n"
1639 "Circuit password\n")
1640{
1641 int len;
1642 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1643 if (!circuit)
1644 return CMD_ERR_NO_MATCH;
1645
1646 len = strlen (argv[0]);
1647 if (len > 254)
1648 {
1649 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
1650 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001651 }
jardineb5d44e2003-12-23 08:09:43 +00001652 circuit->passwd.len = len;
1653 circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001654 strncpy ((char *)circuit->passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001655
jardineb5d44e2003-12-23 08:09:43 +00001656 return CMD_SUCCESS;
1657}
1658
1659DEFUN (no_isis_passwd,
1660 no_isis_passwd_cmd,
1661 "no isis password",
1662 NO_STR
1663 "IS-IS commands\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001664 "Configure the authentication password for a circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001665{
Josh Bailey3f045a02012-03-24 08:35:20 -07001666 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1667 if (!circuit)
1668 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001669
jardineb5d44e2003-12-23 08:09:43 +00001670 memset (&circuit->passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +00001671
jardineb5d44e2003-12-23 08:09:43 +00001672 return CMD_SUCCESS;
1673}
1674
jardineb5d44e2003-12-23 08:09:43 +00001675DEFUN (isis_priority,
1676 isis_priority_cmd,
1677 "isis priority <0-127>",
1678 "IS-IS commands\n"
1679 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001680 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001681{
jardineb5d44e2003-12-23 08:09:43 +00001682 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001683 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1684 if (!circuit)
1685 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001686
1687 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001688 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1689 {
1690 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1691 prio, VTY_NEWLINE);
1692 return CMD_ERR_AMBIGUOUS;
1693 }
jardineb5d44e2003-12-23 08:09:43 +00001694
Josh Bailey3f045a02012-03-24 08:35:20 -07001695 circuit->priority[0] = prio;
1696 circuit->priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001697
jardineb5d44e2003-12-23 08:09:43 +00001698 return CMD_SUCCESS;
1699}
1700
1701DEFUN (no_isis_priority,
1702 no_isis_priority_cmd,
1703 "no isis priority",
1704 NO_STR
1705 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001706 "Set priority for Designated Router election\n")
jardineb5d44e2003-12-23 08:09:43 +00001707{
Josh Bailey3f045a02012-03-24 08:35:20 -07001708 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1709 if (!circuit)
1710 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001711
Josh Bailey3f045a02012-03-24 08:35:20 -07001712 circuit->priority[0] = DEFAULT_PRIORITY;
1713 circuit->priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001714
jardineb5d44e2003-12-23 08:09:43 +00001715 return CMD_SUCCESS;
1716}
1717
1718ALIAS (no_isis_priority,
1719 no_isis_priority_arg_cmd,
1720 "no isis priority <0-127>",
1721 NO_STR
1722 "IS-IS commands\n"
1723 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001724 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001725
1726DEFUN (isis_priority_l1,
1727 isis_priority_l1_cmd,
hassof390d2c2004-09-10 20:48:21 +00001728 "isis priority <0-127> level-1",
jardineb5d44e2003-12-23 08:09:43 +00001729 "IS-IS commands\n"
1730 "Set priority for Designated Router election\n"
1731 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001732 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001733{
jardineb5d44e2003-12-23 08:09:43 +00001734 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001735 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1736 if (!circuit)
1737 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001738
1739 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001740 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1741 {
1742 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1743 prio, VTY_NEWLINE);
1744 return CMD_ERR_AMBIGUOUS;
1745 }
jardineb5d44e2003-12-23 08:09:43 +00001746
Josh Bailey3f045a02012-03-24 08:35:20 -07001747 circuit->priority[0] = prio;
hassof390d2c2004-09-10 20:48:21 +00001748
jardineb5d44e2003-12-23 08:09:43 +00001749 return CMD_SUCCESS;
1750}
1751
1752DEFUN (no_isis_priority_l1,
1753 no_isis_priority_l1_cmd,
1754 "no isis priority level-1",
1755 NO_STR
1756 "IS-IS commands\n"
1757 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001758 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001759{
Josh Bailey3f045a02012-03-24 08:35:20 -07001760 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1761 if (!circuit)
1762 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001763
Josh Bailey3f045a02012-03-24 08:35:20 -07001764 circuit->priority[0] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001765
jardineb5d44e2003-12-23 08:09:43 +00001766 return CMD_SUCCESS;
1767}
1768
1769ALIAS (no_isis_priority_l1,
1770 no_isis_priority_l1_arg_cmd,
1771 "no isis priority <0-127> level-1",
1772 NO_STR
1773 "IS-IS commands\n"
1774 "Set priority for Designated Router election\n"
1775 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001776 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001777
1778DEFUN (isis_priority_l2,
1779 isis_priority_l2_cmd,
hassof390d2c2004-09-10 20:48:21 +00001780 "isis priority <0-127> level-2",
jardineb5d44e2003-12-23 08:09:43 +00001781 "IS-IS commands\n"
1782 "Set priority for Designated Router election\n"
1783 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001784 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001785{
jardineb5d44e2003-12-23 08:09:43 +00001786 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001787 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1788 if (!circuit)
1789 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001790
1791 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001792 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1793 {
1794 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1795 prio, VTY_NEWLINE);
1796 return CMD_ERR_AMBIGUOUS;
1797 }
jardineb5d44e2003-12-23 08:09:43 +00001798
Josh Bailey3f045a02012-03-24 08:35:20 -07001799 circuit->priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001800
jardineb5d44e2003-12-23 08:09:43 +00001801 return CMD_SUCCESS;
1802}
1803
1804DEFUN (no_isis_priority_l2,
1805 no_isis_priority_l2_cmd,
1806 "no isis priority level-2",
1807 NO_STR
1808 "IS-IS commands\n"
1809 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001810 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001811{
Josh Bailey3f045a02012-03-24 08:35:20 -07001812 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1813 if (!circuit)
1814 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001815
Josh Bailey3f045a02012-03-24 08:35:20 -07001816 circuit->priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001817
jardineb5d44e2003-12-23 08:09:43 +00001818 return CMD_SUCCESS;
1819}
1820
1821ALIAS (no_isis_priority_l2,
1822 no_isis_priority_l2_arg_cmd,
1823 "no isis priority <0-127> level-2",
1824 NO_STR
1825 "IS-IS commands\n"
1826 "Set priority for Designated Router election\n"
1827 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001828 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001829
1830/* Metric command */
Josh Bailey3f045a02012-03-24 08:35:20 -07001831DEFUN (isis_metric,
jardineb5d44e2003-12-23 08:09:43 +00001832 isis_metric_cmd,
hassof21fb272005-09-26 17:05:55 +00001833 "isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001834 "IS-IS commands\n"
1835 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001836 "Default metric value\n")
jardineb5d44e2003-12-23 08:09:43 +00001837{
jardineb5d44e2003-12-23 08:09:43 +00001838 int met;
Josh Bailey3f045a02012-03-24 08:35:20 -07001839 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1840 if (!circuit)
1841 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001842
1843 met = atoi (argv[0]);
1844
Josh Bailey3f045a02012-03-24 08:35:20 -07001845 /* RFC3787 section 5.1 */
1846 if (circuit->area && circuit->area->oldmetric == 1 &&
1847 met > MAX_NARROW_LINK_METRIC)
1848 {
1849 vty_out (vty, "Invalid metric %d - should be <0-63> "
1850 "when narrow metric type enabled%s",
1851 met, VTY_NEWLINE);
1852 return CMD_ERR_AMBIGUOUS;
1853 }
1854
1855 /* RFC4444 */
1856 if (circuit->area && circuit->area->newmetric == 1 &&
1857 met > MAX_WIDE_LINK_METRIC)
1858 {
1859 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
1860 "when wide metric type enabled%s",
1861 met, VTY_NEWLINE);
1862 return CMD_ERR_AMBIGUOUS;
1863 }
1864
hassof21fb272005-09-26 17:05:55 +00001865 circuit->te_metric[0] = met;
1866 circuit->te_metric[1] = met;
1867
jardineb5d44e2003-12-23 08:09:43 +00001868 circuit->metrics[0].metric_default = met;
1869 circuit->metrics[1].metric_default = met;
1870
Josh Bailey3f045a02012-03-24 08:35:20 -07001871 if (circuit->area)
1872 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
1873
jardineb5d44e2003-12-23 08:09:43 +00001874 return CMD_SUCCESS;
1875}
1876
1877DEFUN (no_isis_metric,
1878 no_isis_metric_cmd,
1879 "no isis metric",
1880 NO_STR
1881 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001882 "Set default metric for circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001883{
Josh Bailey3f045a02012-03-24 08:35:20 -07001884 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1885 if (!circuit)
1886 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001887
Josh Bailey3f045a02012-03-24 08:35:20 -07001888 circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC;
1889 circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC;
1890 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC;
1891 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC;
jardineb5d44e2003-12-23 08:09:43 +00001892
Josh Bailey3f045a02012-03-24 08:35:20 -07001893 if (circuit->area)
1894 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
jardineb5d44e2003-12-23 08:09:43 +00001895
1896 return CMD_SUCCESS;
1897}
1898
1899ALIAS (no_isis_metric,
1900 no_isis_metric_arg_cmd,
hassof21fb272005-09-26 17:05:55 +00001901 "no isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001902 NO_STR
1903 "IS-IS commands\n"
1904 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001905 "Default metric value\n")
1906
Josh Bailey3f045a02012-03-24 08:35:20 -07001907DEFUN (isis_metric_l1,
1908 isis_metric_l1_cmd,
1909 "isis metric <0-16777215> level-1",
1910 "IS-IS commands\n"
1911 "Set default metric for circuit\n"
1912 "Default metric value\n"
1913 "Specify metric for level-1 routing\n")
1914{
1915 int met;
1916 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1917 if (!circuit)
1918 return CMD_ERR_NO_MATCH;
1919
1920 met = atoi (argv[0]);
1921
1922 /* RFC3787 section 5.1 */
1923 if (circuit->area && circuit->area->oldmetric == 1 &&
1924 met > MAX_NARROW_LINK_METRIC)
1925 {
1926 vty_out (vty, "Invalid metric %d - should be <0-63> "
1927 "when narrow metric type enabled%s",
1928 met, VTY_NEWLINE);
1929 return CMD_ERR_AMBIGUOUS;
1930 }
1931
1932 /* RFC4444 */
1933 if (circuit->area && circuit->area->newmetric == 1 &&
1934 met > MAX_WIDE_LINK_METRIC)
1935 {
1936 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
1937 "when wide metric type enabled%s",
1938 met, VTY_NEWLINE);
1939 return CMD_ERR_AMBIGUOUS;
1940 }
1941
1942 circuit->te_metric[0] = met;
1943 circuit->metrics[0].metric_default = met;
1944
1945 if (circuit->area)
1946 lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0);
1947
1948 return CMD_SUCCESS;
1949}
1950
1951DEFUN (no_isis_metric_l1,
1952 no_isis_metric_l1_cmd,
1953 "no isis metric level-1",
1954 NO_STR
1955 "IS-IS commands\n"
1956 "Set default metric for circuit\n"
1957 "Specify metric for level-1 routing\n")
1958{
1959 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1960 if (!circuit)
1961 return CMD_ERR_NO_MATCH;
1962
1963 circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC;
1964 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC;
1965
1966 if (circuit->area)
1967 lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0);
1968
1969 return CMD_SUCCESS;
1970}
1971
1972ALIAS (no_isis_metric_l1,
1973 no_isis_metric_l1_arg_cmd,
1974 "no isis metric <0-16777215> level-1",
1975 NO_STR
1976 "IS-IS commands\n"
1977 "Set default metric for circuit\n"
1978 "Default metric value\n"
1979 "Specify metric for level-1 routing\n")
1980
1981DEFUN (isis_metric_l2,
1982 isis_metric_l2_cmd,
1983 "isis metric <0-16777215> level-2",
1984 "IS-IS commands\n"
1985 "Set default metric for circuit\n"
1986 "Default metric value\n"
1987 "Specify metric for level-2 routing\n")
1988{
1989 int met;
1990 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1991 if (!circuit)
1992 return CMD_ERR_NO_MATCH;
1993
1994 met = atoi (argv[0]);
1995
1996 /* RFC3787 section 5.1 */
1997 if (circuit->area && circuit->area->oldmetric == 1 &&
1998 met > MAX_NARROW_LINK_METRIC)
1999 {
2000 vty_out (vty, "Invalid metric %d - should be <0-63> "
2001 "when narrow metric type enabled%s",
2002 met, VTY_NEWLINE);
2003 return CMD_ERR_AMBIGUOUS;
2004 }
2005
2006 /* RFC4444 */
2007 if (circuit->area && circuit->area->newmetric == 1 &&
2008 met > MAX_WIDE_LINK_METRIC)
2009 {
2010 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
2011 "when wide metric type enabled%s",
2012 met, VTY_NEWLINE);
2013 return CMD_ERR_AMBIGUOUS;
2014 }
2015
2016 circuit->te_metric[1] = met;
2017 circuit->metrics[1].metric_default = met;
2018
2019 if (circuit->area)
2020 lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0);
2021
2022 return CMD_SUCCESS;
2023}
2024
2025DEFUN (no_isis_metric_l2,
2026 no_isis_metric_l2_cmd,
2027 "no isis metric level-2",
2028 NO_STR
2029 "IS-IS commands\n"
2030 "Set default metric for circuit\n"
2031 "Specify metric for level-2 routing\n")
2032{
2033 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2034 if (!circuit)
2035 return CMD_ERR_NO_MATCH;
2036
2037 circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC;
2038 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC;
2039
2040 if (circuit->area)
2041 lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0);
2042
2043 return CMD_SUCCESS;
2044}
2045
2046ALIAS (no_isis_metric_l2,
2047 no_isis_metric_l2_arg_cmd,
2048 "no isis metric <0-16777215> level-2",
2049 NO_STR
2050 "IS-IS commands\n"
2051 "Set default metric for circuit\n"
2052 "Default metric value\n"
2053 "Specify metric for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00002054/* end of metrics */
Josh Bailey3f045a02012-03-24 08:35:20 -07002055
hassof21fb272005-09-26 17:05:55 +00002056DEFUN (isis_hello_interval,
jardineb5d44e2003-12-23 08:09:43 +00002057 isis_hello_interval_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002058 "isis hello-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002059 "IS-IS commands\n"
2060 "Set Hello interval\n"
2061 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00002062 "Holdtime 1 seconds, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00002063{
jardineb5d44e2003-12-23 08:09:43 +00002064 int interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002065 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2066 if (!circuit)
2067 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002068
Josh Bailey3f045a02012-03-24 08:35:20 -07002069 interval = atoi (argv[0]);
2070 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002071 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002072 vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s",
2073 interval, VTY_NEWLINE);
2074 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002075 }
jardineb5d44e2003-12-23 08:09:43 +00002076
hassof390d2c2004-09-10 20:48:21 +00002077 circuit->hello_interval[0] = (u_int16_t) interval;
2078 circuit->hello_interval[1] = (u_int16_t) interval;
2079
jardineb5d44e2003-12-23 08:09:43 +00002080 return CMD_SUCCESS;
2081}
2082
2083DEFUN (no_isis_hello_interval,
2084 no_isis_hello_interval_cmd,
2085 "no isis hello-interval",
2086 NO_STR
2087 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002088 "Set Hello interval\n")
jardineb5d44e2003-12-23 08:09:43 +00002089{
Josh Bailey3f045a02012-03-24 08:35:20 -07002090 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2091 if (!circuit)
2092 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002093
Josh Bailey3f045a02012-03-24 08:35:20 -07002094 circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL;
2095 circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002096
jardineb5d44e2003-12-23 08:09:43 +00002097 return CMD_SUCCESS;
2098}
2099
2100ALIAS (no_isis_hello_interval,
2101 no_isis_hello_interval_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002102 "no isis hello-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002103 NO_STR
2104 "IS-IS commands\n"
2105 "Set Hello interval\n"
2106 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00002107 "Holdtime 1 second, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00002108
2109DEFUN (isis_hello_interval_l1,
2110 isis_hello_interval_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002111 "isis hello-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002112 "IS-IS commands\n"
2113 "Set Hello interval\n"
2114 "Hello interval value\n"
2115 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002116 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002117{
jardineb5d44e2003-12-23 08:09:43 +00002118 long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002119 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2120 if (!circuit)
2121 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002122
Josh Bailey3f045a02012-03-24 08:35:20 -07002123 interval = atoi (argv[0]);
2124 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002125 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002126 vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
2127 interval, VTY_NEWLINE);
2128 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002129 }
jardineb5d44e2003-12-23 08:09:43 +00002130
hassof390d2c2004-09-10 20:48:21 +00002131 circuit->hello_interval[0] = (u_int16_t) interval;
2132
jardineb5d44e2003-12-23 08:09:43 +00002133 return CMD_SUCCESS;
2134}
2135
2136DEFUN (no_isis_hello_interval_l1,
2137 no_isis_hello_interval_l1_cmd,
2138 "no isis hello-interval level-1",
2139 NO_STR
2140 "IS-IS commands\n"
2141 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00002142 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002143{
Josh Bailey3f045a02012-03-24 08:35:20 -07002144 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2145 if (!circuit)
2146 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002147
Josh Bailey3f045a02012-03-24 08:35:20 -07002148 circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002149
jardineb5d44e2003-12-23 08:09:43 +00002150 return CMD_SUCCESS;
2151}
2152
2153ALIAS (no_isis_hello_interval_l1,
2154 no_isis_hello_interval_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002155 "no isis hello-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002156 NO_STR
2157 "IS-IS commands\n"
2158 "Set Hello interval\n"
2159 "Hello interval value\n"
2160 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002161 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002162
2163DEFUN (isis_hello_interval_l2,
2164 isis_hello_interval_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002165 "isis hello-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002166 "IS-IS commands\n"
2167 "Set Hello interval\n"
2168 "Hello interval value\n"
2169 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002170 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002171{
jardineb5d44e2003-12-23 08:09:43 +00002172 long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002173 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2174 if (!circuit)
2175 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002176
Josh Bailey3f045a02012-03-24 08:35:20 -07002177 interval = atoi (argv[0]);
2178 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002179 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002180 vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
2181 interval, VTY_NEWLINE);
2182 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002183 }
jardineb5d44e2003-12-23 08:09:43 +00002184
hassof390d2c2004-09-10 20:48:21 +00002185 circuit->hello_interval[1] = (u_int16_t) interval;
2186
jardineb5d44e2003-12-23 08:09:43 +00002187 return CMD_SUCCESS;
2188}
2189
2190DEFUN (no_isis_hello_interval_l2,
2191 no_isis_hello_interval_l2_cmd,
2192 "no isis hello-interval level-2",
2193 NO_STR
2194 "IS-IS commands\n"
2195 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00002196 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002197{
Josh Bailey3f045a02012-03-24 08:35:20 -07002198 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2199 if (!circuit)
2200 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002201
Josh Bailey3f045a02012-03-24 08:35:20 -07002202 circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002203
jardineb5d44e2003-12-23 08:09:43 +00002204 return CMD_SUCCESS;
2205}
2206
2207ALIAS (no_isis_hello_interval_l2,
2208 no_isis_hello_interval_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002209 "no isis hello-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002210 NO_STR
2211 "IS-IS commands\n"
2212 "Set Hello interval\n"
2213 "Hello interval value\n"
2214 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002215 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002216
2217DEFUN (isis_hello_multiplier,
2218 isis_hello_multiplier_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002219 "isis hello-multiplier <2-100>",
jardineb5d44e2003-12-23 08:09:43 +00002220 "IS-IS commands\n"
2221 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002222 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00002223{
jardineb5d44e2003-12-23 08:09:43 +00002224 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002225 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2226 if (!circuit)
2227 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002228
2229 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002230 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2231 {
2232 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2233 mult, VTY_NEWLINE);
2234 return CMD_ERR_AMBIGUOUS;
2235 }
jardineb5d44e2003-12-23 08:09:43 +00002236
hassof390d2c2004-09-10 20:48:21 +00002237 circuit->hello_multiplier[0] = (u_int16_t) mult;
2238 circuit->hello_multiplier[1] = (u_int16_t) mult;
2239
jardineb5d44e2003-12-23 08:09:43 +00002240 return CMD_SUCCESS;
2241}
2242
2243DEFUN (no_isis_hello_multiplier,
2244 no_isis_hello_multiplier_cmd,
2245 "no isis hello-multiplier",
2246 NO_STR
2247 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002248 "Set multiplier for Hello holding time\n")
jardineb5d44e2003-12-23 08:09:43 +00002249{
Josh Bailey3f045a02012-03-24 08:35:20 -07002250 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2251 if (!circuit)
2252 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002253
Josh Bailey3f045a02012-03-24 08:35:20 -07002254 circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER;
2255 circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002256
2257 return CMD_SUCCESS;
2258}
2259
2260ALIAS (no_isis_hello_multiplier,
2261 no_isis_hello_multiplier_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002262 "no isis hello-multiplier <2-100>",
jardineb5d44e2003-12-23 08:09:43 +00002263 NO_STR
2264 "IS-IS commands\n"
2265 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002266 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00002267
2268DEFUN (isis_hello_multiplier_l1,
2269 isis_hello_multiplier_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002270 "isis hello-multiplier <2-100> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002271 "IS-IS commands\n"
2272 "Set multiplier for Hello holding time\n"
2273 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002274 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002275{
jardineb5d44e2003-12-23 08:09:43 +00002276 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002277 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2278 if (!circuit)
2279 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002280
2281 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002282 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2283 {
2284 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2285 mult, VTY_NEWLINE);
2286 return CMD_ERR_AMBIGUOUS;
2287 }
jardineb5d44e2003-12-23 08:09:43 +00002288
hassof390d2c2004-09-10 20:48:21 +00002289 circuit->hello_multiplier[0] = (u_int16_t) mult;
2290
jardineb5d44e2003-12-23 08:09:43 +00002291 return CMD_SUCCESS;
2292}
2293
2294DEFUN (no_isis_hello_multiplier_l1,
2295 no_isis_hello_multiplier_l1_cmd,
2296 "no isis hello-multiplier level-1",
2297 NO_STR
2298 "IS-IS commands\n"
2299 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002300 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002301{
Josh Bailey3f045a02012-03-24 08:35:20 -07002302 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2303 if (!circuit)
2304 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002305
Josh Bailey3f045a02012-03-24 08:35:20 -07002306 circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002307
2308 return CMD_SUCCESS;
2309}
2310
2311ALIAS (no_isis_hello_multiplier_l1,
2312 no_isis_hello_multiplier_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002313 "no isis hello-multiplier <2-100> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002314 NO_STR
2315 "IS-IS commands\n"
2316 "Set multiplier for Hello holding time\n"
2317 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002318 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002319
2320DEFUN (isis_hello_multiplier_l2,
2321 isis_hello_multiplier_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002322 "isis hello-multiplier <2-100> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002323 "IS-IS commands\n"
2324 "Set multiplier for Hello holding time\n"
2325 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002326 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002327{
jardineb5d44e2003-12-23 08:09:43 +00002328 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002329 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2330 if (!circuit)
2331 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002332
2333 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002334 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2335 {
2336 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2337 mult, VTY_NEWLINE);
2338 return CMD_ERR_AMBIGUOUS;
2339 }
jardineb5d44e2003-12-23 08:09:43 +00002340
hassof390d2c2004-09-10 20:48:21 +00002341 circuit->hello_multiplier[1] = (u_int16_t) mult;
2342
jardineb5d44e2003-12-23 08:09:43 +00002343 return CMD_SUCCESS;
2344}
2345
2346DEFUN (no_isis_hello_multiplier_l2,
2347 no_isis_hello_multiplier_l2_cmd,
2348 "no isis hello-multiplier level-2",
2349 NO_STR
2350 "IS-IS commands\n"
2351 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002352 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002353{
Josh Bailey3f045a02012-03-24 08:35:20 -07002354 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2355 if (!circuit)
2356 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002357
Josh Bailey3f045a02012-03-24 08:35:20 -07002358 circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002359
2360 return CMD_SUCCESS;
2361}
2362
2363ALIAS (no_isis_hello_multiplier_l2,
2364 no_isis_hello_multiplier_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002365 "no isis hello-multiplier <2-100> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002366 NO_STR
2367 "IS-IS commands\n"
2368 "Set multiplier for Hello holding time\n"
2369 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002370 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002371
Josh Bailey3f045a02012-03-24 08:35:20 -07002372DEFUN (isis_hello_padding,
2373 isis_hello_padding_cmd,
jardineb5d44e2003-12-23 08:09:43 +00002374 "isis hello padding",
2375 "IS-IS commands\n"
2376 "Add padding to IS-IS hello packets\n"
2377 "Pad hello packets\n"
2378 "<cr>\n")
2379{
Josh Bailey3f045a02012-03-24 08:35:20 -07002380 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2381 if (!circuit)
2382 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002383
Josh Bailey3f045a02012-03-24 08:35:20 -07002384 circuit->pad_hellos = 1;
hassof390d2c2004-09-10 20:48:21 +00002385
jardineb5d44e2003-12-23 08:09:43 +00002386 return CMD_SUCCESS;
2387}
2388
Josh Bailey3f045a02012-03-24 08:35:20 -07002389DEFUN (no_isis_hello_padding,
2390 no_isis_hello_padding_cmd,
jardineb5d44e2003-12-23 08:09:43 +00002391 "no isis hello padding",
2392 NO_STR
2393 "IS-IS commands\n"
2394 "Add padding to IS-IS hello packets\n"
2395 "Pad hello packets\n"
2396 "<cr>\n")
2397{
Josh Bailey3f045a02012-03-24 08:35:20 -07002398 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2399 if (!circuit)
2400 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002401
Josh Bailey3f045a02012-03-24 08:35:20 -07002402 circuit->pad_hellos = 0;
hassof390d2c2004-09-10 20:48:21 +00002403
jardineb5d44e2003-12-23 08:09:43 +00002404 return CMD_SUCCESS;
2405}
2406
2407DEFUN (csnp_interval,
2408 csnp_interval_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002409 "isis csnp-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002410 "IS-IS commands\n"
2411 "Set CSNP interval in seconds\n"
2412 "CSNP interval value\n")
2413{
jardineb5d44e2003-12-23 08:09:43 +00002414 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002415 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2416 if (!circuit)
2417 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002418
jardineb5d44e2003-12-23 08:09:43 +00002419 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002420 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2421 {
2422 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2423 interval, VTY_NEWLINE);
2424 return CMD_ERR_AMBIGUOUS;
2425 }
jardineb5d44e2003-12-23 08:09:43 +00002426
hassof390d2c2004-09-10 20:48:21 +00002427 circuit->csnp_interval[0] = (u_int16_t) interval;
2428 circuit->csnp_interval[1] = (u_int16_t) interval;
2429
jardineb5d44e2003-12-23 08:09:43 +00002430 return CMD_SUCCESS;
2431}
2432
2433DEFUN (no_csnp_interval,
2434 no_csnp_interval_cmd,
2435 "no isis csnp-interval",
2436 NO_STR
2437 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002438 "Set CSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002439{
Josh Bailey3f045a02012-03-24 08:35:20 -07002440 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2441 if (!circuit)
2442 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002443
Josh Bailey3f045a02012-03-24 08:35:20 -07002444 circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL;
2445 circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002446
jardineb5d44e2003-12-23 08:09:43 +00002447 return CMD_SUCCESS;
2448}
2449
2450ALIAS (no_csnp_interval,
2451 no_csnp_interval_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002452 "no isis csnp-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002453 NO_STR
2454 "IS-IS commands\n"
2455 "Set CSNP interval in seconds\n"
2456 "CSNP interval value\n")
2457
jardineb5d44e2003-12-23 08:09:43 +00002458DEFUN (csnp_interval_l1,
2459 csnp_interval_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002460 "isis csnp-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002461 "IS-IS commands\n"
2462 "Set CSNP interval in seconds\n"
2463 "CSNP interval value\n"
2464 "Specify interval for level-1 CSNPs\n")
2465{
jardineb5d44e2003-12-23 08:09:43 +00002466 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002467 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2468 if (!circuit)
2469 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002470
jardineb5d44e2003-12-23 08:09:43 +00002471 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002472 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2473 {
2474 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2475 interval, VTY_NEWLINE);
2476 return CMD_ERR_AMBIGUOUS;
2477 }
hassof390d2c2004-09-10 20:48:21 +00002478
2479 circuit->csnp_interval[0] = (u_int16_t) interval;
2480
jardineb5d44e2003-12-23 08:09:43 +00002481 return CMD_SUCCESS;
2482}
2483
2484DEFUN (no_csnp_interval_l1,
2485 no_csnp_interval_l1_cmd,
2486 "no isis csnp-interval level-1",
2487 NO_STR
2488 "IS-IS commands\n"
2489 "Set CSNP interval in seconds\n"
2490 "Specify interval for level-1 CSNPs\n")
2491{
Josh Bailey3f045a02012-03-24 08:35:20 -07002492 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2493 if (!circuit)
2494 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002495
Josh Bailey3f045a02012-03-24 08:35:20 -07002496 circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002497
jardineb5d44e2003-12-23 08:09:43 +00002498 return CMD_SUCCESS;
2499}
2500
2501ALIAS (no_csnp_interval_l1,
2502 no_csnp_interval_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002503 "no isis csnp-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002504 NO_STR
2505 "IS-IS commands\n"
2506 "Set CSNP interval in seconds\n"
2507 "CSNP interval value\n"
2508 "Specify interval for level-1 CSNPs\n")
2509
jardineb5d44e2003-12-23 08:09:43 +00002510DEFUN (csnp_interval_l2,
2511 csnp_interval_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002512 "isis csnp-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002513 "IS-IS commands\n"
2514 "Set CSNP interval in seconds\n"
2515 "CSNP interval value\n"
2516 "Specify interval for level-2 CSNPs\n")
2517{
jardineb5d44e2003-12-23 08:09:43 +00002518 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002519 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2520 if (!circuit)
2521 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002522
jardineb5d44e2003-12-23 08:09:43 +00002523 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002524 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2525 {
2526 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2527 interval, VTY_NEWLINE);
2528 return CMD_ERR_AMBIGUOUS;
2529 }
hassof390d2c2004-09-10 20:48:21 +00002530
2531 circuit->csnp_interval[1] = (u_int16_t) interval;
2532
jardineb5d44e2003-12-23 08:09:43 +00002533 return CMD_SUCCESS;
2534}
2535
2536DEFUN (no_csnp_interval_l2,
2537 no_csnp_interval_l2_cmd,
2538 "no isis csnp-interval level-2",
2539 NO_STR
2540 "IS-IS commands\n"
2541 "Set CSNP interval in seconds\n"
2542 "Specify interval for level-2 CSNPs\n")
2543{
Josh Bailey3f045a02012-03-24 08:35:20 -07002544 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2545 if (!circuit)
2546 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002547
Josh Bailey3f045a02012-03-24 08:35:20 -07002548 circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002549
jardineb5d44e2003-12-23 08:09:43 +00002550 return CMD_SUCCESS;
2551}
2552
2553ALIAS (no_csnp_interval_l2,
2554 no_csnp_interval_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002555 "no isis csnp-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002556 NO_STR
2557 "IS-IS commands\n"
2558 "Set CSNP interval in seconds\n"
2559 "CSNP interval value\n"
2560 "Specify interval for level-2 CSNPs\n")
2561
Josh Bailey3f045a02012-03-24 08:35:20 -07002562DEFUN (psnp_interval,
2563 psnp_interval_cmd,
2564 "isis psnp-interval <1-120>",
2565 "IS-IS commands\n"
2566 "Set PSNP interval in seconds\n"
2567 "PSNP interval value\n")
jardineb5d44e2003-12-23 08:09:43 +00002568{
Josh Bailey3f045a02012-03-24 08:35:20 -07002569 unsigned long interval;
2570 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2571 if (!circuit)
2572 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002573
Josh Bailey3f045a02012-03-24 08:35:20 -07002574 interval = atol (argv[0]);
2575 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002576 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002577 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2578 interval, VTY_NEWLINE);
2579 return CMD_ERR_AMBIGUOUS;
jardineb5d44e2003-12-23 08:09:43 +00002580 }
jardineb5d44e2003-12-23 08:09:43 +00002581
Josh Bailey3f045a02012-03-24 08:35:20 -07002582 circuit->psnp_interval[0] = (u_int16_t) interval;
2583 circuit->psnp_interval[1] = (u_int16_t) interval;
jardineb5d44e2003-12-23 08:09:43 +00002584
2585 return CMD_SUCCESS;
2586}
2587
Josh Bailey3f045a02012-03-24 08:35:20 -07002588DEFUN (no_psnp_interval,
2589 no_psnp_interval_cmd,
2590 "no isis psnp-interval",
jardineb5d44e2003-12-23 08:09:43 +00002591 NO_STR
Josh Bailey3f045a02012-03-24 08:35:20 -07002592 "IS-IS commands\n"
2593 "Set PSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002594{
Josh Bailey3f045a02012-03-24 08:35:20 -07002595 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2596 if (!circuit)
2597 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002598
Josh Bailey3f045a02012-03-24 08:35:20 -07002599 circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL;
2600 circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL;
jardineb5d44e2003-12-23 08:09:43 +00002601
2602 return CMD_SUCCESS;
2603}
jardineb5d44e2003-12-23 08:09:43 +00002604
Josh Bailey3f045a02012-03-24 08:35:20 -07002605ALIAS (no_psnp_interval,
2606 no_psnp_interval_arg_cmd,
2607 "no isis psnp-interval <1-120>",
2608 NO_STR
2609 "IS-IS commands\n"
2610 "Set PSNP interval in seconds\n"
2611 "PSNP interval value\n")
2612
2613DEFUN (psnp_interval_l1,
2614 psnp_interval_l1_cmd,
2615 "isis psnp-interval <1-120> level-1",
2616 "IS-IS commands\n"
2617 "Set PSNP interval in seconds\n"
2618 "PSNP interval value\n"
2619 "Specify interval for level-1 PSNPs\n")
2620{
2621 unsigned long interval;
2622 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2623 if (!circuit)
2624 return CMD_ERR_NO_MATCH;
2625
2626 interval = atol (argv[0]);
2627 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
2628 {
2629 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2630 interval, VTY_NEWLINE);
2631 return CMD_ERR_AMBIGUOUS;
2632 }
2633
2634 circuit->psnp_interval[0] = (u_int16_t) interval;
2635
2636 return CMD_SUCCESS;
2637}
2638
2639DEFUN (no_psnp_interval_l1,
2640 no_psnp_interval_l1_cmd,
2641 "no isis psnp-interval level-1",
2642 NO_STR
2643 "IS-IS commands\n"
2644 "Set PSNP interval in seconds\n"
2645 "Specify interval for level-1 PSNPs\n")
2646{
2647 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2648 if (!circuit)
2649 return CMD_ERR_NO_MATCH;
2650
2651 circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL;
2652
2653 return CMD_SUCCESS;
2654}
2655
2656ALIAS (no_psnp_interval_l1,
2657 no_psnp_interval_l1_arg_cmd,
2658 "no isis psnp-interval <1-120> level-1",
2659 NO_STR
2660 "IS-IS commands\n"
2661 "Set PSNP interval in seconds\n"
2662 "PSNP interval value\n"
2663 "Specify interval for level-1 PSNPs\n")
2664
2665DEFUN (psnp_interval_l2,
2666 psnp_interval_l2_cmd,
2667 "isis psnp-interval <1-120> level-2",
2668 "IS-IS commands\n"
2669 "Set PSNP interval in seconds\n"
2670 "PSNP interval value\n"
2671 "Specify interval for level-2 PSNPs\n")
2672{
2673 unsigned long interval;
2674 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2675 if (!circuit)
2676 return CMD_ERR_NO_MATCH;
2677
2678 interval = atol (argv[0]);
2679 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
2680 {
2681 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2682 interval, VTY_NEWLINE);
2683 return CMD_ERR_AMBIGUOUS;
2684 }
2685
2686 circuit->psnp_interval[1] = (u_int16_t) interval;
2687
2688 return CMD_SUCCESS;
2689}
2690
2691DEFUN (no_psnp_interval_l2,
2692 no_psnp_interval_l2_cmd,
2693 "no isis psnp-interval level-2",
2694 NO_STR
2695 "IS-IS commands\n"
2696 "Set PSNP interval in seconds\n"
2697 "Specify interval for level-2 PSNPs\n")
2698{
2699 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2700 if (!circuit)
2701 return CMD_ERR_NO_MATCH;
2702
2703 circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL;
2704
2705 return CMD_SUCCESS;
2706}
2707
2708ALIAS (no_psnp_interval_l2,
2709 no_psnp_interval_l2_arg_cmd,
2710 "no isis psnp-interval <1-120> level-2",
2711 NO_STR
2712 "IS-IS commands\n"
2713 "Set PSNP interval in seconds\n"
2714 "PSNP interval value\n"
2715 "Specify interval for level-2 PSNPs\n")
2716
2717struct cmd_node interface_node = {
jardineb5d44e2003-12-23 08:09:43 +00002718 INTERFACE_NODE,
2719 "%s(config-if)# ",
2720 1,
2721};
2722
Josh Bailey3f045a02012-03-24 08:35:20 -07002723DEFUN (isis_network,
2724 isis_network_cmd,
2725 "isis network point-to-point",
2726 "IS-IS commands\n"
2727 "Set network type\n"
2728 "point-to-point network type\n")
2729{
2730 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2731 if (!circuit)
2732 return CMD_ERR_NO_MATCH;
2733
2734 /* RFC5309 section 4 */
2735 if (circuit->circ_type == CIRCUIT_T_P2P)
2736 return CMD_SUCCESS;
2737
2738 if (circuit->state != C_STATE_UP)
2739 {
2740 circuit->circ_type = CIRCUIT_T_P2P;
2741 circuit->circ_type_config = CIRCUIT_T_P2P;
2742 }
2743 else
2744 {
2745 struct isis_area *area = circuit->area;
2746 if (!if_is_broadcast (circuit->interface))
2747 {
2748 vty_out (vty, "isis network point-to-point "
2749 "is valid only on broadcast interfaces%s",
2750 VTY_NEWLINE);
2751 return CMD_ERR_AMBIGUOUS;
2752 }
2753
2754 isis_csm_state_change (ISIS_DISABLE, circuit, area);
2755 circuit->circ_type = CIRCUIT_T_P2P;
2756 circuit->circ_type_config = CIRCUIT_T_P2P;
2757 isis_csm_state_change (ISIS_ENABLE, circuit, area);
2758 }
2759
2760 return CMD_SUCCESS;
2761}
2762
2763DEFUN (no_isis_network,
2764 no_isis_network_cmd,
2765 "no isis network point-to-point",
2766 NO_STR
2767 "IS-IS commands\n"
2768 "Set network type for circuit\n"
2769 "point-to-point network type\n")
2770{
2771 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2772 if (!circuit)
2773 return CMD_ERR_NO_MATCH;
2774
2775 /* RFC5309 section 4 */
2776 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
2777 return CMD_SUCCESS;
2778
2779 if (circuit->state != C_STATE_UP)
2780 {
2781 circuit->circ_type = CIRCUIT_T_BROADCAST;
2782 circuit->circ_type_config = CIRCUIT_T_BROADCAST;
2783 }
2784 else
2785 {
2786 struct isis_area *area = circuit->area;
2787 if (circuit->interface &&
2788 !if_is_broadcast (circuit->interface))
2789 {
2790 vty_out (vty, "no isis network point-to-point "
2791 "is valid only on broadcast interfaces%s",
2792 VTY_NEWLINE);
2793 return CMD_ERR_AMBIGUOUS;
2794 }
2795
2796 isis_csm_state_change (ISIS_DISABLE, circuit, area);
2797 circuit->circ_type = CIRCUIT_T_BROADCAST;
2798 circuit->circ_type_config = CIRCUIT_T_BROADCAST;
2799 isis_csm_state_change (ISIS_ENABLE, circuit, area);
2800 }
2801
2802 return CMD_SUCCESS;
2803}
2804
jardineb5d44e2003-12-23 08:09:43 +00002805int
2806isis_if_new_hook (struct interface *ifp)
2807{
jardineb5d44e2003-12-23 08:09:43 +00002808 return 0;
2809}
2810
2811int
2812isis_if_delete_hook (struct interface *ifp)
2813{
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002814 struct isis_circuit *circuit;
2815 /* Clean up the circuit data */
2816 if (ifp && ifp->info)
2817 {
2818 circuit = ifp->info;
2819 isis_csm_state_change (IF_DOWN_FROM_Z, circuit, circuit->area);
2820 isis_csm_state_change (ISIS_DISABLE, circuit, circuit->area);
2821 }
2822
jardineb5d44e2003-12-23 08:09:43 +00002823 return 0;
2824}
2825
jardineb5d44e2003-12-23 08:09:43 +00002826void
2827isis_circuit_init ()
2828{
jardineb5d44e2003-12-23 08:09:43 +00002829 /* Initialize Zebra interface data structure */
jardineb5d44e2003-12-23 08:09:43 +00002830 if_add_hook (IF_NEW_HOOK, isis_if_new_hook);
2831 if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook);
2832
2833 /* Install interface node */
2834 install_node (&interface_node, isis_interface_config_write);
2835 install_element (CONFIG_NODE, &interface_cmd);
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002836 install_element (CONFIG_NODE, &no_interface_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002837
2838 install_default (INTERFACE_NODE);
2839 install_element (INTERFACE_NODE, &interface_desc_cmd);
2840 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
2841
2842 install_element (INTERFACE_NODE, &ip_router_isis_cmd);
2843 install_element (INTERFACE_NODE, &no_ip_router_isis_cmd);
2844
Josh Bailey3f045a02012-03-24 08:35:20 -07002845 install_element (INTERFACE_NODE, &isis_passive_cmd);
2846 install_element (INTERFACE_NODE, &no_isis_passive_cmd);
2847
jardineb5d44e2003-12-23 08:09:43 +00002848 install_element (INTERFACE_NODE, &isis_circuit_type_cmd);
2849 install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd);
2850
Josh Bailey3f045a02012-03-24 08:35:20 -07002851 install_element (INTERFACE_NODE, &isis_passwd_clear_cmd);
2852 install_element (INTERFACE_NODE, &isis_passwd_md5_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002853 install_element (INTERFACE_NODE, &no_isis_passwd_cmd);
2854
2855 install_element (INTERFACE_NODE, &isis_priority_cmd);
2856 install_element (INTERFACE_NODE, &no_isis_priority_cmd);
2857 install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd);
2858 install_element (INTERFACE_NODE, &isis_priority_l1_cmd);
2859 install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd);
2860 install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd);
2861 install_element (INTERFACE_NODE, &isis_priority_l2_cmd);
2862 install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd);
2863 install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd);
2864
2865 install_element (INTERFACE_NODE, &isis_metric_cmd);
2866 install_element (INTERFACE_NODE, &no_isis_metric_cmd);
2867 install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07002868 install_element (INTERFACE_NODE, &isis_metric_l1_cmd);
2869 install_element (INTERFACE_NODE, &no_isis_metric_l1_cmd);
2870 install_element (INTERFACE_NODE, &no_isis_metric_l1_arg_cmd);
2871 install_element (INTERFACE_NODE, &isis_metric_l2_cmd);
2872 install_element (INTERFACE_NODE, &no_isis_metric_l2_cmd);
2873 install_element (INTERFACE_NODE, &no_isis_metric_l2_arg_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002874
2875 install_element (INTERFACE_NODE, &isis_hello_interval_cmd);
2876 install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd);
2877 install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd);
2878 install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd);
2879 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd);
2880 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd);
2881 install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd);
2882 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd);
2883 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd);
2884
2885 install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd);
2886 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
2887 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd);
2888 install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd);
2889 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd);
2890 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd);
2891 install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd);
2892 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd);
2893 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd);
2894
Josh Bailey3f045a02012-03-24 08:35:20 -07002895 install_element (INTERFACE_NODE, &isis_hello_padding_cmd);
2896 install_element (INTERFACE_NODE, &no_isis_hello_padding_cmd);
2897
jardineb5d44e2003-12-23 08:09:43 +00002898 install_element (INTERFACE_NODE, &csnp_interval_cmd);
2899 install_element (INTERFACE_NODE, &no_csnp_interval_cmd);
2900 install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd);
2901 install_element (INTERFACE_NODE, &csnp_interval_l1_cmd);
2902 install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd);
2903 install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd);
2904 install_element (INTERFACE_NODE, &csnp_interval_l2_cmd);
2905 install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd);
2906 install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd);
2907
Josh Bailey3f045a02012-03-24 08:35:20 -07002908 install_element (INTERFACE_NODE, &psnp_interval_cmd);
2909 install_element (INTERFACE_NODE, &no_psnp_interval_cmd);
2910 install_element (INTERFACE_NODE, &no_psnp_interval_arg_cmd);
2911 install_element (INTERFACE_NODE, &psnp_interval_l1_cmd);
2912 install_element (INTERFACE_NODE, &no_psnp_interval_l1_cmd);
2913 install_element (INTERFACE_NODE, &no_psnp_interval_l1_arg_cmd);
2914 install_element (INTERFACE_NODE, &psnp_interval_l2_cmd);
2915 install_element (INTERFACE_NODE, &no_psnp_interval_l2_cmd);
2916 install_element (INTERFACE_NODE, &no_psnp_interval_l2_arg_cmd);
2917
2918 install_element (INTERFACE_NODE, &isis_network_cmd);
2919 install_element (INTERFACE_NODE, &no_isis_network_cmd);
2920
jardineb5d44e2003-12-23 08:09:43 +00002921#ifdef HAVE_IPV6
2922 install_element (INTERFACE_NODE, &ipv6_router_isis_cmd);
2923 install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002924#endif
jardineb5d44e2003-12-23 08:09:43 +00002925}