2 * IS-IS Rout(e)ing protocol - isis_circuit.h
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
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)
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
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
24 #include <net/ethernet.h>
26 #include <netinet/if_ether.h>
41 #include "lib/northbound_cli.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 #include "isisd/isis_nb.h"
62 #include "isisd/isis_ldp_sync.h"
64 DEFINE_MTYPE_STATIC(ISISD
, ISIS_CIRCUIT
, "ISIS circuit");
66 DEFINE_QOBJ_TYPE(isis_circuit
);
68 DEFINE_HOOK(isis_if_new_hook
, (struct interface
*ifp
), (ifp
));
73 int isis_if_new_hook(struct interface
*);
74 int isis_if_delete_hook(struct interface
*);
76 DEFINE_HOOK(isis_circuit_new_hook
, (struct isis_circuit
*circuit
), (circuit
));
77 DEFINE_HOOK(isis_circuit_del_hook
, (struct isis_circuit
*circuit
), (circuit
));
79 static void isis_circuit_enable(struct isis_circuit
*circuit
)
81 struct isis_area
*area
= circuit
->area
;
82 struct interface
*ifp
= circuit
->interface
;
85 area
= isis_area_lookup(circuit
->tag
, ifp
->vrf
->vrf_id
);
87 isis_area_add_circuit(area
, circuit
);
90 if (if_is_operative(ifp
))
91 isis_csm_state_change(IF_UP_FROM_Z
, circuit
, ifp
);
94 static void isis_circuit_disable(struct isis_circuit
*circuit
)
96 struct isis_area
*area
= circuit
->area
;
97 struct interface
*ifp
= circuit
->interface
;
99 if (if_is_operative(ifp
))
100 isis_csm_state_change(IF_DOWN_FROM_Z
, circuit
, ifp
);
103 isis_area_del_circuit(area
, circuit
);
106 struct isis_circuit
*isis_circuit_new(struct interface
*ifp
, const char *tag
)
108 struct isis_circuit
*circuit
;
111 circuit
= XCALLOC(MTYPE_ISIS_CIRCUIT
, sizeof(struct isis_circuit
));
113 circuit
->tag
= XSTRDUP(MTYPE_ISIS_CIRCUIT
, tag
);
119 circuit
->is_type_config
= yang_get_default_enum(
120 "/frr-interface:lib/interface/frr-isisd:isis/circuit-type");
123 circuit
->pad_hellos
= yang_get_default_bool(
124 "/frr-interface:lib/interface/frr-isisd:isis/hello/padding");
125 circuit
->hello_interval
[0] = yang_get_default_uint32(
126 "/frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-1");
127 circuit
->hello_interval
[1] = yang_get_default_uint32(
128 "/frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-2");
129 circuit
->hello_multiplier
[0] = yang_get_default_uint32(
130 "/frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-1");
131 circuit
->hello_multiplier
[1] = yang_get_default_uint32(
132 "/frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-2");
133 circuit
->csnp_interval
[0] = yang_get_default_uint16(
134 "/frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-1");
135 circuit
->csnp_interval
[1] = yang_get_default_uint16(
136 "/frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-2");
137 circuit
->psnp_interval
[0] = yang_get_default_uint16(
138 "/frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-1");
139 circuit
->psnp_interval
[1] = yang_get_default_uint16(
140 "/frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-2");
141 circuit
->priority
[0] = yang_get_default_uint8(
142 "/frr-interface:lib/interface/frr-isisd:isis/priority/level-1");
143 circuit
->priority
[1] = yang_get_default_uint8(
144 "/frr-interface:lib/interface/frr-isisd:isis/priority/level-2");
145 circuit
->metric
[0] = yang_get_default_uint32(
146 "/frr-interface:lib/interface/frr-isisd:isis/metric/level-1");
147 circuit
->metric
[1] = yang_get_default_uint32(
148 "/frr-interface:lib/interface/frr-isisd:isis/metric/level-2");
149 circuit
->te_metric
[0] = yang_get_default_uint32(
150 "/frr-interface:lib/interface/frr-isisd:isis/metric/level-1");
151 circuit
->te_metric
[1] = yang_get_default_uint32(
152 "/frr-interface:lib/interface/frr-isisd:isis/metric/level-2");
154 for (i
= 0; i
< 2; i
++) {
155 circuit
->level_arg
[i
].level
= i
+ 1;
156 circuit
->level_arg
[i
].circuit
= circuit
;
159 circuit
->is_type_config
= IS_LEVEL_1_AND_2
;
161 circuit
->pad_hellos
= 1;
162 for (i
= 0; i
< 2; i
++) {
163 circuit
->hello_interval
[i
] = DEFAULT_HELLO_INTERVAL
;
164 circuit
->hello_multiplier
[i
] = DEFAULT_HELLO_MULTIPLIER
;
165 circuit
->csnp_interval
[i
] = DEFAULT_CSNP_INTERVAL
;
166 circuit
->psnp_interval
[i
] = DEFAULT_PSNP_INTERVAL
;
167 circuit
->priority
[i
] = DEFAULT_PRIORITY
;
168 circuit
->metric
[i
] = DEFAULT_CIRCUIT_METRIC
;
169 circuit
->te_metric
[i
] = DEFAULT_CIRCUIT_METRIC
;
170 circuit
->level_arg
[i
].level
= i
+ 1;
171 circuit
->level_arg
[i
].circuit
= circuit
;
173 #endif /* ifndef FABRICD */
175 circuit
->is_type
= circuit
->is_type_config
;
177 circuit_mt_init(circuit
);
178 isis_lfa_excluded_ifaces_init(circuit
, ISIS_LEVEL1
);
179 isis_lfa_excluded_ifaces_init(circuit
, ISIS_LEVEL2
);
181 circuit
->ldp_sync_info
= ldp_sync_info_create();
182 circuit
->ldp_sync_info
->enabled
= LDP_IGP_SYNC_ENABLED
;
184 QOBJ_REG(circuit
, isis_circuit
);
186 isis_circuit_if_bind(circuit
, ifp
);
188 if (ifp
->ifindex
!= IFINDEX_INTERNAL
)
189 isis_circuit_enable(circuit
);
194 void isis_circuit_del(struct isis_circuit
*circuit
)
199 if (circuit
->interface
->ifindex
!= IFINDEX_INTERNAL
)
200 isis_circuit_disable(circuit
);
202 isis_circuit_if_unbind(circuit
, circuit
->interface
);
206 ldp_sync_info_free(&circuit
->ldp_sync_info
);
208 circuit_mt_finish(circuit
);
209 isis_lfa_excluded_ifaces_clear(circuit
, ISIS_LEVEL1
);
210 isis_lfa_excluded_ifaces_clear(circuit
, ISIS_LEVEL2
);
212 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
213 XFREE(MTYPE_ISIS_CIRCUIT
, circuit
->tag
);
215 /* and lastly the circuit itself */
216 XFREE(MTYPE_ISIS_CIRCUIT
, circuit
);
221 void isis_circuit_configure(struct isis_circuit
*circuit
,
222 struct isis_area
*area
)
225 circuit
->isis
= area
->isis
;
226 circuit
->area
= area
;
229 * Whenever the is-type of an area is changed, the is-type of each
231 * in that area is updated to a non-empty subset of the area is-type.
232 * Inversely, when configuring a new circuit, this property should be
235 if (area
->is_type
!= IS_LEVEL_1_AND_2
)
236 circuit
->is_type
= area
->is_type
;
239 * Add the circuit into area
241 listnode_add(area
->circuit_list
, circuit
);
243 circuit
->idx
= flags_get_index(&area
->flags
);
245 hook_call(isis_circuit_new_hook
, circuit
);
250 void isis_circuit_deconfigure(struct isis_circuit
*circuit
,
251 struct isis_area
*area
)
253 hook_call(isis_circuit_del_hook
, circuit
);
255 /* Free the index of SRM and SSN flags */
256 flags_free_index(&area
->flags
, circuit
->idx
);
259 /* Reset IS type to configured */
260 circuit
->is_type
= circuit
->is_type_config
;
262 /* Remove circuit from area */
263 assert(circuit
->area
== area
);
264 listnode_delete(area
->circuit_list
, circuit
);
265 circuit
->area
= NULL
;
266 circuit
->isis
= NULL
;
271 struct isis_circuit
*circuit_scan_by_ifp(struct interface
*ifp
)
273 return (struct isis_circuit
*)ifp
->info
;
276 DEFINE_HOOK(isis_circuit_add_addr_hook
, (struct isis_circuit
*circuit
),
279 void isis_circuit_add_addr(struct isis_circuit
*circuit
,
280 struct connected
*connected
)
282 struct listnode
*node
;
283 struct prefix_ipv4
*ipv4
;
284 struct prefix_ipv6
*ipv6
;
286 if (connected
->address
->family
== AF_INET
) {
287 uint32_t addr
= connected
->address
->u
.prefix4
.s_addr
;
289 if (IPV4_NET0(addr
) || IPV4_NET127(addr
) || IN_CLASSD(addr
)
290 || IPV4_LINKLOCAL(addr
))
293 for (ALL_LIST_ELEMENTS_RO(circuit
->ip_addrs
, node
, ipv4
))
294 if (prefix_same((struct prefix
*)ipv4
,
298 ipv4
= prefix_ipv4_new();
299 ipv4
->prefixlen
= connected
->address
->prefixlen
;
300 ipv4
->prefix
= connected
->address
->u
.prefix4
;
301 listnode_add(circuit
->ip_addrs
, ipv4
);
303 /* Update Local IP address parameter if MPLS TE is enable */
304 if (circuit
->ext
&& circuit
->area
305 && IS_MPLS_TE(circuit
->area
->mta
)) {
306 circuit
->ext
->local_addr
.s_addr
= ipv4
->prefix
.s_addr
;
307 SET_SUBTLV(circuit
->ext
, EXT_LOCAL_ADDR
);
311 lsp_regenerate_schedule(circuit
->area
, circuit
->is_type
,
315 zlog_debug("Added IP address %pFX to circuit %s",
316 connected
->address
, circuit
->interface
->name
);
317 #endif /* EXTREME_DEBUG */
319 if (connected
->address
->family
== AF_INET6
) {
320 if (IN6_IS_ADDR_LOOPBACK(&connected
->address
->u
.prefix6
))
323 for (ALL_LIST_ELEMENTS_RO(circuit
->ipv6_link
, node
, ipv6
))
324 if (prefix_same((struct prefix
*)ipv6
,
327 for (ALL_LIST_ELEMENTS_RO(circuit
->ipv6_non_link
, node
, ipv6
))
328 if (prefix_same((struct prefix
*)ipv6
,
332 ipv6
= prefix_ipv6_new();
333 ipv6
->prefixlen
= connected
->address
->prefixlen
;
334 ipv6
->prefix
= connected
->address
->u
.prefix6
;
336 if (IN6_IS_ADDR_LINKLOCAL(&ipv6
->prefix
))
337 listnode_add(circuit
->ipv6_link
, ipv6
);
339 listnode_add(circuit
->ipv6_non_link
, ipv6
);
340 /* Update Local IPv6 address param. if MPLS TE is on */
341 if (circuit
->ext
&& circuit
->area
342 && IS_MPLS_TE(circuit
->area
->mta
)) {
343 IPV6_ADDR_COPY(&circuit
->ext
->local_addr6
,
345 SET_SUBTLV(circuit
->ext
, EXT_LOCAL_ADDR6
);
349 lsp_regenerate_schedule(circuit
->area
, circuit
->is_type
,
353 zlog_debug("Added IPv6 address %pFX to circuit %s",
354 connected
->address
, circuit
->interface
->name
);
355 #endif /* EXTREME_DEBUG */
358 hook_call(isis_circuit_add_addr_hook
, circuit
);
363 void isis_circuit_del_addr(struct isis_circuit
*circuit
,
364 struct connected
*connected
)
366 struct prefix_ipv4
*ipv4
, *ip
= NULL
;
367 struct listnode
*node
;
368 struct prefix_ipv6
*ipv6
, *ip6
= NULL
;
371 if (connected
->address
->family
== AF_INET
) {
372 ipv4
= prefix_ipv4_new();
373 ipv4
->prefixlen
= connected
->address
->prefixlen
;
374 ipv4
->prefix
= connected
->address
->u
.prefix4
;
376 for (ALL_LIST_ELEMENTS_RO(circuit
->ip_addrs
, node
, ip
))
377 if (prefix_same((struct prefix
*)ip
,
378 (struct prefix
*)ipv4
))
382 listnode_delete(circuit
->ip_addrs
, ip
);
383 prefix_ipv4_free(&ip
);
385 lsp_regenerate_schedule(circuit
->area
,
386 circuit
->is_type
, 0);
389 "Nonexistent ip address %pFX removal attempt from circuit %s",
390 connected
->address
, circuit
->interface
->name
);
391 zlog_warn("Current ip addresses on %s:",
392 circuit
->interface
->name
);
393 for (ALL_LIST_ELEMENTS_RO(circuit
->ip_addrs
, node
,
395 zlog_warn(" %pFX", ip
);
397 zlog_warn("End of addresses");
400 prefix_ipv4_free(&ipv4
);
402 if (connected
->address
->family
== AF_INET6
) {
403 ipv6
= prefix_ipv6_new();
404 ipv6
->prefixlen
= connected
->address
->prefixlen
;
405 ipv6
->prefix
= connected
->address
->u
.prefix6
;
407 if (IN6_IS_ADDR_LINKLOCAL(&ipv6
->prefix
)) {
408 for (ALL_LIST_ELEMENTS_RO(circuit
->ipv6_link
, node
,
410 if (prefix_same((struct prefix
*)ip6
,
411 (struct prefix
*)ipv6
))
415 listnode_delete(circuit
->ipv6_link
, ip6
);
416 prefix_ipv6_free(&ip6
);
420 for (ALL_LIST_ELEMENTS_RO(circuit
->ipv6_non_link
, node
,
422 if (prefix_same((struct prefix
*)ip6
,
423 (struct prefix
*)ipv6
))
427 listnode_delete(circuit
->ipv6_non_link
, ip6
);
428 prefix_ipv6_free(&ip6
);
435 "Nonexistent ip address %pFX removal attempt from circuit %s",
436 connected
->address
, circuit
->interface
->name
);
437 zlog_warn("Current ip addresses on %s:",
438 circuit
->interface
->name
);
439 for (ALL_LIST_ELEMENTS_RO(circuit
->ipv6_link
, node
,
441 zlog_warn(" %pFX", (struct prefix
*)ip6
);
443 for (ALL_LIST_ELEMENTS_RO(circuit
->ipv6_non_link
, node
,
445 zlog_warn(" %pFX", (struct prefix
*)ip6
);
446 zlog_warn("End of addresses");
447 } else if (circuit
->area
)
448 lsp_regenerate_schedule(circuit
->area
, circuit
->is_type
,
451 prefix_ipv6_free(&ipv6
);
456 static uint8_t isis_circuit_id_gen(struct isis
*isis
, struct interface
*ifp
)
458 /* Circuit ids MUST be unique for any broadcast circuits. Otherwise,
459 * Pseudo-Node LSPs cannot be generated correctly.
461 * Currently, allocate one circuit ID for any circuit, limiting the total
462 * numer of circuits IS-IS can run on to 255.
464 * We should revisit this when implementing 3-way adjacencies for p2p, since
465 * we then have extended interface IDs available.
467 uint8_t id
= ifp
->ifindex
;
470 for (i
= 0; i
< 256; i
++) {
471 if (id
&& !_ISIS_CHECK_FLAG(isis
->circuit_ids_used
, id
))
477 zlog_warn("Could not allocate a circuit id for '%s'",
482 _ISIS_SET_FLAG(isis
->circuit_ids_used
, id
);
486 void isis_circuit_if_add(struct isis_circuit
*circuit
, struct interface
*ifp
)
488 struct listnode
*node
, *nnode
;
489 struct connected
*conn
;
491 if (if_is_broadcast(ifp
)) {
492 if (fabricd
|| circuit
->circ_type_config
== CIRCUIT_T_P2P
)
493 circuit
->circ_type
= CIRCUIT_T_P2P
;
495 circuit
->circ_type
= CIRCUIT_T_BROADCAST
;
496 } else if (if_is_pointopoint(ifp
)) {
497 circuit
->circ_type
= CIRCUIT_T_P2P
;
498 } else if (if_is_loopback(ifp
)) {
499 circuit
->circ_type
= CIRCUIT_T_LOOPBACK
;
500 circuit
->is_passive
= 1;
502 /* It's normal in case of loopback etc. */
504 zlog_debug("isis_circuit_if_add: unsupported media");
505 circuit
->circ_type
= CIRCUIT_T_UNKNOWN
;
508 circuit
->ip_addrs
= list_new();
509 circuit
->ipv6_link
= list_new();
510 circuit
->ipv6_non_link
= list_new();
512 for (ALL_LIST_ELEMENTS(ifp
->connected
, node
, nnode
, conn
))
513 isis_circuit_add_addr(circuit
, conn
);
517 void isis_circuit_if_del(struct isis_circuit
*circuit
, struct interface
*ifp
)
519 struct listnode
*node
, *nnode
;
520 struct connected
*conn
;
522 assert(circuit
->interface
== ifp
);
524 /* destroy addresses */
525 for (ALL_LIST_ELEMENTS(ifp
->connected
, node
, nnode
, conn
))
526 isis_circuit_del_addr(circuit
, conn
);
528 if (circuit
->ip_addrs
) {
529 assert(listcount(circuit
->ip_addrs
) == 0);
530 list_delete(&circuit
->ip_addrs
);
533 if (circuit
->ipv6_link
) {
534 assert(listcount(circuit
->ipv6_link
) == 0);
535 list_delete(&circuit
->ipv6_link
);
538 if (circuit
->ipv6_non_link
) {
539 assert(listcount(circuit
->ipv6_non_link
) == 0);
540 list_delete(&circuit
->ipv6_non_link
);
543 circuit
->circ_type
= CIRCUIT_T_UNKNOWN
;
546 void isis_circuit_if_bind(struct isis_circuit
*circuit
, struct interface
*ifp
)
548 assert(circuit
!= NULL
);
550 if (circuit
->interface
)
551 assert(circuit
->interface
== ifp
);
553 circuit
->interface
= ifp
;
555 assert(ifp
->info
== circuit
);
560 void isis_circuit_if_unbind(struct isis_circuit
*circuit
, struct interface
*ifp
)
562 assert(circuit
!= NULL
);
564 assert(circuit
->interface
== ifp
);
565 assert(ifp
->info
== circuit
);
566 circuit
->interface
= NULL
;
570 static void isis_circuit_update_all_srmflags(struct isis_circuit
*circuit
,
573 struct isis_area
*area
;
574 struct isis_lsp
*lsp
;
578 area
= circuit
->area
;
580 for (level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
; level
++) {
581 if (!(level
& circuit
->is_type
))
584 if (!lspdb_count(&area
->lspdb
[level
- 1]))
587 frr_each (lspdb
, &area
->lspdb
[level
- 1], lsp
) {
589 isis_tx_queue_add(circuit
->tx_queue
, lsp
,
592 isis_tx_queue_del(circuit
->tx_queue
, lsp
);
598 size_t isis_circuit_pdu_size(struct isis_circuit
*circuit
)
600 return ISO_MTU(circuit
);
603 void isis_circuit_stream(struct isis_circuit
*circuit
, struct stream
**stream
)
605 size_t stream_size
= isis_circuit_pdu_size(circuit
);
608 *stream
= stream_new(stream_size
);
610 if (STREAM_SIZE(*stream
) != stream_size
)
611 stream_resize_inplace(stream
, stream_size
);
612 stream_reset(*stream
);
616 void isis_circuit_prepare(struct isis_circuit
*circuit
)
618 #if ISIS_METHOD != ISIS_METHOD_DLPI
619 thread_add_read(master
, isis_receive
, circuit
, circuit
->fd
,
622 thread_add_timer_msec(master
, isis_receive
, circuit
,
623 listcount(circuit
->area
->circuit_list
) * 100,
628 int isis_circuit_up(struct isis_circuit
*circuit
)
632 /* Set the flags for all the lsps of the circuit. */
633 isis_circuit_update_all_srmflags(circuit
, 1);
635 if (circuit
->state
== C_STATE_UP
)
638 if (circuit
->is_passive
) {
639 circuit
->last_uptime
= time(NULL
);
640 /* make sure the union fields are initialized, else we
641 * could end with garbage values from a previous circuit
642 * type, which would then cause a segfault when building
643 * LSPs or computing the SPF tree
645 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
646 circuit
->u
.bc
.adjdb
[0] = list_new();
647 circuit
->u
.bc
.adjdb
[1] = list_new();
648 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
) {
649 circuit
->u
.p2p
.neighbor
= NULL
;
654 if (circuit
->area
->lsp_mtu
> isis_circuit_pdu_size(circuit
)) {
657 "Interface MTU %zu on %s is too low to support area lsp mtu %u!",
658 isis_circuit_pdu_size(circuit
),
659 circuit
->interface
->name
, circuit
->area
->lsp_mtu
);
660 isis_circuit_update_all_srmflags(circuit
, 0);
664 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
665 circuit
->circuit_id
=
666 isis_circuit_id_gen(circuit
->isis
, circuit
->interface
);
667 if (!circuit
->circuit_id
) {
670 "There are already 255 broadcast circuits active!");
675 * Get the Hardware Address
677 if (circuit
->interface
->hw_addr_len
!= ETH_ALEN
) {
678 zlog_warn("unsupported link layer");
680 memcpy(circuit
->u
.bc
.snpa
, circuit
->interface
->hw_addr
,
684 zlog_debug("isis_circuit_if_add: if_id %d, isomtu %d snpa %s",
685 circuit
->interface
->ifindex
, ISO_MTU(circuit
),
686 snpa_print(circuit
->u
.bc
.snpa
));
687 #endif /* EXTREME_DEBUG */
689 circuit
->u
.bc
.adjdb
[0] = list_new();
690 circuit
->u
.bc
.adjdb
[1] = list_new();
693 * ISO 10589 - 8.4.1 Enabling of broadcast circuits
696 /* initilizing the hello sending threads
700 /* 8.4.1 a) commence sending of IIH PDUs */
702 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
; level
++) {
703 if (!(circuit
->is_type
& level
))
706 send_hello_sched(circuit
, level
, TRIGGERED_IIH_DELAY
);
707 circuit
->u
.bc
.lan_neighs
[level
- 1] = list_new();
709 thread_add_timer(master
, isis_run_dr
,
710 &circuit
->level_arg
[level
- 1],
711 2 * circuit
->hello_interval
[level
- 1],
712 &circuit
->u
.bc
.t_run_dr
[level
- 1]);
715 /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */
716 /* 8.4.1 c) FIXME: listen for ESH PDUs */
717 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
) {
718 /* initializing the hello send threads
721 circuit
->u
.p2p
.neighbor
= NULL
;
722 send_hello_sched(circuit
, 0, TRIGGERED_IIH_DELAY
);
725 /* initializing PSNP timers */
726 if (circuit
->is_type
& IS_LEVEL_1
)
728 master
, send_l1_psnp
, circuit
,
729 isis_jitter(circuit
->psnp_interval
[0], PSNP_JITTER
),
730 &circuit
->t_send_psnp
[0]);
732 if (circuit
->is_type
& IS_LEVEL_2
)
734 master
, send_l2_psnp
, circuit
,
735 isis_jitter(circuit
->psnp_interval
[1], PSNP_JITTER
),
736 &circuit
->t_send_psnp
[1]);
738 /* unified init for circuits; ignore warnings below this level */
739 retv
= isis_sock_init(circuit
);
740 if (retv
!= ISIS_OK
) {
741 isis_circuit_down(circuit
);
745 /* initialize the circuit streams after opening connection */
746 isis_circuit_stream(circuit
, &circuit
->rcv_stream
);
747 isis_circuit_stream(circuit
, &circuit
->snd_stream
);
749 isis_circuit_prepare(circuit
);
751 circuit
->tx_queue
= isis_tx_queue_new(circuit
, send_lsp
);
753 circuit
->last_uptime
= time(NULL
);
755 if (circuit
->area
->mta
&& circuit
->area
->mta
->status
)
756 isis_link_params_update(circuit
, circuit
->interface
);
758 isis_if_ldp_sync_enable(circuit
);
761 /* send northbound notification */
762 isis_notif_if_state_change(circuit
, false);
763 #endif /* ifndef FABRICD */
768 void isis_circuit_down(struct isis_circuit
*circuit
)
771 /* send northbound notification */
772 isis_notif_if_state_change(circuit
, true);
773 #endif /* ifndef FABRICD */
775 isis_if_ldp_sync_disable(circuit
);
777 /* log adjacency changes if configured to do so */
778 if (circuit
->area
->log_adj_changes
) {
779 struct isis_adjacency
*adj
= NULL
;
780 if (circuit
->circ_type
== CIRCUIT_T_P2P
) {
781 adj
= circuit
->u
.p2p
.neighbor
;
784 adj
, adj
->adj_state
, ISIS_ADJ_DOWN
,
785 "circuit is being brought down");
786 } else if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
787 struct list
*adj_list
;
788 struct listnode
*node
;
789 if (circuit
->u
.bc
.adjdb
[0]) {
790 adj_list
= list_new();
791 isis_adj_build_up_list(circuit
->u
.bc
.adjdb
[0],
793 for (ALL_LIST_ELEMENTS_RO(adj_list
, node
, adj
))
797 "circuit is being brought down");
798 list_delete(&adj_list
);
800 if (circuit
->u
.bc
.adjdb
[1]) {
801 adj_list
= list_new();
802 isis_adj_build_up_list(circuit
->u
.bc
.adjdb
[1],
804 for (ALL_LIST_ELEMENTS_RO(adj_list
, node
, adj
))
808 "circuit is being brought down");
809 list_delete(&adj_list
);
814 /* Clear the flags for all the lsps of the circuit. */
815 isis_circuit_update_all_srmflags(circuit
, 0);
817 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
818 /* destroy neighbour lists */
819 if (circuit
->u
.bc
.lan_neighs
[0]) {
820 list_delete(&circuit
->u
.bc
.lan_neighs
[0]);
821 circuit
->u
.bc
.lan_neighs
[0] = NULL
;
823 if (circuit
->u
.bc
.lan_neighs
[1]) {
824 list_delete(&circuit
->u
.bc
.lan_neighs
[1]);
825 circuit
->u
.bc
.lan_neighs
[1] = NULL
;
827 /* destroy adjacency databases */
828 if (circuit
->u
.bc
.adjdb
[0]) {
829 circuit
->u
.bc
.adjdb
[0]->del
= isis_delete_adj
;
830 list_delete(&circuit
->u
.bc
.adjdb
[0]);
831 circuit
->u
.bc
.adjdb
[0] = NULL
;
833 if (circuit
->u
.bc
.adjdb
[1]) {
834 circuit
->u
.bc
.adjdb
[1]->del
= isis_delete_adj
;
835 list_delete(&circuit
->u
.bc
.adjdb
[1]);
836 circuit
->u
.bc
.adjdb
[1] = NULL
;
838 if (circuit
->u
.bc
.is_dr
[0]) {
839 isis_dr_resign(circuit
, 1);
840 circuit
->u
.bc
.is_dr
[0] = 0;
842 memset(circuit
->u
.bc
.l1_desig_is
, 0, ISIS_SYS_ID_LEN
+ 1);
843 if (circuit
->u
.bc
.is_dr
[1]) {
844 isis_dr_resign(circuit
, 2);
845 circuit
->u
.bc
.is_dr
[1] = 0;
847 memset(circuit
->u
.bc
.l2_desig_is
, 0, ISIS_SYS_ID_LEN
+ 1);
848 memset(circuit
->u
.bc
.snpa
, 0, ETH_ALEN
);
850 thread_cancel(&circuit
->u
.bc
.t_send_lan_hello
[0]);
851 thread_cancel(&circuit
->u
.bc
.t_send_lan_hello
[1]);
852 thread_cancel(&circuit
->u
.bc
.t_run_dr
[0]);
853 thread_cancel(&circuit
->u
.bc
.t_run_dr
[1]);
854 thread_cancel(&circuit
->u
.bc
.t_refresh_pseudo_lsp
[0]);
855 thread_cancel(&circuit
->u
.bc
.t_refresh_pseudo_lsp
[1]);
856 circuit
->lsp_regenerate_pending
[0] = 0;
857 circuit
->lsp_regenerate_pending
[1] = 0;
859 _ISIS_CLEAR_FLAG(circuit
->isis
->circuit_ids_used
,
860 circuit
->circuit_id
);
861 circuit
->circuit_id
= 0;
862 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
) {
863 isis_delete_adj(circuit
->u
.p2p
.neighbor
);
864 circuit
->u
.p2p
.neighbor
= NULL
;
865 thread_cancel(&circuit
->u
.p2p
.t_send_p2p_hello
);
869 * All adjacencies have to be gone, delete snmp list
870 * and reset snmpd idx generator
872 if (circuit
->snmp_adj_list
!= NULL
)
873 list_delete(&circuit
->snmp_adj_list
);
875 circuit
->snmp_adj_idx_gen
= 0;
877 /* Cancel all active threads */
878 thread_cancel(&circuit
->t_send_csnp
[0]);
879 thread_cancel(&circuit
->t_send_csnp
[1]);
880 thread_cancel(&circuit
->t_send_psnp
[0]);
881 thread_cancel(&circuit
->t_send_psnp
[1]);
882 thread_cancel(&circuit
->t_read
);
884 if (circuit
->tx_queue
) {
885 isis_tx_queue_free(circuit
->tx_queue
);
886 circuit
->tx_queue
= NULL
;
889 /* send one gratuitous hello to spead up convergence */
890 if (circuit
->state
== C_STATE_UP
) {
891 if (circuit
->is_type
& IS_LEVEL_1
)
892 send_hello(circuit
, IS_LEVEL_1
);
893 if (circuit
->is_type
& IS_LEVEL_2
)
894 send_hello(circuit
, IS_LEVEL_2
);
897 circuit
->upadjcount
[0] = 0;
898 circuit
->upadjcount
[1] = 0;
900 /* close the socket */
906 if (circuit
->rcv_stream
!= NULL
) {
907 stream_free(circuit
->rcv_stream
);
908 circuit
->rcv_stream
= NULL
;
911 if (circuit
->snd_stream
!= NULL
) {
912 stream_free(circuit
->snd_stream
);
913 circuit
->snd_stream
= NULL
;
916 thread_cancel_event(master
, circuit
);
921 void circuit_update_nlpids(struct isis_circuit
*circuit
)
923 circuit
->nlpids
.count
= 0;
925 if (circuit
->ip_router
) {
926 circuit
->nlpids
.nlpids
[0] = NLPID_IP
;
927 circuit
->nlpids
.count
++;
929 if (circuit
->ipv6_router
) {
930 circuit
->nlpids
.nlpids
[circuit
->nlpids
.count
] = NLPID_IPV6
;
931 circuit
->nlpids
.count
++;
936 void isis_circuit_print_vty(struct isis_circuit
*circuit
, struct vty
*vty
,
939 if (detail
== ISIS_UI_LEVEL_BRIEF
) {
940 vty_out(vty
, " %-12s", circuit
->interface
->name
);
941 vty_out(vty
, "0x%-7x", circuit
->circuit_id
);
942 vty_out(vty
, "%-9s", circuit_state2string(circuit
->state
));
943 vty_out(vty
, "%-9s", circuit_type2string(circuit
->circ_type
));
944 vty_out(vty
, "%-9s", circuit_t2string(circuit
->is_type
));
948 if (detail
== ISIS_UI_LEVEL_DETAIL
) {
949 struct listnode
*node
;
950 struct prefix
*ip_addr
;
952 vty_out(vty
, " Interface: %s", circuit
->interface
->name
);
953 vty_out(vty
, ", State: %s",
954 circuit_state2string(circuit
->state
));
955 if (circuit
->is_passive
)
956 vty_out(vty
, ", Passive");
958 vty_out(vty
, ", Active");
959 vty_out(vty
, ", Circuit Id: 0x%x", circuit
->circuit_id
);
961 vty_out(vty
, " Type: %s",
962 circuit_type2string(circuit
->circ_type
));
963 vty_out(vty
, ", Level: %s", circuit_t2string(circuit
->is_type
));
964 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
)
965 vty_out(vty
, ", SNPA: %-10s",
966 snpa_print(circuit
->u
.bc
.snpa
));
968 if (circuit
->is_type
& IS_LEVEL_1
) {
969 vty_out(vty
, " Level-1 Information:\n");
970 if (circuit
->area
->newmetric
)
971 vty_out(vty
, " Metric: %d",
972 circuit
->te_metric
[0]);
974 vty_out(vty
, " Metric: %d",
976 if (!circuit
->is_passive
) {
977 vty_out(vty
, ", Active neighbors: %u\n",
978 circuit
->upadjcount
[0]);
980 " Hello interval: %u, Holddown count: %u %s\n",
981 circuit
->hello_interval
[0],
982 circuit
->hello_multiplier
[0],
983 (circuit
->pad_hellos
? "(pad)"
986 " CNSP interval: %u, PSNP interval: %u\n",
987 circuit
->csnp_interval
[0],
988 circuit
->psnp_interval
[0]);
989 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
)
991 " LAN Priority: %u, %s\n",
992 circuit
->priority
[0],
993 (circuit
->u
.bc
.is_dr
[0]
1000 if (circuit
->is_type
& IS_LEVEL_2
) {
1001 vty_out(vty
, " Level-2 Information:\n");
1002 if (circuit
->area
->newmetric
)
1003 vty_out(vty
, " Metric: %d",
1004 circuit
->te_metric
[1]);
1006 vty_out(vty
, " Metric: %d",
1007 circuit
->metric
[1]);
1008 if (!circuit
->is_passive
) {
1009 vty_out(vty
, ", Active neighbors: %u\n",
1010 circuit
->upadjcount
[1]);
1012 " Hello interval: %u, Holddown count: %u %s\n",
1013 circuit
->hello_interval
[1],
1014 circuit
->hello_multiplier
[1],
1015 (circuit
->pad_hellos
? "(pad)"
1018 " CNSP interval: %u, PSNP interval: %u\n",
1019 circuit
->csnp_interval
[1],
1020 circuit
->psnp_interval
[1]);
1021 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
)
1023 " LAN Priority: %u, %s\n",
1024 circuit
->priority
[1],
1025 (circuit
->u
.bc
.is_dr
[1]
1032 if (circuit
->ip_addrs
&& listcount(circuit
->ip_addrs
) > 0) {
1033 vty_out(vty
, " IP Prefix(es):\n");
1034 for (ALL_LIST_ELEMENTS_RO(circuit
->ip_addrs
, node
,
1036 vty_out(vty
, " %pFX\n", ip_addr
);
1038 if (circuit
->ipv6_link
&& listcount(circuit
->ipv6_link
) > 0) {
1039 vty_out(vty
, " IPv6 Link-Locals:\n");
1040 for (ALL_LIST_ELEMENTS_RO(circuit
->ipv6_link
, node
,
1042 vty_out(vty
, " %pFX\n", ip_addr
);
1044 if (circuit
->ipv6_non_link
1045 && listcount(circuit
->ipv6_non_link
) > 0) {
1046 vty_out(vty
, " IPv6 Prefixes:\n");
1047 for (ALL_LIST_ELEMENTS_RO(circuit
->ipv6_non_link
, node
,
1049 vty_out(vty
, " %pFX\n", ip_addr
);
1058 DEFINE_HOOK(isis_circuit_config_write
,
1059 (struct isis_circuit
*circuit
, struct vty
*vty
),
1062 static int isis_interface_config_write(struct vty
*vty
)
1064 struct vrf
*vrf
= vrf_lookup_by_id(VRF_DEFAULT
);
1066 struct interface
*ifp
;
1067 struct isis_circuit
*circuit
;
1070 FOR_ALL_INTERFACES (vrf
, ifp
) {
1072 if_vty_config_start(vty
, ifp
);
1076 vty_out(vty
, " description %s\n", ifp
->desc
);
1081 circuit
= circuit_scan_by_ifp(ifp
);
1082 if (circuit
== NULL
)
1084 if (circuit
->ip_router
) {
1085 vty_out(vty
, " ip router " PROTO_NAME
" %s\n",
1089 if (circuit
->is_passive
) {
1090 vty_out(vty
, " " PROTO_NAME
" passive\n");
1093 if (circuit
->circ_type_config
== CIRCUIT_T_P2P
) {
1094 vty_out(vty
, " " PROTO_NAME
" network point-to-point\n");
1097 if (circuit
->ipv6_router
) {
1098 vty_out(vty
, " ipv6 router " PROTO_NAME
" %s\n",
1103 /* ISIS - circuit type */
1105 if (circuit
->is_type
== IS_LEVEL_1
) {
1106 vty_out(vty
, " " PROTO_NAME
" circuit-type level-1\n");
1109 if (circuit
->is_type
== IS_LEVEL_2
) {
1111 " " PROTO_NAME
" circuit-type level-2-only\n");
1117 /* ISIS - CSNP interval */
1118 if (circuit
->csnp_interval
[0]
1119 == circuit
->csnp_interval
[1]) {
1120 if (circuit
->csnp_interval
[0]
1121 != DEFAULT_CSNP_INTERVAL
) {
1122 vty_out(vty
, " " PROTO_NAME
" csnp-interval %d\n",
1123 circuit
->csnp_interval
[0]);
1127 for (i
= 0; i
< 2; i
++) {
1128 if (circuit
->csnp_interval
[i
]
1129 != DEFAULT_CSNP_INTERVAL
) {
1131 " " PROTO_NAME
" csnp-interval %d level-%d\n",
1132 circuit
->csnp_interval
1140 /* ISIS - PSNP interval */
1141 if (circuit
->psnp_interval
[0]
1142 == circuit
->psnp_interval
[1]) {
1143 if (circuit
->psnp_interval
[0]
1144 != DEFAULT_PSNP_INTERVAL
) {
1145 vty_out(vty
, " " PROTO_NAME
" psnp-interval %d\n",
1146 circuit
->psnp_interval
[0]);
1150 for (i
= 0; i
< 2; i
++) {
1151 if (circuit
->psnp_interval
[i
]
1152 != DEFAULT_PSNP_INTERVAL
) {
1154 " " PROTO_NAME
" psnp-interval %d level-%d\n",
1155 circuit
->psnp_interval
1163 /* ISIS - Hello padding - Defaults to true so only
1164 * display if false */
1165 if (circuit
->pad_hellos
== 0) {
1166 vty_out(vty
, " no " PROTO_NAME
" hello padding\n");
1170 if (circuit
->disable_threeway_adj
) {
1171 vty_out(vty
, " no isis three-way-handshake\n");
1175 /* ISIS - Hello interval */
1176 if (circuit
->hello_interval
[0]
1177 == circuit
->hello_interval
[1]) {
1178 if (circuit
->hello_interval
[0]
1179 != DEFAULT_HELLO_INTERVAL
) {
1181 " " PROTO_NAME
" hello-interval %d\n",
1182 circuit
->hello_interval
[0]);
1186 for (i
= 0; i
< 2; i
++) {
1187 if (circuit
->hello_interval
[i
]
1188 != DEFAULT_HELLO_INTERVAL
) {
1190 " " PROTO_NAME
" hello-interval %d level-%d\n",
1191 circuit
->hello_interval
1199 /* ISIS - Hello Multiplier */
1200 if (circuit
->hello_multiplier
[0]
1201 == circuit
->hello_multiplier
[1]) {
1202 if (circuit
->hello_multiplier
[0]
1203 != DEFAULT_HELLO_MULTIPLIER
) {
1205 " " PROTO_NAME
" hello-multiplier %d\n",
1206 circuit
->hello_multiplier
[0]);
1210 for (i
= 0; i
< 2; i
++) {
1211 if (circuit
->hello_multiplier
[i
]
1212 != DEFAULT_HELLO_MULTIPLIER
) {
1214 " " PROTO_NAME
" hello-multiplier %d level-%d\n",
1215 circuit
->hello_multiplier
1223 /* ISIS - Priority */
1224 if (circuit
->priority
[0] == circuit
->priority
[1]) {
1225 if (circuit
->priority
[0] != DEFAULT_PRIORITY
) {
1226 vty_out(vty
, " " PROTO_NAME
" priority %d\n",
1227 circuit
->priority
[0]);
1231 for (i
= 0; i
< 2; i
++) {
1232 if (circuit
->priority
[i
]
1233 != DEFAULT_PRIORITY
) {
1235 " " PROTO_NAME
" priority %d level-%d\n",
1236 circuit
->priority
[i
],
1244 if (circuit
->te_metric
[0] == circuit
->te_metric
[1]) {
1245 if (circuit
->te_metric
[0]
1246 != DEFAULT_CIRCUIT_METRIC
) {
1247 vty_out(vty
, " " PROTO_NAME
" metric %d\n",
1248 circuit
->te_metric
[0]);
1252 for (i
= 0; i
< 2; i
++) {
1253 if (circuit
->te_metric
[i
]
1254 != DEFAULT_CIRCUIT_METRIC
) {
1256 " " PROTO_NAME
" metric %d level-%d\n",
1257 circuit
->te_metric
[i
],
1263 if (circuit
->passwd
.type
== ISIS_PASSWD_TYPE_HMAC_MD5
) {
1264 vty_out(vty
, " " PROTO_NAME
" password md5 %s\n",
1265 circuit
->passwd
.passwd
);
1267 } else if (circuit
->passwd
.type
1268 == ISIS_PASSWD_TYPE_CLEARTXT
) {
1269 vty_out(vty
, " " PROTO_NAME
" password clear %s\n",
1270 circuit
->passwd
.passwd
);
1273 if (circuit
->bfd_config
.enabled
) {
1274 vty_out(vty
, " " PROTO_NAME
" bfd\n");
1277 write
+= hook_call(isis_circuit_config_write
,
1280 if_vty_config_end(vty
);
1285 #endif /* ifdef FABRICD */
1287 void isis_circuit_af_set(struct isis_circuit
*circuit
, bool ip_router
,
1290 struct isis_area
*area
= circuit
->area
;
1291 int old_ipr
= circuit
->ip_router
;
1292 int old_ipv6r
= circuit
->ipv6_router
;
1294 /* is there something to do? */
1295 if (old_ipr
== ip_router
&& old_ipv6r
== ipv6_router
)
1298 circuit
->ip_router
= ip_router
;
1299 circuit
->ipv6_router
= ipv6_router
;
1300 circuit_update_nlpids(circuit
);
1303 area
->ip_circuits
+= ip_router
- old_ipr
;
1304 area
->ipv6_circuits
+= ipv6_router
- old_ipv6r
;
1306 if (ip_router
|| ipv6_router
)
1307 lsp_regenerate_schedule(area
, circuit
->is_type
, 0);
1311 ferr_r
isis_circuit_passive_set(struct isis_circuit
*circuit
, bool passive
)
1313 if (circuit
->is_passive
== passive
)
1316 if (if_is_loopback(circuit
->interface
) && !passive
)
1317 return ferr_cfg_invalid("loopback is always passive");
1319 if (circuit
->state
!= C_STATE_UP
) {
1320 circuit
->is_passive
= passive
;
1322 struct isis_area
*area
= circuit
->area
;
1323 isis_csm_state_change(ISIS_DISABLE
, circuit
, area
);
1324 circuit
->is_passive
= passive
;
1325 isis_csm_state_change(ISIS_ENABLE
, circuit
, area
);
1331 ferr_r
isis_circuit_metric_set(struct isis_circuit
*circuit
, int level
,
1334 assert(level
== IS_LEVEL_1
|| level
== IS_LEVEL_2
);
1335 if (metric
> MAX_WIDE_LINK_METRIC
)
1336 return ferr_cfg_invalid("metric %d too large for wide metric",
1338 if (circuit
->area
&& circuit
->area
->oldmetric
1339 && metric
> MAX_NARROW_LINK_METRIC
)
1340 return ferr_cfg_invalid("metric %d too large for narrow metric",
1343 /* inform ldp-sync of metric change
1344 * if ldp-sync is running need to save metric
1345 * and restore new values after ldp-sync completion.
1347 if (isis_ldp_sync_if_metric_config(circuit
, level
, metric
)) {
1348 circuit
->te_metric
[level
- 1] = metric
;
1349 circuit
->metric
[level
- 1] = metric
;
1351 lsp_regenerate_schedule(circuit
->area
, level
, 0);
1356 ferr_r
isis_circuit_passwd_unset(struct isis_circuit
*circuit
)
1358 memset(&circuit
->passwd
, 0, sizeof(circuit
->passwd
));
1362 ferr_r
isis_circuit_passwd_set(struct isis_circuit
*circuit
,
1363 uint8_t passwd_type
, const char *passwd
)
1368 return ferr_code_bug("no circuit password given");
1370 len
= strlen(passwd
);
1372 return ferr_code_bug(
1373 "circuit password too long (max 254 chars)");
1375 circuit
->passwd
.len
= len
;
1376 strlcpy((char *)circuit
->passwd
.passwd
, passwd
,
1377 sizeof(circuit
->passwd
.passwd
));
1378 circuit
->passwd
.type
= passwd_type
;
1382 ferr_r
isis_circuit_passwd_cleartext_set(struct isis_circuit
*circuit
,
1385 return isis_circuit_passwd_set(circuit
, ISIS_PASSWD_TYPE_CLEARTXT
,
1389 ferr_r
isis_circuit_passwd_hmac_md5_set(struct isis_circuit
*circuit
,
1392 return isis_circuit_passwd_set(circuit
, ISIS_PASSWD_TYPE_HMAC_MD5
,
1396 void isis_circuit_circ_type_set(struct isis_circuit
*circuit
, int circ_type
)
1398 if (circuit
->circ_type
== circ_type
)
1401 if (circuit
->state
!= C_STATE_UP
) {
1402 circuit
->circ_type
= circ_type
;
1403 circuit
->circ_type_config
= circ_type
;
1405 struct isis_area
*area
= circuit
->area
;
1407 isis_csm_state_change(ISIS_DISABLE
, circuit
, area
);
1408 circuit
->circ_type
= circ_type
;
1409 circuit
->circ_type_config
= circ_type
;
1410 isis_csm_state_change(ISIS_ENABLE
, circuit
, area
);
1414 int isis_circuit_mt_enabled_set(struct isis_circuit
*circuit
, uint16_t mtid
,
1417 struct isis_circuit_mt_setting
*setting
;
1419 setting
= circuit_get_mt_setting(circuit
, mtid
);
1420 if (setting
->enabled
!= enabled
) {
1421 setting
->enabled
= enabled
;
1423 lsp_regenerate_schedule(circuit
->area
,
1424 IS_LEVEL_1
| IS_LEVEL_2
, 0);
1430 int isis_if_new_hook(struct interface
*ifp
)
1435 int isis_if_delete_hook(struct interface
*ifp
)
1438 isis_circuit_del(ifp
->info
);
1443 static int isis_ifp_create(struct interface
*ifp
)
1445 struct isis_circuit
*circuit
= ifp
->info
;
1448 isis_circuit_enable(circuit
);
1450 hook_call(isis_if_new_hook
, ifp
);
1455 static int isis_ifp_up(struct interface
*ifp
)
1457 struct isis_circuit
*circuit
= ifp
->info
;
1460 isis_csm_state_change(IF_UP_FROM_Z
, circuit
, ifp
);
1465 static int isis_ifp_down(struct interface
*ifp
)
1467 struct isis_circuit
*circuit
= ifp
->info
;
1470 isis_csm_state_change(IF_DOWN_FROM_Z
, circuit
, ifp
);
1472 SET_FLAG(circuit
->flags
, ISIS_CIRCUIT_FLAPPED_AFTER_SPF
);
1478 static int isis_ifp_destroy(struct interface
*ifp
)
1480 struct isis_circuit
*circuit
= ifp
->info
;
1483 isis_circuit_disable(circuit
);
1488 void isis_circuit_init(void)
1490 /* Initialize Zebra interface data structure */
1491 hook_register_prio(if_add
, 0, isis_if_new_hook
);
1492 hook_register_prio(if_del
, 0, isis_if_delete_hook
);
1494 /* Install interface node */
1496 if_cmd_init(isis_interface_config_write
);
1498 if_cmd_init_default();
1500 if_zapi_callbacks(isis_ifp_create
, isis_ifp_up
,
1501 isis_ifp_down
, isis_ifp_destroy
);