blob: b0f11194acc2e6fab319daaf85b63e691a0f2bc6 [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);
Christian Franked9628722013-03-08 21:47:35 +0100222 ospf6_interface_state_update (oi->interface);
hasso508e53e2004-05-18 18:57:06 +0000223}
224
225void
226ospf6_interface_disable (struct ospf6_interface *oi)
227{
hasso508e53e2004-05-18 18:57:06 +0000228 SET_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE);
229
Christian Franked9628722013-03-08 21:47:35 +0100230 thread_execute (master, interface_down, oi, 0);
hasso508e53e2004-05-18 18:57:06 +0000231
232 ospf6_lsdb_remove_all (oi->lsdb);
Christian Franked9628722013-03-08 21:47:35 +0100233 ospf6_lsdb_remove_all (oi->lsdb_self);
hasso508e53e2004-05-18 18:57:06 +0000234 ospf6_lsdb_remove_all (oi->lsupdate_list);
235 ospf6_lsdb_remove_all (oi->lsack_list);
236
237 THREAD_OFF (oi->thread_send_hello);
238 THREAD_OFF (oi->thread_send_lsupdate);
239 THREAD_OFF (oi->thread_send_lsack);
Christian Franked9628722013-03-08 21:47:35 +0100240
241 THREAD_OFF (oi->thread_network_lsa);
242 THREAD_OFF (oi->thread_link_lsa);
243 THREAD_OFF (oi->thread_intra_prefix_lsa);
paul718e3742002-12-13 20:15:29 +0000244}
245
246static struct in6_addr *
hasso508e53e2004-05-18 18:57:06 +0000247ospf6_interface_get_linklocal_address (struct interface *ifp)
paul718e3742002-12-13 20:15:29 +0000248{
hasso52dc7ee2004-09-23 19:18:23 +0000249 struct listnode *n;
paul718e3742002-12-13 20:15:29 +0000250 struct connected *c;
251 struct in6_addr *l = (struct in6_addr *) NULL;
252
253 /* for each connected address */
paul1eb8ef22005-04-07 07:30:20 +0000254 for (ALL_LIST_ELEMENTS_RO (ifp->connected, n, c))
paul718e3742002-12-13 20:15:29 +0000255 {
paul718e3742002-12-13 20:15:29 +0000256 /* if family not AF_INET6, ignore */
257 if (c->address->family != AF_INET6)
258 continue;
259
260 /* linklocal scope check */
261 if (IN6_IS_ADDR_LINKLOCAL (&c->address->u.prefix6))
262 l = &c->address->u.prefix6;
263 }
264 return l;
265}
266
267void
268ospf6_interface_if_add (struct interface *ifp)
269{
hasso508e53e2004-05-18 18:57:06 +0000270 struct ospf6_interface *oi;
paul0c083ee2004-10-10 12:54:58 +0000271 unsigned int iobuflen;
paul718e3742002-12-13 20:15:29 +0000272
hasso508e53e2004-05-18 18:57:06 +0000273 oi = (struct ospf6_interface *) ifp->info;
274 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000275 return;
276
hassob596c712004-07-09 18:33:43 +0000277 /* Try to adjust I/O buffer size with IfMtu */
278 if (oi->ifmtu == 0)
hasso1203e1c2004-07-23 21:34:27 +0000279 oi->ifmtu = ifp->mtu6;
280 iobuflen = ospf6_iobuf_size (ifp->mtu6);
hassob596c712004-07-09 18:33:43 +0000281 if (oi->ifmtu > iobuflen)
hasso3b4cd3a2004-05-18 19:28:32 +0000282 {
hasso1e058382004-09-01 21:36:14 +0000283 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000284 zlog_debug ("Interface %s: IfMtu is adjusted to I/O buffer size: %d.",
285 ifp->name, iobuflen);
hasso3b4cd3a2004-05-18 19:28:32 +0000286 oi->ifmtu = iobuflen;
287 }
paul718e3742002-12-13 20:15:29 +0000288
289 /* interface start */
Christian Frankeb13c1d92012-12-13 16:11:16 +0100290 ospf6_interface_state_update(oi->interface);
paul718e3742002-12-13 20:15:29 +0000291}
292
293void
294ospf6_interface_if_del (struct interface *ifp)
295{
hasso508e53e2004-05-18 18:57:06 +0000296 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000297
hasso508e53e2004-05-18 18:57:06 +0000298 oi = (struct ospf6_interface *) ifp->info;
299 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000300 return;
301
302 /* interface stop */
hasso508e53e2004-05-18 18:57:06 +0000303 if (oi->area)
304 thread_execute (master, interface_down, oi, 0);
paul718e3742002-12-13 20:15:29 +0000305
hasso508e53e2004-05-18 18:57:06 +0000306 listnode_delete (oi->area->if_list, oi);
307 oi->area = (struct ospf6_area *) NULL;
paul718e3742002-12-13 20:15:29 +0000308
309 /* cut link */
hasso508e53e2004-05-18 18:57:06 +0000310 oi->interface = NULL;
paul718e3742002-12-13 20:15:29 +0000311 ifp->info = NULL;
312
hasso508e53e2004-05-18 18:57:06 +0000313 ospf6_interface_delete (oi);
paul718e3742002-12-13 20:15:29 +0000314}
315
316void
317ospf6_interface_state_update (struct interface *ifp)
318{
hasso508e53e2004-05-18 18:57:06 +0000319 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000320
hasso508e53e2004-05-18 18:57:06 +0000321 oi = (struct ospf6_interface *) ifp->info;
322 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000323 return;
hasso508e53e2004-05-18 18:57:06 +0000324 if (oi->area == NULL)
paul718e3742002-12-13 20:15:29 +0000325 return;
Christian Franked9628722013-03-08 21:47:35 +0100326 if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE))
327 return;
paul718e3742002-12-13 20:15:29 +0000328
Christian Frankeb13c1d92012-12-13 16:11:16 +0100329 if (if_is_operative (ifp)
330 && (ospf6_interface_get_linklocal_address(oi->interface)
331 || if_is_loopback(oi->interface)))
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
Christian Franked9628722013-03-08 21:47:35 +0100358 if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE))
359 return;
360
hasso508e53e2004-05-18 18:57:06 +0000361 /* update "route to advertise" interface route table */
362 ospf6_route_remove_all (oi->route_connected);
hasso508e53e2004-05-18 18:57:06 +0000363
paul1eb8ef22005-04-07 07:30:20 +0000364 for (ALL_LIST_ELEMENTS (oi->interface->connected, node, nnode, c))
365 {
hasso508e53e2004-05-18 18:57:06 +0000366 if (c->address->family != AF_INET6)
367 continue;
368
hasso1e058382004-09-01 21:36:14 +0000369 CONTINUE_IF_ADDRESS_LINKLOCAL (IS_OSPF6_DEBUG_INTERFACE, c->address);
370 CONTINUE_IF_ADDRESS_UNSPECIFIED (IS_OSPF6_DEBUG_INTERFACE, c->address);
371 CONTINUE_IF_ADDRESS_LOOPBACK (IS_OSPF6_DEBUG_INTERFACE, c->address);
372 CONTINUE_IF_ADDRESS_V4COMPAT (IS_OSPF6_DEBUG_INTERFACE, c->address);
373 CONTINUE_IF_ADDRESS_V4MAPPED (IS_OSPF6_DEBUG_INTERFACE, c->address);
hasso508e53e2004-05-18 18:57:06 +0000374
375 /* apply filter */
376 if (oi->plist_name)
377 {
378 struct prefix_list *plist;
379 enum prefix_list_type ret;
380 char buf[128];
381
382 prefix2str (c->address, buf, sizeof (buf));
383 plist = prefix_list_lookup (AFI_IP6, oi->plist_name);
384 ret = prefix_list_apply (plist, (void *) c->address);
385 if (ret == PREFIX_DENY)
386 {
hasso1e058382004-09-01 21:36:14 +0000387 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000388 zlog_debug ("%s on %s filtered by prefix-list %s ",
389 buf, oi->interface->name, oi->plist_name);
hasso508e53e2004-05-18 18:57:06 +0000390 continue;
391 }
392 }
393
394 route = ospf6_route_create ();
395 memcpy (&route->prefix, c->address, sizeof (struct prefix));
396 apply_mask (&route->prefix);
397 route->type = OSPF6_DEST_TYPE_NETWORK;
398 route->path.area_id = oi->area->area_id;
399 route->path.type = OSPF6_PATH_TYPE_INTRA;
400 route->path.cost = oi->cost;
401 route->nexthop[0].ifindex = oi->interface->ifindex;
402 inet_pton (AF_INET6, "::1", &route->nexthop[0].address);
403 ospf6_route_add (route, oi->route_connected);
404 }
405
paul718e3742002-12-13 20:15:29 +0000406 /* create new Link-LSA */
hasso508e53e2004-05-18 18:57:06 +0000407 OSPF6_LINK_LSA_SCHEDULE (oi);
408 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
409 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
paul718e3742002-12-13 20:15:29 +0000410}
411
hasso508e53e2004-05-18 18:57:06 +0000412static void
413ospf6_interface_state_change (u_char next_state, struct ospf6_interface *oi)
paul718e3742002-12-13 20:15:29 +0000414{
hasso508e53e2004-05-18 18:57:06 +0000415 u_char prev_state;
paul718e3742002-12-13 20:15:29 +0000416
hasso508e53e2004-05-18 18:57:06 +0000417 prev_state = oi->state;
418 oi->state = next_state;
paul718e3742002-12-13 20:15:29 +0000419
hasso508e53e2004-05-18 18:57:06 +0000420 if (prev_state == next_state)
421 return;
paul718e3742002-12-13 20:15:29 +0000422
hasso508e53e2004-05-18 18:57:06 +0000423 /* log */
424 if (IS_OSPF6_DEBUG_INTERFACE)
paul718e3742002-12-13 20:15:29 +0000425 {
hassoc6487d62004-12-24 06:00:11 +0000426 zlog_debug ("Interface state change %s: %s -> %s", oi->interface->name,
427 ospf6_interface_state_str[prev_state],
428 ospf6_interface_state_str[next_state]);
paul718e3742002-12-13 20:15:29 +0000429 }
Vincent Bernat3bc4f842012-06-04 11:40:04 +0200430 oi->state_change++;
paul718e3742002-12-13 20:15:29 +0000431
hasso508e53e2004-05-18 18:57:06 +0000432 if ((prev_state == OSPF6_INTERFACE_DR ||
433 prev_state == OSPF6_INTERFACE_BDR) &&
434 (next_state != OSPF6_INTERFACE_DR &&
435 next_state != OSPF6_INTERFACE_BDR))
Vyacheslav Trushkin9a9446e2011-11-21 20:26:39 +0400436 ospf6_sso (oi->interface->ifindex, &alldrouters6, IPV6_LEAVE_GROUP);
Dinesh Duttc5926a92013-08-24 07:55:00 +0000437
hasso508e53e2004-05-18 18:57:06 +0000438 if ((prev_state != OSPF6_INTERFACE_DR &&
439 prev_state != OSPF6_INTERFACE_BDR) &&
440 (next_state == OSPF6_INTERFACE_DR ||
441 next_state == OSPF6_INTERFACE_BDR))
Vyacheslav Trushkin9a9446e2011-11-21 20:26:39 +0400442 ospf6_sso (oi->interface->ifindex, &alldrouters6, IPV6_JOIN_GROUP);
paul718e3742002-12-13 20:15:29 +0000443
hasso508e53e2004-05-18 18:57:06 +0000444 OSPF6_ROUTER_LSA_SCHEDULE (oi->area);
hasso6452df02004-08-15 05:52:07 +0000445 if (next_state == OSPF6_INTERFACE_DOWN)
446 {
447 OSPF6_NETWORK_LSA_EXECUTE (oi);
448 OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT (oi);
449 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
450 }
451 else if (prev_state == OSPF6_INTERFACE_DR ||
452 next_state == OSPF6_INTERFACE_DR)
paul718e3742002-12-13 20:15:29 +0000453 {
hasso508e53e2004-05-18 18:57:06 +0000454 OSPF6_NETWORK_LSA_SCHEDULE (oi);
455 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
456 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
paul718e3742002-12-13 20:15:29 +0000457 }
Vincent Bernatbf836662012-06-04 14:36:12 +0200458
459#ifdef HAVE_SNMP
460 /* Terminal state or regression */
461 if ((next_state == OSPF6_INTERFACE_POINTTOPOINT) ||
462 (next_state == OSPF6_INTERFACE_DROTHER) ||
463 (next_state == OSPF6_INTERFACE_BDR) ||
464 (next_state == OSPF6_INTERFACE_DR) ||
465 (next_state < prev_state))
466 ospf6TrapIfStateChange (oi);
467#endif
468
hasso508e53e2004-05-18 18:57:06 +0000469}
470
471
472/* DR Election, RFC2328 section 9.4 */
473
474#define IS_ELIGIBLE(n) \
475 ((n)->state >= OSPF6_NEIGHBOR_TWOWAY && (n)->priority != 0)
476
477static struct ospf6_neighbor *
478better_bdrouter (struct ospf6_neighbor *a, struct ospf6_neighbor *b)
479{
480 if ((a == NULL || ! IS_ELIGIBLE (a) || a->drouter == a->router_id) &&
481 (b == NULL || ! IS_ELIGIBLE (b) || b->drouter == b->router_id))
482 return NULL;
483 else if (a == NULL || ! IS_ELIGIBLE (a) || a->drouter == a->router_id)
484 return b;
485 else if (b == NULL || ! IS_ELIGIBLE (b) || b->drouter == b->router_id)
486 return a;
487
488 if (a->bdrouter == a->router_id && b->bdrouter != b->router_id)
489 return a;
490 if (a->bdrouter != a->router_id && b->bdrouter == b->router_id)
491 return b;
492
493 if (a->priority > b->priority)
494 return a;
495 if (a->priority < b->priority)
496 return b;
497
498 if (ntohl (a->router_id) > ntohl (b->router_id))
499 return a;
500 if (ntohl (a->router_id) < ntohl (b->router_id))
501 return b;
502
503 zlog_warn ("Router-ID duplicate ?");
504 return a;
505}
506
507static struct ospf6_neighbor *
508better_drouter (struct ospf6_neighbor *a, struct ospf6_neighbor *b)
509{
510 if ((a == NULL || ! IS_ELIGIBLE (a) || a->drouter != a->router_id) &&
511 (b == NULL || ! IS_ELIGIBLE (b) || b->drouter != b->router_id))
512 return NULL;
513 else if (a == NULL || ! IS_ELIGIBLE (a) || a->drouter != a->router_id)
514 return b;
515 else if (b == NULL || ! IS_ELIGIBLE (b) || b->drouter != b->router_id)
516 return a;
517
518 if (a->drouter == a->router_id && b->drouter != b->router_id)
519 return a;
520 if (a->drouter != a->router_id && b->drouter == b->router_id)
521 return b;
522
523 if (a->priority > b->priority)
524 return a;
525 if (a->priority < b->priority)
526 return b;
527
528 if (ntohl (a->router_id) > ntohl (b->router_id))
529 return a;
530 if (ntohl (a->router_id) < ntohl (b->router_id))
531 return b;
532
533 zlog_warn ("Router-ID duplicate ?");
534 return a;
535}
536
537static u_char
538dr_election (struct ospf6_interface *oi)
539{
paul1eb8ef22005-04-07 07:30:20 +0000540 struct listnode *node, *nnode;
hasso508e53e2004-05-18 18:57:06 +0000541 struct ospf6_neighbor *on, *drouter, *bdrouter, myself;
542 struct ospf6_neighbor *best_drouter, *best_bdrouter;
543 u_char next_state = 0;
544
545 drouter = bdrouter = NULL;
546 best_drouter = best_bdrouter = NULL;
547
548 /* pseudo neighbor myself, including noting current DR/BDR (1) */
549 memset (&myself, 0, sizeof (myself));
550 inet_ntop (AF_INET, &oi->area->ospf6->router_id, myself.name,
551 sizeof (myself.name));
552 myself.state = OSPF6_NEIGHBOR_TWOWAY;
553 myself.drouter = oi->drouter;
554 myself.bdrouter = oi->bdrouter;
555 myself.priority = oi->priority;
556 myself.router_id = oi->area->ospf6->router_id;
557
558 /* Electing BDR (2) */
paul1eb8ef22005-04-07 07:30:20 +0000559 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
560 bdrouter = better_bdrouter (bdrouter, on);
561
hasso508e53e2004-05-18 18:57:06 +0000562 best_bdrouter = bdrouter;
563 bdrouter = better_bdrouter (best_bdrouter, &myself);
564
565 /* Electing DR (3) */
paul1eb8ef22005-04-07 07:30:20 +0000566 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
567 drouter = better_drouter (drouter, on);
568
hasso508e53e2004-05-18 18:57:06 +0000569 best_drouter = drouter;
570 drouter = better_drouter (best_drouter, &myself);
571 if (drouter == NULL)
572 drouter = bdrouter;
573
574 /* the router itself is newly/no longer DR/BDR (4) */
575 if ((drouter == &myself && myself.drouter != myself.router_id) ||
576 (drouter != &myself && myself.drouter == myself.router_id) ||
577 (bdrouter == &myself && myself.bdrouter != myself.router_id) ||
578 (bdrouter != &myself && myself.bdrouter == myself.router_id))
579 {
580 myself.drouter = (drouter ? drouter->router_id : htonl (0));
581 myself.bdrouter = (bdrouter ? bdrouter->router_id : htonl (0));
582
583 /* compatible to Electing BDR (2) */
584 bdrouter = better_bdrouter (best_bdrouter, &myself);
585
586 /* compatible to Electing DR (3) */
587 drouter = better_drouter (best_drouter, &myself);
588 if (drouter == NULL)
589 drouter = bdrouter;
590 }
591
592 /* Set interface state accordingly (5) */
593 if (drouter && drouter == &myself)
594 next_state = OSPF6_INTERFACE_DR;
595 else if (bdrouter && bdrouter == &myself)
596 next_state = OSPF6_INTERFACE_BDR;
597 else
598 next_state = OSPF6_INTERFACE_DROTHER;
599
600 /* If NBMA, schedule Start for each neighbor having priority of 0 (6) */
601 /* XXX */
602
603 /* If DR or BDR change, invoke AdjOK? for each neighbor (7) */
604 /* RFC 2328 section 12.4. Originating LSAs (3) will be handled
605 accordingly after AdjOK */
606 if (oi->drouter != (drouter ? drouter->router_id : htonl (0)) ||
607 oi->bdrouter != (bdrouter ? bdrouter->router_id : htonl (0)))
608 {
609 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000610 zlog_debug ("DR Election on %s: DR: %s BDR: %s", oi->interface->name,
611 (drouter ? drouter->name : "0.0.0.0"),
612 (bdrouter ? bdrouter->name : "0.0.0.0"));
hasso508e53e2004-05-18 18:57:06 +0000613
paul1eb8ef22005-04-07 07:30:20 +0000614 for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, node, on))
hasso508e53e2004-05-18 18:57:06 +0000615 {
hasso508e53e2004-05-18 18:57:06 +0000616 if (on->state < OSPF6_NEIGHBOR_TWOWAY)
617 continue;
618 /* Schedule AdjOK. */
619 thread_add_event (master, adj_ok, on, 0);
620 }
621 }
622
623 oi->drouter = (drouter ? drouter->router_id : htonl (0));
624 oi->bdrouter = (bdrouter ? bdrouter->router_id : htonl (0));
625 return next_state;
626}
627
628
629/* Interface State Machine */
630int
631interface_up (struct thread *thread)
632{
633 struct ospf6_interface *oi;
634
635 oi = (struct ospf6_interface *) THREAD_ARG (thread);
636 assert (oi && oi->interface);
637
638 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000639 zlog_debug ("Interface Event %s: [InterfaceUp]",
640 oi->interface->name);
hasso508e53e2004-05-18 18:57:06 +0000641
642 /* check physical interface is up */
Dinesh Dutte7ad6b22013-08-24 07:55:57 +0000643 if (! if_is_operative (oi->interface))
hasso508e53e2004-05-18 18:57:06 +0000644 {
645 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000646 zlog_debug ("Interface %s is down, can't execute [InterfaceUp]",
647 oi->interface->name);
hasso508e53e2004-05-18 18:57:06 +0000648 return 0;
649 }
650
Christian Frankeb13c1d92012-12-13 16:11:16 +0100651 /* check interface has a link-local address */
652 if (! (ospf6_interface_get_linklocal_address(oi->interface)
653 || if_is_loopback(oi->interface)))
654 {
655 if (IS_OSPF6_DEBUG_INTERFACE)
656 zlog_debug ("Interface %s has no link local address, can't execute [InterfaceUp]",
657 oi->interface->name);
658 return 0;
659 }
660
hasso508e53e2004-05-18 18:57:06 +0000661 /* if already enabled, do nothing */
662 if (oi->state > OSPF6_INTERFACE_DOWN)
663 {
664 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000665 zlog_debug ("Interface %s already enabled",
666 oi->interface->name);
hasso508e53e2004-05-18 18:57:06 +0000667 return 0;
668 }
669
Dinesh Duttba960d52013-08-26 03:40:37 +0000670 /* If no area assigned, return */
671 if (oi->area == NULL)
672 {
673 zlog_debug ("%s: Not scheduleing Hello for %s as there is no area assigned yet", __func__,
674 oi->interface->name);
675 return 0;
676 }
677
hasso508e53e2004-05-18 18:57:06 +0000678 /* Join AllSPFRouters */
Vyacheslav Trushkin9a9446e2011-11-21 20:26:39 +0400679 ospf6_sso (oi->interface->ifindex, &allspfrouters6, IPV6_JOIN_GROUP);
hasso508e53e2004-05-18 18:57:06 +0000680
681 /* Update interface route */
682 ospf6_interface_connected_route_update (oi->interface);
683
684 /* Schedule Hello */
685 if (! CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE))
David Lamparter424cc3b2013-11-23 16:55:36 +0100686 oi->thread_send_hello = thread_add_event (master, ospf6_hello_send, oi, 0);
hasso508e53e2004-05-18 18:57:06 +0000687
688 /* decide next interface state */
Dinesh Duttc5926a92013-08-24 07:55:00 +0000689 if ((if_is_pointopoint (oi->interface)) ||
690 (oi->type == OSPF_IFTYPE_POINTOPOINT)) {
hasso508e53e2004-05-18 18:57:06 +0000691 ospf6_interface_state_change (OSPF6_INTERFACE_POINTTOPOINT, oi);
Dinesh Duttc5926a92013-08-24 07:55:00 +0000692 }
hasso508e53e2004-05-18 18:57:06 +0000693 else if (oi->priority == 0)
694 ospf6_interface_state_change (OSPF6_INTERFACE_DROTHER, oi);
695 else
696 {
697 ospf6_interface_state_change (OSPF6_INTERFACE_WAITING, oi);
698 thread_add_timer (master, wait_timer, oi, oi->dead_interval);
699 }
700
701 return 0;
paul718e3742002-12-13 20:15:29 +0000702}
703
704int
hasso508e53e2004-05-18 18:57:06 +0000705wait_timer (struct thread *thread)
paul718e3742002-12-13 20:15:29 +0000706{
hasso508e53e2004-05-18 18:57:06 +0000707 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000708
hasso508e53e2004-05-18 18:57:06 +0000709 oi = (struct ospf6_interface *) THREAD_ARG (thread);
710 assert (oi && oi->interface);
paul718e3742002-12-13 20:15:29 +0000711
hasso508e53e2004-05-18 18:57:06 +0000712 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000713 zlog_debug ("Interface Event %s: [WaitTimer]",
714 oi->interface->name);
paul718e3742002-12-13 20:15:29 +0000715
hasso508e53e2004-05-18 18:57:06 +0000716 if (oi->state == OSPF6_INTERFACE_WAITING)
717 ospf6_interface_state_change (dr_election (oi), oi);
paul718e3742002-12-13 20:15:29 +0000718
hasso508e53e2004-05-18 18:57:06 +0000719 return 0;
paul718e3742002-12-13 20:15:29 +0000720}
721
hasso508e53e2004-05-18 18:57:06 +0000722int
723backup_seen (struct thread *thread)
paul718e3742002-12-13 20:15:29 +0000724{
hasso508e53e2004-05-18 18:57:06 +0000725 struct ospf6_interface *oi;
726
727 oi = (struct ospf6_interface *) THREAD_ARG (thread);
728 assert (oi && oi->interface);
729
730 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000731 zlog_debug ("Interface Event %s: [BackupSeen]",
732 oi->interface->name);
hasso508e53e2004-05-18 18:57:06 +0000733
734 if (oi->state == OSPF6_INTERFACE_WAITING)
735 ospf6_interface_state_change (dr_election (oi), oi);
736
737 return 0;
paul718e3742002-12-13 20:15:29 +0000738}
739
hasso508e53e2004-05-18 18:57:06 +0000740int
741neighbor_change (struct thread *thread)
paul718e3742002-12-13 20:15:29 +0000742{
hasso508e53e2004-05-18 18:57:06 +0000743 struct ospf6_interface *oi;
744
745 oi = (struct ospf6_interface *) THREAD_ARG (thread);
746 assert (oi && oi->interface);
747
748 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000749 zlog_debug ("Interface Event %s: [NeighborChange]",
750 oi->interface->name);
hasso508e53e2004-05-18 18:57:06 +0000751
752 if (oi->state == OSPF6_INTERFACE_DROTHER ||
753 oi->state == OSPF6_INTERFACE_BDR ||
754 oi->state == OSPF6_INTERFACE_DR)
755 ospf6_interface_state_change (dr_election (oi), oi);
756
757 return 0;
paul718e3742002-12-13 20:15:29 +0000758}
759
hasso508e53e2004-05-18 18:57:06 +0000760int
761interface_down (struct thread *thread)
762{
763 struct ospf6_interface *oi;
paul1eb8ef22005-04-07 07:30:20 +0000764 struct listnode *node, *nnode;
hasso508e53e2004-05-18 18:57:06 +0000765 struct ospf6_neighbor *on;
766
767 oi = (struct ospf6_interface *) THREAD_ARG (thread);
768 assert (oi && oi->interface);
769
770 if (IS_OSPF6_DEBUG_INTERFACE)
hassoc6487d62004-12-24 06:00:11 +0000771 zlog_debug ("Interface Event %s: [InterfaceDown]",
772 oi->interface->name);
hasso508e53e2004-05-18 18:57:06 +0000773
David Lamparter424cc3b2013-11-23 16:55:36 +0100774 /* Stop Hellos */
775 THREAD_OFF (oi->thread_send_hello);
776
hasso508e53e2004-05-18 18:57:06 +0000777 /* Leave AllSPFRouters */
778 if (oi->state > OSPF6_INTERFACE_DOWN)
Vyacheslav Trushkin9a9446e2011-11-21 20:26:39 +0400779 ospf6_sso (oi->interface->ifindex, &allspfrouters6, IPV6_LEAVE_GROUP);
hasso508e53e2004-05-18 18:57:06 +0000780
781 ospf6_interface_state_change (OSPF6_INTERFACE_DOWN, oi);
782
paul1eb8ef22005-04-07 07:30:20 +0000783 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
784 ospf6_neighbor_delete (on);
785
hasso508e53e2004-05-18 18:57:06 +0000786 list_delete_all_node (oi->neighbor_list);
787
Christian Franke37531a72012-12-13 13:50:28 +0100788 /* When interface state is reset, also reset information about
789 * DR election, as it is no longer valid. */
790 oi->drouter = oi->prev_drouter = htonl(0);
791 oi->bdrouter = oi->prev_bdrouter = htonl(0);
hasso508e53e2004-05-18 18:57:06 +0000792 return 0;
793}
794
795
paul718e3742002-12-13 20:15:29 +0000796/* show specified interface structure */
Paul Jakma6ac29a52008-08-15 13:45:30 +0100797static int
hasso508e53e2004-05-18 18:57:06 +0000798ospf6_interface_show (struct vty *vty, struct interface *ifp)
paul718e3742002-12-13 20:15:29 +0000799{
hasso508e53e2004-05-18 18:57:06 +0000800 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000801 struct connected *c;
802 struct prefix *p;
hasso52dc7ee2004-09-23 19:18:23 +0000803 struct listnode *i;
hasso508e53e2004-05-18 18:57:06 +0000804 char strbuf[64], drouter[32], bdrouter[32];
paul0c083ee2004-10-10 12:54:58 +0000805 const char *updown[3] = {"down", "up", NULL};
806 const char *type;
hasso508e53e2004-05-18 18:57:06 +0000807 struct timeval res, now;
808 char duration[32];
809 struct ospf6_lsa *lsa;
paul718e3742002-12-13 20:15:29 +0000810
811 /* check physical interface type */
hasso508e53e2004-05-18 18:57:06 +0000812 if (if_is_loopback (ifp))
paul718e3742002-12-13 20:15:29 +0000813 type = "LOOPBACK";
hasso508e53e2004-05-18 18:57:06 +0000814 else if (if_is_broadcast (ifp))
paul718e3742002-12-13 20:15:29 +0000815 type = "BROADCAST";
hasso508e53e2004-05-18 18:57:06 +0000816 else if (if_is_pointopoint (ifp))
paul718e3742002-12-13 20:15:29 +0000817 type = "POINTOPOINT";
818 else
819 type = "UNKNOWN";
820
821 vty_out (vty, "%s is %s, type %s%s",
Dinesh Dutte7ad6b22013-08-24 07:55:57 +0000822 ifp->name, updown[if_is_operative (ifp)], type,
hasso049207c2004-08-04 20:02:13 +0000823 VNL);
824 vty_out (vty, " Interface ID: %d%s", ifp->ifindex, VNL);
paul718e3742002-12-13 20:15:29 +0000825
hasso508e53e2004-05-18 18:57:06 +0000826 if (ifp->info == NULL)
paul718e3742002-12-13 20:15:29 +0000827 {
hasso049207c2004-08-04 20:02:13 +0000828 vty_out (vty, " OSPF not enabled on this interface%s", VNL);
paul718e3742002-12-13 20:15:29 +0000829 return 0;
830 }
831 else
hasso508e53e2004-05-18 18:57:06 +0000832 oi = (struct ospf6_interface *) ifp->info;
paul718e3742002-12-13 20:15:29 +0000833
hasso049207c2004-08-04 20:02:13 +0000834 vty_out (vty, " Internet Address:%s", VNL);
paul1eb8ef22005-04-07 07:30:20 +0000835
836 for (ALL_LIST_ELEMENTS_RO (ifp->connected, i, c))
paul718e3742002-12-13 20:15:29 +0000837 {
paul718e3742002-12-13 20:15:29 +0000838 p = c->address;
839 prefix2str (p, strbuf, sizeof (strbuf));
840 switch (p->family)
841 {
842 case AF_INET:
hasso508e53e2004-05-18 18:57:06 +0000843 vty_out (vty, " inet : %s%s", strbuf,
hasso049207c2004-08-04 20:02:13 +0000844 VNL);
paul718e3742002-12-13 20:15:29 +0000845 break;
846 case AF_INET6:
hasso508e53e2004-05-18 18:57:06 +0000847 vty_out (vty, " inet6: %s%s", strbuf,
hasso049207c2004-08-04 20:02:13 +0000848 VNL);
paul718e3742002-12-13 20:15:29 +0000849 break;
850 default:
hasso508e53e2004-05-18 18:57:06 +0000851 vty_out (vty, " ??? : %s%s", strbuf,
hasso049207c2004-08-04 20:02:13 +0000852 VNL);
paul718e3742002-12-13 20:15:29 +0000853 break;
854 }
855 }
856
hasso508e53e2004-05-18 18:57:06 +0000857 if (oi->area)
paul718e3742002-12-13 20:15:29 +0000858 {
hasso508e53e2004-05-18 18:57:06 +0000859 vty_out (vty, " Instance ID %d, Interface MTU %d (autodetect: %d)%s",
hasso049207c2004-08-04 20:02:13 +0000860 oi->instance_id, oi->ifmtu, ifp->mtu6, VNL);
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +0400861 vty_out (vty, " MTU mismatch detection: %s%s", oi->mtu_ignore ?
862 "disabled" : "enabled", VNL);
hasso508e53e2004-05-18 18:57:06 +0000863 inet_ntop (AF_INET, &oi->area->area_id,
paul718e3742002-12-13 20:15:29 +0000864 strbuf, sizeof (strbuf));
hasso508e53e2004-05-18 18:57:06 +0000865 vty_out (vty, " Area ID %s, Cost %hu%s", strbuf, oi->cost,
hasso049207c2004-08-04 20:02:13 +0000866 VNL);
paul718e3742002-12-13 20:15:29 +0000867 }
868 else
hasso049207c2004-08-04 20:02:13 +0000869 vty_out (vty, " Not Attached to Area%s", VNL);
paul718e3742002-12-13 20:15:29 +0000870
871 vty_out (vty, " State %s, Transmit Delay %d sec, Priority %d%s",
hasso508e53e2004-05-18 18:57:06 +0000872 ospf6_interface_state_str[oi->state],
873 oi->transdelay, oi->priority,
hasso049207c2004-08-04 20:02:13 +0000874 VNL);
875 vty_out (vty, " Timer intervals configured:%s", VNL);
paul718e3742002-12-13 20:15:29 +0000876 vty_out (vty, " Hello %d, Dead %d, Retransmit %d%s",
hasso508e53e2004-05-18 18:57:06 +0000877 oi->hello_interval, oi->dead_interval, oi->rxmt_interval,
hasso049207c2004-08-04 20:02:13 +0000878 VNL);
paul718e3742002-12-13 20:15:29 +0000879
hasso508e53e2004-05-18 18:57:06 +0000880 inet_ntop (AF_INET, &oi->drouter, drouter, sizeof (drouter));
881 inet_ntop (AF_INET, &oi->bdrouter, bdrouter, sizeof (bdrouter));
hasso049207c2004-08-04 20:02:13 +0000882 vty_out (vty, " DR: %s BDR: %s%s", drouter, bdrouter, VNL);
paul718e3742002-12-13 20:15:29 +0000883
884 vty_out (vty, " Number of I/F scoped LSAs is %u%s",
hasso049207c2004-08-04 20:02:13 +0000885 oi->lsdb->count, VNL);
paul718e3742002-12-13 20:15:29 +0000886
Takashi Sogabe86f72dc2009-06-22 13:07:02 +0900887 quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
paul718e3742002-12-13 20:15:29 +0000888
hasso508e53e2004-05-18 18:57:06 +0000889 timerclear (&res);
890 if (oi->thread_send_lsupdate)
891 timersub (&oi->thread_send_lsupdate->u.sands, &now, &res);
892 timerstring (&res, duration, sizeof (duration));
893 vty_out (vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]%s",
894 oi->lsupdate_list->count, duration,
895 (oi->thread_send_lsupdate ? "on" : "off"),
hasso049207c2004-08-04 20:02:13 +0000896 VNL);
hasso508e53e2004-05-18 18:57:06 +0000897 for (lsa = ospf6_lsdb_head (oi->lsupdate_list); lsa;
898 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000899 vty_out (vty, " %s%s", lsa->name, VNL);
paul718e3742002-12-13 20:15:29 +0000900
hasso508e53e2004-05-18 18:57:06 +0000901 timerclear (&res);
902 if (oi->thread_send_lsack)
903 timersub (&oi->thread_send_lsack->u.sands, &now, &res);
904 timerstring (&res, duration, sizeof (duration));
905 vty_out (vty, " %d Pending LSAs for LSAck in Time %s [thread %s]%s",
906 oi->lsack_list->count, duration,
907 (oi->thread_send_lsack ? "on" : "off"),
hasso049207c2004-08-04 20:02:13 +0000908 VNL);
hasso508e53e2004-05-18 18:57:06 +0000909 for (lsa = ospf6_lsdb_head (oi->lsack_list); lsa;
910 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000911 vty_out (vty, " %s%s", lsa->name, VNL);
paul718e3742002-12-13 20:15:29 +0000912
hasso508e53e2004-05-18 18:57:06 +0000913 return 0;
paul718e3742002-12-13 20:15:29 +0000914}
915
916/* show interface */
917DEFUN (show_ipv6_ospf6_interface,
918 show_ipv6_ospf6_interface_ifname_cmd,
919 "show ipv6 ospf6 interface IFNAME",
920 SHOW_STR
921 IP6_STR
922 OSPF6_STR
923 INTERFACE_STR
924 IFNAME_STR
925 )
926{
927 struct interface *ifp;
hasso52dc7ee2004-09-23 19:18:23 +0000928 struct listnode *i;
paul718e3742002-12-13 20:15:29 +0000929
930 if (argc)
931 {
932 ifp = if_lookup_by_name (argv[0]);
hasso508e53e2004-05-18 18:57:06 +0000933 if (ifp == NULL)
paul718e3742002-12-13 20:15:29 +0000934 {
935 vty_out (vty, "No such Interface: %s%s", argv[0],
hasso049207c2004-08-04 20:02:13 +0000936 VNL);
paul718e3742002-12-13 20:15:29 +0000937 return CMD_WARNING;
938 }
939 ospf6_interface_show (vty, ifp);
940 }
941 else
942 {
paul1eb8ef22005-04-07 07:30:20 +0000943 for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
944 ospf6_interface_show (vty, ifp);
paul718e3742002-12-13 20:15:29 +0000945 }
hasso508e53e2004-05-18 18:57:06 +0000946
paul718e3742002-12-13 20:15:29 +0000947 return CMD_SUCCESS;
948}
949
950ALIAS (show_ipv6_ospf6_interface,
951 show_ipv6_ospf6_interface_cmd,
952 "show ipv6 ospf6 interface",
953 SHOW_STR
954 IP6_STR
955 OSPF6_STR
956 INTERFACE_STR
Paul Jakma6ac29a52008-08-15 13:45:30 +0100957 )
paul718e3742002-12-13 20:15:29 +0000958
hasso508e53e2004-05-18 18:57:06 +0000959DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
960 show_ipv6_ospf6_interface_ifname_prefix_cmd,
961 "show ipv6 ospf6 interface IFNAME prefix",
962 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000963 IP6_STR
964 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +0000965 INTERFACE_STR
966 IFNAME_STR
967 "Display connected prefixes to advertise\n"
paul718e3742002-12-13 20:15:29 +0000968 )
969{
paul718e3742002-12-13 20:15:29 +0000970 struct interface *ifp;
hasso508e53e2004-05-18 18:57:06 +0000971 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000972
hasso508e53e2004-05-18 18:57:06 +0000973 ifp = if_lookup_by_name (argv[0]);
974 if (ifp == NULL)
975 {
hasso049207c2004-08-04 20:02:13 +0000976 vty_out (vty, "No such Interface: %s%s", argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000977 return CMD_WARNING;
978 }
paul718e3742002-12-13 20:15:29 +0000979
hasso508e53e2004-05-18 18:57:06 +0000980 oi = ifp->info;
981 if (oi == NULL)
982 {
hasso049207c2004-08-04 20:02:13 +0000983 vty_out (vty, "OSPFv3 is not enabled on %s%s", argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000984 return CMD_WARNING;
985 }
paul718e3742002-12-13 20:15:29 +0000986
hasso508e53e2004-05-18 18:57:06 +0000987 argc--;
988 argv++;
989 ospf6_route_table_show (vty, argc, argv, oi->route_connected);
paul718e3742002-12-13 20:15:29 +0000990
991 return CMD_SUCCESS;
992}
993
hasso508e53e2004-05-18 18:57:06 +0000994ALIAS (show_ipv6_ospf6_interface_ifname_prefix,
995 show_ipv6_ospf6_interface_ifname_prefix_detail_cmd,
996 "show ipv6 ospf6 interface IFNAME prefix (X:X::X:X|X:X::X:X/M|detail)",
997 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000998 IP6_STR
999 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001000 INTERFACE_STR
1001 IFNAME_STR
1002 "Display connected prefixes to advertise\n"
1003 OSPF6_ROUTE_ADDRESS_STR
1004 OSPF6_ROUTE_PREFIX_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +04001005 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +01001006 )
hasso508e53e2004-05-18 18:57:06 +00001007
1008ALIAS (show_ipv6_ospf6_interface_ifname_prefix,
1009 show_ipv6_ospf6_interface_ifname_prefix_match_cmd,
1010 "show ipv6 ospf6 interface IFNAME prefix X:X::X:X/M (match|detail)",
1011 SHOW_STR
1012 IP6_STR
1013 OSPF6_STR
1014 INTERFACE_STR
1015 IFNAME_STR
1016 "Display connected prefixes to advertise\n"
1017 OSPF6_ROUTE_PREFIX_STR
1018 OSPF6_ROUTE_MATCH_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +04001019 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +01001020 )
hasso508e53e2004-05-18 18:57:06 +00001021
1022DEFUN (show_ipv6_ospf6_interface_prefix,
1023 show_ipv6_ospf6_interface_prefix_cmd,
1024 "show ipv6 ospf6 interface prefix",
1025 SHOW_STR
1026 IP6_STR
1027 OSPF6_STR
1028 INTERFACE_STR
1029 "Display connected prefixes to advertise\n"
paul718e3742002-12-13 20:15:29 +00001030 )
1031{
hasso52dc7ee2004-09-23 19:18:23 +00001032 struct listnode *i;
hasso508e53e2004-05-18 18:57:06 +00001033 struct ospf6_interface *oi;
1034 struct interface *ifp;
1035
paul1eb8ef22005-04-07 07:30:20 +00001036 for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
hasso508e53e2004-05-18 18:57:06 +00001037 {
hasso508e53e2004-05-18 18:57:06 +00001038 oi = (struct ospf6_interface *) ifp->info;
1039 if (oi == NULL)
1040 continue;
1041
1042 ospf6_route_table_show (vty, argc, argv, oi->route_connected);
1043 }
1044
1045 return CMD_SUCCESS;
1046}
1047
1048ALIAS (show_ipv6_ospf6_interface_prefix,
1049 show_ipv6_ospf6_interface_prefix_detail_cmd,
1050 "show ipv6 ospf6 interface prefix (X:X::X:X|X:X::X:X/M|detail)",
1051 SHOW_STR
1052 IP6_STR
1053 OSPF6_STR
1054 INTERFACE_STR
1055 "Display connected prefixes to advertise\n"
1056 OSPF6_ROUTE_ADDRESS_STR
1057 OSPF6_ROUTE_PREFIX_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +04001058 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +01001059 )
hasso508e53e2004-05-18 18:57:06 +00001060
1061ALIAS (show_ipv6_ospf6_interface_prefix,
1062 show_ipv6_ospf6_interface_prefix_match_cmd,
1063 "show ipv6 ospf6 interface prefix X:X::X:X/M (match|detail)",
1064 SHOW_STR
1065 IP6_STR
1066 OSPF6_STR
1067 INTERFACE_STR
1068 "Display connected prefixes to advertise\n"
1069 OSPF6_ROUTE_PREFIX_STR
1070 OSPF6_ROUTE_MATCH_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +04001071 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +01001072 )
hasso508e53e2004-05-18 18:57:06 +00001073
1074
1075/* interface variable set command */
hassob596c712004-07-09 18:33:43 +00001076DEFUN (ipv6_ospf6_ifmtu,
1077 ipv6_ospf6_ifmtu_cmd,
1078 "ipv6 ospf6 ifmtu <1-65535>",
1079 IP6_STR
1080 OSPF6_STR
1081 "Interface MTU\n"
1082 "OSPFv3 Interface MTU\n"
1083 )
1084{
1085 struct ospf6_interface *oi;
1086 struct interface *ifp;
paul0c083ee2004-10-10 12:54:58 +00001087 unsigned int ifmtu, iobuflen;
paul1eb8ef22005-04-07 07:30:20 +00001088 struct listnode *node, *nnode;
hassob596c712004-07-09 18:33:43 +00001089 struct ospf6_neighbor *on;
1090
1091 ifp = (struct interface *) vty->index;
1092 assert (ifp);
1093
1094 oi = (struct ospf6_interface *) ifp->info;
1095 if (oi == NULL)
1096 oi = ospf6_interface_create (ifp);
1097 assert (oi);
1098
1099 ifmtu = strtol (argv[0], NULL, 10);
1100
1101 if (oi->ifmtu == ifmtu)
1102 return CMD_SUCCESS;
1103
hasso1203e1c2004-07-23 21:34:27 +00001104 if (ifp->mtu6 != 0 && ifp->mtu6 < ifmtu)
hassob596c712004-07-09 18:33:43 +00001105 {
1106 vty_out (vty, "%s's ospf6 ifmtu cannot go beyond physical mtu (%d)%s",
hasso049207c2004-08-04 20:02:13 +00001107 ifp->name, ifp->mtu6, VNL);
hassob596c712004-07-09 18:33:43 +00001108 return CMD_WARNING;
1109 }
1110
1111 if (oi->ifmtu < ifmtu)
1112 {
1113 iobuflen = ospf6_iobuf_size (ifmtu);
1114 if (iobuflen < ifmtu)
1115 {
1116 vty_out (vty, "%s's ifmtu is adjusted to I/O buffer size (%d).%s",
hasso049207c2004-08-04 20:02:13 +00001117 ifp->name, iobuflen, VNL);
hassob596c712004-07-09 18:33:43 +00001118 oi->ifmtu = iobuflen;
1119 }
1120 else
1121 oi->ifmtu = ifmtu;
1122 }
1123 else
1124 oi->ifmtu = ifmtu;
1125
1126 /* re-establish adjacencies */
paul1eb8ef22005-04-07 07:30:20 +00001127 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
hassob596c712004-07-09 18:33:43 +00001128 {
hassob596c712004-07-09 18:33:43 +00001129 THREAD_OFF (on->inactivity_timer);
hasso3e834b12005-06-24 07:50:12 +00001130 thread_add_event (master, inactivity_timer, on, 0);
hassob596c712004-07-09 18:33:43 +00001131 }
1132
1133 return CMD_SUCCESS;
1134}
1135
hasso049207c2004-08-04 20:02:13 +00001136DEFUN (no_ipv6_ospf6_ifmtu,
1137 no_ipv6_ospf6_ifmtu_cmd,
1138 "no ipv6 ospf6 ifmtu",
1139 NO_STR
1140 IP6_STR
1141 OSPF6_STR
1142 "Interface MTU\n"
1143 )
1144{
1145 struct ospf6_interface *oi;
1146 struct interface *ifp;
paul0c083ee2004-10-10 12:54:58 +00001147 unsigned int iobuflen;
paul1eb8ef22005-04-07 07:30:20 +00001148 struct listnode *node, *nnode;
hasso049207c2004-08-04 20:02:13 +00001149 struct ospf6_neighbor *on;
1150
1151 ifp = (struct interface *) vty->index;
1152 assert (ifp);
1153
1154 oi = (struct ospf6_interface *) ifp->info;
1155 if (oi == NULL)
1156 oi = ospf6_interface_create (ifp);
1157 assert (oi);
1158
1159 if (oi->ifmtu < ifp->mtu)
1160 {
1161 iobuflen = ospf6_iobuf_size (ifp->mtu);
1162 if (iobuflen < ifp->mtu)
1163 {
1164 vty_out (vty, "%s's ifmtu is adjusted to I/O buffer size (%d).%s",
1165 ifp->name, iobuflen, VNL);
1166 oi->ifmtu = iobuflen;
1167 }
1168 else
1169 oi->ifmtu = ifp->mtu;
1170 }
1171 else
1172 oi->ifmtu = ifp->mtu;
1173
1174 /* re-establish adjacencies */
paul1eb8ef22005-04-07 07:30:20 +00001175 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
hasso049207c2004-08-04 20:02:13 +00001176 {
hasso049207c2004-08-04 20:02:13 +00001177 THREAD_OFF (on->inactivity_timer);
hasso3e834b12005-06-24 07:50:12 +00001178 thread_add_event (master, inactivity_timer, on, 0);
hasso049207c2004-08-04 20:02:13 +00001179 }
1180
1181 return CMD_SUCCESS;
1182}
1183
hasso508e53e2004-05-18 18:57:06 +00001184DEFUN (ipv6_ospf6_cost,
1185 ipv6_ospf6_cost_cmd,
1186 "ipv6 ospf6 cost <1-65535>",
1187 IP6_STR
1188 OSPF6_STR
1189 "Interface cost\n"
1190 "Outgoing metric of this interface\n"
1191 )
1192{
1193 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001194 struct interface *ifp;
paul0c083ee2004-10-10 12:54:58 +00001195 unsigned long int lcost;
paul718e3742002-12-13 20:15:29 +00001196
1197 ifp = (struct interface *) vty->index;
1198 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001199
hasso508e53e2004-05-18 18:57:06 +00001200 oi = (struct ospf6_interface *) ifp->info;
1201 if (oi == NULL)
1202 oi = ospf6_interface_create (ifp);
1203 assert (oi);
1204
paul0c083ee2004-10-10 12:54:58 +00001205 lcost = strtol (argv[0], NULL, 10);
1206
1207 if (lcost > UINT32_MAX)
1208 {
1209 vty_out (vty, "Cost %ld is out of range%s", lcost, VNL);
1210 return CMD_WARNING;
1211 }
1212
1213 if (oi->cost == lcost)
hasso508e53e2004-05-18 18:57:06 +00001214 return CMD_SUCCESS;
paul0c083ee2004-10-10 12:54:58 +00001215
1216 oi->cost = lcost;
1217
hasso508e53e2004-05-18 18:57:06 +00001218 /* update cost held in route_connected list in ospf6_interface */
1219 ospf6_interface_connected_route_update (oi->interface);
1220
1221 /* execute LSA hooks */
1222 if (oi->area)
1223 {
1224 OSPF6_LINK_LSA_SCHEDULE (oi);
1225 OSPF6_ROUTER_LSA_SCHEDULE (oi->area);
1226 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1227 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1228 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
1229 }
1230
1231 return CMD_SUCCESS;
1232}
1233
1234DEFUN (ipv6_ospf6_hellointerval,
1235 ipv6_ospf6_hellointerval_cmd,
1236 "ipv6 ospf6 hello-interval <1-65535>",
1237 IP6_STR
1238 OSPF6_STR
1239 "Interval time of Hello packets\n"
1240 SECONDS_STR
1241 )
1242{
1243 struct ospf6_interface *oi;
1244 struct interface *ifp;
1245
1246 ifp = (struct interface *) vty->index;
1247 assert (ifp);
1248
1249 oi = (struct ospf6_interface *) ifp->info;
1250 if (oi == NULL)
1251 oi = ospf6_interface_create (ifp);
1252 assert (oi);
1253
1254 oi->hello_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001255 return CMD_SUCCESS;
1256}
1257
1258/* interface variable set command */
1259DEFUN (ipv6_ospf6_deadinterval,
1260 ipv6_ospf6_deadinterval_cmd,
hasso508e53e2004-05-18 18:57:06 +00001261 "ipv6 ospf6 dead-interval <1-65535>",
paul718e3742002-12-13 20:15:29 +00001262 IP6_STR
1263 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001264 "Interval time after which a neighbor is declared down\n"
paul718e3742002-12-13 20:15:29 +00001265 SECONDS_STR
1266 )
1267{
hasso508e53e2004-05-18 18:57:06 +00001268 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001269 struct interface *ifp;
1270
1271 ifp = (struct interface *) vty->index;
1272 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001273
hasso508e53e2004-05-18 18:57:06 +00001274 oi = (struct ospf6_interface *) ifp->info;
1275 if (oi == NULL)
1276 oi = ospf6_interface_create (ifp);
1277 assert (oi);
1278
1279 oi->dead_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001280 return CMD_SUCCESS;
1281}
1282
1283/* interface variable set command */
1284DEFUN (ipv6_ospf6_transmitdelay,
1285 ipv6_ospf6_transmitdelay_cmd,
hasso508e53e2004-05-18 18:57:06 +00001286 "ipv6 ospf6 transmit-delay <1-3600>",
paul718e3742002-12-13 20:15:29 +00001287 IP6_STR
1288 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001289 "Transmit delay of this interface\n"
paul718e3742002-12-13 20:15:29 +00001290 SECONDS_STR
1291 )
1292{
hasso508e53e2004-05-18 18:57:06 +00001293 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001294 struct interface *ifp;
1295
1296 ifp = (struct interface *) vty->index;
1297 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001298
hasso508e53e2004-05-18 18:57:06 +00001299 oi = (struct ospf6_interface *) ifp->info;
1300 if (oi == NULL)
1301 oi = ospf6_interface_create (ifp);
1302 assert (oi);
1303
1304 oi->transdelay = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001305 return CMD_SUCCESS;
1306}
1307
1308/* interface variable set command */
1309DEFUN (ipv6_ospf6_retransmitinterval,
1310 ipv6_ospf6_retransmitinterval_cmd,
hasso508e53e2004-05-18 18:57:06 +00001311 "ipv6 ospf6 retransmit-interval <1-65535>",
paul718e3742002-12-13 20:15:29 +00001312 IP6_STR
1313 OSPF6_STR
1314 "Time between retransmitting lost link state advertisements\n"
1315 SECONDS_STR
1316 )
1317{
hasso508e53e2004-05-18 18:57:06 +00001318 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001319 struct interface *ifp;
1320
1321 ifp = (struct interface *) vty->index;
1322 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001323
hasso508e53e2004-05-18 18:57:06 +00001324 oi = (struct ospf6_interface *) ifp->info;
1325 if (oi == NULL)
1326 oi = ospf6_interface_create (ifp);
1327 assert (oi);
1328
1329 oi->rxmt_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001330 return CMD_SUCCESS;
1331}
1332
1333/* interface variable set command */
1334DEFUN (ipv6_ospf6_priority,
1335 ipv6_ospf6_priority_cmd,
hasso508e53e2004-05-18 18:57:06 +00001336 "ipv6 ospf6 priority <0-255>",
paul718e3742002-12-13 20:15:29 +00001337 IP6_STR
1338 OSPF6_STR
1339 "Router priority\n"
hasso508e53e2004-05-18 18:57:06 +00001340 "Priority value\n"
paul718e3742002-12-13 20:15:29 +00001341 )
1342{
hasso508e53e2004-05-18 18:57:06 +00001343 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001344 struct interface *ifp;
1345
1346 ifp = (struct interface *) vty->index;
1347 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001348
hasso508e53e2004-05-18 18:57:06 +00001349 oi = (struct ospf6_interface *) ifp->info;
1350 if (oi == NULL)
1351 oi = ospf6_interface_create (ifp);
1352 assert (oi);
paul718e3742002-12-13 20:15:29 +00001353
hasso508e53e2004-05-18 18:57:06 +00001354 oi->priority = strtol (argv[0], NULL, 10);
1355
Christian Franke7d4aa1d2012-12-13 16:10:05 +01001356 if (oi->area &&
1357 (oi->state == OSPF6_INTERFACE_DROTHER ||
1358 oi->state == OSPF6_INTERFACE_BDR ||
1359 oi->state == OSPF6_INTERFACE_DR))
hasso508e53e2004-05-18 18:57:06 +00001360 ospf6_interface_state_change (dr_election (oi), oi);
paul718e3742002-12-13 20:15:29 +00001361
1362 return CMD_SUCCESS;
1363}
1364
1365DEFUN (ipv6_ospf6_instance,
1366 ipv6_ospf6_instance_cmd,
hasso508e53e2004-05-18 18:57:06 +00001367 "ipv6 ospf6 instance-id <0-255>",
paul718e3742002-12-13 20:15:29 +00001368 IP6_STR
1369 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001370 "Instance ID for this interface\n"
1371 "Instance ID value\n"
paul718e3742002-12-13 20:15:29 +00001372 )
1373{
hasso508e53e2004-05-18 18:57:06 +00001374 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001375 struct interface *ifp;
1376
1377 ifp = (struct interface *)vty->index;
1378 assert (ifp);
1379
hasso508e53e2004-05-18 18:57:06 +00001380 oi = (struct ospf6_interface *)ifp->info;
1381 if (oi == NULL)
1382 oi = ospf6_interface_create (ifp);
1383 assert (oi);
paul718e3742002-12-13 20:15:29 +00001384
hasso508e53e2004-05-18 18:57:06 +00001385 oi->instance_id = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001386 return CMD_SUCCESS;
1387}
1388
1389DEFUN (ipv6_ospf6_passive,
1390 ipv6_ospf6_passive_cmd,
1391 "ipv6 ospf6 passive",
1392 IP6_STR
1393 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001394 "passive interface, No adjacency will be formed on this interface\n"
paul718e3742002-12-13 20:15:29 +00001395 )
1396{
hasso508e53e2004-05-18 18:57:06 +00001397 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001398 struct interface *ifp;
paul1eb8ef22005-04-07 07:30:20 +00001399 struct listnode *node, *nnode;
hasso508e53e2004-05-18 18:57:06 +00001400 struct ospf6_neighbor *on;
paul718e3742002-12-13 20:15:29 +00001401
1402 ifp = (struct interface *) vty->index;
1403 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001404
hasso508e53e2004-05-18 18:57:06 +00001405 oi = (struct ospf6_interface *) ifp->info;
1406 if (oi == NULL)
1407 oi = ospf6_interface_create (ifp);
1408 assert (oi);
paul718e3742002-12-13 20:15:29 +00001409
hasso508e53e2004-05-18 18:57:06 +00001410 SET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);
1411 THREAD_OFF (oi->thread_send_hello);
1412
paul1eb8ef22005-04-07 07:30:20 +00001413 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
paul718e3742002-12-13 20:15:29 +00001414 {
hasso508e53e2004-05-18 18:57:06 +00001415 THREAD_OFF (on->inactivity_timer);
hasso3e834b12005-06-24 07:50:12 +00001416 thread_add_event (master, inactivity_timer, on, 0);
paul718e3742002-12-13 20:15:29 +00001417 }
1418
1419 return CMD_SUCCESS;
1420}
1421
1422DEFUN (no_ipv6_ospf6_passive,
1423 no_ipv6_ospf6_passive_cmd,
1424 "no ipv6 ospf6 passive",
1425 NO_STR
1426 IP6_STR
1427 OSPF6_STR
1428 "passive interface: No Adjacency will be formed on this I/F\n"
1429 )
1430{
hasso508e53e2004-05-18 18:57:06 +00001431 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001432 struct interface *ifp;
1433
1434 ifp = (struct interface *) vty->index;
1435 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001436
hasso508e53e2004-05-18 18:57:06 +00001437 oi = (struct ospf6_interface *) ifp->info;
1438 if (oi == NULL)
1439 oi = ospf6_interface_create (ifp);
1440 assert (oi);
paul718e3742002-12-13 20:15:29 +00001441
hasso508e53e2004-05-18 18:57:06 +00001442 UNSET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);
1443 THREAD_OFF (oi->thread_send_hello);
1444 oi->thread_send_hello =
1445 thread_add_event (master, ospf6_hello_send, oi, 0);
paul718e3742002-12-13 20:15:29 +00001446
1447 return CMD_SUCCESS;
1448}
1449
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +04001450DEFUN (ipv6_ospf6_mtu_ignore,
1451 ipv6_ospf6_mtu_ignore_cmd,
1452 "ipv6 ospf6 mtu-ignore",
1453 IP6_STR
1454 OSPF6_STR
1455 "Ignore MTU mismatch on this interface\n"
1456 )
1457{
1458 struct ospf6_interface *oi;
1459 struct interface *ifp;
1460
1461 ifp = (struct interface *) vty->index;
1462 assert (ifp);
1463
1464 oi = (struct ospf6_interface *) ifp->info;
1465 if (oi == NULL)
1466 oi = ospf6_interface_create (ifp);
1467 assert (oi);
1468
1469 oi->mtu_ignore = 1;
1470
1471 return CMD_SUCCESS;
1472}
1473
1474DEFUN (no_ipv6_ospf6_mtu_ignore,
1475 no_ipv6_ospf6_mtu_ignore_cmd,
1476 "no ipv6 ospf6 mtu-ignore",
1477 NO_STR
1478 IP6_STR
1479 OSPF6_STR
1480 "Ignore MTU mismatch on this interface\n"
1481 )
1482{
1483 struct ospf6_interface *oi;
1484 struct interface *ifp;
1485
1486 ifp = (struct interface *) vty->index;
1487 assert (ifp);
1488
1489 oi = (struct ospf6_interface *) ifp->info;
1490 if (oi == NULL)
1491 oi = ospf6_interface_create (ifp);
1492 assert (oi);
1493
1494 oi->mtu_ignore = 0;
1495
1496 return CMD_SUCCESS;
1497}
1498
paul718e3742002-12-13 20:15:29 +00001499DEFUN (ipv6_ospf6_advertise_prefix_list,
1500 ipv6_ospf6_advertise_prefix_list_cmd,
1501 "ipv6 ospf6 advertise prefix-list WORD",
1502 IP6_STR
1503 OSPF6_STR
1504 "Advertising options\n"
1505 "Filter prefix using prefix-list\n"
1506 "Prefix list name\n"
1507 )
1508{
hasso508e53e2004-05-18 18:57:06 +00001509 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001510 struct interface *ifp;
1511
1512 ifp = (struct interface *) vty->index;
1513 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001514
hasso508e53e2004-05-18 18:57:06 +00001515 oi = (struct ospf6_interface *) ifp->info;
1516 if (oi == NULL)
1517 oi = ospf6_interface_create (ifp);
1518 assert (oi);
paul718e3742002-12-13 20:15:29 +00001519
hasso508e53e2004-05-18 18:57:06 +00001520 if (oi->plist_name)
1521 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
1522 oi->plist_name = XSTRDUP (MTYPE_PREFIX_LIST_STR, argv[0]);
paul718e3742002-12-13 20:15:29 +00001523
hasso508e53e2004-05-18 18:57:06 +00001524 ospf6_interface_connected_route_update (oi->interface);
David Ward2470e992010-01-05 02:45:39 +00001525
1526 if (oi->area)
hasso508e53e2004-05-18 18:57:06 +00001527 {
David Ward2470e992010-01-05 02:45:39 +00001528 OSPF6_LINK_LSA_SCHEDULE (oi);
1529 if (oi->state == OSPF6_INTERFACE_DR)
1530 {
1531 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1532 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1533 }
1534 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
hasso508e53e2004-05-18 18:57:06 +00001535 }
paul718e3742002-12-13 20:15:29 +00001536
1537 return CMD_SUCCESS;
1538}
1539
1540DEFUN (no_ipv6_ospf6_advertise_prefix_list,
1541 no_ipv6_ospf6_advertise_prefix_list_cmd,
1542 "no ipv6 ospf6 advertise prefix-list",
1543 NO_STR
1544 IP6_STR
1545 OSPF6_STR
1546 "Advertising options\n"
1547 "Filter prefix using prefix-list\n"
1548 )
1549{
hasso508e53e2004-05-18 18:57:06 +00001550 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001551 struct interface *ifp;
1552
1553 ifp = (struct interface *) vty->index;
1554 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001555
hasso508e53e2004-05-18 18:57:06 +00001556 oi = (struct ospf6_interface *) ifp->info;
1557 if (oi == NULL)
1558 oi = ospf6_interface_create (ifp);
1559 assert (oi);
1560
1561 if (oi->plist_name)
paul718e3742002-12-13 20:15:29 +00001562 {
hasso508e53e2004-05-18 18:57:06 +00001563 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
1564 oi->plist_name = NULL;
paul718e3742002-12-13 20:15:29 +00001565 }
1566
hasso508e53e2004-05-18 18:57:06 +00001567 ospf6_interface_connected_route_update (oi->interface);
David Ward2470e992010-01-05 02:45:39 +00001568
1569 if (oi->area)
hasso508e53e2004-05-18 18:57:06 +00001570 {
David Ward2470e992010-01-05 02:45:39 +00001571 OSPF6_LINK_LSA_SCHEDULE (oi);
1572 if (oi->state == OSPF6_INTERFACE_DR)
1573 {
1574 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1575 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1576 }
1577 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
hasso508e53e2004-05-18 18:57:06 +00001578 }
paul718e3742002-12-13 20:15:29 +00001579
1580 return CMD_SUCCESS;
1581}
1582
Dinesh Duttc5926a92013-08-24 07:55:00 +00001583DEFUN (ipv6_ospf6_network,
1584 ipv6_ospf6_network_cmd,
1585 "ipv6 ospf6 network (broadcast|point-to-point)",
1586 IP6_STR
1587 OSPF6_STR
1588 "Network Type\n"
1589 "Specify OSPFv6 broadcast network\n"
1590 "Specify OSPF6 point-to-point network\n"
1591 )
1592{
1593 struct ospf6_interface *oi;
1594 struct interface *ifp;
1595
1596 ifp = (struct interface *) vty->index;
1597 assert (ifp);
1598
1599 oi = (struct ospf6_interface *) ifp->info;
1600 if (oi == NULL) {
1601 oi = ospf6_interface_create (ifp);
1602 }
1603 assert (oi);
1604
1605 if (strncmp (argv[0], "b", 1) == 0)
1606 {
1607 if (oi->type == OSPF_IFTYPE_BROADCAST)
1608 return CMD_SUCCESS;
1609
1610 oi->type = OSPF_IFTYPE_BROADCAST;
1611 }
1612 else if (strncmp (argv[0], "point-to-p", 10) == 0)
1613 {
1614 if (oi->type == OSPF_IFTYPE_POINTOPOINT) {
1615 return CMD_SUCCESS;
1616 }
1617 oi->type = OSPF_IFTYPE_POINTOPOINT;
1618 }
1619
1620 /* Reset the interface */
1621 thread_add_event (master, interface_down, oi, 0);
1622 thread_add_event (master, interface_up, oi, 0);
1623
1624 return CMD_SUCCESS;
1625}
1626
1627DEFUN (no_ipv6_ospf6_network,
1628 no_ipv6_ospf6_network_cmd,
1629 "no ipv6 ospf6 network",
1630 NO_STR
1631 IP6_STR
1632 OSPF6_STR
1633 "Network Type\n"
1634 "Default to whatever interface type system specifies"
1635 )
1636{
1637 struct ospf6_interface *oi;
1638 struct interface *ifp;
1639 int type;
1640
1641 ifp = (struct interface *) vty->index;
1642 assert (ifp);
1643
1644 oi = (struct ospf6_interface *) ifp->info;
1645 if (oi == NULL) {
1646 return CMD_SUCCESS;
1647 }
1648
1649 type = ospf6_default_iftype (ifp);
1650 if (oi->type == type)
1651 {
1652 return CMD_SUCCESS;
1653 }
1654 oi->type = type;
1655
1656 /* Reset the interface */
1657 thread_add_event (master, interface_down, oi, 0);
1658 thread_add_event (master, interface_up, oi, 0);
1659
1660 return CMD_SUCCESS;
1661}
1662
Paul Jakma6ac29a52008-08-15 13:45:30 +01001663static int
hasso508e53e2004-05-18 18:57:06 +00001664config_write_ospf6_interface (struct vty *vty)
paul718e3742002-12-13 20:15:29 +00001665{
hasso52dc7ee2004-09-23 19:18:23 +00001666 struct listnode *i;
hasso508e53e2004-05-18 18:57:06 +00001667 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001668 struct interface *ifp;
1669
paul1eb8ef22005-04-07 07:30:20 +00001670 for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
paul718e3742002-12-13 20:15:29 +00001671 {
hasso508e53e2004-05-18 18:57:06 +00001672 oi = (struct ospf6_interface *) ifp->info;
1673 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +00001674 continue;
1675
1676 vty_out (vty, "interface %s%s",
hasso049207c2004-08-04 20:02:13 +00001677 oi->interface->name, VNL);
hasso508e53e2004-05-18 18:57:06 +00001678
1679 if (ifp->desc)
hasso049207c2004-08-04 20:02:13 +00001680 vty_out (vty, " description %s%s", ifp->desc, VNL);
hasso1203e1c2004-07-23 21:34:27 +00001681 if (ifp->mtu6 != oi->ifmtu)
hasso049207c2004-08-04 20:02:13 +00001682 vty_out (vty, " ipv6 ospf6 ifmtu %d%s", oi->ifmtu, VNL);
Vyacheslav Trushkinb51a3a32012-02-10 10:42:45 +04001683
1684 if (oi->cost != OSPF6_INTERFACE_COST)
1685 vty_out (vty, " ipv6 ospf6 cost %d%s",
1686 oi->cost, VNL);
1687
1688 if (oi->hello_interval != OSPF6_INTERFACE_HELLO_INTERVAL)
1689 vty_out (vty, " ipv6 ospf6 hello-interval %d%s",
1690 oi->hello_interval, VNL);
1691
1692 if (oi->dead_interval != OSPF6_INTERFACE_DEAD_INTERVAL)
1693 vty_out (vty, " ipv6 ospf6 dead-interval %d%s",
1694 oi->dead_interval, VNL);
1695
1696 if (oi->rxmt_interval != OSPF6_INTERFACE_RXMT_INTERVAL)
1697 vty_out (vty, " ipv6 ospf6 retransmit-interval %d%s",
1698 oi->rxmt_interval, VNL);
1699
1700 if (oi->priority != OSPF6_INTERFACE_PRIORITY)
1701 vty_out (vty, " ipv6 ospf6 priority %d%s",
1702 oi->priority, VNL);
1703
1704 if (oi->transdelay != OSPF6_INTERFACE_TRANSDELAY)
1705 vty_out (vty, " ipv6 ospf6 transmit-delay %d%s",
1706 oi->transdelay, VNL);
1707
1708 if (oi->instance_id != OSPF6_INTERFACE_INSTANCE_ID)
1709 vty_out (vty, " ipv6 ospf6 instance-id %d%s",
1710 oi->instance_id, VNL);
paul718e3742002-12-13 20:15:29 +00001711
hasso508e53e2004-05-18 18:57:06 +00001712 if (oi->plist_name)
paul718e3742002-12-13 20:15:29 +00001713 vty_out (vty, " ipv6 ospf6 advertise prefix-list %s%s",
hasso049207c2004-08-04 20:02:13 +00001714 oi->plist_name, VNL);
paul718e3742002-12-13 20:15:29 +00001715
hasso508e53e2004-05-18 18:57:06 +00001716 if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE))
hasso049207c2004-08-04 20:02:13 +00001717 vty_out (vty, " ipv6 ospf6 passive%s", VNL);
paul718e3742002-12-13 20:15:29 +00001718
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +04001719 if (oi->mtu_ignore)
1720 vty_out (vty, " ipv6 ospf6 mtu-ignore%s", VNL);
1721
Dinesh Duttc5926a92013-08-24 07:55:00 +00001722 if (oi->type == OSPF_IFTYPE_POINTOPOINT)
1723 vty_out (vty, " ipv6 ospf6 network point-to-point%s", VNL);
1724 else if (oi->type == OSPF_IFTYPE_BROADCAST)
1725 vty_out (vty, " ipv6 ospf6 network broadcast%s", VNL);
1726
hasso049207c2004-08-04 20:02:13 +00001727 vty_out (vty, "!%s", VNL);
paul718e3742002-12-13 20:15:29 +00001728 }
1729 return 0;
1730}
1731
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08001732static struct cmd_node interface_node =
paul718e3742002-12-13 20:15:29 +00001733{
1734 INTERFACE_NODE,
1735 "%s(config-if)# ",
hasso69b4a812004-08-26 18:10:36 +00001736 1 /* VTYSH */
paul718e3742002-12-13 20:15:29 +00001737};
1738
1739void
Paul Jakma6ac29a52008-08-15 13:45:30 +01001740ospf6_interface_init (void)
paul718e3742002-12-13 20:15:29 +00001741{
1742 /* Install interface node. */
hasso508e53e2004-05-18 18:57:06 +00001743 install_node (&interface_node, config_write_ospf6_interface);
paul718e3742002-12-13 20:15:29 +00001744
1745 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_cmd);
hasso508e53e2004-05-18 18:57:06 +00001746 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_cmd);
1747 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd);
1748 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001749 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_cmd);
hasso508e53e2004-05-18 18:57:06 +00001750 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd);
1751 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd);
1752 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001753 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_cmd);
hasso508e53e2004-05-18 18:57:06 +00001754 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_cmd);
1755 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd);
1756 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001757 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_cmd);
hasso508e53e2004-05-18 18:57:06 +00001758 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd);
1759 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd);
1760 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001761
hasso508e53e2004-05-18 18:57:06 +00001762 install_element (CONFIG_NODE, &interface_cmd);
paul718e3742002-12-13 20:15:29 +00001763 install_default (INTERFACE_NODE);
1764 install_element (INTERFACE_NODE, &interface_desc_cmd);
1765 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
1766 install_element (INTERFACE_NODE, &ipv6_ospf6_cost_cmd);
hassob596c712004-07-09 18:33:43 +00001767 install_element (INTERFACE_NODE, &ipv6_ospf6_ifmtu_cmd);
hasso049207c2004-08-04 20:02:13 +00001768 install_element (INTERFACE_NODE, &no_ipv6_ospf6_ifmtu_cmd);
paul718e3742002-12-13 20:15:29 +00001769 install_element (INTERFACE_NODE, &ipv6_ospf6_deadinterval_cmd);
1770 install_element (INTERFACE_NODE, &ipv6_ospf6_hellointerval_cmd);
1771 install_element (INTERFACE_NODE, &ipv6_ospf6_priority_cmd);
1772 install_element (INTERFACE_NODE, &ipv6_ospf6_retransmitinterval_cmd);
1773 install_element (INTERFACE_NODE, &ipv6_ospf6_transmitdelay_cmd);
1774 install_element (INTERFACE_NODE, &ipv6_ospf6_instance_cmd);
hasso508e53e2004-05-18 18:57:06 +00001775
paul718e3742002-12-13 20:15:29 +00001776 install_element (INTERFACE_NODE, &ipv6_ospf6_passive_cmd);
1777 install_element (INTERFACE_NODE, &no_ipv6_ospf6_passive_cmd);
hasso508e53e2004-05-18 18:57:06 +00001778
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +04001779 install_element (INTERFACE_NODE, &ipv6_ospf6_mtu_ignore_cmd);
1780 install_element (INTERFACE_NODE, &no_ipv6_ospf6_mtu_ignore_cmd);
1781
hasso508e53e2004-05-18 18:57:06 +00001782 install_element (INTERFACE_NODE, &ipv6_ospf6_advertise_prefix_list_cmd);
1783 install_element (INTERFACE_NODE, &no_ipv6_ospf6_advertise_prefix_list_cmd);
Dinesh Duttc5926a92013-08-24 07:55:00 +00001784
1785 install_element (INTERFACE_NODE, &ipv6_ospf6_network_cmd);
1786 install_element (INTERFACE_NODE, &no_ipv6_ospf6_network_cmd);
hasso508e53e2004-05-18 18:57:06 +00001787}
1788
1789DEFUN (debug_ospf6_interface,
1790 debug_ospf6_interface_cmd,
1791 "debug ospf6 interface",
1792 DEBUG_STR
1793 OSPF6_STR
1794 "Debug OSPFv3 Interface\n"
1795 )
1796{
1797 OSPF6_DEBUG_INTERFACE_ON ();
1798 return CMD_SUCCESS;
1799}
1800
1801DEFUN (no_debug_ospf6_interface,
1802 no_debug_ospf6_interface_cmd,
1803 "no debug ospf6 interface",
1804 NO_STR
1805 DEBUG_STR
1806 OSPF6_STR
1807 "Debug OSPFv3 Interface\n"
1808 )
1809{
hasso3b687352004-08-19 06:56:53 +00001810 OSPF6_DEBUG_INTERFACE_OFF ();
hasso508e53e2004-05-18 18:57:06 +00001811 return CMD_SUCCESS;
1812}
1813
1814int
1815config_write_ospf6_debug_interface (struct vty *vty)
1816{
1817 if (IS_OSPF6_DEBUG_INTERFACE)
hasso049207c2004-08-04 20:02:13 +00001818 vty_out (vty, "debug ospf6 interface%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001819 return 0;
1820}
1821
1822void
Paul Jakma6ac29a52008-08-15 13:45:30 +01001823install_element_ospf6_debug_interface (void)
hasso508e53e2004-05-18 18:57:06 +00001824{
1825 install_element (ENABLE_NODE, &debug_ospf6_interface_cmd);
1826 install_element (ENABLE_NODE, &no_debug_ospf6_interface_cmd);
1827 install_element (CONFIG_NODE, &debug_ospf6_interface_cmd);
1828 install_element (CONFIG_NODE, &no_debug_ospf6_interface_cmd);
paul718e3742002-12-13 20:15:29 +00001829}
1830
1831