paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 2 | * Copyright (C) 2003 Yasuhiro Ohara |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3 | * |
| 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 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 22 | #include <zebra.h> |
| 23 | |
| 24 | #include "log.h" |
| 25 | #include "memory.h" |
| 26 | #include "linklist.h" |
| 27 | #include "thread.h" |
| 28 | #include "vty.h" |
| 29 | #include "command.h" |
| 30 | #include "if.h" |
| 31 | #include "prefix.h" |
| 32 | #include "table.h" |
hasso | 34956b3 | 2005-06-24 08:44:02 +0000 | [diff] [blame] | 33 | #include "plist.h" |
| 34 | #include "filter.h" |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 35 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 36 | #include "ospf6_proto.h" |
| 37 | #include "ospf6_lsa.h" |
| 38 | #include "ospf6_lsdb.h" |
| 39 | #include "ospf6_route.h" |
| 40 | #include "ospf6_spf.h" |
| 41 | #include "ospf6_top.h" |
| 42 | #include "ospf6_area.h" |
| 43 | #include "ospf6_interface.h" |
| 44 | #include "ospf6_intra.h" |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 45 | #include "ospf6_abr.h" |
| 46 | #include "ospf6d.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 47 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 48 | int |
| 49 | ospf6_area_cmp (void *va, void *vb) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 50 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 51 | struct ospf6_area *oa = (struct ospf6_area *) va; |
| 52 | struct ospf6_area *ob = (struct ospf6_area *) vb; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 53 | return (ntohl (oa->area_id) < ntohl (ob->area_id) ? -1 : 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 54 | } |
| 55 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 56 | /* schedule routing table recalculation */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 57 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 58 | ospf6_area_lsdb_hook_add (struct ospf6_lsa *lsa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 59 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 60 | switch (ntohs (lsa->header->type)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 61 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 62 | case OSPF6_LSTYPE_ROUTER: |
| 63 | case OSPF6_LSTYPE_NETWORK: |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 64 | if (IS_OSPF6_DEBUG_EXAMIN_TYPE (lsa->header->type)) |
| 65 | { |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 66 | zlog_debug ("Examin %s", lsa->name); |
| 67 | zlog_debug ("Schedule SPF Calculation for %s", |
| 68 | OSPF6_AREA (lsa->lsdb->data)->name); |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 69 | } |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 70 | ospf6_spf_schedule (OSPF6_AREA (lsa->lsdb->data)); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 71 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 72 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 73 | case OSPF6_LSTYPE_INTRA_PREFIX: |
| 74 | ospf6_intra_prefix_lsa_add (lsa); |
| 75 | break; |
| 76 | |
| 77 | case OSPF6_LSTYPE_INTER_PREFIX: |
| 78 | case OSPF6_LSTYPE_INTER_ROUTER: |
hasso | ccb59b1 | 2004-08-25 09:10:37 +0000 | [diff] [blame] | 79 | ospf6_abr_examin_summary (lsa, (struct ospf6_area *) lsa->lsdb->data); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 80 | break; |
| 81 | |
| 82 | default: |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 83 | break; |
| 84 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 85 | } |
| 86 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 87 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 88 | ospf6_area_lsdb_hook_remove (struct ospf6_lsa *lsa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 89 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 90 | switch (ntohs (lsa->header->type)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 91 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 92 | case OSPF6_LSTYPE_ROUTER: |
| 93 | case OSPF6_LSTYPE_NETWORK: |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 94 | if (IS_OSPF6_DEBUG_EXAMIN_TYPE (lsa->header->type)) |
| 95 | { |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 96 | zlog_debug ("LSA disappearing: %s", lsa->name); |
| 97 | zlog_debug ("Schedule SPF Calculation for %s", |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 98 | OSPF6_AREA (lsa->lsdb->data)->name); |
| 99 | } |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 100 | ospf6_spf_schedule (OSPF6_AREA (lsa->lsdb->data)); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 101 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 102 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 103 | case OSPF6_LSTYPE_INTRA_PREFIX: |
| 104 | ospf6_intra_prefix_lsa_remove (lsa); |
| 105 | break; |
| 106 | |
| 107 | case OSPF6_LSTYPE_INTER_PREFIX: |
| 108 | case OSPF6_LSTYPE_INTER_ROUTER: |
hasso | ccb59b1 | 2004-08-25 09:10:37 +0000 | [diff] [blame] | 109 | ospf6_abr_examin_summary (lsa, (struct ospf6_area *) lsa->lsdb->data); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 110 | break; |
| 111 | |
| 112 | default: |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 113 | break; |
| 114 | } |
| 115 | } |
| 116 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 117 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 118 | ospf6_area_route_hook_add (struct ospf6_route *route) |
| 119 | { |
| 120 | struct ospf6_route *copy = ospf6_route_copy (route); |
| 121 | ospf6_route_add (copy, ospf6->route_table); |
| 122 | } |
| 123 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 124 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 125 | ospf6_area_route_hook_remove (struct ospf6_route *route) |
| 126 | { |
| 127 | struct ospf6_route *copy; |
| 128 | |
| 129 | copy = ospf6_route_lookup_identical (route, ospf6->route_table); |
| 130 | if (copy) |
| 131 | ospf6_route_remove (copy, ospf6->route_table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | /* Make new area structure */ |
| 135 | struct ospf6_area * |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 136 | ospf6_area_create (u_int32_t area_id, struct ospf6 *o) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 137 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 138 | struct ospf6_area *oa; |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 139 | struct ospf6_route *route; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 140 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 141 | oa = XCALLOC (MTYPE_OSPF6_AREA, sizeof (struct ospf6_area)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 142 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 143 | inet_ntop (AF_INET, &area_id, oa->name, sizeof (oa->name)); |
| 144 | oa->area_id = area_id; |
| 145 | oa->if_list = list_new (); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 146 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 147 | oa->lsdb = ospf6_lsdb_create (oa); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 148 | oa->lsdb->hook_add = ospf6_area_lsdb_hook_add; |
| 149 | oa->lsdb->hook_remove = ospf6_area_lsdb_hook_remove; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 150 | oa->lsdb_self = ospf6_lsdb_create (oa); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 151 | |
Paul Jakma | cf1ce25 | 2006-05-15 10:46:07 +0000 | [diff] [blame] | 152 | oa->spf_table = OSPF6_ROUTE_TABLE_CREATE (AREA, SPF_RESULTS); |
| 153 | oa->spf_table->scope = oa; |
| 154 | oa->route_table = OSPF6_ROUTE_TABLE_CREATE (AREA, ROUTES); |
| 155 | oa->route_table->scope = oa; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 156 | oa->route_table->hook_add = ospf6_area_route_hook_add; |
| 157 | oa->route_table->hook_remove = ospf6_area_route_hook_remove; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 158 | |
Paul Jakma | cf1ce25 | 2006-05-15 10:46:07 +0000 | [diff] [blame] | 159 | oa->range_table = OSPF6_ROUTE_TABLE_CREATE (AREA, PREFIX_RANGES); |
| 160 | oa->range_table->scope = oa; |
| 161 | oa->summary_prefix = OSPF6_ROUTE_TABLE_CREATE (AREA, SUMMARY_PREFIXES); |
| 162 | oa->summary_prefix->scope = oa; |
| 163 | oa->summary_router = OSPF6_ROUTE_TABLE_CREATE (AREA, SUMMARY_ROUTERS); |
| 164 | oa->summary_router->scope = oa; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 165 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 166 | /* set default options */ |
| 167 | OSPF6_OPT_SET (oa->options, OSPF6_OPT_V6); |
| 168 | OSPF6_OPT_SET (oa->options, OSPF6_OPT_E); |
| 169 | OSPF6_OPT_SET (oa->options, OSPF6_OPT_R); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 170 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 171 | oa->ospf6 = o; |
| 172 | listnode_add_sort (o->area_list, oa); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 173 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 174 | /* import athoer area's routes as inter-area routes */ |
| 175 | for (route = ospf6_route_head (o->route_table); route; |
| 176 | route = ospf6_route_next (route)) |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 177 | ospf6_abr_originate_summary_to_area (route, oa); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 178 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 179 | return oa; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 180 | } |
| 181 | |
| 182 | void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 183 | ospf6_area_delete (struct ospf6_area *oa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 184 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 185 | struct listnode *n, *nnode; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 186 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 187 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 188 | ospf6_route_table_delete (oa->range_table); |
| 189 | ospf6_route_table_delete (oa->summary_prefix); |
| 190 | ospf6_route_table_delete (oa->summary_router); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 191 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 192 | /* ospf6 interface list */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 193 | for (ALL_LIST_ELEMENTS (oa->if_list, n, nnode, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 194 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 195 | ospf6_interface_delete (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 196 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 197 | list_delete (oa->if_list); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 198 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 199 | ospf6_lsdb_delete (oa->lsdb); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 200 | ospf6_lsdb_delete (oa->lsdb_self); |
| 201 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 202 | ospf6_route_table_delete (oa->spf_table); |
| 203 | ospf6_route_table_delete (oa->route_table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 204 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 205 | THREAD_OFF (oa->thread_spf_calculation); |
| 206 | THREAD_OFF (oa->thread_route_calculation); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 207 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 208 | listnode_delete (oa->ospf6->area_list, oa); |
| 209 | oa->ospf6 = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 210 | |
| 211 | /* free area */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 212 | XFREE (MTYPE_OSPF6_AREA, oa); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | struct ospf6_area * |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 216 | ospf6_area_lookup (u_int32_t area_id, struct ospf6 *ospf6) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 217 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 218 | struct ospf6_area *oa; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 219 | struct listnode *n; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 220 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 221 | for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, n, oa)) |
| 222 | if (oa->area_id == area_id) |
| 223 | return oa; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 224 | |
| 225 | return (struct ospf6_area *) NULL; |
| 226 | } |
| 227 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 228 | static struct ospf6_area * |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 229 | ospf6_area_get (u_int32_t area_id, struct ospf6 *o) |
| 230 | { |
| 231 | struct ospf6_area *oa; |
| 232 | oa = ospf6_area_lookup (area_id, o); |
| 233 | if (oa == NULL) |
| 234 | oa = ospf6_area_create (area_id, o); |
| 235 | return oa; |
| 236 | } |
| 237 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 238 | void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 239 | ospf6_area_enable (struct ospf6_area *oa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 240 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 241 | struct listnode *node, *nnode; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 242 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 243 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 244 | SET_FLAG (oa->flag, OSPF6_AREA_ENABLE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 245 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 246 | for (ALL_LIST_ELEMENTS (oa->if_list, node, nnode, oi)) |
| 247 | ospf6_interface_enable (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 251 | ospf6_area_disable (struct ospf6_area *oa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 252 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 253 | struct listnode *node, *nnode; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 254 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 255 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 256 | UNSET_FLAG (oa->flag, OSPF6_AREA_ENABLE); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 257 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 258 | for (ALL_LIST_ELEMENTS (oa->if_list, node, nnode, oi)) |
| 259 | ospf6_interface_disable (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 260 | } |
| 261 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 262 | |
| 263 | void |
| 264 | ospf6_area_show (struct vty *vty, struct ospf6_area *oa) |
| 265 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 266 | struct listnode *i; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 267 | struct ospf6_interface *oi; |
| 268 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 269 | vty_out (vty, " Area %s%s", oa->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 270 | vty_out (vty, " Number of Area scoped LSAs is %u%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 271 | oa->lsdb->count, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 272 | |
| 273 | vty_out (vty, " Interface attached to this area:"); |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 274 | for (ALL_LIST_ELEMENTS_RO (oa->if_list, i, oi)) |
| 275 | vty_out (vty, " %s", oi->interface->name); |
| 276 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 277 | vty_out (vty, "%s", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 281 | #define OSPF6_CMD_AREA_LOOKUP(str, oa) \ |
| 282 | { \ |
| 283 | u_int32_t area_id = 0; \ |
| 284 | if (inet_pton (AF_INET, str, &area_id) != 1) \ |
| 285 | { \ |
| 286 | vty_out (vty, "Malformed Area-ID: %s%s", str, VNL); \ |
| 287 | return CMD_SUCCESS; \ |
| 288 | } \ |
| 289 | oa = ospf6_area_lookup (area_id, ospf6); \ |
| 290 | if (oa == NULL) \ |
| 291 | { \ |
| 292 | vty_out (vty, "No such Area: %s%s", str, VNL); \ |
| 293 | return CMD_SUCCESS; \ |
| 294 | } \ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 295 | } |
| 296 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 297 | #define OSPF6_CMD_AREA_GET(str, oa) \ |
| 298 | { \ |
| 299 | u_int32_t area_id = 0; \ |
| 300 | if (inet_pton (AF_INET, str, &area_id) != 1) \ |
| 301 | { \ |
| 302 | vty_out (vty, "Malformed Area-ID: %s%s", str, VNL); \ |
| 303 | return CMD_SUCCESS; \ |
| 304 | } \ |
| 305 | oa = ospf6_area_get (area_id, ospf6); \ |
| 306 | } |
| 307 | |
| 308 | DEFUN (area_range, |
| 309 | area_range_cmd, |
| 310 | "area A.B.C.D range X:X::X:X/M", |
| 311 | "OSPF area parameters\n" |
| 312 | OSPF6_AREA_ID_STR |
| 313 | "Configured address range\n" |
| 314 | "Specify IPv6 prefix\n" |
| 315 | ) |
| 316 | { |
| 317 | int ret; |
| 318 | struct ospf6_area *oa; |
| 319 | struct prefix prefix; |
| 320 | struct ospf6_route *range; |
| 321 | |
| 322 | OSPF6_CMD_AREA_GET (argv[0], oa); |
| 323 | argc--; |
| 324 | argv++; |
| 325 | |
| 326 | ret = str2prefix (argv[0], &prefix); |
| 327 | if (ret != 1 || prefix.family != AF_INET6) |
| 328 | { |
| 329 | vty_out (vty, "Malformed argument: %s%s", argv[0], VNL); |
| 330 | return CMD_SUCCESS; |
| 331 | } |
| 332 | argc--; |
| 333 | argv++; |
| 334 | |
| 335 | range = ospf6_route_lookup (&prefix, oa->range_table); |
| 336 | if (range == NULL) |
| 337 | { |
| 338 | range = ospf6_route_create (); |
| 339 | range->type = OSPF6_DEST_TYPE_RANGE; |
| 340 | range->prefix = prefix; |
| 341 | } |
| 342 | |
| 343 | if (argc) |
| 344 | { |
| 345 | if (! strcmp (argv[0], "not-advertise")) |
| 346 | SET_FLAG (range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE); |
| 347 | else if (! strcmp (argv[0], "advertise")) |
| 348 | UNSET_FLAG (range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE); |
| 349 | } |
| 350 | |
Jon | 86f9e5a | 2009-02-11 17:22:03 -0800 | [diff] [blame] | 351 | if (range->rnode) |
| 352 | { |
| 353 | vty_out (vty, "Range already defined: %s%s", argv[-1], VNL); |
| 354 | return CMD_WARNING; |
| 355 | } |
| 356 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 357 | ospf6_route_add (range, oa->range_table); |
| 358 | return CMD_SUCCESS; |
| 359 | } |
| 360 | |
| 361 | ALIAS (area_range, |
| 362 | area_range_advertise_cmd, |
| 363 | "area A.B.C.D range X:X::X:X/M (advertise|not-advertise)", |
| 364 | "OSPF area parameters\n" |
| 365 | OSPF6_AREA_ID_STR |
| 366 | "Configured address range\n" |
| 367 | "Specify IPv6 prefix\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 368 | ) |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 369 | |
| 370 | DEFUN (no_area_range, |
| 371 | no_area_range_cmd, |
| 372 | "no area A.B.C.D range X:X::X:X/M", |
| 373 | "OSPF area parameters\n" |
| 374 | OSPF6_AREA_ID_STR |
| 375 | "Configured address range\n" |
| 376 | "Specify IPv6 prefix\n" |
| 377 | ) |
| 378 | { |
| 379 | int ret; |
| 380 | struct ospf6_area *oa; |
| 381 | struct prefix prefix; |
| 382 | struct ospf6_route *range; |
| 383 | |
| 384 | OSPF6_CMD_AREA_GET (argv[0], oa); |
| 385 | argc--; |
| 386 | argv++; |
| 387 | |
| 388 | ret = str2prefix (argv[0], &prefix); |
| 389 | if (ret != 1 || prefix.family != AF_INET6) |
| 390 | { |
| 391 | vty_out (vty, "Malformed argument: %s%s", argv[0], VNL); |
| 392 | return CMD_SUCCESS; |
| 393 | } |
| 394 | |
| 395 | range = ospf6_route_lookup (&prefix, oa->range_table); |
| 396 | if (range == NULL) |
| 397 | { |
| 398 | vty_out (vty, "Range %s does not exists.%s", argv[0], VNL); |
| 399 | return CMD_SUCCESS; |
| 400 | } |
| 401 | |
| 402 | ospf6_route_remove (range, oa->range_table); |
| 403 | return CMD_SUCCESS; |
| 404 | } |
| 405 | |
| 406 | void |
| 407 | ospf6_area_config_write (struct vty *vty) |
| 408 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 409 | struct listnode *node; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 410 | struct ospf6_area *oa; |
| 411 | struct ospf6_route *range; |
| 412 | char buf[128]; |
| 413 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 414 | for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa)) |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 415 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 416 | for (range = ospf6_route_head (oa->range_table); range; |
| 417 | range = ospf6_route_next (range)) |
| 418 | { |
| 419 | prefix2str (&range->prefix, buf, sizeof (buf)); |
| 420 | vty_out (vty, " area %s range %s%s", oa->name, buf, VNL); |
| 421 | } |
| 422 | } |
| 423 | } |
| 424 | |
hasso | 34956b3 | 2005-06-24 08:44:02 +0000 | [diff] [blame] | 425 | DEFUN (area_filter_list, |
| 426 | area_filter_list_cmd, |
| 427 | "area A.B.C.D filter-list prefix WORD (in|out)", |
| 428 | "OSPFv6 area parameters\n" |
| 429 | "OSPFv6 area ID in IP address format\n" |
| 430 | "Filter networks between OSPFv6 areas\n" |
| 431 | "Filter prefixes between OSPFv6 areas\n" |
| 432 | "Name of an IPv6 prefix-list\n" |
| 433 | "Filter networks sent to this area\n" |
| 434 | "Filter networks sent from this area\n") |
| 435 | { |
| 436 | struct ospf6_area *area; |
| 437 | struct prefix_list *plist; |
| 438 | |
| 439 | OSPF6_CMD_AREA_GET (argv[0], area); |
| 440 | argc--; |
| 441 | argv++; |
| 442 | |
Christian Hammers | c8049c1 | 2011-09-12 14:23:05 +0400 | [diff] [blame] | 443 | plist = prefix_list_lookup (AFI_IP6, argv[0]); |
| 444 | if (strncmp (argv[1], "in", 2) == 0) |
hasso | 34956b3 | 2005-06-24 08:44:02 +0000 | [diff] [blame] | 445 | { |
| 446 | PREFIX_LIST_IN (area) = plist; |
| 447 | if (PREFIX_NAME_IN (area)) |
| 448 | free (PREFIX_NAME_IN (area)); |
| 449 | |
Christian Hammers | c8049c1 | 2011-09-12 14:23:05 +0400 | [diff] [blame] | 450 | PREFIX_NAME_IN (area) = strdup (argv[0]); |
hasso | 34956b3 | 2005-06-24 08:44:02 +0000 | [diff] [blame] | 451 | ospf6_abr_reimport (area); |
| 452 | } |
| 453 | else |
| 454 | { |
| 455 | PREFIX_LIST_OUT (area) = plist; |
| 456 | if (PREFIX_NAME_OUT (area)) |
| 457 | free (PREFIX_NAME_OUT (area)); |
| 458 | |
Christian Hammers | c8049c1 | 2011-09-12 14:23:05 +0400 | [diff] [blame] | 459 | PREFIX_NAME_OUT (area) = strdup (argv[0]); |
hasso | 34956b3 | 2005-06-24 08:44:02 +0000 | [diff] [blame] | 460 | ospf6_abr_enable_area (area); |
| 461 | } |
| 462 | |
| 463 | return CMD_SUCCESS; |
| 464 | } |
| 465 | |
| 466 | DEFUN (no_area_filter_list, |
| 467 | no_area_filter_list_cmd, |
| 468 | "no area A.B.C.D filter-list prefix WORD (in|out)", |
| 469 | NO_STR |
| 470 | "OSPFv6 area parameters\n" |
| 471 | "OSPFv6 area ID in IP address format\n" |
| 472 | "Filter networks between OSPFv6 areas\n" |
| 473 | "Filter prefixes between OSPFv6 areas\n" |
| 474 | "Name of an IPv6 prefix-list\n" |
| 475 | "Filter networks sent to this area\n" |
| 476 | "Filter networks sent from this area\n") |
| 477 | { |
| 478 | struct ospf6_area *area; |
| 479 | struct prefix_list *plist; |
| 480 | |
| 481 | OSPF6_CMD_AREA_GET (argv[0], area); |
| 482 | argc--; |
| 483 | argv++; |
| 484 | |
Christian Hammers | c8049c1 | 2011-09-12 14:23:05 +0400 | [diff] [blame] | 485 | plist = prefix_list_lookup (AFI_IP6, argv[0]); |
| 486 | if (strncmp (argv[1], "in", 2) == 0) |
hasso | 34956b3 | 2005-06-24 08:44:02 +0000 | [diff] [blame] | 487 | { |
| 488 | if (PREFIX_NAME_IN (area)) |
Christian Hammers | c8049c1 | 2011-09-12 14:23:05 +0400 | [diff] [blame] | 489 | if (strcmp (PREFIX_NAME_IN (area), argv[0]) != 0) |
hasso | 34956b3 | 2005-06-24 08:44:02 +0000 | [diff] [blame] | 490 | return CMD_SUCCESS; |
| 491 | |
| 492 | PREFIX_LIST_IN (area) = NULL; |
| 493 | if (PREFIX_NAME_IN (area)) |
| 494 | free (PREFIX_NAME_IN (area)); |
| 495 | |
| 496 | PREFIX_NAME_IN (area) = NULL; |
| 497 | ospf6_abr_reimport (area); |
| 498 | } |
| 499 | else |
| 500 | { |
| 501 | if (PREFIX_NAME_OUT (area)) |
Christian Hammers | c8049c1 | 2011-09-12 14:23:05 +0400 | [diff] [blame] | 502 | if (strcmp (PREFIX_NAME_OUT (area), argv[0]) != 0) |
hasso | 34956b3 | 2005-06-24 08:44:02 +0000 | [diff] [blame] | 503 | return CMD_SUCCESS; |
| 504 | |
| 505 | PREFIX_LIST_OUT (area) = NULL; |
| 506 | if (PREFIX_NAME_OUT (area)) |
| 507 | free (PREFIX_NAME_OUT (area)); |
| 508 | |
| 509 | PREFIX_NAME_OUT (area) = NULL; |
| 510 | ospf6_abr_enable_area (area); |
| 511 | } |
| 512 | |
| 513 | return CMD_SUCCESS; |
| 514 | } |
| 515 | |
| 516 | DEFUN (area_import_list, |
| 517 | area_import_list_cmd, |
| 518 | "area A.B.C.D import-list NAME", |
| 519 | "OSPFv6 area parameters\n" |
| 520 | "OSPFv6 area ID in IP address format\n" |
| 521 | "Set the filter for networks from other areas announced to the specified one\n" |
| 522 | "Name of the acess-list\n") |
| 523 | { |
| 524 | struct ospf6_area *area; |
| 525 | struct access_list *list; |
| 526 | |
| 527 | OSPF6_CMD_AREA_GET(argv[0], area); |
| 528 | |
| 529 | list = access_list_lookup (AFI_IP6, argv[1]); |
| 530 | |
| 531 | IMPORT_LIST (area) = list; |
| 532 | |
| 533 | if (IMPORT_NAME (area)) |
| 534 | free (IMPORT_NAME (area)); |
| 535 | |
| 536 | IMPORT_NAME (area) = strdup (argv[1]); |
| 537 | ospf6_abr_reimport (area); |
| 538 | |
| 539 | return CMD_SUCCESS; |
| 540 | } |
| 541 | |
| 542 | DEFUN (no_area_import_list, |
| 543 | no_area_import_list_cmd, |
| 544 | "no area A.B.C.D import-list NAME", |
| 545 | "OSPFv6 area parameters\n" |
| 546 | "OSPFv6 area ID in IP address format\n" |
| 547 | "Unset the filter for networks announced to other areas\n" |
| 548 | "NAme of the access-list\n") |
| 549 | { |
| 550 | struct ospf6_area *area; |
| 551 | |
| 552 | OSPF6_CMD_AREA_GET(argv[0], area); |
| 553 | |
| 554 | IMPORT_LIST (area) = 0; |
| 555 | |
| 556 | if (IMPORT_NAME (area)) |
| 557 | free (IMPORT_NAME (area)); |
| 558 | |
| 559 | IMPORT_NAME (area) = NULL; |
| 560 | ospf6_abr_reimport (area); |
| 561 | |
| 562 | return CMD_SUCCESS; |
| 563 | } |
| 564 | |
| 565 | DEFUN (area_export_list, |
| 566 | area_export_list_cmd, |
| 567 | "area A.B.C.D export-list NAME", |
| 568 | "OSPFv6 area parameters\n" |
| 569 | "OSPFv6 area ID in IP address format\n" |
| 570 | "Set the filter for networks announced to other areas\n" |
| 571 | "Name of the acess-list\n") |
| 572 | { |
| 573 | struct ospf6_area *area; |
| 574 | struct access_list *list; |
| 575 | |
| 576 | OSPF6_CMD_AREA_GET(argv[0], area); |
| 577 | |
| 578 | list = access_list_lookup (AFI_IP6, argv[1]); |
| 579 | |
| 580 | EXPORT_LIST (area) = list; |
| 581 | |
| 582 | if (EXPORT_NAME (area)) |
| 583 | free (EXPORT_NAME (area)); |
| 584 | |
| 585 | EXPORT_NAME (area) = strdup (argv[1]); |
| 586 | ospf6_abr_enable_area (area); |
| 587 | |
| 588 | return CMD_SUCCESS; |
| 589 | } |
| 590 | |
| 591 | DEFUN (no_area_export_list, |
| 592 | no_area_export_list_cmd, |
| 593 | "no area A.B.C.D export-list NAME", |
| 594 | "OSPFv6 area parameters\n" |
| 595 | "OSPFv6 area ID in IP address format\n" |
| 596 | "Unset the filter for networks announced to other areas\n" |
| 597 | "Name of the access-list\n") |
| 598 | { |
| 599 | struct ospf6_area *area; |
| 600 | |
| 601 | OSPF6_CMD_AREA_GET(argv[0], area); |
| 602 | |
| 603 | EXPORT_LIST (area) = 0; |
| 604 | |
| 605 | if (EXPORT_NAME (area)) |
| 606 | free (EXPORT_NAME (area)); |
| 607 | |
| 608 | EXPORT_NAME (area) = NULL; |
| 609 | ospf6_abr_enable_area (area); |
| 610 | |
| 611 | return CMD_SUCCESS; |
| 612 | } |
| 613 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 614 | DEFUN (show_ipv6_ospf6_spf_tree, |
| 615 | show_ipv6_ospf6_spf_tree_cmd, |
| 616 | "show ipv6 ospf6 spf tree", |
| 617 | SHOW_STR |
| 618 | IP6_STR |
| 619 | OSPF6_STR |
| 620 | "Shortest Path First caculation\n" |
| 621 | "Show SPF tree\n") |
| 622 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 623 | struct listnode *node; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 624 | struct ospf6_area *oa; |
| 625 | struct ospf6_vertex *root; |
| 626 | struct ospf6_route *route; |
| 627 | struct prefix prefix; |
| 628 | |
| 629 | ospf6_linkstate_prefix (ospf6->router_id, htonl (0), &prefix); |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 630 | |
| 631 | for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa)) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 632 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 633 | route = ospf6_route_lookup (&prefix, oa->spf_table); |
| 634 | if (route == NULL) |
| 635 | { |
| 636 | vty_out (vty, "LS entry for root not found in area %s%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 637 | oa->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 638 | continue; |
| 639 | } |
| 640 | root = (struct ospf6_vertex *) route->route_option; |
| 641 | ospf6_spf_display_subtree (vty, "", 0, root); |
| 642 | } |
| 643 | |
| 644 | return CMD_SUCCESS; |
| 645 | } |
| 646 | |
| 647 | DEFUN (show_ipv6_ospf6_area_spf_tree, |
| 648 | show_ipv6_ospf6_area_spf_tree_cmd, |
| 649 | "show ipv6 ospf6 area A.B.C.D spf tree", |
| 650 | SHOW_STR |
| 651 | IP6_STR |
| 652 | OSPF6_STR |
| 653 | OSPF6_AREA_STR |
| 654 | OSPF6_AREA_ID_STR |
| 655 | "Shortest Path First caculation\n" |
| 656 | "Show SPF tree\n") |
| 657 | { |
| 658 | u_int32_t area_id; |
| 659 | struct ospf6_area *oa; |
| 660 | struct ospf6_vertex *root; |
| 661 | struct ospf6_route *route; |
| 662 | struct prefix prefix; |
| 663 | |
| 664 | ospf6_linkstate_prefix (ospf6->router_id, htonl (0), &prefix); |
| 665 | |
| 666 | if (inet_pton (AF_INET, argv[0], &area_id) != 1) |
| 667 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 668 | vty_out (vty, "Malformed Area-ID: %s%s", argv[0], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 669 | return CMD_SUCCESS; |
| 670 | } |
| 671 | oa = ospf6_area_lookup (area_id, ospf6); |
| 672 | if (oa == NULL) |
| 673 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 674 | vty_out (vty, "No such Area: %s%s", argv[0], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 675 | return CMD_SUCCESS; |
| 676 | } |
| 677 | |
| 678 | route = ospf6_route_lookup (&prefix, oa->spf_table); |
| 679 | if (route == NULL) |
| 680 | { |
| 681 | vty_out (vty, "LS entry for root not found in area %s%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 682 | oa->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 683 | return CMD_SUCCESS; |
| 684 | } |
| 685 | root = (struct ospf6_vertex *) route->route_option; |
| 686 | ospf6_spf_display_subtree (vty, "", 0, root); |
| 687 | |
| 688 | return CMD_SUCCESS; |
| 689 | } |
| 690 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 691 | DEFUN (show_ipv6_ospf6_simulate_spf_tree_root, |
| 692 | show_ipv6_ospf6_simulate_spf_tree_root_cmd, |
| 693 | "show ipv6 ospf6 simulate spf-tree A.B.C.D area A.B.C.D", |
| 694 | SHOW_STR |
| 695 | IP6_STR |
| 696 | OSPF6_STR |
| 697 | "Shortest Path First caculation\n" |
| 698 | "Show SPF tree\n" |
| 699 | "Specify root's router-id to calculate another router's SPF tree\n") |
| 700 | { |
| 701 | u_int32_t area_id; |
| 702 | struct ospf6_area *oa; |
| 703 | struct ospf6_vertex *root; |
| 704 | struct ospf6_route *route; |
| 705 | struct prefix prefix; |
| 706 | u_int32_t router_id; |
| 707 | struct ospf6_route_table *spf_table; |
| 708 | unsigned char tmp_debug_ospf6_spf = 0; |
| 709 | |
| 710 | inet_pton (AF_INET, argv[0], &router_id); |
| 711 | ospf6_linkstate_prefix (router_id, htonl (0), &prefix); |
| 712 | |
| 713 | if (inet_pton (AF_INET, argv[1], &area_id) != 1) |
| 714 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 715 | vty_out (vty, "Malformed Area-ID: %s%s", argv[1], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 716 | return CMD_SUCCESS; |
| 717 | } |
| 718 | oa = ospf6_area_lookup (area_id, ospf6); |
| 719 | if (oa == NULL) |
| 720 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 721 | vty_out (vty, "No such Area: %s%s", argv[1], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 722 | return CMD_SUCCESS; |
| 723 | } |
| 724 | |
| 725 | tmp_debug_ospf6_spf = conf_debug_ospf6_spf; |
| 726 | conf_debug_ospf6_spf = 0; |
| 727 | |
Paul Jakma | cf1ce25 | 2006-05-15 10:46:07 +0000 | [diff] [blame] | 728 | spf_table = OSPF6_ROUTE_TABLE_CREATE (NONE, SPF_RESULTS); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 729 | ospf6_spf_calculation (router_id, spf_table, oa); |
| 730 | |
| 731 | conf_debug_ospf6_spf = tmp_debug_ospf6_spf; |
| 732 | |
| 733 | route = ospf6_route_lookup (&prefix, spf_table); |
| 734 | if (route == NULL) |
| 735 | { |
| 736 | ospf6_spf_table_finish (spf_table); |
| 737 | ospf6_route_table_delete (spf_table); |
| 738 | return CMD_SUCCESS; |
| 739 | } |
| 740 | root = (struct ospf6_vertex *) route->route_option; |
| 741 | ospf6_spf_display_subtree (vty, "", 0, root); |
| 742 | |
| 743 | ospf6_spf_table_finish (spf_table); |
| 744 | ospf6_route_table_delete (spf_table); |
| 745 | |
| 746 | return CMD_SUCCESS; |
| 747 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 748 | |
| 749 | void |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 750 | ospf6_area_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 751 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 752 | install_element (VIEW_NODE, &show_ipv6_ospf6_spf_tree_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 753 | install_element (VIEW_NODE, &show_ipv6_ospf6_area_spf_tree_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 754 | install_element (VIEW_NODE, &show_ipv6_ospf6_simulate_spf_tree_root_cmd); |
| 755 | |
| 756 | install_element (ENABLE_NODE, &show_ipv6_ospf6_spf_tree_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 757 | install_element (ENABLE_NODE, &show_ipv6_ospf6_area_spf_tree_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 758 | install_element (ENABLE_NODE, &show_ipv6_ospf6_simulate_spf_tree_root_cmd); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 759 | |
| 760 | install_element (OSPF6_NODE, &area_range_cmd); |
| 761 | install_element (OSPF6_NODE, &area_range_advertise_cmd); |
| 762 | install_element (OSPF6_NODE, &no_area_range_cmd); |
hasso | 34956b3 | 2005-06-24 08:44:02 +0000 | [diff] [blame] | 763 | |
| 764 | install_element (OSPF6_NODE, &area_import_list_cmd); |
| 765 | install_element (OSPF6_NODE, &no_area_import_list_cmd); |
| 766 | install_element (OSPF6_NODE, &area_export_list_cmd); |
| 767 | install_element (OSPF6_NODE, &no_area_export_list_cmd); |
| 768 | |
| 769 | install_element (OSPF6_NODE, &area_filter_list_cmd); |
| 770 | install_element (OSPF6_NODE, &no_area_filter_list_cmd); |
| 771 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 772 | } |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 773 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 774 | |