]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_circuit.c
Merge pull request #2985 from patrasar/Fix_1636
[mirror_frr.git] / isisd / isis_circuit.c
1 /*
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; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22 #include <zebra.h>
23 #ifdef GNU_LINUX
24 #include <net/ethernet.h>
25 #else
26 #include <netinet/if_ether.h>
27 #endif
28
29 #include "log.h"
30 #include "memory.h"
31 #include "vrf.h"
32 #include "if.h"
33 #include "linklist.h"
34 #include "command.h"
35 #include "thread.h"
36 #include "vty.h"
37 #include "hash.h"
38 #include "prefix.h"
39 #include "stream.h"
40 #include "qobj.h"
41
42 #include "isisd/dict.h"
43 #include "isisd/isis_constants.h"
44 #include "isisd/isis_common.h"
45 #include "isisd/isis_flags.h"
46 #include "isisd/isis_circuit.h"
47 #include "isisd/isis_lsp.h"
48 #include "isisd/isis_pdu.h"
49 #include "isisd/isis_network.h"
50 #include "isisd/isis_misc.h"
51 #include "isisd/isis_constants.h"
52 #include "isisd/isis_adjacency.h"
53 #include "isisd/isis_dr.h"
54 #include "isisd/isisd.h"
55 #include "isisd/isis_csm.h"
56 #include "isisd/isis_events.h"
57 #include "isisd/isis_te.h"
58 #include "isisd/isis_mt.h"
59 #include "isisd/isis_errors.h"
60 #include "isisd/isis_tx_queue.h"
61
62 DEFINE_QOBJ_TYPE(isis_circuit)
63
64 /*
65 * Prototypes.
66 */
67 int isis_interface_config_write(struct vty *);
68 int isis_if_new_hook(struct interface *);
69 int isis_if_delete_hook(struct interface *);
70
71 struct isis_circuit *isis_circuit_new()
72 {
73 struct isis_circuit *circuit;
74 int i;
75
76 circuit = XCALLOC(MTYPE_ISIS_CIRCUIT, sizeof(struct isis_circuit));
77
78 /*
79 * Default values
80 */
81 circuit->is_type = IS_LEVEL_1_AND_2;
82 circuit->flags = 0;
83 circuit->pad_hellos = 1;
84 for (i = 0; i < 2; i++) {
85 circuit->hello_interval[i] = DEFAULT_HELLO_INTERVAL;
86 circuit->hello_multiplier[i] = DEFAULT_HELLO_MULTIPLIER;
87 circuit->csnp_interval[i] = DEFAULT_CSNP_INTERVAL;
88 circuit->psnp_interval[i] = DEFAULT_PSNP_INTERVAL;
89 circuit->priority[i] = DEFAULT_PRIORITY;
90 circuit->metric[i] = DEFAULT_CIRCUIT_METRIC;
91 circuit->te_metric[i] = DEFAULT_CIRCUIT_METRIC;
92 }
93
94 circuit->mtc = mpls_te_circuit_new();
95
96 circuit_mt_init(circuit);
97
98 QOBJ_REG(circuit, isis_circuit);
99
100 return circuit;
101 }
102
103 void isis_circuit_del(struct isis_circuit *circuit)
104 {
105 if (!circuit)
106 return;
107
108 QOBJ_UNREG(circuit);
109
110 isis_circuit_if_unbind(circuit, circuit->interface);
111
112 circuit_mt_finish(circuit);
113
114 /* and lastly the circuit itself */
115 XFREE(MTYPE_ISIS_CIRCUIT, circuit);
116
117 return;
118 }
119
120 void isis_circuit_configure(struct isis_circuit *circuit,
121 struct isis_area *area)
122 {
123 assert(area);
124 circuit->area = area;
125
126 /*
127 * Whenever the is-type of an area is changed, the is-type of each
128 * circuit
129 * in that area is updated to a non-empty subset of the area is-type.
130 * Inversely, when configuring a new circuit, this property should be
131 * ensured as well.
132 */
133 if (area->is_type != IS_LEVEL_1_AND_2)
134 circuit->is_type = area->is_type;
135
136 /*
137 * Add the circuit into area
138 */
139 listnode_add(area->circuit_list, circuit);
140
141 circuit->idx = flags_get_index(&area->flags);
142
143 return;
144 }
145
146 void isis_circuit_deconfigure(struct isis_circuit *circuit,
147 struct isis_area *area)
148 {
149 /* Free the index of SRM and SSN flags */
150 flags_free_index(&area->flags, circuit->idx);
151 circuit->idx = 0;
152 /* Remove circuit from area */
153 assert(circuit->area == area);
154 listnode_delete(area->circuit_list, circuit);
155 circuit->area = NULL;
156
157 return;
158 }
159
160 struct isis_circuit *circuit_lookup_by_ifp(struct interface *ifp,
161 struct list *list)
162 {
163 struct isis_circuit *circuit = NULL;
164 struct listnode *node;
165
166 if (!list)
167 return NULL;
168
169 for (ALL_LIST_ELEMENTS_RO(list, node, circuit))
170 if (circuit->interface == ifp) {
171 assert(ifp->info == circuit);
172 return circuit;
173 }
174
175 return NULL;
176 }
177
178 struct isis_circuit *circuit_scan_by_ifp(struct interface *ifp)
179 {
180 struct isis_area *area;
181 struct listnode *node;
182 struct isis_circuit *circuit;
183
184 if (ifp->info)
185 return (struct isis_circuit *)ifp->info;
186
187 if (isis->area_list) {
188 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
189 circuit =
190 circuit_lookup_by_ifp(ifp, area->circuit_list);
191 if (circuit)
192 return circuit;
193 }
194 }
195 return circuit_lookup_by_ifp(ifp, isis->init_circ_list);
196 }
197
198 void isis_circuit_add_addr(struct isis_circuit *circuit,
199 struct connected *connected)
200 {
201 struct listnode *node;
202 struct prefix_ipv4 *ipv4;
203 #if defined(EXTREME_DEBUG)
204 char buf[PREFIX2STR_BUFFER];
205 #endif
206 struct prefix_ipv6 *ipv6;
207
208 if (connected->address->family == AF_INET) {
209 uint32_t addr = connected->address->u.prefix4.s_addr;
210 addr = ntohl(addr);
211 if (IPV4_NET0(addr) || IPV4_NET127(addr) || IN_CLASSD(addr)
212 || IPV4_LINKLOCAL(addr))
213 return;
214
215 for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node, ipv4))
216 if (prefix_same((struct prefix *)ipv4,
217 connected->address))
218 return;
219
220 ipv4 = prefix_ipv4_new();
221 ipv4->prefixlen = connected->address->prefixlen;
222 ipv4->prefix = connected->address->u.prefix4;
223 listnode_add(circuit->ip_addrs, ipv4);
224
225 /* Update MPLS TE Local IP address parameter */
226 set_circuitparams_local_ipaddr(circuit->mtc, ipv4->prefix);
227
228 if (circuit->area)
229 lsp_regenerate_schedule(circuit->area, circuit->is_type,
230 0);
231
232 #ifdef EXTREME_DEBUG
233 prefix2str(connected->address, buf, sizeof(buf));
234 zlog_debug("Added IP address %s to circuit %s", buf,
235 circuit->interface->name);
236 #endif /* EXTREME_DEBUG */
237 }
238 if (connected->address->family == AF_INET6) {
239 if (IN6_IS_ADDR_LOOPBACK(&connected->address->u.prefix6))
240 return;
241
242 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node, ipv6))
243 if (prefix_same((struct prefix *)ipv6,
244 connected->address))
245 return;
246 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node, ipv6))
247 if (prefix_same((struct prefix *)ipv6,
248 connected->address))
249 return;
250
251 ipv6 = prefix_ipv6_new();
252 ipv6->prefixlen = connected->address->prefixlen;
253 ipv6->prefix = connected->address->u.prefix6;
254
255 if (IN6_IS_ADDR_LINKLOCAL(&ipv6->prefix))
256 listnode_add(circuit->ipv6_link, ipv6);
257 else
258 listnode_add(circuit->ipv6_non_link, ipv6);
259 if (circuit->area)
260 lsp_regenerate_schedule(circuit->area, circuit->is_type,
261 0);
262
263 #ifdef EXTREME_DEBUG
264 prefix2str(connected->address, buf, sizeof(buf));
265 zlog_debug("Added IPv6 address %s to circuit %s", buf,
266 circuit->interface->name);
267 #endif /* EXTREME_DEBUG */
268 }
269 return;
270 }
271
272 void isis_circuit_del_addr(struct isis_circuit *circuit,
273 struct connected *connected)
274 {
275 struct prefix_ipv4 *ipv4, *ip = NULL;
276 struct listnode *node;
277 char buf[PREFIX2STR_BUFFER];
278 struct prefix_ipv6 *ipv6, *ip6 = NULL;
279 int found = 0;
280
281 if (connected->address->family == AF_INET) {
282 ipv4 = prefix_ipv4_new();
283 ipv4->prefixlen = connected->address->prefixlen;
284 ipv4->prefix = connected->address->u.prefix4;
285
286 for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node, ip))
287 if (prefix_same((struct prefix *)ip,
288 (struct prefix *)ipv4))
289 break;
290
291 if (ip) {
292 listnode_delete(circuit->ip_addrs, ip);
293 prefix_ipv4_free(ip);
294 if (circuit->area)
295 lsp_regenerate_schedule(circuit->area,
296 circuit->is_type, 0);
297 } else {
298 prefix2str(connected->address, buf, sizeof(buf));
299 zlog_warn(
300 "Nonexistent ip address %s removal attempt from \
301 circuit %s",
302 buf, circuit->interface->name);
303 zlog_warn("Current ip addresses on %s:",
304 circuit->interface->name);
305 for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node,
306 ip)) {
307 prefix2str(ip, buf, sizeof(buf));
308 zlog_warn(" %s", buf);
309 }
310 zlog_warn("End of addresses");
311 }
312
313 prefix_ipv4_free(ipv4);
314 }
315 if (connected->address->family == AF_INET6) {
316 ipv6 = prefix_ipv6_new();
317 ipv6->prefixlen = connected->address->prefixlen;
318 ipv6->prefix = connected->address->u.prefix6;
319
320 if (IN6_IS_ADDR_LINKLOCAL(&ipv6->prefix)) {
321 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node,
322 ip6)) {
323 if (prefix_same((struct prefix *)ip6,
324 (struct prefix *)ipv6))
325 break;
326 }
327 if (ip6) {
328 listnode_delete(circuit->ipv6_link, ip6);
329 prefix_ipv6_free(ip6);
330 found = 1;
331 }
332 } else {
333 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node,
334 ip6)) {
335 if (prefix_same((struct prefix *)ip6,
336 (struct prefix *)ipv6))
337 break;
338 }
339 if (ip6) {
340 listnode_delete(circuit->ipv6_non_link, ip6);
341 prefix_ipv6_free(ip6);
342 found = 1;
343 }
344 }
345
346 if (!found) {
347 prefix2str(connected->address, buf, sizeof(buf));
348 zlog_warn(
349 "Nonexistent ip address %s removal attempt from \
350 circuit %s",
351 buf, circuit->interface->name);
352 zlog_warn("Current ip addresses on %s:",
353 circuit->interface->name);
354 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node,
355 ip6)) {
356 prefix2str((struct prefix *)ip6, (char *)buf,
357 sizeof(buf));
358 zlog_warn(" %s", buf);
359 }
360 zlog_warn(" -----");
361 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node,
362 ip6)) {
363 prefix2str((struct prefix *)ip6, (char *)buf,
364 sizeof(buf));
365 zlog_warn(" %s", buf);
366 }
367 zlog_warn("End of addresses");
368 } else if (circuit->area)
369 lsp_regenerate_schedule(circuit->area, circuit->is_type,
370 0);
371
372 prefix_ipv6_free(ipv6);
373 }
374 return;
375 }
376
377 static uint8_t isis_circuit_id_gen(struct isis *isis, struct interface *ifp)
378 {
379 /* Circuit ids MUST be unique for any broadcast circuits. Otherwise,
380 * Pseudo-Node LSPs cannot be generated correctly.
381 *
382 * Currently, allocate one circuit ID for any circuit, limiting the total
383 * numer of circuits IS-IS can run on to 255.
384 *
385 * We should revisit this when implementing 3-way adjacencies for p2p, since
386 * we then have extended interface IDs available.
387 */
388 uint8_t id = ifp->ifindex;
389 unsigned int i;
390
391 for (i = 0; i < 256; i++) {
392 if (id && !_ISIS_CHECK_FLAG(isis->circuit_ids_used, id))
393 break;
394 id++;
395 }
396
397 if (i == 256) {
398 zlog_warn("Could not allocate a circuit id for '%s'",
399 ifp->name);
400 return 0;
401 }
402
403 _ISIS_SET_FLAG(isis->circuit_ids_used, id);
404 return id;
405 }
406
407 void isis_circuit_if_add(struct isis_circuit *circuit, struct interface *ifp)
408 {
409 struct listnode *node, *nnode;
410 struct connected *conn;
411
412 isis_circuit_if_bind(circuit, ifp);
413
414 if (if_is_broadcast(ifp)) {
415 if (fabricd || circuit->circ_type_config == CIRCUIT_T_P2P)
416 circuit->circ_type = CIRCUIT_T_P2P;
417 else
418 circuit->circ_type = CIRCUIT_T_BROADCAST;
419 } else if (if_is_pointopoint(ifp)) {
420 circuit->circ_type = CIRCUIT_T_P2P;
421 } else if (if_is_loopback(ifp)) {
422 circuit->circ_type = CIRCUIT_T_LOOPBACK;
423 circuit->is_passive = 1;
424 } else {
425 /* It's normal in case of loopback etc. */
426 if (isis->debugs & DEBUG_EVENTS)
427 zlog_debug("isis_circuit_if_add: unsupported media");
428 circuit->circ_type = CIRCUIT_T_UNKNOWN;
429 }
430
431 circuit->ip_addrs = list_new();
432 circuit->ipv6_link = list_new();
433 circuit->ipv6_non_link = list_new();
434
435 for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, conn))
436 isis_circuit_add_addr(circuit, conn);
437 }
438
439 void isis_circuit_if_del(struct isis_circuit *circuit, struct interface *ifp)
440 {
441 struct listnode *node, *nnode;
442 struct connected *conn;
443
444 assert(circuit->interface == ifp);
445
446 /* destroy addresses */
447 for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, conn))
448 isis_circuit_del_addr(circuit, conn);
449
450 if (circuit->ip_addrs) {
451 assert(listcount(circuit->ip_addrs) == 0);
452 list_delete_and_null(&circuit->ip_addrs);
453 }
454
455 if (circuit->ipv6_link) {
456 assert(listcount(circuit->ipv6_link) == 0);
457 list_delete_and_null(&circuit->ipv6_link);
458 }
459
460 if (circuit->ipv6_non_link) {
461 assert(listcount(circuit->ipv6_non_link) == 0);
462 list_delete_and_null(&circuit->ipv6_non_link);
463 }
464
465 circuit->circ_type = CIRCUIT_T_UNKNOWN;
466 }
467
468 void isis_circuit_if_bind(struct isis_circuit *circuit, struct interface *ifp)
469 {
470 assert(circuit != NULL);
471 assert(ifp != NULL);
472 if (circuit->interface)
473 assert(circuit->interface == ifp);
474 else
475 circuit->interface = ifp;
476 if (ifp->info)
477 assert(ifp->info == circuit);
478 else
479 ifp->info = circuit;
480 isis_link_params_update(circuit, ifp);
481 }
482
483 void isis_circuit_if_unbind(struct isis_circuit *circuit, struct interface *ifp)
484 {
485 assert(circuit != NULL);
486 assert(ifp != NULL);
487 assert(circuit->interface == ifp);
488 assert(ifp->info == circuit);
489 circuit->interface = NULL;
490 ifp->info = NULL;
491 }
492
493 static void isis_circuit_update_all_srmflags(struct isis_circuit *circuit,
494 int is_set)
495 {
496 struct isis_area *area;
497 struct isis_lsp *lsp;
498 dnode_t *dnode;
499 int level;
500
501 assert(circuit);
502 area = circuit->area;
503 assert(area);
504 for (level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) {
505 if (!(level & circuit->is_type))
506 continue;
507
508 if (!area->lspdb[level - 1]
509 || !dict_count(area->lspdb[level - 1]))
510 continue;
511
512 for (dnode = dict_first(area->lspdb[level - 1]);
513 dnode != NULL;
514 dnode = dict_next(area->lspdb[level - 1], dnode)) {
515 lsp = dnode_get(dnode);
516 if (is_set) {
517 isis_tx_queue_add(circuit->tx_queue, lsp,
518 TX_LSP_NORMAL);
519 } else {
520 isis_tx_queue_del(circuit->tx_queue, lsp);
521 }
522 }
523 }
524 }
525
526 size_t isis_circuit_pdu_size(struct isis_circuit *circuit)
527 {
528 return ISO_MTU(circuit);
529 }
530
531 void isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream)
532 {
533 size_t stream_size = isis_circuit_pdu_size(circuit);
534
535 if (!*stream) {
536 *stream = stream_new(stream_size);
537 } else {
538 if (STREAM_SIZE(*stream) != stream_size)
539 stream_resize_inplace(stream, stream_size);
540 stream_reset(*stream);
541 }
542 }
543
544 void isis_circuit_prepare(struct isis_circuit *circuit)
545 {
546 #if ISIS_METHOD != ISIS_METHOD_DLPI
547 thread_add_read(master, isis_receive, circuit, circuit->fd,
548 &circuit->t_read);
549 #else
550 thread_add_timer_msec(master, isis_receive, circuit,
551 listcount(circuit->area->circuit_list) * 100,
552 &circuit->t_read);
553 #endif
554 }
555
556 int isis_circuit_up(struct isis_circuit *circuit)
557 {
558 int retv;
559
560 /* Set the flags for all the lsps of the circuit. */
561 isis_circuit_update_all_srmflags(circuit, 1);
562
563 if (circuit->state == C_STATE_UP)
564 return ISIS_OK;
565
566 if (circuit->is_passive)
567 return ISIS_OK;
568
569 if (circuit->area->lsp_mtu > isis_circuit_pdu_size(circuit)) {
570 flog_err(
571 ISIS_ERR_CONFIG,
572 "Interface MTU %zu on %s is too low to support area lsp mtu %u!",
573 isis_circuit_pdu_size(circuit),
574 circuit->interface->name, circuit->area->lsp_mtu);
575 isis_circuit_update_all_srmflags(circuit, 0);
576 return ISIS_ERROR;
577 }
578
579 if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
580 circuit->circuit_id = isis_circuit_id_gen(isis, circuit->interface);
581 if (!circuit->circuit_id) {
582 flog_err(
583 ISIS_ERR_CONFIG,
584 "There are already 255 broadcast circuits active!");
585 return ISIS_ERROR;
586 }
587
588 /*
589 * Get the Hardware Address
590 */
591 if (circuit->interface->hw_addr_len != ETH_ALEN) {
592 zlog_warn("unsupported link layer");
593 } else {
594 memcpy(circuit->u.bc.snpa, circuit->interface->hw_addr,
595 ETH_ALEN);
596 }
597 #ifdef EXTREME_DEGUG
598 zlog_debug("isis_circuit_if_add: if_id %d, isomtu %d snpa %s",
599 circuit->interface->ifindex, ISO_MTU(circuit),
600 snpa_print(circuit->u.bc.snpa));
601 #endif /* EXTREME_DEBUG */
602
603 circuit->u.bc.adjdb[0] = list_new();
604 circuit->u.bc.adjdb[1] = list_new();
605
606 /*
607 * ISO 10589 - 8.4.1 Enabling of broadcast circuits
608 */
609
610 /* initilizing the hello sending threads
611 * for a broadcast IF
612 */
613
614 /* 8.4.1 a) commence sending of IIH PDUs */
615
616 if (circuit->is_type & IS_LEVEL_1) {
617 thread_add_event(master, send_lan_l1_hello, circuit, 0,
618 NULL);
619 circuit->u.bc.lan_neighs[0] = list_new();
620 }
621
622 if (circuit->is_type & IS_LEVEL_2) {
623 thread_add_event(master, send_lan_l2_hello, circuit, 0,
624 NULL);
625 circuit->u.bc.lan_neighs[1] = list_new();
626 }
627
628 /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */
629 /* 8.4.1 c) FIXME: listen for ESH PDUs */
630
631 /* 8.4.1 d) */
632 /* dr election will commence in... */
633 if (circuit->is_type & IS_LEVEL_1)
634 thread_add_timer(master, isis_run_dr_l1, circuit,
635 2 * circuit->hello_interval[0],
636 &circuit->u.bc.t_run_dr[0]);
637 if (circuit->is_type & IS_LEVEL_2)
638 thread_add_timer(master, isis_run_dr_l2, circuit,
639 2 * circuit->hello_interval[1],
640 &circuit->u.bc.t_run_dr[1]);
641 } else if (circuit->circ_type == CIRCUIT_T_P2P) {
642 /* initializing the hello send threads
643 * for a ptp IF
644 */
645 circuit->u.p2p.neighbor = NULL;
646 thread_add_event(master, send_p2p_hello, circuit, 0, NULL);
647 }
648
649 /* initializing PSNP timers */
650 if (circuit->is_type & IS_LEVEL_1)
651 thread_add_timer(
652 master, send_l1_psnp, circuit,
653 isis_jitter(circuit->psnp_interval[0], PSNP_JITTER),
654 &circuit->t_send_psnp[0]);
655
656 if (circuit->is_type & IS_LEVEL_2)
657 thread_add_timer(
658 master, send_l2_psnp, circuit,
659 isis_jitter(circuit->psnp_interval[1], PSNP_JITTER),
660 &circuit->t_send_psnp[1]);
661
662 /* unified init for circuits; ignore warnings below this level */
663 retv = isis_sock_init(circuit);
664 if (retv != ISIS_OK) {
665 isis_circuit_down(circuit);
666 return retv;
667 }
668
669 /* initialize the circuit streams after opening connection */
670 isis_circuit_stream(circuit, &circuit->rcv_stream);
671 isis_circuit_stream(circuit, &circuit->snd_stream);
672
673 isis_circuit_prepare(circuit);
674
675 circuit->tx_queue = isis_tx_queue_new(circuit, send_lsp);
676
677 return ISIS_OK;
678 }
679
680 void isis_circuit_down(struct isis_circuit *circuit)
681 {
682 /* Clear the flags for all the lsps of the circuit. */
683 isis_circuit_update_all_srmflags(circuit, 0);
684
685 if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
686 /* destroy neighbour lists */
687 if (circuit->u.bc.lan_neighs[0]) {
688 list_delete_and_null(&circuit->u.bc.lan_neighs[0]);
689 circuit->u.bc.lan_neighs[0] = NULL;
690 }
691 if (circuit->u.bc.lan_neighs[1]) {
692 list_delete_and_null(&circuit->u.bc.lan_neighs[1]);
693 circuit->u.bc.lan_neighs[1] = NULL;
694 }
695 /* destroy adjacency databases */
696 if (circuit->u.bc.adjdb[0]) {
697 circuit->u.bc.adjdb[0]->del = isis_delete_adj;
698 list_delete_and_null(&circuit->u.bc.adjdb[0]);
699 circuit->u.bc.adjdb[0] = NULL;
700 }
701 if (circuit->u.bc.adjdb[1]) {
702 circuit->u.bc.adjdb[1]->del = isis_delete_adj;
703 list_delete_and_null(&circuit->u.bc.adjdb[1]);
704 circuit->u.bc.adjdb[1] = NULL;
705 }
706 if (circuit->u.bc.is_dr[0]) {
707 isis_dr_resign(circuit, 1);
708 circuit->u.bc.is_dr[0] = 0;
709 }
710 memset(circuit->u.bc.l1_desig_is, 0, ISIS_SYS_ID_LEN + 1);
711 if (circuit->u.bc.is_dr[1]) {
712 isis_dr_resign(circuit, 2);
713 circuit->u.bc.is_dr[1] = 0;
714 }
715 memset(circuit->u.bc.l2_desig_is, 0, ISIS_SYS_ID_LEN + 1);
716 memset(circuit->u.bc.snpa, 0, ETH_ALEN);
717
718 THREAD_TIMER_OFF(circuit->u.bc.t_send_lan_hello[0]);
719 THREAD_TIMER_OFF(circuit->u.bc.t_send_lan_hello[1]);
720 THREAD_TIMER_OFF(circuit->u.bc.t_run_dr[0]);
721 THREAD_TIMER_OFF(circuit->u.bc.t_run_dr[1]);
722 THREAD_TIMER_OFF(circuit->u.bc.t_refresh_pseudo_lsp[0]);
723 THREAD_TIMER_OFF(circuit->u.bc.t_refresh_pseudo_lsp[1]);
724 circuit->lsp_regenerate_pending[0] = 0;
725 circuit->lsp_regenerate_pending[1] = 0;
726
727 _ISIS_CLEAR_FLAG(isis->circuit_ids_used, circuit->circuit_id);
728 circuit->circuit_id = 0;
729 } else if (circuit->circ_type == CIRCUIT_T_P2P) {
730 isis_delete_adj(circuit->u.p2p.neighbor);
731 circuit->u.p2p.neighbor = NULL;
732 THREAD_TIMER_OFF(circuit->u.p2p.t_send_p2p_hello);
733 }
734
735 /* Cancel all active threads */
736 THREAD_TIMER_OFF(circuit->t_send_csnp[0]);
737 THREAD_TIMER_OFF(circuit->t_send_csnp[1]);
738 THREAD_TIMER_OFF(circuit->t_send_psnp[0]);
739 THREAD_TIMER_OFF(circuit->t_send_psnp[1]);
740 THREAD_OFF(circuit->t_send_lsp);
741 THREAD_OFF(circuit->t_read);
742
743 if (circuit->tx_queue) {
744 isis_tx_queue_free(circuit->tx_queue);
745 circuit->tx_queue = NULL;
746 }
747
748 /* send one gratuitous hello to spead up convergence */
749 if (circuit->state == C_STATE_UP) {
750 if (circuit->is_type & IS_LEVEL_1)
751 send_hello(circuit, IS_LEVEL_1);
752 if (circuit->is_type & IS_LEVEL_2)
753 send_hello(circuit, IS_LEVEL_2);
754 }
755
756 circuit->upadjcount[0] = 0;
757 circuit->upadjcount[1] = 0;
758
759 /* close the socket */
760 if (circuit->fd) {
761 close(circuit->fd);
762 circuit->fd = 0;
763 }
764
765 if (circuit->rcv_stream != NULL) {
766 stream_free(circuit->rcv_stream);
767 circuit->rcv_stream = NULL;
768 }
769
770 if (circuit->snd_stream != NULL) {
771 stream_free(circuit->snd_stream);
772 circuit->snd_stream = NULL;
773 }
774
775 thread_cancel_event(master, circuit);
776
777 return;
778 }
779
780 void circuit_update_nlpids(struct isis_circuit *circuit)
781 {
782 circuit->nlpids.count = 0;
783
784 if (circuit->ip_router) {
785 circuit->nlpids.nlpids[0] = NLPID_IP;
786 circuit->nlpids.count++;
787 }
788 if (circuit->ipv6_router) {
789 circuit->nlpids.nlpids[circuit->nlpids.count] = NLPID_IPV6;
790 circuit->nlpids.count++;
791 }
792 return;
793 }
794
795 void isis_circuit_print_vty(struct isis_circuit *circuit, struct vty *vty,
796 char detail)
797 {
798 if (detail == ISIS_UI_LEVEL_BRIEF) {
799 vty_out(vty, " %-12s", circuit->interface->name);
800 vty_out(vty, "0x%-7x", circuit->circuit_id);
801 vty_out(vty, "%-9s", circuit_state2string(circuit->state));
802 vty_out(vty, "%-9s", circuit_type2string(circuit->circ_type));
803 vty_out(vty, "%-9s", circuit_t2string(circuit->is_type));
804 vty_out(vty, "\n");
805 }
806
807 if (detail == ISIS_UI_LEVEL_DETAIL) {
808 struct listnode *node;
809 struct prefix *ip_addr;
810 char buf[BUFSIZ];
811
812 vty_out(vty, " Interface: %s", circuit->interface->name);
813 vty_out(vty, ", State: %s",
814 circuit_state2string(circuit->state));
815 if (circuit->is_passive)
816 vty_out(vty, ", Passive");
817 else
818 vty_out(vty, ", Active");
819 vty_out(vty, ", Circuit Id: 0x%x", circuit->circuit_id);
820 vty_out(vty, "\n");
821 vty_out(vty, " Type: %s",
822 circuit_type2string(circuit->circ_type));
823 vty_out(vty, ", Level: %s", circuit_t2string(circuit->is_type));
824 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
825 vty_out(vty, ", SNPA: %-10s",
826 snpa_print(circuit->u.bc.snpa));
827 vty_out(vty, "\n");
828 if (circuit->is_type & IS_LEVEL_1) {
829 vty_out(vty, " Level-1 Information:\n");
830 if (circuit->area->newmetric)
831 vty_out(vty, " Metric: %d",
832 circuit->te_metric[0]);
833 else
834 vty_out(vty, " Metric: %d",
835 circuit->metric[0]);
836 if (!circuit->is_passive) {
837 vty_out(vty, ", Active neighbors: %u\n",
838 circuit->upadjcount[0]);
839 vty_out(vty,
840 " Hello interval: %u, "
841 "Holddown count: %u %s\n",
842 circuit->hello_interval[0],
843 circuit->hello_multiplier[0],
844 (circuit->pad_hellos ? "(pad)"
845 : "(no-pad)"));
846 vty_out(vty,
847 " CNSP interval: %u, "
848 "PSNP interval: %u\n",
849 circuit->csnp_interval[0],
850 circuit->psnp_interval[0]);
851 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
852 vty_out(vty,
853 " LAN Priority: %u, %s\n",
854 circuit->priority[0],
855 (circuit->u.bc.is_dr[0]
856 ? "is DIS"
857 : "is not DIS"));
858 } else {
859 vty_out(vty, "\n");
860 }
861 }
862 if (circuit->is_type & IS_LEVEL_2) {
863 vty_out(vty, " Level-2 Information:\n");
864 if (circuit->area->newmetric)
865 vty_out(vty, " Metric: %d",
866 circuit->te_metric[1]);
867 else
868 vty_out(vty, " Metric: %d",
869 circuit->metric[1]);
870 if (!circuit->is_passive) {
871 vty_out(vty, ", Active neighbors: %u\n",
872 circuit->upadjcount[1]);
873 vty_out(vty,
874 " Hello interval: %u, "
875 "Holddown count: %u %s\n",
876 circuit->hello_interval[1],
877 circuit->hello_multiplier[1],
878 (circuit->pad_hellos ? "(pad)"
879 : "(no-pad)"));
880 vty_out(vty,
881 " CNSP interval: %u, "
882 "PSNP interval: %u\n",
883 circuit->csnp_interval[1],
884 circuit->psnp_interval[1]);
885 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
886 vty_out(vty,
887 " LAN Priority: %u, %s\n",
888 circuit->priority[1],
889 (circuit->u.bc.is_dr[1]
890 ? "is DIS"
891 : "is not DIS"));
892 } else {
893 vty_out(vty, "\n");
894 }
895 }
896 if (circuit->ip_addrs && listcount(circuit->ip_addrs) > 0) {
897 vty_out(vty, " IP Prefix(es):\n");
898 for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node,
899 ip_addr)) {
900 prefix2str(ip_addr, buf, sizeof(buf)),
901 vty_out(vty, " %s\n", buf);
902 }
903 }
904 if (circuit->ipv6_link && listcount(circuit->ipv6_link) > 0) {
905 vty_out(vty, " IPv6 Link-Locals:\n");
906 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node,
907 ip_addr)) {
908 prefix2str(ip_addr, (char *)buf, BUFSIZ),
909 vty_out(vty, " %s\n", buf);
910 }
911 }
912 if (circuit->ipv6_non_link
913 && listcount(circuit->ipv6_non_link) > 0) {
914 vty_out(vty, " IPv6 Prefixes:\n");
915 for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node,
916 ip_addr)) {
917 prefix2str(ip_addr, (char *)buf, BUFSIZ),
918 vty_out(vty, " %s\n", buf);
919 }
920 }
921
922 vty_out(vty, "\n");
923 }
924 return;
925 }
926
927 int isis_interface_config_write(struct vty *vty)
928 {
929 struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
930 int write = 0;
931 struct listnode *node;
932 struct interface *ifp;
933 struct isis_area *area;
934 struct isis_circuit *circuit;
935 int i;
936
937 FOR_ALL_INTERFACES (vrf, ifp) {
938 /* IF name */
939 vty_frame(vty, "interface %s\n", ifp->name);
940 write++;
941 /* IF desc */
942 if (ifp->desc) {
943 vty_out(vty, " description %s\n", ifp->desc);
944 write++;
945 }
946 /* ISIS Circuit */
947 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
948 circuit =
949 circuit_lookup_by_ifp(ifp, area->circuit_list);
950 if (circuit == NULL)
951 continue;
952 if (circuit->ip_router) {
953 vty_out(vty, " ip router " PROTO_NAME " %s\n",
954 area->area_tag);
955 write++;
956 }
957 if (circuit->is_passive) {
958 vty_out(vty, " " PROTO_NAME " passive\n");
959 write++;
960 }
961 if (circuit->circ_type_config == CIRCUIT_T_P2P) {
962 vty_out(vty, " " PROTO_NAME " network point-to-point\n");
963 write++;
964 }
965 if (circuit->ipv6_router) {
966 vty_out(vty, " ipv6 router " PROTO_NAME " %s\n",
967 area->area_tag);
968 write++;
969 }
970
971 /* ISIS - circuit type */
972 if (!fabricd) {
973 if (circuit->is_type == IS_LEVEL_1) {
974 vty_out(vty, " " PROTO_NAME " circuit-type level-1\n");
975 write++;
976 } else {
977 if (circuit->is_type == IS_LEVEL_2) {
978 vty_out(vty,
979 " " PROTO_NAME " circuit-type level-2-only\n");
980 write++;
981 }
982 }
983 }
984
985 /* ISIS - CSNP interval */
986 if (circuit->csnp_interval[0]
987 == circuit->csnp_interval[1]) {
988 if (circuit->csnp_interval[0]
989 != DEFAULT_CSNP_INTERVAL) {
990 vty_out(vty, " " PROTO_NAME " csnp-interval %d\n",
991 circuit->csnp_interval[0]);
992 write++;
993 }
994 } else {
995 for (i = 0; i < 2; i++) {
996 if (circuit->csnp_interval[i]
997 != DEFAULT_CSNP_INTERVAL) {
998 vty_out(vty,
999 " " PROTO_NAME " csnp-interval %d level-%d\n",
1000 circuit->csnp_interval
1001 [i],
1002 i + 1);
1003 write++;
1004 }
1005 }
1006 }
1007
1008 /* ISIS - PSNP interval */
1009 if (circuit->psnp_interval[0]
1010 == circuit->psnp_interval[1]) {
1011 if (circuit->psnp_interval[0]
1012 != DEFAULT_PSNP_INTERVAL) {
1013 vty_out(vty, " " PROTO_NAME " psnp-interval %d\n",
1014 circuit->psnp_interval[0]);
1015 write++;
1016 }
1017 } else {
1018 for (i = 0; i < 2; i++) {
1019 if (circuit->psnp_interval[i]
1020 != DEFAULT_PSNP_INTERVAL) {
1021 vty_out(vty,
1022 " " PROTO_NAME " psnp-interval %d level-%d\n",
1023 circuit->psnp_interval
1024 [i],
1025 i + 1);
1026 write++;
1027 }
1028 }
1029 }
1030
1031 /* ISIS - Hello padding - Defaults to true so only
1032 * display if false */
1033 if (circuit->pad_hellos == 0) {
1034 vty_out(vty, " no " PROTO_NAME " hello padding\n");
1035 write++;
1036 }
1037
1038 if (circuit->disable_threeway_adj) {
1039 vty_out(vty, " no isis three-way-handshake\n");
1040 write++;
1041 }
1042
1043 /* ISIS - Hello interval */
1044 if (circuit->hello_interval[0]
1045 == circuit->hello_interval[1]) {
1046 if (circuit->hello_interval[0]
1047 != DEFAULT_HELLO_INTERVAL) {
1048 vty_out(vty,
1049 " " PROTO_NAME " hello-interval %d\n",
1050 circuit->hello_interval[0]);
1051 write++;
1052 }
1053 } else {
1054 for (i = 0; i < 2; i++) {
1055 if (circuit->hello_interval[i]
1056 != DEFAULT_HELLO_INTERVAL) {
1057 vty_out(vty,
1058 " " PROTO_NAME " hello-interval %d level-%d\n",
1059 circuit->hello_interval
1060 [i],
1061 i + 1);
1062 write++;
1063 }
1064 }
1065 }
1066
1067 /* ISIS - Hello Multiplier */
1068 if (circuit->hello_multiplier[0]
1069 == circuit->hello_multiplier[1]) {
1070 if (circuit->hello_multiplier[0]
1071 != DEFAULT_HELLO_MULTIPLIER) {
1072 vty_out(vty,
1073 " " PROTO_NAME " hello-multiplier %d\n",
1074 circuit->hello_multiplier[0]);
1075 write++;
1076 }
1077 } else {
1078 for (i = 0; i < 2; i++) {
1079 if (circuit->hello_multiplier[i]
1080 != DEFAULT_HELLO_MULTIPLIER) {
1081 vty_out(vty,
1082 " " PROTO_NAME " hello-multiplier %d level-%d\n",
1083 circuit->hello_multiplier
1084 [i],
1085 i + 1);
1086 write++;
1087 }
1088 }
1089 }
1090
1091 /* ISIS - Priority */
1092 if (circuit->priority[0] == circuit->priority[1]) {
1093 if (circuit->priority[0] != DEFAULT_PRIORITY) {
1094 vty_out(vty, " " PROTO_NAME " priority %d\n",
1095 circuit->priority[0]);
1096 write++;
1097 }
1098 } else {
1099 for (i = 0; i < 2; i++) {
1100 if (circuit->priority[i]
1101 != DEFAULT_PRIORITY) {
1102 vty_out(vty,
1103 " " PROTO_NAME " priority %d level-%d\n",
1104 circuit->priority[i],
1105 i + 1);
1106 write++;
1107 }
1108 }
1109 }
1110
1111 /* ISIS - Metric */
1112 if (circuit->te_metric[0] == circuit->te_metric[1]) {
1113 if (circuit->te_metric[0]
1114 != DEFAULT_CIRCUIT_METRIC) {
1115 vty_out(vty, " " PROTO_NAME " metric %d\n",
1116 circuit->te_metric[0]);
1117 write++;
1118 }
1119 } else {
1120 for (i = 0; i < 2; i++) {
1121 if (circuit->te_metric[i]
1122 != DEFAULT_CIRCUIT_METRIC) {
1123 vty_out(vty,
1124 " " PROTO_NAME " metric %d level-%d\n",
1125 circuit->te_metric[i],
1126 i + 1);
1127 write++;
1128 }
1129 }
1130 }
1131 if (circuit->passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5) {
1132 vty_out(vty, " " PROTO_NAME " password md5 %s\n",
1133 circuit->passwd.passwd);
1134 write++;
1135 } else if (circuit->passwd.type
1136 == ISIS_PASSWD_TYPE_CLEARTXT) {
1137 vty_out(vty, " " PROTO_NAME " password clear %s\n",
1138 circuit->passwd.passwd);
1139 write++;
1140 }
1141 write += circuit_write_mt_settings(circuit, vty);
1142 }
1143 vty_endframe(vty, "!\n");
1144 }
1145
1146 return write;
1147 }
1148
1149 struct isis_circuit *isis_circuit_create(struct isis_area *area,
1150 struct interface *ifp)
1151 {
1152 struct isis_circuit *circuit = circuit_scan_by_ifp(ifp);
1153 if (circuit && circuit->area)
1154 return NULL;
1155 circuit = isis_csm_state_change(ISIS_ENABLE, circuit, area);
1156 if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP)
1157 return circuit;
1158 isis_circuit_if_bind(circuit, ifp);
1159 return circuit;
1160 }
1161
1162 void isis_circuit_af_set(struct isis_circuit *circuit, bool ip_router,
1163 bool ipv6_router)
1164 {
1165 struct isis_area *area = circuit->area;
1166 bool change = circuit->ip_router != ip_router
1167 || circuit->ipv6_router != ipv6_router;
1168
1169 area->ip_circuits += ip_router - circuit->ip_router;
1170 area->ipv6_circuits += ipv6_router - circuit->ipv6_router;
1171 circuit->ip_router = ip_router;
1172 circuit->ipv6_router = ipv6_router;
1173
1174 if (!change)
1175 return;
1176
1177 circuit_update_nlpids(circuit);
1178
1179 if (!ip_router && !ipv6_router)
1180 isis_csm_state_change(ISIS_DISABLE, circuit, area);
1181 else
1182 lsp_regenerate_schedule(circuit->area, circuit->is_type, 0);
1183 }
1184
1185 ferr_r isis_circuit_passive_set(struct isis_circuit *circuit, bool passive)
1186 {
1187 if (circuit->is_passive == passive)
1188 return ferr_ok();
1189
1190 if (if_is_loopback(circuit->interface) && !passive)
1191 return ferr_cfg_invalid("loopback is always passive");
1192
1193 if (circuit->state != C_STATE_UP) {
1194 circuit->is_passive = passive;
1195 } else {
1196 struct isis_area *area = circuit->area;
1197 isis_csm_state_change(ISIS_DISABLE, circuit, area);
1198 circuit->is_passive = passive;
1199 isis_csm_state_change(ISIS_ENABLE, circuit, area);
1200 }
1201
1202 return ferr_ok();
1203 }
1204
1205 ferr_r isis_circuit_metric_set(struct isis_circuit *circuit, int level,
1206 int metric)
1207 {
1208 assert(level == IS_LEVEL_1 || level == IS_LEVEL_2);
1209 if (metric > MAX_WIDE_LINK_METRIC)
1210 return ferr_cfg_invalid("metric %d too large for wide metric",
1211 metric);
1212 if (circuit->area && circuit->area->oldmetric
1213 && metric > MAX_NARROW_LINK_METRIC)
1214 return ferr_cfg_invalid("metric %d too large for narrow metric",
1215 metric);
1216
1217 circuit->te_metric[level - 1] = metric;
1218 circuit->metric[level - 1] = metric;
1219
1220 if (circuit->area)
1221 lsp_regenerate_schedule(circuit->area, level, 0);
1222 return ferr_ok();
1223 }
1224
1225 ferr_r isis_circuit_passwd_unset(struct isis_circuit *circuit)
1226 {
1227 memset(&circuit->passwd, 0, sizeof(circuit->passwd));
1228 return ferr_ok();
1229 }
1230
1231 static int isis_circuit_passwd_set(struct isis_circuit *circuit,
1232 uint8_t passwd_type, const char *passwd)
1233 {
1234 int len;
1235
1236 if (!passwd)
1237 return ferr_code_bug("no circuit password given");
1238
1239 len = strlen(passwd);
1240 if (len > 254)
1241 return ferr_code_bug(
1242 "circuit password too long (max 254 chars)");
1243
1244 circuit->passwd.len = len;
1245 strncpy((char *)circuit->passwd.passwd, passwd, 255);
1246 circuit->passwd.type = passwd_type;
1247 return ferr_ok();
1248 }
1249
1250 ferr_r isis_circuit_passwd_cleartext_set(struct isis_circuit *circuit,
1251 const char *passwd)
1252 {
1253 return isis_circuit_passwd_set(circuit, ISIS_PASSWD_TYPE_CLEARTXT,
1254 passwd);
1255 }
1256
1257 ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
1258 const char *passwd)
1259 {
1260 return isis_circuit_passwd_set(circuit, ISIS_PASSWD_TYPE_HMAC_MD5,
1261 passwd);
1262 }
1263
1264 struct cmd_node interface_node = {
1265 INTERFACE_NODE, "%s(config-if)# ", 1,
1266 };
1267
1268 ferr_r isis_circuit_circ_type_set(struct isis_circuit *circuit, int circ_type)
1269 {
1270 if (circuit->circ_type == circ_type)
1271 return ferr_ok();
1272
1273 /* Changing the network type to/of loopback or unknown interfaces
1274 * is not supported. */
1275 if (circ_type == CIRCUIT_T_UNKNOWN || circ_type == CIRCUIT_T_LOOPBACK
1276 || circuit->circ_type == CIRCUIT_T_LOOPBACK) {
1277 return ferr_cfg_invalid(
1278 "cannot change network type on unknown interface");
1279 }
1280
1281 if (circuit->state != C_STATE_UP) {
1282 circuit->circ_type = circ_type;
1283 circuit->circ_type_config = circ_type;
1284 } else {
1285 struct isis_area *area = circuit->area;
1286 if (circ_type == CIRCUIT_T_BROADCAST
1287 && !if_is_broadcast(circuit->interface))
1288 return ferr_cfg_reality(
1289 "cannot configure non-broadcast interface for broadcast operation");
1290
1291 isis_csm_state_change(ISIS_DISABLE, circuit, area);
1292 circuit->circ_type = circ_type;
1293 circuit->circ_type_config = circ_type;
1294 isis_csm_state_change(ISIS_ENABLE, circuit, area);
1295 }
1296 return ferr_ok();
1297 }
1298
1299 int isis_circuit_mt_enabled_set(struct isis_circuit *circuit, uint16_t mtid,
1300 bool enabled)
1301 {
1302 struct isis_circuit_mt_setting *setting;
1303
1304 setting = circuit_get_mt_setting(circuit, mtid);
1305 if (setting->enabled != enabled) {
1306 setting->enabled = enabled;
1307 lsp_regenerate_schedule(circuit->area, IS_LEVEL_1 | IS_LEVEL_2,
1308 0);
1309 }
1310
1311 return CMD_SUCCESS;
1312 }
1313
1314 int isis_if_new_hook(struct interface *ifp)
1315 {
1316 return 0;
1317 }
1318
1319 int isis_if_delete_hook(struct interface *ifp)
1320 {
1321 struct isis_circuit *circuit;
1322 /* Clean up the circuit data */
1323 if (ifp && ifp->info) {
1324 circuit = ifp->info;
1325 isis_csm_state_change(IF_DOWN_FROM_Z, circuit, circuit->area);
1326 isis_csm_state_change(ISIS_DISABLE, circuit, circuit->area);
1327 }
1328
1329 return 0;
1330 }
1331
1332 void isis_circuit_init()
1333 {
1334 /* Initialize Zebra interface data structure */
1335 hook_register_prio(if_add, 0, isis_if_new_hook);
1336 hook_register_prio(if_del, 0, isis_if_delete_hook);
1337
1338 /* Install interface node */
1339 install_node(&interface_node, isis_interface_config_write);
1340 if_cmd_init();
1341 }