]>
git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_events.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * IS-IS Rout(e)ing protocol - isis_events.h
5 * Copyright (C) 2001,2002 Sampo Saaristo
6 * Tampere University of Technology
7 * Institute of Communications Engineering
22 #include "isisd/isis_constants.h"
23 #include "isisd/isis_common.h"
24 #include "isisd/isis_flags.h"
25 #include "isisd/isis_circuit.h"
26 #include "isisd/isis_lsp.h"
27 #include "isisd/isis_pdu.h"
28 #include "isisd/isis_network.h"
29 #include "isisd/isis_misc.h"
30 #include "isisd/isis_constants.h"
31 #include "isisd/isis_adjacency.h"
32 #include "isisd/isis_dr.h"
33 #include "isisd/isisd.h"
34 #include "isisd/isis_csm.h"
35 #include "isisd/isis_events.h"
36 #include "isisd/isis_spf.h"
37 #include "isisd/isis_errors.h"
39 void isis_event_circuit_state_change(struct isis_circuit
*circuit
,
40 struct isis_area
*area
, int up
)
42 area
->circuit_state_changes
++;
45 zlog_debug("ISIS-Evt (%s) circuit %s", area
->area_tag
,
49 * Regenerate LSPs this affects
51 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
56 static void circuit_commence_level(struct isis_circuit
*circuit
, int level
)
60 "ISIS-Evt (%s) circuit %u on iface %s commencing on L%d",
61 circuit
->area
->area_tag
, circuit
->circuit_id
,
62 circuit
->interface
->name
, level
);
64 if (!circuit
->is_passive
) {
66 thread_add_timer(master
, send_l1_psnp
, circuit
,
67 isis_jitter(circuit
->psnp_interval
[0],
69 &circuit
->t_send_psnp
[0]);
71 thread_add_timer(master
, send_l2_psnp
, circuit
,
72 isis_jitter(circuit
->psnp_interval
[1],
74 &circuit
->t_send_psnp
[1]);
78 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
79 thread_add_timer(master
, isis_run_dr
,
80 &circuit
->level_arg
[level
- 1],
81 2 * circuit
->hello_interval
[level
- 1],
82 &circuit
->u
.bc
.t_run_dr
[level
- 1]);
84 send_hello_sched(circuit
, level
, TRIGGERED_IIH_DELAY
);
85 circuit
->u
.bc
.lan_neighs
[level
- 1] = list_new();
89 static void circuit_resign_level(struct isis_circuit
*circuit
, int level
)
95 "ISIS-Evt (%s) circuit %u on iface %s resigning on L%d",
96 circuit
->area
->area_tag
, circuit
->circuit_id
,
97 circuit
->interface
->name
, level
);
99 THREAD_OFF(circuit
->t_send_csnp
[idx
]);
100 THREAD_OFF(circuit
->t_send_psnp
[idx
]);
102 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
103 THREAD_OFF(circuit
->u
.bc
.t_send_lan_hello
[idx
]);
104 THREAD_OFF(circuit
->u
.bc
.t_run_dr
[idx
]);
105 THREAD_OFF(circuit
->u
.bc
.t_refresh_pseudo_lsp
[idx
]);
106 circuit
->lsp_regenerate_pending
[idx
] = 0;
107 circuit
->u
.bc
.run_dr_elect
[idx
] = 0;
108 circuit
->u
.bc
.is_dr
[idx
] = 0;
109 if (circuit
->u
.bc
.lan_neighs
[idx
] != NULL
)
110 list_delete(&circuit
->u
.bc
.lan_neighs
[idx
]);
116 void isis_circuit_is_type_set(struct isis_circuit
*circuit
, int newtype
)
118 if (!circuit
->area
) {
119 circuit
->is_type
= newtype
;
124 zlog_debug("ISIS-Evt (%s) circuit type change %s -> %s",
125 circuit
->area
->area_tag
,
126 circuit_t2string(circuit
->is_type
),
127 circuit_t2string(newtype
));
129 if (circuit
->is_type
== newtype
)
130 return; /* No change */
132 if (!(newtype
& circuit
->area
->is_type
)) {
135 "ISIS-Evt (%s) circuit type change - invalid level %s because area is %s",
136 circuit
->area
->area_tag
, circuit_t2string(newtype
),
137 circuit_t2string(circuit
->area
->is_type
));
141 if (circuit
->state
!= C_STATE_UP
) {
142 circuit
->is_type
= newtype
;
146 if (!circuit
->is_passive
) {
147 switch (circuit
->is_type
) {
149 if (newtype
== IS_LEVEL_2
)
150 circuit_resign_level(circuit
, 1);
151 circuit_commence_level(circuit
, 2);
153 case IS_LEVEL_1_AND_2
:
154 if (newtype
== IS_LEVEL_1
)
155 circuit_resign_level(circuit
, 2);
157 circuit_resign_level(circuit
, 1);
160 if (newtype
== IS_LEVEL_1
)
161 circuit_resign_level(circuit
, 2);
162 circuit_commence_level(circuit
, 1);
169 circuit
->is_type
= newtype
;
170 lsp_regenerate_schedule(circuit
->area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
175 /* 04/18/2002 by Gwak. */
176 /**************************************************************************
178 * EVENTS for LSP generation
180 * 1) an Adajacency or Circuit Up/Down event
181 * 2) a chnage in Circuit metric
182 * 3) a change in Reachable Address metric
183 * 4) a change in manualAreaAddresses
184 * 5) a change in systemID
185 * 6) a change in DIS status
186 * 7) a chnage in the waiting status
188 * ***********************************************************************
190 * current support event
192 * 1) Adjacency Up/Down event
193 * 6) a change in DIS status
195 * ***********************************************************************/
197 /* events supporting code */
199 void isis_event_dis_status_change(struct thread
*thread
)
201 struct isis_circuit
*circuit
;
203 circuit
= THREAD_ARG(thread
);
205 /* invalid arguments */
206 if (!circuit
|| !circuit
->area
)
209 zlog_debug("ISIS-Evt (%s) DIS status change",
210 circuit
->area
->area_tag
);
212 /* LSP generation again */
213 lsp_regenerate_schedule(circuit
->area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
216 void isis_event_auth_failure(char *area_tag
, const char *error_string
,
220 zlog_debug("ISIS-Evt (%s) Authentication failure %s from %s",
221 area_tag
, error_string
, sysid_print(sysid
));