blob: 671ebbffe6c2926e40624d87b3b9b4b3f4071115 [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
883 assert (circuit);
884
885 circuit_t = string2circuit_t (argv[0]);
886
hassof390d2c2004-09-10 20:48:21 +0000887 if (!circuit_t)
888 {
889 vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE);
890 return CMD_SUCCESS;
891 }
892
jardineb5d44e2003-12-23 08:09:43 +0000893 is_type = circuit->area->is_type;
894 if (is_type == IS_LEVEL_1_AND_2 || is_type == circuit_t)
hassof390d2c2004-09-10 20:48:21 +0000895 isis_event_circuit_type_change (circuit, circuit_t);
896 else
897 {
898 vty_out (vty, "invalid circuit level for area %s.%s",
899 circuit->area->area_tag, VTY_NEWLINE);
900 }
901
jardineb5d44e2003-12-23 08:09:43 +0000902 return CMD_SUCCESS;
903}
904
905DEFUN (no_isis_circuit_type,
906 no_isis_circuit_type_cmd,
907 "no isis circuit-type (level-1|level-1-2|level-2-only)",
908 NO_STR
909 "IS-IS commands\n"
910 "Configure circuit type for interface\n"
911 "Level-1 only adjacencies are formed\n"
912 "Level-1-2 adjacencies are formed\n"
hassof390d2c2004-09-10 20:48:21 +0000913 "Level-2 only adjacencies are formed\n")
jardineb5d44e2003-12-23 08:09:43 +0000914{
915 struct isis_circuit *circuit;
916 struct interface *ifp;
jardineb5d44e2003-12-23 08:09:43 +0000917
hassof390d2c2004-09-10 20:48:21 +0000918 ifp = vty->index;
919 circuit = ifp->info;
920 if (circuit == NULL)
921 {
922 return CMD_WARNING;
923 }
924
925 assert (circuit);
926
jardineb5d44e2003-12-23 08:09:43 +0000927 /*
928 * Set the circuits level to its default value which is that of the area
929 */
930 isis_event_circuit_type_change (circuit, circuit->area->is_type);
hassof390d2c2004-09-10 20:48:21 +0000931
jardineb5d44e2003-12-23 08:09:43 +0000932 return CMD_SUCCESS;
933}
934
935DEFUN (isis_passwd,
936 isis_passwd_cmd,
937 "isis password WORD",
938 "IS-IS commands\n"
939 "Configure the authentication password for interface\n"
940 "Password\n")
941{
942 struct isis_circuit *circuit;
943 struct interface *ifp;
944 int len;
hassof390d2c2004-09-10 20:48:21 +0000945
946 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000947 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +0000948 if (circuit == NULL)
949 {
950 return CMD_WARNING;
951 }
952
jardineb5d44e2003-12-23 08:09:43 +0000953 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +0000954 if (len > 254)
955 {
956 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
957 return CMD_WARNING;
958 }
jardineb5d44e2003-12-23 08:09:43 +0000959 circuit->passwd.len = len;
960 circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
961 strncpy (circuit->passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +0000962
jardineb5d44e2003-12-23 08:09:43 +0000963 return CMD_SUCCESS;
964}
965
966DEFUN (no_isis_passwd,
967 no_isis_passwd_cmd,
968 "no isis password",
969 NO_STR
970 "IS-IS commands\n"
971 "Configure the authentication password for interface\n")
972{
973 struct isis_circuit *circuit;
974 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +0000975
976 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +0000977 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +0000978 if (circuit == NULL)
979 {
980 return CMD_WARNING;
981 }
982
jardineb5d44e2003-12-23 08:09:43 +0000983 memset (&circuit->passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +0000984
jardineb5d44e2003-12-23 08:09:43 +0000985 return CMD_SUCCESS;
986}
987
988
989DEFUN (isis_priority,
990 isis_priority_cmd,
991 "isis priority <0-127>",
992 "IS-IS commands\n"
993 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +0000994 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +0000995{
996 struct isis_circuit *circuit;
997 struct interface *ifp;
998 int prio;
hassof390d2c2004-09-10 20:48:21 +0000999
1000 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001001 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001002 if (circuit == NULL)
1003 {
1004 return CMD_WARNING;
1005 }
jardineb5d44e2003-12-23 08:09:43 +00001006 assert (circuit);
1007
1008 prio = atoi (argv[0]);
1009
1010 circuit->u.bc.priority[0] = prio;
1011 circuit->u.bc.priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001012
jardineb5d44e2003-12-23 08:09:43 +00001013 return CMD_SUCCESS;
1014}
1015
1016DEFUN (no_isis_priority,
1017 no_isis_priority_cmd,
1018 "no isis priority",
1019 NO_STR
1020 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001021 "Set priority for Designated Router election\n")
jardineb5d44e2003-12-23 08:09:43 +00001022{
1023 struct isis_circuit *circuit;
1024 struct interface *ifp;
1025
hassof390d2c2004-09-10 20:48:21 +00001026 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001027 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001028 if (circuit == NULL)
1029 {
1030 return CMD_WARNING;
1031 }
jardineb5d44e2003-12-23 08:09:43 +00001032 assert (circuit);
1033
1034 circuit->u.bc.priority[0] = DEFAULT_PRIORITY;
1035 circuit->u.bc.priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001036
jardineb5d44e2003-12-23 08:09:43 +00001037 return CMD_SUCCESS;
1038}
1039
1040ALIAS (no_isis_priority,
1041 no_isis_priority_arg_cmd,
1042 "no isis priority <0-127>",
1043 NO_STR
1044 "IS-IS commands\n"
1045 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001046 "Priority value\n")
jardineb5d44e2003-12-23 08:09:43 +00001047
1048DEFUN (isis_priority_l1,
1049 isis_priority_l1_cmd,
hassof390d2c2004-09-10 20:48:21 +00001050 "isis priority <0-127> level-1",
jardineb5d44e2003-12-23 08:09:43 +00001051 "IS-IS commands\n"
1052 "Set priority for Designated Router election\n"
1053 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001054 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001055{
1056 struct isis_circuit *circuit;
1057 struct interface *ifp;
1058 int prio;
hassof390d2c2004-09-10 20:48:21 +00001059
1060 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001061 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001062 if (circuit == NULL)
1063 {
1064 return CMD_WARNING;
1065 }
jardineb5d44e2003-12-23 08:09:43 +00001066 assert (circuit);
1067
1068 prio = atoi (argv[0]);
1069
1070 circuit->u.bc.priority[0] = prio;
hassof390d2c2004-09-10 20:48:21 +00001071
jardineb5d44e2003-12-23 08:09:43 +00001072 return CMD_SUCCESS;
1073}
1074
1075DEFUN (no_isis_priority_l1,
1076 no_isis_priority_l1_cmd,
1077 "no isis priority level-1",
1078 NO_STR
1079 "IS-IS commands\n"
1080 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001081 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001082{
1083 struct isis_circuit *circuit;
1084 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001085
1086 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001087 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001088 if (circuit == NULL)
1089 {
1090 return CMD_WARNING;
1091 }
jardineb5d44e2003-12-23 08:09:43 +00001092 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001093
jardineb5d44e2003-12-23 08:09:43 +00001094 circuit->u.bc.priority[0] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001095
jardineb5d44e2003-12-23 08:09:43 +00001096 return CMD_SUCCESS;
1097}
1098
1099ALIAS (no_isis_priority_l1,
1100 no_isis_priority_l1_arg_cmd,
1101 "no isis priority <0-127> level-1",
1102 NO_STR
1103 "IS-IS commands\n"
1104 "Set priority for Designated Router election\n"
1105 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001106 "Specify priority for level-1 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001107
1108DEFUN (isis_priority_l2,
1109 isis_priority_l2_cmd,
hassof390d2c2004-09-10 20:48:21 +00001110 "isis priority <0-127> level-2",
jardineb5d44e2003-12-23 08:09:43 +00001111 "IS-IS commands\n"
1112 "Set priority for Designated Router election\n"
1113 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001114 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001115{
1116 struct isis_circuit *circuit;
1117 struct interface *ifp;
1118 int prio;
hassof390d2c2004-09-10 20:48:21 +00001119
1120 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001121 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001122 if (circuit == NULL)
1123 {
1124 return CMD_WARNING;
1125 }
jardineb5d44e2003-12-23 08:09:43 +00001126 assert (circuit);
1127
1128 prio = atoi (argv[0]);
1129
1130 circuit->u.bc.priority[1] = prio;
hassof390d2c2004-09-10 20:48:21 +00001131
jardineb5d44e2003-12-23 08:09:43 +00001132 return CMD_SUCCESS;
1133}
1134
1135DEFUN (no_isis_priority_l2,
1136 no_isis_priority_l2_cmd,
1137 "no isis priority level-2",
1138 NO_STR
1139 "IS-IS commands\n"
1140 "Set priority for Designated Router election\n"
hassof390d2c2004-09-10 20:48:21 +00001141 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001142{
1143 struct isis_circuit *circuit;
1144 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001145
1146 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001147 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001148 if (circuit == NULL)
1149 {
1150 return CMD_WARNING;
1151 }
jardineb5d44e2003-12-23 08:09:43 +00001152 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001153
jardineb5d44e2003-12-23 08:09:43 +00001154 circuit->u.bc.priority[1] = DEFAULT_PRIORITY;
hassof390d2c2004-09-10 20:48:21 +00001155
jardineb5d44e2003-12-23 08:09:43 +00001156 return CMD_SUCCESS;
1157}
1158
1159ALIAS (no_isis_priority_l2,
1160 no_isis_priority_l2_arg_cmd,
1161 "no isis priority <0-127> level-2",
1162 NO_STR
1163 "IS-IS commands\n"
1164 "Set priority for Designated Router election\n"
1165 "Priority value\n"
hassof390d2c2004-09-10 20:48:21 +00001166 "Specify priority for level-2 routing\n")
jardineb5d44e2003-12-23 08:09:43 +00001167
1168/* Metric command */
hassof390d2c2004-09-10 20:48:21 +00001169 DEFUN (isis_metric,
jardineb5d44e2003-12-23 08:09:43 +00001170 isis_metric_cmd,
1171 "isis metric <0-63>",
1172 "IS-IS commands\n"
1173 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001174 "Default metric value\n")
jardineb5d44e2003-12-23 08:09:43 +00001175{
1176 struct isis_circuit *circuit;
1177 struct interface *ifp;
1178 int met;
1179
hassof390d2c2004-09-10 20:48:21 +00001180 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001181 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001182 if (circuit == NULL)
1183 {
1184 return CMD_WARNING;
1185 }
jardineb5d44e2003-12-23 08:09:43 +00001186 assert (circuit);
1187
1188 met = atoi (argv[0]);
1189
1190 circuit->metrics[0].metric_default = met;
1191 circuit->metrics[1].metric_default = met;
1192
1193 return CMD_SUCCESS;
1194}
1195
1196DEFUN (no_isis_metric,
1197 no_isis_metric_cmd,
1198 "no isis metric",
1199 NO_STR
1200 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001201 "Set default metric for circuit\n")
jardineb5d44e2003-12-23 08:09:43 +00001202{
1203 struct isis_circuit *circuit;
1204 struct interface *ifp;
1205
hassof390d2c2004-09-10 20:48:21 +00001206 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001207 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001208 if (circuit == NULL)
1209 {
1210 return CMD_WARNING;
1211 }
jardineb5d44e2003-12-23 08:09:43 +00001212 assert (circuit);
1213
1214 circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRICS;
1215 circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRICS;
1216
1217 return CMD_SUCCESS;
1218}
1219
1220ALIAS (no_isis_metric,
1221 no_isis_metric_arg_cmd,
1222 "no isis metric <0-127>",
1223 NO_STR
1224 "IS-IS commands\n"
1225 "Set default metric for circuit\n"
hassof390d2c2004-09-10 20:48:21 +00001226 "Default metric value\n")
1227
jardineb5d44e2003-12-23 08:09:43 +00001228/* end of metrics */
hassof390d2c2004-09-10 20:48:21 +00001229 DEFUN (isis_hello_interval,
jardineb5d44e2003-12-23 08:09:43 +00001230 isis_hello_interval_cmd,
1231 "isis hello-interval (<1-65535>|minimal)",
1232 "IS-IS commands\n"
1233 "Set Hello interval\n"
1234 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00001235 "Holdtime 1 seconds, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00001236{
1237 struct isis_circuit *circuit;
1238 struct interface *ifp;
1239 int interval;
1240 char c;
1241
hassof390d2c2004-09-10 20:48:21 +00001242 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001243 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001244 if (circuit == NULL)
1245 {
1246 return CMD_WARNING;
1247 }
1248 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001249 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001250 if (isdigit ((int) c))
1251 {
1252 interval = atoi (argv[0]);
1253 }
1254 else
1255 interval = HELLO_MINIMAL; /* FIXME: should be calculated */
jardineb5d44e2003-12-23 08:09:43 +00001256
hassof390d2c2004-09-10 20:48:21 +00001257 circuit->hello_interval[0] = (u_int16_t) interval;
1258 circuit->hello_interval[1] = (u_int16_t) interval;
1259
jardineb5d44e2003-12-23 08:09:43 +00001260 return CMD_SUCCESS;
1261}
1262
1263DEFUN (no_isis_hello_interval,
1264 no_isis_hello_interval_cmd,
1265 "no isis hello-interval",
1266 NO_STR
1267 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001268 "Set Hello interval\n")
jardineb5d44e2003-12-23 08:09:43 +00001269{
1270 struct isis_circuit *circuit;
1271 struct interface *ifp;
1272
hassof390d2c2004-09-10 20:48:21 +00001273 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001274 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001275 if (circuit == NULL)
1276 {
1277 return CMD_WARNING;
1278 }
jardineb5d44e2003-12-23 08:09:43 +00001279 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001280
hassof390d2c2004-09-10 20:48:21 +00001281
1282 circuit->hello_interval[0] = HELLO_INTERVAL; /* Default is 1 sec. */
jardineb5d44e2003-12-23 08:09:43 +00001283 circuit->hello_interval[1] = HELLO_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001284
jardineb5d44e2003-12-23 08:09:43 +00001285 return CMD_SUCCESS;
1286}
1287
1288ALIAS (no_isis_hello_interval,
1289 no_isis_hello_interval_arg_cmd,
1290 "no isis hello-interval (<1-65535>|minimal)",
1291 NO_STR
1292 "IS-IS commands\n"
1293 "Set Hello interval\n"
1294 "Hello interval value\n"
hassof390d2c2004-09-10 20:48:21 +00001295 "Holdtime 1 second, interval depends on multiplier\n")
jardineb5d44e2003-12-23 08:09:43 +00001296
1297DEFUN (isis_hello_interval_l1,
1298 isis_hello_interval_l1_cmd,
1299 "isis hello-interval (<1-65535>|minimal) level-1",
1300 "IS-IS commands\n"
1301 "Set Hello interval\n"
1302 "Hello interval value\n"
1303 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001304 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001305{
1306 struct isis_circuit *circuit;
1307 struct interface *ifp;
1308 long interval;
1309 char c;
1310
hassof390d2c2004-09-10 20:48:21 +00001311 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001312 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001313 if (circuit == NULL)
1314 {
1315 return CMD_WARNING;
1316 }
jardineb5d44e2003-12-23 08:09:43 +00001317 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001318
jardineb5d44e2003-12-23 08:09:43 +00001319 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001320 if (isdigit ((int) c))
1321 {
1322 interval = atoi (argv[0]);
1323 }
1324 else
jardineb5d44e2003-12-23 08:09:43 +00001325 interval = HELLO_MINIMAL;
1326
hassof390d2c2004-09-10 20:48:21 +00001327 circuit->hello_interval[0] = (u_int16_t) interval;
1328
jardineb5d44e2003-12-23 08:09:43 +00001329 return CMD_SUCCESS;
1330}
1331
1332DEFUN (no_isis_hello_interval_l1,
1333 no_isis_hello_interval_l1_cmd,
1334 "no isis hello-interval level-1",
1335 NO_STR
1336 "IS-IS commands\n"
1337 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00001338 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001339{
1340 struct isis_circuit *circuit;
1341 struct interface *ifp;
1342
hassof390d2c2004-09-10 20:48:21 +00001343 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001344 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001345 if (circuit == NULL)
1346 {
1347 return CMD_WARNING;
1348 }
jardineb5d44e2003-12-23 08:09:43 +00001349 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001350
hassof390d2c2004-09-10 20:48:21 +00001351
1352 circuit->hello_interval[0] = HELLO_INTERVAL; /* Default is 1 sec. */
1353
jardineb5d44e2003-12-23 08:09:43 +00001354 return CMD_SUCCESS;
1355}
1356
1357ALIAS (no_isis_hello_interval_l1,
1358 no_isis_hello_interval_l1_arg_cmd,
1359 "no isis hello-interval (<1-65535>|minimal) level-1",
1360 NO_STR
1361 "IS-IS commands\n"
1362 "Set Hello interval\n"
1363 "Hello interval value\n"
1364 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001365 "Specify hello-interval for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001366
1367DEFUN (isis_hello_interval_l2,
1368 isis_hello_interval_l2_cmd,
1369 "isis hello-interval (<1-65535>|minimal) level-2",
1370 "IS-IS commands\n"
1371 "Set Hello interval\n"
1372 "Hello interval value\n"
1373 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001374 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001375{
1376 struct isis_circuit *circuit;
1377 struct interface *ifp;
1378 long interval;
1379 char c;
1380
hassof390d2c2004-09-10 20:48:21 +00001381 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001382 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001383 if (circuit == NULL)
1384 {
1385 return CMD_WARNING;
1386 }
jardineb5d44e2003-12-23 08:09:43 +00001387 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001388
jardineb5d44e2003-12-23 08:09:43 +00001389 c = *argv[0];
hassof390d2c2004-09-10 20:48:21 +00001390 if (isdigit ((int) c))
1391 {
1392 interval = atoi (argv[0]);
1393 }
1394 else
jardineb5d44e2003-12-23 08:09:43 +00001395 interval = HELLO_MINIMAL;
1396
hassof390d2c2004-09-10 20:48:21 +00001397 circuit->hello_interval[1] = (u_int16_t) interval;
1398
jardineb5d44e2003-12-23 08:09:43 +00001399 return CMD_SUCCESS;
1400}
1401
1402DEFUN (no_isis_hello_interval_l2,
1403 no_isis_hello_interval_l2_cmd,
1404 "no isis hello-interval level-2",
1405 NO_STR
1406 "IS-IS commands\n"
1407 "Set Hello interval\n"
hassof390d2c2004-09-10 20:48:21 +00001408 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001409{
1410 struct isis_circuit *circuit;
1411 struct interface *ifp;
1412
hassof390d2c2004-09-10 20:48:21 +00001413 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001414 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001415 if (circuit == NULL)
1416 {
1417 return CMD_WARNING;
1418 }
jardineb5d44e2003-12-23 08:09:43 +00001419 assert (circuit);
jardineb5d44e2003-12-23 08:09:43 +00001420
hassof390d2c2004-09-10 20:48:21 +00001421
1422 circuit->hello_interval[1] = HELLO_INTERVAL; /* Default is 1 sec. */
1423
jardineb5d44e2003-12-23 08:09:43 +00001424 return CMD_SUCCESS;
1425}
1426
1427ALIAS (no_isis_hello_interval_l2,
1428 no_isis_hello_interval_l2_arg_cmd,
1429 "no isis hello-interval (<1-65535>|minimal) level-2",
1430 NO_STR
1431 "IS-IS commands\n"
1432 "Set Hello interval\n"
1433 "Hello interval value\n"
1434 "Holdtime 1 second, interval depends on multiplier\n"
hassof390d2c2004-09-10 20:48:21 +00001435 "Specify hello-interval for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001436
1437DEFUN (isis_hello_multiplier,
1438 isis_hello_multiplier_cmd,
1439 "isis hello-multiplier <3-1000>",
1440 "IS-IS commands\n"
1441 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001442 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00001443{
1444 struct isis_circuit *circuit;
1445 struct interface *ifp;
1446 int mult;
hassof390d2c2004-09-10 20:48:21 +00001447
1448 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001449 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001450 if (circuit == NULL)
1451 {
1452 return CMD_WARNING;
1453 }
jardineb5d44e2003-12-23 08:09:43 +00001454 assert (circuit);
1455
1456 mult = atoi (argv[0]);
1457
hassof390d2c2004-09-10 20:48:21 +00001458 circuit->hello_multiplier[0] = (u_int16_t) mult;
1459 circuit->hello_multiplier[1] = (u_int16_t) mult;
1460
jardineb5d44e2003-12-23 08:09:43 +00001461 return CMD_SUCCESS;
1462}
1463
1464DEFUN (no_isis_hello_multiplier,
1465 no_isis_hello_multiplier_cmd,
1466 "no isis hello-multiplier",
1467 NO_STR
1468 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001469 "Set multiplier for Hello holding time\n")
jardineb5d44e2003-12-23 08:09:43 +00001470{
1471 struct isis_circuit *circuit;
1472 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001473
1474 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001475 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001476 if (circuit == NULL)
1477 {
1478 return CMD_WARNING;
1479 }
jardineb5d44e2003-12-23 08:09:43 +00001480 assert (circuit);
1481
1482 circuit->hello_multiplier[0] = HELLO_MULTIPLIER;
1483 circuit->hello_multiplier[1] = HELLO_MULTIPLIER;
1484
1485 return CMD_SUCCESS;
1486}
1487
1488ALIAS (no_isis_hello_multiplier,
1489 no_isis_hello_multiplier_arg_cmd,
1490 "no isis hello-multiplier <3-1000>",
1491 NO_STR
1492 "IS-IS commands\n"
1493 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001494 "Hello multiplier value\n")
jardineb5d44e2003-12-23 08:09:43 +00001495
1496DEFUN (isis_hello_multiplier_l1,
1497 isis_hello_multiplier_l1_cmd,
1498 "isis hello-multiplier <3-1000> level-1",
1499 "IS-IS commands\n"
1500 "Set multiplier for Hello holding time\n"
1501 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001502 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001503{
1504 struct isis_circuit *circuit;
1505 struct interface *ifp;
1506 int mult;
hassof390d2c2004-09-10 20:48:21 +00001507
1508 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001509 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001510 if (circuit == NULL)
1511 {
1512 return CMD_WARNING;
1513 }
jardineb5d44e2003-12-23 08:09:43 +00001514 assert (circuit);
1515
1516 mult = atoi (argv[0]);
1517
hassof390d2c2004-09-10 20:48:21 +00001518 circuit->hello_multiplier[0] = (u_int16_t) mult;
1519
jardineb5d44e2003-12-23 08:09:43 +00001520 return CMD_SUCCESS;
1521}
1522
1523DEFUN (no_isis_hello_multiplier_l1,
1524 no_isis_hello_multiplier_l1_cmd,
1525 "no isis hello-multiplier level-1",
1526 NO_STR
1527 "IS-IS commands\n"
1528 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001529 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001530{
1531 struct isis_circuit *circuit;
1532 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001533
1534 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001535 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001536 if (circuit == NULL)
1537 {
1538 return CMD_WARNING;
1539 }
jardineb5d44e2003-12-23 08:09:43 +00001540 assert (circuit);
1541
1542 circuit->hello_multiplier[0] = HELLO_MULTIPLIER;
1543
1544 return CMD_SUCCESS;
1545}
1546
1547ALIAS (no_isis_hello_multiplier_l1,
1548 no_isis_hello_multiplier_l1_arg_cmd,
1549 "no isis hello-multiplier <3-1000> level-1",
1550 NO_STR
1551 "IS-IS commands\n"
1552 "Set multiplier for Hello holding time\n"
1553 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001554 "Specify hello multiplier for level-1 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001555
1556DEFUN (isis_hello_multiplier_l2,
1557 isis_hello_multiplier_l2_cmd,
1558 "isis hello-multiplier <3-1000> level-2",
1559 "IS-IS commands\n"
1560 "Set multiplier for Hello holding time\n"
1561 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001562 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001563{
1564 struct isis_circuit *circuit;
1565 struct interface *ifp;
1566 int mult;
hassof390d2c2004-09-10 20:48:21 +00001567
1568 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001569 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001570 if (circuit == NULL)
1571 {
1572 return CMD_WARNING;
1573 }
jardineb5d44e2003-12-23 08:09:43 +00001574 assert (circuit);
1575
1576 mult = atoi (argv[0]);
1577
hassof390d2c2004-09-10 20:48:21 +00001578 circuit->hello_multiplier[1] = (u_int16_t) mult;
1579
jardineb5d44e2003-12-23 08:09:43 +00001580 return CMD_SUCCESS;
1581}
1582
1583DEFUN (no_isis_hello_multiplier_l2,
1584 no_isis_hello_multiplier_l2_cmd,
1585 "no isis hello-multiplier level-2",
1586 NO_STR
1587 "IS-IS commands\n"
1588 "Set multiplier for Hello holding time\n"
hassof390d2c2004-09-10 20:48:21 +00001589 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001590{
1591 struct isis_circuit *circuit;
1592 struct interface *ifp;
hassof390d2c2004-09-10 20:48:21 +00001593
1594 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001595 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001596 if (circuit == NULL)
1597 {
1598 return CMD_WARNING;
1599 }
jardineb5d44e2003-12-23 08:09:43 +00001600 assert (circuit);
1601
1602 circuit->hello_multiplier[1] = HELLO_MULTIPLIER;
1603
1604 return CMD_SUCCESS;
1605}
1606
1607ALIAS (no_isis_hello_multiplier_l2,
1608 no_isis_hello_multiplier_l2_arg_cmd,
1609 "no isis hello-multiplier <3-1000> level-2",
1610 NO_STR
1611 "IS-IS commands\n"
1612 "Set multiplier for Hello holding time\n"
1613 "Hello multiplier value\n"
hassof390d2c2004-09-10 20:48:21 +00001614 "Specify hello multiplier for level-2 IIHs\n")
jardineb5d44e2003-12-23 08:09:43 +00001615
1616DEFUN (isis_hello,
1617 isis_hello_cmd,
1618 "isis hello padding",
1619 "IS-IS commands\n"
1620 "Add padding to IS-IS hello packets\n"
1621 "Pad hello packets\n"
1622 "<cr>\n")
1623{
1624 struct interface *ifp;
1625 struct isis_circuit *circuit;
hassof390d2c2004-09-10 20:48:21 +00001626
1627 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001628 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001629 if (circuit == NULL)
1630 {
1631 return CMD_WARNING;
1632 }
jardineb5d44e2003-12-23 08:09:43 +00001633 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001634
jardineb5d44e2003-12-23 08:09:43 +00001635 circuit->u.bc.pad_hellos = 1;
hassof390d2c2004-09-10 20:48:21 +00001636
jardineb5d44e2003-12-23 08:09:43 +00001637 return CMD_SUCCESS;
1638}
1639
hasso54301ce2004-01-27 10:07:34 +00001640#if 0
jardineb5d44e2003-12-23 08:09:43 +00001641DEFUN (ip_address,
1642 ip_address_cmd,
1643 "ip address A.B.C.D/A",
1644 "Interface Internet Protocol config commands\n"
hassof390d2c2004-09-10 20:48:21 +00001645 "Set the IP address of an interface\n" "IP address (e.g. 10.0.0.1/8\n")
jardineb5d44e2003-12-23 08:09:43 +00001646{
1647 struct interface *ifp;
1648 struct isis_circuit *circuit;
1649 struct prefix_ipv4 *ipv4, *ip;
1650 struct listnode *node;
1651 int ret, found = 1;
1652
hassof390d2c2004-09-10 20:48:21 +00001653 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001654 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001655 if (circuit == NULL)
1656 {
1657 return CMD_WARNING;
1658 }
jardineb5d44e2003-12-23 08:09:43 +00001659
1660 assert (circuit);
1661#ifdef HAVE_IPV6
1662 zlog_info ("ip_address_cmd circuit %d", circuit->interface->ifindex);
1663#endif /* HAVE_IPV6 */
1664
1665 ipv4 = prefix_ipv4_new ();
jardineb5d44e2003-12-23 08:09:43 +00001666
hassof390d2c2004-09-10 20:48:21 +00001667 ret = str2prefix_ipv4 (argv[0], ipv4);
1668 if (ret <= 0)
1669 {
1670 zlog_warn ("ip_address_cmd(): malformed address");
1671 vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
1672 return CMD_WARNING;
1673 }
1674
1675 if (!circuit->ip_addrs)
1676 circuit->ip_addrs = list_new ();
1677 else
1678 {
1679 for (node = listhead (circuit->ip_addrs); node; nextnode (node))
1680 {
1681 ip = getdata (node);
1682 if (prefix_same ((struct prefix *) ip, (struct prefix *) ipv4))
1683 found = 1;
1684 }
1685 if (found)
1686 {
1687 prefix_ipv4_free (ipv4);
1688 return CMD_SUCCESS;
1689 }
1690 }
1691
1692
jardineb5d44e2003-12-23 08:09:43 +00001693 listnode_add (circuit->ip_addrs, ipv4);
hassof390d2c2004-09-10 20:48:21 +00001694#ifdef EXTREME_DEBUG
1695 zlog_info ("added IP address %s to circuit %d", argv[0],
jardineb5d44e2003-12-23 08:09:43 +00001696 circuit->interface->ifindex);
1697#endif /* EXTREME_DEBUG */
1698 return CMD_SUCCESS;
1699}
1700
1701DEFUN (no_ip_address,
1702 no_ip_address_cmd,
1703 "no ip address A.B.C.D/A",
1704 NO_STR
1705 "Interface Internet Protocol config commands\n"
1706 "Set the IP address of an interface\n"
1707 "IP address (e.g. 10.0.0.1/8\n")
1708{
1709 struct interface *ifp;
1710 struct isis_circuit *circuit;
1711 struct prefix_ipv4 ipv4, *ip = NULL;
1712 struct listnode *node;
1713 int ret;
1714
hassof390d2c2004-09-10 20:48:21 +00001715 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001716 circuit = ifp->info;
1717 /* UGLY - will remove l8r */
hassof390d2c2004-09-10 20:48:21 +00001718 if (circuit == NULL)
1719 {
1720 return CMD_WARNING;
1721 }
jardineb5d44e2003-12-23 08:09:43 +00001722 assert (circuit);
1723
hassof390d2c2004-09-10 20:48:21 +00001724 if (!circuit->ip_addrs || circuit->ip_addrs->count == 0)
1725 {
1726 vty_out (vty, "Invalid address %s", VTY_NEWLINE);
1727 return CMD_WARNING;
1728 }
jardineb5d44e2003-12-23 08:09:43 +00001729 ret = str2prefix_ipv4 (argv[0], &ipv4);
hassof390d2c2004-09-10 20:48:21 +00001730 if (ret <= 0)
1731 {
1732 vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
1733 return CMD_WARNING;
1734 }
1735
1736 for (node = listhead (circuit->ip_addrs); node; nextnode (node))
1737 {
1738 ip = getdata (node);
1739 if (prefix_same ((struct prefix *) ip, (struct prefix *) &ipv4))
1740 break;
1741 }
1742
1743 if (ip)
1744 {
1745 listnode_delete (circuit->ip_addrs, ip);
1746 }
1747 else
1748 {
1749 vty_out (vty, "Invalid address %s", VTY_NEWLINE);
1750 }
1751
jardineb5d44e2003-12-23 08:09:43 +00001752 return CMD_SUCCESS;
1753}
hasso54301ce2004-01-27 10:07:34 +00001754#endif
jardineb5d44e2003-12-23 08:09:43 +00001755
1756DEFUN (no_isis_hello,
1757 no_isis_hello_cmd,
1758 "no isis hello padding",
1759 NO_STR
1760 "IS-IS commands\n"
1761 "Add padding to IS-IS hello packets\n"
1762 "Pad hello packets\n"
1763 "<cr>\n")
1764{
1765 struct isis_circuit *circuit;
1766 struct interface *ifp;
1767
hassof390d2c2004-09-10 20:48:21 +00001768 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001769 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001770 if (circuit == NULL)
1771 {
1772 return CMD_WARNING;
1773 }
jardineb5d44e2003-12-23 08:09:43 +00001774 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001775
jardineb5d44e2003-12-23 08:09:43 +00001776 circuit->u.bc.pad_hellos = 0;
hassof390d2c2004-09-10 20:48:21 +00001777
jardineb5d44e2003-12-23 08:09:43 +00001778 return CMD_SUCCESS;
1779}
1780
1781DEFUN (csnp_interval,
1782 csnp_interval_cmd,
1783 "isis csnp-interval <0-65535>",
1784 "IS-IS commands\n"
1785 "Set CSNP interval in seconds\n"
1786 "CSNP interval value\n")
1787{
1788 struct isis_circuit *circuit;
1789 struct interface *ifp;
1790 unsigned long interval;
1791
hassof390d2c2004-09-10 20:48:21 +00001792 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001793 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001794 if (circuit == NULL)
1795 {
1796 return CMD_WARNING;
1797 }
jardineb5d44e2003-12-23 08:09:43 +00001798 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001799
jardineb5d44e2003-12-23 08:09:43 +00001800 interval = atol (argv[0]);
1801
hassof390d2c2004-09-10 20:48:21 +00001802 circuit->csnp_interval[0] = (u_int16_t) interval;
1803 circuit->csnp_interval[1] = (u_int16_t) interval;
1804
jardineb5d44e2003-12-23 08:09:43 +00001805 return CMD_SUCCESS;
1806}
1807
1808DEFUN (no_csnp_interval,
1809 no_csnp_interval_cmd,
1810 "no isis csnp-interval",
1811 NO_STR
1812 "IS-IS commands\n"
hassof390d2c2004-09-10 20:48:21 +00001813 "Set CSNP interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001814{
1815 struct isis_circuit *circuit;
1816 struct interface *ifp;
1817
hassof390d2c2004-09-10 20:48:21 +00001818 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001819 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001820 if (circuit == NULL)
1821 {
1822 return CMD_WARNING;
1823 }
jardineb5d44e2003-12-23 08:09:43 +00001824 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001825
jardineb5d44e2003-12-23 08:09:43 +00001826 circuit->csnp_interval[0] = CSNP_INTERVAL;
1827 circuit->csnp_interval[1] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001828
jardineb5d44e2003-12-23 08:09:43 +00001829 return CMD_SUCCESS;
1830}
1831
1832ALIAS (no_csnp_interval,
1833 no_csnp_interval_arg_cmd,
1834 "no isis csnp-interval <0-65535>",
1835 NO_STR
1836 "IS-IS commands\n"
1837 "Set CSNP interval in seconds\n"
1838 "CSNP interval value\n")
1839
jardineb5d44e2003-12-23 08:09:43 +00001840DEFUN (csnp_interval_l1,
1841 csnp_interval_l1_cmd,
1842 "isis csnp-interval <0-65535> level-1",
1843 "IS-IS commands\n"
1844 "Set CSNP interval in seconds\n"
1845 "CSNP interval value\n"
1846 "Specify interval for level-1 CSNPs\n")
1847{
1848 struct isis_circuit *circuit;
1849 struct interface *ifp;
1850 unsigned long interval;
1851
hassof390d2c2004-09-10 20:48:21 +00001852 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001853 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001854 if (circuit == NULL)
1855 {
1856 return CMD_WARNING;
1857 }
jardineb5d44e2003-12-23 08:09:43 +00001858 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001859
jardineb5d44e2003-12-23 08:09:43 +00001860 interval = atol (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001861
1862 circuit->csnp_interval[0] = (u_int16_t) interval;
1863
jardineb5d44e2003-12-23 08:09:43 +00001864 return CMD_SUCCESS;
1865}
1866
1867DEFUN (no_csnp_interval_l1,
1868 no_csnp_interval_l1_cmd,
1869 "no isis csnp-interval level-1",
1870 NO_STR
1871 "IS-IS commands\n"
1872 "Set CSNP interval in seconds\n"
1873 "Specify interval for level-1 CSNPs\n")
1874{
1875 struct isis_circuit *circuit;
1876 struct interface *ifp;
1877
hassof390d2c2004-09-10 20:48:21 +00001878 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001879 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001880 if (circuit == NULL)
1881 {
1882 return CMD_WARNING;
1883 }
jardineb5d44e2003-12-23 08:09:43 +00001884 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001885
jardineb5d44e2003-12-23 08:09:43 +00001886 circuit->csnp_interval[0] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001887
jardineb5d44e2003-12-23 08:09:43 +00001888 return CMD_SUCCESS;
1889}
1890
1891ALIAS (no_csnp_interval_l1,
1892 no_csnp_interval_l1_arg_cmd,
1893 "no isis csnp-interval <0-65535> level-1",
1894 NO_STR
1895 "IS-IS commands\n"
1896 "Set CSNP interval in seconds\n"
1897 "CSNP interval value\n"
1898 "Specify interval for level-1 CSNPs\n")
1899
jardineb5d44e2003-12-23 08:09:43 +00001900DEFUN (csnp_interval_l2,
1901 csnp_interval_l2_cmd,
1902 "isis csnp-interval <0-65535> level-2",
1903 "IS-IS commands\n"
1904 "Set CSNP interval in seconds\n"
1905 "CSNP interval value\n"
1906 "Specify interval for level-2 CSNPs\n")
1907{
1908 struct isis_circuit *circuit;
1909 struct interface *ifp;
1910 unsigned long interval;
1911
hassof390d2c2004-09-10 20:48:21 +00001912 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001913 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001914 if (circuit == NULL)
1915 {
1916 return CMD_WARNING;
1917 }
jardineb5d44e2003-12-23 08:09:43 +00001918 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001919
jardineb5d44e2003-12-23 08:09:43 +00001920 interval = atol (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001921
1922 circuit->csnp_interval[1] = (u_int16_t) interval;
1923
jardineb5d44e2003-12-23 08:09:43 +00001924 return CMD_SUCCESS;
1925}
1926
1927DEFUN (no_csnp_interval_l2,
1928 no_csnp_interval_l2_cmd,
1929 "no isis csnp-interval level-2",
1930 NO_STR
1931 "IS-IS commands\n"
1932 "Set CSNP interval in seconds\n"
1933 "Specify interval for level-2 CSNPs\n")
1934{
1935 struct isis_circuit *circuit;
1936 struct interface *ifp;
1937
hassof390d2c2004-09-10 20:48:21 +00001938 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001939 circuit = ifp->info;
hassof390d2c2004-09-10 20:48:21 +00001940 if (circuit == NULL)
1941 {
1942 return CMD_WARNING;
1943 }
jardineb5d44e2003-12-23 08:09:43 +00001944 assert (circuit);
hassof390d2c2004-09-10 20:48:21 +00001945
jardineb5d44e2003-12-23 08:09:43 +00001946 circuit->csnp_interval[1] = CSNP_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001947
jardineb5d44e2003-12-23 08:09:43 +00001948 return CMD_SUCCESS;
1949}
1950
1951ALIAS (no_csnp_interval_l2,
1952 no_csnp_interval_l2_arg_cmd,
1953 "no isis csnp-interval <0-65535> level-2",
1954 NO_STR
1955 "IS-IS commands\n"
1956 "Set CSNP interval in seconds\n"
1957 "CSNP interval value\n"
1958 "Specify interval for level-2 CSNPs\n")
1959
jardineb5d44e2003-12-23 08:09:43 +00001960#ifdef HAVE_IPV6
1961DEFUN (ipv6_router_isis,
1962 ipv6_router_isis_cmd,
1963 "ipv6 router isis WORD",
1964 "IPv6 interface subcommands\n"
1965 "IPv6 Router interface commands\n"
1966 "IS-IS Routing for IPv6\n"
1967 "Routing process tag\n")
1968{
1969 struct isis_circuit *c;
1970 struct interface *ifp;
1971 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001972
1973 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +00001974 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +00001975
jardineb5d44e2003-12-23 08:09:43 +00001976 area = isis_area_lookup (argv[0]);
1977
1978 /* Prevent more than one circuit per interface */
1979 if (area)
1980 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
hassof390d2c2004-09-10 20:48:21 +00001981 else
1982 c = NULL;
1983
1984 if (c && (ifp->info != NULL))
1985 {
1986 if (c->ipv6_router == 1)
1987 {
1988 vty_out (vty, "ISIS circuit is already defined for IPv6%s",
1989 VTY_NEWLINE);
1990 return CMD_WARNING;
1991 }
jardineb5d44e2003-12-23 08:09:43 +00001992 }
jardineb5d44e2003-12-23 08:09:43 +00001993
1994 /* this is here for ciscopability */
hassof390d2c2004-09-10 20:48:21 +00001995 if (!area)
1996 {
1997 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1998 return CMD_WARNING;
1999 }
jardineb5d44e2003-12-23 08:09:43 +00002000
hassof390d2c2004-09-10 20:48:21 +00002001 if (!c)
2002 {
2003 c = circuit_lookup_by_ifp (ifp, isis->init_circ_list);
2004 c = isis_csm_state_change (ISIS_ENABLE, c, area);
2005 c->interface = ifp;
2006 ifp->info = c;
2007 }
jardineb5d44e2003-12-23 08:09:43 +00002008
hassof390d2c2004-09-10 20:48:21 +00002009 if (!c)
jardineb5d44e2003-12-23 08:09:43 +00002010 return CMD_WARNING;
2011
2012 c->ipv6_router = 1;
2013 area->ipv6_circuits++;
2014 circuit_update_nlpids (c);
2015
2016 vty->node = INTERFACE_NODE;
2017
2018 return CMD_SUCCESS;
2019}
2020
2021DEFUN (no_ipv6_router_isis,
2022 no_ipv6_router_isis_cmd,
2023 "no ipv6 router isis WORD",
2024 NO_STR
2025 "IPv6 interface subcommands\n"
2026 "IPv6 Router interface commands\n"
2027 "IS-IS Routing for IPv6\n"
2028 "Routing process tag\n")
2029{
2030 struct isis_circuit *c;
2031 struct interface *ifp;
2032 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00002033
2034 ifp = (struct interface *) vty->index;
jardineb5d44e2003-12-23 08:09:43 +00002035 /* UGLY - will remove l8r
2036 if (circuit == NULL) {
hassof390d2c2004-09-10 20:48:21 +00002037 return CMD_WARNING;
2038 } */
jardineb5d44e2003-12-23 08:09:43 +00002039 assert (ifp);
hassof390d2c2004-09-10 20:48:21 +00002040
jardineb5d44e2003-12-23 08:09:43 +00002041 area = isis_area_lookup (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00002042 if (!area)
2043 {
2044 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
2045 return CMD_WARNING;
2046 }
2047
jardineb5d44e2003-12-23 08:09:43 +00002048 c = circuit_lookup_by_ifp (ifp, area->circuit_list);
2049 if (!c)
2050 return CMD_WARNING;
2051
2052 c->ipv6_router = 0;
2053 area->ipv6_circuits--;
2054 if (c->ip_router == 0)
2055 isis_csm_state_change (ISIS_DISABLE, c, area);
2056
2057 return CMD_SUCCESS;
2058}
2059
hassof390d2c2004-09-10 20:48:21 +00002060#if 0 /* Guess we don't really need these */
jardineb5d44e2003-12-23 08:09:43 +00002061
2062DEFUN (ipv6_address,
2063 ipv6_address_cmd,
2064 "ipv6 address X:X::X:X/M",
2065 "Interface Internet Protocol config commands\n"
2066 "Set the IP address of an interface\n"
2067 "IPv6 address (e.g. 3ffe:506::1/48)\n")
2068{
2069 struct interface *ifp;
2070 struct isis_circuit *circuit;
2071 struct prefix_ipv6 *ipv6, *ip6;
2072 struct listnode *node;
2073 int ret, found = 1;
2074
hassof390d2c2004-09-10 20:48:21 +00002075 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00002076 circuit = ifp->info;
2077 /* UGLY - will remove l8r */
hassof390d2c2004-09-10 20:48:21 +00002078 if (circuit == NULL)
2079 {
2080 return CMD_WARNING;
2081 }
jardineb5d44e2003-12-23 08:09:43 +00002082 assert (circuit);
2083#ifdef EXTREME_DEBUG
2084 zlog_info ("ipv6_address_cmd circuit %d", circuit->idx);
2085#endif /* EXTREME_DEBUG */
jardineb5d44e2003-12-23 08:09:43 +00002086
hassof390d2c2004-09-10 20:48:21 +00002087 if (circuit == NULL)
2088 {
2089 zlog_warn ("ipv6_address_cmd(): no circuit");
2090 return CMD_WARNING;
2091 }
2092
2093
2094 ipv6 = prefix_ipv6_new ();
2095
2096 ret = str2prefix_ipv6 (argv[0], ipv6);
2097 if (ret <= 0)
2098 {
2099 vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
2100 return CMD_WARNING;
2101 }
2102
2103 if (!circuit->ipv6_addrs)
2104 circuit->ipv6_addrs = list_new ();
2105 else
2106 {
2107 for (node = listhead (circuit->ipv6_addrs); node; nextnode (node))
2108 {
2109 ip6 = getdata (node);
2110 if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6))
2111 found = 1;
2112 }
2113 if (found)
2114 {
2115 prefix_ipv6_free (ipv6);
2116 return CMD_SUCCESS;
2117 }
2118 }
2119
2120
jardineb5d44e2003-12-23 08:09:43 +00002121 listnode_add (circuit->ipv6_addrs, ipv6);
2122#ifdef EXTREME_DEBUG
2123 zlog_info ("added IPv6 address %s to circuit %d", argv[0], circuit->idx);
2124#endif /* EXTREME_DEBUG */
2125
2126 return CMD_SUCCESS;
2127}
2128
2129DEFUN (no_ipv6_address,
2130 no_ipv6_address_cmd,
hassof390d2c2004-09-10 20:48:21 +00002131 "no ipv6 address X:X::X:X/M",
jardineb5d44e2003-12-23 08:09:43 +00002132 NO_STR
2133 "Interface Internet Protocol config commands\n"
2134 "Set the IP address of an interface\n"
2135 "IPv6 address (e.g. 3ffe:506::1/48)\n")
2136{
2137 struct interface *ifp;
2138 struct isis_circuit *circuit;
2139 struct prefix_ipv6 ipv6, *ip6 = NULL;
2140 struct listnode *node;
2141 int ret;
2142
hassof390d2c2004-09-10 20:48:21 +00002143 ifp = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00002144 circuit = ifp->info;
2145 /* UGLY - will remove l8r */
hassof390d2c2004-09-10 20:48:21 +00002146 if (circuit == NULL)
2147 {
2148 return CMD_WARNING;
2149 }
jardineb5d44e2003-12-23 08:09:43 +00002150 assert (circuit);
2151
hassof390d2c2004-09-10 20:48:21 +00002152 if (!circuit->ipv6_addrs || circuit->ipv6_addrs->count == 0)
2153 {
2154 vty_out (vty, "Invalid address %s", VTY_NEWLINE);
2155 return CMD_WARNING;
2156 }
jardineb5d44e2003-12-23 08:09:43 +00002157 ret = str2prefix_ipv6 (argv[0], &ipv6);
hassof390d2c2004-09-10 20:48:21 +00002158 if (ret <= 0)
2159 {
2160 vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
2161 return CMD_WARNING;
2162 }
2163
2164 for (node = listhead (circuit->ipv6_addrs); node; nextnode (node))
2165 {
2166 ip6 = getdata (node);
2167 if (prefix_same ((struct prefix *) ip6, (struct prefix *) &ipv6))
2168 break;
2169 }
2170
2171 if (ip6)
2172 {
2173 listnode_delete (circuit->ipv6_addrs, ip6);
2174 }
2175 else
2176 {
2177 vty_out (vty, "Invalid address %s", VTY_NEWLINE);
2178 }
2179
jardineb5d44e2003-12-23 08:09:43 +00002180 return CMD_SUCCESS;
2181}
2182#endif /* 0 */
hassof390d2c2004-09-10 20:48:21 +00002183#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +00002184
hassof390d2c2004-09-10 20:48:21 +00002185struct cmd_node interface_node = {
jardineb5d44e2003-12-23 08:09:43 +00002186 INTERFACE_NODE,
2187 "%s(config-if)# ",
2188 1,
2189};
2190
jardineb5d44e2003-12-23 08:09:43 +00002191int
2192isis_if_new_hook (struct interface *ifp)
2193{
2194/* FIXME: Discuss if the circuit should be created here
2195 ifp->info = XMALLOC (MTYPE_ISIS_IF_INFO, sizeof (struct isis_if_info)); */
2196 ifp->info = NULL;
2197 return 0;
2198}
2199
2200int
2201isis_if_delete_hook (struct interface *ifp)
2202{
2203/* FIXME: Discuss if the circuit should be created here
2204 XFREE (MTYPE_ISIS_IF_INFO, ifp->info);*/
2205 ifp->info = NULL;
2206 return 0;
2207}
2208
jardineb5d44e2003-12-23 08:09:43 +00002209void
2210isis_circuit_init ()
2211{
jardineb5d44e2003-12-23 08:09:43 +00002212 /* Initialize Zebra interface data structure */
2213 if_init ();
2214 if_add_hook (IF_NEW_HOOK, isis_if_new_hook);
2215 if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook);
2216
2217 /* Install interface node */
2218 install_node (&interface_node, isis_interface_config_write);
2219 install_element (CONFIG_NODE, &interface_cmd);
2220
2221 install_default (INTERFACE_NODE);
2222 install_element (INTERFACE_NODE, &interface_desc_cmd);
2223 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
2224
2225 install_element (INTERFACE_NODE, &ip_router_isis_cmd);
2226 install_element (INTERFACE_NODE, &no_ip_router_isis_cmd);
2227
2228 install_element (INTERFACE_NODE, &isis_circuit_type_cmd);
2229 install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd);
2230
2231 install_element (INTERFACE_NODE, &isis_passwd_cmd);
2232 install_element (INTERFACE_NODE, &no_isis_passwd_cmd);
2233
2234 install_element (INTERFACE_NODE, &isis_priority_cmd);
2235 install_element (INTERFACE_NODE, &no_isis_priority_cmd);
2236 install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd);
2237 install_element (INTERFACE_NODE, &isis_priority_l1_cmd);
2238 install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd);
2239 install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd);
2240 install_element (INTERFACE_NODE, &isis_priority_l2_cmd);
2241 install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd);
2242 install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd);
2243
2244 install_element (INTERFACE_NODE, &isis_metric_cmd);
2245 install_element (INTERFACE_NODE, &no_isis_metric_cmd);
2246 install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd);
2247
2248 install_element (INTERFACE_NODE, &isis_hello_interval_cmd);
2249 install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd);
2250 install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd);
2251 install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd);
2252 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd);
2253 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd);
2254 install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd);
2255 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd);
2256 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd);
2257
2258 install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd);
2259 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
2260 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd);
2261 install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd);
2262 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd);
2263 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd);
2264 install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd);
2265 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd);
2266 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd);
2267
2268 install_element (INTERFACE_NODE, &isis_hello_cmd);
2269 install_element (INTERFACE_NODE, &no_isis_hello_cmd);
hasso38a61c72004-01-27 13:40:14 +00002270#if 0
jardineb5d44e2003-12-23 08:09:43 +00002271 install_element (INTERFACE_NODE, &ip_address_cmd);
2272 install_element (INTERFACE_NODE, &no_ip_address_cmd);
hasso38a61c72004-01-27 13:40:14 +00002273#endif
jardineb5d44e2003-12-23 08:09:43 +00002274 install_element (INTERFACE_NODE, &csnp_interval_cmd);
2275 install_element (INTERFACE_NODE, &no_csnp_interval_cmd);
2276 install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd);
2277 install_element (INTERFACE_NODE, &csnp_interval_l1_cmd);
2278 install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd);
2279 install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd);
2280 install_element (INTERFACE_NODE, &csnp_interval_l2_cmd);
2281 install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd);
2282 install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd);
2283
2284#ifdef HAVE_IPV6
2285 install_element (INTERFACE_NODE, &ipv6_router_isis_cmd);
2286 install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd);
2287#if 0
2288 install_element (INTERFACE_NODE, &ipv6_address_cmd);
2289 install_element (INTERFACE_NODE, &no_ipv6_address_cmd);
2290#endif
2291#endif
jardineb5d44e2003-12-23 08:09:43 +00002292}