blob: b0db345a651c3af9c6bea7d5d2783a803832903d [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/*
hasso508e53e2004-05-18 18:57:06 +00002 * Copyright (C) 2003 Yasuhiro Ohara
paul718e3742002-12-13 20:15:29 +00003 *
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
paul718e3742002-12-13 20:15:29 +000022#include <zebra.h>
23
24#include "log.h"
hasso508e53e2004-05-18 18:57:06 +000025#include "memory.h"
paul718e3742002-12-13 20:15:29 +000026#include "thread.h"
27#include "linklist.h"
28#include "vty.h"
29#include "command.h"
30
hasso508e53e2004-05-18 18:57:06 +000031#include "ospf6_proto.h"
paul718e3742002-12-13 20:15:29 +000032#include "ospf6_lsa.h"
33#include "ospf6_lsdb.h"
hasso508e53e2004-05-18 18:57:06 +000034#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"
hasso3b4cd3a2004-05-18 19:28:32 +000040#include "ospf6_flood.h"
hasso049207c2004-08-04 20:02:13 +000041#include "ospf6d.h"
paul718e3742002-12-13 20:15:29 +000042
hasso508e53e2004-05-18 18:57:06 +000043unsigned char conf_debug_ospf6_neighbor = 0;
44
paul0c083ee2004-10-10 12:54:58 +000045const char *ospf6_neighbor_state_str[] =
hasso508e53e2004-05-18 18:57:06 +000046{ "None", "Down", "Attempt", "Init", "Twoway", "ExStart", "ExChange",
47 "Loading", "Full", NULL };
paul718e3742002-12-13 20:15:29 +000048
49int
hasso508e53e2004-05-18 18:57:06 +000050ospf6_neighbor_cmp (void *va, void *vb)
paul718e3742002-12-13 20:15:29 +000051{
hasso508e53e2004-05-18 18:57:06 +000052 struct ospf6_neighbor *ona = (struct ospf6_neighbor *) va;
53 struct ospf6_neighbor *onb = (struct ospf6_neighbor *) vb;
hasso6452df02004-08-15 05:52:07 +000054 return (ntohl (ona->router_id) < ntohl (onb->router_id) ? -1 : 1);
paul718e3742002-12-13 20:15:29 +000055}
56
hasso508e53e2004-05-18 18:57:06 +000057struct ospf6_neighbor *
58ospf6_neighbor_lookup (u_int32_t router_id,
59 struct ospf6_interface *oi)
paul718e3742002-12-13 20:15:29 +000060{
hasso52dc7ee2004-09-23 19:18:23 +000061 struct listnode *n;
hasso508e53e2004-05-18 18:57:06 +000062 struct ospf6_neighbor *on;
paul718e3742002-12-13 20:15:29 +000063
paul1eb8ef22005-04-07 07:30:20 +000064 for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, n, on))
65 if (on->router_id == router_id)
66 return on;
67
hasso508e53e2004-05-18 18:57:06 +000068 return (struct ospf6_neighbor *) NULL;
paul718e3742002-12-13 20:15:29 +000069}
70
71/* create ospf6_neighbor */
72struct ospf6_neighbor *
hasso508e53e2004-05-18 18:57:06 +000073ospf6_neighbor_create (u_int32_t router_id, struct ospf6_interface *oi)
paul718e3742002-12-13 20:15:29 +000074{
hasso508e53e2004-05-18 18:57:06 +000075 struct ospf6_neighbor *on;
76 char buf[16];
paul718e3742002-12-13 20:15:29 +000077
hasso508e53e2004-05-18 18:57:06 +000078 on = (struct ospf6_neighbor *)
paul718e3742002-12-13 20:15:29 +000079 XMALLOC (MTYPE_OSPF6_NEIGHBOR, sizeof (struct ospf6_neighbor));
hasso508e53e2004-05-18 18:57:06 +000080 if (on == NULL)
paul718e3742002-12-13 20:15:29 +000081 {
82 zlog_warn ("neighbor: malloc failed");
83 return NULL;
84 }
85
hasso508e53e2004-05-18 18:57:06 +000086 memset (on, 0, sizeof (struct ospf6_neighbor));
paul718e3742002-12-13 20:15:29 +000087 inet_ntop (AF_INET, &router_id, buf, sizeof (buf));
hasso508e53e2004-05-18 18:57:06 +000088 snprintf (on->name, sizeof (on->name), "%s%%%s",
89 buf, oi->interface->name);
90 on->ospf6_if = oi;
91 on->state = OSPF6_NEIGHBOR_DOWN;
92 gettimeofday (&on->last_changed, (struct timezone *) NULL);
93 on->router_id = router_id;
paul718e3742002-12-13 20:15:29 +000094
hasso6452df02004-08-15 05:52:07 +000095 on->summary_list = ospf6_lsdb_create (on);
96 on->request_list = ospf6_lsdb_create (on);
97 on->retrans_list = ospf6_lsdb_create (on);
paul718e3742002-12-13 20:15:29 +000098
hasso6452df02004-08-15 05:52:07 +000099 on->dbdesc_list = ospf6_lsdb_create (on);
100 on->lsreq_list = ospf6_lsdb_create (on);
101 on->lsupdate_list = ospf6_lsdb_create (on);
102 on->lsack_list = ospf6_lsdb_create (on);
paul718e3742002-12-13 20:15:29 +0000103
hasso508e53e2004-05-18 18:57:06 +0000104 listnode_add_sort (oi->neighbor_list, on);
105 return on;
paul718e3742002-12-13 20:15:29 +0000106}
107
108void
hasso508e53e2004-05-18 18:57:06 +0000109ospf6_neighbor_delete (struct ospf6_neighbor *on)
paul718e3742002-12-13 20:15:29 +0000110{
hasso3b4cd3a2004-05-18 19:28:32 +0000111 struct ospf6_lsa *lsa;
112
hasso508e53e2004-05-18 18:57:06 +0000113 ospf6_lsdb_remove_all (on->summary_list);
114 ospf6_lsdb_remove_all (on->request_list);
hasso3b4cd3a2004-05-18 19:28:32 +0000115 for (lsa = ospf6_lsdb_head (on->retrans_list); lsa;
116 lsa = ospf6_lsdb_next (lsa))
117 {
hasso6452df02004-08-15 05:52:07 +0000118 ospf6_decrement_retrans_count (lsa);
hasso3b4cd3a2004-05-18 19:28:32 +0000119 ospf6_lsdb_remove (lsa, on->retrans_list);
120 }
paul718e3742002-12-13 20:15:29 +0000121
hasso508e53e2004-05-18 18:57:06 +0000122 ospf6_lsdb_remove_all (on->dbdesc_list);
123 ospf6_lsdb_remove_all (on->lsreq_list);
124 ospf6_lsdb_remove_all (on->lsupdate_list);
125 ospf6_lsdb_remove_all (on->lsack_list);
paul718e3742002-12-13 20:15:29 +0000126
hasso508e53e2004-05-18 18:57:06 +0000127 ospf6_lsdb_delete (on->summary_list);
128 ospf6_lsdb_delete (on->request_list);
129 ospf6_lsdb_delete (on->retrans_list);
paul718e3742002-12-13 20:15:29 +0000130
hasso508e53e2004-05-18 18:57:06 +0000131 ospf6_lsdb_delete (on->dbdesc_list);
132 ospf6_lsdb_delete (on->lsreq_list);
133 ospf6_lsdb_delete (on->lsupdate_list);
134 ospf6_lsdb_delete (on->lsack_list);
paul718e3742002-12-13 20:15:29 +0000135
hasso508e53e2004-05-18 18:57:06 +0000136 THREAD_OFF (on->inactivity_timer);
137
138 THREAD_OFF (on->thread_send_dbdesc);
139 THREAD_OFF (on->thread_send_lsreq);
140 THREAD_OFF (on->thread_send_lsupdate);
141 THREAD_OFF (on->thread_send_lsack);
142
143 XFREE (MTYPE_OSPF6_NEIGHBOR, on);
paul718e3742002-12-13 20:15:29 +0000144}
145
hasso508e53e2004-05-18 18:57:06 +0000146static void
147ospf6_neighbor_state_change (u_char next_state, struct ospf6_neighbor *on)
paul718e3742002-12-13 20:15:29 +0000148{
hasso508e53e2004-05-18 18:57:06 +0000149 u_char prev_state;
paul718e3742002-12-13 20:15:29 +0000150
hasso508e53e2004-05-18 18:57:06 +0000151 prev_state = on->state;
152 on->state = next_state;
153
154 if (prev_state == next_state)
155 return;
156
157 gettimeofday (&on->last_changed, (struct timezone *) NULL);
158
159 /* log */
160 if (IS_OSPF6_DEBUG_NEIGHBOR (STATE))
paul718e3742002-12-13 20:15:29 +0000161 {
hassoc6487d62004-12-24 06:00:11 +0000162 zlog_debug ("Neighbor state change %s: [%s]->[%s]", on->name,
163 ospf6_neighbor_state_str[prev_state],
164 ospf6_neighbor_state_str[next_state]);
paul718e3742002-12-13 20:15:29 +0000165 }
hasso508e53e2004-05-18 18:57:06 +0000166
167 if (prev_state == OSPF6_NEIGHBOR_FULL || next_state == OSPF6_NEIGHBOR_FULL)
168 {
169 OSPF6_ROUTER_LSA_SCHEDULE (on->ospf6_if->area);
170 if (on->ospf6_if->state == OSPF6_INTERFACE_DR)
171 {
172 OSPF6_NETWORK_LSA_SCHEDULE (on->ospf6_if);
173 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (on->ospf6_if);
hasso508e53e2004-05-18 18:57:06 +0000174 }
hasso4846ef62004-09-03 06:04:00 +0000175 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (on->ospf6_if->area);
hasso508e53e2004-05-18 18:57:06 +0000176 }
177
hasso508e53e2004-05-18 18:57:06 +0000178 if ((prev_state == OSPF6_NEIGHBOR_EXCHANGE ||
179 prev_state == OSPF6_NEIGHBOR_LOADING) &&
180 (next_state != OSPF6_NEIGHBOR_EXCHANGE &&
181 next_state != OSPF6_NEIGHBOR_LOADING))
Paul Jakma932bf192006-05-15 10:42:24 +0000182 ospf6_maxage_remove (on->ospf6_if->area->ospf6);
paul718e3742002-12-13 20:15:29 +0000183}
184
hasso508e53e2004-05-18 18:57:06 +0000185/* RFC2328 section 10.4 */
186int
187need_adjacency (struct ospf6_neighbor *on)
188{
189 if (on->ospf6_if->state == OSPF6_INTERFACE_POINTTOPOINT ||
190 on->ospf6_if->state == OSPF6_INTERFACE_DR ||
191 on->ospf6_if->state == OSPF6_INTERFACE_BDR)
192 return 1;
193
194 if (on->ospf6_if->drouter == on->router_id ||
195 on->ospf6_if->bdrouter == on->router_id)
196 return 1;
197
198 return 0;
199}
200
201int
202hello_received (struct thread *thread)
203{
204 struct ospf6_neighbor *on;
205
206 on = (struct ospf6_neighbor *) THREAD_ARG (thread);
207 assert (on);
208
209 if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
hassoc6487d62004-12-24 06:00:11 +0000210 zlog_debug ("Neighbor Event %s: *HelloReceived*", on->name);
hasso508e53e2004-05-18 18:57:06 +0000211
212 /* reset Inactivity Timer */
213 THREAD_OFF (on->inactivity_timer);
214 on->inactivity_timer = thread_add_timer (master, inactivity_timer, on,
215 on->ospf6_if->dead_interval);
216
217 if (on->state <= OSPF6_NEIGHBOR_DOWN)
218 ospf6_neighbor_state_change (OSPF6_NEIGHBOR_INIT, on);
219
220 return 0;
221}
222
223int
224twoway_received (struct thread *thread)
225{
226 struct ospf6_neighbor *on;
227
228 on = (struct ospf6_neighbor *) THREAD_ARG (thread);
229 assert (on);
230
231 if (on->state > OSPF6_NEIGHBOR_INIT)
232 return 0;
233
234 if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
hassoc6487d62004-12-24 06:00:11 +0000235 zlog_debug ("Neighbor Event %s: *2Way-Received*", on->name);
hasso508e53e2004-05-18 18:57:06 +0000236
237 thread_add_event (master, neighbor_change, on->ospf6_if, 0);
238
239 if (! need_adjacency (on))
240 {
241 ospf6_neighbor_state_change (OSPF6_NEIGHBOR_TWOWAY, on);
242 return 0;
243 }
244
245 ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on);
246 SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT);
247 SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT);
248 SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT);
249
250 THREAD_OFF (on->thread_send_dbdesc);
251 on->thread_send_dbdesc =
252 thread_add_event (master, ospf6_dbdesc_send, on, 0);
253
254 return 0;
255}
256
257int
258negotiation_done (struct thread *thread)
259{
260 struct ospf6_neighbor *on;
261 struct ospf6_lsa *lsa;
262
263 on = (struct ospf6_neighbor *) THREAD_ARG (thread);
264 assert (on);
265
266 if (on->state != OSPF6_NEIGHBOR_EXSTART)
267 return 0;
268
269 if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
hassoc6487d62004-12-24 06:00:11 +0000270 zlog_debug ("Neighbor Event %s: *NegotiationDone*", on->name);
hasso508e53e2004-05-18 18:57:06 +0000271
272 /* clear ls-list */
273 ospf6_lsdb_remove_all (on->summary_list);
274 ospf6_lsdb_remove_all (on->request_list);
hasso3b4cd3a2004-05-18 19:28:32 +0000275 for (lsa = ospf6_lsdb_head (on->retrans_list); lsa;
276 lsa = ospf6_lsdb_next (lsa))
277 {
hasso6452df02004-08-15 05:52:07 +0000278 ospf6_decrement_retrans_count (lsa);
hasso3b4cd3a2004-05-18 19:28:32 +0000279 ospf6_lsdb_remove (lsa, on->retrans_list);
280 }
hasso508e53e2004-05-18 18:57:06 +0000281
282 /* Interface scoped LSAs */
283 for (lsa = ospf6_lsdb_head (on->ospf6_if->lsdb); lsa;
284 lsa = ospf6_lsdb_next (lsa))
285 {
hasso508e53e2004-05-18 18:57:06 +0000286 if (OSPF6_LSA_IS_MAXAGE (lsa))
hasso3b4cd3a2004-05-18 19:28:32 +0000287 {
hasso6452df02004-08-15 05:52:07 +0000288 ospf6_increment_retrans_count (lsa);
hasso3b4cd3a2004-05-18 19:28:32 +0000289 ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->retrans_list);
290 }
hasso508e53e2004-05-18 18:57:06 +0000291 else
292 ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->summary_list);
293 }
294
295 /* Area scoped LSAs */
296 for (lsa = ospf6_lsdb_head (on->ospf6_if->area->lsdb); lsa;
297 lsa = ospf6_lsdb_next (lsa))
298 {
hasso508e53e2004-05-18 18:57:06 +0000299 if (OSPF6_LSA_IS_MAXAGE (lsa))
hasso3b4cd3a2004-05-18 19:28:32 +0000300 {
hasso6452df02004-08-15 05:52:07 +0000301 ospf6_increment_retrans_count (lsa);
hasso3b4cd3a2004-05-18 19:28:32 +0000302 ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->retrans_list);
303 }
hasso508e53e2004-05-18 18:57:06 +0000304 else
305 ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->summary_list);
306 }
307
308 /* AS scoped LSAs */
309 for (lsa = ospf6_lsdb_head (on->ospf6_if->area->ospf6->lsdb); lsa;
310 lsa = ospf6_lsdb_next (lsa))
311 {
hasso508e53e2004-05-18 18:57:06 +0000312 if (OSPF6_LSA_IS_MAXAGE (lsa))
hasso3b4cd3a2004-05-18 19:28:32 +0000313 {
hasso6452df02004-08-15 05:52:07 +0000314 ospf6_increment_retrans_count (lsa);
hasso3b4cd3a2004-05-18 19:28:32 +0000315 ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->retrans_list);
316 }
hasso508e53e2004-05-18 18:57:06 +0000317 else
318 ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->summary_list);
319 }
320
321 UNSET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT);
322 ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXCHANGE, on);
323
324 return 0;
325}
326
327int
328exchange_done (struct thread *thread)
329{
330 struct ospf6_neighbor *on;
331
332 on = (struct ospf6_neighbor *) THREAD_ARG (thread);
333 assert (on);
334
335 if (on->state != OSPF6_NEIGHBOR_EXCHANGE)
336 return 0;
337
338 if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
hassoc6487d62004-12-24 06:00:11 +0000339 zlog_debug ("Neighbor Event %s: *ExchangeDone*", on->name);
hasso508e53e2004-05-18 18:57:06 +0000340
341 THREAD_OFF (on->thread_send_dbdesc);
342 ospf6_lsdb_remove_all (on->dbdesc_list);
343
344/* XXX
345 thread_add_timer (master, ospf6_neighbor_last_dbdesc_release, on,
346 on->ospf6_if->dead_interval);
347*/
348
349 if (on->request_list->count == 0)
350 ospf6_neighbor_state_change (OSPF6_NEIGHBOR_FULL, on);
351 else
352 ospf6_neighbor_state_change (OSPF6_NEIGHBOR_LOADING, on);
353
354 return 0;
355}
356
357int
358loading_done (struct thread *thread)
359{
360 struct ospf6_neighbor *on;
361
362 on = (struct ospf6_neighbor *) THREAD_ARG (thread);
363 assert (on);
364
365 if (on->state != OSPF6_NEIGHBOR_LOADING)
366 return 0;
367
368 if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
hassoc6487d62004-12-24 06:00:11 +0000369 zlog_debug ("Neighbor Event %s: *LoadingDone*", on->name);
hasso508e53e2004-05-18 18:57:06 +0000370
371 assert (on->request_list->count == 0);
372
373 ospf6_neighbor_state_change (OSPF6_NEIGHBOR_FULL, on);
374
375 return 0;
376}
377
378int
379adj_ok (struct thread *thread)
380{
381 struct ospf6_neighbor *on;
hasso3b4cd3a2004-05-18 19:28:32 +0000382 struct ospf6_lsa *lsa;
hasso508e53e2004-05-18 18:57:06 +0000383
384 on = (struct ospf6_neighbor *) THREAD_ARG (thread);
385 assert (on);
386
387 if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
hassoc6487d62004-12-24 06:00:11 +0000388 zlog_debug ("Neighbor Event %s: *AdjOK?*", on->name);
hasso508e53e2004-05-18 18:57:06 +0000389
390 if (on->state == OSPF6_NEIGHBOR_TWOWAY && need_adjacency (on))
391 {
392 ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on);
393 SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT);
394 SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT);
395 SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT);
396
397 THREAD_OFF (on->thread_send_dbdesc);
398 on->thread_send_dbdesc =
399 thread_add_event (master, ospf6_dbdesc_send, on, 0);
400
401 }
402 else if (on->state >= OSPF6_NEIGHBOR_EXSTART &&
403 ! need_adjacency (on))
404 {
405 ospf6_neighbor_state_change (OSPF6_NEIGHBOR_TWOWAY, on);
406 ospf6_lsdb_remove_all (on->summary_list);
407 ospf6_lsdb_remove_all (on->request_list);
hasso3b4cd3a2004-05-18 19:28:32 +0000408 for (lsa = ospf6_lsdb_head (on->retrans_list); lsa;
409 lsa = ospf6_lsdb_next (lsa))
410 {
hasso6452df02004-08-15 05:52:07 +0000411 ospf6_decrement_retrans_count (lsa);
hasso3b4cd3a2004-05-18 19:28:32 +0000412 ospf6_lsdb_remove (lsa, on->retrans_list);
413 }
hasso508e53e2004-05-18 18:57:06 +0000414 }
415
416 return 0;
417}
418
419int
420seqnumber_mismatch (struct thread *thread)
421{
422 struct ospf6_neighbor *on;
hasso3b4cd3a2004-05-18 19:28:32 +0000423 struct ospf6_lsa *lsa;
hasso508e53e2004-05-18 18:57:06 +0000424
425 on = (struct ospf6_neighbor *) THREAD_ARG (thread);
426 assert (on);
427
428 if (on->state < OSPF6_NEIGHBOR_EXCHANGE)
429 return 0;
430
431 if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
hassoc6487d62004-12-24 06:00:11 +0000432 zlog_debug ("Neighbor Event %s: *SeqNumberMismatch*", on->name);
hasso508e53e2004-05-18 18:57:06 +0000433
434 ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on);
435 SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT);
436 SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT);
437 SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT);
438
439 ospf6_lsdb_remove_all (on->summary_list);
440 ospf6_lsdb_remove_all (on->request_list);
hasso3b4cd3a2004-05-18 19:28:32 +0000441 for (lsa = ospf6_lsdb_head (on->retrans_list); lsa;
442 lsa = ospf6_lsdb_next (lsa))
443 {
hasso6452df02004-08-15 05:52:07 +0000444 ospf6_decrement_retrans_count (lsa);
hasso3b4cd3a2004-05-18 19:28:32 +0000445 ospf6_lsdb_remove (lsa, on->retrans_list);
446 }
hasso508e53e2004-05-18 18:57:06 +0000447
448 THREAD_OFF (on->thread_send_dbdesc);
449 on->thread_send_dbdesc =
450 thread_add_event (master, ospf6_dbdesc_send, on, 0);
451
452 return 0;
453}
454
455int
456bad_lsreq (struct thread *thread)
457{
458 struct ospf6_neighbor *on;
hasso3b4cd3a2004-05-18 19:28:32 +0000459 struct ospf6_lsa *lsa;
hasso508e53e2004-05-18 18:57:06 +0000460
461 on = (struct ospf6_neighbor *) THREAD_ARG (thread);
462 assert (on);
463
464 if (on->state < OSPF6_NEIGHBOR_EXCHANGE)
465 return 0;
466
467 if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
hassoc6487d62004-12-24 06:00:11 +0000468 zlog_debug ("Neighbor Event %s: *BadLSReq*", on->name);
hasso508e53e2004-05-18 18:57:06 +0000469
470 ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on);
471 SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT);
472 SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT);
473 SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT);
474
475 ospf6_lsdb_remove_all (on->summary_list);
476 ospf6_lsdb_remove_all (on->request_list);
hasso3b4cd3a2004-05-18 19:28:32 +0000477 for (lsa = ospf6_lsdb_head (on->retrans_list); lsa;
478 lsa = ospf6_lsdb_next (lsa))
479 {
hasso6452df02004-08-15 05:52:07 +0000480 ospf6_decrement_retrans_count (lsa);
hasso3b4cd3a2004-05-18 19:28:32 +0000481 ospf6_lsdb_remove (lsa, on->retrans_list);
482 }
hasso508e53e2004-05-18 18:57:06 +0000483
484 THREAD_OFF (on->thread_send_dbdesc);
485 on->thread_send_dbdesc =
486 thread_add_event (master, ospf6_dbdesc_send, on, 0);
487
488 return 0;
489}
490
491int
492oneway_received (struct thread *thread)
493{
494 struct ospf6_neighbor *on;
hasso3b4cd3a2004-05-18 19:28:32 +0000495 struct ospf6_lsa *lsa;
hasso508e53e2004-05-18 18:57:06 +0000496
497 on = (struct ospf6_neighbor *) THREAD_ARG (thread);
498 assert (on);
499
500 if (on->state < OSPF6_NEIGHBOR_TWOWAY)
501 return 0;
502
503 if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
hassoc6487d62004-12-24 06:00:11 +0000504 zlog_debug ("Neighbor Event %s: *1Way-Received*", on->name);
hasso508e53e2004-05-18 18:57:06 +0000505
506 ospf6_neighbor_state_change (OSPF6_NEIGHBOR_INIT, on);
507 thread_add_event (master, neighbor_change, on->ospf6_if, 0);
508
509 ospf6_lsdb_remove_all (on->summary_list);
510 ospf6_lsdb_remove_all (on->request_list);
hasso3b4cd3a2004-05-18 19:28:32 +0000511 for (lsa = ospf6_lsdb_head (on->retrans_list); lsa;
512 lsa = ospf6_lsdb_next (lsa))
513 {
hasso6452df02004-08-15 05:52:07 +0000514 ospf6_decrement_retrans_count (lsa);
hasso3b4cd3a2004-05-18 19:28:32 +0000515 ospf6_lsdb_remove (lsa, on->retrans_list);
516 }
hasso508e53e2004-05-18 18:57:06 +0000517
518 THREAD_OFF (on->thread_send_dbdesc);
519 THREAD_OFF (on->thread_send_lsreq);
520 THREAD_OFF (on->thread_send_lsupdate);
521 THREAD_OFF (on->thread_send_lsack);
522
523 return 0;
524}
525
526int
527inactivity_timer (struct thread *thread)
528{
529 struct ospf6_neighbor *on;
530
531 on = (struct ospf6_neighbor *) THREAD_ARG (thread);
532 assert (on);
533
534 if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
hassoc6487d62004-12-24 06:00:11 +0000535 zlog_debug ("Neighbor Event %s: *InactivityTimer*", on->name);
hasso508e53e2004-05-18 18:57:06 +0000536
537 on->inactivity_timer = NULL;
538 on->drouter = on->prev_drouter = 0;
539 on->bdrouter = on->prev_bdrouter = 0;
540
541 ospf6_neighbor_state_change (OSPF6_NEIGHBOR_DOWN, on);
542 thread_add_event (master, neighbor_change, on->ospf6_if, 0);
543
544 listnode_delete (on->ospf6_if->neighbor_list, on);
545 ospf6_neighbor_delete (on);
546
547 return 0;
548}
549
550
paul718e3742002-12-13 20:15:29 +0000551
552/* vty functions */
553/* show neighbor structure */
554void
hasso508e53e2004-05-18 18:57:06 +0000555ospf6_neighbor_show (struct vty *vty, struct ospf6_neighbor *on)
paul718e3742002-12-13 20:15:29 +0000556{
557 char router_id[16];
hasso508e53e2004-05-18 18:57:06 +0000558 char duration[16];
559 struct timeval now, res;
560 char nstate[16];
561 char deadtime[16];
562 long h, m, s;
563
564 /* Router-ID (Name) */
565 inet_ntop (AF_INET, &on->router_id, router_id, sizeof (router_id));
566#ifdef HAVE_GETNAMEINFO
567 {
568 }
569#endif /*HAVE_GETNAMEINFO*/
570
571 gettimeofday (&now, NULL);
572
573 /* Dead time */
574 h = m = s = 0;
575 if (on->inactivity_timer)
576 {
577 s = on->inactivity_timer->u.sands.tv_sec - now.tv_sec;
578 h = s / 3600;
579 s -= h * 3600;
580 m = s / 60;
581 s -= m * 60;
582 }
583 snprintf (deadtime, sizeof (deadtime), "%02ld:%02ld:%02ld", h, m, s);
584
585 /* Neighbor State */
586 if (if_is_pointopoint (on->ospf6_if->interface))
587 snprintf (nstate, sizeof (nstate), "PointToPoint");
588 else
589 {
590 if (on->router_id == on->drouter)
591 snprintf (nstate, sizeof (nstate), "DR");
592 else if (on->router_id == on->bdrouter)
593 snprintf (nstate, sizeof (nstate), "BDR");
594 else
595 snprintf (nstate, sizeof (nstate), "DROther");
596 }
597
598 /* Duration */
599 timersub (&now, &on->last_changed, &res);
600 timerstring (&res, duration, sizeof (duration));
601
602 /*
603 vty_out (vty, "%-15s %3d %11s %6s/%-12s %11s %s[%s]%s",
604 "Neighbor ID", "Pri", "DeadTime", "State", "", "Duration",
hasso049207c2004-08-04 20:02:13 +0000605 "I/F", "State", VNL);
hasso508e53e2004-05-18 18:57:06 +0000606 */
607
608 vty_out (vty, "%-15s %3d %11s %6s/%-12s %11s %s[%s]%s",
609 router_id, on->priority, deadtime,
610 ospf6_neighbor_state_str[on->state], nstate, duration,
611 on->ospf6_if->interface->name,
hasso049207c2004-08-04 20:02:13 +0000612 ospf6_interface_state_str[on->ospf6_if->state], VNL);
hasso508e53e2004-05-18 18:57:06 +0000613}
614
615void
616ospf6_neighbor_show_drchoice (struct vty *vty, struct ospf6_neighbor *on)
617{
618 char router_id[16];
619 char drouter[16], bdrouter[16];
paul718e3742002-12-13 20:15:29 +0000620 char duration[16];
621 struct timeval now, res;
622
623/*
624 vty_out (vty, "%-15s %6s/%-11s %-15s %-15s %s[%s]%s",
625 "RouterID", "State", "Duration", "DR", "BDR", "I/F",
hasso049207c2004-08-04 20:02:13 +0000626 "State", VNL);
paul718e3742002-12-13 20:15:29 +0000627*/
628
hasso508e53e2004-05-18 18:57:06 +0000629 inet_ntop (AF_INET, &on->router_id, router_id, sizeof (router_id));
630 inet_ntop (AF_INET, &on->drouter, drouter, sizeof (drouter));
631 inet_ntop (AF_INET, &on->bdrouter, bdrouter, sizeof (bdrouter));
paul718e3742002-12-13 20:15:29 +0000632
633 gettimeofday (&now, NULL);
hasso508e53e2004-05-18 18:57:06 +0000634 timersub (&now, &on->last_changed, &res);
635 timerstring (&res, duration, sizeof (duration));
paul718e3742002-12-13 20:15:29 +0000636
637 vty_out (vty, "%-15s %6s/%-11s %-15s %-15s %s[%s]%s",
hasso508e53e2004-05-18 18:57:06 +0000638 router_id, ospf6_neighbor_state_str[on->state],
639 duration, drouter, bdrouter, on->ospf6_if->interface->name,
640 ospf6_interface_state_str[on->ospf6_if->state],
hasso049207c2004-08-04 20:02:13 +0000641 VNL);
paul718e3742002-12-13 20:15:29 +0000642}
643
644void
hasso508e53e2004-05-18 18:57:06 +0000645ospf6_neighbor_show_detail (struct vty *vty, struct ospf6_neighbor *on)
paul718e3742002-12-13 20:15:29 +0000646{
hasso508e53e2004-05-18 18:57:06 +0000647 char drouter[16], bdrouter[16];
648 char linklocal_addr[64], duration[32];
paul718e3742002-12-13 20:15:29 +0000649 struct timeval now, res;
hasso508e53e2004-05-18 18:57:06 +0000650 struct ospf6_lsa *lsa;
paul718e3742002-12-13 20:15:29 +0000651
hasso508e53e2004-05-18 18:57:06 +0000652 inet_ntop (AF_INET6, &on->linklocal_addr, linklocal_addr,
653 sizeof (linklocal_addr));
654 inet_ntop (AF_INET, &on->drouter, drouter, sizeof (drouter));
655 inet_ntop (AF_INET, &on->bdrouter, bdrouter, sizeof (bdrouter));
paul718e3742002-12-13 20:15:29 +0000656
657 gettimeofday (&now, NULL);
hasso508e53e2004-05-18 18:57:06 +0000658 timersub (&now, &on->last_changed, &res);
659 timerstring (&res, duration, sizeof (duration));
paul718e3742002-12-13 20:15:29 +0000660
hasso508e53e2004-05-18 18:57:06 +0000661 vty_out (vty, " Neighbor %s%s", on->name,
hasso049207c2004-08-04 20:02:13 +0000662 VNL);
hasso508e53e2004-05-18 18:57:06 +0000663 vty_out (vty, " Area %s via interface %s (ifindex %d)%s",
664 on->ospf6_if->area->name,
665 on->ospf6_if->interface->name,
666 on->ospf6_if->interface->ifindex,
hasso049207c2004-08-04 20:02:13 +0000667 VNL);
hasso508e53e2004-05-18 18:57:06 +0000668 vty_out (vty, " His IfIndex: %d Link-local address: %s%s",
669 on->ifindex, linklocal_addr,
hasso049207c2004-08-04 20:02:13 +0000670 VNL);
hasso508e53e2004-05-18 18:57:06 +0000671 vty_out (vty, " State %s for a duration of %s%s",
672 ospf6_neighbor_state_str[on->state], duration,
hasso049207c2004-08-04 20:02:13 +0000673 VNL);
hasso508e53e2004-05-18 18:57:06 +0000674 vty_out (vty, " His choice of DR/BDR %s/%s, Priority %d%s",
675 drouter, bdrouter, on->priority,
hasso049207c2004-08-04 20:02:13 +0000676 VNL);
hasso508e53e2004-05-18 18:57:06 +0000677 vty_out (vty, " DbDesc status: %s%s%s SeqNum: %#lx%s",
678 (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT) ? "Initial " : ""),
679 (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT) ? "More " : ""),
680 (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT) ?
681 "Master" : "Slave"), (u_long) ntohl (on->dbdesc_seqnum),
hasso049207c2004-08-04 20:02:13 +0000682 VNL);
paul718e3742002-12-13 20:15:29 +0000683
hasso508e53e2004-05-18 18:57:06 +0000684 vty_out (vty, " Summary-List: %d LSAs%s", on->summary_list->count,
hasso049207c2004-08-04 20:02:13 +0000685 VNL);
hasso508e53e2004-05-18 18:57:06 +0000686 for (lsa = ospf6_lsdb_head (on->summary_list); lsa;
687 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000688 vty_out (vty, " %s%s", lsa->name, VNL);
paul718e3742002-12-13 20:15:29 +0000689
hasso508e53e2004-05-18 18:57:06 +0000690 vty_out (vty, " Request-List: %d LSAs%s", on->request_list->count,
hasso049207c2004-08-04 20:02:13 +0000691 VNL);
hasso508e53e2004-05-18 18:57:06 +0000692 for (lsa = ospf6_lsdb_head (on->request_list); lsa;
693 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000694 vty_out (vty, " %s%s", lsa->name, VNL);
hasso508e53e2004-05-18 18:57:06 +0000695
696 vty_out (vty, " Retrans-List: %d LSAs%s", on->retrans_list->count,
hasso049207c2004-08-04 20:02:13 +0000697 VNL);
hasso508e53e2004-05-18 18:57:06 +0000698 for (lsa = ospf6_lsdb_head (on->retrans_list); lsa;
699 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000700 vty_out (vty, " %s%s", lsa->name, VNL);
hasso508e53e2004-05-18 18:57:06 +0000701
702 timerclear (&res);
703 if (on->thread_send_dbdesc)
704 timersub (&on->thread_send_dbdesc->u.sands, &now, &res);
705 timerstring (&res, duration, sizeof (duration));
706 vty_out (vty, " %d Pending LSAs for DbDesc in Time %s [thread %s]%s",
707 on->dbdesc_list->count, duration,
708 (on->thread_send_dbdesc ? "on" : "off"),
hasso049207c2004-08-04 20:02:13 +0000709 VNL);
hasso508e53e2004-05-18 18:57:06 +0000710 for (lsa = ospf6_lsdb_head (on->dbdesc_list); lsa;
711 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000712 vty_out (vty, " %s%s", lsa->name, VNL);
hasso508e53e2004-05-18 18:57:06 +0000713
714 timerclear (&res);
715 if (on->thread_send_lsreq)
716 timersub (&on->thread_send_lsreq->u.sands, &now, &res);
717 timerstring (&res, duration, sizeof (duration));
718 vty_out (vty, " %d Pending LSAs for LSReq in Time %s [thread %s]%s",
719 on->lsreq_list->count, duration,
720 (on->thread_send_lsreq ? "on" : "off"),
hasso049207c2004-08-04 20:02:13 +0000721 VNL);
hasso508e53e2004-05-18 18:57:06 +0000722 for (lsa = ospf6_lsdb_head (on->lsreq_list); lsa;
723 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000724 vty_out (vty, " %s%s", lsa->name, VNL);
hasso508e53e2004-05-18 18:57:06 +0000725
726 timerclear (&res);
727 if (on->thread_send_lsupdate)
728 timersub (&on->thread_send_lsupdate->u.sands, &now, &res);
729 timerstring (&res, duration, sizeof (duration));
730 vty_out (vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]%s",
731 on->lsupdate_list->count, duration,
732 (on->thread_send_lsupdate ? "on" : "off"),
hasso049207c2004-08-04 20:02:13 +0000733 VNL);
hasso508e53e2004-05-18 18:57:06 +0000734 for (lsa = ospf6_lsdb_head (on->lsupdate_list); lsa;
735 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000736 vty_out (vty, " %s%s", lsa->name, VNL);
hasso508e53e2004-05-18 18:57:06 +0000737
738 timerclear (&res);
739 if (on->thread_send_lsack)
740 timersub (&on->thread_send_lsack->u.sands, &now, &res);
741 timerstring (&res, duration, sizeof (duration));
742 vty_out (vty, " %d Pending LSAs for LSAck in Time %s [thread %s]%s",
743 on->lsack_list->count, duration,
744 (on->thread_send_lsack ? "on" : "off"),
hasso049207c2004-08-04 20:02:13 +0000745 VNL);
hasso508e53e2004-05-18 18:57:06 +0000746 for (lsa = ospf6_lsdb_head (on->lsack_list); lsa;
747 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000748 vty_out (vty, " %s%s", lsa->name, VNL);
hasso508e53e2004-05-18 18:57:06 +0000749
paul718e3742002-12-13 20:15:29 +0000750}
751
hasso508e53e2004-05-18 18:57:06 +0000752DEFUN (show_ipv6_ospf6_neighbor,
paul718e3742002-12-13 20:15:29 +0000753 show_ipv6_ospf6_neighbor_cmd,
754 "show ipv6 ospf6 neighbor",
755 SHOW_STR
756 IP6_STR
757 OSPF6_STR
758 "Neighbor list\n"
hasso508e53e2004-05-18 18:57:06 +0000759 )
paul718e3742002-12-13 20:15:29 +0000760{
hasso508e53e2004-05-18 18:57:06 +0000761 struct ospf6_neighbor *on;
762 struct ospf6_interface *oi;
763 struct ospf6_area *oa;
hasso52dc7ee2004-09-23 19:18:23 +0000764 struct listnode *i, *j, *k;
hasso508e53e2004-05-18 18:57:06 +0000765 void (*showfunc) (struct vty *, struct ospf6_neighbor *);
paul718e3742002-12-13 20:15:29 +0000766
767 OSPF6_CMD_CHECK_RUNNING ();
hasso508e53e2004-05-18 18:57:06 +0000768 showfunc = ospf6_neighbor_show;
769
770 if (argc)
771 {
772 if (! strncmp (argv[0], "de", 2))
773 showfunc = ospf6_neighbor_show_detail;
774 else if (! strncmp (argv[0], "dr", 2))
775 showfunc = ospf6_neighbor_show_drchoice;
776 }
777
778 if (showfunc == ospf6_neighbor_show)
779 vty_out (vty, "%-15s %3s %11s %6s/%-12s %11s %s[%s]%s",
780 "Neighbor ID", "Pri", "DeadTime", "State", "IfState", "Duration",
hasso049207c2004-08-04 20:02:13 +0000781 "I/F", "State", VNL);
hasso508e53e2004-05-18 18:57:06 +0000782 else if (showfunc == ospf6_neighbor_show_drchoice)
783 vty_out (vty, "%-15s %6s/%-11s %-15s %-15s %s[%s]%s",
784 "RouterID", "State", "Duration", "DR", "BDR", "I/F",
hasso049207c2004-08-04 20:02:13 +0000785 "State", VNL);
paul718e3742002-12-13 20:15:29 +0000786
paul1eb8ef22005-04-07 07:30:20 +0000787 for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, i, oa))
788 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
789 for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, k, on))
790 (*showfunc) (vty, on);
791
hasso508e53e2004-05-18 18:57:06 +0000792 return CMD_SUCCESS;
793}
paul718e3742002-12-13 20:15:29 +0000794
hasso508e53e2004-05-18 18:57:06 +0000795ALIAS (show_ipv6_ospf6_neighbor,
796 show_ipv6_ospf6_neighbor_detail_cmd,
797 "show ipv6 ospf6 neighbor (detail|drchoice)",
798 SHOW_STR
799 IP6_STR
800 OSPF6_STR
801 "Neighbor list\n"
802 "Display details\n"
803 "Display DR choices\n"
804 );
805
806DEFUN (show_ipv6_ospf6_neighbor_one,
807 show_ipv6_ospf6_neighbor_one_cmd,
808 "show ipv6 ospf6 neighbor A.B.C.D",
809 SHOW_STR
810 IP6_STR
811 OSPF6_STR
812 "Neighbor list\n"
813 "Specify Router-ID as IPv4 address notation\n"
814 )
815{
816 struct ospf6_neighbor *on;
817 struct ospf6_interface *oi;
818 struct ospf6_area *oa;
hasso52dc7ee2004-09-23 19:18:23 +0000819 struct listnode *i, *j, *k;
hasso508e53e2004-05-18 18:57:06 +0000820 void (*showfunc) (struct vty *, struct ospf6_neighbor *);
821 u_int32_t router_id;
822
823 OSPF6_CMD_CHECK_RUNNING ();
824 showfunc = ospf6_neighbor_show_detail;
825
826 if ((inet_pton (AF_INET, argv[0], &router_id)) != 1)
827 {
828 vty_out (vty, "Router-ID is not parsable: %s%s", argv[0],
hasso049207c2004-08-04 20:02:13 +0000829 VNL);
hasso508e53e2004-05-18 18:57:06 +0000830 return CMD_SUCCESS;
831 }
832
paul1eb8ef22005-04-07 07:30:20 +0000833 for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, i, oa))
834 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
835 for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, k, on))
836 (*showfunc) (vty, on);
837
paul718e3742002-12-13 20:15:29 +0000838 return CMD_SUCCESS;
839}
840
841void
842ospf6_neighbor_init ()
843{
844 install_element (VIEW_NODE, &show_ipv6_ospf6_neighbor_cmd);
hasso508e53e2004-05-18 18:57:06 +0000845 install_element (VIEW_NODE, &show_ipv6_ospf6_neighbor_detail_cmd);
paul718e3742002-12-13 20:15:29 +0000846 install_element (ENABLE_NODE, &show_ipv6_ospf6_neighbor_cmd);
hasso508e53e2004-05-18 18:57:06 +0000847 install_element (ENABLE_NODE, &show_ipv6_ospf6_neighbor_detail_cmd);
paul718e3742002-12-13 20:15:29 +0000848}
849
hasso508e53e2004-05-18 18:57:06 +0000850DEFUN (debug_ospf6_neighbor,
851 debug_ospf6_neighbor_cmd,
852 "debug ospf6 neighbor",
853 DEBUG_STR
854 OSPF6_STR
855 "Debug OSPFv3 Neighbor\n"
856 )
857{
858 unsigned char level = 0;
859 if (argc)
860 {
861 if (! strncmp (argv[0], "s", 1))
862 level = OSPF6_DEBUG_NEIGHBOR_STATE;
863 if (! strncmp (argv[0], "e", 1))
864 level = OSPF6_DEBUG_NEIGHBOR_EVENT;
865 }
866 else
867 level = OSPF6_DEBUG_NEIGHBOR_STATE | OSPF6_DEBUG_NEIGHBOR_EVENT;
868
869 OSPF6_DEBUG_NEIGHBOR_ON (level);
870 return CMD_SUCCESS;
871}
872
873ALIAS (debug_ospf6_neighbor,
874 debug_ospf6_neighbor_detail_cmd,
875 "debug ospf6 neighbor (state|event)",
876 DEBUG_STR
877 OSPF6_STR
878 "Debug OSPFv3 Neighbor\n"
879 "Debug OSPFv3 Neighbor State Change\n"
880 "Debug OSPFv3 Neighbor Event\n"
881 );
882
883DEFUN (no_debug_ospf6_neighbor,
884 no_debug_ospf6_neighbor_cmd,
885 "no debug ospf6 neighbor",
886 NO_STR
887 DEBUG_STR
888 OSPF6_STR
889 "Debug OSPFv3 Neighbor\n"
890 )
891{
892 unsigned char level = 0;
893 if (argc)
894 {
895 if (! strncmp (argv[0], "s", 1))
896 level = OSPF6_DEBUG_NEIGHBOR_STATE;
897 if (! strncmp (argv[0], "e", 1))
898 level = OSPF6_DEBUG_NEIGHBOR_EVENT;
899 }
900 else
901 level = OSPF6_DEBUG_NEIGHBOR_STATE | OSPF6_DEBUG_NEIGHBOR_EVENT;
902
903 OSPF6_DEBUG_NEIGHBOR_OFF (level);
904 return CMD_SUCCESS;
905}
906
907ALIAS (no_debug_ospf6_neighbor,
908 no_debug_ospf6_neighbor_detail_cmd,
909 "no debug ospf6 neighbor (state|event)",
910 NO_STR
911 DEBUG_STR
912 OSPF6_STR
913 "Debug OSPFv3 Neighbor\n"
914 "Debug OSPFv3 Neighbor State Change\n"
915 "Debug OSPFv3 Neighbor Event\n"
916 );
917
918int
919config_write_ospf6_debug_neighbor (struct vty *vty)
920{
921 if (IS_OSPF6_DEBUG_NEIGHBOR (STATE) &&
922 IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
hasso049207c2004-08-04 20:02:13 +0000923 vty_out (vty, "debug ospf6 neighbor%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000924 else if (IS_OSPF6_DEBUG_NEIGHBOR (STATE))
hasso049207c2004-08-04 20:02:13 +0000925 vty_out (vty, "debug ospf6 neighbor state%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000926 else if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
hasso049207c2004-08-04 20:02:13 +0000927 vty_out (vty, "debug ospf6 neighbor event%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000928 return 0;
929}
930
931void
932install_element_ospf6_debug_neighbor ()
933{
934 install_element (ENABLE_NODE, &debug_ospf6_neighbor_cmd);
935 install_element (ENABLE_NODE, &debug_ospf6_neighbor_detail_cmd);
936 install_element (ENABLE_NODE, &no_debug_ospf6_neighbor_cmd);
937 install_element (ENABLE_NODE, &no_debug_ospf6_neighbor_detail_cmd);
938 install_element (CONFIG_NODE, &debug_ospf6_neighbor_cmd);
939 install_element (CONFIG_NODE, &debug_ospf6_neighbor_detail_cmd);
940 install_element (CONFIG_NODE, &no_debug_ospf6_neighbor_cmd);
941 install_element (CONFIG_NODE, &no_debug_ospf6_neighbor_detail_cmd);
942}
943
944
paul718e3742002-12-13 20:15:29 +0000945