blob: 30aa9260506c88826b17458cb262af63d3dcd414 [file] [log] [blame]
jardineb5d44e2003-12-23 08:09:43 +00001/*
2 * IS-IS Rout(e)ing protocol - isis_circuit.h
3 *
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public Licenseas published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
jardineb5d44e2003-12-23 08:09:43 +000022#include <zebra.h>
hasso37da8c02004-05-19 11:38:40 +000023#ifdef GNU_LINUX
jardineb5d44e2003-12-23 08:09:43 +000024#include <net/ethernet.h>
hasso37da8c02004-05-19 11:38:40 +000025#else
26#include <netinet/if_ether.h>
27#endif
jardineb5d44e2003-12-23 08:09:43 +000028
Paul Jakma238497f2007-08-07 18:49:18 +000029#ifndef ETHER_ADDR_LEN
30#define ETHER_ADDR_LEN ETHERADDRL
31#endif
32
jardineb5d44e2003-12-23 08:09:43 +000033#include "log.h"
34#include "memory.h"
35#include "if.h"
36#include "linklist.h"
37#include "command.h"
38#include "thread.h"
39#include "hash.h"
40#include "prefix.h"
41#include "stream.h"
42
43#include "isisd/dict.h"
44#include "isisd/include-netbsd/iso.h"
45#include "isisd/isis_constants.h"
46#include "isisd/isis_common.h"
Josh Bailey3f045a02012-03-24 08:35:20 -070047#include "isisd/isis_flags.h"
jardineb5d44e2003-12-23 08:09:43 +000048#include "isisd/isis_circuit.h"
49#include "isisd/isis_tlv.h"
50#include "isisd/isis_lsp.h"
51#include "isisd/isis_pdu.h"
52#include "isisd/isis_network.h"
53#include "isisd/isis_misc.h"
54#include "isisd/isis_constants.h"
55#include "isisd/isis_adjacency.h"
56#include "isisd/isis_dr.h"
jardineb5d44e2003-12-23 08:09:43 +000057#include "isisd/isisd.h"
58#include "isisd/isis_csm.h"
59#include "isisd/isis_events.h"
60
Paul Jakma41b36e92006-12-08 01:09:50 +000061/*
62 * Prototypes.
63 */
Paul Jakma41b36e92006-12-08 01:09:50 +000064int isis_interface_config_write(struct vty *);
65int isis_if_new_hook(struct interface *);
66int isis_if_delete_hook(struct interface *);
67
jardineb5d44e2003-12-23 08:09:43 +000068struct isis_circuit *
69isis_circuit_new ()
70{
71 struct isis_circuit *circuit;
72 int i;
73
hasso3fdb2dd2005-09-28 18:45:54 +000074 circuit = XCALLOC (MTYPE_ISIS_CIRCUIT, sizeof (struct isis_circuit));
Josh Bailey3f045a02012-03-24 08:35:20 -070075 if (circuit == NULL)
hassof390d2c2004-09-10 20:48:21 +000076 {
77 zlog_err ("Can't malloc isis circuit");
78 return NULL;
79 }
80
Josh Bailey3f045a02012-03-24 08:35:20 -070081 /*
82 * Default values
83 */
84 circuit->is_type = IS_LEVEL_1_AND_2;
85 circuit->flags = 0;
86 circuit->pad_hellos = 1;
87 for (i = 0; i < 2; i++)
88 {
89 circuit->hello_interval[i] = DEFAULT_HELLO_INTERVAL;
90 circuit->hello_multiplier[i] = DEFAULT_HELLO_MULTIPLIER;
91 circuit->csnp_interval[i] = DEFAULT_CSNP_INTERVAL;
92 circuit->psnp_interval[i] = DEFAULT_PSNP_INTERVAL;
93 circuit->priority[i] = DEFAULT_PRIORITY;
94 circuit->metrics[i].metric_default = DEFAULT_CIRCUIT_METRIC;
95 circuit->metrics[i].metric_expense = METRICS_UNSUPPORTED;
96 circuit->metrics[i].metric_error = METRICS_UNSUPPORTED;
97 circuit->metrics[i].metric_delay = METRICS_UNSUPPORTED;
98 circuit->te_metric[i] = DEFAULT_CIRCUIT_METRIC;
99 }
100
jardineb5d44e2003-12-23 08:09:43 +0000101 return circuit;
102}
103
jardineb5d44e2003-12-23 08:09:43 +0000104void
Josh Bailey3f045a02012-03-24 08:35:20 -0700105isis_circuit_del (struct isis_circuit *circuit)
106{
107 if (!circuit)
108 return;
109
110 isis_circuit_if_unbind (circuit, circuit->interface);
111
112 /* and lastly the circuit itself */
113 XFREE (MTYPE_ISIS_CIRCUIT, circuit);
114
115 return;
116}
117
118void
jardineb5d44e2003-12-23 08:09:43 +0000119isis_circuit_configure (struct isis_circuit *circuit, struct isis_area *area)
120{
Josh Bailey3f045a02012-03-24 08:35:20 -0700121 assert (area);
jardineb5d44e2003-12-23 08:09:43 +0000122 circuit->area = area;
Josh Bailey3f045a02012-03-24 08:35:20 -0700123
jardineb5d44e2003-12-23 08:09:43 +0000124 /*
Christian Franke7324ae12015-11-10 18:04:48 +0100125 * Whenever the is-type of an area is changed, the is-type of each circuit
126 * in that area is updated to a non-empty subset of the area is-type.
127 * Inversely, when configuring a new circuit, this property should be
128 * ensured as well.
jardineb5d44e2003-12-23 08:09:43 +0000129 */
Christian Franke7324ae12015-11-10 18:04:48 +0100130 if (area->is_type != IS_LEVEL_1_AND_2)
131 circuit->is_type = area->is_type;
jardineb5d44e2003-12-23 08:09:43 +0000132
133 /*
134 * Add the circuit into area
135 */
136 listnode_add (area->circuit_list, circuit);
137
138 circuit->idx = flags_get_index (&area->flags);
jardineb5d44e2003-12-23 08:09:43 +0000139
140 return;
141}
142
hassof390d2c2004-09-10 20:48:21 +0000143void
Josh Bailey3f045a02012-03-24 08:35:20 -0700144isis_circuit_deconfigure (struct isis_circuit *circuit, struct isis_area *area)
jardineb5d44e2003-12-23 08:09:43 +0000145{
jardineb5d44e2003-12-23 08:09:43 +0000146 /* Free the index of SRM and SSN flags */
147 flags_free_index (&area->flags, circuit->idx);
Josh Bailey3f045a02012-03-24 08:35:20 -0700148 circuit->idx = 0;
149 /* Remove circuit from area */
150 assert (circuit->area == area);
151 listnode_delete (area->circuit_list, circuit);
152 circuit->area = NULL;
jardineb5d44e2003-12-23 08:09:43 +0000153
154 return;
155}
156
157struct isis_circuit *
158circuit_lookup_by_ifp (struct interface *ifp, struct list *list)
159{
160 struct isis_circuit *circuit = NULL;
161 struct listnode *node;
hassof390d2c2004-09-10 20:48:21 +0000162
jardineb5d44e2003-12-23 08:09:43 +0000163 if (!list)
164 return NULL;
hassof390d2c2004-09-10 20:48:21 +0000165
paul1eb8ef22005-04-07 07:30:20 +0000166 for (ALL_LIST_ELEMENTS_RO (list, node, circuit))
167 if (circuit->interface == ifp)
Josh Bailey3f045a02012-03-24 08:35:20 -0700168 {
169 assert (ifp->info == circuit);
170 return circuit;
171 }
172
jardineb5d44e2003-12-23 08:09:43 +0000173 return NULL;
174}
175
176struct isis_circuit *
177circuit_scan_by_ifp (struct interface *ifp)
178{
179 struct isis_area *area;
180 struct listnode *node;
181 struct isis_circuit *circuit;
182
Josh Bailey3f045a02012-03-24 08:35:20 -0700183 if (ifp->info)
184 return (struct isis_circuit *)ifp->info;
jardineb5d44e2003-12-23 08:09:43 +0000185
Josh Bailey3f045a02012-03-24 08:35:20 -0700186 if (isis->area_list)
hassof390d2c2004-09-10 20:48:21 +0000187 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700188 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
189 {
190 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
191 if (circuit)
192 return circuit;
193 }
hassof390d2c2004-09-10 20:48:21 +0000194 }
jardineb5d44e2003-12-23 08:09:43 +0000195 return circuit_lookup_by_ifp (ifp, isis->init_circ_list);
196}
197
Josh Bailey3f045a02012-03-24 08:35:20 -0700198static struct isis_circuit *
199isis_circuit_lookup (struct vty *vty)
jardineb5d44e2003-12-23 08:09:43 +0000200{
Josh Bailey3f045a02012-03-24 08:35:20 -0700201 struct interface *ifp;
202 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +0000203
Josh Bailey3f045a02012-03-24 08:35:20 -0700204 ifp = (struct interface *) vty->index;
205 if (!ifp)
hassof390d2c2004-09-10 20:48:21 +0000206 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700207 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
208 return NULL;
hassof390d2c2004-09-10 20:48:21 +0000209 }
hassof390d2c2004-09-10 20:48:21 +0000210
Josh Bailey3f045a02012-03-24 08:35:20 -0700211 circuit = circuit_scan_by_ifp (ifp);
212 if (!circuit)
213 {
214 vty_out (vty, "ISIS is not enabled on circuit %s%s",
215 ifp->name, VTY_NEWLINE);
216 return NULL;
217 }
jardineb5d44e2003-12-23 08:09:43 +0000218
Josh Bailey3f045a02012-03-24 08:35:20 -0700219 return circuit;
jardineb5d44e2003-12-23 08:09:43 +0000220}
221
222void
hassof891f442004-09-14 13:54:30 +0000223isis_circuit_add_addr (struct isis_circuit *circuit,
224 struct connected *connected)
jardineb5d44e2003-12-23 08:09:43 +0000225{
Josh Bailey3f045a02012-03-24 08:35:20 -0700226 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000227 struct prefix_ipv4 *ipv4;
hassof390d2c2004-09-10 20:48:21 +0000228 u_char buf[BUFSIZ];
jardineb5d44e2003-12-23 08:09:43 +0000229#ifdef HAVE_IPV6
230 struct prefix_ipv6 *ipv6;
231#endif /* HAVE_IPV6 */
hassof891f442004-09-14 13:54:30 +0000232
jardineb5d44e2003-12-23 08:09:43 +0000233 memset (&buf, 0, BUFSIZ);
hassof891f442004-09-14 13:54:30 +0000234 if (connected->address->family == AF_INET)
hassof390d2c2004-09-10 20:48:21 +0000235 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700236 u_int32_t addr = connected->address->u.prefix4.s_addr;
237 addr = ntohl (addr);
238 if (IPV4_NET0(addr) ||
239 IPV4_NET127(addr) ||
240 IN_CLASSD(addr) ||
241 IPV4_LINKLOCAL(addr))
242 return;
243
244 for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ipv4))
245 if (prefix_same ((struct prefix *) ipv4, connected->address))
246 return;
247
hassof390d2c2004-09-10 20:48:21 +0000248 ipv4 = prefix_ipv4_new ();
hassof891f442004-09-14 13:54:30 +0000249 ipv4->prefixlen = connected->address->prefixlen;
250 ipv4->prefix = connected->address->u.prefix4;
hassof390d2c2004-09-10 20:48:21 +0000251 listnode_add (circuit->ip_addrs, ipv4);
hasso0dae85e2004-09-26 19:53:47 +0000252 if (circuit->area)
Josh Bailey3f045a02012-03-24 08:35:20 -0700253 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
hassof891f442004-09-14 13:54:30 +0000254
jardineb5d44e2003-12-23 08:09:43 +0000255#ifdef EXTREME_DEBUG
hassof891f442004-09-14 13:54:30 +0000256 prefix2str (connected->address, buf, BUFSIZ);
hasso529d65b2004-12-24 00:14:50 +0000257 zlog_debug ("Added IP address %s to circuit %d", buf,
hassof390d2c2004-09-10 20:48:21 +0000258 circuit->circuit_id);
259#endif /* EXTREME_DEBUG */
jardineb5d44e2003-12-23 08:09:43 +0000260 }
hassof390d2c2004-09-10 20:48:21 +0000261#ifdef HAVE_IPV6
hassof891f442004-09-14 13:54:30 +0000262 if (connected->address->family == AF_INET6)
hassof390d2c2004-09-10 20:48:21 +0000263 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700264 if (IN6_IS_ADDR_LOOPBACK(&connected->address->u.prefix6))
265 return;
266
267 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_link, node, ipv6))
268 if (prefix_same ((struct prefix *) ipv6, connected->address))
269 return;
270 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, node, ipv6))
271 if (prefix_same ((struct prefix *) ipv6, connected->address))
272 return;
273
hassof390d2c2004-09-10 20:48:21 +0000274 ipv6 = prefix_ipv6_new ();
hassof891f442004-09-14 13:54:30 +0000275 ipv6->prefixlen = connected->address->prefixlen;
276 ipv6->prefix = connected->address->u.prefix6;
277
hassof390d2c2004-09-10 20:48:21 +0000278 if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix))
hassof891f442004-09-14 13:54:30 +0000279 listnode_add (circuit->ipv6_link, ipv6);
hassof390d2c2004-09-10 20:48:21 +0000280 else
hassof891f442004-09-14 13:54:30 +0000281 listnode_add (circuit->ipv6_non_link, ipv6);
hasso0dae85e2004-09-26 19:53:47 +0000282 if (circuit->area)
Josh Bailey3f045a02012-03-24 08:35:20 -0700283 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
hassof891f442004-09-14 13:54:30 +0000284
jardineb5d44e2003-12-23 08:09:43 +0000285#ifdef EXTREME_DEBUG
hassof891f442004-09-14 13:54:30 +0000286 prefix2str (connected->address, buf, BUFSIZ);
hasso529d65b2004-12-24 00:14:50 +0000287 zlog_debug ("Added IPv6 address %s to circuit %d", buf,
hassof390d2c2004-09-10 20:48:21 +0000288 circuit->circuit_id);
289#endif /* EXTREME_DEBUG */
290 }
jardineb5d44e2003-12-23 08:09:43 +0000291#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000292 return;
293}
294
295void
296isis_circuit_del_addr (struct isis_circuit *circuit,
hassof390d2c2004-09-10 20:48:21 +0000297 struct connected *connected)
jardineb5d44e2003-12-23 08:09:43 +0000298{
hassof891f442004-09-14 13:54:30 +0000299 struct prefix_ipv4 *ipv4, *ip = NULL;
300 struct listnode *node;
hassof891f442004-09-14 13:54:30 +0000301 u_char buf[BUFSIZ];
302#ifdef HAVE_IPV6
303 struct prefix_ipv6 *ipv6, *ip6 = NULL;
Paul Jakma41b36e92006-12-08 01:09:50 +0000304 int found = 0;
hassof891f442004-09-14 13:54:30 +0000305#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000306
hassof891f442004-09-14 13:54:30 +0000307 memset (&buf, 0, BUFSIZ);
308 if (connected->address->family == AF_INET)
309 {
310 ipv4 = prefix_ipv4_new ();
311 ipv4->prefixlen = connected->address->prefixlen;
312 ipv4->prefix = connected->address->u.prefix4;
313
paul1eb8ef22005-04-07 07:30:20 +0000314 for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip))
Josh Bailey3f045a02012-03-24 08:35:20 -0700315 if (prefix_same ((struct prefix *) ip, (struct prefix *) ipv4))
paul1eb8ef22005-04-07 07:30:20 +0000316 break;
hassof891f442004-09-14 13:54:30 +0000317
318 if (ip)
319 {
320 listnode_delete (circuit->ip_addrs, ip);
Josh Bailey3f045a02012-03-24 08:35:20 -0700321 if (circuit->area)
322 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
hassof891f442004-09-14 13:54:30 +0000323 }
324 else
325 {
hassof7c43dc2004-09-26 16:24:14 +0000326 prefix2str (connected->address, (char *)buf, BUFSIZ);
Josh Bailey3f045a02012-03-24 08:35:20 -0700327 zlog_warn ("Nonexitant ip address %s removal attempt from \
328 circuit %d", buf, circuit->circuit_id);
Christian Frankeec874162015-11-10 18:33:12 +0100329 zlog_warn ("Current ip addresses on %s:", circuit->interface->name);
330 for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node, ip))
331 {
332 prefix2str((struct prefix*)ip, (char *)buf, BUFSIZ);
333 zlog_warn(" %s", buf);
334 }
335 zlog_warn("End of addresses");
hassof891f442004-09-14 13:54:30 +0000336 }
David Lampartere8aca322012-11-27 01:10:30 +0000337
338 prefix_ipv4_free (ipv4);
hassof891f442004-09-14 13:54:30 +0000339 }
340#ifdef HAVE_IPV6
341 if (connected->address->family == AF_INET6)
342 {
343 ipv6 = prefix_ipv6_new ();
344 ipv6->prefixlen = connected->address->prefixlen;
345 ipv6->prefix = connected->address->u.prefix6;
346
347 if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix))
348 {
paul1eb8ef22005-04-07 07:30:20 +0000349 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_link, node, ip6))
hassof891f442004-09-14 13:54:30 +0000350 {
hassof891f442004-09-14 13:54:30 +0000351 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
352 break;
353 }
354 if (ip6)
355 {
356 listnode_delete (circuit->ipv6_link, ip6);
357 found = 1;
358 }
359 }
360 else
361 {
paul1eb8ef22005-04-07 07:30:20 +0000362 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, node, ip6))
hassof891f442004-09-14 13:54:30 +0000363 {
hassof891f442004-09-14 13:54:30 +0000364 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
365 break;
366 }
367 if (ip6)
368 {
369 listnode_delete (circuit->ipv6_non_link, ip6);
370 found = 1;
371 }
372 }
373
374 if (!found)
375 {
hassof7c43dc2004-09-26 16:24:14 +0000376 prefix2str (connected->address, (char *)buf, BUFSIZ);
Josh Bailey3f045a02012-03-24 08:35:20 -0700377 zlog_warn ("Nonexitant ip address %s removal attempt from \
378 circuit %d", buf, circuit->circuit_id);
Christian Frankeec874162015-11-10 18:33:12 +0100379 zlog_warn ("Current ip addresses on %s:", circuit->interface->name);
380 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node, ip6))
381 {
382 prefix2str((struct prefix*)ip6, (char *)buf, BUFSIZ);
383 zlog_warn(" %s", buf);
384 }
385 zlog_warn(" -----");
386 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node, ip6))
387 {
388 prefix2str((struct prefix*)ip6, (char *)buf, BUFSIZ);
389 zlog_warn(" %s", buf);
390 }
391 zlog_warn("End of addresses");
hassof891f442004-09-14 13:54:30 +0000392 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700393 else if (circuit->area)
394 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
David Lampartere8aca322012-11-27 01:10:30 +0000395
396 prefix_ipv6_free (ipv6);
hassof891f442004-09-14 13:54:30 +0000397 }
398#endif /* HAVE_IPV6 */
399 return;
jardineb5d44e2003-12-23 08:09:43 +0000400}
401
Josh Bailey3f045a02012-03-24 08:35:20 -0700402static u_char
403isis_circuit_id_gen (struct interface *ifp)
404{
405 u_char id = 0;
406 char ifname[16];
407 unsigned int i;
408 int start = -1, end = -1;
409
410 /*
411 * Get a stable circuit id from ifname. This makes
412 * the ifindex from flapping when netdevs are created
413 * and deleted on the fly. Note that this circuit id
414 * is used in pseudo lsps so it is better to be stable.
415 * The following code works on any reasonanle ifname
416 * like: eth1 or trk-1.1 etc.
417 */
418 for (i = 0; i < strlen (ifp->name); i++)
419 {
David Lamparter52f02b42015-04-10 09:14:30 +0200420 if (isdigit((unsigned char)ifp->name[i]))
Josh Bailey3f045a02012-03-24 08:35:20 -0700421 {
422 if (start < 0)
423 {
424 start = i;
425 end = i + 1;
426 }
427 else
428 {
429 end = i + 1;
430 }
431 }
432 else if (start >= 0)
433 break;
434 }
435
436 if ((start >= 0) && (end >= start) && (end - start) < 16)
437 {
438 memset (ifname, 0, 16);
439 strncpy (ifname, &ifp->name[start], end - start);
440 id = (u_char)atoi(ifname);
441 }
442
443 /* Try to be unique. */
444 if (!id)
445 id = (u_char)((ifp->ifindex & 0xff) | 0x80);
446
447 return id;
448}
449
jardineb5d44e2003-12-23 08:09:43 +0000450void
451isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp)
452{
paul1eb8ef22005-04-07 07:30:20 +0000453 struct listnode *node, *nnode;
jardineb5d44e2003-12-23 08:09:43 +0000454 struct connected *conn;
455
Josh Bailey3f045a02012-03-24 08:35:20 -0700456 circuit->circuit_id = isis_circuit_id_gen (ifp);
hassof390d2c2004-09-10 20:48:21 +0000457
Josh Bailey3f045a02012-03-24 08:35:20 -0700458 isis_circuit_if_bind (circuit, ifp);
jardineb5d44e2003-12-23 08:09:43 +0000459 /* isis_circuit_update_addrs (circuit, ifp); */
460
hassof390d2c2004-09-10 20:48:21 +0000461 if (if_is_broadcast (ifp))
462 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700463 if (circuit->circ_type_config == CIRCUIT_T_P2P)
464 circuit->circ_type = CIRCUIT_T_P2P;
hassof390d2c2004-09-10 20:48:21 +0000465 else
Josh Bailey3f045a02012-03-24 08:35:20 -0700466 circuit->circ_type = CIRCUIT_T_BROADCAST;
hassof390d2c2004-09-10 20:48:21 +0000467 }
468 else if (if_is_pointopoint (ifp))
469 {
470 circuit->circ_type = CIRCUIT_T_P2P;
471 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700472 else if (if_is_loopback (ifp))
473 {
474 circuit->circ_type = CIRCUIT_T_LOOPBACK;
475 circuit->is_passive = 1;
476 }
hassof390d2c2004-09-10 20:48:21 +0000477 else
478 {
hassoc89c05d2005-09-04 21:36:36 +0000479 /* It's normal in case of loopback etc. */
480 if (isis->debugs & DEBUG_EVENTS)
Josh Bailey3f045a02012-03-24 08:35:20 -0700481 zlog_debug ("isis_circuit_if_add: unsupported media");
482 circuit->circ_type = CIRCUIT_T_UNKNOWN;
hassof390d2c2004-09-10 20:48:21 +0000483 }
484
Josh Bailey3f045a02012-03-24 08:35:20 -0700485 circuit->ip_addrs = list_new ();
486#ifdef HAVE_IPV6
487 circuit->ipv6_link = list_new ();
488 circuit->ipv6_non_link = list_new ();
489#endif /* HAVE_IPV6 */
490
paul1eb8ef22005-04-07 07:30:20 +0000491 for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn))
492 isis_circuit_add_addr (circuit, conn);
jardineb5d44e2003-12-23 08:09:43 +0000493
494 return;
495}
496
497void
Josh Bailey3f045a02012-03-24 08:35:20 -0700498isis_circuit_if_del (struct isis_circuit *circuit, struct interface *ifp)
jardineb5d44e2003-12-23 08:09:43 +0000499{
Josh Bailey3f045a02012-03-24 08:35:20 -0700500 struct listnode *node, *nnode;
501 struct connected *conn;
hassof390d2c2004-09-10 20:48:21 +0000502
Josh Bailey3f045a02012-03-24 08:35:20 -0700503 assert (circuit->interface == ifp);
504
505 /* destroy addresses */
506 for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn))
507 isis_circuit_del_addr (circuit, conn);
508
509 if (circuit->ip_addrs)
hassof390d2c2004-09-10 20:48:21 +0000510 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700511 assert (listcount(circuit->ip_addrs) == 0);
512 list_delete (circuit->ip_addrs);
513 circuit->ip_addrs = NULL;
hassof390d2c2004-09-10 20:48:21 +0000514 }
jardineb5d44e2003-12-23 08:09:43 +0000515
Josh Bailey3f045a02012-03-24 08:35:20 -0700516#ifdef HAVE_IPV6
517 if (circuit->ipv6_link)
hassof390d2c2004-09-10 20:48:21 +0000518 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700519 assert (listcount(circuit->ipv6_link) == 0);
520 list_delete (circuit->ipv6_link);
521 circuit->ipv6_link = NULL;
jardineb5d44e2003-12-23 08:09:43 +0000522 }
jardineb5d44e2003-12-23 08:09:43 +0000523
Josh Bailey3f045a02012-03-24 08:35:20 -0700524 if (circuit->ipv6_non_link)
hassof390d2c2004-09-10 20:48:21 +0000525 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700526 assert (listcount(circuit->ipv6_non_link) == 0);
527 list_delete (circuit->ipv6_non_link);
528 circuit->ipv6_non_link = NULL;
hassof390d2c2004-09-10 20:48:21 +0000529 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700530#endif /* HAVE_IPV6 */
531
532 circuit->circ_type = CIRCUIT_T_UNKNOWN;
533 circuit->circuit_id = 0;
jardineb5d44e2003-12-23 08:09:43 +0000534
jardineb5d44e2003-12-23 08:09:43 +0000535 return;
536}
537
538void
Josh Bailey3f045a02012-03-24 08:35:20 -0700539isis_circuit_if_bind (struct isis_circuit *circuit, struct interface *ifp)
jardineb5d44e2003-12-23 08:09:43 +0000540{
Josh Bailey3f045a02012-03-24 08:35:20 -0700541 assert (circuit != NULL);
542 assert (ifp != NULL);
543 if (circuit->interface)
544 assert (circuit->interface == ifp);
545 else
546 circuit->interface = ifp;
547 if (ifp->info)
548 assert (ifp->info == circuit);
549 else
550 ifp->info = circuit;
551}
552
553void
554isis_circuit_if_unbind (struct isis_circuit *circuit, struct interface *ifp)
555{
556 assert (circuit != NULL);
557 assert (ifp != NULL);
558 assert (circuit->interface == ifp);
559 assert (ifp->info == circuit);
jardineb5d44e2003-12-23 08:09:43 +0000560 circuit->interface = NULL;
Josh Bailey3f045a02012-03-24 08:35:20 -0700561 ifp->info = NULL;
jardineb5d44e2003-12-23 08:09:43 +0000562}
563
Josh Bailey3f045a02012-03-24 08:35:20 -0700564static void
565isis_circuit_update_all_srmflags (struct isis_circuit *circuit, int is_set)
566{
567 struct isis_area *area;
568 struct isis_lsp *lsp;
569 dnode_t *dnode, *dnode_next;
570 int level;
571
572 assert (circuit);
573 area = circuit->area;
574 assert (area);
575 for (level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++)
576 {
577 if (level & circuit->is_type)
578 {
579 if (area->lspdb[level - 1] &&
580 dict_count (area->lspdb[level - 1]) > 0)
581 {
582 for (dnode = dict_first (area->lspdb[level - 1]);
583 dnode != NULL; dnode = dnode_next)
584 {
585 dnode_next = dict_next (area->lspdb[level - 1], dnode);
586 lsp = dnode_get (dnode);
587 if (is_set)
588 {
589 ISIS_SET_FLAG (lsp->SRMflags, circuit);
590 }
591 else
592 {
593 ISIS_CLEAR_FLAG (lsp->SRMflags, circuit);
594 }
595 }
596 }
597 }
598 }
599}
600
Christian Frankef1fc1db2015-11-10 18:43:31 +0100601size_t
602isis_circuit_pdu_size(struct isis_circuit *circuit)
603{
604 return ISO_MTU(circuit);
605}
606
607void
608isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream)
609{
610 size_t stream_size = isis_circuit_pdu_size(circuit);
611
612 if (!*stream)
613 {
614 *stream = stream_new(stream_size);
615 }
616 else
617 {
618 if (STREAM_SIZE(*stream) != stream_size)
619 stream_resize(*stream, stream_size);
620 stream_reset(*stream);
621 }
622}
623
Josh Bailey3f045a02012-03-24 08:35:20 -0700624int
jardineb5d44e2003-12-23 08:09:43 +0000625isis_circuit_up (struct isis_circuit *circuit)
626{
Josh Bailey3f045a02012-03-24 08:35:20 -0700627 int retv;
628
629 /* Set the flags for all the lsps of the circuit. */
630 isis_circuit_update_all_srmflags (circuit, 1);
631
632 if (circuit->state == C_STATE_UP)
633 return ISIS_OK;
634
635 if (circuit->is_passive)
636 return ISIS_OK;
jardineb5d44e2003-12-23 08:09:43 +0000637
Christian Frankef1fc1db2015-11-10 18:43:31 +0100638 if (circuit->area->lsp_mtu > isis_circuit_pdu_size(circuit))
639 {
640 zlog_err("Interface MTU %zu on %s is too low to support area lsp mtu %u!",
641 isis_circuit_pdu_size(circuit), circuit->interface->name,
642 circuit->area->lsp_mtu);
643 isis_circuit_down(circuit);
644 return ISIS_ERROR;
645 }
646
hassof390d2c2004-09-10 20:48:21 +0000647 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
648 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700649 /*
650 * Get the Hardware Address
651 */
652#ifdef HAVE_STRUCT_SOCKADDR_DL
653#ifndef SUNOS_5
654 if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN)
655 zlog_warn ("unsupported link layer");
656 else
657 memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl),
658 ETH_ALEN);
659#endif
660#else
661 if (circuit->interface->hw_addr_len != ETH_ALEN)
662 {
663 zlog_warn ("unsupported link layer");
664 }
665 else
666 {
667 memcpy (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN);
668 }
669#ifdef EXTREME_DEGUG
670 zlog_debug ("isis_circuit_if_add: if_id %d, isomtu %d snpa %s",
671 circuit->interface->ifindex, ISO_MTU (circuit),
672 snpa_print (circuit->u.bc.snpa));
673#endif /* EXTREME_DEBUG */
674#endif /* HAVE_STRUCT_SOCKADDR_DL */
675
676 circuit->u.bc.adjdb[0] = list_new ();
677 circuit->u.bc.adjdb[1] = list_new ();
678
hassof390d2c2004-09-10 20:48:21 +0000679 /*
680 * ISO 10589 - 8.4.1 Enabling of broadcast circuits
681 */
jardineb5d44e2003-12-23 08:09:43 +0000682
hassof390d2c2004-09-10 20:48:21 +0000683 /* initilizing the hello sending threads
684 * for a broadcast IF
685 */
jardineb5d44e2003-12-23 08:09:43 +0000686
hassof390d2c2004-09-10 20:48:21 +0000687 /* 8.4.1 a) commence sending of IIH PDUs */
688
Josh Bailey3f045a02012-03-24 08:35:20 -0700689 if (circuit->is_type & IS_LEVEL_1)
690 {
691 thread_add_event (master, send_lan_l1_hello, circuit, 0);
692 circuit->u.bc.lan_neighs[0] = list_new ();
693 }
hassof390d2c2004-09-10 20:48:21 +0000694
Josh Bailey3f045a02012-03-24 08:35:20 -0700695 if (circuit->is_type & IS_LEVEL_2)
696 {
697 thread_add_event (master, send_lan_l2_hello, circuit, 0);
698 circuit->u.bc.lan_neighs[1] = list_new ();
699 }
hassof390d2c2004-09-10 20:48:21 +0000700
701 /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */
702 /* 8.4.1 c) FIXME: listen for ESH PDUs */
703
704 /* 8.4.1 d) */
705 /* dr election will commence in... */
Josh Bailey3f045a02012-03-24 08:35:20 -0700706 if (circuit->is_type & IS_LEVEL_1)
707 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
708 circuit, 2 * circuit->hello_interval[0]);
709 if (circuit->is_type & IS_LEVEL_2)
710 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
711 circuit, 2 * circuit->hello_interval[1]);
jardineb5d44e2003-12-23 08:09:43 +0000712 }
hassof390d2c2004-09-10 20:48:21 +0000713 else
714 {
715 /* initializing the hello send threads
716 * for a ptp IF
717 */
Josh Bailey3f045a02012-03-24 08:35:20 -0700718 circuit->u.p2p.neighbor = NULL;
hassof390d2c2004-09-10 20:48:21 +0000719 thread_add_event (master, send_p2p_hello, circuit, 0);
jardineb5d44e2003-12-23 08:09:43 +0000720 }
721
jardineb5d44e2003-12-23 08:09:43 +0000722 /* initializing PSNP timers */
Josh Bailey3f045a02012-03-24 08:35:20 -0700723 if (circuit->is_type & IS_LEVEL_1)
724 THREAD_TIMER_ON (master, circuit->t_send_psnp[0], send_l1_psnp, circuit,
725 isis_jitter (circuit->psnp_interval[0], PSNP_JITTER));
726
727 if (circuit->is_type & IS_LEVEL_2)
728 THREAD_TIMER_ON (master, circuit->t_send_psnp[1], send_l2_psnp, circuit,
729 isis_jitter (circuit->psnp_interval[1], PSNP_JITTER));
730
731 /* unified init for circuits; ignore warnings below this level */
732 retv = isis_sock_init (circuit);
733 if (retv != ISIS_OK)
hassof390d2c2004-09-10 20:48:21 +0000734 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700735 isis_circuit_down (circuit);
736 return retv;
hassof390d2c2004-09-10 20:48:21 +0000737 }
738
Josh Bailey3f045a02012-03-24 08:35:20 -0700739 /* initialize the circuit streams after opening connection */
Christian Frankef1fc1db2015-11-10 18:43:31 +0100740 isis_circuit_stream(circuit, &circuit->rcv_stream);
741 isis_circuit_stream(circuit, &circuit->snd_stream);
jardineb5d44e2003-12-23 08:09:43 +0000742
jardineb5d44e2003-12-23 08:09:43 +0000743#ifdef GNU_LINUX
hassof390d2c2004-09-10 20:48:21 +0000744 THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit,
Josh Bailey3f045a02012-03-24 08:35:20 -0700745 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000746#else
hassof390d2c2004-09-10 20:48:21 +0000747 THREAD_TIMER_ON (master, circuit->t_read, isis_receive, circuit,
Josh Bailey3f045a02012-03-24 08:35:20 -0700748 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000749#endif
Josh Bailey3f045a02012-03-24 08:35:20 -0700750
751 circuit->lsp_queue = list_new ();
752 circuit->lsp_queue_last_cleared = time (NULL);
753
754 return ISIS_OK;
jardineb5d44e2003-12-23 08:09:43 +0000755}
756
757void
758isis_circuit_down (struct isis_circuit *circuit)
759{
Josh Bailey3f045a02012-03-24 08:35:20 -0700760 if (circuit->state != C_STATE_UP)
761 return;
762
763 /* Clear the flags for all the lsps of the circuit. */
764 isis_circuit_update_all_srmflags (circuit, 0);
765
hassof390d2c2004-09-10 20:48:21 +0000766 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
767 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700768 /* destroy neighbour lists */
769 if (circuit->u.bc.lan_neighs[0])
770 {
771 list_delete (circuit->u.bc.lan_neighs[0]);
772 circuit->u.bc.lan_neighs[0] = NULL;
773 }
774 if (circuit->u.bc.lan_neighs[1])
775 {
776 list_delete (circuit->u.bc.lan_neighs[1]);
777 circuit->u.bc.lan_neighs[1] = NULL;
778 }
779 /* destroy adjacency databases */
780 if (circuit->u.bc.adjdb[0])
781 {
782 circuit->u.bc.adjdb[0]->del = isis_delete_adj;
783 list_delete (circuit->u.bc.adjdb[0]);
784 circuit->u.bc.adjdb[0] = NULL;
785 }
786 if (circuit->u.bc.adjdb[1])
787 {
788 circuit->u.bc.adjdb[1]->del = isis_delete_adj;
789 list_delete (circuit->u.bc.adjdb[1]);
790 circuit->u.bc.adjdb[1] = NULL;
791 }
792 if (circuit->u.bc.is_dr[0])
793 {
794 isis_dr_resign (circuit, 1);
795 circuit->u.bc.is_dr[0] = 0;
796 }
797 memset (circuit->u.bc.l1_desig_is, 0, ISIS_SYS_ID_LEN + 1);
798 if (circuit->u.bc.is_dr[1])
799 {
800 isis_dr_resign (circuit, 2);
801 circuit->u.bc.is_dr[1] = 0;
802 }
803 memset (circuit->u.bc.l2_desig_is, 0, ISIS_SYS_ID_LEN + 1);
804 memset (circuit->u.bc.snpa, 0, ETH_ALEN);
805
hassof390d2c2004-09-10 20:48:21 +0000806 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[0]);
807 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[1]);
hassof891f442004-09-14 13:54:30 +0000808 THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[0]);
809 THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[1]);
Josh Bailey3f045a02012-03-24 08:35:20 -0700810 THREAD_TIMER_OFF (circuit->u.bc.t_refresh_pseudo_lsp[0]);
811 THREAD_TIMER_OFF (circuit->u.bc.t_refresh_pseudo_lsp[1]);
Christian Franke61010c32015-11-10 18:43:34 +0100812 circuit->lsp_regenerate_pending[0] = 0;
813 circuit->lsp_regenerate_pending[1] = 0;
hassof390d2c2004-09-10 20:48:21 +0000814 }
815 else if (circuit->circ_type == CIRCUIT_T_P2P)
816 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700817 isis_delete_adj (circuit->u.p2p.neighbor);
818 circuit->u.p2p.neighbor = NULL;
hassof390d2c2004-09-10 20:48:21 +0000819 THREAD_TIMER_OFF (circuit->u.p2p.t_send_p2p_hello);
820 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700821
822 /* Cancel all active threads */
823 THREAD_TIMER_OFF (circuit->t_send_csnp[0]);
824 THREAD_TIMER_OFF (circuit->t_send_csnp[1]);
825 THREAD_TIMER_OFF (circuit->t_send_psnp[0]);
826 THREAD_TIMER_OFF (circuit->t_send_psnp[1]);
827 THREAD_OFF (circuit->t_read);
828
829 if (circuit->lsp_queue)
830 {
831 circuit->lsp_queue->del = NULL;
832 list_delete (circuit->lsp_queue);
833 circuit->lsp_queue = NULL;
834 }
835
836 /* send one gratuitous hello to spead up convergence */
837 if (circuit->is_type & IS_LEVEL_1)
838 send_hello (circuit, IS_LEVEL_1);
839 if (circuit->is_type & IS_LEVEL_2)
840 send_hello (circuit, IS_LEVEL_2);
841
842 circuit->upadjcount[0] = 0;
843 circuit->upadjcount[1] = 0;
844
jardineb5d44e2003-12-23 08:09:43 +0000845 /* close the socket */
Josh Bailey3f045a02012-03-24 08:35:20 -0700846 if (circuit->fd)
847 {
848 close (circuit->fd);
849 circuit->fd = 0;
850 }
851
852 if (circuit->rcv_stream != NULL)
853 {
854 stream_free (circuit->rcv_stream);
855 circuit->rcv_stream = NULL;
856 }
857
858 if (circuit->snd_stream != NULL)
859 {
860 stream_free (circuit->snd_stream);
861 circuit->snd_stream = NULL;
862 }
863
864 thread_cancel_event (master, circuit);
jardineb5d44e2003-12-23 08:09:43 +0000865
866 return;
867}
868
869void
870circuit_update_nlpids (struct isis_circuit *circuit)
871{
872 circuit->nlpids.count = 0;
hassof390d2c2004-09-10 20:48:21 +0000873
874 if (circuit->ip_router)
875 {
876 circuit->nlpids.nlpids[0] = NLPID_IP;
877 circuit->nlpids.count++;
878 }
jardineb5d44e2003-12-23 08:09:43 +0000879#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000880 if (circuit->ipv6_router)
881 {
882 circuit->nlpids.nlpids[circuit->nlpids.count] = NLPID_IPV6;
883 circuit->nlpids.count++;
884 }
jardineb5d44e2003-12-23 08:09:43 +0000885#endif /* HAVE_IPV6 */
886 return;
887}
888
Josh Bailey3f045a02012-03-24 08:35:20 -0700889void
890isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty,
891 char detail)
892{
893 if (detail == ISIS_UI_LEVEL_BRIEF)
894 {
895 vty_out (vty, " %-12s", circuit->interface->name);
896 vty_out (vty, "0x%-7x", circuit->circuit_id);
897 vty_out (vty, "%-9s", circuit_state2string (circuit->state));
898 vty_out (vty, "%-9s", circuit_type2string (circuit->circ_type));
899 vty_out (vty, "%-9s", circuit_t2string (circuit->is_type));
900 vty_out (vty, "%s", VTY_NEWLINE);
901 }
902
903 if (detail == ISIS_UI_LEVEL_DETAIL)
904 {
905 vty_out (vty, " Interface: %s", circuit->interface->name);
906 vty_out (vty, ", State: %s", circuit_state2string (circuit->state));
907 if (circuit->is_passive)
908 vty_out (vty, ", Passive");
909 else
910 vty_out (vty, ", Active");
911 vty_out (vty, ", Circuit Id: 0x%x", circuit->circuit_id);
912 vty_out (vty, "%s", VTY_NEWLINE);
913 vty_out (vty, " Type: %s", circuit_type2string (circuit->circ_type));
914 vty_out (vty, ", Level: %s", circuit_t2string (circuit->is_type));
915 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
916 vty_out (vty, ", SNPA: %-10s", snpa_print (circuit->u.bc.snpa));
917 vty_out (vty, "%s", VTY_NEWLINE);
918 if (circuit->is_type & IS_LEVEL_1)
919 {
920 vty_out (vty, " Level-1 Information:%s", VTY_NEWLINE);
921 if (circuit->area->newmetric)
922 vty_out (vty, " Metric: %d", circuit->te_metric[0]);
923 else
924 vty_out (vty, " Metric: %d",
925 circuit->metrics[0].metric_default);
926 if (!circuit->is_passive)
927 {
928 vty_out (vty, ", Active neighbors: %u%s",
929 circuit->upadjcount[0], VTY_NEWLINE);
930 vty_out (vty, " Hello interval: %u, "
931 "Holddown count: %u %s%s",
932 circuit->hello_interval[0],
933 circuit->hello_multiplier[0],
934 (circuit->pad_hellos ? "(pad)" : "(no-pad)"),
935 VTY_NEWLINE);
936 vty_out (vty, " CNSP interval: %u, "
937 "PSNP interval: %u%s",
938 circuit->csnp_interval[0],
939 circuit->psnp_interval[0], VTY_NEWLINE);
940 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
941 vty_out (vty, " LAN Priority: %u, %s%s",
942 circuit->priority[0],
943 (circuit->u.bc.is_dr[0] ? \
944 "is DIS" : "is not DIS"), VTY_NEWLINE);
945 }
946 else
947 {
948 vty_out (vty, "%s", VTY_NEWLINE);
949 }
950 }
951 if (circuit->is_type & IS_LEVEL_2)
952 {
953 vty_out (vty, " Level-2 Information:%s", VTY_NEWLINE);
954 if (circuit->area->newmetric)
955 vty_out (vty, " Metric: %d", circuit->te_metric[1]);
956 else
957 vty_out (vty, " Metric: %d",
958 circuit->metrics[1].metric_default);
959 if (!circuit->is_passive)
960 {
961 vty_out (vty, ", Active neighbors: %u%s",
962 circuit->upadjcount[1], VTY_NEWLINE);
963 vty_out (vty, " Hello interval: %u, "
964 "Holddown count: %u %s%s",
965 circuit->hello_interval[1],
966 circuit->hello_multiplier[1],
967 (circuit->pad_hellos ? "(pad)" : "(no-pad)"),
968 VTY_NEWLINE);
969 vty_out (vty, " CNSP interval: %u, "
970 "PSNP interval: %u%s",
971 circuit->csnp_interval[1],
972 circuit->psnp_interval[1], VTY_NEWLINE);
973 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
974 vty_out (vty, " LAN Priority: %u, %s%s",
975 circuit->priority[1],
976 (circuit->u.bc.is_dr[1] ? \
977 "is DIS" : "is not DIS"), VTY_NEWLINE);
978 }
979 else
980 {
981 vty_out (vty, "%s", VTY_NEWLINE);
982 }
983 }
984 if (circuit->ip_addrs && listcount (circuit->ip_addrs) > 0)
985 {
986 struct listnode *node;
987 struct prefix *ip_addr;
988 u_char buf[BUFSIZ];
989 vty_out (vty, " IP Prefix(es):%s", VTY_NEWLINE);
990 for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip_addr))
991 {
992 prefix2str (ip_addr, (char*)buf, BUFSIZ),
993 vty_out (vty, " %s%s", buf, VTY_NEWLINE);
994 }
995 }
996 vty_out (vty, "%s", VTY_NEWLINE);
997 }
998 return;
999}
1000
jardineb5d44e2003-12-23 08:09:43 +00001001int
hassof390d2c2004-09-10 20:48:21 +00001002isis_interface_config_write (struct vty *vty)
jardineb5d44e2003-12-23 08:09:43 +00001003{
jardineb5d44e2003-12-23 08:09:43 +00001004 int write = 0;
hasso3fdb2dd2005-09-28 18:45:54 +00001005 struct listnode *node, *node2;
jardineb5d44e2003-12-23 08:09:43 +00001006 struct interface *ifp;
1007 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001008 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +00001009 int i;
jardineb5d44e2003-12-23 08:09:43 +00001010
hasso3fdb2dd2005-09-28 18:45:54 +00001011 for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
jardineb5d44e2003-12-23 08:09:43 +00001012 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001013 /* IF name */
1014 vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE);
1015 write++;
1016 /* IF desc */
1017 if (ifp->desc)
1018 {
1019 vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE);
1020 write++;
1021 }
1022 /* ISIS Circuit */
1023 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node2, area))
1024 {
1025 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
1026 if (circuit == NULL)
1027 continue;
1028 if (circuit->ip_router)
1029 {
1030 vty_out (vty, " ip router isis %s%s", area->area_tag,
1031 VTY_NEWLINE);
1032 write++;
1033 }
1034 if (circuit->is_passive)
1035 {
1036 vty_out (vty, " isis passive%s", VTY_NEWLINE);
1037 write++;
1038 }
1039 if (circuit->circ_type_config == CIRCUIT_T_P2P)
1040 {
1041 vty_out (vty, " isis network point-to-point%s", VTY_NEWLINE);
1042 write++;
1043 }
jardineb5d44e2003-12-23 08:09:43 +00001044#ifdef HAVE_IPV6
Josh Bailey3f045a02012-03-24 08:35:20 -07001045 if (circuit->ipv6_router)
1046 {
1047 vty_out (vty, " ipv6 router isis %s%s", area->area_tag,
1048 VTY_NEWLINE);
1049 write++;
1050 }
jardineb5d44e2003-12-23 08:09:43 +00001051#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +00001052
Josh Bailey3f045a02012-03-24 08:35:20 -07001053 /* ISIS - circuit type */
1054 if (circuit->is_type == IS_LEVEL_1)
1055 {
1056 vty_out (vty, " isis circuit-type level-1%s", VTY_NEWLINE);
1057 write++;
1058 }
1059 else
1060 {
1061 if (circuit->is_type == IS_LEVEL_2)
1062 {
1063 vty_out (vty, " isis circuit-type level-2-only%s",
1064 VTY_NEWLINE);
1065 write++;
1066 }
1067 }
jardineb5d44e2003-12-23 08:09:43 +00001068
Josh Bailey3f045a02012-03-24 08:35:20 -07001069 /* ISIS - CSNP interval */
1070 if (circuit->csnp_interval[0] == circuit->csnp_interval[1])
1071 {
1072 if (circuit->csnp_interval[0] != DEFAULT_CSNP_INTERVAL)
1073 {
1074 vty_out (vty, " isis csnp-interval %d%s",
1075 circuit->csnp_interval[0], VTY_NEWLINE);
1076 write++;
1077 }
1078 }
1079 else
1080 {
1081 for (i = 0; i < 2; i++)
1082 {
1083 if (circuit->csnp_interval[i] != DEFAULT_CSNP_INTERVAL)
1084 {
1085 vty_out (vty, " isis csnp-interval %d level-%d%s",
1086 circuit->csnp_interval[i], i + 1, VTY_NEWLINE);
1087 write++;
1088 }
1089 }
1090 }
jardineb5d44e2003-12-23 08:09:43 +00001091
Josh Bailey3f045a02012-03-24 08:35:20 -07001092 /* ISIS - PSNP interval */
1093 if (circuit->psnp_interval[0] == circuit->psnp_interval[1])
1094 {
1095 if (circuit->psnp_interval[0] != DEFAULT_PSNP_INTERVAL)
1096 {
1097 vty_out (vty, " isis psnp-interval %d%s",
1098 circuit->psnp_interval[0], VTY_NEWLINE);
1099 write++;
1100 }
1101 }
1102 else
1103 {
1104 for (i = 0; i < 2; i++)
1105 {
1106 if (circuit->psnp_interval[i] != DEFAULT_PSNP_INTERVAL)
1107 {
1108 vty_out (vty, " isis psnp-interval %d level-%d%s",
1109 circuit->psnp_interval[i], i + 1, VTY_NEWLINE);
1110 write++;
1111 }
1112 }
1113 }
jardineb5d44e2003-12-23 08:09:43 +00001114
Josh Bailey3f045a02012-03-24 08:35:20 -07001115 /* ISIS - Hello padding - Defaults to true so only display if false */
1116 if (circuit->pad_hellos == 0)
1117 {
1118 vty_out (vty, " no isis hello padding%s", VTY_NEWLINE);
1119 write++;
1120 }
jardineb5d44e2003-12-23 08:09:43 +00001121
Josh Bailey3f045a02012-03-24 08:35:20 -07001122 /* ISIS - Hello interval */
1123 if (circuit->hello_interval[0] == circuit->hello_interval[1])
1124 {
1125 if (circuit->hello_interval[0] != DEFAULT_HELLO_INTERVAL)
1126 {
1127 vty_out (vty, " isis hello-interval %d%s",
1128 circuit->hello_interval[0], VTY_NEWLINE);
1129 write++;
1130 }
1131 }
1132 else
1133 {
1134 for (i = 0; i < 2; i++)
1135 {
1136 if (circuit->hello_interval[i] != DEFAULT_HELLO_INTERVAL)
1137 {
1138 vty_out (vty, " isis hello-interval %d level-%d%s",
1139 circuit->hello_interval[i], i + 1, VTY_NEWLINE);
1140 write++;
1141 }
1142 }
1143 }
jardineb5d44e2003-12-23 08:09:43 +00001144
Josh Bailey3f045a02012-03-24 08:35:20 -07001145 /* ISIS - Hello Multiplier */
1146 if (circuit->hello_multiplier[0] == circuit->hello_multiplier[1])
1147 {
1148 if (circuit->hello_multiplier[0] != DEFAULT_HELLO_MULTIPLIER)
1149 {
1150 vty_out (vty, " isis hello-multiplier %d%s",
1151 circuit->hello_multiplier[0], VTY_NEWLINE);
1152 write++;
1153 }
1154 }
1155 else
1156 {
1157 for (i = 0; i < 2; i++)
1158 {
1159 if (circuit->hello_multiplier[i] != DEFAULT_HELLO_MULTIPLIER)
1160 {
1161 vty_out (vty, " isis hello-multiplier %d level-%d%s",
1162 circuit->hello_multiplier[i], i + 1,
1163 VTY_NEWLINE);
1164 write++;
1165 }
1166 }
1167 }
1168
1169 /* ISIS - Priority */
1170 if (circuit->priority[0] == circuit->priority[1])
1171 {
1172 if (circuit->priority[0] != DEFAULT_PRIORITY)
1173 {
1174 vty_out (vty, " isis priority %d%s",
1175 circuit->priority[0], VTY_NEWLINE);
1176 write++;
1177 }
1178 }
1179 else
1180 {
1181 for (i = 0; i < 2; i++)
1182 {
1183 if (circuit->priority[i] != DEFAULT_PRIORITY)
1184 {
1185 vty_out (vty, " isis priority %d level-%d%s",
1186 circuit->priority[i], i + 1, VTY_NEWLINE);
1187 write++;
1188 }
1189 }
1190 }
1191
1192 /* ISIS - Metric */
1193 if (circuit->te_metric[0] == circuit->te_metric[1])
1194 {
1195 if (circuit->te_metric[0] != DEFAULT_CIRCUIT_METRIC)
1196 {
1197 vty_out (vty, " isis metric %d%s", circuit->te_metric[0],
1198 VTY_NEWLINE);
1199 write++;
1200 }
1201 }
1202 else
1203 {
1204 for (i = 0; i < 2; i++)
1205 {
1206 if (circuit->te_metric[i] != DEFAULT_CIRCUIT_METRIC)
1207 {
1208 vty_out (vty, " isis metric %d level-%d%s",
1209 circuit->te_metric[i], i + 1, VTY_NEWLINE);
1210 write++;
1211 }
1212 }
1213 }
1214 if (circuit->passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
1215 {
1216 vty_out (vty, " isis password md5 %s%s", circuit->passwd.passwd,
1217 VTY_NEWLINE);
1218 write++;
1219 }
1220 else if (circuit->passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
1221 {
1222 vty_out (vty, " isis password clear %s%s", circuit->passwd.passwd,
1223 VTY_NEWLINE);
1224 write++;
1225 }
1226 }
1227 vty_out (vty, "!%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001228 }
hassof390d2c2004-09-10 20:48:21 +00001229
jardineb5d44e2003-12-23 08:09:43 +00001230 return write;
1231}
jardineb5d44e2003-12-23 08:09:43 +00001232
1233DEFUN (ip_router_isis,
1234 ip_router_isis_cmd,
1235 "ip router isis WORD",
1236 "Interface Internet Protocol config commands\n"
1237 "IP router interface commands\n"
1238 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +00001239 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +00001240{
Josh Bailey3f045a02012-03-24 08:35:20 -07001241 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +00001242 struct interface *ifp;
1243 struct isis_area *area;
Christian Frankef1fc1db2015-11-10 18:43:31 +01001244 int rv;
hassof390d2c2004-09-10 20:48:21 +00001245
1246 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001247 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +00001248
Josh Bailey3f045a02012-03-24 08:35:20 -07001249 /* Prevent more than one area per circuit */
1250 circuit = circuit_scan_by_ifp (ifp);
1251 if (circuit)
hassof390d2c2004-09-10 20:48:21 +00001252 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001253 if (circuit->ip_router == 1)
1254 {
1255 if (strcmp (circuit->area->area_tag, argv[0]))
1256 {
1257 vty_out (vty, "ISIS circuit is already defined on %s%s",
1258 circuit->area->area_tag, VTY_NEWLINE);
1259 return CMD_ERR_NOTHING_TODO;
1260 }
1261 return CMD_SUCCESS;
1262 }
jardineb5d44e2003-12-23 08:09:43 +00001263 }
hassof390d2c2004-09-10 20:48:21 +00001264
Josh Bailey3f045a02012-03-24 08:35:20 -07001265 if (isis_area_get (vty, argv[0]) != CMD_SUCCESS)
hassof390d2c2004-09-10 20:48:21 +00001266 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001267 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1268 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001269 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001270 area = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001271
Josh Bailey3f045a02012-03-24 08:35:20 -07001272 circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area);
Christian Frankef1fc1db2015-11-10 18:43:31 +01001273 if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP)
1274 {
1275 vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE);
1276 rv = CMD_WARNING;
1277 }
1278 else
1279 {
1280 isis_circuit_if_bind (circuit, ifp);
jardineb5d44e2003-12-23 08:09:43 +00001281
Christian Frankef1fc1db2015-11-10 18:43:31 +01001282 circuit->ip_router = 1;
1283 area->ip_circuits++;
1284 circuit_update_nlpids (circuit);
1285 rv = CMD_SUCCESS;
1286 }
jardineb5d44e2003-12-23 08:09:43 +00001287
1288 vty->node = INTERFACE_NODE;
Josh Bailey3f045a02012-03-24 08:35:20 -07001289 vty->index = ifp;
hassof390d2c2004-09-10 20:48:21 +00001290
Christian Frankef1fc1db2015-11-10 18:43:31 +01001291 return rv;
jardineb5d44e2003-12-23 08:09:43 +00001292}
1293
1294DEFUN (no_ip_router_isis,
1295 no_ip_router_isis_cmd,
1296 "no ip router isis WORD",
1297 NO_STR
1298 "Interface Internet Protocol config commands\n"
1299 "IP router interface commands\n"
1300 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +00001301 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +00001302{
jardineb5d44e2003-12-23 08:09:43 +00001303 struct interface *ifp;
1304 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001305 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +00001306
hassof390d2c2004-09-10 20:48:21 +00001307 ifp = (struct interface *) vty->index;
Josh Bailey3f045a02012-03-24 08:35:20 -07001308 if (!ifp)
1309 {
1310 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1311 return CMD_ERR_NO_MATCH;
1312 }
hassof390d2c2004-09-10 20:48:21 +00001313
jardineb5d44e2003-12-23 08:09:43 +00001314 area = isis_area_lookup (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001315 if (!area)
1316 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001317 vty_out (vty, "Can't find ISIS instance %s%s",
1318 argv[0], VTY_NEWLINE);
1319 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001320 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001321
1322 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +00001323 if (!circuit)
1324 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001325 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1326 ifp->name, VTY_NEWLINE);
1327 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001328 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001329
jardineb5d44e2003-12-23 08:09:43 +00001330 circuit->ip_router = 0;
1331 area->ip_circuits--;
1332#ifdef HAVE_IPV6
1333 if (circuit->ipv6_router == 0)
1334#endif
1335 isis_csm_state_change (ISIS_DISABLE, circuit, area);
hassof390d2c2004-09-10 20:48:21 +00001336
jardineb5d44e2003-12-23 08:09:43 +00001337 return CMD_SUCCESS;
1338}
1339
Josh Bailey3f045a02012-03-24 08:35:20 -07001340#ifdef HAVE_IPV6
1341DEFUN (ipv6_router_isis,
1342 ipv6_router_isis_cmd,
1343 "ipv6 router isis WORD",
1344 "IPv6 interface subcommands\n"
1345 "IPv6 Router interface commands\n"
1346 "IS-IS Routing for IPv6\n"
1347 "Routing process tag\n")
1348{
1349 struct isis_circuit *circuit;
1350 struct interface *ifp;
1351 struct isis_area *area;
Christian Frankef1fc1db2015-11-10 18:43:31 +01001352 int rv;
Josh Bailey3f045a02012-03-24 08:35:20 -07001353
1354 ifp = (struct interface *) vty->index;
1355 assert (ifp);
1356
1357 /* Prevent more than one area per circuit */
1358 circuit = circuit_scan_by_ifp (ifp);
1359 if (circuit)
1360 {
1361 if (circuit->ipv6_router == 1)
1362 {
1363 if (strcmp (circuit->area->area_tag, argv[0]))
1364 {
1365 vty_out (vty, "ISIS circuit is already defined for IPv6 on %s%s",
1366 circuit->area->area_tag, VTY_NEWLINE);
1367 return CMD_ERR_NOTHING_TODO;
1368 }
1369 return CMD_SUCCESS;
1370 }
1371 }
1372
1373 if (isis_area_get (vty, argv[0]) != CMD_SUCCESS)
1374 {
1375 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1376 return CMD_ERR_NO_MATCH;
1377 }
1378 area = vty->index;
1379
1380 circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area);
Christian Frankef1fc1db2015-11-10 18:43:31 +01001381 if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP)
1382 {
1383 vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE);
1384 rv = CMD_WARNING;
1385 }
1386 else
1387 {
1388 isis_circuit_if_bind (circuit, ifp);
Josh Bailey3f045a02012-03-24 08:35:20 -07001389
Christian Frankef1fc1db2015-11-10 18:43:31 +01001390 circuit->ipv6_router = 1;
1391 area->ipv6_circuits++;
1392 circuit_update_nlpids (circuit);
1393 rv = CMD_SUCCESS;
1394 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001395
1396 vty->node = INTERFACE_NODE;
1397 vty->index = ifp;
1398
Christian Frankef1fc1db2015-11-10 18:43:31 +01001399 return rv;
Josh Bailey3f045a02012-03-24 08:35:20 -07001400}
1401
1402DEFUN (no_ipv6_router_isis,
1403 no_ipv6_router_isis_cmd,
1404 "no ipv6 router isis WORD",
1405 NO_STR
1406 "IPv6 interface subcommands\n"
1407 "IPv6 Router interface commands\n"
1408 "IS-IS Routing for IPv6\n"
1409 "Routing process tag\n")
1410{
1411 struct interface *ifp;
1412 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001413 struct isis_circuit *circuit;
1414
1415 ifp = (struct interface *) vty->index;
1416 if (!ifp)
1417 {
1418 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1419 return CMD_ERR_NO_MATCH;
1420 }
1421
1422 area = isis_area_lookup (argv[0]);
1423 if (!area)
1424 {
1425 vty_out (vty, "Can't find ISIS instance %s%s",
1426 argv[0], VTY_NEWLINE);
1427 return CMD_ERR_NO_MATCH;
1428 }
1429
1430 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
1431 if (!circuit)
1432 {
1433 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1434 ifp->name, VTY_NEWLINE);
1435 return CMD_ERR_NO_MATCH;
1436 }
1437
1438 circuit->ipv6_router = 0;
1439 area->ipv6_circuits--;
1440 if (circuit->ip_router == 0)
1441 isis_csm_state_change (ISIS_DISABLE, circuit, area);
1442
1443 return CMD_SUCCESS;
1444}
1445#endif /* HAVE_IPV6 */
1446
1447DEFUN (isis_passive,
1448 isis_passive_cmd,
1449 "isis passive",
1450 "IS-IS commands\n"
1451 "Configure the passive mode for interface\n")
1452{
1453 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1454 if (!circuit)
1455 return CMD_ERR_NO_MATCH;
1456
1457 if (circuit->is_passive == 1)
1458 return CMD_SUCCESS;
1459
1460 if (circuit->state != C_STATE_UP)
1461 {
1462 circuit->is_passive = 1;
1463 }
1464 else
1465 {
1466 struct isis_area *area = circuit->area;
1467 isis_csm_state_change (ISIS_DISABLE, circuit, area);
1468 circuit->is_passive = 1;
1469 isis_csm_state_change (ISIS_ENABLE, circuit, area);
1470 }
1471
1472 return CMD_SUCCESS;
1473}
1474
1475DEFUN (no_isis_passive,
1476 no_isis_passive_cmd,
1477 "no isis passive",
1478 NO_STR
1479 "IS-IS commands\n"
1480 "Configure the passive mode for interface\n")
1481{
1482 struct interface *ifp;
1483 struct isis_circuit *circuit;
1484
1485 ifp = (struct interface *) vty->index;
1486 if (!ifp)
1487 {
1488 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
1489 return CMD_ERR_NO_MATCH;
1490 }
1491
1492 /* FIXME: what is wrong with circuit = ifp->info ? */
1493 circuit = circuit_scan_by_ifp (ifp);
1494 if (!circuit)
1495 {
1496 vty_out (vty, "ISIS is not enabled on circuit %s%s",
1497 ifp->name, VTY_NEWLINE);
1498 return CMD_ERR_NO_MATCH;
1499 }
1500
1501 if (if_is_loopback(ifp))
1502 {
1503 vty_out (vty, "Can't set no passive for loopback interface%s",
1504 VTY_NEWLINE);
1505 return CMD_ERR_AMBIGUOUS;
1506 }
1507
1508 if (circuit->is_passive == 0)
1509 return CMD_SUCCESS;
1510
1511 if (circuit->state != C_STATE_UP)
1512 {
1513 circuit->is_passive = 0;
1514 }
1515 else
1516 {
1517 struct isis_area *area = circuit->area;
1518 isis_csm_state_change (ISIS_DISABLE, circuit, area);
1519 circuit->is_passive = 0;
1520 isis_csm_state_change (ISIS_ENABLE, circuit, area);
1521 }
1522
1523 return CMD_SUCCESS;
1524}
1525
jardineb5d44e2003-12-23 08:09:43 +00001526DEFUN (isis_circuit_type,
1527 isis_circuit_type_cmd,
1528 "isis circuit-type (level-1|level-1-2|level-2-only)",
1529 "IS-IS commands\n"
1530 "Configure circuit type for interface\n"
1531 "Level-1 only adjacencies are formed\n"
1532 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +00001533 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +00001534{
Josh Bailey3f045a02012-03-24 08:35:20 -07001535 int circuit_type;
1536 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1537 if (!circuit)
1538 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001539
Josh Bailey3f045a02012-03-24 08:35:20 -07001540 circuit_type = string2circuit_t (argv[0]);
1541 if (!circuit_type)
hassof390d2c2004-09-10 20:48:21 +00001542 {
1543 vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -07001544 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001545 }
1546
Josh Bailey3f045a02012-03-24 08:35:20 -07001547 if (circuit->state == C_STATE_UP &&
1548 circuit->area->is_type != IS_LEVEL_1_AND_2 &&
1549 circuit->area->is_type != circuit_type)
hassof390d2c2004-09-10 20:48:21 +00001550 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001551 vty_out (vty, "Invalid circuit level for area %s.%s",
1552 circuit->area->area_tag, VTY_NEWLINE);
1553 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001554 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001555 isis_event_circuit_type_change (circuit, circuit_type);
hassof390d2c2004-09-10 20:48:21 +00001556
jardineb5d44e2003-12-23 08:09:43 +00001557 return CMD_SUCCESS;
1558}
1559
1560DEFUN (no_isis_circuit_type,
1561 no_isis_circuit_type_cmd,
1562 "no isis circuit-type (level-1|level-1-2|level-2-only)",
1563 NO_STR
1564 "IS-IS commands\n"
1565 "Configure circuit type for interface\n"
1566 "Level-1 only adjacencies are formed\n"
1567 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +00001568 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +00001569{
Josh Bailey3f045a02012-03-24 08:35:20 -07001570 int circuit_type;
1571 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1572 if (!circuit)
1573 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001574
jardineb5d44e2003-12-23 08:09:43 +00001575 /*
Josh Bailey3f045a02012-03-24 08:35:20 -07001576 * Set the circuits level to its default value
jardineb5d44e2003-12-23 08:09:43 +00001577 */
Josh Bailey3f045a02012-03-24 08:35:20 -07001578 if (circuit->state == C_STATE_UP)
1579 circuit_type = circuit->area->is_type;
1580 else
1581 circuit_type = IS_LEVEL_1_AND_2;
1582 isis_event_circuit_type_change (circuit, circuit_type);
hassof390d2c2004-09-10 20:48:21 +00001583
jardineb5d44e2003-12-23 08:09:43 +00001584 return CMD_SUCCESS;
1585}
1586
Josh Bailey3f045a02012-03-24 08:35:20 -07001587DEFUN (isis_passwd_md5,
1588 isis_passwd_md5_cmd,
1589 "isis password md5 WORD",
jardineb5d44e2003-12-23 08:09:43 +00001590 "IS-IS commands\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001591 "Configure the authentication password for a circuit\n"
1592 "Authentication type\n"
1593 "Circuit password\n")
jardineb5d44e2003-12-23 08:09:43 +00001594{
jardineb5d44e2003-12-23 08:09:43 +00001595 int len;
Josh Bailey3f045a02012-03-24 08:35:20 -07001596 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1597 if (!circuit)
1598 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001599
jardineb5d44e2003-12-23 08:09:43 +00001600 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001601 if (len > 254)
1602 {
1603 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -07001604 return CMD_ERR_AMBIGUOUS;
1605 }
1606 circuit->passwd.len = len;
1607 circuit->passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
1608 strncpy ((char *)circuit->passwd.passwd, argv[0], 255);
1609
1610 return CMD_SUCCESS;
1611}
1612
1613DEFUN (isis_passwd_clear,
1614 isis_passwd_clear_cmd,
1615 "isis password clear WORD",
1616 "IS-IS commands\n"
1617 "Configure the authentication password for a circuit\n"
1618 "Authentication type\n"
1619 "Circuit password\n")
1620{
1621 int len;
1622 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1623 if (!circuit)
1624 return CMD_ERR_NO_MATCH;
1625
1626 len = strlen (argv[0]);
1627 if (len > 254)
1628 {
1629 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
1630 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001631 }
jardineb5d44e2003-12-23 08:09:43 +00001632 circuit->passwd.len = len;
1633 circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001634 strncpy ((char *)circuit->passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001635
jardineb5d44e2003-12-23 08:09:43 +00001636 return CMD_SUCCESS;
1637}
1638
1639DEFUN (no_isis_passwd,
1640 no_isis_passwd_cmd,
1641 "no isis password",
1642 NO_STR
1643 "IS-IS commands\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001644 "Configure the authentication password for a circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001645{
Josh Bailey3f045a02012-03-24 08:35:20 -07001646 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1647 if (!circuit)
1648 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001649
jardineb5d44e2003-12-23 08:09:43 +00001650 memset (&circuit->passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +00001651
jardineb5d44e2003-12-23 08:09:43 +00001652 return CMD_SUCCESS;
1653}
1654
jardineb5d44e2003-12-23 08:09:43 +00001655DEFUN (isis_priority,
1656 isis_priority_cmd,
1657 "isis priority <0-127>",
1658 "IS-IS commands\n"
1659 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001660 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001661{
jardineb5d44e2003-12-23 08:09:43 +00001662 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001663 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1664 if (!circuit)
1665 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001666
1667 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001668 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1669 {
1670 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1671 prio, VTY_NEWLINE);
1672 return CMD_ERR_AMBIGUOUS;
1673 }
jardineb5d44e2003-12-23 08:09:43 +00001674
Josh Bailey3f045a02012-03-24 08:35:20 -07001675 circuit->priority[0] = prio;
1676 circuit->priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001677
jardineb5d44e2003-12-23 08:09:43 +00001678 return CMD_SUCCESS;
1679}
1680
1681DEFUN (no_isis_priority,
1682 no_isis_priority_cmd,
1683 "no isis priority",
1684 NO_STR
1685 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001686 "Set priority for Designated Router election\n")
jardineb5d44e2003-12-23 08:09:43 +00001687{
Josh Bailey3f045a02012-03-24 08:35:20 -07001688 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1689 if (!circuit)
1690 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001691
Josh Bailey3f045a02012-03-24 08:35:20 -07001692 circuit->priority[0] = DEFAULT_PRIORITY;
1693 circuit->priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001694
jardineb5d44e2003-12-23 08:09:43 +00001695 return CMD_SUCCESS;
1696}
1697
1698ALIAS (no_isis_priority,
1699 no_isis_priority_arg_cmd,
1700 "no isis priority <0-127>",
1701 NO_STR
1702 "IS-IS commands\n"
1703 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001704 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001705
1706DEFUN (isis_priority_l1,
1707 isis_priority_l1_cmd,
hassof390d2c2004-09-10 20:48:21 +00001708 "isis priority <0-127> level-1",
jardineb5d44e2003-12-23 08:09:43 +00001709 "IS-IS commands\n"
1710 "Set priority for Designated Router election\n"
1711 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001712 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001713{
jardineb5d44e2003-12-23 08:09:43 +00001714 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001715 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1716 if (!circuit)
1717 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001718
1719 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001720 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1721 {
1722 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1723 prio, VTY_NEWLINE);
1724 return CMD_ERR_AMBIGUOUS;
1725 }
jardineb5d44e2003-12-23 08:09:43 +00001726
Josh Bailey3f045a02012-03-24 08:35:20 -07001727 circuit->priority[0] = prio;
hassof390d2c2004-09-10 20:48:21 +00001728
jardineb5d44e2003-12-23 08:09:43 +00001729 return CMD_SUCCESS;
1730}
1731
1732DEFUN (no_isis_priority_l1,
1733 no_isis_priority_l1_cmd,
1734 "no isis priority level-1",
1735 NO_STR
1736 "IS-IS commands\n"
1737 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001738 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001739{
Josh Bailey3f045a02012-03-24 08:35:20 -07001740 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1741 if (!circuit)
1742 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001743
Josh Bailey3f045a02012-03-24 08:35:20 -07001744 circuit->priority[0] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001745
jardineb5d44e2003-12-23 08:09:43 +00001746 return CMD_SUCCESS;
1747}
1748
1749ALIAS (no_isis_priority_l1,
1750 no_isis_priority_l1_arg_cmd,
1751 "no isis priority <0-127> level-1",
1752 NO_STR
1753 "IS-IS commands\n"
1754 "Set priority for Designated Router election\n"
1755 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001756 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001757
1758DEFUN (isis_priority_l2,
1759 isis_priority_l2_cmd,
hassof390d2c2004-09-10 20:48:21 +00001760 "isis priority <0-127> level-2",
jardineb5d44e2003-12-23 08:09:43 +00001761 "IS-IS commands\n"
1762 "Set priority for Designated Router election\n"
1763 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001764 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001765{
jardineb5d44e2003-12-23 08:09:43 +00001766 int prio;
Josh Bailey3f045a02012-03-24 08:35:20 -07001767 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1768 if (!circuit)
1769 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001770
1771 prio = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07001772 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
1773 {
1774 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
1775 prio, VTY_NEWLINE);
1776 return CMD_ERR_AMBIGUOUS;
1777 }
jardineb5d44e2003-12-23 08:09:43 +00001778
Josh Bailey3f045a02012-03-24 08:35:20 -07001779 circuit->priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001780
jardineb5d44e2003-12-23 08:09:43 +00001781 return CMD_SUCCESS;
1782}
1783
1784DEFUN (no_isis_priority_l2,
1785 no_isis_priority_l2_cmd,
1786 "no isis priority level-2",
1787 NO_STR
1788 "IS-IS commands\n"
1789 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001790 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001791{
Josh Bailey3f045a02012-03-24 08:35:20 -07001792 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1793 if (!circuit)
1794 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001795
Josh Bailey3f045a02012-03-24 08:35:20 -07001796 circuit->priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001797
jardineb5d44e2003-12-23 08:09:43 +00001798 return CMD_SUCCESS;
1799}
1800
1801ALIAS (no_isis_priority_l2,
1802 no_isis_priority_l2_arg_cmd,
1803 "no isis priority <0-127> level-2",
1804 NO_STR
1805 "IS-IS commands\n"
1806 "Set priority for Designated Router election\n"
1807 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001808 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001809
1810/* Metric command */
Josh Bailey3f045a02012-03-24 08:35:20 -07001811DEFUN (isis_metric,
jardineb5d44e2003-12-23 08:09:43 +00001812 isis_metric_cmd,
hassof21fb272005-09-26 17:05:55 +00001813 "isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001814 "IS-IS commands\n"
1815 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001816 "Default metric value\n")
jardineb5d44e2003-12-23 08:09:43 +00001817{
jardineb5d44e2003-12-23 08:09:43 +00001818 int met;
Josh Bailey3f045a02012-03-24 08:35:20 -07001819 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1820 if (!circuit)
1821 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001822
1823 met = atoi (argv[0]);
1824
Josh Bailey3f045a02012-03-24 08:35:20 -07001825 /* RFC3787 section 5.1 */
1826 if (circuit->area && circuit->area->oldmetric == 1 &&
1827 met > MAX_NARROW_LINK_METRIC)
1828 {
1829 vty_out (vty, "Invalid metric %d - should be <0-63> "
1830 "when narrow metric type enabled%s",
1831 met, VTY_NEWLINE);
1832 return CMD_ERR_AMBIGUOUS;
1833 }
1834
1835 /* RFC4444 */
1836 if (circuit->area && circuit->area->newmetric == 1 &&
1837 met > MAX_WIDE_LINK_METRIC)
1838 {
1839 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
1840 "when wide metric type enabled%s",
1841 met, VTY_NEWLINE);
1842 return CMD_ERR_AMBIGUOUS;
1843 }
1844
hassof21fb272005-09-26 17:05:55 +00001845 circuit->te_metric[0] = met;
1846 circuit->te_metric[1] = met;
1847
jardineb5d44e2003-12-23 08:09:43 +00001848 circuit->metrics[0].metric_default = met;
1849 circuit->metrics[1].metric_default = met;
1850
Josh Bailey3f045a02012-03-24 08:35:20 -07001851 if (circuit->area)
1852 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
1853
jardineb5d44e2003-12-23 08:09:43 +00001854 return CMD_SUCCESS;
1855}
1856
1857DEFUN (no_isis_metric,
1858 no_isis_metric_cmd,
1859 "no isis metric",
1860 NO_STR
1861 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001862 "Set default metric for circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001863{
Josh Bailey3f045a02012-03-24 08:35:20 -07001864 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1865 if (!circuit)
1866 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00001867
Josh Bailey3f045a02012-03-24 08:35:20 -07001868 circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC;
1869 circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC;
1870 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC;
1871 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC;
jardineb5d44e2003-12-23 08:09:43 +00001872
Josh Bailey3f045a02012-03-24 08:35:20 -07001873 if (circuit->area)
1874 lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
jardineb5d44e2003-12-23 08:09:43 +00001875
1876 return CMD_SUCCESS;
1877}
1878
1879ALIAS (no_isis_metric,
1880 no_isis_metric_arg_cmd,
hassof21fb272005-09-26 17:05:55 +00001881 "no isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001882 NO_STR
1883 "IS-IS commands\n"
1884 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001885 "Default metric value\n")
1886
Josh Bailey3f045a02012-03-24 08:35:20 -07001887DEFUN (isis_metric_l1,
1888 isis_metric_l1_cmd,
1889 "isis metric <0-16777215> level-1",
1890 "IS-IS commands\n"
1891 "Set default metric for circuit\n"
1892 "Default metric value\n"
1893 "Specify metric for level-1 routing\n")
1894{
1895 int met;
1896 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1897 if (!circuit)
1898 return CMD_ERR_NO_MATCH;
1899
1900 met = atoi (argv[0]);
1901
1902 /* RFC3787 section 5.1 */
1903 if (circuit->area && circuit->area->oldmetric == 1 &&
1904 met > MAX_NARROW_LINK_METRIC)
1905 {
1906 vty_out (vty, "Invalid metric %d - should be <0-63> "
1907 "when narrow metric type enabled%s",
1908 met, VTY_NEWLINE);
1909 return CMD_ERR_AMBIGUOUS;
1910 }
1911
1912 /* RFC4444 */
1913 if (circuit->area && circuit->area->newmetric == 1 &&
1914 met > MAX_WIDE_LINK_METRIC)
1915 {
1916 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
1917 "when wide metric type enabled%s",
1918 met, VTY_NEWLINE);
1919 return CMD_ERR_AMBIGUOUS;
1920 }
1921
1922 circuit->te_metric[0] = met;
1923 circuit->metrics[0].metric_default = met;
1924
1925 if (circuit->area)
1926 lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0);
1927
1928 return CMD_SUCCESS;
1929}
1930
1931DEFUN (no_isis_metric_l1,
1932 no_isis_metric_l1_cmd,
1933 "no isis metric level-1",
1934 NO_STR
1935 "IS-IS commands\n"
1936 "Set default metric for circuit\n"
1937 "Specify metric for level-1 routing\n")
1938{
1939 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1940 if (!circuit)
1941 return CMD_ERR_NO_MATCH;
1942
1943 circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC;
1944 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC;
1945
1946 if (circuit->area)
1947 lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0);
1948
1949 return CMD_SUCCESS;
1950}
1951
1952ALIAS (no_isis_metric_l1,
1953 no_isis_metric_l1_arg_cmd,
1954 "no isis metric <0-16777215> level-1",
1955 NO_STR
1956 "IS-IS commands\n"
1957 "Set default metric for circuit\n"
1958 "Default metric value\n"
1959 "Specify metric for level-1 routing\n")
1960
1961DEFUN (isis_metric_l2,
1962 isis_metric_l2_cmd,
1963 "isis metric <0-16777215> level-2",
1964 "IS-IS commands\n"
1965 "Set default metric for circuit\n"
1966 "Default metric value\n"
1967 "Specify metric for level-2 routing\n")
1968{
1969 int met;
1970 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1971 if (!circuit)
1972 return CMD_ERR_NO_MATCH;
1973
1974 met = atoi (argv[0]);
1975
1976 /* RFC3787 section 5.1 */
1977 if (circuit->area && circuit->area->oldmetric == 1 &&
1978 met > MAX_NARROW_LINK_METRIC)
1979 {
1980 vty_out (vty, "Invalid metric %d - should be <0-63> "
1981 "when narrow metric type enabled%s",
1982 met, VTY_NEWLINE);
1983 return CMD_ERR_AMBIGUOUS;
1984 }
1985
1986 /* RFC4444 */
1987 if (circuit->area && circuit->area->newmetric == 1 &&
1988 met > MAX_WIDE_LINK_METRIC)
1989 {
1990 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
1991 "when wide metric type enabled%s",
1992 met, VTY_NEWLINE);
1993 return CMD_ERR_AMBIGUOUS;
1994 }
1995
1996 circuit->te_metric[1] = met;
1997 circuit->metrics[1].metric_default = met;
1998
1999 if (circuit->area)
2000 lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0);
2001
2002 return CMD_SUCCESS;
2003}
2004
2005DEFUN (no_isis_metric_l2,
2006 no_isis_metric_l2_cmd,
2007 "no isis metric level-2",
2008 NO_STR
2009 "IS-IS commands\n"
2010 "Set default metric for circuit\n"
2011 "Specify metric for level-2 routing\n")
2012{
2013 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2014 if (!circuit)
2015 return CMD_ERR_NO_MATCH;
2016
2017 circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC;
2018 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC;
2019
2020 if (circuit->area)
2021 lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0);
2022
2023 return CMD_SUCCESS;
2024}
2025
2026ALIAS (no_isis_metric_l2,
2027 no_isis_metric_l2_arg_cmd,
2028 "no isis metric <0-16777215> level-2",
2029 NO_STR
2030 "IS-IS commands\n"
2031 "Set default metric for circuit\n"
2032 "Default metric value\n"
2033 "Specify metric for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00002034/* end of metrics */
Josh Bailey3f045a02012-03-24 08:35:20 -07002035
hassof21fb272005-09-26 17:05:55 +00002036DEFUN (isis_hello_interval,
jardineb5d44e2003-12-23 08:09:43 +00002037 isis_hello_interval_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002038 "isis hello-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002039 "IS-IS commands\n"
2040 "Set Hello interval\n"
2041 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00002042 "Holdtime 1 seconds, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00002043{
jardineb5d44e2003-12-23 08:09:43 +00002044 int interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002045 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2046 if (!circuit)
2047 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002048
Josh Bailey3f045a02012-03-24 08:35:20 -07002049 interval = atoi (argv[0]);
2050 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002051 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002052 vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s",
2053 interval, VTY_NEWLINE);
2054 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002055 }
jardineb5d44e2003-12-23 08:09:43 +00002056
hassof390d2c2004-09-10 20:48:21 +00002057 circuit->hello_interval[0] = (u_int16_t) interval;
2058 circuit->hello_interval[1] = (u_int16_t) interval;
2059
jardineb5d44e2003-12-23 08:09:43 +00002060 return CMD_SUCCESS;
2061}
2062
2063DEFUN (no_isis_hello_interval,
2064 no_isis_hello_interval_cmd,
2065 "no isis hello-interval",
2066 NO_STR
2067 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002068 "Set Hello interval\n")
jardineb5d44e2003-12-23 08:09:43 +00002069{
Josh Bailey3f045a02012-03-24 08:35:20 -07002070 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2071 if (!circuit)
2072 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002073
Josh Bailey3f045a02012-03-24 08:35:20 -07002074 circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL;
2075 circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002076
jardineb5d44e2003-12-23 08:09:43 +00002077 return CMD_SUCCESS;
2078}
2079
2080ALIAS (no_isis_hello_interval,
2081 no_isis_hello_interval_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002082 "no isis hello-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002083 NO_STR
2084 "IS-IS commands\n"
2085 "Set Hello interval\n"
2086 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00002087 "Holdtime 1 second, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00002088
2089DEFUN (isis_hello_interval_l1,
2090 isis_hello_interval_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002091 "isis hello-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002092 "IS-IS commands\n"
2093 "Set Hello interval\n"
2094 "Hello interval value\n"
2095 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002096 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002097{
jardineb5d44e2003-12-23 08:09:43 +00002098 long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002099 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2100 if (!circuit)
2101 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002102
Josh Bailey3f045a02012-03-24 08:35:20 -07002103 interval = atoi (argv[0]);
2104 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002105 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002106 vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
2107 interval, VTY_NEWLINE);
2108 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002109 }
jardineb5d44e2003-12-23 08:09:43 +00002110
hassof390d2c2004-09-10 20:48:21 +00002111 circuit->hello_interval[0] = (u_int16_t) interval;
2112
jardineb5d44e2003-12-23 08:09:43 +00002113 return CMD_SUCCESS;
2114}
2115
2116DEFUN (no_isis_hello_interval_l1,
2117 no_isis_hello_interval_l1_cmd,
2118 "no isis hello-interval level-1",
2119 NO_STR
2120 "IS-IS commands\n"
2121 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00002122 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002123{
Josh Bailey3f045a02012-03-24 08:35:20 -07002124 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2125 if (!circuit)
2126 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002127
Josh Bailey3f045a02012-03-24 08:35:20 -07002128 circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002129
jardineb5d44e2003-12-23 08:09:43 +00002130 return CMD_SUCCESS;
2131}
2132
2133ALIAS (no_isis_hello_interval_l1,
2134 no_isis_hello_interval_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002135 "no isis hello-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002136 NO_STR
2137 "IS-IS commands\n"
2138 "Set Hello interval\n"
2139 "Hello interval value\n"
2140 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002141 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002142
2143DEFUN (isis_hello_interval_l2,
2144 isis_hello_interval_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002145 "isis hello-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002146 "IS-IS commands\n"
2147 "Set Hello interval\n"
2148 "Hello interval value\n"
2149 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002150 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002151{
jardineb5d44e2003-12-23 08:09:43 +00002152 long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002153 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2154 if (!circuit)
2155 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002156
Josh Bailey3f045a02012-03-24 08:35:20 -07002157 interval = atoi (argv[0]);
2158 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002159 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002160 vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
2161 interval, VTY_NEWLINE);
2162 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00002163 }
jardineb5d44e2003-12-23 08:09:43 +00002164
hassof390d2c2004-09-10 20:48:21 +00002165 circuit->hello_interval[1] = (u_int16_t) interval;
2166
jardineb5d44e2003-12-23 08:09:43 +00002167 return CMD_SUCCESS;
2168}
2169
2170DEFUN (no_isis_hello_interval_l2,
2171 no_isis_hello_interval_l2_cmd,
2172 "no isis hello-interval level-2",
2173 NO_STR
2174 "IS-IS commands\n"
2175 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00002176 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002177{
Josh Bailey3f045a02012-03-24 08:35:20 -07002178 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2179 if (!circuit)
2180 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002181
Josh Bailey3f045a02012-03-24 08:35:20 -07002182 circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002183
jardineb5d44e2003-12-23 08:09:43 +00002184 return CMD_SUCCESS;
2185}
2186
2187ALIAS (no_isis_hello_interval_l2,
2188 no_isis_hello_interval_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002189 "no isis hello-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002190 NO_STR
2191 "IS-IS commands\n"
2192 "Set Hello interval\n"
2193 "Hello interval value\n"
2194 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00002195 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002196
2197DEFUN (isis_hello_multiplier,
2198 isis_hello_multiplier_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002199 "isis hello-multiplier <2-100>",
jardineb5d44e2003-12-23 08:09:43 +00002200 "IS-IS commands\n"
2201 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002202 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00002203{
jardineb5d44e2003-12-23 08:09:43 +00002204 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002205 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2206 if (!circuit)
2207 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002208
2209 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002210 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2211 {
2212 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2213 mult, VTY_NEWLINE);
2214 return CMD_ERR_AMBIGUOUS;
2215 }
jardineb5d44e2003-12-23 08:09:43 +00002216
hassof390d2c2004-09-10 20:48:21 +00002217 circuit->hello_multiplier[0] = (u_int16_t) mult;
2218 circuit->hello_multiplier[1] = (u_int16_t) mult;
2219
jardineb5d44e2003-12-23 08:09:43 +00002220 return CMD_SUCCESS;
2221}
2222
2223DEFUN (no_isis_hello_multiplier,
2224 no_isis_hello_multiplier_cmd,
2225 "no isis hello-multiplier",
2226 NO_STR
2227 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002228 "Set multiplier for Hello holding time\n")
jardineb5d44e2003-12-23 08:09:43 +00002229{
Josh Bailey3f045a02012-03-24 08:35:20 -07002230 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2231 if (!circuit)
2232 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002233
Josh Bailey3f045a02012-03-24 08:35:20 -07002234 circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER;
2235 circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002236
2237 return CMD_SUCCESS;
2238}
2239
2240ALIAS (no_isis_hello_multiplier,
2241 no_isis_hello_multiplier_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002242 "no isis hello-multiplier <2-100>",
jardineb5d44e2003-12-23 08:09:43 +00002243 NO_STR
2244 "IS-IS commands\n"
2245 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002246 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00002247
2248DEFUN (isis_hello_multiplier_l1,
2249 isis_hello_multiplier_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002250 "isis hello-multiplier <2-100> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002251 "IS-IS commands\n"
2252 "Set multiplier for Hello holding time\n"
2253 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002254 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002255{
jardineb5d44e2003-12-23 08:09:43 +00002256 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002257 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2258 if (!circuit)
2259 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002260
2261 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002262 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2263 {
2264 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2265 mult, VTY_NEWLINE);
2266 return CMD_ERR_AMBIGUOUS;
2267 }
jardineb5d44e2003-12-23 08:09:43 +00002268
hassof390d2c2004-09-10 20:48:21 +00002269 circuit->hello_multiplier[0] = (u_int16_t) mult;
2270
jardineb5d44e2003-12-23 08:09:43 +00002271 return CMD_SUCCESS;
2272}
2273
2274DEFUN (no_isis_hello_multiplier_l1,
2275 no_isis_hello_multiplier_l1_cmd,
2276 "no isis hello-multiplier level-1",
2277 NO_STR
2278 "IS-IS commands\n"
2279 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002280 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002281{
Josh Bailey3f045a02012-03-24 08:35:20 -07002282 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2283 if (!circuit)
2284 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002285
Josh Bailey3f045a02012-03-24 08:35:20 -07002286 circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002287
2288 return CMD_SUCCESS;
2289}
2290
2291ALIAS (no_isis_hello_multiplier_l1,
2292 no_isis_hello_multiplier_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002293 "no isis hello-multiplier <2-100> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002294 NO_STR
2295 "IS-IS commands\n"
2296 "Set multiplier for Hello holding time\n"
2297 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002298 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002299
2300DEFUN (isis_hello_multiplier_l2,
2301 isis_hello_multiplier_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002302 "isis hello-multiplier <2-100> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002303 "IS-IS commands\n"
2304 "Set multiplier for Hello holding time\n"
2305 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002306 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002307{
jardineb5d44e2003-12-23 08:09:43 +00002308 int mult;
Josh Bailey3f045a02012-03-24 08:35:20 -07002309 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2310 if (!circuit)
2311 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002312
2313 mult = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002314 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
2315 {
2316 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
2317 mult, VTY_NEWLINE);
2318 return CMD_ERR_AMBIGUOUS;
2319 }
jardineb5d44e2003-12-23 08:09:43 +00002320
hassof390d2c2004-09-10 20:48:21 +00002321 circuit->hello_multiplier[1] = (u_int16_t) mult;
2322
jardineb5d44e2003-12-23 08:09:43 +00002323 return CMD_SUCCESS;
2324}
2325
2326DEFUN (no_isis_hello_multiplier_l2,
2327 no_isis_hello_multiplier_l2_cmd,
2328 "no isis hello-multiplier level-2",
2329 NO_STR
2330 "IS-IS commands\n"
2331 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00002332 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002333{
Josh Bailey3f045a02012-03-24 08:35:20 -07002334 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2335 if (!circuit)
2336 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002337
Josh Bailey3f045a02012-03-24 08:35:20 -07002338 circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER;
jardineb5d44e2003-12-23 08:09:43 +00002339
2340 return CMD_SUCCESS;
2341}
2342
2343ALIAS (no_isis_hello_multiplier_l2,
2344 no_isis_hello_multiplier_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002345 "no isis hello-multiplier <2-100> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002346 NO_STR
2347 "IS-IS commands\n"
2348 "Set multiplier for Hello holding time\n"
2349 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00002350 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00002351
Josh Bailey3f045a02012-03-24 08:35:20 -07002352DEFUN (isis_hello_padding,
2353 isis_hello_padding_cmd,
jardineb5d44e2003-12-23 08:09:43 +00002354 "isis hello padding",
2355 "IS-IS commands\n"
2356 "Add padding to IS-IS hello packets\n"
2357 "Pad hello packets\n"
2358 "<cr>\n")
2359{
Josh Bailey3f045a02012-03-24 08:35:20 -07002360 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2361 if (!circuit)
2362 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002363
Josh Bailey3f045a02012-03-24 08:35:20 -07002364 circuit->pad_hellos = 1;
hassof390d2c2004-09-10 20:48:21 +00002365
jardineb5d44e2003-12-23 08:09:43 +00002366 return CMD_SUCCESS;
2367}
2368
Josh Bailey3f045a02012-03-24 08:35:20 -07002369DEFUN (no_isis_hello_padding,
2370 no_isis_hello_padding_cmd,
jardineb5d44e2003-12-23 08:09:43 +00002371 "no isis hello padding",
2372 NO_STR
2373 "IS-IS commands\n"
2374 "Add padding to IS-IS hello packets\n"
2375 "Pad hello packets\n"
2376 "<cr>\n")
2377{
Josh Bailey3f045a02012-03-24 08:35:20 -07002378 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2379 if (!circuit)
2380 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002381
Josh Bailey3f045a02012-03-24 08:35:20 -07002382 circuit->pad_hellos = 0;
hassof390d2c2004-09-10 20:48:21 +00002383
jardineb5d44e2003-12-23 08:09:43 +00002384 return CMD_SUCCESS;
2385}
2386
2387DEFUN (csnp_interval,
2388 csnp_interval_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002389 "isis csnp-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002390 "IS-IS commands\n"
2391 "Set CSNP interval in seconds\n"
2392 "CSNP interval value\n")
2393{
jardineb5d44e2003-12-23 08:09:43 +00002394 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002395 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2396 if (!circuit)
2397 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002398
jardineb5d44e2003-12-23 08:09:43 +00002399 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002400 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2401 {
2402 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2403 interval, VTY_NEWLINE);
2404 return CMD_ERR_AMBIGUOUS;
2405 }
jardineb5d44e2003-12-23 08:09:43 +00002406
hassof390d2c2004-09-10 20:48:21 +00002407 circuit->csnp_interval[0] = (u_int16_t) interval;
2408 circuit->csnp_interval[1] = (u_int16_t) interval;
2409
jardineb5d44e2003-12-23 08:09:43 +00002410 return CMD_SUCCESS;
2411}
2412
2413DEFUN (no_csnp_interval,
2414 no_csnp_interval_cmd,
2415 "no isis csnp-interval",
2416 NO_STR
2417 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00002418 "Set CSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002419{
Josh Bailey3f045a02012-03-24 08:35:20 -07002420 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2421 if (!circuit)
2422 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002423
Josh Bailey3f045a02012-03-24 08:35:20 -07002424 circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL;
2425 circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002426
jardineb5d44e2003-12-23 08:09:43 +00002427 return CMD_SUCCESS;
2428}
2429
2430ALIAS (no_csnp_interval,
2431 no_csnp_interval_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002432 "no isis csnp-interval <1-600>",
jardineb5d44e2003-12-23 08:09:43 +00002433 NO_STR
2434 "IS-IS commands\n"
2435 "Set CSNP interval in seconds\n"
2436 "CSNP interval value\n")
2437
jardineb5d44e2003-12-23 08:09:43 +00002438DEFUN (csnp_interval_l1,
2439 csnp_interval_l1_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002440 "isis csnp-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002441 "IS-IS commands\n"
2442 "Set CSNP interval in seconds\n"
2443 "CSNP interval value\n"
2444 "Specify interval for level-1 CSNPs\n")
2445{
jardineb5d44e2003-12-23 08:09:43 +00002446 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002447 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2448 if (!circuit)
2449 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002450
jardineb5d44e2003-12-23 08:09:43 +00002451 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002452 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2453 {
2454 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2455 interval, VTY_NEWLINE);
2456 return CMD_ERR_AMBIGUOUS;
2457 }
hassof390d2c2004-09-10 20:48:21 +00002458
2459 circuit->csnp_interval[0] = (u_int16_t) interval;
2460
jardineb5d44e2003-12-23 08:09:43 +00002461 return CMD_SUCCESS;
2462}
2463
2464DEFUN (no_csnp_interval_l1,
2465 no_csnp_interval_l1_cmd,
2466 "no isis csnp-interval level-1",
2467 NO_STR
2468 "IS-IS commands\n"
2469 "Set CSNP interval in seconds\n"
2470 "Specify interval for level-1 CSNPs\n")
2471{
Josh Bailey3f045a02012-03-24 08:35:20 -07002472 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2473 if (!circuit)
2474 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002475
Josh Bailey3f045a02012-03-24 08:35:20 -07002476 circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002477
jardineb5d44e2003-12-23 08:09:43 +00002478 return CMD_SUCCESS;
2479}
2480
2481ALIAS (no_csnp_interval_l1,
2482 no_csnp_interval_l1_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002483 "no isis csnp-interval <1-600> level-1",
jardineb5d44e2003-12-23 08:09:43 +00002484 NO_STR
2485 "IS-IS commands\n"
2486 "Set CSNP interval in seconds\n"
2487 "CSNP interval value\n"
2488 "Specify interval for level-1 CSNPs\n")
2489
jardineb5d44e2003-12-23 08:09:43 +00002490DEFUN (csnp_interval_l2,
2491 csnp_interval_l2_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002492 "isis csnp-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002493 "IS-IS commands\n"
2494 "Set CSNP interval in seconds\n"
2495 "CSNP interval value\n"
2496 "Specify interval for level-2 CSNPs\n")
2497{
jardineb5d44e2003-12-23 08:09:43 +00002498 unsigned long interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002499 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2500 if (!circuit)
2501 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002502
jardineb5d44e2003-12-23 08:09:43 +00002503 interval = atol (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002504 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
2505 {
2506 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
2507 interval, VTY_NEWLINE);
2508 return CMD_ERR_AMBIGUOUS;
2509 }
hassof390d2c2004-09-10 20:48:21 +00002510
2511 circuit->csnp_interval[1] = (u_int16_t) interval;
2512
jardineb5d44e2003-12-23 08:09:43 +00002513 return CMD_SUCCESS;
2514}
2515
2516DEFUN (no_csnp_interval_l2,
2517 no_csnp_interval_l2_cmd,
2518 "no isis csnp-interval level-2",
2519 NO_STR
2520 "IS-IS commands\n"
2521 "Set CSNP interval in seconds\n"
2522 "Specify interval for level-2 CSNPs\n")
2523{
Josh Bailey3f045a02012-03-24 08:35:20 -07002524 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2525 if (!circuit)
2526 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +00002527
Josh Bailey3f045a02012-03-24 08:35:20 -07002528 circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002529
jardineb5d44e2003-12-23 08:09:43 +00002530 return CMD_SUCCESS;
2531}
2532
2533ALIAS (no_csnp_interval_l2,
2534 no_csnp_interval_l2_arg_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07002535 "no isis csnp-interval <1-600> level-2",
jardineb5d44e2003-12-23 08:09:43 +00002536 NO_STR
2537 "IS-IS commands\n"
2538 "Set CSNP interval in seconds\n"
2539 "CSNP interval value\n"
2540 "Specify interval for level-2 CSNPs\n")
2541
Josh Bailey3f045a02012-03-24 08:35:20 -07002542DEFUN (psnp_interval,
2543 psnp_interval_cmd,
2544 "isis psnp-interval <1-120>",
2545 "IS-IS commands\n"
2546 "Set PSNP interval in seconds\n"
2547 "PSNP interval value\n")
jardineb5d44e2003-12-23 08:09:43 +00002548{
Josh Bailey3f045a02012-03-24 08:35:20 -07002549 unsigned long interval;
2550 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2551 if (!circuit)
2552 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002553
Josh Bailey3f045a02012-03-24 08:35:20 -07002554 interval = atol (argv[0]);
2555 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00002556 {
Josh Bailey3f045a02012-03-24 08:35:20 -07002557 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2558 interval, VTY_NEWLINE);
2559 return CMD_ERR_AMBIGUOUS;
jardineb5d44e2003-12-23 08:09:43 +00002560 }
jardineb5d44e2003-12-23 08:09:43 +00002561
Josh Bailey3f045a02012-03-24 08:35:20 -07002562 circuit->psnp_interval[0] = (u_int16_t) interval;
2563 circuit->psnp_interval[1] = (u_int16_t) interval;
jardineb5d44e2003-12-23 08:09:43 +00002564
2565 return CMD_SUCCESS;
2566}
2567
Josh Bailey3f045a02012-03-24 08:35:20 -07002568DEFUN (no_psnp_interval,
2569 no_psnp_interval_cmd,
2570 "no isis psnp-interval",
jardineb5d44e2003-12-23 08:09:43 +00002571 NO_STR
Josh Bailey3f045a02012-03-24 08:35:20 -07002572 "IS-IS commands\n"
2573 "Set PSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002574{
Josh Bailey3f045a02012-03-24 08:35:20 -07002575 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2576 if (!circuit)
2577 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00002578
Josh Bailey3f045a02012-03-24 08:35:20 -07002579 circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL;
2580 circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL;
jardineb5d44e2003-12-23 08:09:43 +00002581
2582 return CMD_SUCCESS;
2583}
jardineb5d44e2003-12-23 08:09:43 +00002584
Josh Bailey3f045a02012-03-24 08:35:20 -07002585ALIAS (no_psnp_interval,
2586 no_psnp_interval_arg_cmd,
2587 "no isis psnp-interval <1-120>",
2588 NO_STR
2589 "IS-IS commands\n"
2590 "Set PSNP interval in seconds\n"
2591 "PSNP interval value\n")
2592
2593DEFUN (psnp_interval_l1,
2594 psnp_interval_l1_cmd,
2595 "isis psnp-interval <1-120> level-1",
2596 "IS-IS commands\n"
2597 "Set PSNP interval in seconds\n"
2598 "PSNP interval value\n"
2599 "Specify interval for level-1 PSNPs\n")
2600{
2601 unsigned long interval;
2602 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2603 if (!circuit)
2604 return CMD_ERR_NO_MATCH;
2605
2606 interval = atol (argv[0]);
2607 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
2608 {
2609 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2610 interval, VTY_NEWLINE);
2611 return CMD_ERR_AMBIGUOUS;
2612 }
2613
2614 circuit->psnp_interval[0] = (u_int16_t) interval;
2615
2616 return CMD_SUCCESS;
2617}
2618
2619DEFUN (no_psnp_interval_l1,
2620 no_psnp_interval_l1_cmd,
2621 "no isis psnp-interval level-1",
2622 NO_STR
2623 "IS-IS commands\n"
2624 "Set PSNP interval in seconds\n"
2625 "Specify interval for level-1 PSNPs\n")
2626{
2627 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2628 if (!circuit)
2629 return CMD_ERR_NO_MATCH;
2630
2631 circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL;
2632
2633 return CMD_SUCCESS;
2634}
2635
2636ALIAS (no_psnp_interval_l1,
2637 no_psnp_interval_l1_arg_cmd,
2638 "no isis psnp-interval <1-120> level-1",
2639 NO_STR
2640 "IS-IS commands\n"
2641 "Set PSNP interval in seconds\n"
2642 "PSNP interval value\n"
2643 "Specify interval for level-1 PSNPs\n")
2644
2645DEFUN (psnp_interval_l2,
2646 psnp_interval_l2_cmd,
2647 "isis psnp-interval <1-120> level-2",
2648 "IS-IS commands\n"
2649 "Set PSNP interval in seconds\n"
2650 "PSNP interval value\n"
2651 "Specify interval for level-2 PSNPs\n")
2652{
2653 unsigned long interval;
2654 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2655 if (!circuit)
2656 return CMD_ERR_NO_MATCH;
2657
2658 interval = atol (argv[0]);
2659 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
2660 {
2661 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
2662 interval, VTY_NEWLINE);
2663 return CMD_ERR_AMBIGUOUS;
2664 }
2665
2666 circuit->psnp_interval[1] = (u_int16_t) interval;
2667
2668 return CMD_SUCCESS;
2669}
2670
2671DEFUN (no_psnp_interval_l2,
2672 no_psnp_interval_l2_cmd,
2673 "no isis psnp-interval level-2",
2674 NO_STR
2675 "IS-IS commands\n"
2676 "Set PSNP interval in seconds\n"
2677 "Specify interval for level-2 PSNPs\n")
2678{
2679 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2680 if (!circuit)
2681 return CMD_ERR_NO_MATCH;
2682
2683 circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL;
2684
2685 return CMD_SUCCESS;
2686}
2687
2688ALIAS (no_psnp_interval_l2,
2689 no_psnp_interval_l2_arg_cmd,
2690 "no isis psnp-interval <1-120> level-2",
2691 NO_STR
2692 "IS-IS commands\n"
2693 "Set PSNP interval in seconds\n"
2694 "PSNP interval value\n"
2695 "Specify interval for level-2 PSNPs\n")
2696
2697struct cmd_node interface_node = {
jardineb5d44e2003-12-23 08:09:43 +00002698 INTERFACE_NODE,
2699 "%s(config-if)# ",
2700 1,
2701};
2702
Josh Bailey3f045a02012-03-24 08:35:20 -07002703DEFUN (isis_network,
2704 isis_network_cmd,
2705 "isis network point-to-point",
2706 "IS-IS commands\n"
2707 "Set network type\n"
2708 "point-to-point network type\n")
2709{
2710 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2711 if (!circuit)
2712 return CMD_ERR_NO_MATCH;
2713
2714 /* RFC5309 section 4 */
2715 if (circuit->circ_type == CIRCUIT_T_P2P)
2716 return CMD_SUCCESS;
2717
2718 if (circuit->state != C_STATE_UP)
2719 {
2720 circuit->circ_type = CIRCUIT_T_P2P;
2721 circuit->circ_type_config = CIRCUIT_T_P2P;
2722 }
2723 else
2724 {
2725 struct isis_area *area = circuit->area;
2726 if (!if_is_broadcast (circuit->interface))
2727 {
2728 vty_out (vty, "isis network point-to-point "
2729 "is valid only on broadcast interfaces%s",
2730 VTY_NEWLINE);
2731 return CMD_ERR_AMBIGUOUS;
2732 }
2733
2734 isis_csm_state_change (ISIS_DISABLE, circuit, area);
2735 circuit->circ_type = CIRCUIT_T_P2P;
2736 circuit->circ_type_config = CIRCUIT_T_P2P;
2737 isis_csm_state_change (ISIS_ENABLE, circuit, area);
2738 }
2739
2740 return CMD_SUCCESS;
2741}
2742
2743DEFUN (no_isis_network,
2744 no_isis_network_cmd,
2745 "no isis network point-to-point",
2746 NO_STR
2747 "IS-IS commands\n"
2748 "Set network type for circuit\n"
2749 "point-to-point network type\n")
2750{
2751 struct isis_circuit *circuit = isis_circuit_lookup (vty);
2752 if (!circuit)
2753 return CMD_ERR_NO_MATCH;
2754
2755 /* RFC5309 section 4 */
2756 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
2757 return CMD_SUCCESS;
2758
2759 if (circuit->state != C_STATE_UP)
2760 {
2761 circuit->circ_type = CIRCUIT_T_BROADCAST;
2762 circuit->circ_type_config = CIRCUIT_T_BROADCAST;
2763 }
2764 else
2765 {
2766 struct isis_area *area = circuit->area;
2767 if (circuit->interface &&
2768 !if_is_broadcast (circuit->interface))
2769 {
2770 vty_out (vty, "no isis network point-to-point "
2771 "is valid only on broadcast interfaces%s",
2772 VTY_NEWLINE);
2773 return CMD_ERR_AMBIGUOUS;
2774 }
2775
2776 isis_csm_state_change (ISIS_DISABLE, circuit, area);
2777 circuit->circ_type = CIRCUIT_T_BROADCAST;
2778 circuit->circ_type_config = CIRCUIT_T_BROADCAST;
2779 isis_csm_state_change (ISIS_ENABLE, circuit, area);
2780 }
2781
2782 return CMD_SUCCESS;
2783}
2784
jardineb5d44e2003-12-23 08:09:43 +00002785int
2786isis_if_new_hook (struct interface *ifp)
2787{
jardineb5d44e2003-12-23 08:09:43 +00002788 return 0;
2789}
2790
2791int
2792isis_if_delete_hook (struct interface *ifp)
2793{
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002794 struct isis_circuit *circuit;
2795 /* Clean up the circuit data */
2796 if (ifp && ifp->info)
2797 {
2798 circuit = ifp->info;
2799 isis_csm_state_change (IF_DOWN_FROM_Z, circuit, circuit->area);
2800 isis_csm_state_change (ISIS_DISABLE, circuit, circuit->area);
2801 }
2802
jardineb5d44e2003-12-23 08:09:43 +00002803 return 0;
2804}
2805
jardineb5d44e2003-12-23 08:09:43 +00002806void
2807isis_circuit_init ()
2808{
jardineb5d44e2003-12-23 08:09:43 +00002809 /* Initialize Zebra interface data structure */
jardineb5d44e2003-12-23 08:09:43 +00002810 if_add_hook (IF_NEW_HOOK, isis_if_new_hook);
2811 if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook);
2812
2813 /* Install interface node */
2814 install_node (&interface_node, isis_interface_config_write);
2815 install_element (CONFIG_NODE, &interface_cmd);
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002816 install_element (CONFIG_NODE, &no_interface_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002817
2818 install_default (INTERFACE_NODE);
2819 install_element (INTERFACE_NODE, &interface_desc_cmd);
2820 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
2821
2822 install_element (INTERFACE_NODE, &ip_router_isis_cmd);
2823 install_element (INTERFACE_NODE, &no_ip_router_isis_cmd);
2824
Josh Bailey3f045a02012-03-24 08:35:20 -07002825 install_element (INTERFACE_NODE, &isis_passive_cmd);
2826 install_element (INTERFACE_NODE, &no_isis_passive_cmd);
2827
jardineb5d44e2003-12-23 08:09:43 +00002828 install_element (INTERFACE_NODE, &isis_circuit_type_cmd);
2829 install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd);
2830
Josh Bailey3f045a02012-03-24 08:35:20 -07002831 install_element (INTERFACE_NODE, &isis_passwd_clear_cmd);
2832 install_element (INTERFACE_NODE, &isis_passwd_md5_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002833 install_element (INTERFACE_NODE, &no_isis_passwd_cmd);
2834
2835 install_element (INTERFACE_NODE, &isis_priority_cmd);
2836 install_element (INTERFACE_NODE, &no_isis_priority_cmd);
2837 install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd);
2838 install_element (INTERFACE_NODE, &isis_priority_l1_cmd);
2839 install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd);
2840 install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd);
2841 install_element (INTERFACE_NODE, &isis_priority_l2_cmd);
2842 install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd);
2843 install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd);
2844
2845 install_element (INTERFACE_NODE, &isis_metric_cmd);
2846 install_element (INTERFACE_NODE, &no_isis_metric_cmd);
2847 install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07002848 install_element (INTERFACE_NODE, &isis_metric_l1_cmd);
2849 install_element (INTERFACE_NODE, &no_isis_metric_l1_cmd);
2850 install_element (INTERFACE_NODE, &no_isis_metric_l1_arg_cmd);
2851 install_element (INTERFACE_NODE, &isis_metric_l2_cmd);
2852 install_element (INTERFACE_NODE, &no_isis_metric_l2_cmd);
2853 install_element (INTERFACE_NODE, &no_isis_metric_l2_arg_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002854
2855 install_element (INTERFACE_NODE, &isis_hello_interval_cmd);
2856 install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd);
2857 install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd);
2858 install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd);
2859 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd);
2860 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd);
2861 install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd);
2862 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd);
2863 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd);
2864
2865 install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd);
2866 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
2867 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd);
2868 install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd);
2869 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd);
2870 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd);
2871 install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd);
2872 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd);
2873 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd);
2874
Josh Bailey3f045a02012-03-24 08:35:20 -07002875 install_element (INTERFACE_NODE, &isis_hello_padding_cmd);
2876 install_element (INTERFACE_NODE, &no_isis_hello_padding_cmd);
2877
jardineb5d44e2003-12-23 08:09:43 +00002878 install_element (INTERFACE_NODE, &csnp_interval_cmd);
2879 install_element (INTERFACE_NODE, &no_csnp_interval_cmd);
2880 install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd);
2881 install_element (INTERFACE_NODE, &csnp_interval_l1_cmd);
2882 install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd);
2883 install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd);
2884 install_element (INTERFACE_NODE, &csnp_interval_l2_cmd);
2885 install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd);
2886 install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd);
2887
Josh Bailey3f045a02012-03-24 08:35:20 -07002888 install_element (INTERFACE_NODE, &psnp_interval_cmd);
2889 install_element (INTERFACE_NODE, &no_psnp_interval_cmd);
2890 install_element (INTERFACE_NODE, &no_psnp_interval_arg_cmd);
2891 install_element (INTERFACE_NODE, &psnp_interval_l1_cmd);
2892 install_element (INTERFACE_NODE, &no_psnp_interval_l1_cmd);
2893 install_element (INTERFACE_NODE, &no_psnp_interval_l1_arg_cmd);
2894 install_element (INTERFACE_NODE, &psnp_interval_l2_cmd);
2895 install_element (INTERFACE_NODE, &no_psnp_interval_l2_cmd);
2896 install_element (INTERFACE_NODE, &no_psnp_interval_l2_arg_cmd);
2897
2898 install_element (INTERFACE_NODE, &isis_network_cmd);
2899 install_element (INTERFACE_NODE, &no_isis_network_cmd);
2900
jardineb5d44e2003-12-23 08:09:43 +00002901#ifdef HAVE_IPV6
2902 install_element (INTERFACE_NODE, &ipv6_router_isis_cmd);
2903 install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002904#endif
jardineb5d44e2003-12-23 08:09:43 +00002905}