blob: b49360932cf4bf7f21431c1e68c49bbc09a294d4 [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);
Christian Franke8ed8d0b2016-04-03 12:46:26 -0300643 isis_circuit_update_all_srmflags(circuit, 0);
Christian Frankef1fc1db2015-11-10 18:43:31 +0100644 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 */
Josh Bailey3f045a02012-03-24 08:35:20 -0700652 if (circuit->interface->hw_addr_len != ETH_ALEN)
653 {
654 zlog_warn ("unsupported link layer");
655 }
656 else
657 {
658 memcpy (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN);
659 }
660#ifdef EXTREME_DEGUG
661 zlog_debug ("isis_circuit_if_add: if_id %d, isomtu %d snpa %s",
662 circuit->interface->ifindex, ISO_MTU (circuit),
663 snpa_print (circuit->u.bc.snpa));
664#endif /* EXTREME_DEBUG */
Josh Bailey3f045a02012-03-24 08:35:20 -0700665
666 circuit->u.bc.adjdb[0] = list_new ();
667 circuit->u.bc.adjdb[1] = list_new ();
668
hassof390d2c2004-09-10 20:48:21 +0000669 /*
670 * ISO 10589 - 8.4.1 Enabling of broadcast circuits
671 */
jardineb5d44e2003-12-23 08:09:43 +0000672
hassof390d2c2004-09-10 20:48:21 +0000673 /* initilizing the hello sending threads
674 * for a broadcast IF
675 */
jardineb5d44e2003-12-23 08:09:43 +0000676
hassof390d2c2004-09-10 20:48:21 +0000677 /* 8.4.1 a) commence sending of IIH PDUs */
678
Josh Bailey3f045a02012-03-24 08:35:20 -0700679 if (circuit->is_type & IS_LEVEL_1)
680 {
681 thread_add_event (master, send_lan_l1_hello, circuit, 0);
682 circuit->u.bc.lan_neighs[0] = list_new ();
683 }
hassof390d2c2004-09-10 20:48:21 +0000684
Josh Bailey3f045a02012-03-24 08:35:20 -0700685 if (circuit->is_type & IS_LEVEL_2)
686 {
687 thread_add_event (master, send_lan_l2_hello, circuit, 0);
688 circuit->u.bc.lan_neighs[1] = list_new ();
689 }
hassof390d2c2004-09-10 20:48:21 +0000690
691 /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */
692 /* 8.4.1 c) FIXME: listen for ESH PDUs */
693
694 /* 8.4.1 d) */
695 /* dr election will commence in... */
Josh Bailey3f045a02012-03-24 08:35:20 -0700696 if (circuit->is_type & IS_LEVEL_1)
697 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
698 circuit, 2 * circuit->hello_interval[0]);
699 if (circuit->is_type & IS_LEVEL_2)
700 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
701 circuit, 2 * circuit->hello_interval[1]);
jardineb5d44e2003-12-23 08:09:43 +0000702 }
hassof390d2c2004-09-10 20:48:21 +0000703 else
704 {
705 /* initializing the hello send threads
706 * for a ptp IF
707 */
Josh Bailey3f045a02012-03-24 08:35:20 -0700708 circuit->u.p2p.neighbor = NULL;
hassof390d2c2004-09-10 20:48:21 +0000709 thread_add_event (master, send_p2p_hello, circuit, 0);
jardineb5d44e2003-12-23 08:09:43 +0000710 }
711
jardineb5d44e2003-12-23 08:09:43 +0000712 /* initializing PSNP timers */
Josh Bailey3f045a02012-03-24 08:35:20 -0700713 if (circuit->is_type & IS_LEVEL_1)
714 THREAD_TIMER_ON (master, circuit->t_send_psnp[0], send_l1_psnp, circuit,
715 isis_jitter (circuit->psnp_interval[0], PSNP_JITTER));
716
717 if (circuit->is_type & IS_LEVEL_2)
718 THREAD_TIMER_ON (master, circuit->t_send_psnp[1], send_l2_psnp, circuit,
719 isis_jitter (circuit->psnp_interval[1], PSNP_JITTER));
720
721 /* unified init for circuits; ignore warnings below this level */
722 retv = isis_sock_init (circuit);
723 if (retv != ISIS_OK)
hassof390d2c2004-09-10 20:48:21 +0000724 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700725 isis_circuit_down (circuit);
726 return retv;
hassof390d2c2004-09-10 20:48:21 +0000727 }
728
Josh Bailey3f045a02012-03-24 08:35:20 -0700729 /* initialize the circuit streams after opening connection */
Christian Frankef1fc1db2015-11-10 18:43:31 +0100730 isis_circuit_stream(circuit, &circuit->rcv_stream);
731 isis_circuit_stream(circuit, &circuit->snd_stream);
jardineb5d44e2003-12-23 08:09:43 +0000732
jardineb5d44e2003-12-23 08:09:43 +0000733#ifdef GNU_LINUX
hassof390d2c2004-09-10 20:48:21 +0000734 THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit,
Josh Bailey3f045a02012-03-24 08:35:20 -0700735 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000736#else
hassof390d2c2004-09-10 20:48:21 +0000737 THREAD_TIMER_ON (master, circuit->t_read, isis_receive, circuit,
Josh Bailey3f045a02012-03-24 08:35:20 -0700738 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000739#endif
Josh Bailey3f045a02012-03-24 08:35:20 -0700740
741 circuit->lsp_queue = list_new ();
742 circuit->lsp_queue_last_cleared = time (NULL);
743
744 return ISIS_OK;
jardineb5d44e2003-12-23 08:09:43 +0000745}
746
747void
748isis_circuit_down (struct isis_circuit *circuit)
749{
Josh Bailey3f045a02012-03-24 08:35:20 -0700750 if (circuit->state != C_STATE_UP)
751 return;
752
753 /* Clear the flags for all the lsps of the circuit. */
754 isis_circuit_update_all_srmflags (circuit, 0);
755
hassof390d2c2004-09-10 20:48:21 +0000756 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
757 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700758 /* destroy neighbour lists */
759 if (circuit->u.bc.lan_neighs[0])
760 {
761 list_delete (circuit->u.bc.lan_neighs[0]);
762 circuit->u.bc.lan_neighs[0] = NULL;
763 }
764 if (circuit->u.bc.lan_neighs[1])
765 {
766 list_delete (circuit->u.bc.lan_neighs[1]);
767 circuit->u.bc.lan_neighs[1] = NULL;
768 }
769 /* destroy adjacency databases */
770 if (circuit->u.bc.adjdb[0])
771 {
772 circuit->u.bc.adjdb[0]->del = isis_delete_adj;
773 list_delete (circuit->u.bc.adjdb[0]);
774 circuit->u.bc.adjdb[0] = NULL;
775 }
776 if (circuit->u.bc.adjdb[1])
777 {
778 circuit->u.bc.adjdb[1]->del = isis_delete_adj;
779 list_delete (circuit->u.bc.adjdb[1]);
780 circuit->u.bc.adjdb[1] = NULL;
781 }
782 if (circuit->u.bc.is_dr[0])
783 {
784 isis_dr_resign (circuit, 1);
785 circuit->u.bc.is_dr[0] = 0;
786 }
787 memset (circuit->u.bc.l1_desig_is, 0, ISIS_SYS_ID_LEN + 1);
788 if (circuit->u.bc.is_dr[1])
789 {
790 isis_dr_resign (circuit, 2);
791 circuit->u.bc.is_dr[1] = 0;
792 }
793 memset (circuit->u.bc.l2_desig_is, 0, ISIS_SYS_ID_LEN + 1);
794 memset (circuit->u.bc.snpa, 0, ETH_ALEN);
795
hassof390d2c2004-09-10 20:48:21 +0000796 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[0]);
797 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[1]);
hassof891f442004-09-14 13:54:30 +0000798 THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[0]);
799 THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[1]);
Josh Bailey3f045a02012-03-24 08:35:20 -0700800 THREAD_TIMER_OFF (circuit->u.bc.t_refresh_pseudo_lsp[0]);
801 THREAD_TIMER_OFF (circuit->u.bc.t_refresh_pseudo_lsp[1]);
Christian Franke61010c32015-11-10 18:43:34 +0100802 circuit->lsp_regenerate_pending[0] = 0;
803 circuit->lsp_regenerate_pending[1] = 0;
hassof390d2c2004-09-10 20:48:21 +0000804 }
805 else if (circuit->circ_type == CIRCUIT_T_P2P)
806 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700807 isis_delete_adj (circuit->u.p2p.neighbor);
808 circuit->u.p2p.neighbor = NULL;
hassof390d2c2004-09-10 20:48:21 +0000809 THREAD_TIMER_OFF (circuit->u.p2p.t_send_p2p_hello);
810 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700811
812 /* Cancel all active threads */
813 THREAD_TIMER_OFF (circuit->t_send_csnp[0]);
814 THREAD_TIMER_OFF (circuit->t_send_csnp[1]);
815 THREAD_TIMER_OFF (circuit->t_send_psnp[0]);
816 THREAD_TIMER_OFF (circuit->t_send_psnp[1]);
817 THREAD_OFF (circuit->t_read);
818
819 if (circuit->lsp_queue)
820 {
821 circuit->lsp_queue->del = NULL;
822 list_delete (circuit->lsp_queue);
823 circuit->lsp_queue = NULL;
824 }
825
826 /* send one gratuitous hello to spead up convergence */
827 if (circuit->is_type & IS_LEVEL_1)
828 send_hello (circuit, IS_LEVEL_1);
829 if (circuit->is_type & IS_LEVEL_2)
830 send_hello (circuit, IS_LEVEL_2);
831
832 circuit->upadjcount[0] = 0;
833 circuit->upadjcount[1] = 0;
834
jardineb5d44e2003-12-23 08:09:43 +0000835 /* close the socket */
Josh Bailey3f045a02012-03-24 08:35:20 -0700836 if (circuit->fd)
837 {
838 close (circuit->fd);
839 circuit->fd = 0;
840 }
841
842 if (circuit->rcv_stream != NULL)
843 {
844 stream_free (circuit->rcv_stream);
845 circuit->rcv_stream = NULL;
846 }
847
848 if (circuit->snd_stream != NULL)
849 {
850 stream_free (circuit->snd_stream);
851 circuit->snd_stream = NULL;
852 }
853
854 thread_cancel_event (master, circuit);
jardineb5d44e2003-12-23 08:09:43 +0000855
856 return;
857}
858
859void
860circuit_update_nlpids (struct isis_circuit *circuit)
861{
862 circuit->nlpids.count = 0;
hassof390d2c2004-09-10 20:48:21 +0000863
864 if (circuit->ip_router)
865 {
866 circuit->nlpids.nlpids[0] = NLPID_IP;
867 circuit->nlpids.count++;
868 }
jardineb5d44e2003-12-23 08:09:43 +0000869#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000870 if (circuit->ipv6_router)
871 {
872 circuit->nlpids.nlpids[circuit->nlpids.count] = NLPID_IPV6;
873 circuit->nlpids.count++;
874 }
jardineb5d44e2003-12-23 08:09:43 +0000875#endif /* HAVE_IPV6 */
876 return;
877}
878
Josh Bailey3f045a02012-03-24 08:35:20 -0700879void
880isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty,
881 char detail)
882{
883 if (detail == ISIS_UI_LEVEL_BRIEF)
884 {
885 vty_out (vty, " %-12s", circuit->interface->name);
886 vty_out (vty, "0x%-7x", circuit->circuit_id);
887 vty_out (vty, "%-9s", circuit_state2string (circuit->state));
888 vty_out (vty, "%-9s", circuit_type2string (circuit->circ_type));
889 vty_out (vty, "%-9s", circuit_t2string (circuit->is_type));
890 vty_out (vty, "%s", VTY_NEWLINE);
891 }
892
893 if (detail == ISIS_UI_LEVEL_DETAIL)
894 {
Christian Frankecb32a192015-11-10 18:33:13 +0100895 struct listnode *node;
896 struct prefix *ip_addr;
897 u_char buf[BUFSIZ];
898
Josh Bailey3f045a02012-03-24 08:35:20 -0700899 vty_out (vty, " Interface: %s", circuit->interface->name);
900 vty_out (vty, ", State: %s", circuit_state2string (circuit->state));
901 if (circuit->is_passive)
902 vty_out (vty, ", Passive");
903 else
904 vty_out (vty, ", Active");
905 vty_out (vty, ", Circuit Id: 0x%x", circuit->circuit_id);
906 vty_out (vty, "%s", VTY_NEWLINE);
907 vty_out (vty, " Type: %s", circuit_type2string (circuit->circ_type));
908 vty_out (vty, ", Level: %s", circuit_t2string (circuit->is_type));
909 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
910 vty_out (vty, ", SNPA: %-10s", snpa_print (circuit->u.bc.snpa));
911 vty_out (vty, "%s", VTY_NEWLINE);
912 if (circuit->is_type & IS_LEVEL_1)
913 {
914 vty_out (vty, " Level-1 Information:%s", VTY_NEWLINE);
915 if (circuit->area->newmetric)
916 vty_out (vty, " Metric: %d", circuit->te_metric[0]);
917 else
918 vty_out (vty, " Metric: %d",
919 circuit->metrics[0].metric_default);
920 if (!circuit->is_passive)
921 {
922 vty_out (vty, ", Active neighbors: %u%s",
923 circuit->upadjcount[0], VTY_NEWLINE);
924 vty_out (vty, " Hello interval: %u, "
925 "Holddown count: %u %s%s",
926 circuit->hello_interval[0],
927 circuit->hello_multiplier[0],
928 (circuit->pad_hellos ? "(pad)" : "(no-pad)"),
929 VTY_NEWLINE);
930 vty_out (vty, " CNSP interval: %u, "
931 "PSNP interval: %u%s",
932 circuit->csnp_interval[0],
933 circuit->psnp_interval[0], VTY_NEWLINE);
934 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
935 vty_out (vty, " LAN Priority: %u, %s%s",
936 circuit->priority[0],
937 (circuit->u.bc.is_dr[0] ? \
938 "is DIS" : "is not DIS"), VTY_NEWLINE);
939 }
940 else
941 {
942 vty_out (vty, "%s", VTY_NEWLINE);
943 }
944 }
945 if (circuit->is_type & IS_LEVEL_2)
946 {
947 vty_out (vty, " Level-2 Information:%s", VTY_NEWLINE);
948 if (circuit->area->newmetric)
949 vty_out (vty, " Metric: %d", circuit->te_metric[1]);
950 else
951 vty_out (vty, " Metric: %d",
952 circuit->metrics[1].metric_default);
953 if (!circuit->is_passive)
954 {
955 vty_out (vty, ", Active neighbors: %u%s",
956 circuit->upadjcount[1], VTY_NEWLINE);
957 vty_out (vty, " Hello interval: %u, "
958 "Holddown count: %u %s%s",
959 circuit->hello_interval[1],
960 circuit->hello_multiplier[1],
961 (circuit->pad_hellos ? "(pad)" : "(no-pad)"),
962 VTY_NEWLINE);
963 vty_out (vty, " CNSP interval: %u, "
964 "PSNP interval: %u%s",
965 circuit->csnp_interval[1],
966 circuit->psnp_interval[1], VTY_NEWLINE);
967 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
968 vty_out (vty, " LAN Priority: %u, %s%s",
969 circuit->priority[1],
970 (circuit->u.bc.is_dr[1] ? \
971 "is DIS" : "is not DIS"), VTY_NEWLINE);
972 }
973 else
974 {
975 vty_out (vty, "%s", VTY_NEWLINE);
976 }
977 }
978 if (circuit->ip_addrs && listcount (circuit->ip_addrs) > 0)
979 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700980 vty_out (vty, " IP Prefix(es):%s", VTY_NEWLINE);
981 for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip_addr))
982 {
983 prefix2str (ip_addr, (char*)buf, BUFSIZ),
984 vty_out (vty, " %s%s", buf, VTY_NEWLINE);
985 }
986 }
Christian Frankecb32a192015-11-10 18:33:13 +0100987 if (circuit->ipv6_link && listcount(circuit->ipv6_link) > 0)
988 {
989 vty_out(vty, " IPv6 Link-Locals:%s", VTY_NEWLINE);
990 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node, ip_addr))
991 {
992 prefix2str(ip_addr, (char*)buf, BUFSIZ),
993 vty_out(vty, " %s%s", buf, VTY_NEWLINE);
994 }
995 }
996 if (circuit->ipv6_link && listcount(circuit->ipv6_non_link) > 0)
997 {
998 vty_out(vty, " IPv6 Prefixes:%s", VTY_NEWLINE);
999 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node, ip_addr))
1000 {
1001 prefix2str(ip_addr, (char*)buf, BUFSIZ),
1002 vty_out(vty, " %s%s", buf, VTY_NEWLINE);
1003 }
1004 }
1005
Josh Bailey3f045a02012-03-24 08:35:20 -07001006 vty_out (vty, "%s", VTY_NEWLINE);
1007 }
1008 return;
1009}
1010
jardineb5d44e2003-12-23 08:09:43 +00001011int
hassof390d2c2004-09-10 20:48:21 +00001012isis_interface_config_write (struct vty *vty)
jardineb5d44e2003-12-23 08:09:43 +00001013{
jardineb5d44e2003-12-23 08:09:43 +00001014 int write = 0;
hasso3fdb2dd2005-09-28 18:45:54 +00001015 struct listnode *node, *node2;
jardineb5d44e2003-12-23 08:09:43 +00001016 struct interface *ifp;
1017 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001018 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +00001019 int i;
jardineb5d44e2003-12-23 08:09:43 +00001020
hasso3fdb2dd2005-09-28 18:45:54 +00001021 for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
jardineb5d44e2003-12-23 08:09:43 +00001022 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001023 /* IF name */
1024 vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE);
1025 write++;
1026 /* IF desc */
1027 if (ifp->desc)
1028 {
1029 vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE);
1030 write++;
1031 }
1032 /* ISIS Circuit */
1033 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node2, area))
1034 {
1035 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
1036 if (circuit == NULL)
1037 continue;
1038 if (circuit->ip_router)
1039 {
1040 vty_out (vty, " ip router isis %s%s", area->area_tag,
1041 VTY_NEWLINE);
1042 write++;
1043 }
1044 if (circuit->is_passive)
1045 {
1046 vty_out (vty, " isis passive%s", VTY_NEWLINE);
1047 write++;
1048 }
1049 if (circuit->circ_type_config == CIRCUIT_T_P2P)
1050 {
1051 vty_out (vty, " isis network point-to-point%s", VTY_NEWLINE);
1052 write++;
1053 }
jardineb5d44e2003-12-23 08:09:43 +00001054#ifdef HAVE_IPV6
Josh Bailey3f045a02012-03-24 08:35:20 -07001055 if (circuit->ipv6_router)
1056 {
1057 vty_out (vty, " ipv6 router isis %s%s", area->area_tag,
1058 VTY_NEWLINE);
1059 write++;
1060 }
jardineb5d44e2003-12-23 08:09:43 +00001061#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +00001062
Josh Bailey3f045a02012-03-24 08:35:20 -07001063 /* ISIS - circuit type */
1064 if (circuit->is_type == IS_LEVEL_1)
1065 {
1066 vty_out (vty, " isis circuit-type level-1%s", VTY_NEWLINE);
1067 write++;
1068 }
1069 else
1070 {
1071 if (circuit->is_type == IS_LEVEL_2)
1072 {
1073 vty_out (vty, " isis circuit-type level-2-only%s",
1074 VTY_NEWLINE);
1075 write++;
1076 }
1077 }
jardineb5d44e2003-12-23 08:09:43 +00001078
Josh Bailey3f045a02012-03-24 08:35:20 -07001079 /* ISIS - CSNP interval */
1080 if (circuit->csnp_interval[0] == circuit->csnp_interval[1])
1081 {
1082 if (circuit->csnp_interval[0] != DEFAULT_CSNP_INTERVAL)
1083 {
1084 vty_out (vty, " isis csnp-interval %d%s",
1085 circuit->csnp_interval[0], VTY_NEWLINE);
1086 write++;
1087 }
1088 }
1089 else
1090 {
1091 for (i = 0; i < 2; i++)
1092 {
1093 if (circuit->csnp_interval[i] != DEFAULT_CSNP_INTERVAL)
1094 {
1095 vty_out (vty, " isis csnp-interval %d level-%d%s",
1096 circuit->csnp_interval[i], i + 1, VTY_NEWLINE);
1097 write++;
1098 }
1099 }
1100 }
jardineb5d44e2003-12-23 08:09:43 +00001101
Josh Bailey3f045a02012-03-24 08:35:20 -07001102 /* ISIS - PSNP interval */
1103 if (circuit->psnp_interval[0] == circuit->psnp_interval[1])
1104 {
1105 if (circuit->psnp_interval[0] != DEFAULT_PSNP_INTERVAL)
1106 {
1107 vty_out (vty, " isis psnp-interval %d%s",
1108 circuit->psnp_interval[0], VTY_NEWLINE);
1109 write++;
1110 }
1111 }
1112 else
1113 {
1114 for (i = 0; i < 2; i++)
1115 {
1116 if (circuit->psnp_interval[i] != DEFAULT_PSNP_INTERVAL)
1117 {
1118 vty_out (vty, " isis psnp-interval %d level-%d%s",
1119 circuit->psnp_interval[i], i + 1, VTY_NEWLINE);
1120 write++;
1121 }
1122 }
1123 }
jardineb5d44e2003-12-23 08:09:43 +00001124
Josh Bailey3f045a02012-03-24 08:35:20 -07001125 /* ISIS - Hello padding - Defaults to true so only display if false */
1126 if (circuit->pad_hellos == 0)
1127 {
1128 vty_out (vty, " no isis hello padding%s", VTY_NEWLINE);
1129 write++;
1130 }
jardineb5d44e2003-12-23 08:09:43 +00001131
Josh Bailey3f045a02012-03-24 08:35:20 -07001132 /* ISIS - Hello interval */
1133 if (circuit->hello_interval[0] == circuit->hello_interval[1])
1134 {
1135 if (circuit->hello_interval[0] != DEFAULT_HELLO_INTERVAL)
1136 {
1137 vty_out (vty, " isis hello-interval %d%s",
1138 circuit->hello_interval[0], VTY_NEWLINE);
1139 write++;
1140 }
1141 }
1142 else
1143 {
1144 for (i = 0; i < 2; i++)
1145 {
1146 if (circuit->hello_interval[i] != DEFAULT_HELLO_INTERVAL)
1147 {
1148 vty_out (vty, " isis hello-interval %d level-%d%s",
1149 circuit->hello_interval[i], i + 1, VTY_NEWLINE);
1150 write++;
1151 }
1152 }
1153 }
jardineb5d44e2003-12-23 08:09:43 +00001154
Josh Bailey3f045a02012-03-24 08:35:20 -07001155 /* ISIS - Hello Multiplier */
1156 if (circuit->hello_multiplier[0] == circuit->hello_multiplier[1])
1157 {
1158 if (circuit->hello_multiplier[0] != DEFAULT_HELLO_MULTIPLIER)
1159 {
1160 vty_out (vty, " isis hello-multiplier %d%s",
1161 circuit->hello_multiplier[0], VTY_NEWLINE);
1162 write++;
1163 }
1164 }
1165 else
1166 {
1167 for (i = 0; i < 2; i++)
1168 {
1169 if (circuit->hello_multiplier[i] != DEFAULT_HELLO_MULTIPLIER)
1170 {
1171 vty_out (vty, " isis hello-multiplier %d level-%d%s",
1172 circuit->hello_multiplier[i], i + 1,
1173 VTY_NEWLINE);
1174 write++;
1175 }
1176 }
1177 }
1178
1179 /* ISIS - Priority */
1180 if (circuit->priority[0] == circuit->priority[1])
1181 {
1182 if (circuit->priority[0] != DEFAULT_PRIORITY)
1183 {
1184 vty_out (vty, " isis priority %d%s",
1185 circuit->priority[0], VTY_NEWLINE);
1186 write++;
1187 }
1188 }
1189 else
1190 {
1191 for (i = 0; i < 2; i++)
1192 {
1193 if (circuit->priority[i] != DEFAULT_PRIORITY)
1194 {
1195 vty_out (vty, " isis priority %d level-%d%s",
1196 circuit->priority[i], i + 1, VTY_NEWLINE);
1197 write++;
1198 }
1199 }
1200 }
1201
1202 /* ISIS - Metric */
1203 if (circuit->te_metric[0] == circuit->te_metric[1])
1204 {
1205 if (circuit->te_metric[0] != DEFAULT_CIRCUIT_METRIC)
1206 {
1207 vty_out (vty, " isis metric %d%s", circuit->te_metric[0],
1208 VTY_NEWLINE);
1209 write++;
1210 }
1211 }
1212 else
1213 {
1214 for (i = 0; i < 2; i++)
1215 {
1216 if (circuit->te_metric[i] != DEFAULT_CIRCUIT_METRIC)
1217 {
1218 vty_out (vty, " isis metric %d level-%d%s",
1219 circuit->te_metric[i], i + 1, VTY_NEWLINE);
1220 write++;
1221 }
1222 }
1223 }
1224 if (circuit->passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
1225 {
1226 vty_out (vty, " isis password md5 %s%s", circuit->passwd.passwd,
1227 VTY_NEWLINE);
1228 write++;
1229 }
1230 else if (circuit->passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
1231 {
1232 vty_out (vty, " isis password clear %s%s", circuit->passwd.passwd,
1233 VTY_NEWLINE);
1234 write++;
1235 }
1236 }
1237 vty_out (vty, "!%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001238 }
hassof390d2c2004-09-10 20:48:21 +00001239
jardineb5d44e2003-12-23 08:09:43 +00001240 return write;
1241}
jardineb5d44e2003-12-23 08:09:43 +00001242
1243DEFUN (ip_router_isis,
1244 ip_router_isis_cmd,
1245 "ip router isis WORD",
1246 "Interface Internet Protocol config commands\n"
1247 "IP router interface commands\n"
1248 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +00001249 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +00001250{
Josh Bailey3f045a02012-03-24 08:35:20 -07001251 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +00001252 struct interface *ifp;
1253 struct isis_area *area;
Christian Frankef1fc1db2015-11-10 18:43:31 +01001254 int rv;
hassof390d2c2004-09-10 20:48:21 +00001255
1256 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001257 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +00001258
Josh Bailey3f045a02012-03-24 08:35:20 -07001259 /* Prevent more than one area per circuit */
1260 circuit = circuit_scan_by_ifp (ifp);
1261 if (circuit)
hassof390d2c2004-09-10 20:48:21 +00001262 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001263 if (circuit->ip_router == 1)
1264 {
1265 if (strcmp (circuit->area->area_tag, argv[0]))
1266 {
1267 vty_out (vty, "ISIS circuit is already defined on %s%s",
1268 circuit->area->area_tag, VTY_NEWLINE);
1269 return CMD_ERR_NOTHING_TODO;
1270 }
1271 return CMD_SUCCESS;
1272 }
jardineb5d44e2003-12-23 08:09:43 +00001273 }
hassof390d2c2004-09-10 20:48:21 +00001274
Josh Bailey3f045a02012-03-24 08:35:20 -07001275 if (isis_area_get (vty, argv[0]) != CMD_SUCCESS)
hassof390d2c2004-09-10 20:48:21 +00001276 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001277 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1278 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001279 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001280 area = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001281
Josh Bailey3f045a02012-03-24 08:35:20 -07001282 circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area);
Christian Frankef1fc1db2015-11-10 18:43:31 +01001283 if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP)
1284 {
1285 vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE);
1286 rv = CMD_WARNING;
1287 }
1288 else
1289 {
1290 isis_circuit_if_bind (circuit, ifp);
jardineb5d44e2003-12-23 08:09:43 +00001291
Christian Frankef1fc1db2015-11-10 18:43:31 +01001292 circuit->ip_router = 1;
1293 area->ip_circuits++;
1294 circuit_update_nlpids (circuit);
1295 rv = CMD_SUCCESS;
1296 }
jardineb5d44e2003-12-23 08:09:43 +00001297
1298 vty->node = INTERFACE_NODE;
Josh Bailey3f045a02012-03-24 08:35:20 -07001299 vty->index = ifp;
hassof390d2c2004-09-10 20:48:21 +00001300
Christian Franke84a4da02016-04-03 12:46:27 -03001301 if (circuit->ipv6_router)
1302 lsp_regenerate_schedule(circuit->area, circuit->is_type, 0);
Christian Frankef1fc1db2015-11-10 18:43:31 +01001303 return rv;
jardineb5d44e2003-12-23 08:09:43 +00001304}
1305
1306DEFUN (no_ip_router_isis,
1307 no_ip_router_isis_cmd,
1308 "no ip router isis WORD",
1309 NO_STR
1310 "Interface Internet Protocol config commands\n"
1311 "IP router interface commands\n"
1312 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +00001313 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +00001314{
jardineb5d44e2003-12-23 08:09:43 +00001315 struct interface *ifp;
1316 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001317 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +00001318
hassof390d2c2004-09-10 20:48:21 +00001319 ifp = (struct interface *) vty->index;
Josh Bailey3f045a02012-03-24 08:35:20 -07001320 if (!ifp)
1321 {
1322 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1323 return CMD_ERR_NO_MATCH;
1324 }
hassof390d2c2004-09-10 20:48:21 +00001325
jardineb5d44e2003-12-23 08:09:43 +00001326 area = isis_area_lookup (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001327 if (!area)
1328 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001329 vty_out (vty, "Can't find ISIS instance %s%s",
1330 argv[0], VTY_NEWLINE);
1331 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001332 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001333
1334 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +00001335 if (!circuit)
1336 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001337 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1338 ifp->name, VTY_NEWLINE);
1339 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001340 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001341
jardineb5d44e2003-12-23 08:09:43 +00001342 circuit->ip_router = 0;
1343 area->ip_circuits--;
jardineb5d44e2003-12-23 08:09:43 +00001344 if (circuit->ipv6_router == 0)
jardineb5d44e2003-12-23 08:09:43 +00001345 isis_csm_state_change (ISIS_DISABLE, circuit, area);
Christian Franke84a4da02016-04-03 12:46:27 -03001346 else
1347 lsp_regenerate_schedule(area, circuit->is_type, 0);
hassof390d2c2004-09-10 20:48:21 +00001348
jardineb5d44e2003-12-23 08:09:43 +00001349 return CMD_SUCCESS;
1350}
1351
Josh Bailey3f045a02012-03-24 08:35:20 -07001352#ifdef HAVE_IPV6
1353DEFUN (ipv6_router_isis,
1354 ipv6_router_isis_cmd,
1355 "ipv6 router isis WORD",
1356 "IPv6 interface subcommands\n"
1357 "IPv6 Router interface commands\n"
1358 "IS-IS Routing for IPv6\n"
1359 "Routing process tag\n")
1360{
1361 struct isis_circuit *circuit;
1362 struct interface *ifp;
1363 struct isis_area *area;
Christian Frankef1fc1db2015-11-10 18:43:31 +01001364 int rv;
Josh Bailey3f045a02012-03-24 08:35:20 -07001365
1366 ifp = (struct interface *) vty->index;
1367 assert (ifp);
1368
1369 /* Prevent more than one area per circuit */
1370 circuit = circuit_scan_by_ifp (ifp);
1371 if (circuit)
1372 {
1373 if (circuit->ipv6_router == 1)
1374 {
1375 if (strcmp (circuit->area->area_tag, argv[0]))
1376 {
1377 vty_out (vty, "ISIS circuit is already defined for IPv6 on %s%s",
1378 circuit->area->area_tag, VTY_NEWLINE);
1379 return CMD_ERR_NOTHING_TODO;
1380 }
1381 return CMD_SUCCESS;
1382 }
1383 }
1384
1385 if (isis_area_get (vty, argv[0]) != CMD_SUCCESS)
1386 {
1387 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1388 return CMD_ERR_NO_MATCH;
1389 }
1390 area = vty->index;
1391
1392 circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area);
Christian Frankef1fc1db2015-11-10 18:43:31 +01001393 if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP)
1394 {
1395 vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE);
1396 rv = CMD_WARNING;
1397 }
1398 else
1399 {
1400 isis_circuit_if_bind (circuit, ifp);
Josh Bailey3f045a02012-03-24 08:35:20 -07001401
Christian Frankef1fc1db2015-11-10 18:43:31 +01001402 circuit->ipv6_router = 1;
1403 area->ipv6_circuits++;
1404 circuit_update_nlpids (circuit);
1405 rv = CMD_SUCCESS;
1406 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001407
1408 vty->node = INTERFACE_NODE;
1409 vty->index = ifp;
1410
Christian Franke84a4da02016-04-03 12:46:27 -03001411 if (circuit->ip_router)
1412 lsp_regenerate_schedule(circuit->area, circuit->is_type, 0);
Christian Frankef1fc1db2015-11-10 18:43:31 +01001413 return rv;
Josh Bailey3f045a02012-03-24 08:35:20 -07001414}
1415
1416DEFUN (no_ipv6_router_isis,
1417 no_ipv6_router_isis_cmd,
1418 "no ipv6 router isis WORD",
1419 NO_STR
1420 "IPv6 interface subcommands\n"
1421 "IPv6 Router interface commands\n"
1422 "IS-IS Routing for IPv6\n"
1423 "Routing process tag\n")
1424{
1425 struct interface *ifp;
1426 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001427 struct isis_circuit *circuit;
1428
1429 ifp = (struct interface *) vty->index;
1430 if (!ifp)
1431 {
1432 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1433 return CMD_ERR_NO_MATCH;
1434 }
1435
1436 area = isis_area_lookup (argv[0]);
1437 if (!area)
1438 {
1439 vty_out (vty, "Can't find ISIS instance %s%s",
1440 argv[0], VTY_NEWLINE);
1441 return CMD_ERR_NO_MATCH;
1442 }
1443
1444 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
1445 if (!circuit)
1446 {
1447 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1448 ifp->name, VTY_NEWLINE);
1449 return CMD_ERR_NO_MATCH;
1450 }
1451
1452 circuit->ipv6_router = 0;
1453 area->ipv6_circuits--;
1454 if (circuit->ip_router == 0)
1455 isis_csm_state_change (ISIS_DISABLE, circuit, area);
Christian Franke84a4da02016-04-03 12:46:27 -03001456 else
1457 lsp_regenerate_schedule(area, circuit->is_type, 0);
Josh Bailey3f045a02012-03-24 08:35:20 -07001458
1459 return CMD_SUCCESS;
1460}
1461#endif /* HAVE_IPV6 */
1462
1463DEFUN (isis_passive,
1464 isis_passive_cmd,
1465 "isis passive",
1466 "IS-IS commands\n"
1467 "Configure the passive mode for interface\n")
1468{
1469 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1470 if (!circuit)
1471 return CMD_ERR_NO_MATCH;
1472
1473 if (circuit->is_passive == 1)
1474 return CMD_SUCCESS;
1475
1476 if (circuit->state != C_STATE_UP)
1477 {
1478 circuit->is_passive = 1;
1479 }
1480 else
1481 {
1482 struct isis_area *area = circuit->area;
1483 isis_csm_state_change (ISIS_DISABLE, circuit, area);
1484 circuit->is_passive = 1;
1485 isis_csm_state_change (ISIS_ENABLE, circuit, area);
1486 }
1487
1488 return CMD_SUCCESS;
1489}
1490
1491DEFUN (no_isis_passive,
1492 no_isis_passive_cmd,
1493 "no isis passive",
1494 NO_STR
1495 "IS-IS commands\n"
1496 "Configure the passive mode for interface\n")
1497{
1498 struct interface *ifp;
1499 struct isis_circuit *circuit;
1500
1501 ifp = (struct interface *) vty->index;
1502 if (!ifp)
1503 {
1504 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1505 return CMD_ERR_NO_MATCH;
1506 }
1507
1508 /* FIXME: what is wrong with circuit = ifp->info ? */
1509 circuit = circuit_scan_by_ifp (ifp);
1510 if (!circuit)
1511 {
1512 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1513 ifp->name, VTY_NEWLINE);
1514 return CMD_ERR_NO_MATCH;
1515 }
1516
1517 if (if_is_loopback(ifp))
1518 {
1519 vty_out (vty, "Can't set no passive for loopback interface%s",
1520 VTY_NEWLINE);
1521 return CMD_ERR_AMBIGUOUS;
1522 }
1523
1524 if (circuit->is_passive == 0)
1525 return CMD_SUCCESS;
1526
1527 if (circuit->state != C_STATE_UP)
1528 {
1529 circuit->is_passive = 0;
1530 }
1531 else
1532 {
1533 struct isis_area *area = circuit->area;
1534 isis_csm_state_change (ISIS_DISABLE, circuit, area);
1535 circuit->is_passive = 0;
1536 isis_csm_state_change (ISIS_ENABLE, circuit, area);
1537 }
1538
1539 return CMD_SUCCESS;
1540}
1541
jardineb5d44e2003-12-23 08:09:43 +00001542DEFUN (isis_circuit_type,
1543 isis_circuit_type_cmd,
1544 "isis circuit-type (level-1|level-1-2|level-2-only)",
1545 "IS-IS commands\n"
1546 "Configure circuit type for interface\n"
1547 "Level-1 only adjacencies are formed\n"
1548 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +00001549 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +00001550{
Josh Bailey3f045a02012-03-24 08:35:20 -07001551 int circuit_type;
1552 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1553 if (!circuit)
1554 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001555
Josh Bailey3f045a02012-03-24 08:35:20 -07001556 circuit_type = string2circuit_t (argv[0]);
1557 if (!circuit_type)
hassof390d2c2004-09-10 20:48:21 +00001558 {
1559 vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -07001560 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001561 }
1562
Josh Bailey3f045a02012-03-24 08:35:20 -07001563 if (circuit->state == C_STATE_UP &&
1564 circuit->area->is_type != IS_LEVEL_1_AND_2 &&
1565 circuit->area->is_type != circuit_type)
hassof390d2c2004-09-10 20:48:21 +00001566 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001567 vty_out (vty, "Invalid circuit level for area %s.%s",
1568 circuit->area->area_tag, VTY_NEWLINE);
1569 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001570 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001571 isis_event_circuit_type_change (circuit, circuit_type);
hassof390d2c2004-09-10 20:48:21 +00001572
jardineb5d44e2003-12-23 08:09:43 +00001573 return CMD_SUCCESS;
1574}
1575
1576DEFUN (no_isis_circuit_type,
1577 no_isis_circuit_type_cmd,
1578 "no isis circuit-type (level-1|level-1-2|level-2-only)",
1579 NO_STR
1580 "IS-IS commands\n"
1581 "Configure circuit type for interface\n"
1582 "Level-1 only adjacencies are formed\n"
1583 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +00001584 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +00001585{
Josh Bailey3f045a02012-03-24 08:35:20 -07001586 int circuit_type;
1587 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1588 if (!circuit)
1589 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001590
jardineb5d44e2003-12-23 08:09:43 +00001591 /*
Josh Bailey3f045a02012-03-24 08:35:20 -07001592 * Set the circuits level to its default value
jardineb5d44e2003-12-23 08:09:43 +00001593 */
Josh Bailey3f045a02012-03-24 08:35:20 -07001594 if (circuit->state == C_STATE_UP)
1595 circuit_type = circuit->area->is_type;
1596 else
1597 circuit_type = IS_LEVEL_1_AND_2;
1598 isis_event_circuit_type_change (circuit, circuit_type);
hassof390d2c2004-09-10 20:48:21 +00001599
jardineb5d44e2003-12-23 08:09:43 +00001600 return CMD_SUCCESS;
1601}
1602
Josh Bailey3f045a02012-03-24 08:35:20 -07001603DEFUN (isis_passwd_md5,
1604 isis_passwd_md5_cmd,
1605 "isis password md5 WORD",
jardineb5d44e2003-12-23 08:09:43 +00001606 "IS-IS commands\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001607 "Configure the authentication password for a circuit\n"
1608 "Authentication type\n"
1609 "Circuit password\n")
jardineb5d44e2003-12-23 08:09:43 +00001610{
jardineb5d44e2003-12-23 08:09:43 +00001611 int len;
Josh Bailey3f045a02012-03-24 08:35:20 -07001612 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1613 if (!circuit)
1614 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001615
jardineb5d44e2003-12-23 08:09:43 +00001616 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001617 if (len > 254)
1618 {
1619 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -07001620 return CMD_ERR_AMBIGUOUS;
1621 }
1622 circuit->passwd.len = len;
1623 circuit->passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
1624 strncpy ((char *)circuit->passwd.passwd, argv[0], 255);
1625
1626 return CMD_SUCCESS;
1627}
1628
1629DEFUN (isis_passwd_clear,
1630 isis_passwd_clear_cmd,
1631 "isis password clear WORD",
1632 "IS-IS commands\n"
1633 "Configure the authentication password for a circuit\n"
1634 "Authentication type\n"
1635 "Circuit password\n")
1636{
1637 int len;
1638 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1639 if (!circuit)
1640 return CMD_ERR_NO_MATCH;
1641
1642 len = strlen (argv[0]);
1643 if (len > 254)
1644 {
1645 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
1646 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001647 }
jardineb5d44e2003-12-23 08:09:43 +00001648 circuit->passwd.len = len;
1649 circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001650 strncpy ((char *)circuit->passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001651
jardineb5d44e2003-12-23 08:09:43 +00001652 return CMD_SUCCESS;
1653}
1654
1655DEFUN (no_isis_passwd,
1656 no_isis_passwd_cmd,
1657 "no isis password",
1658 NO_STR
1659 "IS-IS commands\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001660 "Configure the authentication password for a circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001661{
Josh Bailey3f045a02012-03-24 08:35:20 -07001662 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1663 if (!circuit)
1664 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001665
jardineb5d44e2003-12-23 08:09:43 +00001666 memset (&circuit->passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +00001667
jardineb5d44e2003-12-23 08:09:43 +00001668 return CMD_SUCCESS;
1669}
1670
jardineb5d44e2003-12-23 08:09:43 +00001671DEFUN (isis_priority,
1672 isis_priority_cmd,
1673 "isis priority <0-127>",
1674 "IS-IS commands\n"
1675 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001676 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001677{
jardineb5d44e2003-12-23 08:09:43 +00001678 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001679 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1680 if (!circuit)
1681 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001682
1683 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001684 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1685 {
1686 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1687 prio, VTY_NEWLINE);
1688 return CMD_ERR_AMBIGUOUS;
1689 }
jardineb5d44e2003-12-23 08:09:43 +00001690
Josh Bailey3f045a02012-03-24 08:35:20 -07001691 circuit->priority[0] = prio;
1692 circuit->priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001693
jardineb5d44e2003-12-23 08:09:43 +00001694 return CMD_SUCCESS;
1695}
1696
1697DEFUN (no_isis_priority,
1698 no_isis_priority_cmd,
1699 "no isis priority",
1700 NO_STR
1701 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001702 "Set priority for Designated Router election\n")
jardineb5d44e2003-12-23 08:09:43 +00001703{
Josh Bailey3f045a02012-03-24 08:35:20 -07001704 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1705 if (!circuit)
1706 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001707
Josh Bailey3f045a02012-03-24 08:35:20 -07001708 circuit->priority[0] = DEFAULT_PRIORITY;
1709 circuit->priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001710
jardineb5d44e2003-12-23 08:09:43 +00001711 return CMD_SUCCESS;
1712}
1713
1714ALIAS (no_isis_priority,
1715 no_isis_priority_arg_cmd,
1716 "no isis priority <0-127>",
1717 NO_STR
1718 "IS-IS commands\n"
1719 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001720 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001721
1722DEFUN (isis_priority_l1,
1723 isis_priority_l1_cmd,
hassof390d2c2004-09-10 20:48:21 +00001724 "isis priority <0-127> level-1",
jardineb5d44e2003-12-23 08:09:43 +00001725 "IS-IS commands\n"
1726 "Set priority for Designated Router election\n"
1727 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001728 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001729{
jardineb5d44e2003-12-23 08:09:43 +00001730 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001731 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1732 if (!circuit)
1733 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001734
1735 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001736 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1737 {
1738 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1739 prio, VTY_NEWLINE);
1740 return CMD_ERR_AMBIGUOUS;
1741 }
jardineb5d44e2003-12-23 08:09:43 +00001742
Josh Bailey3f045a02012-03-24 08:35:20 -07001743 circuit->priority[0] = prio;
hassof390d2c2004-09-10 20:48:21 +00001744
jardineb5d44e2003-12-23 08:09:43 +00001745 return CMD_SUCCESS;
1746}
1747
1748DEFUN (no_isis_priority_l1,
1749 no_isis_priority_l1_cmd,
1750 "no isis priority level-1",
1751 NO_STR
1752 "IS-IS commands\n"
1753 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001754 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001755{
Josh Bailey3f045a02012-03-24 08:35:20 -07001756 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1757 if (!circuit)
1758 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001759
Josh Bailey3f045a02012-03-24 08:35:20 -07001760 circuit->priority[0] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001761
jardineb5d44e2003-12-23 08:09:43 +00001762 return CMD_SUCCESS;
1763}
1764
1765ALIAS (no_isis_priority_l1,
1766 no_isis_priority_l1_arg_cmd,
1767 "no isis priority <0-127> level-1",
1768 NO_STR
1769 "IS-IS commands\n"
1770 "Set priority for Designated Router election\n"
1771 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001772 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001773
1774DEFUN (isis_priority_l2,
1775 isis_priority_l2_cmd,
hassof390d2c2004-09-10 20:48:21 +00001776 "isis priority <0-127> level-2",
jardineb5d44e2003-12-23 08:09:43 +00001777 "IS-IS commands\n"
1778 "Set priority for Designated Router election\n"
1779 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001780 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001781{
jardineb5d44e2003-12-23 08:09:43 +00001782 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001783 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1784 if (!circuit)
1785 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001786
1787 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001788 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1789 {
1790 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1791 prio, VTY_NEWLINE);
1792 return CMD_ERR_AMBIGUOUS;
1793 }
jardineb5d44e2003-12-23 08:09:43 +00001794
Josh Bailey3f045a02012-03-24 08:35:20 -07001795 circuit->priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001796
jardineb5d44e2003-12-23 08:09:43 +00001797 return CMD_SUCCESS;
1798}
1799
1800DEFUN (no_isis_priority_l2,
1801 no_isis_priority_l2_cmd,
1802 "no isis priority level-2",
1803 NO_STR
1804 "IS-IS commands\n"
1805 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001806 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001807{
Josh Bailey3f045a02012-03-24 08:35:20 -07001808 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1809 if (!circuit)
1810 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001811
Josh Bailey3f045a02012-03-24 08:35:20 -07001812 circuit->priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001813
jardineb5d44e2003-12-23 08:09:43 +00001814 return CMD_SUCCESS;
1815}
1816
1817ALIAS (no_isis_priority_l2,
1818 no_isis_priority_l2_arg_cmd,
1819 "no isis priority <0-127> level-2",
1820 NO_STR
1821 "IS-IS commands\n"
1822 "Set priority for Designated Router election\n"
1823 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001824 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001825
1826/* Metric command */
Josh Bailey3f045a02012-03-24 08:35:20 -07001827DEFUN (isis_metric,
jardineb5d44e2003-12-23 08:09:43 +00001828 isis_metric_cmd,
hassof21fb272005-09-26 17:05:55 +00001829 "isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001830 "IS-IS commands\n"
1831 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001832 "Default metric value\n")
jardineb5d44e2003-12-23 08:09:43 +00001833{
jardineb5d44e2003-12-23 08:09:43 +00001834 int met;
Josh Bailey3f045a02012-03-24 08:35:20 -07001835 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1836 if (!circuit)
1837 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001838
1839 met = atoi (argv[0]);
1840
Josh Bailey3f045a02012-03-24 08:35:20 -07001841 /* RFC3787 section 5.1 */
1842 if (circuit->area && circuit->area->oldmetric == 1 &&
1843 met > MAX_NARROW_LINK_METRIC)
1844 {
1845 vty_out (vty, "Invalid metric %d - should be <0-63> "
1846 "when narrow metric type enabled%s",
1847 met, VTY_NEWLINE);
1848 return CMD_ERR_AMBIGUOUS;
1849 }
1850
1851 /* RFC4444 */
1852 if (circuit->area && circuit->area->newmetric == 1 &&
1853 met > MAX_WIDE_LINK_METRIC)
1854 {
1855 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
1856 "when wide metric type enabled%s",
1857 met, VTY_NEWLINE);
1858 return CMD_ERR_AMBIGUOUS;
1859 }
1860
hassof21fb272005-09-26 17:05:55 +00001861 circuit->te_metric[0] = met;
1862 circuit->te_metric[1] = met;
1863
jardineb5d44e2003-12-23 08:09:43 +00001864 circuit->metrics[0].metric_default = met;
1865 circuit->metrics[1].metric_default = met;
1866
Josh Bailey3f045a02012-03-24 08:35:20 -07001867 if (circuit->area)
1868 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
1869
jardineb5d44e2003-12-23 08:09:43 +00001870 return CMD_SUCCESS;
1871}
1872
1873DEFUN (no_isis_metric,
1874 no_isis_metric_cmd,
1875 "no isis metric",
1876 NO_STR
1877 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001878 "Set default metric for circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001879{
Josh Bailey3f045a02012-03-24 08:35:20 -07001880 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1881 if (!circuit)
1882 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001883
Josh Bailey3f045a02012-03-24 08:35:20 -07001884 circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC;
1885 circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC;
1886 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC;
1887 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC;
jardineb5d44e2003-12-23 08:09:43 +00001888
Josh Bailey3f045a02012-03-24 08:35:20 -07001889 if (circuit->area)
1890 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
jardineb5d44e2003-12-23 08:09:43 +00001891
1892 return CMD_SUCCESS;
1893}
1894
1895ALIAS (no_isis_metric,
1896 no_isis_metric_arg_cmd,
hassof21fb272005-09-26 17:05:55 +00001897 "no isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001898 NO_STR
1899 "IS-IS commands\n"
1900 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001901 "Default metric value\n")
1902
Josh Bailey3f045a02012-03-24 08:35:20 -07001903DEFUN (isis_metric_l1,
1904 isis_metric_l1_cmd,
1905 "isis metric <0-16777215> level-1",
1906 "IS-IS commands\n"
1907 "Set default metric for circuit\n"
1908 "Default metric value\n"
1909 "Specify metric for level-1 routing\n")
1910{
1911 int met;
1912 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1913 if (!circuit)
1914 return CMD_ERR_NO_MATCH;
1915
1916 met = atoi (argv[0]);
1917
1918 /* RFC3787 section 5.1 */
1919 if (circuit->area && circuit->area->oldmetric == 1 &&
1920 met > MAX_NARROW_LINK_METRIC)
1921 {
1922 vty_out (vty, "Invalid metric %d - should be <0-63> "
1923 "when narrow metric type enabled%s",
1924 met, VTY_NEWLINE);
1925 return CMD_ERR_AMBIGUOUS;
1926 }
1927
1928 /* RFC4444 */
1929 if (circuit->area && circuit->area->newmetric == 1 &&
1930 met > MAX_WIDE_LINK_METRIC)
1931 {
1932 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
1933 "when wide metric type enabled%s",
1934 met, VTY_NEWLINE);
1935 return CMD_ERR_AMBIGUOUS;
1936 }
1937
1938 circuit->te_metric[0] = met;
1939 circuit->metrics[0].metric_default = met;
1940
1941 if (circuit->area)
1942 lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0);
1943
1944 return CMD_SUCCESS;
1945}
1946
1947DEFUN (no_isis_metric_l1,
1948 no_isis_metric_l1_cmd,
1949 "no isis metric level-1",
1950 NO_STR
1951 "IS-IS commands\n"
1952 "Set default metric for circuit\n"
1953 "Specify metric for level-1 routing\n")
1954{
1955 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1956 if (!circuit)
1957 return CMD_ERR_NO_MATCH;
1958
1959 circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC;
1960 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC;
1961
1962 if (circuit->area)
1963 lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0);
1964
1965 return CMD_SUCCESS;
1966}
1967
1968ALIAS (no_isis_metric_l1,
1969 no_isis_metric_l1_arg_cmd,
1970 "no isis metric <0-16777215> level-1",
1971 NO_STR
1972 "IS-IS commands\n"
1973 "Set default metric for circuit\n"
1974 "Default metric value\n"
1975 "Specify metric for level-1 routing\n")
1976
1977DEFUN (isis_metric_l2,
1978 isis_metric_l2_cmd,
1979 "isis metric <0-16777215> level-2",
1980 "IS-IS commands\n"
1981 "Set default metric for circuit\n"
1982 "Default metric value\n"
1983 "Specify metric for level-2 routing\n")
1984{
1985 int met;
1986 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1987 if (!circuit)
1988 return CMD_ERR_NO_MATCH;
1989
1990 met = atoi (argv[0]);
1991
1992 /* RFC3787 section 5.1 */
1993 if (circuit->area && circuit->area->oldmetric == 1 &&
1994 met > MAX_NARROW_LINK_METRIC)
1995 {
1996 vty_out (vty, "Invalid metric %d - should be <0-63> "
1997 "when narrow metric type enabled%s",
1998 met, VTY_NEWLINE);
1999 return CMD_ERR_AMBIGUOUS;
2000 }
2001
2002 /* RFC4444 */
2003 if (circuit->area && circuit->area->newmetric == 1 &&
2004 met > MAX_WIDE_LINK_METRIC)
2005 {
2006 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
2007 "when wide metric type enabled%s",
2008 met, VTY_NEWLINE);
2009 return CMD_ERR_AMBIGUOUS;
2010 }
2011
2012 circuit->te_metric[1] = met;
2013 circuit->metrics[1].metric_default = met;
2014
2015 if (circuit->area)
2016 lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0);
2017
2018 return CMD_SUCCESS;
2019}
2020
2021DEFUN (no_isis_metric_l2,
2022 no_isis_metric_l2_cmd,
2023 "no isis metric level-2",
2024 NO_STR
2025 "IS-IS commands\n"
2026 "Set default metric for circuit\n"
2027 "Specify metric for level-2 routing\n")
2028{
2029 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2030 if (!circuit)
2031 return CMD_ERR_NO_MATCH;
2032
2033 circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC;
2034 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC;
2035
2036 if (circuit->area)
2037 lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0);
2038
2039 return CMD_SUCCESS;
2040}
2041
2042ALIAS (no_isis_metric_l2,
2043 no_isis_metric_l2_arg_cmd,
2044 "no isis metric <0-16777215> level-2",
2045 NO_STR
2046 "IS-IS commands\n"
2047 "Set default metric for circuit\n"
2048 "Default metric value\n"
2049 "Specify metric for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00002050/* end of metrics */
Josh Bailey3f045a02012-03-24 08:35:20 -07002051
hassof21fb272005-09-26 17:05:55 +00002052DEFUN (isis_hello_interval,
jardineb5d44e2003-12-23 08:09:43 +00002053 isis_hello_interval_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002054 "isis hello-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002055 "IS-IS commands\n"
2056 "Set Hello interval\n"
2057 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00002058 "Holdtime 1 seconds, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00002059{
jardineb5d44e2003-12-23 08:09:43 +00002060 int interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002061 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2062 if (!circuit)
2063 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002064
Josh Bailey3f045a02012-03-24 08:35:20 -07002065 interval = atoi (argv[0]);
2066 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002067 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002068 vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s",
2069 interval, VTY_NEWLINE);
2070 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002071 }
jardineb5d44e2003-12-23 08:09:43 +00002072
hassof390d2c2004-09-10 20:48:21 +00002073 circuit->hello_interval[0] = (u_int16_t) interval;
2074 circuit->hello_interval[1] = (u_int16_t) interval;
2075
jardineb5d44e2003-12-23 08:09:43 +00002076 return CMD_SUCCESS;
2077}
2078
2079DEFUN (no_isis_hello_interval,
2080 no_isis_hello_interval_cmd,
2081 "no isis hello-interval",
2082 NO_STR
2083 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002084 "Set Hello interval\n")
jardineb5d44e2003-12-23 08:09:43 +00002085{
Josh Bailey3f045a02012-03-24 08:35:20 -07002086 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2087 if (!circuit)
2088 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002089
Josh Bailey3f045a02012-03-24 08:35:20 -07002090 circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL;
2091 circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002092
jardineb5d44e2003-12-23 08:09:43 +00002093 return CMD_SUCCESS;
2094}
2095
2096ALIAS (no_isis_hello_interval,
2097 no_isis_hello_interval_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002098 "no isis hello-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002099 NO_STR
2100 "IS-IS commands\n"
2101 "Set Hello interval\n"
2102 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00002103 "Holdtime 1 second, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00002104
2105DEFUN (isis_hello_interval_l1,
2106 isis_hello_interval_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002107 "isis hello-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002108 "IS-IS commands\n"
2109 "Set Hello interval\n"
2110 "Hello interval value\n"
2111 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002112 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002113{
jardineb5d44e2003-12-23 08:09:43 +00002114 long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002115 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2116 if (!circuit)
2117 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002118
Josh Bailey3f045a02012-03-24 08:35:20 -07002119 interval = atoi (argv[0]);
2120 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002121 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002122 vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
2123 interval, VTY_NEWLINE);
2124 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002125 }
jardineb5d44e2003-12-23 08:09:43 +00002126
hassof390d2c2004-09-10 20:48:21 +00002127 circuit->hello_interval[0] = (u_int16_t) interval;
2128
jardineb5d44e2003-12-23 08:09:43 +00002129 return CMD_SUCCESS;
2130}
2131
2132DEFUN (no_isis_hello_interval_l1,
2133 no_isis_hello_interval_l1_cmd,
2134 "no isis hello-interval level-1",
2135 NO_STR
2136 "IS-IS commands\n"
2137 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00002138 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002139{
Josh Bailey3f045a02012-03-24 08:35:20 -07002140 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2141 if (!circuit)
2142 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002143
Josh Bailey3f045a02012-03-24 08:35:20 -07002144 circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002145
jardineb5d44e2003-12-23 08:09:43 +00002146 return CMD_SUCCESS;
2147}
2148
2149ALIAS (no_isis_hello_interval_l1,
2150 no_isis_hello_interval_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002151 "no isis hello-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002152 NO_STR
2153 "IS-IS commands\n"
2154 "Set Hello interval\n"
2155 "Hello interval value\n"
2156 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002157 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002158
2159DEFUN (isis_hello_interval_l2,
2160 isis_hello_interval_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002161 "isis hello-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002162 "IS-IS commands\n"
2163 "Set Hello interval\n"
2164 "Hello interval value\n"
2165 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002166 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002167{
jardineb5d44e2003-12-23 08:09:43 +00002168 long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002169 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2170 if (!circuit)
2171 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002172
Josh Bailey3f045a02012-03-24 08:35:20 -07002173 interval = atoi (argv[0]);
2174 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002175 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002176 vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
2177 interval, VTY_NEWLINE);
2178 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002179 }
jardineb5d44e2003-12-23 08:09:43 +00002180
hassof390d2c2004-09-10 20:48:21 +00002181 circuit->hello_interval[1] = (u_int16_t) interval;
2182
jardineb5d44e2003-12-23 08:09:43 +00002183 return CMD_SUCCESS;
2184}
2185
2186DEFUN (no_isis_hello_interval_l2,
2187 no_isis_hello_interval_l2_cmd,
2188 "no isis hello-interval level-2",
2189 NO_STR
2190 "IS-IS commands\n"
2191 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00002192 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002193{
Josh Bailey3f045a02012-03-24 08:35:20 -07002194 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2195 if (!circuit)
2196 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002197
Josh Bailey3f045a02012-03-24 08:35:20 -07002198 circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002199
jardineb5d44e2003-12-23 08:09:43 +00002200 return CMD_SUCCESS;
2201}
2202
2203ALIAS (no_isis_hello_interval_l2,
2204 no_isis_hello_interval_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002205 "no isis hello-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002206 NO_STR
2207 "IS-IS commands\n"
2208 "Set Hello interval\n"
2209 "Hello interval value\n"
2210 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002211 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002212
2213DEFUN (isis_hello_multiplier,
2214 isis_hello_multiplier_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002215 "isis hello-multiplier <2-100>",
jardineb5d44e2003-12-23 08:09:43 +00002216 "IS-IS commands\n"
2217 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002218 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00002219{
jardineb5d44e2003-12-23 08:09:43 +00002220 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002221 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2222 if (!circuit)
2223 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002224
2225 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002226 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2227 {
2228 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2229 mult, VTY_NEWLINE);
2230 return CMD_ERR_AMBIGUOUS;
2231 }
jardineb5d44e2003-12-23 08:09:43 +00002232
hassof390d2c2004-09-10 20:48:21 +00002233 circuit->hello_multiplier[0] = (u_int16_t) mult;
2234 circuit->hello_multiplier[1] = (u_int16_t) mult;
2235
jardineb5d44e2003-12-23 08:09:43 +00002236 return CMD_SUCCESS;
2237}
2238
2239DEFUN (no_isis_hello_multiplier,
2240 no_isis_hello_multiplier_cmd,
2241 "no isis hello-multiplier",
2242 NO_STR
2243 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002244 "Set multiplier for Hello holding time\n")
jardineb5d44e2003-12-23 08:09:43 +00002245{
Josh Bailey3f045a02012-03-24 08:35:20 -07002246 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2247 if (!circuit)
2248 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002249
Josh Bailey3f045a02012-03-24 08:35:20 -07002250 circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER;
2251 circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002252
2253 return CMD_SUCCESS;
2254}
2255
2256ALIAS (no_isis_hello_multiplier,
2257 no_isis_hello_multiplier_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002258 "no isis hello-multiplier <2-100>",
jardineb5d44e2003-12-23 08:09:43 +00002259 NO_STR
2260 "IS-IS commands\n"
2261 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002262 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00002263
2264DEFUN (isis_hello_multiplier_l1,
2265 isis_hello_multiplier_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002266 "isis hello-multiplier <2-100> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002267 "IS-IS commands\n"
2268 "Set multiplier for Hello holding time\n"
2269 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002270 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002271{
jardineb5d44e2003-12-23 08:09:43 +00002272 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002273 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2274 if (!circuit)
2275 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002276
2277 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002278 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2279 {
2280 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2281 mult, VTY_NEWLINE);
2282 return CMD_ERR_AMBIGUOUS;
2283 }
jardineb5d44e2003-12-23 08:09:43 +00002284
hassof390d2c2004-09-10 20:48:21 +00002285 circuit->hello_multiplier[0] = (u_int16_t) mult;
2286
jardineb5d44e2003-12-23 08:09:43 +00002287 return CMD_SUCCESS;
2288}
2289
2290DEFUN (no_isis_hello_multiplier_l1,
2291 no_isis_hello_multiplier_l1_cmd,
2292 "no isis hello-multiplier level-1",
2293 NO_STR
2294 "IS-IS commands\n"
2295 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002296 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002297{
Josh Bailey3f045a02012-03-24 08:35:20 -07002298 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2299 if (!circuit)
2300 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002301
Josh Bailey3f045a02012-03-24 08:35:20 -07002302 circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002303
2304 return CMD_SUCCESS;
2305}
2306
2307ALIAS (no_isis_hello_multiplier_l1,
2308 no_isis_hello_multiplier_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002309 "no isis hello-multiplier <2-100> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002310 NO_STR
2311 "IS-IS commands\n"
2312 "Set multiplier for Hello holding time\n"
2313 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002314 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002315
2316DEFUN (isis_hello_multiplier_l2,
2317 isis_hello_multiplier_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002318 "isis hello-multiplier <2-100> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002319 "IS-IS commands\n"
2320 "Set multiplier for Hello holding time\n"
2321 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002322 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002323{
jardineb5d44e2003-12-23 08:09:43 +00002324 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002325 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2326 if (!circuit)
2327 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002328
2329 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002330 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2331 {
2332 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2333 mult, VTY_NEWLINE);
2334 return CMD_ERR_AMBIGUOUS;
2335 }
jardineb5d44e2003-12-23 08:09:43 +00002336
hassof390d2c2004-09-10 20:48:21 +00002337 circuit->hello_multiplier[1] = (u_int16_t) mult;
2338
jardineb5d44e2003-12-23 08:09:43 +00002339 return CMD_SUCCESS;
2340}
2341
2342DEFUN (no_isis_hello_multiplier_l2,
2343 no_isis_hello_multiplier_l2_cmd,
2344 "no isis hello-multiplier level-2",
2345 NO_STR
2346 "IS-IS commands\n"
2347 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002348 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002349{
Josh Bailey3f045a02012-03-24 08:35:20 -07002350 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2351 if (!circuit)
2352 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002353
Josh Bailey3f045a02012-03-24 08:35:20 -07002354 circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002355
2356 return CMD_SUCCESS;
2357}
2358
2359ALIAS (no_isis_hello_multiplier_l2,
2360 no_isis_hello_multiplier_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002361 "no isis hello-multiplier <2-100> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002362 NO_STR
2363 "IS-IS commands\n"
2364 "Set multiplier for Hello holding time\n"
2365 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002366 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002367
Josh Bailey3f045a02012-03-24 08:35:20 -07002368DEFUN (isis_hello_padding,
2369 isis_hello_padding_cmd,
jardineb5d44e2003-12-23 08:09:43 +00002370 "isis hello padding",
2371 "IS-IS commands\n"
2372 "Add padding to IS-IS hello packets\n"
2373 "Pad hello packets\n"
2374 "<cr>\n")
2375{
Josh Bailey3f045a02012-03-24 08:35:20 -07002376 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2377 if (!circuit)
2378 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002379
Josh Bailey3f045a02012-03-24 08:35:20 -07002380 circuit->pad_hellos = 1;
hassof390d2c2004-09-10 20:48:21 +00002381
jardineb5d44e2003-12-23 08:09:43 +00002382 return CMD_SUCCESS;
2383}
2384
Josh Bailey3f045a02012-03-24 08:35:20 -07002385DEFUN (no_isis_hello_padding,
2386 no_isis_hello_padding_cmd,
jardineb5d44e2003-12-23 08:09:43 +00002387 "no isis hello padding",
2388 NO_STR
2389 "IS-IS commands\n"
2390 "Add padding to IS-IS hello packets\n"
2391 "Pad hello packets\n"
2392 "<cr>\n")
2393{
Josh Bailey3f045a02012-03-24 08:35:20 -07002394 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2395 if (!circuit)
2396 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002397
Josh Bailey3f045a02012-03-24 08:35:20 -07002398 circuit->pad_hellos = 0;
hassof390d2c2004-09-10 20:48:21 +00002399
jardineb5d44e2003-12-23 08:09:43 +00002400 return CMD_SUCCESS;
2401}
2402
2403DEFUN (csnp_interval,
2404 csnp_interval_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002405 "isis csnp-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002406 "IS-IS commands\n"
2407 "Set CSNP interval in seconds\n"
2408 "CSNP interval value\n")
2409{
jardineb5d44e2003-12-23 08:09:43 +00002410 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002411 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2412 if (!circuit)
2413 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002414
jardineb5d44e2003-12-23 08:09:43 +00002415 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002416 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2417 {
2418 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2419 interval, VTY_NEWLINE);
2420 return CMD_ERR_AMBIGUOUS;
2421 }
jardineb5d44e2003-12-23 08:09:43 +00002422
hassof390d2c2004-09-10 20:48:21 +00002423 circuit->csnp_interval[0] = (u_int16_t) interval;
2424 circuit->csnp_interval[1] = (u_int16_t) interval;
2425
jardineb5d44e2003-12-23 08:09:43 +00002426 return CMD_SUCCESS;
2427}
2428
2429DEFUN (no_csnp_interval,
2430 no_csnp_interval_cmd,
2431 "no isis csnp-interval",
2432 NO_STR
2433 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002434 "Set CSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002435{
Josh Bailey3f045a02012-03-24 08:35:20 -07002436 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2437 if (!circuit)
2438 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002439
Josh Bailey3f045a02012-03-24 08:35:20 -07002440 circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL;
2441 circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002442
jardineb5d44e2003-12-23 08:09:43 +00002443 return CMD_SUCCESS;
2444}
2445
2446ALIAS (no_csnp_interval,
2447 no_csnp_interval_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002448 "no isis csnp-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002449 NO_STR
2450 "IS-IS commands\n"
2451 "Set CSNP interval in seconds\n"
2452 "CSNP interval value\n")
2453
jardineb5d44e2003-12-23 08:09:43 +00002454DEFUN (csnp_interval_l1,
2455 csnp_interval_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002456 "isis csnp-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002457 "IS-IS commands\n"
2458 "Set CSNP interval in seconds\n"
2459 "CSNP interval value\n"
2460 "Specify interval for level-1 CSNPs\n")
2461{
jardineb5d44e2003-12-23 08:09:43 +00002462 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002463 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2464 if (!circuit)
2465 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002466
jardineb5d44e2003-12-23 08:09:43 +00002467 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002468 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2469 {
2470 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2471 interval, VTY_NEWLINE);
2472 return CMD_ERR_AMBIGUOUS;
2473 }
hassof390d2c2004-09-10 20:48:21 +00002474
2475 circuit->csnp_interval[0] = (u_int16_t) interval;
2476
jardineb5d44e2003-12-23 08:09:43 +00002477 return CMD_SUCCESS;
2478}
2479
2480DEFUN (no_csnp_interval_l1,
2481 no_csnp_interval_l1_cmd,
2482 "no isis csnp-interval level-1",
2483 NO_STR
2484 "IS-IS commands\n"
2485 "Set CSNP interval in seconds\n"
2486 "Specify interval for level-1 CSNPs\n")
2487{
Josh Bailey3f045a02012-03-24 08:35:20 -07002488 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2489 if (!circuit)
2490 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002491
Josh Bailey3f045a02012-03-24 08:35:20 -07002492 circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002493
jardineb5d44e2003-12-23 08:09:43 +00002494 return CMD_SUCCESS;
2495}
2496
2497ALIAS (no_csnp_interval_l1,
2498 no_csnp_interval_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002499 "no isis csnp-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002500 NO_STR
2501 "IS-IS commands\n"
2502 "Set CSNP interval in seconds\n"
2503 "CSNP interval value\n"
2504 "Specify interval for level-1 CSNPs\n")
2505
jardineb5d44e2003-12-23 08:09:43 +00002506DEFUN (csnp_interval_l2,
2507 csnp_interval_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002508 "isis csnp-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002509 "IS-IS commands\n"
2510 "Set CSNP interval in seconds\n"
2511 "CSNP interval value\n"
2512 "Specify interval for level-2 CSNPs\n")
2513{
jardineb5d44e2003-12-23 08:09:43 +00002514 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002515 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2516 if (!circuit)
2517 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002518
jardineb5d44e2003-12-23 08:09:43 +00002519 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002520 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2521 {
2522 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2523 interval, VTY_NEWLINE);
2524 return CMD_ERR_AMBIGUOUS;
2525 }
hassof390d2c2004-09-10 20:48:21 +00002526
2527 circuit->csnp_interval[1] = (u_int16_t) interval;
2528
jardineb5d44e2003-12-23 08:09:43 +00002529 return CMD_SUCCESS;
2530}
2531
2532DEFUN (no_csnp_interval_l2,
2533 no_csnp_interval_l2_cmd,
2534 "no isis csnp-interval level-2",
2535 NO_STR
2536 "IS-IS commands\n"
2537 "Set CSNP interval in seconds\n"
2538 "Specify interval for level-2 CSNPs\n")
2539{
Josh Bailey3f045a02012-03-24 08:35:20 -07002540 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2541 if (!circuit)
2542 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002543
Josh Bailey3f045a02012-03-24 08:35:20 -07002544 circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002545
jardineb5d44e2003-12-23 08:09:43 +00002546 return CMD_SUCCESS;
2547}
2548
2549ALIAS (no_csnp_interval_l2,
2550 no_csnp_interval_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002551 "no isis csnp-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002552 NO_STR
2553 "IS-IS commands\n"
2554 "Set CSNP interval in seconds\n"
2555 "CSNP interval value\n"
2556 "Specify interval for level-2 CSNPs\n")
2557
Josh Bailey3f045a02012-03-24 08:35:20 -07002558DEFUN (psnp_interval,
2559 psnp_interval_cmd,
2560 "isis psnp-interval <1-120>",
2561 "IS-IS commands\n"
2562 "Set PSNP interval in seconds\n"
2563 "PSNP interval value\n")
jardineb5d44e2003-12-23 08:09:43 +00002564{
Josh Bailey3f045a02012-03-24 08:35:20 -07002565 unsigned long interval;
2566 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2567 if (!circuit)
2568 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002569
Josh Bailey3f045a02012-03-24 08:35:20 -07002570 interval = atol (argv[0]);
2571 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002572 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002573 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2574 interval, VTY_NEWLINE);
2575 return CMD_ERR_AMBIGUOUS;
jardineb5d44e2003-12-23 08:09:43 +00002576 }
jardineb5d44e2003-12-23 08:09:43 +00002577
Josh Bailey3f045a02012-03-24 08:35:20 -07002578 circuit->psnp_interval[0] = (u_int16_t) interval;
2579 circuit->psnp_interval[1] = (u_int16_t) interval;
jardineb5d44e2003-12-23 08:09:43 +00002580
2581 return CMD_SUCCESS;
2582}
2583
Josh Bailey3f045a02012-03-24 08:35:20 -07002584DEFUN (no_psnp_interval,
2585 no_psnp_interval_cmd,
2586 "no isis psnp-interval",
jardineb5d44e2003-12-23 08:09:43 +00002587 NO_STR
Josh Bailey3f045a02012-03-24 08:35:20 -07002588 "IS-IS commands\n"
2589 "Set PSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002590{
Josh Bailey3f045a02012-03-24 08:35:20 -07002591 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2592 if (!circuit)
2593 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002594
Josh Bailey3f045a02012-03-24 08:35:20 -07002595 circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL;
2596 circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL;
jardineb5d44e2003-12-23 08:09:43 +00002597
2598 return CMD_SUCCESS;
2599}
jardineb5d44e2003-12-23 08:09:43 +00002600
Josh Bailey3f045a02012-03-24 08:35:20 -07002601ALIAS (no_psnp_interval,
2602 no_psnp_interval_arg_cmd,
2603 "no isis psnp-interval <1-120>",
2604 NO_STR
2605 "IS-IS commands\n"
2606 "Set PSNP interval in seconds\n"
2607 "PSNP interval value\n")
2608
2609DEFUN (psnp_interval_l1,
2610 psnp_interval_l1_cmd,
2611 "isis psnp-interval <1-120> level-1",
2612 "IS-IS commands\n"
2613 "Set PSNP interval in seconds\n"
2614 "PSNP interval value\n"
2615 "Specify interval for level-1 PSNPs\n")
2616{
2617 unsigned long interval;
2618 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2619 if (!circuit)
2620 return CMD_ERR_NO_MATCH;
2621
2622 interval = atol (argv[0]);
2623 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
2624 {
2625 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2626 interval, VTY_NEWLINE);
2627 return CMD_ERR_AMBIGUOUS;
2628 }
2629
2630 circuit->psnp_interval[0] = (u_int16_t) interval;
2631
2632 return CMD_SUCCESS;
2633}
2634
2635DEFUN (no_psnp_interval_l1,
2636 no_psnp_interval_l1_cmd,
2637 "no isis psnp-interval level-1",
2638 NO_STR
2639 "IS-IS commands\n"
2640 "Set PSNP interval in seconds\n"
2641 "Specify interval for level-1 PSNPs\n")
2642{
2643 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2644 if (!circuit)
2645 return CMD_ERR_NO_MATCH;
2646
2647 circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL;
2648
2649 return CMD_SUCCESS;
2650}
2651
2652ALIAS (no_psnp_interval_l1,
2653 no_psnp_interval_l1_arg_cmd,
2654 "no isis psnp-interval <1-120> level-1",
2655 NO_STR
2656 "IS-IS commands\n"
2657 "Set PSNP interval in seconds\n"
2658 "PSNP interval value\n"
2659 "Specify interval for level-1 PSNPs\n")
2660
2661DEFUN (psnp_interval_l2,
2662 psnp_interval_l2_cmd,
2663 "isis psnp-interval <1-120> level-2",
2664 "IS-IS commands\n"
2665 "Set PSNP interval in seconds\n"
2666 "PSNP interval value\n"
2667 "Specify interval for level-2 PSNPs\n")
2668{
2669 unsigned long interval;
2670 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2671 if (!circuit)
2672 return CMD_ERR_NO_MATCH;
2673
2674 interval = atol (argv[0]);
2675 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
2676 {
2677 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2678 interval, VTY_NEWLINE);
2679 return CMD_ERR_AMBIGUOUS;
2680 }
2681
2682 circuit->psnp_interval[1] = (u_int16_t) interval;
2683
2684 return CMD_SUCCESS;
2685}
2686
2687DEFUN (no_psnp_interval_l2,
2688 no_psnp_interval_l2_cmd,
2689 "no isis psnp-interval level-2",
2690 NO_STR
2691 "IS-IS commands\n"
2692 "Set PSNP interval in seconds\n"
2693 "Specify interval for level-2 PSNPs\n")
2694{
2695 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2696 if (!circuit)
2697 return CMD_ERR_NO_MATCH;
2698
2699 circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL;
2700
2701 return CMD_SUCCESS;
2702}
2703
2704ALIAS (no_psnp_interval_l2,
2705 no_psnp_interval_l2_arg_cmd,
2706 "no isis psnp-interval <1-120> level-2",
2707 NO_STR
2708 "IS-IS commands\n"
2709 "Set PSNP interval in seconds\n"
2710 "PSNP interval value\n"
2711 "Specify interval for level-2 PSNPs\n")
2712
2713struct cmd_node interface_node = {
jardineb5d44e2003-12-23 08:09:43 +00002714 INTERFACE_NODE,
2715 "%s(config-if)# ",
2716 1,
2717};
2718
Josh Bailey3f045a02012-03-24 08:35:20 -07002719DEFUN (isis_network,
2720 isis_network_cmd,
2721 "isis network point-to-point",
2722 "IS-IS commands\n"
2723 "Set network type\n"
2724 "point-to-point network type\n")
2725{
2726 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2727 if (!circuit)
2728 return CMD_ERR_NO_MATCH;
2729
2730 /* RFC5309 section 4 */
2731 if (circuit->circ_type == CIRCUIT_T_P2P)
2732 return CMD_SUCCESS;
2733
2734 if (circuit->state != C_STATE_UP)
2735 {
2736 circuit->circ_type = CIRCUIT_T_P2P;
2737 circuit->circ_type_config = CIRCUIT_T_P2P;
2738 }
2739 else
2740 {
2741 struct isis_area *area = circuit->area;
2742 if (!if_is_broadcast (circuit->interface))
2743 {
2744 vty_out (vty, "isis network point-to-point "
2745 "is valid only on broadcast interfaces%s",
2746 VTY_NEWLINE);
2747 return CMD_ERR_AMBIGUOUS;
2748 }
2749
2750 isis_csm_state_change (ISIS_DISABLE, circuit, area);
2751 circuit->circ_type = CIRCUIT_T_P2P;
2752 circuit->circ_type_config = CIRCUIT_T_P2P;
2753 isis_csm_state_change (ISIS_ENABLE, circuit, area);
2754 }
2755
2756 return CMD_SUCCESS;
2757}
2758
2759DEFUN (no_isis_network,
2760 no_isis_network_cmd,
2761 "no isis network point-to-point",
2762 NO_STR
2763 "IS-IS commands\n"
2764 "Set network type for circuit\n"
2765 "point-to-point network type\n")
2766{
2767 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2768 if (!circuit)
2769 return CMD_ERR_NO_MATCH;
2770
2771 /* RFC5309 section 4 */
2772 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
2773 return CMD_SUCCESS;
2774
2775 if (circuit->state != C_STATE_UP)
2776 {
2777 circuit->circ_type = CIRCUIT_T_BROADCAST;
2778 circuit->circ_type_config = CIRCUIT_T_BROADCAST;
2779 }
2780 else
2781 {
2782 struct isis_area *area = circuit->area;
2783 if (circuit->interface &&
2784 !if_is_broadcast (circuit->interface))
2785 {
2786 vty_out (vty, "no isis network point-to-point "
2787 "is valid only on broadcast interfaces%s",
2788 VTY_NEWLINE);
2789 return CMD_ERR_AMBIGUOUS;
2790 }
2791
2792 isis_csm_state_change (ISIS_DISABLE, circuit, area);
2793 circuit->circ_type = CIRCUIT_T_BROADCAST;
2794 circuit->circ_type_config = CIRCUIT_T_BROADCAST;
2795 isis_csm_state_change (ISIS_ENABLE, circuit, area);
2796 }
2797
2798 return CMD_SUCCESS;
2799}
2800
jardineb5d44e2003-12-23 08:09:43 +00002801int
2802isis_if_new_hook (struct interface *ifp)
2803{
jardineb5d44e2003-12-23 08:09:43 +00002804 return 0;
2805}
2806
2807int
2808isis_if_delete_hook (struct interface *ifp)
2809{
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002810 struct isis_circuit *circuit;
2811 /* Clean up the circuit data */
2812 if (ifp && ifp->info)
2813 {
2814 circuit = ifp->info;
2815 isis_csm_state_change (IF_DOWN_FROM_Z, circuit, circuit->area);
2816 isis_csm_state_change (ISIS_DISABLE, circuit, circuit->area);
2817 }
2818
jardineb5d44e2003-12-23 08:09:43 +00002819 return 0;
2820}
2821
jardineb5d44e2003-12-23 08:09:43 +00002822void
2823isis_circuit_init ()
2824{
jardineb5d44e2003-12-23 08:09:43 +00002825 /* Initialize Zebra interface data structure */
jardineb5d44e2003-12-23 08:09:43 +00002826 if_add_hook (IF_NEW_HOOK, isis_if_new_hook);
2827 if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook);
2828
2829 /* Install interface node */
2830 install_node (&interface_node, isis_interface_config_write);
2831 install_element (CONFIG_NODE, &interface_cmd);
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002832 install_element (CONFIG_NODE, &no_interface_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002833
2834 install_default (INTERFACE_NODE);
2835 install_element (INTERFACE_NODE, &interface_desc_cmd);
2836 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
2837
2838 install_element (INTERFACE_NODE, &ip_router_isis_cmd);
2839 install_element (INTERFACE_NODE, &no_ip_router_isis_cmd);
2840
Josh Bailey3f045a02012-03-24 08:35:20 -07002841 install_element (INTERFACE_NODE, &isis_passive_cmd);
2842 install_element (INTERFACE_NODE, &no_isis_passive_cmd);
2843
jardineb5d44e2003-12-23 08:09:43 +00002844 install_element (INTERFACE_NODE, &isis_circuit_type_cmd);
2845 install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd);
2846
Josh Bailey3f045a02012-03-24 08:35:20 -07002847 install_element (INTERFACE_NODE, &isis_passwd_clear_cmd);
2848 install_element (INTERFACE_NODE, &isis_passwd_md5_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002849 install_element (INTERFACE_NODE, &no_isis_passwd_cmd);
2850
2851 install_element (INTERFACE_NODE, &isis_priority_cmd);
2852 install_element (INTERFACE_NODE, &no_isis_priority_cmd);
2853 install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd);
2854 install_element (INTERFACE_NODE, &isis_priority_l1_cmd);
2855 install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd);
2856 install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd);
2857 install_element (INTERFACE_NODE, &isis_priority_l2_cmd);
2858 install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd);
2859 install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd);
2860
2861 install_element (INTERFACE_NODE, &isis_metric_cmd);
2862 install_element (INTERFACE_NODE, &no_isis_metric_cmd);
2863 install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07002864 install_element (INTERFACE_NODE, &isis_metric_l1_cmd);
2865 install_element (INTERFACE_NODE, &no_isis_metric_l1_cmd);
2866 install_element (INTERFACE_NODE, &no_isis_metric_l1_arg_cmd);
2867 install_element (INTERFACE_NODE, &isis_metric_l2_cmd);
2868 install_element (INTERFACE_NODE, &no_isis_metric_l2_cmd);
2869 install_element (INTERFACE_NODE, &no_isis_metric_l2_arg_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002870
2871 install_element (INTERFACE_NODE, &isis_hello_interval_cmd);
2872 install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd);
2873 install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd);
2874 install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd);
2875 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd);
2876 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd);
2877 install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd);
2878 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd);
2879 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd);
2880
2881 install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd);
2882 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
2883 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd);
2884 install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd);
2885 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd);
2886 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd);
2887 install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd);
2888 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd);
2889 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd);
2890
Josh Bailey3f045a02012-03-24 08:35:20 -07002891 install_element (INTERFACE_NODE, &isis_hello_padding_cmd);
2892 install_element (INTERFACE_NODE, &no_isis_hello_padding_cmd);
2893
jardineb5d44e2003-12-23 08:09:43 +00002894 install_element (INTERFACE_NODE, &csnp_interval_cmd);
2895 install_element (INTERFACE_NODE, &no_csnp_interval_cmd);
2896 install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd);
2897 install_element (INTERFACE_NODE, &csnp_interval_l1_cmd);
2898 install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd);
2899 install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd);
2900 install_element (INTERFACE_NODE, &csnp_interval_l2_cmd);
2901 install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd);
2902 install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd);
2903
Josh Bailey3f045a02012-03-24 08:35:20 -07002904 install_element (INTERFACE_NODE, &psnp_interval_cmd);
2905 install_element (INTERFACE_NODE, &no_psnp_interval_cmd);
2906 install_element (INTERFACE_NODE, &no_psnp_interval_arg_cmd);
2907 install_element (INTERFACE_NODE, &psnp_interval_l1_cmd);
2908 install_element (INTERFACE_NODE, &no_psnp_interval_l1_cmd);
2909 install_element (INTERFACE_NODE, &no_psnp_interval_l1_arg_cmd);
2910 install_element (INTERFACE_NODE, &psnp_interval_l2_cmd);
2911 install_element (INTERFACE_NODE, &no_psnp_interval_l2_cmd);
2912 install_element (INTERFACE_NODE, &no_psnp_interval_l2_arg_cmd);
2913
2914 install_element (INTERFACE_NODE, &isis_network_cmd);
2915 install_element (INTERFACE_NODE, &no_isis_network_cmd);
2916
jardineb5d44e2003-12-23 08:09:43 +00002917#ifdef HAVE_IPV6
2918 install_element (INTERFACE_NODE, &ipv6_router_isis_cmd);
2919 install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002920#endif
jardineb5d44e2003-12-23 08:09:43 +00002921}