blob: e34d491a6eaaf3f403e63d5e7f40f6d7c9981342 [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"
47#include "isisd/isis_circuit.h"
48#include "isisd/isis_tlv.h"
49#include "isisd/isis_lsp.h"
50#include "isisd/isis_pdu.h"
51#include "isisd/isis_network.h"
52#include "isisd/isis_misc.h"
53#include "isisd/isis_constants.h"
54#include "isisd/isis_adjacency.h"
55#include "isisd/isis_dr.h"
56#include "isisd/isis_flags.h"
57#include "isisd/isisd.h"
58#include "isisd/isis_csm.h"
59#include "isisd/isis_events.h"
60
61extern struct thread_master *master;
62extern struct isis *isis;
63
Paul Jakma41b36e92006-12-08 01:09:50 +000064/*
65 * Prototypes.
66 */
67void isis_circuit_down(struct isis_circuit *);
68int isis_interface_config_write(struct vty *);
69int isis_if_new_hook(struct interface *);
70int isis_if_delete_hook(struct interface *);
71
jardineb5d44e2003-12-23 08:09:43 +000072struct isis_circuit *
73isis_circuit_new ()
74{
75 struct isis_circuit *circuit;
76 int i;
77
hasso3fdb2dd2005-09-28 18:45:54 +000078 circuit = XCALLOC (MTYPE_ISIS_CIRCUIT, sizeof (struct isis_circuit));
hassof390d2c2004-09-10 20:48:21 +000079 if (circuit)
80 {
hassof390d2c2004-09-10 20:48:21 +000081 /* set default metrics for circuit */
82 for (i = 0; i < 2; i++)
83 {
84 circuit->metrics[i].metric_default = DEFAULT_CIRCUIT_METRICS;
85 circuit->metrics[i].metric_expense = METRICS_UNSUPPORTED;
86 circuit->metrics[i].metric_error = METRICS_UNSUPPORTED;
87 circuit->metrics[i].metric_delay = METRICS_UNSUPPORTED;
hassof21fb272005-09-26 17:05:55 +000088 circuit->te_metric[i] = DEFAULT_CIRCUIT_METRICS;
hassof390d2c2004-09-10 20:48:21 +000089 }
jardineb5d44e2003-12-23 08:09:43 +000090 }
hassof390d2c2004-09-10 20:48:21 +000091 else
92 {
93 zlog_err ("Can't malloc isis circuit");
94 return NULL;
95 }
96
jardineb5d44e2003-12-23 08:09:43 +000097 return circuit;
98}
99
jardineb5d44e2003-12-23 08:09:43 +0000100void
101isis_circuit_configure (struct isis_circuit *circuit, struct isis_area *area)
102{
103 int i;
104 circuit->area = area;
105 /*
106 * The level for the circuit is same as for the area, unless configured
107 * otherwise.
108 */
109 circuit->circuit_is_type = area->is_type;
110 /*
111 * Default values
112 */
hassof390d2c2004-09-10 20:48:21 +0000113 for (i = 0; i < 2; i++)
114 {
115 circuit->hello_interval[i] = HELLO_INTERVAL;
116 circuit->hello_multiplier[i] = HELLO_MULTIPLIER;
117 circuit->csnp_interval[i] = CSNP_INTERVAL;
118 circuit->psnp_interval[i] = PSNP_INTERVAL;
119 circuit->u.bc.priority[i] = DEFAULT_PRIORITY;
120 }
121 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
122 {
123 circuit->u.bc.adjdb[0] = list_new ();
124 circuit->u.bc.adjdb[1] = list_new ();
125 circuit->u.bc.pad_hellos = 1;
126 }
jardineb5d44e2003-12-23 08:09:43 +0000127 circuit->lsp_interval = LSP_INTERVAL;
128
129 /*
130 * Add the circuit into area
131 */
132 listnode_add (area->circuit_list, circuit);
133
134 circuit->idx = flags_get_index (&area->flags);
135 circuit->lsp_queue = list_new ();
136
137 return;
138}
139
hassof390d2c2004-09-10 20:48:21 +0000140void
jardineb5d44e2003-12-23 08:09:43 +0000141isis_circuit_deconfigure (struct isis_circuit *circuit,
hassof390d2c2004-09-10 20:48:21 +0000142 struct isis_area *area)
jardineb5d44e2003-12-23 08:09:43 +0000143{
hassof390d2c2004-09-10 20:48:21 +0000144
Fritz Reichmann55749992011-09-14 19:31:51 +0400145 /* destroy adjacencies */
146 if (circuit->u.bc.adjdb[0])
147 isis_adjdb_iterate (circuit->u.bc.adjdb[0], (void(*) (struct isis_adjacency *, void *)) isis_delete_adj, circuit->u.bc.adjdb[0]);
148 if (circuit->u.bc.adjdb[1])
149 isis_adjdb_iterate (circuit->u.bc.adjdb[1], (void(*) (struct isis_adjacency *, void *)) isis_delete_adj, circuit->u.bc.adjdb[1]);
jardineb5d44e2003-12-23 08:09:43 +0000150 /* Remove circuit from area */
151 listnode_delete (area->circuit_list, circuit);
152 /* Free the index of SRM and SSN flags */
153 flags_free_index (&area->flags, circuit->idx);
154
155 return;
156}
157
158struct isis_circuit *
159circuit_lookup_by_ifp (struct interface *ifp, struct list *list)
160{
161 struct isis_circuit *circuit = NULL;
162 struct listnode *node;
hassof390d2c2004-09-10 20:48:21 +0000163
jardineb5d44e2003-12-23 08:09:43 +0000164 if (!list)
165 return NULL;
hassof390d2c2004-09-10 20:48:21 +0000166
paul1eb8ef22005-04-07 07:30:20 +0000167 for (ALL_LIST_ELEMENTS_RO (list, node, circuit))
168 if (circuit->interface == ifp)
169 return circuit;
170
jardineb5d44e2003-12-23 08:09:43 +0000171 return NULL;
172}
173
174struct isis_circuit *
175circuit_scan_by_ifp (struct interface *ifp)
176{
177 struct isis_area *area;
178 struct listnode *node;
179 struct isis_circuit *circuit;
180
181 if (!isis->area_list)
182 return NULL;
183
paul1eb8ef22005-04-07 07:30:20 +0000184 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +0000185 {
hassof390d2c2004-09-10 20:48:21 +0000186 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
187 if (circuit)
188 return circuit;
189 }
190
jardineb5d44e2003-12-23 08:09:43 +0000191 return circuit_lookup_by_ifp (ifp, isis->init_circ_list);
192}
193
194void
195isis_circuit_del (struct isis_circuit *circuit)
196{
197
198 if (!circuit)
199 return;
200
hassof390d2c2004-09-10 20:48:21 +0000201 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
202 {
203 /* destroy adjacency databases */
hasso46606872004-12-29 19:34:22 +0000204 if (circuit->u.bc.adjdb[0])
205 list_delete (circuit->u.bc.adjdb[0]);
206 if (circuit->u.bc.adjdb[1])
207 list_delete (circuit->u.bc.adjdb[1]);
hassof390d2c2004-09-10 20:48:21 +0000208 /* destroy neighbour lists */
209 if (circuit->u.bc.lan_neighs[0])
210 list_delete (circuit->u.bc.lan_neighs[0]);
211 if (circuit->u.bc.lan_neighs[1])
212 list_delete (circuit->u.bc.lan_neighs[1]);
213 /* destroy addresses */
214 }
jardineb5d44e2003-12-23 08:09:43 +0000215 if (circuit->ip_addrs)
216 list_delete (circuit->ip_addrs);
217#ifdef HAVE_IPV6
218 if (circuit->ipv6_link)
219 list_delete (circuit->ipv6_link);
220 if (circuit->ipv6_non_link)
221 list_delete (circuit->ipv6_non_link);
222#endif /* HAVE_IPV6 */
hassof390d2c2004-09-10 20:48:21 +0000223
jardineb5d44e2003-12-23 08:09:43 +0000224 /* and lastly the circuit itself */
225 XFREE (MTYPE_ISIS_CIRCUIT, circuit);
226
227 return;
228}
229
230void
hassof891f442004-09-14 13:54:30 +0000231isis_circuit_add_addr (struct isis_circuit *circuit,
232 struct connected *connected)
jardineb5d44e2003-12-23 08:09:43 +0000233{
234 struct prefix_ipv4 *ipv4;
hassof390d2c2004-09-10 20:48:21 +0000235 u_char buf[BUFSIZ];
jardineb5d44e2003-12-23 08:09:43 +0000236#ifdef HAVE_IPV6
237 struct prefix_ipv6 *ipv6;
238#endif /* HAVE_IPV6 */
hassof891f442004-09-14 13:54:30 +0000239
hassof390d2c2004-09-10 20:48:21 +0000240 if (!circuit->ip_addrs)
hassof891f442004-09-14 13:54:30 +0000241 circuit->ip_addrs = list_new ();
jardineb5d44e2003-12-23 08:09:43 +0000242#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000243 if (!circuit->ipv6_link)
hassof891f442004-09-14 13:54:30 +0000244 circuit->ipv6_link = list_new ();
hassof390d2c2004-09-10 20:48:21 +0000245 if (!circuit->ipv6_non_link)
hassof891f442004-09-14 13:54:30 +0000246 circuit->ipv6_non_link = list_new ();
jardineb5d44e2003-12-23 08:09:43 +0000247#endif /* HAVE_IPV6 */
248
249 memset (&buf, 0, BUFSIZ);
hassof891f442004-09-14 13:54:30 +0000250 if (connected->address->family == AF_INET)
hassof390d2c2004-09-10 20:48:21 +0000251 {
252 ipv4 = prefix_ipv4_new ();
hassof891f442004-09-14 13:54:30 +0000253 ipv4->prefixlen = connected->address->prefixlen;
254 ipv4->prefix = connected->address->u.prefix4;
hassof390d2c2004-09-10 20:48:21 +0000255 listnode_add (circuit->ip_addrs, ipv4);
hasso0dae85e2004-09-26 19:53:47 +0000256 if (circuit->area)
257 lsp_regenerate_schedule (circuit->area);
hassof891f442004-09-14 13:54:30 +0000258
jardineb5d44e2003-12-23 08:09:43 +0000259#ifdef EXTREME_DEBUG
hassof891f442004-09-14 13:54:30 +0000260 prefix2str (connected->address, buf, BUFSIZ);
hasso529d65b2004-12-24 00:14:50 +0000261 zlog_debug ("Added IP address %s to circuit %d", buf,
hassof390d2c2004-09-10 20:48:21 +0000262 circuit->circuit_id);
263#endif /* EXTREME_DEBUG */
jardineb5d44e2003-12-23 08:09:43 +0000264 }
hassof390d2c2004-09-10 20:48:21 +0000265#ifdef HAVE_IPV6
hassof891f442004-09-14 13:54:30 +0000266 if (connected->address->family == AF_INET6)
hassof390d2c2004-09-10 20:48:21 +0000267 {
268 ipv6 = prefix_ipv6_new ();
hassof891f442004-09-14 13:54:30 +0000269 ipv6->prefixlen = connected->address->prefixlen;
270 ipv6->prefix = connected->address->u.prefix6;
271
hassof390d2c2004-09-10 20:48:21 +0000272 if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix))
hassof891f442004-09-14 13:54:30 +0000273 listnode_add (circuit->ipv6_link, ipv6);
hassof390d2c2004-09-10 20:48:21 +0000274 else
hassof891f442004-09-14 13:54:30 +0000275 listnode_add (circuit->ipv6_non_link, ipv6);
hasso0dae85e2004-09-26 19:53:47 +0000276 if (circuit->area)
277 lsp_regenerate_schedule (circuit->area);
hassof891f442004-09-14 13:54:30 +0000278
jardineb5d44e2003-12-23 08:09:43 +0000279#ifdef EXTREME_DEBUG
hassof891f442004-09-14 13:54:30 +0000280 prefix2str (connected->address, buf, BUFSIZ);
hasso529d65b2004-12-24 00:14:50 +0000281 zlog_debug ("Added IPv6 address %s to circuit %d", buf,
hassof390d2c2004-09-10 20:48:21 +0000282 circuit->circuit_id);
283#endif /* EXTREME_DEBUG */
284 }
jardineb5d44e2003-12-23 08:09:43 +0000285#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000286 return;
287}
288
289void
290isis_circuit_del_addr (struct isis_circuit *circuit,
hassof390d2c2004-09-10 20:48:21 +0000291 struct connected *connected)
jardineb5d44e2003-12-23 08:09:43 +0000292{
hassof891f442004-09-14 13:54:30 +0000293 struct prefix_ipv4 *ipv4, *ip = NULL;
294 struct listnode *node;
hassof891f442004-09-14 13:54:30 +0000295 u_char buf[BUFSIZ];
296#ifdef HAVE_IPV6
297 struct prefix_ipv6 *ipv6, *ip6 = NULL;
Paul Jakma41b36e92006-12-08 01:09:50 +0000298 int found = 0;
hassof891f442004-09-14 13:54:30 +0000299#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000300
hassof891f442004-09-14 13:54:30 +0000301 memset (&buf, 0, BUFSIZ);
302 if (connected->address->family == AF_INET)
303 {
304 ipv4 = prefix_ipv4_new ();
305 ipv4->prefixlen = connected->address->prefixlen;
306 ipv4->prefix = connected->address->u.prefix4;
307
paul1eb8ef22005-04-07 07:30:20 +0000308 for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip))
309 if (prefix_same ((struct prefix *) ip, (struct prefix *) &ipv4))
310 break;
hassof891f442004-09-14 13:54:30 +0000311
312 if (ip)
313 {
314 listnode_delete (circuit->ip_addrs, ip);
hasso0dae85e2004-09-26 19:53:47 +0000315 if (circuit->area)
316 lsp_regenerate_schedule (circuit->area);
hassof891f442004-09-14 13:54:30 +0000317 }
318 else
319 {
hassof7c43dc2004-09-26 16:24:14 +0000320 prefix2str (connected->address, (char *)buf, BUFSIZ);
hassof891f442004-09-14 13:54:30 +0000321 zlog_warn("Nonexitant ip address %s removal attempt from circuit \
322 %d", buf, circuit->circuit_id);
323 }
324 }
325#ifdef HAVE_IPV6
326 if (connected->address->family == AF_INET6)
327 {
328 ipv6 = prefix_ipv6_new ();
329 ipv6->prefixlen = connected->address->prefixlen;
330 ipv6->prefix = connected->address->u.prefix6;
331
332 if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix))
333 {
paul1eb8ef22005-04-07 07:30:20 +0000334 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_link, node, ip6))
hassof891f442004-09-14 13:54:30 +0000335 {
hassof891f442004-09-14 13:54:30 +0000336 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
337 break;
338 }
339 if (ip6)
340 {
341 listnode_delete (circuit->ipv6_link, ip6);
342 found = 1;
343 }
344 }
345 else
346 {
paul1eb8ef22005-04-07 07:30:20 +0000347 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, node, ip6))
hassof891f442004-09-14 13:54:30 +0000348 {
hassof891f442004-09-14 13:54:30 +0000349 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
350 break;
351 }
352 if (ip6)
353 {
354 listnode_delete (circuit->ipv6_non_link, ip6);
355 found = 1;
356 }
357 }
358
359 if (!found)
360 {
hassof7c43dc2004-09-26 16:24:14 +0000361 prefix2str (connected->address, (char *)buf, BUFSIZ);
hassof891f442004-09-14 13:54:30 +0000362 zlog_warn("Nonexitant ip address %s removal attempt from \
363 circuit %d", buf, circuit->circuit_id);
364 }
365 else
hasso0dae85e2004-09-26 19:53:47 +0000366 if (circuit->area)
367 lsp_regenerate_schedule (circuit->area);
hassof891f442004-09-14 13:54:30 +0000368 }
369#endif /* HAVE_IPV6 */
370 return;
jardineb5d44e2003-12-23 08:09:43 +0000371}
372
373void
374isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp)
375{
paul1eb8ef22005-04-07 07:30:20 +0000376 struct listnode *node, *nnode;
jardineb5d44e2003-12-23 08:09:43 +0000377 struct connected *conn;
378
379 circuit->interface = ifp;
380 ifp->info = circuit;
hassof390d2c2004-09-10 20:48:21 +0000381
382 circuit->circuit_id = ifp->ifindex % 255; /* FIXME: Why not ? */
jardineb5d44e2003-12-23 08:09:43 +0000383
384 /* isis_circuit_update_addrs (circuit, ifp); */
385
hassof390d2c2004-09-10 20:48:21 +0000386 if (if_is_broadcast (ifp))
387 {
388 circuit->circ_type = CIRCUIT_T_BROADCAST;
389 /*
390 * Get the Hardware Address
391 */
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000392#ifdef HAVE_STRUCT_SOCKADDR_DL
Paul Jakma238497f2007-08-07 18:49:18 +0000393#ifndef SUNOS_5
hassof390d2c2004-09-10 20:48:21 +0000394 if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN)
395 zlog_warn ("unsupported link layer");
396 else
397 memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl),
398 ETH_ALEN);
Paul Jakma238497f2007-08-07 18:49:18 +0000399#endif
jardineb5d44e2003-12-23 08:09:43 +0000400#else
hassof390d2c2004-09-10 20:48:21 +0000401 if (circuit->interface->hw_addr_len != ETH_ALEN)
402 {
403 zlog_warn ("unsupported link layer");
404 }
405 else
406 {
407 memcpy (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN);
408 }
jardineb5d44e2003-12-23 08:09:43 +0000409#ifdef EXTREME_DEGUG
hasso529d65b2004-12-24 00:14:50 +0000410 zlog_debug ("isis_circuit_if_add: if_id %d, isomtu %d snpa %s",
hassof390d2c2004-09-10 20:48:21 +0000411 circuit->interface->ifindex, ISO_MTU (circuit),
412 snpa_print (circuit->u.bc.snpa));
jardineb5d44e2003-12-23 08:09:43 +0000413
414#endif /* EXTREME_DEBUG */
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000415#endif /* HAVE_STRUCT_SOCKADDR_DL */
hassof390d2c2004-09-10 20:48:21 +0000416 }
417 else if (if_is_pointopoint (ifp))
418 {
419 circuit->circ_type = CIRCUIT_T_P2P;
420 }
421 else
422 {
hassoc89c05d2005-09-04 21:36:36 +0000423 /* It's normal in case of loopback etc. */
424 if (isis->debugs & DEBUG_EVENTS)
425 zlog_debug ("isis_circuit_if_add: unsupported media");
hassof390d2c2004-09-10 20:48:21 +0000426 }
427
paul1eb8ef22005-04-07 07:30:20 +0000428 for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn))
429 isis_circuit_add_addr (circuit, conn);
jardineb5d44e2003-12-23 08:09:43 +0000430
431 return;
432}
433
434void
hassof390d2c2004-09-10 20:48:21 +0000435isis_circuit_update_params (struct isis_circuit *circuit,
436 struct interface *ifp)
jardineb5d44e2003-12-23 08:09:43 +0000437{
hassob30c5e62004-12-29 20:06:41 +0000438 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +0000439
440 if (circuit->circuit_id != ifp->ifindex)
441 {
442 zlog_warn ("changing circuit_id %d->%d", circuit->circuit_id,
443 ifp->ifindex);
444 circuit->circuit_id = ifp->ifindex % 255;
445 }
jardineb5d44e2003-12-23 08:09:43 +0000446
447 /* FIXME: Why is this needed? shouldn't we compare to the area's mtu */
448 /* Ofer, this was here in case someone changes the mtu (e.g. with ifconfig)
449 The areas MTU is the minimum of mtu's of circuits in the area
450 now we can't catch the change
451 if (circuit->mtu != ifp->mtu) {
452 zlog_warn ("changing circuit mtu %d->%d", circuit->mtu,
453 ifp->mtu);
454 circuit->mtu = ifp->mtu;
455 }
hassof390d2c2004-09-10 20:48:21 +0000456 */
jardineb5d44e2003-12-23 08:09:43 +0000457 /*
458 * Get the Hardware Address
459 */
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000460#ifdef HAVE_STRUCT_SOCKADDR_DL
Paul Jakma238497f2007-08-07 18:49:18 +0000461#ifndef SUNOS_5
jardineb5d44e2003-12-23 08:09:43 +0000462 if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN)
jardineb5d44e2003-12-23 08:09:43 +0000463 zlog_warn ("unsupported link layer");
hassof390d2c2004-09-10 20:48:21 +0000464 else
465 memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl), ETH_ALEN);
Paul Jakma238497f2007-08-07 18:49:18 +0000466#endif
hassof390d2c2004-09-10 20:48:21 +0000467#else
468 if (circuit->interface->hw_addr_len != ETH_ALEN)
469 {
470 zlog_warn ("unsupported link layer");
jardineb5d44e2003-12-23 08:09:43 +0000471 }
hassof390d2c2004-09-10 20:48:21 +0000472 else
473 {
474 if (memcmp (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN))
475 {
476 zlog_warn ("changing circuit snpa %s->%s",
477 snpa_print (circuit->u.bc.snpa),
478 snpa_print (circuit->interface->hw_addr));
479 }
480 }
481#endif
jardineb5d44e2003-12-23 08:09:43 +0000482
hassof390d2c2004-09-10 20:48:21 +0000483 if (if_is_broadcast (ifp))
484 {
485 circuit->circ_type = CIRCUIT_T_BROADCAST;
486 }
487 else if (if_is_pointopoint (ifp))
488 {
489 circuit->circ_type = CIRCUIT_T_P2P;
490 }
491 else
492 {
493 zlog_warn ("isis_circuit_update_params: unsupported media");
494 }
jardineb5d44e2003-12-23 08:09:43 +0000495
jardineb5d44e2003-12-23 08:09:43 +0000496 return;
497}
498
499void
hassof390d2c2004-09-10 20:48:21 +0000500isis_circuit_if_del (struct isis_circuit *circuit)
jardineb5d44e2003-12-23 08:09:43 +0000501{
502 circuit->interface->info = NULL;
503 circuit->interface = NULL;
hassof390d2c2004-09-10 20:48:21 +0000504
jardineb5d44e2003-12-23 08:09:43 +0000505 return;
506}
507
508void
509isis_circuit_up (struct isis_circuit *circuit)
510{
jardineb5d44e2003-12-23 08:09:43 +0000511
hassof390d2c2004-09-10 20:48:21 +0000512 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
513 {
514 if (circuit->area->min_bcast_mtu == 0 ||
515 ISO_MTU (circuit) < circuit->area->min_bcast_mtu)
516 circuit->area->min_bcast_mtu = ISO_MTU (circuit);
517 /*
518 * ISO 10589 - 8.4.1 Enabling of broadcast circuits
519 */
jardineb5d44e2003-12-23 08:09:43 +0000520
hassof390d2c2004-09-10 20:48:21 +0000521 /* initilizing the hello sending threads
522 * for a broadcast IF
523 */
jardineb5d44e2003-12-23 08:09:43 +0000524
hassof390d2c2004-09-10 20:48:21 +0000525 /* 8.4.1 a) commence sending of IIH PDUs */
526
527 if (circuit->circuit_is_type & IS_LEVEL_1)
528 {
529 thread_add_event (master, send_lan_l1_hello, circuit, 0);
530 circuit->u.bc.lan_neighs[0] = list_new ();
531 }
532
533 if (circuit->circuit_is_type & IS_LEVEL_2)
534 {
535 thread_add_event (master, send_lan_l2_hello, circuit, 0);
536 circuit->u.bc.lan_neighs[1] = list_new ();
537 }
538
539 /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */
540 /* 8.4.1 c) FIXME: listen for ESH PDUs */
541
542 /* 8.4.1 d) */
543 /* dr election will commence in... */
544 if (circuit->circuit_is_type & IS_LEVEL_1)
545 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
hassobf731012004-09-17 07:59:57 +0000546 circuit, 2 * circuit->hello_interval[0]);
hassof390d2c2004-09-10 20:48:21 +0000547 if (circuit->circuit_is_type & IS_LEVEL_2)
548 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
hassobf731012004-09-17 07:59:57 +0000549 circuit, 2 * circuit->hello_interval[1]);
jardineb5d44e2003-12-23 08:09:43 +0000550 }
hassof390d2c2004-09-10 20:48:21 +0000551 else
552 {
553 /* initializing the hello send threads
554 * for a ptp IF
555 */
556 thread_add_event (master, send_p2p_hello, circuit, 0);
jardineb5d44e2003-12-23 08:09:43 +0000557
jardineb5d44e2003-12-23 08:09:43 +0000558 }
559
jardineb5d44e2003-12-23 08:09:43 +0000560 /* initializing PSNP timers */
hassof390d2c2004-09-10 20:48:21 +0000561 if (circuit->circuit_is_type & IS_LEVEL_1)
562 {
563 THREAD_TIMER_ON (master, circuit->t_send_psnp[0], send_l1_psnp, circuit,
564 isis_jitter (circuit->psnp_interval[0], PSNP_JITTER));
565 }
566
567 if (circuit->circuit_is_type & IS_LEVEL_2)
568 {
569 THREAD_TIMER_ON (master, circuit->t_send_psnp[1], send_l2_psnp, circuit,
570 isis_jitter (circuit->psnp_interval[1], PSNP_JITTER));
571 }
572
jardineb5d44e2003-12-23 08:09:43 +0000573 /* initialize the circuit streams */
574 if (circuit->rcv_stream == NULL)
hassof390d2c2004-09-10 20:48:21 +0000575 circuit->rcv_stream = stream_new (ISO_MTU (circuit));
jardineb5d44e2003-12-23 08:09:43 +0000576
577 if (circuit->snd_stream == NULL)
hassof390d2c2004-09-10 20:48:21 +0000578 circuit->snd_stream = stream_new (ISO_MTU (circuit));
jardineb5d44e2003-12-23 08:09:43 +0000579
580 /* unified init for circuits */
581 isis_sock_init (circuit);
582
583#ifdef GNU_LINUX
hassof390d2c2004-09-10 20:48:21 +0000584 THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit,
585 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000586#else
hassof390d2c2004-09-10 20:48:21 +0000587 THREAD_TIMER_ON (master, circuit->t_read, isis_receive, circuit,
588 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000589#endif
590 return;
591}
592
593void
594isis_circuit_down (struct isis_circuit *circuit)
595{
hassof390d2c2004-09-10 20:48:21 +0000596 /* Cancel all active threads -- FIXME: wrong place */
hassod70f99e2004-02-11 20:26:31 +0000597 /* HT: Read thread if GNU_LINUX, TIMER thread otherwise. */
hassof390d2c2004-09-10 20:48:21 +0000598 THREAD_OFF (circuit->t_read);
599 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
600 {
601 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[0]);
602 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[1]);
hassof891f442004-09-14 13:54:30 +0000603 THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[0]);
604 THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[1]);
hassof390d2c2004-09-10 20:48:21 +0000605 }
606 else if (circuit->circ_type == CIRCUIT_T_P2P)
607 {
608 THREAD_TIMER_OFF (circuit->u.p2p.t_send_p2p_hello);
609 }
Fritz Reichmann55749992011-09-14 19:31:51 +0400610
611 if (circuit->t_send_psnp[0]) {
612 THREAD_TIMER_OFF (circuit->t_send_psnp[0]);
613 }
614 if (circuit->t_send_psnp[1]) {
615 THREAD_TIMER_OFF (circuit->t_send_psnp[1]);
616 }
jardineb5d44e2003-12-23 08:09:43 +0000617 /* close the socket */
618 close (circuit->fd);
619
620 return;
621}
622
623void
624circuit_update_nlpids (struct isis_circuit *circuit)
625{
626 circuit->nlpids.count = 0;
hassof390d2c2004-09-10 20:48:21 +0000627
628 if (circuit->ip_router)
629 {
630 circuit->nlpids.nlpids[0] = NLPID_IP;
631 circuit->nlpids.count++;
632 }
jardineb5d44e2003-12-23 08:09:43 +0000633#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000634 if (circuit->ipv6_router)
635 {
636 circuit->nlpids.nlpids[circuit->nlpids.count] = NLPID_IPV6;
637 circuit->nlpids.count++;
638 }
jardineb5d44e2003-12-23 08:09:43 +0000639#endif /* HAVE_IPV6 */
640 return;
641}
642
643int
hassof390d2c2004-09-10 20:48:21 +0000644isis_interface_config_write (struct vty *vty)
jardineb5d44e2003-12-23 08:09:43 +0000645{
646
647 int write = 0;
hasso3fdb2dd2005-09-28 18:45:54 +0000648 struct listnode *node, *node2;
jardineb5d44e2003-12-23 08:09:43 +0000649 struct interface *ifp;
650 struct isis_area *area;
651 struct isis_circuit *c;
jardineb5d44e2003-12-23 08:09:43 +0000652 int i;
jardineb5d44e2003-12-23 08:09:43 +0000653
hasso3fdb2dd2005-09-28 18:45:54 +0000654 for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
jardineb5d44e2003-12-23 08:09:43 +0000655 {
656 /* IF name */
hassof390d2c2004-09-10 20:48:21 +0000657 vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000658 write++;
659 /* IF desc */
hassof390d2c2004-09-10 20:48:21 +0000660 if (ifp->desc)
661 {
662 vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE);
663 write++;
664 }
jardineb5d44e2003-12-23 08:09:43 +0000665 /* ISIS Circuit */
hasso3fdb2dd2005-09-28 18:45:54 +0000666 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node2, area))
jardineb5d44e2003-12-23 08:09:43 +0000667 {
668 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +0000669 if (c)
670 {
671 if (c->ip_router)
672 {
673 vty_out (vty, " ip router isis %s%s", area->area_tag,
674 VTY_NEWLINE);
675 write++;
676 }
jardineb5d44e2003-12-23 08:09:43 +0000677#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000678 if (c->ipv6_router)
679 {
680 vty_out (vty, " ipv6 router isis %s%s", area->area_tag,
681 VTY_NEWLINE);
682 write++;
683 }
jardineb5d44e2003-12-23 08:09:43 +0000684#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000685
hassof390d2c2004-09-10 20:48:21 +0000686 /* ISIS - circuit type */
687 if (c->circuit_is_type == IS_LEVEL_1)
688 {
689 vty_out (vty, " isis circuit-type level-1%s", VTY_NEWLINE);
690 write++;
691 }
692 else
693 {
694 if (c->circuit_is_type == IS_LEVEL_2)
695 {
696 vty_out (vty, " isis circuit-type level-2-only%s",
697 VTY_NEWLINE);
698 write++;
699 }
700 }
jardineb5d44e2003-12-23 08:09:43 +0000701
hassof390d2c2004-09-10 20:48:21 +0000702 /* ISIS - CSNP interval - FIXME: compare to cisco */
703 if (c->csnp_interval[0] == c->csnp_interval[1])
704 {
705 if (c->csnp_interval[0] != CSNP_INTERVAL)
706 {
707 vty_out (vty, " isis csnp-interval %d%s",
708 c->csnp_interval[0], VTY_NEWLINE);
709 write++;
710 }
711 }
712 else
713 {
714 for (i = 0; i < 2; i++)
715 {
716 if (c->csnp_interval[1] != CSNP_INTERVAL)
717 {
718 vty_out (vty, " isis csnp-interval %d level-%d%s",
719 c->csnp_interval[1], i + 1, VTY_NEWLINE);
720 write++;
721 }
722 }
723 }
jardineb5d44e2003-12-23 08:09:43 +0000724
hassof390d2c2004-09-10 20:48:21 +0000725 /* ISIS - Hello padding - Defaults to true so only display if false */
726 if (c->circ_type == CIRCUIT_T_BROADCAST && !c->u.bc.pad_hellos)
727 {
728 vty_out (vty, " no isis hello padding%s", VTY_NEWLINE);
729 write++;
730 }
jardineb5d44e2003-12-23 08:09:43 +0000731
hassof390d2c2004-09-10 20:48:21 +0000732 /* ISIS - Hello interval - FIXME: compare to cisco */
733 if (c->hello_interval[0] == c->hello_interval[1])
734 {
735 if (c->hello_interval[0] != HELLO_INTERVAL)
736 {
737 vty_out (vty, " isis hello-interval %d%s",
738 c->hello_interval[0], VTY_NEWLINE);
739 write++;
740 }
741 }
742 else
743 {
744 for (i = 0; i < 2; i++)
745 {
746 if (c->hello_interval[i] != HELLO_INTERVAL)
747 {
748 if (c->hello_interval[i] == HELLO_MINIMAL)
749 {
750 vty_out (vty,
751 " isis hello-interval minimal level-%d%s",
752 i + 1, VTY_NEWLINE);
753 }
754 else
755 {
756 vty_out (vty, " isis hello-interval %d level-%d%s",
757 c->hello_interval[i], i + 1, VTY_NEWLINE);
758 }
759 write++;
760 }
761 }
762 }
jardineb5d44e2003-12-23 08:09:43 +0000763
hassof390d2c2004-09-10 20:48:21 +0000764 /* ISIS - Hello Multiplier */
765 if (c->hello_multiplier[0] == c->hello_multiplier[1])
766 {
767 if (c->hello_multiplier[0] != HELLO_MULTIPLIER)
768 {
769 vty_out (vty, " isis hello-multiplier %d%s",
770 c->hello_multiplier[0], VTY_NEWLINE);
771 write++;
772 }
773 }
774 else
775 {
776 for (i = 0; i < 2; i++)
777 {
778 if (c->hello_multiplier[i] != HELLO_MULTIPLIER)
779 {
780 vty_out (vty, " isis hello-multiplier %d level-%d%s",
781 c->hello_multiplier[i], i + 1, VTY_NEWLINE);
782 write++;
783 }
784 }
785 }
786 /* ISIS - Priority */
787 if (c->circ_type == CIRCUIT_T_BROADCAST)
788 {
789 if (c->u.bc.priority[0] == c->u.bc.priority[1])
790 {
791 if (c->u.bc.priority[0] != DEFAULT_PRIORITY)
792 {
793 vty_out (vty, " isis priority %d%s",
794 c->u.bc.priority[0], VTY_NEWLINE);
795 write++;
796 }
797 }
798 else
799 {
800 for (i = 0; i < 2; i++)
801 {
802 if (c->u.bc.priority[i] != DEFAULT_PRIORITY)
803 {
804 vty_out (vty, " isis priority %d level-%d%s",
805 c->u.bc.priority[i], i + 1, VTY_NEWLINE);
806 write++;
807 }
808 }
809 }
810 }
811 /* ISIS - Metric */
hassof21fb272005-09-26 17:05:55 +0000812 if (c->te_metric[0] == c->te_metric[1])
hassof390d2c2004-09-10 20:48:21 +0000813 {
hassof21fb272005-09-26 17:05:55 +0000814 if (c->te_metric[0] != DEFAULT_CIRCUIT_METRICS)
hassof390d2c2004-09-10 20:48:21 +0000815 {
hassof21fb272005-09-26 17:05:55 +0000816 vty_out (vty, " isis metric %d%s", c->te_metric[0],
817 VTY_NEWLINE);
hassof390d2c2004-09-10 20:48:21 +0000818 write++;
819 }
820 }
821 else
822 {
823 for (i = 0; i < 2; i++)
824 {
hassof21fb272005-09-26 17:05:55 +0000825 if (c->te_metric[i] != DEFAULT_CIRCUIT_METRICS)
hassof390d2c2004-09-10 20:48:21 +0000826 {
827 vty_out (vty, " isis metric %d level-%d%s",
hassof21fb272005-09-26 17:05:55 +0000828 c->te_metric[i], i + 1, VTY_NEWLINE);
hassof390d2c2004-09-10 20:48:21 +0000829 write++;
830 }
831 }
832 }
jardineb5d44e2003-12-23 08:09:43 +0000833
hassof390d2c2004-09-10 20:48:21 +0000834 }
jardineb5d44e2003-12-23 08:09:43 +0000835 }
hassof390d2c2004-09-10 20:48:21 +0000836 vty_out (vty, "!%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000837 }
hassof390d2c2004-09-10 20:48:21 +0000838
jardineb5d44e2003-12-23 08:09:43 +0000839 return write;
840}
jardineb5d44e2003-12-23 08:09:43 +0000841
842DEFUN (ip_router_isis,
843 ip_router_isis_cmd,
844 "ip router isis WORD",
845 "Interface Internet Protocol config commands\n"
846 "IP router interface commands\n"
847 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +0000848 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +0000849{
850 struct isis_circuit *c;
851 struct interface *ifp;
852 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000853
854 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000855 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +0000856
jardineb5d44e2003-12-23 08:09:43 +0000857 area = isis_area_lookup (argv[0]);
858
859 /* Prevent more than one circuit per interface */
860 if (area)
861 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +0000862 else
863 c = NULL;
864 if (c && (ifp->info != NULL))
865 {
jardineb5d44e2003-12-23 08:09:43 +0000866#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000867 if (c->ipv6_router == 0)
868 {
jardineb5d44e2003-12-23 08:09:43 +0000869#endif /* HAVE_IPV6 */
hassoc89c05d2005-09-04 21:36:36 +0000870 /* FIXME: Find the way to warn only vty users. */
871 /* vty_out (vty, "ISIS circuit is already defined%s", VTY_NEWLINE); */
hassof390d2c2004-09-10 20:48:21 +0000872 return CMD_WARNING;
jardineb5d44e2003-12-23 08:09:43 +0000873#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000874 }
875#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000876 }
hassof390d2c2004-09-10 20:48:21 +0000877
jardineb5d44e2003-12-23 08:09:43 +0000878 /* this is here for ciscopability */
hassof390d2c2004-09-10 20:48:21 +0000879 if (!area)
880 {
hassoc89c05d2005-09-04 21:36:36 +0000881 /* FIXME: Find the way to warn only vty users. */
882 /* vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); */
hassof390d2c2004-09-10 20:48:21 +0000883 return CMD_WARNING;
884 }
jardineb5d44e2003-12-23 08:09:43 +0000885
hassof390d2c2004-09-10 20:48:21 +0000886 if (!c)
887 {
888 c = circuit_lookup_by_ifp (ifp, isis->init_circ_list);
889 c = isis_csm_state_change (ISIS_ENABLE, c, area);
890 c->interface = ifp; /* this is automatic */
891 ifp->info = c; /* hardly related to the FSM */
892 }
jardineb5d44e2003-12-23 08:09:43 +0000893
hassof390d2c2004-09-10 20:48:21 +0000894 if (!c)
jardineb5d44e2003-12-23 08:09:43 +0000895 return CMD_WARNING;
896
897 c->ip_router = 1;
898 area->ip_circuits++;
899 circuit_update_nlpids (c);
900
901 vty->node = INTERFACE_NODE;
hassof390d2c2004-09-10 20:48:21 +0000902
jardineb5d44e2003-12-23 08:09:43 +0000903 return CMD_SUCCESS;
904}
905
906DEFUN (no_ip_router_isis,
907 no_ip_router_isis_cmd,
908 "no ip router isis WORD",
909 NO_STR
910 "Interface Internet Protocol config commands\n"
911 "IP router interface commands\n"
912 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +0000913 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +0000914{
915 struct isis_circuit *circuit = NULL;
916 struct interface *ifp;
917 struct isis_area *area;
hasso3fdb2dd2005-09-28 18:45:54 +0000918 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000919
hassof390d2c2004-09-10 20:48:21 +0000920 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000921 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +0000922
jardineb5d44e2003-12-23 08:09:43 +0000923 area = isis_area_lookup (argv[0]);
hassof390d2c2004-09-10 20:48:21 +0000924 if (!area)
925 {
926 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
927 return CMD_WARNING;
928 }
hasso3fdb2dd2005-09-28 18:45:54 +0000929 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
jardineb5d44e2003-12-23 08:09:43 +0000930 if (circuit->interface == ifp)
931 break;
hassof390d2c2004-09-10 20:48:21 +0000932 if (!circuit)
933 {
934 vty_out (vty, "Can't find ISIS interface %s", VTY_NEWLINE);
935 return CMD_WARNING;
936 }
jardineb5d44e2003-12-23 08:09:43 +0000937 circuit->ip_router = 0;
938 area->ip_circuits--;
939#ifdef HAVE_IPV6
940 if (circuit->ipv6_router == 0)
941#endif
942 isis_csm_state_change (ISIS_DISABLE, circuit, area);
hassof390d2c2004-09-10 20:48:21 +0000943
jardineb5d44e2003-12-23 08:09:43 +0000944 return CMD_SUCCESS;
945}
946
947DEFUN (isis_circuit_type,
948 isis_circuit_type_cmd,
949 "isis circuit-type (level-1|level-1-2|level-2-only)",
950 "IS-IS commands\n"
951 "Configure circuit type for interface\n"
952 "Level-1 only adjacencies are formed\n"
953 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +0000954 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +0000955{
956 struct isis_circuit *circuit;
957 struct interface *ifp;
958 int circuit_t;
959 int is_type;
hassof390d2c2004-09-10 20:48:21 +0000960
961 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000962 circuit = ifp->info;
963 /* UGLY - will remove l8r */
hassof390d2c2004-09-10 20:48:21 +0000964 if (circuit == NULL)
965 {
966 return CMD_WARNING;
967 }
jardineb5d44e2003-12-23 08:09:43 +0000968
hasso13c48f72004-09-10 21:19:13 +0000969 /* XXX what to do when ip_router_isis is not executed */
970 if (circuit->area == NULL)
971 return CMD_WARNING;
972
jardineb5d44e2003-12-23 08:09:43 +0000973 assert (circuit);
974
Paul Jakma41b36e92006-12-08 01:09:50 +0000975 circuit_t = string2circuit_t (argv[0]);
jardineb5d44e2003-12-23 08:09:43 +0000976
hassof390d2c2004-09-10 20:48:21 +0000977 if (!circuit_t)
978 {
979 vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE);
980 return CMD_SUCCESS;
981 }
982
jardineb5d44e2003-12-23 08:09:43 +0000983 is_type = circuit->area->is_type;
984 if (is_type == IS_LEVEL_1_AND_2 || is_type == circuit_t)
hassof390d2c2004-09-10 20:48:21 +0000985 isis_event_circuit_type_change (circuit, circuit_t);
986 else
987 {
988 vty_out (vty, "invalid circuit level for area %s.%s",
989 circuit->area->area_tag, VTY_NEWLINE);
990 }
991
jardineb5d44e2003-12-23 08:09:43 +0000992 return CMD_SUCCESS;
993}
994
995DEFUN (no_isis_circuit_type,
996 no_isis_circuit_type_cmd,
997 "no isis circuit-type (level-1|level-1-2|level-2-only)",
998 NO_STR
999 "IS-IS commands\n"
1000 "Configure circuit type for interface\n"
1001 "Level-1 only adjacencies are formed\n"
1002 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +00001003 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +00001004{
1005 struct isis_circuit *circuit;
1006 struct interface *ifp;
jardineb5d44e2003-12-23 08:09:43 +00001007
hassof390d2c2004-09-10 20:48:21 +00001008 ifp = vty->index;
1009 circuit = ifp->info;
1010 if (circuit == NULL)
1011 {
1012 return CMD_WARNING;
1013 }
1014
1015 assert (circuit);
1016
jardineb5d44e2003-12-23 08:09:43 +00001017 /*
1018 * Set the circuits level to its default value which is that of the area
1019 */
1020 isis_event_circuit_type_change (circuit, circuit->area->is_type);
hassof390d2c2004-09-10 20:48:21 +00001021
jardineb5d44e2003-12-23 08:09:43 +00001022 return CMD_SUCCESS;
1023}
1024
1025DEFUN (isis_passwd,
1026 isis_passwd_cmd,
1027 "isis password WORD",
1028 "IS-IS commands\n"
1029 "Configure the authentication password for interface\n"
1030 "Password\n")
1031{
1032 struct isis_circuit *circuit;
1033 struct interface *ifp;
1034 int len;
hassof390d2c2004-09-10 20:48:21 +00001035
1036 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001037 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001038 if (circuit == NULL)
1039 {
1040 return CMD_WARNING;
1041 }
1042
jardineb5d44e2003-12-23 08:09:43 +00001043 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001044 if (len > 254)
1045 {
1046 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
1047 return CMD_WARNING;
1048 }
jardineb5d44e2003-12-23 08:09:43 +00001049 circuit->passwd.len = len;
1050 circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001051 strncpy ((char *)circuit->passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001052
jardineb5d44e2003-12-23 08:09:43 +00001053 return CMD_SUCCESS;
1054}
1055
1056DEFUN (no_isis_passwd,
1057 no_isis_passwd_cmd,
1058 "no isis password",
1059 NO_STR
1060 "IS-IS commands\n"
1061 "Configure the authentication password for interface\n")
1062{
1063 struct isis_circuit *circuit;
1064 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001065
1066 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001067 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001068 if (circuit == NULL)
1069 {
1070 return CMD_WARNING;
1071 }
1072
jardineb5d44e2003-12-23 08:09:43 +00001073 memset (&circuit->passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +00001074
jardineb5d44e2003-12-23 08:09:43 +00001075 return CMD_SUCCESS;
1076}
1077
1078
1079DEFUN (isis_priority,
1080 isis_priority_cmd,
1081 "isis priority <0-127>",
1082 "IS-IS commands\n"
1083 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001084 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001085{
1086 struct isis_circuit *circuit;
1087 struct interface *ifp;
1088 int prio;
hassof390d2c2004-09-10 20:48:21 +00001089
1090 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001091 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001092 if (circuit == NULL)
1093 {
1094 return CMD_WARNING;
1095 }
jardineb5d44e2003-12-23 08:09:43 +00001096 assert (circuit);
1097
1098 prio = atoi (argv[0]);
1099
1100 circuit->u.bc.priority[0] = prio;
1101 circuit->u.bc.priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001102
jardineb5d44e2003-12-23 08:09:43 +00001103 return CMD_SUCCESS;
1104}
1105
1106DEFUN (no_isis_priority,
1107 no_isis_priority_cmd,
1108 "no isis priority",
1109 NO_STR
1110 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001111 "Set priority for Designated Router election\n")
jardineb5d44e2003-12-23 08:09:43 +00001112{
1113 struct isis_circuit *circuit;
1114 struct interface *ifp;
1115
hassof390d2c2004-09-10 20:48:21 +00001116 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001117 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001118 if (circuit == NULL)
1119 {
1120 return CMD_WARNING;
1121 }
jardineb5d44e2003-12-23 08:09:43 +00001122 assert (circuit);
1123
1124 circuit->u.bc.priority[0] = DEFAULT_PRIORITY;
1125 circuit->u.bc.priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001126
jardineb5d44e2003-12-23 08:09:43 +00001127 return CMD_SUCCESS;
1128}
1129
1130ALIAS (no_isis_priority,
1131 no_isis_priority_arg_cmd,
1132 "no isis priority <0-127>",
1133 NO_STR
1134 "IS-IS commands\n"
1135 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001136 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001137
1138DEFUN (isis_priority_l1,
1139 isis_priority_l1_cmd,
hassof390d2c2004-09-10 20:48:21 +00001140 "isis priority <0-127> level-1",
jardineb5d44e2003-12-23 08:09:43 +00001141 "IS-IS commands\n"
1142 "Set priority for Designated Router election\n"
1143 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001144 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001145{
1146 struct isis_circuit *circuit;
1147 struct interface *ifp;
1148 int prio;
hassof390d2c2004-09-10 20:48:21 +00001149
1150 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001151 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001152 if (circuit == NULL)
1153 {
1154 return CMD_WARNING;
1155 }
jardineb5d44e2003-12-23 08:09:43 +00001156 assert (circuit);
1157
1158 prio = atoi (argv[0]);
1159
1160 circuit->u.bc.priority[0] = prio;
hassof390d2c2004-09-10 20:48:21 +00001161
jardineb5d44e2003-12-23 08:09:43 +00001162 return CMD_SUCCESS;
1163}
1164
1165DEFUN (no_isis_priority_l1,
1166 no_isis_priority_l1_cmd,
1167 "no isis priority level-1",
1168 NO_STR
1169 "IS-IS commands\n"
1170 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001171 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001172{
1173 struct isis_circuit *circuit;
1174 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001175
1176 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001177 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001178 if (circuit == NULL)
1179 {
1180 return CMD_WARNING;
1181 }
jardineb5d44e2003-12-23 08:09:43 +00001182 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001183
jardineb5d44e2003-12-23 08:09:43 +00001184 circuit->u.bc.priority[0] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001185
jardineb5d44e2003-12-23 08:09:43 +00001186 return CMD_SUCCESS;
1187}
1188
1189ALIAS (no_isis_priority_l1,
1190 no_isis_priority_l1_arg_cmd,
1191 "no isis priority <0-127> level-1",
1192 NO_STR
1193 "IS-IS commands\n"
1194 "Set priority for Designated Router election\n"
1195 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001196 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001197
1198DEFUN (isis_priority_l2,
1199 isis_priority_l2_cmd,
hassof390d2c2004-09-10 20:48:21 +00001200 "isis priority <0-127> level-2",
jardineb5d44e2003-12-23 08:09:43 +00001201 "IS-IS commands\n"
1202 "Set priority for Designated Router election\n"
1203 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001204 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001205{
1206 struct isis_circuit *circuit;
1207 struct interface *ifp;
1208 int prio;
hassof390d2c2004-09-10 20:48:21 +00001209
1210 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001211 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001212 if (circuit == NULL)
1213 {
1214 return CMD_WARNING;
1215 }
jardineb5d44e2003-12-23 08:09:43 +00001216 assert (circuit);
1217
1218 prio = atoi (argv[0]);
1219
1220 circuit->u.bc.priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001221
jardineb5d44e2003-12-23 08:09:43 +00001222 return CMD_SUCCESS;
1223}
1224
1225DEFUN (no_isis_priority_l2,
1226 no_isis_priority_l2_cmd,
1227 "no isis priority level-2",
1228 NO_STR
1229 "IS-IS commands\n"
1230 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001231 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001232{
1233 struct isis_circuit *circuit;
1234 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001235
1236 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001237 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001238 if (circuit == NULL)
1239 {
1240 return CMD_WARNING;
1241 }
jardineb5d44e2003-12-23 08:09:43 +00001242 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001243
jardineb5d44e2003-12-23 08:09:43 +00001244 circuit->u.bc.priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001245
jardineb5d44e2003-12-23 08:09:43 +00001246 return CMD_SUCCESS;
1247}
1248
1249ALIAS (no_isis_priority_l2,
1250 no_isis_priority_l2_arg_cmd,
1251 "no isis priority <0-127> level-2",
1252 NO_STR
1253 "IS-IS commands\n"
1254 "Set priority for Designated Router election\n"
1255 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001256 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001257
1258/* Metric command */
hassof390d2c2004-09-10 20:48:21 +00001259 DEFUN (isis_metric,
jardineb5d44e2003-12-23 08:09:43 +00001260 isis_metric_cmd,
hassof21fb272005-09-26 17:05:55 +00001261 "isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001262 "IS-IS commands\n"
1263 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001264 "Default metric value\n")
jardineb5d44e2003-12-23 08:09:43 +00001265{
1266 struct isis_circuit *circuit;
1267 struct interface *ifp;
1268 int met;
1269
hassof390d2c2004-09-10 20:48:21 +00001270 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001271 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001272 if (circuit == NULL)
1273 {
1274 return CMD_WARNING;
1275 }
jardineb5d44e2003-12-23 08:09:43 +00001276 assert (circuit);
1277
1278 met = atoi (argv[0]);
1279
hassof21fb272005-09-26 17:05:55 +00001280 circuit->te_metric[0] = met;
1281 circuit->te_metric[1] = met;
1282
1283 if (met > 63)
1284 met = 63;
1285
jardineb5d44e2003-12-23 08:09:43 +00001286 circuit->metrics[0].metric_default = met;
1287 circuit->metrics[1].metric_default = met;
1288
1289 return CMD_SUCCESS;
1290}
1291
1292DEFUN (no_isis_metric,
1293 no_isis_metric_cmd,
1294 "no isis metric",
1295 NO_STR
1296 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001297 "Set default metric for circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001298{
1299 struct isis_circuit *circuit;
1300 struct interface *ifp;
1301
hassof390d2c2004-09-10 20:48:21 +00001302 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001303 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001304 if (circuit == NULL)
1305 {
1306 return CMD_WARNING;
1307 }
jardineb5d44e2003-12-23 08:09:43 +00001308 assert (circuit);
1309
hassof21fb272005-09-26 17:05:55 +00001310 circuit->te_metric[0] = DEFAULT_CIRCUIT_METRICS;
1311 circuit->te_metric[1] = DEFAULT_CIRCUIT_METRICS;
jardineb5d44e2003-12-23 08:09:43 +00001312 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRICS;
1313 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRICS;
1314
1315 return CMD_SUCCESS;
1316}
1317
1318ALIAS (no_isis_metric,
1319 no_isis_metric_arg_cmd,
hassof21fb272005-09-26 17:05:55 +00001320 "no isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001321 NO_STR
1322 "IS-IS commands\n"
1323 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001324 "Default metric value\n")
1325
jardineb5d44e2003-12-23 08:09:43 +00001326/* end of metrics */
hassof21fb272005-09-26 17:05:55 +00001327DEFUN (isis_hello_interval,
jardineb5d44e2003-12-23 08:09:43 +00001328 isis_hello_interval_cmd,
1329 "isis hello-interval (<1-65535>|minimal)",
1330 "IS-IS commands\n"
1331 "Set Hello interval\n"
1332 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00001333 "Holdtime 1 seconds, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00001334{
1335 struct isis_circuit *circuit;
1336 struct interface *ifp;
1337 int interval;
1338 char c;
1339
hassof390d2c2004-09-10 20:48:21 +00001340 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001341 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001342 if (circuit == NULL)
1343 {
1344 return CMD_WARNING;
1345 }
1346 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001347 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001348 if (isdigit ((int) c))
1349 {
1350 interval = atoi (argv[0]);
1351 }
1352 else
1353 interval = HELLO_MINIMAL; /* FIXME: should be calculated */
jardineb5d44e2003-12-23 08:09:43 +00001354
hassof390d2c2004-09-10 20:48:21 +00001355 circuit->hello_interval[0] = (u_int16_t) interval;
1356 circuit->hello_interval[1] = (u_int16_t) interval;
1357
jardineb5d44e2003-12-23 08:09:43 +00001358 return CMD_SUCCESS;
1359}
1360
1361DEFUN (no_isis_hello_interval,
1362 no_isis_hello_interval_cmd,
1363 "no isis hello-interval",
1364 NO_STR
1365 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001366 "Set Hello interval\n")
jardineb5d44e2003-12-23 08:09:43 +00001367{
1368 struct isis_circuit *circuit;
1369 struct interface *ifp;
1370
hassof390d2c2004-09-10 20:48:21 +00001371 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001372 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001373 if (circuit == NULL)
1374 {
1375 return CMD_WARNING;
1376 }
jardineb5d44e2003-12-23 08:09:43 +00001377 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001378
hassof390d2c2004-09-10 20:48:21 +00001379
1380 circuit->hello_interval[0] = HELLO_INTERVAL; /* Default is 1 sec. */
jardineb5d44e2003-12-23 08:09:43 +00001381 circuit->hello_interval[1] = HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001382
jardineb5d44e2003-12-23 08:09:43 +00001383 return CMD_SUCCESS;
1384}
1385
1386ALIAS (no_isis_hello_interval,
1387 no_isis_hello_interval_arg_cmd,
1388 "no isis hello-interval (<1-65535>|minimal)",
1389 NO_STR
1390 "IS-IS commands\n"
1391 "Set Hello interval\n"
1392 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00001393 "Holdtime 1 second, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00001394
1395DEFUN (isis_hello_interval_l1,
1396 isis_hello_interval_l1_cmd,
1397 "isis hello-interval (<1-65535>|minimal) level-1",
1398 "IS-IS commands\n"
1399 "Set Hello interval\n"
1400 "Hello interval value\n"
1401 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001402 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001403{
1404 struct isis_circuit *circuit;
1405 struct interface *ifp;
1406 long interval;
1407 char c;
1408
hassof390d2c2004-09-10 20:48:21 +00001409 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001410 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001411 if (circuit == NULL)
1412 {
1413 return CMD_WARNING;
1414 }
jardineb5d44e2003-12-23 08:09:43 +00001415 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001416
jardineb5d44e2003-12-23 08:09:43 +00001417 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001418 if (isdigit ((int) c))
1419 {
1420 interval = atoi (argv[0]);
1421 }
1422 else
jardineb5d44e2003-12-23 08:09:43 +00001423 interval = HELLO_MINIMAL;
1424
hassof390d2c2004-09-10 20:48:21 +00001425 circuit->hello_interval[0] = (u_int16_t) interval;
1426
jardineb5d44e2003-12-23 08:09:43 +00001427 return CMD_SUCCESS;
1428}
1429
1430DEFUN (no_isis_hello_interval_l1,
1431 no_isis_hello_interval_l1_cmd,
1432 "no isis hello-interval level-1",
1433 NO_STR
1434 "IS-IS commands\n"
1435 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00001436 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001437{
1438 struct isis_circuit *circuit;
1439 struct interface *ifp;
1440
hassof390d2c2004-09-10 20:48:21 +00001441 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001442 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001443 if (circuit == NULL)
1444 {
1445 return CMD_WARNING;
1446 }
jardineb5d44e2003-12-23 08:09:43 +00001447 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001448
hassof390d2c2004-09-10 20:48:21 +00001449
1450 circuit->hello_interval[0] = HELLO_INTERVAL; /* Default is 1 sec. */
1451
jardineb5d44e2003-12-23 08:09:43 +00001452 return CMD_SUCCESS;
1453}
1454
1455ALIAS (no_isis_hello_interval_l1,
1456 no_isis_hello_interval_l1_arg_cmd,
1457 "no isis hello-interval (<1-65535>|minimal) level-1",
1458 NO_STR
1459 "IS-IS commands\n"
1460 "Set Hello interval\n"
1461 "Hello interval value\n"
1462 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001463 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001464
1465DEFUN (isis_hello_interval_l2,
1466 isis_hello_interval_l2_cmd,
1467 "isis hello-interval (<1-65535>|minimal) level-2",
1468 "IS-IS commands\n"
1469 "Set Hello interval\n"
1470 "Hello interval value\n"
1471 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001472 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001473{
1474 struct isis_circuit *circuit;
1475 struct interface *ifp;
1476 long interval;
1477 char c;
1478
hassof390d2c2004-09-10 20:48:21 +00001479 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001480 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001481 if (circuit == NULL)
1482 {
1483 return CMD_WARNING;
1484 }
jardineb5d44e2003-12-23 08:09:43 +00001485 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001486
jardineb5d44e2003-12-23 08:09:43 +00001487 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001488 if (isdigit ((int) c))
1489 {
1490 interval = atoi (argv[0]);
1491 }
1492 else
jardineb5d44e2003-12-23 08:09:43 +00001493 interval = HELLO_MINIMAL;
1494
hassof390d2c2004-09-10 20:48:21 +00001495 circuit->hello_interval[1] = (u_int16_t) interval;
1496
jardineb5d44e2003-12-23 08:09:43 +00001497 return CMD_SUCCESS;
1498}
1499
1500DEFUN (no_isis_hello_interval_l2,
1501 no_isis_hello_interval_l2_cmd,
1502 "no isis hello-interval level-2",
1503 NO_STR
1504 "IS-IS commands\n"
1505 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00001506 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001507{
1508 struct isis_circuit *circuit;
1509 struct interface *ifp;
1510
hassof390d2c2004-09-10 20:48:21 +00001511 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001512 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001513 if (circuit == NULL)
1514 {
1515 return CMD_WARNING;
1516 }
jardineb5d44e2003-12-23 08:09:43 +00001517 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001518
hassof390d2c2004-09-10 20:48:21 +00001519
1520 circuit->hello_interval[1] = HELLO_INTERVAL; /* Default is 1 sec. */
1521
jardineb5d44e2003-12-23 08:09:43 +00001522 return CMD_SUCCESS;
1523}
1524
1525ALIAS (no_isis_hello_interval_l2,
1526 no_isis_hello_interval_l2_arg_cmd,
1527 "no isis hello-interval (<1-65535>|minimal) level-2",
1528 NO_STR
1529 "IS-IS commands\n"
1530 "Set Hello interval\n"
1531 "Hello interval value\n"
1532 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001533 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001534
1535DEFUN (isis_hello_multiplier,
1536 isis_hello_multiplier_cmd,
1537 "isis hello-multiplier <3-1000>",
1538 "IS-IS commands\n"
1539 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001540 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00001541{
1542 struct isis_circuit *circuit;
1543 struct interface *ifp;
1544 int mult;
hassof390d2c2004-09-10 20:48:21 +00001545
1546 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001547 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001548 if (circuit == NULL)
1549 {
1550 return CMD_WARNING;
1551 }
jardineb5d44e2003-12-23 08:09:43 +00001552 assert (circuit);
1553
1554 mult = atoi (argv[0]);
1555
hassof390d2c2004-09-10 20:48:21 +00001556 circuit->hello_multiplier[0] = (u_int16_t) mult;
1557 circuit->hello_multiplier[1] = (u_int16_t) mult;
1558
jardineb5d44e2003-12-23 08:09:43 +00001559 return CMD_SUCCESS;
1560}
1561
1562DEFUN (no_isis_hello_multiplier,
1563 no_isis_hello_multiplier_cmd,
1564 "no isis hello-multiplier",
1565 NO_STR
1566 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001567 "Set multiplier for Hello holding time\n")
jardineb5d44e2003-12-23 08:09:43 +00001568{
1569 struct isis_circuit *circuit;
1570 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001571
1572 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001573 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001574 if (circuit == NULL)
1575 {
1576 return CMD_WARNING;
1577 }
jardineb5d44e2003-12-23 08:09:43 +00001578 assert (circuit);
1579
1580 circuit->hello_multiplier[0] = HELLO_MULTIPLIER;
1581 circuit->hello_multiplier[1] = HELLO_MULTIPLIER;
1582
1583 return CMD_SUCCESS;
1584}
1585
1586ALIAS (no_isis_hello_multiplier,
1587 no_isis_hello_multiplier_arg_cmd,
1588 "no isis hello-multiplier <3-1000>",
1589 NO_STR
1590 "IS-IS commands\n"
1591 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001592 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00001593
1594DEFUN (isis_hello_multiplier_l1,
1595 isis_hello_multiplier_l1_cmd,
1596 "isis hello-multiplier <3-1000> level-1",
1597 "IS-IS commands\n"
1598 "Set multiplier for Hello holding time\n"
1599 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001600 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001601{
1602 struct isis_circuit *circuit;
1603 struct interface *ifp;
1604 int mult;
hassof390d2c2004-09-10 20:48:21 +00001605
1606 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001607 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001608 if (circuit == NULL)
1609 {
1610 return CMD_WARNING;
1611 }
jardineb5d44e2003-12-23 08:09:43 +00001612 assert (circuit);
1613
1614 mult = atoi (argv[0]);
1615
hassof390d2c2004-09-10 20:48:21 +00001616 circuit->hello_multiplier[0] = (u_int16_t) mult;
1617
jardineb5d44e2003-12-23 08:09:43 +00001618 return CMD_SUCCESS;
1619}
1620
1621DEFUN (no_isis_hello_multiplier_l1,
1622 no_isis_hello_multiplier_l1_cmd,
1623 "no isis hello-multiplier level-1",
1624 NO_STR
1625 "IS-IS commands\n"
1626 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001627 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001628{
1629 struct isis_circuit *circuit;
1630 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001631
1632 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001633 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001634 if (circuit == NULL)
1635 {
1636 return CMD_WARNING;
1637 }
jardineb5d44e2003-12-23 08:09:43 +00001638 assert (circuit);
1639
1640 circuit->hello_multiplier[0] = HELLO_MULTIPLIER;
1641
1642 return CMD_SUCCESS;
1643}
1644
1645ALIAS (no_isis_hello_multiplier_l1,
1646 no_isis_hello_multiplier_l1_arg_cmd,
1647 "no isis hello-multiplier <3-1000> level-1",
1648 NO_STR
1649 "IS-IS commands\n"
1650 "Set multiplier for Hello holding time\n"
1651 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001652 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001653
1654DEFUN (isis_hello_multiplier_l2,
1655 isis_hello_multiplier_l2_cmd,
1656 "isis hello-multiplier <3-1000> level-2",
1657 "IS-IS commands\n"
1658 "Set multiplier for Hello holding time\n"
1659 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001660 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001661{
1662 struct isis_circuit *circuit;
1663 struct interface *ifp;
1664 int mult;
hassof390d2c2004-09-10 20:48:21 +00001665
1666 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001667 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001668 if (circuit == NULL)
1669 {
1670 return CMD_WARNING;
1671 }
jardineb5d44e2003-12-23 08:09:43 +00001672 assert (circuit);
1673
1674 mult = atoi (argv[0]);
1675
hassof390d2c2004-09-10 20:48:21 +00001676 circuit->hello_multiplier[1] = (u_int16_t) mult;
1677
jardineb5d44e2003-12-23 08:09:43 +00001678 return CMD_SUCCESS;
1679}
1680
1681DEFUN (no_isis_hello_multiplier_l2,
1682 no_isis_hello_multiplier_l2_cmd,
1683 "no isis hello-multiplier level-2",
1684 NO_STR
1685 "IS-IS commands\n"
1686 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001687 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001688{
1689 struct isis_circuit *circuit;
1690 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001691
1692 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001693 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001694 if (circuit == NULL)
1695 {
1696 return CMD_WARNING;
1697 }
jardineb5d44e2003-12-23 08:09:43 +00001698 assert (circuit);
1699
1700 circuit->hello_multiplier[1] = HELLO_MULTIPLIER;
1701
1702 return CMD_SUCCESS;
1703}
1704
1705ALIAS (no_isis_hello_multiplier_l2,
1706 no_isis_hello_multiplier_l2_arg_cmd,
1707 "no isis hello-multiplier <3-1000> level-2",
1708 NO_STR
1709 "IS-IS commands\n"
1710 "Set multiplier for Hello holding time\n"
1711 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001712 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001713
1714DEFUN (isis_hello,
1715 isis_hello_cmd,
1716 "isis hello padding",
1717 "IS-IS commands\n"
1718 "Add padding to IS-IS hello packets\n"
1719 "Pad hello packets\n"
1720 "<cr>\n")
1721{
1722 struct interface *ifp;
1723 struct isis_circuit *circuit;
hassof390d2c2004-09-10 20:48:21 +00001724
1725 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001726 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001727 if (circuit == NULL)
1728 {
1729 return CMD_WARNING;
1730 }
jardineb5d44e2003-12-23 08:09:43 +00001731 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001732
jardineb5d44e2003-12-23 08:09:43 +00001733 circuit->u.bc.pad_hellos = 1;
hassof390d2c2004-09-10 20:48:21 +00001734
jardineb5d44e2003-12-23 08:09:43 +00001735 return CMD_SUCCESS;
1736}
1737
jardineb5d44e2003-12-23 08:09:43 +00001738DEFUN (no_isis_hello,
1739 no_isis_hello_cmd,
1740 "no isis hello padding",
1741 NO_STR
1742 "IS-IS commands\n"
1743 "Add padding to IS-IS hello packets\n"
1744 "Pad hello packets\n"
1745 "<cr>\n")
1746{
1747 struct isis_circuit *circuit;
1748 struct interface *ifp;
1749
hassof390d2c2004-09-10 20:48:21 +00001750 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001751 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001752 if (circuit == NULL)
1753 {
1754 return CMD_WARNING;
1755 }
jardineb5d44e2003-12-23 08:09:43 +00001756 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001757
jardineb5d44e2003-12-23 08:09:43 +00001758 circuit->u.bc.pad_hellos = 0;
hassof390d2c2004-09-10 20:48:21 +00001759
jardineb5d44e2003-12-23 08:09:43 +00001760 return CMD_SUCCESS;
1761}
1762
1763DEFUN (csnp_interval,
1764 csnp_interval_cmd,
1765 "isis csnp-interval <0-65535>",
1766 "IS-IS commands\n"
1767 "Set CSNP interval in seconds\n"
1768 "CSNP interval value\n")
1769{
1770 struct isis_circuit *circuit;
1771 struct interface *ifp;
1772 unsigned long interval;
1773
hassof390d2c2004-09-10 20:48:21 +00001774 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001775 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001776 if (circuit == NULL)
1777 {
1778 return CMD_WARNING;
1779 }
jardineb5d44e2003-12-23 08:09:43 +00001780 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001781
jardineb5d44e2003-12-23 08:09:43 +00001782 interval = atol (argv[0]);
1783
hassof390d2c2004-09-10 20:48:21 +00001784 circuit->csnp_interval[0] = (u_int16_t) interval;
1785 circuit->csnp_interval[1] = (u_int16_t) interval;
1786
jardineb5d44e2003-12-23 08:09:43 +00001787 return CMD_SUCCESS;
1788}
1789
1790DEFUN (no_csnp_interval,
1791 no_csnp_interval_cmd,
1792 "no isis csnp-interval",
1793 NO_STR
1794 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001795 "Set CSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001796{
1797 struct isis_circuit *circuit;
1798 struct interface *ifp;
1799
hassof390d2c2004-09-10 20:48:21 +00001800 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001801 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001802 if (circuit == NULL)
1803 {
1804 return CMD_WARNING;
1805 }
jardineb5d44e2003-12-23 08:09:43 +00001806 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001807
jardineb5d44e2003-12-23 08:09:43 +00001808 circuit->csnp_interval[0] = CSNP_INTERVAL;
1809 circuit->csnp_interval[1] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001810
jardineb5d44e2003-12-23 08:09:43 +00001811 return CMD_SUCCESS;
1812}
1813
1814ALIAS (no_csnp_interval,
1815 no_csnp_interval_arg_cmd,
1816 "no isis csnp-interval <0-65535>",
1817 NO_STR
1818 "IS-IS commands\n"
1819 "Set CSNP interval in seconds\n"
1820 "CSNP interval value\n")
1821
jardineb5d44e2003-12-23 08:09:43 +00001822DEFUN (csnp_interval_l1,
1823 csnp_interval_l1_cmd,
1824 "isis csnp-interval <0-65535> level-1",
1825 "IS-IS commands\n"
1826 "Set CSNP interval in seconds\n"
1827 "CSNP interval value\n"
1828 "Specify interval for level-1 CSNPs\n")
1829{
1830 struct isis_circuit *circuit;
1831 struct interface *ifp;
1832 unsigned long interval;
1833
hassof390d2c2004-09-10 20:48:21 +00001834 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001835 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001836 if (circuit == NULL)
1837 {
1838 return CMD_WARNING;
1839 }
jardineb5d44e2003-12-23 08:09:43 +00001840 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001841
jardineb5d44e2003-12-23 08:09:43 +00001842 interval = atol (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001843
1844 circuit->csnp_interval[0] = (u_int16_t) interval;
1845
jardineb5d44e2003-12-23 08:09:43 +00001846 return CMD_SUCCESS;
1847}
1848
1849DEFUN (no_csnp_interval_l1,
1850 no_csnp_interval_l1_cmd,
1851 "no isis csnp-interval level-1",
1852 NO_STR
1853 "IS-IS commands\n"
1854 "Set CSNP interval in seconds\n"
1855 "Specify interval for level-1 CSNPs\n")
1856{
1857 struct isis_circuit *circuit;
1858 struct interface *ifp;
1859
hassof390d2c2004-09-10 20:48:21 +00001860 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001861 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001862 if (circuit == NULL)
1863 {
1864 return CMD_WARNING;
1865 }
jardineb5d44e2003-12-23 08:09:43 +00001866 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001867
jardineb5d44e2003-12-23 08:09:43 +00001868 circuit->csnp_interval[0] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001869
jardineb5d44e2003-12-23 08:09:43 +00001870 return CMD_SUCCESS;
1871}
1872
1873ALIAS (no_csnp_interval_l1,
1874 no_csnp_interval_l1_arg_cmd,
1875 "no isis csnp-interval <0-65535> level-1",
1876 NO_STR
1877 "IS-IS commands\n"
1878 "Set CSNP interval in seconds\n"
1879 "CSNP interval value\n"
1880 "Specify interval for level-1 CSNPs\n")
1881
jardineb5d44e2003-12-23 08:09:43 +00001882DEFUN (csnp_interval_l2,
1883 csnp_interval_l2_cmd,
1884 "isis csnp-interval <0-65535> level-2",
1885 "IS-IS commands\n"
1886 "Set CSNP interval in seconds\n"
1887 "CSNP interval value\n"
1888 "Specify interval for level-2 CSNPs\n")
1889{
1890 struct isis_circuit *circuit;
1891 struct interface *ifp;
1892 unsigned long interval;
1893
hassof390d2c2004-09-10 20:48:21 +00001894 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001895 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001896 if (circuit == NULL)
1897 {
1898 return CMD_WARNING;
1899 }
jardineb5d44e2003-12-23 08:09:43 +00001900 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001901
jardineb5d44e2003-12-23 08:09:43 +00001902 interval = atol (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001903
1904 circuit->csnp_interval[1] = (u_int16_t) interval;
1905
jardineb5d44e2003-12-23 08:09:43 +00001906 return CMD_SUCCESS;
1907}
1908
1909DEFUN (no_csnp_interval_l2,
1910 no_csnp_interval_l2_cmd,
1911 "no isis csnp-interval level-2",
1912 NO_STR
1913 "IS-IS commands\n"
1914 "Set CSNP interval in seconds\n"
1915 "Specify interval for level-2 CSNPs\n")
1916{
1917 struct isis_circuit *circuit;
1918 struct interface *ifp;
1919
hassof390d2c2004-09-10 20:48:21 +00001920 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001921 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001922 if (circuit == NULL)
1923 {
1924 return CMD_WARNING;
1925 }
jardineb5d44e2003-12-23 08:09:43 +00001926 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001927
jardineb5d44e2003-12-23 08:09:43 +00001928 circuit->csnp_interval[1] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001929
jardineb5d44e2003-12-23 08:09:43 +00001930 return CMD_SUCCESS;
1931}
1932
1933ALIAS (no_csnp_interval_l2,
1934 no_csnp_interval_l2_arg_cmd,
1935 "no isis csnp-interval <0-65535> level-2",
1936 NO_STR
1937 "IS-IS commands\n"
1938 "Set CSNP interval in seconds\n"
1939 "CSNP interval value\n"
1940 "Specify interval for level-2 CSNPs\n")
1941
jardineb5d44e2003-12-23 08:09:43 +00001942#ifdef HAVE_IPV6
1943DEFUN (ipv6_router_isis,
1944 ipv6_router_isis_cmd,
1945 "ipv6 router isis WORD",
1946 "IPv6 interface subcommands\n"
1947 "IPv6 Router interface commands\n"
1948 "IS-IS Routing for IPv6\n"
1949 "Routing process tag\n")
1950{
1951 struct isis_circuit *c;
1952 struct interface *ifp;
1953 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001954
1955 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001956 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +00001957
jardineb5d44e2003-12-23 08:09:43 +00001958 area = isis_area_lookup (argv[0]);
1959
1960 /* Prevent more than one circuit per interface */
1961 if (area)
1962 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +00001963 else
1964 c = NULL;
1965
1966 if (c && (ifp->info != NULL))
1967 {
1968 if (c->ipv6_router == 1)
1969 {
1970 vty_out (vty, "ISIS circuit is already defined for IPv6%s",
1971 VTY_NEWLINE);
1972 return CMD_WARNING;
1973 }
jardineb5d44e2003-12-23 08:09:43 +00001974 }
jardineb5d44e2003-12-23 08:09:43 +00001975
1976 /* this is here for ciscopability */
hassof390d2c2004-09-10 20:48:21 +00001977 if (!area)
1978 {
1979 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1980 return CMD_WARNING;
1981 }
jardineb5d44e2003-12-23 08:09:43 +00001982
hassof390d2c2004-09-10 20:48:21 +00001983 if (!c)
1984 {
1985 c = circuit_lookup_by_ifp (ifp, isis->init_circ_list);
1986 c = isis_csm_state_change (ISIS_ENABLE, c, area);
1987 c->interface = ifp;
1988 ifp->info = c;
1989 }
jardineb5d44e2003-12-23 08:09:43 +00001990
hassof390d2c2004-09-10 20:48:21 +00001991 if (!c)
jardineb5d44e2003-12-23 08:09:43 +00001992 return CMD_WARNING;
1993
1994 c->ipv6_router = 1;
1995 area->ipv6_circuits++;
1996 circuit_update_nlpids (c);
1997
1998 vty->node = INTERFACE_NODE;
1999
2000 return CMD_SUCCESS;
2001}
2002
2003DEFUN (no_ipv6_router_isis,
2004 no_ipv6_router_isis_cmd,
2005 "no ipv6 router isis WORD",
2006 NO_STR
2007 "IPv6 interface subcommands\n"
2008 "IPv6 Router interface commands\n"
2009 "IS-IS Routing for IPv6\n"
2010 "Routing process tag\n")
2011{
2012 struct isis_circuit *c;
2013 struct interface *ifp;
2014 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00002015
2016 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +00002017 /* UGLY - will remove l8r
2018 if (circuit == NULL) {
hassof390d2c2004-09-10 20:48:21 +00002019 return CMD_WARNING;
2020 } */
jardineb5d44e2003-12-23 08:09:43 +00002021 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +00002022
jardineb5d44e2003-12-23 08:09:43 +00002023 area = isis_area_lookup (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00002024 if (!area)
2025 {
2026 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
2027 return CMD_WARNING;
2028 }
2029
jardineb5d44e2003-12-23 08:09:43 +00002030 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
2031 if (!c)
2032 return CMD_WARNING;
2033
2034 c->ipv6_router = 0;
2035 area->ipv6_circuits--;
2036 if (c->ip_router == 0)
2037 isis_csm_state_change (ISIS_DISABLE, c, area);
2038
2039 return CMD_SUCCESS;
2040}
hassof390d2c2004-09-10 20:48:21 +00002041#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +00002042
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08002043static struct cmd_node interface_node = {
jardineb5d44e2003-12-23 08:09:43 +00002044 INTERFACE_NODE,
2045 "%s(config-if)# ",
2046 1,
2047};
2048
jardineb5d44e2003-12-23 08:09:43 +00002049int
2050isis_if_new_hook (struct interface *ifp)
2051{
2052/* FIXME: Discuss if the circuit should be created here
2053 ifp->info = XMALLOC (MTYPE_ISIS_IF_INFO, sizeof (struct isis_if_info)); */
2054 ifp->info = NULL;
2055 return 0;
2056}
2057
2058int
2059isis_if_delete_hook (struct interface *ifp)
2060{
2061/* FIXME: Discuss if the circuit should be created here
2062 XFREE (MTYPE_ISIS_IF_INFO, ifp->info);*/
2063 ifp->info = NULL;
2064 return 0;
2065}
2066
jardineb5d44e2003-12-23 08:09:43 +00002067void
2068isis_circuit_init ()
2069{
jardineb5d44e2003-12-23 08:09:43 +00002070 /* Initialize Zebra interface data structure */
2071 if_init ();
2072 if_add_hook (IF_NEW_HOOK, isis_if_new_hook);
2073 if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook);
2074
2075 /* Install interface node */
2076 install_node (&interface_node, isis_interface_config_write);
2077 install_element (CONFIG_NODE, &interface_cmd);
2078
2079 install_default (INTERFACE_NODE);
2080 install_element (INTERFACE_NODE, &interface_desc_cmd);
2081 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
2082
2083 install_element (INTERFACE_NODE, &ip_router_isis_cmd);
2084 install_element (INTERFACE_NODE, &no_ip_router_isis_cmd);
2085
2086 install_element (INTERFACE_NODE, &isis_circuit_type_cmd);
2087 install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd);
2088
2089 install_element (INTERFACE_NODE, &isis_passwd_cmd);
2090 install_element (INTERFACE_NODE, &no_isis_passwd_cmd);
2091
2092 install_element (INTERFACE_NODE, &isis_priority_cmd);
2093 install_element (INTERFACE_NODE, &no_isis_priority_cmd);
2094 install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd);
2095 install_element (INTERFACE_NODE, &isis_priority_l1_cmd);
2096 install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd);
2097 install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd);
2098 install_element (INTERFACE_NODE, &isis_priority_l2_cmd);
2099 install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd);
2100 install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd);
2101
2102 install_element (INTERFACE_NODE, &isis_metric_cmd);
2103 install_element (INTERFACE_NODE, &no_isis_metric_cmd);
2104 install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd);
2105
2106 install_element (INTERFACE_NODE, &isis_hello_interval_cmd);
2107 install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd);
2108 install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd);
2109 install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd);
2110 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd);
2111 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd);
2112 install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd);
2113 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd);
2114 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd);
2115
2116 install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd);
2117 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
2118 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd);
2119 install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd);
2120 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd);
2121 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd);
2122 install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd);
2123 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd);
2124 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd);
2125
2126 install_element (INTERFACE_NODE, &isis_hello_cmd);
2127 install_element (INTERFACE_NODE, &no_isis_hello_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002128 install_element (INTERFACE_NODE, &csnp_interval_cmd);
2129 install_element (INTERFACE_NODE, &no_csnp_interval_cmd);
2130 install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd);
2131 install_element (INTERFACE_NODE, &csnp_interval_l1_cmd);
2132 install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd);
2133 install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd);
2134 install_element (INTERFACE_NODE, &csnp_interval_l2_cmd);
2135 install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd);
2136 install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd);
2137
2138#ifdef HAVE_IPV6
2139 install_element (INTERFACE_NODE, &ipv6_router_isis_cmd);
2140 install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002141#endif
jardineb5d44e2003-12-23 08:09:43 +00002142}