blob: a48afd2b80fac9078b42b3e1e0ed8e9fd5dd295c [file] [log] [blame]
jardineb5d44e2003-12-23 08:09:43 +00001/*
2 * IS-IS Rout(e)ing protocol - isis_circuit.h
3 *
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public Licenseas published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
jardineb5d44e2003-12-23 08:09:43 +000022#include <zebra.h>
hasso37da8c02004-05-19 11:38:40 +000023#ifdef GNU_LINUX
jardineb5d44e2003-12-23 08:09:43 +000024#include <net/ethernet.h>
hasso37da8c02004-05-19 11:38:40 +000025#else
26#include <netinet/if_ether.h>
27#endif
jardineb5d44e2003-12-23 08:09:43 +000028
Paul Jakma238497f2007-08-07 18:49:18 +000029#ifndef ETHER_ADDR_LEN
30#define ETHER_ADDR_LEN ETHERADDRL
31#endif
32
jardineb5d44e2003-12-23 08:09:43 +000033#include "log.h"
34#include "memory.h"
35#include "if.h"
36#include "linklist.h"
37#include "command.h"
38#include "thread.h"
39#include "hash.h"
40#include "prefix.h"
41#include "stream.h"
42
43#include "isisd/dict.h"
44#include "isisd/include-netbsd/iso.h"
45#include "isisd/isis_constants.h"
46#include "isisd/isis_common.h"
Josh Bailey3f045a02012-03-24 08:35:20 -070047#include "isisd/isis_flags.h"
jardineb5d44e2003-12-23 08:09:43 +000048#include "isisd/isis_circuit.h"
49#include "isisd/isis_tlv.h"
50#include "isisd/isis_lsp.h"
51#include "isisd/isis_pdu.h"
52#include "isisd/isis_network.h"
53#include "isisd/isis_misc.h"
54#include "isisd/isis_constants.h"
55#include "isisd/isis_adjacency.h"
56#include "isisd/isis_dr.h"
jardineb5d44e2003-12-23 08:09:43 +000057#include "isisd/isisd.h"
58#include "isisd/isis_csm.h"
59#include "isisd/isis_events.h"
60
Paul Jakma41b36e92006-12-08 01:09:50 +000061/*
62 * Prototypes.
63 */
Paul Jakma41b36e92006-12-08 01:09:50 +000064int isis_interface_config_write(struct vty *);
65int isis_if_new_hook(struct interface *);
66int isis_if_delete_hook(struct interface *);
67
jardineb5d44e2003-12-23 08:09:43 +000068struct isis_circuit *
69isis_circuit_new ()
70{
71 struct isis_circuit *circuit;
72 int i;
73
hasso3fdb2dd2005-09-28 18:45:54 +000074 circuit = XCALLOC (MTYPE_ISIS_CIRCUIT, sizeof (struct isis_circuit));
Josh Bailey3f045a02012-03-24 08:35:20 -070075 if (circuit == NULL)
hassof390d2c2004-09-10 20:48:21 +000076 {
77 zlog_err ("Can't malloc isis circuit");
78 return NULL;
79 }
80
Josh Bailey3f045a02012-03-24 08:35:20 -070081 /*
82 * Default values
83 */
84 circuit->is_type = IS_LEVEL_1_AND_2;
85 circuit->flags = 0;
86 circuit->pad_hellos = 1;
87 for (i = 0; i < 2; i++)
88 {
89 circuit->hello_interval[i] = DEFAULT_HELLO_INTERVAL;
90 circuit->hello_multiplier[i] = DEFAULT_HELLO_MULTIPLIER;
91 circuit->csnp_interval[i] = DEFAULT_CSNP_INTERVAL;
92 circuit->psnp_interval[i] = DEFAULT_PSNP_INTERVAL;
93 circuit->priority[i] = DEFAULT_PRIORITY;
94 circuit->metrics[i].metric_default = DEFAULT_CIRCUIT_METRIC;
95 circuit->metrics[i].metric_expense = METRICS_UNSUPPORTED;
96 circuit->metrics[i].metric_error = METRICS_UNSUPPORTED;
97 circuit->metrics[i].metric_delay = METRICS_UNSUPPORTED;
98 circuit->te_metric[i] = DEFAULT_CIRCUIT_METRIC;
99 }
100
jardineb5d44e2003-12-23 08:09:43 +0000101 return circuit;
102}
103
jardineb5d44e2003-12-23 08:09:43 +0000104void
Josh Bailey3f045a02012-03-24 08:35:20 -0700105isis_circuit_del (struct isis_circuit *circuit)
106{
107 if (!circuit)
108 return;
109
110 isis_circuit_if_unbind (circuit, circuit->interface);
111
112 /* and lastly the circuit itself */
113 XFREE (MTYPE_ISIS_CIRCUIT, circuit);
114
115 return;
116}
117
118void
jardineb5d44e2003-12-23 08:09:43 +0000119isis_circuit_configure (struct isis_circuit *circuit, struct isis_area *area)
120{
Josh Bailey3f045a02012-03-24 08:35:20 -0700121 assert (area);
jardineb5d44e2003-12-23 08:09:43 +0000122 circuit->area = area;
Josh Bailey3f045a02012-03-24 08:35:20 -0700123
jardineb5d44e2003-12-23 08:09:43 +0000124 /*
Christian Franke7324ae12015-11-10 18:04:48 +0100125 * Whenever the is-type of an area is changed, the is-type of each circuit
126 * in that area is updated to a non-empty subset of the area is-type.
127 * Inversely, when configuring a new circuit, this property should be
128 * ensured as well.
jardineb5d44e2003-12-23 08:09:43 +0000129 */
Christian Franke7324ae12015-11-10 18:04:48 +0100130 if (area->is_type != IS_LEVEL_1_AND_2)
131 circuit->is_type = area->is_type;
jardineb5d44e2003-12-23 08:09:43 +0000132
133 /*
134 * Add the circuit into area
135 */
136 listnode_add (area->circuit_list, circuit);
137
138 circuit->idx = flags_get_index (&area->flags);
jardineb5d44e2003-12-23 08:09:43 +0000139
140 return;
141}
142
hassof390d2c2004-09-10 20:48:21 +0000143void
Josh Bailey3f045a02012-03-24 08:35:20 -0700144isis_circuit_deconfigure (struct isis_circuit *circuit, struct isis_area *area)
jardineb5d44e2003-12-23 08:09:43 +0000145{
jardineb5d44e2003-12-23 08:09:43 +0000146 /* Free the index of SRM and SSN flags */
147 flags_free_index (&area->flags, circuit->idx);
Josh Bailey3f045a02012-03-24 08:35:20 -0700148 circuit->idx = 0;
149 /* Remove circuit from area */
150 assert (circuit->area == area);
151 listnode_delete (area->circuit_list, circuit);
152 circuit->area = NULL;
jardineb5d44e2003-12-23 08:09:43 +0000153
154 return;
155}
156
157struct isis_circuit *
158circuit_lookup_by_ifp (struct interface *ifp, struct list *list)
159{
160 struct isis_circuit *circuit = NULL;
161 struct listnode *node;
hassof390d2c2004-09-10 20:48:21 +0000162
jardineb5d44e2003-12-23 08:09:43 +0000163 if (!list)
164 return NULL;
hassof390d2c2004-09-10 20:48:21 +0000165
paul1eb8ef22005-04-07 07:30:20 +0000166 for (ALL_LIST_ELEMENTS_RO (list, node, circuit))
167 if (circuit->interface == ifp)
Josh Bailey3f045a02012-03-24 08:35:20 -0700168 {
169 assert (ifp->info == circuit);
170 return circuit;
171 }
172
jardineb5d44e2003-12-23 08:09:43 +0000173 return NULL;
174}
175
176struct isis_circuit *
177circuit_scan_by_ifp (struct interface *ifp)
178{
179 struct isis_area *area;
180 struct listnode *node;
181 struct isis_circuit *circuit;
182
Josh Bailey3f045a02012-03-24 08:35:20 -0700183 if (ifp->info)
184 return (struct isis_circuit *)ifp->info;
jardineb5d44e2003-12-23 08:09:43 +0000185
Josh Bailey3f045a02012-03-24 08:35:20 -0700186 if (isis->area_list)
hassof390d2c2004-09-10 20:48:21 +0000187 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700188 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
189 {
190 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
191 if (circuit)
192 return circuit;
193 }
hassof390d2c2004-09-10 20:48:21 +0000194 }
jardineb5d44e2003-12-23 08:09:43 +0000195 return circuit_lookup_by_ifp (ifp, isis->init_circ_list);
196}
197
Josh Bailey3f045a02012-03-24 08:35:20 -0700198static struct isis_circuit *
199isis_circuit_lookup (struct vty *vty)
jardineb5d44e2003-12-23 08:09:43 +0000200{
Josh Bailey3f045a02012-03-24 08:35:20 -0700201 struct interface *ifp;
202 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +0000203
Josh Bailey3f045a02012-03-24 08:35:20 -0700204 ifp = (struct interface *) vty->index;
205 if (!ifp)
hassof390d2c2004-09-10 20:48:21 +0000206 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700207 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
208 return NULL;
hassof390d2c2004-09-10 20:48:21 +0000209 }
hassof390d2c2004-09-10 20:48:21 +0000210
Josh Bailey3f045a02012-03-24 08:35:20 -0700211 circuit = circuit_scan_by_ifp (ifp);
212 if (!circuit)
213 {
214 vty_out (vty, "ISIS is not enabled on circuit %s%s",
215 ifp->name, VTY_NEWLINE);
216 return NULL;
217 }
jardineb5d44e2003-12-23 08:09:43 +0000218
Josh Bailey3f045a02012-03-24 08:35:20 -0700219 return circuit;
jardineb5d44e2003-12-23 08:09:43 +0000220}
221
222void
hassof891f442004-09-14 13:54:30 +0000223isis_circuit_add_addr (struct isis_circuit *circuit,
224 struct connected *connected)
jardineb5d44e2003-12-23 08:09:43 +0000225{
Josh Bailey3f045a02012-03-24 08:35:20 -0700226 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000227 struct prefix_ipv4 *ipv4;
hassof390d2c2004-09-10 20:48:21 +0000228 u_char buf[BUFSIZ];
jardineb5d44e2003-12-23 08:09:43 +0000229#ifdef HAVE_IPV6
230 struct prefix_ipv6 *ipv6;
231#endif /* HAVE_IPV6 */
hassof891f442004-09-14 13:54:30 +0000232
jardineb5d44e2003-12-23 08:09:43 +0000233 memset (&buf, 0, BUFSIZ);
hassof891f442004-09-14 13:54:30 +0000234 if (connected->address->family == AF_INET)
hassof390d2c2004-09-10 20:48:21 +0000235 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700236 u_int32_t addr = connected->address->u.prefix4.s_addr;
237 addr = ntohl (addr);
238 if (IPV4_NET0(addr) ||
239 IPV4_NET127(addr) ||
240 IN_CLASSD(addr) ||
241 IPV4_LINKLOCAL(addr))
242 return;
243
244 for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ipv4))
245 if (prefix_same ((struct prefix *) ipv4, connected->address))
246 return;
247
hassof390d2c2004-09-10 20:48:21 +0000248 ipv4 = prefix_ipv4_new ();
hassof891f442004-09-14 13:54:30 +0000249 ipv4->prefixlen = connected->address->prefixlen;
250 ipv4->prefix = connected->address->u.prefix4;
hassof390d2c2004-09-10 20:48:21 +0000251 listnode_add (circuit->ip_addrs, ipv4);
hasso0dae85e2004-09-26 19:53:47 +0000252 if (circuit->area)
Josh Bailey3f045a02012-03-24 08:35:20 -0700253 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
hassof891f442004-09-14 13:54:30 +0000254
jardineb5d44e2003-12-23 08:09:43 +0000255#ifdef EXTREME_DEBUG
hassof891f442004-09-14 13:54:30 +0000256 prefix2str (connected->address, buf, BUFSIZ);
hasso529d65b2004-12-24 00:14:50 +0000257 zlog_debug ("Added IP address %s to circuit %d", buf,
hassof390d2c2004-09-10 20:48:21 +0000258 circuit->circuit_id);
259#endif /* EXTREME_DEBUG */
jardineb5d44e2003-12-23 08:09:43 +0000260 }
hassof390d2c2004-09-10 20:48:21 +0000261#ifdef HAVE_IPV6
hassof891f442004-09-14 13:54:30 +0000262 if (connected->address->family == AF_INET6)
hassof390d2c2004-09-10 20:48:21 +0000263 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700264 if (IN6_IS_ADDR_LOOPBACK(&connected->address->u.prefix6))
265 return;
266
267 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_link, node, ipv6))
268 if (prefix_same ((struct prefix *) ipv6, connected->address))
269 return;
270 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, node, ipv6))
271 if (prefix_same ((struct prefix *) ipv6, connected->address))
272 return;
273
hassof390d2c2004-09-10 20:48:21 +0000274 ipv6 = prefix_ipv6_new ();
hassof891f442004-09-14 13:54:30 +0000275 ipv6->prefixlen = connected->address->prefixlen;
276 ipv6->prefix = connected->address->u.prefix6;
277
hassof390d2c2004-09-10 20:48:21 +0000278 if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix))
hassof891f442004-09-14 13:54:30 +0000279 listnode_add (circuit->ipv6_link, ipv6);
hassof390d2c2004-09-10 20:48:21 +0000280 else
hassof891f442004-09-14 13:54:30 +0000281 listnode_add (circuit->ipv6_non_link, ipv6);
hasso0dae85e2004-09-26 19:53:47 +0000282 if (circuit->area)
Josh Bailey3f045a02012-03-24 08:35:20 -0700283 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
hassof891f442004-09-14 13:54:30 +0000284
jardineb5d44e2003-12-23 08:09:43 +0000285#ifdef EXTREME_DEBUG
hassof891f442004-09-14 13:54:30 +0000286 prefix2str (connected->address, buf, BUFSIZ);
hasso529d65b2004-12-24 00:14:50 +0000287 zlog_debug ("Added IPv6 address %s to circuit %d", buf,
hassof390d2c2004-09-10 20:48:21 +0000288 circuit->circuit_id);
289#endif /* EXTREME_DEBUG */
290 }
jardineb5d44e2003-12-23 08:09:43 +0000291#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000292 return;
293}
294
295void
296isis_circuit_del_addr (struct isis_circuit *circuit,
hassof390d2c2004-09-10 20:48:21 +0000297 struct connected *connected)
jardineb5d44e2003-12-23 08:09:43 +0000298{
hassof891f442004-09-14 13:54:30 +0000299 struct prefix_ipv4 *ipv4, *ip = NULL;
300 struct listnode *node;
hassof891f442004-09-14 13:54:30 +0000301 u_char buf[BUFSIZ];
302#ifdef HAVE_IPV6
303 struct prefix_ipv6 *ipv6, *ip6 = NULL;
Paul Jakma41b36e92006-12-08 01:09:50 +0000304 int found = 0;
hassof891f442004-09-14 13:54:30 +0000305#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000306
hassof891f442004-09-14 13:54:30 +0000307 memset (&buf, 0, BUFSIZ);
308 if (connected->address->family == AF_INET)
309 {
310 ipv4 = prefix_ipv4_new ();
311 ipv4->prefixlen = connected->address->prefixlen;
312 ipv4->prefix = connected->address->u.prefix4;
313
paul1eb8ef22005-04-07 07:30:20 +0000314 for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip))
Josh Bailey3f045a02012-03-24 08:35:20 -0700315 if (prefix_same ((struct prefix *) ip, (struct prefix *) ipv4))
paul1eb8ef22005-04-07 07:30:20 +0000316 break;
hassof891f442004-09-14 13:54:30 +0000317
318 if (ip)
319 {
320 listnode_delete (circuit->ip_addrs, ip);
Josh Bailey3f045a02012-03-24 08:35:20 -0700321 if (circuit->area)
322 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
hassof891f442004-09-14 13:54:30 +0000323 }
324 else
325 {
hassof7c43dc2004-09-26 16:24:14 +0000326 prefix2str (connected->address, (char *)buf, BUFSIZ);
Josh Bailey3f045a02012-03-24 08:35:20 -0700327 zlog_warn ("Nonexitant ip address %s removal attempt from \
328 circuit %d", buf, circuit->circuit_id);
Christian Frankeec874162015-11-10 18:33:12 +0100329 zlog_warn ("Current ip addresses on %s:", circuit->interface->name);
330 for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node, ip))
331 {
332 prefix2str((struct prefix*)ip, (char *)buf, BUFSIZ);
333 zlog_warn(" %s", buf);
334 }
335 zlog_warn("End of addresses");
hassof891f442004-09-14 13:54:30 +0000336 }
David Lampartere8aca322012-11-27 01:10:30 +0000337
338 prefix_ipv4_free (ipv4);
hassof891f442004-09-14 13:54:30 +0000339 }
340#ifdef HAVE_IPV6
341 if (connected->address->family == AF_INET6)
342 {
343 ipv6 = prefix_ipv6_new ();
344 ipv6->prefixlen = connected->address->prefixlen;
345 ipv6->prefix = connected->address->u.prefix6;
346
347 if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix))
348 {
paul1eb8ef22005-04-07 07:30:20 +0000349 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_link, node, ip6))
hassof891f442004-09-14 13:54:30 +0000350 {
hassof891f442004-09-14 13:54:30 +0000351 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
352 break;
353 }
354 if (ip6)
355 {
356 listnode_delete (circuit->ipv6_link, ip6);
357 found = 1;
358 }
359 }
360 else
361 {
paul1eb8ef22005-04-07 07:30:20 +0000362 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, node, ip6))
hassof891f442004-09-14 13:54:30 +0000363 {
hassof891f442004-09-14 13:54:30 +0000364 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
365 break;
366 }
367 if (ip6)
368 {
369 listnode_delete (circuit->ipv6_non_link, ip6);
370 found = 1;
371 }
372 }
373
374 if (!found)
375 {
hassof7c43dc2004-09-26 16:24:14 +0000376 prefix2str (connected->address, (char *)buf, BUFSIZ);
Josh Bailey3f045a02012-03-24 08:35:20 -0700377 zlog_warn ("Nonexitant ip address %s removal attempt from \
378 circuit %d", buf, circuit->circuit_id);
Christian Frankeec874162015-11-10 18:33:12 +0100379 zlog_warn ("Current ip addresses on %s:", circuit->interface->name);
380 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node, ip6))
381 {
382 prefix2str((struct prefix*)ip6, (char *)buf, BUFSIZ);
383 zlog_warn(" %s", buf);
384 }
385 zlog_warn(" -----");
386 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node, ip6))
387 {
388 prefix2str((struct prefix*)ip6, (char *)buf, BUFSIZ);
389 zlog_warn(" %s", buf);
390 }
391 zlog_warn("End of addresses");
hassof891f442004-09-14 13:54:30 +0000392 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700393 else if (circuit->area)
394 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
David Lampartere8aca322012-11-27 01:10:30 +0000395
396 prefix_ipv6_free (ipv6);
hassof891f442004-09-14 13:54:30 +0000397 }
398#endif /* HAVE_IPV6 */
399 return;
jardineb5d44e2003-12-23 08:09:43 +0000400}
401
Josh Bailey3f045a02012-03-24 08:35:20 -0700402static u_char
403isis_circuit_id_gen (struct interface *ifp)
404{
405 u_char id = 0;
406 char ifname[16];
407 unsigned int i;
408 int start = -1, end = -1;
409
410 /*
411 * Get a stable circuit id from ifname. This makes
412 * the ifindex from flapping when netdevs are created
413 * and deleted on the fly. Note that this circuit id
414 * is used in pseudo lsps so it is better to be stable.
415 * The following code works on any reasonanle ifname
416 * like: eth1 or trk-1.1 etc.
417 */
418 for (i = 0; i < strlen (ifp->name); i++)
419 {
David Lamparter52f02b42015-04-10 09:14:30 +0200420 if (isdigit((unsigned char)ifp->name[i]))
Josh Bailey3f045a02012-03-24 08:35:20 -0700421 {
422 if (start < 0)
423 {
424 start = i;
425 end = i + 1;
426 }
427 else
428 {
429 end = i + 1;
430 }
431 }
432 else if (start >= 0)
433 break;
434 }
435
436 if ((start >= 0) && (end >= start) && (end - start) < 16)
437 {
438 memset (ifname, 0, 16);
439 strncpy (ifname, &ifp->name[start], end - start);
440 id = (u_char)atoi(ifname);
441 }
442
443 /* Try to be unique. */
444 if (!id)
445 id = (u_char)((ifp->ifindex & 0xff) | 0x80);
446
447 return id;
448}
449
jardineb5d44e2003-12-23 08:09:43 +0000450void
451isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp)
452{
paul1eb8ef22005-04-07 07:30:20 +0000453 struct listnode *node, *nnode;
jardineb5d44e2003-12-23 08:09:43 +0000454 struct connected *conn;
455
Josh Bailey3f045a02012-03-24 08:35:20 -0700456 circuit->circuit_id = isis_circuit_id_gen (ifp);
hassof390d2c2004-09-10 20:48:21 +0000457
Josh Bailey3f045a02012-03-24 08:35:20 -0700458 isis_circuit_if_bind (circuit, ifp);
jardineb5d44e2003-12-23 08:09:43 +0000459 /* isis_circuit_update_addrs (circuit, ifp); */
460
hassof390d2c2004-09-10 20:48:21 +0000461 if (if_is_broadcast (ifp))
462 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700463 if (circuit->circ_type_config == CIRCUIT_T_P2P)
464 circuit->circ_type = CIRCUIT_T_P2P;
hassof390d2c2004-09-10 20:48:21 +0000465 else
Josh Bailey3f045a02012-03-24 08:35:20 -0700466 circuit->circ_type = CIRCUIT_T_BROADCAST;
hassof390d2c2004-09-10 20:48:21 +0000467 }
468 else if (if_is_pointopoint (ifp))
469 {
470 circuit->circ_type = CIRCUIT_T_P2P;
471 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700472 else if (if_is_loopback (ifp))
473 {
474 circuit->circ_type = CIRCUIT_T_LOOPBACK;
475 circuit->is_passive = 1;
476 }
hassof390d2c2004-09-10 20:48:21 +0000477 else
478 {
hassoc89c05d2005-09-04 21:36:36 +0000479 /* It's normal in case of loopback etc. */
480 if (isis->debugs & DEBUG_EVENTS)
Josh Bailey3f045a02012-03-24 08:35:20 -0700481 zlog_debug ("isis_circuit_if_add: unsupported media");
482 circuit->circ_type = CIRCUIT_T_UNKNOWN;
hassof390d2c2004-09-10 20:48:21 +0000483 }
484
Josh Bailey3f045a02012-03-24 08:35:20 -0700485 circuit->ip_addrs = list_new ();
486#ifdef HAVE_IPV6
487 circuit->ipv6_link = list_new ();
488 circuit->ipv6_non_link = list_new ();
489#endif /* HAVE_IPV6 */
490
paul1eb8ef22005-04-07 07:30:20 +0000491 for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn))
492 isis_circuit_add_addr (circuit, conn);
jardineb5d44e2003-12-23 08:09:43 +0000493
494 return;
495}
496
497void
Josh Bailey3f045a02012-03-24 08:35:20 -0700498isis_circuit_if_del (struct isis_circuit *circuit, struct interface *ifp)
jardineb5d44e2003-12-23 08:09:43 +0000499{
Josh Bailey3f045a02012-03-24 08:35:20 -0700500 struct listnode *node, *nnode;
501 struct connected *conn;
hassof390d2c2004-09-10 20:48:21 +0000502
Josh Bailey3f045a02012-03-24 08:35:20 -0700503 assert (circuit->interface == ifp);
504
505 /* destroy addresses */
506 for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn))
507 isis_circuit_del_addr (circuit, conn);
508
509 if (circuit->ip_addrs)
hassof390d2c2004-09-10 20:48:21 +0000510 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700511 assert (listcount(circuit->ip_addrs) == 0);
512 list_delete (circuit->ip_addrs);
513 circuit->ip_addrs = NULL;
hassof390d2c2004-09-10 20:48:21 +0000514 }
jardineb5d44e2003-12-23 08:09:43 +0000515
Josh Bailey3f045a02012-03-24 08:35:20 -0700516#ifdef HAVE_IPV6
517 if (circuit->ipv6_link)
hassof390d2c2004-09-10 20:48:21 +0000518 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700519 assert (listcount(circuit->ipv6_link) == 0);
520 list_delete (circuit->ipv6_link);
521 circuit->ipv6_link = NULL;
jardineb5d44e2003-12-23 08:09:43 +0000522 }
jardineb5d44e2003-12-23 08:09:43 +0000523
Josh Bailey3f045a02012-03-24 08:35:20 -0700524 if (circuit->ipv6_non_link)
hassof390d2c2004-09-10 20:48:21 +0000525 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700526 assert (listcount(circuit->ipv6_non_link) == 0);
527 list_delete (circuit->ipv6_non_link);
528 circuit->ipv6_non_link = NULL;
hassof390d2c2004-09-10 20:48:21 +0000529 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700530#endif /* HAVE_IPV6 */
531
532 circuit->circ_type = CIRCUIT_T_UNKNOWN;
533 circuit->circuit_id = 0;
jardineb5d44e2003-12-23 08:09:43 +0000534
jardineb5d44e2003-12-23 08:09:43 +0000535 return;
536}
537
538void
Josh Bailey3f045a02012-03-24 08:35:20 -0700539isis_circuit_if_bind (struct isis_circuit *circuit, struct interface *ifp)
jardineb5d44e2003-12-23 08:09:43 +0000540{
Josh Bailey3f045a02012-03-24 08:35:20 -0700541 assert (circuit != NULL);
542 assert (ifp != NULL);
543 if (circuit->interface)
544 assert (circuit->interface == ifp);
545 else
546 circuit->interface = ifp;
547 if (ifp->info)
548 assert (ifp->info == circuit);
549 else
550 ifp->info = circuit;
551}
552
553void
554isis_circuit_if_unbind (struct isis_circuit *circuit, struct interface *ifp)
555{
556 assert (circuit != NULL);
557 assert (ifp != NULL);
558 assert (circuit->interface == ifp);
559 assert (ifp->info == circuit);
jardineb5d44e2003-12-23 08:09:43 +0000560 circuit->interface = NULL;
Josh Bailey3f045a02012-03-24 08:35:20 -0700561 ifp->info = NULL;
jardineb5d44e2003-12-23 08:09:43 +0000562}
563
Josh Bailey3f045a02012-03-24 08:35:20 -0700564static void
565isis_circuit_update_all_srmflags (struct isis_circuit *circuit, int is_set)
566{
567 struct isis_area *area;
568 struct isis_lsp *lsp;
569 dnode_t *dnode, *dnode_next;
570 int level;
571
572 assert (circuit);
573 area = circuit->area;
574 assert (area);
575 for (level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++)
576 {
577 if (level & circuit->is_type)
578 {
579 if (area->lspdb[level - 1] &&
580 dict_count (area->lspdb[level - 1]) > 0)
581 {
582 for (dnode = dict_first (area->lspdb[level - 1]);
583 dnode != NULL; dnode = dnode_next)
584 {
585 dnode_next = dict_next (area->lspdb[level - 1], dnode);
586 lsp = dnode_get (dnode);
587 if (is_set)
588 {
589 ISIS_SET_FLAG (lsp->SRMflags, circuit);
590 }
591 else
592 {
593 ISIS_CLEAR_FLAG (lsp->SRMflags, circuit);
594 }
595 }
596 }
597 }
598 }
599}
600
Christian Frankef1fc1db2015-11-10 18:43:31 +0100601size_t
602isis_circuit_pdu_size(struct isis_circuit *circuit)
603{
604 return ISO_MTU(circuit);
605}
606
607void
608isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream)
609{
610 size_t stream_size = isis_circuit_pdu_size(circuit);
611
612 if (!*stream)
613 {
614 *stream = stream_new(stream_size);
615 }
616 else
617 {
618 if (STREAM_SIZE(*stream) != stream_size)
619 stream_resize(*stream, stream_size);
620 stream_reset(*stream);
621 }
622}
623
Josh Bailey3f045a02012-03-24 08:35:20 -0700624int
jardineb5d44e2003-12-23 08:09:43 +0000625isis_circuit_up (struct isis_circuit *circuit)
626{
Josh Bailey3f045a02012-03-24 08:35:20 -0700627 int retv;
628
629 /* Set the flags for all the lsps of the circuit. */
630 isis_circuit_update_all_srmflags (circuit, 1);
631
632 if (circuit->state == C_STATE_UP)
633 return ISIS_OK;
634
635 if (circuit->is_passive)
636 return ISIS_OK;
jardineb5d44e2003-12-23 08:09:43 +0000637
Christian Frankef1fc1db2015-11-10 18:43:31 +0100638 if (circuit->area->lsp_mtu > isis_circuit_pdu_size(circuit))
639 {
640 zlog_err("Interface MTU %zu on %s is too low to support area lsp mtu %u!",
641 isis_circuit_pdu_size(circuit), circuit->interface->name,
642 circuit->area->lsp_mtu);
643 isis_circuit_down(circuit);
644 return ISIS_ERROR;
645 }
646
hassof390d2c2004-09-10 20:48:21 +0000647 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
648 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700649 /*
650 * Get the Hardware Address
651 */
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 Frankef1fc1db2015-11-10 18:43:31 +01001301 return rv;
jardineb5d44e2003-12-23 08:09:43 +00001302}
1303
1304DEFUN (no_ip_router_isis,
1305 no_ip_router_isis_cmd,
1306 "no ip router isis WORD",
1307 NO_STR
1308 "Interface Internet Protocol config commands\n"
1309 "IP router interface commands\n"
1310 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +00001311 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +00001312{
jardineb5d44e2003-12-23 08:09:43 +00001313 struct interface *ifp;
1314 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001315 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +00001316
hassof390d2c2004-09-10 20:48:21 +00001317 ifp = (struct interface *) vty->index;
Josh Bailey3f045a02012-03-24 08:35:20 -07001318 if (!ifp)
1319 {
1320 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1321 return CMD_ERR_NO_MATCH;
1322 }
hassof390d2c2004-09-10 20:48:21 +00001323
jardineb5d44e2003-12-23 08:09:43 +00001324 area = isis_area_lookup (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001325 if (!area)
1326 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001327 vty_out (vty, "Can't find ISIS instance %s%s",
1328 argv[0], VTY_NEWLINE);
1329 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001330 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001331
1332 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +00001333 if (!circuit)
1334 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001335 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1336 ifp->name, VTY_NEWLINE);
1337 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001338 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001339
jardineb5d44e2003-12-23 08:09:43 +00001340 circuit->ip_router = 0;
1341 area->ip_circuits--;
1342#ifdef HAVE_IPV6
1343 if (circuit->ipv6_router == 0)
1344#endif
1345 isis_csm_state_change (ISIS_DISABLE, circuit, area);
hassof390d2c2004-09-10 20:48:21 +00001346
jardineb5d44e2003-12-23 08:09:43 +00001347 return CMD_SUCCESS;
1348}
1349
Josh Bailey3f045a02012-03-24 08:35:20 -07001350#ifdef HAVE_IPV6
1351DEFUN (ipv6_router_isis,
1352 ipv6_router_isis_cmd,
1353 "ipv6 router isis WORD",
1354 "IPv6 interface subcommands\n"
1355 "IPv6 Router interface commands\n"
1356 "IS-IS Routing for IPv6\n"
1357 "Routing process tag\n")
1358{
1359 struct isis_circuit *circuit;
1360 struct interface *ifp;
1361 struct isis_area *area;
Christian Frankef1fc1db2015-11-10 18:43:31 +01001362 int rv;
Josh Bailey3f045a02012-03-24 08:35:20 -07001363
1364 ifp = (struct interface *) vty->index;
1365 assert (ifp);
1366
1367 /* Prevent more than one area per circuit */
1368 circuit = circuit_scan_by_ifp (ifp);
1369 if (circuit)
1370 {
1371 if (circuit->ipv6_router == 1)
1372 {
1373 if (strcmp (circuit->area->area_tag, argv[0]))
1374 {
1375 vty_out (vty, "ISIS circuit is already defined for IPv6 on %s%s",
1376 circuit->area->area_tag, VTY_NEWLINE);
1377 return CMD_ERR_NOTHING_TODO;
1378 }
1379 return CMD_SUCCESS;
1380 }
1381 }
1382
1383 if (isis_area_get (vty, argv[0]) != CMD_SUCCESS)
1384 {
1385 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1386 return CMD_ERR_NO_MATCH;
1387 }
1388 area = vty->index;
1389
1390 circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area);
Christian Frankef1fc1db2015-11-10 18:43:31 +01001391 if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP)
1392 {
1393 vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE);
1394 rv = CMD_WARNING;
1395 }
1396 else
1397 {
1398 isis_circuit_if_bind (circuit, ifp);
Josh Bailey3f045a02012-03-24 08:35:20 -07001399
Christian Frankef1fc1db2015-11-10 18:43:31 +01001400 circuit->ipv6_router = 1;
1401 area->ipv6_circuits++;
1402 circuit_update_nlpids (circuit);
1403 rv = CMD_SUCCESS;
1404 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001405
1406 vty->node = INTERFACE_NODE;
1407 vty->index = ifp;
1408
Christian Frankef1fc1db2015-11-10 18:43:31 +01001409 return rv;
Josh Bailey3f045a02012-03-24 08:35:20 -07001410}
1411
1412DEFUN (no_ipv6_router_isis,
1413 no_ipv6_router_isis_cmd,
1414 "no ipv6 router isis WORD",
1415 NO_STR
1416 "IPv6 interface subcommands\n"
1417 "IPv6 Router interface commands\n"
1418 "IS-IS Routing for IPv6\n"
1419 "Routing process tag\n")
1420{
1421 struct interface *ifp;
1422 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001423 struct isis_circuit *circuit;
1424
1425 ifp = (struct interface *) vty->index;
1426 if (!ifp)
1427 {
1428 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1429 return CMD_ERR_NO_MATCH;
1430 }
1431
1432 area = isis_area_lookup (argv[0]);
1433 if (!area)
1434 {
1435 vty_out (vty, "Can't find ISIS instance %s%s",
1436 argv[0], VTY_NEWLINE);
1437 return CMD_ERR_NO_MATCH;
1438 }
1439
1440 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
1441 if (!circuit)
1442 {
1443 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1444 ifp->name, VTY_NEWLINE);
1445 return CMD_ERR_NO_MATCH;
1446 }
1447
1448 circuit->ipv6_router = 0;
1449 area->ipv6_circuits--;
1450 if (circuit->ip_router == 0)
1451 isis_csm_state_change (ISIS_DISABLE, circuit, area);
1452
1453 return CMD_SUCCESS;
1454}
1455#endif /* HAVE_IPV6 */
1456
1457DEFUN (isis_passive,
1458 isis_passive_cmd,
1459 "isis passive",
1460 "IS-IS commands\n"
1461 "Configure the passive mode for interface\n")
1462{
1463 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1464 if (!circuit)
1465 return CMD_ERR_NO_MATCH;
1466
1467 if (circuit->is_passive == 1)
1468 return CMD_SUCCESS;
1469
1470 if (circuit->state != C_STATE_UP)
1471 {
1472 circuit->is_passive = 1;
1473 }
1474 else
1475 {
1476 struct isis_area *area = circuit->area;
1477 isis_csm_state_change (ISIS_DISABLE, circuit, area);
1478 circuit->is_passive = 1;
1479 isis_csm_state_change (ISIS_ENABLE, circuit, area);
1480 }
1481
1482 return CMD_SUCCESS;
1483}
1484
1485DEFUN (no_isis_passive,
1486 no_isis_passive_cmd,
1487 "no isis passive",
1488 NO_STR
1489 "IS-IS commands\n"
1490 "Configure the passive mode for interface\n")
1491{
1492 struct interface *ifp;
1493 struct isis_circuit *circuit;
1494
1495 ifp = (struct interface *) vty->index;
1496 if (!ifp)
1497 {
1498 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1499 return CMD_ERR_NO_MATCH;
1500 }
1501
1502 /* FIXME: what is wrong with circuit = ifp->info ? */
1503 circuit = circuit_scan_by_ifp (ifp);
1504 if (!circuit)
1505 {
1506 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1507 ifp->name, VTY_NEWLINE);
1508 return CMD_ERR_NO_MATCH;
1509 }
1510
1511 if (if_is_loopback(ifp))
1512 {
1513 vty_out (vty, "Can't set no passive for loopback interface%s",
1514 VTY_NEWLINE);
1515 return CMD_ERR_AMBIGUOUS;
1516 }
1517
1518 if (circuit->is_passive == 0)
1519 return CMD_SUCCESS;
1520
1521 if (circuit->state != C_STATE_UP)
1522 {
1523 circuit->is_passive = 0;
1524 }
1525 else
1526 {
1527 struct isis_area *area = circuit->area;
1528 isis_csm_state_change (ISIS_DISABLE, circuit, area);
1529 circuit->is_passive = 0;
1530 isis_csm_state_change (ISIS_ENABLE, circuit, area);
1531 }
1532
1533 return CMD_SUCCESS;
1534}
1535
jardineb5d44e2003-12-23 08:09:43 +00001536DEFUN (isis_circuit_type,
1537 isis_circuit_type_cmd,
1538 "isis circuit-type (level-1|level-1-2|level-2-only)",
1539 "IS-IS commands\n"
1540 "Configure circuit type for interface\n"
1541 "Level-1 only adjacencies are formed\n"
1542 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +00001543 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +00001544{
Josh Bailey3f045a02012-03-24 08:35:20 -07001545 int circuit_type;
1546 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1547 if (!circuit)
1548 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001549
Josh Bailey3f045a02012-03-24 08:35:20 -07001550 circuit_type = string2circuit_t (argv[0]);
1551 if (!circuit_type)
hassof390d2c2004-09-10 20:48:21 +00001552 {
1553 vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -07001554 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001555 }
1556
Josh Bailey3f045a02012-03-24 08:35:20 -07001557 if (circuit->state == C_STATE_UP &&
1558 circuit->area->is_type != IS_LEVEL_1_AND_2 &&
1559 circuit->area->is_type != circuit_type)
hassof390d2c2004-09-10 20:48:21 +00001560 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001561 vty_out (vty, "Invalid circuit level for area %s.%s",
1562 circuit->area->area_tag, VTY_NEWLINE);
1563 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001564 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001565 isis_event_circuit_type_change (circuit, circuit_type);
hassof390d2c2004-09-10 20:48:21 +00001566
jardineb5d44e2003-12-23 08:09:43 +00001567 return CMD_SUCCESS;
1568}
1569
1570DEFUN (no_isis_circuit_type,
1571 no_isis_circuit_type_cmd,
1572 "no isis circuit-type (level-1|level-1-2|level-2-only)",
1573 NO_STR
1574 "IS-IS commands\n"
1575 "Configure circuit type for interface\n"
1576 "Level-1 only adjacencies are formed\n"
1577 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +00001578 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +00001579{
Josh Bailey3f045a02012-03-24 08:35:20 -07001580 int circuit_type;
1581 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1582 if (!circuit)
1583 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001584
jardineb5d44e2003-12-23 08:09:43 +00001585 /*
Josh Bailey3f045a02012-03-24 08:35:20 -07001586 * Set the circuits level to its default value
jardineb5d44e2003-12-23 08:09:43 +00001587 */
Josh Bailey3f045a02012-03-24 08:35:20 -07001588 if (circuit->state == C_STATE_UP)
1589 circuit_type = circuit->area->is_type;
1590 else
1591 circuit_type = IS_LEVEL_1_AND_2;
1592 isis_event_circuit_type_change (circuit, circuit_type);
hassof390d2c2004-09-10 20:48:21 +00001593
jardineb5d44e2003-12-23 08:09:43 +00001594 return CMD_SUCCESS;
1595}
1596
Josh Bailey3f045a02012-03-24 08:35:20 -07001597DEFUN (isis_passwd_md5,
1598 isis_passwd_md5_cmd,
1599 "isis password md5 WORD",
jardineb5d44e2003-12-23 08:09:43 +00001600 "IS-IS commands\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001601 "Configure the authentication password for a circuit\n"
1602 "Authentication type\n"
1603 "Circuit password\n")
jardineb5d44e2003-12-23 08:09:43 +00001604{
jardineb5d44e2003-12-23 08:09:43 +00001605 int len;
Josh Bailey3f045a02012-03-24 08:35:20 -07001606 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1607 if (!circuit)
1608 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001609
jardineb5d44e2003-12-23 08:09:43 +00001610 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001611 if (len > 254)
1612 {
1613 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -07001614 return CMD_ERR_AMBIGUOUS;
1615 }
1616 circuit->passwd.len = len;
1617 circuit->passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
1618 strncpy ((char *)circuit->passwd.passwd, argv[0], 255);
1619
1620 return CMD_SUCCESS;
1621}
1622
1623DEFUN (isis_passwd_clear,
1624 isis_passwd_clear_cmd,
1625 "isis password clear WORD",
1626 "IS-IS commands\n"
1627 "Configure the authentication password for a circuit\n"
1628 "Authentication type\n"
1629 "Circuit password\n")
1630{
1631 int len;
1632 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1633 if (!circuit)
1634 return CMD_ERR_NO_MATCH;
1635
1636 len = strlen (argv[0]);
1637 if (len > 254)
1638 {
1639 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
1640 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001641 }
jardineb5d44e2003-12-23 08:09:43 +00001642 circuit->passwd.len = len;
1643 circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001644 strncpy ((char *)circuit->passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001645
jardineb5d44e2003-12-23 08:09:43 +00001646 return CMD_SUCCESS;
1647}
1648
1649DEFUN (no_isis_passwd,
1650 no_isis_passwd_cmd,
1651 "no isis password",
1652 NO_STR
1653 "IS-IS commands\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001654 "Configure the authentication password for a circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001655{
Josh Bailey3f045a02012-03-24 08:35:20 -07001656 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1657 if (!circuit)
1658 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001659
jardineb5d44e2003-12-23 08:09:43 +00001660 memset (&circuit->passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +00001661
jardineb5d44e2003-12-23 08:09:43 +00001662 return CMD_SUCCESS;
1663}
1664
jardineb5d44e2003-12-23 08:09:43 +00001665DEFUN (isis_priority,
1666 isis_priority_cmd,
1667 "isis priority <0-127>",
1668 "IS-IS commands\n"
1669 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001670 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001671{
jardineb5d44e2003-12-23 08:09:43 +00001672 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001673 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1674 if (!circuit)
1675 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001676
1677 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001678 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1679 {
1680 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1681 prio, VTY_NEWLINE);
1682 return CMD_ERR_AMBIGUOUS;
1683 }
jardineb5d44e2003-12-23 08:09:43 +00001684
Josh Bailey3f045a02012-03-24 08:35:20 -07001685 circuit->priority[0] = prio;
1686 circuit->priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001687
jardineb5d44e2003-12-23 08:09:43 +00001688 return CMD_SUCCESS;
1689}
1690
1691DEFUN (no_isis_priority,
1692 no_isis_priority_cmd,
1693 "no isis priority",
1694 NO_STR
1695 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001696 "Set priority for Designated Router election\n")
jardineb5d44e2003-12-23 08:09:43 +00001697{
Josh Bailey3f045a02012-03-24 08:35:20 -07001698 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1699 if (!circuit)
1700 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001701
Josh Bailey3f045a02012-03-24 08:35:20 -07001702 circuit->priority[0] = DEFAULT_PRIORITY;
1703 circuit->priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001704
jardineb5d44e2003-12-23 08:09:43 +00001705 return CMD_SUCCESS;
1706}
1707
1708ALIAS (no_isis_priority,
1709 no_isis_priority_arg_cmd,
1710 "no isis priority <0-127>",
1711 NO_STR
1712 "IS-IS commands\n"
1713 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001714 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001715
1716DEFUN (isis_priority_l1,
1717 isis_priority_l1_cmd,
hassof390d2c2004-09-10 20:48:21 +00001718 "isis priority <0-127> level-1",
jardineb5d44e2003-12-23 08:09:43 +00001719 "IS-IS commands\n"
1720 "Set priority for Designated Router election\n"
1721 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001722 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001723{
jardineb5d44e2003-12-23 08:09:43 +00001724 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001725 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1726 if (!circuit)
1727 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001728
1729 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001730 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1731 {
1732 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1733 prio, VTY_NEWLINE);
1734 return CMD_ERR_AMBIGUOUS;
1735 }
jardineb5d44e2003-12-23 08:09:43 +00001736
Josh Bailey3f045a02012-03-24 08:35:20 -07001737 circuit->priority[0] = prio;
hassof390d2c2004-09-10 20:48:21 +00001738
jardineb5d44e2003-12-23 08:09:43 +00001739 return CMD_SUCCESS;
1740}
1741
1742DEFUN (no_isis_priority_l1,
1743 no_isis_priority_l1_cmd,
1744 "no isis priority level-1",
1745 NO_STR
1746 "IS-IS commands\n"
1747 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001748 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001749{
Josh Bailey3f045a02012-03-24 08:35:20 -07001750 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1751 if (!circuit)
1752 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001753
Josh Bailey3f045a02012-03-24 08:35:20 -07001754 circuit->priority[0] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001755
jardineb5d44e2003-12-23 08:09:43 +00001756 return CMD_SUCCESS;
1757}
1758
1759ALIAS (no_isis_priority_l1,
1760 no_isis_priority_l1_arg_cmd,
1761 "no isis priority <0-127> level-1",
1762 NO_STR
1763 "IS-IS commands\n"
1764 "Set priority for Designated Router election\n"
1765 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001766 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001767
1768DEFUN (isis_priority_l2,
1769 isis_priority_l2_cmd,
hassof390d2c2004-09-10 20:48:21 +00001770 "isis priority <0-127> level-2",
jardineb5d44e2003-12-23 08:09:43 +00001771 "IS-IS commands\n"
1772 "Set priority for Designated Router election\n"
1773 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001774 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001775{
jardineb5d44e2003-12-23 08:09:43 +00001776 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001777 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1778 if (!circuit)
1779 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001780
1781 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001782 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1783 {
1784 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1785 prio, VTY_NEWLINE);
1786 return CMD_ERR_AMBIGUOUS;
1787 }
jardineb5d44e2003-12-23 08:09:43 +00001788
Josh Bailey3f045a02012-03-24 08:35:20 -07001789 circuit->priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001790
jardineb5d44e2003-12-23 08:09:43 +00001791 return CMD_SUCCESS;
1792}
1793
1794DEFUN (no_isis_priority_l2,
1795 no_isis_priority_l2_cmd,
1796 "no isis priority level-2",
1797 NO_STR
1798 "IS-IS commands\n"
1799 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001800 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001801{
Josh Bailey3f045a02012-03-24 08:35:20 -07001802 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1803 if (!circuit)
1804 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001805
Josh Bailey3f045a02012-03-24 08:35:20 -07001806 circuit->priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001807
jardineb5d44e2003-12-23 08:09:43 +00001808 return CMD_SUCCESS;
1809}
1810
1811ALIAS (no_isis_priority_l2,
1812 no_isis_priority_l2_arg_cmd,
1813 "no isis priority <0-127> level-2",
1814 NO_STR
1815 "IS-IS commands\n"
1816 "Set priority for Designated Router election\n"
1817 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001818 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001819
1820/* Metric command */
Josh Bailey3f045a02012-03-24 08:35:20 -07001821DEFUN (isis_metric,
jardineb5d44e2003-12-23 08:09:43 +00001822 isis_metric_cmd,
hassof21fb272005-09-26 17:05:55 +00001823 "isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001824 "IS-IS commands\n"
1825 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001826 "Default metric value\n")
jardineb5d44e2003-12-23 08:09:43 +00001827{
jardineb5d44e2003-12-23 08:09:43 +00001828 int met;
Josh Bailey3f045a02012-03-24 08:35:20 -07001829 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1830 if (!circuit)
1831 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001832
1833 met = atoi (argv[0]);
1834
Josh Bailey3f045a02012-03-24 08:35:20 -07001835 /* RFC3787 section 5.1 */
1836 if (circuit->area && circuit->area->oldmetric == 1 &&
1837 met > MAX_NARROW_LINK_METRIC)
1838 {
1839 vty_out (vty, "Invalid metric %d - should be <0-63> "
1840 "when narrow metric type enabled%s",
1841 met, VTY_NEWLINE);
1842 return CMD_ERR_AMBIGUOUS;
1843 }
1844
1845 /* RFC4444 */
1846 if (circuit->area && circuit->area->newmetric == 1 &&
1847 met > MAX_WIDE_LINK_METRIC)
1848 {
1849 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
1850 "when wide metric type enabled%s",
1851 met, VTY_NEWLINE);
1852 return CMD_ERR_AMBIGUOUS;
1853 }
1854
hassof21fb272005-09-26 17:05:55 +00001855 circuit->te_metric[0] = met;
1856 circuit->te_metric[1] = met;
1857
jardineb5d44e2003-12-23 08:09:43 +00001858 circuit->metrics[0].metric_default = met;
1859 circuit->metrics[1].metric_default = met;
1860
Josh Bailey3f045a02012-03-24 08:35:20 -07001861 if (circuit->area)
1862 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
1863
jardineb5d44e2003-12-23 08:09:43 +00001864 return CMD_SUCCESS;
1865}
1866
1867DEFUN (no_isis_metric,
1868 no_isis_metric_cmd,
1869 "no isis metric",
1870 NO_STR
1871 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001872 "Set default metric for circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001873{
Josh Bailey3f045a02012-03-24 08:35:20 -07001874 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1875 if (!circuit)
1876 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001877
Josh Bailey3f045a02012-03-24 08:35:20 -07001878 circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC;
1879 circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC;
1880 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC;
1881 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC;
jardineb5d44e2003-12-23 08:09:43 +00001882
Josh Bailey3f045a02012-03-24 08:35:20 -07001883 if (circuit->area)
1884 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
jardineb5d44e2003-12-23 08:09:43 +00001885
1886 return CMD_SUCCESS;
1887}
1888
1889ALIAS (no_isis_metric,
1890 no_isis_metric_arg_cmd,
hassof21fb272005-09-26 17:05:55 +00001891 "no isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001892 NO_STR
1893 "IS-IS commands\n"
1894 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001895 "Default metric value\n")
1896
Josh Bailey3f045a02012-03-24 08:35:20 -07001897DEFUN (isis_metric_l1,
1898 isis_metric_l1_cmd,
1899 "isis metric <0-16777215> level-1",
1900 "IS-IS commands\n"
1901 "Set default metric for circuit\n"
1902 "Default metric value\n"
1903 "Specify metric for level-1 routing\n")
1904{
1905 int met;
1906 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1907 if (!circuit)
1908 return CMD_ERR_NO_MATCH;
1909
1910 met = atoi (argv[0]);
1911
1912 /* RFC3787 section 5.1 */
1913 if (circuit->area && circuit->area->oldmetric == 1 &&
1914 met > MAX_NARROW_LINK_METRIC)
1915 {
1916 vty_out (vty, "Invalid metric %d - should be <0-63> "
1917 "when narrow metric type enabled%s",
1918 met, VTY_NEWLINE);
1919 return CMD_ERR_AMBIGUOUS;
1920 }
1921
1922 /* RFC4444 */
1923 if (circuit->area && circuit->area->newmetric == 1 &&
1924 met > MAX_WIDE_LINK_METRIC)
1925 {
1926 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
1927 "when wide metric type enabled%s",
1928 met, VTY_NEWLINE);
1929 return CMD_ERR_AMBIGUOUS;
1930 }
1931
1932 circuit->te_metric[0] = met;
1933 circuit->metrics[0].metric_default = met;
1934
1935 if (circuit->area)
1936 lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0);
1937
1938 return CMD_SUCCESS;
1939}
1940
1941DEFUN (no_isis_metric_l1,
1942 no_isis_metric_l1_cmd,
1943 "no isis metric level-1",
1944 NO_STR
1945 "IS-IS commands\n"
1946 "Set default metric for circuit\n"
1947 "Specify metric for level-1 routing\n")
1948{
1949 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1950 if (!circuit)
1951 return CMD_ERR_NO_MATCH;
1952
1953 circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC;
1954 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC;
1955
1956 if (circuit->area)
1957 lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0);
1958
1959 return CMD_SUCCESS;
1960}
1961
1962ALIAS (no_isis_metric_l1,
1963 no_isis_metric_l1_arg_cmd,
1964 "no isis metric <0-16777215> level-1",
1965 NO_STR
1966 "IS-IS commands\n"
1967 "Set default metric for circuit\n"
1968 "Default metric value\n"
1969 "Specify metric for level-1 routing\n")
1970
1971DEFUN (isis_metric_l2,
1972 isis_metric_l2_cmd,
1973 "isis metric <0-16777215> level-2",
1974 "IS-IS commands\n"
1975 "Set default metric for circuit\n"
1976 "Default metric value\n"
1977 "Specify metric for level-2 routing\n")
1978{
1979 int met;
1980 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1981 if (!circuit)
1982 return CMD_ERR_NO_MATCH;
1983
1984 met = atoi (argv[0]);
1985
1986 /* RFC3787 section 5.1 */
1987 if (circuit->area && circuit->area->oldmetric == 1 &&
1988 met > MAX_NARROW_LINK_METRIC)
1989 {
1990 vty_out (vty, "Invalid metric %d - should be <0-63> "
1991 "when narrow metric type enabled%s",
1992 met, VTY_NEWLINE);
1993 return CMD_ERR_AMBIGUOUS;
1994 }
1995
1996 /* RFC4444 */
1997 if (circuit->area && circuit->area->newmetric == 1 &&
1998 met > MAX_WIDE_LINK_METRIC)
1999 {
2000 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
2001 "when wide metric type enabled%s",
2002 met, VTY_NEWLINE);
2003 return CMD_ERR_AMBIGUOUS;
2004 }
2005
2006 circuit->te_metric[1] = met;
2007 circuit->metrics[1].metric_default = met;
2008
2009 if (circuit->area)
2010 lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0);
2011
2012 return CMD_SUCCESS;
2013}
2014
2015DEFUN (no_isis_metric_l2,
2016 no_isis_metric_l2_cmd,
2017 "no isis metric level-2",
2018 NO_STR
2019 "IS-IS commands\n"
2020 "Set default metric for circuit\n"
2021 "Specify metric for level-2 routing\n")
2022{
2023 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2024 if (!circuit)
2025 return CMD_ERR_NO_MATCH;
2026
2027 circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC;
2028 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC;
2029
2030 if (circuit->area)
2031 lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0);
2032
2033 return CMD_SUCCESS;
2034}
2035
2036ALIAS (no_isis_metric_l2,
2037 no_isis_metric_l2_arg_cmd,
2038 "no isis metric <0-16777215> level-2",
2039 NO_STR
2040 "IS-IS commands\n"
2041 "Set default metric for circuit\n"
2042 "Default metric value\n"
2043 "Specify metric for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00002044/* end of metrics */
Josh Bailey3f045a02012-03-24 08:35:20 -07002045
hassof21fb272005-09-26 17:05:55 +00002046DEFUN (isis_hello_interval,
jardineb5d44e2003-12-23 08:09:43 +00002047 isis_hello_interval_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002048 "isis hello-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002049 "IS-IS commands\n"
2050 "Set Hello interval\n"
2051 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00002052 "Holdtime 1 seconds, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00002053{
jardineb5d44e2003-12-23 08:09:43 +00002054 int interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002055 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2056 if (!circuit)
2057 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002058
Josh Bailey3f045a02012-03-24 08:35:20 -07002059 interval = atoi (argv[0]);
2060 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002061 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002062 vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s",
2063 interval, VTY_NEWLINE);
2064 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002065 }
jardineb5d44e2003-12-23 08:09:43 +00002066
hassof390d2c2004-09-10 20:48:21 +00002067 circuit->hello_interval[0] = (u_int16_t) interval;
2068 circuit->hello_interval[1] = (u_int16_t) interval;
2069
jardineb5d44e2003-12-23 08:09:43 +00002070 return CMD_SUCCESS;
2071}
2072
2073DEFUN (no_isis_hello_interval,
2074 no_isis_hello_interval_cmd,
2075 "no isis hello-interval",
2076 NO_STR
2077 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002078 "Set Hello interval\n")
jardineb5d44e2003-12-23 08:09:43 +00002079{
Josh Bailey3f045a02012-03-24 08:35:20 -07002080 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2081 if (!circuit)
2082 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002083
Josh Bailey3f045a02012-03-24 08:35:20 -07002084 circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL;
2085 circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002086
jardineb5d44e2003-12-23 08:09:43 +00002087 return CMD_SUCCESS;
2088}
2089
2090ALIAS (no_isis_hello_interval,
2091 no_isis_hello_interval_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002092 "no isis hello-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002093 NO_STR
2094 "IS-IS commands\n"
2095 "Set Hello interval\n"
2096 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00002097 "Holdtime 1 second, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00002098
2099DEFUN (isis_hello_interval_l1,
2100 isis_hello_interval_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002101 "isis hello-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002102 "IS-IS commands\n"
2103 "Set Hello interval\n"
2104 "Hello interval value\n"
2105 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002106 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002107{
jardineb5d44e2003-12-23 08:09:43 +00002108 long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002109 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2110 if (!circuit)
2111 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002112
Josh Bailey3f045a02012-03-24 08:35:20 -07002113 interval = atoi (argv[0]);
2114 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002115 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002116 vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
2117 interval, VTY_NEWLINE);
2118 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002119 }
jardineb5d44e2003-12-23 08:09:43 +00002120
hassof390d2c2004-09-10 20:48:21 +00002121 circuit->hello_interval[0] = (u_int16_t) interval;
2122
jardineb5d44e2003-12-23 08:09:43 +00002123 return CMD_SUCCESS;
2124}
2125
2126DEFUN (no_isis_hello_interval_l1,
2127 no_isis_hello_interval_l1_cmd,
2128 "no isis hello-interval level-1",
2129 NO_STR
2130 "IS-IS commands\n"
2131 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00002132 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002133{
Josh Bailey3f045a02012-03-24 08:35:20 -07002134 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2135 if (!circuit)
2136 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002137
Josh Bailey3f045a02012-03-24 08:35:20 -07002138 circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002139
jardineb5d44e2003-12-23 08:09:43 +00002140 return CMD_SUCCESS;
2141}
2142
2143ALIAS (no_isis_hello_interval_l1,
2144 no_isis_hello_interval_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002145 "no isis hello-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002146 NO_STR
2147 "IS-IS commands\n"
2148 "Set Hello interval\n"
2149 "Hello interval value\n"
2150 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002151 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002152
2153DEFUN (isis_hello_interval_l2,
2154 isis_hello_interval_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002155 "isis hello-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002156 "IS-IS commands\n"
2157 "Set Hello interval\n"
2158 "Hello interval value\n"
2159 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002160 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002161{
jardineb5d44e2003-12-23 08:09:43 +00002162 long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002163 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2164 if (!circuit)
2165 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002166
Josh Bailey3f045a02012-03-24 08:35:20 -07002167 interval = atoi (argv[0]);
2168 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002169 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002170 vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
2171 interval, VTY_NEWLINE);
2172 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002173 }
jardineb5d44e2003-12-23 08:09:43 +00002174
hassof390d2c2004-09-10 20:48:21 +00002175 circuit->hello_interval[1] = (u_int16_t) interval;
2176
jardineb5d44e2003-12-23 08:09:43 +00002177 return CMD_SUCCESS;
2178}
2179
2180DEFUN (no_isis_hello_interval_l2,
2181 no_isis_hello_interval_l2_cmd,
2182 "no isis hello-interval level-2",
2183 NO_STR
2184 "IS-IS commands\n"
2185 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00002186 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002187{
Josh Bailey3f045a02012-03-24 08:35:20 -07002188 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2189 if (!circuit)
2190 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002191
Josh Bailey3f045a02012-03-24 08:35:20 -07002192 circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002193
jardineb5d44e2003-12-23 08:09:43 +00002194 return CMD_SUCCESS;
2195}
2196
2197ALIAS (no_isis_hello_interval_l2,
2198 no_isis_hello_interval_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002199 "no isis hello-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002200 NO_STR
2201 "IS-IS commands\n"
2202 "Set Hello interval\n"
2203 "Hello interval value\n"
2204 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002205 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002206
2207DEFUN (isis_hello_multiplier,
2208 isis_hello_multiplier_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002209 "isis hello-multiplier <2-100>",
jardineb5d44e2003-12-23 08:09:43 +00002210 "IS-IS commands\n"
2211 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002212 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00002213{
jardineb5d44e2003-12-23 08:09:43 +00002214 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002215 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2216 if (!circuit)
2217 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002218
2219 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002220 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2221 {
2222 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2223 mult, VTY_NEWLINE);
2224 return CMD_ERR_AMBIGUOUS;
2225 }
jardineb5d44e2003-12-23 08:09:43 +00002226
hassof390d2c2004-09-10 20:48:21 +00002227 circuit->hello_multiplier[0] = (u_int16_t) mult;
2228 circuit->hello_multiplier[1] = (u_int16_t) mult;
2229
jardineb5d44e2003-12-23 08:09:43 +00002230 return CMD_SUCCESS;
2231}
2232
2233DEFUN (no_isis_hello_multiplier,
2234 no_isis_hello_multiplier_cmd,
2235 "no isis hello-multiplier",
2236 NO_STR
2237 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002238 "Set multiplier for Hello holding time\n")
jardineb5d44e2003-12-23 08:09:43 +00002239{
Josh Bailey3f045a02012-03-24 08:35:20 -07002240 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2241 if (!circuit)
2242 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002243
Josh Bailey3f045a02012-03-24 08:35:20 -07002244 circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER;
2245 circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002246
2247 return CMD_SUCCESS;
2248}
2249
2250ALIAS (no_isis_hello_multiplier,
2251 no_isis_hello_multiplier_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002252 "no isis hello-multiplier <2-100>",
jardineb5d44e2003-12-23 08:09:43 +00002253 NO_STR
2254 "IS-IS commands\n"
2255 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002256 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00002257
2258DEFUN (isis_hello_multiplier_l1,
2259 isis_hello_multiplier_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002260 "isis hello-multiplier <2-100> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002261 "IS-IS commands\n"
2262 "Set multiplier for Hello holding time\n"
2263 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002264 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002265{
jardineb5d44e2003-12-23 08:09:43 +00002266 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002267 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2268 if (!circuit)
2269 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002270
2271 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002272 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2273 {
2274 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2275 mult, VTY_NEWLINE);
2276 return CMD_ERR_AMBIGUOUS;
2277 }
jardineb5d44e2003-12-23 08:09:43 +00002278
hassof390d2c2004-09-10 20:48:21 +00002279 circuit->hello_multiplier[0] = (u_int16_t) mult;
2280
jardineb5d44e2003-12-23 08:09:43 +00002281 return CMD_SUCCESS;
2282}
2283
2284DEFUN (no_isis_hello_multiplier_l1,
2285 no_isis_hello_multiplier_l1_cmd,
2286 "no isis hello-multiplier level-1",
2287 NO_STR
2288 "IS-IS commands\n"
2289 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002290 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002291{
Josh Bailey3f045a02012-03-24 08:35:20 -07002292 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2293 if (!circuit)
2294 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002295
Josh Bailey3f045a02012-03-24 08:35:20 -07002296 circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002297
2298 return CMD_SUCCESS;
2299}
2300
2301ALIAS (no_isis_hello_multiplier_l1,
2302 no_isis_hello_multiplier_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002303 "no isis hello-multiplier <2-100> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002304 NO_STR
2305 "IS-IS commands\n"
2306 "Set multiplier for Hello holding time\n"
2307 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002308 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002309
2310DEFUN (isis_hello_multiplier_l2,
2311 isis_hello_multiplier_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002312 "isis hello-multiplier <2-100> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002313 "IS-IS commands\n"
2314 "Set multiplier for Hello holding time\n"
2315 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002316 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002317{
jardineb5d44e2003-12-23 08:09:43 +00002318 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002319 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2320 if (!circuit)
2321 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002322
2323 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002324 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2325 {
2326 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2327 mult, VTY_NEWLINE);
2328 return CMD_ERR_AMBIGUOUS;
2329 }
jardineb5d44e2003-12-23 08:09:43 +00002330
hassof390d2c2004-09-10 20:48:21 +00002331 circuit->hello_multiplier[1] = (u_int16_t) mult;
2332
jardineb5d44e2003-12-23 08:09:43 +00002333 return CMD_SUCCESS;
2334}
2335
2336DEFUN (no_isis_hello_multiplier_l2,
2337 no_isis_hello_multiplier_l2_cmd,
2338 "no isis hello-multiplier level-2",
2339 NO_STR
2340 "IS-IS commands\n"
2341 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002342 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002343{
Josh Bailey3f045a02012-03-24 08:35:20 -07002344 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2345 if (!circuit)
2346 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002347
Josh Bailey3f045a02012-03-24 08:35:20 -07002348 circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002349
2350 return CMD_SUCCESS;
2351}
2352
2353ALIAS (no_isis_hello_multiplier_l2,
2354 no_isis_hello_multiplier_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002355 "no isis hello-multiplier <2-100> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002356 NO_STR
2357 "IS-IS commands\n"
2358 "Set multiplier for Hello holding time\n"
2359 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002360 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002361
Josh Bailey3f045a02012-03-24 08:35:20 -07002362DEFUN (isis_hello_padding,
2363 isis_hello_padding_cmd,
jardineb5d44e2003-12-23 08:09:43 +00002364 "isis hello padding",
2365 "IS-IS commands\n"
2366 "Add padding to IS-IS hello packets\n"
2367 "Pad hello packets\n"
2368 "<cr>\n")
2369{
Josh Bailey3f045a02012-03-24 08:35:20 -07002370 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2371 if (!circuit)
2372 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002373
Josh Bailey3f045a02012-03-24 08:35:20 -07002374 circuit->pad_hellos = 1;
hassof390d2c2004-09-10 20:48:21 +00002375
jardineb5d44e2003-12-23 08:09:43 +00002376 return CMD_SUCCESS;
2377}
2378
Josh Bailey3f045a02012-03-24 08:35:20 -07002379DEFUN (no_isis_hello_padding,
2380 no_isis_hello_padding_cmd,
jardineb5d44e2003-12-23 08:09:43 +00002381 "no isis hello padding",
2382 NO_STR
2383 "IS-IS commands\n"
2384 "Add padding to IS-IS hello packets\n"
2385 "Pad hello packets\n"
2386 "<cr>\n")
2387{
Josh Bailey3f045a02012-03-24 08:35:20 -07002388 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2389 if (!circuit)
2390 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002391
Josh Bailey3f045a02012-03-24 08:35:20 -07002392 circuit->pad_hellos = 0;
hassof390d2c2004-09-10 20:48:21 +00002393
jardineb5d44e2003-12-23 08:09:43 +00002394 return CMD_SUCCESS;
2395}
2396
2397DEFUN (csnp_interval,
2398 csnp_interval_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002399 "isis csnp-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002400 "IS-IS commands\n"
2401 "Set CSNP interval in seconds\n"
2402 "CSNP interval value\n")
2403{
jardineb5d44e2003-12-23 08:09:43 +00002404 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002405 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2406 if (!circuit)
2407 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002408
jardineb5d44e2003-12-23 08:09:43 +00002409 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002410 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2411 {
2412 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2413 interval, VTY_NEWLINE);
2414 return CMD_ERR_AMBIGUOUS;
2415 }
jardineb5d44e2003-12-23 08:09:43 +00002416
hassof390d2c2004-09-10 20:48:21 +00002417 circuit->csnp_interval[0] = (u_int16_t) interval;
2418 circuit->csnp_interval[1] = (u_int16_t) interval;
2419
jardineb5d44e2003-12-23 08:09:43 +00002420 return CMD_SUCCESS;
2421}
2422
2423DEFUN (no_csnp_interval,
2424 no_csnp_interval_cmd,
2425 "no isis csnp-interval",
2426 NO_STR
2427 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002428 "Set CSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002429{
Josh Bailey3f045a02012-03-24 08:35:20 -07002430 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2431 if (!circuit)
2432 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002433
Josh Bailey3f045a02012-03-24 08:35:20 -07002434 circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL;
2435 circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002436
jardineb5d44e2003-12-23 08:09:43 +00002437 return CMD_SUCCESS;
2438}
2439
2440ALIAS (no_csnp_interval,
2441 no_csnp_interval_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002442 "no isis csnp-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002443 NO_STR
2444 "IS-IS commands\n"
2445 "Set CSNP interval in seconds\n"
2446 "CSNP interval value\n")
2447
jardineb5d44e2003-12-23 08:09:43 +00002448DEFUN (csnp_interval_l1,
2449 csnp_interval_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002450 "isis csnp-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002451 "IS-IS commands\n"
2452 "Set CSNP interval in seconds\n"
2453 "CSNP interval value\n"
2454 "Specify interval for level-1 CSNPs\n")
2455{
jardineb5d44e2003-12-23 08:09:43 +00002456 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002457 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2458 if (!circuit)
2459 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002460
jardineb5d44e2003-12-23 08:09:43 +00002461 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002462 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2463 {
2464 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2465 interval, VTY_NEWLINE);
2466 return CMD_ERR_AMBIGUOUS;
2467 }
hassof390d2c2004-09-10 20:48:21 +00002468
2469 circuit->csnp_interval[0] = (u_int16_t) interval;
2470
jardineb5d44e2003-12-23 08:09:43 +00002471 return CMD_SUCCESS;
2472}
2473
2474DEFUN (no_csnp_interval_l1,
2475 no_csnp_interval_l1_cmd,
2476 "no isis csnp-interval level-1",
2477 NO_STR
2478 "IS-IS commands\n"
2479 "Set CSNP interval in seconds\n"
2480 "Specify interval for level-1 CSNPs\n")
2481{
Josh Bailey3f045a02012-03-24 08:35:20 -07002482 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2483 if (!circuit)
2484 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002485
Josh Bailey3f045a02012-03-24 08:35:20 -07002486 circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002487
jardineb5d44e2003-12-23 08:09:43 +00002488 return CMD_SUCCESS;
2489}
2490
2491ALIAS (no_csnp_interval_l1,
2492 no_csnp_interval_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002493 "no isis csnp-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002494 NO_STR
2495 "IS-IS commands\n"
2496 "Set CSNP interval in seconds\n"
2497 "CSNP interval value\n"
2498 "Specify interval for level-1 CSNPs\n")
2499
jardineb5d44e2003-12-23 08:09:43 +00002500DEFUN (csnp_interval_l2,
2501 csnp_interval_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002502 "isis csnp-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002503 "IS-IS commands\n"
2504 "Set CSNP interval in seconds\n"
2505 "CSNP interval value\n"
2506 "Specify interval for level-2 CSNPs\n")
2507{
jardineb5d44e2003-12-23 08:09:43 +00002508 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002509 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2510 if (!circuit)
2511 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002512
jardineb5d44e2003-12-23 08:09:43 +00002513 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002514 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2515 {
2516 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2517 interval, VTY_NEWLINE);
2518 return CMD_ERR_AMBIGUOUS;
2519 }
hassof390d2c2004-09-10 20:48:21 +00002520
2521 circuit->csnp_interval[1] = (u_int16_t) interval;
2522
jardineb5d44e2003-12-23 08:09:43 +00002523 return CMD_SUCCESS;
2524}
2525
2526DEFUN (no_csnp_interval_l2,
2527 no_csnp_interval_l2_cmd,
2528 "no isis csnp-interval level-2",
2529 NO_STR
2530 "IS-IS commands\n"
2531 "Set CSNP interval in seconds\n"
2532 "Specify interval for level-2 CSNPs\n")
2533{
Josh Bailey3f045a02012-03-24 08:35:20 -07002534 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2535 if (!circuit)
2536 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002537
Josh Bailey3f045a02012-03-24 08:35:20 -07002538 circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002539
jardineb5d44e2003-12-23 08:09:43 +00002540 return CMD_SUCCESS;
2541}
2542
2543ALIAS (no_csnp_interval_l2,
2544 no_csnp_interval_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002545 "no isis csnp-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002546 NO_STR
2547 "IS-IS commands\n"
2548 "Set CSNP interval in seconds\n"
2549 "CSNP interval value\n"
2550 "Specify interval for level-2 CSNPs\n")
2551
Josh Bailey3f045a02012-03-24 08:35:20 -07002552DEFUN (psnp_interval,
2553 psnp_interval_cmd,
2554 "isis psnp-interval <1-120>",
2555 "IS-IS commands\n"
2556 "Set PSNP interval in seconds\n"
2557 "PSNP interval value\n")
jardineb5d44e2003-12-23 08:09:43 +00002558{
Josh Bailey3f045a02012-03-24 08:35:20 -07002559 unsigned long interval;
2560 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2561 if (!circuit)
2562 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002563
Josh Bailey3f045a02012-03-24 08:35:20 -07002564 interval = atol (argv[0]);
2565 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002566 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002567 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2568 interval, VTY_NEWLINE);
2569 return CMD_ERR_AMBIGUOUS;
jardineb5d44e2003-12-23 08:09:43 +00002570 }
jardineb5d44e2003-12-23 08:09:43 +00002571
Josh Bailey3f045a02012-03-24 08:35:20 -07002572 circuit->psnp_interval[0] = (u_int16_t) interval;
2573 circuit->psnp_interval[1] = (u_int16_t) interval;
jardineb5d44e2003-12-23 08:09:43 +00002574
2575 return CMD_SUCCESS;
2576}
2577
Josh Bailey3f045a02012-03-24 08:35:20 -07002578DEFUN (no_psnp_interval,
2579 no_psnp_interval_cmd,
2580 "no isis psnp-interval",
jardineb5d44e2003-12-23 08:09:43 +00002581 NO_STR
Josh Bailey3f045a02012-03-24 08:35:20 -07002582 "IS-IS commands\n"
2583 "Set PSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002584{
Josh Bailey3f045a02012-03-24 08:35:20 -07002585 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2586 if (!circuit)
2587 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002588
Josh Bailey3f045a02012-03-24 08:35:20 -07002589 circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL;
2590 circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL;
jardineb5d44e2003-12-23 08:09:43 +00002591
2592 return CMD_SUCCESS;
2593}
jardineb5d44e2003-12-23 08:09:43 +00002594
Josh Bailey3f045a02012-03-24 08:35:20 -07002595ALIAS (no_psnp_interval,
2596 no_psnp_interval_arg_cmd,
2597 "no isis psnp-interval <1-120>",
2598 NO_STR
2599 "IS-IS commands\n"
2600 "Set PSNP interval in seconds\n"
2601 "PSNP interval value\n")
2602
2603DEFUN (psnp_interval_l1,
2604 psnp_interval_l1_cmd,
2605 "isis psnp-interval <1-120> level-1",
2606 "IS-IS commands\n"
2607 "Set PSNP interval in seconds\n"
2608 "PSNP interval value\n"
2609 "Specify interval for level-1 PSNPs\n")
2610{
2611 unsigned long interval;
2612 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2613 if (!circuit)
2614 return CMD_ERR_NO_MATCH;
2615
2616 interval = atol (argv[0]);
2617 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
2618 {
2619 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2620 interval, VTY_NEWLINE);
2621 return CMD_ERR_AMBIGUOUS;
2622 }
2623
2624 circuit->psnp_interval[0] = (u_int16_t) interval;
2625
2626 return CMD_SUCCESS;
2627}
2628
2629DEFUN (no_psnp_interval_l1,
2630 no_psnp_interval_l1_cmd,
2631 "no isis psnp-interval level-1",
2632 NO_STR
2633 "IS-IS commands\n"
2634 "Set PSNP interval in seconds\n"
2635 "Specify interval for level-1 PSNPs\n")
2636{
2637 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2638 if (!circuit)
2639 return CMD_ERR_NO_MATCH;
2640
2641 circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL;
2642
2643 return CMD_SUCCESS;
2644}
2645
2646ALIAS (no_psnp_interval_l1,
2647 no_psnp_interval_l1_arg_cmd,
2648 "no isis psnp-interval <1-120> level-1",
2649 NO_STR
2650 "IS-IS commands\n"
2651 "Set PSNP interval in seconds\n"
2652 "PSNP interval value\n"
2653 "Specify interval for level-1 PSNPs\n")
2654
2655DEFUN (psnp_interval_l2,
2656 psnp_interval_l2_cmd,
2657 "isis psnp-interval <1-120> level-2",
2658 "IS-IS commands\n"
2659 "Set PSNP interval in seconds\n"
2660 "PSNP interval value\n"
2661 "Specify interval for level-2 PSNPs\n")
2662{
2663 unsigned long interval;
2664 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2665 if (!circuit)
2666 return CMD_ERR_NO_MATCH;
2667
2668 interval = atol (argv[0]);
2669 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
2670 {
2671 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2672 interval, VTY_NEWLINE);
2673 return CMD_ERR_AMBIGUOUS;
2674 }
2675
2676 circuit->psnp_interval[1] = (u_int16_t) interval;
2677
2678 return CMD_SUCCESS;
2679}
2680
2681DEFUN (no_psnp_interval_l2,
2682 no_psnp_interval_l2_cmd,
2683 "no isis psnp-interval level-2",
2684 NO_STR
2685 "IS-IS commands\n"
2686 "Set PSNP interval in seconds\n"
2687 "Specify interval for level-2 PSNPs\n")
2688{
2689 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2690 if (!circuit)
2691 return CMD_ERR_NO_MATCH;
2692
2693 circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL;
2694
2695 return CMD_SUCCESS;
2696}
2697
2698ALIAS (no_psnp_interval_l2,
2699 no_psnp_interval_l2_arg_cmd,
2700 "no isis psnp-interval <1-120> level-2",
2701 NO_STR
2702 "IS-IS commands\n"
2703 "Set PSNP interval in seconds\n"
2704 "PSNP interval value\n"
2705 "Specify interval for level-2 PSNPs\n")
2706
2707struct cmd_node interface_node = {
jardineb5d44e2003-12-23 08:09:43 +00002708 INTERFACE_NODE,
2709 "%s(config-if)# ",
2710 1,
2711};
2712
Josh Bailey3f045a02012-03-24 08:35:20 -07002713DEFUN (isis_network,
2714 isis_network_cmd,
2715 "isis network point-to-point",
2716 "IS-IS commands\n"
2717 "Set network type\n"
2718 "point-to-point network type\n")
2719{
2720 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2721 if (!circuit)
2722 return CMD_ERR_NO_MATCH;
2723
2724 /* RFC5309 section 4 */
2725 if (circuit->circ_type == CIRCUIT_T_P2P)
2726 return CMD_SUCCESS;
2727
2728 if (circuit->state != C_STATE_UP)
2729 {
2730 circuit->circ_type = CIRCUIT_T_P2P;
2731 circuit->circ_type_config = CIRCUIT_T_P2P;
2732 }
2733 else
2734 {
2735 struct isis_area *area = circuit->area;
2736 if (!if_is_broadcast (circuit->interface))
2737 {
2738 vty_out (vty, "isis network point-to-point "
2739 "is valid only on broadcast interfaces%s",
2740 VTY_NEWLINE);
2741 return CMD_ERR_AMBIGUOUS;
2742 }
2743
2744 isis_csm_state_change (ISIS_DISABLE, circuit, area);
2745 circuit->circ_type = CIRCUIT_T_P2P;
2746 circuit->circ_type_config = CIRCUIT_T_P2P;
2747 isis_csm_state_change (ISIS_ENABLE, circuit, area);
2748 }
2749
2750 return CMD_SUCCESS;
2751}
2752
2753DEFUN (no_isis_network,
2754 no_isis_network_cmd,
2755 "no isis network point-to-point",
2756 NO_STR
2757 "IS-IS commands\n"
2758 "Set network type for circuit\n"
2759 "point-to-point network type\n")
2760{
2761 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2762 if (!circuit)
2763 return CMD_ERR_NO_MATCH;
2764
2765 /* RFC5309 section 4 */
2766 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
2767 return CMD_SUCCESS;
2768
2769 if (circuit->state != C_STATE_UP)
2770 {
2771 circuit->circ_type = CIRCUIT_T_BROADCAST;
2772 circuit->circ_type_config = CIRCUIT_T_BROADCAST;
2773 }
2774 else
2775 {
2776 struct isis_area *area = circuit->area;
2777 if (circuit->interface &&
2778 !if_is_broadcast (circuit->interface))
2779 {
2780 vty_out (vty, "no isis network point-to-point "
2781 "is valid only on broadcast interfaces%s",
2782 VTY_NEWLINE);
2783 return CMD_ERR_AMBIGUOUS;
2784 }
2785
2786 isis_csm_state_change (ISIS_DISABLE, circuit, area);
2787 circuit->circ_type = CIRCUIT_T_BROADCAST;
2788 circuit->circ_type_config = CIRCUIT_T_BROADCAST;
2789 isis_csm_state_change (ISIS_ENABLE, circuit, area);
2790 }
2791
2792 return CMD_SUCCESS;
2793}
2794
jardineb5d44e2003-12-23 08:09:43 +00002795int
2796isis_if_new_hook (struct interface *ifp)
2797{
jardineb5d44e2003-12-23 08:09:43 +00002798 return 0;
2799}
2800
2801int
2802isis_if_delete_hook (struct interface *ifp)
2803{
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002804 struct isis_circuit *circuit;
2805 /* Clean up the circuit data */
2806 if (ifp && ifp->info)
2807 {
2808 circuit = ifp->info;
2809 isis_csm_state_change (IF_DOWN_FROM_Z, circuit, circuit->area);
2810 isis_csm_state_change (ISIS_DISABLE, circuit, circuit->area);
2811 }
2812
jardineb5d44e2003-12-23 08:09:43 +00002813 return 0;
2814}
2815
jardineb5d44e2003-12-23 08:09:43 +00002816void
2817isis_circuit_init ()
2818{
jardineb5d44e2003-12-23 08:09:43 +00002819 /* Initialize Zebra interface data structure */
jardineb5d44e2003-12-23 08:09:43 +00002820 if_add_hook (IF_NEW_HOOK, isis_if_new_hook);
2821 if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook);
2822
2823 /* Install interface node */
2824 install_node (&interface_node, isis_interface_config_write);
2825 install_element (CONFIG_NODE, &interface_cmd);
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002826 install_element (CONFIG_NODE, &no_interface_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002827
2828 install_default (INTERFACE_NODE);
2829 install_element (INTERFACE_NODE, &interface_desc_cmd);
2830 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
2831
2832 install_element (INTERFACE_NODE, &ip_router_isis_cmd);
2833 install_element (INTERFACE_NODE, &no_ip_router_isis_cmd);
2834
Josh Bailey3f045a02012-03-24 08:35:20 -07002835 install_element (INTERFACE_NODE, &isis_passive_cmd);
2836 install_element (INTERFACE_NODE, &no_isis_passive_cmd);
2837
jardineb5d44e2003-12-23 08:09:43 +00002838 install_element (INTERFACE_NODE, &isis_circuit_type_cmd);
2839 install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd);
2840
Josh Bailey3f045a02012-03-24 08:35:20 -07002841 install_element (INTERFACE_NODE, &isis_passwd_clear_cmd);
2842 install_element (INTERFACE_NODE, &isis_passwd_md5_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002843 install_element (INTERFACE_NODE, &no_isis_passwd_cmd);
2844
2845 install_element (INTERFACE_NODE, &isis_priority_cmd);
2846 install_element (INTERFACE_NODE, &no_isis_priority_cmd);
2847 install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd);
2848 install_element (INTERFACE_NODE, &isis_priority_l1_cmd);
2849 install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd);
2850 install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd);
2851 install_element (INTERFACE_NODE, &isis_priority_l2_cmd);
2852 install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd);
2853 install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd);
2854
2855 install_element (INTERFACE_NODE, &isis_metric_cmd);
2856 install_element (INTERFACE_NODE, &no_isis_metric_cmd);
2857 install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07002858 install_element (INTERFACE_NODE, &isis_metric_l1_cmd);
2859 install_element (INTERFACE_NODE, &no_isis_metric_l1_cmd);
2860 install_element (INTERFACE_NODE, &no_isis_metric_l1_arg_cmd);
2861 install_element (INTERFACE_NODE, &isis_metric_l2_cmd);
2862 install_element (INTERFACE_NODE, &no_isis_metric_l2_cmd);
2863 install_element (INTERFACE_NODE, &no_isis_metric_l2_arg_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002864
2865 install_element (INTERFACE_NODE, &isis_hello_interval_cmd);
2866 install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd);
2867 install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd);
2868 install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd);
2869 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd);
2870 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd);
2871 install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd);
2872 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd);
2873 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd);
2874
2875 install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd);
2876 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
2877 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd);
2878 install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd);
2879 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd);
2880 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd);
2881 install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd);
2882 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd);
2883 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd);
2884
Josh Bailey3f045a02012-03-24 08:35:20 -07002885 install_element (INTERFACE_NODE, &isis_hello_padding_cmd);
2886 install_element (INTERFACE_NODE, &no_isis_hello_padding_cmd);
2887
jardineb5d44e2003-12-23 08:09:43 +00002888 install_element (INTERFACE_NODE, &csnp_interval_cmd);
2889 install_element (INTERFACE_NODE, &no_csnp_interval_cmd);
2890 install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd);
2891 install_element (INTERFACE_NODE, &csnp_interval_l1_cmd);
2892 install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd);
2893 install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd);
2894 install_element (INTERFACE_NODE, &csnp_interval_l2_cmd);
2895 install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd);
2896 install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd);
2897
Josh Bailey3f045a02012-03-24 08:35:20 -07002898 install_element (INTERFACE_NODE, &psnp_interval_cmd);
2899 install_element (INTERFACE_NODE, &no_psnp_interval_cmd);
2900 install_element (INTERFACE_NODE, &no_psnp_interval_arg_cmd);
2901 install_element (INTERFACE_NODE, &psnp_interval_l1_cmd);
2902 install_element (INTERFACE_NODE, &no_psnp_interval_l1_cmd);
2903 install_element (INTERFACE_NODE, &no_psnp_interval_l1_arg_cmd);
2904 install_element (INTERFACE_NODE, &psnp_interval_l2_cmd);
2905 install_element (INTERFACE_NODE, &no_psnp_interval_l2_cmd);
2906 install_element (INTERFACE_NODE, &no_psnp_interval_l2_arg_cmd);
2907
2908 install_element (INTERFACE_NODE, &isis_network_cmd);
2909 install_element (INTERFACE_NODE, &no_isis_network_cmd);
2910
jardineb5d44e2003-12-23 08:09:43 +00002911#ifdef HAVE_IPV6
2912 install_element (INTERFACE_NODE, &ipv6_router_isis_cmd);
2913 install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002914#endif
jardineb5d44e2003-12-23 08:09:43 +00002915}