isis_route.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. /*
  2. * IS-IS Rout(e)ing protocol - isis_route.c
  3. * Copyright (C) 2001,2002 Sampo Saaristo
  4. * Tampere University of Technology
  5. * Institute of Communications Engineering
  6. *
  7. * based on ../ospf6d/ospf6_route.[ch]
  8. * by Yasuhiro Ohara
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public Licenseas published by the Free
  12. * Software Foundation; either version 2 of the License, or (at your option)
  13. * any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,but WITHOUT
  16. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  17. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  18. * more details.
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write to the Free Software Foundation, Inc.,
  21. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. */
  23. #include <zebra.h>
  24. #include "thread.h"
  25. #include "linklist.h"
  26. #include "vty.h"
  27. #include "log.h"
  28. #include "memory.h"
  29. #include "prefix.h"
  30. #include "hash.h"
  31. #include "if.h"
  32. #include "table.h"
  33. #include "isis_constants.h"
  34. #include "isis_common.h"
  35. #include "isis_flags.h"
  36. #include "dict.h"
  37. #include "isisd.h"
  38. #include "isis_misc.h"
  39. #include "isis_adjacency.h"
  40. #include "isis_circuit.h"
  41. #include "isis_tlv.h"
  42. #include "isis_pdu.h"
  43. #include "isis_lsp.h"
  44. #include "isis_spf.h"
  45. #include "isis_route.h"
  46. #include "isis_zebra.h"
  47. static struct isis_nexthop *
  48. isis_nexthop_create (struct in_addr *ip, ifindex_t ifindex)
  49. {
  50. struct listnode *node;
  51. struct isis_nexthop *nexthop;
  52. for (ALL_LIST_ELEMENTS_RO (isis->nexthops, node, nexthop))
  53. {
  54. if (nexthop->ifindex != ifindex)
  55. continue;
  56. if (ip && memcmp (&nexthop->ip, ip, sizeof (struct in_addr)) != 0)
  57. continue;
  58. nexthop->lock++;
  59. return nexthop;
  60. }
  61. nexthop = XCALLOC (MTYPE_ISIS_NEXTHOP, sizeof (struct isis_nexthop));
  62. nexthop->ifindex = ifindex;
  63. memcpy (&nexthop->ip, ip, sizeof (struct in_addr));
  64. listnode_add (isis->nexthops, nexthop);
  65. nexthop->lock++;
  66. return nexthop;
  67. }
  68. static void
  69. isis_nexthop_delete (struct isis_nexthop *nexthop)
  70. {
  71. nexthop->lock--;
  72. if (nexthop->lock == 0)
  73. {
  74. listnode_delete (isis->nexthops, nexthop);
  75. XFREE (MTYPE_ISIS_NEXTHOP, nexthop);
  76. }
  77. return;
  78. }
  79. static int
  80. nexthoplookup (struct list *nexthops, struct in_addr *ip,
  81. ifindex_t ifindex)
  82. {
  83. struct listnode *node;
  84. struct isis_nexthop *nh;
  85. for (ALL_LIST_ELEMENTS_RO (nexthops, node, nh))
  86. {
  87. if (!(memcmp (ip, &nh->ip, sizeof (struct in_addr))) &&
  88. ifindex == nh->ifindex)
  89. return 1;
  90. }
  91. return 0;
  92. }
  93. #ifdef EXTREME_DEBUG
  94. static void
  95. nexthop_print (struct isis_nexthop *nh)
  96. {
  97. u_char buf[BUFSIZ];
  98. inet_ntop (AF_INET, &nh->ip, (char *) buf, BUFSIZ);
  99. zlog_debug (" %s %u", buf, nh->ifindex);
  100. }
  101. static void
  102. nexthops_print (struct list *nhs)
  103. {
  104. struct listnode *node;
  105. struct isis_nexthop *nh;
  106. for (ALL_LIST_ELEMENTS_RO (nhs, node, nh))
  107. nexthop_print (nh);
  108. }
  109. #endif /* EXTREME_DEBUG */
  110. #ifdef HAVE_IPV6
  111. static struct isis_nexthop6 *
  112. isis_nexthop6_new (struct in6_addr *ip6, ifindex_t ifindex)
  113. {
  114. struct isis_nexthop6 *nexthop6;
  115. nexthop6 = XCALLOC (MTYPE_ISIS_NEXTHOP6, sizeof (struct isis_nexthop6));
  116. nexthop6->ifindex = ifindex;
  117. memcpy (&nexthop6->ip6, ip6, sizeof (struct in6_addr));
  118. nexthop6->lock++;
  119. return nexthop6;
  120. }
  121. static struct isis_nexthop6 *
  122. isis_nexthop6_create (struct in6_addr *ip6, ifindex_t ifindex)
  123. {
  124. struct listnode *node;
  125. struct isis_nexthop6 *nexthop6;
  126. for (ALL_LIST_ELEMENTS_RO (isis->nexthops6, node, nexthop6))
  127. {
  128. if (nexthop6->ifindex != ifindex)
  129. continue;
  130. if (ip6 && memcmp (&nexthop6->ip6, ip6, sizeof (struct in6_addr)) != 0)
  131. continue;
  132. nexthop6->lock++;
  133. return nexthop6;
  134. }
  135. nexthop6 = isis_nexthop6_new (ip6, ifindex);
  136. return nexthop6;
  137. }
  138. static void
  139. isis_nexthop6_delete (struct isis_nexthop6 *nexthop6)
  140. {
  141. nexthop6->lock--;
  142. if (nexthop6->lock == 0)
  143. {
  144. listnode_delete (isis->nexthops6, nexthop6);
  145. XFREE (MTYPE_ISIS_NEXTHOP6, nexthop6);
  146. }
  147. return;
  148. }
  149. static int
  150. nexthop6lookup (struct list *nexthops6, struct in6_addr *ip6,
  151. ifindex_t ifindex)
  152. {
  153. struct listnode *node;
  154. struct isis_nexthop6 *nh6;
  155. for (ALL_LIST_ELEMENTS_RO (nexthops6, node, nh6))
  156. {
  157. if (!(memcmp (ip6, &nh6->ip6, sizeof (struct in6_addr))) &&
  158. ifindex == nh6->ifindex)
  159. return 1;
  160. }
  161. return 0;
  162. }
  163. #ifdef EXTREME_DEBUG
  164. static void
  165. nexthop6_print (struct isis_nexthop6 *nh6)
  166. {
  167. u_char buf[BUFSIZ];
  168. inet_ntop (AF_INET6, &nh6->ip6, (char *) buf, BUFSIZ);
  169. zlog_debug (" %s %u", buf, nh6->ifindex);
  170. }
  171. static void
  172. nexthops6_print (struct list *nhs6)
  173. {
  174. struct listnode *node;
  175. struct isis_nexthop6 *nh6;
  176. for (ALL_LIST_ELEMENTS_RO (nhs6, node, nh6))
  177. nexthop6_print (nh6);
  178. }
  179. #endif /* EXTREME_DEBUG */
  180. #endif /* HAVE_IPV6 */
  181. static void
  182. adjinfo2nexthop (struct list *nexthops, struct isis_adjacency *adj)
  183. {
  184. struct isis_nexthop *nh;
  185. struct listnode *node;
  186. struct in_addr *ipv4_addr;
  187. if (adj->ipv4_addrs == NULL)
  188. return;
  189. for (ALL_LIST_ELEMENTS_RO (adj->ipv4_addrs, node, ipv4_addr))
  190. {
  191. if (!nexthoplookup (nexthops, ipv4_addr,
  192. adj->circuit->interface->ifindex))
  193. {
  194. nh = isis_nexthop_create (ipv4_addr,
  195. adj->circuit->interface->ifindex);
  196. nh->router_address = adj->router_address;
  197. listnode_add (nexthops, nh);
  198. }
  199. }
  200. }
  201. #ifdef HAVE_IPV6
  202. static void
  203. adjinfo2nexthop6 (struct list *nexthops6, struct isis_adjacency *adj)
  204. {
  205. struct listnode *node;
  206. struct in6_addr *ipv6_addr;
  207. struct isis_nexthop6 *nh6;
  208. if (!adj->ipv6_addrs)
  209. return;
  210. for (ALL_LIST_ELEMENTS_RO (adj->ipv6_addrs, node, ipv6_addr))
  211. {
  212. if (!nexthop6lookup (nexthops6, ipv6_addr,
  213. adj->circuit->interface->ifindex))
  214. {
  215. nh6 = isis_nexthop6_create (ipv6_addr,
  216. adj->circuit->interface->ifindex);
  217. nh6->router_address6 = adj->router_address6;
  218. listnode_add (nexthops6, nh6);
  219. }
  220. }
  221. }
  222. #endif /* HAVE_IPV6 */
  223. static struct isis_route_info *
  224. isis_route_info_new (struct prefix *prefix, uint32_t cost, uint32_t depth,
  225. struct list *adjacencies)
  226. {
  227. struct isis_route_info *rinfo;
  228. struct isis_adjacency *adj;
  229. struct listnode *node;
  230. rinfo = XCALLOC (MTYPE_ISIS_ROUTE_INFO, sizeof (struct isis_route_info));
  231. if (prefix->family == AF_INET)
  232. {
  233. rinfo->nexthops = list_new ();
  234. for (ALL_LIST_ELEMENTS_RO (adjacencies, node, adj))
  235. {
  236. /* check for force resync this route */
  237. if (CHECK_FLAG (adj->circuit->flags, ISIS_CIRCUIT_FLAPPED_AFTER_SPF))
  238. SET_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_RESYNC);
  239. /* update neighbor router address */
  240. if (depth == 2 && prefix->prefixlen == 32)
  241. adj->router_address = prefix->u.prefix4;
  242. adjinfo2nexthop (rinfo->nexthops, adj);
  243. }
  244. }
  245. #ifdef HAVE_IPV6
  246. if (prefix->family == AF_INET6)
  247. {
  248. rinfo->nexthops6 = list_new ();
  249. for (ALL_LIST_ELEMENTS_RO (adjacencies, node, adj))
  250. {
  251. /* check for force resync this route */
  252. if (CHECK_FLAG (adj->circuit->flags, ISIS_CIRCUIT_FLAPPED_AFTER_SPF))
  253. SET_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_RESYNC);
  254. /* update neighbor router address */
  255. if (depth == 2 && prefix->prefixlen == 128)
  256. adj->router_address6 = prefix->u.prefix6;
  257. adjinfo2nexthop6 (rinfo->nexthops6, adj);
  258. }
  259. }
  260. #endif /* HAVE_IPV6 */
  261. rinfo->cost = cost;
  262. rinfo->depth = depth;
  263. return rinfo;
  264. }
  265. static void
  266. isis_route_info_delete (struct isis_route_info *route_info)
  267. {
  268. if (route_info->nexthops)
  269. {
  270. route_info->nexthops->del = (void (*)(void *)) isis_nexthop_delete;
  271. list_delete (route_info->nexthops);
  272. }
  273. #ifdef HAVE_IPV6
  274. if (route_info->nexthops6)
  275. {
  276. route_info->nexthops6->del = (void (*)(void *)) isis_nexthop6_delete;
  277. list_delete (route_info->nexthops6);
  278. }
  279. #endif /* HAVE_IPV6 */
  280. XFREE (MTYPE_ISIS_ROUTE_INFO, route_info);
  281. }
  282. static int
  283. isis_route_info_same_attrib (struct isis_route_info *new,
  284. struct isis_route_info *old)
  285. {
  286. if (new->cost != old->cost)
  287. return 0;
  288. if (new->depth != old->depth)
  289. return 0;
  290. return 1;
  291. }
  292. static int
  293. isis_route_info_same (struct isis_route_info *new,
  294. struct isis_route_info *old, u_char family)
  295. {
  296. struct listnode *node;
  297. struct isis_nexthop *nexthop;
  298. #ifdef HAVE_IPV6
  299. struct isis_nexthop6 *nexthop6;
  300. #endif /* HAVE_IPV6 */
  301. if (!CHECK_FLAG (old->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED))
  302. return 0;
  303. if (CHECK_FLAG (new->flag, ISIS_ROUTE_FLAG_ZEBRA_RESYNC))
  304. return 0;
  305. if (!isis_route_info_same_attrib (new, old))
  306. return 0;
  307. if (family == AF_INET)
  308. {
  309. for (ALL_LIST_ELEMENTS_RO (new->nexthops, node, nexthop))
  310. if (nexthoplookup (old->nexthops, &nexthop->ip, nexthop->ifindex)
  311. == 0)
  312. return 0;
  313. for (ALL_LIST_ELEMENTS_RO (old->nexthops, node, nexthop))
  314. if (nexthoplookup (new->nexthops, &nexthop->ip, nexthop->ifindex)
  315. == 0)
  316. return 0;
  317. }
  318. #ifdef HAVE_IPV6
  319. else if (family == AF_INET6)
  320. {
  321. for (ALL_LIST_ELEMENTS_RO (new->nexthops6, node, nexthop6))
  322. if (nexthop6lookup (old->nexthops6, &nexthop6->ip6,
  323. nexthop6->ifindex) == 0)
  324. return 0;
  325. for (ALL_LIST_ELEMENTS_RO (old->nexthops6, node, nexthop6))
  326. if (nexthop6lookup (new->nexthops6, &nexthop6->ip6,
  327. nexthop6->ifindex) == 0)
  328. return 0;
  329. }
  330. #endif /* HAVE_IPV6 */
  331. return 1;
  332. }
  333. struct isis_route_info *
  334. isis_route_create (struct prefix *prefix, u_int32_t cost, u_int32_t depth,
  335. struct list *adjacencies, struct isis_area *area,
  336. int level)
  337. {
  338. struct route_node *route_node;
  339. struct isis_route_info *rinfo_new, *rinfo_old, *route_info = NULL;
  340. u_char buff[BUFSIZ];
  341. u_char family;
  342. family = prefix->family;
  343. /* for debugs */
  344. prefix2str (prefix, (char *) buff, BUFSIZ);
  345. rinfo_new = isis_route_info_new (prefix, cost, depth, adjacencies);
  346. if (family == AF_INET)
  347. route_node = route_node_get (area->route_table[level - 1], prefix);
  348. #ifdef HAVE_IPV6
  349. else if (family == AF_INET6)
  350. route_node = route_node_get (area->route_table6[level - 1], prefix);
  351. #endif /* HAVE_IPV6 */
  352. else
  353. {
  354. isis_route_info_delete (rinfo_new);
  355. return NULL;
  356. }
  357. rinfo_old = route_node->info;
  358. if (!rinfo_old)
  359. {
  360. if (isis->debugs & DEBUG_RTE_EVENTS)
  361. zlog_debug ("ISIS-Rte (%s) route created: %s", area->area_tag, buff);
  362. route_info = rinfo_new;
  363. UNSET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
  364. }
  365. else
  366. {
  367. if (isis->debugs & DEBUG_RTE_EVENTS)
  368. zlog_debug ("ISIS-Rte (%s) route already exists: %s", area->area_tag,
  369. buff);
  370. if (isis_route_info_same (rinfo_new, rinfo_old, family))
  371. {
  372. if (isis->debugs & DEBUG_RTE_EVENTS)
  373. zlog_debug ("ISIS-Rte (%s) route unchanged: %s", area->area_tag,
  374. buff);
  375. isis_route_info_delete (rinfo_new);
  376. route_info = rinfo_old;
  377. }
  378. else
  379. {
  380. if (isis->debugs & DEBUG_RTE_EVENTS)
  381. zlog_debug ("ISIS-Rte (%s) route changed: %s", area->area_tag,
  382. buff);
  383. isis_route_info_delete (rinfo_old);
  384. route_info = rinfo_new;
  385. UNSET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
  386. }
  387. }
  388. SET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ACTIVE);
  389. route_node->info = route_info;
  390. return route_info;
  391. }
  392. static void
  393. isis_route_delete (struct prefix *prefix, struct route_table *table)
  394. {
  395. struct route_node *rode;
  396. struct isis_route_info *rinfo;
  397. char buff[BUFSIZ];
  398. /* for log */
  399. prefix2str (prefix, buff, BUFSIZ);
  400. rode = route_node_get (table, prefix);
  401. rinfo = rode->info;
  402. if (rinfo == NULL)
  403. {
  404. if (isis->debugs & DEBUG_RTE_EVENTS)
  405. zlog_debug ("ISIS-Rte: tried to delete non-existant route %s", buff);
  406. return;
  407. }
  408. if (CHECK_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED))
  409. {
  410. UNSET_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ACTIVE);
  411. if (isis->debugs & DEBUG_RTE_EVENTS)
  412. zlog_debug ("ISIS-Rte: route delete %s", buff);
  413. isis_zebra_route_update (prefix, rinfo);
  414. }
  415. isis_route_info_delete (rinfo);
  416. rode->info = NULL;
  417. return;
  418. }
  419. /* Validating routes in particular table. */
  420. static void
  421. isis_route_validate_table (struct isis_area *area, struct route_table *table)
  422. {
  423. struct route_node *rnode, *drnode;
  424. struct isis_route_info *rinfo;
  425. u_char buff[BUFSIZ];
  426. for (rnode = route_top (table); rnode; rnode = route_next (rnode))
  427. {
  428. if (rnode->info == NULL)
  429. continue;
  430. rinfo = rnode->info;
  431. if (isis->debugs & DEBUG_RTE_EVENTS)
  432. {
  433. prefix2str (&rnode->p, (char *) buff, BUFSIZ);
  434. zlog_debug ("ISIS-Rte (%s): route validate: %s %s %s %s",
  435. area->area_tag,
  436. (CHECK_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED) ?
  437. "synced" : "not-synced"),
  438. (CHECK_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_RESYNC) ?
  439. "resync" : "not-resync"),
  440. (CHECK_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ACTIVE) ?
  441. "active" : "inactive"), buff);
  442. }
  443. isis_zebra_route_update (&rnode->p, rinfo);
  444. if (!CHECK_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ACTIVE))
  445. {
  446. /* Area is either L1 or L2 => we use level route tables directly for
  447. * validating => no problems with deleting routes. */
  448. if (area->is_type != IS_LEVEL_1_AND_2)
  449. {
  450. isis_route_delete (&rnode->p, table);
  451. continue;
  452. }
  453. /* If area is L1L2, we work with merge table and therefore must
  454. * delete node from level tables as well before deleting route info.
  455. * FIXME: Is it performance problem? There has to be the better way.
  456. * Like not to deal with it here at all (see the next comment)? */
  457. if (rnode->p.family == AF_INET)
  458. {
  459. drnode = route_node_get (area->route_table[0], &rnode->p);
  460. if (drnode->info == rnode->info)
  461. drnode->info = NULL;
  462. drnode = route_node_get (area->route_table[1], &rnode->p);
  463. if (drnode->info == rnode->info)
  464. drnode->info = NULL;
  465. }
  466. #ifdef HAVE_IPV6
  467. if (rnode->p.family == AF_INET6)
  468. {
  469. drnode = route_node_get (area->route_table6[0], &rnode->p);
  470. if (drnode->info == rnode->info)
  471. drnode->info = NULL;
  472. drnode = route_node_get (area->route_table6[1], &rnode->p);
  473. if (drnode->info == rnode->info)
  474. drnode->info = NULL;
  475. }
  476. #endif
  477. isis_route_delete (&rnode->p, table);
  478. }
  479. }
  480. }
  481. /* Function to validate route tables for L1L2 areas. In this case we can't use
  482. * level route tables directly, we have to merge them at first. L1 routes are
  483. * preferred over the L2 ones.
  484. *
  485. * Merge algorithm is trivial (at least for now). All L1 paths are copied into
  486. * merge table at first, then L2 paths are added if L1 path for same prefix
  487. * doesn't already exists there.
  488. *
  489. * FIXME: Is it right place to do it at all? Maybe we should push both levels
  490. * to the RIB with different zebra route types and let RIB handle this? */
  491. static void
  492. isis_route_validate_merge (struct isis_area *area, int family)
  493. {
  494. struct route_table *table = NULL;
  495. struct route_table *merge;
  496. struct route_node *rnode, *mrnode;
  497. merge = route_table_init ();
  498. if (family == AF_INET)
  499. table = area->route_table[0];
  500. #ifdef HAVE_IPV6
  501. else if (family == AF_INET6)
  502. table = area->route_table6[0];
  503. #endif
  504. for (rnode = route_top (table); rnode; rnode = route_next (rnode))
  505. {
  506. if (rnode->info == NULL)
  507. continue;
  508. mrnode = route_node_get (merge, &rnode->p);
  509. mrnode->info = rnode->info;
  510. }
  511. if (family == AF_INET)
  512. table = area->route_table[1];
  513. #ifdef HAVE_IPV6
  514. else if (family == AF_INET6)
  515. table = area->route_table6[1];
  516. #endif
  517. for (rnode = route_top (table); rnode; rnode = route_next (rnode))
  518. {
  519. if (rnode->info == NULL)
  520. continue;
  521. mrnode = route_node_get (merge, &rnode->p);
  522. if (mrnode->info != NULL)
  523. continue;
  524. mrnode->info = rnode->info;
  525. }
  526. isis_route_validate_table (area, merge);
  527. route_table_finish (merge);
  528. }
  529. /* Walk through route tables and propagate necessary changes into RIB. In case
  530. * of L1L2 area, level tables have to be merged at first. */
  531. void
  532. isis_route_validate (struct isis_area *area)
  533. {
  534. struct listnode *node;
  535. struct isis_circuit *circuit;
  536. if (area->is_type == IS_LEVEL_1)
  537. isis_route_validate_table (area, area->route_table[0]);
  538. else if (area->is_type == IS_LEVEL_2)
  539. isis_route_validate_table (area, area->route_table[1]);
  540. else
  541. isis_route_validate_merge (area, AF_INET);
  542. #ifdef HAVE_IPV6
  543. if (area->is_type == IS_LEVEL_1)
  544. isis_route_validate_table (area, area->route_table6[0]);
  545. else if (area->is_type == IS_LEVEL_2)
  546. isis_route_validate_table (area, area->route_table6[1]);
  547. else
  548. isis_route_validate_merge (area, AF_INET6);
  549. #endif
  550. if (!area->circuit_list) {
  551. return;
  552. }
  553. /* walk all circuits and reset any spf specific flags */
  554. for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
  555. UNSET_FLAG(circuit->flags, ISIS_CIRCUIT_FLAPPED_AFTER_SPF);
  556. return;
  557. }
  558. void
  559. isis_route_invalidate_table (struct isis_area *area, struct route_table *table)
  560. {
  561. struct route_node *rode;
  562. struct isis_route_info *rinfo;
  563. for (rode = route_top (table); rode; rode = route_next (rode))
  564. {
  565. if (rode->info == NULL)
  566. continue;
  567. rinfo = rode->info;
  568. UNSET_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ACTIVE);
  569. }
  570. }
  571. void
  572. isis_route_invalidate (struct isis_area *area)
  573. {
  574. if (area->is_type & IS_LEVEL_1)
  575. isis_route_invalidate_table (area, area->route_table[0]);
  576. if (area->is_type & IS_LEVEL_2)
  577. isis_route_invalidate_table (area, area->route_table[1]);
  578. }