blob: 8d4276458db323a4cfcac6434bd17f2bf4df1436 [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))
686 thread_add_event (master, ospf6_hello_send, oi, 0);
687
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
774 /* Leave AllSPFRouters */
775 if (oi->state > OSPF6_INTERFACE_DOWN)
Vyacheslav Trushkin9a9446e2011-11-21 20:26:39 +0400776 ospf6_sso (oi->interface->ifindex, &allspfrouters6, IPV6_LEAVE_GROUP);
hasso508e53e2004-05-18 18:57:06 +0000777
778 ospf6_interface_state_change (OSPF6_INTERFACE_DOWN, oi);
779
paul1eb8ef22005-04-07 07:30:20 +0000780 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
781 ospf6_neighbor_delete (on);
782
hasso508e53e2004-05-18 18:57:06 +0000783 list_delete_all_node (oi->neighbor_list);
784
Christian Franke37531a72012-12-13 13:50:28 +0100785 /* When interface state is reset, also reset information about
786 * DR election, as it is no longer valid. */
787 oi->drouter = oi->prev_drouter = htonl(0);
788 oi->bdrouter = oi->prev_bdrouter = htonl(0);
hasso508e53e2004-05-18 18:57:06 +0000789 return 0;
790}
791
792
paul718e3742002-12-13 20:15:29 +0000793/* show specified interface structure */
Paul Jakma6ac29a52008-08-15 13:45:30 +0100794static int
hasso508e53e2004-05-18 18:57:06 +0000795ospf6_interface_show (struct vty *vty, struct interface *ifp)
paul718e3742002-12-13 20:15:29 +0000796{
hasso508e53e2004-05-18 18:57:06 +0000797 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000798 struct connected *c;
799 struct prefix *p;
hasso52dc7ee2004-09-23 19:18:23 +0000800 struct listnode *i;
hasso508e53e2004-05-18 18:57:06 +0000801 char strbuf[64], drouter[32], bdrouter[32];
paul0c083ee2004-10-10 12:54:58 +0000802 const char *updown[3] = {"down", "up", NULL};
803 const char *type;
hasso508e53e2004-05-18 18:57:06 +0000804 struct timeval res, now;
805 char duration[32];
806 struct ospf6_lsa *lsa;
paul718e3742002-12-13 20:15:29 +0000807
808 /* check physical interface type */
hasso508e53e2004-05-18 18:57:06 +0000809 if (if_is_loopback (ifp))
paul718e3742002-12-13 20:15:29 +0000810 type = "LOOPBACK";
hasso508e53e2004-05-18 18:57:06 +0000811 else if (if_is_broadcast (ifp))
paul718e3742002-12-13 20:15:29 +0000812 type = "BROADCAST";
hasso508e53e2004-05-18 18:57:06 +0000813 else if (if_is_pointopoint (ifp))
paul718e3742002-12-13 20:15:29 +0000814 type = "POINTOPOINT";
815 else
816 type = "UNKNOWN";
817
818 vty_out (vty, "%s is %s, type %s%s",
Dinesh Dutte7ad6b22013-08-24 07:55:57 +0000819 ifp->name, updown[if_is_operative (ifp)], type,
hasso049207c2004-08-04 20:02:13 +0000820 VNL);
821 vty_out (vty, " Interface ID: %d%s", ifp->ifindex, VNL);
paul718e3742002-12-13 20:15:29 +0000822
hasso508e53e2004-05-18 18:57:06 +0000823 if (ifp->info == NULL)
paul718e3742002-12-13 20:15:29 +0000824 {
hasso049207c2004-08-04 20:02:13 +0000825 vty_out (vty, " OSPF not enabled on this interface%s", VNL);
paul718e3742002-12-13 20:15:29 +0000826 return 0;
827 }
828 else
hasso508e53e2004-05-18 18:57:06 +0000829 oi = (struct ospf6_interface *) ifp->info;
paul718e3742002-12-13 20:15:29 +0000830
hasso049207c2004-08-04 20:02:13 +0000831 vty_out (vty, " Internet Address:%s", VNL);
paul1eb8ef22005-04-07 07:30:20 +0000832
833 for (ALL_LIST_ELEMENTS_RO (ifp->connected, i, c))
paul718e3742002-12-13 20:15:29 +0000834 {
paul718e3742002-12-13 20:15:29 +0000835 p = c->address;
836 prefix2str (p, strbuf, sizeof (strbuf));
837 switch (p->family)
838 {
839 case AF_INET:
hasso508e53e2004-05-18 18:57:06 +0000840 vty_out (vty, " inet : %s%s", strbuf,
hasso049207c2004-08-04 20:02:13 +0000841 VNL);
paul718e3742002-12-13 20:15:29 +0000842 break;
843 case AF_INET6:
hasso508e53e2004-05-18 18:57:06 +0000844 vty_out (vty, " inet6: %s%s", strbuf,
hasso049207c2004-08-04 20:02:13 +0000845 VNL);
paul718e3742002-12-13 20:15:29 +0000846 break;
847 default:
hasso508e53e2004-05-18 18:57:06 +0000848 vty_out (vty, " ??? : %s%s", strbuf,
hasso049207c2004-08-04 20:02:13 +0000849 VNL);
paul718e3742002-12-13 20:15:29 +0000850 break;
851 }
852 }
853
hasso508e53e2004-05-18 18:57:06 +0000854 if (oi->area)
paul718e3742002-12-13 20:15:29 +0000855 {
hasso508e53e2004-05-18 18:57:06 +0000856 vty_out (vty, " Instance ID %d, Interface MTU %d (autodetect: %d)%s",
hasso049207c2004-08-04 20:02:13 +0000857 oi->instance_id, oi->ifmtu, ifp->mtu6, VNL);
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +0400858 vty_out (vty, " MTU mismatch detection: %s%s", oi->mtu_ignore ?
859 "disabled" : "enabled", VNL);
hasso508e53e2004-05-18 18:57:06 +0000860 inet_ntop (AF_INET, &oi->area->area_id,
paul718e3742002-12-13 20:15:29 +0000861 strbuf, sizeof (strbuf));
hasso508e53e2004-05-18 18:57:06 +0000862 vty_out (vty, " Area ID %s, Cost %hu%s", strbuf, oi->cost,
hasso049207c2004-08-04 20:02:13 +0000863 VNL);
paul718e3742002-12-13 20:15:29 +0000864 }
865 else
hasso049207c2004-08-04 20:02:13 +0000866 vty_out (vty, " Not Attached to Area%s", VNL);
paul718e3742002-12-13 20:15:29 +0000867
868 vty_out (vty, " State %s, Transmit Delay %d sec, Priority %d%s",
hasso508e53e2004-05-18 18:57:06 +0000869 ospf6_interface_state_str[oi->state],
870 oi->transdelay, oi->priority,
hasso049207c2004-08-04 20:02:13 +0000871 VNL);
872 vty_out (vty, " Timer intervals configured:%s", VNL);
paul718e3742002-12-13 20:15:29 +0000873 vty_out (vty, " Hello %d, Dead %d, Retransmit %d%s",
hasso508e53e2004-05-18 18:57:06 +0000874 oi->hello_interval, oi->dead_interval, oi->rxmt_interval,
hasso049207c2004-08-04 20:02:13 +0000875 VNL);
paul718e3742002-12-13 20:15:29 +0000876
hasso508e53e2004-05-18 18:57:06 +0000877 inet_ntop (AF_INET, &oi->drouter, drouter, sizeof (drouter));
878 inet_ntop (AF_INET, &oi->bdrouter, bdrouter, sizeof (bdrouter));
hasso049207c2004-08-04 20:02:13 +0000879 vty_out (vty, " DR: %s BDR: %s%s", drouter, bdrouter, VNL);
paul718e3742002-12-13 20:15:29 +0000880
881 vty_out (vty, " Number of I/F scoped LSAs is %u%s",
hasso049207c2004-08-04 20:02:13 +0000882 oi->lsdb->count, VNL);
paul718e3742002-12-13 20:15:29 +0000883
Takashi Sogabe86f72dc2009-06-22 13:07:02 +0900884 quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
paul718e3742002-12-13 20:15:29 +0000885
hasso508e53e2004-05-18 18:57:06 +0000886 timerclear (&res);
887 if (oi->thread_send_lsupdate)
888 timersub (&oi->thread_send_lsupdate->u.sands, &now, &res);
889 timerstring (&res, duration, sizeof (duration));
890 vty_out (vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]%s",
891 oi->lsupdate_list->count, duration,
892 (oi->thread_send_lsupdate ? "on" : "off"),
hasso049207c2004-08-04 20:02:13 +0000893 VNL);
hasso508e53e2004-05-18 18:57:06 +0000894 for (lsa = ospf6_lsdb_head (oi->lsupdate_list); lsa;
895 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000896 vty_out (vty, " %s%s", lsa->name, VNL);
paul718e3742002-12-13 20:15:29 +0000897
hasso508e53e2004-05-18 18:57:06 +0000898 timerclear (&res);
899 if (oi->thread_send_lsack)
900 timersub (&oi->thread_send_lsack->u.sands, &now, &res);
901 timerstring (&res, duration, sizeof (duration));
902 vty_out (vty, " %d Pending LSAs for LSAck in Time %s [thread %s]%s",
903 oi->lsack_list->count, duration,
904 (oi->thread_send_lsack ? "on" : "off"),
hasso049207c2004-08-04 20:02:13 +0000905 VNL);
hasso508e53e2004-05-18 18:57:06 +0000906 for (lsa = ospf6_lsdb_head (oi->lsack_list); lsa;
907 lsa = ospf6_lsdb_next (lsa))
hasso049207c2004-08-04 20:02:13 +0000908 vty_out (vty, " %s%s", lsa->name, VNL);
paul718e3742002-12-13 20:15:29 +0000909
hasso508e53e2004-05-18 18:57:06 +0000910 return 0;
paul718e3742002-12-13 20:15:29 +0000911}
912
913/* show interface */
914DEFUN (show_ipv6_ospf6_interface,
915 show_ipv6_ospf6_interface_ifname_cmd,
916 "show ipv6 ospf6 interface IFNAME",
917 SHOW_STR
918 IP6_STR
919 OSPF6_STR
920 INTERFACE_STR
921 IFNAME_STR
922 )
923{
924 struct interface *ifp;
hasso52dc7ee2004-09-23 19:18:23 +0000925 struct listnode *i;
paul718e3742002-12-13 20:15:29 +0000926
927 if (argc)
928 {
929 ifp = if_lookup_by_name (argv[0]);
hasso508e53e2004-05-18 18:57:06 +0000930 if (ifp == NULL)
paul718e3742002-12-13 20:15:29 +0000931 {
932 vty_out (vty, "No such Interface: %s%s", argv[0],
hasso049207c2004-08-04 20:02:13 +0000933 VNL);
paul718e3742002-12-13 20:15:29 +0000934 return CMD_WARNING;
935 }
936 ospf6_interface_show (vty, ifp);
937 }
938 else
939 {
paul1eb8ef22005-04-07 07:30:20 +0000940 for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
941 ospf6_interface_show (vty, ifp);
paul718e3742002-12-13 20:15:29 +0000942 }
hasso508e53e2004-05-18 18:57:06 +0000943
paul718e3742002-12-13 20:15:29 +0000944 return CMD_SUCCESS;
945}
946
947ALIAS (show_ipv6_ospf6_interface,
948 show_ipv6_ospf6_interface_cmd,
949 "show ipv6 ospf6 interface",
950 SHOW_STR
951 IP6_STR
952 OSPF6_STR
953 INTERFACE_STR
Paul Jakma6ac29a52008-08-15 13:45:30 +0100954 )
paul718e3742002-12-13 20:15:29 +0000955
hasso508e53e2004-05-18 18:57:06 +0000956DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
957 show_ipv6_ospf6_interface_ifname_prefix_cmd,
958 "show ipv6 ospf6 interface IFNAME prefix",
959 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000960 IP6_STR
961 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +0000962 INTERFACE_STR
963 IFNAME_STR
964 "Display connected prefixes to advertise\n"
paul718e3742002-12-13 20:15:29 +0000965 )
966{
paul718e3742002-12-13 20:15:29 +0000967 struct interface *ifp;
hasso508e53e2004-05-18 18:57:06 +0000968 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000969
hasso508e53e2004-05-18 18:57:06 +0000970 ifp = if_lookup_by_name (argv[0]);
971 if (ifp == NULL)
972 {
hasso049207c2004-08-04 20:02:13 +0000973 vty_out (vty, "No such Interface: %s%s", argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000974 return CMD_WARNING;
975 }
paul718e3742002-12-13 20:15:29 +0000976
hasso508e53e2004-05-18 18:57:06 +0000977 oi = ifp->info;
978 if (oi == NULL)
979 {
hasso049207c2004-08-04 20:02:13 +0000980 vty_out (vty, "OSPFv3 is not enabled on %s%s", argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000981 return CMD_WARNING;
982 }
paul718e3742002-12-13 20:15:29 +0000983
hasso508e53e2004-05-18 18:57:06 +0000984 argc--;
985 argv++;
986 ospf6_route_table_show (vty, argc, argv, oi->route_connected);
paul718e3742002-12-13 20:15:29 +0000987
988 return CMD_SUCCESS;
989}
990
hasso508e53e2004-05-18 18:57:06 +0000991ALIAS (show_ipv6_ospf6_interface_ifname_prefix,
992 show_ipv6_ospf6_interface_ifname_prefix_detail_cmd,
993 "show ipv6 ospf6 interface IFNAME prefix (X:X::X:X|X:X::X:X/M|detail)",
994 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000995 IP6_STR
996 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +0000997 INTERFACE_STR
998 IFNAME_STR
999 "Display connected prefixes to advertise\n"
1000 OSPF6_ROUTE_ADDRESS_STR
1001 OSPF6_ROUTE_PREFIX_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +04001002 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +01001003 )
hasso508e53e2004-05-18 18:57:06 +00001004
1005ALIAS (show_ipv6_ospf6_interface_ifname_prefix,
1006 show_ipv6_ospf6_interface_ifname_prefix_match_cmd,
1007 "show ipv6 ospf6 interface IFNAME prefix X:X::X:X/M (match|detail)",
1008 SHOW_STR
1009 IP6_STR
1010 OSPF6_STR
1011 INTERFACE_STR
1012 IFNAME_STR
1013 "Display connected prefixes to advertise\n"
1014 OSPF6_ROUTE_PREFIX_STR
1015 OSPF6_ROUTE_MATCH_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +04001016 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +01001017 )
hasso508e53e2004-05-18 18:57:06 +00001018
1019DEFUN (show_ipv6_ospf6_interface_prefix,
1020 show_ipv6_ospf6_interface_prefix_cmd,
1021 "show ipv6 ospf6 interface prefix",
1022 SHOW_STR
1023 IP6_STR
1024 OSPF6_STR
1025 INTERFACE_STR
1026 "Display connected prefixes to advertise\n"
paul718e3742002-12-13 20:15:29 +00001027 )
1028{
hasso52dc7ee2004-09-23 19:18:23 +00001029 struct listnode *i;
hasso508e53e2004-05-18 18:57:06 +00001030 struct ospf6_interface *oi;
1031 struct interface *ifp;
1032
paul1eb8ef22005-04-07 07:30:20 +00001033 for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
hasso508e53e2004-05-18 18:57:06 +00001034 {
hasso508e53e2004-05-18 18:57:06 +00001035 oi = (struct ospf6_interface *) ifp->info;
1036 if (oi == NULL)
1037 continue;
1038
1039 ospf6_route_table_show (vty, argc, argv, oi->route_connected);
1040 }
1041
1042 return CMD_SUCCESS;
1043}
1044
1045ALIAS (show_ipv6_ospf6_interface_prefix,
1046 show_ipv6_ospf6_interface_prefix_detail_cmd,
1047 "show ipv6 ospf6 interface prefix (X:X::X:X|X:X::X:X/M|detail)",
1048 SHOW_STR
1049 IP6_STR
1050 OSPF6_STR
1051 INTERFACE_STR
1052 "Display connected prefixes to advertise\n"
1053 OSPF6_ROUTE_ADDRESS_STR
1054 OSPF6_ROUTE_PREFIX_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +04001055 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +01001056 )
hasso508e53e2004-05-18 18:57:06 +00001057
1058ALIAS (show_ipv6_ospf6_interface_prefix,
1059 show_ipv6_ospf6_interface_prefix_match_cmd,
1060 "show ipv6 ospf6 interface prefix X:X::X:X/M (match|detail)",
1061 SHOW_STR
1062 IP6_STR
1063 OSPF6_STR
1064 INTERFACE_STR
1065 "Display connected prefixes to advertise\n"
1066 OSPF6_ROUTE_PREFIX_STR
1067 OSPF6_ROUTE_MATCH_STR
Denis Ovsienkoea402192011-08-19 16:27:16 +04001068 "Display details of the prefixes\n"
Paul Jakma6ac29a52008-08-15 13:45:30 +01001069 )
hasso508e53e2004-05-18 18:57:06 +00001070
1071
1072/* interface variable set command */
hassob596c712004-07-09 18:33:43 +00001073DEFUN (ipv6_ospf6_ifmtu,
1074 ipv6_ospf6_ifmtu_cmd,
1075 "ipv6 ospf6 ifmtu <1-65535>",
1076 IP6_STR
1077 OSPF6_STR
1078 "Interface MTU\n"
1079 "OSPFv3 Interface MTU\n"
1080 )
1081{
1082 struct ospf6_interface *oi;
1083 struct interface *ifp;
paul0c083ee2004-10-10 12:54:58 +00001084 unsigned int ifmtu, iobuflen;
paul1eb8ef22005-04-07 07:30:20 +00001085 struct listnode *node, *nnode;
hassob596c712004-07-09 18:33:43 +00001086 struct ospf6_neighbor *on;
1087
1088 ifp = (struct interface *) vty->index;
1089 assert (ifp);
1090
1091 oi = (struct ospf6_interface *) ifp->info;
1092 if (oi == NULL)
1093 oi = ospf6_interface_create (ifp);
1094 assert (oi);
1095
1096 ifmtu = strtol (argv[0], NULL, 10);
1097
1098 if (oi->ifmtu == ifmtu)
1099 return CMD_SUCCESS;
1100
hasso1203e1c2004-07-23 21:34:27 +00001101 if (ifp->mtu6 != 0 && ifp->mtu6 < ifmtu)
hassob596c712004-07-09 18:33:43 +00001102 {
1103 vty_out (vty, "%s's ospf6 ifmtu cannot go beyond physical mtu (%d)%s",
hasso049207c2004-08-04 20:02:13 +00001104 ifp->name, ifp->mtu6, VNL);
hassob596c712004-07-09 18:33:43 +00001105 return CMD_WARNING;
1106 }
1107
1108 if (oi->ifmtu < ifmtu)
1109 {
1110 iobuflen = ospf6_iobuf_size (ifmtu);
1111 if (iobuflen < ifmtu)
1112 {
1113 vty_out (vty, "%s's ifmtu is adjusted to I/O buffer size (%d).%s",
hasso049207c2004-08-04 20:02:13 +00001114 ifp->name, iobuflen, VNL);
hassob596c712004-07-09 18:33:43 +00001115 oi->ifmtu = iobuflen;
1116 }
1117 else
1118 oi->ifmtu = ifmtu;
1119 }
1120 else
1121 oi->ifmtu = ifmtu;
1122
1123 /* re-establish adjacencies */
paul1eb8ef22005-04-07 07:30:20 +00001124 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
hassob596c712004-07-09 18:33:43 +00001125 {
hassob596c712004-07-09 18:33:43 +00001126 THREAD_OFF (on->inactivity_timer);
hasso3e834b12005-06-24 07:50:12 +00001127 thread_add_event (master, inactivity_timer, on, 0);
hassob596c712004-07-09 18:33:43 +00001128 }
1129
1130 return CMD_SUCCESS;
1131}
1132
hasso049207c2004-08-04 20:02:13 +00001133DEFUN (no_ipv6_ospf6_ifmtu,
1134 no_ipv6_ospf6_ifmtu_cmd,
1135 "no ipv6 ospf6 ifmtu",
1136 NO_STR
1137 IP6_STR
1138 OSPF6_STR
1139 "Interface MTU\n"
1140 )
1141{
1142 struct ospf6_interface *oi;
1143 struct interface *ifp;
paul0c083ee2004-10-10 12:54:58 +00001144 unsigned int iobuflen;
paul1eb8ef22005-04-07 07:30:20 +00001145 struct listnode *node, *nnode;
hasso049207c2004-08-04 20:02:13 +00001146 struct ospf6_neighbor *on;
1147
1148 ifp = (struct interface *) vty->index;
1149 assert (ifp);
1150
1151 oi = (struct ospf6_interface *) ifp->info;
1152 if (oi == NULL)
1153 oi = ospf6_interface_create (ifp);
1154 assert (oi);
1155
1156 if (oi->ifmtu < ifp->mtu)
1157 {
1158 iobuflen = ospf6_iobuf_size (ifp->mtu);
1159 if (iobuflen < ifp->mtu)
1160 {
1161 vty_out (vty, "%s's ifmtu is adjusted to I/O buffer size (%d).%s",
1162 ifp->name, iobuflen, VNL);
1163 oi->ifmtu = iobuflen;
1164 }
1165 else
1166 oi->ifmtu = ifp->mtu;
1167 }
1168 else
1169 oi->ifmtu = ifp->mtu;
1170
1171 /* re-establish adjacencies */
paul1eb8ef22005-04-07 07:30:20 +00001172 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
hasso049207c2004-08-04 20:02:13 +00001173 {
hasso049207c2004-08-04 20:02:13 +00001174 THREAD_OFF (on->inactivity_timer);
hasso3e834b12005-06-24 07:50:12 +00001175 thread_add_event (master, inactivity_timer, on, 0);
hasso049207c2004-08-04 20:02:13 +00001176 }
1177
1178 return CMD_SUCCESS;
1179}
1180
hasso508e53e2004-05-18 18:57:06 +00001181DEFUN (ipv6_ospf6_cost,
1182 ipv6_ospf6_cost_cmd,
1183 "ipv6 ospf6 cost <1-65535>",
1184 IP6_STR
1185 OSPF6_STR
1186 "Interface cost\n"
1187 "Outgoing metric of this interface\n"
1188 )
1189{
1190 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001191 struct interface *ifp;
paul0c083ee2004-10-10 12:54:58 +00001192 unsigned long int lcost;
paul718e3742002-12-13 20:15:29 +00001193
1194 ifp = (struct interface *) vty->index;
1195 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001196
hasso508e53e2004-05-18 18:57:06 +00001197 oi = (struct ospf6_interface *) ifp->info;
1198 if (oi == NULL)
1199 oi = ospf6_interface_create (ifp);
1200 assert (oi);
1201
paul0c083ee2004-10-10 12:54:58 +00001202 lcost = strtol (argv[0], NULL, 10);
1203
1204 if (lcost > UINT32_MAX)
1205 {
1206 vty_out (vty, "Cost %ld is out of range%s", lcost, VNL);
1207 return CMD_WARNING;
1208 }
1209
1210 if (oi->cost == lcost)
hasso508e53e2004-05-18 18:57:06 +00001211 return CMD_SUCCESS;
paul0c083ee2004-10-10 12:54:58 +00001212
1213 oi->cost = lcost;
1214
hasso508e53e2004-05-18 18:57:06 +00001215 /* update cost held in route_connected list in ospf6_interface */
1216 ospf6_interface_connected_route_update (oi->interface);
1217
1218 /* execute LSA hooks */
1219 if (oi->area)
1220 {
1221 OSPF6_LINK_LSA_SCHEDULE (oi);
1222 OSPF6_ROUTER_LSA_SCHEDULE (oi->area);
1223 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1224 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1225 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
1226 }
1227
1228 return CMD_SUCCESS;
1229}
1230
1231DEFUN (ipv6_ospf6_hellointerval,
1232 ipv6_ospf6_hellointerval_cmd,
1233 "ipv6 ospf6 hello-interval <1-65535>",
1234 IP6_STR
1235 OSPF6_STR
1236 "Interval time of Hello packets\n"
1237 SECONDS_STR
1238 )
1239{
1240 struct ospf6_interface *oi;
1241 struct interface *ifp;
1242
1243 ifp = (struct interface *) vty->index;
1244 assert (ifp);
1245
1246 oi = (struct ospf6_interface *) ifp->info;
1247 if (oi == NULL)
1248 oi = ospf6_interface_create (ifp);
1249 assert (oi);
1250
1251 oi->hello_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001252 return CMD_SUCCESS;
1253}
1254
1255/* interface variable set command */
1256DEFUN (ipv6_ospf6_deadinterval,
1257 ipv6_ospf6_deadinterval_cmd,
hasso508e53e2004-05-18 18:57:06 +00001258 "ipv6 ospf6 dead-interval <1-65535>",
paul718e3742002-12-13 20:15:29 +00001259 IP6_STR
1260 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001261 "Interval time after which a neighbor is declared down\n"
paul718e3742002-12-13 20:15:29 +00001262 SECONDS_STR
1263 )
1264{
hasso508e53e2004-05-18 18:57:06 +00001265 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001266 struct interface *ifp;
1267
1268 ifp = (struct interface *) vty->index;
1269 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001270
hasso508e53e2004-05-18 18:57:06 +00001271 oi = (struct ospf6_interface *) ifp->info;
1272 if (oi == NULL)
1273 oi = ospf6_interface_create (ifp);
1274 assert (oi);
1275
1276 oi->dead_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001277 return CMD_SUCCESS;
1278}
1279
1280/* interface variable set command */
1281DEFUN (ipv6_ospf6_transmitdelay,
1282 ipv6_ospf6_transmitdelay_cmd,
hasso508e53e2004-05-18 18:57:06 +00001283 "ipv6 ospf6 transmit-delay <1-3600>",
paul718e3742002-12-13 20:15:29 +00001284 IP6_STR
1285 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001286 "Transmit delay of this interface\n"
paul718e3742002-12-13 20:15:29 +00001287 SECONDS_STR
1288 )
1289{
hasso508e53e2004-05-18 18:57:06 +00001290 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001291 struct interface *ifp;
1292
1293 ifp = (struct interface *) vty->index;
1294 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001295
hasso508e53e2004-05-18 18:57:06 +00001296 oi = (struct ospf6_interface *) ifp->info;
1297 if (oi == NULL)
1298 oi = ospf6_interface_create (ifp);
1299 assert (oi);
1300
1301 oi->transdelay = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001302 return CMD_SUCCESS;
1303}
1304
1305/* interface variable set command */
1306DEFUN (ipv6_ospf6_retransmitinterval,
1307 ipv6_ospf6_retransmitinterval_cmd,
hasso508e53e2004-05-18 18:57:06 +00001308 "ipv6 ospf6 retransmit-interval <1-65535>",
paul718e3742002-12-13 20:15:29 +00001309 IP6_STR
1310 OSPF6_STR
1311 "Time between retransmitting lost link state advertisements\n"
1312 SECONDS_STR
1313 )
1314{
hasso508e53e2004-05-18 18:57:06 +00001315 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001316 struct interface *ifp;
1317
1318 ifp = (struct interface *) vty->index;
1319 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001320
hasso508e53e2004-05-18 18:57:06 +00001321 oi = (struct ospf6_interface *) ifp->info;
1322 if (oi == NULL)
1323 oi = ospf6_interface_create (ifp);
1324 assert (oi);
1325
1326 oi->rxmt_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001327 return CMD_SUCCESS;
1328}
1329
1330/* interface variable set command */
1331DEFUN (ipv6_ospf6_priority,
1332 ipv6_ospf6_priority_cmd,
hasso508e53e2004-05-18 18:57:06 +00001333 "ipv6 ospf6 priority <0-255>",
paul718e3742002-12-13 20:15:29 +00001334 IP6_STR
1335 OSPF6_STR
1336 "Router priority\n"
hasso508e53e2004-05-18 18:57:06 +00001337 "Priority value\n"
paul718e3742002-12-13 20:15:29 +00001338 )
1339{
hasso508e53e2004-05-18 18:57:06 +00001340 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001341 struct interface *ifp;
1342
1343 ifp = (struct interface *) vty->index;
1344 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001345
hasso508e53e2004-05-18 18:57:06 +00001346 oi = (struct ospf6_interface *) ifp->info;
1347 if (oi == NULL)
1348 oi = ospf6_interface_create (ifp);
1349 assert (oi);
paul718e3742002-12-13 20:15:29 +00001350
hasso508e53e2004-05-18 18:57:06 +00001351 oi->priority = strtol (argv[0], NULL, 10);
1352
Christian Franke7d4aa1d2012-12-13 16:10:05 +01001353 if (oi->area &&
1354 (oi->state == OSPF6_INTERFACE_DROTHER ||
1355 oi->state == OSPF6_INTERFACE_BDR ||
1356 oi->state == OSPF6_INTERFACE_DR))
hasso508e53e2004-05-18 18:57:06 +00001357 ospf6_interface_state_change (dr_election (oi), oi);
paul718e3742002-12-13 20:15:29 +00001358
1359 return CMD_SUCCESS;
1360}
1361
1362DEFUN (ipv6_ospf6_instance,
1363 ipv6_ospf6_instance_cmd,
hasso508e53e2004-05-18 18:57:06 +00001364 "ipv6 ospf6 instance-id <0-255>",
paul718e3742002-12-13 20:15:29 +00001365 IP6_STR
1366 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001367 "Instance ID for this interface\n"
1368 "Instance ID value\n"
paul718e3742002-12-13 20:15:29 +00001369 )
1370{
hasso508e53e2004-05-18 18:57:06 +00001371 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001372 struct interface *ifp;
1373
1374 ifp = (struct interface *)vty->index;
1375 assert (ifp);
1376
hasso508e53e2004-05-18 18:57:06 +00001377 oi = (struct ospf6_interface *)ifp->info;
1378 if (oi == NULL)
1379 oi = ospf6_interface_create (ifp);
1380 assert (oi);
paul718e3742002-12-13 20:15:29 +00001381
hasso508e53e2004-05-18 18:57:06 +00001382 oi->instance_id = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001383 return CMD_SUCCESS;
1384}
1385
1386DEFUN (ipv6_ospf6_passive,
1387 ipv6_ospf6_passive_cmd,
1388 "ipv6 ospf6 passive",
1389 IP6_STR
1390 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001391 "passive interface, No adjacency will be formed on this interface\n"
paul718e3742002-12-13 20:15:29 +00001392 )
1393{
hasso508e53e2004-05-18 18:57:06 +00001394 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001395 struct interface *ifp;
paul1eb8ef22005-04-07 07:30:20 +00001396 struct listnode *node, *nnode;
hasso508e53e2004-05-18 18:57:06 +00001397 struct ospf6_neighbor *on;
paul718e3742002-12-13 20:15:29 +00001398
1399 ifp = (struct interface *) vty->index;
1400 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001401
hasso508e53e2004-05-18 18:57:06 +00001402 oi = (struct ospf6_interface *) ifp->info;
1403 if (oi == NULL)
1404 oi = ospf6_interface_create (ifp);
1405 assert (oi);
paul718e3742002-12-13 20:15:29 +00001406
hasso508e53e2004-05-18 18:57:06 +00001407 SET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);
1408 THREAD_OFF (oi->thread_send_hello);
1409
paul1eb8ef22005-04-07 07:30:20 +00001410 for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
paul718e3742002-12-13 20:15:29 +00001411 {
hasso508e53e2004-05-18 18:57:06 +00001412 THREAD_OFF (on->inactivity_timer);
hasso3e834b12005-06-24 07:50:12 +00001413 thread_add_event (master, inactivity_timer, on, 0);
paul718e3742002-12-13 20:15:29 +00001414 }
1415
1416 return CMD_SUCCESS;
1417}
1418
1419DEFUN (no_ipv6_ospf6_passive,
1420 no_ipv6_ospf6_passive_cmd,
1421 "no ipv6 ospf6 passive",
1422 NO_STR
1423 IP6_STR
1424 OSPF6_STR
1425 "passive interface: No Adjacency will be formed on this I/F\n"
1426 )
1427{
hasso508e53e2004-05-18 18:57:06 +00001428 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001429 struct interface *ifp;
1430
1431 ifp = (struct interface *) vty->index;
1432 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001433
hasso508e53e2004-05-18 18:57:06 +00001434 oi = (struct ospf6_interface *) ifp->info;
1435 if (oi == NULL)
1436 oi = ospf6_interface_create (ifp);
1437 assert (oi);
paul718e3742002-12-13 20:15:29 +00001438
hasso508e53e2004-05-18 18:57:06 +00001439 UNSET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);
1440 THREAD_OFF (oi->thread_send_hello);
1441 oi->thread_send_hello =
1442 thread_add_event (master, ospf6_hello_send, oi, 0);
paul718e3742002-12-13 20:15:29 +00001443
1444 return CMD_SUCCESS;
1445}
1446
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +04001447DEFUN (ipv6_ospf6_mtu_ignore,
1448 ipv6_ospf6_mtu_ignore_cmd,
1449 "ipv6 ospf6 mtu-ignore",
1450 IP6_STR
1451 OSPF6_STR
1452 "Ignore MTU mismatch on this interface\n"
1453 )
1454{
1455 struct ospf6_interface *oi;
1456 struct interface *ifp;
1457
1458 ifp = (struct interface *) vty->index;
1459 assert (ifp);
1460
1461 oi = (struct ospf6_interface *) ifp->info;
1462 if (oi == NULL)
1463 oi = ospf6_interface_create (ifp);
1464 assert (oi);
1465
1466 oi->mtu_ignore = 1;
1467
1468 return CMD_SUCCESS;
1469}
1470
1471DEFUN (no_ipv6_ospf6_mtu_ignore,
1472 no_ipv6_ospf6_mtu_ignore_cmd,
1473 "no ipv6 ospf6 mtu-ignore",
1474 NO_STR
1475 IP6_STR
1476 OSPF6_STR
1477 "Ignore MTU mismatch on this interface\n"
1478 )
1479{
1480 struct ospf6_interface *oi;
1481 struct interface *ifp;
1482
1483 ifp = (struct interface *) vty->index;
1484 assert (ifp);
1485
1486 oi = (struct ospf6_interface *) ifp->info;
1487 if (oi == NULL)
1488 oi = ospf6_interface_create (ifp);
1489 assert (oi);
1490
1491 oi->mtu_ignore = 0;
1492
1493 return CMD_SUCCESS;
1494}
1495
paul718e3742002-12-13 20:15:29 +00001496DEFUN (ipv6_ospf6_advertise_prefix_list,
1497 ipv6_ospf6_advertise_prefix_list_cmd,
1498 "ipv6 ospf6 advertise prefix-list WORD",
1499 IP6_STR
1500 OSPF6_STR
1501 "Advertising options\n"
1502 "Filter prefix using prefix-list\n"
1503 "Prefix list name\n"
1504 )
1505{
hasso508e53e2004-05-18 18:57:06 +00001506 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001507 struct interface *ifp;
1508
1509 ifp = (struct interface *) vty->index;
1510 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001511
hasso508e53e2004-05-18 18:57:06 +00001512 oi = (struct ospf6_interface *) ifp->info;
1513 if (oi == NULL)
1514 oi = ospf6_interface_create (ifp);
1515 assert (oi);
paul718e3742002-12-13 20:15:29 +00001516
hasso508e53e2004-05-18 18:57:06 +00001517 if (oi->plist_name)
1518 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
1519 oi->plist_name = XSTRDUP (MTYPE_PREFIX_LIST_STR, argv[0]);
paul718e3742002-12-13 20:15:29 +00001520
hasso508e53e2004-05-18 18:57:06 +00001521 ospf6_interface_connected_route_update (oi->interface);
David Ward2470e992010-01-05 02:45:39 +00001522
1523 if (oi->area)
hasso508e53e2004-05-18 18:57:06 +00001524 {
David Ward2470e992010-01-05 02:45:39 +00001525 OSPF6_LINK_LSA_SCHEDULE (oi);
1526 if (oi->state == OSPF6_INTERFACE_DR)
1527 {
1528 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1529 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1530 }
1531 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
hasso508e53e2004-05-18 18:57:06 +00001532 }
paul718e3742002-12-13 20:15:29 +00001533
1534 return CMD_SUCCESS;
1535}
1536
1537DEFUN (no_ipv6_ospf6_advertise_prefix_list,
1538 no_ipv6_ospf6_advertise_prefix_list_cmd,
1539 "no ipv6 ospf6 advertise prefix-list",
1540 NO_STR
1541 IP6_STR
1542 OSPF6_STR
1543 "Advertising options\n"
1544 "Filter prefix using prefix-list\n"
1545 )
1546{
hasso508e53e2004-05-18 18:57:06 +00001547 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001548 struct interface *ifp;
1549
1550 ifp = (struct interface *) vty->index;
1551 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001552
hasso508e53e2004-05-18 18:57:06 +00001553 oi = (struct ospf6_interface *) ifp->info;
1554 if (oi == NULL)
1555 oi = ospf6_interface_create (ifp);
1556 assert (oi);
1557
1558 if (oi->plist_name)
paul718e3742002-12-13 20:15:29 +00001559 {
hasso508e53e2004-05-18 18:57:06 +00001560 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
1561 oi->plist_name = NULL;
paul718e3742002-12-13 20:15:29 +00001562 }
1563
hasso508e53e2004-05-18 18:57:06 +00001564 ospf6_interface_connected_route_update (oi->interface);
David Ward2470e992010-01-05 02:45:39 +00001565
1566 if (oi->area)
hasso508e53e2004-05-18 18:57:06 +00001567 {
David Ward2470e992010-01-05 02:45:39 +00001568 OSPF6_LINK_LSA_SCHEDULE (oi);
1569 if (oi->state == OSPF6_INTERFACE_DR)
1570 {
1571 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1572 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1573 }
1574 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
hasso508e53e2004-05-18 18:57:06 +00001575 }
paul718e3742002-12-13 20:15:29 +00001576
1577 return CMD_SUCCESS;
1578}
1579
Dinesh Duttc5926a92013-08-24 07:55:00 +00001580DEFUN (ipv6_ospf6_network,
1581 ipv6_ospf6_network_cmd,
1582 "ipv6 ospf6 network (broadcast|point-to-point)",
1583 IP6_STR
1584 OSPF6_STR
1585 "Network Type\n"
1586 "Specify OSPFv6 broadcast network\n"
1587 "Specify OSPF6 point-to-point network\n"
1588 )
1589{
1590 struct ospf6_interface *oi;
1591 struct interface *ifp;
1592
1593 ifp = (struct interface *) vty->index;
1594 assert (ifp);
1595
1596 oi = (struct ospf6_interface *) ifp->info;
1597 if (oi == NULL) {
1598 oi = ospf6_interface_create (ifp);
1599 }
1600 assert (oi);
1601
1602 if (strncmp (argv[0], "b", 1) == 0)
1603 {
1604 if (oi->type == OSPF_IFTYPE_BROADCAST)
1605 return CMD_SUCCESS;
1606
1607 oi->type = OSPF_IFTYPE_BROADCAST;
1608 }
1609 else if (strncmp (argv[0], "point-to-p", 10) == 0)
1610 {
1611 if (oi->type == OSPF_IFTYPE_POINTOPOINT) {
1612 return CMD_SUCCESS;
1613 }
1614 oi->type = OSPF_IFTYPE_POINTOPOINT;
1615 }
1616
1617 /* Reset the interface */
1618 thread_add_event (master, interface_down, oi, 0);
1619 thread_add_event (master, interface_up, oi, 0);
1620
1621 return CMD_SUCCESS;
1622}
1623
1624DEFUN (no_ipv6_ospf6_network,
1625 no_ipv6_ospf6_network_cmd,
1626 "no ipv6 ospf6 network",
1627 NO_STR
1628 IP6_STR
1629 OSPF6_STR
1630 "Network Type\n"
1631 "Default to whatever interface type system specifies"
1632 )
1633{
1634 struct ospf6_interface *oi;
1635 struct interface *ifp;
1636 int type;
1637
1638 ifp = (struct interface *) vty->index;
1639 assert (ifp);
1640
1641 oi = (struct ospf6_interface *) ifp->info;
1642 if (oi == NULL) {
1643 return CMD_SUCCESS;
1644 }
1645
1646 type = ospf6_default_iftype (ifp);
1647 if (oi->type == type)
1648 {
1649 return CMD_SUCCESS;
1650 }
1651 oi->type = type;
1652
1653 /* Reset the interface */
1654 thread_add_event (master, interface_down, oi, 0);
1655 thread_add_event (master, interface_up, oi, 0);
1656
1657 return CMD_SUCCESS;
1658}
1659
Paul Jakma6ac29a52008-08-15 13:45:30 +01001660static int
hasso508e53e2004-05-18 18:57:06 +00001661config_write_ospf6_interface (struct vty *vty)
paul718e3742002-12-13 20:15:29 +00001662{
hasso52dc7ee2004-09-23 19:18:23 +00001663 struct listnode *i;
hasso508e53e2004-05-18 18:57:06 +00001664 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001665 struct interface *ifp;
1666
paul1eb8ef22005-04-07 07:30:20 +00001667 for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
paul718e3742002-12-13 20:15:29 +00001668 {
hasso508e53e2004-05-18 18:57:06 +00001669 oi = (struct ospf6_interface *) ifp->info;
1670 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +00001671 continue;
1672
1673 vty_out (vty, "interface %s%s",
hasso049207c2004-08-04 20:02:13 +00001674 oi->interface->name, VNL);
hasso508e53e2004-05-18 18:57:06 +00001675
1676 if (ifp->desc)
hasso049207c2004-08-04 20:02:13 +00001677 vty_out (vty, " description %s%s", ifp->desc, VNL);
hasso1203e1c2004-07-23 21:34:27 +00001678 if (ifp->mtu6 != oi->ifmtu)
hasso049207c2004-08-04 20:02:13 +00001679 vty_out (vty, " ipv6 ospf6 ifmtu %d%s", oi->ifmtu, VNL);
Vyacheslav Trushkinb51a3a32012-02-10 10:42:45 +04001680
1681 if (oi->cost != OSPF6_INTERFACE_COST)
1682 vty_out (vty, " ipv6 ospf6 cost %d%s",
1683 oi->cost, VNL);
1684
1685 if (oi->hello_interval != OSPF6_INTERFACE_HELLO_INTERVAL)
1686 vty_out (vty, " ipv6 ospf6 hello-interval %d%s",
1687 oi->hello_interval, VNL);
1688
1689 if (oi->dead_interval != OSPF6_INTERFACE_DEAD_INTERVAL)
1690 vty_out (vty, " ipv6 ospf6 dead-interval %d%s",
1691 oi->dead_interval, VNL);
1692
1693 if (oi->rxmt_interval != OSPF6_INTERFACE_RXMT_INTERVAL)
1694 vty_out (vty, " ipv6 ospf6 retransmit-interval %d%s",
1695 oi->rxmt_interval, VNL);
1696
1697 if (oi->priority != OSPF6_INTERFACE_PRIORITY)
1698 vty_out (vty, " ipv6 ospf6 priority %d%s",
1699 oi->priority, VNL);
1700
1701 if (oi->transdelay != OSPF6_INTERFACE_TRANSDELAY)
1702 vty_out (vty, " ipv6 ospf6 transmit-delay %d%s",
1703 oi->transdelay, VNL);
1704
1705 if (oi->instance_id != OSPF6_INTERFACE_INSTANCE_ID)
1706 vty_out (vty, " ipv6 ospf6 instance-id %d%s",
1707 oi->instance_id, VNL);
paul718e3742002-12-13 20:15:29 +00001708
hasso508e53e2004-05-18 18:57:06 +00001709 if (oi->plist_name)
paul718e3742002-12-13 20:15:29 +00001710 vty_out (vty, " ipv6 ospf6 advertise prefix-list %s%s",
hasso049207c2004-08-04 20:02:13 +00001711 oi->plist_name, VNL);
paul718e3742002-12-13 20:15:29 +00001712
hasso508e53e2004-05-18 18:57:06 +00001713 if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE))
hasso049207c2004-08-04 20:02:13 +00001714 vty_out (vty, " ipv6 ospf6 passive%s", VNL);
paul718e3742002-12-13 20:15:29 +00001715
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +04001716 if (oi->mtu_ignore)
1717 vty_out (vty, " ipv6 ospf6 mtu-ignore%s", VNL);
1718
Dinesh Duttc5926a92013-08-24 07:55:00 +00001719 if (oi->type == OSPF_IFTYPE_POINTOPOINT)
1720 vty_out (vty, " ipv6 ospf6 network point-to-point%s", VNL);
1721 else if (oi->type == OSPF_IFTYPE_BROADCAST)
1722 vty_out (vty, " ipv6 ospf6 network broadcast%s", VNL);
1723
hasso049207c2004-08-04 20:02:13 +00001724 vty_out (vty, "!%s", VNL);
paul718e3742002-12-13 20:15:29 +00001725 }
1726 return 0;
1727}
1728
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08001729static struct cmd_node interface_node =
paul718e3742002-12-13 20:15:29 +00001730{
1731 INTERFACE_NODE,
1732 "%s(config-if)# ",
hasso69b4a812004-08-26 18:10:36 +00001733 1 /* VTYSH */
paul718e3742002-12-13 20:15:29 +00001734};
1735
1736void
Paul Jakma6ac29a52008-08-15 13:45:30 +01001737ospf6_interface_init (void)
paul718e3742002-12-13 20:15:29 +00001738{
1739 /* Install interface node. */
hasso508e53e2004-05-18 18:57:06 +00001740 install_node (&interface_node, config_write_ospf6_interface);
paul718e3742002-12-13 20:15:29 +00001741
1742 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_cmd);
hasso508e53e2004-05-18 18:57:06 +00001743 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_cmd);
1744 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd);
1745 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001746 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_cmd);
hasso508e53e2004-05-18 18:57:06 +00001747 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd);
1748 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd);
1749 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001750 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_cmd);
hasso508e53e2004-05-18 18:57:06 +00001751 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_cmd);
1752 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd);
1753 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001754 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_cmd);
hasso508e53e2004-05-18 18:57:06 +00001755 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd);
1756 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd);
1757 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001758
hasso508e53e2004-05-18 18:57:06 +00001759 install_element (CONFIG_NODE, &interface_cmd);
paul718e3742002-12-13 20:15:29 +00001760 install_default (INTERFACE_NODE);
1761 install_element (INTERFACE_NODE, &interface_desc_cmd);
1762 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
1763 install_element (INTERFACE_NODE, &ipv6_ospf6_cost_cmd);
hassob596c712004-07-09 18:33:43 +00001764 install_element (INTERFACE_NODE, &ipv6_ospf6_ifmtu_cmd);
hasso049207c2004-08-04 20:02:13 +00001765 install_element (INTERFACE_NODE, &no_ipv6_ospf6_ifmtu_cmd);
paul718e3742002-12-13 20:15:29 +00001766 install_element (INTERFACE_NODE, &ipv6_ospf6_deadinterval_cmd);
1767 install_element (INTERFACE_NODE, &ipv6_ospf6_hellointerval_cmd);
1768 install_element (INTERFACE_NODE, &ipv6_ospf6_priority_cmd);
1769 install_element (INTERFACE_NODE, &ipv6_ospf6_retransmitinterval_cmd);
1770 install_element (INTERFACE_NODE, &ipv6_ospf6_transmitdelay_cmd);
1771 install_element (INTERFACE_NODE, &ipv6_ospf6_instance_cmd);
hasso508e53e2004-05-18 18:57:06 +00001772
paul718e3742002-12-13 20:15:29 +00001773 install_element (INTERFACE_NODE, &ipv6_ospf6_passive_cmd);
1774 install_element (INTERFACE_NODE, &no_ipv6_ospf6_passive_cmd);
hasso508e53e2004-05-18 18:57:06 +00001775
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +04001776 install_element (INTERFACE_NODE, &ipv6_ospf6_mtu_ignore_cmd);
1777 install_element (INTERFACE_NODE, &no_ipv6_ospf6_mtu_ignore_cmd);
1778
hasso508e53e2004-05-18 18:57:06 +00001779 install_element (INTERFACE_NODE, &ipv6_ospf6_advertise_prefix_list_cmd);
1780 install_element (INTERFACE_NODE, &no_ipv6_ospf6_advertise_prefix_list_cmd);
Dinesh Duttc5926a92013-08-24 07:55:00 +00001781
1782 install_element (INTERFACE_NODE, &ipv6_ospf6_network_cmd);
1783 install_element (INTERFACE_NODE, &no_ipv6_ospf6_network_cmd);
hasso508e53e2004-05-18 18:57:06 +00001784}
1785
1786DEFUN (debug_ospf6_interface,
1787 debug_ospf6_interface_cmd,
1788 "debug ospf6 interface",
1789 DEBUG_STR
1790 OSPF6_STR
1791 "Debug OSPFv3 Interface\n"
1792 )
1793{
1794 OSPF6_DEBUG_INTERFACE_ON ();
1795 return CMD_SUCCESS;
1796}
1797
1798DEFUN (no_debug_ospf6_interface,
1799 no_debug_ospf6_interface_cmd,
1800 "no debug ospf6 interface",
1801 NO_STR
1802 DEBUG_STR
1803 OSPF6_STR
1804 "Debug OSPFv3 Interface\n"
1805 )
1806{
hasso3b687352004-08-19 06:56:53 +00001807 OSPF6_DEBUG_INTERFACE_OFF ();
hasso508e53e2004-05-18 18:57:06 +00001808 return CMD_SUCCESS;
1809}
1810
1811int
1812config_write_ospf6_debug_interface (struct vty *vty)
1813{
1814 if (IS_OSPF6_DEBUG_INTERFACE)
hasso049207c2004-08-04 20:02:13 +00001815 vty_out (vty, "debug ospf6 interface%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001816 return 0;
1817}
1818
1819void
Paul Jakma6ac29a52008-08-15 13:45:30 +01001820install_element_ospf6_debug_interface (void)
hasso508e53e2004-05-18 18:57:06 +00001821{
1822 install_element (ENABLE_NODE, &debug_ospf6_interface_cmd);
1823 install_element (ENABLE_NODE, &no_debug_ospf6_interface_cmd);
1824 install_element (CONFIG_NODE, &debug_ospf6_interface_cmd);
1825 install_element (CONFIG_NODE, &no_debug_ospf6_interface_cmd);
paul718e3742002-12-13 20:15:29 +00001826}
1827
1828