]>
Commit | Line | Data |
---|---|---|
2d59836a | 1 | /* |
2 | * OSPF version 2 Neighbor State Machine | |
3 | * From RFC2328 [OSPF Version 2] | |
4 | * Copyright (C) 1999, 2000 Toshiaki Takada | |
5 | * | |
6 | * This file is part of GNU Zebra. | |
7 | * | |
8 | * GNU Zebra is free software; you can redistribute it and/or modify it | |
9 | * under the terms of the GNU General Public License as published by the | |
10 | * Free Software Foundation; either version 2, or (at your option) any | |
11 | * later version. | |
12 | * | |
13 | * GNU Zebra is distributed in the hope that it will be useful, but | |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | * General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with GNU Zebra; see the file COPYING. If not, write to the Free | |
20 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
21 | * 02111-1307, USA. | |
22 | */ | |
23 | ||
24 | #include <zebra.h> | |
25 | ||
26 | #include "thread.h" | |
27 | #include "memory.h" | |
28 | #include "hash.h" | |
29 | #include "linklist.h" | |
30 | #include "prefix.h" | |
31 | #include "if.h" | |
32 | #include "table.h" | |
33 | #include "stream.h" | |
34 | #include "table.h" | |
35 | #include "log.h" | |
36 | ||
37 | #include "ospfd/ospfd.h" | |
38 | #include "ospfd/ospf_interface.h" | |
39 | #include "ospfd/ospf_ism.h" | |
40 | #include "ospfd/ospf_asbr.h" | |
41 | #include "ospfd/ospf_lsa.h" | |
42 | #include "ospfd/ospf_lsdb.h" | |
43 | #include "ospfd/ospf_neighbor.h" | |
44 | #include "ospfd/ospf_nsm.h" | |
45 | #include "ospfd/ospf_network.h" | |
46 | #include "ospfd/ospf_packet.h" | |
47 | #include "ospfd/ospf_dump.h" | |
48 | #include "ospfd/ospf_flood.h" | |
49 | #include "ospfd/ospf_abr.h" | |
5e4914c3 | 50 | #include "ospfd/ospf_snmp.h" |
2d59836a | 51 | |
d1b1cd8f PJ |
52 | static void nsm_reset_nbr (struct ospf_neighbor *); |
53 | static void nsm_clear_adj (struct ospf_neighbor *); | |
2d59836a | 54 | \f |
55 | /* OSPF NSM Timer functions. */ | |
4dadc291 | 56 | static int |
2d59836a | 57 | ospf_inactivity_timer (struct thread *thread) |
58 | { | |
59 | struct ospf_neighbor *nbr; | |
60 | ||
61 | nbr = THREAD_ARG (thread); | |
62 | nbr->t_inactivity = NULL; | |
63 | ||
64 | if (IS_DEBUG_OSPF (nsm, NSM_TIMERS)) | |
65 | zlog (NULL, LOG_DEBUG, "NSM[%s:%s]: Timer (Inactivity timer expire)", | |
66 | IF_NAME (nbr->oi), inet_ntoa (nbr->router_id)); | |
67 | ||
68 | OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_InactivityTimer); | |
69 | ||
70 | return 0; | |
71 | } | |
72 | ||
4dadc291 | 73 | static int |
2d59836a | 74 | ospf_db_desc_timer (struct thread *thread) |
75 | { | |
76 | struct ospf_interface *oi; | |
77 | struct ospf_neighbor *nbr; | |
78 | ||
79 | nbr = THREAD_ARG (thread); | |
80 | nbr->t_db_desc = NULL; | |
81 | ||
82 | oi = nbr->oi; | |
83 | ||
84 | if (IS_DEBUG_OSPF (nsm, NSM_TIMERS)) | |
2a42e285 | 85 | zlog (NULL, LOG_DEBUG, "NSM[%s:%s]: Timer (DD Retransmit timer expire)", |
2d59836a | 86 | IF_NAME (nbr->oi), inet_ntoa (nbr->src)); |
87 | ||
88 | /* resent last send DD packet. */ | |
89 | assert (nbr->last_send); | |
90 | ospf_db_desc_resend (nbr); | |
91 | ||
92 | /* DD Retransmit timer set. */ | |
93 | OSPF_NSM_TIMER_ON (nbr->t_db_desc, ospf_db_desc_timer, nbr->v_db_desc); | |
94 | ||
95 | return 0; | |
96 | } | |
97 | ||
1f2c2743 PJ |
98 | /* Hook function called after ospf NSM event is occured. |
99 | * | |
100 | * Set/clear any timers whose condition is implicit to the neighbour | |
101 | * state. There may be other timers which are set/unset according to other | |
102 | * state. | |
103 | * | |
104 | * We rely on this function to properly clear timers in lower states, | |
105 | * particularly before deleting a neighbour. | |
106 | */ | |
4dadc291 | 107 | static void |
2d59836a | 108 | nsm_timer_set (struct ospf_neighbor *nbr) |
109 | { | |
110 | switch (nbr->state) | |
111 | { | |
1f2c2743 | 112 | case NSM_Deleted: |
2d59836a | 113 | case NSM_Down: |
e55dd53b | 114 | OSPF_NSM_TIMER_OFF (nbr->t_inactivity); |
1f2c2743 | 115 | OSPF_NSM_TIMER_OFF (nbr->t_hello_reply); |
2d59836a | 116 | case NSM_Attempt: |
2d59836a | 117 | case NSM_Init: |
2d59836a | 118 | case NSM_TwoWay: |
119 | OSPF_NSM_TIMER_OFF (nbr->t_db_desc); | |
120 | OSPF_NSM_TIMER_OFF (nbr->t_ls_upd); | |
e55dd53b | 121 | OSPF_NSM_TIMER_OFF (nbr->t_ls_req); |
2d59836a | 122 | break; |
123 | case NSM_ExStart: | |
124 | OSPF_NSM_TIMER_ON (nbr->t_db_desc, ospf_db_desc_timer, nbr->v_db_desc); | |
125 | OSPF_NSM_TIMER_OFF (nbr->t_ls_upd); | |
e55dd53b | 126 | OSPF_NSM_TIMER_OFF (nbr->t_ls_req); |
2d59836a | 127 | break; |
128 | case NSM_Exchange: | |
129 | OSPF_NSM_TIMER_ON (nbr->t_ls_upd, ospf_ls_upd_timer, nbr->v_ls_upd); | |
130 | if (!IS_SET_DD_MS (nbr->dd_flags)) | |
131 | OSPF_NSM_TIMER_OFF (nbr->t_db_desc); | |
132 | break; | |
133 | case NSM_Loading: | |
2d59836a | 134 | case NSM_Full: |
2d59836a | 135 | default: |
136 | OSPF_NSM_TIMER_OFF (nbr->t_db_desc); | |
137 | break; | |
138 | } | |
139 | } | |
140 | ||
d7b0fb62 PJ |
141 | /* 10.4 of RFC2328, indicate whether an adjacency is appropriate with |
142 | * the given neighbour | |
143 | */ | |
144 | static int | |
145 | nsm_should_adj (struct ospf_neighbor *nbr) | |
146 | { | |
f7a76abf | 147 | struct ospf_interface *oi = nbr->oi; |
d7b0fb62 | 148 | |
f7a76abf | 149 | /* These network types must always form adjacencies. */ |
d7b0fb62 PJ |
150 | if (oi->type == OSPF_IFTYPE_POINTOPOINT |
151 | || oi->type == OSPF_IFTYPE_POINTOMULTIPOINT | |
f7a76abf PJ |
152 | || oi->type == OSPF_IFTYPE_VIRTUALLINK |
153 | /* Router itself is the DRouter or the BDRouter. */ | |
154 | || IPV4_ADDR_SAME (&oi->address->u.prefix4, &DR (oi)) | |
155 | || IPV4_ADDR_SAME (&oi->address->u.prefix4, &BDR (oi)) | |
156 | /* Neighboring Router is the DRouter or the BDRouter. */ | |
157 | || IPV4_ADDR_SAME (&nbr->address.u.prefix4, &DR (oi)) | |
d7b0fb62 PJ |
158 | || IPV4_ADDR_SAME (&nbr->address.u.prefix4, &BDR (oi))) |
159 | return 1; | |
160 | ||
161 | return 0; | |
162 | } | |
2d59836a | 163 | \f |
164 | /* OSPF NSM functions. */ | |
4dadc291 | 165 | static int |
2d59836a | 166 | nsm_ignore (struct ospf_neighbor *nbr) |
167 | { | |
168 | if (IS_DEBUG_OSPF (nsm, NSM_EVENTS)) | |
2a42e285 | 169 | zlog (NULL, LOG_DEBUG, "NSM[%s:%s]: nsm_ignore called", |
2d59836a | 170 | IF_NAME (nbr->oi), inet_ntoa (nbr->router_id)); |
171 | ||
172 | return 0; | |
173 | } | |
174 | ||
4dadc291 | 175 | static int |
2d59836a | 176 | nsm_hello_received (struct ospf_neighbor *nbr) |
177 | { | |
178 | /* Start or Restart Inactivity Timer. */ | |
179 | OSPF_NSM_TIMER_OFF (nbr->t_inactivity); | |
180 | ||
181 | OSPF_NSM_TIMER_ON (nbr->t_inactivity, ospf_inactivity_timer, | |
182 | nbr->v_inactivity); | |
183 | ||
184 | if (nbr->oi->type == OSPF_IFTYPE_NBMA && nbr->nbr_nbma) | |
185 | OSPF_POLL_TIMER_OFF (nbr->nbr_nbma->t_poll); | |
186 | ||
187 | return 0; | |
188 | } | |
189 | ||
4dadc291 | 190 | static int |
2d59836a | 191 | nsm_start (struct ospf_neighbor *nbr) |
192 | { | |
193 | ||
194 | nsm_reset_nbr (nbr); | |
195 | ||
196 | if (nbr->nbr_nbma) | |
197 | OSPF_POLL_TIMER_OFF (nbr->nbr_nbma->t_poll); | |
198 | ||
199 | OSPF_NSM_TIMER_OFF (nbr->t_inactivity); | |
200 | ||
201 | OSPF_NSM_TIMER_ON (nbr->t_inactivity, ospf_inactivity_timer, | |
202 | nbr->v_inactivity); | |
203 | ||
204 | return 0; | |
205 | } | |
206 | ||
4dadc291 | 207 | static int |
2d59836a | 208 | nsm_twoway_received (struct ospf_neighbor *nbr) |
209 | { | |
f7a76abf | 210 | return (nsm_should_adj (nbr) ? NSM_ExStart : NSM_TwoWay); |
2d59836a | 211 | } |
212 | ||
213 | int | |
214 | ospf_db_summary_count (struct ospf_neighbor *nbr) | |
215 | { | |
216 | return ospf_lsdb_count_all (&nbr->db_sum); | |
217 | } | |
218 | ||
219 | int | |
220 | ospf_db_summary_isempty (struct ospf_neighbor *nbr) | |
221 | { | |
222 | return ospf_lsdb_isempty (&nbr->db_sum); | |
223 | } | |
224 | ||
4dadc291 | 225 | static int |
68980084 | 226 | ospf_db_summary_add (struct ospf_neighbor *nbr, struct ospf_lsa *lsa) |
2d59836a | 227 | { |
09e4efdc | 228 | #ifdef HAVE_OPAQUE_LSA |
229 | switch (lsa->data->type) | |
230 | { | |
231 | case OSPF_OPAQUE_LINK_LSA: | |
232 | /* Exclude type-9 LSAs that does not have the same "oi" with "nbr". */ | |
233 | if (lsa->oi != nbr->oi) | |
234 | return 0; | |
235 | break; | |
236 | case OSPF_OPAQUE_AREA_LSA: | |
237 | /* | |
238 | * It is assured by the caller function "nsm_negotiation_done()" | |
239 | * that every given LSA belongs to the same area with "nbr". | |
240 | */ | |
241 | break; | |
242 | case OSPF_OPAQUE_AS_LSA: | |
243 | default: | |
244 | break; | |
245 | } | |
246 | #endif /* HAVE_OPAQUE_LSA */ | |
247 | ||
2d59836a | 248 | /* Stay away from any Local Translated Type-7 LSAs */ |
249 | if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT)) | |
250 | return 0; | |
2d59836a | 251 | |
252 | if (IS_LSA_MAXAGE (lsa)) | |
253 | ospf_ls_retransmit_add (nbr, lsa); | |
254 | else | |
255 | ospf_lsdb_add (&nbr->db_sum, lsa); | |
256 | ||
257 | return 0; | |
258 | } | |
259 | ||
260 | void | |
261 | ospf_db_summary_clear (struct ospf_neighbor *nbr) | |
262 | { | |
263 | struct ospf_lsdb *lsdb; | |
264 | int i; | |
265 | ||
266 | lsdb = &nbr->db_sum; | |
267 | for (i = OSPF_MIN_LSA; i < OSPF_MAX_LSA; i++) | |
268 | { | |
269 | struct route_table *table = lsdb->type[i].db; | |
270 | struct route_node *rn; | |
271 | ||
272 | for (rn = route_top (table); rn; rn = route_next (rn)) | |
273 | if (rn->info) | |
274 | ospf_lsdb_delete (&nbr->db_sum, rn->info); | |
275 | } | |
276 | } | |
277 | ||
278 | \f | |
279 | ||
2d59836a | 280 | /* The area link state database consists of the router-LSAs, |
281 | network-LSAs and summary-LSAs contained in the area structure, | |
68980084 | 282 | along with the AS-external-LSAs contained in the global structure. |
283 | AS-external-LSAs are omitted from a virtual neighbor's Database | |
2d59836a | 284 | summary list. AS-external-LSAs are omitted from the Database |
285 | summary list if the area has been configured as a stub. */ | |
4dadc291 | 286 | static int |
2d59836a | 287 | nsm_negotiation_done (struct ospf_neighbor *nbr) |
288 | { | |
68980084 | 289 | struct ospf_area *area = nbr->oi->area; |
290 | struct ospf_lsa *lsa; | |
291 | struct route_node *rn; | |
292 | ||
293 | LSDB_LOOP (ROUTER_LSDB (area), rn, lsa) | |
294 | ospf_db_summary_add (nbr, lsa); | |
295 | LSDB_LOOP (NETWORK_LSDB (area), rn, lsa) | |
296 | ospf_db_summary_add (nbr, lsa); | |
297 | LSDB_LOOP (SUMMARY_LSDB (area), rn, lsa) | |
298 | ospf_db_summary_add (nbr, lsa); | |
299 | LSDB_LOOP (ASBR_SUMMARY_LSDB (area), rn, lsa) | |
300 | ospf_db_summary_add (nbr, lsa); | |
2d59836a | 301 | |
2d59836a | 302 | #ifdef HAVE_OPAQUE_LSA |
303 | /* Process only if the neighbor is opaque capable. */ | |
304 | if (CHECK_FLAG (nbr->options, OSPF_OPTION_O)) | |
305 | { | |
68980084 | 306 | LSDB_LOOP (OPAQUE_LINK_LSDB (area), rn, lsa) |
307 | ospf_db_summary_add (nbr, lsa); | |
308 | LSDB_LOOP (OPAQUE_AREA_LSDB (area), rn, lsa) | |
309 | ospf_db_summary_add (nbr, lsa); | |
2d59836a | 310 | } |
311 | #endif /* HAVE_OPAQUE_LSA */ | |
312 | ||
f4833e9f | 313 | if (CHECK_FLAG (nbr->options, OSPF_OPTION_NP)) |
314 | { | |
315 | LSDB_LOOP (NSSA_LSDB (area), rn, lsa) | |
316 | ospf_db_summary_add (nbr, lsa); | |
317 | } | |
318 | ||
68980084 | 319 | if (nbr->oi->type != OSPF_IFTYPE_VIRTUALLINK |
320 | && area->external_routing == OSPF_AREA_DEFAULT) | |
321 | LSDB_LOOP (EXTERNAL_LSDB (nbr->oi->ospf), rn, lsa) | |
322 | ospf_db_summary_add (nbr, lsa); | |
2d59836a | 323 | |
324 | #ifdef HAVE_OPAQUE_LSA | |
68980084 | 325 | if (CHECK_FLAG (nbr->options, OSPF_OPTION_O) |
326 | && (nbr->oi->type != OSPF_IFTYPE_VIRTUALLINK | |
327 | && area->external_routing == OSPF_AREA_DEFAULT)) | |
328 | LSDB_LOOP (OPAQUE_AS_LSDB (nbr->oi->ospf), rn, lsa) | |
329 | ospf_db_summary_add (nbr, lsa); | |
2d59836a | 330 | #endif /* HAVE_OPAQUE_LSA */ |
331 | ||
2d59836a | 332 | return 0; |
333 | } | |
334 | ||
4dadc291 | 335 | static int |
2d59836a | 336 | nsm_exchange_done (struct ospf_neighbor *nbr) |
337 | { | |
2d59836a | 338 | if (ospf_ls_request_isempty (nbr)) |
339 | return NSM_Full; | |
340 | ||
2d59836a | 341 | /* Send Link State Request. */ |
342 | ospf_ls_req_send (nbr); | |
343 | ||
344 | return NSM_Loading; | |
345 | } | |
346 | ||
4dadc291 | 347 | static int |
2d59836a | 348 | nsm_bad_ls_req (struct ospf_neighbor *nbr) |
349 | { | |
350 | /* Clear neighbor. */ | |
351 | nsm_reset_nbr (nbr); | |
352 | ||
353 | return 0; | |
354 | } | |
355 | ||
4dadc291 | 356 | static int |
2d59836a | 357 | nsm_adj_ok (struct ospf_neighbor *nbr) |
358 | { | |
d7b0fb62 PJ |
359 | int next_state = nbr->state; |
360 | int adj = nsm_should_adj (nbr); | |
2d59836a | 361 | |
d7b0fb62 | 362 | if (nbr->state == NSM_TwoWay && adj == 1) |
2d59836a | 363 | next_state = NSM_ExStart; |
d7b0fb62 | 364 | else if (nbr->state >= NSM_ExStart && adj == 0) |
2d59836a | 365 | next_state = NSM_TwoWay; |
366 | ||
367 | return next_state; | |
368 | } | |
369 | ||
4dadc291 | 370 | static int |
2d59836a | 371 | nsm_seq_number_mismatch (struct ospf_neighbor *nbr) |
372 | { | |
373 | /* Clear neighbor. */ | |
374 | nsm_reset_nbr (nbr); | |
375 | ||
376 | return 0; | |
377 | } | |
378 | ||
4dadc291 | 379 | static int |
2d59836a | 380 | nsm_oneway_received (struct ospf_neighbor *nbr) |
381 | { | |
382 | /* Clear neighbor. */ | |
383 | nsm_reset_nbr (nbr); | |
384 | ||
385 | return 0; | |
386 | } | |
387 | ||
d1b1cd8f PJ |
388 | /* Clear adjacency related state for a neighbour, intended where nbr |
389 | * transitions from > ExStart (i.e. a Full or forming adjacency) | |
390 | * to <= ExStart. | |
391 | */ | |
392 | static void | |
393 | nsm_clear_adj (struct ospf_neighbor *nbr) | |
2d59836a | 394 | { |
395 | /* Clear Database Summary list. */ | |
396 | if (!ospf_db_summary_isempty (nbr)) | |
397 | ospf_db_summary_clear (nbr); | |
398 | ||
399 | /* Clear Link State Request list. */ | |
400 | if (!ospf_ls_request_isempty (nbr)) | |
401 | ospf_ls_request_delete_all (nbr); | |
402 | ||
403 | /* Clear Link State Retransmission list. */ | |
404 | if (!ospf_ls_retransmit_isempty (nbr)) | |
405 | ospf_ls_retransmit_clear (nbr); | |
d1b1cd8f PJ |
406 | } |
407 | ||
408 | static void | |
409 | nsm_reset_nbr (struct ospf_neighbor *nbr) | |
410 | { | |
411 | nsm_clear_adj (nbr); | |
2d59836a | 412 | |
413 | /* Cancel thread. */ | |
414 | OSPF_NSM_TIMER_OFF (nbr->t_db_desc); | |
415 | OSPF_NSM_TIMER_OFF (nbr->t_ls_req); | |
416 | OSPF_NSM_TIMER_OFF (nbr->t_ls_upd); | |
417 | OSPF_NSM_TIMER_OFF (nbr->t_hello_reply); | |
418 | ||
419 | #ifdef HAVE_OPAQUE_LSA | |
420 | if (CHECK_FLAG (nbr->options, OSPF_OPTION_O)) | |
421 | UNSET_FLAG (nbr->options, OSPF_OPTION_O); | |
422 | #endif /* HAVE_OPAQUE_LSA */ | |
423 | } | |
424 | ||
4dadc291 | 425 | static int |
2d59836a | 426 | nsm_kill_nbr (struct ospf_neighbor *nbr) |
427 | { | |
478aab98 | 428 | /* killing nbr_self is invalid */ |
478aab98 | 429 | if (nbr == nbr->oi->nbr_self) |
1f2c2743 PJ |
430 | { |
431 | assert (nbr != nbr->oi->nbr_self); | |
432 | return 0; | |
433 | } | |
478aab98 | 434 | |
2d59836a | 435 | /* Reset neighbor. */ |
436 | nsm_reset_nbr (nbr); | |
437 | ||
438 | if (nbr->oi->type == OSPF_IFTYPE_NBMA && nbr->nbr_nbma != NULL) | |
439 | { | |
440 | struct ospf_nbr_nbma *nbr_nbma = nbr->nbr_nbma; | |
441 | ||
442 | nbr_nbma->nbr = NULL; | |
443 | nbr_nbma->state_change = nbr->state_change; | |
444 | ||
445 | nbr->nbr_nbma = NULL; | |
446 | ||
447 | OSPF_POLL_TIMER_ON (nbr_nbma->t_poll, ospf_poll_timer, | |
448 | nbr_nbma->v_poll); | |
449 | ||
450 | if (IS_DEBUG_OSPF (nsm, NSM_EVENTS)) | |
2a42e285 | 451 | zlog_debug ("NSM[%s:%s]: Down (PollIntervalTimer scheduled)", |
2d59836a | 452 | IF_NAME (nbr->oi), inet_ntoa (nbr->address.u.prefix4)); |
453 | } | |
454 | ||
2d59836a | 455 | return 0; |
456 | } | |
457 | ||
4dadc291 | 458 | static int |
2d59836a | 459 | nsm_inactivity_timer (struct ospf_neighbor *nbr) |
460 | { | |
461 | /* Kill neighbor. */ | |
462 | nsm_kill_nbr (nbr); | |
463 | ||
464 | return 0; | |
465 | } | |
466 | ||
4dadc291 | 467 | static int |
2d59836a | 468 | nsm_ll_down (struct ospf_neighbor *nbr) |
469 | { | |
2d59836a | 470 | /* Kill neighbor. */ |
471 | nsm_kill_nbr (nbr); | |
472 | ||
473 | return 0; | |
474 | } | |
475 | ||
476 | /* Neighbor State Machine */ | |
477 | struct { | |
4dadc291 | 478 | int (*func) (struct ospf_neighbor *); |
2d59836a | 479 | int next_state; |
480 | } NSM [OSPF_NSM_STATE_MAX][OSPF_NSM_EVENT_MAX] = | |
481 | { | |
482 | { | |
483 | /* DependUpon: dummy state. */ | |
484 | { nsm_ignore, NSM_DependUpon }, /* NoEvent */ | |
485 | { nsm_ignore, NSM_DependUpon }, /* HelloReceived */ | |
486 | { nsm_ignore, NSM_DependUpon }, /* Start */ | |
487 | { nsm_ignore, NSM_DependUpon }, /* 2-WayReceived */ | |
488 | { nsm_ignore, NSM_DependUpon }, /* NegotiationDone */ | |
489 | { nsm_ignore, NSM_DependUpon }, /* ExchangeDone */ | |
490 | { nsm_ignore, NSM_DependUpon }, /* BadLSReq */ | |
491 | { nsm_ignore, NSM_DependUpon }, /* LoadingDone */ | |
492 | { nsm_ignore, NSM_DependUpon }, /* AdjOK? */ | |
493 | { nsm_ignore, NSM_DependUpon }, /* SeqNumberMismatch */ | |
494 | { nsm_ignore, NSM_DependUpon }, /* 1-WayReceived */ | |
495 | { nsm_ignore, NSM_DependUpon }, /* KillNbr */ | |
496 | { nsm_ignore, NSM_DependUpon }, /* InactivityTimer */ | |
497 | { nsm_ignore, NSM_DependUpon }, /* LLDown */ | |
498 | }, | |
1f2c2743 PJ |
499 | { |
500 | /* Deleted: dummy state. */ | |
501 | { nsm_ignore, NSM_Deleted }, /* NoEvent */ | |
502 | { nsm_ignore, NSM_Deleted }, /* HelloReceived */ | |
503 | { nsm_ignore, NSM_Deleted }, /* Start */ | |
504 | { nsm_ignore, NSM_Deleted }, /* 2-WayReceived */ | |
505 | { nsm_ignore, NSM_Deleted }, /* NegotiationDone */ | |
506 | { nsm_ignore, NSM_Deleted }, /* ExchangeDone */ | |
507 | { nsm_ignore, NSM_Deleted }, /* BadLSReq */ | |
508 | { nsm_ignore, NSM_Deleted }, /* LoadingDone */ | |
509 | { nsm_ignore, NSM_Deleted }, /* AdjOK? */ | |
510 | { nsm_ignore, NSM_Deleted }, /* SeqNumberMismatch */ | |
511 | { nsm_ignore, NSM_Deleted }, /* 1-WayReceived */ | |
512 | { nsm_ignore, NSM_Deleted }, /* KillNbr */ | |
513 | { nsm_ignore, NSM_Deleted }, /* InactivityTimer */ | |
514 | { nsm_ignore, NSM_Deleted }, /* LLDown */ | |
515 | }, | |
2d59836a | 516 | { |
517 | /* Down: */ | |
518 | { nsm_ignore, NSM_DependUpon }, /* NoEvent */ | |
519 | { nsm_hello_received, NSM_Init }, /* HelloReceived */ | |
520 | { nsm_start, NSM_Attempt }, /* Start */ | |
521 | { nsm_ignore, NSM_Down }, /* 2-WayReceived */ | |
522 | { nsm_ignore, NSM_Down }, /* NegotiationDone */ | |
523 | { nsm_ignore, NSM_Down }, /* ExchangeDone */ | |
524 | { nsm_ignore, NSM_Down }, /* BadLSReq */ | |
525 | { nsm_ignore, NSM_Down }, /* LoadingDone */ | |
526 | { nsm_ignore, NSM_Down }, /* AdjOK? */ | |
527 | { nsm_ignore, NSM_Down }, /* SeqNumberMismatch */ | |
528 | { nsm_ignore, NSM_Down }, /* 1-WayReceived */ | |
1f2c2743 PJ |
529 | { nsm_kill_nbr, NSM_Deleted }, /* KillNbr */ |
530 | { nsm_inactivity_timer, NSM_Deleted }, /* InactivityTimer */ | |
531 | { nsm_ll_down, NSM_Deleted }, /* LLDown */ | |
2d59836a | 532 | }, |
533 | { | |
534 | /* Attempt: */ | |
535 | { nsm_ignore, NSM_DependUpon }, /* NoEvent */ | |
536 | { nsm_hello_received, NSM_Init }, /* HelloReceived */ | |
537 | { nsm_ignore, NSM_Attempt }, /* Start */ | |
538 | { nsm_ignore, NSM_Attempt }, /* 2-WayReceived */ | |
539 | { nsm_ignore, NSM_Attempt }, /* NegotiationDone */ | |
540 | { nsm_ignore, NSM_Attempt }, /* ExchangeDone */ | |
541 | { nsm_ignore, NSM_Attempt }, /* BadLSReq */ | |
542 | { nsm_ignore, NSM_Attempt }, /* LoadingDone */ | |
543 | { nsm_ignore, NSM_Attempt }, /* AdjOK? */ | |
544 | { nsm_ignore, NSM_Attempt }, /* SeqNumberMismatch */ | |
545 | { nsm_ignore, NSM_Attempt }, /* 1-WayReceived */ | |
1f2c2743 PJ |
546 | { nsm_kill_nbr, NSM_Deleted }, /* KillNbr */ |
547 | { nsm_inactivity_timer, NSM_Deleted }, /* InactivityTimer */ | |
548 | { nsm_ll_down, NSM_Deleted }, /* LLDown */ | |
2d59836a | 549 | }, |
550 | { | |
551 | /* Init: */ | |
552 | { nsm_ignore, NSM_DependUpon }, /* NoEvent */ | |
553 | { nsm_hello_received, NSM_Init }, /* HelloReceived */ | |
554 | { nsm_ignore, NSM_Init }, /* Start */ | |
555 | { nsm_twoway_received, NSM_DependUpon }, /* 2-WayReceived */ | |
556 | { nsm_ignore, NSM_Init }, /* NegotiationDone */ | |
557 | { nsm_ignore, NSM_Init }, /* ExchangeDone */ | |
558 | { nsm_ignore, NSM_Init }, /* BadLSReq */ | |
559 | { nsm_ignore, NSM_Init }, /* LoadingDone */ | |
560 | { nsm_ignore, NSM_Init }, /* AdjOK? */ | |
561 | { nsm_ignore, NSM_Init }, /* SeqNumberMismatch */ | |
562 | { nsm_ignore, NSM_Init }, /* 1-WayReceived */ | |
1f2c2743 PJ |
563 | { nsm_kill_nbr, NSM_Deleted }, /* KillNbr */ |
564 | { nsm_inactivity_timer, NSM_Deleted }, /* InactivityTimer */ | |
565 | { nsm_ll_down, NSM_Deleted }, /* LLDown */ | |
2d59836a | 566 | }, |
567 | { | |
568 | /* 2-Way: */ | |
569 | { nsm_ignore, NSM_DependUpon }, /* NoEvent */ | |
570 | { nsm_hello_received, NSM_TwoWay }, /* HelloReceived */ | |
571 | { nsm_ignore, NSM_TwoWay }, /* Start */ | |
572 | { nsm_ignore, NSM_TwoWay }, /* 2-WayReceived */ | |
573 | { nsm_ignore, NSM_TwoWay }, /* NegotiationDone */ | |
574 | { nsm_ignore, NSM_TwoWay }, /* ExchangeDone */ | |
575 | { nsm_ignore, NSM_TwoWay }, /* BadLSReq */ | |
576 | { nsm_ignore, NSM_TwoWay }, /* LoadingDone */ | |
577 | { nsm_adj_ok, NSM_DependUpon }, /* AdjOK? */ | |
578 | { nsm_ignore, NSM_TwoWay }, /* SeqNumberMismatch */ | |
579 | { nsm_oneway_received, NSM_Init }, /* 1-WayReceived */ | |
1f2c2743 PJ |
580 | { nsm_kill_nbr, NSM_Deleted }, /* KillNbr */ |
581 | { nsm_inactivity_timer, NSM_Deleted }, /* InactivityTimer */ | |
582 | { nsm_ll_down, NSM_Deleted }, /* LLDown */ | |
2d59836a | 583 | }, |
584 | { | |
585 | /* ExStart: */ | |
586 | { nsm_ignore, NSM_DependUpon }, /* NoEvent */ | |
587 | { nsm_hello_received, NSM_ExStart }, /* HelloReceived */ | |
588 | { nsm_ignore, NSM_ExStart }, /* Start */ | |
589 | { nsm_ignore, NSM_ExStart }, /* 2-WayReceived */ | |
590 | { nsm_negotiation_done, NSM_Exchange }, /* NegotiationDone */ | |
591 | { nsm_ignore, NSM_ExStart }, /* ExchangeDone */ | |
592 | { nsm_ignore, NSM_ExStart }, /* BadLSReq */ | |
593 | { nsm_ignore, NSM_ExStart }, /* LoadingDone */ | |
594 | { nsm_adj_ok, NSM_DependUpon }, /* AdjOK? */ | |
595 | { nsm_ignore, NSM_ExStart }, /* SeqNumberMismatch */ | |
596 | { nsm_oneway_received, NSM_Init }, /* 1-WayReceived */ | |
1f2c2743 PJ |
597 | { nsm_kill_nbr, NSM_Deleted }, /* KillNbr */ |
598 | { nsm_inactivity_timer, NSM_Deleted }, /* InactivityTimer */ | |
599 | { nsm_ll_down, NSM_Deleted }, /* LLDown */ | |
2d59836a | 600 | }, |
601 | { | |
602 | /* Exchange: */ | |
603 | { nsm_ignore, NSM_DependUpon }, /* NoEvent */ | |
604 | { nsm_hello_received, NSM_Exchange }, /* HelloReceived */ | |
605 | { nsm_ignore, NSM_Exchange }, /* Start */ | |
606 | { nsm_ignore, NSM_Exchange }, /* 2-WayReceived */ | |
607 | { nsm_ignore, NSM_Exchange }, /* NegotiationDone */ | |
608 | { nsm_exchange_done, NSM_DependUpon }, /* ExchangeDone */ | |
609 | { nsm_bad_ls_req, NSM_ExStart }, /* BadLSReq */ | |
610 | { nsm_ignore, NSM_Exchange }, /* LoadingDone */ | |
611 | { nsm_adj_ok, NSM_DependUpon }, /* AdjOK? */ | |
612 | { nsm_seq_number_mismatch, NSM_ExStart }, /* SeqNumberMismatch */ | |
613 | { nsm_oneway_received, NSM_Init }, /* 1-WayReceived */ | |
1f2c2743 PJ |
614 | { nsm_kill_nbr, NSM_Deleted }, /* KillNbr */ |
615 | { nsm_inactivity_timer, NSM_Deleted }, /* InactivityTimer */ | |
616 | { nsm_ll_down, NSM_Deleted }, /* LLDown */ | |
2d59836a | 617 | }, |
618 | { | |
619 | /* Loading: */ | |
620 | { nsm_ignore, NSM_DependUpon }, /* NoEvent */ | |
621 | { nsm_hello_received, NSM_Loading }, /* HelloReceived */ | |
622 | { nsm_ignore, NSM_Loading }, /* Start */ | |
623 | { nsm_ignore, NSM_Loading }, /* 2-WayReceived */ | |
624 | { nsm_ignore, NSM_Loading }, /* NegotiationDone */ | |
625 | { nsm_ignore, NSM_Loading }, /* ExchangeDone */ | |
626 | { nsm_bad_ls_req, NSM_ExStart }, /* BadLSReq */ | |
627 | { nsm_ignore, NSM_Full }, /* LoadingDone */ | |
628 | { nsm_adj_ok, NSM_DependUpon }, /* AdjOK? */ | |
629 | { nsm_seq_number_mismatch, NSM_ExStart }, /* SeqNumberMismatch */ | |
630 | { nsm_oneway_received, NSM_Init }, /* 1-WayReceived */ | |
1f2c2743 PJ |
631 | { nsm_kill_nbr, NSM_Deleted }, /* KillNbr */ |
632 | { nsm_inactivity_timer, NSM_Deleted }, /* InactivityTimer */ | |
633 | { nsm_ll_down, NSM_Deleted }, /* LLDown */ | |
2d59836a | 634 | }, |
635 | { /* Full: */ | |
636 | { nsm_ignore, NSM_DependUpon }, /* NoEvent */ | |
637 | { nsm_hello_received, NSM_Full }, /* HelloReceived */ | |
638 | { nsm_ignore, NSM_Full }, /* Start */ | |
639 | { nsm_ignore, NSM_Full }, /* 2-WayReceived */ | |
640 | { nsm_ignore, NSM_Full }, /* NegotiationDone */ | |
641 | { nsm_ignore, NSM_Full }, /* ExchangeDone */ | |
642 | { nsm_bad_ls_req, NSM_ExStart }, /* BadLSReq */ | |
643 | { nsm_ignore, NSM_Full }, /* LoadingDone */ | |
644 | { nsm_adj_ok, NSM_DependUpon }, /* AdjOK? */ | |
645 | { nsm_seq_number_mismatch, NSM_ExStart }, /* SeqNumberMismatch */ | |
646 | { nsm_oneway_received, NSM_Init }, /* 1-WayReceived */ | |
1f2c2743 PJ |
647 | { nsm_kill_nbr, NSM_Deleted }, /* KillNbr */ |
648 | { nsm_inactivity_timer, NSM_Deleted }, /* InactivityTimer */ | |
649 | { nsm_ll_down, NSM_Deleted }, /* LLDown */ | |
2d59836a | 650 | }, |
651 | }; | |
652 | ||
eb1ce605 | 653 | const static char *ospf_nsm_event_str[] = |
2d59836a | 654 | { |
655 | "NoEvent", | |
656 | "HelloReceived", | |
657 | "Start", | |
658 | "2-WayReceived", | |
659 | "NegotiationDone", | |
660 | "ExchangeDone", | |
661 | "BadLSReq", | |
662 | "LoadingDone", | |
663 | "AdjOK?", | |
664 | "SeqNumberMismatch", | |
665 | "1-WayReceived", | |
666 | "KillNbr", | |
667 | "InactivityTimer", | |
668 | "LLDown", | |
669 | }; | |
670 | ||
671 | void | |
672 | nsm_change_state (struct ospf_neighbor *nbr, int state) | |
673 | { | |
68980084 | 674 | struct ospf_interface *oi = nbr->oi; |
2d59836a | 675 | struct ospf_area *vl_area = NULL; |
676 | u_char old_state; | |
677 | int x; | |
678 | int force = 1; | |
679 | ||
680 | /* Logging change of status. */ | |
681 | if (IS_DEBUG_OSPF (nsm, NSM_STATUS)) | |
2a42e285 | 682 | zlog_debug ("NSM[%s:%s]: State change %s -> %s", |
2d59836a | 683 | IF_NAME (nbr->oi), inet_ntoa (nbr->router_id), |
684 | LOOKUP (ospf_nsm_state_msg, nbr->state), | |
685 | LOOKUP (ospf_nsm_state_msg, state)); | |
686 | ||
687 | /* Preserve old status. */ | |
688 | old_state = nbr->state; | |
689 | ||
690 | /* Change to new status. */ | |
691 | nbr->state = state; | |
692 | ||
693 | /* Statistics. */ | |
694 | nbr->state_change++; | |
695 | ||
2d59836a | 696 | if (oi->type == OSPF_IFTYPE_VIRTUALLINK) |
68980084 | 697 | vl_area = ospf_area_lookup_by_area_id (oi->ospf, oi->vl_data->vl_area_id); |
d7e60dd7 AS |
698 | |
699 | /* Optionally notify about adjacency changes */ | |
700 | if (CHECK_FLAG(oi->ospf->config, OSPF_LOG_ADJACENCY_CHANGES) && | |
701 | (old_state != state) && | |
702 | (CHECK_FLAG(oi->ospf->config, OSPF_LOG_ADJACENCY_DETAIL) || | |
703 | (state == NSM_Full) || (state < old_state))) | |
704 | zlog_notice("AdjChg: Nbr %s on %s: %s -> %s", | |
1f2c2743 PJ |
705 | inet_ntoa (nbr->router_id), IF_NAME (nbr->oi), |
706 | LOOKUP (ospf_nsm_state_msg, old_state), | |
707 | LOOKUP (ospf_nsm_state_msg, state)); | |
d7e60dd7 | 708 | |
5e4914c3 | 709 | #ifdef HAVE_SNMP |
710 | /* Terminal state or regression */ | |
711 | if ((state == NSM_Full) || (state == NSM_TwoWay) || (state < old_state)) | |
712 | { | |
713 | /* ospfVirtNbrStateChange */ | |
714 | if (oi->type == OSPF_IFTYPE_VIRTUALLINK) | |
715 | ospfTrapVirtNbrStateChange(nbr); | |
716 | /* ospfNbrStateChange trap */ | |
1f2c2743 | 717 | else |
5e4914c3 | 718 | /* To/From FULL, only managed by DR */ |
719 | if (((state != NSM_Full) && (old_state != NSM_Full)) || | |
720 | (oi->state == ISM_DR)) | |
721 | ospfTrapNbrStateChange(nbr); | |
722 | } | |
723 | #endif | |
724 | ||
2d59836a | 725 | /* One of the neighboring routers changes to/from the FULL state. */ |
726 | if ((old_state != NSM_Full && state == NSM_Full) || | |
727 | (old_state == NSM_Full && state != NSM_Full)) | |
3aa8d5f9 | 728 | { |
2d59836a | 729 | if (state == NSM_Full) |
730 | { | |
731 | oi->full_nbrs++; | |
732 | oi->area->full_nbrs++; | |
733 | ||
68980084 | 734 | ospf_check_abr_status (oi->ospf); |
2d59836a | 735 | |
736 | if (oi->type == OSPF_IFTYPE_VIRTUALLINK && vl_area) | |
737 | if (++vl_area->full_vls == 1) | |
68980084 | 738 | ospf_schedule_abr_task (oi->ospf); |
2d59836a | 739 | |
740 | /* kevinm: refresh any redistributions */ | |
68980084 | 741 | for (x = ZEBRA_ROUTE_SYSTEM; x < ZEBRA_ROUTE_MAX; x++) |
742 | { | |
743 | if (x == ZEBRA_ROUTE_OSPF || x == ZEBRA_ROUTE_OSPF6) | |
744 | continue; | |
745 | ospf_external_lsa_refresh_type (oi->ospf, x, force); | |
746 | } | |
2d59836a | 747 | } |
748 | else | |
749 | { | |
750 | oi->full_nbrs--; | |
751 | oi->area->full_nbrs--; | |
752 | ||
68980084 | 753 | ospf_check_abr_status (oi->ospf); |
2d59836a | 754 | |
755 | if (oi->type == OSPF_IFTYPE_VIRTUALLINK && vl_area) | |
756 | if (vl_area->full_vls > 0) | |
757 | if (--vl_area->full_vls == 0) | |
68980084 | 758 | ospf_schedule_abr_task (oi->ospf); |
2d59836a | 759 | } |
760 | ||
3aa8d5f9 | 761 | zlog_info ("nsm_change_state(%s, %s -> %s): " |
762 | "scheduling new router-LSA origination", | |
763 | inet_ntoa (nbr->router_id), | |
764 | LOOKUP(ospf_nsm_state_msg, old_state), | |
765 | LOOKUP(ospf_nsm_state_msg, state)); | |
2d59836a | 766 | |
767 | ospf_router_lsa_timer_add (oi->area); | |
768 | ||
769 | if (oi->type == OSPF_IFTYPE_VIRTUALLINK) | |
770 | { | |
771 | struct ospf_area *vl_area = | |
68980084 | 772 | ospf_area_lookup_by_area_id (oi->ospf, oi->vl_data->vl_area_id); |
2d59836a | 773 | |
774 | if (vl_area) | |
775 | ospf_router_lsa_timer_add (vl_area); | |
776 | } | |
777 | ||
778 | /* Originate network-LSA. */ | |
779 | if (oi->state == ISM_DR) | |
780 | { | |
781 | if (oi->network_lsa_self && oi->full_nbrs == 0) | |
782 | { | |
783 | ospf_lsa_flush_area (oi->network_lsa_self, oi->area); | |
784 | ospf_lsa_unlock (oi->network_lsa_self); | |
785 | oi->network_lsa_self = NULL; | |
786 | OSPF_TIMER_OFF (oi->t_network_lsa_self); | |
787 | } | |
788 | else | |
789 | ospf_network_lsa_timer_add (oi); | |
790 | } | |
791 | } | |
792 | ||
793 | #ifdef HAVE_OPAQUE_LSA | |
794 | ospf_opaque_nsm_change (nbr, old_state); | |
795 | #endif /* HAVE_OPAQUE_LSA */ | |
796 | ||
d1b1cd8f PJ |
797 | /* State changes from > ExStart to <= ExStart should clear any Exchange |
798 | * or Full/LSA Update related lists and state. | |
799 | * Potential causal events: BadLSReq, SeqNumberMismatch, AdjOK? | |
800 | * | |
801 | * Note that transitions from > ExStart to < 2-Way (e.g. due to | |
802 | * KillNbr or 1-Way) must and will do the same, but via | |
803 | * nsm_reset_nbr. | |
804 | */ | |
805 | if (old_state > NSM_ExStart | |
806 | && (state == NSM_ExStart || state == NSM_TwoWay)) | |
807 | nsm_clear_adj (nbr); | |
808 | ||
2d59836a | 809 | /* Start DD exchange protocol */ |
810 | if (state == NSM_ExStart) | |
811 | { | |
812 | if (nbr->dd_seqnum == 0) | |
813 | nbr->dd_seqnum = time (NULL); | |
814 | else | |
815 | nbr->dd_seqnum++; | |
816 | ||
817 | nbr->dd_flags = OSPF_DD_FLAG_I|OSPF_DD_FLAG_M|OSPF_DD_FLAG_MS; | |
818 | ospf_db_desc_send (nbr); | |
819 | } | |
820 | ||
821 | /* clear cryptographic sequence number */ | |
822 | if (state == NSM_Down) | |
823 | nbr->crypt_seqnum = 0; | |
824 | ||
825 | /* Generete NeighborChange ISM event. */ | |
2d59836a | 826 | switch (oi->state) { |
827 | case ISM_DROther: | |
828 | case ISM_Backup: | |
829 | case ISM_DR: | |
830 | if ((old_state < NSM_TwoWay && state >= NSM_TwoWay) || | |
831 | (old_state >= NSM_TwoWay && state < NSM_TwoWay)) | |
832 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_NeighborChange); | |
833 | break; | |
834 | default: | |
835 | /* ISM_PointToPoint -> ISM_Down, ISM_Loopback -> ISM_Down, etc. */ | |
836 | break; | |
837 | } | |
2d59836a | 838 | |
839 | /* Performance hack. Send hello immideately when some neighbor enter | |
840 | Init state. This whay we decrease neighbor discovery time. Gleb.*/ | |
841 | if (state == NSM_Init) | |
842 | { | |
843 | OSPF_ISM_TIMER_OFF (oi->t_hello); | |
f9ad937f | 844 | OSPF_ISM_TIMER_MSEC_ON (oi->t_hello, ospf_hello_timer, 1); |
2d59836a | 845 | } |
846 | ||
847 | /* Preserve old status? */ | |
848 | } | |
849 | ||
850 | /* Execute NSM event process. */ | |
851 | int | |
852 | ospf_nsm_event (struct thread *thread) | |
853 | { | |
854 | int event; | |
855 | int next_state; | |
856 | struct ospf_neighbor *nbr; | |
857 | struct in_addr router_id; | |
858 | int old_state; | |
859 | struct ospf_interface *oi; | |
860 | ||
861 | nbr = THREAD_ARG (thread); | |
862 | event = THREAD_VAL (thread); | |
863 | router_id = nbr->router_id; | |
864 | ||
865 | old_state = nbr->state; | |
866 | oi = nbr->oi ; | |
867 | ||
868 | /* Call function. */ | |
869 | next_state = (*(NSM [nbr->state][event].func))(nbr); | |
870 | ||
2d59836a | 871 | if (! next_state) |
872 | next_state = NSM [nbr->state][event].next_state; | |
ba0beb4a PJ |
873 | else if (NSM [nbr->state][event].next_state != NSM_DependUpon) |
874 | { | |
875 | /* There's a mismatch between the FSM tables and what an FSM | |
876 | * action/state-change function returned. State changes which | |
877 | * do not have conditional/DependUpon next-states should not | |
878 | * try set next_state. | |
879 | */ | |
880 | zlog_warn ("NSM[%s:%s]: %s (%s): " | |
881 | "Warning: action tried to change next_state to %s", | |
882 | IF_NAME (oi), inet_ntoa (nbr->router_id), | |
883 | LOOKUP (ospf_nsm_state_msg, nbr->state), | |
884 | ospf_nsm_event_str [event], | |
885 | LOOKUP (ospf_nsm_state_msg, next_state)); | |
886 | ||
887 | next_state = NSM [nbr->state][event].next_state; | |
888 | } | |
2d59836a | 889 | |
890 | if (IS_DEBUG_OSPF (nsm, NSM_EVENTS)) | |
2a42e285 | 891 | zlog_debug ("NSM[%s:%s]: %s (%s)", IF_NAME (oi), |
2d59836a | 892 | inet_ntoa (nbr->router_id), |
893 | LOOKUP (ospf_nsm_state_msg, nbr->state), | |
894 | ospf_nsm_event_str [event]); | |
895 | ||
896 | /* If state is changed. */ | |
897 | if (next_state != nbr->state) | |
898 | nsm_change_state (nbr, next_state); | |
899 | ||
900 | /* Make sure timer is set. */ | |
901 | nsm_timer_set (nbr); | |
902 | ||
1f2c2743 PJ |
903 | /* When event is NSM_KillNbr, InactivityTimer or LLDown, the neighbor |
904 | * is deleted. | |
905 | * | |
906 | * Rather than encode knowledge here of which events lead to NBR | |
907 | * delete, we take our cue from the NSM table, via the dummy | |
908 | * 'Deleted' neighbour state. | |
909 | */ | |
910 | if (nbr->state == NSM_Deleted) | |
911 | ospf_nbr_delete (nbr); | |
912 | ||
2d59836a | 913 | return 0; |
914 | } | |
915 | ||
916 | /* Check loading state. */ | |
917 | void | |
918 | ospf_check_nbr_loading (struct ospf_neighbor *nbr) | |
919 | { | |
920 | if (nbr->state == NSM_Loading) | |
921 | { | |
922 | if (ospf_ls_request_isempty (nbr)) | |
923 | OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_LoadingDone); | |
924 | else if (nbr->ls_req_last == NULL) | |
925 | ospf_ls_req_event (nbr); | |
926 | } | |
927 | } |