ospf_ia.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. /*
  2. * OSPF inter-area routing.
  3. * Copyright (C) 1999, 2000 Alex Zinin, Toshiaki Takada
  4. *
  5. * This file is part of GNU Zebra.
  6. *
  7. * GNU Zebra is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2, or (at your option) any
  10. * later version.
  11. *
  12. * GNU Zebra is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with GNU Zebra; see the file COPYING. If not, write to the Free
  19. * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  20. * 02111-1307, USA.
  21. */
  22. #include <zebra.h>
  23. #include "thread.h"
  24. #include "memory.h"
  25. #include "hash.h"
  26. #include "linklist.h"
  27. #include "prefix.h"
  28. #include "table.h"
  29. #include "log.h"
  30. #include "ospfd/ospfd.h"
  31. #include "ospfd/ospf_interface.h"
  32. #include "ospfd/ospf_ism.h"
  33. #include "ospfd/ospf_asbr.h"
  34. #include "ospfd/ospf_lsa.h"
  35. #include "ospfd/ospf_lsdb.h"
  36. #include "ospfd/ospf_neighbor.h"
  37. #include "ospfd/ospf_nsm.h"
  38. #include "ospfd/ospf_spf.h"
  39. #include "ospfd/ospf_route.h"
  40. #include "ospfd/ospf_ase.h"
  41. #include "ospfd/ospf_abr.h"
  42. #include "ospfd/ospf_ia.h"
  43. #include "ospfd/ospf_dump.h"
  44. static struct ospf_route *
  45. ospf_find_abr_route (struct route_table *rtrs,
  46. struct prefix_ipv4 *abr,
  47. struct ospf_area *area)
  48. {
  49. struct route_node *rn;
  50. struct ospf_route *or;
  51. struct listnode *node;
  52. if ((rn = route_node_lookup (rtrs, (struct prefix *) abr)) == NULL)
  53. return NULL;
  54. route_unlock_node (rn);
  55. for (ALL_LIST_ELEMENTS_RO ((struct list *) rn->info, node, or))
  56. if (IPV4_ADDR_SAME (&or->u.std.area_id, &area->area_id)
  57. && (or->u.std.flags & ROUTER_LSA_BORDER))
  58. return or;
  59. return NULL;
  60. }
  61. static void
  62. ospf_ia_network_route (struct ospf *ospf, struct route_table *rt,
  63. struct prefix_ipv4 *p, struct ospf_route *new_or,
  64. struct ospf_route *abr_or)
  65. {
  66. struct route_node *rn1;
  67. struct ospf_route *or;
  68. if (IS_DEBUG_OSPF_EVENT)
  69. zlog_debug ("ospf_ia_network_route(): processing summary route to %s/%d",
  70. inet_ntoa (p->prefix), p->prefixlen);
  71. /* Find a route to the same dest */
  72. if ((rn1 = route_node_lookup (rt, (struct prefix *) p)))
  73. {
  74. int res;
  75. route_unlock_node (rn1);
  76. if ((or = rn1->info))
  77. {
  78. if (IS_DEBUG_OSPF_EVENT)
  79. zlog_debug ("ospf_ia_network_route(): "
  80. "Found a route to the same network");
  81. /* Check the existing route. */
  82. if ((res = ospf_route_cmp (ospf, new_or, or)) < 0)
  83. {
  84. /* New route is better, so replace old one. */
  85. ospf_route_subst (rn1, new_or, abr_or);
  86. }
  87. else if (res == 0)
  88. {
  89. /* New and old route are equal, so next hops can be added. */
  90. route_lock_node (rn1);
  91. ospf_route_copy_nexthops (or, abr_or->paths);
  92. route_unlock_node (rn1);
  93. /* new route can be deleted, because existing route has been updated. */
  94. ospf_route_free (new_or);
  95. }
  96. else
  97. {
  98. /* New route is worse, so free it. */
  99. ospf_route_free (new_or);
  100. return;
  101. }
  102. } /* if (or)*/
  103. } /*if (rn1)*/
  104. else
  105. { /* no route */
  106. if (IS_DEBUG_OSPF_EVENT)
  107. zlog_debug ("ospf_ia_network_route(): add new route to %s/%d",
  108. inet_ntoa (p->prefix), p->prefixlen);
  109. ospf_route_add (rt, p, new_or, abr_or);
  110. }
  111. }
  112. static void
  113. ospf_ia_router_route (struct ospf *ospf, struct route_table *rtrs,
  114. struct prefix_ipv4 *p,
  115. struct ospf_route *new_or, struct ospf_route *abr_or)
  116. {
  117. struct ospf_route *or = NULL;
  118. struct route_node *rn;
  119. int ret;
  120. if (IS_DEBUG_OSPF_EVENT)
  121. zlog_debug ("ospf_ia_router_route(): considering %s/%d",
  122. inet_ntoa (p->prefix), p->prefixlen);
  123. /* Find a route to the same dest */
  124. rn = route_node_get (rtrs, (struct prefix *) p);
  125. if (rn->info == NULL)
  126. /* This is a new route */
  127. rn->info = list_new ();
  128. else
  129. {
  130. struct ospf_area *or_area;
  131. or_area = ospf_area_lookup_by_area_id (ospf, new_or->u.std.area_id);
  132. assert (or_area);
  133. /* This is an additional route */
  134. route_unlock_node (rn);
  135. or = ospf_find_asbr_route_through_area (rtrs, p, or_area);
  136. }
  137. if (or)
  138. {
  139. if (IS_DEBUG_OSPF_EVENT)
  140. zlog_debug ("ospf_ia_router_route(): "
  141. "a route to the same ABR through the same area exists");
  142. /* New route is better */
  143. if ((ret = ospf_route_cmp (ospf, new_or, or)) < 0)
  144. {
  145. listnode_delete (rn->info, or);
  146. ospf_route_free (or);
  147. /* proceed down */
  148. }
  149. /* Routes are the same */
  150. else if (ret == 0)
  151. {
  152. if (IS_DEBUG_OSPF_EVENT)
  153. zlog_debug ("ospf_ia_router_route(): merging the new route");
  154. ospf_route_copy_nexthops (or, abr_or->paths);
  155. ospf_route_free (new_or);
  156. return;
  157. }
  158. /* New route is worse */
  159. else
  160. {
  161. if (IS_DEBUG_OSPF_EVENT)
  162. zlog_debug ("ospf_ia_router_route(): skipping the new route");
  163. ospf_route_free (new_or);
  164. return;
  165. }
  166. }
  167. ospf_route_copy_nexthops (new_or, abr_or->paths);
  168. if (IS_DEBUG_OSPF_EVENT)
  169. zlog_debug ("ospf_ia_router_route(): adding the new route");
  170. listnode_add (rn->info, new_or);
  171. }
  172. static int
  173. process_summary_lsa (struct ospf_area *area, struct route_table *rt,
  174. struct route_table *rtrs, struct ospf_lsa *lsa)
  175. {
  176. struct ospf *ospf = area->ospf;
  177. struct ospf_area_range *range;
  178. struct ospf_route *abr_or, *new_or;
  179. struct summary_lsa *sl;
  180. struct prefix_ipv4 p, abr;
  181. u_int32_t metric;
  182. if (lsa == NULL)
  183. return 0;
  184. sl = (struct summary_lsa *) lsa->data;
  185. if (IS_DEBUG_OSPF_EVENT)
  186. zlog_debug ("process_summary_lsa(): LS ID: %s", inet_ntoa (sl->header.id));
  187. metric = GET_METRIC (sl->metric);
  188. if (metric == OSPF_LS_INFINITY)
  189. return 0;
  190. if (IS_LSA_MAXAGE (lsa))
  191. return 0;
  192. if (ospf_lsa_is_self_originated (area->ospf, lsa))
  193. return 0;
  194. p.family = AF_INET;
  195. p.prefix = sl->header.id;
  196. if (sl->header.type == OSPF_SUMMARY_LSA)
  197. p.prefixlen = ip_masklen (sl->mask);
  198. else
  199. p.prefixlen = IPV4_MAX_BITLEN;
  200. apply_mask_ipv4 (&p);
  201. if (sl->header.type == OSPF_SUMMARY_LSA &&
  202. (range = ospf_area_range_match_any (ospf, &p)) &&
  203. ospf_area_range_active (range))
  204. return 0;
  205. /* XXX: This check seems dubious to me. If an ABR has already decided
  206. * to consider summaries received in this area, then why would one wish
  207. * to exclude default?
  208. */
  209. if (IS_OSPF_ABR(ospf) &&
  210. ospf->abr_type != OSPF_ABR_STAND &&
  211. area->external_routing != OSPF_AREA_DEFAULT &&
  212. p.prefix.s_addr == OSPF_DEFAULT_DESTINATION &&
  213. p.prefixlen == 0)
  214. return 0; /* Ignore summary default from a stub area */
  215. abr.family = AF_INET;
  216. abr.prefix = sl->header.adv_router;
  217. abr.prefixlen = IPV4_MAX_BITLEN;
  218. apply_mask_ipv4 (&abr);
  219. abr_or = ospf_find_abr_route (rtrs, &abr, area);
  220. if (abr_or == NULL)
  221. return 0;
  222. new_or = ospf_route_new ();
  223. new_or->type = OSPF_DESTINATION_NETWORK;
  224. new_or->id = sl->header.id;
  225. new_or->mask = sl->mask;
  226. new_or->u.std.options = sl->header.options;
  227. new_or->u.std.origin = (struct lsa_header *) sl;
  228. new_or->cost = abr_or->cost + metric;
  229. new_or->u.std.area_id = area->area_id;
  230. new_or->u.std.external_routing = area->external_routing;
  231. new_or->path_type = OSPF_PATH_INTER_AREA;
  232. if (sl->header.type == OSPF_SUMMARY_LSA)
  233. ospf_ia_network_route (ospf, rt, &p, new_or, abr_or);
  234. else
  235. {
  236. new_or->type = OSPF_DESTINATION_ROUTER;
  237. new_or->u.std.flags = ROUTER_LSA_EXTERNAL;
  238. ospf_ia_router_route (ospf, rtrs, &p, new_or, abr_or);
  239. }
  240. return 0;
  241. }
  242. static void
  243. ospf_examine_summaries (struct ospf_area *area,
  244. struct route_table *lsdb_rt,
  245. struct route_table *rt,
  246. struct route_table *rtrs)
  247. {
  248. struct ospf_lsa *lsa;
  249. struct route_node *rn;
  250. LSDB_LOOP (lsdb_rt, rn, lsa)
  251. process_summary_lsa (area, rt, rtrs, lsa);
  252. }
  253. int
  254. ospf_area_is_transit (struct ospf_area *area)
  255. {
  256. return (area->transit == OSPF_TRANSIT_TRUE) ||
  257. ospf_full_virtual_nbrs(area); /* Cisco forgets to set the V-bit :( */
  258. }
  259. static void
  260. ospf_update_network_route (struct ospf *ospf,
  261. struct route_table *rt,
  262. struct route_table *rtrs,
  263. struct summary_lsa *lsa,
  264. struct prefix_ipv4 *p,
  265. struct ospf_area *area)
  266. {
  267. struct route_node *rn;
  268. struct ospf_route *or, *abr_or, *new_or;
  269. struct prefix_ipv4 abr;
  270. u_int32_t cost;
  271. abr.family = AF_INET;
  272. abr.prefix =lsa->header.adv_router;
  273. abr.prefixlen = IPV4_MAX_BITLEN;
  274. apply_mask_ipv4 (&abr);
  275. abr_or = ospf_find_abr_route (rtrs, &abr, area);
  276. if (abr_or == NULL)
  277. {
  278. if (IS_DEBUG_OSPF_EVENT)
  279. zlog_debug ("ospf_update_network_route(): can't find a route to the ABR");
  280. return;
  281. }
  282. cost = abr_or->cost + GET_METRIC (lsa->metric);
  283. rn = route_node_lookup (rt, (struct prefix *) p);
  284. if (! rn)
  285. {
  286. if (ospf->abr_type != OSPF_ABR_SHORTCUT)
  287. return; /* Standard ABR can update only already installed
  288. backbone paths */
  289. if (IS_DEBUG_OSPF_EVENT)
  290. zlog_debug ("ospf_update_network_route(): "
  291. "Allowing Shortcut ABR to add new route");
  292. new_or = ospf_route_new ();
  293. new_or->type = OSPF_DESTINATION_NETWORK;
  294. new_or->id = lsa->header.id;
  295. new_or->mask = lsa->mask;
  296. new_or->u.std.options = lsa->header.options;
  297. new_or->u.std.origin = (struct lsa_header *) lsa;
  298. new_or->cost = cost;
  299. new_or->u.std.area_id = area->area_id;
  300. new_or->u.std.external_routing = area->external_routing;
  301. new_or->path_type = OSPF_PATH_INTER_AREA;
  302. ospf_route_add (rt, p, new_or, abr_or);
  303. return;
  304. }
  305. else
  306. {
  307. route_unlock_node (rn);
  308. if (rn->info == NULL)
  309. return;
  310. }
  311. or = rn->info;
  312. if (or->path_type != OSPF_PATH_INTRA_AREA &&
  313. or->path_type != OSPF_PATH_INTER_AREA)
  314. {
  315. if (IS_DEBUG_OSPF_EVENT)
  316. zlog_debug ("ospf_update_network_route(): ERR: path type is wrong");
  317. return;
  318. }
  319. if (ospf->abr_type == OSPF_ABR_SHORTCUT)
  320. {
  321. if (or->path_type == OSPF_PATH_INTRA_AREA &&
  322. !OSPF_IS_AREA_ID_BACKBONE (or->u.std.area_id))
  323. {
  324. if (IS_DEBUG_OSPF_EVENT)
  325. zlog_debug ("ospf_update_network_route(): Shortcut: "
  326. "this intra-area path is not backbone");
  327. return;
  328. }
  329. }
  330. else /* Not Shortcut ABR */
  331. {
  332. if (!OSPF_IS_AREA_ID_BACKBONE (or->u.std.area_id))
  333. {
  334. if (IS_DEBUG_OSPF_EVENT)
  335. zlog_debug ("ospf_update_network_route(): "
  336. "route is not BB-associated");
  337. return; /* We can update only BB routes */
  338. }
  339. }
  340. if (or->cost < cost)
  341. {
  342. if (IS_DEBUG_OSPF_EVENT)
  343. zlog_debug ("ospf_update_network_route(): new route is worse");
  344. return;
  345. }
  346. if (or->cost == cost)
  347. {
  348. if (IS_DEBUG_OSPF_EVENT)
  349. zlog_debug ("ospf_update_network_route(): "
  350. "new route is same distance, adding nexthops");
  351. ospf_route_copy_nexthops (or, abr_or->paths);
  352. }
  353. if (or->cost > cost)
  354. {
  355. if (IS_DEBUG_OSPF_EVENT)
  356. zlog_debug ("ospf_update_network_route(): "
  357. "new route is better, overriding nexthops");
  358. ospf_route_subst_nexthops (or, abr_or->paths);
  359. or->cost = cost;
  360. if ((ospf->abr_type == OSPF_ABR_SHORTCUT) &&
  361. !OSPF_IS_AREA_ID_BACKBONE (or->u.std.area_id))
  362. {
  363. or->path_type = OSPF_PATH_INTER_AREA;
  364. or->u.std.area_id = area->area_id;
  365. or->u.std.external_routing = area->external_routing;
  366. /* Note that we can do this only in Shortcut ABR mode,
  367. because standard ABR must leave the route type and area
  368. unchanged
  369. */
  370. }
  371. }
  372. }
  373. static void
  374. ospf_update_router_route (struct ospf *ospf,
  375. struct route_table *rtrs,
  376. struct summary_lsa *lsa,
  377. struct prefix_ipv4 *p,
  378. struct ospf_area *area)
  379. {
  380. struct ospf_route *or, *abr_or, *new_or;
  381. struct prefix_ipv4 abr;
  382. u_int32_t cost;
  383. abr.family = AF_INET;
  384. abr.prefix = lsa->header.adv_router;
  385. abr.prefixlen = IPV4_MAX_BITLEN;
  386. apply_mask_ipv4 (&abr);
  387. abr_or = ospf_find_abr_route (rtrs, &abr, area);
  388. if (abr_or == NULL)
  389. {
  390. if (IS_DEBUG_OSPF_EVENT)
  391. zlog_debug ("ospf_update_router_route(): can't find a route to the ABR");
  392. return;
  393. }
  394. cost = abr_or->cost + GET_METRIC (lsa->metric);
  395. /* First try to find a backbone path,
  396. because standard ABR can update only BB-associated paths */
  397. if ((ospf->backbone == NULL) &&
  398. (ospf->abr_type != OSPF_ABR_SHORTCUT))
  399. return; /* no BB area, not Shortcut ABR, exiting */
  400. /* find the backbone route, if possible */
  401. if ((ospf->backbone == NULL)
  402. || !(or = ospf_find_asbr_route_through_area (rtrs, p, ospf->backbone)))
  403. {
  404. if (ospf->abr_type != OSPF_ABR_SHORTCUT)
  405. /* route to ASBR through the BB not found
  406. the router is not Shortcut ABR, exiting */
  407. return;
  408. else
  409. /* We're a Shortcut ABR*/
  410. {
  411. /* Let it either add a new router or update the route
  412. through the same (non-BB) area. */
  413. new_or = ospf_route_new ();
  414. new_or->type = OSPF_DESTINATION_ROUTER;
  415. new_or->id = lsa->header.id;
  416. new_or->mask = lsa->mask;
  417. new_or->u.std.options = lsa->header.options;
  418. new_or->u.std.origin = (struct lsa_header *)lsa;
  419. new_or->cost = cost;
  420. new_or->u.std.area_id = area->area_id;
  421. new_or->u.std.external_routing = area->external_routing;
  422. new_or->path_type = OSPF_PATH_INTER_AREA;
  423. new_or->u.std.flags = ROUTER_LSA_EXTERNAL;
  424. ospf_ia_router_route (ospf, rtrs, p, new_or, abr_or);
  425. return;
  426. }
  427. }
  428. /* At this point the "or" is always bb-associated */
  429. if (!(or->u.std.flags & ROUTER_LSA_EXTERNAL))
  430. {
  431. if (IS_DEBUG_OSPF_EVENT)
  432. zlog_debug ("ospf_upd_router_route(): the remote router is not an ASBR");
  433. return;
  434. }
  435. if (or->path_type != OSPF_PATH_INTRA_AREA &&
  436. or->path_type != OSPF_PATH_INTER_AREA)
  437. return;
  438. if (or->cost < cost)
  439. return;
  440. else if (or->cost == cost)
  441. ospf_route_copy_nexthops (or, abr_or->paths);
  442. else if (or->cost > cost)
  443. {
  444. ospf_route_subst_nexthops (or, abr_or->paths);
  445. or->cost = cost;
  446. /* Even if the ABR runs in Shortcut mode, we can't change
  447. the path type and area, because the "or" is always bb-associated
  448. at this point and even Shortcut ABR can't change these attributes */
  449. }
  450. }
  451. static int
  452. process_transit_summary_lsa (struct ospf_area *area, struct route_table *rt,
  453. struct route_table *rtrs, struct ospf_lsa *lsa)
  454. {
  455. struct ospf *ospf = area->ospf;
  456. struct summary_lsa *sl;
  457. struct prefix_ipv4 p;
  458. u_int32_t metric;
  459. if (lsa == NULL)
  460. return 0;
  461. sl = (struct summary_lsa *) lsa->data;
  462. if (IS_DEBUG_OSPF_EVENT)
  463. zlog_debug ("process_transit_summaries(): LS ID: %s",
  464. inet_ntoa (lsa->data->id));
  465. metric = GET_METRIC (sl->metric);
  466. if (metric == OSPF_LS_INFINITY)
  467. {
  468. if (IS_DEBUG_OSPF_EVENT)
  469. zlog_debug ("process_transit_summaries(): metric is infinity, skip");
  470. return 0;
  471. }
  472. if (IS_LSA_MAXAGE (lsa))
  473. {
  474. if (IS_DEBUG_OSPF_EVENT)
  475. zlog_debug ("process_transit_summaries(): This LSA is too old");
  476. return 0;
  477. }
  478. if (ospf_lsa_is_self_originated (area->ospf, lsa))
  479. {
  480. if (IS_DEBUG_OSPF_EVENT)
  481. zlog_debug ("process_transit_summaries(): This LSA is mine, skip");
  482. return 0;
  483. }
  484. p.family = AF_INET;
  485. p.prefix = sl->header.id;
  486. if (sl->header.type == OSPF_SUMMARY_LSA)
  487. p.prefixlen = ip_masklen (sl->mask);
  488. else
  489. p.prefixlen = IPV4_MAX_BITLEN;
  490. apply_mask_ipv4 (&p);
  491. if (sl->header.type == OSPF_SUMMARY_LSA)
  492. ospf_update_network_route (ospf, rt, rtrs, sl, &p, area);
  493. else
  494. ospf_update_router_route (ospf, rtrs, sl, &p, area);
  495. return 0;
  496. }
  497. static void
  498. ospf_examine_transit_summaries (struct ospf_area *area,
  499. struct route_table *lsdb_rt,
  500. struct route_table *rt,
  501. struct route_table *rtrs)
  502. {
  503. struct ospf_lsa *lsa;
  504. struct route_node *rn;
  505. LSDB_LOOP (lsdb_rt, rn, lsa)
  506. process_transit_summary_lsa (area, rt, rtrs, lsa);
  507. }
  508. void
  509. ospf_ia_routing (struct ospf *ospf,
  510. struct route_table *rt,
  511. struct route_table *rtrs)
  512. {
  513. struct ospf_area * area;
  514. if (IS_DEBUG_OSPF_EVENT)
  515. zlog_debug ("ospf_ia_routing():start");
  516. if (IS_OSPF_ABR (ospf))
  517. {
  518. struct listnode *node;
  519. struct ospf_area *area;
  520. switch (ospf->abr_type)
  521. {
  522. case OSPF_ABR_STAND:
  523. if (IS_DEBUG_OSPF_EVENT)
  524. zlog_debug ("ospf_ia_routing():Standard ABR");
  525. if ((area = ospf->backbone))
  526. {
  527. struct listnode *node;
  528. if (IS_DEBUG_OSPF_EVENT)
  529. {
  530. zlog_debug ("ospf_ia_routing():backbone area found");
  531. zlog_debug ("ospf_ia_routing():examining summaries");
  532. }
  533. OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
  534. for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
  535. if (area != ospf->backbone)
  536. if (ospf_area_is_transit (area))
  537. OSPF_EXAMINE_TRANSIT_SUMMARIES_ALL (area, rt, rtrs);
  538. }
  539. else
  540. if (IS_DEBUG_OSPF_EVENT)
  541. zlog_debug ("ospf_ia_routing():backbone area NOT found");
  542. break;
  543. case OSPF_ABR_IBM:
  544. case OSPF_ABR_CISCO:
  545. if (IS_DEBUG_OSPF_EVENT)
  546. zlog_debug ("ospf_ia_routing():Alternative Cisco/IBM ABR");
  547. area = ospf->backbone; /* Find the BB */
  548. /* If we have an active BB connection */
  549. if (area && ospf_act_bb_connection (ospf))
  550. {
  551. if (IS_DEBUG_OSPF_EVENT)
  552. {
  553. zlog_debug ("ospf_ia_routing(): backbone area found");
  554. zlog_debug ("ospf_ia_routing(): examining BB summaries");
  555. }
  556. OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
  557. for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
  558. if (area != ospf->backbone)
  559. if (ospf_area_is_transit (area))
  560. OSPF_EXAMINE_TRANSIT_SUMMARIES_ALL (area, rt, rtrs);
  561. }
  562. else
  563. { /* No active BB connection--consider all areas */
  564. if (IS_DEBUG_OSPF_EVENT)
  565. zlog_debug ("ospf_ia_routing(): "
  566. "Active BB connection not found");
  567. for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
  568. OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
  569. }
  570. break;
  571. case OSPF_ABR_SHORTCUT:
  572. if (IS_DEBUG_OSPF_EVENT)
  573. zlog_debug ("ospf_ia_routing():Alternative Shortcut");
  574. area = ospf->backbone; /* Find the BB */
  575. /* If we have an active BB connection */
  576. if (area && ospf_act_bb_connection (ospf))
  577. {
  578. if (IS_DEBUG_OSPF_EVENT)
  579. {
  580. zlog_debug ("ospf_ia_routing(): backbone area found");
  581. zlog_debug ("ospf_ia_routing(): examining BB summaries");
  582. }
  583. OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
  584. }
  585. for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
  586. if (area != ospf->backbone)
  587. if (ospf_area_is_transit (area) ||
  588. ((area->shortcut_configured != OSPF_SHORTCUT_DISABLE) &&
  589. ((ospf->backbone == NULL) ||
  590. ((area->shortcut_configured == OSPF_SHORTCUT_ENABLE) &&
  591. area->shortcut_capability))))
  592. OSPF_EXAMINE_TRANSIT_SUMMARIES_ALL (area, rt, rtrs);
  593. break;
  594. default:
  595. break;
  596. }
  597. }
  598. else
  599. {
  600. struct listnode *node;
  601. if (IS_DEBUG_OSPF_EVENT)
  602. zlog_debug ("ospf_ia_routing():not ABR, considering all areas");
  603. for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
  604. OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
  605. }
  606. }