blob: 86c0bf6882134f3a084e19aafa9e9a376e1eac24 [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
hasso508e53e2004-05-18 18:57:06 +000022#include <zebra.h>
paul718e3742002-12-13 20:15:29 +000023
hasso508e53e2004-05-18 18:57:06 +000024#include "memory.h"
paul718e3742002-12-13 20:15:29 +000025#include "if.h"
26#include "log.h"
27#include "command.h"
hasso508e53e2004-05-18 18:57:06 +000028#include "thread.h"
29#include "prefix.h"
30#include "plist.h"
paul718e3742002-12-13 20:15:29 +000031
hasso508e53e2004-05-18 18:57:06 +000032#include "ospf6_lsa.h"
paul718e3742002-12-13 20:15:29 +000033#include "ospf6_lsdb.h"
hasso508e53e2004-05-18 18:57:06 +000034#include "ospf6_network.h"
35#include "ospf6_message.h"
36#include "ospf6_route.h"
paul718e3742002-12-13 20:15:29 +000037#include "ospf6_top.h"
38#include "ospf6_area.h"
39#include "ospf6_interface.h"
hasso508e53e2004-05-18 18:57:06 +000040#include "ospf6_neighbor.h"
41#include "ospf6_intra.h"
42#include "ospf6_spf.h"
hasso049207c2004-08-04 20:02:13 +000043#include "ospf6d.h"
paul718e3742002-12-13 20:15:29 +000044
hasso508e53e2004-05-18 18:57:06 +000045unsigned char conf_debug_ospf6_interface = 0;
46
paul0c083ee2004-10-10 12:54:58 +000047const char *ospf6_interface_state_str[] =
paul718e3742002-12-13 20:15:29 +000048{
hasso508e53e2004-05-18 18:57:06 +000049 "None",
50 "Down",
51 "Loopback",
52 "Waiting",
53 "PointToPoint",
54 "DROther",
55 "BDR",
56 "DR",
57 NULL
paul718e3742002-12-13 20:15:29 +000058};
59
hasso508e53e2004-05-18 18:57:06 +000060struct ospf6_interface *
61ospf6_interface_lookup_by_ifindex (int ifindex)
paul718e3742002-12-13 20:15:29 +000062{
hasso508e53e2004-05-18 18:57:06 +000063 struct ospf6_interface *oi;
64 struct interface *ifp;
paul718e3742002-12-13 20:15:29 +000065
hasso508e53e2004-05-18 18:57:06 +000066 ifp = if_lookup_by_index (ifindex);
67 if (ifp == NULL)
68 return (struct ospf6_interface *) NULL;
69
70 oi = (struct ospf6_interface *) ifp->info;
71 return oi;
paul718e3742002-12-13 20:15:29 +000072}
73
hasso508e53e2004-05-18 18:57:06 +000074/* schedule routing table recalculation */
Paul Jakma6ac29a52008-08-15 13:45:30 +010075static void
Dinesh Dutta0edf672013-08-26 03:40:23 +000076ospf6_interface_lsdb_hook (struct ospf6_lsa *lsa, unsigned int reason)
paul718e3742002-12-13 20:15:29 +000077{
Dinesh Dutt3810e062013-08-24 07:54:09 +000078 struct ospf6_interface *oi;
79
80 if (lsa == NULL)
81 return;
82
83 oi = lsa->lsdb->data;
hasso508e53e2004-05-18 18:57:06 +000084 switch (ntohs (lsa->header->type))
85 {
86 case OSPF6_LSTYPE_LINK:
Dinesh Dutt3810e062013-08-24 07:54:09 +000087 if (oi->state == OSPF6_INTERFACE_DR)
88 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
Dinesh Dutta0edf672013-08-26 03:40:23 +000089 ospf6_spf_schedule (oi->area->ospf6, reason);
hasso508e53e2004-05-18 18:57:06 +000090 break;
paul718e3742002-12-13 20:15:29 +000091
hasso508e53e2004-05-18 18:57:06 +000092 default:
hasso508e53e2004-05-18 18:57:06 +000093 break;
94 }
paul718e3742002-12-13 20:15:29 +000095}
96
Dinesh Dutta0edf672013-08-26 03:40:23 +000097static void
98ospf6_interface_lsdb_hook_add (struct ospf6_lsa *lsa)
99{
100 ospf6_interface_lsdb_hook(lsa, ospf6_lsadd_to_spf_reason(lsa));
101}
102
103static void
104ospf6_interface_lsdb_hook_remove (struct ospf6_lsa *lsa)
105{
106 ospf6_interface_lsdb_hook(lsa, ospf6_lsremove_to_spf_reason(lsa));
107}
108
Dinesh Duttc5926a92013-08-24 07:55:00 +0000109static u_char
110ospf6_default_iftype(struct interface *ifp)
111{
112 if (if_is_pointopoint (ifp))
113 return OSPF_IFTYPE_POINTOPOINT;
114 else if (if_is_loopback (ifp))
115 return OSPF_IFTYPE_LOOPBACK;
116 else
117 return OSPF_IFTYPE_BROADCAST;
118}
119
paul718e3742002-12-13 20:15:29 +0000120/* Create new ospf6 interface structure */
121struct ospf6_interface *
122ospf6_interface_create (struct interface *ifp)
123{
hasso508e53e2004-05-18 18:57:06 +0000124 struct ospf6_interface *oi;
paul0c083ee2004-10-10 12:54:58 +0000125 unsigned int iobuflen;
paul718e3742002-12-13 20:15:29 +0000126
hasso508e53e2004-05-18 18:57:06 +0000127 oi = (struct ospf6_interface *)
Stephen Hemminger393deb92008-08-18 14:13:29 -0700128 XCALLOC (MTYPE_OSPF6_IF, sizeof (struct ospf6_interface));
paul718e3742002-12-13 20:15:29 +0000129
Stephen Hemminger393deb92008-08-18 14:13:29 -0700130 if (!oi)
paul718e3742002-12-13 20:15:29 +0000131 {
132 zlog_err ("Can't malloc ospf6_interface for ifindex %d", ifp->ifindex);
133 return (struct ospf6_interface *) NULL;
134 }
135
hasso508e53e2004-05-18 18:57:06 +0000136 oi->area = (struct ospf6_area *) NULL;
137 oi->neighbor_list = list_new ();
138 oi->neighbor_list->cmp = ospf6_neighbor_cmp;
139 oi->linklocal_addr = (struct in6_addr *) NULL;
Vyacheslav Trushkinb51a3a32012-02-10 10:42:45 +0400140 oi->instance_id = OSPF6_INTERFACE_INSTANCE_ID;
141 oi->transdelay = OSPF6_INTERFACE_TRANSDELAY;
142 oi->priority = OSPF6_INTERFACE_PRIORITY;
paul718e3742002-12-13 20:15:29 +0000143
Dinesh Dutt8551e6d2013-10-22 17:42:18 -0700144 oi->hello_interval = OSPF_HELLO_INTERVAL_DEFAULT;
145 oi->dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
146 oi->rxmt_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
Vyacheslav Trushkinb51a3a32012-02-10 10:42:45 +0400147 oi->cost = OSPF6_INTERFACE_COST;
Dinesh Duttc5926a92013-08-24 07:55:00 +0000148 oi->type = ospf6_default_iftype (ifp);
hasso508e53e2004-05-18 18:57:06 +0000149 oi->state = OSPF6_INTERFACE_DOWN;
150 oi->flag = 0;
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +0400151 oi->mtu_ignore = 0;
paul718e3742002-12-13 20:15:29 +0000152
hassob596c712004-07-09 18:33:43 +0000153 /* Try to adjust I/O buffer size with IfMtu */
hasso1203e1c2004-07-23 21:34:27 +0000154 oi->ifmtu = ifp->mtu6;
155 iobuflen = ospf6_iobuf_size (ifp->mtu6);
hassob596c712004-07-09 18:33:43 +0000156 if (oi->ifmtu > iobuflen)
hasso3b4cd3a2004-05-18 19:28:32 +0000157 {
hasso1e058382004-09-01 21:36:14 +0000158 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000159 zlog_debug ("Interface %s: IfMtu is adjusted to I/O buffer size: %d.",
160 ifp->name, iobuflen);
hasso3b4cd3a2004-05-18 19:28:32 +0000161 oi->ifmtu = iobuflen;
162 }
hasso3b4cd3a2004-05-18 19:28:32 +0000163
hasso6452df02004-08-15 05:52:07 +0000164 oi->lsupdate_list = ospf6_lsdb_create (oi);
165 oi->lsack_list = ospf6_lsdb_create (oi);
166 oi->lsdb = ospf6_lsdb_create (oi);
Dinesh Dutta0edf672013-08-26 03:40:23 +0000167 oi->lsdb->hook_add = ospf6_interface_lsdb_hook_add;
168 oi->lsdb->hook_remove = ospf6_interface_lsdb_hook_remove;
hasso6452df02004-08-15 05:52:07 +0000169 oi->lsdb_self = ospf6_lsdb_create (oi);
paul718e3742002-12-13 20:15:29 +0000170
Paul Jakmacf1ce252006-05-15 10:46:07 +0000171 oi->route_connected = OSPF6_ROUTE_TABLE_CREATE (INTERFACE, CONNECTED_ROUTES);
172 oi->route_connected->scope = oi;
paul718e3742002-12-13 20:15:29 +0000173
174 /* link both */
hasso508e53e2004-05-18 18:57:06 +0000175 oi->interface = ifp;
176 ifp->info = oi;
paul718e3742002-12-13 20:15:29 +0000177
hasso508e53e2004-05-18 18:57:06 +0000178 return oi;
paul718e3742002-12-13 20:15:29 +0000179}
180
181void
hasso508e53e2004-05-18 18:57:06 +0000182ospf6_interface_delete (struct ospf6_interface *oi)
paul718e3742002-12-13 20:15:29 +0000183{
paul1eb8ef22005-04-07 07:30:20 +0000184 struct listnode *node, *nnode;
hasso508e53e2004-05-18 18:57:06 +0000185 struct ospf6_neighbor *on;
paul718e3742002-12-13 20:15:29 +0000186
paul1eb8ef22005-04-07 07:30:20 +0000187 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
hasso508e53e2004-05-18 18:57:06 +0000188 ospf6_neighbor_delete (on);
paul1eb8ef22005-04-07 07:30:20 +0000189
hasso508e53e2004-05-18 18:57:06 +0000190 list_delete (oi->neighbor_list);
paul718e3742002-12-13 20:15:29 +0000191
hasso508e53e2004-05-18 18:57:06 +0000192 THREAD_OFF (oi->thread_send_hello);
193 THREAD_OFF (oi->thread_send_lsupdate);
194 THREAD_OFF (oi->thread_send_lsack);
paul718e3742002-12-13 20:15:29 +0000195
hasso508e53e2004-05-18 18:57:06 +0000196 ospf6_lsdb_remove_all (oi->lsdb);
197 ospf6_lsdb_remove_all (oi->lsupdate_list);
198 ospf6_lsdb_remove_all (oi->lsack_list);
199
200 ospf6_lsdb_delete (oi->lsdb);
hasso6452df02004-08-15 05:52:07 +0000201 ospf6_lsdb_delete (oi->lsdb_self);
202
hasso508e53e2004-05-18 18:57:06 +0000203 ospf6_lsdb_delete (oi->lsupdate_list);
204 ospf6_lsdb_delete (oi->lsack_list);
205
206 ospf6_route_table_delete (oi->route_connected);
paul718e3742002-12-13 20:15:29 +0000207
208 /* cut link */
hasso508e53e2004-05-18 18:57:06 +0000209 oi->interface->info = NULL;
paul718e3742002-12-13 20:15:29 +0000210
211 /* plist_name */
hasso508e53e2004-05-18 18:57:06 +0000212 if (oi->plist_name)
213 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
paul718e3742002-12-13 20:15:29 +0000214
hasso508e53e2004-05-18 18:57:06 +0000215 XFREE (MTYPE_OSPF6_IF, oi);
216}
217
218void
219ospf6_interface_enable (struct ospf6_interface *oi)
220{
221 UNSET_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE);
222
223 oi->thread_send_hello =
224 thread_add_event (master, ospf6_hello_send, oi, 0);
225}
226
227void
228ospf6_interface_disable (struct ospf6_interface *oi)
229{
paul1eb8ef22005-04-07 07:30:20 +0000230 struct listnode *node, *nnode;
hasso508e53e2004-05-18 18:57:06 +0000231 struct ospf6_neighbor *on;
232
233 SET_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE);
234
paul1eb8ef22005-04-07 07:30:20 +0000235 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
hasso508e53e2004-05-18 18:57:06 +0000236 ospf6_neighbor_delete (on);
paul1eb8ef22005-04-07 07:30:20 +0000237
hasso508e53e2004-05-18 18:57:06 +0000238 list_delete_all_node (oi->neighbor_list);
239
240 ospf6_lsdb_remove_all (oi->lsdb);
241 ospf6_lsdb_remove_all (oi->lsupdate_list);
242 ospf6_lsdb_remove_all (oi->lsack_list);
243
244 THREAD_OFF (oi->thread_send_hello);
245 THREAD_OFF (oi->thread_send_lsupdate);
246 THREAD_OFF (oi->thread_send_lsack);
paul718e3742002-12-13 20:15:29 +0000247}
248
249static struct in6_addr *
hasso508e53e2004-05-18 18:57:06 +0000250ospf6_interface_get_linklocal_address (struct interface *ifp)
paul718e3742002-12-13 20:15:29 +0000251{
hasso52dc7ee2004-09-23 19:18:23 +0000252 struct listnode *n;
paul718e3742002-12-13 20:15:29 +0000253 struct connected *c;
254 struct in6_addr *l = (struct in6_addr *) NULL;
255
256 /* for each connected address */
paul1eb8ef22005-04-07 07:30:20 +0000257 for (ALL_LIST_ELEMENTS_RO (ifp->connected, n, c))
paul718e3742002-12-13 20:15:29 +0000258 {
paul718e3742002-12-13 20:15:29 +0000259 /* if family not AF_INET6, ignore */
260 if (c->address->family != AF_INET6)
261 continue;
262
263 /* linklocal scope check */
264 if (IN6_IS_ADDR_LINKLOCAL (&c->address->u.prefix6))
265 l = &c->address->u.prefix6;
266 }
267 return l;
268}
269
270void
271ospf6_interface_if_add (struct interface *ifp)
272{
hasso508e53e2004-05-18 18:57:06 +0000273 struct ospf6_interface *oi;
paul0c083ee2004-10-10 12:54:58 +0000274 unsigned int iobuflen;
paul718e3742002-12-13 20:15:29 +0000275
hasso508e53e2004-05-18 18:57:06 +0000276 oi = (struct ospf6_interface *) ifp->info;
277 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000278 return;
279
hassob596c712004-07-09 18:33:43 +0000280 /* Try to adjust I/O buffer size with IfMtu */
281 if (oi->ifmtu == 0)
hasso1203e1c2004-07-23 21:34:27 +0000282 oi->ifmtu = ifp->mtu6;
283 iobuflen = ospf6_iobuf_size (ifp->mtu6);
hassob596c712004-07-09 18:33:43 +0000284 if (oi->ifmtu > iobuflen)
hasso3b4cd3a2004-05-18 19:28:32 +0000285 {
hasso1e058382004-09-01 21:36:14 +0000286 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000287 zlog_debug ("Interface %s: IfMtu is adjusted to I/O buffer size: %d.",
288 ifp->name, iobuflen);
hasso3b4cd3a2004-05-18 19:28:32 +0000289 oi->ifmtu = iobuflen;
290 }
paul718e3742002-12-13 20:15:29 +0000291
292 /* interface start */
hasso508e53e2004-05-18 18:57:06 +0000293 if (oi->area)
294 thread_add_event (master, interface_up, oi, 0);
paul718e3742002-12-13 20:15:29 +0000295}
296
297void
298ospf6_interface_if_del (struct interface *ifp)
299{
hasso508e53e2004-05-18 18:57:06 +0000300 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000301
hasso508e53e2004-05-18 18:57:06 +0000302 oi = (struct ospf6_interface *) ifp->info;
303 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000304 return;
305
306 /* interface stop */
hasso508e53e2004-05-18 18:57:06 +0000307 if (oi->area)
308 thread_execute (master, interface_down, oi, 0);
paul718e3742002-12-13 20:15:29 +0000309
hasso508e53e2004-05-18 18:57:06 +0000310 listnode_delete (oi->area->if_list, oi);
311 oi->area = (struct ospf6_area *) NULL;
paul718e3742002-12-13 20:15:29 +0000312
313 /* cut link */
hasso508e53e2004-05-18 18:57:06 +0000314 oi->interface = NULL;
paul718e3742002-12-13 20:15:29 +0000315 ifp->info = NULL;
316
hasso508e53e2004-05-18 18:57:06 +0000317 ospf6_interface_delete (oi);
paul718e3742002-12-13 20:15:29 +0000318}
319
320void
321ospf6_interface_state_update (struct interface *ifp)
322{
hasso508e53e2004-05-18 18:57:06 +0000323 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000324
hasso508e53e2004-05-18 18:57:06 +0000325 oi = (struct ospf6_interface *) ifp->info;
326 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000327 return;
hasso508e53e2004-05-18 18:57:06 +0000328 if (oi->area == NULL)
paul718e3742002-12-13 20:15:29 +0000329 return;
330
Dinesh Dutte7ad6b22013-08-24 07:55:57 +0000331 if (if_is_operative (ifp))
hasso508e53e2004-05-18 18:57:06 +0000332 thread_add_event (master, interface_up, oi, 0);
paul718e3742002-12-13 20:15:29 +0000333 else
hasso508e53e2004-05-18 18:57:06 +0000334 thread_add_event (master, interface_down, oi, 0);
paul718e3742002-12-13 20:15:29 +0000335
336 return;
337}
338
339void
hasso508e53e2004-05-18 18:57:06 +0000340ospf6_interface_connected_route_update (struct interface *ifp)
paul718e3742002-12-13 20:15:29 +0000341{
hasso508e53e2004-05-18 18:57:06 +0000342 struct ospf6_interface *oi;
343 struct ospf6_route *route;
344 struct connected *c;
paul1eb8ef22005-04-07 07:30:20 +0000345 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +0000346
hasso508e53e2004-05-18 18:57:06 +0000347 oi = (struct ospf6_interface *) ifp->info;
348 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000349 return;
350
351 /* reset linklocal pointer */
hasso508e53e2004-05-18 18:57:06 +0000352 oi->linklocal_addr = ospf6_interface_get_linklocal_address (ifp);
paul718e3742002-12-13 20:15:29 +0000353
hasso508e53e2004-05-18 18:57:06 +0000354 /* if area is null, do not make connected-route list */
355 if (oi->area == NULL)
paul718e3742002-12-13 20:15:29 +0000356 return;
357
hasso508e53e2004-05-18 18:57:06 +0000358 /* update "route to advertise" interface route table */
359 ospf6_route_remove_all (oi->route_connected);
hasso508e53e2004-05-18 18:57:06 +0000360
paul1eb8ef22005-04-07 07:30:20 +0000361 for (ALL_LIST_ELEMENTS (oi->interface->connected, node, nnode, c))
362 {
hasso508e53e2004-05-18 18:57:06 +0000363 if (c->address->family != AF_INET6)
364 continue;
365
hasso1e058382004-09-01 21:36:14 +0000366 CONTINUE_IF_ADDRESS_LINKLOCAL (IS_OSPF6_DEBUG_INTERFACE, c->address);
367 CONTINUE_IF_ADDRESS_UNSPECIFIED (IS_OSPF6_DEBUG_INTERFACE, c->address);
368 CONTINUE_IF_ADDRESS_LOOPBACK (IS_OSPF6_DEBUG_INTERFACE, c->address);
369 CONTINUE_IF_ADDRESS_V4COMPAT (IS_OSPF6_DEBUG_INTERFACE, c->address);
370 CONTINUE_IF_ADDRESS_V4MAPPED (IS_OSPF6_DEBUG_INTERFACE, c->address);
hasso508e53e2004-05-18 18:57:06 +0000371
372 /* apply filter */
373 if (oi->plist_name)
374 {
375 struct prefix_list *plist;
376 enum prefix_list_type ret;
377 char buf[128];
378
379 prefix2str (c->address, buf, sizeof (buf));
380 plist = prefix_list_lookup (AFI_IP6, oi->plist_name);
381 ret = prefix_list_apply (plist, (void *) c->address);
382 if (ret == PREFIX_DENY)
383 {
hasso1e058382004-09-01 21:36:14 +0000384 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000385 zlog_debug ("%s on %s filtered by prefix-list %s ",
386 buf, oi->interface->name, oi->plist_name);
hasso508e53e2004-05-18 18:57:06 +0000387 continue;
388 }
389 }
390
391 route = ospf6_route_create ();
392 memcpy (&route->prefix, c->address, sizeof (struct prefix));
393 apply_mask (&route->prefix);
394 route->type = OSPF6_DEST_TYPE_NETWORK;
395 route->path.area_id = oi->area->area_id;
396 route->path.type = OSPF6_PATH_TYPE_INTRA;
397 route->path.cost = oi->cost;
398 route->nexthop[0].ifindex = oi->interface->ifindex;
399 inet_pton (AF_INET6, "::1", &route->nexthop[0].address);
400 ospf6_route_add (route, oi->route_connected);
401 }
402
paul718e3742002-12-13 20:15:29 +0000403 /* create new Link-LSA */
hasso508e53e2004-05-18 18:57:06 +0000404 OSPF6_LINK_LSA_SCHEDULE (oi);
405 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
406 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
paul718e3742002-12-13 20:15:29 +0000407}
408
hasso508e53e2004-05-18 18:57:06 +0000409static void
410ospf6_interface_state_change (u_char next_state, struct ospf6_interface *oi)
paul718e3742002-12-13 20:15:29 +0000411{
hasso508e53e2004-05-18 18:57:06 +0000412 u_char prev_state;
paul718e3742002-12-13 20:15:29 +0000413
hasso508e53e2004-05-18 18:57:06 +0000414 prev_state = oi->state;
415 oi->state = next_state;
paul718e3742002-12-13 20:15:29 +0000416
hasso508e53e2004-05-18 18:57:06 +0000417 if (prev_state == next_state)
418 return;
paul718e3742002-12-13 20:15:29 +0000419
hasso508e53e2004-05-18 18:57:06 +0000420 /* log */
421 if (IS_OSPF6_DEBUG_INTERFACE)
paul718e3742002-12-13 20:15:29 +0000422 {
hassoc6487d62004-12-24 06:00:11 +0000423 zlog_debug ("Interface state change %s: %s -> %s", oi->interface->name,
424 ospf6_interface_state_str[prev_state],
425 ospf6_interface_state_str[next_state]);
paul718e3742002-12-13 20:15:29 +0000426 }
Vincent Bernat3bc4f842012-06-04 11:40:04 +0200427 oi->state_change++;
paul718e3742002-12-13 20:15:29 +0000428
hasso508e53e2004-05-18 18:57:06 +0000429 if ((prev_state == OSPF6_INTERFACE_DR ||
430 prev_state == OSPF6_INTERFACE_BDR) &&
431 (next_state != OSPF6_INTERFACE_DR &&
432 next_state != OSPF6_INTERFACE_BDR))
Vyacheslav Trushkin9a9446e2011-11-21 20:26:39 +0400433 ospf6_sso (oi->interface->ifindex, &alldrouters6, IPV6_LEAVE_GROUP);
Dinesh Duttc5926a92013-08-24 07:55:00 +0000434
hasso508e53e2004-05-18 18:57:06 +0000435 if ((prev_state != OSPF6_INTERFACE_DR &&
436 prev_state != OSPF6_INTERFACE_BDR) &&
437 (next_state == OSPF6_INTERFACE_DR ||
438 next_state == OSPF6_INTERFACE_BDR))
Vyacheslav Trushkin9a9446e2011-11-21 20:26:39 +0400439 ospf6_sso (oi->interface->ifindex, &alldrouters6, IPV6_JOIN_GROUP);
paul718e3742002-12-13 20:15:29 +0000440
hasso508e53e2004-05-18 18:57:06 +0000441 OSPF6_ROUTER_LSA_SCHEDULE (oi->area);
hasso6452df02004-08-15 05:52:07 +0000442 if (next_state == OSPF6_INTERFACE_DOWN)
443 {
444 OSPF6_NETWORK_LSA_EXECUTE (oi);
445 OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT (oi);
446 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
447 }
448 else if (prev_state == OSPF6_INTERFACE_DR ||
449 next_state == OSPF6_INTERFACE_DR)
paul718e3742002-12-13 20:15:29 +0000450 {
hasso508e53e2004-05-18 18:57:06 +0000451 OSPF6_NETWORK_LSA_SCHEDULE (oi);
452 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
453 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
paul718e3742002-12-13 20:15:29 +0000454 }
Vincent Bernatbf836662012-06-04 14:36:12 +0200455
456#ifdef HAVE_SNMP
457 /* Terminal state or regression */
458 if ((next_state == OSPF6_INTERFACE_POINTTOPOINT) ||
459 (next_state == OSPF6_INTERFACE_DROTHER) ||
460 (next_state == OSPF6_INTERFACE_BDR) ||
461 (next_state == OSPF6_INTERFACE_DR) ||
462 (next_state < prev_state))
463 ospf6TrapIfStateChange (oi);
464#endif
465
hasso508e53e2004-05-18 18:57:06 +0000466}
467
468
469/* DR Election, RFC2328 section 9.4 */
470
471#define IS_ELIGIBLE(n) \
472 ((n)->state >= OSPF6_NEIGHBOR_TWOWAY && (n)->priority != 0)
473
474static struct ospf6_neighbor *
475better_bdrouter (struct ospf6_neighbor *a, struct ospf6_neighbor *b)
476{
477 if ((a == NULL || ! IS_ELIGIBLE (a) || a->drouter == a->router_id) &&
478 (b == NULL || ! IS_ELIGIBLE (b) || b->drouter == b->router_id))
479 return NULL;
480 else if (a == NULL || ! IS_ELIGIBLE (a) || a->drouter == a->router_id)
481 return b;
482 else if (b == NULL || ! IS_ELIGIBLE (b) || b->drouter == b->router_id)
483 return a;
484
485 if (a->bdrouter == a->router_id && b->bdrouter != b->router_id)
486 return a;
487 if (a->bdrouter != a->router_id && b->bdrouter == b->router_id)
488 return b;
489
490 if (a->priority > b->priority)
491 return a;
492 if (a->priority < b->priority)
493 return b;
494
495 if (ntohl (a->router_id) > ntohl (b->router_id))
496 return a;
497 if (ntohl (a->router_id) < ntohl (b->router_id))
498 return b;
499
500 zlog_warn ("Router-ID duplicate ?");
501 return a;
502}
503
504static struct ospf6_neighbor *
505better_drouter (struct ospf6_neighbor *a, struct ospf6_neighbor *b)
506{
507 if ((a == NULL || ! IS_ELIGIBLE (a) || a->drouter != a->router_id) &&
508 (b == NULL || ! IS_ELIGIBLE (b) || b->drouter != b->router_id))
509 return NULL;
510 else if (a == NULL || ! IS_ELIGIBLE (a) || a->drouter != a->router_id)
511 return b;
512 else if (b == NULL || ! IS_ELIGIBLE (b) || b->drouter != b->router_id)
513 return a;
514
515 if (a->drouter == a->router_id && b->drouter != b->router_id)
516 return a;
517 if (a->drouter != a->router_id && b->drouter == b->router_id)
518 return b;
519
520 if (a->priority > b->priority)
521 return a;
522 if (a->priority < b->priority)
523 return b;
524
525 if (ntohl (a->router_id) > ntohl (b->router_id))
526 return a;
527 if (ntohl (a->router_id) < ntohl (b->router_id))
528 return b;
529
530 zlog_warn ("Router-ID duplicate ?");
531 return a;
532}
533
534static u_char
535dr_election (struct ospf6_interface *oi)
536{
paul1eb8ef22005-04-07 07:30:20 +0000537 struct listnode *node, *nnode;
hasso508e53e2004-05-18 18:57:06 +0000538 struct ospf6_neighbor *on, *drouter, *bdrouter, myself;
539 struct ospf6_neighbor *best_drouter, *best_bdrouter;
540 u_char next_state = 0;
541
542 drouter = bdrouter = NULL;
543 best_drouter = best_bdrouter = NULL;
544
545 /* pseudo neighbor myself, including noting current DR/BDR (1) */
546 memset (&myself, 0, sizeof (myself));
547 inet_ntop (AF_INET, &oi->area->ospf6->router_id, myself.name,
548 sizeof (myself.name));
549 myself.state = OSPF6_NEIGHBOR_TWOWAY;
550 myself.drouter = oi->drouter;
551 myself.bdrouter = oi->bdrouter;
552 myself.priority = oi->priority;
553 myself.router_id = oi->area->ospf6->router_id;
554
555 /* Electing BDR (2) */
paul1eb8ef22005-04-07 07:30:20 +0000556 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
557 bdrouter = better_bdrouter (bdrouter, on);
558
hasso508e53e2004-05-18 18:57:06 +0000559 best_bdrouter = bdrouter;
560 bdrouter = better_bdrouter (best_bdrouter, &myself);
561
562 /* Electing DR (3) */
paul1eb8ef22005-04-07 07:30:20 +0000563 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
564 drouter = better_drouter (drouter, on);
565
hasso508e53e2004-05-18 18:57:06 +0000566 best_drouter = drouter;
567 drouter = better_drouter (best_drouter, &myself);
568 if (drouter == NULL)
569 drouter = bdrouter;
570
571 /* the router itself is newly/no longer DR/BDR (4) */
572 if ((drouter == &myself && myself.drouter != myself.router_id) ||
573 (drouter != &myself && myself.drouter == myself.router_id) ||
574 (bdrouter == &myself && myself.bdrouter != myself.router_id) ||
575 (bdrouter != &myself && myself.bdrouter == myself.router_id))
576 {
577 myself.drouter = (drouter ? drouter->router_id : htonl (0));
578 myself.bdrouter = (bdrouter ? bdrouter->router_id : htonl (0));
579
580 /* compatible to Electing BDR (2) */
581 bdrouter = better_bdrouter (best_bdrouter, &myself);
582
583 /* compatible to Electing DR (3) */
584 drouter = better_drouter (best_drouter, &myself);
585 if (drouter == NULL)
586 drouter = bdrouter;
587 }
588
589 /* Set interface state accordingly (5) */
590 if (drouter && drouter == &myself)
591 next_state = OSPF6_INTERFACE_DR;
592 else if (bdrouter && bdrouter == &myself)
593 next_state = OSPF6_INTERFACE_BDR;
594 else
595 next_state = OSPF6_INTERFACE_DROTHER;
596
597 /* If NBMA, schedule Start for each neighbor having priority of 0 (6) */
598 /* XXX */
599
600 /* If DR or BDR change, invoke AdjOK? for each neighbor (7) */
601 /* RFC 2328 section 12.4. Originating LSAs (3) will be handled
602 accordingly after AdjOK */
603 if (oi->drouter != (drouter ? drouter->router_id : htonl (0)) ||
604 oi->bdrouter != (bdrouter ? bdrouter->router_id : htonl (0)))
605 {
606 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000607 zlog_debug ("DR Election on %s: DR: %s BDR: %s", oi->interface->name,
608 (drouter ? drouter->name : "0.0.0.0"),
609 (bdrouter ? bdrouter->name : "0.0.0.0"));
hasso508e53e2004-05-18 18:57:06 +0000610
paul1eb8ef22005-04-07 07:30:20 +0000611 for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, node, on))
hasso508e53e2004-05-18 18:57:06 +0000612 {
hasso508e53e2004-05-18 18:57:06 +0000613 if (on->state < OSPF6_NEIGHBOR_TWOWAY)
614 continue;
615 /* Schedule AdjOK. */
616 thread_add_event (master, adj_ok, on, 0);
617 }
618 }
619
620 oi->drouter = (drouter ? drouter->router_id : htonl (0));
621 oi->bdrouter = (bdrouter ? bdrouter->router_id : htonl (0));
622 return next_state;
623}
624
625
626/* Interface State Machine */
627int
628interface_up (struct thread *thread)
629{
630 struct ospf6_interface *oi;
631
632 oi = (struct ospf6_interface *) THREAD_ARG (thread);
633 assert (oi && oi->interface);
634
635 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000636 zlog_debug ("Interface Event %s: [InterfaceUp]",
637 oi->interface->name);
hasso508e53e2004-05-18 18:57:06 +0000638
639 /* check physical interface is up */
Dinesh Dutte7ad6b22013-08-24 07:55:57 +0000640 if (! if_is_operative (oi->interface))
hasso508e53e2004-05-18 18:57:06 +0000641 {
642 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000643 zlog_debug ("Interface %s is down, can't execute [InterfaceUp]",
644 oi->interface->name);
hasso508e53e2004-05-18 18:57:06 +0000645 return 0;
646 }
647
648 /* if already enabled, do nothing */
649 if (oi->state > OSPF6_INTERFACE_DOWN)
650 {
651 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000652 zlog_debug ("Interface %s already enabled",
653 oi->interface->name);
hasso508e53e2004-05-18 18:57:06 +0000654 return 0;
655 }
656
Dinesh Duttba960d52013-08-26 03:40:37 +0000657 /* If no area assigned, return */
658 if (oi->area == NULL)
659 {
660 zlog_debug ("%s: Not scheduleing Hello for %s as there is no area assigned yet", __func__,
661 oi->interface->name);
662 return 0;
663 }
664
hasso508e53e2004-05-18 18:57:06 +0000665 /* Join AllSPFRouters */
Vyacheslav Trushkin9a9446e2011-11-21 20:26:39 +0400666 ospf6_sso (oi->interface->ifindex, &allspfrouters6, IPV6_JOIN_GROUP);
hasso508e53e2004-05-18 18:57:06 +0000667
668 /* Update interface route */
669 ospf6_interface_connected_route_update (oi->interface);
670
671 /* Schedule Hello */
672 if (! CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE))
673 thread_add_event (master, ospf6_hello_send, oi, 0);
674
675 /* decide next interface state */
Dinesh Duttc5926a92013-08-24 07:55:00 +0000676 if ((if_is_pointopoint (oi->interface)) ||
677 (oi->type == OSPF_IFTYPE_POINTOPOINT)) {
hasso508e53e2004-05-18 18:57:06 +0000678 ospf6_interface_state_change (OSPF6_INTERFACE_POINTTOPOINT, oi);
Dinesh Duttc5926a92013-08-24 07:55:00 +0000679 }
hasso508e53e2004-05-18 18:57:06 +0000680 else if (oi->priority == 0)
681 ospf6_interface_state_change (OSPF6_INTERFACE_DROTHER, oi);
682 else
683 {
684 ospf6_interface_state_change (OSPF6_INTERFACE_WAITING, oi);
685 thread_add_timer (master, wait_timer, oi, oi->dead_interval);
686 }
687
688 return 0;
paul718e3742002-12-13 20:15:29 +0000689}
690
691int
hasso508e53e2004-05-18 18:57:06 +0000692wait_timer (struct thread *thread)
paul718e3742002-12-13 20:15:29 +0000693{
hasso508e53e2004-05-18 18:57:06 +0000694 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000695
hasso508e53e2004-05-18 18:57:06 +0000696 oi = (struct ospf6_interface *) THREAD_ARG (thread);
697 assert (oi && oi->interface);
paul718e3742002-12-13 20:15:29 +0000698
hasso508e53e2004-05-18 18:57:06 +0000699 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000700 zlog_debug ("Interface Event %s: [WaitTimer]",
701 oi->interface->name);
paul718e3742002-12-13 20:15:29 +0000702
hasso508e53e2004-05-18 18:57:06 +0000703 if (oi->state == OSPF6_INTERFACE_WAITING)
704 ospf6_interface_state_change (dr_election (oi), oi);
paul718e3742002-12-13 20:15:29 +0000705
hasso508e53e2004-05-18 18:57:06 +0000706 return 0;
paul718e3742002-12-13 20:15:29 +0000707}
708
hasso508e53e2004-05-18 18:57:06 +0000709int
710backup_seen (struct thread *thread)
paul718e3742002-12-13 20:15:29 +0000711{
hasso508e53e2004-05-18 18:57:06 +0000712 struct ospf6_interface *oi;
713
714 oi = (struct ospf6_interface *) THREAD_ARG (thread);
715 assert (oi && oi->interface);
716
717 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000718 zlog_debug ("Interface Event %s: [BackupSeen]",
719 oi->interface->name);
hasso508e53e2004-05-18 18:57:06 +0000720
721 if (oi->state == OSPF6_INTERFACE_WAITING)
722 ospf6_interface_state_change (dr_election (oi), oi);
723
724 return 0;
paul718e3742002-12-13 20:15:29 +0000725}
726
hasso508e53e2004-05-18 18:57:06 +0000727int
728neighbor_change (struct thread *thread)
paul718e3742002-12-13 20:15:29 +0000729{
hasso508e53e2004-05-18 18:57:06 +0000730 struct ospf6_interface *oi;
731
732 oi = (struct ospf6_interface *) THREAD_ARG (thread);
733 assert (oi && oi->interface);
734
735 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000736 zlog_debug ("Interface Event %s: [NeighborChange]",
737 oi->interface->name);
hasso508e53e2004-05-18 18:57:06 +0000738
739 if (oi->state == OSPF6_INTERFACE_DROTHER ||
740 oi->state == OSPF6_INTERFACE_BDR ||
741 oi->state == OSPF6_INTERFACE_DR)
742 ospf6_interface_state_change (dr_election (oi), oi);
743
744 return 0;
paul718e3742002-12-13 20:15:29 +0000745}
746
hasso508e53e2004-05-18 18:57:06 +0000747int
748interface_down (struct thread *thread)
749{
750 struct ospf6_interface *oi;
paul1eb8ef22005-04-07 07:30:20 +0000751 struct listnode *node, *nnode;
hasso508e53e2004-05-18 18:57:06 +0000752 struct ospf6_neighbor *on;
753
754 oi = (struct ospf6_interface *) THREAD_ARG (thread);
755 assert (oi && oi->interface);
756
757 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000758 zlog_debug ("Interface Event %s: [InterfaceDown]",
759 oi->interface->name);
hasso508e53e2004-05-18 18:57:06 +0000760
761 /* Leave AllSPFRouters */
762 if (oi->state > OSPF6_INTERFACE_DOWN)
Vyacheslav Trushkin9a9446e2011-11-21 20:26:39 +0400763 ospf6_sso (oi->interface->ifindex, &allspfrouters6, IPV6_LEAVE_GROUP);
hasso508e53e2004-05-18 18:57:06 +0000764
765 ospf6_interface_state_change (OSPF6_INTERFACE_DOWN, oi);
766
paul1eb8ef22005-04-07 07:30:20 +0000767 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
768 ospf6_neighbor_delete (on);
769
hasso508e53e2004-05-18 18:57:06 +0000770 list_delete_all_node (oi->neighbor_list);
771
Christian Franke37531a72012-12-13 13:50:28 +0100772 /* When interface state is reset, also reset information about
773 * DR election, as it is no longer valid. */
774 oi->drouter = oi->prev_drouter = htonl(0);
775 oi->bdrouter = oi->prev_bdrouter = htonl(0);
hasso508e53e2004-05-18 18:57:06 +0000776 return 0;
777}
778
779
paul718e3742002-12-13 20:15:29 +0000780/* show specified interface structure */
Paul Jakma6ac29a52008-08-15 13:45:30 +0100781static int
hasso508e53e2004-05-18 18:57:06 +0000782ospf6_interface_show (struct vty *vty, struct interface *ifp)
paul718e3742002-12-13 20:15:29 +0000783{
hasso508e53e2004-05-18 18:57:06 +0000784 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000785 struct connected *c;
786 struct prefix *p;
hasso52dc7ee2004-09-23 19:18:23 +0000787 struct listnode *i;
hasso508e53e2004-05-18 18:57:06 +0000788 char strbuf[64], drouter[32], bdrouter[32];
paul0c083ee2004-10-10 12:54:58 +0000789 const char *updown[3] = {"down", "up", NULL};
790 const char *type;
hasso508e53e2004-05-18 18:57:06 +0000791 struct timeval res, now;
792 char duration[32];
793 struct ospf6_lsa *lsa;
paul718e3742002-12-13 20:15:29 +0000794
795 /* check physical interface type */
hasso508e53e2004-05-18 18:57:06 +0000796 if (if_is_loopback (ifp))
paul718e3742002-12-13 20:15:29 +0000797 type = "LOOPBACK";
hasso508e53e2004-05-18 18:57:06 +0000798 else if (if_is_broadcast (ifp))
paul718e3742002-12-13 20:15:29 +0000799 type = "BROADCAST";
hasso508e53e2004-05-18 18:57:06 +0000800 else if (if_is_pointopoint (ifp))
paul718e3742002-12-13 20:15:29 +0000801 type = "POINTOPOINT";
802 else
803 type = "UNKNOWN";
804
805 vty_out (vty, "%s is %s, type %s%s",
Dinesh Dutte7ad6b22013-08-24 07:55:57 +0000806 ifp->name, updown[if_is_operative (ifp)], type,
hasso049207c2004-08-04 20:02:13 +0000807 VNL);
808 vty_out (vty, " Interface ID: %d%s", ifp->ifindex, VNL);
paul718e3742002-12-13 20:15:29 +0000809
hasso508e53e2004-05-18 18:57:06 +0000810 if (ifp->info == NULL)
paul718e3742002-12-13 20:15:29 +0000811 {
hasso049207c2004-08-04 20:02:13 +0000812 vty_out (vty, " OSPF not enabled on this interface%s", VNL);
paul718e3742002-12-13 20:15:29 +0000813 return 0;
814 }
815 else
hasso508e53e2004-05-18 18:57:06 +0000816 oi = (struct ospf6_interface *) ifp->info;
paul718e3742002-12-13 20:15:29 +0000817
hasso049207c2004-08-04 20:02:13 +0000818 vty_out (vty, " Internet Address:%s", VNL);
paul1eb8ef22005-04-07 07:30:20 +0000819
820 for (ALL_LIST_ELEMENTS_RO (ifp->connected, i, c))
paul718e3742002-12-13 20:15:29 +0000821 {
paul718e3742002-12-13 20:15:29 +0000822 p = c->address;
823 prefix2str (p, strbuf, sizeof (strbuf));
824 switch (p->family)
825 {
826 case AF_INET:
hasso508e53e2004-05-18 18:57:06 +0000827 vty_out (vty, " inet : %s%s", strbuf,
hasso049207c2004-08-04 20:02:13 +0000828 VNL);
paul718e3742002-12-13 20:15:29 +0000829 break;
830 case AF_INET6:
hasso508e53e2004-05-18 18:57:06 +0000831 vty_out (vty, " inet6: %s%s", strbuf,
hasso049207c2004-08-04 20:02:13 +0000832 VNL);
paul718e3742002-12-13 20:15:29 +0000833 break;
834 default:
hasso508e53e2004-05-18 18:57:06 +0000835 vty_out (vty, " ??? : %s%s", strbuf,
hasso049207c2004-08-04 20:02:13 +0000836 VNL);
paul718e3742002-12-13 20:15:29 +0000837 break;
838 }
839 }
840
hasso508e53e2004-05-18 18:57:06 +0000841 if (oi->area)
paul718e3742002-12-13 20:15:29 +0000842 {
hasso508e53e2004-05-18 18:57:06 +0000843 vty_out (vty, " Instance ID %d, Interface MTU %d (autodetect: %d)%s",
hasso049207c2004-08-04 20:02:13 +0000844 oi->instance_id, oi->ifmtu, ifp->mtu6, VNL);
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +0400845 vty_out (vty, " MTU mismatch detection: %s%s", oi->mtu_ignore ?
846 "disabled" : "enabled", VNL);
hasso508e53e2004-05-18 18:57:06 +0000847 inet_ntop (AF_INET, &oi->area->area_id,
paul718e3742002-12-13 20:15:29 +0000848 strbuf, sizeof (strbuf));
hasso508e53e2004-05-18 18:57:06 +0000849 vty_out (vty, " Area ID %s, Cost %hu%s", strbuf, oi->cost,
hasso049207c2004-08-04 20:02:13 +0000850 VNL);
paul718e3742002-12-13 20:15:29 +0000851 }
852 else
hasso049207c2004-08-04 20:02:13 +0000853 vty_out (vty, " Not Attached to Area%s", VNL);
paul718e3742002-12-13 20:15:29 +0000854
855 vty_out (vty, " State %s, Transmit Delay %d sec, Priority %d%s",
hasso508e53e2004-05-18 18:57:06 +0000856 ospf6_interface_state_str[oi->state],
857 oi->transdelay, oi->priority,
hasso049207c2004-08-04 20:02:13 +0000858 VNL);
859 vty_out (vty, " Timer intervals configured:%s", VNL);
paul718e3742002-12-13 20:15:29 +0000860 vty_out (vty, " Hello %d, Dead %d, Retransmit %d%s",
hasso508e53e2004-05-18 18:57:06 +0000861 oi->hello_interval, oi->dead_interval, oi->rxmt_interval,
hasso049207c2004-08-04 20:02:13 +0000862 VNL);
paul718e3742002-12-13 20:15:29 +0000863
hasso508e53e2004-05-18 18:57:06 +0000864 inet_ntop (AF_INET, &oi->drouter, drouter, sizeof (drouter));
865 inet_ntop (AF_INET, &oi->bdrouter, bdrouter, sizeof (bdrouter));
hasso049207c2004-08-04 20:02:13 +0000866 vty_out (vty, " DR: %s BDR: %s%s", drouter, bdrouter, VNL);
paul718e3742002-12-13 20:15:29 +0000867
868 vty_out (vty, " Number of I/F scoped LSAs is %u%s",
hasso049207c2004-08-04 20:02:13 +0000869 oi->lsdb->count, VNL);
paul718e3742002-12-13 20:15:29 +0000870
Takashi Sogabe86f72dc2009-06-22 13:07:02 +0900871 quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
paul718e3742002-12-13 20:15:29 +0000872
hasso508e53e2004-05-18 18:57:06 +0000873 timerclear (&res);
874 if (oi->thread_send_lsupdate)
875 timersub (&oi->thread_send_lsupdate->u.sands, &now, &res);
876 timerstring (&res, duration, sizeof (duration));
877 vty_out (vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]%s",
878 oi->lsupdate_list->count, duration,
879 (oi->thread_send_lsupdate ? "on" : "off"),
hasso049207c2004-08-04 20:02:13 +0000880 VNL);
hasso508e53e2004-05-18 18:57:06 +0000881 for (lsa = ospf6_lsdb_head (oi->lsupdate_list); lsa;
882 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000883 vty_out (vty, " %s%s", lsa->name, VNL);
paul718e3742002-12-13 20:15:29 +0000884
hasso508e53e2004-05-18 18:57:06 +0000885 timerclear (&res);
886 if (oi->thread_send_lsack)
887 timersub (&oi->thread_send_lsack->u.sands, &now, &res);
888 timerstring (&res, duration, sizeof (duration));
889 vty_out (vty, " %d Pending LSAs for LSAck in Time %s [thread %s]%s",
890 oi->lsack_list->count, duration,
891 (oi->thread_send_lsack ? "on" : "off"),
hasso049207c2004-08-04 20:02:13 +0000892 VNL);
hasso508e53e2004-05-18 18:57:06 +0000893 for (lsa = ospf6_lsdb_head (oi->lsack_list); lsa;
894 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000895 vty_out (vty, " %s%s", lsa->name, VNL);
paul718e3742002-12-13 20:15:29 +0000896
hasso508e53e2004-05-18 18:57:06 +0000897 return 0;
paul718e3742002-12-13 20:15:29 +0000898}
899
900/* show interface */
901DEFUN (show_ipv6_ospf6_interface,
902 show_ipv6_ospf6_interface_ifname_cmd,
903 "show ipv6 ospf6 interface IFNAME",
904 SHOW_STR
905 IP6_STR
906 OSPF6_STR
907 INTERFACE_STR
908 IFNAME_STR
909 )
910{
911 struct interface *ifp;
hasso52dc7ee2004-09-23 19:18:23 +0000912 struct listnode *i;
paul718e3742002-12-13 20:15:29 +0000913
914 if (argc)
915 {
916 ifp = if_lookup_by_name (argv[0]);
hasso508e53e2004-05-18 18:57:06 +0000917 if (ifp == NULL)
paul718e3742002-12-13 20:15:29 +0000918 {
919 vty_out (vty, "No such Interface: %s%s", argv[0],
hasso049207c2004-08-04 20:02:13 +0000920 VNL);
paul718e3742002-12-13 20:15:29 +0000921 return CMD_WARNING;
922 }
923 ospf6_interface_show (vty, ifp);
924 }
925 else
926 {
paul1eb8ef22005-04-07 07:30:20 +0000927 for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
928 ospf6_interface_show (vty, ifp);
paul718e3742002-12-13 20:15:29 +0000929 }
hasso508e53e2004-05-18 18:57:06 +0000930
paul718e3742002-12-13 20:15:29 +0000931 return CMD_SUCCESS;
932}
933
934ALIAS (show_ipv6_ospf6_interface,
935 show_ipv6_ospf6_interface_cmd,
936 "show ipv6 ospf6 interface",
937 SHOW_STR
938 IP6_STR
939 OSPF6_STR
940 INTERFACE_STR
Paul Jakma6ac29a52008-08-15 13:45:30 +0100941 )
paul718e3742002-12-13 20:15:29 +0000942
hasso508e53e2004-05-18 18:57:06 +0000943DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
944 show_ipv6_ospf6_interface_ifname_prefix_cmd,
945 "show ipv6 ospf6 interface IFNAME prefix",
946 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000947 IP6_STR
948 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +0000949 INTERFACE_STR
950 IFNAME_STR
951 "Display connected prefixes to advertise\n"
paul718e3742002-12-13 20:15:29 +0000952 )
953{
paul718e3742002-12-13 20:15:29 +0000954 struct interface *ifp;
hasso508e53e2004-05-18 18:57:06 +0000955 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000956
hasso508e53e2004-05-18 18:57:06 +0000957 ifp = if_lookup_by_name (argv[0]);
958 if (ifp == NULL)
959 {
hasso049207c2004-08-04 20:02:13 +0000960 vty_out (vty, "No such Interface: %s%s", argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000961 return CMD_WARNING;
962 }
paul718e3742002-12-13 20:15:29 +0000963
hasso508e53e2004-05-18 18:57:06 +0000964 oi = ifp->info;
965 if (oi == NULL)
966 {
hasso049207c2004-08-04 20:02:13 +0000967 vty_out (vty, "OSPFv3 is not enabled on %s%s", argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000968 return CMD_WARNING;
969 }
paul718e3742002-12-13 20:15:29 +0000970
hasso508e53e2004-05-18 18:57:06 +0000971 argc--;
972 argv++;
973 ospf6_route_table_show (vty, argc, argv, oi->route_connected);
paul718e3742002-12-13 20:15:29 +0000974
975 return CMD_SUCCESS;
976}
977
hasso508e53e2004-05-18 18:57:06 +0000978ALIAS (show_ipv6_ospf6_interface_ifname_prefix,
979 show_ipv6_ospf6_interface_ifname_prefix_detail_cmd,
980 "show ipv6 ospf6 interface IFNAME prefix (X:X::X:X|X:X::X:X/M|detail)",
981 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000982 IP6_STR
983 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +0000984 INTERFACE_STR
985 IFNAME_STR
986 "Display connected prefixes to advertise\n"
987 OSPF6_ROUTE_ADDRESS_STR
988 OSPF6_ROUTE_PREFIX_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +0400989 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +0100990 )
hasso508e53e2004-05-18 18:57:06 +0000991
992ALIAS (show_ipv6_ospf6_interface_ifname_prefix,
993 show_ipv6_ospf6_interface_ifname_prefix_match_cmd,
994 "show ipv6 ospf6 interface IFNAME prefix X:X::X:X/M (match|detail)",
995 SHOW_STR
996 IP6_STR
997 OSPF6_STR
998 INTERFACE_STR
999 IFNAME_STR
1000 "Display connected prefixes to advertise\n"
1001 OSPF6_ROUTE_PREFIX_STR
1002 OSPF6_ROUTE_MATCH_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +04001003 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +01001004 )
hasso508e53e2004-05-18 18:57:06 +00001005
1006DEFUN (show_ipv6_ospf6_interface_prefix,
1007 show_ipv6_ospf6_interface_prefix_cmd,
1008 "show ipv6 ospf6 interface prefix",
1009 SHOW_STR
1010 IP6_STR
1011 OSPF6_STR
1012 INTERFACE_STR
1013 "Display connected prefixes to advertise\n"
paul718e3742002-12-13 20:15:29 +00001014 )
1015{
hasso52dc7ee2004-09-23 19:18:23 +00001016 struct listnode *i;
hasso508e53e2004-05-18 18:57:06 +00001017 struct ospf6_interface *oi;
1018 struct interface *ifp;
1019
paul1eb8ef22005-04-07 07:30:20 +00001020 for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
hasso508e53e2004-05-18 18:57:06 +00001021 {
hasso508e53e2004-05-18 18:57:06 +00001022 oi = (struct ospf6_interface *) ifp->info;
1023 if (oi == NULL)
1024 continue;
1025
1026 ospf6_route_table_show (vty, argc, argv, oi->route_connected);
1027 }
1028
1029 return CMD_SUCCESS;
1030}
1031
1032ALIAS (show_ipv6_ospf6_interface_prefix,
1033 show_ipv6_ospf6_interface_prefix_detail_cmd,
1034 "show ipv6 ospf6 interface prefix (X:X::X:X|X:X::X:X/M|detail)",
1035 SHOW_STR
1036 IP6_STR
1037 OSPF6_STR
1038 INTERFACE_STR
1039 "Display connected prefixes to advertise\n"
1040 OSPF6_ROUTE_ADDRESS_STR
1041 OSPF6_ROUTE_PREFIX_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +04001042 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +01001043 )
hasso508e53e2004-05-18 18:57:06 +00001044
1045ALIAS (show_ipv6_ospf6_interface_prefix,
1046 show_ipv6_ospf6_interface_prefix_match_cmd,
1047 "show ipv6 ospf6 interface prefix X:X::X:X/M (match|detail)",
1048 SHOW_STR
1049 IP6_STR
1050 OSPF6_STR
1051 INTERFACE_STR
1052 "Display connected prefixes to advertise\n"
1053 OSPF6_ROUTE_PREFIX_STR
1054 OSPF6_ROUTE_MATCH_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +04001055 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +01001056 )
hasso508e53e2004-05-18 18:57:06 +00001057
1058
1059/* interface variable set command */
hassob596c712004-07-09 18:33:43 +00001060DEFUN (ipv6_ospf6_ifmtu,
1061 ipv6_ospf6_ifmtu_cmd,
1062 "ipv6 ospf6 ifmtu <1-65535>",
1063 IP6_STR
1064 OSPF6_STR
1065 "Interface MTU\n"
1066 "OSPFv3 Interface MTU\n"
1067 )
1068{
1069 struct ospf6_interface *oi;
1070 struct interface *ifp;
paul0c083ee2004-10-10 12:54:58 +00001071 unsigned int ifmtu, iobuflen;
paul1eb8ef22005-04-07 07:30:20 +00001072 struct listnode *node, *nnode;
hassob596c712004-07-09 18:33:43 +00001073 struct ospf6_neighbor *on;
1074
1075 ifp = (struct interface *) vty->index;
1076 assert (ifp);
1077
1078 oi = (struct ospf6_interface *) ifp->info;
1079 if (oi == NULL)
1080 oi = ospf6_interface_create (ifp);
1081 assert (oi);
1082
1083 ifmtu = strtol (argv[0], NULL, 10);
1084
1085 if (oi->ifmtu == ifmtu)
1086 return CMD_SUCCESS;
1087
hasso1203e1c2004-07-23 21:34:27 +00001088 if (ifp->mtu6 != 0 && ifp->mtu6 < ifmtu)
hassob596c712004-07-09 18:33:43 +00001089 {
1090 vty_out (vty, "%s's ospf6 ifmtu cannot go beyond physical mtu (%d)%s",
hasso049207c2004-08-04 20:02:13 +00001091 ifp->name, ifp->mtu6, VNL);
hassob596c712004-07-09 18:33:43 +00001092 return CMD_WARNING;
1093 }
1094
1095 if (oi->ifmtu < ifmtu)
1096 {
1097 iobuflen = ospf6_iobuf_size (ifmtu);
1098 if (iobuflen < ifmtu)
1099 {
1100 vty_out (vty, "%s's ifmtu is adjusted to I/O buffer size (%d).%s",
hasso049207c2004-08-04 20:02:13 +00001101 ifp->name, iobuflen, VNL);
hassob596c712004-07-09 18:33:43 +00001102 oi->ifmtu = iobuflen;
1103 }
1104 else
1105 oi->ifmtu = ifmtu;
1106 }
1107 else
1108 oi->ifmtu = ifmtu;
1109
1110 /* re-establish adjacencies */
paul1eb8ef22005-04-07 07:30:20 +00001111 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
hassob596c712004-07-09 18:33:43 +00001112 {
hassob596c712004-07-09 18:33:43 +00001113 THREAD_OFF (on->inactivity_timer);
hasso3e834b12005-06-24 07:50:12 +00001114 thread_add_event (master, inactivity_timer, on, 0);
hassob596c712004-07-09 18:33:43 +00001115 }
1116
1117 return CMD_SUCCESS;
1118}
1119
hasso049207c2004-08-04 20:02:13 +00001120DEFUN (no_ipv6_ospf6_ifmtu,
1121 no_ipv6_ospf6_ifmtu_cmd,
1122 "no ipv6 ospf6 ifmtu",
1123 NO_STR
1124 IP6_STR
1125 OSPF6_STR
1126 "Interface MTU\n"
1127 )
1128{
1129 struct ospf6_interface *oi;
1130 struct interface *ifp;
paul0c083ee2004-10-10 12:54:58 +00001131 unsigned int iobuflen;
paul1eb8ef22005-04-07 07:30:20 +00001132 struct listnode *node, *nnode;
hasso049207c2004-08-04 20:02:13 +00001133 struct ospf6_neighbor *on;
1134
1135 ifp = (struct interface *) vty->index;
1136 assert (ifp);
1137
1138 oi = (struct ospf6_interface *) ifp->info;
1139 if (oi == NULL)
1140 oi = ospf6_interface_create (ifp);
1141 assert (oi);
1142
1143 if (oi->ifmtu < ifp->mtu)
1144 {
1145 iobuflen = ospf6_iobuf_size (ifp->mtu);
1146 if (iobuflen < ifp->mtu)
1147 {
1148 vty_out (vty, "%s's ifmtu is adjusted to I/O buffer size (%d).%s",
1149 ifp->name, iobuflen, VNL);
1150 oi->ifmtu = iobuflen;
1151 }
1152 else
1153 oi->ifmtu = ifp->mtu;
1154 }
1155 else
1156 oi->ifmtu = ifp->mtu;
1157
1158 /* re-establish adjacencies */
paul1eb8ef22005-04-07 07:30:20 +00001159 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
hasso049207c2004-08-04 20:02:13 +00001160 {
hasso049207c2004-08-04 20:02:13 +00001161 THREAD_OFF (on->inactivity_timer);
hasso3e834b12005-06-24 07:50:12 +00001162 thread_add_event (master, inactivity_timer, on, 0);
hasso049207c2004-08-04 20:02:13 +00001163 }
1164
1165 return CMD_SUCCESS;
1166}
1167
hasso508e53e2004-05-18 18:57:06 +00001168DEFUN (ipv6_ospf6_cost,
1169 ipv6_ospf6_cost_cmd,
1170 "ipv6 ospf6 cost <1-65535>",
1171 IP6_STR
1172 OSPF6_STR
1173 "Interface cost\n"
1174 "Outgoing metric of this interface\n"
1175 )
1176{
1177 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001178 struct interface *ifp;
paul0c083ee2004-10-10 12:54:58 +00001179 unsigned long int lcost;
paul718e3742002-12-13 20:15:29 +00001180
1181 ifp = (struct interface *) vty->index;
1182 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001183
hasso508e53e2004-05-18 18:57:06 +00001184 oi = (struct ospf6_interface *) ifp->info;
1185 if (oi == NULL)
1186 oi = ospf6_interface_create (ifp);
1187 assert (oi);
1188
paul0c083ee2004-10-10 12:54:58 +00001189 lcost = strtol (argv[0], NULL, 10);
1190
1191 if (lcost > UINT32_MAX)
1192 {
1193 vty_out (vty, "Cost %ld is out of range%s", lcost, VNL);
1194 return CMD_WARNING;
1195 }
1196
1197 if (oi->cost == lcost)
hasso508e53e2004-05-18 18:57:06 +00001198 return CMD_SUCCESS;
paul0c083ee2004-10-10 12:54:58 +00001199
1200 oi->cost = lcost;
1201
hasso508e53e2004-05-18 18:57:06 +00001202 /* update cost held in route_connected list in ospf6_interface */
1203 ospf6_interface_connected_route_update (oi->interface);
1204
1205 /* execute LSA hooks */
1206 if (oi->area)
1207 {
1208 OSPF6_LINK_LSA_SCHEDULE (oi);
1209 OSPF6_ROUTER_LSA_SCHEDULE (oi->area);
1210 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1211 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1212 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
1213 }
1214
1215 return CMD_SUCCESS;
1216}
1217
1218DEFUN (ipv6_ospf6_hellointerval,
1219 ipv6_ospf6_hellointerval_cmd,
1220 "ipv6 ospf6 hello-interval <1-65535>",
1221 IP6_STR
1222 OSPF6_STR
1223 "Interval time of Hello packets\n"
1224 SECONDS_STR
1225 )
1226{
1227 struct ospf6_interface *oi;
1228 struct interface *ifp;
1229
1230 ifp = (struct interface *) vty->index;
1231 assert (ifp);
1232
1233 oi = (struct ospf6_interface *) ifp->info;
1234 if (oi == NULL)
1235 oi = ospf6_interface_create (ifp);
1236 assert (oi);
1237
1238 oi->hello_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001239 return CMD_SUCCESS;
1240}
1241
1242/* interface variable set command */
1243DEFUN (ipv6_ospf6_deadinterval,
1244 ipv6_ospf6_deadinterval_cmd,
hasso508e53e2004-05-18 18:57:06 +00001245 "ipv6 ospf6 dead-interval <1-65535>",
paul718e3742002-12-13 20:15:29 +00001246 IP6_STR
1247 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001248 "Interval time after which a neighbor is declared down\n"
paul718e3742002-12-13 20:15:29 +00001249 SECONDS_STR
1250 )
1251{
hasso508e53e2004-05-18 18:57:06 +00001252 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001253 struct interface *ifp;
1254
1255 ifp = (struct interface *) vty->index;
1256 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001257
hasso508e53e2004-05-18 18:57:06 +00001258 oi = (struct ospf6_interface *) ifp->info;
1259 if (oi == NULL)
1260 oi = ospf6_interface_create (ifp);
1261 assert (oi);
1262
1263 oi->dead_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001264 return CMD_SUCCESS;
1265}
1266
1267/* interface variable set command */
1268DEFUN (ipv6_ospf6_transmitdelay,
1269 ipv6_ospf6_transmitdelay_cmd,
hasso508e53e2004-05-18 18:57:06 +00001270 "ipv6 ospf6 transmit-delay <1-3600>",
paul718e3742002-12-13 20:15:29 +00001271 IP6_STR
1272 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001273 "Transmit delay of this interface\n"
paul718e3742002-12-13 20:15:29 +00001274 SECONDS_STR
1275 )
1276{
hasso508e53e2004-05-18 18:57:06 +00001277 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001278 struct interface *ifp;
1279
1280 ifp = (struct interface *) vty->index;
1281 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001282
hasso508e53e2004-05-18 18:57:06 +00001283 oi = (struct ospf6_interface *) ifp->info;
1284 if (oi == NULL)
1285 oi = ospf6_interface_create (ifp);
1286 assert (oi);
1287
1288 oi->transdelay = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001289 return CMD_SUCCESS;
1290}
1291
1292/* interface variable set command */
1293DEFUN (ipv6_ospf6_retransmitinterval,
1294 ipv6_ospf6_retransmitinterval_cmd,
hasso508e53e2004-05-18 18:57:06 +00001295 "ipv6 ospf6 retransmit-interval <1-65535>",
paul718e3742002-12-13 20:15:29 +00001296 IP6_STR
1297 OSPF6_STR
1298 "Time between retransmitting lost link state advertisements\n"
1299 SECONDS_STR
1300 )
1301{
hasso508e53e2004-05-18 18:57:06 +00001302 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001303 struct interface *ifp;
1304
1305 ifp = (struct interface *) vty->index;
1306 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001307
hasso508e53e2004-05-18 18:57:06 +00001308 oi = (struct ospf6_interface *) ifp->info;
1309 if (oi == NULL)
1310 oi = ospf6_interface_create (ifp);
1311 assert (oi);
1312
1313 oi->rxmt_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001314 return CMD_SUCCESS;
1315}
1316
1317/* interface variable set command */
1318DEFUN (ipv6_ospf6_priority,
1319 ipv6_ospf6_priority_cmd,
hasso508e53e2004-05-18 18:57:06 +00001320 "ipv6 ospf6 priority <0-255>",
paul718e3742002-12-13 20:15:29 +00001321 IP6_STR
1322 OSPF6_STR
1323 "Router priority\n"
hasso508e53e2004-05-18 18:57:06 +00001324 "Priority value\n"
paul718e3742002-12-13 20:15:29 +00001325 )
1326{
hasso508e53e2004-05-18 18:57:06 +00001327 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001328 struct interface *ifp;
1329
1330 ifp = (struct interface *) vty->index;
1331 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001332
hasso508e53e2004-05-18 18:57:06 +00001333 oi = (struct ospf6_interface *) ifp->info;
1334 if (oi == NULL)
1335 oi = ospf6_interface_create (ifp);
1336 assert (oi);
paul718e3742002-12-13 20:15:29 +00001337
hasso508e53e2004-05-18 18:57:06 +00001338 oi->priority = strtol (argv[0], NULL, 10);
1339
Christian Franke7d4aa1d2012-12-13 16:10:05 +01001340 if (oi->area &&
1341 (oi->state == OSPF6_INTERFACE_DROTHER ||
1342 oi->state == OSPF6_INTERFACE_BDR ||
1343 oi->state == OSPF6_INTERFACE_DR))
hasso508e53e2004-05-18 18:57:06 +00001344 ospf6_interface_state_change (dr_election (oi), oi);
paul718e3742002-12-13 20:15:29 +00001345
1346 return CMD_SUCCESS;
1347}
1348
1349DEFUN (ipv6_ospf6_instance,
1350 ipv6_ospf6_instance_cmd,
hasso508e53e2004-05-18 18:57:06 +00001351 "ipv6 ospf6 instance-id <0-255>",
paul718e3742002-12-13 20:15:29 +00001352 IP6_STR
1353 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001354 "Instance ID for this interface\n"
1355 "Instance ID value\n"
paul718e3742002-12-13 20:15:29 +00001356 )
1357{
hasso508e53e2004-05-18 18:57:06 +00001358 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001359 struct interface *ifp;
1360
1361 ifp = (struct interface *)vty->index;
1362 assert (ifp);
1363
hasso508e53e2004-05-18 18:57:06 +00001364 oi = (struct ospf6_interface *)ifp->info;
1365 if (oi == NULL)
1366 oi = ospf6_interface_create (ifp);
1367 assert (oi);
paul718e3742002-12-13 20:15:29 +00001368
hasso508e53e2004-05-18 18:57:06 +00001369 oi->instance_id = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001370 return CMD_SUCCESS;
1371}
1372
1373DEFUN (ipv6_ospf6_passive,
1374 ipv6_ospf6_passive_cmd,
1375 "ipv6 ospf6 passive",
1376 IP6_STR
1377 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001378 "passive interface, No adjacency will be formed on this interface\n"
paul718e3742002-12-13 20:15:29 +00001379 )
1380{
hasso508e53e2004-05-18 18:57:06 +00001381 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001382 struct interface *ifp;
paul1eb8ef22005-04-07 07:30:20 +00001383 struct listnode *node, *nnode;
hasso508e53e2004-05-18 18:57:06 +00001384 struct ospf6_neighbor *on;
paul718e3742002-12-13 20:15:29 +00001385
1386 ifp = (struct interface *) vty->index;
1387 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001388
hasso508e53e2004-05-18 18:57:06 +00001389 oi = (struct ospf6_interface *) ifp->info;
1390 if (oi == NULL)
1391 oi = ospf6_interface_create (ifp);
1392 assert (oi);
paul718e3742002-12-13 20:15:29 +00001393
hasso508e53e2004-05-18 18:57:06 +00001394 SET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);
1395 THREAD_OFF (oi->thread_send_hello);
1396
paul1eb8ef22005-04-07 07:30:20 +00001397 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
paul718e3742002-12-13 20:15:29 +00001398 {
hasso508e53e2004-05-18 18:57:06 +00001399 THREAD_OFF (on->inactivity_timer);
hasso3e834b12005-06-24 07:50:12 +00001400 thread_add_event (master, inactivity_timer, on, 0);
paul718e3742002-12-13 20:15:29 +00001401 }
1402
1403 return CMD_SUCCESS;
1404}
1405
1406DEFUN (no_ipv6_ospf6_passive,
1407 no_ipv6_ospf6_passive_cmd,
1408 "no ipv6 ospf6 passive",
1409 NO_STR
1410 IP6_STR
1411 OSPF6_STR
1412 "passive interface: No Adjacency will be formed on this I/F\n"
1413 )
1414{
hasso508e53e2004-05-18 18:57:06 +00001415 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001416 struct interface *ifp;
1417
1418 ifp = (struct interface *) vty->index;
1419 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001420
hasso508e53e2004-05-18 18:57:06 +00001421 oi = (struct ospf6_interface *) ifp->info;
1422 if (oi == NULL)
1423 oi = ospf6_interface_create (ifp);
1424 assert (oi);
paul718e3742002-12-13 20:15:29 +00001425
hasso508e53e2004-05-18 18:57:06 +00001426 UNSET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);
1427 THREAD_OFF (oi->thread_send_hello);
1428 oi->thread_send_hello =
1429 thread_add_event (master, ospf6_hello_send, oi, 0);
paul718e3742002-12-13 20:15:29 +00001430
1431 return CMD_SUCCESS;
1432}
1433
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +04001434DEFUN (ipv6_ospf6_mtu_ignore,
1435 ipv6_ospf6_mtu_ignore_cmd,
1436 "ipv6 ospf6 mtu-ignore",
1437 IP6_STR
1438 OSPF6_STR
1439 "Ignore MTU mismatch on this interface\n"
1440 )
1441{
1442 struct ospf6_interface *oi;
1443 struct interface *ifp;
1444
1445 ifp = (struct interface *) vty->index;
1446 assert (ifp);
1447
1448 oi = (struct ospf6_interface *) ifp->info;
1449 if (oi == NULL)
1450 oi = ospf6_interface_create (ifp);
1451 assert (oi);
1452
1453 oi->mtu_ignore = 1;
1454
1455 return CMD_SUCCESS;
1456}
1457
1458DEFUN (no_ipv6_ospf6_mtu_ignore,
1459 no_ipv6_ospf6_mtu_ignore_cmd,
1460 "no ipv6 ospf6 mtu-ignore",
1461 NO_STR
1462 IP6_STR
1463 OSPF6_STR
1464 "Ignore MTU mismatch on this interface\n"
1465 )
1466{
1467 struct ospf6_interface *oi;
1468 struct interface *ifp;
1469
1470 ifp = (struct interface *) vty->index;
1471 assert (ifp);
1472
1473 oi = (struct ospf6_interface *) ifp->info;
1474 if (oi == NULL)
1475 oi = ospf6_interface_create (ifp);
1476 assert (oi);
1477
1478 oi->mtu_ignore = 0;
1479
1480 return CMD_SUCCESS;
1481}
1482
paul718e3742002-12-13 20:15:29 +00001483DEFUN (ipv6_ospf6_advertise_prefix_list,
1484 ipv6_ospf6_advertise_prefix_list_cmd,
1485 "ipv6 ospf6 advertise prefix-list WORD",
1486 IP6_STR
1487 OSPF6_STR
1488 "Advertising options\n"
1489 "Filter prefix using prefix-list\n"
1490 "Prefix list name\n"
1491 )
1492{
hasso508e53e2004-05-18 18:57:06 +00001493 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001494 struct interface *ifp;
1495
1496 ifp = (struct interface *) vty->index;
1497 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001498
hasso508e53e2004-05-18 18:57:06 +00001499 oi = (struct ospf6_interface *) ifp->info;
1500 if (oi == NULL)
1501 oi = ospf6_interface_create (ifp);
1502 assert (oi);
paul718e3742002-12-13 20:15:29 +00001503
hasso508e53e2004-05-18 18:57:06 +00001504 if (oi->plist_name)
1505 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
1506 oi->plist_name = XSTRDUP (MTYPE_PREFIX_LIST_STR, argv[0]);
paul718e3742002-12-13 20:15:29 +00001507
hasso508e53e2004-05-18 18:57:06 +00001508 ospf6_interface_connected_route_update (oi->interface);
David Ward2470e992010-01-05 02:45:39 +00001509
1510 if (oi->area)
hasso508e53e2004-05-18 18:57:06 +00001511 {
David Ward2470e992010-01-05 02:45:39 +00001512 OSPF6_LINK_LSA_SCHEDULE (oi);
1513 if (oi->state == OSPF6_INTERFACE_DR)
1514 {
1515 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1516 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1517 }
1518 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
hasso508e53e2004-05-18 18:57:06 +00001519 }
paul718e3742002-12-13 20:15:29 +00001520
1521 return CMD_SUCCESS;
1522}
1523
1524DEFUN (no_ipv6_ospf6_advertise_prefix_list,
1525 no_ipv6_ospf6_advertise_prefix_list_cmd,
1526 "no ipv6 ospf6 advertise prefix-list",
1527 NO_STR
1528 IP6_STR
1529 OSPF6_STR
1530 "Advertising options\n"
1531 "Filter prefix using prefix-list\n"
1532 )
1533{
hasso508e53e2004-05-18 18:57:06 +00001534 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001535 struct interface *ifp;
1536
1537 ifp = (struct interface *) vty->index;
1538 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001539
hasso508e53e2004-05-18 18:57:06 +00001540 oi = (struct ospf6_interface *) ifp->info;
1541 if (oi == NULL)
1542 oi = ospf6_interface_create (ifp);
1543 assert (oi);
1544
1545 if (oi->plist_name)
paul718e3742002-12-13 20:15:29 +00001546 {
hasso508e53e2004-05-18 18:57:06 +00001547 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
1548 oi->plist_name = NULL;
paul718e3742002-12-13 20:15:29 +00001549 }
1550
hasso508e53e2004-05-18 18:57:06 +00001551 ospf6_interface_connected_route_update (oi->interface);
David Ward2470e992010-01-05 02:45:39 +00001552
1553 if (oi->area)
hasso508e53e2004-05-18 18:57:06 +00001554 {
David Ward2470e992010-01-05 02:45:39 +00001555 OSPF6_LINK_LSA_SCHEDULE (oi);
1556 if (oi->state == OSPF6_INTERFACE_DR)
1557 {
1558 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1559 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1560 }
1561 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
hasso508e53e2004-05-18 18:57:06 +00001562 }
paul718e3742002-12-13 20:15:29 +00001563
1564 return CMD_SUCCESS;
1565}
1566
Dinesh Duttc5926a92013-08-24 07:55:00 +00001567DEFUN (ipv6_ospf6_network,
1568 ipv6_ospf6_network_cmd,
1569 "ipv6 ospf6 network (broadcast|point-to-point)",
1570 IP6_STR
1571 OSPF6_STR
1572 "Network Type\n"
1573 "Specify OSPFv6 broadcast network\n"
1574 "Specify OSPF6 point-to-point network\n"
1575 )
1576{
1577 struct ospf6_interface *oi;
1578 struct interface *ifp;
1579
1580 ifp = (struct interface *) vty->index;
1581 assert (ifp);
1582
1583 oi = (struct ospf6_interface *) ifp->info;
1584 if (oi == NULL) {
1585 oi = ospf6_interface_create (ifp);
1586 }
1587 assert (oi);
1588
1589 if (strncmp (argv[0], "b", 1) == 0)
1590 {
1591 if (oi->type == OSPF_IFTYPE_BROADCAST)
1592 return CMD_SUCCESS;
1593
1594 oi->type = OSPF_IFTYPE_BROADCAST;
1595 }
1596 else if (strncmp (argv[0], "point-to-p", 10) == 0)
1597 {
1598 if (oi->type == OSPF_IFTYPE_POINTOPOINT) {
1599 return CMD_SUCCESS;
1600 }
1601 oi->type = OSPF_IFTYPE_POINTOPOINT;
1602 }
1603
1604 /* Reset the interface */
1605 thread_add_event (master, interface_down, oi, 0);
1606 thread_add_event (master, interface_up, oi, 0);
1607
1608 return CMD_SUCCESS;
1609}
1610
1611DEFUN (no_ipv6_ospf6_network,
1612 no_ipv6_ospf6_network_cmd,
1613 "no ipv6 ospf6 network",
1614 NO_STR
1615 IP6_STR
1616 OSPF6_STR
1617 "Network Type\n"
1618 "Default to whatever interface type system specifies"
1619 )
1620{
1621 struct ospf6_interface *oi;
1622 struct interface *ifp;
1623 int type;
1624
1625 ifp = (struct interface *) vty->index;
1626 assert (ifp);
1627
1628 oi = (struct ospf6_interface *) ifp->info;
1629 if (oi == NULL) {
1630 return CMD_SUCCESS;
1631 }
1632
1633 type = ospf6_default_iftype (ifp);
1634 if (oi->type == type)
1635 {
1636 return CMD_SUCCESS;
1637 }
1638 oi->type = type;
1639
1640 /* Reset the interface */
1641 thread_add_event (master, interface_down, oi, 0);
1642 thread_add_event (master, interface_up, oi, 0);
1643
1644 return CMD_SUCCESS;
1645}
1646
Paul Jakma6ac29a52008-08-15 13:45:30 +01001647static int
hasso508e53e2004-05-18 18:57:06 +00001648config_write_ospf6_interface (struct vty *vty)
paul718e3742002-12-13 20:15:29 +00001649{
hasso52dc7ee2004-09-23 19:18:23 +00001650 struct listnode *i;
hasso508e53e2004-05-18 18:57:06 +00001651 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001652 struct interface *ifp;
1653
paul1eb8ef22005-04-07 07:30:20 +00001654 for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
paul718e3742002-12-13 20:15:29 +00001655 {
hasso508e53e2004-05-18 18:57:06 +00001656 oi = (struct ospf6_interface *) ifp->info;
1657 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +00001658 continue;
1659
1660 vty_out (vty, "interface %s%s",
hasso049207c2004-08-04 20:02:13 +00001661 oi->interface->name, VNL);
hasso508e53e2004-05-18 18:57:06 +00001662
1663 if (ifp->desc)
hasso049207c2004-08-04 20:02:13 +00001664 vty_out (vty, " description %s%s", ifp->desc, VNL);
hasso1203e1c2004-07-23 21:34:27 +00001665 if (ifp->mtu6 != oi->ifmtu)
hasso049207c2004-08-04 20:02:13 +00001666 vty_out (vty, " ipv6 ospf6 ifmtu %d%s", oi->ifmtu, VNL);
Vyacheslav Trushkinb51a3a32012-02-10 10:42:45 +04001667
1668 if (oi->cost != OSPF6_INTERFACE_COST)
1669 vty_out (vty, " ipv6 ospf6 cost %d%s",
1670 oi->cost, VNL);
1671
1672 if (oi->hello_interval != OSPF6_INTERFACE_HELLO_INTERVAL)
1673 vty_out (vty, " ipv6 ospf6 hello-interval %d%s",
1674 oi->hello_interval, VNL);
1675
1676 if (oi->dead_interval != OSPF6_INTERFACE_DEAD_INTERVAL)
1677 vty_out (vty, " ipv6 ospf6 dead-interval %d%s",
1678 oi->dead_interval, VNL);
1679
1680 if (oi->rxmt_interval != OSPF6_INTERFACE_RXMT_INTERVAL)
1681 vty_out (vty, " ipv6 ospf6 retransmit-interval %d%s",
1682 oi->rxmt_interval, VNL);
1683
1684 if (oi->priority != OSPF6_INTERFACE_PRIORITY)
1685 vty_out (vty, " ipv6 ospf6 priority %d%s",
1686 oi->priority, VNL);
1687
1688 if (oi->transdelay != OSPF6_INTERFACE_TRANSDELAY)
1689 vty_out (vty, " ipv6 ospf6 transmit-delay %d%s",
1690 oi->transdelay, VNL);
1691
1692 if (oi->instance_id != OSPF6_INTERFACE_INSTANCE_ID)
1693 vty_out (vty, " ipv6 ospf6 instance-id %d%s",
1694 oi->instance_id, VNL);
paul718e3742002-12-13 20:15:29 +00001695
hasso508e53e2004-05-18 18:57:06 +00001696 if (oi->plist_name)
paul718e3742002-12-13 20:15:29 +00001697 vty_out (vty, " ipv6 ospf6 advertise prefix-list %s%s",
hasso049207c2004-08-04 20:02:13 +00001698 oi->plist_name, VNL);
paul718e3742002-12-13 20:15:29 +00001699
hasso508e53e2004-05-18 18:57:06 +00001700 if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE))
hasso049207c2004-08-04 20:02:13 +00001701 vty_out (vty, " ipv6 ospf6 passive%s", VNL);
paul718e3742002-12-13 20:15:29 +00001702
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +04001703 if (oi->mtu_ignore)
1704 vty_out (vty, " ipv6 ospf6 mtu-ignore%s", VNL);
1705
Dinesh Duttc5926a92013-08-24 07:55:00 +00001706 if (oi->type == OSPF_IFTYPE_POINTOPOINT)
1707 vty_out (vty, " ipv6 ospf6 network point-to-point%s", VNL);
1708 else if (oi->type == OSPF_IFTYPE_BROADCAST)
1709 vty_out (vty, " ipv6 ospf6 network broadcast%s", VNL);
1710
hasso049207c2004-08-04 20:02:13 +00001711 vty_out (vty, "!%s", VNL);
paul718e3742002-12-13 20:15:29 +00001712 }
1713 return 0;
1714}
1715
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08001716static struct cmd_node interface_node =
paul718e3742002-12-13 20:15:29 +00001717{
1718 INTERFACE_NODE,
1719 "%s(config-if)# ",
hasso69b4a812004-08-26 18:10:36 +00001720 1 /* VTYSH */
paul718e3742002-12-13 20:15:29 +00001721};
1722
1723void
Paul Jakma6ac29a52008-08-15 13:45:30 +01001724ospf6_interface_init (void)
paul718e3742002-12-13 20:15:29 +00001725{
1726 /* Install interface node. */
hasso508e53e2004-05-18 18:57:06 +00001727 install_node (&interface_node, config_write_ospf6_interface);
paul718e3742002-12-13 20:15:29 +00001728
1729 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_cmd);
hasso508e53e2004-05-18 18:57:06 +00001730 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_cmd);
1731 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd);
1732 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001733 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_cmd);
hasso508e53e2004-05-18 18:57:06 +00001734 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd);
1735 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd);
1736 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001737 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_cmd);
hasso508e53e2004-05-18 18:57:06 +00001738 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_cmd);
1739 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd);
1740 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001741 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_cmd);
hasso508e53e2004-05-18 18:57:06 +00001742 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd);
1743 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd);
1744 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001745
hasso508e53e2004-05-18 18:57:06 +00001746 install_element (CONFIG_NODE, &interface_cmd);
paul718e3742002-12-13 20:15:29 +00001747 install_default (INTERFACE_NODE);
1748 install_element (INTERFACE_NODE, &interface_desc_cmd);
1749 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
1750 install_element (INTERFACE_NODE, &ipv6_ospf6_cost_cmd);
hassob596c712004-07-09 18:33:43 +00001751 install_element (INTERFACE_NODE, &ipv6_ospf6_ifmtu_cmd);
hasso049207c2004-08-04 20:02:13 +00001752 install_element (INTERFACE_NODE, &no_ipv6_ospf6_ifmtu_cmd);
paul718e3742002-12-13 20:15:29 +00001753 install_element (INTERFACE_NODE, &ipv6_ospf6_deadinterval_cmd);
1754 install_element (INTERFACE_NODE, &ipv6_ospf6_hellointerval_cmd);
1755 install_element (INTERFACE_NODE, &ipv6_ospf6_priority_cmd);
1756 install_element (INTERFACE_NODE, &ipv6_ospf6_retransmitinterval_cmd);
1757 install_element (INTERFACE_NODE, &ipv6_ospf6_transmitdelay_cmd);
1758 install_element (INTERFACE_NODE, &ipv6_ospf6_instance_cmd);
hasso508e53e2004-05-18 18:57:06 +00001759
paul718e3742002-12-13 20:15:29 +00001760 install_element (INTERFACE_NODE, &ipv6_ospf6_passive_cmd);
1761 install_element (INTERFACE_NODE, &no_ipv6_ospf6_passive_cmd);
hasso508e53e2004-05-18 18:57:06 +00001762
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +04001763 install_element (INTERFACE_NODE, &ipv6_ospf6_mtu_ignore_cmd);
1764 install_element (INTERFACE_NODE, &no_ipv6_ospf6_mtu_ignore_cmd);
1765
hasso508e53e2004-05-18 18:57:06 +00001766 install_element (INTERFACE_NODE, &ipv6_ospf6_advertise_prefix_list_cmd);
1767 install_element (INTERFACE_NODE, &no_ipv6_ospf6_advertise_prefix_list_cmd);
Dinesh Duttc5926a92013-08-24 07:55:00 +00001768
1769 install_element (INTERFACE_NODE, &ipv6_ospf6_network_cmd);
1770 install_element (INTERFACE_NODE, &no_ipv6_ospf6_network_cmd);
hasso508e53e2004-05-18 18:57:06 +00001771}
1772
1773DEFUN (debug_ospf6_interface,
1774 debug_ospf6_interface_cmd,
1775 "debug ospf6 interface",
1776 DEBUG_STR
1777 OSPF6_STR
1778 "Debug OSPFv3 Interface\n"
1779 )
1780{
1781 OSPF6_DEBUG_INTERFACE_ON ();
1782 return CMD_SUCCESS;
1783}
1784
1785DEFUN (no_debug_ospf6_interface,
1786 no_debug_ospf6_interface_cmd,
1787 "no debug ospf6 interface",
1788 NO_STR
1789 DEBUG_STR
1790 OSPF6_STR
1791 "Debug OSPFv3 Interface\n"
1792 )
1793{
hasso3b687352004-08-19 06:56:53 +00001794 OSPF6_DEBUG_INTERFACE_OFF ();
hasso508e53e2004-05-18 18:57:06 +00001795 return CMD_SUCCESS;
1796}
1797
1798int
1799config_write_ospf6_debug_interface (struct vty *vty)
1800{
1801 if (IS_OSPF6_DEBUG_INTERFACE)
hasso049207c2004-08-04 20:02:13 +00001802 vty_out (vty, "debug ospf6 interface%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001803 return 0;
1804}
1805
1806void
Paul Jakma6ac29a52008-08-15 13:45:30 +01001807install_element_ospf6_debug_interface (void)
hasso508e53e2004-05-18 18:57:06 +00001808{
1809 install_element (ENABLE_NODE, &debug_ospf6_interface_cmd);
1810 install_element (ENABLE_NODE, &no_debug_ospf6_interface_cmd);
1811 install_element (CONFIG_NODE, &debug_ospf6_interface_cmd);
1812 install_element (CONFIG_NODE, &no_debug_ospf6_interface_cmd);
paul718e3742002-12-13 20:15:29 +00001813}
1814
1815