blob: fe3eb827dd79c258440d63921f5f1890ec54b9b6 [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
29#include "log.h"
30#include "memory.h"
31#include "if.h"
32#include "linklist.h"
33#include "command.h"
34#include "thread.h"
35#include "hash.h"
36#include "prefix.h"
37#include "stream.h"
38
39#include "isisd/dict.h"
40#include "isisd/include-netbsd/iso.h"
41#include "isisd/isis_constants.h"
42#include "isisd/isis_common.h"
43#include "isisd/isis_circuit.h"
44#include "isisd/isis_tlv.h"
45#include "isisd/isis_lsp.h"
46#include "isisd/isis_pdu.h"
47#include "isisd/isis_network.h"
48#include "isisd/isis_misc.h"
49#include "isisd/isis_constants.h"
50#include "isisd/isis_adjacency.h"
51#include "isisd/isis_dr.h"
52#include "isisd/isis_flags.h"
53#include "isisd/isisd.h"
54#include "isisd/isis_csm.h"
55#include "isisd/isis_events.h"
56
57extern struct thread_master *master;
58extern struct isis *isis;
59
Paul Jakma41b36e92006-12-08 01:09:50 +000060/*
61 * Prototypes.
62 */
63void isis_circuit_down(struct isis_circuit *);
64int isis_interface_config_write(struct vty *);
65int isis_if_new_hook(struct interface *);
66int isis_if_delete_hook(struct interface *);
67
jardineb5d44e2003-12-23 08:09:43 +000068struct isis_circuit *
69isis_circuit_new ()
70{
71 struct isis_circuit *circuit;
72 int i;
73
hasso3fdb2dd2005-09-28 18:45:54 +000074 circuit = XCALLOC (MTYPE_ISIS_CIRCUIT, sizeof (struct isis_circuit));
hassof390d2c2004-09-10 20:48:21 +000075 if (circuit)
76 {
hassof390d2c2004-09-10 20:48:21 +000077 /* set default metrics for circuit */
78 for (i = 0; i < 2; i++)
79 {
80 circuit->metrics[i].metric_default = DEFAULT_CIRCUIT_METRICS;
81 circuit->metrics[i].metric_expense = METRICS_UNSUPPORTED;
82 circuit->metrics[i].metric_error = METRICS_UNSUPPORTED;
83 circuit->metrics[i].metric_delay = METRICS_UNSUPPORTED;
hassof21fb272005-09-26 17:05:55 +000084 circuit->te_metric[i] = DEFAULT_CIRCUIT_METRICS;
hassof390d2c2004-09-10 20:48:21 +000085 }
jardineb5d44e2003-12-23 08:09:43 +000086 }
hassof390d2c2004-09-10 20:48:21 +000087 else
88 {
89 zlog_err ("Can't malloc isis circuit");
90 return NULL;
91 }
92
jardineb5d44e2003-12-23 08:09:43 +000093 return circuit;
94}
95
jardineb5d44e2003-12-23 08:09:43 +000096void
97isis_circuit_configure (struct isis_circuit *circuit, struct isis_area *area)
98{
99 int i;
100 circuit->area = area;
101 /*
102 * The level for the circuit is same as for the area, unless configured
103 * otherwise.
104 */
105 circuit->circuit_is_type = area->is_type;
106 /*
107 * Default values
108 */
hassof390d2c2004-09-10 20:48:21 +0000109 for (i = 0; i < 2; i++)
110 {
111 circuit->hello_interval[i] = HELLO_INTERVAL;
112 circuit->hello_multiplier[i] = HELLO_MULTIPLIER;
113 circuit->csnp_interval[i] = CSNP_INTERVAL;
114 circuit->psnp_interval[i] = PSNP_INTERVAL;
115 circuit->u.bc.priority[i] = DEFAULT_PRIORITY;
116 }
117 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
118 {
119 circuit->u.bc.adjdb[0] = list_new ();
120 circuit->u.bc.adjdb[1] = list_new ();
121 circuit->u.bc.pad_hellos = 1;
122 }
jardineb5d44e2003-12-23 08:09:43 +0000123 circuit->lsp_interval = LSP_INTERVAL;
124
125 /*
126 * Add the circuit into area
127 */
128 listnode_add (area->circuit_list, circuit);
129
130 circuit->idx = flags_get_index (&area->flags);
131 circuit->lsp_queue = list_new ();
132
133 return;
134}
135
hassof390d2c2004-09-10 20:48:21 +0000136void
jardineb5d44e2003-12-23 08:09:43 +0000137isis_circuit_deconfigure (struct isis_circuit *circuit,
hassof390d2c2004-09-10 20:48:21 +0000138 struct isis_area *area)
jardineb5d44e2003-12-23 08:09:43 +0000139{
hassof390d2c2004-09-10 20:48:21 +0000140
jardineb5d44e2003-12-23 08:09:43 +0000141 /* Remove circuit from area */
142 listnode_delete (area->circuit_list, circuit);
143 /* Free the index of SRM and SSN flags */
144 flags_free_index (&area->flags, circuit->idx);
145
146 return;
147}
148
149struct isis_circuit *
150circuit_lookup_by_ifp (struct interface *ifp, struct list *list)
151{
152 struct isis_circuit *circuit = NULL;
153 struct listnode *node;
hassof390d2c2004-09-10 20:48:21 +0000154
jardineb5d44e2003-12-23 08:09:43 +0000155 if (!list)
156 return NULL;
hassof390d2c2004-09-10 20:48:21 +0000157
paul1eb8ef22005-04-07 07:30:20 +0000158 for (ALL_LIST_ELEMENTS_RO (list, node, circuit))
159 if (circuit->interface == ifp)
160 return circuit;
161
jardineb5d44e2003-12-23 08:09:43 +0000162 return NULL;
163}
164
165struct isis_circuit *
166circuit_scan_by_ifp (struct interface *ifp)
167{
168 struct isis_area *area;
169 struct listnode *node;
170 struct isis_circuit *circuit;
171
172 if (!isis->area_list)
173 return NULL;
174
paul1eb8ef22005-04-07 07:30:20 +0000175 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +0000176 {
hassof390d2c2004-09-10 20:48:21 +0000177 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
178 if (circuit)
179 return circuit;
180 }
181
jardineb5d44e2003-12-23 08:09:43 +0000182 return circuit_lookup_by_ifp (ifp, isis->init_circ_list);
183}
184
185void
186isis_circuit_del (struct isis_circuit *circuit)
187{
188
189 if (!circuit)
190 return;
191
hassof390d2c2004-09-10 20:48:21 +0000192 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
193 {
194 /* destroy adjacency databases */
hasso46606872004-12-29 19:34:22 +0000195 if (circuit->u.bc.adjdb[0])
196 list_delete (circuit->u.bc.adjdb[0]);
197 if (circuit->u.bc.adjdb[1])
198 list_delete (circuit->u.bc.adjdb[1]);
hassof390d2c2004-09-10 20:48:21 +0000199 /* destroy neighbour lists */
200 if (circuit->u.bc.lan_neighs[0])
201 list_delete (circuit->u.bc.lan_neighs[0]);
202 if (circuit->u.bc.lan_neighs[1])
203 list_delete (circuit->u.bc.lan_neighs[1]);
204 /* destroy addresses */
205 }
jardineb5d44e2003-12-23 08:09:43 +0000206 if (circuit->ip_addrs)
207 list_delete (circuit->ip_addrs);
208#ifdef HAVE_IPV6
209 if (circuit->ipv6_link)
210 list_delete (circuit->ipv6_link);
211 if (circuit->ipv6_non_link)
212 list_delete (circuit->ipv6_non_link);
213#endif /* HAVE_IPV6 */
hassof390d2c2004-09-10 20:48:21 +0000214
jardineb5d44e2003-12-23 08:09:43 +0000215 /* and lastly the circuit itself */
216 XFREE (MTYPE_ISIS_CIRCUIT, circuit);
217
218 return;
219}
220
221void
hassof891f442004-09-14 13:54:30 +0000222isis_circuit_add_addr (struct isis_circuit *circuit,
223 struct connected *connected)
jardineb5d44e2003-12-23 08:09:43 +0000224{
225 struct prefix_ipv4 *ipv4;
hassof390d2c2004-09-10 20:48:21 +0000226 u_char buf[BUFSIZ];
jardineb5d44e2003-12-23 08:09:43 +0000227#ifdef HAVE_IPV6
228 struct prefix_ipv6 *ipv6;
229#endif /* HAVE_IPV6 */
hassof891f442004-09-14 13:54:30 +0000230
hassof390d2c2004-09-10 20:48:21 +0000231 if (!circuit->ip_addrs)
hassof891f442004-09-14 13:54:30 +0000232 circuit->ip_addrs = list_new ();
jardineb5d44e2003-12-23 08:09:43 +0000233#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000234 if (!circuit->ipv6_link)
hassof891f442004-09-14 13:54:30 +0000235 circuit->ipv6_link = list_new ();
hassof390d2c2004-09-10 20:48:21 +0000236 if (!circuit->ipv6_non_link)
hassof891f442004-09-14 13:54:30 +0000237 circuit->ipv6_non_link = list_new ();
jardineb5d44e2003-12-23 08:09:43 +0000238#endif /* HAVE_IPV6 */
239
240 memset (&buf, 0, BUFSIZ);
hassof891f442004-09-14 13:54:30 +0000241 if (connected->address->family == AF_INET)
hassof390d2c2004-09-10 20:48:21 +0000242 {
243 ipv4 = prefix_ipv4_new ();
hassof891f442004-09-14 13:54:30 +0000244 ipv4->prefixlen = connected->address->prefixlen;
245 ipv4->prefix = connected->address->u.prefix4;
hassof390d2c2004-09-10 20:48:21 +0000246 listnode_add (circuit->ip_addrs, ipv4);
hasso0dae85e2004-09-26 19:53:47 +0000247 if (circuit->area)
248 lsp_regenerate_schedule (circuit->area);
hassof891f442004-09-14 13:54:30 +0000249
jardineb5d44e2003-12-23 08:09:43 +0000250#ifdef EXTREME_DEBUG
hassof891f442004-09-14 13:54:30 +0000251 prefix2str (connected->address, buf, BUFSIZ);
hasso529d65b2004-12-24 00:14:50 +0000252 zlog_debug ("Added IP address %s to circuit %d", buf,
hassof390d2c2004-09-10 20:48:21 +0000253 circuit->circuit_id);
254#endif /* EXTREME_DEBUG */
jardineb5d44e2003-12-23 08:09:43 +0000255 }
hassof390d2c2004-09-10 20:48:21 +0000256#ifdef HAVE_IPV6
hassof891f442004-09-14 13:54:30 +0000257 if (connected->address->family == AF_INET6)
hassof390d2c2004-09-10 20:48:21 +0000258 {
259 ipv6 = prefix_ipv6_new ();
hassof891f442004-09-14 13:54:30 +0000260 ipv6->prefixlen = connected->address->prefixlen;
261 ipv6->prefix = connected->address->u.prefix6;
262
hassof390d2c2004-09-10 20:48:21 +0000263 if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix))
hassof891f442004-09-14 13:54:30 +0000264 listnode_add (circuit->ipv6_link, ipv6);
hassof390d2c2004-09-10 20:48:21 +0000265 else
hassof891f442004-09-14 13:54:30 +0000266 listnode_add (circuit->ipv6_non_link, ipv6);
hasso0dae85e2004-09-26 19:53:47 +0000267 if (circuit->area)
268 lsp_regenerate_schedule (circuit->area);
hassof891f442004-09-14 13:54:30 +0000269
jardineb5d44e2003-12-23 08:09:43 +0000270#ifdef EXTREME_DEBUG
hassof891f442004-09-14 13:54:30 +0000271 prefix2str (connected->address, buf, BUFSIZ);
hasso529d65b2004-12-24 00:14:50 +0000272 zlog_debug ("Added IPv6 address %s to circuit %d", buf,
hassof390d2c2004-09-10 20:48:21 +0000273 circuit->circuit_id);
274#endif /* EXTREME_DEBUG */
275 }
jardineb5d44e2003-12-23 08:09:43 +0000276#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000277 return;
278}
279
280void
281isis_circuit_del_addr (struct isis_circuit *circuit,
hassof390d2c2004-09-10 20:48:21 +0000282 struct connected *connected)
jardineb5d44e2003-12-23 08:09:43 +0000283{
hassof891f442004-09-14 13:54:30 +0000284 struct prefix_ipv4 *ipv4, *ip = NULL;
285 struct listnode *node;
hassof891f442004-09-14 13:54:30 +0000286 u_char buf[BUFSIZ];
287#ifdef HAVE_IPV6
288 struct prefix_ipv6 *ipv6, *ip6 = NULL;
Paul Jakma41b36e92006-12-08 01:09:50 +0000289 int found = 0;
hassof891f442004-09-14 13:54:30 +0000290#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000291
hassof891f442004-09-14 13:54:30 +0000292 memset (&buf, 0, BUFSIZ);
293 if (connected->address->family == AF_INET)
294 {
295 ipv4 = prefix_ipv4_new ();
296 ipv4->prefixlen = connected->address->prefixlen;
297 ipv4->prefix = connected->address->u.prefix4;
298
paul1eb8ef22005-04-07 07:30:20 +0000299 for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip))
300 if (prefix_same ((struct prefix *) ip, (struct prefix *) &ipv4))
301 break;
hassof891f442004-09-14 13:54:30 +0000302
303 if (ip)
304 {
305 listnode_delete (circuit->ip_addrs, ip);
hasso0dae85e2004-09-26 19:53:47 +0000306 if (circuit->area)
307 lsp_regenerate_schedule (circuit->area);
hassof891f442004-09-14 13:54:30 +0000308 }
309 else
310 {
hassof7c43dc2004-09-26 16:24:14 +0000311 prefix2str (connected->address, (char *)buf, BUFSIZ);
hassof891f442004-09-14 13:54:30 +0000312 zlog_warn("Nonexitant ip address %s removal attempt from circuit \
313 %d", buf, circuit->circuit_id);
314 }
315 }
316#ifdef HAVE_IPV6
317 if (connected->address->family == AF_INET6)
318 {
319 ipv6 = prefix_ipv6_new ();
320 ipv6->prefixlen = connected->address->prefixlen;
321 ipv6->prefix = connected->address->u.prefix6;
322
323 if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix))
324 {
paul1eb8ef22005-04-07 07:30:20 +0000325 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_link, node, ip6))
hassof891f442004-09-14 13:54:30 +0000326 {
hassof891f442004-09-14 13:54:30 +0000327 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
328 break;
329 }
330 if (ip6)
331 {
332 listnode_delete (circuit->ipv6_link, ip6);
333 found = 1;
334 }
335 }
336 else
337 {
paul1eb8ef22005-04-07 07:30:20 +0000338 for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, node, ip6))
hassof891f442004-09-14 13:54:30 +0000339 {
hassof891f442004-09-14 13:54:30 +0000340 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
341 break;
342 }
343 if (ip6)
344 {
345 listnode_delete (circuit->ipv6_non_link, ip6);
346 found = 1;
347 }
348 }
349
350 if (!found)
351 {
hassof7c43dc2004-09-26 16:24:14 +0000352 prefix2str (connected->address, (char *)buf, BUFSIZ);
hassof891f442004-09-14 13:54:30 +0000353 zlog_warn("Nonexitant ip address %s removal attempt from \
354 circuit %d", buf, circuit->circuit_id);
355 }
356 else
hasso0dae85e2004-09-26 19:53:47 +0000357 if (circuit->area)
358 lsp_regenerate_schedule (circuit->area);
hassof891f442004-09-14 13:54:30 +0000359 }
360#endif /* HAVE_IPV6 */
361 return;
jardineb5d44e2003-12-23 08:09:43 +0000362}
363
364void
365isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp)
366{
paul1eb8ef22005-04-07 07:30:20 +0000367 struct listnode *node, *nnode;
jardineb5d44e2003-12-23 08:09:43 +0000368 struct connected *conn;
369
370 circuit->interface = ifp;
371 ifp->info = circuit;
hassof390d2c2004-09-10 20:48:21 +0000372
373 circuit->circuit_id = ifp->ifindex % 255; /* FIXME: Why not ? */
jardineb5d44e2003-12-23 08:09:43 +0000374
375 /* isis_circuit_update_addrs (circuit, ifp); */
376
hassof390d2c2004-09-10 20:48:21 +0000377 if (if_is_broadcast (ifp))
378 {
379 circuit->circ_type = CIRCUIT_T_BROADCAST;
380 /*
381 * Get the Hardware Address
382 */
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000383#ifdef HAVE_STRUCT_SOCKADDR_DL
hassof390d2c2004-09-10 20:48:21 +0000384 if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN)
385 zlog_warn ("unsupported link layer");
386 else
387 memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl),
388 ETH_ALEN);
jardineb5d44e2003-12-23 08:09:43 +0000389#else
hassof390d2c2004-09-10 20:48:21 +0000390 if (circuit->interface->hw_addr_len != ETH_ALEN)
391 {
392 zlog_warn ("unsupported link layer");
393 }
394 else
395 {
396 memcpy (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN);
397 }
jardineb5d44e2003-12-23 08:09:43 +0000398#ifdef EXTREME_DEGUG
hasso529d65b2004-12-24 00:14:50 +0000399 zlog_debug ("isis_circuit_if_add: if_id %d, isomtu %d snpa %s",
hassof390d2c2004-09-10 20:48:21 +0000400 circuit->interface->ifindex, ISO_MTU (circuit),
401 snpa_print (circuit->u.bc.snpa));
jardineb5d44e2003-12-23 08:09:43 +0000402
403#endif /* EXTREME_DEBUG */
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000404#endif /* HAVE_STRUCT_SOCKADDR_DL */
hassof390d2c2004-09-10 20:48:21 +0000405 }
406 else if (if_is_pointopoint (ifp))
407 {
408 circuit->circ_type = CIRCUIT_T_P2P;
409 }
410 else
411 {
hassoc89c05d2005-09-04 21:36:36 +0000412 /* It's normal in case of loopback etc. */
413 if (isis->debugs & DEBUG_EVENTS)
414 zlog_debug ("isis_circuit_if_add: unsupported media");
hassof390d2c2004-09-10 20:48:21 +0000415 }
416
paul1eb8ef22005-04-07 07:30:20 +0000417 for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn))
418 isis_circuit_add_addr (circuit, conn);
jardineb5d44e2003-12-23 08:09:43 +0000419
420 return;
421}
422
423void
hassof390d2c2004-09-10 20:48:21 +0000424isis_circuit_update_params (struct isis_circuit *circuit,
425 struct interface *ifp)
jardineb5d44e2003-12-23 08:09:43 +0000426{
hassob30c5e62004-12-29 20:06:41 +0000427 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +0000428
429 if (circuit->circuit_id != ifp->ifindex)
430 {
431 zlog_warn ("changing circuit_id %d->%d", circuit->circuit_id,
432 ifp->ifindex);
433 circuit->circuit_id = ifp->ifindex % 255;
434 }
jardineb5d44e2003-12-23 08:09:43 +0000435
436 /* FIXME: Why is this needed? shouldn't we compare to the area's mtu */
437 /* Ofer, this was here in case someone changes the mtu (e.g. with ifconfig)
438 The areas MTU is the minimum of mtu's of circuits in the area
439 now we can't catch the change
440 if (circuit->mtu != ifp->mtu) {
441 zlog_warn ("changing circuit mtu %d->%d", circuit->mtu,
442 ifp->mtu);
443 circuit->mtu = ifp->mtu;
444 }
hassof390d2c2004-09-10 20:48:21 +0000445 */
jardineb5d44e2003-12-23 08:09:43 +0000446 /*
447 * Get the Hardware Address
448 */
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000449#ifdef HAVE_STRUCT_SOCKADDR_DL
jardineb5d44e2003-12-23 08:09:43 +0000450 if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN)
jardineb5d44e2003-12-23 08:09:43 +0000451 zlog_warn ("unsupported link layer");
hassof390d2c2004-09-10 20:48:21 +0000452 else
453 memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl), ETH_ALEN);
454#else
455 if (circuit->interface->hw_addr_len != ETH_ALEN)
456 {
457 zlog_warn ("unsupported link layer");
jardineb5d44e2003-12-23 08:09:43 +0000458 }
hassof390d2c2004-09-10 20:48:21 +0000459 else
460 {
461 if (memcmp (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN))
462 {
463 zlog_warn ("changing circuit snpa %s->%s",
464 snpa_print (circuit->u.bc.snpa),
465 snpa_print (circuit->interface->hw_addr));
466 }
467 }
468#endif
jardineb5d44e2003-12-23 08:09:43 +0000469
hassof390d2c2004-09-10 20:48:21 +0000470 if (if_is_broadcast (ifp))
471 {
472 circuit->circ_type = CIRCUIT_T_BROADCAST;
473 }
474 else if (if_is_pointopoint (ifp))
475 {
476 circuit->circ_type = CIRCUIT_T_P2P;
477 }
478 else
479 {
480 zlog_warn ("isis_circuit_update_params: unsupported media");
481 }
jardineb5d44e2003-12-23 08:09:43 +0000482
jardineb5d44e2003-12-23 08:09:43 +0000483 return;
484}
485
486void
hassof390d2c2004-09-10 20:48:21 +0000487isis_circuit_if_del (struct isis_circuit *circuit)
jardineb5d44e2003-12-23 08:09:43 +0000488{
489 circuit->interface->info = NULL;
490 circuit->interface = NULL;
hassof390d2c2004-09-10 20:48:21 +0000491
jardineb5d44e2003-12-23 08:09:43 +0000492 return;
493}
494
495void
496isis_circuit_up (struct isis_circuit *circuit)
497{
jardineb5d44e2003-12-23 08:09:43 +0000498
hassof390d2c2004-09-10 20:48:21 +0000499 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
500 {
501 if (circuit->area->min_bcast_mtu == 0 ||
502 ISO_MTU (circuit) < circuit->area->min_bcast_mtu)
503 circuit->area->min_bcast_mtu = ISO_MTU (circuit);
504 /*
505 * ISO 10589 - 8.4.1 Enabling of broadcast circuits
506 */
jardineb5d44e2003-12-23 08:09:43 +0000507
hassof390d2c2004-09-10 20:48:21 +0000508 /* initilizing the hello sending threads
509 * for a broadcast IF
510 */
jardineb5d44e2003-12-23 08:09:43 +0000511
hassof390d2c2004-09-10 20:48:21 +0000512 /* 8.4.1 a) commence sending of IIH PDUs */
513
514 if (circuit->circuit_is_type & IS_LEVEL_1)
515 {
516 thread_add_event (master, send_lan_l1_hello, circuit, 0);
517 circuit->u.bc.lan_neighs[0] = list_new ();
518 }
519
520 if (circuit->circuit_is_type & IS_LEVEL_2)
521 {
522 thread_add_event (master, send_lan_l2_hello, circuit, 0);
523 circuit->u.bc.lan_neighs[1] = list_new ();
524 }
525
526 /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */
527 /* 8.4.1 c) FIXME: listen for ESH PDUs */
528
529 /* 8.4.1 d) */
530 /* dr election will commence in... */
531 if (circuit->circuit_is_type & IS_LEVEL_1)
532 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
hassobf731012004-09-17 07:59:57 +0000533 circuit, 2 * circuit->hello_interval[0]);
hassof390d2c2004-09-10 20:48:21 +0000534 if (circuit->circuit_is_type & IS_LEVEL_2)
535 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
hassobf731012004-09-17 07:59:57 +0000536 circuit, 2 * circuit->hello_interval[1]);
jardineb5d44e2003-12-23 08:09:43 +0000537 }
hassof390d2c2004-09-10 20:48:21 +0000538 else
539 {
540 /* initializing the hello send threads
541 * for a ptp IF
542 */
543 thread_add_event (master, send_p2p_hello, circuit, 0);
jardineb5d44e2003-12-23 08:09:43 +0000544
jardineb5d44e2003-12-23 08:09:43 +0000545 }
546
jardineb5d44e2003-12-23 08:09:43 +0000547 /* initializing PSNP timers */
hassof390d2c2004-09-10 20:48:21 +0000548 if (circuit->circuit_is_type & IS_LEVEL_1)
549 {
550 THREAD_TIMER_ON (master, circuit->t_send_psnp[0], send_l1_psnp, circuit,
551 isis_jitter (circuit->psnp_interval[0], PSNP_JITTER));
552 }
553
554 if (circuit->circuit_is_type & IS_LEVEL_2)
555 {
556 THREAD_TIMER_ON (master, circuit->t_send_psnp[1], send_l2_psnp, circuit,
557 isis_jitter (circuit->psnp_interval[1], PSNP_JITTER));
558 }
559
jardineb5d44e2003-12-23 08:09:43 +0000560 /* initialize the circuit streams */
561 if (circuit->rcv_stream == NULL)
hassof390d2c2004-09-10 20:48:21 +0000562 circuit->rcv_stream = stream_new (ISO_MTU (circuit));
jardineb5d44e2003-12-23 08:09:43 +0000563
564 if (circuit->snd_stream == NULL)
hassof390d2c2004-09-10 20:48:21 +0000565 circuit->snd_stream = stream_new (ISO_MTU (circuit));
jardineb5d44e2003-12-23 08:09:43 +0000566
567 /* unified init for circuits */
568 isis_sock_init (circuit);
569
570#ifdef GNU_LINUX
hassof390d2c2004-09-10 20:48:21 +0000571 THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit,
572 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000573#else
hassof390d2c2004-09-10 20:48:21 +0000574 THREAD_TIMER_ON (master, circuit->t_read, isis_receive, circuit,
575 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000576#endif
577 return;
578}
579
580void
581isis_circuit_down (struct isis_circuit *circuit)
582{
hassof390d2c2004-09-10 20:48:21 +0000583 /* Cancel all active threads -- FIXME: wrong place */
hassod70f99e2004-02-11 20:26:31 +0000584 /* HT: Read thread if GNU_LINUX, TIMER thread otherwise. */
hassof390d2c2004-09-10 20:48:21 +0000585 THREAD_OFF (circuit->t_read);
586 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
587 {
588 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[0]);
589 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[1]);
hassof891f442004-09-14 13:54:30 +0000590 THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[0]);
591 THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[1]);
hassof390d2c2004-09-10 20:48:21 +0000592 }
593 else if (circuit->circ_type == CIRCUIT_T_P2P)
594 {
595 THREAD_TIMER_OFF (circuit->u.p2p.t_send_p2p_hello);
596 }
jardineb5d44e2003-12-23 08:09:43 +0000597 /* close the socket */
598 close (circuit->fd);
599
600 return;
601}
602
603void
604circuit_update_nlpids (struct isis_circuit *circuit)
605{
606 circuit->nlpids.count = 0;
hassof390d2c2004-09-10 20:48:21 +0000607
608 if (circuit->ip_router)
609 {
610 circuit->nlpids.nlpids[0] = NLPID_IP;
611 circuit->nlpids.count++;
612 }
jardineb5d44e2003-12-23 08:09:43 +0000613#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000614 if (circuit->ipv6_router)
615 {
616 circuit->nlpids.nlpids[circuit->nlpids.count] = NLPID_IPV6;
617 circuit->nlpids.count++;
618 }
jardineb5d44e2003-12-23 08:09:43 +0000619#endif /* HAVE_IPV6 */
620 return;
621}
622
623int
hassof390d2c2004-09-10 20:48:21 +0000624isis_interface_config_write (struct vty *vty)
jardineb5d44e2003-12-23 08:09:43 +0000625{
626
627 int write = 0;
hasso3fdb2dd2005-09-28 18:45:54 +0000628 struct listnode *node, *node2;
jardineb5d44e2003-12-23 08:09:43 +0000629 struct interface *ifp;
630 struct isis_area *area;
631 struct isis_circuit *c;
jardineb5d44e2003-12-23 08:09:43 +0000632 int i;
jardineb5d44e2003-12-23 08:09:43 +0000633
hasso3fdb2dd2005-09-28 18:45:54 +0000634 for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
jardineb5d44e2003-12-23 08:09:43 +0000635 {
636 /* IF name */
hassof390d2c2004-09-10 20:48:21 +0000637 vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000638 write++;
639 /* IF desc */
hassof390d2c2004-09-10 20:48:21 +0000640 if (ifp->desc)
641 {
642 vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE);
643 write++;
644 }
jardineb5d44e2003-12-23 08:09:43 +0000645 /* ISIS Circuit */
hasso3fdb2dd2005-09-28 18:45:54 +0000646 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node2, area))
jardineb5d44e2003-12-23 08:09:43 +0000647 {
648 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +0000649 if (c)
650 {
651 if (c->ip_router)
652 {
653 vty_out (vty, " ip router isis %s%s", area->area_tag,
654 VTY_NEWLINE);
655 write++;
656 }
jardineb5d44e2003-12-23 08:09:43 +0000657#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000658 if (c->ipv6_router)
659 {
660 vty_out (vty, " ipv6 router isis %s%s", area->area_tag,
661 VTY_NEWLINE);
662 write++;
663 }
jardineb5d44e2003-12-23 08:09:43 +0000664#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000665
hassof390d2c2004-09-10 20:48:21 +0000666 /* ISIS - circuit type */
667 if (c->circuit_is_type == IS_LEVEL_1)
668 {
669 vty_out (vty, " isis circuit-type level-1%s", VTY_NEWLINE);
670 write++;
671 }
672 else
673 {
674 if (c->circuit_is_type == IS_LEVEL_2)
675 {
676 vty_out (vty, " isis circuit-type level-2-only%s",
677 VTY_NEWLINE);
678 write++;
679 }
680 }
jardineb5d44e2003-12-23 08:09:43 +0000681
hassof390d2c2004-09-10 20:48:21 +0000682 /* ISIS - CSNP interval - FIXME: compare to cisco */
683 if (c->csnp_interval[0] == c->csnp_interval[1])
684 {
685 if (c->csnp_interval[0] != CSNP_INTERVAL)
686 {
687 vty_out (vty, " isis csnp-interval %d%s",
688 c->csnp_interval[0], VTY_NEWLINE);
689 write++;
690 }
691 }
692 else
693 {
694 for (i = 0; i < 2; i++)
695 {
696 if (c->csnp_interval[1] != CSNP_INTERVAL)
697 {
698 vty_out (vty, " isis csnp-interval %d level-%d%s",
699 c->csnp_interval[1], i + 1, VTY_NEWLINE);
700 write++;
701 }
702 }
703 }
jardineb5d44e2003-12-23 08:09:43 +0000704
hassof390d2c2004-09-10 20:48:21 +0000705 /* ISIS - Hello padding - Defaults to true so only display if false */
706 if (c->circ_type == CIRCUIT_T_BROADCAST && !c->u.bc.pad_hellos)
707 {
708 vty_out (vty, " no isis hello padding%s", VTY_NEWLINE);
709 write++;
710 }
jardineb5d44e2003-12-23 08:09:43 +0000711
hassof390d2c2004-09-10 20:48:21 +0000712 /* ISIS - Hello interval - FIXME: compare to cisco */
713 if (c->hello_interval[0] == c->hello_interval[1])
714 {
715 if (c->hello_interval[0] != HELLO_INTERVAL)
716 {
717 vty_out (vty, " isis hello-interval %d%s",
718 c->hello_interval[0], VTY_NEWLINE);
719 write++;
720 }
721 }
722 else
723 {
724 for (i = 0; i < 2; i++)
725 {
726 if (c->hello_interval[i] != HELLO_INTERVAL)
727 {
728 if (c->hello_interval[i] == HELLO_MINIMAL)
729 {
730 vty_out (vty,
731 " isis hello-interval minimal level-%d%s",
732 i + 1, VTY_NEWLINE);
733 }
734 else
735 {
736 vty_out (vty, " isis hello-interval %d level-%d%s",
737 c->hello_interval[i], i + 1, VTY_NEWLINE);
738 }
739 write++;
740 }
741 }
742 }
jardineb5d44e2003-12-23 08:09:43 +0000743
hassof390d2c2004-09-10 20:48:21 +0000744 /* ISIS - Hello Multiplier */
745 if (c->hello_multiplier[0] == c->hello_multiplier[1])
746 {
747 if (c->hello_multiplier[0] != HELLO_MULTIPLIER)
748 {
749 vty_out (vty, " isis hello-multiplier %d%s",
750 c->hello_multiplier[0], VTY_NEWLINE);
751 write++;
752 }
753 }
754 else
755 {
756 for (i = 0; i < 2; i++)
757 {
758 if (c->hello_multiplier[i] != HELLO_MULTIPLIER)
759 {
760 vty_out (vty, " isis hello-multiplier %d level-%d%s",
761 c->hello_multiplier[i], i + 1, VTY_NEWLINE);
762 write++;
763 }
764 }
765 }
766 /* ISIS - Priority */
767 if (c->circ_type == CIRCUIT_T_BROADCAST)
768 {
769 if (c->u.bc.priority[0] == c->u.bc.priority[1])
770 {
771 if (c->u.bc.priority[0] != DEFAULT_PRIORITY)
772 {
773 vty_out (vty, " isis priority %d%s",
774 c->u.bc.priority[0], VTY_NEWLINE);
775 write++;
776 }
777 }
778 else
779 {
780 for (i = 0; i < 2; i++)
781 {
782 if (c->u.bc.priority[i] != DEFAULT_PRIORITY)
783 {
784 vty_out (vty, " isis priority %d level-%d%s",
785 c->u.bc.priority[i], i + 1, VTY_NEWLINE);
786 write++;
787 }
788 }
789 }
790 }
791 /* ISIS - Metric */
hassof21fb272005-09-26 17:05:55 +0000792 if (c->te_metric[0] == c->te_metric[1])
hassof390d2c2004-09-10 20:48:21 +0000793 {
hassof21fb272005-09-26 17:05:55 +0000794 if (c->te_metric[0] != DEFAULT_CIRCUIT_METRICS)
hassof390d2c2004-09-10 20:48:21 +0000795 {
hassof21fb272005-09-26 17:05:55 +0000796 vty_out (vty, " isis metric %d%s", c->te_metric[0],
797 VTY_NEWLINE);
hassof390d2c2004-09-10 20:48:21 +0000798 write++;
799 }
800 }
801 else
802 {
803 for (i = 0; i < 2; i++)
804 {
hassof21fb272005-09-26 17:05:55 +0000805 if (c->te_metric[i] != DEFAULT_CIRCUIT_METRICS)
hassof390d2c2004-09-10 20:48:21 +0000806 {
807 vty_out (vty, " isis metric %d level-%d%s",
hassof21fb272005-09-26 17:05:55 +0000808 c->te_metric[i], i + 1, VTY_NEWLINE);
hassof390d2c2004-09-10 20:48:21 +0000809 write++;
810 }
811 }
812 }
jardineb5d44e2003-12-23 08:09:43 +0000813
hassof390d2c2004-09-10 20:48:21 +0000814 }
jardineb5d44e2003-12-23 08:09:43 +0000815 }
hassof390d2c2004-09-10 20:48:21 +0000816 vty_out (vty, "!%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000817 }
hassof390d2c2004-09-10 20:48:21 +0000818
jardineb5d44e2003-12-23 08:09:43 +0000819 return write;
820}
jardineb5d44e2003-12-23 08:09:43 +0000821
822DEFUN (ip_router_isis,
823 ip_router_isis_cmd,
824 "ip router isis WORD",
825 "Interface Internet Protocol config commands\n"
826 "IP router interface commands\n"
827 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +0000828 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +0000829{
830 struct isis_circuit *c;
831 struct interface *ifp;
832 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000833
834 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000835 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +0000836
jardineb5d44e2003-12-23 08:09:43 +0000837 area = isis_area_lookup (argv[0]);
838
839 /* Prevent more than one circuit per interface */
840 if (area)
841 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +0000842 else
843 c = NULL;
844 if (c && (ifp->info != NULL))
845 {
jardineb5d44e2003-12-23 08:09:43 +0000846#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000847 if (c->ipv6_router == 0)
848 {
jardineb5d44e2003-12-23 08:09:43 +0000849#endif /* HAVE_IPV6 */
hassoc89c05d2005-09-04 21:36:36 +0000850 /* FIXME: Find the way to warn only vty users. */
851 /* vty_out (vty, "ISIS circuit is already defined%s", VTY_NEWLINE); */
hassof390d2c2004-09-10 20:48:21 +0000852 return CMD_WARNING;
jardineb5d44e2003-12-23 08:09:43 +0000853#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000854 }
855#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000856 }
hassof390d2c2004-09-10 20:48:21 +0000857
jardineb5d44e2003-12-23 08:09:43 +0000858 /* this is here for ciscopability */
hassof390d2c2004-09-10 20:48:21 +0000859 if (!area)
860 {
hassoc89c05d2005-09-04 21:36:36 +0000861 /* FIXME: Find the way to warn only vty users. */
862 /* vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); */
hassof390d2c2004-09-10 20:48:21 +0000863 return CMD_WARNING;
864 }
jardineb5d44e2003-12-23 08:09:43 +0000865
hassof390d2c2004-09-10 20:48:21 +0000866 if (!c)
867 {
868 c = circuit_lookup_by_ifp (ifp, isis->init_circ_list);
869 c = isis_csm_state_change (ISIS_ENABLE, c, area);
870 c->interface = ifp; /* this is automatic */
871 ifp->info = c; /* hardly related to the FSM */
872 }
jardineb5d44e2003-12-23 08:09:43 +0000873
hassof390d2c2004-09-10 20:48:21 +0000874 if (!c)
jardineb5d44e2003-12-23 08:09:43 +0000875 return CMD_WARNING;
876
877 c->ip_router = 1;
878 area->ip_circuits++;
879 circuit_update_nlpids (c);
880
881 vty->node = INTERFACE_NODE;
hassof390d2c2004-09-10 20:48:21 +0000882
jardineb5d44e2003-12-23 08:09:43 +0000883 return CMD_SUCCESS;
884}
885
886DEFUN (no_ip_router_isis,
887 no_ip_router_isis_cmd,
888 "no ip router isis WORD",
889 NO_STR
890 "Interface Internet Protocol config commands\n"
891 "IP router interface commands\n"
892 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +0000893 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +0000894{
895 struct isis_circuit *circuit = NULL;
896 struct interface *ifp;
897 struct isis_area *area;
hasso3fdb2dd2005-09-28 18:45:54 +0000898 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000899
hassof390d2c2004-09-10 20:48:21 +0000900 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000901 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +0000902
jardineb5d44e2003-12-23 08:09:43 +0000903 area = isis_area_lookup (argv[0]);
hassof390d2c2004-09-10 20:48:21 +0000904 if (!area)
905 {
906 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
907 return CMD_WARNING;
908 }
hasso3fdb2dd2005-09-28 18:45:54 +0000909 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
jardineb5d44e2003-12-23 08:09:43 +0000910 if (circuit->interface == ifp)
911 break;
hassof390d2c2004-09-10 20:48:21 +0000912 if (!circuit)
913 {
914 vty_out (vty, "Can't find ISIS interface %s", VTY_NEWLINE);
915 return CMD_WARNING;
916 }
jardineb5d44e2003-12-23 08:09:43 +0000917 circuit->ip_router = 0;
918 area->ip_circuits--;
919#ifdef HAVE_IPV6
920 if (circuit->ipv6_router == 0)
921#endif
922 isis_csm_state_change (ISIS_DISABLE, circuit, area);
hassof390d2c2004-09-10 20:48:21 +0000923
jardineb5d44e2003-12-23 08:09:43 +0000924 return CMD_SUCCESS;
925}
926
927DEFUN (isis_circuit_type,
928 isis_circuit_type_cmd,
929 "isis circuit-type (level-1|level-1-2|level-2-only)",
930 "IS-IS commands\n"
931 "Configure circuit type for interface\n"
932 "Level-1 only adjacencies are formed\n"
933 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +0000934 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +0000935{
936 struct isis_circuit *circuit;
937 struct interface *ifp;
938 int circuit_t;
939 int is_type;
hassof390d2c2004-09-10 20:48:21 +0000940
941 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000942 circuit = ifp->info;
943 /* UGLY - will remove l8r */
hassof390d2c2004-09-10 20:48:21 +0000944 if (circuit == NULL)
945 {
946 return CMD_WARNING;
947 }
jardineb5d44e2003-12-23 08:09:43 +0000948
hasso13c48f72004-09-10 21:19:13 +0000949 /* XXX what to do when ip_router_isis is not executed */
950 if (circuit->area == NULL)
951 return CMD_WARNING;
952
jardineb5d44e2003-12-23 08:09:43 +0000953 assert (circuit);
954
Paul Jakma41b36e92006-12-08 01:09:50 +0000955 circuit_t = string2circuit_t (argv[0]);
jardineb5d44e2003-12-23 08:09:43 +0000956
hassof390d2c2004-09-10 20:48:21 +0000957 if (!circuit_t)
958 {
959 vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE);
960 return CMD_SUCCESS;
961 }
962
jardineb5d44e2003-12-23 08:09:43 +0000963 is_type = circuit->area->is_type;
964 if (is_type == IS_LEVEL_1_AND_2 || is_type == circuit_t)
hassof390d2c2004-09-10 20:48:21 +0000965 isis_event_circuit_type_change (circuit, circuit_t);
966 else
967 {
968 vty_out (vty, "invalid circuit level for area %s.%s",
969 circuit->area->area_tag, VTY_NEWLINE);
970 }
971
jardineb5d44e2003-12-23 08:09:43 +0000972 return CMD_SUCCESS;
973}
974
975DEFUN (no_isis_circuit_type,
976 no_isis_circuit_type_cmd,
977 "no isis circuit-type (level-1|level-1-2|level-2-only)",
978 NO_STR
979 "IS-IS commands\n"
980 "Configure circuit type for interface\n"
981 "Level-1 only adjacencies are formed\n"
982 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +0000983 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +0000984{
985 struct isis_circuit *circuit;
986 struct interface *ifp;
jardineb5d44e2003-12-23 08:09:43 +0000987
hassof390d2c2004-09-10 20:48:21 +0000988 ifp = vty->index;
989 circuit = ifp->info;
990 if (circuit == NULL)
991 {
992 return CMD_WARNING;
993 }
994
995 assert (circuit);
996
jardineb5d44e2003-12-23 08:09:43 +0000997 /*
998 * Set the circuits level to its default value which is that of the area
999 */
1000 isis_event_circuit_type_change (circuit, circuit->area->is_type);
hassof390d2c2004-09-10 20:48:21 +00001001
jardineb5d44e2003-12-23 08:09:43 +00001002 return CMD_SUCCESS;
1003}
1004
1005DEFUN (isis_passwd,
1006 isis_passwd_cmd,
1007 "isis password WORD",
1008 "IS-IS commands\n"
1009 "Configure the authentication password for interface\n"
1010 "Password\n")
1011{
1012 struct isis_circuit *circuit;
1013 struct interface *ifp;
1014 int len;
hassof390d2c2004-09-10 20:48:21 +00001015
1016 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001017 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001018 if (circuit == NULL)
1019 {
1020 return CMD_WARNING;
1021 }
1022
jardineb5d44e2003-12-23 08:09:43 +00001023 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001024 if (len > 254)
1025 {
1026 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
1027 return CMD_WARNING;
1028 }
jardineb5d44e2003-12-23 08:09:43 +00001029 circuit->passwd.len = len;
1030 circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001031 strncpy ((char *)circuit->passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001032
jardineb5d44e2003-12-23 08:09:43 +00001033 return CMD_SUCCESS;
1034}
1035
1036DEFUN (no_isis_passwd,
1037 no_isis_passwd_cmd,
1038 "no isis password",
1039 NO_STR
1040 "IS-IS commands\n"
1041 "Configure the authentication password for interface\n")
1042{
1043 struct isis_circuit *circuit;
1044 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001045
1046 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001047 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001048 if (circuit == NULL)
1049 {
1050 return CMD_WARNING;
1051 }
1052
jardineb5d44e2003-12-23 08:09:43 +00001053 memset (&circuit->passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +00001054
jardineb5d44e2003-12-23 08:09:43 +00001055 return CMD_SUCCESS;
1056}
1057
1058
1059DEFUN (isis_priority,
1060 isis_priority_cmd,
1061 "isis priority <0-127>",
1062 "IS-IS commands\n"
1063 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001064 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001065{
1066 struct isis_circuit *circuit;
1067 struct interface *ifp;
1068 int prio;
hassof390d2c2004-09-10 20:48:21 +00001069
1070 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001071 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001072 if (circuit == NULL)
1073 {
1074 return CMD_WARNING;
1075 }
jardineb5d44e2003-12-23 08:09:43 +00001076 assert (circuit);
1077
1078 prio = atoi (argv[0]);
1079
1080 circuit->u.bc.priority[0] = prio;
1081 circuit->u.bc.priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001082
jardineb5d44e2003-12-23 08:09:43 +00001083 return CMD_SUCCESS;
1084}
1085
1086DEFUN (no_isis_priority,
1087 no_isis_priority_cmd,
1088 "no isis priority",
1089 NO_STR
1090 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001091 "Set priority for Designated Router election\n")
jardineb5d44e2003-12-23 08:09:43 +00001092{
1093 struct isis_circuit *circuit;
1094 struct interface *ifp;
1095
hassof390d2c2004-09-10 20:48:21 +00001096 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001097 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001098 if (circuit == NULL)
1099 {
1100 return CMD_WARNING;
1101 }
jardineb5d44e2003-12-23 08:09:43 +00001102 assert (circuit);
1103
1104 circuit->u.bc.priority[0] = DEFAULT_PRIORITY;
1105 circuit->u.bc.priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001106
jardineb5d44e2003-12-23 08:09:43 +00001107 return CMD_SUCCESS;
1108}
1109
1110ALIAS (no_isis_priority,
1111 no_isis_priority_arg_cmd,
1112 "no isis priority <0-127>",
1113 NO_STR
1114 "IS-IS commands\n"
1115 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001116 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001117
1118DEFUN (isis_priority_l1,
1119 isis_priority_l1_cmd,
hassof390d2c2004-09-10 20:48:21 +00001120 "isis priority <0-127> level-1",
jardineb5d44e2003-12-23 08:09:43 +00001121 "IS-IS commands\n"
1122 "Set priority for Designated Router election\n"
1123 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001124 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001125{
1126 struct isis_circuit *circuit;
1127 struct interface *ifp;
1128 int prio;
hassof390d2c2004-09-10 20:48:21 +00001129
1130 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001131 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001132 if (circuit == NULL)
1133 {
1134 return CMD_WARNING;
1135 }
jardineb5d44e2003-12-23 08:09:43 +00001136 assert (circuit);
1137
1138 prio = atoi (argv[0]);
1139
1140 circuit->u.bc.priority[0] = prio;
hassof390d2c2004-09-10 20:48:21 +00001141
jardineb5d44e2003-12-23 08:09:43 +00001142 return CMD_SUCCESS;
1143}
1144
1145DEFUN (no_isis_priority_l1,
1146 no_isis_priority_l1_cmd,
1147 "no isis priority level-1",
1148 NO_STR
1149 "IS-IS commands\n"
1150 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001151 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001152{
1153 struct isis_circuit *circuit;
1154 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001155
1156 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001157 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001158 if (circuit == NULL)
1159 {
1160 return CMD_WARNING;
1161 }
jardineb5d44e2003-12-23 08:09:43 +00001162 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001163
jardineb5d44e2003-12-23 08:09:43 +00001164 circuit->u.bc.priority[0] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001165
jardineb5d44e2003-12-23 08:09:43 +00001166 return CMD_SUCCESS;
1167}
1168
1169ALIAS (no_isis_priority_l1,
1170 no_isis_priority_l1_arg_cmd,
1171 "no isis priority <0-127> level-1",
1172 NO_STR
1173 "IS-IS commands\n"
1174 "Set priority for Designated Router election\n"
1175 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001176 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001177
1178DEFUN (isis_priority_l2,
1179 isis_priority_l2_cmd,
hassof390d2c2004-09-10 20:48:21 +00001180 "isis priority <0-127> level-2",
jardineb5d44e2003-12-23 08:09:43 +00001181 "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-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001185{
1186 struct isis_circuit *circuit;
1187 struct interface *ifp;
1188 int prio;
hassof390d2c2004-09-10 20:48:21 +00001189
1190 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001191 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001192 if (circuit == NULL)
1193 {
1194 return CMD_WARNING;
1195 }
jardineb5d44e2003-12-23 08:09:43 +00001196 assert (circuit);
1197
1198 prio = atoi (argv[0]);
1199
1200 circuit->u.bc.priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001201
jardineb5d44e2003-12-23 08:09:43 +00001202 return CMD_SUCCESS;
1203}
1204
1205DEFUN (no_isis_priority_l2,
1206 no_isis_priority_l2_cmd,
1207 "no isis priority level-2",
1208 NO_STR
1209 "IS-IS commands\n"
1210 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001211 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001212{
1213 struct isis_circuit *circuit;
1214 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001215
1216 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001217 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001218 if (circuit == NULL)
1219 {
1220 return CMD_WARNING;
1221 }
jardineb5d44e2003-12-23 08:09:43 +00001222 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001223
jardineb5d44e2003-12-23 08:09:43 +00001224 circuit->u.bc.priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001225
jardineb5d44e2003-12-23 08:09:43 +00001226 return CMD_SUCCESS;
1227}
1228
1229ALIAS (no_isis_priority_l2,
1230 no_isis_priority_l2_arg_cmd,
1231 "no isis priority <0-127> level-2",
1232 NO_STR
1233 "IS-IS commands\n"
1234 "Set priority for Designated Router election\n"
1235 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001236 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001237
1238/* Metric command */
hassof390d2c2004-09-10 20:48:21 +00001239 DEFUN (isis_metric,
jardineb5d44e2003-12-23 08:09:43 +00001240 isis_metric_cmd,
hassof21fb272005-09-26 17:05:55 +00001241 "isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001242 "IS-IS commands\n"
1243 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001244 "Default metric value\n")
jardineb5d44e2003-12-23 08:09:43 +00001245{
1246 struct isis_circuit *circuit;
1247 struct interface *ifp;
1248 int met;
1249
hassof390d2c2004-09-10 20:48:21 +00001250 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001251 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001252 if (circuit == NULL)
1253 {
1254 return CMD_WARNING;
1255 }
jardineb5d44e2003-12-23 08:09:43 +00001256 assert (circuit);
1257
1258 met = atoi (argv[0]);
1259
hassof21fb272005-09-26 17:05:55 +00001260 circuit->te_metric[0] = met;
1261 circuit->te_metric[1] = met;
1262
1263 if (met > 63)
1264 met = 63;
1265
jardineb5d44e2003-12-23 08:09:43 +00001266 circuit->metrics[0].metric_default = met;
1267 circuit->metrics[1].metric_default = met;
1268
1269 return CMD_SUCCESS;
1270}
1271
1272DEFUN (no_isis_metric,
1273 no_isis_metric_cmd,
1274 "no isis metric",
1275 NO_STR
1276 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001277 "Set default metric for circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001278{
1279 struct isis_circuit *circuit;
1280 struct interface *ifp;
1281
hassof390d2c2004-09-10 20:48:21 +00001282 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001283 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001284 if (circuit == NULL)
1285 {
1286 return CMD_WARNING;
1287 }
jardineb5d44e2003-12-23 08:09:43 +00001288 assert (circuit);
1289
hassof21fb272005-09-26 17:05:55 +00001290 circuit->te_metric[0] = DEFAULT_CIRCUIT_METRICS;
1291 circuit->te_metric[1] = DEFAULT_CIRCUIT_METRICS;
jardineb5d44e2003-12-23 08:09:43 +00001292 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRICS;
1293 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRICS;
1294
1295 return CMD_SUCCESS;
1296}
1297
1298ALIAS (no_isis_metric,
1299 no_isis_metric_arg_cmd,
hassof21fb272005-09-26 17:05:55 +00001300 "no isis metric <0-16777215>",
jardineb5d44e2003-12-23 08:09:43 +00001301 NO_STR
1302 "IS-IS commands\n"
1303 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001304 "Default metric value\n")
1305
jardineb5d44e2003-12-23 08:09:43 +00001306/* end of metrics */
hassof21fb272005-09-26 17:05:55 +00001307DEFUN (isis_hello_interval,
jardineb5d44e2003-12-23 08:09:43 +00001308 isis_hello_interval_cmd,
1309 "isis hello-interval (<1-65535>|minimal)",
1310 "IS-IS commands\n"
1311 "Set Hello interval\n"
1312 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00001313 "Holdtime 1 seconds, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00001314{
1315 struct isis_circuit *circuit;
1316 struct interface *ifp;
1317 int interval;
1318 char c;
1319
hassof390d2c2004-09-10 20:48:21 +00001320 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001321 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001322 if (circuit == NULL)
1323 {
1324 return CMD_WARNING;
1325 }
1326 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001327 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001328 if (isdigit ((int) c))
1329 {
1330 interval = atoi (argv[0]);
1331 }
1332 else
1333 interval = HELLO_MINIMAL; /* FIXME: should be calculated */
jardineb5d44e2003-12-23 08:09:43 +00001334
hassof390d2c2004-09-10 20:48:21 +00001335 circuit->hello_interval[0] = (u_int16_t) interval;
1336 circuit->hello_interval[1] = (u_int16_t) interval;
1337
jardineb5d44e2003-12-23 08:09:43 +00001338 return CMD_SUCCESS;
1339}
1340
1341DEFUN (no_isis_hello_interval,
1342 no_isis_hello_interval_cmd,
1343 "no isis hello-interval",
1344 NO_STR
1345 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001346 "Set Hello interval\n")
jardineb5d44e2003-12-23 08:09:43 +00001347{
1348 struct isis_circuit *circuit;
1349 struct interface *ifp;
1350
hassof390d2c2004-09-10 20:48:21 +00001351 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001352 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001353 if (circuit == NULL)
1354 {
1355 return CMD_WARNING;
1356 }
jardineb5d44e2003-12-23 08:09:43 +00001357 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001358
hassof390d2c2004-09-10 20:48:21 +00001359
1360 circuit->hello_interval[0] = HELLO_INTERVAL; /* Default is 1 sec. */
jardineb5d44e2003-12-23 08:09:43 +00001361 circuit->hello_interval[1] = HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001362
jardineb5d44e2003-12-23 08:09:43 +00001363 return CMD_SUCCESS;
1364}
1365
1366ALIAS (no_isis_hello_interval,
1367 no_isis_hello_interval_arg_cmd,
1368 "no isis hello-interval (<1-65535>|minimal)",
1369 NO_STR
1370 "IS-IS commands\n"
1371 "Set Hello interval\n"
1372 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00001373 "Holdtime 1 second, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00001374
1375DEFUN (isis_hello_interval_l1,
1376 isis_hello_interval_l1_cmd,
1377 "isis hello-interval (<1-65535>|minimal) level-1",
1378 "IS-IS commands\n"
1379 "Set Hello interval\n"
1380 "Hello interval value\n"
1381 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001382 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001383{
1384 struct isis_circuit *circuit;
1385 struct interface *ifp;
1386 long interval;
1387 char c;
1388
hassof390d2c2004-09-10 20:48:21 +00001389 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001390 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001391 if (circuit == NULL)
1392 {
1393 return CMD_WARNING;
1394 }
jardineb5d44e2003-12-23 08:09:43 +00001395 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001396
jardineb5d44e2003-12-23 08:09:43 +00001397 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001398 if (isdigit ((int) c))
1399 {
1400 interval = atoi (argv[0]);
1401 }
1402 else
jardineb5d44e2003-12-23 08:09:43 +00001403 interval = HELLO_MINIMAL;
1404
hassof390d2c2004-09-10 20:48:21 +00001405 circuit->hello_interval[0] = (u_int16_t) interval;
1406
jardineb5d44e2003-12-23 08:09:43 +00001407 return CMD_SUCCESS;
1408}
1409
1410DEFUN (no_isis_hello_interval_l1,
1411 no_isis_hello_interval_l1_cmd,
1412 "no isis hello-interval level-1",
1413 NO_STR
1414 "IS-IS commands\n"
1415 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00001416 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001417{
1418 struct isis_circuit *circuit;
1419 struct interface *ifp;
1420
hassof390d2c2004-09-10 20:48:21 +00001421 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001422 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001423 if (circuit == NULL)
1424 {
1425 return CMD_WARNING;
1426 }
jardineb5d44e2003-12-23 08:09:43 +00001427 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001428
hassof390d2c2004-09-10 20:48:21 +00001429
1430 circuit->hello_interval[0] = HELLO_INTERVAL; /* Default is 1 sec. */
1431
jardineb5d44e2003-12-23 08:09:43 +00001432 return CMD_SUCCESS;
1433}
1434
1435ALIAS (no_isis_hello_interval_l1,
1436 no_isis_hello_interval_l1_arg_cmd,
1437 "no isis hello-interval (<1-65535>|minimal) level-1",
1438 NO_STR
1439 "IS-IS commands\n"
1440 "Set Hello interval\n"
1441 "Hello interval value\n"
1442 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001443 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001444
1445DEFUN (isis_hello_interval_l2,
1446 isis_hello_interval_l2_cmd,
1447 "isis hello-interval (<1-65535>|minimal) level-2",
1448 "IS-IS commands\n"
1449 "Set Hello interval\n"
1450 "Hello interval value\n"
1451 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001452 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001453{
1454 struct isis_circuit *circuit;
1455 struct interface *ifp;
1456 long interval;
1457 char c;
1458
hassof390d2c2004-09-10 20:48:21 +00001459 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001460 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001461 if (circuit == NULL)
1462 {
1463 return CMD_WARNING;
1464 }
jardineb5d44e2003-12-23 08:09:43 +00001465 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001466
jardineb5d44e2003-12-23 08:09:43 +00001467 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001468 if (isdigit ((int) c))
1469 {
1470 interval = atoi (argv[0]);
1471 }
1472 else
jardineb5d44e2003-12-23 08:09:43 +00001473 interval = HELLO_MINIMAL;
1474
hassof390d2c2004-09-10 20:48:21 +00001475 circuit->hello_interval[1] = (u_int16_t) interval;
1476
jardineb5d44e2003-12-23 08:09:43 +00001477 return CMD_SUCCESS;
1478}
1479
1480DEFUN (no_isis_hello_interval_l2,
1481 no_isis_hello_interval_l2_cmd,
1482 "no isis hello-interval level-2",
1483 NO_STR
1484 "IS-IS commands\n"
1485 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00001486 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001487{
1488 struct isis_circuit *circuit;
1489 struct interface *ifp;
1490
hassof390d2c2004-09-10 20:48:21 +00001491 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001492 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001493 if (circuit == NULL)
1494 {
1495 return CMD_WARNING;
1496 }
jardineb5d44e2003-12-23 08:09:43 +00001497 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001498
hassof390d2c2004-09-10 20:48:21 +00001499
1500 circuit->hello_interval[1] = HELLO_INTERVAL; /* Default is 1 sec. */
1501
jardineb5d44e2003-12-23 08:09:43 +00001502 return CMD_SUCCESS;
1503}
1504
1505ALIAS (no_isis_hello_interval_l2,
1506 no_isis_hello_interval_l2_arg_cmd,
1507 "no isis hello-interval (<1-65535>|minimal) level-2",
1508 NO_STR
1509 "IS-IS commands\n"
1510 "Set Hello interval\n"
1511 "Hello interval value\n"
1512 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001513 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001514
1515DEFUN (isis_hello_multiplier,
1516 isis_hello_multiplier_cmd,
1517 "isis hello-multiplier <3-1000>",
1518 "IS-IS commands\n"
1519 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001520 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00001521{
1522 struct isis_circuit *circuit;
1523 struct interface *ifp;
1524 int mult;
hassof390d2c2004-09-10 20:48:21 +00001525
1526 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001527 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001528 if (circuit == NULL)
1529 {
1530 return CMD_WARNING;
1531 }
jardineb5d44e2003-12-23 08:09:43 +00001532 assert (circuit);
1533
1534 mult = atoi (argv[0]);
1535
hassof390d2c2004-09-10 20:48:21 +00001536 circuit->hello_multiplier[0] = (u_int16_t) mult;
1537 circuit->hello_multiplier[1] = (u_int16_t) mult;
1538
jardineb5d44e2003-12-23 08:09:43 +00001539 return CMD_SUCCESS;
1540}
1541
1542DEFUN (no_isis_hello_multiplier,
1543 no_isis_hello_multiplier_cmd,
1544 "no isis hello-multiplier",
1545 NO_STR
1546 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001547 "Set multiplier for Hello holding time\n")
jardineb5d44e2003-12-23 08:09:43 +00001548{
1549 struct isis_circuit *circuit;
1550 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001551
1552 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001553 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001554 if (circuit == NULL)
1555 {
1556 return CMD_WARNING;
1557 }
jardineb5d44e2003-12-23 08:09:43 +00001558 assert (circuit);
1559
1560 circuit->hello_multiplier[0] = HELLO_MULTIPLIER;
1561 circuit->hello_multiplier[1] = HELLO_MULTIPLIER;
1562
1563 return CMD_SUCCESS;
1564}
1565
1566ALIAS (no_isis_hello_multiplier,
1567 no_isis_hello_multiplier_arg_cmd,
1568 "no isis hello-multiplier <3-1000>",
1569 NO_STR
1570 "IS-IS commands\n"
1571 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001572 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00001573
1574DEFUN (isis_hello_multiplier_l1,
1575 isis_hello_multiplier_l1_cmd,
1576 "isis hello-multiplier <3-1000> level-1",
1577 "IS-IS commands\n"
1578 "Set multiplier for Hello holding time\n"
1579 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001580 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001581{
1582 struct isis_circuit *circuit;
1583 struct interface *ifp;
1584 int mult;
hassof390d2c2004-09-10 20:48:21 +00001585
1586 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001587 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001588 if (circuit == NULL)
1589 {
1590 return CMD_WARNING;
1591 }
jardineb5d44e2003-12-23 08:09:43 +00001592 assert (circuit);
1593
1594 mult = atoi (argv[0]);
1595
hassof390d2c2004-09-10 20:48:21 +00001596 circuit->hello_multiplier[0] = (u_int16_t) mult;
1597
jardineb5d44e2003-12-23 08:09:43 +00001598 return CMD_SUCCESS;
1599}
1600
1601DEFUN (no_isis_hello_multiplier_l1,
1602 no_isis_hello_multiplier_l1_cmd,
1603 "no isis hello-multiplier level-1",
1604 NO_STR
1605 "IS-IS commands\n"
1606 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001607 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001608{
1609 struct isis_circuit *circuit;
1610 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001611
1612 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001613 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001614 if (circuit == NULL)
1615 {
1616 return CMD_WARNING;
1617 }
jardineb5d44e2003-12-23 08:09:43 +00001618 assert (circuit);
1619
1620 circuit->hello_multiplier[0] = HELLO_MULTIPLIER;
1621
1622 return CMD_SUCCESS;
1623}
1624
1625ALIAS (no_isis_hello_multiplier_l1,
1626 no_isis_hello_multiplier_l1_arg_cmd,
1627 "no isis hello-multiplier <3-1000> level-1",
1628 NO_STR
1629 "IS-IS commands\n"
1630 "Set multiplier for Hello holding time\n"
1631 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001632 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001633
1634DEFUN (isis_hello_multiplier_l2,
1635 isis_hello_multiplier_l2_cmd,
1636 "isis hello-multiplier <3-1000> level-2",
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-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001641{
1642 struct isis_circuit *circuit;
1643 struct interface *ifp;
1644 int mult;
hassof390d2c2004-09-10 20:48:21 +00001645
1646 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001647 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001648 if (circuit == NULL)
1649 {
1650 return CMD_WARNING;
1651 }
jardineb5d44e2003-12-23 08:09:43 +00001652 assert (circuit);
1653
1654 mult = atoi (argv[0]);
1655
hassof390d2c2004-09-10 20:48:21 +00001656 circuit->hello_multiplier[1] = (u_int16_t) mult;
1657
jardineb5d44e2003-12-23 08:09:43 +00001658 return CMD_SUCCESS;
1659}
1660
1661DEFUN (no_isis_hello_multiplier_l2,
1662 no_isis_hello_multiplier_l2_cmd,
1663 "no isis hello-multiplier level-2",
1664 NO_STR
1665 "IS-IS commands\n"
1666 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001667 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001668{
1669 struct isis_circuit *circuit;
1670 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001671
1672 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001673 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001674 if (circuit == NULL)
1675 {
1676 return CMD_WARNING;
1677 }
jardineb5d44e2003-12-23 08:09:43 +00001678 assert (circuit);
1679
1680 circuit->hello_multiplier[1] = HELLO_MULTIPLIER;
1681
1682 return CMD_SUCCESS;
1683}
1684
1685ALIAS (no_isis_hello_multiplier_l2,
1686 no_isis_hello_multiplier_l2_arg_cmd,
1687 "no isis hello-multiplier <3-1000> level-2",
1688 NO_STR
1689 "IS-IS commands\n"
1690 "Set multiplier for Hello holding time\n"
1691 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001692 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001693
1694DEFUN (isis_hello,
1695 isis_hello_cmd,
1696 "isis hello padding",
1697 "IS-IS commands\n"
1698 "Add padding to IS-IS hello packets\n"
1699 "Pad hello packets\n"
1700 "<cr>\n")
1701{
1702 struct interface *ifp;
1703 struct isis_circuit *circuit;
hassof390d2c2004-09-10 20:48:21 +00001704
1705 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001706 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001707 if (circuit == NULL)
1708 {
1709 return CMD_WARNING;
1710 }
jardineb5d44e2003-12-23 08:09:43 +00001711 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001712
jardineb5d44e2003-12-23 08:09:43 +00001713 circuit->u.bc.pad_hellos = 1;
hassof390d2c2004-09-10 20:48:21 +00001714
jardineb5d44e2003-12-23 08:09:43 +00001715 return CMD_SUCCESS;
1716}
1717
jardineb5d44e2003-12-23 08:09:43 +00001718DEFUN (no_isis_hello,
1719 no_isis_hello_cmd,
1720 "no isis hello padding",
1721 NO_STR
1722 "IS-IS commands\n"
1723 "Add padding to IS-IS hello packets\n"
1724 "Pad hello packets\n"
1725 "<cr>\n")
1726{
1727 struct isis_circuit *circuit;
1728 struct interface *ifp;
1729
hassof390d2c2004-09-10 20:48:21 +00001730 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001731 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001732 if (circuit == NULL)
1733 {
1734 return CMD_WARNING;
1735 }
jardineb5d44e2003-12-23 08:09:43 +00001736 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001737
jardineb5d44e2003-12-23 08:09:43 +00001738 circuit->u.bc.pad_hellos = 0;
hassof390d2c2004-09-10 20:48:21 +00001739
jardineb5d44e2003-12-23 08:09:43 +00001740 return CMD_SUCCESS;
1741}
1742
1743DEFUN (csnp_interval,
1744 csnp_interval_cmd,
1745 "isis csnp-interval <0-65535>",
1746 "IS-IS commands\n"
1747 "Set CSNP interval in seconds\n"
1748 "CSNP interval value\n")
1749{
1750 struct isis_circuit *circuit;
1751 struct interface *ifp;
1752 unsigned long interval;
1753
hassof390d2c2004-09-10 20:48:21 +00001754 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001755 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001756 if (circuit == NULL)
1757 {
1758 return CMD_WARNING;
1759 }
jardineb5d44e2003-12-23 08:09:43 +00001760 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001761
jardineb5d44e2003-12-23 08:09:43 +00001762 interval = atol (argv[0]);
1763
hassof390d2c2004-09-10 20:48:21 +00001764 circuit->csnp_interval[0] = (u_int16_t) interval;
1765 circuit->csnp_interval[1] = (u_int16_t) interval;
1766
jardineb5d44e2003-12-23 08:09:43 +00001767 return CMD_SUCCESS;
1768}
1769
1770DEFUN (no_csnp_interval,
1771 no_csnp_interval_cmd,
1772 "no isis csnp-interval",
1773 NO_STR
1774 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001775 "Set CSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001776{
1777 struct isis_circuit *circuit;
1778 struct interface *ifp;
1779
hassof390d2c2004-09-10 20:48:21 +00001780 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001781 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001782 if (circuit == NULL)
1783 {
1784 return CMD_WARNING;
1785 }
jardineb5d44e2003-12-23 08:09:43 +00001786 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001787
jardineb5d44e2003-12-23 08:09:43 +00001788 circuit->csnp_interval[0] = CSNP_INTERVAL;
1789 circuit->csnp_interval[1] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001790
jardineb5d44e2003-12-23 08:09:43 +00001791 return CMD_SUCCESS;
1792}
1793
1794ALIAS (no_csnp_interval,
1795 no_csnp_interval_arg_cmd,
1796 "no isis csnp-interval <0-65535>",
1797 NO_STR
1798 "IS-IS commands\n"
1799 "Set CSNP interval in seconds\n"
1800 "CSNP interval value\n")
1801
jardineb5d44e2003-12-23 08:09:43 +00001802DEFUN (csnp_interval_l1,
1803 csnp_interval_l1_cmd,
1804 "isis csnp-interval <0-65535> level-1",
1805 "IS-IS commands\n"
1806 "Set CSNP interval in seconds\n"
1807 "CSNP interval value\n"
1808 "Specify interval for level-1 CSNPs\n")
1809{
1810 struct isis_circuit *circuit;
1811 struct interface *ifp;
1812 unsigned long interval;
1813
hassof390d2c2004-09-10 20:48:21 +00001814 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001815 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001816 if (circuit == NULL)
1817 {
1818 return CMD_WARNING;
1819 }
jardineb5d44e2003-12-23 08:09:43 +00001820 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001821
jardineb5d44e2003-12-23 08:09:43 +00001822 interval = atol (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001823
1824 circuit->csnp_interval[0] = (u_int16_t) interval;
1825
jardineb5d44e2003-12-23 08:09:43 +00001826 return CMD_SUCCESS;
1827}
1828
1829DEFUN (no_csnp_interval_l1,
1830 no_csnp_interval_l1_cmd,
1831 "no isis csnp-interval level-1",
1832 NO_STR
1833 "IS-IS commands\n"
1834 "Set CSNP interval in seconds\n"
1835 "Specify interval for level-1 CSNPs\n")
1836{
1837 struct isis_circuit *circuit;
1838 struct interface *ifp;
1839
hassof390d2c2004-09-10 20:48:21 +00001840 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001841 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001842 if (circuit == NULL)
1843 {
1844 return CMD_WARNING;
1845 }
jardineb5d44e2003-12-23 08:09:43 +00001846 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001847
jardineb5d44e2003-12-23 08:09:43 +00001848 circuit->csnp_interval[0] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001849
jardineb5d44e2003-12-23 08:09:43 +00001850 return CMD_SUCCESS;
1851}
1852
1853ALIAS (no_csnp_interval_l1,
1854 no_csnp_interval_l1_arg_cmd,
1855 "no isis csnp-interval <0-65535> level-1",
1856 NO_STR
1857 "IS-IS commands\n"
1858 "Set CSNP interval in seconds\n"
1859 "CSNP interval value\n"
1860 "Specify interval for level-1 CSNPs\n")
1861
jardineb5d44e2003-12-23 08:09:43 +00001862DEFUN (csnp_interval_l2,
1863 csnp_interval_l2_cmd,
1864 "isis csnp-interval <0-65535> level-2",
1865 "IS-IS commands\n"
1866 "Set CSNP interval in seconds\n"
1867 "CSNP interval value\n"
1868 "Specify interval for level-2 CSNPs\n")
1869{
1870 struct isis_circuit *circuit;
1871 struct interface *ifp;
1872 unsigned long interval;
1873
hassof390d2c2004-09-10 20:48:21 +00001874 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001875 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001876 if (circuit == NULL)
1877 {
1878 return CMD_WARNING;
1879 }
jardineb5d44e2003-12-23 08:09:43 +00001880 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001881
jardineb5d44e2003-12-23 08:09:43 +00001882 interval = atol (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001883
1884 circuit->csnp_interval[1] = (u_int16_t) interval;
1885
jardineb5d44e2003-12-23 08:09:43 +00001886 return CMD_SUCCESS;
1887}
1888
1889DEFUN (no_csnp_interval_l2,
1890 no_csnp_interval_l2_cmd,
1891 "no isis csnp-interval level-2",
1892 NO_STR
1893 "IS-IS commands\n"
1894 "Set CSNP interval in seconds\n"
1895 "Specify interval for level-2 CSNPs\n")
1896{
1897 struct isis_circuit *circuit;
1898 struct interface *ifp;
1899
hassof390d2c2004-09-10 20:48:21 +00001900 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001901 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001902 if (circuit == NULL)
1903 {
1904 return CMD_WARNING;
1905 }
jardineb5d44e2003-12-23 08:09:43 +00001906 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001907
jardineb5d44e2003-12-23 08:09:43 +00001908 circuit->csnp_interval[1] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001909
jardineb5d44e2003-12-23 08:09:43 +00001910 return CMD_SUCCESS;
1911}
1912
1913ALIAS (no_csnp_interval_l2,
1914 no_csnp_interval_l2_arg_cmd,
1915 "no isis csnp-interval <0-65535> level-2",
1916 NO_STR
1917 "IS-IS commands\n"
1918 "Set CSNP interval in seconds\n"
1919 "CSNP interval value\n"
1920 "Specify interval for level-2 CSNPs\n")
1921
jardineb5d44e2003-12-23 08:09:43 +00001922#ifdef HAVE_IPV6
1923DEFUN (ipv6_router_isis,
1924 ipv6_router_isis_cmd,
1925 "ipv6 router isis WORD",
1926 "IPv6 interface subcommands\n"
1927 "IPv6 Router interface commands\n"
1928 "IS-IS Routing for IPv6\n"
1929 "Routing process tag\n")
1930{
1931 struct isis_circuit *c;
1932 struct interface *ifp;
1933 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001934
1935 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001936 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +00001937
jardineb5d44e2003-12-23 08:09:43 +00001938 area = isis_area_lookup (argv[0]);
1939
1940 /* Prevent more than one circuit per interface */
1941 if (area)
1942 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +00001943 else
1944 c = NULL;
1945
1946 if (c && (ifp->info != NULL))
1947 {
1948 if (c->ipv6_router == 1)
1949 {
1950 vty_out (vty, "ISIS circuit is already defined for IPv6%s",
1951 VTY_NEWLINE);
1952 return CMD_WARNING;
1953 }
jardineb5d44e2003-12-23 08:09:43 +00001954 }
jardineb5d44e2003-12-23 08:09:43 +00001955
1956 /* this is here for ciscopability */
hassof390d2c2004-09-10 20:48:21 +00001957 if (!area)
1958 {
1959 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1960 return CMD_WARNING;
1961 }
jardineb5d44e2003-12-23 08:09:43 +00001962
hassof390d2c2004-09-10 20:48:21 +00001963 if (!c)
1964 {
1965 c = circuit_lookup_by_ifp (ifp, isis->init_circ_list);
1966 c = isis_csm_state_change (ISIS_ENABLE, c, area);
1967 c->interface = ifp;
1968 ifp->info = c;
1969 }
jardineb5d44e2003-12-23 08:09:43 +00001970
hassof390d2c2004-09-10 20:48:21 +00001971 if (!c)
jardineb5d44e2003-12-23 08:09:43 +00001972 return CMD_WARNING;
1973
1974 c->ipv6_router = 1;
1975 area->ipv6_circuits++;
1976 circuit_update_nlpids (c);
1977
1978 vty->node = INTERFACE_NODE;
1979
1980 return CMD_SUCCESS;
1981}
1982
1983DEFUN (no_ipv6_router_isis,
1984 no_ipv6_router_isis_cmd,
1985 "no ipv6 router isis WORD",
1986 NO_STR
1987 "IPv6 interface subcommands\n"
1988 "IPv6 Router interface commands\n"
1989 "IS-IS Routing for IPv6\n"
1990 "Routing process tag\n")
1991{
1992 struct isis_circuit *c;
1993 struct interface *ifp;
1994 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001995
1996 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001997 /* UGLY - will remove l8r
1998 if (circuit == NULL) {
hassof390d2c2004-09-10 20:48:21 +00001999 return CMD_WARNING;
2000 } */
jardineb5d44e2003-12-23 08:09:43 +00002001 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +00002002
jardineb5d44e2003-12-23 08:09:43 +00002003 area = isis_area_lookup (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00002004 if (!area)
2005 {
2006 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
2007 return CMD_WARNING;
2008 }
2009
jardineb5d44e2003-12-23 08:09:43 +00002010 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
2011 if (!c)
2012 return CMD_WARNING;
2013
2014 c->ipv6_router = 0;
2015 area->ipv6_circuits--;
2016 if (c->ip_router == 0)
2017 isis_csm_state_change (ISIS_DISABLE, c, area);
2018
2019 return CMD_SUCCESS;
2020}
hassof390d2c2004-09-10 20:48:21 +00002021#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +00002022
hassof390d2c2004-09-10 20:48:21 +00002023struct cmd_node interface_node = {
jardineb5d44e2003-12-23 08:09:43 +00002024 INTERFACE_NODE,
2025 "%s(config-if)# ",
2026 1,
2027};
2028
jardineb5d44e2003-12-23 08:09:43 +00002029int
2030isis_if_new_hook (struct interface *ifp)
2031{
2032/* FIXME: Discuss if the circuit should be created here
2033 ifp->info = XMALLOC (MTYPE_ISIS_IF_INFO, sizeof (struct isis_if_info)); */
2034 ifp->info = NULL;
2035 return 0;
2036}
2037
2038int
2039isis_if_delete_hook (struct interface *ifp)
2040{
2041/* FIXME: Discuss if the circuit should be created here
2042 XFREE (MTYPE_ISIS_IF_INFO, ifp->info);*/
2043 ifp->info = NULL;
2044 return 0;
2045}
2046
jardineb5d44e2003-12-23 08:09:43 +00002047void
2048isis_circuit_init ()
2049{
jardineb5d44e2003-12-23 08:09:43 +00002050 /* Initialize Zebra interface data structure */
2051 if_init ();
2052 if_add_hook (IF_NEW_HOOK, isis_if_new_hook);
2053 if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook);
2054
2055 /* Install interface node */
2056 install_node (&interface_node, isis_interface_config_write);
2057 install_element (CONFIG_NODE, &interface_cmd);
2058
2059 install_default (INTERFACE_NODE);
2060 install_element (INTERFACE_NODE, &interface_desc_cmd);
2061 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
2062
2063 install_element (INTERFACE_NODE, &ip_router_isis_cmd);
2064 install_element (INTERFACE_NODE, &no_ip_router_isis_cmd);
2065
2066 install_element (INTERFACE_NODE, &isis_circuit_type_cmd);
2067 install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd);
2068
2069 install_element (INTERFACE_NODE, &isis_passwd_cmd);
2070 install_element (INTERFACE_NODE, &no_isis_passwd_cmd);
2071
2072 install_element (INTERFACE_NODE, &isis_priority_cmd);
2073 install_element (INTERFACE_NODE, &no_isis_priority_cmd);
2074 install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd);
2075 install_element (INTERFACE_NODE, &isis_priority_l1_cmd);
2076 install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd);
2077 install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd);
2078 install_element (INTERFACE_NODE, &isis_priority_l2_cmd);
2079 install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd);
2080 install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd);
2081
2082 install_element (INTERFACE_NODE, &isis_metric_cmd);
2083 install_element (INTERFACE_NODE, &no_isis_metric_cmd);
2084 install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd);
2085
2086 install_element (INTERFACE_NODE, &isis_hello_interval_cmd);
2087 install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd);
2088 install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd);
2089 install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd);
2090 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd);
2091 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd);
2092 install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd);
2093 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd);
2094 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd);
2095
2096 install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd);
2097 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
2098 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd);
2099 install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd);
2100 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd);
2101 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd);
2102 install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd);
2103 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd);
2104 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd);
2105
2106 install_element (INTERFACE_NODE, &isis_hello_cmd);
2107 install_element (INTERFACE_NODE, &no_isis_hello_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002108 install_element (INTERFACE_NODE, &csnp_interval_cmd);
2109 install_element (INTERFACE_NODE, &no_csnp_interval_cmd);
2110 install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd);
2111 install_element (INTERFACE_NODE, &csnp_interval_l1_cmd);
2112 install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd);
2113 install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd);
2114 install_element (INTERFACE_NODE, &csnp_interval_l2_cmd);
2115 install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd);
2116 install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd);
2117
2118#ifdef HAVE_IPV6
2119 install_element (INTERFACE_NODE, &ipv6_router_isis_cmd);
2120 install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002121#endif
jardineb5d44e2003-12-23 08:09:43 +00002122}