blob: 9a41c582cf31c1043ca0d565e44ed0f8c0cada60 [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 */
22#include <stdlib.h>
23#include <stdio.h>
24#include <ctype.h>
25#include <zebra.h>
hasso37da8c02004-05-19 11:38:40 +000026#ifdef GNU_LINUX
jardineb5d44e2003-12-23 08:09:43 +000027#include <net/ethernet.h>
hasso37da8c02004-05-19 11:38:40 +000028#else
29#include <netinet/if_ether.h>
30#endif
jardineb5d44e2003-12-23 08:09:43 +000031
32#include "log.h"
33#include "memory.h"
34#include "if.h"
35#include "linklist.h"
36#include "command.h"
37#include "thread.h"
38#include "hash.h"
39#include "prefix.h"
40#include "stream.h"
41
42#include "isisd/dict.h"
43#include "isisd/include-netbsd/iso.h"
44#include "isisd/isis_constants.h"
45#include "isisd/isis_common.h"
46#include "isisd/isis_circuit.h"
47#include "isisd/isis_tlv.h"
48#include "isisd/isis_lsp.h"
49#include "isisd/isis_pdu.h"
50#include "isisd/isis_network.h"
51#include "isisd/isis_misc.h"
52#include "isisd/isis_constants.h"
53#include "isisd/isis_adjacency.h"
54#include "isisd/isis_dr.h"
55#include "isisd/isis_flags.h"
56#include "isisd/isisd.h"
57#include "isisd/isis_csm.h"
58#include "isisd/isis_events.h"
59
60extern struct thread_master *master;
61extern struct isis *isis;
62
63struct isis_circuit *
64isis_circuit_new ()
65{
66 struct isis_circuit *circuit;
67 int i;
68
69 circuit = XMALLOC (MTYPE_ISIS_CIRCUIT, sizeof (struct isis_circuit));
hassof390d2c2004-09-10 20:48:21 +000070 if (circuit)
71 {
72 memset (circuit, 0, sizeof (struct isis_circuit));
73 /* set default metrics for circuit */
74 for (i = 0; i < 2; i++)
75 {
76 circuit->metrics[i].metric_default = DEFAULT_CIRCUIT_METRICS;
77 circuit->metrics[i].metric_expense = METRICS_UNSUPPORTED;
78 circuit->metrics[i].metric_error = METRICS_UNSUPPORTED;
79 circuit->metrics[i].metric_delay = METRICS_UNSUPPORTED;
80 }
jardineb5d44e2003-12-23 08:09:43 +000081 }
hassof390d2c2004-09-10 20:48:21 +000082 else
83 {
84 zlog_err ("Can't malloc isis circuit");
85 return NULL;
86 }
87
jardineb5d44e2003-12-23 08:09:43 +000088 return circuit;
89}
90
jardineb5d44e2003-12-23 08:09:43 +000091void
92isis_circuit_configure (struct isis_circuit *circuit, struct isis_area *area)
93{
94 int i;
95 circuit->area = area;
96 /*
97 * The level for the circuit is same as for the area, unless configured
98 * otherwise.
99 */
100 circuit->circuit_is_type = area->is_type;
101 /*
102 * Default values
103 */
hassof390d2c2004-09-10 20:48:21 +0000104 for (i = 0; i < 2; i++)
105 {
106 circuit->hello_interval[i] = HELLO_INTERVAL;
107 circuit->hello_multiplier[i] = HELLO_MULTIPLIER;
108 circuit->csnp_interval[i] = CSNP_INTERVAL;
109 circuit->psnp_interval[i] = PSNP_INTERVAL;
110 circuit->u.bc.priority[i] = DEFAULT_PRIORITY;
111 }
112 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
113 {
114 circuit->u.bc.adjdb[0] = list_new ();
115 circuit->u.bc.adjdb[1] = list_new ();
116 circuit->u.bc.pad_hellos = 1;
117 }
jardineb5d44e2003-12-23 08:09:43 +0000118 circuit->lsp_interval = LSP_INTERVAL;
119
120 /*
121 * Add the circuit into area
122 */
123 listnode_add (area->circuit_list, circuit);
124
125 circuit->idx = flags_get_index (&area->flags);
126 circuit->lsp_queue = list_new ();
127
128 return;
129}
130
hassof390d2c2004-09-10 20:48:21 +0000131void
jardineb5d44e2003-12-23 08:09:43 +0000132isis_circuit_deconfigure (struct isis_circuit *circuit,
hassof390d2c2004-09-10 20:48:21 +0000133 struct isis_area *area)
jardineb5d44e2003-12-23 08:09:43 +0000134{
hassof390d2c2004-09-10 20:48:21 +0000135
jardineb5d44e2003-12-23 08:09:43 +0000136 /* Remove circuit from area */
137 listnode_delete (area->circuit_list, circuit);
138 /* Free the index of SRM and SSN flags */
139 flags_free_index (&area->flags, circuit->idx);
140
141 return;
142}
143
144struct isis_circuit *
145circuit_lookup_by_ifp (struct interface *ifp, struct list *list)
146{
147 struct isis_circuit *circuit = NULL;
148 struct listnode *node;
hassof390d2c2004-09-10 20:48:21 +0000149
jardineb5d44e2003-12-23 08:09:43 +0000150 if (!list)
151 return NULL;
hassof390d2c2004-09-10 20:48:21 +0000152
153 for (node = listhead (list); node; nextnode (node))
154 {
155 circuit = getdata (node);
156 if (circuit->interface == ifp)
157 return circuit;
158 }
159
jardineb5d44e2003-12-23 08:09:43 +0000160 return NULL;
161}
162
163struct isis_circuit *
164circuit_scan_by_ifp (struct interface *ifp)
165{
166 struct isis_area *area;
167 struct listnode *node;
168 struct isis_circuit *circuit;
169
170 if (!isis->area_list)
171 return NULL;
172
hassof390d2c2004-09-10 20:48:21 +0000173 for (node = listhead (isis->area_list); node; nextnode (node))
174 {
175 area = getdata (node);
176 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
177 if (circuit)
178 return circuit;
179 }
180
jardineb5d44e2003-12-23 08:09:43 +0000181 return circuit_lookup_by_ifp (ifp, isis->init_circ_list);
182}
183
184void
185isis_circuit_del (struct isis_circuit *circuit)
186{
187
188 if (!circuit)
189 return;
190
hassof390d2c2004-09-10 20:48:21 +0000191 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
192 {
193 /* destroy adjacency databases */
194 list_delete (circuit->u.bc.adjdb[0]);
195 list_delete (circuit->u.bc.adjdb[1]);
196 /* destroy neighbour lists */
197 if (circuit->u.bc.lan_neighs[0])
198 list_delete (circuit->u.bc.lan_neighs[0]);
199 if (circuit->u.bc.lan_neighs[1])
200 list_delete (circuit->u.bc.lan_neighs[1]);
201 /* destroy addresses */
202 }
jardineb5d44e2003-12-23 08:09:43 +0000203 if (circuit->ip_addrs)
204 list_delete (circuit->ip_addrs);
205#ifdef HAVE_IPV6
206 if (circuit->ipv6_link)
207 list_delete (circuit->ipv6_link);
208 if (circuit->ipv6_non_link)
209 list_delete (circuit->ipv6_non_link);
210#endif /* HAVE_IPV6 */
hassof390d2c2004-09-10 20:48:21 +0000211
jardineb5d44e2003-12-23 08:09:43 +0000212 /* and lastly the circuit itself */
213 XFREE (MTYPE_ISIS_CIRCUIT, circuit);
214
215 return;
216}
217
218void
hassof390d2c2004-09-10 20:48:21 +0000219isis_circuit_add_addr (struct isis_circuit *circuit, struct connected *conn)
jardineb5d44e2003-12-23 08:09:43 +0000220{
221 struct prefix_ipv4 *ipv4;
hassof390d2c2004-09-10 20:48:21 +0000222 u_char buf[BUFSIZ];
jardineb5d44e2003-12-23 08:09:43 +0000223#ifdef HAVE_IPV6
224 struct prefix_ipv6 *ipv6;
225#endif /* HAVE_IPV6 */
hassof390d2c2004-09-10 20:48:21 +0000226 if (!circuit->ip_addrs)
227 {
228 circuit->ip_addrs = list_new ();
229 }
jardineb5d44e2003-12-23 08:09:43 +0000230#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000231 if (!circuit->ipv6_link)
232 {
233 circuit->ipv6_link = list_new ();
234 }
235 if (!circuit->ipv6_non_link)
236 {
237 circuit->ipv6_non_link = list_new ();
238 }
jardineb5d44e2003-12-23 08:09:43 +0000239#endif /* HAVE_IPV6 */
240
241 memset (&buf, 0, BUFSIZ);
hassof390d2c2004-09-10 20:48:21 +0000242 if (conn->address->family == AF_INET)
243 {
244 ipv4 = prefix_ipv4_new ();
245 ipv4->prefixlen = conn->address->prefixlen;
246 ipv4->prefix = conn->address->u.prefix4;
247 listnode_add (circuit->ip_addrs, ipv4);
248 prefix2str (conn->address, buf, BUFSIZ);
jardineb5d44e2003-12-23 08:09:43 +0000249#ifdef EXTREME_DEBUG
hassof390d2c2004-09-10 20:48:21 +0000250 zlog_info ("Added IP address %s to circuit %d", buf,
251 circuit->circuit_id);
252#endif /* EXTREME_DEBUG */
jardineb5d44e2003-12-23 08:09:43 +0000253 }
hassof390d2c2004-09-10 20:48:21 +0000254#ifdef HAVE_IPV6
255 if (conn->address->family == AF_INET6)
256 {
257 ipv6 = prefix_ipv6_new ();
258 ipv6->prefixlen = conn->address->prefixlen;
259 ipv6->prefix = conn->address->u.prefix6;
260 if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix))
261 {
262 listnode_add (circuit->ipv6_link, ipv6);
263 }
264 else
265 {
266 listnode_add (circuit->ipv6_non_link, ipv6);
267 }
268 prefix2str (conn->address, buf, BUFSIZ);
jardineb5d44e2003-12-23 08:09:43 +0000269#ifdef EXTREME_DEBUG
hassof390d2c2004-09-10 20:48:21 +0000270 zlog_info ("Added IPv6 address %s to circuit %d", buf,
271 circuit->circuit_id);
272#endif /* EXTREME_DEBUG */
273 }
jardineb5d44e2003-12-23 08:09:43 +0000274#endif /* HAVE_IPV6 */
hassof390d2c2004-09-10 20:48:21 +0000275
jardineb5d44e2003-12-23 08:09:43 +0000276
277 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{
284
285}
286
287void
288isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp)
289{
290 struct listnode *node;
291 struct connected *conn;
292
293 circuit->interface = ifp;
294 ifp->info = circuit;
hassof390d2c2004-09-10 20:48:21 +0000295
296 circuit->circuit_id = ifp->ifindex % 255; /* FIXME: Why not ? */
jardineb5d44e2003-12-23 08:09:43 +0000297
298 /* isis_circuit_update_addrs (circuit, ifp); */
299
hassof390d2c2004-09-10 20:48:21 +0000300 if (if_is_broadcast (ifp))
301 {
302 circuit->circ_type = CIRCUIT_T_BROADCAST;
303 /*
304 * Get the Hardware Address
305 */
jardineb5d44e2003-12-23 08:09:43 +0000306#ifdef HAVE_SOCKADDR_DL
hassof390d2c2004-09-10 20:48:21 +0000307 if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN)
308 zlog_warn ("unsupported link layer");
309 else
310 memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl),
311 ETH_ALEN);
jardineb5d44e2003-12-23 08:09:43 +0000312#else
hassof390d2c2004-09-10 20:48:21 +0000313 if (circuit->interface->hw_addr_len != ETH_ALEN)
314 {
315 zlog_warn ("unsupported link layer");
316 }
317 else
318 {
319 memcpy (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN);
320 }
jardineb5d44e2003-12-23 08:09:43 +0000321#ifdef EXTREME_DEGUG
hassof390d2c2004-09-10 20:48:21 +0000322 zlog_info ("isis_circuit_if_add: if_id %d, isomtu %d snpa %s",
323 circuit->interface->ifindex, ISO_MTU (circuit),
324 snpa_print (circuit->u.bc.snpa));
jardineb5d44e2003-12-23 08:09:43 +0000325
326#endif /* EXTREME_DEBUG */
hassof390d2c2004-09-10 20:48:21 +0000327#endif /* HAVE_SOCKADDR_DL */
328 }
329 else if (if_is_pointopoint (ifp))
330 {
331 circuit->circ_type = CIRCUIT_T_P2P;
332 }
333 else
334 {
335 zlog_warn ("isis_circuit_if_add: unsupported media");
336 }
337
338 for (node = ifp->connected ? listhead (ifp->connected) : NULL; node;
339 nextnode (node))
340 {
341 conn = getdata (node);
342 isis_circuit_add_addr (circuit, conn);
343 }
jardineb5d44e2003-12-23 08:09:43 +0000344
345 return;
346}
347
348void
hassof390d2c2004-09-10 20:48:21 +0000349isis_circuit_update_params (struct isis_circuit *circuit,
350 struct interface *ifp)
jardineb5d44e2003-12-23 08:09:43 +0000351{
352 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +0000353
354 if (circuit->circuit_id != ifp->ifindex)
355 {
356 zlog_warn ("changing circuit_id %d->%d", circuit->circuit_id,
357 ifp->ifindex);
358 circuit->circuit_id = ifp->ifindex % 255;
359 }
jardineb5d44e2003-12-23 08:09:43 +0000360
361 /* FIXME: Why is this needed? shouldn't we compare to the area's mtu */
362 /* Ofer, this was here in case someone changes the mtu (e.g. with ifconfig)
363 The areas MTU is the minimum of mtu's of circuits in the area
364 now we can't catch the change
365 if (circuit->mtu != ifp->mtu) {
366 zlog_warn ("changing circuit mtu %d->%d", circuit->mtu,
367 ifp->mtu);
368 circuit->mtu = ifp->mtu;
369 }
hassof390d2c2004-09-10 20:48:21 +0000370 */
jardineb5d44e2003-12-23 08:09:43 +0000371 /*
372 * Get the Hardware Address
373 */
374#ifdef HAVE_SOCKADDR_DL
375 if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN)
jardineb5d44e2003-12-23 08:09:43 +0000376 zlog_warn ("unsupported link layer");
hassof390d2c2004-09-10 20:48:21 +0000377 else
378 memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl), ETH_ALEN);
379#else
380 if (circuit->interface->hw_addr_len != ETH_ALEN)
381 {
382 zlog_warn ("unsupported link layer");
jardineb5d44e2003-12-23 08:09:43 +0000383 }
hassof390d2c2004-09-10 20:48:21 +0000384 else
385 {
386 if (memcmp (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN))
387 {
388 zlog_warn ("changing circuit snpa %s->%s",
389 snpa_print (circuit->u.bc.snpa),
390 snpa_print (circuit->interface->hw_addr));
391 }
392 }
393#endif
jardineb5d44e2003-12-23 08:09:43 +0000394
hassof390d2c2004-09-10 20:48:21 +0000395 if (if_is_broadcast (ifp))
396 {
397 circuit->circ_type = CIRCUIT_T_BROADCAST;
398 }
399 else if (if_is_pointopoint (ifp))
400 {
401 circuit->circ_type = CIRCUIT_T_P2P;
402 }
403 else
404 {
405 zlog_warn ("isis_circuit_update_params: unsupported media");
406 }
jardineb5d44e2003-12-23 08:09:43 +0000407
jardineb5d44e2003-12-23 08:09:43 +0000408 return;
409}
410
411void
hassof390d2c2004-09-10 20:48:21 +0000412isis_circuit_if_del (struct isis_circuit *circuit)
jardineb5d44e2003-12-23 08:09:43 +0000413{
414 circuit->interface->info = NULL;
415 circuit->interface = NULL;
hassof390d2c2004-09-10 20:48:21 +0000416
jardineb5d44e2003-12-23 08:09:43 +0000417 return;
418}
419
420void
421isis_circuit_up (struct isis_circuit *circuit)
422{
jardineb5d44e2003-12-23 08:09:43 +0000423
hassof390d2c2004-09-10 20:48:21 +0000424 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
425 {
426 if (circuit->area->min_bcast_mtu == 0 ||
427 ISO_MTU (circuit) < circuit->area->min_bcast_mtu)
428 circuit->area->min_bcast_mtu = ISO_MTU (circuit);
429 /*
430 * ISO 10589 - 8.4.1 Enabling of broadcast circuits
431 */
jardineb5d44e2003-12-23 08:09:43 +0000432
hassof390d2c2004-09-10 20:48:21 +0000433 /* initilizing the hello sending threads
434 * for a broadcast IF
435 */
jardineb5d44e2003-12-23 08:09:43 +0000436
hassof390d2c2004-09-10 20:48:21 +0000437 /* 8.4.1 a) commence sending of IIH PDUs */
438
439 if (circuit->circuit_is_type & IS_LEVEL_1)
440 {
441 thread_add_event (master, send_lan_l1_hello, circuit, 0);
442 circuit->u.bc.lan_neighs[0] = list_new ();
443 }
444
445 if (circuit->circuit_is_type & IS_LEVEL_2)
446 {
447 thread_add_event (master, send_lan_l2_hello, circuit, 0);
448 circuit->u.bc.lan_neighs[1] = list_new ();
449 }
450
451 /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */
452 /* 8.4.1 c) FIXME: listen for ESH PDUs */
453
454 /* 8.4.1 d) */
455 /* dr election will commence in... */
456 if (circuit->circuit_is_type & IS_LEVEL_1)
457 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
458 circuit,
459 2 * circuit->hello_multiplier[0] *
460 circuit->hello_interval[0]);
461 if (circuit->circuit_is_type & IS_LEVEL_2)
462 THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
463 circuit,
464 2 * circuit->hello_multiplier[1] *
465 circuit->hello_interval[1]);
jardineb5d44e2003-12-23 08:09:43 +0000466 }
hassof390d2c2004-09-10 20:48:21 +0000467 else
468 {
469 /* initializing the hello send threads
470 * for a ptp IF
471 */
472 thread_add_event (master, send_p2p_hello, circuit, 0);
jardineb5d44e2003-12-23 08:09:43 +0000473
jardineb5d44e2003-12-23 08:09:43 +0000474 }
475
jardineb5d44e2003-12-23 08:09:43 +0000476 /* initializing PSNP timers */
hassof390d2c2004-09-10 20:48:21 +0000477 if (circuit->circuit_is_type & IS_LEVEL_1)
478 {
479 THREAD_TIMER_ON (master, circuit->t_send_psnp[0], send_l1_psnp, circuit,
480 isis_jitter (circuit->psnp_interval[0], PSNP_JITTER));
481 }
482
483 if (circuit->circuit_is_type & IS_LEVEL_2)
484 {
485 THREAD_TIMER_ON (master, circuit->t_send_psnp[1], send_l2_psnp, circuit,
486 isis_jitter (circuit->psnp_interval[1], PSNP_JITTER));
487 }
488
jardineb5d44e2003-12-23 08:09:43 +0000489 /* initialize the circuit streams */
490 if (circuit->rcv_stream == NULL)
hassof390d2c2004-09-10 20:48:21 +0000491 circuit->rcv_stream = stream_new (ISO_MTU (circuit));
jardineb5d44e2003-12-23 08:09:43 +0000492
493 if (circuit->snd_stream == NULL)
hassof390d2c2004-09-10 20:48:21 +0000494 circuit->snd_stream = stream_new (ISO_MTU (circuit));
jardineb5d44e2003-12-23 08:09:43 +0000495
496 /* unified init for circuits */
497 isis_sock_init (circuit);
498
499#ifdef GNU_LINUX
hassof390d2c2004-09-10 20:48:21 +0000500 THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit,
501 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000502#else
hassof390d2c2004-09-10 20:48:21 +0000503 THREAD_TIMER_ON (master, circuit->t_read, isis_receive, circuit,
504 circuit->fd);
jardineb5d44e2003-12-23 08:09:43 +0000505#endif
506 return;
507}
508
509void
510isis_circuit_down (struct isis_circuit *circuit)
511{
hassof390d2c2004-09-10 20:48:21 +0000512 /* Cancel all active threads -- FIXME: wrong place */
hassod70f99e2004-02-11 20:26:31 +0000513 /* HT: Read thread if GNU_LINUX, TIMER thread otherwise. */
hassof390d2c2004-09-10 20:48:21 +0000514 THREAD_OFF (circuit->t_read);
515 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
516 {
517 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[0]);
518 THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[1]);
519 }
520 else if (circuit->circ_type == CIRCUIT_T_P2P)
521 {
522 THREAD_TIMER_OFF (circuit->u.p2p.t_send_p2p_hello);
523 }
jardineb5d44e2003-12-23 08:09:43 +0000524 /* close the socket */
525 close (circuit->fd);
526
527 return;
528}
529
530void
531circuit_update_nlpids (struct isis_circuit *circuit)
532{
533 circuit->nlpids.count = 0;
hassof390d2c2004-09-10 20:48:21 +0000534
535 if (circuit->ip_router)
536 {
537 circuit->nlpids.nlpids[0] = NLPID_IP;
538 circuit->nlpids.count++;
539 }
jardineb5d44e2003-12-23 08:09:43 +0000540#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000541 if (circuit->ipv6_router)
542 {
543 circuit->nlpids.nlpids[circuit->nlpids.count] = NLPID_IPV6;
544 circuit->nlpids.count++;
545 }
jardineb5d44e2003-12-23 08:09:43 +0000546#endif /* HAVE_IPV6 */
547 return;
548}
549
550int
hassof390d2c2004-09-10 20:48:21 +0000551isis_interface_config_write (struct vty *vty)
jardineb5d44e2003-12-23 08:09:43 +0000552{
553
554 int write = 0;
555 listnode node;
556 listnode node2;
557 listnode node3;
558 struct interface *ifp;
559 struct isis_area *area;
560 struct isis_circuit *c;
561 struct prefix_ipv4 *ip;
562 int i;
563#ifdef HAVE_IPV6
564 struct prefix_ipv6 *ipv6;
565#endif /*HAVE_IPV6 */
566
567 char buf[BUFSIZ];
568
jardineb5d44e2003-12-23 08:09:43 +0000569 LIST_LOOP (iflist, ifp, node)
570 {
571 /* IF name */
hassof390d2c2004-09-10 20:48:21 +0000572 vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000573 write++;
574 /* IF desc */
hassof390d2c2004-09-10 20:48:21 +0000575 if (ifp->desc)
576 {
577 vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE);
578 write++;
579 }
jardineb5d44e2003-12-23 08:09:43 +0000580 /* ISIS Circuit */
581 LIST_LOOP (isis->area_list, area, node2)
582 {
583 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +0000584 if (c)
585 {
586 if (c->ip_router)
587 {
588 vty_out (vty, " ip router isis %s%s", area->area_tag,
589 VTY_NEWLINE);
590 write++;
591 }
jardineb5d44e2003-12-23 08:09:43 +0000592#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000593 if (c->ipv6_router)
594 {
595 vty_out (vty, " ipv6 router isis %s%s", area->area_tag,
596 VTY_NEWLINE);
597 write++;
598 }
jardineb5d44e2003-12-23 08:09:43 +0000599#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000600
hassof390d2c2004-09-10 20:48:21 +0000601 /* ISIS - circuit type */
602 if (c->circuit_is_type == IS_LEVEL_1)
603 {
604 vty_out (vty, " isis circuit-type level-1%s", VTY_NEWLINE);
605 write++;
606 }
607 else
608 {
609 if (c->circuit_is_type == IS_LEVEL_2)
610 {
611 vty_out (vty, " isis circuit-type level-2-only%s",
612 VTY_NEWLINE);
613 write++;
614 }
615 }
jardineb5d44e2003-12-23 08:09:43 +0000616
hassof390d2c2004-09-10 20:48:21 +0000617 /* ISIS - CSNP interval - FIXME: compare to cisco */
618 if (c->csnp_interval[0] == c->csnp_interval[1])
619 {
620 if (c->csnp_interval[0] != CSNP_INTERVAL)
621 {
622 vty_out (vty, " isis csnp-interval %d%s",
623 c->csnp_interval[0], VTY_NEWLINE);
624 write++;
625 }
626 }
627 else
628 {
629 for (i = 0; i < 2; i++)
630 {
631 if (c->csnp_interval[1] != CSNP_INTERVAL)
632 {
633 vty_out (vty, " isis csnp-interval %d level-%d%s",
634 c->csnp_interval[1], i + 1, VTY_NEWLINE);
635 write++;
636 }
637 }
638 }
jardineb5d44e2003-12-23 08:09:43 +0000639
hassof390d2c2004-09-10 20:48:21 +0000640 /* ISIS - Hello padding - Defaults to true so only display if false */
641 if (c->circ_type == CIRCUIT_T_BROADCAST && !c->u.bc.pad_hellos)
642 {
643 vty_out (vty, " no isis hello padding%s", VTY_NEWLINE);
644 write++;
645 }
jardineb5d44e2003-12-23 08:09:43 +0000646
hassof390d2c2004-09-10 20:48:21 +0000647 /* ISIS - Hello interval - FIXME: compare to cisco */
648 if (c->hello_interval[0] == c->hello_interval[1])
649 {
650 if (c->hello_interval[0] != HELLO_INTERVAL)
651 {
652 vty_out (vty, " isis hello-interval %d%s",
653 c->hello_interval[0], VTY_NEWLINE);
654 write++;
655 }
656 }
657 else
658 {
659 for (i = 0; i < 2; i++)
660 {
661 if (c->hello_interval[i] != HELLO_INTERVAL)
662 {
663 if (c->hello_interval[i] == HELLO_MINIMAL)
664 {
665 vty_out (vty,
666 " isis hello-interval minimal level-%d%s",
667 i + 1, VTY_NEWLINE);
668 }
669 else
670 {
671 vty_out (vty, " isis hello-interval %d level-%d%s",
672 c->hello_interval[i], i + 1, VTY_NEWLINE);
673 }
674 write++;
675 }
676 }
677 }
jardineb5d44e2003-12-23 08:09:43 +0000678
hassof390d2c2004-09-10 20:48:21 +0000679 /* ISIS - Hello Multiplier */
680 if (c->hello_multiplier[0] == c->hello_multiplier[1])
681 {
682 if (c->hello_multiplier[0] != HELLO_MULTIPLIER)
683 {
684 vty_out (vty, " isis hello-multiplier %d%s",
685 c->hello_multiplier[0], VTY_NEWLINE);
686 write++;
687 }
688 }
689 else
690 {
691 for (i = 0; i < 2; i++)
692 {
693 if (c->hello_multiplier[i] != HELLO_MULTIPLIER)
694 {
695 vty_out (vty, " isis hello-multiplier %d level-%d%s",
696 c->hello_multiplier[i], i + 1, VTY_NEWLINE);
697 write++;
698 }
699 }
700 }
701 /* ISIS - Priority */
702 if (c->circ_type == CIRCUIT_T_BROADCAST)
703 {
704 if (c->u.bc.priority[0] == c->u.bc.priority[1])
705 {
706 if (c->u.bc.priority[0] != DEFAULT_PRIORITY)
707 {
708 vty_out (vty, " isis priority %d%s",
709 c->u.bc.priority[0], VTY_NEWLINE);
710 write++;
711 }
712 }
713 else
714 {
715 for (i = 0; i < 2; i++)
716 {
717 if (c->u.bc.priority[i] != DEFAULT_PRIORITY)
718 {
719 vty_out (vty, " isis priority %d level-%d%s",
720 c->u.bc.priority[i], i + 1, VTY_NEWLINE);
721 write++;
722 }
723 }
724 }
725 }
726 /* ISIS - Metric */
727 if (c->metrics[0].metric_default == c->metrics[1].metric_default)
728 {
729 if (c->metrics[0].metric_default != DEFAULT_CIRCUIT_METRICS)
730 {
731 vty_out (vty, " isis metric %d%s",
732 c->metrics[0].metric_default, VTY_NEWLINE);
733 write++;
734 }
735 }
736 else
737 {
738 for (i = 0; i < 2; i++)
739 {
740 if (c->metrics[i].metric_default != DEFAULT_CIRCUIT_METRICS)
741 {
742 vty_out (vty, " isis metric %d level-%d%s",
743 c->metrics[i].metric_default, i + 1,
744 VTY_NEWLINE);
745 write++;
746 }
747 }
748 }
jardineb5d44e2003-12-23 08:09:43 +0000749
hassof390d2c2004-09-10 20:48:21 +0000750 }
jardineb5d44e2003-12-23 08:09:43 +0000751 }
hassof390d2c2004-09-10 20:48:21 +0000752 vty_out (vty, "!%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000753 }
hassof390d2c2004-09-10 20:48:21 +0000754
jardineb5d44e2003-12-23 08:09:43 +0000755 return write;
756}
jardineb5d44e2003-12-23 08:09:43 +0000757
758DEFUN (ip_router_isis,
759 ip_router_isis_cmd,
760 "ip router isis WORD",
761 "Interface Internet Protocol config commands\n"
762 "IP router interface commands\n"
763 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +0000764 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +0000765{
766 struct isis_circuit *c;
767 struct interface *ifp;
768 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000769
770 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000771 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +0000772
jardineb5d44e2003-12-23 08:09:43 +0000773 area = isis_area_lookup (argv[0]);
774
775 /* Prevent more than one circuit per interface */
776 if (area)
777 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +0000778 else
779 c = NULL;
780 if (c && (ifp->info != NULL))
781 {
jardineb5d44e2003-12-23 08:09:43 +0000782#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000783 if (c->ipv6_router == 0)
784 {
jardineb5d44e2003-12-23 08:09:43 +0000785#endif /* HAVE_IPV6 */
hassof390d2c2004-09-10 20:48:21 +0000786 vty_out (vty, "ISIS circuit is already defined%s", VTY_NEWLINE);
787 return CMD_WARNING;
jardineb5d44e2003-12-23 08:09:43 +0000788#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000789 }
790#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000791 }
hassof390d2c2004-09-10 20:48:21 +0000792
jardineb5d44e2003-12-23 08:09:43 +0000793 /* this is here for ciscopability */
hassof390d2c2004-09-10 20:48:21 +0000794 if (!area)
795 {
796 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
797 return CMD_WARNING;
798 }
jardineb5d44e2003-12-23 08:09:43 +0000799
hassof390d2c2004-09-10 20:48:21 +0000800 if (!c)
801 {
802 c = circuit_lookup_by_ifp (ifp, isis->init_circ_list);
803 c = isis_csm_state_change (ISIS_ENABLE, c, area);
804 c->interface = ifp; /* this is automatic */
805 ifp->info = c; /* hardly related to the FSM */
806 }
jardineb5d44e2003-12-23 08:09:43 +0000807
hassof390d2c2004-09-10 20:48:21 +0000808 if (!c)
jardineb5d44e2003-12-23 08:09:43 +0000809 return CMD_WARNING;
810
811 c->ip_router = 1;
812 area->ip_circuits++;
813 circuit_update_nlpids (c);
814
815 vty->node = INTERFACE_NODE;
hassof390d2c2004-09-10 20:48:21 +0000816
jardineb5d44e2003-12-23 08:09:43 +0000817 return CMD_SUCCESS;
818}
819
820DEFUN (no_ip_router_isis,
821 no_ip_router_isis_cmd,
822 "no ip router isis WORD",
823 NO_STR
824 "Interface Internet Protocol config commands\n"
825 "IP router interface commands\n"
826 "IS-IS Routing for IP\n"
hassof390d2c2004-09-10 20:48:21 +0000827 "Routing process tag\n")
jardineb5d44e2003-12-23 08:09:43 +0000828{
829 struct isis_circuit *circuit = NULL;
830 struct interface *ifp;
831 struct isis_area *area;
832 struct listnode *node;
833
hassof390d2c2004-09-10 20:48:21 +0000834 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]);
hassof390d2c2004-09-10 20:48:21 +0000838 if (!area)
839 {
840 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
841 return CMD_WARNING;
842 }
jardineb5d44e2003-12-23 08:09:43 +0000843 LIST_LOOP (area->circuit_list, circuit, node)
844 if (circuit->interface == ifp)
845 break;
hassof390d2c2004-09-10 20:48:21 +0000846 if (!circuit)
847 {
848 vty_out (vty, "Can't find ISIS interface %s", VTY_NEWLINE);
849 return CMD_WARNING;
850 }
jardineb5d44e2003-12-23 08:09:43 +0000851 circuit->ip_router = 0;
852 area->ip_circuits--;
853#ifdef HAVE_IPV6
854 if (circuit->ipv6_router == 0)
855#endif
856 isis_csm_state_change (ISIS_DISABLE, circuit, area);
hassof390d2c2004-09-10 20:48:21 +0000857
jardineb5d44e2003-12-23 08:09:43 +0000858 return CMD_SUCCESS;
859}
860
861DEFUN (isis_circuit_type,
862 isis_circuit_type_cmd,
863 "isis circuit-type (level-1|level-1-2|level-2-only)",
864 "IS-IS commands\n"
865 "Configure circuit type for interface\n"
866 "Level-1 only adjacencies are formed\n"
867 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +0000868 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +0000869{
870 struct isis_circuit *circuit;
871 struct interface *ifp;
872 int circuit_t;
873 int is_type;
hassof390d2c2004-09-10 20:48:21 +0000874
875 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000876 circuit = ifp->info;
877 /* UGLY - will remove l8r */
hassof390d2c2004-09-10 20:48:21 +0000878 if (circuit == NULL)
879 {
880 return CMD_WARNING;
881 }
jardineb5d44e2003-12-23 08:09:43 +0000882
hasso13c48f72004-09-10 21:19:13 +0000883 /* XXX what to do when ip_router_isis is not executed */
884 if (circuit->area == NULL)
885 return CMD_WARNING;
886
jardineb5d44e2003-12-23 08:09:43 +0000887 assert (circuit);
888
889 circuit_t = string2circuit_t (argv[0]);
890
hassof390d2c2004-09-10 20:48:21 +0000891 if (!circuit_t)
892 {
893 vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE);
894 return CMD_SUCCESS;
895 }
896
jardineb5d44e2003-12-23 08:09:43 +0000897 is_type = circuit->area->is_type;
898 if (is_type == IS_LEVEL_1_AND_2 || is_type == circuit_t)
hassof390d2c2004-09-10 20:48:21 +0000899 isis_event_circuit_type_change (circuit, circuit_t);
900 else
901 {
902 vty_out (vty, "invalid circuit level for area %s.%s",
903 circuit->area->area_tag, VTY_NEWLINE);
904 }
905
jardineb5d44e2003-12-23 08:09:43 +0000906 return CMD_SUCCESS;
907}
908
909DEFUN (no_isis_circuit_type,
910 no_isis_circuit_type_cmd,
911 "no isis circuit-type (level-1|level-1-2|level-2-only)",
912 NO_STR
913 "IS-IS commands\n"
914 "Configure circuit type for interface\n"
915 "Level-1 only adjacencies are formed\n"
916 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +0000917 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +0000918{
919 struct isis_circuit *circuit;
920 struct interface *ifp;
jardineb5d44e2003-12-23 08:09:43 +0000921
hassof390d2c2004-09-10 20:48:21 +0000922 ifp = vty->index;
923 circuit = ifp->info;
924 if (circuit == NULL)
925 {
926 return CMD_WARNING;
927 }
928
929 assert (circuit);
930
jardineb5d44e2003-12-23 08:09:43 +0000931 /*
932 * Set the circuits level to its default value which is that of the area
933 */
934 isis_event_circuit_type_change (circuit, circuit->area->is_type);
hassof390d2c2004-09-10 20:48:21 +0000935
jardineb5d44e2003-12-23 08:09:43 +0000936 return CMD_SUCCESS;
937}
938
939DEFUN (isis_passwd,
940 isis_passwd_cmd,
941 "isis password WORD",
942 "IS-IS commands\n"
943 "Configure the authentication password for interface\n"
944 "Password\n")
945{
946 struct isis_circuit *circuit;
947 struct interface *ifp;
948 int len;
hassof390d2c2004-09-10 20:48:21 +0000949
950 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000951 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +0000952 if (circuit == NULL)
953 {
954 return CMD_WARNING;
955 }
956
jardineb5d44e2003-12-23 08:09:43 +0000957 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +0000958 if (len > 254)
959 {
960 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
961 return CMD_WARNING;
962 }
jardineb5d44e2003-12-23 08:09:43 +0000963 circuit->passwd.len = len;
964 circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
965 strncpy (circuit->passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +0000966
jardineb5d44e2003-12-23 08:09:43 +0000967 return CMD_SUCCESS;
968}
969
970DEFUN (no_isis_passwd,
971 no_isis_passwd_cmd,
972 "no isis password",
973 NO_STR
974 "IS-IS commands\n"
975 "Configure the authentication password for interface\n")
976{
977 struct isis_circuit *circuit;
978 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +0000979
980 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000981 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +0000982 if (circuit == NULL)
983 {
984 return CMD_WARNING;
985 }
986
jardineb5d44e2003-12-23 08:09:43 +0000987 memset (&circuit->passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +0000988
jardineb5d44e2003-12-23 08:09:43 +0000989 return CMD_SUCCESS;
990}
991
992
993DEFUN (isis_priority,
994 isis_priority_cmd,
995 "isis priority <0-127>",
996 "IS-IS commands\n"
997 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +0000998 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +0000999{
1000 struct isis_circuit *circuit;
1001 struct interface *ifp;
1002 int prio;
hassof390d2c2004-09-10 20:48:21 +00001003
1004 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001005 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001006 if (circuit == NULL)
1007 {
1008 return CMD_WARNING;
1009 }
jardineb5d44e2003-12-23 08:09:43 +00001010 assert (circuit);
1011
1012 prio = atoi (argv[0]);
1013
1014 circuit->u.bc.priority[0] = prio;
1015 circuit->u.bc.priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001016
jardineb5d44e2003-12-23 08:09:43 +00001017 return CMD_SUCCESS;
1018}
1019
1020DEFUN (no_isis_priority,
1021 no_isis_priority_cmd,
1022 "no isis priority",
1023 NO_STR
1024 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001025 "Set priority for Designated Router election\n")
jardineb5d44e2003-12-23 08:09:43 +00001026{
1027 struct isis_circuit *circuit;
1028 struct interface *ifp;
1029
hassof390d2c2004-09-10 20:48:21 +00001030 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001031 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001032 if (circuit == NULL)
1033 {
1034 return CMD_WARNING;
1035 }
jardineb5d44e2003-12-23 08:09:43 +00001036 assert (circuit);
1037
1038 circuit->u.bc.priority[0] = DEFAULT_PRIORITY;
1039 circuit->u.bc.priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001040
jardineb5d44e2003-12-23 08:09:43 +00001041 return CMD_SUCCESS;
1042}
1043
1044ALIAS (no_isis_priority,
1045 no_isis_priority_arg_cmd,
1046 "no isis priority <0-127>",
1047 NO_STR
1048 "IS-IS commands\n"
1049 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001050 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001051
1052DEFUN (isis_priority_l1,
1053 isis_priority_l1_cmd,
hassof390d2c2004-09-10 20:48:21 +00001054 "isis priority <0-127> level-1",
jardineb5d44e2003-12-23 08:09:43 +00001055 "IS-IS commands\n"
1056 "Set priority for Designated Router election\n"
1057 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001058 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001059{
1060 struct isis_circuit *circuit;
1061 struct interface *ifp;
1062 int prio;
hassof390d2c2004-09-10 20:48:21 +00001063
1064 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001065 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001066 if (circuit == NULL)
1067 {
1068 return CMD_WARNING;
1069 }
jardineb5d44e2003-12-23 08:09:43 +00001070 assert (circuit);
1071
1072 prio = atoi (argv[0]);
1073
1074 circuit->u.bc.priority[0] = prio;
hassof390d2c2004-09-10 20:48:21 +00001075
jardineb5d44e2003-12-23 08:09:43 +00001076 return CMD_SUCCESS;
1077}
1078
1079DEFUN (no_isis_priority_l1,
1080 no_isis_priority_l1_cmd,
1081 "no isis priority level-1",
1082 NO_STR
1083 "IS-IS commands\n"
1084 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001085 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001086{
1087 struct isis_circuit *circuit;
1088 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001089
1090 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001091 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001092 if (circuit == NULL)
1093 {
1094 return CMD_WARNING;
1095 }
jardineb5d44e2003-12-23 08:09:43 +00001096 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001097
jardineb5d44e2003-12-23 08:09:43 +00001098 circuit->u.bc.priority[0] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001099
jardineb5d44e2003-12-23 08:09:43 +00001100 return CMD_SUCCESS;
1101}
1102
1103ALIAS (no_isis_priority_l1,
1104 no_isis_priority_l1_arg_cmd,
1105 "no isis priority <0-127> level-1",
1106 NO_STR
1107 "IS-IS commands\n"
1108 "Set priority for Designated Router election\n"
1109 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001110 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001111
1112DEFUN (isis_priority_l2,
1113 isis_priority_l2_cmd,
hassof390d2c2004-09-10 20:48:21 +00001114 "isis priority <0-127> level-2",
jardineb5d44e2003-12-23 08:09:43 +00001115 "IS-IS commands\n"
1116 "Set priority for Designated Router election\n"
1117 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001118 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001119{
1120 struct isis_circuit *circuit;
1121 struct interface *ifp;
1122 int prio;
hassof390d2c2004-09-10 20:48:21 +00001123
1124 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001125 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001126 if (circuit == NULL)
1127 {
1128 return CMD_WARNING;
1129 }
jardineb5d44e2003-12-23 08:09:43 +00001130 assert (circuit);
1131
1132 prio = atoi (argv[0]);
1133
1134 circuit->u.bc.priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001135
jardineb5d44e2003-12-23 08:09:43 +00001136 return CMD_SUCCESS;
1137}
1138
1139DEFUN (no_isis_priority_l2,
1140 no_isis_priority_l2_cmd,
1141 "no isis priority level-2",
1142 NO_STR
1143 "IS-IS commands\n"
1144 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001145 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001146{
1147 struct isis_circuit *circuit;
1148 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001149
1150 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001151 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001152 if (circuit == NULL)
1153 {
1154 return CMD_WARNING;
1155 }
jardineb5d44e2003-12-23 08:09:43 +00001156 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001157
jardineb5d44e2003-12-23 08:09:43 +00001158 circuit->u.bc.priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001159
jardineb5d44e2003-12-23 08:09:43 +00001160 return CMD_SUCCESS;
1161}
1162
1163ALIAS (no_isis_priority_l2,
1164 no_isis_priority_l2_arg_cmd,
1165 "no isis priority <0-127> level-2",
1166 NO_STR
1167 "IS-IS commands\n"
1168 "Set priority for Designated Router election\n"
1169 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001170 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001171
1172/* Metric command */
hassof390d2c2004-09-10 20:48:21 +00001173 DEFUN (isis_metric,
jardineb5d44e2003-12-23 08:09:43 +00001174 isis_metric_cmd,
1175 "isis metric <0-63>",
1176 "IS-IS commands\n"
1177 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001178 "Default metric value\n")
jardineb5d44e2003-12-23 08:09:43 +00001179{
1180 struct isis_circuit *circuit;
1181 struct interface *ifp;
1182 int met;
1183
hassof390d2c2004-09-10 20:48:21 +00001184 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001185 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001186 if (circuit == NULL)
1187 {
1188 return CMD_WARNING;
1189 }
jardineb5d44e2003-12-23 08:09:43 +00001190 assert (circuit);
1191
1192 met = atoi (argv[0]);
1193
1194 circuit->metrics[0].metric_default = met;
1195 circuit->metrics[1].metric_default = met;
1196
1197 return CMD_SUCCESS;
1198}
1199
1200DEFUN (no_isis_metric,
1201 no_isis_metric_cmd,
1202 "no isis metric",
1203 NO_STR
1204 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001205 "Set default metric for circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001206{
1207 struct isis_circuit *circuit;
1208 struct interface *ifp;
1209
hassof390d2c2004-09-10 20:48:21 +00001210 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001211 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001212 if (circuit == NULL)
1213 {
1214 return CMD_WARNING;
1215 }
jardineb5d44e2003-12-23 08:09:43 +00001216 assert (circuit);
1217
1218 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRICS;
1219 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRICS;
1220
1221 return CMD_SUCCESS;
1222}
1223
1224ALIAS (no_isis_metric,
1225 no_isis_metric_arg_cmd,
1226 "no isis metric <0-127>",
1227 NO_STR
1228 "IS-IS commands\n"
1229 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001230 "Default metric value\n")
1231
jardineb5d44e2003-12-23 08:09:43 +00001232/* end of metrics */
hassof390d2c2004-09-10 20:48:21 +00001233 DEFUN (isis_hello_interval,
jardineb5d44e2003-12-23 08:09:43 +00001234 isis_hello_interval_cmd,
1235 "isis hello-interval (<1-65535>|minimal)",
1236 "IS-IS commands\n"
1237 "Set Hello interval\n"
1238 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00001239 "Holdtime 1 seconds, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00001240{
1241 struct isis_circuit *circuit;
1242 struct interface *ifp;
1243 int interval;
1244 char c;
1245
hassof390d2c2004-09-10 20:48:21 +00001246 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001247 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001248 if (circuit == NULL)
1249 {
1250 return CMD_WARNING;
1251 }
1252 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001253 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001254 if (isdigit ((int) c))
1255 {
1256 interval = atoi (argv[0]);
1257 }
1258 else
1259 interval = HELLO_MINIMAL; /* FIXME: should be calculated */
jardineb5d44e2003-12-23 08:09:43 +00001260
hassof390d2c2004-09-10 20:48:21 +00001261 circuit->hello_interval[0] = (u_int16_t) interval;
1262 circuit->hello_interval[1] = (u_int16_t) interval;
1263
jardineb5d44e2003-12-23 08:09:43 +00001264 return CMD_SUCCESS;
1265}
1266
1267DEFUN (no_isis_hello_interval,
1268 no_isis_hello_interval_cmd,
1269 "no isis hello-interval",
1270 NO_STR
1271 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001272 "Set Hello interval\n")
jardineb5d44e2003-12-23 08:09:43 +00001273{
1274 struct isis_circuit *circuit;
1275 struct interface *ifp;
1276
hassof390d2c2004-09-10 20:48:21 +00001277 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001278 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001279 if (circuit == NULL)
1280 {
1281 return CMD_WARNING;
1282 }
jardineb5d44e2003-12-23 08:09:43 +00001283 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001284
hassof390d2c2004-09-10 20:48:21 +00001285
1286 circuit->hello_interval[0] = HELLO_INTERVAL; /* Default is 1 sec. */
jardineb5d44e2003-12-23 08:09:43 +00001287 circuit->hello_interval[1] = HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001288
jardineb5d44e2003-12-23 08:09:43 +00001289 return CMD_SUCCESS;
1290}
1291
1292ALIAS (no_isis_hello_interval,
1293 no_isis_hello_interval_arg_cmd,
1294 "no isis hello-interval (<1-65535>|minimal)",
1295 NO_STR
1296 "IS-IS commands\n"
1297 "Set Hello interval\n"
1298 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00001299 "Holdtime 1 second, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00001300
1301DEFUN (isis_hello_interval_l1,
1302 isis_hello_interval_l1_cmd,
1303 "isis hello-interval (<1-65535>|minimal) level-1",
1304 "IS-IS commands\n"
1305 "Set Hello interval\n"
1306 "Hello interval value\n"
1307 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001308 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001309{
1310 struct isis_circuit *circuit;
1311 struct interface *ifp;
1312 long interval;
1313 char c;
1314
hassof390d2c2004-09-10 20:48:21 +00001315 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001316 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001317 if (circuit == NULL)
1318 {
1319 return CMD_WARNING;
1320 }
jardineb5d44e2003-12-23 08:09:43 +00001321 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001322
jardineb5d44e2003-12-23 08:09:43 +00001323 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001324 if (isdigit ((int) c))
1325 {
1326 interval = atoi (argv[0]);
1327 }
1328 else
jardineb5d44e2003-12-23 08:09:43 +00001329 interval = HELLO_MINIMAL;
1330
hassof390d2c2004-09-10 20:48:21 +00001331 circuit->hello_interval[0] = (u_int16_t) interval;
1332
jardineb5d44e2003-12-23 08:09:43 +00001333 return CMD_SUCCESS;
1334}
1335
1336DEFUN (no_isis_hello_interval_l1,
1337 no_isis_hello_interval_l1_cmd,
1338 "no isis hello-interval level-1",
1339 NO_STR
1340 "IS-IS commands\n"
1341 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00001342 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001343{
1344 struct isis_circuit *circuit;
1345 struct interface *ifp;
1346
hassof390d2c2004-09-10 20:48:21 +00001347 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001348 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001349 if (circuit == NULL)
1350 {
1351 return CMD_WARNING;
1352 }
jardineb5d44e2003-12-23 08:09:43 +00001353 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001354
hassof390d2c2004-09-10 20:48:21 +00001355
1356 circuit->hello_interval[0] = HELLO_INTERVAL; /* Default is 1 sec. */
1357
jardineb5d44e2003-12-23 08:09:43 +00001358 return CMD_SUCCESS;
1359}
1360
1361ALIAS (no_isis_hello_interval_l1,
1362 no_isis_hello_interval_l1_arg_cmd,
1363 "no isis hello-interval (<1-65535>|minimal) level-1",
1364 NO_STR
1365 "IS-IS commands\n"
1366 "Set Hello interval\n"
1367 "Hello interval value\n"
1368 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001369 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001370
1371DEFUN (isis_hello_interval_l2,
1372 isis_hello_interval_l2_cmd,
1373 "isis hello-interval (<1-65535>|minimal) level-2",
1374 "IS-IS commands\n"
1375 "Set Hello interval\n"
1376 "Hello interval value\n"
1377 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001378 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001379{
1380 struct isis_circuit *circuit;
1381 struct interface *ifp;
1382 long interval;
1383 char c;
1384
hassof390d2c2004-09-10 20:48:21 +00001385 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001386 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001387 if (circuit == NULL)
1388 {
1389 return CMD_WARNING;
1390 }
jardineb5d44e2003-12-23 08:09:43 +00001391 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001392
jardineb5d44e2003-12-23 08:09:43 +00001393 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001394 if (isdigit ((int) c))
1395 {
1396 interval = atoi (argv[0]);
1397 }
1398 else
jardineb5d44e2003-12-23 08:09:43 +00001399 interval = HELLO_MINIMAL;
1400
hassof390d2c2004-09-10 20:48:21 +00001401 circuit->hello_interval[1] = (u_int16_t) interval;
1402
jardineb5d44e2003-12-23 08:09:43 +00001403 return CMD_SUCCESS;
1404}
1405
1406DEFUN (no_isis_hello_interval_l2,
1407 no_isis_hello_interval_l2_cmd,
1408 "no isis hello-interval level-2",
1409 NO_STR
1410 "IS-IS commands\n"
1411 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00001412 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001413{
1414 struct isis_circuit *circuit;
1415 struct interface *ifp;
1416
hassof390d2c2004-09-10 20:48:21 +00001417 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001418 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001419 if (circuit == NULL)
1420 {
1421 return CMD_WARNING;
1422 }
jardineb5d44e2003-12-23 08:09:43 +00001423 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001424
hassof390d2c2004-09-10 20:48:21 +00001425
1426 circuit->hello_interval[1] = HELLO_INTERVAL; /* Default is 1 sec. */
1427
jardineb5d44e2003-12-23 08:09:43 +00001428 return CMD_SUCCESS;
1429}
1430
1431ALIAS (no_isis_hello_interval_l2,
1432 no_isis_hello_interval_l2_arg_cmd,
1433 "no isis hello-interval (<1-65535>|minimal) level-2",
1434 NO_STR
1435 "IS-IS commands\n"
1436 "Set Hello interval\n"
1437 "Hello interval value\n"
1438 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001439 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001440
1441DEFUN (isis_hello_multiplier,
1442 isis_hello_multiplier_cmd,
1443 "isis hello-multiplier <3-1000>",
1444 "IS-IS commands\n"
1445 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001446 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00001447{
1448 struct isis_circuit *circuit;
1449 struct interface *ifp;
1450 int mult;
hassof390d2c2004-09-10 20:48:21 +00001451
1452 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001453 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001454 if (circuit == NULL)
1455 {
1456 return CMD_WARNING;
1457 }
jardineb5d44e2003-12-23 08:09:43 +00001458 assert (circuit);
1459
1460 mult = atoi (argv[0]);
1461
hassof390d2c2004-09-10 20:48:21 +00001462 circuit->hello_multiplier[0] = (u_int16_t) mult;
1463 circuit->hello_multiplier[1] = (u_int16_t) mult;
1464
jardineb5d44e2003-12-23 08:09:43 +00001465 return CMD_SUCCESS;
1466}
1467
1468DEFUN (no_isis_hello_multiplier,
1469 no_isis_hello_multiplier_cmd,
1470 "no isis hello-multiplier",
1471 NO_STR
1472 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001473 "Set multiplier for Hello holding time\n")
jardineb5d44e2003-12-23 08:09:43 +00001474{
1475 struct isis_circuit *circuit;
1476 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001477
1478 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001479 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001480 if (circuit == NULL)
1481 {
1482 return CMD_WARNING;
1483 }
jardineb5d44e2003-12-23 08:09:43 +00001484 assert (circuit);
1485
1486 circuit->hello_multiplier[0] = HELLO_MULTIPLIER;
1487 circuit->hello_multiplier[1] = HELLO_MULTIPLIER;
1488
1489 return CMD_SUCCESS;
1490}
1491
1492ALIAS (no_isis_hello_multiplier,
1493 no_isis_hello_multiplier_arg_cmd,
1494 "no isis hello-multiplier <3-1000>",
1495 NO_STR
1496 "IS-IS commands\n"
1497 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001498 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00001499
1500DEFUN (isis_hello_multiplier_l1,
1501 isis_hello_multiplier_l1_cmd,
1502 "isis hello-multiplier <3-1000> level-1",
1503 "IS-IS commands\n"
1504 "Set multiplier for Hello holding time\n"
1505 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001506 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001507{
1508 struct isis_circuit *circuit;
1509 struct interface *ifp;
1510 int mult;
hassof390d2c2004-09-10 20:48:21 +00001511
1512 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001513 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001514 if (circuit == NULL)
1515 {
1516 return CMD_WARNING;
1517 }
jardineb5d44e2003-12-23 08:09:43 +00001518 assert (circuit);
1519
1520 mult = atoi (argv[0]);
1521
hassof390d2c2004-09-10 20:48:21 +00001522 circuit->hello_multiplier[0] = (u_int16_t) mult;
1523
jardineb5d44e2003-12-23 08:09:43 +00001524 return CMD_SUCCESS;
1525}
1526
1527DEFUN (no_isis_hello_multiplier_l1,
1528 no_isis_hello_multiplier_l1_cmd,
1529 "no isis hello-multiplier level-1",
1530 NO_STR
1531 "IS-IS commands\n"
1532 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001533 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001534{
1535 struct isis_circuit *circuit;
1536 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001537
1538 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001539 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001540 if (circuit == NULL)
1541 {
1542 return CMD_WARNING;
1543 }
jardineb5d44e2003-12-23 08:09:43 +00001544 assert (circuit);
1545
1546 circuit->hello_multiplier[0] = HELLO_MULTIPLIER;
1547
1548 return CMD_SUCCESS;
1549}
1550
1551ALIAS (no_isis_hello_multiplier_l1,
1552 no_isis_hello_multiplier_l1_arg_cmd,
1553 "no isis hello-multiplier <3-1000> level-1",
1554 NO_STR
1555 "IS-IS commands\n"
1556 "Set multiplier for Hello holding time\n"
1557 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001558 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001559
1560DEFUN (isis_hello_multiplier_l2,
1561 isis_hello_multiplier_l2_cmd,
1562 "isis hello-multiplier <3-1000> level-2",
1563 "IS-IS commands\n"
1564 "Set multiplier for Hello holding time\n"
1565 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001566 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001567{
1568 struct isis_circuit *circuit;
1569 struct interface *ifp;
1570 int mult;
hassof390d2c2004-09-10 20:48:21 +00001571
1572 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001573 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001574 if (circuit == NULL)
1575 {
1576 return CMD_WARNING;
1577 }
jardineb5d44e2003-12-23 08:09:43 +00001578 assert (circuit);
1579
1580 mult = atoi (argv[0]);
1581
hassof390d2c2004-09-10 20:48:21 +00001582 circuit->hello_multiplier[1] = (u_int16_t) mult;
1583
jardineb5d44e2003-12-23 08:09:43 +00001584 return CMD_SUCCESS;
1585}
1586
1587DEFUN (no_isis_hello_multiplier_l2,
1588 no_isis_hello_multiplier_l2_cmd,
1589 "no isis hello-multiplier level-2",
1590 NO_STR
1591 "IS-IS commands\n"
1592 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001593 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001594{
1595 struct isis_circuit *circuit;
1596 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001597
1598 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001599 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001600 if (circuit == NULL)
1601 {
1602 return CMD_WARNING;
1603 }
jardineb5d44e2003-12-23 08:09:43 +00001604 assert (circuit);
1605
1606 circuit->hello_multiplier[1] = HELLO_MULTIPLIER;
1607
1608 return CMD_SUCCESS;
1609}
1610
1611ALIAS (no_isis_hello_multiplier_l2,
1612 no_isis_hello_multiplier_l2_arg_cmd,
1613 "no isis hello-multiplier <3-1000> level-2",
1614 NO_STR
1615 "IS-IS commands\n"
1616 "Set multiplier for Hello holding time\n"
1617 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001618 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001619
1620DEFUN (isis_hello,
1621 isis_hello_cmd,
1622 "isis hello padding",
1623 "IS-IS commands\n"
1624 "Add padding to IS-IS hello packets\n"
1625 "Pad hello packets\n"
1626 "<cr>\n")
1627{
1628 struct interface *ifp;
1629 struct isis_circuit *circuit;
hassof390d2c2004-09-10 20:48:21 +00001630
1631 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001632 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001633 if (circuit == NULL)
1634 {
1635 return CMD_WARNING;
1636 }
jardineb5d44e2003-12-23 08:09:43 +00001637 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001638
jardineb5d44e2003-12-23 08:09:43 +00001639 circuit->u.bc.pad_hellos = 1;
hassof390d2c2004-09-10 20:48:21 +00001640
jardineb5d44e2003-12-23 08:09:43 +00001641 return CMD_SUCCESS;
1642}
1643
hasso54301ce2004-01-27 10:07:34 +00001644#if 0
jardineb5d44e2003-12-23 08:09:43 +00001645DEFUN (ip_address,
1646 ip_address_cmd,
1647 "ip address A.B.C.D/A",
1648 "Interface Internet Protocol config commands\n"
hassof390d2c2004-09-10 20:48:21 +00001649 "Set the IP address of an interface\n" "IP address (e.g. 10.0.0.1/8\n")
jardineb5d44e2003-12-23 08:09:43 +00001650{
1651 struct interface *ifp;
1652 struct isis_circuit *circuit;
1653 struct prefix_ipv4 *ipv4, *ip;
1654 struct listnode *node;
1655 int ret, found = 1;
1656
hassof390d2c2004-09-10 20:48:21 +00001657 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001658 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001659 if (circuit == NULL)
1660 {
1661 return CMD_WARNING;
1662 }
jardineb5d44e2003-12-23 08:09:43 +00001663
1664 assert (circuit);
1665#ifdef HAVE_IPV6
1666 zlog_info ("ip_address_cmd circuit %d", circuit->interface->ifindex);
1667#endif /* HAVE_IPV6 */
1668
1669 ipv4 = prefix_ipv4_new ();
jardineb5d44e2003-12-23 08:09:43 +00001670
hassof390d2c2004-09-10 20:48:21 +00001671 ret = str2prefix_ipv4 (argv[0], ipv4);
1672 if (ret <= 0)
1673 {
1674 zlog_warn ("ip_address_cmd(): malformed address");
1675 vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
1676 return CMD_WARNING;
1677 }
1678
1679 if (!circuit->ip_addrs)
1680 circuit->ip_addrs = list_new ();
1681 else
1682 {
1683 for (node = listhead (circuit->ip_addrs); node; nextnode (node))
1684 {
1685 ip = getdata (node);
1686 if (prefix_same ((struct prefix *) ip, (struct prefix *) ipv4))
1687 found = 1;
1688 }
1689 if (found)
1690 {
1691 prefix_ipv4_free (ipv4);
1692 return CMD_SUCCESS;
1693 }
1694 }
1695
1696
jardineb5d44e2003-12-23 08:09:43 +00001697 listnode_add (circuit->ip_addrs, ipv4);
hassof390d2c2004-09-10 20:48:21 +00001698#ifdef EXTREME_DEBUG
1699 zlog_info ("added IP address %s to circuit %d", argv[0],
jardineb5d44e2003-12-23 08:09:43 +00001700 circuit->interface->ifindex);
1701#endif /* EXTREME_DEBUG */
1702 return CMD_SUCCESS;
1703}
1704
1705DEFUN (no_ip_address,
1706 no_ip_address_cmd,
1707 "no ip address A.B.C.D/A",
1708 NO_STR
1709 "Interface Internet Protocol config commands\n"
1710 "Set the IP address of an interface\n"
1711 "IP address (e.g. 10.0.0.1/8\n")
1712{
1713 struct interface *ifp;
1714 struct isis_circuit *circuit;
1715 struct prefix_ipv4 ipv4, *ip = NULL;
1716 struct listnode *node;
1717 int ret;
1718
hassof390d2c2004-09-10 20:48:21 +00001719 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001720 circuit = ifp->info;
1721 /* UGLY - will remove l8r */
hassof390d2c2004-09-10 20:48:21 +00001722 if (circuit == NULL)
1723 {
1724 return CMD_WARNING;
1725 }
jardineb5d44e2003-12-23 08:09:43 +00001726 assert (circuit);
1727
hassof390d2c2004-09-10 20:48:21 +00001728 if (!circuit->ip_addrs || circuit->ip_addrs->count == 0)
1729 {
1730 vty_out (vty, "Invalid address %s", VTY_NEWLINE);
1731 return CMD_WARNING;
1732 }
jardineb5d44e2003-12-23 08:09:43 +00001733 ret = str2prefix_ipv4 (argv[0], &ipv4);
hassof390d2c2004-09-10 20:48:21 +00001734 if (ret <= 0)
1735 {
1736 vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
1737 return CMD_WARNING;
1738 }
1739
1740 for (node = listhead (circuit->ip_addrs); node; nextnode (node))
1741 {
1742 ip = getdata (node);
1743 if (prefix_same ((struct prefix *) ip, (struct prefix *) &ipv4))
1744 break;
1745 }
1746
1747 if (ip)
1748 {
1749 listnode_delete (circuit->ip_addrs, ip);
1750 }
1751 else
1752 {
1753 vty_out (vty, "Invalid address %s", VTY_NEWLINE);
1754 }
1755
jardineb5d44e2003-12-23 08:09:43 +00001756 return CMD_SUCCESS;
1757}
hasso54301ce2004-01-27 10:07:34 +00001758#endif
jardineb5d44e2003-12-23 08:09:43 +00001759
1760DEFUN (no_isis_hello,
1761 no_isis_hello_cmd,
1762 "no isis hello padding",
1763 NO_STR
1764 "IS-IS commands\n"
1765 "Add padding to IS-IS hello packets\n"
1766 "Pad hello packets\n"
1767 "<cr>\n")
1768{
1769 struct isis_circuit *circuit;
1770 struct interface *ifp;
1771
hassof390d2c2004-09-10 20:48:21 +00001772 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001773 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001774 if (circuit == NULL)
1775 {
1776 return CMD_WARNING;
1777 }
jardineb5d44e2003-12-23 08:09:43 +00001778 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001779
jardineb5d44e2003-12-23 08:09:43 +00001780 circuit->u.bc.pad_hellos = 0;
hassof390d2c2004-09-10 20:48:21 +00001781
jardineb5d44e2003-12-23 08:09:43 +00001782 return CMD_SUCCESS;
1783}
1784
1785DEFUN (csnp_interval,
1786 csnp_interval_cmd,
1787 "isis csnp-interval <0-65535>",
1788 "IS-IS commands\n"
1789 "Set CSNP interval in seconds\n"
1790 "CSNP interval value\n")
1791{
1792 struct isis_circuit *circuit;
1793 struct interface *ifp;
1794 unsigned long interval;
1795
hassof390d2c2004-09-10 20:48:21 +00001796 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001797 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001798 if (circuit == NULL)
1799 {
1800 return CMD_WARNING;
1801 }
jardineb5d44e2003-12-23 08:09:43 +00001802 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001803
jardineb5d44e2003-12-23 08:09:43 +00001804 interval = atol (argv[0]);
1805
hassof390d2c2004-09-10 20:48:21 +00001806 circuit->csnp_interval[0] = (u_int16_t) interval;
1807 circuit->csnp_interval[1] = (u_int16_t) interval;
1808
jardineb5d44e2003-12-23 08:09:43 +00001809 return CMD_SUCCESS;
1810}
1811
1812DEFUN (no_csnp_interval,
1813 no_csnp_interval_cmd,
1814 "no isis csnp-interval",
1815 NO_STR
1816 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001817 "Set CSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001818{
1819 struct isis_circuit *circuit;
1820 struct interface *ifp;
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 circuit->csnp_interval[0] = CSNP_INTERVAL;
1831 circuit->csnp_interval[1] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001832
jardineb5d44e2003-12-23 08:09:43 +00001833 return CMD_SUCCESS;
1834}
1835
1836ALIAS (no_csnp_interval,
1837 no_csnp_interval_arg_cmd,
1838 "no isis csnp-interval <0-65535>",
1839 NO_STR
1840 "IS-IS commands\n"
1841 "Set CSNP interval in seconds\n"
1842 "CSNP interval value\n")
1843
jardineb5d44e2003-12-23 08:09:43 +00001844DEFUN (csnp_interval_l1,
1845 csnp_interval_l1_cmd,
1846 "isis csnp-interval <0-65535> level-1",
1847 "IS-IS commands\n"
1848 "Set CSNP interval in seconds\n"
1849 "CSNP interval value\n"
1850 "Specify interval for level-1 CSNPs\n")
1851{
1852 struct isis_circuit *circuit;
1853 struct interface *ifp;
1854 unsigned long interval;
1855
hassof390d2c2004-09-10 20:48:21 +00001856 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001857 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001858 if (circuit == NULL)
1859 {
1860 return CMD_WARNING;
1861 }
jardineb5d44e2003-12-23 08:09:43 +00001862 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001863
jardineb5d44e2003-12-23 08:09:43 +00001864 interval = atol (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001865
1866 circuit->csnp_interval[0] = (u_int16_t) interval;
1867
jardineb5d44e2003-12-23 08:09:43 +00001868 return CMD_SUCCESS;
1869}
1870
1871DEFUN (no_csnp_interval_l1,
1872 no_csnp_interval_l1_cmd,
1873 "no isis csnp-interval level-1",
1874 NO_STR
1875 "IS-IS commands\n"
1876 "Set CSNP interval in seconds\n"
1877 "Specify interval for level-1 CSNPs\n")
1878{
1879 struct isis_circuit *circuit;
1880 struct interface *ifp;
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 circuit->csnp_interval[0] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001891
jardineb5d44e2003-12-23 08:09:43 +00001892 return CMD_SUCCESS;
1893}
1894
1895ALIAS (no_csnp_interval_l1,
1896 no_csnp_interval_l1_arg_cmd,
1897 "no isis csnp-interval <0-65535> level-1",
1898 NO_STR
1899 "IS-IS commands\n"
1900 "Set CSNP interval in seconds\n"
1901 "CSNP interval value\n"
1902 "Specify interval for level-1 CSNPs\n")
1903
jardineb5d44e2003-12-23 08:09:43 +00001904DEFUN (csnp_interval_l2,
1905 csnp_interval_l2_cmd,
1906 "isis csnp-interval <0-65535> level-2",
1907 "IS-IS commands\n"
1908 "Set CSNP interval in seconds\n"
1909 "CSNP interval value\n"
1910 "Specify interval for level-2 CSNPs\n")
1911{
1912 struct isis_circuit *circuit;
1913 struct interface *ifp;
1914 unsigned long interval;
1915
hassof390d2c2004-09-10 20:48:21 +00001916 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001917 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001918 if (circuit == NULL)
1919 {
1920 return CMD_WARNING;
1921 }
jardineb5d44e2003-12-23 08:09:43 +00001922 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001923
jardineb5d44e2003-12-23 08:09:43 +00001924 interval = atol (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001925
1926 circuit->csnp_interval[1] = (u_int16_t) interval;
1927
jardineb5d44e2003-12-23 08:09:43 +00001928 return CMD_SUCCESS;
1929}
1930
1931DEFUN (no_csnp_interval_l2,
1932 no_csnp_interval_l2_cmd,
1933 "no isis csnp-interval level-2",
1934 NO_STR
1935 "IS-IS commands\n"
1936 "Set CSNP interval in seconds\n"
1937 "Specify interval for level-2 CSNPs\n")
1938{
1939 struct isis_circuit *circuit;
1940 struct interface *ifp;
1941
hassof390d2c2004-09-10 20:48:21 +00001942 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001943 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001944 if (circuit == NULL)
1945 {
1946 return CMD_WARNING;
1947 }
jardineb5d44e2003-12-23 08:09:43 +00001948 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001949
jardineb5d44e2003-12-23 08:09:43 +00001950 circuit->csnp_interval[1] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001951
jardineb5d44e2003-12-23 08:09:43 +00001952 return CMD_SUCCESS;
1953}
1954
1955ALIAS (no_csnp_interval_l2,
1956 no_csnp_interval_l2_arg_cmd,
1957 "no isis csnp-interval <0-65535> level-2",
1958 NO_STR
1959 "IS-IS commands\n"
1960 "Set CSNP interval in seconds\n"
1961 "CSNP interval value\n"
1962 "Specify interval for level-2 CSNPs\n")
1963
jardineb5d44e2003-12-23 08:09:43 +00001964#ifdef HAVE_IPV6
1965DEFUN (ipv6_router_isis,
1966 ipv6_router_isis_cmd,
1967 "ipv6 router isis WORD",
1968 "IPv6 interface subcommands\n"
1969 "IPv6 Router interface commands\n"
1970 "IS-IS Routing for IPv6\n"
1971 "Routing process tag\n")
1972{
1973 struct isis_circuit *c;
1974 struct interface *ifp;
1975 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001976
1977 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001978 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +00001979
jardineb5d44e2003-12-23 08:09:43 +00001980 area = isis_area_lookup (argv[0]);
1981
1982 /* Prevent more than one circuit per interface */
1983 if (area)
1984 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +00001985 else
1986 c = NULL;
1987
1988 if (c && (ifp->info != NULL))
1989 {
1990 if (c->ipv6_router == 1)
1991 {
1992 vty_out (vty, "ISIS circuit is already defined for IPv6%s",
1993 VTY_NEWLINE);
1994 return CMD_WARNING;
1995 }
jardineb5d44e2003-12-23 08:09:43 +00001996 }
jardineb5d44e2003-12-23 08:09:43 +00001997
1998 /* this is here for ciscopability */
hassof390d2c2004-09-10 20:48:21 +00001999 if (!area)
2000 {
2001 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
2002 return CMD_WARNING;
2003 }
jardineb5d44e2003-12-23 08:09:43 +00002004
hassof390d2c2004-09-10 20:48:21 +00002005 if (!c)
2006 {
2007 c = circuit_lookup_by_ifp (ifp, isis->init_circ_list);
2008 c = isis_csm_state_change (ISIS_ENABLE, c, area);
2009 c->interface = ifp;
2010 ifp->info = c;
2011 }
jardineb5d44e2003-12-23 08:09:43 +00002012
hassof390d2c2004-09-10 20:48:21 +00002013 if (!c)
jardineb5d44e2003-12-23 08:09:43 +00002014 return CMD_WARNING;
2015
2016 c->ipv6_router = 1;
2017 area->ipv6_circuits++;
2018 circuit_update_nlpids (c);
2019
2020 vty->node = INTERFACE_NODE;
2021
2022 return CMD_SUCCESS;
2023}
2024
2025DEFUN (no_ipv6_router_isis,
2026 no_ipv6_router_isis_cmd,
2027 "no ipv6 router isis WORD",
2028 NO_STR
2029 "IPv6 interface subcommands\n"
2030 "IPv6 Router interface commands\n"
2031 "IS-IS Routing for IPv6\n"
2032 "Routing process tag\n")
2033{
2034 struct isis_circuit *c;
2035 struct interface *ifp;
2036 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00002037
2038 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +00002039 /* UGLY - will remove l8r
2040 if (circuit == NULL) {
hassof390d2c2004-09-10 20:48:21 +00002041 return CMD_WARNING;
2042 } */
jardineb5d44e2003-12-23 08:09:43 +00002043 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +00002044
jardineb5d44e2003-12-23 08:09:43 +00002045 area = isis_area_lookup (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00002046 if (!area)
2047 {
2048 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
2049 return CMD_WARNING;
2050 }
2051
jardineb5d44e2003-12-23 08:09:43 +00002052 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
2053 if (!c)
2054 return CMD_WARNING;
2055
2056 c->ipv6_router = 0;
2057 area->ipv6_circuits--;
2058 if (c->ip_router == 0)
2059 isis_csm_state_change (ISIS_DISABLE, c, area);
2060
2061 return CMD_SUCCESS;
2062}
2063
hassof390d2c2004-09-10 20:48:21 +00002064#if 0 /* Guess we don't really need these */
jardineb5d44e2003-12-23 08:09:43 +00002065
2066DEFUN (ipv6_address,
2067 ipv6_address_cmd,
2068 "ipv6 address X:X::X:X/M",
2069 "Interface Internet Protocol config commands\n"
2070 "Set the IP address of an interface\n"
2071 "IPv6 address (e.g. 3ffe:506::1/48)\n")
2072{
2073 struct interface *ifp;
2074 struct isis_circuit *circuit;
2075 struct prefix_ipv6 *ipv6, *ip6;
2076 struct listnode *node;
2077 int ret, found = 1;
2078
hassof390d2c2004-09-10 20:48:21 +00002079 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00002080 circuit = ifp->info;
2081 /* UGLY - will remove l8r */
hassof390d2c2004-09-10 20:48:21 +00002082 if (circuit == NULL)
2083 {
2084 return CMD_WARNING;
2085 }
jardineb5d44e2003-12-23 08:09:43 +00002086 assert (circuit);
2087#ifdef EXTREME_DEBUG
2088 zlog_info ("ipv6_address_cmd circuit %d", circuit->idx);
2089#endif /* EXTREME_DEBUG */
jardineb5d44e2003-12-23 08:09:43 +00002090
hassof390d2c2004-09-10 20:48:21 +00002091 if (circuit == NULL)
2092 {
2093 zlog_warn ("ipv6_address_cmd(): no circuit");
2094 return CMD_WARNING;
2095 }
2096
2097
2098 ipv6 = prefix_ipv6_new ();
2099
2100 ret = str2prefix_ipv6 (argv[0], ipv6);
2101 if (ret <= 0)
2102 {
2103 vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
2104 return CMD_WARNING;
2105 }
2106
2107 if (!circuit->ipv6_addrs)
2108 circuit->ipv6_addrs = list_new ();
2109 else
2110 {
2111 for (node = listhead (circuit->ipv6_addrs); node; nextnode (node))
2112 {
2113 ip6 = getdata (node);
2114 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
2115 found = 1;
2116 }
2117 if (found)
2118 {
2119 prefix_ipv6_free (ipv6);
2120 return CMD_SUCCESS;
2121 }
2122 }
2123
2124
jardineb5d44e2003-12-23 08:09:43 +00002125 listnode_add (circuit->ipv6_addrs, ipv6);
2126#ifdef EXTREME_DEBUG
2127 zlog_info ("added IPv6 address %s to circuit %d", argv[0], circuit->idx);
2128#endif /* EXTREME_DEBUG */
2129
2130 return CMD_SUCCESS;
2131}
2132
2133DEFUN (no_ipv6_address,
2134 no_ipv6_address_cmd,
hassof390d2c2004-09-10 20:48:21 +00002135 "no ipv6 address X:X::X:X/M",
jardineb5d44e2003-12-23 08:09:43 +00002136 NO_STR
2137 "Interface Internet Protocol config commands\n"
2138 "Set the IP address of an interface\n"
2139 "IPv6 address (e.g. 3ffe:506::1/48)\n")
2140{
2141 struct interface *ifp;
2142 struct isis_circuit *circuit;
2143 struct prefix_ipv6 ipv6, *ip6 = NULL;
2144 struct listnode *node;
2145 int ret;
2146
hassof390d2c2004-09-10 20:48:21 +00002147 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00002148 circuit = ifp->info;
2149 /* UGLY - will remove l8r */
hassof390d2c2004-09-10 20:48:21 +00002150 if (circuit == NULL)
2151 {
2152 return CMD_WARNING;
2153 }
jardineb5d44e2003-12-23 08:09:43 +00002154 assert (circuit);
2155
hassof390d2c2004-09-10 20:48:21 +00002156 if (!circuit->ipv6_addrs || circuit->ipv6_addrs->count == 0)
2157 {
2158 vty_out (vty, "Invalid address %s", VTY_NEWLINE);
2159 return CMD_WARNING;
2160 }
jardineb5d44e2003-12-23 08:09:43 +00002161 ret = str2prefix_ipv6 (argv[0], &ipv6);
hassof390d2c2004-09-10 20:48:21 +00002162 if (ret <= 0)
2163 {
2164 vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
2165 return CMD_WARNING;
2166 }
2167
2168 for (node = listhead (circuit->ipv6_addrs); node; nextnode (node))
2169 {
2170 ip6 = getdata (node);
2171 if (prefix_same ((struct prefix *) ip6, (struct prefix *) &ipv6))
2172 break;
2173 }
2174
2175 if (ip6)
2176 {
2177 listnode_delete (circuit->ipv6_addrs, ip6);
2178 }
2179 else
2180 {
2181 vty_out (vty, "Invalid address %s", VTY_NEWLINE);
2182 }
2183
jardineb5d44e2003-12-23 08:09:43 +00002184 return CMD_SUCCESS;
2185}
2186#endif /* 0 */
hassof390d2c2004-09-10 20:48:21 +00002187#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +00002188
hassof390d2c2004-09-10 20:48:21 +00002189struct cmd_node interface_node = {
jardineb5d44e2003-12-23 08:09:43 +00002190 INTERFACE_NODE,
2191 "%s(config-if)# ",
2192 1,
2193};
2194
jardineb5d44e2003-12-23 08:09:43 +00002195int
2196isis_if_new_hook (struct interface *ifp)
2197{
2198/* FIXME: Discuss if the circuit should be created here
2199 ifp->info = XMALLOC (MTYPE_ISIS_IF_INFO, sizeof (struct isis_if_info)); */
2200 ifp->info = NULL;
2201 return 0;
2202}
2203
2204int
2205isis_if_delete_hook (struct interface *ifp)
2206{
2207/* FIXME: Discuss if the circuit should be created here
2208 XFREE (MTYPE_ISIS_IF_INFO, ifp->info);*/
2209 ifp->info = NULL;
2210 return 0;
2211}
2212
jardineb5d44e2003-12-23 08:09:43 +00002213void
2214isis_circuit_init ()
2215{
jardineb5d44e2003-12-23 08:09:43 +00002216 /* Initialize Zebra interface data structure */
2217 if_init ();
2218 if_add_hook (IF_NEW_HOOK, isis_if_new_hook);
2219 if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook);
2220
2221 /* Install interface node */
2222 install_node (&interface_node, isis_interface_config_write);
2223 install_element (CONFIG_NODE, &interface_cmd);
2224
2225 install_default (INTERFACE_NODE);
2226 install_element (INTERFACE_NODE, &interface_desc_cmd);
2227 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
2228
2229 install_element (INTERFACE_NODE, &ip_router_isis_cmd);
2230 install_element (INTERFACE_NODE, &no_ip_router_isis_cmd);
2231
2232 install_element (INTERFACE_NODE, &isis_circuit_type_cmd);
2233 install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd);
2234
2235 install_element (INTERFACE_NODE, &isis_passwd_cmd);
2236 install_element (INTERFACE_NODE, &no_isis_passwd_cmd);
2237
2238 install_element (INTERFACE_NODE, &isis_priority_cmd);
2239 install_element (INTERFACE_NODE, &no_isis_priority_cmd);
2240 install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd);
2241 install_element (INTERFACE_NODE, &isis_priority_l1_cmd);
2242 install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd);
2243 install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd);
2244 install_element (INTERFACE_NODE, &isis_priority_l2_cmd);
2245 install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd);
2246 install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd);
2247
2248 install_element (INTERFACE_NODE, &isis_metric_cmd);
2249 install_element (INTERFACE_NODE, &no_isis_metric_cmd);
2250 install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd);
2251
2252 install_element (INTERFACE_NODE, &isis_hello_interval_cmd);
2253 install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd);
2254 install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd);
2255 install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd);
2256 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd);
2257 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd);
2258 install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd);
2259 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd);
2260 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd);
2261
2262 install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd);
2263 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
2264 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd);
2265 install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd);
2266 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd);
2267 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd);
2268 install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd);
2269 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd);
2270 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd);
2271
2272 install_element (INTERFACE_NODE, &isis_hello_cmd);
2273 install_element (INTERFACE_NODE, &no_isis_hello_cmd);
hasso38a61c72004-01-27 13:40:14 +00002274#if 0
jardineb5d44e2003-12-23 08:09:43 +00002275 install_element (INTERFACE_NODE, &ip_address_cmd);
2276 install_element (INTERFACE_NODE, &no_ip_address_cmd);
hasso38a61c72004-01-27 13:40:14 +00002277#endif
jardineb5d44e2003-12-23 08:09:43 +00002278 install_element (INTERFACE_NODE, &csnp_interval_cmd);
2279 install_element (INTERFACE_NODE, &no_csnp_interval_cmd);
2280 install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd);
2281 install_element (INTERFACE_NODE, &csnp_interval_l1_cmd);
2282 install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd);
2283 install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd);
2284 install_element (INTERFACE_NODE, &csnp_interval_l2_cmd);
2285 install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd);
2286 install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd);
2287
2288#ifdef HAVE_IPV6
2289 install_element (INTERFACE_NODE, &ipv6_router_isis_cmd);
2290 install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd);
2291#if 0
2292 install_element (INTERFACE_NODE, &ipv6_address_cmd);
2293 install_element (INTERFACE_NODE, &no_ipv6_address_cmd);
2294#endif
2295#endif
jardineb5d44e2003-12-23 08:09:43 +00002296}