1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
|
/*
* Copyright (C) 1999 Yasuhiro Ohara
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Zebra; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "ospf6d.h"
#include "ospf6_damp.h"
/* global ospf6d variable */
int ospf6_sock;
list iflist;
list nexthoplist = NULL;
struct sockaddr_in6 allspfrouters6;
struct sockaddr_in6 alldrouters6;
char *recent_reason; /* set by ospf6_lsa_check_recent () */
int proctitle_mode = 0;
char ospf6_daemon_version[] = OSPF6_DAEMON_VERSION;
#define TIMER_SEC_MICRO 1000000
void
ospf6_timeval_sub (const struct timeval *t1, const struct timeval *t2,
struct timeval *result)
{
long usec, movedown = 0;
if (t1->tv_sec < t2->tv_sec ||
(t1->tv_sec == t2->tv_sec && t1->tv_usec < t2->tv_usec))
{
result->tv_sec = 0;
result->tv_usec = 0;
return;
}
if (t1->tv_usec < t2->tv_usec)
{
usec = t1->tv_usec + TIMER_SEC_MICRO;
movedown++;
}
else
usec = t1->tv_usec;
result->tv_usec = usec - t2->tv_usec;
result->tv_sec = t1->tv_sec - t2->tv_sec - movedown;
}
void
ospf6_timeval_div (const struct timeval *t1, u_int by,
struct timeval *result)
{
long movedown;
if (by == 0)
{
result->tv_sec = 0;
result->tv_usec = 0;
return;
}
movedown = t1->tv_sec % by;
result->tv_sec = t1->tv_sec / by;
result->tv_usec = (t1->tv_usec + movedown * TIMER_SEC_MICRO) / by;
}
void
ospf6_timeval_decode (const struct timeval *t, long *dayp, long *hourp,
long *minp, long *secp, long *msecp, long *usecp)
{
long day, hour, min, sec, msec, usec, left;
left = t->tv_sec;
day = left / 86400; left -= day * 86400;
hour = left / 3600; left -= hour * 3600;
min = left / 60; left -= min * 60;
sec = left;
left = t->tv_usec;
msec = left / 1000; left -= msec * 1000;
usec = left;
if (dayp) *dayp = day;
if (hourp) *hourp = hour;
if (minp) *minp = min;
if (secp) *secp = sec;
if (msecp) *msecp = msec;
if (usecp) *usecp = usec;
}
void
ospf6_timeval_string (struct timeval *tv, char *buf, int size)
{
char days[16], hours[16], mins[16], secs[16], msecs[16], usecs[16];
long day, hour, min, sec, msec, usec;
ospf6_timeval_decode (tv, &day, &hour, &min, &sec, &msec, &usec);
snprintf (days, sizeof (days), "%ld days ", day);
snprintf (hours, sizeof (hours), "%ld hours ", hour);
snprintf (mins, sizeof (mins), "%ld mins ", min);
snprintf (secs, sizeof (secs), "%ld secs ", sec);
snprintf (msecs, sizeof (msecs), "%ld msecs ", msec);
snprintf (usecs, sizeof (usecs), "%ld usecs ", usec);
snprintf (buf, size, "%s%s%s%s%s%s",
(day ? days : ""), (hour ? hours : ""),
(min ? mins : ""), (sec ? secs : ""),
(msec ? msecs : ""), (usec ? usecs : ""));
}
void
ospf6_timeval_string_summary (struct timeval *tv, char *buf, int size)
{
char days[16], hours[16], mins[16], secs[16], msecs[16], usecs[16];
long day, hour, min, sec, msec, usec;
ospf6_timeval_decode (tv, &day, &hour, &min, &sec, &msec, &usec);
snprintf (days, sizeof (days), "%02ldd", day);
snprintf (hours, sizeof (hours), "%ldh", hour);
snprintf (mins, sizeof (mins), "%ldm", min);
snprintf (secs, sizeof (secs), "%lds", sec);
snprintf (msecs, sizeof (msecs), "%ldms", msec);
snprintf (usecs, sizeof (usecs), "%ldus", usec);
snprintf (buf, size, "%s%02ld:%02ld:%02ld",
(day ? days : ""), hour, min, sec);
}
/* foreach function */
void
ospf6_count_state (void *arg, int val, void *obj)
{
int *count = (int *) arg;
u_char state = val;
struct ospf6_neighbor *nei = (struct ospf6_neighbor *) obj;
if (nei->state == state)
(*count)++;
}
/* VTY commands. */
DEFUN (reload,
reload_cmd,
"reload",
"Reloads\n")
{
extern void _reload ();
_reload ();
return CMD_SUCCESS;
}
DEFUN (garbage_collection,
garbage_collection_cmd,
"ipv6 ospf6 garbage collect",
IPV6_STR
OSPF6_STR
"garbage collection by hand\n"
"Remove Maxages if possible and recalculate routes\n")
{
ospf6_maxage_remover ();
#if 0
ospf6_route_calculation_schedule ();
#endif
return CMD_SUCCESS;
}
/* Show version. */
DEFUN (show_version_ospf6,
show_version_ospf6_cmd,
"show version ospf6",
SHOW_STR
"Displays ospf6d version\n")
{
vty_out (vty, "Zebra OSPF6d Version: %s%s",
ospf6_daemon_version, VTY_NEWLINE);
return CMD_SUCCESS;
}
/* start ospf6 */
DEFUN (router_ospf6,
router_ospf6_cmd,
"router ospf6",
OSPF6_ROUTER_STR
OSPF6_STR)
{
if (ospf6 == NULL)
ospf6_start ();
/* set current ospf point. */
vty->node = OSPF6_NODE;
vty->index = ospf6;
return CMD_SUCCESS;
}
/* stop ospf6 */
DEFUN (no_router_ospf6,
no_router_ospf6_cmd,
"no router ospf6",
NO_STR
OSPF6_ROUTER_STR)
{
if (!ospf6)
vty_out (vty, "OSPFv3 is not running%s", VTY_NEWLINE);
else
ospf6_stop ();
/* return to config node . */
vty->node = CONFIG_NODE;
vty->index = NULL;
return CMD_SUCCESS;
}
/* show top level structures */
DEFUN (show_ipv6_ospf6,
show_ipv6_ospf6_cmd,
"show ipv6 ospf6",
SHOW_STR
IP6_STR
OSPF6_STR)
{
OSPF6_CMD_CHECK_RUNNING ();
ospf6_show (vty);
return CMD_SUCCESS;
}
DEFUN (show_ipv6_ospf6_nexthoplist,
show_ipv6_ospf6_nexthoplist_cmd,
"show ipv6 ospf6 nexthop-list",
SHOW_STR
IP6_STR
OSPF6_STR
"List of nexthop\n")
{
#if 0
listnode i;
struct ospf6_nexthop *nh;
char buf[128];
for (i = listhead (nexthoplist); i; nextnode (i))
{
nh = (struct ospf6_nexthop *) getdata (i);
nexthop_str (nh, buf, sizeof (buf));
vty_out (vty, "%s%s", buf,
VTY_NEWLINE);
}
#endif
return CMD_SUCCESS;
}
DEFUN (show_ipv6_ospf6_statistics,
show_ipv6_ospf6_statistics_cmd,
"show ipv6 ospf6 statistics",
SHOW_STR
IP6_STR
OSPF6_STR
"Statistics\n")
{
OSPF6_CMD_CHECK_RUNNING ();
ospf6_statistics_show (vty, ospf6);
return CMD_SUCCESS;
}
/* change Router_ID commands. */
DEFUN (ospf6_router_id,
ospf6_router_id_cmd,
"router-id ROUTER_ID",
"Configure ospf Router-ID.\n"
V4NOTATION_STR)
{
int ret;
u_int32_t router_id;
ret = inet_pton (AF_INET, argv[0], &router_id);
if (!ret)
{
vty_out (vty, "malformed ospf router identifier%s", VTY_NEWLINE);
vty_out (vty, "%s", VTY_NEWLINE);
return CMD_WARNING;
}
if (IS_OSPF6_DUMP_CONFIG)
zlog_info ("CONFIG: router-id %s", argv[0]);
ospf6->router_id = router_id;
return CMD_SUCCESS;
}
int
ospf6_interface_bind_area (struct vty *vty,
char *if_name, char *area_name,
char *plist_name, int passive)
{
struct interface *ifp;
struct ospf6_interface *o6i;
struct ospf6_area *o6a;
u_int32_t area_id;
/* find/create ospf6 interface */
ifp = if_get_by_name (if_name);
o6i = (struct ospf6_interface *) ifp->info;
if (! o6i)
o6i = ospf6_interface_create (ifp);
/* parse Area-ID */
if (inet_pton (AF_INET, area_name, &area_id) != 1)
{
vty_out (vty, "Invalid Area-ID: %s%s", area_name, VTY_NEWLINE);
return CMD_ERR_AMBIGUOUS;
}
/* find/create ospf6 area */
o6a = ospf6_area_lookup (area_id, ospf6);
if (!o6a)
{
o6a = ospf6_area_create (area_id);
o6a->ospf6 = ospf6;
listnode_add (ospf6->area_list, o6a);
}
if (o6i->area)
{
if (o6i->area != o6a)
{
vty_out (vty, "Aready attached to area %s%s",
o6i->area->str, VTY_NEWLINE);
return CMD_ERR_NOTHING_TODO;
}
}
else
{
listnode_add (o6a->if_list, o6i);
o6i->area = o6a;
}
/* prefix-list name */
if (plist_name)
{
if (o6i->plist_name)
XFREE (MTYPE_PREFIX_LIST_STR, o6i->plist_name);
o6i->plist_name = XSTRDUP (MTYPE_PREFIX_LIST_STR, plist_name);
}
else
{
if (o6i->plist_name)
XFREE (MTYPE_PREFIX_LIST_STR, o6i->plist_name);
o6i->plist_name = NULL;
}
if (passive)
{
listnode node;
struct ospf6_neighbor *o6n;
SET_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_PASSIVE);
if (o6i->thread_send_hello)
{
thread_cancel (o6i->thread_send_hello);
o6i->thread_send_hello = (struct thread *) NULL;
}
for (node = listhead (o6i->neighbor_list); node; nextnode (node))
{
o6n = getdata (node);
if (o6n->inactivity_timer)
thread_cancel (o6n->inactivity_timer);
thread_execute (master, inactivity_timer, o6n, 0);
}
}
else
{
UNSET_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_PASSIVE);
if (o6i->thread_send_hello == NULL)
thread_add_event (master, ospf6_send_hello, o6i, 0);
}
/* enable I/F if it's not enabled still */
if (! ospf6_interface_is_enabled (o6i->interface->ifindex))
thread_add_event (master, interface_up, o6i, 0);
else
CALL_FOREACH_LSA_HOOK (hook_interface, hook_change, o6i);
CALL_CHANGE_HOOK (&interface_hook, o6i);
return CMD_SUCCESS;
}
DEFUN (ospf6_interface_area_plist,
ospf6_interface_area_plist_cmd,
"interface IFNAME area A.B.C.D prefix-list WORD",
"Enable routing on an IPv6 interface\n"
IFNAME_STR
"Set the OSPF6 area ID\n"
"OSPF6 area ID in IPv4 address notation\n"
OSPF6_PREFIX_LIST_STR
"IPv6 prefix-list name\n"
)
{
if (IS_OSPF6_DUMP_CONFIG)
zlog_info ("CONFIG: interface %s area %s prefix-list %s",
argv[0], argv[1], argv[2]);
return ospf6_interface_bind_area (vty, argv[0], argv[1], argv[2], 0);
}
DEFUN (ospf6_interface_area_plist_passive,
ospf6_interface_area_plist_passive_cmd,
"interface IFNAME area A.B.C.D prefix-list WORD passive",
"Enable routing on an IPv6 interface\n"
IFNAME_STR
"Set the OSPF6 area ID\n"
"OSPF6 area ID in IPv4 address notation\n"
OSPF6_PREFIX_LIST_STR
"IPv6 prefix-list name\n"
"IPv6 prefix-list name\n"
OSPF6_PASSIVE_STR
)
{
if (IS_OSPF6_DUMP_CONFIG)
zlog_info ("CONFIG: interface %s area %s prefix-list %s passive",
argv[0], argv[1], argv[2]);
return ospf6_interface_bind_area (vty, argv[0], argv[1], argv[2], 1);
}
DEFUN (ospf6_interface_area,
ospf6_interface_area_cmd,
"interface IFNAME area A.B.C.D",
"Enable routing on an IPv6 interface\n"
IFNAME_STR
"Set the OSPF6 area ID\n"
"OSPF6 area ID in IPv4 address notation\n"
)
{
struct interface *ifp;
struct ospf6_interface *o6i;
int passive;
char *plist_name;
if (IS_OSPF6_DUMP_CONFIG)
zlog_info ("CONFIG: interface %s area %s",
argv[0], argv[1]);
ifp = if_get_by_name (argv[0]);
o6i = (struct ospf6_interface *) ifp->info;
if (o6i)
{
passive = CHECK_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_PASSIVE);
plist_name = o6i->plist_name;
}
else
{
passive = 0;
plist_name = NULL;
}
return ospf6_interface_bind_area (vty, argv[0], argv[1],
plist_name, passive);
}
DEFUN (ospf6_interface_area_passive,
ospf6_interface_area_passive_cmd,
"interface IFNAME area A.B.C.D passive",
"Enable routing on an IPv6 interface\n"
IFNAME_STR
"Set the OSPF6 area ID\n"
"OSPF6 area ID in IPv4 address notation\n"
OSPF6_PASSIVE_STR
)
{
if (IS_OSPF6_DUMP_CONFIG)
zlog_info ("CONFIG: interface %s area %s passive",
argv[0], argv[1]);
return ospf6_interface_bind_area (vty, argv[0], argv[1], NULL, 1);
}
DEFUN (no_ospf6_interface_area,
no_ospf6_interface_area_cmd,
"no interface IFNAME area A.B.C.D",
NO_STR
"Disable routing on an IPv6 interface\n"
IFNAME_STR)
{
struct interface *ifp;
struct ospf6_interface *o6i;
struct ospf6 *o6;
u_int32_t area_id;
o6 = (struct ospf6 *) vty->index;
ifp = if_lookup_by_name (argv[0]);
if (!ifp)
return CMD_ERR_NO_MATCH;
o6i = (struct ospf6_interface *) ifp->info;
if (!o6i)
return CMD_SUCCESS;
/* parse Area-ID */
if (inet_pton (AF_INET, argv[1], &area_id) != 1)
{
vty_out (vty, "Invalid Area-ID: %s%s", argv[1], VTY_NEWLINE);
return CMD_ERR_AMBIGUOUS;
}
if (o6i->area->area_id != area_id)
{
vty_out (vty, "Wrong Area-ID: %s aready attached to area %s%s",
o6i->interface->name, o6i->area->str, VTY_NEWLINE);
return CMD_ERR_NOTHING_TODO;
}
if (o6i->area)
thread_execute (master, interface_down, o6i, 0);
listnode_delete (o6i->area->if_list, o6i);
o6i->area = (struct ospf6_area *) NULL;
return CMD_SUCCESS;
}
DEFUN (ospf6_area_range,
ospf6_area_range_cmd,
"area A.B.C.D range X:X::X:X/M",
"OSPFv3 area parameters\n"
"OSPFv3 area ID in IPv4 address format\n"
"Summarize routes matching address/mask (border routers only)\n"
"IPv6 address range\n")
{
struct ospf6 *o6;
struct ospf6_area *o6a;
u_int32_t area_id;
int ret;
o6 = (struct ospf6 *) vty->index;
inet_pton (AF_INET, argv[0], &area_id);
o6a = ospf6_area_lookup (area_id, o6);
if (! o6a)
{
vty_out (vty, "No such area%s", VTY_NEWLINE);
return CMD_ERR_NO_MATCH;
}
ret = str2prefix_ipv6 (argv[1], &o6a->area_range);
if (ret <= 0)
{
vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE);
return CMD_WARNING;
}
return CMD_SUCCESS;
}
DEFUN (ospf6_passive_interface,
ospf6_passive_interface_cmd,
"passive-interface IFNAME",
OSPF6_PASSIVE_STR
IFNAME_STR)
{
struct interface *ifp;
struct ospf6_interface *o6i;
ifp = if_get_by_name (argv[0]);
if (ifp->info)
o6i = (struct ospf6_interface *) ifp->info;
else
o6i = ospf6_interface_create (ifp);
SET_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_PASSIVE);
if (o6i->thread_send_hello)
{
thread_cancel (o6i->thread_send_hello);
o6i->thread_send_hello = (struct thread *) NULL;
}
return CMD_SUCCESS;
}
DEFUN (no_ospf6_passive_interface,
no_ospf6_passive_interface_cmd,
"no passive-interface IFNAME",
NO_STR
OSPF6_PASSIVE_STR
IFNAME_STR)
{
struct interface *ifp;
struct ospf6_interface *o6i;
ifp = if_lookup_by_name (argv[0]);
if (! ifp)
return CMD_ERR_NO_MATCH;
o6i = (struct ospf6_interface *) ifp->info;
UNSET_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_PASSIVE);
if (o6i->thread_send_hello == NULL)
thread_add_event (master, ospf6_send_hello, o6i, 0);
return CMD_SUCCESS;
}
#ifdef HAVE_SETPROCTITLE
extern int _argc;
extern char **_argv;
DEFUN (set_proctitle,
set_proctitle_cmd,
"set proctitle (version|normal|none)",
"Set command\n"
"Process title\n"
"Version information\n"
"Normal command-line options\n"
"Just program name\n")
{
int i;
char buf[64], tmp[64];
if (strncmp (argv[0], "v", 1) == 0)
{
proctitle_mode = 1;
setproctitle ("%s Zebra: %s", OSPF6_DAEMON_VERSION, QUAGGA_VERSION);
}
else if (strncmp (argv[0], "nor", 3) == 0)
{
proctitle_mode = 0;
memset (tmp, 0, sizeof (tmp));
memset (buf, 0, sizeof (buf));
for (i = 0; i < _argc; i++)
{
snprintf (buf, sizeof (buf), "%s%s ", tmp, _argv[i]);
memcpy (&tmp, &buf, sizeof (tmp));
}
setproctitle (buf);
}
else if (strncmp (argv[0], "non", 3) == 0)
{
proctitle_mode = -1;
setproctitle (NULL);
}
else
return CMD_ERR_NO_MATCH;
return CMD_SUCCESS;
}
#endif /* HAVE_SETPROCTITLE */
/* OSPF configuration write function. */
int
ospf6_config_write (struct vty *vty)
{
listnode j, k;
char buf[64];
struct ospf6_area *area;
struct ospf6_interface *o6i;
if (proctitle_mode == 1)
vty_out (vty, "set proctitle version%s", VTY_NEWLINE);
else if (proctitle_mode == -1)
vty_out (vty, "set proctitle none%s", VTY_NEWLINE);
vty_out (vty, "!%s", VTY_NEWLINE);
if (! ospf6)
return 0;
/* OSPFv6 configuration. */
if (!ospf6)
return CMD_SUCCESS;
inet_ntop (AF_INET, &ospf6->router_id, buf, sizeof (buf));
vty_out (vty, "router ospf6%s", VTY_NEWLINE);
vty_out (vty, " router-id %s%s", buf, VTY_NEWLINE);
ospf6_redistribute_config_write (vty);
ospf6_damp_config_write (vty);
for (j = listhead (ospf6->area_list); j; nextnode (j))
{
area = (struct ospf6_area *)getdata (j);
for (k = listhead (area->if_list); k; nextnode (k))
{
o6i = (struct ospf6_interface *) getdata (k);
vty_out (vty, " interface %s area %s%s",
o6i->interface->name, area->str, VTY_NEWLINE);
}
}
vty_out (vty, "!%s", VTY_NEWLINE);
return 0;
}
/* OSPF6 node structure. */
struct cmd_node ospf6_node =
{
OSPF6_NODE,
"%s(config-ospf6)# ",
vtysh: 1
};
/* Install ospf related commands. */
void
ospf6_init ()
{
/* Install ospf6 top node. */
install_node (&ospf6_node, ospf6_config_write);
install_element (VIEW_NODE, &show_ipv6_ospf6_cmd);
install_element (VIEW_NODE, &show_version_ospf6_cmd);
install_element (ENABLE_NODE, &show_ipv6_ospf6_cmd);
install_element (ENABLE_NODE, &show_version_ospf6_cmd);
install_element (ENABLE_NODE, &reload_cmd);
install_element (CONFIG_NODE, &router_ospf6_cmd);
install_element (CONFIG_NODE, &interface_cmd);
install_element (CONFIG_NODE, &no_interface_cmd);
#ifdef OSPF6_STATISTICS
install_element (VIEW_NODE, &show_ipv6_ospf6_statistics_cmd);
install_element (ENABLE_NODE, &show_ipv6_ospf6_statistics_cmd);
#endif /* OSPF6_STATISTICS */
#ifdef OSPF6_GARBAGE_COLLECT
install_element (ENABLE_NODE, &garbage_collection_cmd);
#endif /* OSPF6_GARBAGE_COLLECT */
#ifdef HAVE_SETPROCTITLE
install_element (CONFIG_NODE, &set_proctitle_cmd);
#endif /* HAVE_SETPROCTITLE */
install_default (OSPF6_NODE);
install_element (OSPF6_NODE, &ospf6_router_id_cmd);
install_element (OSPF6_NODE, &ospf6_interface_area_cmd);
install_element (OSPF6_NODE, &ospf6_interface_area_passive_cmd);
install_element (OSPF6_NODE, &ospf6_interface_area_plist_cmd);
install_element (OSPF6_NODE, &ospf6_interface_area_plist_passive_cmd);
install_element (OSPF6_NODE, &no_ospf6_interface_area_cmd);
install_element (OSPF6_NODE, &ospf6_passive_interface_cmd);
install_element (OSPF6_NODE, &no_ospf6_passive_interface_cmd);
install_element (OSPF6_NODE, &ospf6_area_range_cmd);
/* Make empty list of top list. */
if_init ();
/* Install access list */
access_list_init ();
/* Install prefix list */
prefix_list_init ();
ospf6_dump_init ();
#ifdef HAVE_OSPF6_DAMP
ospf6_damp_init ();
#endif /*HAVE_OSPF6_DAMP*/
ospf6_hook_init ();
ospf6_lsa_init ();
ospf6_top_init ();
ospf6_area_init ();
ospf6_interface_init ();
ospf6_neighbor_init ();
ospf6_zebra_init ();
ospf6_routemap_init ();
ospf6_lsdb_init ();
ospf6_spf_init ();
ospf6_intra_init ();
ospf6_abr_init ();
ospf6_asbr_init ();
}
void
ospf6_terminate ()
{
/* stop ospf6 */
ospf6_stop ();
/* log */
zlog (NULL, LOG_INFO, "OSPF6d terminated");
}
void
ospf6_maxage_remover ()
{
#if 0
if (IS_OSPF6_DUMP_LSDB)
zlog_info ("MaxAge Remover");
#endif
ospf6_top_schedule_maxage_remover (NULL, 0, ospf6);
(*ospf6->foreach_area) (ospf6, NULL, 0,
ospf6_area_schedule_maxage_remover);
(*ospf6->foreach_if) (ospf6, NULL, 0,
ospf6_interface_schedule_maxage_remover);
}
void *
ospf6_lsa_get_scope (u_int16_t type, struct ospf6_interface *o6i)
{
if (OSPF6_LSA_IS_SCOPE_LINKLOCAL (ntohs (type)))
return o6i;
else if (OSPF6_LSA_IS_SCOPE_AREA (ntohs (type)))
return o6i->area;
else if (OSPF6_LSA_IS_SCOPE_AS (ntohs (type)))
return o6i->area->ospf6;
else
return NULL;
}
|