paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 2 | * Copyright (C) 2003 Yasuhiro Ohara |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 22 | #include <zebra.h> |
| 23 | |
| 24 | #include "log.h" |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 25 | #include "memory.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 26 | #include "thread.h" |
| 27 | #include "linklist.h" |
| 28 | #include "vty.h" |
| 29 | #include "command.h" |
| 30 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 31 | #include "ospf6_proto.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 32 | #include "ospf6_lsa.h" |
| 33 | #include "ospf6_lsdb.h" |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 34 | #include "ospf6_message.h" |
| 35 | #include "ospf6_top.h" |
| 36 | #include "ospf6_area.h" |
| 37 | #include "ospf6_interface.h" |
| 38 | #include "ospf6_neighbor.h" |
| 39 | #include "ospf6_intra.h" |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 40 | #include "ospf6_flood.h" |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 41 | #include "ospf6d.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 42 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 43 | unsigned char conf_debug_ospf6_neighbor = 0; |
| 44 | |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 45 | const char *ospf6_neighbor_state_str[] = |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 46 | { "None", "Down", "Attempt", "Init", "Twoway", "ExStart", "ExChange", |
| 47 | "Loading", "Full", NULL }; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 48 | |
| 49 | int |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 50 | ospf6_neighbor_cmp (void *va, void *vb) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 51 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 52 | struct ospf6_neighbor *ona = (struct ospf6_neighbor *) va; |
| 53 | struct ospf6_neighbor *onb = (struct ospf6_neighbor *) vb; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 54 | return (ntohl (ona->router_id) < ntohl (onb->router_id) ? -1 : 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 55 | } |
| 56 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 57 | struct ospf6_neighbor * |
| 58 | ospf6_neighbor_lookup (u_int32_t router_id, |
| 59 | struct ospf6_interface *oi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 60 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 61 | struct listnode *n; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 62 | struct ospf6_neighbor *on; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 63 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 64 | for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, n, on)) |
| 65 | if (on->router_id == router_id) |
| 66 | return on; |
| 67 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 68 | return (struct ospf6_neighbor *) NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | /* create ospf6_neighbor */ |
| 72 | struct ospf6_neighbor * |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 73 | ospf6_neighbor_create (u_int32_t router_id, struct ospf6_interface *oi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 74 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 75 | struct ospf6_neighbor *on; |
| 76 | char buf[16]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 77 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 78 | on = (struct ospf6_neighbor *) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 79 | XMALLOC (MTYPE_OSPF6_NEIGHBOR, sizeof (struct ospf6_neighbor)); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 80 | if (on == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 81 | { |
| 82 | zlog_warn ("neighbor: malloc failed"); |
| 83 | return NULL; |
| 84 | } |
| 85 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 86 | memset (on, 0, sizeof (struct ospf6_neighbor)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 87 | inet_ntop (AF_INET, &router_id, buf, sizeof (buf)); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 88 | snprintf (on->name, sizeof (on->name), "%s%%%s", |
| 89 | buf, oi->interface->name); |
| 90 | on->ospf6_if = oi; |
| 91 | on->state = OSPF6_NEIGHBOR_DOWN; |
Vincent Bernat | 061bc73 | 2012-05-31 20:21:15 +0200 | [diff] [blame] | 92 | on->state_change = 0; |
Takashi Sogabe | 86f72dc | 2009-06-22 13:07:02 +0900 | [diff] [blame] | 93 | quagga_gettime (QUAGGA_CLK_MONOTONIC, &on->last_changed); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 94 | on->router_id = router_id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 95 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 96 | on->summary_list = ospf6_lsdb_create (on); |
| 97 | on->request_list = ospf6_lsdb_create (on); |
| 98 | on->retrans_list = ospf6_lsdb_create (on); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 99 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 100 | on->dbdesc_list = ospf6_lsdb_create (on); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 101 | on->lsupdate_list = ospf6_lsdb_create (on); |
| 102 | on->lsack_list = ospf6_lsdb_create (on); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 103 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 104 | listnode_add_sort (oi->neighbor_list, on); |
| 105 | return on; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 109 | ospf6_neighbor_delete (struct ospf6_neighbor *on) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 110 | { |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 111 | struct ospf6_lsa *lsa; |
| 112 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 113 | ospf6_lsdb_remove_all (on->summary_list); |
| 114 | ospf6_lsdb_remove_all (on->request_list); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 115 | for (lsa = ospf6_lsdb_head (on->retrans_list); lsa; |
| 116 | lsa = ospf6_lsdb_next (lsa)) |
| 117 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 118 | ospf6_decrement_retrans_count (lsa); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 119 | ospf6_lsdb_remove (lsa, on->retrans_list); |
| 120 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 121 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 122 | ospf6_lsdb_remove_all (on->dbdesc_list); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 123 | ospf6_lsdb_remove_all (on->lsupdate_list); |
| 124 | ospf6_lsdb_remove_all (on->lsack_list); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 125 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 126 | ospf6_lsdb_delete (on->summary_list); |
| 127 | ospf6_lsdb_delete (on->request_list); |
| 128 | ospf6_lsdb_delete (on->retrans_list); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 129 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 130 | ospf6_lsdb_delete (on->dbdesc_list); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 131 | ospf6_lsdb_delete (on->lsupdate_list); |
| 132 | ospf6_lsdb_delete (on->lsack_list); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 133 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 134 | THREAD_OFF (on->inactivity_timer); |
| 135 | |
| 136 | THREAD_OFF (on->thread_send_dbdesc); |
| 137 | THREAD_OFF (on->thread_send_lsreq); |
| 138 | THREAD_OFF (on->thread_send_lsupdate); |
| 139 | THREAD_OFF (on->thread_send_lsack); |
| 140 | |
| 141 | XFREE (MTYPE_OSPF6_NEIGHBOR, on); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 142 | } |
| 143 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 144 | static void |
| 145 | ospf6_neighbor_state_change (u_char next_state, struct ospf6_neighbor *on) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 146 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 147 | u_char prev_state; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 148 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 149 | prev_state = on->state; |
| 150 | on->state = next_state; |
| 151 | |
| 152 | if (prev_state == next_state) |
| 153 | return; |
| 154 | |
Vincent Bernat | 061bc73 | 2012-05-31 20:21:15 +0200 | [diff] [blame] | 155 | on->state_change++; |
Takashi Sogabe | 86f72dc | 2009-06-22 13:07:02 +0900 | [diff] [blame] | 156 | quagga_gettime (QUAGGA_CLK_MONOTONIC, &on->last_changed); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 157 | |
| 158 | /* log */ |
| 159 | if (IS_OSPF6_DEBUG_NEIGHBOR (STATE)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 160 | { |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 161 | zlog_debug ("Neighbor state change %s: [%s]->[%s]", on->name, |
| 162 | ospf6_neighbor_state_str[prev_state], |
| 163 | ospf6_neighbor_state_str[next_state]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 164 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 165 | |
| 166 | if (prev_state == OSPF6_NEIGHBOR_FULL || next_state == OSPF6_NEIGHBOR_FULL) |
| 167 | { |
| 168 | OSPF6_ROUTER_LSA_SCHEDULE (on->ospf6_if->area); |
| 169 | if (on->ospf6_if->state == OSPF6_INTERFACE_DR) |
| 170 | { |
| 171 | OSPF6_NETWORK_LSA_SCHEDULE (on->ospf6_if); |
| 172 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (on->ospf6_if); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 173 | } |
hasso | 4846ef6 | 2004-09-03 06:04:00 +0000 | [diff] [blame] | 174 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (on->ospf6_if->area); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 175 | } |
| 176 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 177 | if ((prev_state == OSPF6_NEIGHBOR_EXCHANGE || |
| 178 | prev_state == OSPF6_NEIGHBOR_LOADING) && |
| 179 | (next_state != OSPF6_NEIGHBOR_EXCHANGE && |
| 180 | next_state != OSPF6_NEIGHBOR_LOADING)) |
Paul Jakma | 932bf19 | 2006-05-15 10:42:24 +0000 | [diff] [blame] | 181 | ospf6_maxage_remove (on->ospf6_if->area->ospf6); |
Vincent Bernat | bf83666 | 2012-06-04 14:36:12 +0200 | [diff] [blame] | 182 | |
| 183 | #ifdef HAVE_SNMP |
| 184 | /* Terminal state or regression */ |
| 185 | if ((next_state == OSPF6_NEIGHBOR_FULL) || |
| 186 | (next_state == OSPF6_NEIGHBOR_TWOWAY) || |
| 187 | (next_state < prev_state)) |
| 188 | ospf6TrapNbrStateChange (on); |
| 189 | #endif |
| 190 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 191 | } |
| 192 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 193 | /* RFC2328 section 10.4 */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 194 | static int |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 195 | need_adjacency (struct ospf6_neighbor *on) |
| 196 | { |
| 197 | if (on->ospf6_if->state == OSPF6_INTERFACE_POINTTOPOINT || |
| 198 | on->ospf6_if->state == OSPF6_INTERFACE_DR || |
| 199 | on->ospf6_if->state == OSPF6_INTERFACE_BDR) |
| 200 | return 1; |
| 201 | |
| 202 | if (on->ospf6_if->drouter == on->router_id || |
| 203 | on->ospf6_if->bdrouter == on->router_id) |
| 204 | return 1; |
| 205 | |
| 206 | return 0; |
| 207 | } |
| 208 | |
| 209 | int |
| 210 | hello_received (struct thread *thread) |
| 211 | { |
| 212 | struct ospf6_neighbor *on; |
| 213 | |
| 214 | on = (struct ospf6_neighbor *) THREAD_ARG (thread); |
| 215 | assert (on); |
| 216 | |
| 217 | if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 218 | zlog_debug ("Neighbor Event %s: *HelloReceived*", on->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 219 | |
| 220 | /* reset Inactivity Timer */ |
| 221 | THREAD_OFF (on->inactivity_timer); |
| 222 | on->inactivity_timer = thread_add_timer (master, inactivity_timer, on, |
| 223 | on->ospf6_if->dead_interval); |
| 224 | |
| 225 | if (on->state <= OSPF6_NEIGHBOR_DOWN) |
| 226 | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_INIT, on); |
| 227 | |
| 228 | return 0; |
| 229 | } |
| 230 | |
| 231 | int |
| 232 | twoway_received (struct thread *thread) |
| 233 | { |
| 234 | struct ospf6_neighbor *on; |
| 235 | |
| 236 | on = (struct ospf6_neighbor *) THREAD_ARG (thread); |
| 237 | assert (on); |
| 238 | |
| 239 | if (on->state > OSPF6_NEIGHBOR_INIT) |
| 240 | return 0; |
| 241 | |
| 242 | if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 243 | zlog_debug ("Neighbor Event %s: *2Way-Received*", on->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 244 | |
| 245 | thread_add_event (master, neighbor_change, on->ospf6_if, 0); |
| 246 | |
| 247 | if (! need_adjacency (on)) |
| 248 | { |
| 249 | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_TWOWAY, on); |
| 250 | return 0; |
| 251 | } |
| 252 | |
| 253 | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on); |
| 254 | SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT); |
| 255 | SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT); |
| 256 | SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
| 257 | |
| 258 | THREAD_OFF (on->thread_send_dbdesc); |
| 259 | on->thread_send_dbdesc = |
| 260 | thread_add_event (master, ospf6_dbdesc_send, on, 0); |
| 261 | |
| 262 | return 0; |
| 263 | } |
| 264 | |
| 265 | int |
| 266 | negotiation_done (struct thread *thread) |
| 267 | { |
| 268 | struct ospf6_neighbor *on; |
| 269 | struct ospf6_lsa *lsa; |
| 270 | |
| 271 | on = (struct ospf6_neighbor *) THREAD_ARG (thread); |
| 272 | assert (on); |
| 273 | |
| 274 | if (on->state != OSPF6_NEIGHBOR_EXSTART) |
| 275 | return 0; |
| 276 | |
| 277 | if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 278 | zlog_debug ("Neighbor Event %s: *NegotiationDone*", on->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 279 | |
| 280 | /* clear ls-list */ |
| 281 | ospf6_lsdb_remove_all (on->summary_list); |
| 282 | ospf6_lsdb_remove_all (on->request_list); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 283 | for (lsa = ospf6_lsdb_head (on->retrans_list); lsa; |
| 284 | lsa = ospf6_lsdb_next (lsa)) |
| 285 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 286 | ospf6_decrement_retrans_count (lsa); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 287 | ospf6_lsdb_remove (lsa, on->retrans_list); |
| 288 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 289 | |
| 290 | /* Interface scoped LSAs */ |
| 291 | for (lsa = ospf6_lsdb_head (on->ospf6_if->lsdb); lsa; |
| 292 | lsa = ospf6_lsdb_next (lsa)) |
| 293 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 294 | if (OSPF6_LSA_IS_MAXAGE (lsa)) |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 295 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 296 | ospf6_increment_retrans_count (lsa); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 297 | ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->retrans_list); |
| 298 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 299 | else |
| 300 | ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->summary_list); |
| 301 | } |
| 302 | |
| 303 | /* Area scoped LSAs */ |
| 304 | for (lsa = ospf6_lsdb_head (on->ospf6_if->area->lsdb); lsa; |
| 305 | lsa = ospf6_lsdb_next (lsa)) |
| 306 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 307 | if (OSPF6_LSA_IS_MAXAGE (lsa)) |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 308 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 309 | ospf6_increment_retrans_count (lsa); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 310 | ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->retrans_list); |
| 311 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 312 | else |
| 313 | ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->summary_list); |
| 314 | } |
| 315 | |
| 316 | /* AS scoped LSAs */ |
| 317 | for (lsa = ospf6_lsdb_head (on->ospf6_if->area->ospf6->lsdb); lsa; |
| 318 | lsa = ospf6_lsdb_next (lsa)) |
| 319 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 320 | if (OSPF6_LSA_IS_MAXAGE (lsa)) |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 321 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 322 | ospf6_increment_retrans_count (lsa); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 323 | ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->retrans_list); |
| 324 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 325 | else |
| 326 | ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->summary_list); |
| 327 | } |
| 328 | |
| 329 | UNSET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
| 330 | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXCHANGE, on); |
| 331 | |
| 332 | return 0; |
| 333 | } |
| 334 | |
| 335 | int |
| 336 | exchange_done (struct thread *thread) |
| 337 | { |
| 338 | struct ospf6_neighbor *on; |
| 339 | |
| 340 | on = (struct ospf6_neighbor *) THREAD_ARG (thread); |
| 341 | assert (on); |
| 342 | |
| 343 | if (on->state != OSPF6_NEIGHBOR_EXCHANGE) |
| 344 | return 0; |
| 345 | |
| 346 | if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 347 | zlog_debug ("Neighbor Event %s: *ExchangeDone*", on->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 348 | |
| 349 | THREAD_OFF (on->thread_send_dbdesc); |
| 350 | ospf6_lsdb_remove_all (on->dbdesc_list); |
| 351 | |
| 352 | /* XXX |
| 353 | thread_add_timer (master, ospf6_neighbor_last_dbdesc_release, on, |
| 354 | on->ospf6_if->dead_interval); |
| 355 | */ |
| 356 | |
| 357 | if (on->request_list->count == 0) |
| 358 | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_FULL, on); |
| 359 | else |
Dinesh Dutt | eb82e9e | 2013-08-24 07:55:07 +0000 | [diff] [blame] | 360 | { |
| 361 | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_LOADING, on); |
| 362 | |
| 363 | if (on->thread_send_lsreq == NULL) |
| 364 | on->thread_send_lsreq = |
| 365 | thread_add_event (master, ospf6_lsreq_send, on, 0); |
| 366 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 367 | |
| 368 | return 0; |
| 369 | } |
| 370 | |
Dinesh Dutt | eb82e9e | 2013-08-24 07:55:07 +0000 | [diff] [blame] | 371 | /* Check loading state. */ |
| 372 | void |
| 373 | ospf6_check_nbr_loading (struct ospf6_neighbor *on) |
| 374 | { |
| 375 | |
| 376 | /* RFC2328 Section 10.9: When the neighbor responds to these requests |
| 377 | with the proper Link State Update packet(s), the Link state request |
| 378 | list is truncated and a new Link State Request packet is sent. |
| 379 | */ |
| 380 | if ((on->state == OSPF6_NEIGHBOR_LOADING) || |
| 381 | (on->state == OSPF6_NEIGHBOR_EXCHANGE)) |
| 382 | { |
| 383 | if (on->request_list->count == 0) |
| 384 | thread_add_event (master, loading_done, on, 0); |
| 385 | else if (on->last_ls_req == NULL) |
| 386 | { |
| 387 | if (on->thread_send_lsreq != NULL) |
| 388 | THREAD_OFF (on->thread_send_lsreq); |
| 389 | on->thread_send_lsreq = |
| 390 | thread_add_event (master, ospf6_lsreq_send, on, 0); |
| 391 | } |
| 392 | } |
| 393 | } |
| 394 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 395 | int |
| 396 | loading_done (struct thread *thread) |
| 397 | { |
| 398 | struct ospf6_neighbor *on; |
| 399 | |
| 400 | on = (struct ospf6_neighbor *) THREAD_ARG (thread); |
| 401 | assert (on); |
| 402 | |
| 403 | if (on->state != OSPF6_NEIGHBOR_LOADING) |
| 404 | return 0; |
| 405 | |
| 406 | if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 407 | zlog_debug ("Neighbor Event %s: *LoadingDone*", on->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 408 | |
| 409 | assert (on->request_list->count == 0); |
| 410 | |
| 411 | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_FULL, on); |
| 412 | |
| 413 | return 0; |
| 414 | } |
| 415 | |
| 416 | int |
| 417 | adj_ok (struct thread *thread) |
| 418 | { |
| 419 | struct ospf6_neighbor *on; |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 420 | struct ospf6_lsa *lsa; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 421 | |
| 422 | on = (struct ospf6_neighbor *) THREAD_ARG (thread); |
| 423 | assert (on); |
| 424 | |
| 425 | if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 426 | zlog_debug ("Neighbor Event %s: *AdjOK?*", on->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 427 | |
| 428 | if (on->state == OSPF6_NEIGHBOR_TWOWAY && need_adjacency (on)) |
| 429 | { |
| 430 | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on); |
| 431 | SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT); |
| 432 | SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT); |
| 433 | SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
| 434 | |
| 435 | THREAD_OFF (on->thread_send_dbdesc); |
| 436 | on->thread_send_dbdesc = |
| 437 | thread_add_event (master, ospf6_dbdesc_send, on, 0); |
| 438 | |
| 439 | } |
| 440 | else if (on->state >= OSPF6_NEIGHBOR_EXSTART && |
| 441 | ! need_adjacency (on)) |
| 442 | { |
| 443 | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_TWOWAY, on); |
| 444 | ospf6_lsdb_remove_all (on->summary_list); |
| 445 | ospf6_lsdb_remove_all (on->request_list); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 446 | for (lsa = ospf6_lsdb_head (on->retrans_list); lsa; |
| 447 | lsa = ospf6_lsdb_next (lsa)) |
| 448 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 449 | ospf6_decrement_retrans_count (lsa); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 450 | ospf6_lsdb_remove (lsa, on->retrans_list); |
| 451 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 452 | } |
| 453 | |
| 454 | return 0; |
| 455 | } |
| 456 | |
| 457 | int |
| 458 | seqnumber_mismatch (struct thread *thread) |
| 459 | { |
| 460 | struct ospf6_neighbor *on; |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 461 | struct ospf6_lsa *lsa; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 462 | |
| 463 | on = (struct ospf6_neighbor *) THREAD_ARG (thread); |
| 464 | assert (on); |
| 465 | |
| 466 | if (on->state < OSPF6_NEIGHBOR_EXCHANGE) |
| 467 | return 0; |
| 468 | |
| 469 | if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 470 | zlog_debug ("Neighbor Event %s: *SeqNumberMismatch*", on->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 471 | |
| 472 | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on); |
| 473 | SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT); |
| 474 | SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT); |
| 475 | SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
| 476 | |
| 477 | ospf6_lsdb_remove_all (on->summary_list); |
| 478 | ospf6_lsdb_remove_all (on->request_list); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 479 | for (lsa = ospf6_lsdb_head (on->retrans_list); lsa; |
| 480 | lsa = ospf6_lsdb_next (lsa)) |
| 481 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 482 | ospf6_decrement_retrans_count (lsa); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 483 | ospf6_lsdb_remove (lsa, on->retrans_list); |
| 484 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 485 | |
| 486 | THREAD_OFF (on->thread_send_dbdesc); |
| 487 | on->thread_send_dbdesc = |
| 488 | thread_add_event (master, ospf6_dbdesc_send, on, 0); |
| 489 | |
| 490 | return 0; |
| 491 | } |
| 492 | |
| 493 | int |
| 494 | bad_lsreq (struct thread *thread) |
| 495 | { |
| 496 | struct ospf6_neighbor *on; |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 497 | struct ospf6_lsa *lsa; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 498 | |
| 499 | on = (struct ospf6_neighbor *) THREAD_ARG (thread); |
| 500 | assert (on); |
| 501 | |
| 502 | if (on->state < OSPF6_NEIGHBOR_EXCHANGE) |
| 503 | return 0; |
| 504 | |
| 505 | if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 506 | zlog_debug ("Neighbor Event %s: *BadLSReq*", on->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 507 | |
| 508 | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on); |
| 509 | SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT); |
| 510 | SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT); |
| 511 | SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
| 512 | |
| 513 | ospf6_lsdb_remove_all (on->summary_list); |
| 514 | ospf6_lsdb_remove_all (on->request_list); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 515 | for (lsa = ospf6_lsdb_head (on->retrans_list); lsa; |
| 516 | lsa = ospf6_lsdb_next (lsa)) |
| 517 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 518 | ospf6_decrement_retrans_count (lsa); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 519 | ospf6_lsdb_remove (lsa, on->retrans_list); |
| 520 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 521 | |
| 522 | THREAD_OFF (on->thread_send_dbdesc); |
| 523 | on->thread_send_dbdesc = |
| 524 | thread_add_event (master, ospf6_dbdesc_send, on, 0); |
| 525 | |
| 526 | return 0; |
| 527 | } |
| 528 | |
| 529 | int |
| 530 | oneway_received (struct thread *thread) |
| 531 | { |
| 532 | struct ospf6_neighbor *on; |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 533 | struct ospf6_lsa *lsa; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 534 | |
| 535 | on = (struct ospf6_neighbor *) THREAD_ARG (thread); |
| 536 | assert (on); |
| 537 | |
| 538 | if (on->state < OSPF6_NEIGHBOR_TWOWAY) |
| 539 | return 0; |
| 540 | |
| 541 | if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 542 | zlog_debug ("Neighbor Event %s: *1Way-Received*", on->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 543 | |
| 544 | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_INIT, on); |
| 545 | thread_add_event (master, neighbor_change, on->ospf6_if, 0); |
| 546 | |
| 547 | ospf6_lsdb_remove_all (on->summary_list); |
| 548 | ospf6_lsdb_remove_all (on->request_list); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 549 | for (lsa = ospf6_lsdb_head (on->retrans_list); lsa; |
| 550 | lsa = ospf6_lsdb_next (lsa)) |
| 551 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 552 | ospf6_decrement_retrans_count (lsa); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 553 | ospf6_lsdb_remove (lsa, on->retrans_list); |
| 554 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 555 | |
| 556 | THREAD_OFF (on->thread_send_dbdesc); |
| 557 | THREAD_OFF (on->thread_send_lsreq); |
| 558 | THREAD_OFF (on->thread_send_lsupdate); |
| 559 | THREAD_OFF (on->thread_send_lsack); |
| 560 | |
| 561 | return 0; |
| 562 | } |
| 563 | |
| 564 | int |
| 565 | inactivity_timer (struct thread *thread) |
| 566 | { |
| 567 | struct ospf6_neighbor *on; |
| 568 | |
| 569 | on = (struct ospf6_neighbor *) THREAD_ARG (thread); |
| 570 | assert (on); |
| 571 | |
| 572 | if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 573 | zlog_debug ("Neighbor Event %s: *InactivityTimer*", on->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 574 | |
| 575 | on->inactivity_timer = NULL; |
| 576 | on->drouter = on->prev_drouter = 0; |
| 577 | on->bdrouter = on->prev_bdrouter = 0; |
| 578 | |
| 579 | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_DOWN, on); |
| 580 | thread_add_event (master, neighbor_change, on->ospf6_if, 0); |
| 581 | |
| 582 | listnode_delete (on->ospf6_if->neighbor_list, on); |
| 583 | ospf6_neighbor_delete (on); |
| 584 | |
| 585 | return 0; |
| 586 | } |
| 587 | |
| 588 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 589 | |
| 590 | /* vty functions */ |
| 591 | /* show neighbor structure */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 592 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 593 | ospf6_neighbor_show (struct vty *vty, struct ospf6_neighbor *on) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 594 | { |
| 595 | char router_id[16]; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 596 | char duration[16]; |
| 597 | struct timeval now, res; |
| 598 | char nstate[16]; |
| 599 | char deadtime[16]; |
| 600 | long h, m, s; |
| 601 | |
| 602 | /* Router-ID (Name) */ |
| 603 | inet_ntop (AF_INET, &on->router_id, router_id, sizeof (router_id)); |
| 604 | #ifdef HAVE_GETNAMEINFO |
| 605 | { |
| 606 | } |
| 607 | #endif /*HAVE_GETNAMEINFO*/ |
| 608 | |
Takashi Sogabe | 86f72dc | 2009-06-22 13:07:02 +0900 | [diff] [blame] | 609 | quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 610 | |
| 611 | /* Dead time */ |
| 612 | h = m = s = 0; |
| 613 | if (on->inactivity_timer) |
| 614 | { |
Paul Jakma | c136d24 | 2007-03-08 17:50:01 +0000 | [diff] [blame] | 615 | s = on->inactivity_timer->u.sands.tv_sec - recent_relative_time().tv_sec; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 616 | h = s / 3600; |
| 617 | s -= h * 3600; |
| 618 | m = s / 60; |
| 619 | s -= m * 60; |
| 620 | } |
| 621 | snprintf (deadtime, sizeof (deadtime), "%02ld:%02ld:%02ld", h, m, s); |
| 622 | |
| 623 | /* Neighbor State */ |
| 624 | if (if_is_pointopoint (on->ospf6_if->interface)) |
| 625 | snprintf (nstate, sizeof (nstate), "PointToPoint"); |
| 626 | else |
| 627 | { |
| 628 | if (on->router_id == on->drouter) |
| 629 | snprintf (nstate, sizeof (nstate), "DR"); |
| 630 | else if (on->router_id == on->bdrouter) |
| 631 | snprintf (nstate, sizeof (nstate), "BDR"); |
| 632 | else |
| 633 | snprintf (nstate, sizeof (nstate), "DROther"); |
| 634 | } |
| 635 | |
| 636 | /* Duration */ |
| 637 | timersub (&now, &on->last_changed, &res); |
| 638 | timerstring (&res, duration, sizeof (duration)); |
| 639 | |
| 640 | /* |
| 641 | vty_out (vty, "%-15s %3d %11s %6s/%-12s %11s %s[%s]%s", |
| 642 | "Neighbor ID", "Pri", "DeadTime", "State", "", "Duration", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 643 | "I/F", "State", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 644 | */ |
| 645 | |
| 646 | vty_out (vty, "%-15s %3d %11s %6s/%-12s %11s %s[%s]%s", |
| 647 | router_id, on->priority, deadtime, |
| 648 | ospf6_neighbor_state_str[on->state], nstate, duration, |
| 649 | on->ospf6_if->interface->name, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 650 | ospf6_interface_state_str[on->ospf6_if->state], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 651 | } |
| 652 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 653 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 654 | ospf6_neighbor_show_drchoice (struct vty *vty, struct ospf6_neighbor *on) |
| 655 | { |
| 656 | char router_id[16]; |
| 657 | char drouter[16], bdrouter[16]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 658 | char duration[16]; |
| 659 | struct timeval now, res; |
| 660 | |
| 661 | /* |
| 662 | vty_out (vty, "%-15s %6s/%-11s %-15s %-15s %s[%s]%s", |
| 663 | "RouterID", "State", "Duration", "DR", "BDR", "I/F", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 664 | "State", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 665 | */ |
| 666 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 667 | inet_ntop (AF_INET, &on->router_id, router_id, sizeof (router_id)); |
| 668 | inet_ntop (AF_INET, &on->drouter, drouter, sizeof (drouter)); |
| 669 | inet_ntop (AF_INET, &on->bdrouter, bdrouter, sizeof (bdrouter)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 670 | |
Takashi Sogabe | 86f72dc | 2009-06-22 13:07:02 +0900 | [diff] [blame] | 671 | quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 672 | timersub (&now, &on->last_changed, &res); |
| 673 | timerstring (&res, duration, sizeof (duration)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 674 | |
| 675 | vty_out (vty, "%-15s %6s/%-11s %-15s %-15s %s[%s]%s", |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 676 | router_id, ospf6_neighbor_state_str[on->state], |
| 677 | duration, drouter, bdrouter, on->ospf6_if->interface->name, |
| 678 | ospf6_interface_state_str[on->ospf6_if->state], |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 679 | VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 680 | } |
| 681 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 682 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 683 | ospf6_neighbor_show_detail (struct vty *vty, struct ospf6_neighbor *on) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 684 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 685 | char drouter[16], bdrouter[16]; |
| 686 | char linklocal_addr[64], duration[32]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 687 | struct timeval now, res; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 688 | struct ospf6_lsa *lsa; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 689 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 690 | inet_ntop (AF_INET6, &on->linklocal_addr, linklocal_addr, |
| 691 | sizeof (linklocal_addr)); |
| 692 | inet_ntop (AF_INET, &on->drouter, drouter, sizeof (drouter)); |
| 693 | inet_ntop (AF_INET, &on->bdrouter, bdrouter, sizeof (bdrouter)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 694 | |
Takashi Sogabe | 86f72dc | 2009-06-22 13:07:02 +0900 | [diff] [blame] | 695 | quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 696 | timersub (&now, &on->last_changed, &res); |
| 697 | timerstring (&res, duration, sizeof (duration)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 698 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 699 | vty_out (vty, " Neighbor %s%s", on->name, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 700 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 701 | vty_out (vty, " Area %s via interface %s (ifindex %d)%s", |
| 702 | on->ospf6_if->area->name, |
| 703 | on->ospf6_if->interface->name, |
| 704 | on->ospf6_if->interface->ifindex, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 705 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 706 | vty_out (vty, " His IfIndex: %d Link-local address: %s%s", |
| 707 | on->ifindex, linklocal_addr, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 708 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 709 | vty_out (vty, " State %s for a duration of %s%s", |
| 710 | ospf6_neighbor_state_str[on->state], duration, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 711 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 712 | vty_out (vty, " His choice of DR/BDR %s/%s, Priority %d%s", |
| 713 | drouter, bdrouter, on->priority, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 714 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 715 | vty_out (vty, " DbDesc status: %s%s%s SeqNum: %#lx%s", |
| 716 | (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT) ? "Initial " : ""), |
| 717 | (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT) ? "More " : ""), |
| 718 | (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT) ? |
| 719 | "Master" : "Slave"), (u_long) ntohl (on->dbdesc_seqnum), |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 720 | VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 721 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 722 | vty_out (vty, " Summary-List: %d LSAs%s", on->summary_list->count, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 723 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 724 | for (lsa = ospf6_lsdb_head (on->summary_list); lsa; |
| 725 | lsa = ospf6_lsdb_next (lsa)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 726 | vty_out (vty, " %s%s", lsa->name, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 727 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 728 | vty_out (vty, " Request-List: %d LSAs%s", on->request_list->count, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 729 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 730 | for (lsa = ospf6_lsdb_head (on->request_list); lsa; |
| 731 | lsa = ospf6_lsdb_next (lsa)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 732 | vty_out (vty, " %s%s", lsa->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 733 | |
| 734 | vty_out (vty, " Retrans-List: %d LSAs%s", on->retrans_list->count, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 735 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 736 | for (lsa = ospf6_lsdb_head (on->retrans_list); lsa; |
| 737 | lsa = ospf6_lsdb_next (lsa)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 738 | vty_out (vty, " %s%s", lsa->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 739 | |
| 740 | timerclear (&res); |
| 741 | if (on->thread_send_dbdesc) |
| 742 | timersub (&on->thread_send_dbdesc->u.sands, &now, &res); |
| 743 | timerstring (&res, duration, sizeof (duration)); |
| 744 | vty_out (vty, " %d Pending LSAs for DbDesc in Time %s [thread %s]%s", |
| 745 | on->dbdesc_list->count, duration, |
| 746 | (on->thread_send_dbdesc ? "on" : "off"), |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 747 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 748 | for (lsa = ospf6_lsdb_head (on->dbdesc_list); lsa; |
| 749 | lsa = ospf6_lsdb_next (lsa)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 750 | vty_out (vty, " %s%s", lsa->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 751 | |
| 752 | timerclear (&res); |
| 753 | if (on->thread_send_lsreq) |
| 754 | timersub (&on->thread_send_lsreq->u.sands, &now, &res); |
| 755 | timerstring (&res, duration, sizeof (duration)); |
| 756 | vty_out (vty, " %d Pending LSAs for LSReq in Time %s [thread %s]%s", |
Dinesh Dutt | eb82e9e | 2013-08-24 07:55:07 +0000 | [diff] [blame] | 757 | on->request_list->count, duration, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 758 | (on->thread_send_lsreq ? "on" : "off"), |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 759 | VNL); |
Dinesh Dutt | eb82e9e | 2013-08-24 07:55:07 +0000 | [diff] [blame] | 760 | for (lsa = ospf6_lsdb_head (on->request_list); lsa; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 761 | lsa = ospf6_lsdb_next (lsa)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 762 | vty_out (vty, " %s%s", lsa->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 763 | |
| 764 | timerclear (&res); |
| 765 | if (on->thread_send_lsupdate) |
| 766 | timersub (&on->thread_send_lsupdate->u.sands, &now, &res); |
| 767 | timerstring (&res, duration, sizeof (duration)); |
| 768 | vty_out (vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]%s", |
| 769 | on->lsupdate_list->count, duration, |
| 770 | (on->thread_send_lsupdate ? "on" : "off"), |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 771 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 772 | for (lsa = ospf6_lsdb_head (on->lsupdate_list); lsa; |
| 773 | lsa = ospf6_lsdb_next (lsa)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 774 | vty_out (vty, " %s%s", lsa->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 775 | |
| 776 | timerclear (&res); |
| 777 | if (on->thread_send_lsack) |
| 778 | timersub (&on->thread_send_lsack->u.sands, &now, &res); |
| 779 | timerstring (&res, duration, sizeof (duration)); |
| 780 | vty_out (vty, " %d Pending LSAs for LSAck in Time %s [thread %s]%s", |
| 781 | on->lsack_list->count, duration, |
| 782 | (on->thread_send_lsack ? "on" : "off"), |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 783 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 784 | for (lsa = ospf6_lsdb_head (on->lsack_list); lsa; |
| 785 | lsa = ospf6_lsdb_next (lsa)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 786 | vty_out (vty, " %s%s", lsa->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 787 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 788 | } |
| 789 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 790 | DEFUN (show_ipv6_ospf6_neighbor, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 791 | show_ipv6_ospf6_neighbor_cmd, |
| 792 | "show ipv6 ospf6 neighbor", |
| 793 | SHOW_STR |
| 794 | IP6_STR |
| 795 | OSPF6_STR |
| 796 | "Neighbor list\n" |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 797 | ) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 798 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 799 | struct ospf6_neighbor *on; |
| 800 | struct ospf6_interface *oi; |
| 801 | struct ospf6_area *oa; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 802 | struct listnode *i, *j, *k; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 803 | void (*showfunc) (struct vty *, struct ospf6_neighbor *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 804 | |
| 805 | OSPF6_CMD_CHECK_RUNNING (); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 806 | showfunc = ospf6_neighbor_show; |
| 807 | |
| 808 | if (argc) |
| 809 | { |
| 810 | if (! strncmp (argv[0], "de", 2)) |
| 811 | showfunc = ospf6_neighbor_show_detail; |
| 812 | else if (! strncmp (argv[0], "dr", 2)) |
| 813 | showfunc = ospf6_neighbor_show_drchoice; |
| 814 | } |
| 815 | |
| 816 | if (showfunc == ospf6_neighbor_show) |
| 817 | vty_out (vty, "%-15s %3s %11s %6s/%-12s %11s %s[%s]%s", |
| 818 | "Neighbor ID", "Pri", "DeadTime", "State", "IfState", "Duration", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 819 | "I/F", "State", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 820 | else if (showfunc == ospf6_neighbor_show_drchoice) |
| 821 | vty_out (vty, "%-15s %6s/%-11s %-15s %-15s %s[%s]%s", |
| 822 | "RouterID", "State", "Duration", "DR", "BDR", "I/F", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 823 | "State", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 824 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 825 | for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, i, oa)) |
| 826 | for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi)) |
| 827 | for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, k, on)) |
| 828 | (*showfunc) (vty, on); |
| 829 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 830 | return CMD_SUCCESS; |
| 831 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 832 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 833 | ALIAS (show_ipv6_ospf6_neighbor, |
| 834 | show_ipv6_ospf6_neighbor_detail_cmd, |
| 835 | "show ipv6 ospf6 neighbor (detail|drchoice)", |
| 836 | SHOW_STR |
| 837 | IP6_STR |
| 838 | OSPF6_STR |
| 839 | "Neighbor list\n" |
| 840 | "Display details\n" |
| 841 | "Display DR choices\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 842 | ) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 843 | |
| 844 | DEFUN (show_ipv6_ospf6_neighbor_one, |
| 845 | show_ipv6_ospf6_neighbor_one_cmd, |
| 846 | "show ipv6 ospf6 neighbor A.B.C.D", |
| 847 | SHOW_STR |
| 848 | IP6_STR |
| 849 | OSPF6_STR |
| 850 | "Neighbor list\n" |
| 851 | "Specify Router-ID as IPv4 address notation\n" |
| 852 | ) |
| 853 | { |
| 854 | struct ospf6_neighbor *on; |
| 855 | struct ospf6_interface *oi; |
| 856 | struct ospf6_area *oa; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 857 | struct listnode *i, *j, *k; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 858 | void (*showfunc) (struct vty *, struct ospf6_neighbor *); |
| 859 | u_int32_t router_id; |
| 860 | |
| 861 | OSPF6_CMD_CHECK_RUNNING (); |
| 862 | showfunc = ospf6_neighbor_show_detail; |
| 863 | |
| 864 | if ((inet_pton (AF_INET, argv[0], &router_id)) != 1) |
| 865 | { |
| 866 | vty_out (vty, "Router-ID is not parsable: %s%s", argv[0], |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 867 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 868 | return CMD_SUCCESS; |
| 869 | } |
| 870 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 871 | for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, i, oa)) |
| 872 | for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi)) |
| 873 | for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, k, on)) |
| 874 | (*showfunc) (vty, on); |
| 875 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 876 | return CMD_SUCCESS; |
| 877 | } |
| 878 | |
| 879 | void |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 880 | ospf6_neighbor_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 881 | { |
| 882 | install_element (VIEW_NODE, &show_ipv6_ospf6_neighbor_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 883 | install_element (VIEW_NODE, &show_ipv6_ospf6_neighbor_detail_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 884 | install_element (ENABLE_NODE, &show_ipv6_ospf6_neighbor_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 885 | install_element (ENABLE_NODE, &show_ipv6_ospf6_neighbor_detail_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 886 | } |
| 887 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 888 | DEFUN (debug_ospf6_neighbor, |
| 889 | debug_ospf6_neighbor_cmd, |
| 890 | "debug ospf6 neighbor", |
| 891 | DEBUG_STR |
| 892 | OSPF6_STR |
| 893 | "Debug OSPFv3 Neighbor\n" |
| 894 | ) |
| 895 | { |
| 896 | unsigned char level = 0; |
| 897 | if (argc) |
| 898 | { |
| 899 | if (! strncmp (argv[0], "s", 1)) |
| 900 | level = OSPF6_DEBUG_NEIGHBOR_STATE; |
| 901 | if (! strncmp (argv[0], "e", 1)) |
| 902 | level = OSPF6_DEBUG_NEIGHBOR_EVENT; |
| 903 | } |
| 904 | else |
| 905 | level = OSPF6_DEBUG_NEIGHBOR_STATE | OSPF6_DEBUG_NEIGHBOR_EVENT; |
| 906 | |
| 907 | OSPF6_DEBUG_NEIGHBOR_ON (level); |
| 908 | return CMD_SUCCESS; |
| 909 | } |
| 910 | |
| 911 | ALIAS (debug_ospf6_neighbor, |
| 912 | debug_ospf6_neighbor_detail_cmd, |
| 913 | "debug ospf6 neighbor (state|event)", |
| 914 | DEBUG_STR |
| 915 | OSPF6_STR |
| 916 | "Debug OSPFv3 Neighbor\n" |
| 917 | "Debug OSPFv3 Neighbor State Change\n" |
| 918 | "Debug OSPFv3 Neighbor Event\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 919 | ) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 920 | |
| 921 | DEFUN (no_debug_ospf6_neighbor, |
| 922 | no_debug_ospf6_neighbor_cmd, |
| 923 | "no debug ospf6 neighbor", |
| 924 | NO_STR |
| 925 | DEBUG_STR |
| 926 | OSPF6_STR |
| 927 | "Debug OSPFv3 Neighbor\n" |
| 928 | ) |
| 929 | { |
| 930 | unsigned char level = 0; |
| 931 | if (argc) |
| 932 | { |
| 933 | if (! strncmp (argv[0], "s", 1)) |
| 934 | level = OSPF6_DEBUG_NEIGHBOR_STATE; |
| 935 | if (! strncmp (argv[0], "e", 1)) |
| 936 | level = OSPF6_DEBUG_NEIGHBOR_EVENT; |
| 937 | } |
| 938 | else |
| 939 | level = OSPF6_DEBUG_NEIGHBOR_STATE | OSPF6_DEBUG_NEIGHBOR_EVENT; |
| 940 | |
| 941 | OSPF6_DEBUG_NEIGHBOR_OFF (level); |
| 942 | return CMD_SUCCESS; |
| 943 | } |
| 944 | |
| 945 | ALIAS (no_debug_ospf6_neighbor, |
| 946 | no_debug_ospf6_neighbor_detail_cmd, |
| 947 | "no debug ospf6 neighbor (state|event)", |
| 948 | NO_STR |
| 949 | DEBUG_STR |
| 950 | OSPF6_STR |
| 951 | "Debug OSPFv3 Neighbor\n" |
| 952 | "Debug OSPFv3 Neighbor State Change\n" |
| 953 | "Debug OSPFv3 Neighbor Event\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 954 | ) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 955 | |
| 956 | int |
| 957 | config_write_ospf6_debug_neighbor (struct vty *vty) |
| 958 | { |
| 959 | if (IS_OSPF6_DEBUG_NEIGHBOR (STATE) && |
| 960 | IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 961 | vty_out (vty, "debug ospf6 neighbor%s", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 962 | else if (IS_OSPF6_DEBUG_NEIGHBOR (STATE)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 963 | vty_out (vty, "debug ospf6 neighbor state%s", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 964 | else if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 965 | vty_out (vty, "debug ospf6 neighbor event%s", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 966 | return 0; |
| 967 | } |
| 968 | |
| 969 | void |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 970 | install_element_ospf6_debug_neighbor (void) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 971 | { |
| 972 | install_element (ENABLE_NODE, &debug_ospf6_neighbor_cmd); |
| 973 | install_element (ENABLE_NODE, &debug_ospf6_neighbor_detail_cmd); |
| 974 | install_element (ENABLE_NODE, &no_debug_ospf6_neighbor_cmd); |
| 975 | install_element (ENABLE_NODE, &no_debug_ospf6_neighbor_detail_cmd); |
| 976 | install_element (CONFIG_NODE, &debug_ospf6_neighbor_cmd); |
| 977 | install_element (CONFIG_NODE, &debug_ospf6_neighbor_detail_cmd); |
| 978 | install_element (CONFIG_NODE, &no_debug_ospf6_neighbor_cmd); |
| 979 | install_element (CONFIG_NODE, &no_debug_ospf6_neighbor_detail_cmd); |
| 980 | } |
| 981 | |
| 982 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 983 | |