blob: 9a0292057159e517ae8ade4b341c755b3193d080 [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
hasso3b4cd3a2004-05-18 19:28:32 +0000144 /* Try to adust I/O buffer size with IfMtu */
145 iobuflen = ospf6_iobuf_size (ifp->mtu);
146 if (iobuflen < ifp->mtu)
147 {
148 zlog_info ("Interface %s: IfMtu is adjusted to I/O buffer size: %d.",
149 ifp->name, iobuflen);
150 oi->ifmtu = iobuflen;
151 }
152 else
153 oi->ifmtu = ifp->mtu;
154
hasso508e53e2004-05-18 18:57:06 +0000155 oi->lsupdate_list = ospf6_lsdb_create ();
156 oi->lsack_list = ospf6_lsdb_create ();
157 oi->lsdb = ospf6_lsdb_create ();
158 oi->lsdb->hook_add = ospf6_interface_lsdb_hook;
159 oi->lsdb->hook_remove = ospf6_interface_lsdb_hook;
paul718e3742002-12-13 20:15:29 +0000160
hasso508e53e2004-05-18 18:57:06 +0000161 oi->route_connected = ospf6_route_table_create ();
paul718e3742002-12-13 20:15:29 +0000162
163 /* link both */
hasso508e53e2004-05-18 18:57:06 +0000164 oi->interface = ifp;
165 ifp->info = oi;
paul718e3742002-12-13 20:15:29 +0000166
hasso508e53e2004-05-18 18:57:06 +0000167 return oi;
paul718e3742002-12-13 20:15:29 +0000168}
169
170void
hasso508e53e2004-05-18 18:57:06 +0000171ospf6_interface_delete (struct ospf6_interface *oi)
paul718e3742002-12-13 20:15:29 +0000172{
173 listnode n;
hasso508e53e2004-05-18 18:57:06 +0000174 struct ospf6_neighbor *on;
paul718e3742002-12-13 20:15:29 +0000175
hasso508e53e2004-05-18 18:57:06 +0000176 for (n = listhead (oi->neighbor_list); n; nextnode (n))
paul718e3742002-12-13 20:15:29 +0000177 {
hasso508e53e2004-05-18 18:57:06 +0000178 on = (struct ospf6_neighbor *) getdata (n);
179 ospf6_neighbor_delete (on);
paul718e3742002-12-13 20:15:29 +0000180 }
hasso508e53e2004-05-18 18:57:06 +0000181 list_delete (oi->neighbor_list);
paul718e3742002-12-13 20:15:29 +0000182
hasso508e53e2004-05-18 18:57:06 +0000183 THREAD_OFF (oi->thread_send_hello);
184 THREAD_OFF (oi->thread_send_lsupdate);
185 THREAD_OFF (oi->thread_send_lsack);
paul718e3742002-12-13 20:15:29 +0000186
hasso508e53e2004-05-18 18:57:06 +0000187 ospf6_lsdb_remove_all (oi->lsdb);
188 ospf6_lsdb_remove_all (oi->lsupdate_list);
189 ospf6_lsdb_remove_all (oi->lsack_list);
190
191 ospf6_lsdb_delete (oi->lsdb);
192 ospf6_lsdb_delete (oi->lsupdate_list);
193 ospf6_lsdb_delete (oi->lsack_list);
194
195 ospf6_route_table_delete (oi->route_connected);
paul718e3742002-12-13 20:15:29 +0000196
197 /* cut link */
hasso508e53e2004-05-18 18:57:06 +0000198 oi->interface->info = NULL;
paul718e3742002-12-13 20:15:29 +0000199
200 /* plist_name */
hasso508e53e2004-05-18 18:57:06 +0000201 if (oi->plist_name)
202 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
paul718e3742002-12-13 20:15:29 +0000203
hasso508e53e2004-05-18 18:57:06 +0000204 XFREE (MTYPE_OSPF6_IF, oi);
205}
206
207void
208ospf6_interface_enable (struct ospf6_interface *oi)
209{
210 UNSET_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE);
211
212 oi->thread_send_hello =
213 thread_add_event (master, ospf6_hello_send, oi, 0);
214}
215
216void
217ospf6_interface_disable (struct ospf6_interface *oi)
218{
219 listnode i;
220 struct ospf6_neighbor *on;
221
222 SET_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE);
223
224 for (i = listhead (oi->neighbor_list); i; nextnode (i))
225 {
226 on = (struct ospf6_neighbor *) getdata (i);
227 ospf6_neighbor_delete (on);
228 }
229 list_delete_all_node (oi->neighbor_list);
230
231 ospf6_lsdb_remove_all (oi->lsdb);
232 ospf6_lsdb_remove_all (oi->lsupdate_list);
233 ospf6_lsdb_remove_all (oi->lsack_list);
234
235 THREAD_OFF (oi->thread_send_hello);
236 THREAD_OFF (oi->thread_send_lsupdate);
237 THREAD_OFF (oi->thread_send_lsack);
paul718e3742002-12-13 20:15:29 +0000238}
239
240static struct in6_addr *
hasso508e53e2004-05-18 18:57:06 +0000241ospf6_interface_get_linklocal_address (struct interface *ifp)
paul718e3742002-12-13 20:15:29 +0000242{
243 listnode n;
244 struct connected *c;
245 struct in6_addr *l = (struct in6_addr *) NULL;
246
247 /* for each connected address */
248 for (n = listhead (ifp->connected); n; nextnode (n))
249 {
250 c = (struct connected *) getdata (n);
251
252 /* if family not AF_INET6, ignore */
253 if (c->address->family != AF_INET6)
254 continue;
255
256 /* linklocal scope check */
257 if (IN6_IS_ADDR_LINKLOCAL (&c->address->u.prefix6))
258 l = &c->address->u.prefix6;
259 }
260 return l;
261}
262
263void
264ospf6_interface_if_add (struct interface *ifp)
265{
hasso508e53e2004-05-18 18:57:06 +0000266 struct ospf6_interface *oi;
hasso3b4cd3a2004-05-18 19:28:32 +0000267 int iobuflen;
paul718e3742002-12-13 20:15:29 +0000268
hasso508e53e2004-05-18 18:57:06 +0000269 oi = (struct ospf6_interface *) ifp->info;
270 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000271 return;
272
hasso3b4cd3a2004-05-18 19:28:32 +0000273 /* Try to adust I/O buffer size with IfMtu */
274 iobuflen = ospf6_iobuf_size (ifp->mtu);
275 if (iobuflen < ifp->mtu)
276 {
277 zlog_info ("Interface %s: IfMtu is adjusted to I/O buffer size: %d.",
278 ifp->name, iobuflen);
279 oi->ifmtu = iobuflen;
280 }
281 else
282 oi->ifmtu = ifp->mtu;
paul718e3742002-12-13 20:15:29 +0000283
284 /* interface start */
hasso508e53e2004-05-18 18:57:06 +0000285 if (oi->area)
286 thread_add_event (master, interface_up, oi, 0);
paul718e3742002-12-13 20:15:29 +0000287}
288
289void
290ospf6_interface_if_del (struct interface *ifp)
291{
hasso508e53e2004-05-18 18:57:06 +0000292 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000293
hasso508e53e2004-05-18 18:57:06 +0000294 oi = (struct ospf6_interface *) ifp->info;
295 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000296 return;
297
298 /* interface stop */
hasso508e53e2004-05-18 18:57:06 +0000299 if (oi->area)
300 thread_execute (master, interface_down, oi, 0);
paul718e3742002-12-13 20:15:29 +0000301
hasso508e53e2004-05-18 18:57:06 +0000302 listnode_delete (oi->area->if_list, oi);
303 oi->area = (struct ospf6_area *) NULL;
paul718e3742002-12-13 20:15:29 +0000304
305 /* cut link */
hasso508e53e2004-05-18 18:57:06 +0000306 oi->interface = NULL;
paul718e3742002-12-13 20:15:29 +0000307 ifp->info = NULL;
308
hasso508e53e2004-05-18 18:57:06 +0000309 ospf6_interface_delete (oi);
paul718e3742002-12-13 20:15:29 +0000310}
311
312void
313ospf6_interface_state_update (struct interface *ifp)
314{
hasso508e53e2004-05-18 18:57:06 +0000315 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000316
hasso508e53e2004-05-18 18:57:06 +0000317 oi = (struct ospf6_interface *) ifp->info;
318 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000319 return;
hasso508e53e2004-05-18 18:57:06 +0000320 if (oi->area == NULL)
paul718e3742002-12-13 20:15:29 +0000321 return;
322
323 if (if_is_up (ifp))
hasso508e53e2004-05-18 18:57:06 +0000324 thread_add_event (master, interface_up, oi, 0);
paul718e3742002-12-13 20:15:29 +0000325 else
hasso508e53e2004-05-18 18:57:06 +0000326 thread_add_event (master, interface_down, oi, 0);
paul718e3742002-12-13 20:15:29 +0000327
328 return;
329}
330
331void
hasso508e53e2004-05-18 18:57:06 +0000332ospf6_interface_connected_route_update (struct interface *ifp)
paul718e3742002-12-13 20:15:29 +0000333{
hasso508e53e2004-05-18 18:57:06 +0000334 struct ospf6_interface *oi;
335 struct ospf6_route *route;
336 struct connected *c;
337 listnode i;
paul718e3742002-12-13 20:15:29 +0000338
hasso508e53e2004-05-18 18:57:06 +0000339 oi = (struct ospf6_interface *) ifp->info;
340 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +0000341 return;
342
343 /* reset linklocal pointer */
hasso508e53e2004-05-18 18:57:06 +0000344 oi->linklocal_addr = ospf6_interface_get_linklocal_address (ifp);
paul718e3742002-12-13 20:15:29 +0000345
hasso508e53e2004-05-18 18:57:06 +0000346 /* if area is null, do not make connected-route list */
347 if (oi->area == NULL)
paul718e3742002-12-13 20:15:29 +0000348 return;
349
hasso508e53e2004-05-18 18:57:06 +0000350 /* update "route to advertise" interface route table */
351 ospf6_route_remove_all (oi->route_connected);
352 for (i = listhead (oi->interface->connected); i; nextnode (i))
353 {
354 c = (struct connected *) getdata (i);
355
356 if (c->address->family != AF_INET6)
357 continue;
358
359 CONTINUE_IF_ADDRESS_LINKLOCAL (c->address);
360 CONTINUE_IF_ADDRESS_UNSPECIFIED (c->address);
361 CONTINUE_IF_ADDRESS_LOOPBACK (c->address);
362 CONTINUE_IF_ADDRESS_V4COMPAT (c->address);
363 CONTINUE_IF_ADDRESS_V4MAPPED (c->address);
364
365 /* apply filter */
366 if (oi->plist_name)
367 {
368 struct prefix_list *plist;
369 enum prefix_list_type ret;
370 char buf[128];
371
372 prefix2str (c->address, buf, sizeof (buf));
373 plist = prefix_list_lookup (AFI_IP6, oi->plist_name);
374 ret = prefix_list_apply (plist, (void *) c->address);
375 if (ret == PREFIX_DENY)
376 {
377 zlog_info ("%s on %s filtered by prefix-list %s ",
378 buf, oi->interface->name, oi->plist_name);
379 continue;
380 }
381 }
382
383 route = ospf6_route_create ();
384 memcpy (&route->prefix, c->address, sizeof (struct prefix));
385 apply_mask (&route->prefix);
386 route->type = OSPF6_DEST_TYPE_NETWORK;
387 route->path.area_id = oi->area->area_id;
388 route->path.type = OSPF6_PATH_TYPE_INTRA;
389 route->path.cost = oi->cost;
390 route->nexthop[0].ifindex = oi->interface->ifindex;
391 inet_pton (AF_INET6, "::1", &route->nexthop[0].address);
392 ospf6_route_add (route, oi->route_connected);
393 }
394
paul718e3742002-12-13 20:15:29 +0000395 /* create new Link-LSA */
hasso508e53e2004-05-18 18:57:06 +0000396 OSPF6_LINK_LSA_SCHEDULE (oi);
397 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
398 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
paul718e3742002-12-13 20:15:29 +0000399}
400
hasso508e53e2004-05-18 18:57:06 +0000401static void
402ospf6_interface_state_change (u_char next_state, struct ospf6_interface *oi)
paul718e3742002-12-13 20:15:29 +0000403{
hasso508e53e2004-05-18 18:57:06 +0000404 u_char prev_state;
paul718e3742002-12-13 20:15:29 +0000405
hasso508e53e2004-05-18 18:57:06 +0000406 prev_state = oi->state;
407 oi->state = next_state;
paul718e3742002-12-13 20:15:29 +0000408
hasso508e53e2004-05-18 18:57:06 +0000409 if (prev_state == next_state)
410 return;
paul718e3742002-12-13 20:15:29 +0000411
hasso508e53e2004-05-18 18:57:06 +0000412 /* log */
413 if (IS_OSPF6_DEBUG_INTERFACE)
paul718e3742002-12-13 20:15:29 +0000414 {
hasso508e53e2004-05-18 18:57:06 +0000415 zlog_info ("Interface state change %s: %s -> %s", oi->interface->name,
416 ospf6_interface_state_str[prev_state],
417 ospf6_interface_state_str[next_state]);
paul718e3742002-12-13 20:15:29 +0000418 }
paul718e3742002-12-13 20:15:29 +0000419
hasso508e53e2004-05-18 18:57:06 +0000420 if ((prev_state == OSPF6_INTERFACE_DR ||
421 prev_state == OSPF6_INTERFACE_BDR) &&
422 (next_state != OSPF6_INTERFACE_DR &&
423 next_state != OSPF6_INTERFACE_BDR))
424 ospf6_leave_alldrouters (oi->interface->ifindex);
425 if ((prev_state != OSPF6_INTERFACE_DR &&
426 prev_state != OSPF6_INTERFACE_BDR) &&
427 (next_state == OSPF6_INTERFACE_DR ||
428 next_state == OSPF6_INTERFACE_BDR))
429 ospf6_join_alldrouters (oi->interface->ifindex);
paul718e3742002-12-13 20:15:29 +0000430
hasso508e53e2004-05-18 18:57:06 +0000431 OSPF6_ROUTER_LSA_SCHEDULE (oi->area);
432 if (prev_state == OSPF6_INTERFACE_DR || next_state == OSPF6_INTERFACE_DR)
paul718e3742002-12-13 20:15:29 +0000433 {
hasso508e53e2004-05-18 18:57:06 +0000434 OSPF6_NETWORK_LSA_SCHEDULE (oi);
435 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
436 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
paul718e3742002-12-13 20:15:29 +0000437 }
hasso508e53e2004-05-18 18:57:06 +0000438}
439
440
441/* DR Election, RFC2328 section 9.4 */
442
443#define IS_ELIGIBLE(n) \
444 ((n)->state >= OSPF6_NEIGHBOR_TWOWAY && (n)->priority != 0)
445
446static struct ospf6_neighbor *
447better_bdrouter (struct ospf6_neighbor *a, struct ospf6_neighbor *b)
448{
449 if ((a == NULL || ! IS_ELIGIBLE (a) || a->drouter == a->router_id) &&
450 (b == NULL || ! IS_ELIGIBLE (b) || b->drouter == b->router_id))
451 return NULL;
452 else if (a == NULL || ! IS_ELIGIBLE (a) || a->drouter == a->router_id)
453 return b;
454 else if (b == NULL || ! IS_ELIGIBLE (b) || b->drouter == b->router_id)
455 return a;
456
457 if (a->bdrouter == a->router_id && b->bdrouter != b->router_id)
458 return a;
459 if (a->bdrouter != a->router_id && b->bdrouter == b->router_id)
460 return b;
461
462 if (a->priority > b->priority)
463 return a;
464 if (a->priority < b->priority)
465 return b;
466
467 if (ntohl (a->router_id) > ntohl (b->router_id))
468 return a;
469 if (ntohl (a->router_id) < ntohl (b->router_id))
470 return b;
471
472 zlog_warn ("Router-ID duplicate ?");
473 return a;
474}
475
476static struct ospf6_neighbor *
477better_drouter (struct ospf6_neighbor *a, struct ospf6_neighbor *b)
478{
479 if ((a == NULL || ! IS_ELIGIBLE (a) || a->drouter != a->router_id) &&
480 (b == NULL || ! IS_ELIGIBLE (b) || b->drouter != b->router_id))
481 return NULL;
482 else if (a == NULL || ! IS_ELIGIBLE (a) || a->drouter != a->router_id)
483 return b;
484 else if (b == NULL || ! IS_ELIGIBLE (b) || b->drouter != b->router_id)
485 return a;
486
487 if (a->drouter == a->router_id && b->drouter != b->router_id)
488 return a;
489 if (a->drouter != a->router_id && b->drouter == b->router_id)
490 return b;
491
492 if (a->priority > b->priority)
493 return a;
494 if (a->priority < b->priority)
495 return b;
496
497 if (ntohl (a->router_id) > ntohl (b->router_id))
498 return a;
499 if (ntohl (a->router_id) < ntohl (b->router_id))
500 return b;
501
502 zlog_warn ("Router-ID duplicate ?");
503 return a;
504}
505
506static u_char
507dr_election (struct ospf6_interface *oi)
508{
509 listnode i;
510 struct ospf6_neighbor *on, *drouter, *bdrouter, myself;
511 struct ospf6_neighbor *best_drouter, *best_bdrouter;
512 u_char next_state = 0;
513
514 drouter = bdrouter = NULL;
515 best_drouter = best_bdrouter = NULL;
516
517 /* pseudo neighbor myself, including noting current DR/BDR (1) */
518 memset (&myself, 0, sizeof (myself));
519 inet_ntop (AF_INET, &oi->area->ospf6->router_id, myself.name,
520 sizeof (myself.name));
521 myself.state = OSPF6_NEIGHBOR_TWOWAY;
522 myself.drouter = oi->drouter;
523 myself.bdrouter = oi->bdrouter;
524 myself.priority = oi->priority;
525 myself.router_id = oi->area->ospf6->router_id;
526
527 /* Electing BDR (2) */
528 for (i = listhead (oi->neighbor_list); i; nextnode (i))
529 {
530 on = (struct ospf6_neighbor *) getdata (i);
531 bdrouter = better_bdrouter (bdrouter, on);
532 }
533 best_bdrouter = bdrouter;
534 bdrouter = better_bdrouter (best_bdrouter, &myself);
535
536 /* Electing DR (3) */
537 for (i = listhead (oi->neighbor_list); i; nextnode (i))
538 {
539 on = (struct ospf6_neighbor *) getdata (i);
540 drouter = better_drouter (drouter, on);
541 }
542 best_drouter = drouter;
543 drouter = better_drouter (best_drouter, &myself);
544 if (drouter == NULL)
545 drouter = bdrouter;
546
547 /* the router itself is newly/no longer DR/BDR (4) */
548 if ((drouter == &myself && myself.drouter != myself.router_id) ||
549 (drouter != &myself && myself.drouter == myself.router_id) ||
550 (bdrouter == &myself && myself.bdrouter != myself.router_id) ||
551 (bdrouter != &myself && myself.bdrouter == myself.router_id))
552 {
553 myself.drouter = (drouter ? drouter->router_id : htonl (0));
554 myself.bdrouter = (bdrouter ? bdrouter->router_id : htonl (0));
555
556 /* compatible to Electing BDR (2) */
557 bdrouter = better_bdrouter (best_bdrouter, &myself);
558
559 /* compatible to Electing DR (3) */
560 drouter = better_drouter (best_drouter, &myself);
561 if (drouter == NULL)
562 drouter = bdrouter;
563 }
564
565 /* Set interface state accordingly (5) */
566 if (drouter && drouter == &myself)
567 next_state = OSPF6_INTERFACE_DR;
568 else if (bdrouter && bdrouter == &myself)
569 next_state = OSPF6_INTERFACE_BDR;
570 else
571 next_state = OSPF6_INTERFACE_DROTHER;
572
573 /* If NBMA, schedule Start for each neighbor having priority of 0 (6) */
574 /* XXX */
575
576 /* If DR or BDR change, invoke AdjOK? for each neighbor (7) */
577 /* RFC 2328 section 12.4. Originating LSAs (3) will be handled
578 accordingly after AdjOK */
579 if (oi->drouter != (drouter ? drouter->router_id : htonl (0)) ||
580 oi->bdrouter != (bdrouter ? bdrouter->router_id : htonl (0)))
581 {
582 if (IS_OSPF6_DEBUG_INTERFACE)
583 zlog_info ("DR Election on %s: DR: %s BDR: %s", oi->interface->name,
584 (drouter ? drouter->name : "0.0.0.0"),
585 (bdrouter ? bdrouter->name : "0.0.0.0"));
586
587 for (i = listhead (oi->neighbor_list); i; nextnode (i))
588 {
589 on = (struct ospf6_neighbor *) getdata (i);
590 if (on->state < OSPF6_NEIGHBOR_TWOWAY)
591 continue;
592 /* Schedule AdjOK. */
593 thread_add_event (master, adj_ok, on, 0);
594 }
595 }
596
597 oi->drouter = (drouter ? drouter->router_id : htonl (0));
598 oi->bdrouter = (bdrouter ? bdrouter->router_id : htonl (0));
599 return next_state;
600}
601
602
603/* Interface State Machine */
604int
605interface_up (struct thread *thread)
606{
607 struct ospf6_interface *oi;
608
609 oi = (struct ospf6_interface *) THREAD_ARG (thread);
610 assert (oi && oi->interface);
611
612 if (IS_OSPF6_DEBUG_INTERFACE)
613 zlog_info ("Interface Event %s: [InterfaceUp]",
614 oi->interface->name);
615
616 /* check physical interface is up */
617 if (! if_is_up (oi->interface))
618 {
619 if (IS_OSPF6_DEBUG_INTERFACE)
620 zlog_info ("Interface %s is down, can't execute [InterfaceUp]",
621 oi->interface->name);
622 return 0;
623 }
624
625 /* if already enabled, do nothing */
626 if (oi->state > OSPF6_INTERFACE_DOWN)
627 {
628 if (IS_OSPF6_DEBUG_INTERFACE)
629 zlog_info ("Interface %s already enabled",
630 oi->interface->name);
631 return 0;
632 }
633
634 /* Join AllSPFRouters */
635 ospf6_join_allspfrouters (oi->interface->ifindex);
636
637 /* Update interface route */
638 ospf6_interface_connected_route_update (oi->interface);
639
640 /* Schedule Hello */
641 if (! CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE))
642 thread_add_event (master, ospf6_hello_send, oi, 0);
643
644 /* decide next interface state */
645 if (if_is_pointopoint (oi->interface))
646 ospf6_interface_state_change (OSPF6_INTERFACE_POINTTOPOINT, oi);
647 else if (oi->priority == 0)
648 ospf6_interface_state_change (OSPF6_INTERFACE_DROTHER, oi);
649 else
650 {
651 ospf6_interface_state_change (OSPF6_INTERFACE_WAITING, oi);
652 thread_add_timer (master, wait_timer, oi, oi->dead_interval);
653 }
654
655 return 0;
paul718e3742002-12-13 20:15:29 +0000656}
657
658int
hasso508e53e2004-05-18 18:57:06 +0000659wait_timer (struct thread *thread)
paul718e3742002-12-13 20:15:29 +0000660{
hasso508e53e2004-05-18 18:57:06 +0000661 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000662
hasso508e53e2004-05-18 18:57:06 +0000663 oi = (struct ospf6_interface *) THREAD_ARG (thread);
664 assert (oi && oi->interface);
paul718e3742002-12-13 20:15:29 +0000665
hasso508e53e2004-05-18 18:57:06 +0000666 if (IS_OSPF6_DEBUG_INTERFACE)
667 zlog_info ("Interface Event %s: [WaitTimer]",
668 oi->interface->name);
paul718e3742002-12-13 20:15:29 +0000669
hasso508e53e2004-05-18 18:57:06 +0000670 if (oi->state == OSPF6_INTERFACE_WAITING)
671 ospf6_interface_state_change (dr_election (oi), oi);
paul718e3742002-12-13 20:15:29 +0000672
hasso508e53e2004-05-18 18:57:06 +0000673 return 0;
paul718e3742002-12-13 20:15:29 +0000674}
675
hasso508e53e2004-05-18 18:57:06 +0000676int
677backup_seen (struct thread *thread)
paul718e3742002-12-13 20:15:29 +0000678{
hasso508e53e2004-05-18 18:57:06 +0000679 struct ospf6_interface *oi;
680
681 oi = (struct ospf6_interface *) THREAD_ARG (thread);
682 assert (oi && oi->interface);
683
684 if (IS_OSPF6_DEBUG_INTERFACE)
685 zlog_info ("Interface Event %s: [BackupSeen]",
686 oi->interface->name);
687
688 if (oi->state == OSPF6_INTERFACE_WAITING)
689 ospf6_interface_state_change (dr_election (oi), oi);
690
691 return 0;
paul718e3742002-12-13 20:15:29 +0000692}
693
hasso508e53e2004-05-18 18:57:06 +0000694int
695neighbor_change (struct thread *thread)
paul718e3742002-12-13 20:15:29 +0000696{
hasso508e53e2004-05-18 18:57:06 +0000697 struct ospf6_interface *oi;
698
699 oi = (struct ospf6_interface *) THREAD_ARG (thread);
700 assert (oi && oi->interface);
701
702 if (IS_OSPF6_DEBUG_INTERFACE)
703 zlog_info ("Interface Event %s: [NeighborChange]",
704 oi->interface->name);
705
706 if (oi->state == OSPF6_INTERFACE_DROTHER ||
707 oi->state == OSPF6_INTERFACE_BDR ||
708 oi->state == OSPF6_INTERFACE_DR)
709 ospf6_interface_state_change (dr_election (oi), oi);
710
711 return 0;
paul718e3742002-12-13 20:15:29 +0000712}
713
hasso508e53e2004-05-18 18:57:06 +0000714int
715loopind (struct thread *thread)
716{
717 struct ospf6_interface *oi;
718
719 oi = (struct ospf6_interface *) THREAD_ARG (thread);
720 assert (oi && oi->interface);
721
722 if (IS_OSPF6_DEBUG_INTERFACE)
723 zlog_info ("Interface Event %s: [LoopInd]",
724 oi->interface->name);
725
726 /* XXX not yet */
727
728 return 0;
729}
730
731int
732interface_down (struct thread *thread)
733{
734 struct ospf6_interface *oi;
735 listnode n;
736 struct ospf6_neighbor *on;
737
738 oi = (struct ospf6_interface *) THREAD_ARG (thread);
739 assert (oi && oi->interface);
740
741 if (IS_OSPF6_DEBUG_INTERFACE)
742 zlog_info ("Interface Event %s: [InterfaceDown]",
743 oi->interface->name);
744
745 /* Leave AllSPFRouters */
746 if (oi->state > OSPF6_INTERFACE_DOWN)
747 ospf6_leave_allspfrouters (oi->interface->ifindex);
748
749 ospf6_interface_state_change (OSPF6_INTERFACE_DOWN, oi);
750
751 for (n = listhead (oi->neighbor_list); n; nextnode (n))
752 {
753 on = (struct ospf6_neighbor *) getdata (n);
754 ospf6_neighbor_delete (on);
755 }
756 list_delete_all_node (oi->neighbor_list);
757
758 return 0;
759}
760
761
paul718e3742002-12-13 20:15:29 +0000762/* show specified interface structure */
763int
hasso508e53e2004-05-18 18:57:06 +0000764ospf6_interface_show (struct vty *vty, struct interface *ifp)
paul718e3742002-12-13 20:15:29 +0000765{
hasso508e53e2004-05-18 18:57:06 +0000766 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000767 struct connected *c;
768 struct prefix *p;
769 listnode i;
hasso508e53e2004-05-18 18:57:06 +0000770 char strbuf[64], drouter[32], bdrouter[32];
paul718e3742002-12-13 20:15:29 +0000771 char *updown[3] = {"down", "up", NULL};
772 char *type;
hasso508e53e2004-05-18 18:57:06 +0000773 struct timeval res, now;
774 char duration[32];
775 struct ospf6_lsa *lsa;
paul718e3742002-12-13 20:15:29 +0000776
777 /* check physical interface type */
hasso508e53e2004-05-18 18:57:06 +0000778 if (if_is_loopback (ifp))
paul718e3742002-12-13 20:15:29 +0000779 type = "LOOPBACK";
hasso508e53e2004-05-18 18:57:06 +0000780 else if (if_is_broadcast (ifp))
paul718e3742002-12-13 20:15:29 +0000781 type = "BROADCAST";
hasso508e53e2004-05-18 18:57:06 +0000782 else if (if_is_pointopoint (ifp))
paul718e3742002-12-13 20:15:29 +0000783 type = "POINTOPOINT";
784 else
785 type = "UNKNOWN";
786
787 vty_out (vty, "%s is %s, type %s%s",
hasso508e53e2004-05-18 18:57:06 +0000788 ifp->name, updown[if_is_up (ifp)], type,
paul718e3742002-12-13 20:15:29 +0000789 VTY_NEWLINE);
hasso508e53e2004-05-18 18:57:06 +0000790 vty_out (vty, " Interface ID: %d%s", ifp->ifindex, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000791
hasso508e53e2004-05-18 18:57:06 +0000792 if (ifp->info == NULL)
paul718e3742002-12-13 20:15:29 +0000793 {
794 vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE);
795 return 0;
796 }
797 else
hasso508e53e2004-05-18 18:57:06 +0000798 oi = (struct ospf6_interface *) ifp->info;
paul718e3742002-12-13 20:15:29 +0000799
800 vty_out (vty, " Internet Address:%s", VTY_NEWLINE);
hasso508e53e2004-05-18 18:57:06 +0000801 for (i = listhead (ifp->connected); i; nextnode (i))
paul718e3742002-12-13 20:15:29 +0000802 {
803 c = (struct connected *)getdata (i);
804 p = c->address;
805 prefix2str (p, strbuf, sizeof (strbuf));
806 switch (p->family)
807 {
808 case AF_INET:
hasso508e53e2004-05-18 18:57:06 +0000809 vty_out (vty, " inet : %s%s", strbuf,
paul718e3742002-12-13 20:15:29 +0000810 VTY_NEWLINE);
811 break;
812 case AF_INET6:
hasso508e53e2004-05-18 18:57:06 +0000813 vty_out (vty, " inet6: %s%s", strbuf,
paul718e3742002-12-13 20:15:29 +0000814 VTY_NEWLINE);
815 break;
816 default:
hasso508e53e2004-05-18 18:57:06 +0000817 vty_out (vty, " ??? : %s%s", strbuf,
paul718e3742002-12-13 20:15:29 +0000818 VTY_NEWLINE);
819 break;
820 }
821 }
822
hasso508e53e2004-05-18 18:57:06 +0000823 if (oi->area)
paul718e3742002-12-13 20:15:29 +0000824 {
hasso508e53e2004-05-18 18:57:06 +0000825 vty_out (vty, " Instance ID %d, Interface MTU %d (autodetect: %d)%s",
826 oi->instance_id, oi->ifmtu, ifp->mtu, VTY_NEWLINE);
827 inet_ntop (AF_INET, &oi->area->area_id,
paul718e3742002-12-13 20:15:29 +0000828 strbuf, sizeof (strbuf));
hasso508e53e2004-05-18 18:57:06 +0000829 vty_out (vty, " Area ID %s, Cost %hu%s", strbuf, oi->cost,
paul718e3742002-12-13 20:15:29 +0000830 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000831 }
832 else
833 vty_out (vty, " Not Attached to Area%s", VTY_NEWLINE);
834
835 vty_out (vty, " State %s, Transmit Delay %d sec, Priority %d%s",
hasso508e53e2004-05-18 18:57:06 +0000836 ospf6_interface_state_str[oi->state],
837 oi->transdelay, oi->priority,
paul718e3742002-12-13 20:15:29 +0000838 VTY_NEWLINE);
839 vty_out (vty, " Timer intervals configured:%s", VTY_NEWLINE);
840 vty_out (vty, " Hello %d, Dead %d, Retransmit %d%s",
hasso508e53e2004-05-18 18:57:06 +0000841 oi->hello_interval, oi->dead_interval, oi->rxmt_interval,
paul718e3742002-12-13 20:15:29 +0000842 VTY_NEWLINE);
843
hasso508e53e2004-05-18 18:57:06 +0000844 inet_ntop (AF_INET, &oi->drouter, drouter, sizeof (drouter));
845 inet_ntop (AF_INET, &oi->bdrouter, bdrouter, sizeof (bdrouter));
846 vty_out (vty, " DR: %s BDR: %s%s", drouter, bdrouter, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000847
848 vty_out (vty, " Number of I/F scoped LSAs is %u%s",
hasso508e53e2004-05-18 18:57:06 +0000849 oi->lsdb->count, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000850
851 gettimeofday (&now, (struct timezone *) NULL);
paul718e3742002-12-13 20:15:29 +0000852
hasso508e53e2004-05-18 18:57:06 +0000853 timerclear (&res);
854 if (oi->thread_send_lsupdate)
855 timersub (&oi->thread_send_lsupdate->u.sands, &now, &res);
856 timerstring (&res, duration, sizeof (duration));
857 vty_out (vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]%s",
858 oi->lsupdate_list->count, duration,
859 (oi->thread_send_lsupdate ? "on" : "off"),
860 VTY_NEWLINE);
861 for (lsa = ospf6_lsdb_head (oi->lsupdate_list); lsa;
862 lsa = ospf6_lsdb_next (lsa))
863 vty_out (vty, " %s%s", lsa->name, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000864
hasso508e53e2004-05-18 18:57:06 +0000865 timerclear (&res);
866 if (oi->thread_send_lsack)
867 timersub (&oi->thread_send_lsack->u.sands, &now, &res);
868 timerstring (&res, duration, sizeof (duration));
869 vty_out (vty, " %d Pending LSAs for LSAck in Time %s [thread %s]%s",
870 oi->lsack_list->count, duration,
871 (oi->thread_send_lsack ? "on" : "off"),
872 VTY_NEWLINE);
873 for (lsa = ospf6_lsdb_head (oi->lsack_list); lsa;
874 lsa = ospf6_lsdb_next (lsa))
875 vty_out (vty, " %s%s", lsa->name, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000876
hasso508e53e2004-05-18 18:57:06 +0000877 return 0;
paul718e3742002-12-13 20:15:29 +0000878}
879
880/* show interface */
881DEFUN (show_ipv6_ospf6_interface,
882 show_ipv6_ospf6_interface_ifname_cmd,
883 "show ipv6 ospf6 interface IFNAME",
884 SHOW_STR
885 IP6_STR
886 OSPF6_STR
887 INTERFACE_STR
888 IFNAME_STR
889 )
890{
891 struct interface *ifp;
892 listnode i;
893
894 if (argc)
895 {
896 ifp = if_lookup_by_name (argv[0]);
hasso508e53e2004-05-18 18:57:06 +0000897 if (ifp == NULL)
paul718e3742002-12-13 20:15:29 +0000898 {
899 vty_out (vty, "No such Interface: %s%s", argv[0],
hasso508e53e2004-05-18 18:57:06 +0000900 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000901 return CMD_WARNING;
902 }
903 ospf6_interface_show (vty, ifp);
904 }
905 else
906 {
907 for (i = listhead (iflist); i; nextnode (i))
908 {
hasso508e53e2004-05-18 18:57:06 +0000909 ifp = (struct interface *) getdata (i);
paul718e3742002-12-13 20:15:29 +0000910 ospf6_interface_show (vty, ifp);
911 }
912 }
hasso508e53e2004-05-18 18:57:06 +0000913
paul718e3742002-12-13 20:15:29 +0000914 return CMD_SUCCESS;
915}
916
917ALIAS (show_ipv6_ospf6_interface,
918 show_ipv6_ospf6_interface_cmd,
919 "show ipv6 ospf6 interface",
920 SHOW_STR
921 IP6_STR
922 OSPF6_STR
923 INTERFACE_STR
hasso508e53e2004-05-18 18:57:06 +0000924 );
paul718e3742002-12-13 20:15:29 +0000925
hasso508e53e2004-05-18 18:57:06 +0000926DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
927 show_ipv6_ospf6_interface_ifname_prefix_cmd,
928 "show ipv6 ospf6 interface IFNAME prefix",
929 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000930 IP6_STR
931 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +0000932 INTERFACE_STR
933 IFNAME_STR
934 "Display connected prefixes to advertise\n"
paul718e3742002-12-13 20:15:29 +0000935 )
936{
paul718e3742002-12-13 20:15:29 +0000937 struct interface *ifp;
hasso508e53e2004-05-18 18:57:06 +0000938 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +0000939
hasso508e53e2004-05-18 18:57:06 +0000940 ifp = if_lookup_by_name (argv[0]);
941 if (ifp == NULL)
942 {
943 vty_out (vty, "No such Interface: %s%s", argv[0], VTY_NEWLINE);
944 return CMD_WARNING;
945 }
paul718e3742002-12-13 20:15:29 +0000946
hasso508e53e2004-05-18 18:57:06 +0000947 oi = ifp->info;
948 if (oi == NULL)
949 {
950 vty_out (vty, "OSPFv3 is not enabled on %s%s", argv[0], VTY_NEWLINE);
951 return CMD_WARNING;
952 }
paul718e3742002-12-13 20:15:29 +0000953
hasso508e53e2004-05-18 18:57:06 +0000954 argc--;
955 argv++;
956 ospf6_route_table_show (vty, argc, argv, oi->route_connected);
paul718e3742002-12-13 20:15:29 +0000957
958 return CMD_SUCCESS;
959}
960
hasso508e53e2004-05-18 18:57:06 +0000961ALIAS (show_ipv6_ospf6_interface_ifname_prefix,
962 show_ipv6_ospf6_interface_ifname_prefix_detail_cmd,
963 "show ipv6 ospf6 interface IFNAME prefix (X:X::X:X|X:X::X:X/M|detail)",
964 SHOW_STR
paul718e3742002-12-13 20:15:29 +0000965 IP6_STR
966 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +0000967 INTERFACE_STR
968 IFNAME_STR
969 "Display connected prefixes to advertise\n"
970 OSPF6_ROUTE_ADDRESS_STR
971 OSPF6_ROUTE_PREFIX_STR
972 "Dispaly details of the prefixes\n"
973 );
974
975ALIAS (show_ipv6_ospf6_interface_ifname_prefix,
976 show_ipv6_ospf6_interface_ifname_prefix_match_cmd,
977 "show ipv6 ospf6 interface IFNAME prefix X:X::X:X/M (match|detail)",
978 SHOW_STR
979 IP6_STR
980 OSPF6_STR
981 INTERFACE_STR
982 IFNAME_STR
983 "Display connected prefixes to advertise\n"
984 OSPF6_ROUTE_PREFIX_STR
985 OSPF6_ROUTE_MATCH_STR
986 "Dispaly details of the prefixes\n"
987 );
988
989DEFUN (show_ipv6_ospf6_interface_prefix,
990 show_ipv6_ospf6_interface_prefix_cmd,
991 "show ipv6 ospf6 interface prefix",
992 SHOW_STR
993 IP6_STR
994 OSPF6_STR
995 INTERFACE_STR
996 "Display connected prefixes to advertise\n"
paul718e3742002-12-13 20:15:29 +0000997 )
998{
hasso508e53e2004-05-18 18:57:06 +0000999 listnode i;
1000 struct ospf6_interface *oi;
1001 struct interface *ifp;
1002
1003 for (i = listhead (iflist); i; nextnode (i))
1004 {
1005 ifp = (struct interface *) getdata (i);
1006 oi = (struct ospf6_interface *) ifp->info;
1007 if (oi == NULL)
1008 continue;
1009
1010 ospf6_route_table_show (vty, argc, argv, oi->route_connected);
1011 }
1012
1013 return CMD_SUCCESS;
1014}
1015
1016ALIAS (show_ipv6_ospf6_interface_prefix,
1017 show_ipv6_ospf6_interface_prefix_detail_cmd,
1018 "show ipv6 ospf6 interface prefix (X:X::X:X|X:X::X:X/M|detail)",
1019 SHOW_STR
1020 IP6_STR
1021 OSPF6_STR
1022 INTERFACE_STR
1023 "Display connected prefixes to advertise\n"
1024 OSPF6_ROUTE_ADDRESS_STR
1025 OSPF6_ROUTE_PREFIX_STR
1026 "Dispaly details of the prefixes\n"
1027 );
1028
1029ALIAS (show_ipv6_ospf6_interface_prefix,
1030 show_ipv6_ospf6_interface_prefix_match_cmd,
1031 "show ipv6 ospf6 interface prefix X:X::X:X/M (match|detail)",
1032 SHOW_STR
1033 IP6_STR
1034 OSPF6_STR
1035 INTERFACE_STR
1036 "Display connected prefixes to advertise\n"
1037 OSPF6_ROUTE_PREFIX_STR
1038 OSPF6_ROUTE_MATCH_STR
1039 "Dispaly details of the prefixes\n"
1040 );
1041
1042
1043/* interface variable set command */
1044DEFUN (ipv6_ospf6_cost,
1045 ipv6_ospf6_cost_cmd,
1046 "ipv6 ospf6 cost <1-65535>",
1047 IP6_STR
1048 OSPF6_STR
1049 "Interface cost\n"
1050 "Outgoing metric of this interface\n"
1051 )
1052{
1053 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001054 struct interface *ifp;
1055
1056 ifp = (struct interface *) vty->index;
1057 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001058
hasso508e53e2004-05-18 18:57:06 +00001059 oi = (struct ospf6_interface *) ifp->info;
1060 if (oi == NULL)
1061 oi = ospf6_interface_create (ifp);
1062 assert (oi);
1063
1064 if (oi->cost == strtol (argv[0], NULL, 10))
1065 return CMD_SUCCESS;
1066
1067 oi->cost = strtol (argv[0], NULL, 10);
1068
1069 /* update cost held in route_connected list in ospf6_interface */
1070 ospf6_interface_connected_route_update (oi->interface);
1071
1072 /* execute LSA hooks */
1073 if (oi->area)
1074 {
1075 OSPF6_LINK_LSA_SCHEDULE (oi);
1076 OSPF6_ROUTER_LSA_SCHEDULE (oi->area);
1077 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1078 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1079 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
1080 }
1081
1082 return CMD_SUCCESS;
1083}
1084
1085DEFUN (ipv6_ospf6_hellointerval,
1086 ipv6_ospf6_hellointerval_cmd,
1087 "ipv6 ospf6 hello-interval <1-65535>",
1088 IP6_STR
1089 OSPF6_STR
1090 "Interval time of Hello packets\n"
1091 SECONDS_STR
1092 )
1093{
1094 struct ospf6_interface *oi;
1095 struct interface *ifp;
1096
1097 ifp = (struct interface *) vty->index;
1098 assert (ifp);
1099
1100 oi = (struct ospf6_interface *) ifp->info;
1101 if (oi == NULL)
1102 oi = ospf6_interface_create (ifp);
1103 assert (oi);
1104
1105 oi->hello_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001106 return CMD_SUCCESS;
1107}
1108
1109/* interface variable set command */
1110DEFUN (ipv6_ospf6_deadinterval,
1111 ipv6_ospf6_deadinterval_cmd,
hasso508e53e2004-05-18 18:57:06 +00001112 "ipv6 ospf6 dead-interval <1-65535>",
paul718e3742002-12-13 20:15:29 +00001113 IP6_STR
1114 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001115 "Interval time after which a neighbor is declared down\n"
paul718e3742002-12-13 20:15:29 +00001116 SECONDS_STR
1117 )
1118{
hasso508e53e2004-05-18 18:57:06 +00001119 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001120 struct interface *ifp;
1121
1122 ifp = (struct interface *) vty->index;
1123 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001124
hasso508e53e2004-05-18 18:57:06 +00001125 oi = (struct ospf6_interface *) ifp->info;
1126 if (oi == NULL)
1127 oi = ospf6_interface_create (ifp);
1128 assert (oi);
1129
1130 oi->dead_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001131 return CMD_SUCCESS;
1132}
1133
1134/* interface variable set command */
1135DEFUN (ipv6_ospf6_transmitdelay,
1136 ipv6_ospf6_transmitdelay_cmd,
hasso508e53e2004-05-18 18:57:06 +00001137 "ipv6 ospf6 transmit-delay <1-3600>",
paul718e3742002-12-13 20:15:29 +00001138 IP6_STR
1139 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001140 "Transmit delay of this interface\n"
paul718e3742002-12-13 20:15:29 +00001141 SECONDS_STR
1142 )
1143{
hasso508e53e2004-05-18 18:57:06 +00001144 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001145 struct interface *ifp;
1146
1147 ifp = (struct interface *) vty->index;
1148 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001149
hasso508e53e2004-05-18 18:57:06 +00001150 oi = (struct ospf6_interface *) ifp->info;
1151 if (oi == NULL)
1152 oi = ospf6_interface_create (ifp);
1153 assert (oi);
1154
1155 oi->transdelay = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001156 return CMD_SUCCESS;
1157}
1158
1159/* interface variable set command */
1160DEFUN (ipv6_ospf6_retransmitinterval,
1161 ipv6_ospf6_retransmitinterval_cmd,
hasso508e53e2004-05-18 18:57:06 +00001162 "ipv6 ospf6 retransmit-interval <1-65535>",
paul718e3742002-12-13 20:15:29 +00001163 IP6_STR
1164 OSPF6_STR
1165 "Time between retransmitting lost link state advertisements\n"
1166 SECONDS_STR
1167 )
1168{
hasso508e53e2004-05-18 18:57:06 +00001169 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001170 struct interface *ifp;
1171
1172 ifp = (struct interface *) vty->index;
1173 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001174
hasso508e53e2004-05-18 18:57:06 +00001175 oi = (struct ospf6_interface *) ifp->info;
1176 if (oi == NULL)
1177 oi = ospf6_interface_create (ifp);
1178 assert (oi);
1179
1180 oi->rxmt_interval = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001181 return CMD_SUCCESS;
1182}
1183
1184/* interface variable set command */
1185DEFUN (ipv6_ospf6_priority,
1186 ipv6_ospf6_priority_cmd,
hasso508e53e2004-05-18 18:57:06 +00001187 "ipv6 ospf6 priority <0-255>",
paul718e3742002-12-13 20:15:29 +00001188 IP6_STR
1189 OSPF6_STR
1190 "Router priority\n"
hasso508e53e2004-05-18 18:57:06 +00001191 "Priority value\n"
paul718e3742002-12-13 20:15:29 +00001192 )
1193{
hasso508e53e2004-05-18 18:57:06 +00001194 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001195 struct interface *ifp;
1196
1197 ifp = (struct interface *) vty->index;
1198 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001199
hasso508e53e2004-05-18 18:57:06 +00001200 oi = (struct ospf6_interface *) ifp->info;
1201 if (oi == NULL)
1202 oi = ospf6_interface_create (ifp);
1203 assert (oi);
paul718e3742002-12-13 20:15:29 +00001204
hasso508e53e2004-05-18 18:57:06 +00001205 oi->priority = strtol (argv[0], NULL, 10);
1206
1207 if (oi->area)
1208 ospf6_interface_state_change (dr_election (oi), oi);
paul718e3742002-12-13 20:15:29 +00001209
1210 return CMD_SUCCESS;
1211}
1212
1213DEFUN (ipv6_ospf6_instance,
1214 ipv6_ospf6_instance_cmd,
hasso508e53e2004-05-18 18:57:06 +00001215 "ipv6 ospf6 instance-id <0-255>",
paul718e3742002-12-13 20:15:29 +00001216 IP6_STR
1217 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001218 "Instance ID for this interface\n"
1219 "Instance ID value\n"
paul718e3742002-12-13 20:15:29 +00001220 )
1221{
hasso508e53e2004-05-18 18:57:06 +00001222 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001223 struct interface *ifp;
1224
1225 ifp = (struct interface *)vty->index;
1226 assert (ifp);
1227
hasso508e53e2004-05-18 18:57:06 +00001228 oi = (struct ospf6_interface *)ifp->info;
1229 if (oi == NULL)
1230 oi = ospf6_interface_create (ifp);
1231 assert (oi);
paul718e3742002-12-13 20:15:29 +00001232
hasso508e53e2004-05-18 18:57:06 +00001233 oi->instance_id = strtol (argv[0], NULL, 10);
paul718e3742002-12-13 20:15:29 +00001234 return CMD_SUCCESS;
1235}
1236
1237DEFUN (ipv6_ospf6_passive,
1238 ipv6_ospf6_passive_cmd,
1239 "ipv6 ospf6 passive",
1240 IP6_STR
1241 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001242 "passive interface, No adjacency will be formed on this interface\n"
paul718e3742002-12-13 20:15:29 +00001243 )
1244{
hasso508e53e2004-05-18 18:57:06 +00001245 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001246 struct interface *ifp;
1247 listnode node;
hasso508e53e2004-05-18 18:57:06 +00001248 struct ospf6_neighbor *on;
paul718e3742002-12-13 20:15:29 +00001249
1250 ifp = (struct interface *) vty->index;
1251 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001252
hasso508e53e2004-05-18 18:57:06 +00001253 oi = (struct ospf6_interface *) ifp->info;
1254 if (oi == NULL)
1255 oi = ospf6_interface_create (ifp);
1256 assert (oi);
paul718e3742002-12-13 20:15:29 +00001257
hasso508e53e2004-05-18 18:57:06 +00001258 SET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);
1259 THREAD_OFF (oi->thread_send_hello);
1260
1261 for (node = listhead (oi->neighbor_list); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00001262 {
hasso508e53e2004-05-18 18:57:06 +00001263 on = (struct ospf6_neighbor *) getdata (node);
1264 THREAD_OFF (on->inactivity_timer);
1265 thread_execute (master, inactivity_timer, on, 0);
paul718e3742002-12-13 20:15:29 +00001266 }
1267
1268 return CMD_SUCCESS;
1269}
1270
1271DEFUN (no_ipv6_ospf6_passive,
1272 no_ipv6_ospf6_passive_cmd,
1273 "no ipv6 ospf6 passive",
1274 NO_STR
1275 IP6_STR
1276 OSPF6_STR
1277 "passive interface: No Adjacency will be formed on this I/F\n"
1278 )
1279{
hasso508e53e2004-05-18 18:57:06 +00001280 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001281 struct interface *ifp;
1282
1283 ifp = (struct interface *) vty->index;
1284 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001285
hasso508e53e2004-05-18 18:57:06 +00001286 oi = (struct ospf6_interface *) ifp->info;
1287 if (oi == NULL)
1288 oi = ospf6_interface_create (ifp);
1289 assert (oi);
paul718e3742002-12-13 20:15:29 +00001290
hasso508e53e2004-05-18 18:57:06 +00001291 UNSET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);
1292 THREAD_OFF (oi->thread_send_hello);
1293 oi->thread_send_hello =
1294 thread_add_event (master, ospf6_hello_send, oi, 0);
paul718e3742002-12-13 20:15:29 +00001295
1296 return CMD_SUCCESS;
1297}
1298
1299DEFUN (ipv6_ospf6_advertise_prefix_list,
1300 ipv6_ospf6_advertise_prefix_list_cmd,
1301 "ipv6 ospf6 advertise prefix-list WORD",
1302 IP6_STR
1303 OSPF6_STR
1304 "Advertising options\n"
1305 "Filter prefix using prefix-list\n"
1306 "Prefix list name\n"
1307 )
1308{
hasso508e53e2004-05-18 18:57:06 +00001309 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001310 struct interface *ifp;
1311
1312 ifp = (struct interface *) vty->index;
1313 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001314
hasso508e53e2004-05-18 18:57:06 +00001315 oi = (struct ospf6_interface *) ifp->info;
1316 if (oi == NULL)
1317 oi = ospf6_interface_create (ifp);
1318 assert (oi);
paul718e3742002-12-13 20:15:29 +00001319
hasso508e53e2004-05-18 18:57:06 +00001320 if (oi->plist_name)
1321 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
1322 oi->plist_name = XSTRDUP (MTYPE_PREFIX_LIST_STR, argv[0]);
paul718e3742002-12-13 20:15:29 +00001323
hasso508e53e2004-05-18 18:57:06 +00001324 ospf6_interface_connected_route_update (oi->interface);
1325 OSPF6_LINK_LSA_SCHEDULE (oi);
1326 if (oi->state == OSPF6_INTERFACE_DR)
1327 {
1328 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1329 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1330 }
1331 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
paul718e3742002-12-13 20:15:29 +00001332
1333 return CMD_SUCCESS;
1334}
1335
1336DEFUN (no_ipv6_ospf6_advertise_prefix_list,
1337 no_ipv6_ospf6_advertise_prefix_list_cmd,
1338 "no ipv6 ospf6 advertise prefix-list",
1339 NO_STR
1340 IP6_STR
1341 OSPF6_STR
1342 "Advertising options\n"
1343 "Filter prefix using prefix-list\n"
1344 )
1345{
hasso508e53e2004-05-18 18:57:06 +00001346 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001347 struct interface *ifp;
1348
1349 ifp = (struct interface *) vty->index;
1350 assert (ifp);
paul718e3742002-12-13 20:15:29 +00001351
hasso508e53e2004-05-18 18:57:06 +00001352 oi = (struct ospf6_interface *) ifp->info;
1353 if (oi == NULL)
1354 oi = ospf6_interface_create (ifp);
1355 assert (oi);
1356
1357 if (oi->plist_name)
paul718e3742002-12-13 20:15:29 +00001358 {
hasso508e53e2004-05-18 18:57:06 +00001359 XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
1360 oi->plist_name = NULL;
paul718e3742002-12-13 20:15:29 +00001361 }
1362
hasso508e53e2004-05-18 18:57:06 +00001363 ospf6_interface_connected_route_update (oi->interface);
1364 OSPF6_LINK_LSA_SCHEDULE (oi);
1365 if (oi->state == OSPF6_INTERFACE_DR)
1366 {
1367 OSPF6_NETWORK_LSA_SCHEDULE (oi);
1368 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
1369 }
1370 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
paul718e3742002-12-13 20:15:29 +00001371
1372 return CMD_SUCCESS;
1373}
1374
1375int
hasso508e53e2004-05-18 18:57:06 +00001376config_write_ospf6_interface (struct vty *vty)
paul718e3742002-12-13 20:15:29 +00001377{
1378 listnode i;
hasso508e53e2004-05-18 18:57:06 +00001379 struct ospf6_interface *oi;
paul718e3742002-12-13 20:15:29 +00001380 struct interface *ifp;
1381
1382 for (i = listhead (iflist); i; nextnode (i))
1383 {
1384 ifp = (struct interface *) getdata (i);
hasso508e53e2004-05-18 18:57:06 +00001385 oi = (struct ospf6_interface *) ifp->info;
1386 if (oi == NULL)
paul718e3742002-12-13 20:15:29 +00001387 continue;
1388
1389 vty_out (vty, "interface %s%s",
hasso508e53e2004-05-18 18:57:06 +00001390 oi->interface->name, VTY_NEWLINE);
1391
1392 if (ifp->desc)
1393 vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE);
1394
paul718e3742002-12-13 20:15:29 +00001395 vty_out (vty, " ipv6 ospf6 cost %d%s",
hasso508e53e2004-05-18 18:57:06 +00001396 oi->cost, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001397 vty_out (vty, " ipv6 ospf6 hello-interval %d%s",
hasso508e53e2004-05-18 18:57:06 +00001398 oi->hello_interval, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001399 vty_out (vty, " ipv6 ospf6 dead-interval %d%s",
hasso508e53e2004-05-18 18:57:06 +00001400 oi->dead_interval, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001401 vty_out (vty, " ipv6 ospf6 retransmit-interval %d%s",
hasso508e53e2004-05-18 18:57:06 +00001402 oi->rxmt_interval, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001403 vty_out (vty, " ipv6 ospf6 priority %d%s",
hasso508e53e2004-05-18 18:57:06 +00001404 oi->priority, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001405 vty_out (vty, " ipv6 ospf6 transmit-delay %d%s",
hasso508e53e2004-05-18 18:57:06 +00001406 oi->transdelay, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001407 vty_out (vty, " ipv6 ospf6 instance-id %d%s",
hasso508e53e2004-05-18 18:57:06 +00001408 oi->instance_id, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001409
hasso508e53e2004-05-18 18:57:06 +00001410 if (oi->plist_name)
paul718e3742002-12-13 20:15:29 +00001411 vty_out (vty, " ipv6 ospf6 advertise prefix-list %s%s",
hasso508e53e2004-05-18 18:57:06 +00001412 oi->plist_name, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001413
hasso508e53e2004-05-18 18:57:06 +00001414 if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE))
paul718e3742002-12-13 20:15:29 +00001415 vty_out (vty, " ipv6 ospf6 passive%s", VTY_NEWLINE);
1416
1417 vty_out (vty, "!%s", VTY_NEWLINE);
1418 }
1419 return 0;
1420}
1421
1422struct cmd_node interface_node =
1423{
1424 INTERFACE_NODE,
1425 "%s(config-if)# ",
paul718e3742002-12-13 20:15:29 +00001426};
1427
1428void
1429ospf6_interface_init ()
1430{
1431 /* Install interface node. */
hasso508e53e2004-05-18 18:57:06 +00001432 install_node (&interface_node, config_write_ospf6_interface);
paul718e3742002-12-13 20:15:29 +00001433
1434 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_cmd);
hasso508e53e2004-05-18 18:57:06 +00001435 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_cmd);
1436 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd);
1437 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001438 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_cmd);
hasso508e53e2004-05-18 18:57:06 +00001439 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd);
1440 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd);
1441 install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001442 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_cmd);
hasso508e53e2004-05-18 18:57:06 +00001443 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_cmd);
1444 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd);
1445 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001446 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_cmd);
hasso508e53e2004-05-18 18:57:06 +00001447 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd);
1448 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd);
1449 install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd);
paul718e3742002-12-13 20:15:29 +00001450
hasso508e53e2004-05-18 18:57:06 +00001451 install_element (CONFIG_NODE, &interface_cmd);
paul718e3742002-12-13 20:15:29 +00001452 install_default (INTERFACE_NODE);
1453 install_element (INTERFACE_NODE, &interface_desc_cmd);
1454 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
1455 install_element (INTERFACE_NODE, &ipv6_ospf6_cost_cmd);
1456 install_element (INTERFACE_NODE, &ipv6_ospf6_deadinterval_cmd);
1457 install_element (INTERFACE_NODE, &ipv6_ospf6_hellointerval_cmd);
1458 install_element (INTERFACE_NODE, &ipv6_ospf6_priority_cmd);
1459 install_element (INTERFACE_NODE, &ipv6_ospf6_retransmitinterval_cmd);
1460 install_element (INTERFACE_NODE, &ipv6_ospf6_transmitdelay_cmd);
1461 install_element (INTERFACE_NODE, &ipv6_ospf6_instance_cmd);
hasso508e53e2004-05-18 18:57:06 +00001462
paul718e3742002-12-13 20:15:29 +00001463 install_element (INTERFACE_NODE, &ipv6_ospf6_passive_cmd);
1464 install_element (INTERFACE_NODE, &no_ipv6_ospf6_passive_cmd);
hasso508e53e2004-05-18 18:57:06 +00001465
1466 install_element (INTERFACE_NODE, &ipv6_ospf6_advertise_prefix_list_cmd);
1467 install_element (INTERFACE_NODE, &no_ipv6_ospf6_advertise_prefix_list_cmd);
1468}
1469
1470DEFUN (debug_ospf6_interface,
1471 debug_ospf6_interface_cmd,
1472 "debug ospf6 interface",
1473 DEBUG_STR
1474 OSPF6_STR
1475 "Debug OSPFv3 Interface\n"
1476 )
1477{
1478 OSPF6_DEBUG_INTERFACE_ON ();
1479 return CMD_SUCCESS;
1480}
1481
1482DEFUN (no_debug_ospf6_interface,
1483 no_debug_ospf6_interface_cmd,
1484 "no debug ospf6 interface",
1485 NO_STR
1486 DEBUG_STR
1487 OSPF6_STR
1488 "Debug OSPFv3 Interface\n"
1489 )
1490{
1491 OSPF6_DEBUG_INTERFACE_ON ();
1492 return CMD_SUCCESS;
1493}
1494
1495int
1496config_write_ospf6_debug_interface (struct vty *vty)
1497{
1498 if (IS_OSPF6_DEBUG_INTERFACE)
1499 vty_out (vty, "debug ospf6 interface%s", VTY_NEWLINE);
1500 return 0;
1501}
1502
1503void
1504install_element_ospf6_debug_interface ()
1505{
1506 install_element (ENABLE_NODE, &debug_ospf6_interface_cmd);
1507 install_element (ENABLE_NODE, &no_debug_ospf6_interface_cmd);
1508 install_element (CONFIG_NODE, &debug_ospf6_interface_cmd);
1509 install_element (CONFIG_NODE, &no_debug_ospf6_interface_cmd);
paul718e3742002-12-13 20:15:29 +00001510}
1511
1512