hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2003 Yasuhiro Ohara |
| 3 | * |
| 4 | * This file is part of GNU Zebra. |
| 5 | * |
| 6 | * GNU Zebra is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the |
| 8 | * Free Software Foundation; either version 2, or (at your option) any |
| 9 | * later version. |
| 10 | * |
| 11 | * GNU Zebra is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with GNU Zebra; see the file COPYING. If not, write to the |
| 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 19 | * Boston, MA 02111-1307, USA. |
| 20 | */ |
| 21 | |
| 22 | #include <zebra.h> |
| 23 | |
| 24 | #include "log.h" |
| 25 | #include "thread.h" |
| 26 | #include "linklist.h" |
| 27 | #include "vty.h" |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 28 | #include "command.h" |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 29 | |
| 30 | #include "ospf6d.h" |
| 31 | #include "ospf6_proto.h" |
| 32 | #include "ospf6_lsa.h" |
| 33 | #include "ospf6_lsdb.h" |
| 34 | #include "ospf6_message.h" |
| 35 | #include "ospf6_route.h" |
| 36 | #include "ospf6_spf.h" |
| 37 | |
| 38 | #include "ospf6_top.h" |
| 39 | #include "ospf6_area.h" |
| 40 | #include "ospf6_interface.h" |
| 41 | #include "ospf6_neighbor.h" |
| 42 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 43 | #include "ospf6_flood.h" |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 44 | |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 45 | unsigned char conf_debug_ospf6_flooding; |
| 46 | |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 47 | struct ospf6_lsdb * |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 48 | ospf6_get_scoped_lsdb (struct ospf6_lsa *lsa) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 49 | { |
| 50 | struct ospf6_lsdb *lsdb = NULL; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 51 | switch (OSPF6_LSA_SCOPE (lsa->header->type)) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 52 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 53 | case OSPF6_SCOPE_LINKLOCAL: |
| 54 | lsdb = OSPF6_INTERFACE (lsa->lsdb->data)->lsdb; |
| 55 | break; |
| 56 | case OSPF6_SCOPE_AREA: |
| 57 | lsdb = OSPF6_AREA (lsa->lsdb->data)->lsdb; |
| 58 | break; |
| 59 | case OSPF6_SCOPE_AS: |
| 60 | lsdb = OSPF6_PROCESS (lsa->lsdb->data)->lsdb; |
| 61 | break; |
| 62 | default: |
| 63 | assert (0); |
| 64 | break; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 65 | } |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 66 | return lsdb; |
| 67 | } |
| 68 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 69 | struct ospf6_lsdb * |
| 70 | ospf6_get_scoped_lsdb_self (struct ospf6_lsa *lsa) |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 71 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 72 | struct ospf6_lsdb *lsdb_self = NULL; |
| 73 | switch (OSPF6_LSA_SCOPE (lsa->header->type)) |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 74 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 75 | case OSPF6_SCOPE_LINKLOCAL: |
| 76 | lsdb_self = OSPF6_INTERFACE (lsa->lsdb->data)->lsdb_self; |
| 77 | break; |
| 78 | case OSPF6_SCOPE_AREA: |
| 79 | lsdb_self = OSPF6_AREA (lsa->lsdb->data)->lsdb_self; |
| 80 | break; |
| 81 | case OSPF6_SCOPE_AS: |
| 82 | lsdb_self = OSPF6_PROCESS (lsa->lsdb->data)->lsdb_self; |
| 83 | break; |
| 84 | default: |
| 85 | assert (0); |
| 86 | break; |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 87 | } |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 88 | return lsdb_self; |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | void |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 92 | ospf6_lsa_originate (struct ospf6_lsa *lsa) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 93 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 94 | struct ospf6_lsa *old; |
| 95 | struct ospf6_lsdb *lsdb_self; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 96 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 97 | /* find previous LSA */ |
| 98 | old = ospf6_lsdb_lookup (lsa->header->type, lsa->header->id, |
| 99 | lsa->header->adv_router, lsa->lsdb); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 100 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 101 | /* if the new LSA does not differ from previous, |
| 102 | suppress this update of the LSA */ |
| 103 | if (old && ! OSPF6_LSA_IS_DIFFER (lsa, old)) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 104 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 105 | if (IS_OSPF6_DEBUG_ORIGINATE_TYPE (lsa->header->type)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 106 | zlog_debug ("Suppress updating LSA: %s", lsa->name); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 107 | ospf6_lsa_delete (lsa); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 108 | return; |
| 109 | } |
| 110 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 111 | /* store it in the LSDB for self-originated LSAs */ |
| 112 | lsdb_self = ospf6_get_scoped_lsdb_self (lsa); |
| 113 | ospf6_lsdb_add (ospf6_lsa_copy (lsa), lsdb_self); |
| 114 | |
| 115 | lsa->refresh = thread_add_timer (master, ospf6_lsa_refresh, lsa, |
| 116 | LS_REFRESH_TIME); |
| 117 | |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 118 | if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type) || |
| 119 | IS_OSPF6_DEBUG_ORIGINATE_TYPE (lsa->header->type)) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 120 | { |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 121 | zlog_debug ("LSA Originate:"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 122 | ospf6_lsa_header_print (lsa); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 123 | } |
| 124 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 125 | if (old) |
| 126 | ospf6_flood_clear (old); |
| 127 | ospf6_flood (NULL, lsa); |
| 128 | ospf6_install_lsa (lsa); |
| 129 | } |
| 130 | |
| 131 | void |
| 132 | ospf6_lsa_originate_process (struct ospf6_lsa *lsa, |
| 133 | struct ospf6 *process) |
| 134 | { |
| 135 | lsa->lsdb = process->lsdb; |
| 136 | ospf6_lsa_originate (lsa); |
| 137 | } |
| 138 | |
| 139 | void |
| 140 | ospf6_lsa_originate_area (struct ospf6_lsa *lsa, |
| 141 | struct ospf6_area *oa) |
| 142 | { |
| 143 | lsa->lsdb = oa->lsdb; |
| 144 | ospf6_lsa_originate (lsa); |
| 145 | } |
| 146 | |
| 147 | void |
| 148 | ospf6_lsa_originate_interface (struct ospf6_lsa *lsa, |
| 149 | struct ospf6_interface *oi) |
| 150 | { |
| 151 | lsa->lsdb = oi->lsdb; |
| 152 | ospf6_lsa_originate (lsa); |
| 153 | } |
| 154 | |
| 155 | void |
| 156 | ospf6_lsa_purge (struct ospf6_lsa *lsa) |
| 157 | { |
| 158 | struct ospf6_lsa *self; |
| 159 | struct ospf6_lsdb *lsdb_self; |
| 160 | |
| 161 | /* remove it from the LSDB for self-originated LSAs */ |
| 162 | lsdb_self = ospf6_get_scoped_lsdb_self (lsa); |
| 163 | self = ospf6_lsdb_lookup (lsa->header->type, lsa->header->id, |
| 164 | lsa->header->adv_router, lsdb_self); |
| 165 | if (self) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 166 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 167 | THREAD_OFF (self->expire); |
| 168 | THREAD_OFF (self->refresh); |
| 169 | ospf6_lsdb_remove (self, lsdb_self); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 170 | } |
| 171 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 172 | ospf6_lsa_premature_aging (lsa); |
| 173 | } |
| 174 | |
| 175 | |
| 176 | void |
| 177 | ospf6_increment_retrans_count (struct ospf6_lsa *lsa) |
| 178 | { |
| 179 | /* The LSA must be the original one (see the description |
| 180 | in ospf6_decrement_retrans_count () below) */ |
| 181 | lsa->retrans_count++; |
| 182 | } |
| 183 | |
| 184 | void |
| 185 | ospf6_decrement_retrans_count (struct ospf6_lsa *lsa) |
| 186 | { |
| 187 | struct ospf6_lsdb *lsdb; |
| 188 | struct ospf6_lsa *orig; |
| 189 | |
| 190 | /* The LSA must be on the retrans-list of a neighbor. It means |
| 191 | the "lsa" is a copied one, and we have to decrement the |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 192 | retransmission count of the original one (instead of this "lsa"'s). |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 193 | In order to find the original LSA, first we have to find |
| 194 | appropriate LSDB that have the original LSA. */ |
| 195 | lsdb = ospf6_get_scoped_lsdb (lsa); |
| 196 | |
| 197 | /* Find the original LSA of which the retrans_count should be decremented */ |
| 198 | orig = ospf6_lsdb_lookup (lsa->header->type, lsa->header->id, |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 199 | lsa->header->adv_router, lsdb); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 200 | if (orig) |
hasso | 6861b30 | 2004-08-26 18:19:59 +0000 | [diff] [blame] | 201 | { |
| 202 | orig->retrans_count--; |
| 203 | assert (orig->retrans_count >= 0); |
| 204 | } |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | /* RFC2328 section 13.2 Installing LSAs in the database */ |
| 208 | void |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 209 | ospf6_install_lsa (struct ospf6_lsa *lsa) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 210 | { |
| 211 | struct ospf6_lsa *old; |
hasso | 3b68735 | 2004-08-19 06:56:53 +0000 | [diff] [blame] | 212 | struct timeval now; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 213 | |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 214 | if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type) || |
| 215 | IS_OSPF6_DEBUG_EXAMIN_TYPE (lsa->header->type)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 216 | zlog_debug ("Install LSA: %s", lsa->name); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 217 | |
| 218 | /* Remove the old instance from all neighbors' Link state |
| 219 | retransmission list (RFC2328 13.2 last paragraph) */ |
| 220 | old = ospf6_lsdb_lookup (lsa->header->type, lsa->header->id, |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 221 | lsa->header->adv_router, lsa->lsdb); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 222 | if (old) |
hasso | 3b68735 | 2004-08-19 06:56:53 +0000 | [diff] [blame] | 223 | { |
| 224 | THREAD_OFF (old->expire); |
| 225 | ospf6_flood_clear (old); |
| 226 | } |
| 227 | |
| 228 | gettimeofday (&now, (struct timezone *) NULL); |
hasso | ccb59b1 | 2004-08-25 09:10:37 +0000 | [diff] [blame] | 229 | if (! OSPF6_LSA_IS_MAXAGE (lsa)) |
hasso | 3b68735 | 2004-08-19 06:56:53 +0000 | [diff] [blame] | 230 | lsa->expire = thread_add_timer (master, ospf6_lsa_expire, lsa, |
| 231 | MAXAGE + lsa->birth.tv_sec - now.tv_sec); |
| 232 | else |
| 233 | lsa->expire = NULL; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 234 | |
| 235 | /* actually install */ |
hasso | 3b68735 | 2004-08-19 06:56:53 +0000 | [diff] [blame] | 236 | lsa->installed = now; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 237 | ospf6_lsdb_add (lsa, lsa->lsdb); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 238 | |
| 239 | return; |
| 240 | } |
| 241 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 242 | /* RFC2740 section 3.5.2. Sending Link State Update packets */ |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 243 | /* RFC2328 section 13.3 Next step in the flooding procedure */ |
| 244 | void |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 245 | ospf6_flood_interface (struct ospf6_neighbor *from, |
| 246 | struct ospf6_lsa *lsa, struct ospf6_interface *oi) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 247 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 248 | struct listnode *node; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 249 | struct ospf6_neighbor *on; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 250 | struct ospf6_lsa *req; |
| 251 | int retrans_added = 0; |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 252 | int is_debug = 0; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 253 | |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 254 | if (IS_OSPF6_DEBUG_FLOODING || |
| 255 | IS_OSPF6_DEBUG_FLOOD_TYPE (lsa->header->type)) |
| 256 | { |
| 257 | is_debug++; |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 258 | zlog_debug ("Flooding on %s: %s", oi->interface->name, lsa->name); |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 259 | } |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 260 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 261 | /* (1) For each neighbor */ |
| 262 | for (node = listhead (oi->neighbor_list); node; nextnode (node)) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 263 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 264 | on = (struct ospf6_neighbor *) getdata (node); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 265 | |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 266 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 267 | zlog_debug ("To neighbor %s", on->name); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 268 | |
| 269 | /* (a) if neighbor state < Exchange, examin next */ |
| 270 | if (on->state < OSPF6_NEIGHBOR_EXCHANGE) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 271 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 272 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 273 | zlog_debug ("Neighbor state less than ExChange, next neighbor"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 274 | continue; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 275 | } |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 276 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 277 | /* (b) if neighbor not yet Full, check request-list */ |
| 278 | if (on->state != OSPF6_NEIGHBOR_FULL) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 279 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 280 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 281 | zlog_debug ("Neighbor not yet Full"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 282 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 283 | req = ospf6_lsdb_lookup (lsa->header->type, lsa->header->id, |
| 284 | lsa->header->adv_router, on->request_list); |
| 285 | if (req == NULL) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 286 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 287 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 288 | zlog_debug ("Not on request-list for this neighbor"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 289 | /* fall through */ |
| 290 | } |
| 291 | else |
| 292 | { |
| 293 | /* If new LSA less recent, examin next neighbor */ |
| 294 | if (ospf6_lsa_compare (lsa, req) > 0) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 295 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 296 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 297 | zlog_debug ("Requesting is newer, next neighbor"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 298 | continue; |
| 299 | } |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 300 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 301 | /* If the same instance, delete from request-list and |
| 302 | examin next neighbor */ |
| 303 | if (ospf6_lsa_compare (lsa, req) == 0) |
| 304 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 305 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 306 | zlog_debug ("Requesting the same, remove it, next neighbor"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 307 | ospf6_lsdb_remove (req, on->request_list); |
| 308 | continue; |
| 309 | } |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 310 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 311 | /* If the new LSA is more recent, delete from request-list */ |
| 312 | if (ospf6_lsa_compare (lsa, req) < 0) |
| 313 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 314 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 315 | zlog_debug ("Received is newer, remove requesting"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 316 | ospf6_lsdb_remove (req, on->request_list); |
| 317 | /* fall through */ |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 318 | } |
| 319 | } |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 320 | } |
| 321 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 322 | /* (c) If the new LSA was received from this neighbor, |
| 323 | examin next neighbor */ |
| 324 | if (from == on) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 325 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 326 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 327 | zlog_debug ("Received is from the neighbor, next neighbor"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 328 | continue; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 329 | } |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 330 | |
| 331 | /* (d) add retrans-list, schedule retransmission */ |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 332 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 333 | zlog_debug ("Add retrans-list of this neighbor"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 334 | ospf6_increment_retrans_count (lsa); |
| 335 | ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->retrans_list); |
| 336 | if (on->thread_send_lsupdate == NULL) |
| 337 | on->thread_send_lsupdate = |
gdt | 6639a04 | 2004-11-05 18:42:27 +0000 | [diff] [blame] | 338 | thread_add_timer (master, ospf6_lsupdate_send_neighbor, |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 339 | on, on->ospf6_if->rxmt_interval); |
| 340 | retrans_added++; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 341 | } |
| 342 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 343 | /* (2) examin next interface if not added to retrans-list */ |
| 344 | if (retrans_added == 0) |
| 345 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 346 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 347 | zlog_debug ("No retransmission scheduled, next interface"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 348 | return; |
| 349 | } |
| 350 | |
| 351 | /* (3) If the new LSA was received on this interface, |
| 352 | and it was from DR or BDR, examin next interface */ |
| 353 | if (from && from->ospf6_if == oi && |
| 354 | (from->router_id == oi->drouter || from->router_id == oi->bdrouter)) |
| 355 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 356 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 357 | zlog_debug ("Received is from the I/F's DR or BDR, next interface"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 358 | return; |
| 359 | } |
| 360 | |
| 361 | /* (4) If the new LSA was received on this interface, |
| 362 | and the interface state is BDR, examin next interface */ |
| 363 | if (from && from->ospf6_if == oi && oi->state == OSPF6_INTERFACE_BDR) |
| 364 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 365 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 366 | zlog_debug ("Received is from the I/F, itself BDR, next interface"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 367 | return; |
| 368 | } |
| 369 | |
| 370 | /* (5) flood the LSA out the interface. */ |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 371 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 372 | zlog_debug ("Schedule flooding for the interface"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 373 | if (if_is_broadcast (oi->interface)) |
| 374 | { |
| 375 | ospf6_lsdb_add (ospf6_lsa_copy (lsa), oi->lsupdate_list); |
| 376 | if (oi->thread_send_lsupdate == NULL) |
| 377 | oi->thread_send_lsupdate = |
| 378 | thread_add_event (master, ospf6_lsupdate_send_interface, oi, 0); |
| 379 | } |
| 380 | else |
| 381 | { |
| 382 | /* reschedule retransmissions to all neighbors */ |
| 383 | for (node = listhead (oi->neighbor_list); node; nextnode (node)) |
| 384 | { |
| 385 | on = (struct ospf6_neighbor *) getdata (node); |
| 386 | THREAD_OFF (on->thread_send_lsupdate); |
| 387 | on->thread_send_lsupdate = |
| 388 | thread_add_event (master, ospf6_lsupdate_send_neighbor, on, 0); |
| 389 | } |
| 390 | } |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 391 | } |
| 392 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 393 | void |
| 394 | ospf6_flood_area (struct ospf6_neighbor *from, |
| 395 | struct ospf6_lsa *lsa, struct ospf6_area *oa) |
| 396 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 397 | struct listnode *node; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 398 | struct ospf6_interface *oi; |
| 399 | |
| 400 | for (node = listhead (oa->if_list); node; nextnode (node)) |
| 401 | { |
| 402 | oi = OSPF6_INTERFACE (getdata (node)); |
| 403 | |
| 404 | if (OSPF6_LSA_SCOPE (lsa->header->type) == OSPF6_SCOPE_LINKLOCAL && |
| 405 | oi != OSPF6_INTERFACE (lsa->lsdb->data)) |
| 406 | continue; |
| 407 | |
| 408 | #if 0 |
| 409 | if (OSPF6_LSA_SCOPE (lsa->header->type) == OSPF6_SCOPE_AS && |
| 410 | ospf6_is_interface_virtual_link (oi)) |
| 411 | continue; |
| 412 | #endif/*0*/ |
| 413 | |
| 414 | ospf6_flood_interface (from, lsa, oi); |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | void |
| 419 | ospf6_flood_process (struct ospf6_neighbor *from, |
| 420 | struct ospf6_lsa *lsa, struct ospf6 *process) |
| 421 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 422 | struct listnode *node; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 423 | struct ospf6_area *oa; |
| 424 | |
| 425 | for (node = listhead (process->area_list); node; nextnode (node)) |
| 426 | { |
| 427 | oa = OSPF6_AREA (getdata (node)); |
| 428 | |
| 429 | if (OSPF6_LSA_SCOPE (lsa->header->type) == OSPF6_SCOPE_AREA && |
| 430 | oa != OSPF6_AREA (lsa->lsdb->data)) |
| 431 | continue; |
| 432 | if (OSPF6_LSA_SCOPE (lsa->header->type) == OSPF6_SCOPE_LINKLOCAL && |
| 433 | oa != OSPF6_INTERFACE (lsa->lsdb->data)->area) |
| 434 | continue; |
| 435 | |
| 436 | if (ntohs (lsa->header->type) == OSPF6_LSTYPE_AS_EXTERNAL && |
| 437 | IS_AREA_STUB (oa)) |
| 438 | continue; |
| 439 | |
| 440 | ospf6_flood_area (from, lsa, oa); |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | void |
| 445 | ospf6_flood (struct ospf6_neighbor *from, struct ospf6_lsa *lsa) |
| 446 | { |
| 447 | ospf6_flood_process (from, lsa, ospf6); |
| 448 | } |
| 449 | |
| 450 | void |
| 451 | ospf6_flood_clear_interface (struct ospf6_lsa *lsa, struct ospf6_interface *oi) |
| 452 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 453 | struct listnode *node; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 454 | struct ospf6_neighbor *on; |
| 455 | struct ospf6_lsa *rem; |
| 456 | |
| 457 | for (node = listhead (oi->neighbor_list); node; nextnode (node)) |
| 458 | { |
| 459 | on = OSPF6_NEIGHBOR (getdata (node)); |
| 460 | rem = ospf6_lsdb_lookup (lsa->header->type, lsa->header->id, |
| 461 | lsa->header->adv_router, on->retrans_list); |
| 462 | if (rem && ! ospf6_lsa_compare (rem, lsa)) |
| 463 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 464 | if (IS_OSPF6_DEBUG_FLOODING || |
| 465 | IS_OSPF6_DEBUG_FLOOD_TYPE (lsa->header->type)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 466 | zlog_debug ("Remove %s from retrans_list of %s", |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 467 | rem->name, on->name); |
| 468 | ospf6_decrement_retrans_count (rem); |
| 469 | ospf6_lsdb_remove (rem, on->retrans_list); |
| 470 | } |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | void |
| 475 | ospf6_flood_clear_area (struct ospf6_lsa *lsa, struct ospf6_area *oa) |
| 476 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 477 | struct listnode *node; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 478 | struct ospf6_interface *oi; |
| 479 | |
| 480 | for (node = listhead (oa->if_list); node; nextnode (node)) |
| 481 | { |
| 482 | oi = OSPF6_INTERFACE (getdata (node)); |
| 483 | |
| 484 | if (OSPF6_LSA_SCOPE (lsa->header->type) == OSPF6_SCOPE_LINKLOCAL && |
| 485 | oi != OSPF6_INTERFACE (lsa->lsdb->data)) |
| 486 | continue; |
| 487 | |
| 488 | #if 0 |
| 489 | if (OSPF6_LSA_SCOPE (lsa->header->type) == OSPF6_SCOPE_AS && |
| 490 | ospf6_is_interface_virtual_link (oi)) |
| 491 | continue; |
| 492 | #endif/*0*/ |
| 493 | |
| 494 | ospf6_flood_clear_interface (lsa, oi); |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | void |
| 499 | ospf6_flood_clear_process (struct ospf6_lsa *lsa, struct ospf6 *process) |
| 500 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 501 | struct listnode *node; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 502 | struct ospf6_area *oa; |
| 503 | |
| 504 | for (node = listhead (process->area_list); node; nextnode (node)) |
| 505 | { |
| 506 | oa = OSPF6_AREA (getdata (node)); |
| 507 | |
| 508 | if (OSPF6_LSA_SCOPE (lsa->header->type) == OSPF6_SCOPE_AREA && |
| 509 | oa != OSPF6_AREA (lsa->lsdb->data)) |
| 510 | continue; |
| 511 | if (OSPF6_LSA_SCOPE (lsa->header->type) == OSPF6_SCOPE_LINKLOCAL && |
| 512 | oa != OSPF6_INTERFACE (lsa->lsdb->data)->area) |
| 513 | continue; |
| 514 | |
| 515 | if (ntohs (lsa->header->type) == OSPF6_LSTYPE_AS_EXTERNAL && |
| 516 | IS_AREA_STUB (oa)) |
| 517 | continue; |
| 518 | |
| 519 | ospf6_flood_clear_area (lsa, oa); |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | void |
| 524 | ospf6_flood_clear (struct ospf6_lsa *lsa) |
| 525 | { |
| 526 | ospf6_flood_clear_process (lsa, ospf6); |
| 527 | } |
| 528 | |
| 529 | |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 530 | /* RFC2328 13.5 (Table 19): Sending link state acknowledgements. */ |
| 531 | static void |
| 532 | ospf6_acknowledge_lsa_bdrouter (struct ospf6_lsa *lsa, int ismore_recent, |
| 533 | struct ospf6_neighbor *from) |
| 534 | { |
| 535 | struct ospf6_interface *oi; |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 536 | int is_debug = 0; |
| 537 | |
| 538 | if (IS_OSPF6_DEBUG_FLOODING || |
| 539 | IS_OSPF6_DEBUG_FLOOD_TYPE (lsa->header->type)) |
| 540 | is_debug++; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 541 | |
| 542 | assert (from && from->ospf6_if); |
| 543 | oi = from->ospf6_if; |
| 544 | |
| 545 | /* LSA has been flood back out receiving interface. |
| 546 | No acknowledgement sent. */ |
| 547 | if (CHECK_FLAG (lsa->flag, OSPF6_LSA_FLOODBACK)) |
| 548 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 549 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 550 | zlog_debug ("No acknowledgement (BDR & FloodBack)"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 551 | return; |
| 552 | } |
| 553 | |
| 554 | /* LSA is more recent than database copy, but was not flooded |
| 555 | back out receiving interface. Delayed acknowledgement sent |
| 556 | if advertisement received from Designated Router, |
| 557 | otherwide do nothing. */ |
| 558 | if (ismore_recent < 0) |
| 559 | { |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 560 | if (oi->drouter == from->router_id) |
| 561 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 562 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 563 | zlog_debug ("Delayed acknowledgement (BDR & MoreRecent & from DR)"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 564 | /* Delayed acknowledgement */ |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 565 | ospf6_lsdb_add (ospf6_lsa_copy (lsa), oi->lsack_list); |
| 566 | if (oi->thread_send_lsack == NULL) |
| 567 | oi->thread_send_lsack = |
| 568 | thread_add_timer (master, ospf6_lsack_send_interface, oi, 3); |
| 569 | } |
| 570 | else |
| 571 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 572 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 573 | zlog_debug ("No acknowledgement (BDR & MoreRecent & ! from DR)"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 574 | } |
| 575 | return; |
| 576 | } |
| 577 | |
| 578 | /* LSA is a duplicate, and was treated as an implied acknowledgement. |
| 579 | Delayed acknowledgement sent if advertisement received from |
| 580 | Designated Router, otherwise do nothing */ |
| 581 | if (CHECK_FLAG (lsa->flag, OSPF6_LSA_DUPLICATE) && |
| 582 | CHECK_FLAG (lsa->flag, OSPF6_LSA_IMPLIEDACK)) |
| 583 | { |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 584 | if (oi->drouter == from->router_id) |
| 585 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 586 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 587 | zlog_debug ("Delayed acknowledgement (BDR & Duplicate & ImpliedAck & from DR)"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 588 | /* Delayed acknowledgement */ |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 589 | ospf6_lsdb_add (ospf6_lsa_copy (lsa), oi->lsack_list); |
| 590 | if (oi->thread_send_lsack == NULL) |
| 591 | oi->thread_send_lsack = |
| 592 | thread_add_timer (master, ospf6_lsack_send_interface, oi, 3); |
| 593 | } |
| 594 | else |
| 595 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 596 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 597 | zlog_debug ("No acknowledgement (BDR & Duplicate & ImpliedAck & ! from DR)"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 598 | } |
| 599 | return; |
| 600 | } |
| 601 | |
| 602 | /* LSA is a duplicate, and was not treated as an implied acknowledgement. |
| 603 | Direct acknowledgement sent */ |
| 604 | if (CHECK_FLAG (lsa->flag, OSPF6_LSA_DUPLICATE) && |
| 605 | ! CHECK_FLAG (lsa->flag, OSPF6_LSA_IMPLIEDACK)) |
| 606 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 607 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 608 | zlog_debug ("Direct acknowledgement (BDR & Duplicate)"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 609 | ospf6_lsdb_add (ospf6_lsa_copy (lsa), from->lsack_list); |
| 610 | if (from->thread_send_lsack == NULL) |
| 611 | from->thread_send_lsack = |
| 612 | thread_add_event (master, ospf6_lsack_send_neighbor, from, 0); |
| 613 | return; |
| 614 | } |
| 615 | |
| 616 | /* LSA's LS age is equal to Maxage, and there is no current instance |
| 617 | of the LSA in the link state database, and none of router's |
| 618 | neighbors are in states Exchange or Loading */ |
| 619 | /* Direct acknowledgement sent, but this case is handled in |
| 620 | early of ospf6_receive_lsa () */ |
| 621 | } |
| 622 | |
| 623 | static void |
| 624 | ospf6_acknowledge_lsa_allother (struct ospf6_lsa *lsa, int ismore_recent, |
| 625 | struct ospf6_neighbor *from) |
| 626 | { |
| 627 | struct ospf6_interface *oi; |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 628 | int is_debug = 0; |
| 629 | |
| 630 | if (IS_OSPF6_DEBUG_FLOODING || |
| 631 | IS_OSPF6_DEBUG_FLOOD_TYPE (lsa->header->type)) |
| 632 | is_debug++; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 633 | |
| 634 | assert (from && from->ospf6_if); |
| 635 | oi = from->ospf6_if; |
| 636 | |
| 637 | /* LSA has been flood back out receiving interface. |
| 638 | No acknowledgement sent. */ |
| 639 | if (CHECK_FLAG (lsa->flag, OSPF6_LSA_FLOODBACK)) |
| 640 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 641 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 642 | zlog_debug ("No acknowledgement (AllOther & FloodBack)"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 643 | return; |
| 644 | } |
| 645 | |
| 646 | /* LSA is more recent than database copy, but was not flooded |
| 647 | back out receiving interface. Delayed acknowledgement sent. */ |
| 648 | if (ismore_recent < 0) |
| 649 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 650 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 651 | zlog_debug ("Delayed acknowledgement (AllOther & MoreRecent)"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 652 | /* Delayed acknowledgement */ |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 653 | ospf6_lsdb_add (ospf6_lsa_copy (lsa), oi->lsack_list); |
| 654 | if (oi->thread_send_lsack == NULL) |
| 655 | oi->thread_send_lsack = |
| 656 | thread_add_timer (master, ospf6_lsack_send_interface, oi, 3); |
| 657 | return; |
| 658 | } |
| 659 | |
| 660 | /* LSA is a duplicate, and was treated as an implied acknowledgement. |
| 661 | No acknowledgement sent. */ |
| 662 | if (CHECK_FLAG (lsa->flag, OSPF6_LSA_DUPLICATE) && |
| 663 | CHECK_FLAG (lsa->flag, OSPF6_LSA_IMPLIEDACK)) |
| 664 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 665 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 666 | zlog_debug ("No acknowledgement (AllOther & Duplicate & ImpliedAck)"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 667 | return; |
| 668 | } |
| 669 | |
| 670 | /* LSA is a duplicate, and was not treated as an implied acknowledgement. |
| 671 | Direct acknowledgement sent */ |
| 672 | if (CHECK_FLAG (lsa->flag, OSPF6_LSA_DUPLICATE) && |
| 673 | ! CHECK_FLAG (lsa->flag, OSPF6_LSA_IMPLIEDACK)) |
| 674 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 675 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 676 | zlog_debug ("Direct acknowledgement (AllOther & Duplicate)"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 677 | ospf6_lsdb_add (ospf6_lsa_copy (lsa), from->lsack_list); |
| 678 | if (from->thread_send_lsack == NULL) |
| 679 | from->thread_send_lsack = |
| 680 | thread_add_event (master, ospf6_lsack_send_neighbor, from, 0); |
| 681 | return; |
| 682 | } |
| 683 | |
| 684 | /* LSA's LS age is equal to Maxage, and there is no current instance |
| 685 | of the LSA in the link state database, and none of router's |
| 686 | neighbors are in states Exchange or Loading */ |
| 687 | /* Direct acknowledgement sent, but this case is handled in |
| 688 | early of ospf6_receive_lsa () */ |
| 689 | } |
| 690 | |
| 691 | void |
| 692 | ospf6_acknowledge_lsa (struct ospf6_lsa *lsa, int ismore_recent, |
| 693 | struct ospf6_neighbor *from) |
| 694 | { |
| 695 | struct ospf6_interface *oi; |
| 696 | |
| 697 | assert (from && from->ospf6_if); |
| 698 | oi = from->ospf6_if; |
| 699 | |
| 700 | if (oi->state == OSPF6_INTERFACE_BDR) |
| 701 | ospf6_acknowledge_lsa_bdrouter (lsa, ismore_recent, from); |
| 702 | else |
| 703 | ospf6_acknowledge_lsa_allother (lsa, ismore_recent, from); |
| 704 | } |
| 705 | |
| 706 | /* RFC2328 section 13 (4): |
| 707 | if MaxAge LSA and if we have no instance, and no neighbor |
| 708 | is in states Exchange or Loading |
| 709 | returns 1 if match this case, else returns 0 */ |
| 710 | static int |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 711 | ospf6_is_maxage_lsa_drop (struct ospf6_lsa *lsa, struct ospf6_neighbor *from) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 712 | { |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 713 | struct ospf6_neighbor *on; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 714 | struct ospf6_interface *oi; |
| 715 | struct ospf6_area *oa; |
| 716 | struct ospf6 *process = NULL; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 717 | struct listnode *i, *j, *k; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 718 | int count = 0; |
| 719 | |
| 720 | if (! OSPF6_LSA_IS_MAXAGE (lsa)) |
| 721 | return 0; |
| 722 | |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 723 | if (ospf6_lsdb_lookup (lsa->header->type, lsa->header->id, |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 724 | lsa->header->adv_router, lsa->lsdb)) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 725 | return 0; |
| 726 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 727 | process = from->ospf6_if->area->ospf6; |
| 728 | for (i = listhead (process->area_list); i; nextnode (i)) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 729 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 730 | oa = OSPF6_AREA (getdata (i)); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 731 | for (j = listhead (oa->if_list); j; nextnode (j)) |
| 732 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 733 | oi = OSPF6_INTERFACE (getdata (j)); |
| 734 | for (k = listhead (oi->neighbor_list); k; nextnode (k)) |
| 735 | { |
| 736 | on = OSPF6_NEIGHBOR (getdata (k)); |
| 737 | if (on->state == OSPF6_NEIGHBOR_EXCHANGE || |
| 738 | on->state == OSPF6_NEIGHBOR_LOADING) |
| 739 | count++; |
| 740 | } |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 741 | } |
| 742 | } |
| 743 | |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 744 | if (count == 0) |
| 745 | return 1; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 746 | return 0; |
| 747 | } |
| 748 | |
| 749 | /* RFC2328 section 13 The Flooding Procedure */ |
| 750 | void |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 751 | ospf6_receive_lsa (struct ospf6_neighbor *from, |
| 752 | struct ospf6_lsa_header *lsa_header) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 753 | { |
| 754 | struct ospf6_lsa *new = NULL, *old = NULL, *rem = NULL; |
| 755 | int ismore_recent; |
| 756 | unsigned short cksum; |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 757 | int is_debug = 0; |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 758 | |
| 759 | ismore_recent = 1; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 760 | assert (from); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 761 | |
| 762 | /* make lsa structure for received lsa */ |
| 763 | new = ospf6_lsa_create (lsa_header); |
| 764 | |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 765 | if (IS_OSPF6_DEBUG_FLOODING || |
| 766 | IS_OSPF6_DEBUG_FLOOD_TYPE (new->header->type)) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 767 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 768 | is_debug++; |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 769 | zlog_debug ("LSA Receive from %s", from->name); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 770 | ospf6_lsa_header_print (new); |
| 771 | } |
| 772 | |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 773 | /* (1) LSA Checksum */ |
| 774 | cksum = ntohs (new->header->checksum); |
| 775 | if (ntohs (ospf6_lsa_checksum (new->header)) != cksum) |
| 776 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 777 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 778 | zlog_debug ("Wrong LSA Checksum, discard"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 779 | ospf6_lsa_delete (new); |
| 780 | return; |
| 781 | } |
| 782 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 783 | /* (2) Examine the LSA's LS type. |
| 784 | RFC2470 3.5.1. Receiving Link State Update packets */ |
| 785 | if (IS_AREA_STUB (from->ospf6_if->area) && |
| 786 | OSPF6_LSA_SCOPE (new->header->type) == OSPF6_SCOPE_AS) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 787 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 788 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 789 | zlog_debug ("AS-External-LSA (or AS-scope LSA) in stub area, discard"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 790 | ospf6_lsa_delete (new); |
| 791 | return; |
| 792 | } |
| 793 | |
| 794 | /* (3) LSA which have reserved scope is discarded |
| 795 | RFC2470 3.5.1. Receiving Link State Update packets */ |
| 796 | /* Flooding scope check. LSAs with unknown scope are discarded here. |
| 797 | Set appropriate LSDB for the LSA */ |
| 798 | switch (OSPF6_LSA_SCOPE (new->header->type)) |
| 799 | { |
| 800 | case OSPF6_SCOPE_LINKLOCAL: |
| 801 | new->lsdb = from->ospf6_if->lsdb; |
| 802 | break; |
| 803 | case OSPF6_SCOPE_AREA: |
| 804 | new->lsdb = from->ospf6_if->area->lsdb; |
| 805 | break; |
| 806 | case OSPF6_SCOPE_AS: |
| 807 | new->lsdb = from->ospf6_if->area->ospf6->lsdb; |
| 808 | break; |
| 809 | default: |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 810 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 811 | zlog_debug ("LSA has reserved scope, discard"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 812 | ospf6_lsa_delete (new); |
| 813 | return; |
| 814 | } |
| 815 | |
| 816 | /* (4) if MaxAge LSA and if we have no instance, and no neighbor |
| 817 | is in states Exchange or Loading */ |
| 818 | if (ospf6_is_maxage_lsa_drop (new, from)) |
| 819 | { |
| 820 | /* log */ |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 821 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 822 | zlog_debug ("Drop MaxAge LSA with direct acknowledgement."); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 823 | |
| 824 | /* a) Acknowledge back to neighbor (Direct acknowledgement, 13.5) */ |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 825 | ospf6_lsdb_add (ospf6_lsa_copy (new), from->lsack_list); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 826 | if (from->thread_send_lsack == NULL) |
| 827 | from->thread_send_lsack = |
| 828 | thread_add_event (master, ospf6_lsack_send_neighbor, from, 0); |
| 829 | |
| 830 | /* b) Discard */ |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 831 | ospf6_lsa_delete (new); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 832 | return; |
| 833 | } |
| 834 | |
| 835 | /* (5) */ |
| 836 | /* lookup the same database copy in lsdb */ |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 837 | old = ospf6_lsdb_lookup (new->header->type, new->header->id, |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 838 | new->header->adv_router, new->lsdb); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 839 | if (old) |
| 840 | { |
| 841 | ismore_recent = ospf6_lsa_compare (new, old); |
| 842 | if (ntohl (new->header->seqnum) == ntohl (old->header->seqnum)) |
| 843 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 844 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 845 | zlog_debug ("Received is duplicated LSA"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 846 | SET_FLAG (new->flag, OSPF6_LSA_DUPLICATE); |
| 847 | } |
| 848 | } |
| 849 | |
| 850 | /* if no database copy or received is more recent */ |
| 851 | if (old == NULL || ismore_recent < 0) |
| 852 | { |
| 853 | /* in case we have no database copy */ |
| 854 | ismore_recent = -1; |
| 855 | |
| 856 | /* (a) MinLSArrival check */ |
| 857 | if (old) |
| 858 | { |
| 859 | struct timeval now, res; |
| 860 | gettimeofday (&now, (struct timezone *) NULL); |
| 861 | timersub (&now, &old->installed, &res); |
| 862 | if (res.tv_sec < MIN_LS_ARRIVAL) |
| 863 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 864 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 865 | zlog_debug ("LSA can't be updated within MinLSArrival, discard"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 866 | ospf6_lsa_delete (new); |
| 867 | return; /* examin next lsa */ |
| 868 | } |
| 869 | } |
| 870 | |
hasso | ccb59b1 | 2004-08-25 09:10:37 +0000 | [diff] [blame] | 871 | gettimeofday (&new->received, (struct timezone *) NULL); |
| 872 | |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 873 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 874 | zlog_debug ("Flood, Install, Possibly acknowledge the received LSA"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 875 | |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 876 | /* (b) immediately flood and (c) remove from all retrans-list */ |
hasso | ccb59b1 | 2004-08-25 09:10:37 +0000 | [diff] [blame] | 877 | /* Prevent self-originated LSA to be flooded. this is to make |
| 878 | reoriginated instance of the LSA not to be rejected by other routers |
| 879 | due to MinLSArrival. */ |
| 880 | if (new->header->adv_router != from->ospf6_if->area->ospf6->router_id) |
| 881 | ospf6_flood (from, new); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 882 | |
| 883 | /* (c) Remove the current database copy from all neighbors' Link |
| 884 | state retransmission lists. */ |
| 885 | /* XXX, flood_clear ? */ |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 886 | |
| 887 | /* (d), installing lsdb, which may cause routing |
| 888 | table calculation (replacing database copy) */ |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 889 | ospf6_install_lsa (new); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 890 | |
| 891 | /* (e) possibly acknowledge */ |
| 892 | ospf6_acknowledge_lsa (new, ismore_recent, from); |
| 893 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 894 | /* (f) Self Originated LSA, section 13.4 */ |
| 895 | if (new->header->adv_router == from->ospf6_if->area->ospf6->router_id) |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 896 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 897 | /* Self-originated LSA (newer than ours) is received from |
| 898 | another router. We have to make a new instance of the LSA |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 899 | or have to flush this LSA. */ |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 900 | if (is_debug) |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 901 | { |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 902 | zlog_debug ("Newer instance of the self-originated LSA"); |
| 903 | zlog_debug ("Schedule reorigination"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 904 | } |
| 905 | new->refresh = thread_add_event (master, ospf6_lsa_refresh, new, 0); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 906 | } |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 907 | |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 908 | return; |
| 909 | } |
| 910 | |
| 911 | /* (6) if there is instance on sending neighbor's request list */ |
| 912 | if (ospf6_lsdb_lookup (new->header->type, new->header->id, |
| 913 | new->header->adv_router, from->request_list)) |
| 914 | { |
| 915 | /* if no database copy, should go above state (5) */ |
| 916 | assert (old); |
| 917 | |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 918 | if (is_debug) |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 919 | { |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 920 | zlog_debug ("Received is not newer, on the neighbor's request-list"); |
| 921 | zlog_debug ("BadLSReq, discard the received LSA"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 922 | } |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 923 | |
| 924 | /* BadLSReq */ |
| 925 | thread_add_event (master, bad_lsreq, from, 0); |
| 926 | |
| 927 | ospf6_lsa_delete (new); |
| 928 | return; |
| 929 | } |
| 930 | |
| 931 | /* (7) if neither one is more recent */ |
| 932 | if (ismore_recent == 0) |
| 933 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 934 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 935 | zlog_debug ("The same instance as database copy (neither recent)"); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 936 | |
| 937 | /* (a) if on retrans-list, Treat this LSA as an Ack: Implied Ack */ |
| 938 | rem = ospf6_lsdb_lookup (new->header->type, new->header->id, |
| 939 | new->header->adv_router, from->retrans_list); |
| 940 | if (rem) |
| 941 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 942 | if (is_debug) |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 943 | { |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 944 | zlog_debug ("It is on the neighbor's retrans-list."); |
| 945 | zlog_debug ("Treat as an Implied acknowledgement"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 946 | } |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 947 | SET_FLAG (new->flag, OSPF6_LSA_IMPLIEDACK); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 948 | ospf6_decrement_retrans_count (rem); |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 949 | ospf6_lsdb_remove (rem, from->retrans_list); |
| 950 | } |
| 951 | |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 952 | if (is_debug) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 953 | zlog_debug ("Possibly acknowledge and then discard"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 954 | |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 955 | /* (b) possibly acknowledge */ |
| 956 | ospf6_acknowledge_lsa (new, ismore_recent, from); |
| 957 | |
| 958 | ospf6_lsa_delete (new); |
| 959 | return; |
| 960 | } |
| 961 | |
| 962 | /* (8) previous database copy is more recent */ |
| 963 | { |
| 964 | assert (old); |
| 965 | |
| 966 | /* If database copy is in 'Seqnumber Wrapping', |
| 967 | simply discard the received LSA */ |
| 968 | if (OSPF6_LSA_IS_MAXAGE (old) && |
| 969 | old->header->seqnum == htonl (MAX_SEQUENCE_NUMBER)) |
| 970 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 971 | if (is_debug) |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 972 | { |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 973 | zlog_debug ("The LSA is in Seqnumber Wrapping"); |
| 974 | zlog_debug ("MaxAge & MaxSeqNum, discard"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 975 | } |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 976 | ospf6_lsa_delete (new); |
| 977 | return; |
| 978 | } |
| 979 | |
| 980 | /* Otherwise, Send database copy of this LSA to this neighbor */ |
| 981 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 982 | if (is_debug) |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 983 | { |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 984 | zlog_debug ("Database copy is more recent."); |
| 985 | zlog_debug ("Send back directly and then discard"); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 986 | } |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 987 | |
| 988 | /* XXX, MinLSArrival check !? RFC 2328 13 (8) */ |
| 989 | |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 990 | ospf6_lsdb_add (ospf6_lsa_copy (old), from->lsupdate_list); |
| 991 | if (from->thread_send_lsupdate == NULL) |
| 992 | from->thread_send_lsupdate = |
| 993 | thread_add_event (master, ospf6_lsupdate_send_neighbor, from, 0); |
| 994 | ospf6_lsa_delete (new); |
| 995 | return; |
| 996 | } |
| 997 | return; |
| 998 | } |
| 999 | } |
| 1000 | |
| 1001 | |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 1002 | DEFUN (debug_ospf6_flooding, |
| 1003 | debug_ospf6_flooding_cmd, |
| 1004 | "debug ospf6 flooding", |
| 1005 | DEBUG_STR |
| 1006 | OSPF6_STR |
| 1007 | "Debug OSPFv3 flooding function\n" |
| 1008 | ) |
| 1009 | { |
| 1010 | OSPF6_DEBUG_FLOODING_ON (); |
| 1011 | return CMD_SUCCESS; |
| 1012 | } |
| 1013 | |
| 1014 | DEFUN (no_debug_ospf6_flooding, |
| 1015 | no_debug_ospf6_flooding_cmd, |
| 1016 | "no debug ospf6 flooding", |
| 1017 | NO_STR |
| 1018 | DEBUG_STR |
| 1019 | OSPF6_STR |
| 1020 | "Debug OSPFv3 flooding function\n" |
| 1021 | ) |
| 1022 | { |
| 1023 | OSPF6_DEBUG_FLOODING_OFF (); |
| 1024 | return CMD_SUCCESS; |
| 1025 | } |
| 1026 | |
| 1027 | int |
| 1028 | config_write_ospf6_debug_flood (struct vty *vty) |
| 1029 | { |
| 1030 | if (IS_OSPF6_DEBUG_FLOODING) |
| 1031 | vty_out (vty, "debug ospf6 flooding%s", VNL); |
| 1032 | return 0; |
| 1033 | } |
| 1034 | |
| 1035 | void |
| 1036 | install_element_ospf6_debug_flood () |
| 1037 | { |
| 1038 | install_element (ENABLE_NODE, &debug_ospf6_flooding_cmd); |
| 1039 | install_element (ENABLE_NODE, &no_debug_ospf6_flooding_cmd); |
| 1040 | install_element (CONFIG_NODE, &debug_ospf6_flooding_cmd); |
| 1041 | install_element (CONFIG_NODE, &no_debug_ospf6_flooding_cmd); |
| 1042 | } |
| 1043 | |
| 1044 | |
| 1045 | |
| 1046 | |
hasso | 4845437 | 2004-05-18 19:14:52 +0000 | [diff] [blame] | 1047 | |