]>
git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_events.c
2 * IS-IS Rout(e)ing protocol - isis_events.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
35 #include "isisd/dict.h"
36 #include "isisd/isis_constants.h"
37 #include "isisd/isis_common.h"
38 #include "isisd/isis_flags.h"
39 #include "isisd/isis_circuit.h"
40 #include "isisd/isis_lsp.h"
41 #include "isisd/isis_pdu.h"
42 #include "isisd/isis_network.h"
43 #include "isisd/isis_misc.h"
44 #include "isisd/isis_constants.h"
45 #include "isisd/isis_adjacency.h"
46 #include "isisd/isis_dr.h"
47 #include "isisd/isisd.h"
48 #include "isisd/isis_csm.h"
49 #include "isisd/isis_events.h"
50 #include "isisd/isis_spf.h"
52 /* debug isis-spf spf-events
53 4w4d: ISIS-Spf (tlt): L2 SPF needed, new adjacency, from 0x609229F4
54 4w4d: ISIS-Spf (tlt): L2, 0000.0000.0042.01-00 TLV contents changed, code 0x2
55 4w4d: ISIS-Spf (tlt): L2, new LSP 0 DEAD.BEEF.0043.00-00
56 4w5d: ISIS-Spf (tlt): L1 SPF needed, periodic SPF, from 0x6091C844
57 4w5d: ISIS-Spf (tlt): L2 SPF needed, periodic SPF, from 0x6091C844
60 void isis_event_circuit_state_change(struct isis_circuit
*circuit
,
61 struct isis_area
*area
, int up
)
63 area
->circuit_state_changes
++;
65 if (isis
->debugs
& DEBUG_EVENTS
)
66 zlog_debug("ISIS-Evt (%s) circuit %s", area
->area_tag
,
70 * Regenerate LSPs this affects
72 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
77 static void circuit_commence_level(struct isis_circuit
*circuit
, int level
)
80 if (!circuit
->is_passive
)
81 thread_add_timer(master
, send_l1_psnp
, circuit
,
82 isis_jitter(circuit
->psnp_interval
[0],
84 &circuit
->t_send_psnp
[0]);
86 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
87 thread_add_timer(master
, isis_run_dr_l1
, circuit
,
88 2 * circuit
->hello_interval
[0],
89 &circuit
->u
.bc
.t_run_dr
[0]);
91 thread_add_timer(master
, send_lan_l1_hello
, circuit
,
92 isis_jitter(circuit
->hello_interval
[0],
94 &circuit
->u
.bc
.t_send_lan_hello
[0]);
96 circuit
->u
.bc
.lan_neighs
[0] = list_new();
99 if (!circuit
->is_passive
)
100 thread_add_timer(master
, send_l2_psnp
, circuit
,
101 isis_jitter(circuit
->psnp_interval
[1],
103 &circuit
->t_send_psnp
[1]);
105 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
106 thread_add_timer(master
, isis_run_dr_l2
, circuit
,
107 2 * circuit
->hello_interval
[1],
108 &circuit
->u
.bc
.t_run_dr
[1]);
110 thread_add_timer(master
, send_lan_l2_hello
, circuit
,
111 isis_jitter(circuit
->hello_interval
[1],
113 &circuit
->u
.bc
.t_send_lan_hello
[1]);
115 circuit
->u
.bc
.lan_neighs
[1] = list_new();
122 static void circuit_resign_level(struct isis_circuit
*circuit
, int level
)
126 THREAD_TIMER_OFF(circuit
->t_send_csnp
[idx
]);
127 THREAD_TIMER_OFF(circuit
->t_send_psnp
[idx
]);
129 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
130 THREAD_TIMER_OFF(circuit
->u
.bc
.t_send_lan_hello
[idx
]);
131 THREAD_TIMER_OFF(circuit
->u
.bc
.t_run_dr
[idx
]);
132 THREAD_TIMER_OFF(circuit
->u
.bc
.t_refresh_pseudo_lsp
[idx
]);
133 circuit
->lsp_regenerate_pending
[idx
] = 0;
134 circuit
->u
.bc
.run_dr_elect
[idx
] = 0;
135 if (circuit
->u
.bc
.lan_neighs
[idx
] != NULL
)
136 list_delete_and_null(&circuit
->u
.bc
.lan_neighs
[idx
]);
142 void isis_circuit_is_type_set(struct isis_circuit
*circuit
, int newtype
)
144 if (circuit
->state
!= C_STATE_UP
) {
145 circuit
->is_type
= newtype
;
149 if (isis
->debugs
& DEBUG_EVENTS
)
150 zlog_debug("ISIS-Evt (%s) circuit type change %s -> %s",
151 circuit
->area
->area_tag
,
152 circuit_t2string(circuit
->is_type
),
153 circuit_t2string(newtype
));
155 if (circuit
->is_type
== newtype
)
156 return; /* No change */
158 if (!(newtype
& circuit
->area
->is_type
)) {
160 "ISIS-Evt (%s) circuit type change - invalid level %s because"
162 circuit
->area
->area_tag
, circuit_t2string(newtype
),
163 circuit_t2string(circuit
->area
->is_type
));
167 if (!circuit
->is_passive
) {
168 switch (circuit
->is_type
) {
170 if (newtype
== IS_LEVEL_2
)
171 circuit_resign_level(circuit
, 1);
172 circuit_commence_level(circuit
, 2);
174 case IS_LEVEL_1_AND_2
:
175 if (newtype
== IS_LEVEL_1
)
176 circuit_resign_level(circuit
, 2);
178 circuit_resign_level(circuit
, 1);
181 if (newtype
== IS_LEVEL_1
)
182 circuit_resign_level(circuit
, 2);
183 circuit_commence_level(circuit
, 1);
190 circuit
->is_type
= newtype
;
191 lsp_regenerate_schedule(circuit
->area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
196 /* 04/18/2002 by Gwak. */
197 /**************************************************************************
199 * EVENTS for LSP generation
201 * 1) an Adajacency or Circuit Up/Down event
202 * 2) a chnage in Circuit metric
203 * 3) a change in Reachable Address metric
204 * 4) a change in manualAreaAddresses
205 * 5) a change in systemID
206 * 6) a change in DIS status
207 * 7) a chnage in the waiting status
209 * ***********************************************************************
211 * current support event
213 * 1) Adjacency Up/Down event
214 * 6) a change in DIS status
216 * ***********************************************************************/
218 void isis_event_adjacency_state_change(struct isis_adjacency
*adj
, int newstate
)
220 /* adjacency state change event.
221 * - the only proto-type was supported */
223 /* invalid arguments */
224 if (!adj
|| !adj
->circuit
|| !adj
->circuit
->area
)
227 if (isis
->debugs
& DEBUG_EVENTS
)
228 zlog_debug("ISIS-Evt (%s) Adjacency State change",
229 adj
->circuit
->area
->area_tag
);
231 /* LSP generation again */
232 lsp_regenerate_schedule(adj
->circuit
->area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
237 /* events supporting code */
239 int isis_event_dis_status_change(struct thread
*thread
)
241 struct isis_circuit
*circuit
;
243 circuit
= THREAD_ARG(thread
);
245 /* invalid arguments */
246 if (!circuit
|| !circuit
->area
)
248 if (isis
->debugs
& DEBUG_EVENTS
)
249 zlog_debug("ISIS-Evt (%s) DIS status change",
250 circuit
->area
->area_tag
);
252 /* LSP generation again */
253 lsp_regenerate_schedule(circuit
->area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
258 void isis_event_auth_failure(char *area_tag
, const char *error_string
,
261 if (isis
->debugs
& DEBUG_EVENTS
)
262 zlog_debug("ISIS-Evt (%s) Authentication failure %s from %s",
263 area_tag
, error_string
, sysid_print(sysid
));