blob: c692f2c7d3214e413ecc6d10d6aed85d42553c42 [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
772 return 0;
773}
774
775
paul718e3742002-12-13 20:15:29 +0000776/* show specified interface structure */
Paul Jakma6ac29a52008-08-15 13:45:30 +0100777static int
hasso508e53e2004-05-18 18:57:06 +0000778ospf6_interface_show (struct vty *vty, struct interface *ifp)
paul718e3742002-12-13 20:15:29 +0000779{
hasso508e53e2004-05-18 18:57:06 +0000780 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000781 struct connected *c;
782 struct prefix *p;
hasso52dc7ee2004-09-23 19:18:23 +0000783 struct listnode *i;
hasso508e53e2004-05-18 18:57:06 +0000784 char strbuf[64], drouter[32], bdrouter[32];
paul0c083ee2004-10-10 12:54:58 +0000785 const char *updown[3] = {"down", "up", NULL};
786 const char *type;
hasso508e53e2004-05-18 18:57:06 +0000787 struct timeval res, now;
788 char duration[32];
789 struct ospf6_lsa *lsa;
paul718e3742002-12-13 20:15:29 +0000790
791 /* check physical interface type */
hasso508e53e2004-05-18 18:57:06 +0000792 if (if_is_loopback (ifp))
paul718e3742002-12-13 20:15:29 +0000793 type = "LOOPBACK";
hasso508e53e2004-05-18 18:57:06 +0000794 else if (if_is_broadcast (ifp))
paul718e3742002-12-13 20:15:29 +0000795 type = "BROADCAST";
hasso508e53e2004-05-18 18:57:06 +0000796 else if (if_is_pointopoint (ifp))
paul718e3742002-12-13 20:15:29 +0000797 type = "POINTOPOINT";
798 else
799 type = "UNKNOWN";
800
801 vty_out (vty, "%s is %s, type %s%s",
Dinesh Dutte7ad6b22013-08-24 07:55:57 +0000802 ifp->name, updown[if_is_operative (ifp)], type,
hasso049207c2004-08-04 20:02:13 +0000803 VNL);
804 vty_out (vty, " Interface ID: %d%s", ifp->ifindex, VNL);
paul718e3742002-12-13 20:15:29 +0000805
hasso508e53e2004-05-18 18:57:06 +0000806 if (ifp->info == NULL)
paul718e3742002-12-13 20:15:29 +0000807 {
hasso049207c2004-08-04 20:02:13 +0000808 vty_out (vty, " OSPF not enabled on this interface%s", VNL);
paul718e3742002-12-13 20:15:29 +0000809 return 0;
810 }
811 else
hasso508e53e2004-05-18 18:57:06 +0000812 oi = (struct ospf6_interface *) ifp->info;
paul718e3742002-12-13 20:15:29 +0000813
hasso049207c2004-08-04 20:02:13 +0000814 vty_out (vty, " Internet Address:%s", VNL);
paul1eb8ef22005-04-07 07:30:20 +0000815
816 for (ALL_LIST_ELEMENTS_RO (ifp->connected, i, c))
paul718e3742002-12-13 20:15:29 +0000817 {
paul718e3742002-12-13 20:15:29 +0000818 p = c->address;
819 prefix2str (p, strbuf, sizeof (strbuf));
820 switch (p->family)
821 {
822 case AF_INET:
hasso508e53e2004-05-18 18:57:06 +0000823 vty_out (vty, " inet : %s%s", strbuf,
hasso049207c2004-08-04 20:02:13 +0000824 VNL);
paul718e3742002-12-13 20:15:29 +0000825 break;
826 case AF_INET6:
hasso508e53e2004-05-18 18:57:06 +0000827 vty_out (vty, " inet6: %s%s", strbuf,
hasso049207c2004-08-04 20:02:13 +0000828 VNL);
paul718e3742002-12-13 20:15:29 +0000829 break;
830 default:
hasso508e53e2004-05-18 18:57:06 +0000831 vty_out (vty, " ??? : %s%s", strbuf,
hasso049207c2004-08-04 20:02:13 +0000832 VNL);
paul718e3742002-12-13 20:15:29 +0000833 break;
834 }
835 }
836
hasso508e53e2004-05-18 18:57:06 +0000837 if (oi->area)
paul718e3742002-12-13 20:15:29 +0000838 {
hasso508e53e2004-05-18 18:57:06 +0000839 vty_out (vty, " Instance ID %d, Interface MTU %d (autodetect: %d)%s",
hasso049207c2004-08-04 20:02:13 +0000840 oi->instance_id, oi->ifmtu, ifp->mtu6, VNL);
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +0400841 vty_out (vty, " MTU mismatch detection: %s%s", oi->mtu_ignore ?
842 "disabled" : "enabled", VNL);
hasso508e53e2004-05-18 18:57:06 +0000843 inet_ntop (AF_INET, &oi->area->area_id,
paul718e3742002-12-13 20:15:29 +0000844 strbuf, sizeof (strbuf));
hasso508e53e2004-05-18 18:57:06 +0000845 vty_out (vty, " Area ID %s, Cost %hu%s", strbuf, oi->cost,
hasso049207c2004-08-04 20:02:13 +0000846 VNL);
paul718e3742002-12-13 20:15:29 +0000847 }
848 else
hasso049207c2004-08-04 20:02:13 +0000849 vty_out (vty, " Not Attached to Area%s", VNL);
paul718e3742002-12-13 20:15:29 +0000850
851 vty_out (vty, " State %s, Transmit Delay %d sec, Priority %d%s",
hasso508e53e2004-05-18 18:57:06 +0000852 ospf6_interface_state_str[oi->state],
853 oi->transdelay, oi->priority,
hasso049207c2004-08-04 20:02:13 +0000854 VNL);
855 vty_out (vty, " Timer intervals configured:%s", VNL);
paul718e3742002-12-13 20:15:29 +0000856 vty_out (vty, " Hello %d, Dead %d, Retransmit %d%s",
hasso508e53e2004-05-18 18:57:06 +0000857 oi->hello_interval, oi->dead_interval, oi->rxmt_interval,
hasso049207c2004-08-04 20:02:13 +0000858 VNL);
paul718e3742002-12-13 20:15:29 +0000859
hasso508e53e2004-05-18 18:57:06 +0000860 inet_ntop (AF_INET, &oi->drouter, drouter, sizeof (drouter));
861 inet_ntop (AF_INET, &oi->bdrouter, bdrouter, sizeof (bdrouter));
hasso049207c2004-08-04 20:02:13 +0000862 vty_out (vty, " DR: %s BDR: %s%s", drouter, bdrouter, VNL);
paul718e3742002-12-13 20:15:29 +0000863
864 vty_out (vty, " Number of I/F scoped LSAs is %u%s",
hasso049207c2004-08-04 20:02:13 +0000865 oi->lsdb->count, VNL);
paul718e3742002-12-13 20:15:29 +0000866
Takashi Sogabe86f72dc2009-06-22 13:07:02 +0900867 quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
paul718e3742002-12-13 20:15:29 +0000868
hasso508e53e2004-05-18 18:57:06 +0000869 timerclear (&res);
870 if (oi->thread_send_lsupdate)
871 timersub (&oi->thread_send_lsupdate->u.sands, &now, &res);
872 timerstring (&res, duration, sizeof (duration));
873 vty_out (vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]%s",
874 oi->lsupdate_list->count, duration,
875 (oi->thread_send_lsupdate ? "on" : "off"),
hasso049207c2004-08-04 20:02:13 +0000876 VNL);
hasso508e53e2004-05-18 18:57:06 +0000877 for (lsa = ospf6_lsdb_head (oi->lsupdate_list); lsa;
878 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000879 vty_out (vty, " %s%s", lsa->name, VNL);
paul718e3742002-12-13 20:15:29 +0000880
hasso508e53e2004-05-18 18:57:06 +0000881 timerclear (&res);
882 if (oi->thread_send_lsack)
883 timersub (&oi->thread_send_lsack->u.sands, &now, &res);
884 timerstring (&res, duration, sizeof (duration));
885 vty_out (vty, " %d Pending LSAs for LSAck in Time %s [thread %s]%s",
886 oi->lsack_list->count, duration,
887 (oi->thread_send_lsack ? "on" : "off"),
hasso049207c2004-08-04 20:02:13 +0000888 VNL);
hasso508e53e2004-05-18 18:57:06 +0000889 for (lsa = ospf6_lsdb_head (oi->lsack_list); lsa;
890 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000891 vty_out (vty, " %s%s", lsa->name, VNL);
paul718e3742002-12-13 20:15:29 +0000892
hasso508e53e2004-05-18 18:57:06 +0000893 return 0;
paul718e3742002-12-13 20:15:29 +0000894}
895
896/* show interface */
897DEFUN (show_ipv6_ospf6_interface,
898 show_ipv6_ospf6_interface_ifname_cmd,
899 "show ipv6 ospf6 interface IFNAME",
900 SHOW_STR
901 IP6_STR
902 OSPF6_STR
903 INTERFACE_STR
904 IFNAME_STR
905 )
906{
907 struct interface *ifp;
hasso52dc7ee2004-09-23 19:18:23 +0000908 struct listnode *i;
paul718e3742002-12-13 20:15:29 +0000909
910 if (argc)
911 {
912 ifp = if_lookup_by_name (argv[0]);
hasso508e53e2004-05-18 18:57:06 +0000913 if (ifp == NULL)
paul718e3742002-12-13 20:15:29 +0000914 {
915 vty_out (vty, "No such Interface: %s%s", argv[0],
hasso049207c2004-08-04 20:02:13 +0000916 VNL);
paul718e3742002-12-13 20:15:29 +0000917 return CMD_WARNING;
918 }
919 ospf6_interface_show (vty, ifp);
920 }
921 else
922 {
paul1eb8ef22005-04-07 07:30:20 +0000923 for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
924 ospf6_interface_show (vty, ifp);
paul718e3742002-12-13 20:15:29 +0000925 }
hasso508e53e2004-05-18 18:57:06 +0000926
paul718e3742002-12-13 20:15:29 +0000927 return CMD_SUCCESS;
928}
929
930ALIAS (show_ipv6_ospf6_interface,
931 show_ipv6_ospf6_interface_cmd,
932 "show ipv6 ospf6 interface",
933 SHOW_STR
934 IP6_STR
935 OSPF6_STR
936 INTERFACE_STR
Paul Jakma6ac29a52008-08-15 13:45:30 +0100937 )
paul718e3742002-12-13 20:15:29 +0000938
hasso508e53e2004-05-18 18:57:06 +0000939DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
940 show_ipv6_ospf6_interface_ifname_prefix_cmd,
941 "show ipv6 ospf6 interface IFNAME prefix",
942 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000943 IP6_STR
944 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +0000945 INTERFACE_STR
946 IFNAME_STR
947 "Display connected prefixes to advertise\n"
paul718e3742002-12-13 20:15:29 +0000948 )
949{
paul718e3742002-12-13 20:15:29 +0000950 struct interface *ifp;
hasso508e53e2004-05-18 18:57:06 +0000951 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000952
hasso508e53e2004-05-18 18:57:06 +0000953 ifp = if_lookup_by_name (argv[0]);
954 if (ifp == NULL)
955 {
hasso049207c2004-08-04 20:02:13 +0000956 vty_out (vty, "No such Interface: %s%s", argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000957 return CMD_WARNING;
958 }
paul718e3742002-12-13 20:15:29 +0000959
hasso508e53e2004-05-18 18:57:06 +0000960 oi = ifp->info;
961 if (oi == NULL)
962 {
hasso049207c2004-08-04 20:02:13 +0000963 vty_out (vty, "OSPFv3 is not enabled on %s%s", argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000964 return CMD_WARNING;
965 }
paul718e3742002-12-13 20:15:29 +0000966
hasso508e53e2004-05-18 18:57:06 +0000967 argc--;
968 argv++;
969 ospf6_route_table_show (vty, argc, argv, oi->route_connected);
paul718e3742002-12-13 20:15:29 +0000970
971 return CMD_SUCCESS;
972}
973
hasso508e53e2004-05-18 18:57:06 +0000974ALIAS (show_ipv6_ospf6_interface_ifname_prefix,
975 show_ipv6_ospf6_interface_ifname_prefix_detail_cmd,
976 "show ipv6 ospf6 interface IFNAME prefix (X:X::X:X|X:X::X:X/M|detail)",
977 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000978 IP6_STR
979 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +0000980 INTERFACE_STR
981 IFNAME_STR
982 "Display connected prefixes to advertise\n"
983 OSPF6_ROUTE_ADDRESS_STR
984 OSPF6_ROUTE_PREFIX_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +0400985 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +0100986 )
hasso508e53e2004-05-18 18:57:06 +0000987
988ALIAS (show_ipv6_ospf6_interface_ifname_prefix,
989 show_ipv6_ospf6_interface_ifname_prefix_match_cmd,
990 "show ipv6 ospf6 interface IFNAME prefix X:X::X:X/M (match|detail)",
991 SHOW_STR
992 IP6_STR
993 OSPF6_STR
994 INTERFACE_STR
995 IFNAME_STR
996 "Display connected prefixes to advertise\n"
997 OSPF6_ROUTE_PREFIX_STR
998 OSPF6_ROUTE_MATCH_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +0400999 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +01001000 )
hasso508e53e2004-05-18 18:57:06 +00001001
1002DEFUN (show_ipv6_ospf6_interface_prefix,
1003 show_ipv6_ospf6_interface_prefix_cmd,
1004 "show ipv6 ospf6 interface prefix",
1005 SHOW_STR
1006 IP6_STR
1007 OSPF6_STR
1008 INTERFACE_STR
1009 "Display connected prefixes to advertise\n"
paul718e3742002-12-13 20:15:29 +00001010 )
1011{
hasso52dc7ee2004-09-23 19:18:23 +00001012 struct listnode *i;
hasso508e53e2004-05-18 18:57:06 +00001013 struct ospf6_interface *oi;
1014 struct interface *ifp;
1015
paul1eb8ef22005-04-07 07:30:20 +00001016 for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
hasso508e53e2004-05-18 18:57:06 +00001017 {
hasso508e53e2004-05-18 18:57:06 +00001018 oi = (struct ospf6_interface *) ifp->info;
1019 if (oi == NULL)
1020 continue;
1021
1022 ospf6_route_table_show (vty, argc, argv, oi->route_connected);
1023 }
1024
1025 return CMD_SUCCESS;
1026}
1027
1028ALIAS (show_ipv6_ospf6_interface_prefix,
1029 show_ipv6_ospf6_interface_prefix_detail_cmd,
1030 "show ipv6 ospf6 interface prefix (X:X::X:X|X:X::X:X/M|detail)",
1031 SHOW_STR
1032 IP6_STR
1033 OSPF6_STR
1034 INTERFACE_STR
1035 "Display connected prefixes to advertise\n"
1036 OSPF6_ROUTE_ADDRESS_STR
1037 OSPF6_ROUTE_PREFIX_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +04001038 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +01001039 )
hasso508e53e2004-05-18 18:57:06 +00001040
1041ALIAS (show_ipv6_ospf6_interface_prefix,
1042 show_ipv6_ospf6_interface_prefix_match_cmd,
1043 "show ipv6 ospf6 interface prefix X:X::X:X/M (match|detail)",
1044 SHOW_STR
1045 IP6_STR
1046 OSPF6_STR
1047 INTERFACE_STR
1048 "Display connected prefixes to advertise\n"
1049 OSPF6_ROUTE_PREFIX_STR
1050 OSPF6_ROUTE_MATCH_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +04001051 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +01001052 )
hasso508e53e2004-05-18 18:57:06 +00001053
1054
1055/* interface variable set command */
hassob596c712004-07-09 18:33:43 +00001056DEFUN (ipv6_ospf6_ifmtu,
1057 ipv6_ospf6_ifmtu_cmd,
1058 "ipv6 ospf6 ifmtu <1-65535>",
1059 IP6_STR
1060 OSPF6_STR
1061 "Interface MTU\n"
1062 "OSPFv3 Interface MTU\n"
1063 )
1064{
1065 struct ospf6_interface *oi;
1066 struct interface *ifp;
paul0c083ee2004-10-10 12:54:58 +00001067 unsigned int ifmtu, iobuflen;
paul1eb8ef22005-04-07 07:30:20 +00001068 struct listnode *node, *nnode;
hassob596c712004-07-09 18:33:43 +00001069 struct ospf6_neighbor *on;
1070
1071 ifp = (struct interface *) vty->index;
1072 assert (ifp);
1073
1074 oi = (struct ospf6_interface *) ifp->info;
1075 if (oi == NULL)
1076 oi = ospf6_interface_create (ifp);
1077 assert (oi);
1078
1079 ifmtu = strtol (argv[0], NULL, 10);
1080
1081 if (oi->ifmtu == ifmtu)
1082 return CMD_SUCCESS;
1083
hasso1203e1c2004-07-23 21:34:27 +00001084 if (ifp->mtu6 != 0 && ifp->mtu6 < ifmtu)
hassob596c712004-07-09 18:33:43 +00001085 {
1086 vty_out (vty, "%s's ospf6 ifmtu cannot go beyond physical mtu (%d)%s",
hasso049207c2004-08-04 20:02:13 +00001087 ifp->name, ifp->mtu6, VNL);
hassob596c712004-07-09 18:33:43 +00001088 return CMD_WARNING;
1089 }
1090
1091 if (oi->ifmtu < ifmtu)
1092 {
1093 iobuflen = ospf6_iobuf_size (ifmtu);
1094 if (iobuflen < ifmtu)
1095 {
1096 vty_out (vty, "%s's ifmtu is adjusted to I/O buffer size (%d).%s",
hasso049207c2004-08-04 20:02:13 +00001097 ifp->name, iobuflen, VNL);
hassob596c712004-07-09 18:33:43 +00001098 oi->ifmtu = iobuflen;
1099 }
1100 else
1101 oi->ifmtu = ifmtu;
1102 }
1103 else
1104 oi->ifmtu = ifmtu;
1105
1106 /* re-establish adjacencies */
paul1eb8ef22005-04-07 07:30:20 +00001107 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
hassob596c712004-07-09 18:33:43 +00001108 {
hassob596c712004-07-09 18:33:43 +00001109 THREAD_OFF (on->inactivity_timer);
hasso3e834b12005-06-24 07:50:12 +00001110 thread_add_event (master, inactivity_timer, on, 0);
hassob596c712004-07-09 18:33:43 +00001111 }
1112
1113 return CMD_SUCCESS;
1114}
1115
hasso049207c2004-08-04 20:02:13 +00001116DEFUN (no_ipv6_ospf6_ifmtu,
1117 no_ipv6_ospf6_ifmtu_cmd,
1118 "no ipv6 ospf6 ifmtu",
1119 NO_STR
1120 IP6_STR
1121 OSPF6_STR
1122 "Interface MTU\n"
1123 )
1124{
1125 struct ospf6_interface *oi;
1126 struct interface *ifp;
paul0c083ee2004-10-10 12:54:58 +00001127 unsigned int iobuflen;
paul1eb8ef22005-04-07 07:30:20 +00001128 struct listnode *node, *nnode;
hasso049207c2004-08-04 20:02:13 +00001129 struct ospf6_neighbor *on;
1130
1131 ifp = (struct interface *) vty->index;
1132 assert (ifp);
1133
1134 oi = (struct ospf6_interface *) ifp->info;
1135 if (oi == NULL)
1136 oi = ospf6_interface_create (ifp);
1137 assert (oi);
1138
1139 if (oi->ifmtu < ifp->mtu)
1140 {
1141 iobuflen = ospf6_iobuf_size (ifp->mtu);
1142 if (iobuflen < ifp->mtu)
1143 {
1144 vty_out (vty, "%s's ifmtu is adjusted to I/O buffer size (%d).%s",
1145 ifp->name, iobuflen, VNL);
1146 oi->ifmtu = iobuflen;
1147 }
1148 else
1149 oi->ifmtu = ifp->mtu;
1150 }
1151 else
1152 oi->ifmtu = ifp->mtu;
1153
1154 /* re-establish adjacencies */
paul1eb8ef22005-04-07 07:30:20 +00001155 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
hasso049207c2004-08-04 20:02:13 +00001156 {
hasso049207c2004-08-04 20:02:13 +00001157 THREAD_OFF (on->inactivity_timer);
hasso3e834b12005-06-24 07:50:12 +00001158 thread_add_event (master, inactivity_timer, on, 0);
hasso049207c2004-08-04 20:02:13 +00001159 }
1160
1161 return CMD_SUCCESS;
1162}
1163
hasso508e53e2004-05-18 18:57:06 +00001164DEFUN (ipv6_ospf6_cost,
1165 ipv6_ospf6_cost_cmd,
1166 "ipv6 ospf6 cost <1-65535>",
1167 IP6_STR
1168 OSPF6_STR
1169 "Interface cost\n"
1170 "Outgoing metric of this interface\n"
1171 )
1172{
1173 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001174 struct interface *ifp;
paul0c083ee2004-10-10 12:54:58 +00001175 unsigned long int lcost;
paul718e3742002-12-13 20:15:29 +00001176
1177 ifp = (struct interface *) vty->index;
1178 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001179
hasso508e53e2004-05-18 18:57:06 +00001180 oi = (struct ospf6_interface *) ifp->info;
1181 if (oi == NULL)
1182 oi = ospf6_interface_create (ifp);
1183 assert (oi);
1184
paul0c083ee2004-10-10 12:54:58 +00001185 lcost = strtol (argv[0], NULL, 10);
1186
1187 if (lcost > UINT32_MAX)
1188 {
1189 vty_out (vty, "Cost %ld is out of range%s", lcost, VNL);
1190 return CMD_WARNING;
1191 }
1192
1193 if (oi->cost == lcost)
hasso508e53e2004-05-18 18:57:06 +00001194 return CMD_SUCCESS;
paul0c083ee2004-10-10 12:54:58 +00001195
1196 oi->cost = lcost;
1197
hasso508e53e2004-05-18 18:57:06 +00001198 /* update cost held in route_connected list in ospf6_interface */
1199 ospf6_interface_connected_route_update (oi->interface);
1200
1201 /* execute LSA hooks */
1202 if (oi->area)
1203 {
1204 OSPF6_LINK_LSA_SCHEDULE (oi);
1205 OSPF6_ROUTER_LSA_SCHEDULE (oi->area);
1206 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1207 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1208 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
1209 }
1210
1211 return CMD_SUCCESS;
1212}
1213
1214DEFUN (ipv6_ospf6_hellointerval,
1215 ipv6_ospf6_hellointerval_cmd,
1216 "ipv6 ospf6 hello-interval <1-65535>",
1217 IP6_STR
1218 OSPF6_STR
1219 "Interval time of Hello packets\n"
1220 SECONDS_STR
1221 )
1222{
1223 struct ospf6_interface *oi;
1224 struct interface *ifp;
1225
1226 ifp = (struct interface *) vty->index;
1227 assert (ifp);
1228
1229 oi = (struct ospf6_interface *) ifp->info;
1230 if (oi == NULL)
1231 oi = ospf6_interface_create (ifp);
1232 assert (oi);
1233
1234 oi->hello_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001235 return CMD_SUCCESS;
1236}
1237
1238/* interface variable set command */
1239DEFUN (ipv6_ospf6_deadinterval,
1240 ipv6_ospf6_deadinterval_cmd,
hasso508e53e2004-05-18 18:57:06 +00001241 "ipv6 ospf6 dead-interval <1-65535>",
paul718e3742002-12-13 20:15:29 +00001242 IP6_STR
1243 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001244 "Interval time after which a neighbor is declared down\n"
paul718e3742002-12-13 20:15:29 +00001245 SECONDS_STR
1246 )
1247{
hasso508e53e2004-05-18 18:57:06 +00001248 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001249 struct interface *ifp;
1250
1251 ifp = (struct interface *) vty->index;
1252 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001253
hasso508e53e2004-05-18 18:57:06 +00001254 oi = (struct ospf6_interface *) ifp->info;
1255 if (oi == NULL)
1256 oi = ospf6_interface_create (ifp);
1257 assert (oi);
1258
1259 oi->dead_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001260 return CMD_SUCCESS;
1261}
1262
1263/* interface variable set command */
1264DEFUN (ipv6_ospf6_transmitdelay,
1265 ipv6_ospf6_transmitdelay_cmd,
hasso508e53e2004-05-18 18:57:06 +00001266 "ipv6 ospf6 transmit-delay <1-3600>",
paul718e3742002-12-13 20:15:29 +00001267 IP6_STR
1268 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001269 "Transmit delay of this interface\n"
paul718e3742002-12-13 20:15:29 +00001270 SECONDS_STR
1271 )
1272{
hasso508e53e2004-05-18 18:57:06 +00001273 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001274 struct interface *ifp;
1275
1276 ifp = (struct interface *) vty->index;
1277 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001278
hasso508e53e2004-05-18 18:57:06 +00001279 oi = (struct ospf6_interface *) ifp->info;
1280 if (oi == NULL)
1281 oi = ospf6_interface_create (ifp);
1282 assert (oi);
1283
1284 oi->transdelay = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001285 return CMD_SUCCESS;
1286}
1287
1288/* interface variable set command */
1289DEFUN (ipv6_ospf6_retransmitinterval,
1290 ipv6_ospf6_retransmitinterval_cmd,
hasso508e53e2004-05-18 18:57:06 +00001291 "ipv6 ospf6 retransmit-interval <1-65535>",
paul718e3742002-12-13 20:15:29 +00001292 IP6_STR
1293 OSPF6_STR
1294 "Time between retransmitting lost link state advertisements\n"
1295 SECONDS_STR
1296 )
1297{
hasso508e53e2004-05-18 18:57:06 +00001298 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001299 struct interface *ifp;
1300
1301 ifp = (struct interface *) vty->index;
1302 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001303
hasso508e53e2004-05-18 18:57:06 +00001304 oi = (struct ospf6_interface *) ifp->info;
1305 if (oi == NULL)
1306 oi = ospf6_interface_create (ifp);
1307 assert (oi);
1308
1309 oi->rxmt_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001310 return CMD_SUCCESS;
1311}
1312
1313/* interface variable set command */
1314DEFUN (ipv6_ospf6_priority,
1315 ipv6_ospf6_priority_cmd,
hasso508e53e2004-05-18 18:57:06 +00001316 "ipv6 ospf6 priority <0-255>",
paul718e3742002-12-13 20:15:29 +00001317 IP6_STR
1318 OSPF6_STR
1319 "Router priority\n"
hasso508e53e2004-05-18 18:57:06 +00001320 "Priority value\n"
paul718e3742002-12-13 20:15:29 +00001321 )
1322{
hasso508e53e2004-05-18 18:57:06 +00001323 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001324 struct interface *ifp;
1325
1326 ifp = (struct interface *) vty->index;
1327 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001328
hasso508e53e2004-05-18 18:57:06 +00001329 oi = (struct ospf6_interface *) ifp->info;
1330 if (oi == NULL)
1331 oi = ospf6_interface_create (ifp);
1332 assert (oi);
paul718e3742002-12-13 20:15:29 +00001333
hasso508e53e2004-05-18 18:57:06 +00001334 oi->priority = strtol (argv[0], NULL, 10);
1335
Christian Franke7d4aa1d2012-12-13 16:10:05 +01001336 if (oi->area &&
1337 (oi->state == OSPF6_INTERFACE_DROTHER ||
1338 oi->state == OSPF6_INTERFACE_BDR ||
1339 oi->state == OSPF6_INTERFACE_DR))
hasso508e53e2004-05-18 18:57:06 +00001340 ospf6_interface_state_change (dr_election (oi), oi);
paul718e3742002-12-13 20:15:29 +00001341
1342 return CMD_SUCCESS;
1343}
1344
1345DEFUN (ipv6_ospf6_instance,
1346 ipv6_ospf6_instance_cmd,
hasso508e53e2004-05-18 18:57:06 +00001347 "ipv6 ospf6 instance-id <0-255>",
paul718e3742002-12-13 20:15:29 +00001348 IP6_STR
1349 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001350 "Instance ID for this interface\n"
1351 "Instance ID value\n"
paul718e3742002-12-13 20:15:29 +00001352 )
1353{
hasso508e53e2004-05-18 18:57:06 +00001354 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001355 struct interface *ifp;
1356
1357 ifp = (struct interface *)vty->index;
1358 assert (ifp);
1359
hasso508e53e2004-05-18 18:57:06 +00001360 oi = (struct ospf6_interface *)ifp->info;
1361 if (oi == NULL)
1362 oi = ospf6_interface_create (ifp);
1363 assert (oi);
paul718e3742002-12-13 20:15:29 +00001364
hasso508e53e2004-05-18 18:57:06 +00001365 oi->instance_id = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001366 return CMD_SUCCESS;
1367}
1368
1369DEFUN (ipv6_ospf6_passive,
1370 ipv6_ospf6_passive_cmd,
1371 "ipv6 ospf6 passive",
1372 IP6_STR
1373 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001374 "passive interface, No adjacency will be formed on this interface\n"
paul718e3742002-12-13 20:15:29 +00001375 )
1376{
hasso508e53e2004-05-18 18:57:06 +00001377 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001378 struct interface *ifp;
paul1eb8ef22005-04-07 07:30:20 +00001379 struct listnode *node, *nnode;
hasso508e53e2004-05-18 18:57:06 +00001380 struct ospf6_neighbor *on;
paul718e3742002-12-13 20:15:29 +00001381
1382 ifp = (struct interface *) vty->index;
1383 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001384
hasso508e53e2004-05-18 18:57:06 +00001385 oi = (struct ospf6_interface *) ifp->info;
1386 if (oi == NULL)
1387 oi = ospf6_interface_create (ifp);
1388 assert (oi);
paul718e3742002-12-13 20:15:29 +00001389
hasso508e53e2004-05-18 18:57:06 +00001390 SET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);
1391 THREAD_OFF (oi->thread_send_hello);
1392
paul1eb8ef22005-04-07 07:30:20 +00001393 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
paul718e3742002-12-13 20:15:29 +00001394 {
hasso508e53e2004-05-18 18:57:06 +00001395 THREAD_OFF (on->inactivity_timer);
hasso3e834b12005-06-24 07:50:12 +00001396 thread_add_event (master, inactivity_timer, on, 0);
paul718e3742002-12-13 20:15:29 +00001397 }
1398
1399 return CMD_SUCCESS;
1400}
1401
1402DEFUN (no_ipv6_ospf6_passive,
1403 no_ipv6_ospf6_passive_cmd,
1404 "no ipv6 ospf6 passive",
1405 NO_STR
1406 IP6_STR
1407 OSPF6_STR
1408 "passive interface: No Adjacency will be formed on this I/F\n"
1409 )
1410{
hasso508e53e2004-05-18 18:57:06 +00001411 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001412 struct interface *ifp;
1413
1414 ifp = (struct interface *) vty->index;
1415 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001416
hasso508e53e2004-05-18 18:57:06 +00001417 oi = (struct ospf6_interface *) ifp->info;
1418 if (oi == NULL)
1419 oi = ospf6_interface_create (ifp);
1420 assert (oi);
paul718e3742002-12-13 20:15:29 +00001421
hasso508e53e2004-05-18 18:57:06 +00001422 UNSET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);
1423 THREAD_OFF (oi->thread_send_hello);
1424 oi->thread_send_hello =
1425 thread_add_event (master, ospf6_hello_send, oi, 0);
paul718e3742002-12-13 20:15:29 +00001426
1427 return CMD_SUCCESS;
1428}
1429
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +04001430DEFUN (ipv6_ospf6_mtu_ignore,
1431 ipv6_ospf6_mtu_ignore_cmd,
1432 "ipv6 ospf6 mtu-ignore",
1433 IP6_STR
1434 OSPF6_STR
1435 "Ignore MTU mismatch on this interface\n"
1436 )
1437{
1438 struct ospf6_interface *oi;
1439 struct interface *ifp;
1440
1441 ifp = (struct interface *) vty->index;
1442 assert (ifp);
1443
1444 oi = (struct ospf6_interface *) ifp->info;
1445 if (oi == NULL)
1446 oi = ospf6_interface_create (ifp);
1447 assert (oi);
1448
1449 oi->mtu_ignore = 1;
1450
1451 return CMD_SUCCESS;
1452}
1453
1454DEFUN (no_ipv6_ospf6_mtu_ignore,
1455 no_ipv6_ospf6_mtu_ignore_cmd,
1456 "no ipv6 ospf6 mtu-ignore",
1457 NO_STR
1458 IP6_STR
1459 OSPF6_STR
1460 "Ignore MTU mismatch on this interface\n"
1461 )
1462{
1463 struct ospf6_interface *oi;
1464 struct interface *ifp;
1465
1466 ifp = (struct interface *) vty->index;
1467 assert (ifp);
1468
1469 oi = (struct ospf6_interface *) ifp->info;
1470 if (oi == NULL)
1471 oi = ospf6_interface_create (ifp);
1472 assert (oi);
1473
1474 oi->mtu_ignore = 0;
1475
1476 return CMD_SUCCESS;
1477}
1478
paul718e3742002-12-13 20:15:29 +00001479DEFUN (ipv6_ospf6_advertise_prefix_list,
1480 ipv6_ospf6_advertise_prefix_list_cmd,
1481 "ipv6 ospf6 advertise prefix-list WORD",
1482 IP6_STR
1483 OSPF6_STR
1484 "Advertising options\n"
1485 "Filter prefix using prefix-list\n"
1486 "Prefix list name\n"
1487 )
1488{
hasso508e53e2004-05-18 18:57:06 +00001489 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001490 struct interface *ifp;
1491
1492 ifp = (struct interface *) vty->index;
1493 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001494
hasso508e53e2004-05-18 18:57:06 +00001495 oi = (struct ospf6_interface *) ifp->info;
1496 if (oi == NULL)
1497 oi = ospf6_interface_create (ifp);
1498 assert (oi);
paul718e3742002-12-13 20:15:29 +00001499
hasso508e53e2004-05-18 18:57:06 +00001500 if (oi->plist_name)
1501 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
1502 oi->plist_name = XSTRDUP (MTYPE_PREFIX_LIST_STR, argv[0]);
paul718e3742002-12-13 20:15:29 +00001503
hasso508e53e2004-05-18 18:57:06 +00001504 ospf6_interface_connected_route_update (oi->interface);
David Ward2470e992010-01-05 02:45:39 +00001505
1506 if (oi->area)
hasso508e53e2004-05-18 18:57:06 +00001507 {
David Ward2470e992010-01-05 02:45:39 +00001508 OSPF6_LINK_LSA_SCHEDULE (oi);
1509 if (oi->state == OSPF6_INTERFACE_DR)
1510 {
1511 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1512 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1513 }
1514 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
hasso508e53e2004-05-18 18:57:06 +00001515 }
paul718e3742002-12-13 20:15:29 +00001516
1517 return CMD_SUCCESS;
1518}
1519
1520DEFUN (no_ipv6_ospf6_advertise_prefix_list,
1521 no_ipv6_ospf6_advertise_prefix_list_cmd,
1522 "no ipv6 ospf6 advertise prefix-list",
1523 NO_STR
1524 IP6_STR
1525 OSPF6_STR
1526 "Advertising options\n"
1527 "Filter prefix using prefix-list\n"
1528 )
1529{
hasso508e53e2004-05-18 18:57:06 +00001530 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001531 struct interface *ifp;
1532
1533 ifp = (struct interface *) vty->index;
1534 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001535
hasso508e53e2004-05-18 18:57:06 +00001536 oi = (struct ospf6_interface *) ifp->info;
1537 if (oi == NULL)
1538 oi = ospf6_interface_create (ifp);
1539 assert (oi);
1540
1541 if (oi->plist_name)
paul718e3742002-12-13 20:15:29 +00001542 {
hasso508e53e2004-05-18 18:57:06 +00001543 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
1544 oi->plist_name = NULL;
paul718e3742002-12-13 20:15:29 +00001545 }
1546
hasso508e53e2004-05-18 18:57:06 +00001547 ospf6_interface_connected_route_update (oi->interface);
David Ward2470e992010-01-05 02:45:39 +00001548
1549 if (oi->area)
hasso508e53e2004-05-18 18:57:06 +00001550 {
David Ward2470e992010-01-05 02:45:39 +00001551 OSPF6_LINK_LSA_SCHEDULE (oi);
1552 if (oi->state == OSPF6_INTERFACE_DR)
1553 {
1554 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1555 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1556 }
1557 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
hasso508e53e2004-05-18 18:57:06 +00001558 }
paul718e3742002-12-13 20:15:29 +00001559
1560 return CMD_SUCCESS;
1561}
1562
Dinesh Duttc5926a92013-08-24 07:55:00 +00001563DEFUN (ipv6_ospf6_network,
1564 ipv6_ospf6_network_cmd,
1565 "ipv6 ospf6 network (broadcast|point-to-point)",
1566 IP6_STR
1567 OSPF6_STR
1568 "Network Type\n"
1569 "Specify OSPFv6 broadcast network\n"
1570 "Specify OSPF6 point-to-point network\n"
1571 )
1572{
1573 struct ospf6_interface *oi;
1574 struct interface *ifp;
1575
1576 ifp = (struct interface *) vty->index;
1577 assert (ifp);
1578
1579 oi = (struct ospf6_interface *) ifp->info;
1580 if (oi == NULL) {
1581 oi = ospf6_interface_create (ifp);
1582 }
1583 assert (oi);
1584
1585 if (strncmp (argv[0], "b", 1) == 0)
1586 {
1587 if (oi->type == OSPF_IFTYPE_BROADCAST)
1588 return CMD_SUCCESS;
1589
1590 oi->type = OSPF_IFTYPE_BROADCAST;
1591 }
1592 else if (strncmp (argv[0], "point-to-p", 10) == 0)
1593 {
1594 if (oi->type == OSPF_IFTYPE_POINTOPOINT) {
1595 return CMD_SUCCESS;
1596 }
1597 oi->type = OSPF_IFTYPE_POINTOPOINT;
1598 }
1599
1600 /* Reset the interface */
1601 thread_add_event (master, interface_down, oi, 0);
1602 thread_add_event (master, interface_up, oi, 0);
1603
1604 return CMD_SUCCESS;
1605}
1606
1607DEFUN (no_ipv6_ospf6_network,
1608 no_ipv6_ospf6_network_cmd,
1609 "no ipv6 ospf6 network",
1610 NO_STR
1611 IP6_STR
1612 OSPF6_STR
1613 "Network Type\n"
1614 "Default to whatever interface type system specifies"
1615 )
1616{
1617 struct ospf6_interface *oi;
1618 struct interface *ifp;
1619 int type;
1620
1621 ifp = (struct interface *) vty->index;
1622 assert (ifp);
1623
1624 oi = (struct ospf6_interface *) ifp->info;
1625 if (oi == NULL) {
1626 return CMD_SUCCESS;
1627 }
1628
1629 type = ospf6_default_iftype (ifp);
1630 if (oi->type == type)
1631 {
1632 return CMD_SUCCESS;
1633 }
1634 oi->type = type;
1635
1636 /* Reset the interface */
1637 thread_add_event (master, interface_down, oi, 0);
1638 thread_add_event (master, interface_up, oi, 0);
1639
1640 return CMD_SUCCESS;
1641}
1642
Paul Jakma6ac29a52008-08-15 13:45:30 +01001643static int
hasso508e53e2004-05-18 18:57:06 +00001644config_write_ospf6_interface (struct vty *vty)
paul718e3742002-12-13 20:15:29 +00001645{
hasso52dc7ee2004-09-23 19:18:23 +00001646 struct listnode *i;
hasso508e53e2004-05-18 18:57:06 +00001647 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001648 struct interface *ifp;
1649
paul1eb8ef22005-04-07 07:30:20 +00001650 for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
paul718e3742002-12-13 20:15:29 +00001651 {
hasso508e53e2004-05-18 18:57:06 +00001652 oi = (struct ospf6_interface *) ifp->info;
1653 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +00001654 continue;
1655
1656 vty_out (vty, "interface %s%s",
hasso049207c2004-08-04 20:02:13 +00001657 oi->interface->name, VNL);
hasso508e53e2004-05-18 18:57:06 +00001658
1659 if (ifp->desc)
hasso049207c2004-08-04 20:02:13 +00001660 vty_out (vty, " description %s%s", ifp->desc, VNL);
hasso1203e1c2004-07-23 21:34:27 +00001661 if (ifp->mtu6 != oi->ifmtu)
hasso049207c2004-08-04 20:02:13 +00001662 vty_out (vty, " ipv6 ospf6 ifmtu %d%s", oi->ifmtu, VNL);
Vyacheslav Trushkinb51a3a32012-02-10 10:42:45 +04001663
1664 if (oi->cost != OSPF6_INTERFACE_COST)
1665 vty_out (vty, " ipv6 ospf6 cost %d%s",
1666 oi->cost, VNL);
1667
1668 if (oi->hello_interval != OSPF6_INTERFACE_HELLO_INTERVAL)
1669 vty_out (vty, " ipv6 ospf6 hello-interval %d%s",
1670 oi->hello_interval, VNL);
1671
1672 if (oi->dead_interval != OSPF6_INTERFACE_DEAD_INTERVAL)
1673 vty_out (vty, " ipv6 ospf6 dead-interval %d%s",
1674 oi->dead_interval, VNL);
1675
1676 if (oi->rxmt_interval != OSPF6_INTERFACE_RXMT_INTERVAL)
1677 vty_out (vty, " ipv6 ospf6 retransmit-interval %d%s",
1678 oi->rxmt_interval, VNL);
1679
1680 if (oi->priority != OSPF6_INTERFACE_PRIORITY)
1681 vty_out (vty, " ipv6 ospf6 priority %d%s",
1682 oi->priority, VNL);
1683
1684 if (oi->transdelay != OSPF6_INTERFACE_TRANSDELAY)
1685 vty_out (vty, " ipv6 ospf6 transmit-delay %d%s",
1686 oi->transdelay, VNL);
1687
1688 if (oi->instance_id != OSPF6_INTERFACE_INSTANCE_ID)
1689 vty_out (vty, " ipv6 ospf6 instance-id %d%s",
1690 oi->instance_id, VNL);
paul718e3742002-12-13 20:15:29 +00001691
hasso508e53e2004-05-18 18:57:06 +00001692 if (oi->plist_name)
paul718e3742002-12-13 20:15:29 +00001693 vty_out (vty, " ipv6 ospf6 advertise prefix-list %s%s",
hasso049207c2004-08-04 20:02:13 +00001694 oi->plist_name, VNL);
paul718e3742002-12-13 20:15:29 +00001695
hasso508e53e2004-05-18 18:57:06 +00001696 if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE))
hasso049207c2004-08-04 20:02:13 +00001697 vty_out (vty, " ipv6 ospf6 passive%s", VNL);
paul718e3742002-12-13 20:15:29 +00001698
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +04001699 if (oi->mtu_ignore)
1700 vty_out (vty, " ipv6 ospf6 mtu-ignore%s", VNL);
1701
Dinesh Duttc5926a92013-08-24 07:55:00 +00001702 if (oi->type == OSPF_IFTYPE_POINTOPOINT)
1703 vty_out (vty, " ipv6 ospf6 network point-to-point%s", VNL);
1704 else if (oi->type == OSPF_IFTYPE_BROADCAST)
1705 vty_out (vty, " ipv6 ospf6 network broadcast%s", VNL);
1706
hasso049207c2004-08-04 20:02:13 +00001707 vty_out (vty, "!%s", VNL);
paul718e3742002-12-13 20:15:29 +00001708 }
1709 return 0;
1710}
1711
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08001712static struct cmd_node interface_node =
paul718e3742002-12-13 20:15:29 +00001713{
1714 INTERFACE_NODE,
1715 "%s(config-if)# ",
hasso69b4a812004-08-26 18:10:36 +00001716 1 /* VTYSH */
paul718e3742002-12-13 20:15:29 +00001717};
1718
1719void
Paul Jakma6ac29a52008-08-15 13:45:30 +01001720ospf6_interface_init (void)
paul718e3742002-12-13 20:15:29 +00001721{
1722 /* Install interface node. */
hasso508e53e2004-05-18 18:57:06 +00001723 install_node (&interface_node, config_write_ospf6_interface);
paul718e3742002-12-13 20:15:29 +00001724
1725 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_cmd);
hasso508e53e2004-05-18 18:57:06 +00001726 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_cmd);
1727 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd);
1728 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001729 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_cmd);
hasso508e53e2004-05-18 18:57:06 +00001730 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd);
1731 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd);
1732 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001733 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_cmd);
hasso508e53e2004-05-18 18:57:06 +00001734 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_cmd);
1735 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd);
1736 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001737 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_cmd);
hasso508e53e2004-05-18 18:57:06 +00001738 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd);
1739 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd);
1740 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001741
hasso508e53e2004-05-18 18:57:06 +00001742 install_element (CONFIG_NODE, &interface_cmd);
paul718e3742002-12-13 20:15:29 +00001743 install_default (INTERFACE_NODE);
1744 install_element (INTERFACE_NODE, &interface_desc_cmd);
1745 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
1746 install_element (INTERFACE_NODE, &ipv6_ospf6_cost_cmd);
hassob596c712004-07-09 18:33:43 +00001747 install_element (INTERFACE_NODE, &ipv6_ospf6_ifmtu_cmd);
hasso049207c2004-08-04 20:02:13 +00001748 install_element (INTERFACE_NODE, &no_ipv6_ospf6_ifmtu_cmd);
paul718e3742002-12-13 20:15:29 +00001749 install_element (INTERFACE_NODE, &ipv6_ospf6_deadinterval_cmd);
1750 install_element (INTERFACE_NODE, &ipv6_ospf6_hellointerval_cmd);
1751 install_element (INTERFACE_NODE, &ipv6_ospf6_priority_cmd);
1752 install_element (INTERFACE_NODE, &ipv6_ospf6_retransmitinterval_cmd);
1753 install_element (INTERFACE_NODE, &ipv6_ospf6_transmitdelay_cmd);
1754 install_element (INTERFACE_NODE, &ipv6_ospf6_instance_cmd);
hasso508e53e2004-05-18 18:57:06 +00001755
paul718e3742002-12-13 20:15:29 +00001756 install_element (INTERFACE_NODE, &ipv6_ospf6_passive_cmd);
1757 install_element (INTERFACE_NODE, &no_ipv6_ospf6_passive_cmd);
hasso508e53e2004-05-18 18:57:06 +00001758
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +04001759 install_element (INTERFACE_NODE, &ipv6_ospf6_mtu_ignore_cmd);
1760 install_element (INTERFACE_NODE, &no_ipv6_ospf6_mtu_ignore_cmd);
1761
hasso508e53e2004-05-18 18:57:06 +00001762 install_element (INTERFACE_NODE, &ipv6_ospf6_advertise_prefix_list_cmd);
1763 install_element (INTERFACE_NODE, &no_ipv6_ospf6_advertise_prefix_list_cmd);
Dinesh Duttc5926a92013-08-24 07:55:00 +00001764
1765 install_element (INTERFACE_NODE, &ipv6_ospf6_network_cmd);
1766 install_element (INTERFACE_NODE, &no_ipv6_ospf6_network_cmd);
hasso508e53e2004-05-18 18:57:06 +00001767}
1768
1769DEFUN (debug_ospf6_interface,
1770 debug_ospf6_interface_cmd,
1771 "debug ospf6 interface",
1772 DEBUG_STR
1773 OSPF6_STR
1774 "Debug OSPFv3 Interface\n"
1775 )
1776{
1777 OSPF6_DEBUG_INTERFACE_ON ();
1778 return CMD_SUCCESS;
1779}
1780
1781DEFUN (no_debug_ospf6_interface,
1782 no_debug_ospf6_interface_cmd,
1783 "no debug ospf6 interface",
1784 NO_STR
1785 DEBUG_STR
1786 OSPF6_STR
1787 "Debug OSPFv3 Interface\n"
1788 )
1789{
hasso3b687352004-08-19 06:56:53 +00001790 OSPF6_DEBUG_INTERFACE_OFF ();
hasso508e53e2004-05-18 18:57:06 +00001791 return CMD_SUCCESS;
1792}
1793
1794int
1795config_write_ospf6_debug_interface (struct vty *vty)
1796{
1797 if (IS_OSPF6_DEBUG_INTERFACE)
hasso049207c2004-08-04 20:02:13 +00001798 vty_out (vty, "debug ospf6 interface%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001799 return 0;
1800}
1801
1802void
Paul Jakma6ac29a52008-08-15 13:45:30 +01001803install_element_ospf6_debug_interface (void)
hasso508e53e2004-05-18 18:57:06 +00001804{
1805 install_element (ENABLE_NODE, &debug_ospf6_interface_cmd);
1806 install_element (ENABLE_NODE, &no_debug_ospf6_interface_cmd);
1807 install_element (CONFIG_NODE, &debug_ospf6_interface_cmd);
1808 install_element (CONFIG_NODE, &no_debug_ospf6_interface_cmd);
paul718e3742002-12-13 20:15:29 +00001809}
1810
1811