]>
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/isis_constants.h"
36 #include "isisd/isis_common.h"
37 #include "isisd/isis_flags.h"
38 #include "isisd/isis_circuit.h"
39 #include "isisd/isis_lsp.h"
40 #include "isisd/isis_pdu.h"
41 #include "isisd/isis_network.h"
42 #include "isisd/isis_misc.h"
43 #include "isisd/isis_constants.h"
44 #include "isisd/isis_adjacency.h"
45 #include "isisd/isis_dr.h"
46 #include "isisd/isisd.h"
47 #include "isisd/isis_csm.h"
48 #include "isisd/isis_events.h"
49 #include "isisd/isis_spf.h"
50 #include "isisd/isis_errors.h"
52 void isis_event_circuit_state_change(struct isis_circuit
*circuit
,
53 struct isis_area
*area
, int up
)
55 area
->circuit_state_changes
++;
58 zlog_debug("ISIS-Evt (%s) circuit %s", area
->area_tag
,
62 * Regenerate LSPs this affects
64 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
69 static void circuit_commence_level(struct isis_circuit
*circuit
, int level
)
73 "ISIS-Evt (%s) circuit %u on iface %s commencing on L%d",
74 circuit
->area
->area_tag
, circuit
->circuit_id
,
75 circuit
->interface
->name
, level
);
77 if (!circuit
->is_passive
) {
79 thread_add_timer(master
, send_l1_psnp
, circuit
,
80 isis_jitter(circuit
->psnp_interval
[0],
82 &circuit
->t_send_psnp
[0]);
84 thread_add_timer(master
, send_l2_psnp
, circuit
,
85 isis_jitter(circuit
->psnp_interval
[1],
87 &circuit
->t_send_psnp
[1]);
91 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
92 thread_add_timer(master
, isis_run_dr
,
93 &circuit
->level_arg
[level
- 1],
94 2 * circuit
->hello_interval
[level
- 1],
95 &circuit
->u
.bc
.t_run_dr
[level
- 1]);
97 send_hello_sched(circuit
, level
, TRIGGERED_IIH_DELAY
);
98 circuit
->u
.bc
.lan_neighs
[level
- 1] = list_new();
102 static void circuit_resign_level(struct isis_circuit
*circuit
, int level
)
108 "ISIS-Evt (%s) circuit %u on iface %s resigning on L%d",
109 circuit
->area
->area_tag
, circuit
->circuit_id
,
110 circuit
->interface
->name
, level
);
112 THREAD_TIMER_OFF(circuit
->t_send_csnp
[idx
]);
113 THREAD_TIMER_OFF(circuit
->t_send_psnp
[idx
]);
115 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
116 THREAD_TIMER_OFF(circuit
->u
.bc
.t_send_lan_hello
[idx
]);
117 THREAD_TIMER_OFF(circuit
->u
.bc
.t_run_dr
[idx
]);
118 THREAD_TIMER_OFF(circuit
->u
.bc
.t_refresh_pseudo_lsp
[idx
]);
119 circuit
->lsp_regenerate_pending
[idx
] = 0;
120 circuit
->u
.bc
.run_dr_elect
[idx
] = 0;
121 circuit
->u
.bc
.is_dr
[idx
] = 0;
122 if (circuit
->u
.bc
.lan_neighs
[idx
] != NULL
)
123 list_delete(&circuit
->u
.bc
.lan_neighs
[idx
]);
129 void isis_circuit_is_type_set(struct isis_circuit
*circuit
, int newtype
)
131 if (circuit
->state
!= C_STATE_UP
) {
132 circuit
->is_type
= newtype
;
137 zlog_debug("ISIS-Evt (%s) circuit type change %s -> %s",
138 circuit
->area
->area_tag
,
139 circuit_t2string(circuit
->is_type
),
140 circuit_t2string(newtype
));
142 if (circuit
->is_type
== newtype
)
143 return; /* No change */
145 if (!(newtype
& circuit
->area
->is_type
)) {
148 "ISIS-Evt (%s) circuit type change - invalid level %s because area is %s",
149 circuit
->area
->area_tag
, circuit_t2string(newtype
),
150 circuit_t2string(circuit
->area
->is_type
));
154 if (!circuit
->is_passive
) {
155 switch (circuit
->is_type
) {
157 if (newtype
== IS_LEVEL_2
)
158 circuit_resign_level(circuit
, 1);
159 circuit_commence_level(circuit
, 2);
161 case IS_LEVEL_1_AND_2
:
162 if (newtype
== IS_LEVEL_1
)
163 circuit_resign_level(circuit
, 2);
165 circuit_resign_level(circuit
, 1);
168 if (newtype
== IS_LEVEL_1
)
169 circuit_resign_level(circuit
, 2);
170 circuit_commence_level(circuit
, 1);
177 circuit
->is_type
= newtype
;
178 lsp_regenerate_schedule(circuit
->area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
183 /* 04/18/2002 by Gwak. */
184 /**************************************************************************
186 * EVENTS for LSP generation
188 * 1) an Adajacency or Circuit Up/Down event
189 * 2) a chnage in Circuit metric
190 * 3) a change in Reachable Address metric
191 * 4) a change in manualAreaAddresses
192 * 5) a change in systemID
193 * 6) a change in DIS status
194 * 7) a chnage in the waiting status
196 * ***********************************************************************
198 * current support event
200 * 1) Adjacency Up/Down event
201 * 6) a change in DIS status
203 * ***********************************************************************/
205 /* events supporting code */
207 int isis_event_dis_status_change(struct thread
*thread
)
209 struct isis_circuit
*circuit
;
211 circuit
= THREAD_ARG(thread
);
213 /* invalid arguments */
214 if (!circuit
|| !circuit
->area
)
217 zlog_debug("ISIS-Evt (%s) DIS status change",
218 circuit
->area
->area_tag
);
220 /* LSP generation again */
221 lsp_regenerate_schedule(circuit
->area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
226 void isis_event_auth_failure(char *area_tag
, const char *error_string
,
230 zlog_debug("ISIS-Evt (%s) Authentication failure %s from %s",
231 area_tag
, error_string
, sysid_print(sysid
));