blob: 3fb3290ad6a0ba8094baa4daa30b37bb03797064 [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 "ospf6d.h"
33#include "ospf6_lsa.h"
paul718e3742002-12-13 20:15:29 +000034#include "ospf6_lsdb.h"
hasso508e53e2004-05-18 18:57:06 +000035#include "ospf6_network.h"
36#include "ospf6_message.h"
37#include "ospf6_route.h"
paul718e3742002-12-13 20:15:29 +000038#include "ospf6_top.h"
39#include "ospf6_area.h"
40#include "ospf6_interface.h"
hasso508e53e2004-05-18 18:57:06 +000041#include "ospf6_neighbor.h"
42#include "ospf6_intra.h"
43#include "ospf6_spf.h"
paul718e3742002-12-13 20:15:29 +000044
hasso508e53e2004-05-18 18:57:06 +000045unsigned char conf_debug_ospf6_interface = 0;
46
47char *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 +000074struct ospf6_interface *
75ospf6_interface_lookup_by_name (char *ifname)
paul718e3742002-12-13 20:15:29 +000076{
hasso508e53e2004-05-18 18:57:06 +000077 struct ospf6_interface *oi;
78 struct interface *ifp;
paul718e3742002-12-13 20:15:29 +000079
hasso508e53e2004-05-18 18:57:06 +000080 ifp = if_lookup_by_name (ifname);
81 if (ifp == NULL)
82 return (struct ospf6_interface *) NULL;
paul718e3742002-12-13 20:15:29 +000083
hasso508e53e2004-05-18 18:57:06 +000084 oi = (struct ospf6_interface *) ifp->info;
85 return oi;
paul718e3742002-12-13 20:15:29 +000086}
87
hasso508e53e2004-05-18 18:57:06 +000088/* schedule routing table recalculation */
paul718e3742002-12-13 20:15:29 +000089void
hasso508e53e2004-05-18 18:57:06 +000090ospf6_interface_lsdb_hook (struct ospf6_lsa *lsa)
paul718e3742002-12-13 20:15:29 +000091{
hasso508e53e2004-05-18 18:57:06 +000092 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +000093
hasso508e53e2004-05-18 18:57:06 +000094 oi = (struct ospf6_interface *) lsa->scope;
95 switch (ntohs (lsa->header->type))
96 {
97 case OSPF6_LSTYPE_LINK:
98 if (oi->state == OSPF6_INTERFACE_DR)
99 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
100 ospf6_spf_schedule (oi->area);
101 break;
paul718e3742002-12-13 20:15:29 +0000102
hasso508e53e2004-05-18 18:57:06 +0000103 default:
104 if (IS_OSPF6_DEBUG_LSA (RECV))
105 zlog_info ("Unknown LSA in Interface %s's lsdb",
106 oi->interface->name);
107 break;
108 }
paul718e3742002-12-13 20:15:29 +0000109}
110
111/* Create new ospf6 interface structure */
112struct ospf6_interface *
113ospf6_interface_create (struct interface *ifp)
114{
hasso508e53e2004-05-18 18:57:06 +0000115 struct ospf6_interface *oi;
hasso3b4cd3a2004-05-18 19:28:32 +0000116 int iobuflen;
paul718e3742002-12-13 20:15:29 +0000117
hasso508e53e2004-05-18 18:57:06 +0000118 oi = (struct ospf6_interface *)
paul718e3742002-12-13 20:15:29 +0000119 XMALLOC (MTYPE_OSPF6_IF, sizeof (struct ospf6_interface));
120
hasso508e53e2004-05-18 18:57:06 +0000121 if (oi)
122 memset (oi, 0, sizeof (struct ospf6_interface));
paul718e3742002-12-13 20:15:29 +0000123 else
124 {
125 zlog_err ("Can't malloc ospf6_interface for ifindex %d", ifp->ifindex);
126 return (struct ospf6_interface *) NULL;
127 }
128
hasso508e53e2004-05-18 18:57:06 +0000129 oi->area = (struct ospf6_area *) NULL;
130 oi->neighbor_list = list_new ();
131 oi->neighbor_list->cmp = ospf6_neighbor_cmp;
132 oi->linklocal_addr = (struct in6_addr *) NULL;
133 oi->instance_id = 0;
134 oi->transdelay = 1;
135 oi->priority = 1;
paul718e3742002-12-13 20:15:29 +0000136
hasso508e53e2004-05-18 18:57:06 +0000137 oi->hello_interval = 10;
138 oi->dead_interval = 40;
139 oi->rxmt_interval = 5;
140 oi->cost = 1;
hasso508e53e2004-05-18 18:57:06 +0000141 oi->state = OSPF6_INTERFACE_DOWN;
142 oi->flag = 0;
paul718e3742002-12-13 20:15:29 +0000143
hassob596c712004-07-09 18:33:43 +0000144 /* Try to adjust I/O buffer size with IfMtu */
hasso1203e1c2004-07-23 21:34:27 +0000145 oi->ifmtu = ifp->mtu6;
146 iobuflen = ospf6_iobuf_size (ifp->mtu6);
hassob596c712004-07-09 18:33:43 +0000147 if (oi->ifmtu > iobuflen)
hasso3b4cd3a2004-05-18 19:28:32 +0000148 {
149 zlog_info ("Interface %s: IfMtu is adjusted to I/O buffer size: %d.",
150 ifp->name, iobuflen);
151 oi->ifmtu = iobuflen;
152 }
hasso3b4cd3a2004-05-18 19:28:32 +0000153
hasso508e53e2004-05-18 18:57:06 +0000154 oi->lsupdate_list = ospf6_lsdb_create ();
155 oi->lsack_list = ospf6_lsdb_create ();
156 oi->lsdb = ospf6_lsdb_create ();
157 oi->lsdb->hook_add = ospf6_interface_lsdb_hook;
158 oi->lsdb->hook_remove = ospf6_interface_lsdb_hook;
paul718e3742002-12-13 20:15:29 +0000159
hasso508e53e2004-05-18 18:57:06 +0000160 oi->route_connected = ospf6_route_table_create ();
paul718e3742002-12-13 20:15:29 +0000161
162 /* link both */
hasso508e53e2004-05-18 18:57:06 +0000163 oi->interface = ifp;
164 ifp->info = oi;
paul718e3742002-12-13 20:15:29 +0000165
hasso508e53e2004-05-18 18:57:06 +0000166 return oi;
paul718e3742002-12-13 20:15:29 +0000167}
168
169void
hasso508e53e2004-05-18 18:57:06 +0000170ospf6_interface_delete (struct ospf6_interface *oi)
paul718e3742002-12-13 20:15:29 +0000171{
172 listnode n;
hasso508e53e2004-05-18 18:57:06 +0000173 struct ospf6_neighbor *on;
paul718e3742002-12-13 20:15:29 +0000174
hasso508e53e2004-05-18 18:57:06 +0000175 for (n = listhead (oi->neighbor_list); n; nextnode (n))
paul718e3742002-12-13 20:15:29 +0000176 {
hasso508e53e2004-05-18 18:57:06 +0000177 on = (struct ospf6_neighbor *) getdata (n);
178 ospf6_neighbor_delete (on);
paul718e3742002-12-13 20:15:29 +0000179 }
hasso508e53e2004-05-18 18:57:06 +0000180 list_delete (oi->neighbor_list);
paul718e3742002-12-13 20:15:29 +0000181
hasso508e53e2004-05-18 18:57:06 +0000182 THREAD_OFF (oi->thread_send_hello);
183 THREAD_OFF (oi->thread_send_lsupdate);
184 THREAD_OFF (oi->thread_send_lsack);
paul718e3742002-12-13 20:15:29 +0000185
hasso508e53e2004-05-18 18:57:06 +0000186 ospf6_lsdb_remove_all (oi->lsdb);
187 ospf6_lsdb_remove_all (oi->lsupdate_list);
188 ospf6_lsdb_remove_all (oi->lsack_list);
189
190 ospf6_lsdb_delete (oi->lsdb);
191 ospf6_lsdb_delete (oi->lsupdate_list);
192 ospf6_lsdb_delete (oi->lsack_list);
193
194 ospf6_route_table_delete (oi->route_connected);
paul718e3742002-12-13 20:15:29 +0000195
196 /* cut link */
hasso508e53e2004-05-18 18:57:06 +0000197 oi->interface->info = NULL;
paul718e3742002-12-13 20:15:29 +0000198
199 /* plist_name */
hasso508e53e2004-05-18 18:57:06 +0000200 if (oi->plist_name)
201 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
paul718e3742002-12-13 20:15:29 +0000202
hasso508e53e2004-05-18 18:57:06 +0000203 XFREE (MTYPE_OSPF6_IF, oi);
204}
205
206void
207ospf6_interface_enable (struct ospf6_interface *oi)
208{
209 UNSET_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE);
210
211 oi->thread_send_hello =
212 thread_add_event (master, ospf6_hello_send, oi, 0);
213}
214
215void
216ospf6_interface_disable (struct ospf6_interface *oi)
217{
218 listnode i;
219 struct ospf6_neighbor *on;
220
221 SET_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE);
222
223 for (i = listhead (oi->neighbor_list); i; nextnode (i))
224 {
225 on = (struct ospf6_neighbor *) getdata (i);
226 ospf6_neighbor_delete (on);
227 }
228 list_delete_all_node (oi->neighbor_list);
229
230 ospf6_lsdb_remove_all (oi->lsdb);
231 ospf6_lsdb_remove_all (oi->lsupdate_list);
232 ospf6_lsdb_remove_all (oi->lsack_list);
233
234 THREAD_OFF (oi->thread_send_hello);
235 THREAD_OFF (oi->thread_send_lsupdate);
236 THREAD_OFF (oi->thread_send_lsack);
paul718e3742002-12-13 20:15:29 +0000237}
238
239static struct in6_addr *
hasso508e53e2004-05-18 18:57:06 +0000240ospf6_interface_get_linklocal_address (struct interface *ifp)
paul718e3742002-12-13 20:15:29 +0000241{
242 listnode n;
243 struct connected *c;
244 struct in6_addr *l = (struct in6_addr *) NULL;
245
246 /* for each connected address */
247 for (n = listhead (ifp->connected); n; nextnode (n))
248 {
249 c = (struct connected *) getdata (n);
250
251 /* if family not AF_INET6, ignore */
252 if (c->address->family != AF_INET6)
253 continue;
254
255 /* linklocal scope check */
256 if (IN6_IS_ADDR_LINKLOCAL (&c->address->u.prefix6))
257 l = &c->address->u.prefix6;
258 }
259 return l;
260}
261
262void
263ospf6_interface_if_add (struct interface *ifp)
264{
hasso508e53e2004-05-18 18:57:06 +0000265 struct ospf6_interface *oi;
hasso3b4cd3a2004-05-18 19:28:32 +0000266 int iobuflen;
paul718e3742002-12-13 20:15:29 +0000267
hasso508e53e2004-05-18 18:57:06 +0000268 oi = (struct ospf6_interface *) ifp->info;
269 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000270 return;
271
hassob596c712004-07-09 18:33:43 +0000272 /* Try to adjust I/O buffer size with IfMtu */
273 if (oi->ifmtu == 0)
hasso1203e1c2004-07-23 21:34:27 +0000274 oi->ifmtu = ifp->mtu6;
275 iobuflen = ospf6_iobuf_size (ifp->mtu6);
hassob596c712004-07-09 18:33:43 +0000276 if (oi->ifmtu > iobuflen)
hasso3b4cd3a2004-05-18 19:28:32 +0000277 {
278 zlog_info ("Interface %s: IfMtu is adjusted to I/O buffer size: %d.",
279 ifp->name, iobuflen);
280 oi->ifmtu = iobuflen;
281 }
paul718e3742002-12-13 20:15:29 +0000282
283 /* interface start */
hasso508e53e2004-05-18 18:57:06 +0000284 if (oi->area)
285 thread_add_event (master, interface_up, oi, 0);
paul718e3742002-12-13 20:15:29 +0000286}
287
288void
289ospf6_interface_if_del (struct interface *ifp)
290{
hasso508e53e2004-05-18 18:57:06 +0000291 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000292
hasso508e53e2004-05-18 18:57:06 +0000293 oi = (struct ospf6_interface *) ifp->info;
294 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000295 return;
296
297 /* interface stop */
hasso508e53e2004-05-18 18:57:06 +0000298 if (oi->area)
299 thread_execute (master, interface_down, oi, 0);
paul718e3742002-12-13 20:15:29 +0000300
hasso508e53e2004-05-18 18:57:06 +0000301 listnode_delete (oi->area->if_list, oi);
302 oi->area = (struct ospf6_area *) NULL;
paul718e3742002-12-13 20:15:29 +0000303
304 /* cut link */
hasso508e53e2004-05-18 18:57:06 +0000305 oi->interface = NULL;
paul718e3742002-12-13 20:15:29 +0000306 ifp->info = NULL;
307
hasso508e53e2004-05-18 18:57:06 +0000308 ospf6_interface_delete (oi);
paul718e3742002-12-13 20:15:29 +0000309}
310
311void
312ospf6_interface_state_update (struct interface *ifp)
313{
hasso508e53e2004-05-18 18:57:06 +0000314 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000315
hasso508e53e2004-05-18 18:57:06 +0000316 oi = (struct ospf6_interface *) ifp->info;
317 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000318 return;
hasso508e53e2004-05-18 18:57:06 +0000319 if (oi->area == NULL)
paul718e3742002-12-13 20:15:29 +0000320 return;
321
322 if (if_is_up (ifp))
hasso508e53e2004-05-18 18:57:06 +0000323 thread_add_event (master, interface_up, oi, 0);
paul718e3742002-12-13 20:15:29 +0000324 else
hasso508e53e2004-05-18 18:57:06 +0000325 thread_add_event (master, interface_down, oi, 0);
paul718e3742002-12-13 20:15:29 +0000326
327 return;
328}
329
330void
hasso508e53e2004-05-18 18:57:06 +0000331ospf6_interface_connected_route_update (struct interface *ifp)
paul718e3742002-12-13 20:15:29 +0000332{
hasso508e53e2004-05-18 18:57:06 +0000333 struct ospf6_interface *oi;
334 struct ospf6_route *route;
335 struct connected *c;
336 listnode i;
paul718e3742002-12-13 20:15:29 +0000337
hasso508e53e2004-05-18 18:57:06 +0000338 oi = (struct ospf6_interface *) ifp->info;
339 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000340 return;
341
342 /* reset linklocal pointer */
hasso508e53e2004-05-18 18:57:06 +0000343 oi->linklocal_addr = ospf6_interface_get_linklocal_address (ifp);
paul718e3742002-12-13 20:15:29 +0000344
hasso508e53e2004-05-18 18:57:06 +0000345 /* if area is null, do not make connected-route list */
346 if (oi->area == NULL)
paul718e3742002-12-13 20:15:29 +0000347 return;
348
hasso508e53e2004-05-18 18:57:06 +0000349 /* update "route to advertise" interface route table */
350 ospf6_route_remove_all (oi->route_connected);
351 for (i = listhead (oi->interface->connected); i; nextnode (i))
352 {
353 c = (struct connected *) getdata (i);
354
355 if (c->address->family != AF_INET6)
356 continue;
357
358 CONTINUE_IF_ADDRESS_LINKLOCAL (c->address);
359 CONTINUE_IF_ADDRESS_UNSPECIFIED (c->address);
360 CONTINUE_IF_ADDRESS_LOOPBACK (c->address);
361 CONTINUE_IF_ADDRESS_V4COMPAT (c->address);
362 CONTINUE_IF_ADDRESS_V4MAPPED (c->address);
363
364 /* apply filter */
365 if (oi->plist_name)
366 {
367 struct prefix_list *plist;
368 enum prefix_list_type ret;
369 char buf[128];
370
371 prefix2str (c->address, buf, sizeof (buf));
372 plist = prefix_list_lookup (AFI_IP6, oi->plist_name);
373 ret = prefix_list_apply (plist, (void *) c->address);
374 if (ret == PREFIX_DENY)
375 {
376 zlog_info ("%s on %s filtered by prefix-list %s ",
377 buf, oi->interface->name, oi->plist_name);
378 continue;
379 }
380 }
381
382 route = ospf6_route_create ();
383 memcpy (&route->prefix, c->address, sizeof (struct prefix));
384 apply_mask (&route->prefix);
385 route->type = OSPF6_DEST_TYPE_NETWORK;
386 route->path.area_id = oi->area->area_id;
387 route->path.type = OSPF6_PATH_TYPE_INTRA;
388 route->path.cost = oi->cost;
389 route->nexthop[0].ifindex = oi->interface->ifindex;
390 inet_pton (AF_INET6, "::1", &route->nexthop[0].address);
391 ospf6_route_add (route, oi->route_connected);
392 }
393
paul718e3742002-12-13 20:15:29 +0000394 /* create new Link-LSA */
hasso508e53e2004-05-18 18:57:06 +0000395 OSPF6_LINK_LSA_SCHEDULE (oi);
396 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
397 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
paul718e3742002-12-13 20:15:29 +0000398}
399
hasso508e53e2004-05-18 18:57:06 +0000400static void
401ospf6_interface_state_change (u_char next_state, struct ospf6_interface *oi)
paul718e3742002-12-13 20:15:29 +0000402{
hasso508e53e2004-05-18 18:57:06 +0000403 u_char prev_state;
paul718e3742002-12-13 20:15:29 +0000404
hasso508e53e2004-05-18 18:57:06 +0000405 prev_state = oi->state;
406 oi->state = next_state;
paul718e3742002-12-13 20:15:29 +0000407
hasso508e53e2004-05-18 18:57:06 +0000408 if (prev_state == next_state)
409 return;
paul718e3742002-12-13 20:15:29 +0000410
hasso508e53e2004-05-18 18:57:06 +0000411 /* log */
412 if (IS_OSPF6_DEBUG_INTERFACE)
paul718e3742002-12-13 20:15:29 +0000413 {
hasso508e53e2004-05-18 18:57:06 +0000414 zlog_info ("Interface state change %s: %s -> %s", oi->interface->name,
415 ospf6_interface_state_str[prev_state],
416 ospf6_interface_state_str[next_state]);
paul718e3742002-12-13 20:15:29 +0000417 }
paul718e3742002-12-13 20:15:29 +0000418
hasso508e53e2004-05-18 18:57:06 +0000419 if ((prev_state == OSPF6_INTERFACE_DR ||
420 prev_state == OSPF6_INTERFACE_BDR) &&
421 (next_state != OSPF6_INTERFACE_DR &&
422 next_state != OSPF6_INTERFACE_BDR))
423 ospf6_leave_alldrouters (oi->interface->ifindex);
424 if ((prev_state != OSPF6_INTERFACE_DR &&
425 prev_state != OSPF6_INTERFACE_BDR) &&
426 (next_state == OSPF6_INTERFACE_DR ||
427 next_state == OSPF6_INTERFACE_BDR))
428 ospf6_join_alldrouters (oi->interface->ifindex);
paul718e3742002-12-13 20:15:29 +0000429
hasso508e53e2004-05-18 18:57:06 +0000430 OSPF6_ROUTER_LSA_SCHEDULE (oi->area);
431 if (prev_state == OSPF6_INTERFACE_DR || next_state == OSPF6_INTERFACE_DR)
paul718e3742002-12-13 20:15:29 +0000432 {
hasso508e53e2004-05-18 18:57:06 +0000433 OSPF6_NETWORK_LSA_SCHEDULE (oi);
434 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
435 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
paul718e3742002-12-13 20:15:29 +0000436 }
hasso508e53e2004-05-18 18:57:06 +0000437}
438
439
440/* DR Election, RFC2328 section 9.4 */
441
442#define IS_ELIGIBLE(n) \
443 ((n)->state >= OSPF6_NEIGHBOR_TWOWAY && (n)->priority != 0)
444
445static struct ospf6_neighbor *
446better_bdrouter (struct ospf6_neighbor *a, struct ospf6_neighbor *b)
447{
448 if ((a == NULL || ! IS_ELIGIBLE (a) || a->drouter == a->router_id) &&
449 (b == NULL || ! IS_ELIGIBLE (b) || b->drouter == b->router_id))
450 return NULL;
451 else if (a == NULL || ! IS_ELIGIBLE (a) || a->drouter == a->router_id)
452 return b;
453 else if (b == NULL || ! IS_ELIGIBLE (b) || b->drouter == b->router_id)
454 return a;
455
456 if (a->bdrouter == a->router_id && b->bdrouter != b->router_id)
457 return a;
458 if (a->bdrouter != a->router_id && b->bdrouter == b->router_id)
459 return b;
460
461 if (a->priority > b->priority)
462 return a;
463 if (a->priority < b->priority)
464 return b;
465
466 if (ntohl (a->router_id) > ntohl (b->router_id))
467 return a;
468 if (ntohl (a->router_id) < ntohl (b->router_id))
469 return b;
470
471 zlog_warn ("Router-ID duplicate ?");
472 return a;
473}
474
475static struct ospf6_neighbor *
476better_drouter (struct ospf6_neighbor *a, struct ospf6_neighbor *b)
477{
478 if ((a == NULL || ! IS_ELIGIBLE (a) || a->drouter != a->router_id) &&
479 (b == NULL || ! IS_ELIGIBLE (b) || b->drouter != b->router_id))
480 return NULL;
481 else if (a == NULL || ! IS_ELIGIBLE (a) || a->drouter != a->router_id)
482 return b;
483 else if (b == NULL || ! IS_ELIGIBLE (b) || b->drouter != b->router_id)
484 return a;
485
486 if (a->drouter == a->router_id && b->drouter != b->router_id)
487 return a;
488 if (a->drouter != a->router_id && b->drouter == b->router_id)
489 return b;
490
491 if (a->priority > b->priority)
492 return a;
493 if (a->priority < b->priority)
494 return b;
495
496 if (ntohl (a->router_id) > ntohl (b->router_id))
497 return a;
498 if (ntohl (a->router_id) < ntohl (b->router_id))
499 return b;
500
501 zlog_warn ("Router-ID duplicate ?");
502 return a;
503}
504
505static u_char
506dr_election (struct ospf6_interface *oi)
507{
508 listnode i;
509 struct ospf6_neighbor *on, *drouter, *bdrouter, myself;
510 struct ospf6_neighbor *best_drouter, *best_bdrouter;
511 u_char next_state = 0;
512
513 drouter = bdrouter = NULL;
514 best_drouter = best_bdrouter = NULL;
515
516 /* pseudo neighbor myself, including noting current DR/BDR (1) */
517 memset (&myself, 0, sizeof (myself));
518 inet_ntop (AF_INET, &oi->area->ospf6->router_id, myself.name,
519 sizeof (myself.name));
520 myself.state = OSPF6_NEIGHBOR_TWOWAY;
521 myself.drouter = oi->drouter;
522 myself.bdrouter = oi->bdrouter;
523 myself.priority = oi->priority;
524 myself.router_id = oi->area->ospf6->router_id;
525
526 /* Electing BDR (2) */
527 for (i = listhead (oi->neighbor_list); i; nextnode (i))
528 {
529 on = (struct ospf6_neighbor *) getdata (i);
530 bdrouter = better_bdrouter (bdrouter, on);
531 }
532 best_bdrouter = bdrouter;
533 bdrouter = better_bdrouter (best_bdrouter, &myself);
534
535 /* Electing DR (3) */
536 for (i = listhead (oi->neighbor_list); i; nextnode (i))
537 {
538 on = (struct ospf6_neighbor *) getdata (i);
539 drouter = better_drouter (drouter, on);
540 }
541 best_drouter = drouter;
542 drouter = better_drouter (best_drouter, &myself);
543 if (drouter == NULL)
544 drouter = bdrouter;
545
546 /* the router itself is newly/no longer DR/BDR (4) */
547 if ((drouter == &myself && myself.drouter != myself.router_id) ||
548 (drouter != &myself && myself.drouter == myself.router_id) ||
549 (bdrouter == &myself && myself.bdrouter != myself.router_id) ||
550 (bdrouter != &myself && myself.bdrouter == myself.router_id))
551 {
552 myself.drouter = (drouter ? drouter->router_id : htonl (0));
553 myself.bdrouter = (bdrouter ? bdrouter->router_id : htonl (0));
554
555 /* compatible to Electing BDR (2) */
556 bdrouter = better_bdrouter (best_bdrouter, &myself);
557
558 /* compatible to Electing DR (3) */
559 drouter = better_drouter (best_drouter, &myself);
560 if (drouter == NULL)
561 drouter = bdrouter;
562 }
563
564 /* Set interface state accordingly (5) */
565 if (drouter && drouter == &myself)
566 next_state = OSPF6_INTERFACE_DR;
567 else if (bdrouter && bdrouter == &myself)
568 next_state = OSPF6_INTERFACE_BDR;
569 else
570 next_state = OSPF6_INTERFACE_DROTHER;
571
572 /* If NBMA, schedule Start for each neighbor having priority of 0 (6) */
573 /* XXX */
574
575 /* If DR or BDR change, invoke AdjOK? for each neighbor (7) */
576 /* RFC 2328 section 12.4. Originating LSAs (3) will be handled
577 accordingly after AdjOK */
578 if (oi->drouter != (drouter ? drouter->router_id : htonl (0)) ||
579 oi->bdrouter != (bdrouter ? bdrouter->router_id : htonl (0)))
580 {
581 if (IS_OSPF6_DEBUG_INTERFACE)
582 zlog_info ("DR Election on %s: DR: %s BDR: %s", oi->interface->name,
583 (drouter ? drouter->name : "0.0.0.0"),
584 (bdrouter ? bdrouter->name : "0.0.0.0"));
585
586 for (i = listhead (oi->neighbor_list); i; nextnode (i))
587 {
588 on = (struct ospf6_neighbor *) getdata (i);
589 if (on->state < OSPF6_NEIGHBOR_TWOWAY)
590 continue;
591 /* Schedule AdjOK. */
592 thread_add_event (master, adj_ok, on, 0);
593 }
594 }
595
596 oi->drouter = (drouter ? drouter->router_id : htonl (0));
597 oi->bdrouter = (bdrouter ? bdrouter->router_id : htonl (0));
598 return next_state;
599}
600
601
602/* Interface State Machine */
603int
604interface_up (struct thread *thread)
605{
606 struct ospf6_interface *oi;
607
608 oi = (struct ospf6_interface *) THREAD_ARG (thread);
609 assert (oi && oi->interface);
610
611 if (IS_OSPF6_DEBUG_INTERFACE)
612 zlog_info ("Interface Event %s: [InterfaceUp]",
613 oi->interface->name);
614
615 /* check physical interface is up */
616 if (! if_is_up (oi->interface))
617 {
618 if (IS_OSPF6_DEBUG_INTERFACE)
619 zlog_info ("Interface %s is down, can't execute [InterfaceUp]",
620 oi->interface->name);
621 return 0;
622 }
623
624 /* if already enabled, do nothing */
625 if (oi->state > OSPF6_INTERFACE_DOWN)
626 {
627 if (IS_OSPF6_DEBUG_INTERFACE)
628 zlog_info ("Interface %s already enabled",
629 oi->interface->name);
630 return 0;
631 }
632
633 /* Join AllSPFRouters */
634 ospf6_join_allspfrouters (oi->interface->ifindex);
635
636 /* Update interface route */
637 ospf6_interface_connected_route_update (oi->interface);
638
639 /* Schedule Hello */
640 if (! CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE))
641 thread_add_event (master, ospf6_hello_send, oi, 0);
642
643 /* decide next interface state */
644 if (if_is_pointopoint (oi->interface))
645 ospf6_interface_state_change (OSPF6_INTERFACE_POINTTOPOINT, oi);
646 else if (oi->priority == 0)
647 ospf6_interface_state_change (OSPF6_INTERFACE_DROTHER, oi);
648 else
649 {
650 ospf6_interface_state_change (OSPF6_INTERFACE_WAITING, oi);
651 thread_add_timer (master, wait_timer, oi, oi->dead_interval);
652 }
653
654 return 0;
paul718e3742002-12-13 20:15:29 +0000655}
656
657int
hasso508e53e2004-05-18 18:57:06 +0000658wait_timer (struct thread *thread)
paul718e3742002-12-13 20:15:29 +0000659{
hasso508e53e2004-05-18 18:57:06 +0000660 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000661
hasso508e53e2004-05-18 18:57:06 +0000662 oi = (struct ospf6_interface *) THREAD_ARG (thread);
663 assert (oi && oi->interface);
paul718e3742002-12-13 20:15:29 +0000664
hasso508e53e2004-05-18 18:57:06 +0000665 if (IS_OSPF6_DEBUG_INTERFACE)
666 zlog_info ("Interface Event %s: [WaitTimer]",
667 oi->interface->name);
paul718e3742002-12-13 20:15:29 +0000668
hasso508e53e2004-05-18 18:57:06 +0000669 if (oi->state == OSPF6_INTERFACE_WAITING)
670 ospf6_interface_state_change (dr_election (oi), oi);
paul718e3742002-12-13 20:15:29 +0000671
hasso508e53e2004-05-18 18:57:06 +0000672 return 0;
paul718e3742002-12-13 20:15:29 +0000673}
674
hasso508e53e2004-05-18 18:57:06 +0000675int
676backup_seen (struct thread *thread)
paul718e3742002-12-13 20:15:29 +0000677{
hasso508e53e2004-05-18 18:57:06 +0000678 struct ospf6_interface *oi;
679
680 oi = (struct ospf6_interface *) THREAD_ARG (thread);
681 assert (oi && oi->interface);
682
683 if (IS_OSPF6_DEBUG_INTERFACE)
684 zlog_info ("Interface Event %s: [BackupSeen]",
685 oi->interface->name);
686
687 if (oi->state == OSPF6_INTERFACE_WAITING)
688 ospf6_interface_state_change (dr_election (oi), oi);
689
690 return 0;
paul718e3742002-12-13 20:15:29 +0000691}
692
hasso508e53e2004-05-18 18:57:06 +0000693int
694neighbor_change (struct thread *thread)
paul718e3742002-12-13 20:15:29 +0000695{
hasso508e53e2004-05-18 18:57:06 +0000696 struct ospf6_interface *oi;
697
698 oi = (struct ospf6_interface *) THREAD_ARG (thread);
699 assert (oi && oi->interface);
700
701 if (IS_OSPF6_DEBUG_INTERFACE)
702 zlog_info ("Interface Event %s: [NeighborChange]",
703 oi->interface->name);
704
705 if (oi->state == OSPF6_INTERFACE_DROTHER ||
706 oi->state == OSPF6_INTERFACE_BDR ||
707 oi->state == OSPF6_INTERFACE_DR)
708 ospf6_interface_state_change (dr_election (oi), oi);
709
710 return 0;
paul718e3742002-12-13 20:15:29 +0000711}
712
hasso508e53e2004-05-18 18:57:06 +0000713int
714loopind (struct thread *thread)
715{
716 struct ospf6_interface *oi;
717
718 oi = (struct ospf6_interface *) THREAD_ARG (thread);
719 assert (oi && oi->interface);
720
721 if (IS_OSPF6_DEBUG_INTERFACE)
722 zlog_info ("Interface Event %s: [LoopInd]",
723 oi->interface->name);
724
725 /* XXX not yet */
726
727 return 0;
728}
729
730int
731interface_down (struct thread *thread)
732{
733 struct ospf6_interface *oi;
734 listnode n;
735 struct ospf6_neighbor *on;
736
737 oi = (struct ospf6_interface *) THREAD_ARG (thread);
738 assert (oi && oi->interface);
739
740 if (IS_OSPF6_DEBUG_INTERFACE)
741 zlog_info ("Interface Event %s: [InterfaceDown]",
742 oi->interface->name);
743
744 /* Leave AllSPFRouters */
745 if (oi->state > OSPF6_INTERFACE_DOWN)
746 ospf6_leave_allspfrouters (oi->interface->ifindex);
747
748 ospf6_interface_state_change (OSPF6_INTERFACE_DOWN, oi);
749
750 for (n = listhead (oi->neighbor_list); n; nextnode (n))
751 {
752 on = (struct ospf6_neighbor *) getdata (n);
753 ospf6_neighbor_delete (on);
754 }
755 list_delete_all_node (oi->neighbor_list);
756
757 return 0;
758}
759
760
paul718e3742002-12-13 20:15:29 +0000761/* show specified interface structure */
762int
hasso508e53e2004-05-18 18:57:06 +0000763ospf6_interface_show (struct vty *vty, struct interface *ifp)
paul718e3742002-12-13 20:15:29 +0000764{
hasso508e53e2004-05-18 18:57:06 +0000765 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000766 struct connected *c;
767 struct prefix *p;
768 listnode i;
hasso508e53e2004-05-18 18:57:06 +0000769 char strbuf[64], drouter[32], bdrouter[32];
paul718e3742002-12-13 20:15:29 +0000770 char *updown[3] = {"down", "up", NULL};
771 char *type;
hasso508e53e2004-05-18 18:57:06 +0000772 struct timeval res, now;
773 char duration[32];
774 struct ospf6_lsa *lsa;
paul718e3742002-12-13 20:15:29 +0000775
776 /* check physical interface type */
hasso508e53e2004-05-18 18:57:06 +0000777 if (if_is_loopback (ifp))
paul718e3742002-12-13 20:15:29 +0000778 type = "LOOPBACK";
hasso508e53e2004-05-18 18:57:06 +0000779 else if (if_is_broadcast (ifp))
paul718e3742002-12-13 20:15:29 +0000780 type = "BROADCAST";
hasso508e53e2004-05-18 18:57:06 +0000781 else if (if_is_pointopoint (ifp))
paul718e3742002-12-13 20:15:29 +0000782 type = "POINTOPOINT";
783 else
784 type = "UNKNOWN";
785
786 vty_out (vty, "%s is %s, type %s%s",
hasso508e53e2004-05-18 18:57:06 +0000787 ifp->name, updown[if_is_up (ifp)], type,
paul718e3742002-12-13 20:15:29 +0000788 VTY_NEWLINE);
hasso508e53e2004-05-18 18:57:06 +0000789 vty_out (vty, " Interface ID: %d%s", ifp->ifindex, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000790
hasso508e53e2004-05-18 18:57:06 +0000791 if (ifp->info == NULL)
paul718e3742002-12-13 20:15:29 +0000792 {
793 vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE);
794 return 0;
795 }
796 else
hasso508e53e2004-05-18 18:57:06 +0000797 oi = (struct ospf6_interface *) ifp->info;
paul718e3742002-12-13 20:15:29 +0000798
799 vty_out (vty, " Internet Address:%s", VTY_NEWLINE);
hasso508e53e2004-05-18 18:57:06 +0000800 for (i = listhead (ifp->connected); i; nextnode (i))
paul718e3742002-12-13 20:15:29 +0000801 {
802 c = (struct connected *)getdata (i);
803 p = c->address;
804 prefix2str (p, strbuf, sizeof (strbuf));
805 switch (p->family)
806 {
807 case AF_INET:
hasso508e53e2004-05-18 18:57:06 +0000808 vty_out (vty, " inet : %s%s", strbuf,
paul718e3742002-12-13 20:15:29 +0000809 VTY_NEWLINE);
810 break;
811 case AF_INET6:
hasso508e53e2004-05-18 18:57:06 +0000812 vty_out (vty, " inet6: %s%s", strbuf,
paul718e3742002-12-13 20:15:29 +0000813 VTY_NEWLINE);
814 break;
815 default:
hasso508e53e2004-05-18 18:57:06 +0000816 vty_out (vty, " ??? : %s%s", strbuf,
paul718e3742002-12-13 20:15:29 +0000817 VTY_NEWLINE);
818 break;
819 }
820 }
821
hasso508e53e2004-05-18 18:57:06 +0000822 if (oi->area)
paul718e3742002-12-13 20:15:29 +0000823 {
hasso508e53e2004-05-18 18:57:06 +0000824 vty_out (vty, " Instance ID %d, Interface MTU %d (autodetect: %d)%s",
hasso1203e1c2004-07-23 21:34:27 +0000825 oi->instance_id, oi->ifmtu, ifp->mtu6, VTY_NEWLINE);
hasso508e53e2004-05-18 18:57:06 +0000826 inet_ntop (AF_INET, &oi->area->area_id,
paul718e3742002-12-13 20:15:29 +0000827 strbuf, sizeof (strbuf));
hasso508e53e2004-05-18 18:57:06 +0000828 vty_out (vty, " Area ID %s, Cost %hu%s", strbuf, oi->cost,
paul718e3742002-12-13 20:15:29 +0000829 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000830 }
831 else
832 vty_out (vty, " Not Attached to Area%s", VTY_NEWLINE);
833
834 vty_out (vty, " State %s, Transmit Delay %d sec, Priority %d%s",
hasso508e53e2004-05-18 18:57:06 +0000835 ospf6_interface_state_str[oi->state],
836 oi->transdelay, oi->priority,
paul718e3742002-12-13 20:15:29 +0000837 VTY_NEWLINE);
838 vty_out (vty, " Timer intervals configured:%s", VTY_NEWLINE);
839 vty_out (vty, " Hello %d, Dead %d, Retransmit %d%s",
hasso508e53e2004-05-18 18:57:06 +0000840 oi->hello_interval, oi->dead_interval, oi->rxmt_interval,
paul718e3742002-12-13 20:15:29 +0000841 VTY_NEWLINE);
842
hasso508e53e2004-05-18 18:57:06 +0000843 inet_ntop (AF_INET, &oi->drouter, drouter, sizeof (drouter));
844 inet_ntop (AF_INET, &oi->bdrouter, bdrouter, sizeof (bdrouter));
845 vty_out (vty, " DR: %s BDR: %s%s", drouter, bdrouter, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000846
847 vty_out (vty, " Number of I/F scoped LSAs is %u%s",
hasso508e53e2004-05-18 18:57:06 +0000848 oi->lsdb->count, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000849
850 gettimeofday (&now, (struct timezone *) NULL);
paul718e3742002-12-13 20:15:29 +0000851
hasso508e53e2004-05-18 18:57:06 +0000852 timerclear (&res);
853 if (oi->thread_send_lsupdate)
854 timersub (&oi->thread_send_lsupdate->u.sands, &now, &res);
855 timerstring (&res, duration, sizeof (duration));
856 vty_out (vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]%s",
857 oi->lsupdate_list->count, duration,
858 (oi->thread_send_lsupdate ? "on" : "off"),
859 VTY_NEWLINE);
860 for (lsa = ospf6_lsdb_head (oi->lsupdate_list); lsa;
861 lsa = ospf6_lsdb_next (lsa))
862 vty_out (vty, " %s%s", lsa->name, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000863
hasso508e53e2004-05-18 18:57:06 +0000864 timerclear (&res);
865 if (oi->thread_send_lsack)
866 timersub (&oi->thread_send_lsack->u.sands, &now, &res);
867 timerstring (&res, duration, sizeof (duration));
868 vty_out (vty, " %d Pending LSAs for LSAck in Time %s [thread %s]%s",
869 oi->lsack_list->count, duration,
870 (oi->thread_send_lsack ? "on" : "off"),
871 VTY_NEWLINE);
872 for (lsa = ospf6_lsdb_head (oi->lsack_list); lsa;
873 lsa = ospf6_lsdb_next (lsa))
874 vty_out (vty, " %s%s", lsa->name, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000875
hasso508e53e2004-05-18 18:57:06 +0000876 return 0;
paul718e3742002-12-13 20:15:29 +0000877}
878
879/* show interface */
880DEFUN (show_ipv6_ospf6_interface,
881 show_ipv6_ospf6_interface_ifname_cmd,
882 "show ipv6 ospf6 interface IFNAME",
883 SHOW_STR
884 IP6_STR
885 OSPF6_STR
886 INTERFACE_STR
887 IFNAME_STR
888 )
889{
890 struct interface *ifp;
891 listnode i;
892
893 if (argc)
894 {
895 ifp = if_lookup_by_name (argv[0]);
hasso508e53e2004-05-18 18:57:06 +0000896 if (ifp == NULL)
paul718e3742002-12-13 20:15:29 +0000897 {
898 vty_out (vty, "No such Interface: %s%s", argv[0],
hasso508e53e2004-05-18 18:57:06 +0000899 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000900 return CMD_WARNING;
901 }
902 ospf6_interface_show (vty, ifp);
903 }
904 else
905 {
906 for (i = listhead (iflist); i; nextnode (i))
907 {
hasso508e53e2004-05-18 18:57:06 +0000908 ifp = (struct interface *) getdata (i);
paul718e3742002-12-13 20:15:29 +0000909 ospf6_interface_show (vty, ifp);
910 }
911 }
hasso508e53e2004-05-18 18:57:06 +0000912
paul718e3742002-12-13 20:15:29 +0000913 return CMD_SUCCESS;
914}
915
916ALIAS (show_ipv6_ospf6_interface,
917 show_ipv6_ospf6_interface_cmd,
918 "show ipv6 ospf6 interface",
919 SHOW_STR
920 IP6_STR
921 OSPF6_STR
922 INTERFACE_STR
hasso508e53e2004-05-18 18:57:06 +0000923 );
paul718e3742002-12-13 20:15:29 +0000924
hasso508e53e2004-05-18 18:57:06 +0000925DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
926 show_ipv6_ospf6_interface_ifname_prefix_cmd,
927 "show ipv6 ospf6 interface IFNAME prefix",
928 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000929 IP6_STR
930 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +0000931 INTERFACE_STR
932 IFNAME_STR
933 "Display connected prefixes to advertise\n"
paul718e3742002-12-13 20:15:29 +0000934 )
935{
paul718e3742002-12-13 20:15:29 +0000936 struct interface *ifp;
hasso508e53e2004-05-18 18:57:06 +0000937 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000938
hasso508e53e2004-05-18 18:57:06 +0000939 ifp = if_lookup_by_name (argv[0]);
940 if (ifp == NULL)
941 {
942 vty_out (vty, "No such Interface: %s%s", argv[0], VTY_NEWLINE);
943 return CMD_WARNING;
944 }
paul718e3742002-12-13 20:15:29 +0000945
hasso508e53e2004-05-18 18:57:06 +0000946 oi = ifp->info;
947 if (oi == NULL)
948 {
949 vty_out (vty, "OSPFv3 is not enabled on %s%s", argv[0], VTY_NEWLINE);
950 return CMD_WARNING;
951 }
paul718e3742002-12-13 20:15:29 +0000952
hasso508e53e2004-05-18 18:57:06 +0000953 argc--;
954 argv++;
955 ospf6_route_table_show (vty, argc, argv, oi->route_connected);
paul718e3742002-12-13 20:15:29 +0000956
957 return CMD_SUCCESS;
958}
959
hasso508e53e2004-05-18 18:57:06 +0000960ALIAS (show_ipv6_ospf6_interface_ifname_prefix,
961 show_ipv6_ospf6_interface_ifname_prefix_detail_cmd,
962 "show ipv6 ospf6 interface IFNAME prefix (X:X::X:X|X:X::X:X/M|detail)",
963 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000964 IP6_STR
965 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +0000966 INTERFACE_STR
967 IFNAME_STR
968 "Display connected prefixes to advertise\n"
969 OSPF6_ROUTE_ADDRESS_STR
970 OSPF6_ROUTE_PREFIX_STR
971 "Dispaly details of the prefixes\n"
972 );
973
974ALIAS (show_ipv6_ospf6_interface_ifname_prefix,
975 show_ipv6_ospf6_interface_ifname_prefix_match_cmd,
976 "show ipv6 ospf6 interface IFNAME prefix X:X::X:X/M (match|detail)",
977 SHOW_STR
978 IP6_STR
979 OSPF6_STR
980 INTERFACE_STR
981 IFNAME_STR
982 "Display connected prefixes to advertise\n"
983 OSPF6_ROUTE_PREFIX_STR
984 OSPF6_ROUTE_MATCH_STR
985 "Dispaly details of the prefixes\n"
986 );
987
988DEFUN (show_ipv6_ospf6_interface_prefix,
989 show_ipv6_ospf6_interface_prefix_cmd,
990 "show ipv6 ospf6 interface prefix",
991 SHOW_STR
992 IP6_STR
993 OSPF6_STR
994 INTERFACE_STR
995 "Display connected prefixes to advertise\n"
paul718e3742002-12-13 20:15:29 +0000996 )
997{
hasso508e53e2004-05-18 18:57:06 +0000998 listnode i;
999 struct ospf6_interface *oi;
1000 struct interface *ifp;
1001
1002 for (i = listhead (iflist); i; nextnode (i))
1003 {
1004 ifp = (struct interface *) getdata (i);
1005 oi = (struct ospf6_interface *) ifp->info;
1006 if (oi == NULL)
1007 continue;
1008
1009 ospf6_route_table_show (vty, argc, argv, oi->route_connected);
1010 }
1011
1012 return CMD_SUCCESS;
1013}
1014
1015ALIAS (show_ipv6_ospf6_interface_prefix,
1016 show_ipv6_ospf6_interface_prefix_detail_cmd,
1017 "show ipv6 ospf6 interface prefix (X:X::X:X|X:X::X:X/M|detail)",
1018 SHOW_STR
1019 IP6_STR
1020 OSPF6_STR
1021 INTERFACE_STR
1022 "Display connected prefixes to advertise\n"
1023 OSPF6_ROUTE_ADDRESS_STR
1024 OSPF6_ROUTE_PREFIX_STR
1025 "Dispaly details of the prefixes\n"
1026 );
1027
1028ALIAS (show_ipv6_ospf6_interface_prefix,
1029 show_ipv6_ospf6_interface_prefix_match_cmd,
1030 "show ipv6 ospf6 interface prefix X:X::X:X/M (match|detail)",
1031 SHOW_STR
1032 IP6_STR
1033 OSPF6_STR
1034 INTERFACE_STR
1035 "Display connected prefixes to advertise\n"
1036 OSPF6_ROUTE_PREFIX_STR
1037 OSPF6_ROUTE_MATCH_STR
1038 "Dispaly details of the prefixes\n"
1039 );
1040
1041
1042/* interface variable set command */
hassob596c712004-07-09 18:33:43 +00001043DEFUN (ipv6_ospf6_ifmtu,
1044 ipv6_ospf6_ifmtu_cmd,
1045 "ipv6 ospf6 ifmtu <1-65535>",
1046 IP6_STR
1047 OSPF6_STR
1048 "Interface MTU\n"
1049 "OSPFv3 Interface MTU\n"
1050 )
1051{
1052 struct ospf6_interface *oi;
1053 struct interface *ifp;
1054 int ifmtu, iobuflen;
1055 listnode node;
1056 struct ospf6_neighbor *on;
1057
1058 ifp = (struct interface *) vty->index;
1059 assert (ifp);
1060
1061 oi = (struct ospf6_interface *) ifp->info;
1062 if (oi == NULL)
1063 oi = ospf6_interface_create (ifp);
1064 assert (oi);
1065
1066 ifmtu = strtol (argv[0], NULL, 10);
1067
1068 if (oi->ifmtu == ifmtu)
1069 return CMD_SUCCESS;
1070
hasso1203e1c2004-07-23 21:34:27 +00001071 if (ifp->mtu6 != 0 && ifp->mtu6 < ifmtu)
hassob596c712004-07-09 18:33:43 +00001072 {
1073 vty_out (vty, "%s's ospf6 ifmtu cannot go beyond physical mtu (%d)%s",
hasso1203e1c2004-07-23 21:34:27 +00001074 ifp->name, ifp->mtu6, VTY_NEWLINE);
hassob596c712004-07-09 18:33:43 +00001075 return CMD_WARNING;
1076 }
1077
1078 if (oi->ifmtu < ifmtu)
1079 {
1080 iobuflen = ospf6_iobuf_size (ifmtu);
1081 if (iobuflen < ifmtu)
1082 {
1083 vty_out (vty, "%s's ifmtu is adjusted to I/O buffer size (%d).%s",
1084 ifp->name, iobuflen, VTY_NEWLINE);
1085 oi->ifmtu = iobuflen;
1086 }
1087 else
1088 oi->ifmtu = ifmtu;
1089 }
1090 else
1091 oi->ifmtu = ifmtu;
1092
1093 /* re-establish adjacencies */
1094 for (node = listhead (oi->neighbor_list); node; nextnode (node))
1095 {
1096 on = (struct ospf6_neighbor *) getdata (node);
1097 THREAD_OFF (on->inactivity_timer);
1098 thread_execute (master, inactivity_timer, on, 0);
1099 }
1100
1101 return CMD_SUCCESS;
1102}
1103
hasso508e53e2004-05-18 18:57:06 +00001104DEFUN (ipv6_ospf6_cost,
1105 ipv6_ospf6_cost_cmd,
1106 "ipv6 ospf6 cost <1-65535>",
1107 IP6_STR
1108 OSPF6_STR
1109 "Interface cost\n"
1110 "Outgoing metric of this interface\n"
1111 )
1112{
1113 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001114 struct interface *ifp;
1115
1116 ifp = (struct interface *) vty->index;
1117 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001118
hasso508e53e2004-05-18 18:57:06 +00001119 oi = (struct ospf6_interface *) ifp->info;
1120 if (oi == NULL)
1121 oi = ospf6_interface_create (ifp);
1122 assert (oi);
1123
1124 if (oi->cost == strtol (argv[0], NULL, 10))
1125 return CMD_SUCCESS;
1126
1127 oi->cost = strtol (argv[0], NULL, 10);
1128
1129 /* update cost held in route_connected list in ospf6_interface */
1130 ospf6_interface_connected_route_update (oi->interface);
1131
1132 /* execute LSA hooks */
1133 if (oi->area)
1134 {
1135 OSPF6_LINK_LSA_SCHEDULE (oi);
1136 OSPF6_ROUTER_LSA_SCHEDULE (oi->area);
1137 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1138 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1139 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
1140 }
1141
1142 return CMD_SUCCESS;
1143}
1144
1145DEFUN (ipv6_ospf6_hellointerval,
1146 ipv6_ospf6_hellointerval_cmd,
1147 "ipv6 ospf6 hello-interval <1-65535>",
1148 IP6_STR
1149 OSPF6_STR
1150 "Interval time of Hello packets\n"
1151 SECONDS_STR
1152 )
1153{
1154 struct ospf6_interface *oi;
1155 struct interface *ifp;
1156
1157 ifp = (struct interface *) vty->index;
1158 assert (ifp);
1159
1160 oi = (struct ospf6_interface *) ifp->info;
1161 if (oi == NULL)
1162 oi = ospf6_interface_create (ifp);
1163 assert (oi);
1164
1165 oi->hello_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001166 return CMD_SUCCESS;
1167}
1168
1169/* interface variable set command */
1170DEFUN (ipv6_ospf6_deadinterval,
1171 ipv6_ospf6_deadinterval_cmd,
hasso508e53e2004-05-18 18:57:06 +00001172 "ipv6 ospf6 dead-interval <1-65535>",
paul718e3742002-12-13 20:15:29 +00001173 IP6_STR
1174 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001175 "Interval time after which a neighbor is declared down\n"
paul718e3742002-12-13 20:15:29 +00001176 SECONDS_STR
1177 )
1178{
hasso508e53e2004-05-18 18:57:06 +00001179 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001180 struct interface *ifp;
1181
1182 ifp = (struct interface *) vty->index;
1183 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001184
hasso508e53e2004-05-18 18:57:06 +00001185 oi = (struct ospf6_interface *) ifp->info;
1186 if (oi == NULL)
1187 oi = ospf6_interface_create (ifp);
1188 assert (oi);
1189
1190 oi->dead_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001191 return CMD_SUCCESS;
1192}
1193
1194/* interface variable set command */
1195DEFUN (ipv6_ospf6_transmitdelay,
1196 ipv6_ospf6_transmitdelay_cmd,
hasso508e53e2004-05-18 18:57:06 +00001197 "ipv6 ospf6 transmit-delay <1-3600>",
paul718e3742002-12-13 20:15:29 +00001198 IP6_STR
1199 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001200 "Transmit delay of this interface\n"
paul718e3742002-12-13 20:15:29 +00001201 SECONDS_STR
1202 )
1203{
hasso508e53e2004-05-18 18:57:06 +00001204 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001205 struct interface *ifp;
1206
1207 ifp = (struct interface *) vty->index;
1208 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001209
hasso508e53e2004-05-18 18:57:06 +00001210 oi = (struct ospf6_interface *) ifp->info;
1211 if (oi == NULL)
1212 oi = ospf6_interface_create (ifp);
1213 assert (oi);
1214
1215 oi->transdelay = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001216 return CMD_SUCCESS;
1217}
1218
1219/* interface variable set command */
1220DEFUN (ipv6_ospf6_retransmitinterval,
1221 ipv6_ospf6_retransmitinterval_cmd,
hasso508e53e2004-05-18 18:57:06 +00001222 "ipv6 ospf6 retransmit-interval <1-65535>",
paul718e3742002-12-13 20:15:29 +00001223 IP6_STR
1224 OSPF6_STR
1225 "Time between retransmitting lost link state advertisements\n"
1226 SECONDS_STR
1227 )
1228{
hasso508e53e2004-05-18 18:57:06 +00001229 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001230 struct interface *ifp;
1231
1232 ifp = (struct interface *) vty->index;
1233 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001234
hasso508e53e2004-05-18 18:57:06 +00001235 oi = (struct ospf6_interface *) ifp->info;
1236 if (oi == NULL)
1237 oi = ospf6_interface_create (ifp);
1238 assert (oi);
1239
1240 oi->rxmt_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001241 return CMD_SUCCESS;
1242}
1243
1244/* interface variable set command */
1245DEFUN (ipv6_ospf6_priority,
1246 ipv6_ospf6_priority_cmd,
hasso508e53e2004-05-18 18:57:06 +00001247 "ipv6 ospf6 priority <0-255>",
paul718e3742002-12-13 20:15:29 +00001248 IP6_STR
1249 OSPF6_STR
1250 "Router priority\n"
hasso508e53e2004-05-18 18:57:06 +00001251 "Priority value\n"
paul718e3742002-12-13 20:15:29 +00001252 )
1253{
hasso508e53e2004-05-18 18:57:06 +00001254 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001255 struct interface *ifp;
1256
1257 ifp = (struct interface *) vty->index;
1258 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001259
hasso508e53e2004-05-18 18:57:06 +00001260 oi = (struct ospf6_interface *) ifp->info;
1261 if (oi == NULL)
1262 oi = ospf6_interface_create (ifp);
1263 assert (oi);
paul718e3742002-12-13 20:15:29 +00001264
hasso508e53e2004-05-18 18:57:06 +00001265 oi->priority = strtol (argv[0], NULL, 10);
1266
1267 if (oi->area)
1268 ospf6_interface_state_change (dr_election (oi), oi);
paul718e3742002-12-13 20:15:29 +00001269
1270 return CMD_SUCCESS;
1271}
1272
1273DEFUN (ipv6_ospf6_instance,
1274 ipv6_ospf6_instance_cmd,
hasso508e53e2004-05-18 18:57:06 +00001275 "ipv6 ospf6 instance-id <0-255>",
paul718e3742002-12-13 20:15:29 +00001276 IP6_STR
1277 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001278 "Instance ID for this interface\n"
1279 "Instance ID value\n"
paul718e3742002-12-13 20:15:29 +00001280 )
1281{
hasso508e53e2004-05-18 18:57:06 +00001282 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001283 struct interface *ifp;
1284
1285 ifp = (struct interface *)vty->index;
1286 assert (ifp);
1287
hasso508e53e2004-05-18 18:57:06 +00001288 oi = (struct ospf6_interface *)ifp->info;
1289 if (oi == NULL)
1290 oi = ospf6_interface_create (ifp);
1291 assert (oi);
paul718e3742002-12-13 20:15:29 +00001292
hasso508e53e2004-05-18 18:57:06 +00001293 oi->instance_id = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001294 return CMD_SUCCESS;
1295}
1296
1297DEFUN (ipv6_ospf6_passive,
1298 ipv6_ospf6_passive_cmd,
1299 "ipv6 ospf6 passive",
1300 IP6_STR
1301 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001302 "passive interface, No adjacency will be formed on this interface\n"
paul718e3742002-12-13 20:15:29 +00001303 )
1304{
hasso508e53e2004-05-18 18:57:06 +00001305 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001306 struct interface *ifp;
1307 listnode node;
hasso508e53e2004-05-18 18:57:06 +00001308 struct ospf6_neighbor *on;
paul718e3742002-12-13 20:15:29 +00001309
1310 ifp = (struct interface *) vty->index;
1311 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001312
hasso508e53e2004-05-18 18:57:06 +00001313 oi = (struct ospf6_interface *) ifp->info;
1314 if (oi == NULL)
1315 oi = ospf6_interface_create (ifp);
1316 assert (oi);
paul718e3742002-12-13 20:15:29 +00001317
hasso508e53e2004-05-18 18:57:06 +00001318 SET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);
1319 THREAD_OFF (oi->thread_send_hello);
1320
1321 for (node = listhead (oi->neighbor_list); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00001322 {
hasso508e53e2004-05-18 18:57:06 +00001323 on = (struct ospf6_neighbor *) getdata (node);
1324 THREAD_OFF (on->inactivity_timer);
1325 thread_execute (master, inactivity_timer, on, 0);
paul718e3742002-12-13 20:15:29 +00001326 }
1327
1328 return CMD_SUCCESS;
1329}
1330
1331DEFUN (no_ipv6_ospf6_passive,
1332 no_ipv6_ospf6_passive_cmd,
1333 "no ipv6 ospf6 passive",
1334 NO_STR
1335 IP6_STR
1336 OSPF6_STR
1337 "passive interface: No Adjacency will be formed on this I/F\n"
1338 )
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 UNSET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);
1352 THREAD_OFF (oi->thread_send_hello);
1353 oi->thread_send_hello =
1354 thread_add_event (master, ospf6_hello_send, oi, 0);
paul718e3742002-12-13 20:15:29 +00001355
1356 return CMD_SUCCESS;
1357}
1358
1359DEFUN (ipv6_ospf6_advertise_prefix_list,
1360 ipv6_ospf6_advertise_prefix_list_cmd,
1361 "ipv6 ospf6 advertise prefix-list WORD",
1362 IP6_STR
1363 OSPF6_STR
1364 "Advertising options\n"
1365 "Filter prefix using prefix-list\n"
1366 "Prefix list name\n"
1367 )
1368{
hasso508e53e2004-05-18 18:57:06 +00001369 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001370 struct interface *ifp;
1371
1372 ifp = (struct interface *) vty->index;
1373 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001374
hasso508e53e2004-05-18 18:57:06 +00001375 oi = (struct ospf6_interface *) ifp->info;
1376 if (oi == NULL)
1377 oi = ospf6_interface_create (ifp);
1378 assert (oi);
paul718e3742002-12-13 20:15:29 +00001379
hasso508e53e2004-05-18 18:57:06 +00001380 if (oi->plist_name)
1381 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
1382 oi->plist_name = XSTRDUP (MTYPE_PREFIX_LIST_STR, argv[0]);
paul718e3742002-12-13 20:15:29 +00001383
hasso508e53e2004-05-18 18:57:06 +00001384 ospf6_interface_connected_route_update (oi->interface);
1385 OSPF6_LINK_LSA_SCHEDULE (oi);
1386 if (oi->state == OSPF6_INTERFACE_DR)
1387 {
1388 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1389 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1390 }
1391 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
paul718e3742002-12-13 20:15:29 +00001392
1393 return CMD_SUCCESS;
1394}
1395
1396DEFUN (no_ipv6_ospf6_advertise_prefix_list,
1397 no_ipv6_ospf6_advertise_prefix_list_cmd,
1398 "no ipv6 ospf6 advertise prefix-list",
1399 NO_STR
1400 IP6_STR
1401 OSPF6_STR
1402 "Advertising options\n"
1403 "Filter prefix using prefix-list\n"
1404 )
1405{
hasso508e53e2004-05-18 18:57:06 +00001406 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001407 struct interface *ifp;
1408
1409 ifp = (struct interface *) vty->index;
1410 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001411
hasso508e53e2004-05-18 18:57:06 +00001412 oi = (struct ospf6_interface *) ifp->info;
1413 if (oi == NULL)
1414 oi = ospf6_interface_create (ifp);
1415 assert (oi);
1416
1417 if (oi->plist_name)
paul718e3742002-12-13 20:15:29 +00001418 {
hasso508e53e2004-05-18 18:57:06 +00001419 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
1420 oi->plist_name = NULL;
paul718e3742002-12-13 20:15:29 +00001421 }
1422
hasso508e53e2004-05-18 18:57:06 +00001423 ospf6_interface_connected_route_update (oi->interface);
1424 OSPF6_LINK_LSA_SCHEDULE (oi);
1425 if (oi->state == OSPF6_INTERFACE_DR)
1426 {
1427 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1428 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1429 }
1430 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
paul718e3742002-12-13 20:15:29 +00001431
1432 return CMD_SUCCESS;
1433}
1434
1435int
hasso508e53e2004-05-18 18:57:06 +00001436config_write_ospf6_interface (struct vty *vty)
paul718e3742002-12-13 20:15:29 +00001437{
1438 listnode i;
hasso508e53e2004-05-18 18:57:06 +00001439 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001440 struct interface *ifp;
1441
1442 for (i = listhead (iflist); i; nextnode (i))
1443 {
1444 ifp = (struct interface *) getdata (i);
hasso508e53e2004-05-18 18:57:06 +00001445 oi = (struct ospf6_interface *) ifp->info;
1446 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +00001447 continue;
1448
1449 vty_out (vty, "interface %s%s",
hasso508e53e2004-05-18 18:57:06 +00001450 oi->interface->name, VTY_NEWLINE);
1451
1452 if (ifp->desc)
1453 vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE);
1454
hasso1203e1c2004-07-23 21:34:27 +00001455 if (ifp->mtu6 != oi->ifmtu)
hassob596c712004-07-09 18:33:43 +00001456 vty_out (vty, " ipv6 ospf6 ifmtu %d%s", oi->ifmtu, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001457 vty_out (vty, " ipv6 ospf6 cost %d%s",
hasso508e53e2004-05-18 18:57:06 +00001458 oi->cost, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001459 vty_out (vty, " ipv6 ospf6 hello-interval %d%s",
hasso508e53e2004-05-18 18:57:06 +00001460 oi->hello_interval, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001461 vty_out (vty, " ipv6 ospf6 dead-interval %d%s",
hasso508e53e2004-05-18 18:57:06 +00001462 oi->dead_interval, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001463 vty_out (vty, " ipv6 ospf6 retransmit-interval %d%s",
hasso508e53e2004-05-18 18:57:06 +00001464 oi->rxmt_interval, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001465 vty_out (vty, " ipv6 ospf6 priority %d%s",
hasso508e53e2004-05-18 18:57:06 +00001466 oi->priority, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001467 vty_out (vty, " ipv6 ospf6 transmit-delay %d%s",
hasso508e53e2004-05-18 18:57:06 +00001468 oi->transdelay, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001469 vty_out (vty, " ipv6 ospf6 instance-id %d%s",
hasso508e53e2004-05-18 18:57:06 +00001470 oi->instance_id, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001471
hasso508e53e2004-05-18 18:57:06 +00001472 if (oi->plist_name)
paul718e3742002-12-13 20:15:29 +00001473 vty_out (vty, " ipv6 ospf6 advertise prefix-list %s%s",
hasso508e53e2004-05-18 18:57:06 +00001474 oi->plist_name, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001475
hasso508e53e2004-05-18 18:57:06 +00001476 if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE))
paul718e3742002-12-13 20:15:29 +00001477 vty_out (vty, " ipv6 ospf6 passive%s", VTY_NEWLINE);
1478
1479 vty_out (vty, "!%s", VTY_NEWLINE);
1480 }
1481 return 0;
1482}
1483
1484struct cmd_node interface_node =
1485{
1486 INTERFACE_NODE,
1487 "%s(config-if)# ",
paul718e3742002-12-13 20:15:29 +00001488};
1489
1490void
1491ospf6_interface_init ()
1492{
1493 /* Install interface node. */
hasso508e53e2004-05-18 18:57:06 +00001494 install_node (&interface_node, config_write_ospf6_interface);
paul718e3742002-12-13 20:15:29 +00001495
1496 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_cmd);
hasso508e53e2004-05-18 18:57:06 +00001497 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_cmd);
1498 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd);
1499 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001500 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_cmd);
hasso508e53e2004-05-18 18:57:06 +00001501 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd);
1502 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd);
1503 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001504 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_cmd);
hasso508e53e2004-05-18 18:57:06 +00001505 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_cmd);
1506 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd);
1507 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001508 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_cmd);
hasso508e53e2004-05-18 18:57:06 +00001509 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd);
1510 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd);
1511 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001512
hasso508e53e2004-05-18 18:57:06 +00001513 install_element (CONFIG_NODE, &interface_cmd);
paul718e3742002-12-13 20:15:29 +00001514 install_default (INTERFACE_NODE);
1515 install_element (INTERFACE_NODE, &interface_desc_cmd);
1516 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
1517 install_element (INTERFACE_NODE, &ipv6_ospf6_cost_cmd);
hassob596c712004-07-09 18:33:43 +00001518 install_element (INTERFACE_NODE, &ipv6_ospf6_ifmtu_cmd);
paul718e3742002-12-13 20:15:29 +00001519 install_element (INTERFACE_NODE, &ipv6_ospf6_deadinterval_cmd);
1520 install_element (INTERFACE_NODE, &ipv6_ospf6_hellointerval_cmd);
1521 install_element (INTERFACE_NODE, &ipv6_ospf6_priority_cmd);
1522 install_element (INTERFACE_NODE, &ipv6_ospf6_retransmitinterval_cmd);
1523 install_element (INTERFACE_NODE, &ipv6_ospf6_transmitdelay_cmd);
1524 install_element (INTERFACE_NODE, &ipv6_ospf6_instance_cmd);
hasso508e53e2004-05-18 18:57:06 +00001525
paul718e3742002-12-13 20:15:29 +00001526 install_element (INTERFACE_NODE, &ipv6_ospf6_passive_cmd);
1527 install_element (INTERFACE_NODE, &no_ipv6_ospf6_passive_cmd);
hasso508e53e2004-05-18 18:57:06 +00001528
1529 install_element (INTERFACE_NODE, &ipv6_ospf6_advertise_prefix_list_cmd);
1530 install_element (INTERFACE_NODE, &no_ipv6_ospf6_advertise_prefix_list_cmd);
1531}
1532
1533DEFUN (debug_ospf6_interface,
1534 debug_ospf6_interface_cmd,
1535 "debug ospf6 interface",
1536 DEBUG_STR
1537 OSPF6_STR
1538 "Debug OSPFv3 Interface\n"
1539 )
1540{
1541 OSPF6_DEBUG_INTERFACE_ON ();
1542 return CMD_SUCCESS;
1543}
1544
1545DEFUN (no_debug_ospf6_interface,
1546 no_debug_ospf6_interface_cmd,
1547 "no debug ospf6 interface",
1548 NO_STR
1549 DEBUG_STR
1550 OSPF6_STR
1551 "Debug OSPFv3 Interface\n"
1552 )
1553{
1554 OSPF6_DEBUG_INTERFACE_ON ();
1555 return CMD_SUCCESS;
1556}
1557
1558int
1559config_write_ospf6_debug_interface (struct vty *vty)
1560{
1561 if (IS_OSPF6_DEBUG_INTERFACE)
1562 vty_out (vty, "debug ospf6 interface%s", VTY_NEWLINE);
1563 return 0;
1564}
1565
1566void
1567install_element_ospf6_debug_interface ()
1568{
1569 install_element (ENABLE_NODE, &debug_ospf6_interface_cmd);
1570 install_element (ENABLE_NODE, &no_debug_ospf6_interface_cmd);
1571 install_element (CONFIG_NODE, &debug_ospf6_interface_cmd);
1572 install_element (CONFIG_NODE, &no_debug_ospf6_interface_cmd);
paul718e3742002-12-13 20:15:29 +00001573}
1574
1575