blob: d2923b575135eb0aa59f1026343f6bc8af456bbf [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
jardineb5d44e2003-12-23 08:09:43 +0000145 /* Remove circuit from area */
146 listnode_delete (area->circuit_list, circuit);
147 /* Free the index of SRM and SSN flags */
148 flags_free_index (&area->flags, circuit->idx);
149
150 return;
151}
152
153struct isis_circuit *
154circuit_lookup_by_ifp (struct interface *ifp, struct list *list)
155{
156 struct isis_circuit *circuit = NULL;
157 struct listnode *node;
hassof390d2c2004-09-10 20:48:21 +0000158
jardineb5d44e2003-12-23 08:09:43 +0000159 if (!list)
160 return NULL;
hassof390d2c2004-09-10 20:48:21 +0000161
paul1eb8ef22005-04-07 07:30:20 +0000162 for (ALL_LIST_ELEMENTS_RO (list, node, circuit))
163 if (circuit->interface == ifp)
164 return circuit;
165
jardineb5d44e2003-12-23 08:09:43 +0000166 return NULL;
167}
168
169struct isis_circuit *
170circuit_scan_by_ifp (struct interface *ifp)
171{
172 struct isis_area *area;
173 struct listnode *node;
174 struct isis_circuit *circuit;
175
176 if (!isis->area_list)
177 return NULL;
178
paul1eb8ef22005-04-07 07:30:20 +0000179 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +0000180 {
hassof390d2c2004-09-10 20:48:21 +0000181 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
182 if (circuit)
183 return circuit;
184 }
185
jardineb5d44e2003-12-23 08:09:43 +0000186 return circuit_lookup_by_ifp (ifp, isis->init_circ_list);
187}
188
189void
190isis_circuit_del (struct isis_circuit *circuit)
191{
192
193 if (!circuit)
194 return;
195
hassof390d2c2004-09-10 20:48:21 +0000196 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
197 {
198 /* destroy adjacency databases */
hasso46606872004-12-29 19:34:22 +0000199 if (circuit->u.bc.adjdb[0])
200 list_delete (circuit->u.bc.adjdb[0]);
201 if (circuit->u.bc.adjdb[1])
202 list_delete (circuit->u.bc.adjdb[1]);
hassof390d2c2004-09-10 20:48:21 +0000203 /* destroy neighbour lists */
204 if (circuit->u.bc.lan_neighs[0])
205 list_delete (circuit->u.bc.lan_neighs[0]);
206 if (circuit->u.bc.lan_neighs[1])
207 list_delete (circuit->u.bc.lan_neighs[1]);
208 /* destroy addresses */
209 }
jardineb5d44e2003-12-23 08:09:43 +0000210 if (circuit->ip_addrs)
211 list_delete (circuit->ip_addrs);
212#ifdef HAVE_IPV6
213 if (circuit->ipv6_link)
214 list_delete (circuit->ipv6_link);
215 if (circuit->ipv6_non_link)
216 list_delete (circuit->ipv6_non_link);
217#endif /* HAVE_IPV6 */
hassof390d2c2004-09-10 20:48:21 +0000218
jardineb5d44e2003-12-23 08:09:43 +0000219 /* and lastly the circuit itself */
220 XFREE (MTYPE_ISIS_CIRCUIT, circuit);
221
222 return;
223}
224
225void
hassof891f442004-09-14 13:54:30 +0000226isis_circuit_add_addr (struct isis_circuit *circuit,
227 struct connected *connected)
jardineb5d44e2003-12-23 08:09:43 +0000228{
229 struct prefix_ipv4 *ipv4;
hassof390d2c2004-09-10 20:48:21 +0000230 u_char buf[BUFSIZ];
jardineb5d44e2003-12-23 08:09:43 +0000231#ifdef HAVE_IPV6
232 struct prefix_ipv6 *ipv6;
233#endif /* HAVE_IPV6 */
hassof891f442004-09-14 13:54:30 +0000234
hassof390d2c2004-09-10 20:48:21 +0000235 if (!circuit->ip_addrs)
hassof891f442004-09-14 13:54:30 +0000236 circuit->ip_addrs = list_new ();
jardineb5d44e2003-12-23 08:09:43 +0000237#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000238 if (!circuit->ipv6_link)
hassof891f442004-09-14 13:54:30 +0000239 circuit->ipv6_link = list_new ();
hassof390d2c2004-09-10 20:48:21 +0000240 if (!circuit->ipv6_non_link)
hassof891f442004-09-14 13:54:30 +0000241 circuit->ipv6_non_link = list_new ();
jardineb5d44e2003-12-23 08:09:43 +0000242#endif /* HAVE_IPV6 */
243
244 memset (&buf, 0, BUFSIZ);
hassof891f442004-09-14 13:54:30 +0000245 if (connected->address->family == AF_INET)
hassof390d2c2004-09-10 20:48:21 +0000246 {
247 ipv4 = prefix_ipv4_new ();
hassof891f442004-09-14 13:54:30 +0000248 ipv4->prefixlen = connected->address->prefixlen;
249 ipv4->prefix = connected->address->u.prefix4;
hassof390d2c2004-09-10 20:48:21 +0000250 listnode_add (circuit->ip_addrs, ipv4);
hasso0dae85e2004-09-26 19:53:47 +0000251 if (circuit->area)
252 lsp_regenerate_schedule (circuit->area);
hassof891f442004-09-14 13:54:30 +0000253
jardineb5d44e2003-12-23 08:09:43 +0000254#ifdef EXTREME_DEBUG
hassof891f442004-09-14 13:54:30 +0000255 prefix2str (connected->address, buf, BUFSIZ);
hasso529d65b2004-12-24 00:14:50 +0000256 zlog_debug ("Added IP address %s to circuit %d", buf,
hassof390d2c2004-09-10 20:48:21 +0000257 circuit->circuit_id);
258#endif /* EXTREME_DEBUG */
jardineb5d44e2003-12-23 08:09:43 +0000259 }
hassof390d2c2004-09-10 20:48:21 +0000260#ifdef HAVE_IPV6
hassof891f442004-09-14 13:54:30 +0000261 if (connected->address->family == AF_INET6)
hassof390d2c2004-09-10 20:48:21 +0000262 {
263 ipv6 = prefix_ipv6_new ();
hassof891f442004-09-14 13:54:30 +0000264 ipv6->prefixlen = connected->address->prefixlen;
265 ipv6->prefix = connected->address->u.prefix6;
266
hassof390d2c2004-09-10 20:48:21 +0000267 if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix))
hassof891f442004-09-14 13:54:30 +0000268 listnode_add (circuit->ipv6_link, ipv6);
hassof390d2c2004-09-10 20:48:21 +0000269 else
hassof891f442004-09-14 13:54:30 +0000270 listnode_add (circuit->ipv6_non_link, ipv6);
hasso0dae85e2004-09-26 19:53:47 +0000271 if (circuit->area)
272 lsp_regenerate_schedule (circuit->area);
hassof891f442004-09-14 13:54:30 +0000273
jardineb5d44e2003-12-23 08:09:43 +0000274#ifdef EXTREME_DEBUG
hassof891f442004-09-14 13:54:30 +0000275 prefix2str (connected->address, buf, BUFSIZ);
hasso529d65b2004-12-24 00:14:50 +0000276 zlog_debug ("Added IPv6 address %s to circuit %d", buf,
hassof390d2c2004-09-10 20:48:21 +0000277 circuit->circuit_id);
278#endif /* EXTREME_DEBUG */
279 }
jardineb5d44e2003-12-23 08:09:43 +0000280#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000281 return;
282}
283
284void
285isis_circuit_del_addr (struct isis_circuit *circuit,
hassof390d2c2004-09-10 20:48:21 +0000286 struct connected *connected)
jardineb5d44e2003-12-23 08:09:43 +0000287{
hassof891f442004-09-14 13:54:30 +0000288 struct prefix_ipv4 *ipv4, *ip = NULL;
289 struct listnode *node;
hassof891f442004-09-14 13:54:30 +0000290 u_char buf[BUFSIZ];
291#ifdef HAVE_IPV6
292 struct prefix_ipv6 *ipv6, *ip6 = NULL;
Paul Jakma41b36e92006-12-08 01:09:50 +0000293 int found = 0;
hassof891f442004-09-14 13:54:30 +0000294#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000295
hassof891f442004-09-14 13:54:30 +0000296 memset (&buf, 0, BUFSIZ);
297 if (connected->address->family == AF_INET)
298 {
299 ipv4 = prefix_ipv4_new ();
300 ipv4->prefixlen = connected->address->prefixlen;
301 ipv4->prefix = connected->address->u.prefix4;
302
paul1eb8ef22005-04-07 07:30:20 +0000303 for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip))
304 if (prefix_same ((struct prefix *) ip, (struct prefix *) &ipv4))
305 break;
hassof891f442004-09-14 13:54:30 +0000306
307 if (ip)
308 {
309 listnode_delete (circuit->ip_addrs, ip);
hasso0dae85e2004-09-26 19:53:47 +0000310 if (circuit->area)
311 lsp_regenerate_schedule (circuit->area);
hassof891f442004-09-14 13:54:30 +0000312 }
313 else
314 {
hassof7c43dc2004-09-26 16:24:14 +0000315 prefix2str (connected->address, (char *)buf, BUFSIZ);
hassof891f442004-09-14 13:54:30 +0000316 zlog_warn("Nonexitant ip address %s removal attempt from circuit \
317 %d", buf, circuit->circuit_id);
318 }
319 }
320#ifdef HAVE_IPV6
321 if (connected->address->family == AF_INET6)
322 {
323 ipv6 = prefix_ipv6_new ();
324 ipv6->prefixlen = connected->address->prefixlen;
325 ipv6->prefix = connected->address->u.prefix6;
326
327 if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix))
328 {
paul1eb8ef22005-04-07 07:30:20 +0000329 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_link, node, ip6))
hassof891f442004-09-14 13:54:30 +0000330 {
hassof891f442004-09-14 13:54:30 +0000331 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
332 break;
333 }
334 if (ip6)
335 {
336 listnode_delete (circuit->ipv6_link, ip6);
337 found = 1;
338 }
339 }
340 else
341 {
paul1eb8ef22005-04-07 07:30:20 +0000342 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, node, ip6))
hassof891f442004-09-14 13:54:30 +0000343 {
hassof891f442004-09-14 13:54:30 +0000344 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
345 break;
346 }
347 if (ip6)
348 {
349 listnode_delete (circuit->ipv6_non_link, ip6);
350 found = 1;
351 }
352 }
353
354 if (!found)
355 {
hassof7c43dc2004-09-26 16:24:14 +0000356 prefix2str (connected->address, (char *)buf, BUFSIZ);
hassof891f442004-09-14 13:54:30 +0000357 zlog_warn("Nonexitant ip address %s removal attempt from \
358 circuit %d", buf, circuit->circuit_id);
359 }
360 else
hasso0dae85e2004-09-26 19:53:47 +0000361 if (circuit->area)
362 lsp_regenerate_schedule (circuit->area);
hassof891f442004-09-14 13:54:30 +0000363 }
364#endif /* HAVE_IPV6 */
365 return;
jardineb5d44e2003-12-23 08:09:43 +0000366}
367
368void
369isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp)
370{
paul1eb8ef22005-04-07 07:30:20 +0000371 struct listnode *node, *nnode;
jardineb5d44e2003-12-23 08:09:43 +0000372 struct connected *conn;
373
374 circuit->interface = ifp;
375 ifp->info = circuit;
hassof390d2c2004-09-10 20:48:21 +0000376
377 circuit->circuit_id = ifp->ifindex % 255; /* FIXME: Why not ? */
jardineb5d44e2003-12-23 08:09:43 +0000378
379 /* isis_circuit_update_addrs (circuit, ifp); */
380
hassof390d2c2004-09-10 20:48:21 +0000381 if (if_is_broadcast (ifp))
382 {
383 circuit->circ_type = CIRCUIT_T_BROADCAST;
384 /*
385 * Get the Hardware Address
386 */
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000387#ifdef HAVE_STRUCT_SOCKADDR_DL
Paul Jakma238497f2007-08-07 18:49:18 +0000388#ifndef SUNOS_5
hassof390d2c2004-09-10 20:48:21 +0000389 if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN)
390 zlog_warn ("unsupported link layer");
391 else
392 memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl),
393 ETH_ALEN);
Paul Jakma238497f2007-08-07 18:49:18 +0000394#endif
jardineb5d44e2003-12-23 08:09:43 +0000395#else
hassof390d2c2004-09-10 20:48:21 +0000396 if (circuit->interface->hw_addr_len != ETH_ALEN)
397 {
398 zlog_warn ("unsupported link layer");
399 }
400 else
401 {
402 memcpy (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN);
403 }
jardineb5d44e2003-12-23 08:09:43 +0000404#ifdef EXTREME_DEGUG
hasso529d65b2004-12-24 00:14:50 +0000405 zlog_debug ("isis_circuit_if_add: if_id %d, isomtu %d snpa %s",
hassof390d2c2004-09-10 20:48:21 +0000406 circuit->interface->ifindex, ISO_MTU (circuit),
407 snpa_print (circuit->u.bc.snpa));
jardineb5d44e2003-12-23 08:09:43 +0000408
409#endif /* EXTREME_DEBUG */
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000410#endif /* HAVE_STRUCT_SOCKADDR_DL */
hassof390d2c2004-09-10 20:48:21 +0000411 }
412 else if (if_is_pointopoint (ifp))
413 {
414 circuit->circ_type = CIRCUIT_T_P2P;
415 }
416 else
417 {
hassoc89c05d2005-09-04 21:36:36 +0000418 /* It's normal in case of loopback etc. */
419 if (isis->debugs & DEBUG_EVENTS)
420 zlog_debug ("isis_circuit_if_add: unsupported media");
hassof390d2c2004-09-10 20:48:21 +0000421 }
422
paul1eb8ef22005-04-07 07:30:20 +0000423 for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn))
424 isis_circuit_add_addr (circuit, conn);
jardineb5d44e2003-12-23 08:09:43 +0000425
426 return;
427}
428
429void
hassof390d2c2004-09-10 20:48:21 +0000430isis_circuit_update_params (struct isis_circuit *circuit,
431 struct interface *ifp)
jardineb5d44e2003-12-23 08:09:43 +0000432{
hassob30c5e62004-12-29 20:06:41 +0000433 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +0000434
435 if (circuit->circuit_id != ifp->ifindex)
436 {
437 zlog_warn ("changing circuit_id %d->%d", circuit->circuit_id,
438 ifp->ifindex);
439 circuit->circuit_id = ifp->ifindex % 255;
440 }
jardineb5d44e2003-12-23 08:09:43 +0000441
442 /* FIXME: Why is this needed? shouldn't we compare to the area's mtu */
443 /* Ofer, this was here in case someone changes the mtu (e.g. with ifconfig)
444 The areas MTU is the minimum of mtu's of circuits in the area
445 now we can't catch the change
446 if (circuit->mtu != ifp->mtu) {
447 zlog_warn ("changing circuit mtu %d->%d", circuit->mtu,
448 ifp->mtu);
449 circuit->mtu = ifp->mtu;
450 }
hassof390d2c2004-09-10 20:48:21 +0000451 */
jardineb5d44e2003-12-23 08:09:43 +0000452 /*
453 * Get the Hardware Address
454 */
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000455#ifdef HAVE_STRUCT_SOCKADDR_DL
Paul Jakma238497f2007-08-07 18:49:18 +0000456#ifndef SUNOS_5
jardineb5d44e2003-12-23 08:09:43 +0000457 if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN)
jardineb5d44e2003-12-23 08:09:43 +0000458 zlog_warn ("unsupported link layer");
hassof390d2c2004-09-10 20:48:21 +0000459 else
460 memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl), ETH_ALEN);
Paul Jakma238497f2007-08-07 18:49:18 +0000461#endif
hassof390d2c2004-09-10 20:48:21 +0000462#else
463 if (circuit->interface->hw_addr_len != ETH_ALEN)
464 {
465 zlog_warn ("unsupported link layer");
jardineb5d44e2003-12-23 08:09:43 +0000466 }
hassof390d2c2004-09-10 20:48:21 +0000467 else
468 {
469 if (memcmp (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN))
470 {
471 zlog_warn ("changing circuit snpa %s->%s",
472 snpa_print (circuit->u.bc.snpa),
473 snpa_print (circuit->interface->hw_addr));
474 }
475 }
476#endif
jardineb5d44e2003-12-23 08:09:43 +0000477
hassof390d2c2004-09-10 20:48:21 +0000478 if (if_is_broadcast (ifp))
479 {
480 circuit->circ_type = CIRCUIT_T_BROADCAST;
481 }
482 else if (if_is_pointopoint (ifp))
483 {
484 circuit->circ_type = CIRCUIT_T_P2P;
485 }
486 else
487 {
488 zlog_warn ("isis_circuit_update_params: unsupported media");
489 }
jardineb5d44e2003-12-23 08:09:43 +0000490
jardineb5d44e2003-12-23 08:09:43 +0000491 return;
492}
493
494void
hassof390d2c2004-09-10 20:48:21 +0000495isis_circuit_if_del (struct isis_circuit *circuit)
jardineb5d44e2003-12-23 08:09:43 +0000496{
497 circuit->interface->info = NULL;
498 circuit->interface = NULL;
hassof390d2c2004-09-10 20:48:21 +0000499
jardineb5d44e2003-12-23 08:09:43 +0000500 return;
501}
502
503void
504isis_circuit_up (struct isis_circuit *circuit)
505{
jardineb5d44e2003-12-23 08:09:43 +0000506
hassof390d2c2004-09-10 20:48:21 +0000507 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
508 {
509 if (circuit->area->min_bcast_mtu == 0 ||
510 ISO_MTU (circuit) < circuit->area->min_bcast_mtu)
511 circuit->area->min_bcast_mtu = ISO_MTU (circuit);
512 /*
513 * ISO 10589 - 8.4.1 Enabling of broadcast circuits
514 */
jardineb5d44e2003-12-23 08:09:43 +0000515
hassof390d2c2004-09-10 20:48:21 +0000516 /* initilizing the hello sending threads
517 * for a broadcast IF
518 */
jardineb5d44e2003-12-23 08:09:43 +0000519
hassof390d2c2004-09-10 20:48:21 +0000520 /* 8.4.1 a) commence sending of IIH PDUs */
521
522 if (circuit->circuit_is_type & IS_LEVEL_1)
523 {
524 thread_add_event (master, send_lan_l1_hello, circuit, 0);
525 circuit->u.bc.lan_neighs[0] = list_new ();
526 }
527
528 if (circuit->circuit_is_type & IS_LEVEL_2)
529 {
530 thread_add_event (master, send_lan_l2_hello, circuit, 0);
531 circuit->u.bc.lan_neighs[1] = list_new ();
532 }
533
534 /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */
535 /* 8.4.1 c) FIXME: listen for ESH PDUs */
536
537 /* 8.4.1 d) */
538 /* dr election will commence in... */
539 if (circuit->circuit_is_type & IS_LEVEL_1)
540 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
hassobf731012004-09-17 07:59:57 +0000541 circuit, 2 * circuit->hello_interval[0]);
hassof390d2c2004-09-10 20:48:21 +0000542 if (circuit->circuit_is_type & IS_LEVEL_2)
543 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
hassobf731012004-09-17 07:59:57 +0000544 circuit, 2 * circuit->hello_interval[1]);
jardineb5d44e2003-12-23 08:09:43 +0000545 }
hassof390d2c2004-09-10 20:48:21 +0000546 else
547 {
548 /* initializing the hello send threads
549 * for a ptp IF
550 */
551 thread_add_event (master, send_p2p_hello, circuit, 0);
jardineb5d44e2003-12-23 08:09:43 +0000552
jardineb5d44e2003-12-23 08:09:43 +0000553 }
554
jardineb5d44e2003-12-23 08:09:43 +0000555 /* initializing PSNP timers */
hassof390d2c2004-09-10 20:48:21 +0000556 if (circuit->circuit_is_type & IS_LEVEL_1)
557 {
558 THREAD_TIMER_ON (master, circuit->t_send_psnp[0], send_l1_psnp, circuit,
559 isis_jitter (circuit->psnp_interval[0], PSNP_JITTER));
560 }
561
562 if (circuit->circuit_is_type & IS_LEVEL_2)
563 {
564 THREAD_TIMER_ON (master, circuit->t_send_psnp[1], send_l2_psnp, circuit,
565 isis_jitter (circuit->psnp_interval[1], PSNP_JITTER));
566 }
567
jardineb5d44e2003-12-23 08:09:43 +0000568 /* initialize the circuit streams */
569 if (circuit->rcv_stream == NULL)
hassof390d2c2004-09-10 20:48:21 +0000570 circuit->rcv_stream = stream_new (ISO_MTU (circuit));
jardineb5d44e2003-12-23 08:09:43 +0000571
572 if (circuit->snd_stream == NULL)
hassof390d2c2004-09-10 20:48:21 +0000573 circuit->snd_stream = stream_new (ISO_MTU (circuit));
jardineb5d44e2003-12-23 08:09:43 +0000574
575 /* unified init for circuits */
576 isis_sock_init (circuit);
577
578#ifdef GNU_LINUX
hassof390d2c2004-09-10 20:48:21 +0000579 THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit,
580 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000581#else
hassof390d2c2004-09-10 20:48:21 +0000582 THREAD_TIMER_ON (master, circuit->t_read, isis_receive, circuit,
583 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000584#endif
585 return;
586}
587
588void
589isis_circuit_down (struct isis_circuit *circuit)
590{
hassof390d2c2004-09-10 20:48:21 +0000591 /* Cancel all active threads -- FIXME: wrong place */
hassod70f99e2004-02-11 20:26:31 +0000592 /* HT: Read thread if GNU_LINUX, TIMER thread otherwise. */
hassof390d2c2004-09-10 20:48:21 +0000593 THREAD_OFF (circuit->t_read);
594 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
595 {
596 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[0]);
597 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[1]);
hassof891f442004-09-14 13:54:30 +0000598 THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[0]);
599 THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[1]);
hassof390d2c2004-09-10 20:48:21 +0000600 }
601 else if (circuit->circ_type == CIRCUIT_T_P2P)
602 {
603 THREAD_TIMER_OFF (circuit->u.p2p.t_send_p2p_hello);
604 }
jardineb5d44e2003-12-23 08:09:43 +0000605 /* close the socket */
606 close (circuit->fd);
607
608 return;
609}
610
611void
612circuit_update_nlpids (struct isis_circuit *circuit)
613{
614 circuit->nlpids.count = 0;
hassof390d2c2004-09-10 20:48:21 +0000615
616 if (circuit->ip_router)
617 {
618 circuit->nlpids.nlpids[0] = NLPID_IP;
619 circuit->nlpids.count++;
620 }
jardineb5d44e2003-12-23 08:09:43 +0000621#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000622 if (circuit->ipv6_router)
623 {
624 circuit->nlpids.nlpids[circuit->nlpids.count] = NLPID_IPV6;
625 circuit->nlpids.count++;
626 }
jardineb5d44e2003-12-23 08:09:43 +0000627#endif /* HAVE_IPV6 */
628 return;
629}
630
631int
hassof390d2c2004-09-10 20:48:21 +0000632isis_interface_config_write (struct vty *vty)
jardineb5d44e2003-12-23 08:09:43 +0000633{
634
635 int write = 0;
hasso3fdb2dd2005-09-28 18:45:54 +0000636 struct listnode *node, *node2;
jardineb5d44e2003-12-23 08:09:43 +0000637 struct interface *ifp;
638 struct isis_area *area;
639 struct isis_circuit *c;
jardineb5d44e2003-12-23 08:09:43 +0000640 int i;
jardineb5d44e2003-12-23 08:09:43 +0000641
hasso3fdb2dd2005-09-28 18:45:54 +0000642 for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
jardineb5d44e2003-12-23 08:09:43 +0000643 {
644 /* IF name */
hassof390d2c2004-09-10 20:48:21 +0000645 vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000646 write++;
647 /* IF desc */
hassof390d2c2004-09-10 20:48:21 +0000648 if (ifp->desc)
649 {
650 vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE);
651 write++;
652 }
jardineb5d44e2003-12-23 08:09:43 +0000653 /* ISIS Circuit */
hasso3fdb2dd2005-09-28 18:45:54 +0000654 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node2, area))
jardineb5d44e2003-12-23 08:09:43 +0000655 {
656 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +0000657 if (c)
658 {
659 if (c->ip_router)
660 {
661 vty_out (vty, " ip router isis %s%s", area->area_tag,
662 VTY_NEWLINE);
663 write++;
664 }
jardineb5d44e2003-12-23 08:09:43 +0000665#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000666 if (c->ipv6_router)
667 {
668 vty_out (vty, " ipv6 router isis %s%s", area->area_tag,
669 VTY_NEWLINE);
670 write++;
671 }
jardineb5d44e2003-12-23 08:09:43 +0000672#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000673
hassof390d2c2004-09-10 20:48:21 +0000674 /* ISIS - circuit type */
675 if (c->circuit_is_type == IS_LEVEL_1)
676 {
677 vty_out (vty, " isis circuit-type level-1%s", VTY_NEWLINE);
678 write++;
679 }
680 else
681 {
682 if (c->circuit_is_type == IS_LEVEL_2)
683 {
684 vty_out (vty, " isis circuit-type level-2-only%s",
685 VTY_NEWLINE);
686 write++;
687 }
688 }
jardineb5d44e2003-12-23 08:09:43 +0000689
hassof390d2c2004-09-10 20:48:21 +0000690 /* ISIS - CSNP interval - FIXME: compare to cisco */
691 if (c->csnp_interval[0] == c->csnp_interval[1])
692 {
693 if (c->csnp_interval[0] != CSNP_INTERVAL)
694 {
695 vty_out (vty, " isis csnp-interval %d%s",
696 c->csnp_interval[0], VTY_NEWLINE);
697 write++;
698 }
699 }
700 else
701 {
702 for (i = 0; i < 2; i++)
703 {
704 if (c->csnp_interval[1] != CSNP_INTERVAL)
705 {
706 vty_out (vty, " isis csnp-interval %d level-%d%s",
707 c->csnp_interval[1], i + 1, VTY_NEWLINE);
708 write++;
709 }
710 }
711 }
jardineb5d44e2003-12-23 08:09:43 +0000712
hassof390d2c2004-09-10 20:48:21 +0000713 /* ISIS - Hello padding - Defaults to true so only display if false */
714 if (c->circ_type == CIRCUIT_T_BROADCAST && !c->u.bc.pad_hellos)
715 {
716 vty_out (vty, " no isis hello padding%s", VTY_NEWLINE);
717 write++;
718 }
jardineb5d44e2003-12-23 08:09:43 +0000719
hassof390d2c2004-09-10 20:48:21 +0000720 /* ISIS - Hello interval - FIXME: compare to cisco */
721 if (c->hello_interval[0] == c->hello_interval[1])
722 {
723 if (c->hello_interval[0] != HELLO_INTERVAL)
724 {
725 vty_out (vty, " isis hello-interval %d%s",
726 c->hello_interval[0], VTY_NEWLINE);
727 write++;
728 }
729 }
730 else
731 {
732 for (i = 0; i < 2; i++)
733 {
734 if (c->hello_interval[i] != HELLO_INTERVAL)
735 {
736 if (c->hello_interval[i] == HELLO_MINIMAL)
737 {
738 vty_out (vty,
739 " isis hello-interval minimal level-%d%s",
740 i + 1, VTY_NEWLINE);
741 }
742 else
743 {
744 vty_out (vty, " isis hello-interval %d level-%d%s",
745 c->hello_interval[i], i + 1, VTY_NEWLINE);
746 }
747 write++;
748 }
749 }
750 }
jardineb5d44e2003-12-23 08:09:43 +0000751
hassof390d2c2004-09-10 20:48:21 +0000752 /* ISIS - Hello Multiplier */
753 if (c->hello_multiplier[0] == c->hello_multiplier[1])
754 {
755 if (c->hello_multiplier[0] != HELLO_MULTIPLIER)
756 {
757 vty_out (vty, " isis hello-multiplier %d%s",
758 c->hello_multiplier[0], VTY_NEWLINE);
759 write++;
760 }
761 }
762 else
763 {
764 for (i = 0; i < 2; i++)
765 {
766 if (c->hello_multiplier[i] != HELLO_MULTIPLIER)
767 {
768 vty_out (vty, " isis hello-multiplier %d level-%d%s",
769 c->hello_multiplier[i], i + 1, VTY_NEWLINE);
770 write++;
771 }
772 }
773 }
774 /* ISIS - Priority */
775 if (c->circ_type == CIRCUIT_T_BROADCAST)
776 {
777 if (c->u.bc.priority[0] == c->u.bc.priority[1])
778 {
779 if (c->u.bc.priority[0] != DEFAULT_PRIORITY)
780 {
781 vty_out (vty, " isis priority %d%s",
782 c->u.bc.priority[0], VTY_NEWLINE);
783 write++;
784 }
785 }
786 else
787 {
788 for (i = 0; i < 2; i++)
789 {
790 if (c->u.bc.priority[i] != DEFAULT_PRIORITY)
791 {
792 vty_out (vty, " isis priority %d level-%d%s",
793 c->u.bc.priority[i], i + 1, VTY_NEWLINE);
794 write++;
795 }
796 }
797 }
798 }
799 /* ISIS - Metric */
hassof21fb272005-09-26 17:05:55 +0000800 if (c->te_metric[0] == c->te_metric[1])
hassof390d2c2004-09-10 20:48:21 +0000801 {
hassof21fb272005-09-26 17:05:55 +0000802 if (c->te_metric[0] != DEFAULT_CIRCUIT_METRICS)
hassof390d2c2004-09-10 20:48:21 +0000803 {
hassof21fb272005-09-26 17:05:55 +0000804 vty_out (vty, " isis metric %d%s", c->te_metric[0],
805 VTY_NEWLINE);
hassof390d2c2004-09-10 20:48:21 +0000806 write++;
807 }
808 }
809 else
810 {
811 for (i = 0; i < 2; i++)
812 {
hassof21fb272005-09-26 17:05:55 +0000813 if (c->te_metric[i] != DEFAULT_CIRCUIT_METRICS)
hassof390d2c2004-09-10 20:48:21 +0000814 {
815 vty_out (vty, " isis metric %d level-%d%s",
hassof21fb272005-09-26 17:05:55 +0000816 c->te_metric[i], i + 1, VTY_NEWLINE);
hassof390d2c2004-09-10 20:48:21 +0000817 write++;
818 }
819 }
820 }
jardineb5d44e2003-12-23 08:09:43 +0000821
hassof390d2c2004-09-10 20:48:21 +0000822 }
jardineb5d44e2003-12-23 08:09:43 +0000823 }
hassof390d2c2004-09-10 20:48:21 +0000824 vty_out (vty, "!%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000825 }
hassof390d2c2004-09-10 20:48:21 +0000826
jardineb5d44e2003-12-23 08:09:43 +0000827 return write;
828}
jardineb5d44e2003-12-23 08:09:43 +0000829
830DEFUN (ip_router_isis,
831 ip_router_isis_cmd,
832 "ip router isis WORD",
833 "Interface Internet Protocol config commands\n"
834 "IP router interface commands\n"
835 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +0000836 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +0000837{
838 struct isis_circuit *c;
839 struct interface *ifp;
840 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000841
842 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000843 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +0000844
jardineb5d44e2003-12-23 08:09:43 +0000845 area = isis_area_lookup (argv[0]);
846
847 /* Prevent more than one circuit per interface */
848 if (area)
849 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +0000850 else
851 c = NULL;
852 if (c && (ifp->info != NULL))
853 {
jardineb5d44e2003-12-23 08:09:43 +0000854#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000855 if (c->ipv6_router == 0)
856 {
jardineb5d44e2003-12-23 08:09:43 +0000857#endif /* HAVE_IPV6 */
hassoc89c05d2005-09-04 21:36:36 +0000858 /* FIXME: Find the way to warn only vty users. */
859 /* vty_out (vty, "ISIS circuit is already defined%s", VTY_NEWLINE); */
hassof390d2c2004-09-10 20:48:21 +0000860 return CMD_WARNING;
jardineb5d44e2003-12-23 08:09:43 +0000861#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000862 }
863#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000864 }
hassof390d2c2004-09-10 20:48:21 +0000865
jardineb5d44e2003-12-23 08:09:43 +0000866 /* this is here for ciscopability */
hassof390d2c2004-09-10 20:48:21 +0000867 if (!area)
868 {
hassoc89c05d2005-09-04 21:36:36 +0000869 /* FIXME: Find the way to warn only vty users. */
870 /* vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); */
hassof390d2c2004-09-10 20:48:21 +0000871 return CMD_WARNING;
872 }
jardineb5d44e2003-12-23 08:09:43 +0000873
hassof390d2c2004-09-10 20:48:21 +0000874 if (!c)
875 {
876 c = circuit_lookup_by_ifp (ifp, isis->init_circ_list);
877 c = isis_csm_state_change (ISIS_ENABLE, c, area);
878 c->interface = ifp; /* this is automatic */
879 ifp->info = c; /* hardly related to the FSM */
880 }
jardineb5d44e2003-12-23 08:09:43 +0000881
hassof390d2c2004-09-10 20:48:21 +0000882 if (!c)
jardineb5d44e2003-12-23 08:09:43 +0000883 return CMD_WARNING;
884
885 c->ip_router = 1;
886 area->ip_circuits++;
887 circuit_update_nlpids (c);
888
889 vty->node = INTERFACE_NODE;
hassof390d2c2004-09-10 20:48:21 +0000890
jardineb5d44e2003-12-23 08:09:43 +0000891 return CMD_SUCCESS;
892}
893
894DEFUN (no_ip_router_isis,
895 no_ip_router_isis_cmd,
896 "no ip router isis WORD",
897 NO_STR
898 "Interface Internet Protocol config commands\n"
899 "IP router interface commands\n"
900 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +0000901 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +0000902{
903 struct isis_circuit *circuit = NULL;
904 struct interface *ifp;
905 struct isis_area *area;
hasso3fdb2dd2005-09-28 18:45:54 +0000906 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000907
hassof390d2c2004-09-10 20:48:21 +0000908 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000909 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +0000910
jardineb5d44e2003-12-23 08:09:43 +0000911 area = isis_area_lookup (argv[0]);
hassof390d2c2004-09-10 20:48:21 +0000912 if (!area)
913 {
914 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
915 return CMD_WARNING;
916 }
hasso3fdb2dd2005-09-28 18:45:54 +0000917 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
jardineb5d44e2003-12-23 08:09:43 +0000918 if (circuit->interface == ifp)
919 break;
hassof390d2c2004-09-10 20:48:21 +0000920 if (!circuit)
921 {
922 vty_out (vty, "Can't find ISIS interface %s", VTY_NEWLINE);
923 return CMD_WARNING;
924 }
jardineb5d44e2003-12-23 08:09:43 +0000925 circuit->ip_router = 0;
926 area->ip_circuits--;
927#ifdef HAVE_IPV6
928 if (circuit->ipv6_router == 0)
929#endif
930 isis_csm_state_change (ISIS_DISABLE, circuit, area);
hassof390d2c2004-09-10 20:48:21 +0000931
jardineb5d44e2003-12-23 08:09:43 +0000932 return CMD_SUCCESS;
933}
934
935DEFUN (isis_circuit_type,
936 isis_circuit_type_cmd,
937 "isis circuit-type (level-1|level-1-2|level-2-only)",
938 "IS-IS commands\n"
939 "Configure circuit type for interface\n"
940 "Level-1 only adjacencies are formed\n"
941 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +0000942 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +0000943{
944 struct isis_circuit *circuit;
945 struct interface *ifp;
946 int circuit_t;
947 int is_type;
hassof390d2c2004-09-10 20:48:21 +0000948
949 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000950 circuit = ifp->info;
951 /* UGLY - will remove l8r */
hassof390d2c2004-09-10 20:48:21 +0000952 if (circuit == NULL)
953 {
954 return CMD_WARNING;
955 }
jardineb5d44e2003-12-23 08:09:43 +0000956
hasso13c48f72004-09-10 21:19:13 +0000957 /* XXX what to do when ip_router_isis is not executed */
958 if (circuit->area == NULL)
959 return CMD_WARNING;
960
jardineb5d44e2003-12-23 08:09:43 +0000961 assert (circuit);
962
Paul Jakma41b36e92006-12-08 01:09:50 +0000963 circuit_t = string2circuit_t (argv[0]);
jardineb5d44e2003-12-23 08:09:43 +0000964
hassof390d2c2004-09-10 20:48:21 +0000965 if (!circuit_t)
966 {
967 vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE);
968 return CMD_SUCCESS;
969 }
970
jardineb5d44e2003-12-23 08:09:43 +0000971 is_type = circuit->area->is_type;
972 if (is_type == IS_LEVEL_1_AND_2 || is_type == circuit_t)
hassof390d2c2004-09-10 20:48:21 +0000973 isis_event_circuit_type_change (circuit, circuit_t);
974 else
975 {
976 vty_out (vty, "invalid circuit level for area %s.%s",
977 circuit->area->area_tag, VTY_NEWLINE);
978 }
979
jardineb5d44e2003-12-23 08:09:43 +0000980 return CMD_SUCCESS;
981}
982
983DEFUN (no_isis_circuit_type,
984 no_isis_circuit_type_cmd,
985 "no isis circuit-type (level-1|level-1-2|level-2-only)",
986 NO_STR
987 "IS-IS commands\n"
988 "Configure circuit type for interface\n"
989 "Level-1 only adjacencies are formed\n"
990 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +0000991 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +0000992{
993 struct isis_circuit *circuit;
994 struct interface *ifp;
jardineb5d44e2003-12-23 08:09:43 +0000995
hassof390d2c2004-09-10 20:48:21 +0000996 ifp = vty->index;
997 circuit = ifp->info;
998 if (circuit == NULL)
999 {
1000 return CMD_WARNING;
1001 }
1002
1003 assert (circuit);
1004
jardineb5d44e2003-12-23 08:09:43 +00001005 /*
1006 * Set the circuits level to its default value which is that of the area
1007 */
1008 isis_event_circuit_type_change (circuit, circuit->area->is_type);
hassof390d2c2004-09-10 20:48:21 +00001009
jardineb5d44e2003-12-23 08:09:43 +00001010 return CMD_SUCCESS;
1011}
1012
1013DEFUN (isis_passwd,
1014 isis_passwd_cmd,
1015 "isis password WORD",
1016 "IS-IS commands\n"
1017 "Configure the authentication password for interface\n"
1018 "Password\n")
1019{
1020 struct isis_circuit *circuit;
1021 struct interface *ifp;
1022 int len;
hassof390d2c2004-09-10 20:48:21 +00001023
1024 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001025 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001026 if (circuit == NULL)
1027 {
1028 return CMD_WARNING;
1029 }
1030
jardineb5d44e2003-12-23 08:09:43 +00001031 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001032 if (len > 254)
1033 {
1034 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
1035 return CMD_WARNING;
1036 }
jardineb5d44e2003-12-23 08:09:43 +00001037 circuit->passwd.len = len;
1038 circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001039 strncpy ((char *)circuit->passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001040
jardineb5d44e2003-12-23 08:09:43 +00001041 return CMD_SUCCESS;
1042}
1043
1044DEFUN (no_isis_passwd,
1045 no_isis_passwd_cmd,
1046 "no isis password",
1047 NO_STR
1048 "IS-IS commands\n"
1049 "Configure the authentication password for interface\n")
1050{
1051 struct isis_circuit *circuit;
1052 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001053
1054 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001055 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001056 if (circuit == NULL)
1057 {
1058 return CMD_WARNING;
1059 }
1060
jardineb5d44e2003-12-23 08:09:43 +00001061 memset (&circuit->passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +00001062
jardineb5d44e2003-12-23 08:09:43 +00001063 return CMD_SUCCESS;
1064}
1065
1066
1067DEFUN (isis_priority,
1068 isis_priority_cmd,
1069 "isis priority <0-127>",
1070 "IS-IS commands\n"
1071 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001072 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001073{
1074 struct isis_circuit *circuit;
1075 struct interface *ifp;
1076 int prio;
hassof390d2c2004-09-10 20:48:21 +00001077
1078 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001079 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001080 if (circuit == NULL)
1081 {
1082 return CMD_WARNING;
1083 }
jardineb5d44e2003-12-23 08:09:43 +00001084 assert (circuit);
1085
1086 prio = atoi (argv[0]);
1087
1088 circuit->u.bc.priority[0] = prio;
1089 circuit->u.bc.priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001090
jardineb5d44e2003-12-23 08:09:43 +00001091 return CMD_SUCCESS;
1092}
1093
1094DEFUN (no_isis_priority,
1095 no_isis_priority_cmd,
1096 "no isis priority",
1097 NO_STR
1098 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001099 "Set priority for Designated Router election\n")
jardineb5d44e2003-12-23 08:09:43 +00001100{
1101 struct isis_circuit *circuit;
1102 struct interface *ifp;
1103
hassof390d2c2004-09-10 20:48:21 +00001104 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001105 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001106 if (circuit == NULL)
1107 {
1108 return CMD_WARNING;
1109 }
jardineb5d44e2003-12-23 08:09:43 +00001110 assert (circuit);
1111
1112 circuit->u.bc.priority[0] = DEFAULT_PRIORITY;
1113 circuit->u.bc.priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001114
jardineb5d44e2003-12-23 08:09:43 +00001115 return CMD_SUCCESS;
1116}
1117
1118ALIAS (no_isis_priority,
1119 no_isis_priority_arg_cmd,
1120 "no isis priority <0-127>",
1121 NO_STR
1122 "IS-IS commands\n"
1123 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001124 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001125
1126DEFUN (isis_priority_l1,
1127 isis_priority_l1_cmd,
hassof390d2c2004-09-10 20:48:21 +00001128 "isis priority <0-127> level-1",
jardineb5d44e2003-12-23 08:09:43 +00001129 "IS-IS commands\n"
1130 "Set priority for Designated Router election\n"
1131 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001132 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001133{
1134 struct isis_circuit *circuit;
1135 struct interface *ifp;
1136 int prio;
hassof390d2c2004-09-10 20:48:21 +00001137
1138 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001139 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001140 if (circuit == NULL)
1141 {
1142 return CMD_WARNING;
1143 }
jardineb5d44e2003-12-23 08:09:43 +00001144 assert (circuit);
1145
1146 prio = atoi (argv[0]);
1147
1148 circuit->u.bc.priority[0] = prio;
hassof390d2c2004-09-10 20:48:21 +00001149
jardineb5d44e2003-12-23 08:09:43 +00001150 return CMD_SUCCESS;
1151}
1152
1153DEFUN (no_isis_priority_l1,
1154 no_isis_priority_l1_cmd,
1155 "no isis priority level-1",
1156 NO_STR
1157 "IS-IS commands\n"
1158 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001159 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001160{
1161 struct isis_circuit *circuit;
1162 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001163
1164 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001165 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001166 if (circuit == NULL)
1167 {
1168 return CMD_WARNING;
1169 }
jardineb5d44e2003-12-23 08:09:43 +00001170 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001171
jardineb5d44e2003-12-23 08:09:43 +00001172 circuit->u.bc.priority[0] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001173
jardineb5d44e2003-12-23 08:09:43 +00001174 return CMD_SUCCESS;
1175}
1176
1177ALIAS (no_isis_priority_l1,
1178 no_isis_priority_l1_arg_cmd,
1179 "no isis priority <0-127> level-1",
1180 NO_STR
1181 "IS-IS commands\n"
1182 "Set priority for Designated Router election\n"
1183 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001184 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001185
1186DEFUN (isis_priority_l2,
1187 isis_priority_l2_cmd,
hassof390d2c2004-09-10 20:48:21 +00001188 "isis priority <0-127> level-2",
jardineb5d44e2003-12-23 08:09:43 +00001189 "IS-IS commands\n"
1190 "Set priority for Designated Router election\n"
1191 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001192 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001193{
1194 struct isis_circuit *circuit;
1195 struct interface *ifp;
1196 int prio;
hassof390d2c2004-09-10 20:48:21 +00001197
1198 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001199 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001200 if (circuit == NULL)
1201 {
1202 return CMD_WARNING;
1203 }
jardineb5d44e2003-12-23 08:09:43 +00001204 assert (circuit);
1205
1206 prio = atoi (argv[0]);
1207
1208 circuit->u.bc.priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001209
jardineb5d44e2003-12-23 08:09:43 +00001210 return CMD_SUCCESS;
1211}
1212
1213DEFUN (no_isis_priority_l2,
1214 no_isis_priority_l2_cmd,
1215 "no isis priority level-2",
1216 NO_STR
1217 "IS-IS commands\n"
1218 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001219 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001220{
1221 struct isis_circuit *circuit;
1222 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001223
1224 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001225 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001226 if (circuit == NULL)
1227 {
1228 return CMD_WARNING;
1229 }
jardineb5d44e2003-12-23 08:09:43 +00001230 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001231
jardineb5d44e2003-12-23 08:09:43 +00001232 circuit->u.bc.priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001233
jardineb5d44e2003-12-23 08:09:43 +00001234 return CMD_SUCCESS;
1235}
1236
1237ALIAS (no_isis_priority_l2,
1238 no_isis_priority_l2_arg_cmd,
1239 "no isis priority <0-127> level-2",
1240 NO_STR
1241 "IS-IS commands\n"
1242 "Set priority for Designated Router election\n"
1243 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001244 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001245
1246/* Metric command */
hassof390d2c2004-09-10 20:48:21 +00001247 DEFUN (isis_metric,
jardineb5d44e2003-12-23 08:09:43 +00001248 isis_metric_cmd,
hassof21fb272005-09-26 17:05:55 +00001249 "isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001250 "IS-IS commands\n"
1251 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001252 "Default metric value\n")
jardineb5d44e2003-12-23 08:09:43 +00001253{
1254 struct isis_circuit *circuit;
1255 struct interface *ifp;
1256 int met;
1257
hassof390d2c2004-09-10 20:48:21 +00001258 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001259 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001260 if (circuit == NULL)
1261 {
1262 return CMD_WARNING;
1263 }
jardineb5d44e2003-12-23 08:09:43 +00001264 assert (circuit);
1265
1266 met = atoi (argv[0]);
1267
hassof21fb272005-09-26 17:05:55 +00001268 circuit->te_metric[0] = met;
1269 circuit->te_metric[1] = met;
1270
1271 if (met > 63)
1272 met = 63;
1273
jardineb5d44e2003-12-23 08:09:43 +00001274 circuit->metrics[0].metric_default = met;
1275 circuit->metrics[1].metric_default = met;
1276
1277 return CMD_SUCCESS;
1278}
1279
1280DEFUN (no_isis_metric,
1281 no_isis_metric_cmd,
1282 "no isis metric",
1283 NO_STR
1284 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001285 "Set default metric for circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001286{
1287 struct isis_circuit *circuit;
1288 struct interface *ifp;
1289
hassof390d2c2004-09-10 20:48:21 +00001290 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001291 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001292 if (circuit == NULL)
1293 {
1294 return CMD_WARNING;
1295 }
jardineb5d44e2003-12-23 08:09:43 +00001296 assert (circuit);
1297
hassof21fb272005-09-26 17:05:55 +00001298 circuit->te_metric[0] = DEFAULT_CIRCUIT_METRICS;
1299 circuit->te_metric[1] = DEFAULT_CIRCUIT_METRICS;
jardineb5d44e2003-12-23 08:09:43 +00001300 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRICS;
1301 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRICS;
1302
1303 return CMD_SUCCESS;
1304}
1305
1306ALIAS (no_isis_metric,
1307 no_isis_metric_arg_cmd,
hassof21fb272005-09-26 17:05:55 +00001308 "no isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001309 NO_STR
1310 "IS-IS commands\n"
1311 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001312 "Default metric value\n")
1313
jardineb5d44e2003-12-23 08:09:43 +00001314/* end of metrics */
hassof21fb272005-09-26 17:05:55 +00001315DEFUN (isis_hello_interval,
jardineb5d44e2003-12-23 08:09:43 +00001316 isis_hello_interval_cmd,
1317 "isis hello-interval (<1-65535>|minimal)",
1318 "IS-IS commands\n"
1319 "Set Hello interval\n"
1320 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00001321 "Holdtime 1 seconds, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00001322{
1323 struct isis_circuit *circuit;
1324 struct interface *ifp;
1325 int interval;
1326 char c;
1327
hassof390d2c2004-09-10 20:48:21 +00001328 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001329 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001330 if (circuit == NULL)
1331 {
1332 return CMD_WARNING;
1333 }
1334 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001335 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001336 if (isdigit ((int) c))
1337 {
1338 interval = atoi (argv[0]);
1339 }
1340 else
1341 interval = HELLO_MINIMAL; /* FIXME: should be calculated */
jardineb5d44e2003-12-23 08:09:43 +00001342
hassof390d2c2004-09-10 20:48:21 +00001343 circuit->hello_interval[0] = (u_int16_t) interval;
1344 circuit->hello_interval[1] = (u_int16_t) interval;
1345
jardineb5d44e2003-12-23 08:09:43 +00001346 return CMD_SUCCESS;
1347}
1348
1349DEFUN (no_isis_hello_interval,
1350 no_isis_hello_interval_cmd,
1351 "no isis hello-interval",
1352 NO_STR
1353 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001354 "Set Hello interval\n")
jardineb5d44e2003-12-23 08:09:43 +00001355{
1356 struct isis_circuit *circuit;
1357 struct interface *ifp;
1358
hassof390d2c2004-09-10 20:48:21 +00001359 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001360 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001361 if (circuit == NULL)
1362 {
1363 return CMD_WARNING;
1364 }
jardineb5d44e2003-12-23 08:09:43 +00001365 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001366
hassof390d2c2004-09-10 20:48:21 +00001367
1368 circuit->hello_interval[0] = HELLO_INTERVAL; /* Default is 1 sec. */
jardineb5d44e2003-12-23 08:09:43 +00001369 circuit->hello_interval[1] = HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001370
jardineb5d44e2003-12-23 08:09:43 +00001371 return CMD_SUCCESS;
1372}
1373
1374ALIAS (no_isis_hello_interval,
1375 no_isis_hello_interval_arg_cmd,
1376 "no isis hello-interval (<1-65535>|minimal)",
1377 NO_STR
1378 "IS-IS commands\n"
1379 "Set Hello interval\n"
1380 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00001381 "Holdtime 1 second, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00001382
1383DEFUN (isis_hello_interval_l1,
1384 isis_hello_interval_l1_cmd,
1385 "isis hello-interval (<1-65535>|minimal) level-1",
1386 "IS-IS commands\n"
1387 "Set Hello interval\n"
1388 "Hello interval value\n"
1389 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001390 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001391{
1392 struct isis_circuit *circuit;
1393 struct interface *ifp;
1394 long interval;
1395 char c;
1396
hassof390d2c2004-09-10 20:48:21 +00001397 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001398 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001399 if (circuit == NULL)
1400 {
1401 return CMD_WARNING;
1402 }
jardineb5d44e2003-12-23 08:09:43 +00001403 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001404
jardineb5d44e2003-12-23 08:09:43 +00001405 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001406 if (isdigit ((int) c))
1407 {
1408 interval = atoi (argv[0]);
1409 }
1410 else
jardineb5d44e2003-12-23 08:09:43 +00001411 interval = HELLO_MINIMAL;
1412
hassof390d2c2004-09-10 20:48:21 +00001413 circuit->hello_interval[0] = (u_int16_t) interval;
1414
jardineb5d44e2003-12-23 08:09:43 +00001415 return CMD_SUCCESS;
1416}
1417
1418DEFUN (no_isis_hello_interval_l1,
1419 no_isis_hello_interval_l1_cmd,
1420 "no isis hello-interval level-1",
1421 NO_STR
1422 "IS-IS commands\n"
1423 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00001424 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001425{
1426 struct isis_circuit *circuit;
1427 struct interface *ifp;
1428
hassof390d2c2004-09-10 20:48:21 +00001429 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001430 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001431 if (circuit == NULL)
1432 {
1433 return CMD_WARNING;
1434 }
jardineb5d44e2003-12-23 08:09:43 +00001435 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001436
hassof390d2c2004-09-10 20:48:21 +00001437
1438 circuit->hello_interval[0] = HELLO_INTERVAL; /* Default is 1 sec. */
1439
jardineb5d44e2003-12-23 08:09:43 +00001440 return CMD_SUCCESS;
1441}
1442
1443ALIAS (no_isis_hello_interval_l1,
1444 no_isis_hello_interval_l1_arg_cmd,
1445 "no isis hello-interval (<1-65535>|minimal) level-1",
1446 NO_STR
1447 "IS-IS commands\n"
1448 "Set Hello interval\n"
1449 "Hello interval value\n"
1450 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001451 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001452
1453DEFUN (isis_hello_interval_l2,
1454 isis_hello_interval_l2_cmd,
1455 "isis hello-interval (<1-65535>|minimal) level-2",
1456 "IS-IS commands\n"
1457 "Set Hello interval\n"
1458 "Hello interval value\n"
1459 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001460 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001461{
1462 struct isis_circuit *circuit;
1463 struct interface *ifp;
1464 long interval;
1465 char c;
1466
hassof390d2c2004-09-10 20:48:21 +00001467 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001468 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001469 if (circuit == NULL)
1470 {
1471 return CMD_WARNING;
1472 }
jardineb5d44e2003-12-23 08:09:43 +00001473 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001474
jardineb5d44e2003-12-23 08:09:43 +00001475 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001476 if (isdigit ((int) c))
1477 {
1478 interval = atoi (argv[0]);
1479 }
1480 else
jardineb5d44e2003-12-23 08:09:43 +00001481 interval = HELLO_MINIMAL;
1482
hassof390d2c2004-09-10 20:48:21 +00001483 circuit->hello_interval[1] = (u_int16_t) interval;
1484
jardineb5d44e2003-12-23 08:09:43 +00001485 return CMD_SUCCESS;
1486}
1487
1488DEFUN (no_isis_hello_interval_l2,
1489 no_isis_hello_interval_l2_cmd,
1490 "no isis hello-interval level-2",
1491 NO_STR
1492 "IS-IS commands\n"
1493 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00001494 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001495{
1496 struct isis_circuit *circuit;
1497 struct interface *ifp;
1498
hassof390d2c2004-09-10 20:48:21 +00001499 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001500 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001501 if (circuit == NULL)
1502 {
1503 return CMD_WARNING;
1504 }
jardineb5d44e2003-12-23 08:09:43 +00001505 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001506
hassof390d2c2004-09-10 20:48:21 +00001507
1508 circuit->hello_interval[1] = HELLO_INTERVAL; /* Default is 1 sec. */
1509
jardineb5d44e2003-12-23 08:09:43 +00001510 return CMD_SUCCESS;
1511}
1512
1513ALIAS (no_isis_hello_interval_l2,
1514 no_isis_hello_interval_l2_arg_cmd,
1515 "no isis hello-interval (<1-65535>|minimal) level-2",
1516 NO_STR
1517 "IS-IS commands\n"
1518 "Set Hello interval\n"
1519 "Hello interval value\n"
1520 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001521 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001522
1523DEFUN (isis_hello_multiplier,
1524 isis_hello_multiplier_cmd,
1525 "isis hello-multiplier <3-1000>",
1526 "IS-IS commands\n"
1527 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001528 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00001529{
1530 struct isis_circuit *circuit;
1531 struct interface *ifp;
1532 int mult;
hassof390d2c2004-09-10 20:48:21 +00001533
1534 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001535 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001536 if (circuit == NULL)
1537 {
1538 return CMD_WARNING;
1539 }
jardineb5d44e2003-12-23 08:09:43 +00001540 assert (circuit);
1541
1542 mult = atoi (argv[0]);
1543
hassof390d2c2004-09-10 20:48:21 +00001544 circuit->hello_multiplier[0] = (u_int16_t) mult;
1545 circuit->hello_multiplier[1] = (u_int16_t) mult;
1546
jardineb5d44e2003-12-23 08:09:43 +00001547 return CMD_SUCCESS;
1548}
1549
1550DEFUN (no_isis_hello_multiplier,
1551 no_isis_hello_multiplier_cmd,
1552 "no isis hello-multiplier",
1553 NO_STR
1554 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001555 "Set multiplier for Hello holding time\n")
jardineb5d44e2003-12-23 08:09:43 +00001556{
1557 struct isis_circuit *circuit;
1558 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001559
1560 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001561 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001562 if (circuit == NULL)
1563 {
1564 return CMD_WARNING;
1565 }
jardineb5d44e2003-12-23 08:09:43 +00001566 assert (circuit);
1567
1568 circuit->hello_multiplier[0] = HELLO_MULTIPLIER;
1569 circuit->hello_multiplier[1] = HELLO_MULTIPLIER;
1570
1571 return CMD_SUCCESS;
1572}
1573
1574ALIAS (no_isis_hello_multiplier,
1575 no_isis_hello_multiplier_arg_cmd,
1576 "no isis hello-multiplier <3-1000>",
1577 NO_STR
1578 "IS-IS commands\n"
1579 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001580 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00001581
1582DEFUN (isis_hello_multiplier_l1,
1583 isis_hello_multiplier_l1_cmd,
1584 "isis hello-multiplier <3-1000> level-1",
1585 "IS-IS commands\n"
1586 "Set multiplier for Hello holding time\n"
1587 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001588 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001589{
1590 struct isis_circuit *circuit;
1591 struct interface *ifp;
1592 int mult;
hassof390d2c2004-09-10 20:48:21 +00001593
1594 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001595 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001596 if (circuit == NULL)
1597 {
1598 return CMD_WARNING;
1599 }
jardineb5d44e2003-12-23 08:09:43 +00001600 assert (circuit);
1601
1602 mult = atoi (argv[0]);
1603
hassof390d2c2004-09-10 20:48:21 +00001604 circuit->hello_multiplier[0] = (u_int16_t) mult;
1605
jardineb5d44e2003-12-23 08:09:43 +00001606 return CMD_SUCCESS;
1607}
1608
1609DEFUN (no_isis_hello_multiplier_l1,
1610 no_isis_hello_multiplier_l1_cmd,
1611 "no isis hello-multiplier level-1",
1612 NO_STR
1613 "IS-IS commands\n"
1614 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001615 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001616{
1617 struct isis_circuit *circuit;
1618 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001619
1620 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001621 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001622 if (circuit == NULL)
1623 {
1624 return CMD_WARNING;
1625 }
jardineb5d44e2003-12-23 08:09:43 +00001626 assert (circuit);
1627
1628 circuit->hello_multiplier[0] = HELLO_MULTIPLIER;
1629
1630 return CMD_SUCCESS;
1631}
1632
1633ALIAS (no_isis_hello_multiplier_l1,
1634 no_isis_hello_multiplier_l1_arg_cmd,
1635 "no isis hello-multiplier <3-1000> level-1",
1636 NO_STR
1637 "IS-IS commands\n"
1638 "Set multiplier for Hello holding time\n"
1639 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001640 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001641
1642DEFUN (isis_hello_multiplier_l2,
1643 isis_hello_multiplier_l2_cmd,
1644 "isis hello-multiplier <3-1000> level-2",
1645 "IS-IS commands\n"
1646 "Set multiplier for Hello holding time\n"
1647 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001648 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001649{
1650 struct isis_circuit *circuit;
1651 struct interface *ifp;
1652 int mult;
hassof390d2c2004-09-10 20:48:21 +00001653
1654 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001655 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001656 if (circuit == NULL)
1657 {
1658 return CMD_WARNING;
1659 }
jardineb5d44e2003-12-23 08:09:43 +00001660 assert (circuit);
1661
1662 mult = atoi (argv[0]);
1663
hassof390d2c2004-09-10 20:48:21 +00001664 circuit->hello_multiplier[1] = (u_int16_t) mult;
1665
jardineb5d44e2003-12-23 08:09:43 +00001666 return CMD_SUCCESS;
1667}
1668
1669DEFUN (no_isis_hello_multiplier_l2,
1670 no_isis_hello_multiplier_l2_cmd,
1671 "no isis hello-multiplier level-2",
1672 NO_STR
1673 "IS-IS commands\n"
1674 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001675 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001676{
1677 struct isis_circuit *circuit;
1678 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001679
1680 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001681 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001682 if (circuit == NULL)
1683 {
1684 return CMD_WARNING;
1685 }
jardineb5d44e2003-12-23 08:09:43 +00001686 assert (circuit);
1687
1688 circuit->hello_multiplier[1] = HELLO_MULTIPLIER;
1689
1690 return CMD_SUCCESS;
1691}
1692
1693ALIAS (no_isis_hello_multiplier_l2,
1694 no_isis_hello_multiplier_l2_arg_cmd,
1695 "no isis hello-multiplier <3-1000> level-2",
1696 NO_STR
1697 "IS-IS commands\n"
1698 "Set multiplier for Hello holding time\n"
1699 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001700 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001701
1702DEFUN (isis_hello,
1703 isis_hello_cmd,
1704 "isis hello padding",
1705 "IS-IS commands\n"
1706 "Add padding to IS-IS hello packets\n"
1707 "Pad hello packets\n"
1708 "<cr>\n")
1709{
1710 struct interface *ifp;
1711 struct isis_circuit *circuit;
hassof390d2c2004-09-10 20:48:21 +00001712
1713 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001714 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001715 if (circuit == NULL)
1716 {
1717 return CMD_WARNING;
1718 }
jardineb5d44e2003-12-23 08:09:43 +00001719 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001720
jardineb5d44e2003-12-23 08:09:43 +00001721 circuit->u.bc.pad_hellos = 1;
hassof390d2c2004-09-10 20:48:21 +00001722
jardineb5d44e2003-12-23 08:09:43 +00001723 return CMD_SUCCESS;
1724}
1725
jardineb5d44e2003-12-23 08:09:43 +00001726DEFUN (no_isis_hello,
1727 no_isis_hello_cmd,
1728 "no isis hello padding",
1729 NO_STR
1730 "IS-IS commands\n"
1731 "Add padding to IS-IS hello packets\n"
1732 "Pad hello packets\n"
1733 "<cr>\n")
1734{
1735 struct isis_circuit *circuit;
1736 struct interface *ifp;
1737
hassof390d2c2004-09-10 20:48:21 +00001738 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001739 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001740 if (circuit == NULL)
1741 {
1742 return CMD_WARNING;
1743 }
jardineb5d44e2003-12-23 08:09:43 +00001744 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001745
jardineb5d44e2003-12-23 08:09:43 +00001746 circuit->u.bc.pad_hellos = 0;
hassof390d2c2004-09-10 20:48:21 +00001747
jardineb5d44e2003-12-23 08:09:43 +00001748 return CMD_SUCCESS;
1749}
1750
1751DEFUN (csnp_interval,
1752 csnp_interval_cmd,
1753 "isis csnp-interval <0-65535>",
1754 "IS-IS commands\n"
1755 "Set CSNP interval in seconds\n"
1756 "CSNP interval value\n")
1757{
1758 struct isis_circuit *circuit;
1759 struct interface *ifp;
1760 unsigned long interval;
1761
hassof390d2c2004-09-10 20:48:21 +00001762 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001763 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001764 if (circuit == NULL)
1765 {
1766 return CMD_WARNING;
1767 }
jardineb5d44e2003-12-23 08:09:43 +00001768 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001769
jardineb5d44e2003-12-23 08:09:43 +00001770 interval = atol (argv[0]);
1771
hassof390d2c2004-09-10 20:48:21 +00001772 circuit->csnp_interval[0] = (u_int16_t) interval;
1773 circuit->csnp_interval[1] = (u_int16_t) interval;
1774
jardineb5d44e2003-12-23 08:09:43 +00001775 return CMD_SUCCESS;
1776}
1777
1778DEFUN (no_csnp_interval,
1779 no_csnp_interval_cmd,
1780 "no isis csnp-interval",
1781 NO_STR
1782 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001783 "Set CSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001784{
1785 struct isis_circuit *circuit;
1786 struct interface *ifp;
1787
hassof390d2c2004-09-10 20:48:21 +00001788 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001789 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001790 if (circuit == NULL)
1791 {
1792 return CMD_WARNING;
1793 }
jardineb5d44e2003-12-23 08:09:43 +00001794 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001795
jardineb5d44e2003-12-23 08:09:43 +00001796 circuit->csnp_interval[0] = CSNP_INTERVAL;
1797 circuit->csnp_interval[1] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001798
jardineb5d44e2003-12-23 08:09:43 +00001799 return CMD_SUCCESS;
1800}
1801
1802ALIAS (no_csnp_interval,
1803 no_csnp_interval_arg_cmd,
1804 "no isis csnp-interval <0-65535>",
1805 NO_STR
1806 "IS-IS commands\n"
1807 "Set CSNP interval in seconds\n"
1808 "CSNP interval value\n")
1809
jardineb5d44e2003-12-23 08:09:43 +00001810DEFUN (csnp_interval_l1,
1811 csnp_interval_l1_cmd,
1812 "isis csnp-interval <0-65535> level-1",
1813 "IS-IS commands\n"
1814 "Set CSNP interval in seconds\n"
1815 "CSNP interval value\n"
1816 "Specify interval for level-1 CSNPs\n")
1817{
1818 struct isis_circuit *circuit;
1819 struct interface *ifp;
1820 unsigned long interval;
1821
hassof390d2c2004-09-10 20:48:21 +00001822 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001823 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001824 if (circuit == NULL)
1825 {
1826 return CMD_WARNING;
1827 }
jardineb5d44e2003-12-23 08:09:43 +00001828 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001829
jardineb5d44e2003-12-23 08:09:43 +00001830 interval = atol (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001831
1832 circuit->csnp_interval[0] = (u_int16_t) interval;
1833
jardineb5d44e2003-12-23 08:09:43 +00001834 return CMD_SUCCESS;
1835}
1836
1837DEFUN (no_csnp_interval_l1,
1838 no_csnp_interval_l1_cmd,
1839 "no isis csnp-interval level-1",
1840 NO_STR
1841 "IS-IS commands\n"
1842 "Set CSNP interval in seconds\n"
1843 "Specify interval for level-1 CSNPs\n")
1844{
1845 struct isis_circuit *circuit;
1846 struct interface *ifp;
1847
hassof390d2c2004-09-10 20:48:21 +00001848 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001849 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001850 if (circuit == NULL)
1851 {
1852 return CMD_WARNING;
1853 }
jardineb5d44e2003-12-23 08:09:43 +00001854 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001855
jardineb5d44e2003-12-23 08:09:43 +00001856 circuit->csnp_interval[0] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001857
jardineb5d44e2003-12-23 08:09:43 +00001858 return CMD_SUCCESS;
1859}
1860
1861ALIAS (no_csnp_interval_l1,
1862 no_csnp_interval_l1_arg_cmd,
1863 "no isis csnp-interval <0-65535> level-1",
1864 NO_STR
1865 "IS-IS commands\n"
1866 "Set CSNP interval in seconds\n"
1867 "CSNP interval value\n"
1868 "Specify interval for level-1 CSNPs\n")
1869
jardineb5d44e2003-12-23 08:09:43 +00001870DEFUN (csnp_interval_l2,
1871 csnp_interval_l2_cmd,
1872 "isis csnp-interval <0-65535> level-2",
1873 "IS-IS commands\n"
1874 "Set CSNP interval in seconds\n"
1875 "CSNP interval value\n"
1876 "Specify interval for level-2 CSNPs\n")
1877{
1878 struct isis_circuit *circuit;
1879 struct interface *ifp;
1880 unsigned long interval;
1881
hassof390d2c2004-09-10 20:48:21 +00001882 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001883 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001884 if (circuit == NULL)
1885 {
1886 return CMD_WARNING;
1887 }
jardineb5d44e2003-12-23 08:09:43 +00001888 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001889
jardineb5d44e2003-12-23 08:09:43 +00001890 interval = atol (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001891
1892 circuit->csnp_interval[1] = (u_int16_t) interval;
1893
jardineb5d44e2003-12-23 08:09:43 +00001894 return CMD_SUCCESS;
1895}
1896
1897DEFUN (no_csnp_interval_l2,
1898 no_csnp_interval_l2_cmd,
1899 "no isis csnp-interval level-2",
1900 NO_STR
1901 "IS-IS commands\n"
1902 "Set CSNP interval in seconds\n"
1903 "Specify interval for level-2 CSNPs\n")
1904{
1905 struct isis_circuit *circuit;
1906 struct interface *ifp;
1907
hassof390d2c2004-09-10 20:48:21 +00001908 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001909 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001910 if (circuit == NULL)
1911 {
1912 return CMD_WARNING;
1913 }
jardineb5d44e2003-12-23 08:09:43 +00001914 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001915
jardineb5d44e2003-12-23 08:09:43 +00001916 circuit->csnp_interval[1] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001917
jardineb5d44e2003-12-23 08:09:43 +00001918 return CMD_SUCCESS;
1919}
1920
1921ALIAS (no_csnp_interval_l2,
1922 no_csnp_interval_l2_arg_cmd,
1923 "no isis csnp-interval <0-65535> level-2",
1924 NO_STR
1925 "IS-IS commands\n"
1926 "Set CSNP interval in seconds\n"
1927 "CSNP interval value\n"
1928 "Specify interval for level-2 CSNPs\n")
1929
jardineb5d44e2003-12-23 08:09:43 +00001930#ifdef HAVE_IPV6
1931DEFUN (ipv6_router_isis,
1932 ipv6_router_isis_cmd,
1933 "ipv6 router isis WORD",
1934 "IPv6 interface subcommands\n"
1935 "IPv6 Router interface commands\n"
1936 "IS-IS Routing for IPv6\n"
1937 "Routing process tag\n")
1938{
1939 struct isis_circuit *c;
1940 struct interface *ifp;
1941 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001942
1943 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001944 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +00001945
jardineb5d44e2003-12-23 08:09:43 +00001946 area = isis_area_lookup (argv[0]);
1947
1948 /* Prevent more than one circuit per interface */
1949 if (area)
1950 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +00001951 else
1952 c = NULL;
1953
1954 if (c && (ifp->info != NULL))
1955 {
1956 if (c->ipv6_router == 1)
1957 {
1958 vty_out (vty, "ISIS circuit is already defined for IPv6%s",
1959 VTY_NEWLINE);
1960 return CMD_WARNING;
1961 }
jardineb5d44e2003-12-23 08:09:43 +00001962 }
jardineb5d44e2003-12-23 08:09:43 +00001963
1964 /* this is here for ciscopability */
hassof390d2c2004-09-10 20:48:21 +00001965 if (!area)
1966 {
1967 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1968 return CMD_WARNING;
1969 }
jardineb5d44e2003-12-23 08:09:43 +00001970
hassof390d2c2004-09-10 20:48:21 +00001971 if (!c)
1972 {
1973 c = circuit_lookup_by_ifp (ifp, isis->init_circ_list);
1974 c = isis_csm_state_change (ISIS_ENABLE, c, area);
1975 c->interface = ifp;
1976 ifp->info = c;
1977 }
jardineb5d44e2003-12-23 08:09:43 +00001978
hassof390d2c2004-09-10 20:48:21 +00001979 if (!c)
jardineb5d44e2003-12-23 08:09:43 +00001980 return CMD_WARNING;
1981
1982 c->ipv6_router = 1;
1983 area->ipv6_circuits++;
1984 circuit_update_nlpids (c);
1985
1986 vty->node = INTERFACE_NODE;
1987
1988 return CMD_SUCCESS;
1989}
1990
1991DEFUN (no_ipv6_router_isis,
1992 no_ipv6_router_isis_cmd,
1993 "no ipv6 router isis WORD",
1994 NO_STR
1995 "IPv6 interface subcommands\n"
1996 "IPv6 Router interface commands\n"
1997 "IS-IS Routing for IPv6\n"
1998 "Routing process tag\n")
1999{
2000 struct isis_circuit *c;
2001 struct interface *ifp;
2002 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00002003
2004 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +00002005 /* UGLY - will remove l8r
2006 if (circuit == NULL) {
hassof390d2c2004-09-10 20:48:21 +00002007 return CMD_WARNING;
2008 } */
jardineb5d44e2003-12-23 08:09:43 +00002009 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +00002010
jardineb5d44e2003-12-23 08:09:43 +00002011 area = isis_area_lookup (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00002012 if (!area)
2013 {
2014 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
2015 return CMD_WARNING;
2016 }
2017
jardineb5d44e2003-12-23 08:09:43 +00002018 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
2019 if (!c)
2020 return CMD_WARNING;
2021
2022 c->ipv6_router = 0;
2023 area->ipv6_circuits--;
2024 if (c->ip_router == 0)
2025 isis_csm_state_change (ISIS_DISABLE, c, area);
2026
2027 return CMD_SUCCESS;
2028}
hassof390d2c2004-09-10 20:48:21 +00002029#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +00002030
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08002031static struct cmd_node interface_node = {
jardineb5d44e2003-12-23 08:09:43 +00002032 INTERFACE_NODE,
2033 "%s(config-if)# ",
2034 1,
2035};
2036
jardineb5d44e2003-12-23 08:09:43 +00002037int
2038isis_if_new_hook (struct interface *ifp)
2039{
2040/* FIXME: Discuss if the circuit should be created here
2041 ifp->info = XMALLOC (MTYPE_ISIS_IF_INFO, sizeof (struct isis_if_info)); */
2042 ifp->info = NULL;
2043 return 0;
2044}
2045
2046int
2047isis_if_delete_hook (struct interface *ifp)
2048{
2049/* FIXME: Discuss if the circuit should be created here
2050 XFREE (MTYPE_ISIS_IF_INFO, ifp->info);*/
2051 ifp->info = NULL;
2052 return 0;
2053}
2054
jardineb5d44e2003-12-23 08:09:43 +00002055void
2056isis_circuit_init ()
2057{
jardineb5d44e2003-12-23 08:09:43 +00002058 /* Initialize Zebra interface data structure */
2059 if_init ();
2060 if_add_hook (IF_NEW_HOOK, isis_if_new_hook);
2061 if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook);
2062
2063 /* Install interface node */
2064 install_node (&interface_node, isis_interface_config_write);
2065 install_element (CONFIG_NODE, &interface_cmd);
2066
2067 install_default (INTERFACE_NODE);
2068 install_element (INTERFACE_NODE, &interface_desc_cmd);
2069 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
2070
2071 install_element (INTERFACE_NODE, &ip_router_isis_cmd);
2072 install_element (INTERFACE_NODE, &no_ip_router_isis_cmd);
2073
2074 install_element (INTERFACE_NODE, &isis_circuit_type_cmd);
2075 install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd);
2076
2077 install_element (INTERFACE_NODE, &isis_passwd_cmd);
2078 install_element (INTERFACE_NODE, &no_isis_passwd_cmd);
2079
2080 install_element (INTERFACE_NODE, &isis_priority_cmd);
2081 install_element (INTERFACE_NODE, &no_isis_priority_cmd);
2082 install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd);
2083 install_element (INTERFACE_NODE, &isis_priority_l1_cmd);
2084 install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd);
2085 install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd);
2086 install_element (INTERFACE_NODE, &isis_priority_l2_cmd);
2087 install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd);
2088 install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd);
2089
2090 install_element (INTERFACE_NODE, &isis_metric_cmd);
2091 install_element (INTERFACE_NODE, &no_isis_metric_cmd);
2092 install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd);
2093
2094 install_element (INTERFACE_NODE, &isis_hello_interval_cmd);
2095 install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd);
2096 install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd);
2097 install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd);
2098 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd);
2099 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd);
2100 install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd);
2101 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd);
2102 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd);
2103
2104 install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd);
2105 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
2106 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd);
2107 install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd);
2108 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd);
2109 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd);
2110 install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd);
2111 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd);
2112 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd);
2113
2114 install_element (INTERFACE_NODE, &isis_hello_cmd);
2115 install_element (INTERFACE_NODE, &no_isis_hello_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002116 install_element (INTERFACE_NODE, &csnp_interval_cmd);
2117 install_element (INTERFACE_NODE, &no_csnp_interval_cmd);
2118 install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd);
2119 install_element (INTERFACE_NODE, &csnp_interval_l1_cmd);
2120 install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd);
2121 install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd);
2122 install_element (INTERFACE_NODE, &csnp_interval_l2_cmd);
2123 install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd);
2124 install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd);
2125
2126#ifdef HAVE_IPV6
2127 install_element (INTERFACE_NODE, &ipv6_router_isis_cmd);
2128 install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002129#endif
jardineb5d44e2003-12-23 08:09:43 +00002130}