paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * OSPF ABR functions. |
| 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 | |
| 23 | |
| 24 | #include <zebra.h> |
| 25 | |
| 26 | #include "thread.h" |
| 27 | #include "memory.h" |
| 28 | #include "linklist.h" |
| 29 | #include "prefix.h" |
| 30 | #include "if.h" |
| 31 | #include "table.h" |
| 32 | #include "vty.h" |
| 33 | #include "filter.h" |
| 34 | #include "plist.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_spf.h" |
| 46 | #include "ospfd/ospf_route.h" |
| 47 | #include "ospfd/ospf_ia.h" |
| 48 | #include "ospfd/ospf_flood.h" |
| 49 | #include "ospfd/ospf_abr.h" |
| 50 | #include "ospfd/ospf_ase.h" |
| 51 | #include "ospfd/ospf_zebra.h" |
| 52 | #include "ospfd/ospf_dump.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 53 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 54 | static struct ospf_area_range * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 55 | ospf_area_range_new (struct prefix_ipv4 *p) |
| 56 | { |
| 57 | struct ospf_area_range *range; |
| 58 | |
| 59 | range = XCALLOC (MTYPE_OSPF_AREA_RANGE, sizeof (struct ospf_area_range)); |
| 60 | range->addr = p->prefix; |
| 61 | range->masklen = p->prefixlen; |
| 62 | range->cost_config = OSPF_AREA_RANGE_COST_UNSPEC; |
| 63 | |
| 64 | return range; |
| 65 | } |
| 66 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 67 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 68 | ospf_area_range_free (struct ospf_area_range *range) |
| 69 | { |
| 70 | XFREE (MTYPE_OSPF_AREA_RANGE, range); |
| 71 | } |
| 72 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 73 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 74 | ospf_area_range_add (struct ospf_area *area, struct ospf_area_range *range) |
| 75 | { |
| 76 | struct route_node *rn; |
| 77 | struct prefix_ipv4 p; |
| 78 | |
| 79 | p.family = AF_INET; |
| 80 | p.prefixlen = range->masklen; |
| 81 | p.prefix = range->addr; |
| 82 | |
| 83 | rn = route_node_get (area->ranges, (struct prefix *)&p); |
| 84 | if (rn->info) |
| 85 | route_unlock_node (rn); |
| 86 | else |
| 87 | rn->info = range; |
| 88 | } |
| 89 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 90 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 91 | ospf_area_range_delete (struct ospf_area *area, struct ospf_area_range *range) |
| 92 | { |
| 93 | struct route_node *rn; |
| 94 | struct prefix_ipv4 p; |
| 95 | |
| 96 | p.family = AF_INET; |
| 97 | p.prefixlen = range->masklen; |
| 98 | p.prefix = range->addr; |
| 99 | |
| 100 | rn = route_node_lookup (area->ranges, (struct prefix *)&p); |
| 101 | if (rn) |
| 102 | { |
| 103 | ospf_area_range_free (rn->info); |
| 104 | rn->info = NULL; |
| 105 | route_unlock_node (rn); |
| 106 | route_unlock_node (rn); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | struct ospf_area_range * |
| 111 | ospf_area_range_lookup (struct ospf_area *area, struct prefix_ipv4 *p) |
| 112 | { |
| 113 | struct route_node *rn; |
| 114 | |
| 115 | rn = route_node_lookup (area->ranges, (struct prefix *)p); |
| 116 | if (rn) |
| 117 | { |
| 118 | route_unlock_node (rn); |
| 119 | return rn->info; |
| 120 | } |
| 121 | return NULL; |
| 122 | } |
| 123 | |
| 124 | struct ospf_area_range * |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 125 | ospf_area_range_lookup_next (struct ospf_area *area, |
| 126 | struct in_addr *range_net, |
| 127 | int first) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 128 | { |
| 129 | struct route_node *rn; |
| 130 | struct prefix_ipv4 p; |
| 131 | struct ospf_area_range *find; |
| 132 | |
| 133 | p.family = AF_INET; |
| 134 | p.prefixlen = IPV4_MAX_BITLEN; |
| 135 | p.prefix = *range_net; |
| 136 | |
| 137 | if (first) |
| 138 | rn = route_top (area->ranges); |
| 139 | else |
| 140 | { |
| 141 | rn = route_node_get (area->ranges, (struct prefix *) &p); |
| 142 | rn = route_next (rn); |
| 143 | } |
| 144 | |
| 145 | for (; rn; rn = route_next (rn)) |
| 146 | if (rn->info) |
| 147 | break; |
| 148 | |
| 149 | if (rn && rn->info) |
| 150 | { |
| 151 | find = rn->info; |
| 152 | *range_net = rn->p.u.prefix4; |
| 153 | route_unlock_node (rn); |
| 154 | return find; |
| 155 | } |
| 156 | return NULL; |
| 157 | } |
| 158 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 159 | static struct ospf_area_range * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 160 | ospf_area_range_match (struct ospf_area *area, struct prefix_ipv4 *p) |
| 161 | { |
| 162 | struct route_node *node; |
| 163 | |
| 164 | node = route_node_match (area->ranges, (struct prefix *) p); |
| 165 | if (node) |
| 166 | { |
| 167 | route_unlock_node (node); |
| 168 | return node->info; |
| 169 | } |
| 170 | return NULL; |
| 171 | } |
| 172 | |
| 173 | struct ospf_area_range * |
| 174 | ospf_area_range_match_any (struct ospf *ospf, struct prefix_ipv4 *p) |
| 175 | { |
| 176 | struct ospf_area_range *range; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 177 | struct ospf_area *area; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 178 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 179 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 180 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
| 181 | if ((range = ospf_area_range_match (area, p))) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 182 | return range; |
| 183 | |
| 184 | return NULL; |
| 185 | } |
| 186 | |
| 187 | int |
| 188 | ospf_area_range_active (struct ospf_area_range *range) |
| 189 | { |
| 190 | return range->specifics; |
| 191 | } |
| 192 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 193 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 194 | ospf_area_actively_attached (struct ospf_area *area) |
| 195 | { |
| 196 | return area->act_ints; |
| 197 | } |
| 198 | |
| 199 | int |
| 200 | ospf_area_range_set (struct ospf *ospf, struct in_addr area_id, |
| 201 | struct prefix_ipv4 *p, int advertise) |
| 202 | { |
| 203 | struct ospf_area *area; |
| 204 | struct ospf_area_range *range; |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 205 | int ret = OSPF_AREA_ID_FORMAT_ADDRESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 206 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 207 | area = ospf_area_get (ospf, area_id, ret); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 208 | if (area == NULL) |
| 209 | return 0; |
| 210 | |
| 211 | range = ospf_area_range_lookup (area, p); |
| 212 | if (range != NULL) |
| 213 | { |
| 214 | if ((CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE) |
| 215 | && !CHECK_FLAG (advertise, OSPF_AREA_RANGE_ADVERTISE)) |
| 216 | || (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE) |
| 217 | && CHECK_FLAG (advertise, OSPF_AREA_RANGE_ADVERTISE))) |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 218 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 219 | } |
| 220 | else |
| 221 | { |
| 222 | range = ospf_area_range_new (p); |
| 223 | ospf_area_range_add (area, range); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 224 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | if (CHECK_FLAG (advertise, OSPF_AREA_RANGE_ADVERTISE)) |
| 228 | SET_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE); |
| 229 | else |
| 230 | UNSET_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE); |
| 231 | |
| 232 | return 1; |
| 233 | } |
| 234 | |
| 235 | int |
| 236 | ospf_area_range_cost_set (struct ospf *ospf, struct in_addr area_id, |
| 237 | struct prefix_ipv4 *p, u_int32_t cost) |
| 238 | { |
| 239 | struct ospf_area *area; |
| 240 | struct ospf_area_range *range; |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 241 | int ret = OSPF_AREA_ID_FORMAT_ADDRESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 242 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 243 | area = ospf_area_get (ospf, area_id, ret); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 244 | if (area == NULL) |
| 245 | return 0; |
| 246 | |
Paul Jakma | 214a445 | 2006-05-12 22:51:49 +0000 | [diff] [blame] | 247 | range = ospf_area_range_lookup (area, p); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 248 | if (range == NULL) |
| 249 | return 0; |
| 250 | |
| 251 | if (range->cost_config != cost) |
| 252 | { |
| 253 | range->cost_config = cost; |
| 254 | if (ospf_area_range_active (range)) |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 255 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | return 1; |
| 259 | } |
| 260 | |
| 261 | int |
| 262 | ospf_area_range_unset (struct ospf *ospf, struct in_addr area_id, |
| 263 | struct prefix_ipv4 *p) |
| 264 | { |
| 265 | struct ospf_area *area; |
| 266 | struct ospf_area_range *range; |
| 267 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 268 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 269 | if (area == NULL) |
| 270 | return 0; |
| 271 | |
| 272 | range = ospf_area_range_lookup (area, p); |
| 273 | if (range == NULL) |
| 274 | return 0; |
| 275 | |
| 276 | if (ospf_area_range_active (range)) |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 277 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 278 | |
| 279 | ospf_area_range_delete (area, range); |
| 280 | |
| 281 | return 1; |
| 282 | } |
| 283 | |
| 284 | int |
| 285 | ospf_area_range_substitute_set (struct ospf *ospf, struct in_addr area_id, |
| 286 | struct prefix_ipv4 *p, struct prefix_ipv4 *s) |
| 287 | { |
| 288 | struct ospf_area *area; |
| 289 | struct ospf_area_range *range; |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 290 | int ret = OSPF_AREA_ID_FORMAT_ADDRESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 291 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 292 | area = ospf_area_get (ospf, area_id, ret); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 293 | range = ospf_area_range_lookup (area, p); |
| 294 | |
| 295 | if (range != NULL) |
| 296 | { |
| 297 | if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE) || |
| 298 | !CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE)) |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 299 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 300 | } |
| 301 | else |
| 302 | { |
| 303 | range = ospf_area_range_new (p); |
| 304 | ospf_area_range_add (area, range); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 305 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 306 | } |
| 307 | |
| 308 | SET_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE); |
| 309 | SET_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE); |
| 310 | range->subst_addr = s->prefix; |
| 311 | range->subst_masklen = s->prefixlen; |
| 312 | |
| 313 | return 1; |
| 314 | } |
| 315 | |
| 316 | int |
| 317 | ospf_area_range_substitute_unset (struct ospf *ospf, struct in_addr area_id, |
| 318 | struct prefix_ipv4 *p) |
| 319 | { |
| 320 | struct ospf_area *area; |
| 321 | struct ospf_area_range *range; |
| 322 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 323 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 324 | if (area == NULL) |
| 325 | return 0; |
| 326 | |
| 327 | range = ospf_area_range_lookup (area, p); |
| 328 | if (range == NULL) |
| 329 | return 0; |
| 330 | |
| 331 | if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE)) |
| 332 | if (ospf_area_range_active (range)) |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 333 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 334 | |
| 335 | UNSET_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE); |
| 336 | range->subst_addr.s_addr = 0; |
| 337 | range->subst_masklen = 0; |
| 338 | |
| 339 | return 1; |
| 340 | } |
| 341 | |
| 342 | int |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 343 | ospf_act_bb_connection (struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 344 | { |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 345 | if (ospf->backbone == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 346 | return 0; |
| 347 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 348 | return ospf->backbone->full_nbrs; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 349 | } |
| 350 | |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 351 | /* Determine whether this router is elected translator or not for area */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 352 | static int |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 353 | ospf_abr_nssa_am_elected (struct ospf_area *area) |
| 354 | { |
| 355 | struct route_node *rn; |
| 356 | struct ospf_lsa *lsa; |
| 357 | struct router_lsa *rlsa; |
| 358 | struct in_addr *best = NULL; |
| 359 | |
| 360 | LSDB_LOOP ( ROUTER_LSDB (area), rn, lsa) |
| 361 | { |
| 362 | /* sanity checks */ |
| 363 | if (!lsa |
| 364 | || (lsa->data->type != OSPF_ROUTER_LSA) |
| 365 | || IS_LSA_SELF (lsa)) |
| 366 | continue; |
| 367 | |
| 368 | rlsa = (struct router_lsa *) lsa->data; |
| 369 | |
| 370 | /* ignore non-ABR routers */ |
| 371 | if (!IS_ROUTER_LSA_BORDER (rlsa)) |
| 372 | continue; |
| 373 | |
| 374 | /* Router has Nt flag - always translate */ |
| 375 | if (IS_ROUTER_LSA_NT (rlsa)) |
| 376 | { |
| 377 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 378 | zlog_debug ("ospf_abr_nssa_am_elected: " |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 379 | "router %s asserts Nt", |
| 380 | inet_ntoa (lsa->data->id) ); |
| 381 | return 0; |
| 382 | } |
| 383 | |
| 384 | if (best == NULL) |
| 385 | best = &lsa->data->id; |
| 386 | else |
| 387 | if ( IPV4_ADDR_CMP (&best, &lsa->data->id) < 0) |
| 388 | best = &lsa->data->id; |
| 389 | } |
| 390 | |
| 391 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 392 | zlog_debug ("ospf_abr_nssa_am_elected: best electable ABR is: %s", |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 393 | (best) ? inet_ntoa (*best) : "<none>" ); |
| 394 | |
| 395 | if (best == NULL) |
| 396 | return 1; |
| 397 | |
| 398 | if ( IPV4_ADDR_CMP (&best, &area->ospf->router_id) < 0) |
| 399 | return 1; |
| 400 | else |
| 401 | return 0; |
| 402 | } |
| 403 | |
| 404 | /* Check NSSA ABR status |
| 405 | * assumes there are nssa areas |
| 406 | */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 407 | static void |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 408 | ospf_abr_nssa_check_status (struct ospf *ospf) |
| 409 | { |
| 410 | struct ospf_area *area; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 411 | struct listnode *lnode, *nnode; |
Paul Jakma | 9560fa8 | 2006-06-26 12:50:06 +0000 | [diff] [blame] | 412 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 413 | for (ALL_LIST_ELEMENTS (ospf->areas, lnode, nnode, area)) |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 414 | { |
Paul Jakma | 9560fa8 | 2006-06-26 12:50:06 +0000 | [diff] [blame] | 415 | u_char old_state = area->NSSATranslatorState; |
| 416 | |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 417 | if (area->external_routing != OSPF_AREA_NSSA) |
| 418 | continue; |
Paul Jakma | 9560fa8 | 2006-06-26 12:50:06 +0000 | [diff] [blame] | 419 | |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 420 | if (IS_DEBUG_OSPF (nssa, NSSA)) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 421 | zlog_debug ("ospf_abr_nssa_check_status: " |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 422 | "checking area %s", |
| 423 | inet_ntoa (area->area_id)); |
Paul Jakma | 9560fa8 | 2006-06-26 12:50:06 +0000 | [diff] [blame] | 424 | |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 425 | if (!IS_OSPF_ABR (area->ospf)) |
| 426 | { |
| 427 | if (IS_DEBUG_OSPF (nssa, NSSA)) |
Paul Jakma | 9560fa8 | 2006-06-26 12:50:06 +0000 | [diff] [blame] | 428 | zlog_debug ("ospf_abr_nssa_check_status: " |
| 429 | "not ABR"); |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 430 | area->NSSATranslatorState = OSPF_NSSA_TRANSLATE_DISABLED; |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 431 | } |
Paul Jakma | 9560fa8 | 2006-06-26 12:50:06 +0000 | [diff] [blame] | 432 | else |
| 433 | { |
| 434 | switch (area->NSSATranslatorRole) |
| 435 | { |
| 436 | case OSPF_NSSA_ROLE_NEVER: |
| 437 | /* We never Translate Type-7 LSA. */ |
| 438 | /* TODO: check previous state and flush? */ |
| 439 | if (IS_DEBUG_OSPF (nssa, NSSA)) |
| 440 | zlog_debug ("ospf_abr_nssa_check_status: " |
| 441 | "never translate"); |
| 442 | area->NSSATranslatorState = OSPF_NSSA_TRANSLATE_DISABLED; |
| 443 | break; |
| 444 | |
| 445 | case OSPF_NSSA_ROLE_ALWAYS: |
| 446 | /* We always translate if we are an ABR |
| 447 | * TODO: originate new LSAs if state change? |
| 448 | * or let the nssa abr task take care of it? |
| 449 | */ |
| 450 | if (IS_DEBUG_OSPF (nssa, NSSA)) |
| 451 | zlog_debug ("ospf_abr_nssa_check_status: " |
| 452 | "translate always"); |
| 453 | area->NSSATranslatorState = OSPF_NSSA_TRANSLATE_ENABLED; |
| 454 | break; |
| 455 | |
| 456 | case OSPF_NSSA_ROLE_CANDIDATE: |
| 457 | /* We are a candidate for Translation */ |
| 458 | if (ospf_abr_nssa_am_elected (area) > 0) |
| 459 | { |
| 460 | area->NSSATranslatorState = OSPF_NSSA_TRANSLATE_ENABLED; |
| 461 | if (IS_DEBUG_OSPF (nssa, NSSA)) |
| 462 | zlog_debug ("ospf_abr_nssa_check_status: " |
| 463 | "elected translator"); |
| 464 | } |
| 465 | else |
| 466 | { |
| 467 | area->NSSATranslatorState = OSPF_NSSA_TRANSLATE_DISABLED; |
| 468 | if (IS_DEBUG_OSPF (nssa, NSSA)) |
| 469 | zlog_debug ("ospf_abr_nssa_check_status: " "not elected"); |
| 470 | } |
| 471 | break; |
| 472 | } |
| 473 | } |
| 474 | /* RFC3101, 3.1: |
| 475 | * All NSSA border routers must set the E-bit in the Type-1 router-LSAs |
| 476 | * of their directly attached non-stub areas, even when they are not |
| 477 | * translating. |
| 478 | */ |
| 479 | if (old_state != area->NSSATranslatorState) |
| 480 | { |
| 481 | if (old_state == OSPF_NSSA_TRANSLATE_DISABLED) |
| 482 | ospf_asbr_status_update (ospf, ++ospf->redistribute); |
| 483 | else if (area->NSSATranslatorState == OSPF_NSSA_TRANSLATE_DISABLED) |
| 484 | ospf_asbr_status_update (ospf, --ospf->redistribute); |
| 485 | } |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 486 | } |
| 487 | } |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 488 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 489 | /* Check area border router status. */ |
| 490 | void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 491 | ospf_check_abr_status (struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 492 | { |
| 493 | struct ospf_area *area; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 494 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 495 | int bb_configured = 0; |
| 496 | int bb_act_attached = 0; |
| 497 | int areas_configured = 0; |
| 498 | int areas_act_attached = 0; |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 499 | u_char new_flags = ospf->flags; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 500 | |
| 501 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 502 | zlog_debug ("ospf_check_abr_status(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 503 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 504 | for (ALL_LIST_ELEMENTS (ospf->areas, node, nnode, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 505 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 506 | if (listcount (area->oiflist)) |
| 507 | { |
| 508 | areas_configured++; |
| 509 | |
| 510 | if (OSPF_IS_AREA_BACKBONE (area)) |
| 511 | bb_configured = 1; |
| 512 | } |
| 513 | |
| 514 | if (ospf_area_actively_attached (area)) |
| 515 | { |
| 516 | areas_act_attached++; |
| 517 | |
| 518 | if (OSPF_IS_AREA_BACKBONE (area)) |
| 519 | bb_act_attached = 1; |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | if (IS_DEBUG_OSPF_EVENT) |
| 524 | { |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 525 | zlog_debug ("ospf_check_abr_status(): looked through areas"); |
| 526 | zlog_debug ("ospf_check_abr_status(): bb_configured: %d", bb_configured); |
| 527 | zlog_debug ("ospf_check_abr_status(): bb_act_attached: %d", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 528 | bb_act_attached); |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 529 | zlog_debug ("ospf_check_abr_status(): areas_configured: %d", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 530 | areas_configured); |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 531 | zlog_debug ("ospf_check_abr_status(): areas_act_attached: %d", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 532 | areas_act_attached); |
| 533 | } |
| 534 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 535 | switch (ospf->abr_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 536 | { |
| 537 | case OSPF_ABR_SHORTCUT: |
| 538 | case OSPF_ABR_STAND: |
| 539 | if (areas_act_attached > 1) |
| 540 | SET_FLAG (new_flags, OSPF_FLAG_ABR); |
| 541 | else |
| 542 | UNSET_FLAG (new_flags, OSPF_FLAG_ABR); |
| 543 | break; |
| 544 | |
| 545 | case OSPF_ABR_IBM: |
| 546 | if ((areas_act_attached > 1) && bb_configured) |
| 547 | SET_FLAG (new_flags, OSPF_FLAG_ABR); |
| 548 | else |
| 549 | UNSET_FLAG (new_flags, OSPF_FLAG_ABR); |
| 550 | break; |
| 551 | |
| 552 | case OSPF_ABR_CISCO: |
| 553 | if ((areas_configured > 1) && bb_act_attached) |
| 554 | SET_FLAG (new_flags, OSPF_FLAG_ABR); |
| 555 | else |
| 556 | UNSET_FLAG (new_flags, OSPF_FLAG_ABR); |
| 557 | break; |
| 558 | default: |
| 559 | break; |
| 560 | } |
| 561 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 562 | if (new_flags != ospf->flags) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 563 | { |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 564 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 565 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 566 | zlog_debug ("ospf_check_abr_status(): new router flags: %x",new_flags); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 567 | ospf->flags = new_flags; |
| 568 | OSPF_TIMER_ON (ospf->t_router_lsa_update, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 569 | ospf_router_lsa_update_timer, OSPF_LSA_UPDATE_DELAY); |
| 570 | } |
| 571 | } |
| 572 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 573 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 574 | ospf_abr_update_aggregate (struct ospf_area_range *range, |
paul | 7f352b8 | 2004-02-19 19:37:47 +0000 | [diff] [blame] | 575 | struct ospf_route *or) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 576 | { |
| 577 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 578 | zlog_debug ("ospf_abr_update_aggregate(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 579 | |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 580 | if (range->cost_config != OSPF_AREA_RANGE_COST_UNSPEC) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 581 | { |
| 582 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 583 | zlog_debug ("ospf_abr_update_aggregate(): use configured cost %d", |
paul | 7f352b8 | 2004-02-19 19:37:47 +0000 | [diff] [blame] | 584 | range->cost_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 585 | |
| 586 | range->cost = range->cost_config; |
| 587 | } |
| 588 | else |
| 589 | { |
| 590 | if (range->specifics == 0) |
paul | 7f352b8 | 2004-02-19 19:37:47 +0000 | [diff] [blame] | 591 | range->cost = or->cost; /* 1st time get 1st cost */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 592 | |
paul | 7f352b8 | 2004-02-19 19:37:47 +0000 | [diff] [blame] | 593 | if (or->cost > range->cost) |
| 594 | { |
| 595 | if (IS_DEBUG_OSPF_EVENT) |
paul | 500e418 | 2005-05-26 17:11:13 +0000 | [diff] [blame] | 596 | zlog_debug ("ospf_abr_update_aggregate(): largest cost, update"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 597 | |
paul | 7f352b8 | 2004-02-19 19:37:47 +0000 | [diff] [blame] | 598 | range->cost = or->cost; |
| 599 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 600 | } |
| 601 | |
| 602 | range->specifics++; |
| 603 | } |
| 604 | |
| 605 | static void |
| 606 | set_metric (struct ospf_lsa *lsa, u_int32_t metric) |
| 607 | { |
| 608 | struct summary_lsa *header; |
| 609 | u_char *mp; |
| 610 | metric = htonl (metric); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 611 | mp = (u_char *) &metric; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 612 | mp++; |
| 613 | header = (struct summary_lsa *) lsa->data; |
| 614 | memcpy(header->metric, mp, 3); |
| 615 | } |
| 616 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 617 | /* ospf_abr_translate_nssa */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 618 | static int |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 619 | ospf_abr_translate_nssa (struct ospf_area *area, struct ospf_lsa *lsa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 620 | { |
| 621 | /* Incoming Type-7 or later aggregated Type-7 |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 622 | * |
| 623 | * LSA is skipped if P-bit is off. |
| 624 | * LSA is aggregated if within range. |
| 625 | * |
| 626 | * The Type-7 is translated, Installed/Approved as a Type-5 into |
| 627 | * global LSDB, then Flooded through AS |
| 628 | * |
| 629 | * Later, any Unapproved Translated Type-5's are flushed/discarded |
| 630 | */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 631 | |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 632 | struct ospf_lsa *old = NULL, |
| 633 | *new = NULL; |
| 634 | struct as_external_lsa *ext7; |
| 635 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 636 | |
| 637 | if (! CHECK_FLAG (lsa->data->options, OSPF_OPTION_NP)) |
| 638 | { |
| 639 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 640 | zlog_debug ("ospf_abr_translate_nssa(): LSA Id %s, P-bit off, NO Translation", |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 641 | inet_ntoa (lsa->data->id)); |
| 642 | return 1; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 643 | } |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 644 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 645 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 646 | zlog_debug ("ospf_abr_translate_nssa(): LSA Id %s, TRANSLATING 7 to 5", |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 647 | inet_ntoa (lsa->data->id)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 648 | |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 649 | ext7 = (struct as_external_lsa *)(lsa->data); |
| 650 | p.prefix = lsa->data->id; |
| 651 | p.prefixlen = ip_masklen (ext7->mask); |
| 652 | |
| 653 | if (ext7->e[0].fwd_addr.s_addr == OSPF_DEFAULT_DESTINATION) |
| 654 | { |
| 655 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 656 | zlog_debug ("ospf_abr_translate_nssa(): LSA Id %s, " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 657 | "Forward address is 0, NO Translation", |
| 658 | inet_ntoa (lsa->data->id)); |
| 659 | return 1; |
| 660 | } |
| 661 | |
| 662 | /* try find existing AS-External LSA for this prefix */ |
| 663 | |
| 664 | old = ospf_external_info_find_lsa (area->ospf, &p); |
| 665 | |
| 666 | if (old) |
| 667 | { |
| 668 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 669 | zlog_debug ("ospf_abr_translate_nssa(): " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 670 | "found old translated LSA Id %s, refreshing", |
| 671 | inet_ntoa (old->data->id)); |
| 672 | |
| 673 | /* refresh */ |
| 674 | new = ospf_translated_nssa_refresh (area->ospf, lsa, old); |
| 675 | if (!new) |
| 676 | { |
| 677 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 678 | zlog_debug ("ospf_abr_translate_nssa(): " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 679 | "could not refresh translated LSA Id %s", |
| 680 | inet_ntoa (old->data->id)); |
| 681 | } |
| 682 | } |
| 683 | else |
| 684 | { |
| 685 | /* no existing external route for this LSA Id |
| 686 | * originate translated LSA |
| 687 | */ |
| 688 | |
| 689 | if ((new = ospf_translated_nssa_originate (area->ospf, lsa)) |
| 690 | == NULL) |
| 691 | { |
| 692 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 693 | zlog_debug ("ospf_abr_translate_nssa(): Could not translate " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 694 | "Type-7 for %s to Type-5", |
| 695 | inet_ntoa (lsa->data->id)); |
| 696 | return 1; |
| 697 | } |
| 698 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 699 | |
| 700 | /* Area where Aggregate testing will be inserted, just like summary |
| 701 | advertisements */ |
| 702 | /* ospf_abr_check_nssa_range (p_arg, lsa-> cost, lsa -> area); */ |
| 703 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 704 | return 0; |
| 705 | } |
| 706 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 707 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 708 | ospf_abr_translate_nssa_range (struct prefix_ipv4 *p, u_int32_t cost) |
| 709 | { |
| 710 | /* The Type-7 is created from the aggregated prefix and forwarded |
| 711 | for lsa installation and flooding... to be added... */ |
| 712 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 713 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 714 | void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 715 | ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost, |
| 716 | struct ospf_area *area) |
| 717 | { |
| 718 | struct ospf_lsa *lsa, *old = NULL; |
| 719 | struct summary_lsa *sl = NULL; |
| 720 | |
| 721 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 722 | zlog_debug ("ospf_abr_announce_network_to_area(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 723 | |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 724 | old = ospf_lsa_lookup_by_prefix (area->lsdb, OSPF_SUMMARY_LSA, |
| 725 | (struct prefix_ipv4 *) p, |
| 726 | area->ospf->router_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 727 | if (old) |
| 728 | { |
| 729 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 730 | zlog_debug ("ospf_abr_announce_network_to_area(): old summary found"); |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 731 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 732 | sl = (struct summary_lsa *) old->data; |
| 733 | |
| 734 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 735 | zlog_debug ("ospf_abr_announce_network_to_area(): " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 736 | "old metric: %d, new metric: %d", |
| 737 | GET_METRIC (sl->metric), cost); |
| 738 | |
| 739 | if (GET_METRIC (sl->metric) == cost) |
| 740 | { |
| 741 | /* unchanged. simply reapprove it */ |
| 742 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 743 | zlog_debug ("ospf_abr_announce_network_to_area(): " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 744 | "old summary approved"); |
| 745 | SET_FLAG (old->flags, OSPF_LSA_APPROVED); |
| 746 | } |
| 747 | else |
| 748 | { |
| 749 | /* LSA is changed, refresh it */ |
| 750 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 751 | zlog_debug ("ospf_abr_announce_network_to_area(): " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 752 | "refreshing summary"); |
| 753 | set_metric (old, cost); |
| 754 | lsa = ospf_summary_lsa_refresh (area->ospf, old); |
paul | c24d602 | 2005-11-20 14:54:12 +0000 | [diff] [blame] | 755 | |
| 756 | if (!lsa) |
| 757 | { |
| 758 | char buf[INET_ADDRSTRLEN + 3]; /* ipv4 and /XX */ |
| 759 | |
| 760 | prefix2str ((struct prefix *) p, buf, sizeof(buf)); |
| 761 | zlog_warn ("%s: Could not refresh %s to %s", |
| 762 | __func__, |
| 763 | buf, |
| 764 | inet_ntoa (area->area_id)); |
| 765 | return; |
| 766 | } |
| 767 | |
paul | c898775 | 2005-07-26 06:07:22 +0000 | [diff] [blame] | 768 | SET_FLAG (lsa->flags, OSPF_LSA_APPROVED); |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 769 | /* This will flood through area. */ |
| 770 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 771 | } |
| 772 | else |
| 773 | { |
| 774 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 775 | zlog_debug ("ospf_abr_announce_network_to_area(): " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 776 | "creating new summary"); |
| 777 | lsa = ospf_summary_lsa_originate ( (struct prefix_ipv4 *)p, cost, area); |
| 778 | /* This will flood through area. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 779 | |
paul | c24d602 | 2005-11-20 14:54:12 +0000 | [diff] [blame] | 780 | if (!lsa) |
| 781 | { |
| 782 | char buf[INET_ADDRSTRLEN + 3]; /* ipv4 and /XX */ |
| 783 | |
| 784 | prefix2str ((struct prefix *)p, buf, sizeof(buf)); |
| 785 | zlog_warn ("%s: Could not originate %s to %s", |
| 786 | __func__, |
| 787 | buf, |
| 788 | inet_ntoa (area->area_id)); |
| 789 | return; |
| 790 | } |
| 791 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 792 | SET_FLAG (lsa->flags, OSPF_LSA_APPROVED); |
| 793 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 794 | zlog_debug ("ospf_abr_announce_network_to_area(): " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 795 | "flooding new version of summary"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 796 | } |
| 797 | |
| 798 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 799 | zlog_debug ("ospf_abr_announce_network_to_area(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 800 | } |
| 801 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 802 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 803 | ospf_abr_nexthops_belong_to_area (struct ospf_route *or, |
| 804 | struct ospf_area *area) |
| 805 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 806 | struct listnode *node, *nnode; |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 807 | struct ospf_path *path; |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 808 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 809 | |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 810 | for (ALL_LIST_ELEMENTS_RO (or->paths, node, path)) |
| 811 | for (ALL_LIST_ELEMENTS_RO (area->oiflist, nnode, oi)) |
| 812 | if (oi->ifp && oi->ifp->ifindex == path->ifindex) |
| 813 | return 1; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 814 | |
| 815 | return 0; |
| 816 | } |
| 817 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 818 | static int |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 819 | ospf_abr_should_accept (struct prefix_ipv4 *p, struct ospf_area *area) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 820 | { |
| 821 | if (IMPORT_NAME (area)) |
| 822 | { |
| 823 | if (IMPORT_LIST (area) == NULL) |
| 824 | IMPORT_LIST (area) = access_list_lookup (AFI_IP, IMPORT_NAME (area)); |
| 825 | |
| 826 | if (IMPORT_LIST (area)) |
| 827 | if (access_list_apply (IMPORT_LIST (area), p) == FILTER_DENY) |
| 828 | return 0; |
| 829 | } |
| 830 | |
| 831 | return 1; |
| 832 | } |
| 833 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 834 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 835 | ospf_abr_plist_in_check (struct ospf_area *area, struct ospf_route *or, |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 836 | struct prefix_ipv4 *p) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 837 | { |
| 838 | if (PREFIX_NAME_IN (area)) |
| 839 | { |
| 840 | if (PREFIX_LIST_IN (area) == NULL) |
| 841 | PREFIX_LIST_IN (area) = prefix_list_lookup (AFI_IP, |
| 842 | PREFIX_NAME_IN (area)); |
| 843 | if (PREFIX_LIST_IN (area)) |
| 844 | if (prefix_list_apply (PREFIX_LIST_IN (area), p) != PREFIX_PERMIT) |
| 845 | return 0; |
| 846 | } |
| 847 | return 1; |
| 848 | } |
| 849 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 850 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 851 | ospf_abr_plist_out_check (struct ospf_area *area, struct ospf_route *or, |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 852 | struct prefix_ipv4 *p) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 853 | { |
| 854 | if (PREFIX_NAME_OUT (area)) |
| 855 | { |
| 856 | if (PREFIX_LIST_OUT (area) == NULL) |
| 857 | PREFIX_LIST_OUT (area) = prefix_list_lookup (AFI_IP, |
| 858 | PREFIX_NAME_OUT (area)); |
| 859 | if (PREFIX_LIST_OUT (area)) |
| 860 | if (prefix_list_apply (PREFIX_LIST_OUT (area), p) != PREFIX_PERMIT) |
| 861 | return 0; |
| 862 | } |
| 863 | return 1; |
| 864 | } |
| 865 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 866 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 867 | ospf_abr_announce_network (struct ospf *ospf, |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 868 | struct prefix_ipv4 *p, struct ospf_route *or) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 869 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 870 | struct ospf_area_range *range; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 871 | struct ospf_area *area, *or_area; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 872 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 873 | |
| 874 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 875 | zlog_debug ("ospf_abr_announce_network(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 876 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 877 | or_area = ospf_area_lookup_by_area_id (ospf, or->u.std.area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 878 | assert (or_area); |
| 879 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 880 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 881 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 882 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 883 | zlog_debug ("ospf_abr_announce_network(): looking at area %s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 884 | inet_ntoa (area->area_id)); |
| 885 | |
| 886 | if (IPV4_ADDR_SAME (&or->u.std.area_id, &area->area_id)) |
| 887 | continue; |
| 888 | |
| 889 | if (ospf_abr_nexthops_belong_to_area (or, area)) |
| 890 | continue; |
| 891 | |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 892 | if (!ospf_abr_should_accept (p, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 893 | { |
| 894 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 895 | zlog_debug ("ospf_abr_announce_network(): " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 896 | "prefix %s/%d was denied by import-list", |
| 897 | inet_ntoa (p->prefix), p->prefixlen); |
| 898 | continue; |
| 899 | } |
| 900 | |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 901 | if (!ospf_abr_plist_in_check (area, or, p)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 902 | { |
| 903 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 904 | zlog_debug ("ospf_abr_announce_network(): " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 905 | "prefix %s/%d was denied by prefix-list", |
| 906 | inet_ntoa (p->prefix), p->prefixlen); |
| 907 | continue; |
| 908 | } |
| 909 | |
| 910 | if (area->external_routing != OSPF_AREA_DEFAULT && area->no_summary) |
| 911 | { |
| 912 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 913 | zlog_debug ("ospf_abr_announce_network(): " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 914 | "area %s is stub and no_summary", |
| 915 | inet_ntoa (area->area_id)); |
| 916 | continue; |
| 917 | } |
| 918 | |
| 919 | if (or->path_type == OSPF_PATH_INTER_AREA) |
| 920 | { |
| 921 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 922 | zlog_debug ("ospf_abr_announce_network(): this is " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 923 | "inter-area route to %s/%d", |
| 924 | inet_ntoa (p->prefix), p->prefixlen); |
| 925 | |
| 926 | if (!OSPF_IS_AREA_BACKBONE (area)) |
| 927 | ospf_abr_announce_network_to_area (p, or->cost, area); |
| 928 | } |
| 929 | |
| 930 | if (or->path_type == OSPF_PATH_INTRA_AREA) |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 931 | { |
| 932 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 933 | zlog_debug ("ospf_abr_announce_network(): " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 934 | "this is intra-area route to %s/%d", |
| 935 | inet_ntoa (p->prefix), p->prefixlen); |
| 936 | if ((range = ospf_area_range_match (or_area, p)) |
| 937 | && !ospf_area_is_transit (area)) |
| 938 | ospf_abr_update_aggregate (range, or); |
| 939 | else |
| 940 | ospf_abr_announce_network_to_area (p, or->cost, area); |
| 941 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 942 | } |
| 943 | } |
| 944 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 945 | static int |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 946 | ospf_abr_should_announce (struct ospf *ospf, |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 947 | struct prefix_ipv4 *p, struct ospf_route *or) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 948 | { |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 949 | struct ospf_area *area; |
| 950 | |
| 951 | area = ospf_area_lookup_by_area_id (ospf, or->u.std.area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 952 | |
| 953 | assert (area); |
| 954 | |
| 955 | if (EXPORT_NAME (area)) |
| 956 | { |
| 957 | if (EXPORT_LIST (area) == NULL) |
| 958 | EXPORT_LIST (area) = access_list_lookup (AFI_IP, EXPORT_NAME (area)); |
| 959 | |
| 960 | if (EXPORT_LIST (area)) |
| 961 | if (access_list_apply (EXPORT_LIST (area), p) == FILTER_DENY) |
| 962 | return 0; |
| 963 | } |
| 964 | |
| 965 | return 1; |
| 966 | } |
| 967 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 968 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 969 | ospf_abr_process_nssa_translates (struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 970 | { |
| 971 | /* Scan through all NSSA_LSDB records for all areas; |
| 972 | |
| 973 | If P-bit is on, translate all Type-7's to 5's and aggregate or |
| 974 | flood install as approved in Type-5 LSDB with XLATE Flag on |
| 975 | later, do same for all aggregates... At end, DISCARD all |
| 976 | remaining UNAPPROVED Type-5's (Aggregate is for future ) */ |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 977 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 978 | struct ospf_area *area; |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 979 | struct route_node *rn; |
| 980 | struct ospf_lsa *lsa; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 981 | |
| 982 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 983 | zlog_debug ("ospf_abr_process_nssa_translates(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 984 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 985 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 986 | { |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 987 | if (! area->NSSATranslatorState) |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 988 | continue; /* skip if not translator */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 989 | |
| 990 | if (area->external_routing != OSPF_AREA_NSSA) |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 991 | continue; /* skip if not Nssa Area */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 992 | |
| 993 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 994 | zlog_debug ("ospf_abr_process_nssa_translates(): " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 995 | "looking at area %s", inet_ntoa (area->area_id)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 996 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 997 | LSDB_LOOP (NSSA_LSDB (area), rn, lsa) |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 998 | ospf_abr_translate_nssa (area, lsa); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 999 | } |
| 1000 | |
| 1001 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1002 | zlog_debug ("ospf_abr_process_nssa_translates(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1003 | |
| 1004 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1005 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1006 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1007 | ospf_abr_process_network_rt (struct ospf *ospf, |
| 1008 | struct route_table *rt) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1009 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1010 | struct ospf_area *area; |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1011 | struct ospf_route *or; |
| 1012 | struct route_node *rn; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1013 | |
| 1014 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1015 | zlog_debug ("ospf_abr_process_network_rt(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1016 | |
| 1017 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 1018 | { |
| 1019 | if ((or = rn->info) == NULL) |
| 1020 | continue; |
| 1021 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1022 | if (!(area = ospf_area_lookup_by_area_id (ospf, or->u.std.area_id))) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1023 | { |
| 1024 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1025 | zlog_debug ("ospf_abr_process_network_rt(): area %s no longer exists", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1026 | inet_ntoa (or->u.std.area_id)); |
| 1027 | continue; |
| 1028 | } |
| 1029 | |
| 1030 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1031 | zlog_debug ("ospf_abr_process_network_rt(): this is a route to %s/%d", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1032 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); |
| 1033 | if (or->path_type >= OSPF_PATH_TYPE1_EXTERNAL) |
| 1034 | { |
| 1035 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1036 | zlog_debug ("ospf_abr_process_network_rt(): " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1037 | "this is an External router, skipping"); |
| 1038 | continue; |
| 1039 | } |
| 1040 | |
| 1041 | if (or->cost >= OSPF_LS_INFINITY) |
| 1042 | { |
| 1043 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1044 | zlog_debug ("ospf_abr_process_network_rt():" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1045 | " this route's cost is infinity, skipping"); |
| 1046 | continue; |
| 1047 | } |
| 1048 | |
| 1049 | if (or->type == OSPF_DESTINATION_DISCARD) |
| 1050 | { |
| 1051 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1052 | zlog_debug ("ospf_abr_process_network_rt():" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1053 | " this is a discard entry, skipping"); |
| 1054 | continue; |
| 1055 | } |
| 1056 | |
| 1057 | if (or->path_type == OSPF_PATH_INTRA_AREA && |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1058 | !ospf_abr_should_announce (ospf, (struct prefix_ipv4 *) &rn->p, or)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1059 | { |
| 1060 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1061 | zlog_debug("ospf_abr_process_network_rt(): denied by export-list"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1062 | continue; |
| 1063 | } |
| 1064 | |
| 1065 | if (or->path_type == OSPF_PATH_INTRA_AREA && |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1066 | !ospf_abr_plist_out_check (area, or, (struct prefix_ipv4 *) &rn->p)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1067 | { |
| 1068 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1069 | zlog_debug("ospf_abr_process_network_rt(): denied by prefix-list"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1070 | continue; |
| 1071 | } |
| 1072 | |
| 1073 | if ((or->path_type == OSPF_PATH_INTER_AREA) && |
| 1074 | !OSPF_IS_AREA_ID_BACKBONE (or->u.std.area_id)) |
| 1075 | { |
| 1076 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1077 | zlog_debug ("ospf_abr_process_network_rt():" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1078 | " this is route is not backbone one, skipping"); |
| 1079 | continue; |
| 1080 | } |
| 1081 | |
| 1082 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1083 | if ((ospf->abr_type == OSPF_ABR_CISCO) || |
| 1084 | (ospf->abr_type == OSPF_ABR_IBM)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1085 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1086 | if (!ospf_act_bb_connection (ospf) && |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1087 | or->path_type != OSPF_PATH_INTRA_AREA) |
| 1088 | { |
| 1089 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1090 | zlog_debug ("ospf_abr_process_network_rt(): ALT ABR: " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1091 | "No BB connection, skip not intra-area routes"); |
| 1092 | continue; |
| 1093 | } |
| 1094 | |
| 1095 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1096 | zlog_debug ("ospf_abr_process_network_rt(): announcing"); |
hasso | fa2b17e | 2004-03-04 17:45:00 +0000 | [diff] [blame] | 1097 | ospf_abr_announce_network (ospf, (struct prefix_ipv4 *)&rn->p, or); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1098 | } |
| 1099 | |
| 1100 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1101 | zlog_debug ("ospf_abr_process_network_rt(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1102 | } |
| 1103 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1104 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1105 | ospf_abr_announce_rtr_to_area (struct prefix_ipv4 *p, u_int32_t cost, |
| 1106 | struct ospf_area *area) |
| 1107 | { |
| 1108 | struct ospf_lsa *lsa, *old = NULL; |
| 1109 | struct summary_lsa *slsa = NULL; |
| 1110 | |
| 1111 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1112 | zlog_debug ("ospf_abr_announce_rtr_to_area(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1113 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1114 | old = ospf_lsa_lookup_by_prefix (area->lsdb, OSPF_ASBR_SUMMARY_LSA, |
| 1115 | p, area->ospf->router_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1116 | if (old) |
| 1117 | { |
| 1118 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1119 | zlog_debug ("ospf_abr_announce_rtr_to_area(): old summary found"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1120 | slsa = (struct summary_lsa *) old->data; |
| 1121 | |
| 1122 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1123 | zlog_debug ("ospf_abr_announce_network_to_area(): " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1124 | "old metric: %d, new metric: %d", |
| 1125 | GET_METRIC (slsa->metric), cost); |
| 1126 | } |
| 1127 | |
| 1128 | if (old && (GET_METRIC (slsa->metric) == cost)) |
| 1129 | { |
| 1130 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1131 | zlog_debug ("ospf_abr_announce_rtr_to_area(): old summary approved"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1132 | SET_FLAG (old->flags, OSPF_LSA_APPROVED); |
| 1133 | } |
| 1134 | else |
| 1135 | { |
| 1136 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1137 | zlog_debug ("ospf_abr_announce_rtr_to_area(): 2.2"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1138 | |
| 1139 | if (old) |
| 1140 | { |
| 1141 | set_metric (old, cost); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1142 | lsa = ospf_summary_asbr_lsa_refresh (area->ospf, old); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1143 | } |
| 1144 | else |
| 1145 | lsa = ospf_summary_asbr_lsa_originate (p, cost, area); |
paul | c24d602 | 2005-11-20 14:54:12 +0000 | [diff] [blame] | 1146 | if (!lsa) |
| 1147 | { |
| 1148 | char buf[INET_ADDRSTRLEN + 3]; /* ipv4 and /XX */ |
| 1149 | |
| 1150 | prefix2str ((struct prefix *)p, buf, sizeof(buf)); |
| 1151 | zlog_warn ("%s: Could not refresh/originate %s to %s", |
| 1152 | __func__, |
| 1153 | buf, |
| 1154 | inet_ntoa (area->area_id)); |
| 1155 | return; |
| 1156 | } |
| 1157 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1158 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1159 | zlog_debug ("ospf_abr_announce_rtr_to_area(): " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1160 | "flooding new version of summary"); |
paul | c24d602 | 2005-11-20 14:54:12 +0000 | [diff] [blame] | 1161 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1162 | /* |
| 1163 | zlog_info ("ospf_abr_announce_rtr_to_area(): creating new summary"); |
| 1164 | lsa = ospf_summary_asbr_lsa (p, cost, area, old); */ |
| 1165 | |
| 1166 | SET_FLAG (lsa->flags, OSPF_LSA_APPROVED); |
| 1167 | /* ospf_flood_through_area (area, NULL, lsa);*/ |
| 1168 | } |
| 1169 | |
| 1170 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1171 | zlog_debug ("ospf_abr_announce_rtr_to_area(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1172 | } |
| 1173 | |
| 1174 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1175 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1176 | ospf_abr_announce_rtr (struct ospf *ospf, |
| 1177 | struct prefix_ipv4 *p, struct ospf_route *or) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1178 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 1179 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1180 | struct ospf_area *area; |
| 1181 | |
| 1182 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1183 | zlog_debug ("ospf_abr_announce_rtr(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1184 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1185 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1186 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1187 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1188 | zlog_debug ("ospf_abr_announce_rtr(): looking at area %s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1189 | inet_ntoa (area->area_id)); |
| 1190 | |
| 1191 | if (IPV4_ADDR_SAME (&or->u.std.area_id, &area->area_id)) |
| 1192 | continue; |
| 1193 | |
| 1194 | if (ospf_abr_nexthops_belong_to_area (or, area)) |
| 1195 | continue; |
| 1196 | |
| 1197 | if (area->external_routing != OSPF_AREA_DEFAULT) |
| 1198 | { |
| 1199 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1200 | zlog_debug ("ospf_abr_announce_rtr(): " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1201 | "area %s doesn't support external routing", |
| 1202 | inet_ntoa(area->area_id)); |
| 1203 | continue; |
| 1204 | } |
| 1205 | |
| 1206 | if (or->path_type == OSPF_PATH_INTER_AREA) |
| 1207 | { |
| 1208 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1209 | zlog_debug ("ospf_abr_announce_rtr(): " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1210 | "this is inter-area route to %s", inet_ntoa (p->prefix)); |
| 1211 | if (!OSPF_IS_AREA_BACKBONE (area)) |
| 1212 | ospf_abr_announce_rtr_to_area (p, or->cost, area); |
| 1213 | } |
| 1214 | |
| 1215 | if (or->path_type == OSPF_PATH_INTRA_AREA) |
| 1216 | { |
| 1217 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1218 | zlog_debug ("ospf_abr_announce_rtr(): " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1219 | "this is intra-area route to %s", inet_ntoa (p->prefix)); |
| 1220 | ospf_abr_announce_rtr_to_area (p, or->cost, area); |
| 1221 | } |
| 1222 | } |
| 1223 | |
| 1224 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1225 | zlog_debug ("ospf_abr_announce_rtr(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1226 | } |
| 1227 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1228 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1229 | ospf_abr_process_router_rt (struct ospf *ospf, struct route_table *rt) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1230 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1231 | struct ospf_route *or; |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1232 | struct route_node *rn; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1233 | struct list *l; |
| 1234 | |
| 1235 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1236 | zlog_debug ("ospf_abr_process_router_rt(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1237 | |
| 1238 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 1239 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1240 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1241 | char flag = 0; |
| 1242 | struct ospf_route *best = NULL; |
| 1243 | |
| 1244 | if (rn->info == NULL) |
| 1245 | continue; |
| 1246 | |
| 1247 | l = rn->info; |
| 1248 | |
| 1249 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1250 | zlog_debug ("ospf_abr_process_router_rt(): this is a route to %s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1251 | inet_ntoa (rn->p.u.prefix4)); |
| 1252 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1253 | for (ALL_LIST_ELEMENTS (l, node, nnode, or)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1254 | { |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1255 | if (!ospf_area_lookup_by_area_id (ospf, or->u.std.area_id)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1256 | { |
| 1257 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1258 | zlog_debug ("ospf_abr_process_router_rt(): area %s no longer exists", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1259 | inet_ntoa (or->u.std.area_id)); |
| 1260 | continue; |
| 1261 | } |
| 1262 | |
| 1263 | |
| 1264 | if (!CHECK_FLAG (or->u.std.flags, ROUTER_LSA_EXTERNAL)) |
| 1265 | { |
| 1266 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1267 | zlog_debug ("ospf_abr_process_router_rt(): " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1268 | "This is not an ASBR, skipping"); |
| 1269 | continue; |
| 1270 | } |
| 1271 | |
| 1272 | if (!flag) |
| 1273 | { |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1274 | best = ospf_find_asbr_route (ospf, rt, |
| 1275 | (struct prefix_ipv4 *) &rn->p); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1276 | flag = 1; |
| 1277 | } |
| 1278 | |
| 1279 | if (best == NULL) |
| 1280 | continue; |
| 1281 | |
| 1282 | if (or != best) |
| 1283 | { |
| 1284 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1285 | zlog_debug ("ospf_abr_process_router_rt(): " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1286 | "This route is not the best among possible, skipping"); |
| 1287 | continue; |
| 1288 | } |
| 1289 | |
| 1290 | if (or->path_type == OSPF_PATH_INTER_AREA && |
| 1291 | !OSPF_IS_AREA_ID_BACKBONE (or->u.std.area_id)) |
| 1292 | { |
| 1293 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1294 | zlog_debug ("ospf_abr_process_router_rt(): " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1295 | "This route is not a backbone one, skipping"); |
| 1296 | continue; |
| 1297 | } |
| 1298 | |
| 1299 | if (or->cost >= OSPF_LS_INFINITY) |
| 1300 | { |
| 1301 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1302 | zlog_debug ("ospf_abr_process_router_rt(): " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1303 | "This route has LS_INFINITY metric, skipping"); |
| 1304 | continue; |
| 1305 | } |
| 1306 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1307 | if (ospf->abr_type == OSPF_ABR_CISCO |
| 1308 | || ospf->abr_type == OSPF_ABR_IBM) |
| 1309 | if (!ospf_act_bb_connection (ospf) |
| 1310 | && or->path_type != OSPF_PATH_INTRA_AREA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1311 | { |
| 1312 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1313 | zlog_debug("ospf_abr_process_network_rt(): ALT ABR: " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1314 | "No BB connection, skip not intra-area routes"); |
| 1315 | continue; |
| 1316 | } |
| 1317 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1318 | ospf_abr_announce_rtr (ospf, (struct prefix_ipv4 *) &rn->p, or); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1319 | |
| 1320 | } |
| 1321 | |
| 1322 | } |
| 1323 | |
| 1324 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1325 | zlog_debug ("ospf_abr_process_router_rt(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1326 | } |
| 1327 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1328 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1329 | ospf_abr_unapprove_translates (struct ospf *ospf) /* For NSSA Translations */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1330 | { |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1331 | struct ospf_lsa *lsa; |
| 1332 | struct route_node *rn; |
| 1333 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1334 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1335 | zlog_debug ("ospf_abr_unapprove_translates(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1336 | |
| 1337 | /* NSSA Translator is not checked, because it may have gone away, |
| 1338 | and we would want to flush any residuals anyway */ |
| 1339 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1340 | LSDB_LOOP (EXTERNAL_LSDB (ospf), rn, lsa) |
| 1341 | if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT)) |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1342 | { |
| 1343 | UNSET_FLAG (lsa->flags, OSPF_LSA_APPROVED); |
| 1344 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1345 | zlog_debug ("ospf_abr_unapprove_translates(): " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1346 | "approved unset on link id %s", |
| 1347 | inet_ntoa (lsa->data->id)); |
| 1348 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1349 | |
| 1350 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1351 | zlog_debug ("ospf_abr_unapprove_translates(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1352 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1353 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1354 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1355 | ospf_abr_unapprove_summaries (struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1356 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 1357 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1358 | struct ospf_area *area; |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1359 | struct route_node *rn; |
| 1360 | struct ospf_lsa *lsa; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1361 | |
| 1362 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1363 | zlog_debug ("ospf_abr_unapprove_summaries(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1364 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1365 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1366 | { |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1367 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1368 | zlog_debug ("ospf_abr_unapprove_summaries(): " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1369 | "considering area %s", |
| 1370 | inet_ntoa (area->area_id)); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1371 | LSDB_LOOP (SUMMARY_LSDB (area), rn, lsa) |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1372 | if (ospf_lsa_is_self_originated (ospf, lsa)) |
| 1373 | { |
| 1374 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1375 | zlog_debug ("ospf_abr_unapprove_summaries(): " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1376 | "approved unset on summary link id %s", |
| 1377 | inet_ntoa (lsa->data->id)); |
| 1378 | UNSET_FLAG (lsa->flags, OSPF_LSA_APPROVED); |
| 1379 | } |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1380 | |
| 1381 | LSDB_LOOP (ASBR_SUMMARY_LSDB (area), rn, lsa) |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1382 | if (ospf_lsa_is_self_originated (ospf, lsa)) |
| 1383 | { |
| 1384 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1385 | zlog_debug ("ospf_abr_unapprove_summaries(): " |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1386 | "approved unset on asbr-summary link id %s", |
| 1387 | inet_ntoa (lsa->data->id)); |
| 1388 | UNSET_FLAG (lsa->flags, OSPF_LSA_APPROVED); |
| 1389 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1390 | } |
| 1391 | |
| 1392 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1393 | zlog_debug ("ospf_abr_unapprove_summaries(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1394 | } |
| 1395 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1396 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1397 | ospf_abr_prepare_aggregates (struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1398 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 1399 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1400 | struct route_node *rn; |
| 1401 | struct ospf_area_range *range; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1402 | struct ospf_area *area; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1403 | |
| 1404 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1405 | zlog_debug ("ospf_abr_prepare_aggregates(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1406 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1407 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1408 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1409 | for (rn = route_top (area->ranges); rn; rn = route_next (rn)) |
| 1410 | if ((range = rn->info) != NULL) |
| 1411 | { |
| 1412 | range->cost = 0; |
| 1413 | range->specifics = 0; |
| 1414 | } |
| 1415 | } |
| 1416 | |
| 1417 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1418 | zlog_debug ("ospf_abr_prepare_aggregates(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1419 | } |
| 1420 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1421 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1422 | ospf_abr_announce_aggregates (struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1423 | { |
| 1424 | struct ospf_area *area, *ar; |
| 1425 | struct ospf_area_range *range; |
| 1426 | struct route_node *rn; |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1427 | struct prefix p; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 1428 | struct listnode *node, *n; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1429 | |
| 1430 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1431 | zlog_debug ("ospf_abr_announce_aggregates(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1432 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1433 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1434 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1435 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1436 | zlog_debug ("ospf_abr_announce_aggregates(): looking at area %s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1437 | inet_ntoa (area->area_id)); |
| 1438 | |
| 1439 | for (rn = route_top (area->ranges); rn; rn = route_next (rn)) |
| 1440 | if ((range = rn->info)) |
| 1441 | { |
| 1442 | if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE)) |
| 1443 | { |
| 1444 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1445 | zlog_debug ("ospf_abr_announce_aggregates():" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1446 | " discarding suppress-ranges"); |
| 1447 | continue; |
| 1448 | } |
| 1449 | |
| 1450 | p.family = AF_INET; |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1451 | p.u.prefix4 = range->addr; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1452 | p.prefixlen = range->masklen; |
| 1453 | |
| 1454 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1455 | zlog_debug ("ospf_abr_announce_aggregates():" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1456 | " this is range: %s/%d", |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1457 | inet_ntoa (p.u.prefix4), p.prefixlen); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1458 | |
| 1459 | if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE)) |
| 1460 | { |
| 1461 | p.family = AF_INET; |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1462 | p.u.prefix4 = range->subst_addr; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1463 | p.prefixlen = range->subst_masklen; |
| 1464 | } |
| 1465 | |
| 1466 | if (range->specifics) |
| 1467 | { |
| 1468 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1469 | zlog_debug ("ospf_abr_announce_aggregates(): active range"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1470 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1471 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, n, ar)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1472 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1473 | if (ar == area) |
| 1474 | continue; |
| 1475 | |
| 1476 | /* We do not check nexthops here, because |
| 1477 | intra-area routes can be associated with |
| 1478 | one area only */ |
| 1479 | |
| 1480 | /* backbone routes are not summarized |
| 1481 | when announced into transit areas */ |
| 1482 | |
| 1483 | if (ospf_area_is_transit (ar) && |
| 1484 | OSPF_IS_AREA_BACKBONE (area)) |
| 1485 | { |
| 1486 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1487 | zlog_debug ("ospf_abr_announce_aggregates(): Skipping " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1488 | "announcement of BB aggregate into" |
| 1489 | " a transit area"); |
| 1490 | continue; |
| 1491 | } |
hasso | fa2b17e | 2004-03-04 17:45:00 +0000 | [diff] [blame] | 1492 | ospf_abr_announce_network_to_area ((struct prefix_ipv4 *)&p, range->cost, ar); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1493 | } |
| 1494 | } |
| 1495 | } |
| 1496 | } |
| 1497 | |
| 1498 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1499 | zlog_debug ("ospf_abr_announce_aggregates(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1500 | } |
| 1501 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1502 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1503 | ospf_abr_send_nssa_aggregates (struct ospf *ospf) /* temporarily turned off */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1504 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 1505 | struct listnode *node; /*, n; */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1506 | struct ospf_area *area; /*, *ar; */ |
| 1507 | struct route_node *rn; |
| 1508 | struct ospf_area_range *range; |
| 1509 | struct prefix_ipv4 p; |
| 1510 | |
| 1511 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1512 | zlog_debug ("ospf_abr_send_nssa_aggregates(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1513 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1514 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1515 | { |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 1516 | if (! area->NSSATranslatorState) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1517 | continue; |
| 1518 | |
| 1519 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1520 | zlog_debug ("ospf_abr_send_nssa_aggregates(): looking at area %s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1521 | inet_ntoa (area->area_id)); |
| 1522 | |
| 1523 | for (rn = route_top (area->ranges); rn; rn = route_next (rn)) |
| 1524 | { |
| 1525 | if (rn->info == NULL) |
| 1526 | continue; |
| 1527 | |
| 1528 | range = rn->info; |
| 1529 | |
| 1530 | if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE)) |
| 1531 | { |
| 1532 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1533 | zlog_debug ("ospf_abr_send_nssa_aggregates():" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1534 | " discarding suppress-ranges"); |
| 1535 | continue; |
| 1536 | } |
| 1537 | |
| 1538 | p.family = AF_INET; |
| 1539 | p.prefix = range->addr; |
| 1540 | p.prefixlen = range->masklen; |
| 1541 | |
| 1542 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1543 | zlog_debug ("ospf_abr_send_nssa_aggregates():" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1544 | " this is range: %s/%d", |
| 1545 | inet_ntoa (p.prefix), p.prefixlen); |
| 1546 | |
| 1547 | if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE)) |
| 1548 | { |
| 1549 | p.family = AF_INET; |
| 1550 | p.prefix = range->subst_addr; |
| 1551 | p.prefixlen = range->subst_masklen; |
| 1552 | } |
| 1553 | |
| 1554 | if (range->specifics) |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 1555 | { |
| 1556 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1557 | zlog_debug ("ospf_abr_send_nssa_aggregates(): active range"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1558 | |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 1559 | /* Fetch LSA-Type-7 from aggregate prefix, and then |
| 1560 | * translate, Install (as Type-5), Approve, and Flood |
| 1561 | */ |
| 1562 | ospf_abr_translate_nssa_range (&p, range->cost); |
| 1563 | } |
| 1564 | } /* all area ranges*/ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1565 | } /* all areas */ |
| 1566 | |
| 1567 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1568 | zlog_debug ("ospf_abr_send_nssa_aggregates(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1569 | } |
| 1570 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1571 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1572 | ospf_abr_announce_stub_defaults (struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1573 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 1574 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1575 | struct ospf_area *area; |
| 1576 | struct prefix_ipv4 p; |
| 1577 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1578 | if (! IS_OSPF_ABR (ospf)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1579 | return; |
| 1580 | |
| 1581 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1582 | zlog_debug ("ospf_abr_announce_stub_defaults(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1583 | |
| 1584 | p.family = AF_INET; |
| 1585 | p.prefix.s_addr = OSPF_DEFAULT_DESTINATION; |
| 1586 | p.prefixlen = 0; |
| 1587 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1588 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1589 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1590 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1591 | zlog_debug ("ospf_abr_announce_stub_defaults(): looking at area %s", |
| 1592 | inet_ntoa (area->area_id)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1593 | |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1594 | if ( (area->external_routing != OSPF_AREA_STUB) |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1595 | && (area->external_routing != OSPF_AREA_NSSA) |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1596 | ) |
| 1597 | continue; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1598 | |
| 1599 | if (OSPF_IS_AREA_BACKBONE (area)) |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1600 | continue; /* Sanity Check */ |
| 1601 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1602 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1603 | zlog_debug ("ospf_abr_announce_stub_defaults(): " |
| 1604 | "announcing 0.0.0.0/0 to area %s", |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1605 | inet_ntoa (area->area_id)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1606 | ospf_abr_announce_network_to_area (&p, area->default_cost, area); |
| 1607 | } |
| 1608 | |
| 1609 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1610 | zlog_debug ("ospf_abr_announce_stub_defaults(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1611 | } |
| 1612 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1613 | static int |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1614 | ospf_abr_remove_unapproved_translates_apply (struct ospf *ospf, |
| 1615 | struct ospf_lsa *lsa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1616 | { |
| 1617 | if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT) |
| 1618 | && ! CHECK_FLAG (lsa->flags, OSPF_LSA_APPROVED)) |
| 1619 | { |
| 1620 | zlog_info ("ospf_abr_remove_unapproved_translates(): " |
| 1621 | "removing unapproved translates, ID: %s", |
| 1622 | inet_ntoa (lsa->data->id)); |
| 1623 | |
| 1624 | /* FLUSH THROUGHOUT AS */ |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1625 | ospf_lsa_flush_as (ospf, lsa); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1626 | |
| 1627 | /* DISCARD from LSDB */ |
| 1628 | } |
| 1629 | return 0; |
| 1630 | } |
| 1631 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1632 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1633 | ospf_abr_remove_unapproved_translates (struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1634 | { |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1635 | struct route_node *rn; |
| 1636 | struct ospf_lsa *lsa; |
| 1637 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1638 | /* All AREA PROCESS should have APPROVED necessary LSAs */ |
| 1639 | /* Remove any left over and not APPROVED */ |
| 1640 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1641 | zlog_debug ("ospf_abr_remove_unapproved_translates(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1642 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1643 | LSDB_LOOP (EXTERNAL_LSDB (ospf), rn, lsa) |
| 1644 | ospf_abr_remove_unapproved_translates_apply (ospf, lsa); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1645 | |
| 1646 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1647 | zlog_debug ("ospf_abr_remove_unapproved_translates(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1648 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1649 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1650 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1651 | ospf_abr_remove_unapproved_summaries (struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1652 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 1653 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1654 | struct ospf_area *area; |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1655 | struct route_node *rn; |
| 1656 | struct ospf_lsa *lsa; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1657 | |
| 1658 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1659 | zlog_debug ("ospf_abr_remove_unapproved_summaries(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1660 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1661 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1662 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1663 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1664 | zlog_debug ("ospf_abr_remove_unapproved_summaries(): " |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1665 | "looking at area %s", inet_ntoa (area->area_id)); |
| 1666 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1667 | LSDB_LOOP (SUMMARY_LSDB (area), rn, lsa) |
| 1668 | if (ospf_lsa_is_self_originated (ospf, lsa)) |
| 1669 | if (!CHECK_FLAG (lsa->flags, OSPF_LSA_APPROVED)) |
| 1670 | ospf_lsa_flush_area (lsa, area); |
| 1671 | |
| 1672 | LSDB_LOOP (ASBR_SUMMARY_LSDB (area), rn, lsa) |
| 1673 | if (ospf_lsa_is_self_originated (ospf, lsa)) |
| 1674 | if (!CHECK_FLAG (lsa->flags, OSPF_LSA_APPROVED)) |
| 1675 | ospf_lsa_flush_area (lsa, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1676 | } |
| 1677 | |
| 1678 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1679 | zlog_debug ("ospf_abr_remove_unapproved_summaries(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1680 | } |
| 1681 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1682 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1683 | ospf_abr_manage_discard_routes (struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1684 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1685 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1686 | struct route_node *rn; |
| 1687 | struct ospf_area *area; |
| 1688 | struct ospf_area_range *range; |
| 1689 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1690 | for (ALL_LIST_ELEMENTS (ospf->areas, node, nnode, area)) |
| 1691 | for (rn = route_top (area->ranges); rn; rn = route_next (rn)) |
| 1692 | if ((range = rn->info) != NULL) |
| 1693 | if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE)) |
| 1694 | { |
| 1695 | if (range->specifics) |
| 1696 | ospf_add_discard_route (ospf->new_table, area, |
| 1697 | (struct prefix_ipv4 *) &rn->p); |
| 1698 | else |
| 1699 | ospf_delete_discard_route ((struct prefix_ipv4 *) &rn->p); |
| 1700 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1701 | } |
| 1702 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1703 | /* This is the function taking care about ABR NSSA, i.e. NSSA |
| 1704 | Translator, -LSA aggregation and flooding. For all NSSAs |
| 1705 | |
| 1706 | Any SELF-AS-LSA is in the Type-5 LSDB and Type-7 LSDB. These LSA's |
| 1707 | are refreshed from the Type-5 LSDB, installed into the Type-7 LSDB |
| 1708 | with the P-bit set. |
| 1709 | |
| 1710 | Any received Type-5s are legal for an ABR, else illegal for IR. |
| 1711 | Received Type-7s are installed, by area, with incoming P-bit. They |
| 1712 | are flooded; if the Elected NSSA Translator, then P-bit off. |
| 1713 | |
| 1714 | Additionally, this ABR will place "translated type-7's" into the |
| 1715 | Type-5 LSDB in order to keep track of APPROVAL or not. |
| 1716 | |
| 1717 | It will scan through every area, looking for Type-7 LSAs with P-Bit |
| 1718 | SET. The Type-7's are either AS-FLOODED & 5-INSTALLED or |
| 1719 | AGGREGATED. Later, the AGGREGATED LSAs are AS-FLOODED & |
| 1720 | 5-INSTALLED. |
| 1721 | |
| 1722 | 5-INSTALLED is into the Type-5 LSDB; Any UNAPPROVED Type-5 LSAs |
| 1723 | left over are FLUSHED and DISCARDED. |
| 1724 | |
| 1725 | For External Calculations, any NSSA areas use the Type-7 AREA-LSDB, |
| 1726 | any ABR-non-NSSA areas use the Type-5 GLOBAL-LSDB. */ |
| 1727 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1728 | static void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1729 | ospf_abr_nssa_task (struct ospf *ospf) /* called only if any_nssa */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1730 | { |
| 1731 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1732 | zlog_debug ("Check for NSSA-ABR Tasks():"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1733 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1734 | if (! IS_OSPF_ABR (ospf)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1735 | return; |
| 1736 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1737 | if (! ospf->anyNSSA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1738 | return; |
| 1739 | |
| 1740 | /* Each area must confirm TranslatorRole */ |
| 1741 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1742 | zlog_debug ("ospf_abr_nssa_task(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1743 | |
| 1744 | /* For all Global Entries flagged "local-translate", unset APPROVED */ |
| 1745 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1746 | zlog_debug ("ospf_abr_nssa_task(): unapprove translates"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1747 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1748 | ospf_abr_unapprove_translates (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1749 | |
| 1750 | /* RESET all Ranges in every Area, same as summaries */ |
| 1751 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1752 | zlog_debug ("ospf_abr_nssa_task(): NSSA initialize aggregates"); |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 1753 | ospf_abr_prepare_aggregates (ospf); /*TURNED OFF just for now */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1754 | |
| 1755 | /* For all NSSAs, Type-7s, translate to 5's, INSTALL/FLOOD, or |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 1756 | * Aggregate as Type-7 |
| 1757 | * Install or Approve in Type-5 Global LSDB |
| 1758 | */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1759 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1760 | zlog_debug ("ospf_abr_nssa_task(): process translates"); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1761 | ospf_abr_process_nssa_translates (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1762 | |
| 1763 | /* Translate/Send any "ranged" aggregates, and also 5-Install and |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 1764 | * Approve |
| 1765 | * Scan Type-7's for aggregates, translate to Type-5's, |
| 1766 | * Install/Flood/Approve |
| 1767 | */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1768 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1769 | zlog_debug("ospf_abr_nssa_task(): send NSSA aggregates"); |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 1770 | ospf_abr_send_nssa_aggregates (ospf); /*TURNED OFF FOR NOW */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1771 | |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1772 | /* Send any NSSA defaults as Type-5 |
| 1773 | *if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1774 | * zlog_debug ("ospf_abr_nssa_task(): announce nssa defaults"); |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1775 | *ospf_abr_announce_nssa_defaults (ospf); |
| 1776 | * havnt a clue what above is supposed to do. |
| 1777 | */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1778 | |
| 1779 | /* Flush any unapproved previous translates from Global Data Base */ |
| 1780 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1781 | zlog_debug ("ospf_abr_nssa_task(): remove unapproved translates"); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1782 | ospf_abr_remove_unapproved_translates (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1783 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1784 | ospf_abr_manage_discard_routes (ospf); /* same as normal...discard */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1785 | |
| 1786 | if (IS_DEBUG_OSPF_NSSA) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1787 | zlog_debug ("ospf_abr_nssa_task(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1788 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1789 | |
| 1790 | /* This is the function taking care about ABR stuff, i.e. |
| 1791 | summary-LSA origination and flooding. */ |
| 1792 | void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1793 | ospf_abr_task (struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1794 | { |
| 1795 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1796 | zlog_debug ("ospf_abr_task(): Start"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1797 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1798 | if (ospf->new_table == NULL || ospf->new_rtrs == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1799 | { |
| 1800 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1801 | zlog_debug ("ospf_abr_task(): Routing tables are not yet ready"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1802 | return; |
| 1803 | } |
| 1804 | |
| 1805 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1806 | zlog_debug ("ospf_abr_task(): unapprove summaries"); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1807 | ospf_abr_unapprove_summaries (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1808 | |
| 1809 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1810 | zlog_debug ("ospf_abr_task(): prepare aggregates"); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1811 | ospf_abr_prepare_aggregates (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1812 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1813 | if (IS_OSPF_ABR (ospf)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1814 | { |
| 1815 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1816 | zlog_debug ("ospf_abr_task(): process network RT"); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1817 | ospf_abr_process_network_rt (ospf, ospf->new_table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1818 | |
| 1819 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1820 | zlog_debug ("ospf_abr_task(): process router RT"); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1821 | ospf_abr_process_router_rt (ospf, ospf->new_rtrs); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1822 | |
| 1823 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1824 | zlog_debug ("ospf_abr_task(): announce aggregates"); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1825 | ospf_abr_announce_aggregates (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1826 | |
| 1827 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1828 | zlog_debug ("ospf_abr_task(): announce stub defaults"); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1829 | ospf_abr_announce_stub_defaults (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1830 | } |
| 1831 | |
| 1832 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1833 | zlog_debug ("ospf_abr_task(): remove unapproved summaries"); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1834 | ospf_abr_remove_unapproved_summaries (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1835 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1836 | ospf_abr_manage_discard_routes (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1837 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1838 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1839 | zlog_debug ("ospf_abr_task(): Stop"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1840 | } |
| 1841 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1842 | static int |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1843 | ospf_abr_task_timer (struct thread *thread) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1844 | { |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1845 | struct ospf *ospf = THREAD_ARG (thread); |
| 1846 | |
| 1847 | ospf->t_abr_task = 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1848 | |
| 1849 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1850 | zlog_debug ("Running ABR task on timer"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1851 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1852 | ospf_check_abr_status (ospf); |
paul | d4a53d5 | 2003-07-12 21:30:57 +0000 | [diff] [blame] | 1853 | ospf_abr_nssa_check_status (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1854 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1855 | ospf_abr_task (ospf); |
paul | e2c6c15 | 2003-06-22 08:49:25 +0000 | [diff] [blame] | 1856 | ospf_abr_nssa_task (ospf); /* if nssa-abr, then scan Type-7 LSDB */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1857 | |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1858 | return 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1859 | } |
| 1860 | |
| 1861 | void |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1862 | ospf_schedule_abr_task (struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1863 | { |
| 1864 | if (IS_DEBUG_OSPF_EVENT) |
ajs | e84cc64 | 2004-12-08 17:28:56 +0000 | [diff] [blame] | 1865 | zlog_debug ("Scheduling ABR task"); |
paul | 147193a | 2003-04-19 00:31:59 +0000 | [diff] [blame] | 1866 | |
| 1867 | if (ospf->t_abr_task == NULL) |
| 1868 | ospf->t_abr_task = thread_add_timer (master, ospf_abr_task_timer, |
| 1869 | ospf, OSPF_ABR_TASK_DELAY); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1870 | } |