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" |
| 33 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 34 | #include "ospf6_proto.h" |
| 35 | #include "ospf6_lsa.h" |
| 36 | #include "ospf6_lsdb.h" |
| 37 | #include "ospf6_route.h" |
| 38 | #include "ospf6_spf.h" |
| 39 | #include "ospf6_top.h" |
| 40 | #include "ospf6_area.h" |
| 41 | #include "ospf6_interface.h" |
| 42 | #include "ospf6_intra.h" |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 43 | #include "ospf6_abr.h" |
| 44 | #include "ospf6d.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 45 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 46 | int |
| 47 | ospf6_area_cmp (void *va, void *vb) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 48 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 49 | struct ospf6_area *oa = (struct ospf6_area *) va; |
| 50 | struct ospf6_area *ob = (struct ospf6_area *) vb; |
| 51 | return (ntohl (oa->area_id) - ntohl (ob->area_id)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | int |
| 55 | ospf6_area_is_stub (struct ospf6_area *o6a) |
| 56 | { |
| 57 | if (OSPF6_OPT_ISSET (o6a->options, OSPF6_OPT_E)) |
| 58 | return 0; |
| 59 | return 1; |
| 60 | } |
| 61 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 62 | /* schedule routing table recalculation */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 63 | void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 64 | ospf6_area_lsdb_hook_add (struct ospf6_lsa *lsa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 65 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 66 | struct ospf6_area *oa; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 67 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 68 | oa = (struct ospf6_area *) lsa->scope; |
| 69 | switch (ntohs (lsa->header->type)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 70 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 71 | case OSPF6_LSTYPE_ROUTER: |
| 72 | case OSPF6_LSTYPE_NETWORK: |
| 73 | ospf6_spf_schedule (oa); |
| 74 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 75 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 76 | case OSPF6_LSTYPE_INTRA_PREFIX: |
| 77 | ospf6_intra_prefix_lsa_add (lsa); |
| 78 | break; |
| 79 | |
| 80 | case OSPF6_LSTYPE_INTER_PREFIX: |
| 81 | case OSPF6_LSTYPE_INTER_ROUTER: |
| 82 | break; |
| 83 | |
| 84 | default: |
| 85 | if (IS_OSPF6_DEBUG_LSA (RECV)) |
| 86 | zlog_info ("Unknown LSA in Area %s's lsdb", oa->name); |
| 87 | break; |
| 88 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 92 | ospf6_area_lsdb_hook_remove (struct ospf6_lsa *lsa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 93 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 94 | struct ospf6_area *oa; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 95 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 96 | oa = (struct ospf6_area *) lsa->scope; |
| 97 | switch (ntohs (lsa->header->type)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 98 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 99 | case OSPF6_LSTYPE_ROUTER: |
| 100 | case OSPF6_LSTYPE_NETWORK: |
| 101 | ospf6_spf_schedule (oa); |
| 102 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 103 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 104 | case OSPF6_LSTYPE_INTRA_PREFIX: |
| 105 | ospf6_intra_prefix_lsa_remove (lsa); |
| 106 | break; |
| 107 | |
| 108 | case OSPF6_LSTYPE_INTER_PREFIX: |
| 109 | case OSPF6_LSTYPE_INTER_ROUTER: |
| 110 | break; |
| 111 | |
| 112 | default: |
| 113 | if (IS_OSPF6_DEBUG_LSA (RECV)) |
| 114 | zlog_info ("Unknown LSA in Area %s's lsdb", oa->name); |
| 115 | break; |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | void |
| 120 | ospf6_area_route_hook_add (struct ospf6_route *route) |
| 121 | { |
| 122 | struct ospf6_route *copy = ospf6_route_copy (route); |
| 123 | ospf6_route_add (copy, ospf6->route_table); |
| 124 | } |
| 125 | |
| 126 | void |
| 127 | ospf6_area_route_hook_remove (struct ospf6_route *route) |
| 128 | { |
| 129 | struct ospf6_route *copy; |
| 130 | |
| 131 | copy = ospf6_route_lookup_identical (route, ospf6->route_table); |
| 132 | if (copy) |
| 133 | ospf6_route_remove (copy, ospf6->route_table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | /* Make new area structure */ |
| 137 | struct ospf6_area * |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 138 | ospf6_area_create (u_int32_t area_id, struct ospf6 *o) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 139 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 140 | struct ospf6_area *oa; |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 141 | struct ospf6_route *route; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 142 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 143 | oa = XCALLOC (MTYPE_OSPF6_AREA, sizeof (struct ospf6_area)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 144 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 145 | inet_ntop (AF_INET, &area_id, oa->name, sizeof (oa->name)); |
| 146 | oa->area_id = area_id; |
| 147 | oa->if_list = list_new (); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 148 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 149 | oa->summary_table = ospf6_route_table_create (); |
| 150 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 151 | oa->lsdb = ospf6_lsdb_create (); |
| 152 | oa->lsdb->hook_add = ospf6_area_lsdb_hook_add; |
| 153 | oa->lsdb->hook_remove = ospf6_area_lsdb_hook_remove; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 154 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 155 | oa->spf_table = ospf6_route_table_create (); |
| 156 | oa->route_table = ospf6_route_table_create (); |
| 157 | oa->route_table->hook_add = ospf6_area_route_hook_add; |
| 158 | oa->route_table->hook_remove = ospf6_area_route_hook_remove; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 159 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 160 | /* set default options */ |
| 161 | OSPF6_OPT_SET (oa->options, OSPF6_OPT_V6); |
| 162 | OSPF6_OPT_SET (oa->options, OSPF6_OPT_E); |
| 163 | OSPF6_OPT_SET (oa->options, OSPF6_OPT_R); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 164 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 165 | oa->ospf6 = o; |
| 166 | listnode_add_sort (o->area_list, oa); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 167 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 168 | /* import athoer area's routes as inter-area routes */ |
| 169 | for (route = ospf6_route_head (o->route_table); route; |
| 170 | route = ospf6_route_next (route)) |
| 171 | ospf6_abr_originate_prefix_to_area (route, oa); |
| 172 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 173 | return oa; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 177 | ospf6_area_delete (struct ospf6_area *oa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 178 | { |
| 179 | listnode n; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 180 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 181 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 182 | ospf6_route_table_delete (oa->summary_table); |
| 183 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 184 | /* ospf6 interface list */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 185 | for (n = listhead (oa->if_list); n; nextnode (n)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 186 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 187 | oi = (struct ospf6_interface *) getdata (n); |
| 188 | ospf6_interface_delete (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 189 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 190 | list_delete (oa->if_list); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 191 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 192 | ospf6_lsdb_delete (oa->lsdb); |
| 193 | ospf6_route_table_delete (oa->spf_table); |
| 194 | ospf6_route_table_delete (oa->route_table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 195 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 196 | #if 0 |
| 197 | ospf6_spftree_delete (oa->spf_tree); |
| 198 | ospf6_route_table_delete (oa->topology_table); |
| 199 | #endif /*0*/ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 200 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 201 | THREAD_OFF (oa->thread_spf_calculation); |
| 202 | THREAD_OFF (oa->thread_route_calculation); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 203 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 204 | listnode_delete (oa->ospf6->area_list, oa); |
| 205 | oa->ospf6 = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 206 | |
| 207 | /* free area */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 208 | XFREE (MTYPE_OSPF6_AREA, oa); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 209 | } |
| 210 | |
| 211 | struct ospf6_area * |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 212 | ospf6_area_lookup (u_int32_t area_id, struct ospf6 *ospf6) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 213 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 214 | struct ospf6_area *oa; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 215 | listnode n; |
| 216 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 217 | for (n = listhead (ospf6->area_list); n; nextnode (n)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 218 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 219 | oa = (struct ospf6_area *) getdata (n); |
| 220 | if (oa->area_id == area_id) |
| 221 | return oa; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | return (struct ospf6_area *) NULL; |
| 225 | } |
| 226 | |
| 227 | void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 228 | ospf6_area_enable (struct ospf6_area *oa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 229 | { |
| 230 | listnode i; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 231 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 232 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 233 | UNSET_FLAG (oa->flag, OSPF6_AREA_DISABLE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 234 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 235 | for (i = listhead (oa->if_list); i; nextnode (i)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 236 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 237 | oi = (struct ospf6_interface *) getdata (i); |
| 238 | ospf6_interface_enable (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 239 | } |
| 240 | } |
| 241 | |
| 242 | void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 243 | ospf6_area_disable (struct ospf6_area *oa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 244 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 245 | listnode i; |
| 246 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 247 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 248 | SET_FLAG (oa->flag, OSPF6_AREA_DISABLE); |
| 249 | |
| 250 | for (i = listhead (oa->if_list); i; nextnode (i)) |
| 251 | { |
| 252 | oi = (struct ospf6_interface *) getdata (i); |
| 253 | ospf6_interface_disable (oi); |
| 254 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 255 | } |
| 256 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 257 | |
| 258 | void |
| 259 | ospf6_area_show (struct vty *vty, struct ospf6_area *oa) |
| 260 | { |
| 261 | listnode i; |
| 262 | struct ospf6_interface *oi; |
| 263 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 264 | vty_out (vty, " Area %s%s", oa->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 265 | vty_out (vty, " Number of Area scoped LSAs is %u%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 266 | oa->lsdb->count, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 267 | |
| 268 | vty_out (vty, " Interface attached to this area:"); |
| 269 | for (i = listhead (oa->if_list); i; nextnode (i)) |
| 270 | { |
| 271 | oi = (struct ospf6_interface *) getdata (i); |
| 272 | vty_out (vty, " %s", oi->interface->name); |
| 273 | } |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 274 | vty_out (vty, "%s", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 278 | #define OSPF6_CMD_AREA_LOOKUP(str, oa) \ |
| 279 | { \ |
| 280 | u_int32_t area_id = 0; \ |
| 281 | if (inet_pton (AF_INET, str, &area_id) != 1) \ |
| 282 | { \ |
| 283 | vty_out (vty, "Malformed Area-ID: %s%s", str, VNL); \ |
| 284 | return CMD_SUCCESS; \ |
| 285 | } \ |
| 286 | oa = ospf6_area_lookup (area_id, ospf6); \ |
| 287 | if (oa == NULL) \ |
| 288 | { \ |
| 289 | vty_out (vty, "No such Area: %s%s", str, VNL); \ |
| 290 | return CMD_SUCCESS; \ |
| 291 | } \ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 292 | } |
| 293 | |
| 294 | DEFUN (show_ipv6_ospf6_area_route_intra, |
| 295 | show_ipv6_ospf6_area_route_intra_cmd, |
| 296 | "show ipv6 ospf6 area A.B.C.D route intra-area", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 297 | SHOW_STR |
| 298 | IP6_STR |
| 299 | OSPF6_STR |
| 300 | OSPF6_AREA_STR |
| 301 | OSPF6_AREA_ID_STR |
| 302 | ROUTE_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 303 | "Display Intra-Area routes\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 304 | ) |
| 305 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 306 | struct ospf6_area *oa; |
| 307 | OSPF6_CMD_AREA_LOOKUP (argv[0], oa); |
| 308 | argc--; |
| 309 | argv++; |
| 310 | return ospf6_route_table_show (vty, argc, argv, oa->route_table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 311 | } |
| 312 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 313 | ALIAS (show_ipv6_ospf6_area_route_intra, |
| 314 | show_ipv6_ospf6_area_route_intra_detail_cmd, |
| 315 | "show ipv6 ospf6 area A.B.C.D route intra-area (X::X|X::X/M|detail)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 316 | SHOW_STR |
| 317 | IP6_STR |
| 318 | OSPF6_STR |
| 319 | OSPF6_AREA_STR |
| 320 | OSPF6_AREA_ID_STR |
| 321 | ROUTE_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 322 | "Display Intra-Area routes\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 323 | "Specify IPv6 address\n" |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 324 | "Specify IPv6 prefix\n" |
| 325 | "Detailed information\n" |
| 326 | ); |
| 327 | |
| 328 | DEFUN (show_ipv6_ospf6_area_route_intra_match, |
| 329 | show_ipv6_ospf6_area_route_intra_match_cmd, |
| 330 | "show ipv6 ospf6 area A.B.C.D route intra-area X::X/M match", |
| 331 | SHOW_STR |
| 332 | IP6_STR |
| 333 | OSPF6_STR |
| 334 | ROUTE_STR |
| 335 | "Display Intra-Area routes\n" |
| 336 | OSPF6_AREA_STR |
| 337 | OSPF6_AREA_ID_STR |
| 338 | "Specify IPv6 prefix\n" |
| 339 | "Display routes which match the specified route\n" |
| 340 | ) |
| 341 | { |
| 342 | char *sargv[CMD_ARGC_MAX]; |
| 343 | int i, sargc; |
| 344 | struct ospf6_area *oa; |
| 345 | |
| 346 | OSPF6_CMD_AREA_LOOKUP (argv[0], oa); |
| 347 | argc--; |
| 348 | argv++; |
| 349 | |
| 350 | /* copy argv to sargv and then append "match" */ |
| 351 | for (i = 0; i < argc; i++) |
| 352 | sargv[i] = argv[i]; |
| 353 | sargc = argc; |
| 354 | sargv[sargc++] = "match"; |
| 355 | sargv[sargc] = NULL; |
| 356 | |
| 357 | return ospf6_route_table_show (vty, sargc, sargv, oa->route_table); |
| 358 | } |
| 359 | |
| 360 | DEFUN (show_ipv6_ospf6_area_route_intra_match_detail, |
| 361 | show_ipv6_ospf6_area_route_intra_match_detail_cmd, |
| 362 | "show ipv6 ospf6 area A.B.C.D route intra-area X::X/M match detail", |
| 363 | SHOW_STR |
| 364 | IP6_STR |
| 365 | OSPF6_STR |
| 366 | OSPF6_AREA_STR |
| 367 | OSPF6_AREA_ID_STR |
| 368 | ROUTE_STR |
| 369 | "Display Intra-Area routes\n" |
| 370 | "Specify IPv6 prefix\n" |
| 371 | "Display routes which match the specified route\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 372 | "Detailed information\n" |
| 373 | ) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 374 | { |
| 375 | char *sargv[CMD_ARGC_MAX]; |
| 376 | int i, sargc; |
| 377 | struct ospf6_area *oa; |
| 378 | |
| 379 | OSPF6_CMD_AREA_LOOKUP (argv[0], oa); |
| 380 | argc--; |
| 381 | argv++; |
| 382 | |
| 383 | /* copy argv to sargv and then append "match" and "detail" */ |
| 384 | for (i = 0; i < argc; i++) |
| 385 | sargv[i] = argv[i]; |
| 386 | sargc = argc; |
| 387 | sargv[sargc++] = "match"; |
| 388 | sargv[sargc++] = "detail"; |
| 389 | sargv[sargc] = NULL; |
| 390 | |
| 391 | return ospf6_route_table_show (vty, sargc, sargv, oa->route_table); |
| 392 | } |
| 393 | |
| 394 | DEFUN (show_ipv6_ospf6_route_intra, |
| 395 | show_ipv6_ospf6_route_intra_cmd, |
| 396 | "show ipv6 ospf6 route intra-area", |
| 397 | SHOW_STR |
| 398 | IP6_STR |
| 399 | OSPF6_STR |
| 400 | ROUTE_STR |
| 401 | "Display Intra-Area routes\n" |
| 402 | ) |
| 403 | { |
| 404 | listnode node; |
| 405 | struct ospf6_area *oa; |
| 406 | |
| 407 | for (node = listhead (ospf6->area_list); node; nextnode (node)) |
| 408 | { |
| 409 | oa = (struct ospf6_area *) getdata (node); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 410 | vty_out (vty, "Area %s%s", oa->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 411 | ospf6_route_table_show (vty, argc, argv, oa->route_table); |
| 412 | } |
| 413 | |
| 414 | return CMD_SUCCESS; |
| 415 | } |
| 416 | |
| 417 | ALIAS (show_ipv6_ospf6_route_intra, |
| 418 | show_ipv6_ospf6_route_intra_detail_cmd, |
| 419 | "show ipv6 ospf6 route intra-area (X::X|X::X/M|detail|summary)", |
| 420 | SHOW_STR |
| 421 | IP6_STR |
| 422 | OSPF6_STR |
| 423 | ROUTE_STR |
| 424 | "Display Intra-Area routes\n" |
| 425 | "Specify IPv6 address\n" |
| 426 | "Specify IPv6 prefix\n" |
| 427 | "Detailed information\n" |
| 428 | "Summary of route table\n" |
| 429 | ); |
| 430 | |
| 431 | DEFUN (show_ipv6_ospf6_route_intra_match, |
| 432 | show_ipv6_ospf6_route_intra_match_cmd, |
| 433 | "show ipv6 ospf6 route intra-area X::X/M match", |
| 434 | SHOW_STR |
| 435 | IP6_STR |
| 436 | OSPF6_STR |
| 437 | ROUTE_STR |
| 438 | "Display Intra-Area routes\n" |
| 439 | "Specify IPv6 prefix\n" |
| 440 | "Display routes which match the specified route\n" |
| 441 | ) |
| 442 | { |
| 443 | char *sargv[CMD_ARGC_MAX]; |
| 444 | int i, sargc; |
| 445 | listnode node; |
| 446 | struct ospf6_area *oa; |
| 447 | |
| 448 | /* copy argv to sargv and then append "match" */ |
| 449 | for (i = 0; i < argc; i++) |
| 450 | sargv[i] = argv[i]; |
| 451 | sargc = argc; |
| 452 | sargv[sargc++] = "match"; |
| 453 | sargv[sargc] = NULL; |
| 454 | |
| 455 | for (node = listhead (ospf6->area_list); node; nextnode (node)) |
| 456 | { |
| 457 | oa = (struct ospf6_area *) getdata (node); |
| 458 | ospf6_route_table_show (vty, sargc, sargv, oa->route_table); |
| 459 | } |
| 460 | |
| 461 | return CMD_SUCCESS; |
| 462 | } |
| 463 | |
| 464 | DEFUN (show_ipv6_ospf6_route_intra_match_detail, |
| 465 | show_ipv6_ospf6_route_intra_match_detail_cmd, |
| 466 | "show ipv6 ospf6 route intra-area X::X/M match detail", |
| 467 | SHOW_STR |
| 468 | IP6_STR |
| 469 | OSPF6_STR |
| 470 | ROUTE_STR |
| 471 | "Display Intra-Area routes\n" |
| 472 | "Specify IPv6 prefix\n" |
| 473 | "Display routes which match the specified route\n" |
| 474 | "Detailed information\n" |
| 475 | ) |
| 476 | { |
| 477 | char *sargv[CMD_ARGC_MAX]; |
| 478 | int i, sargc; |
| 479 | listnode node; |
| 480 | struct ospf6_area *oa; |
| 481 | |
| 482 | /* copy argv to sargv and then append "match" and "detail" */ |
| 483 | for (i = 0; i < argc; i++) |
| 484 | sargv[i] = argv[i]; |
| 485 | sargc = argc; |
| 486 | sargv[sargc++] = "match"; |
| 487 | sargv[sargc++] = "detail"; |
| 488 | sargv[sargc] = NULL; |
| 489 | |
| 490 | for (node = listhead (ospf6->area_list); node; nextnode (node)) |
| 491 | { |
| 492 | oa = (struct ospf6_area *) getdata (node); |
| 493 | ospf6_route_table_show (vty, sargc, sargv, oa->route_table); |
| 494 | } |
| 495 | |
| 496 | return CMD_SUCCESS; |
| 497 | } |
| 498 | |
| 499 | DEFUN (show_ipv6_ospf6_spf_tree, |
| 500 | show_ipv6_ospf6_spf_tree_cmd, |
| 501 | "show ipv6 ospf6 spf tree", |
| 502 | SHOW_STR |
| 503 | IP6_STR |
| 504 | OSPF6_STR |
| 505 | "Shortest Path First caculation\n" |
| 506 | "Show SPF tree\n") |
| 507 | { |
| 508 | listnode node; |
| 509 | struct ospf6_area *oa; |
| 510 | struct ospf6_vertex *root; |
| 511 | struct ospf6_route *route; |
| 512 | struct prefix prefix; |
| 513 | |
| 514 | ospf6_linkstate_prefix (ospf6->router_id, htonl (0), &prefix); |
| 515 | for (node = listhead (ospf6->area_list); node; nextnode (node)) |
| 516 | { |
| 517 | oa = (struct ospf6_area *) getdata (node); |
| 518 | route = ospf6_route_lookup (&prefix, oa->spf_table); |
| 519 | if (route == NULL) |
| 520 | { |
| 521 | vty_out (vty, "LS entry for root not found in area %s%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 522 | oa->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 523 | continue; |
| 524 | } |
| 525 | root = (struct ospf6_vertex *) route->route_option; |
| 526 | ospf6_spf_display_subtree (vty, "", 0, root); |
| 527 | } |
| 528 | |
| 529 | return CMD_SUCCESS; |
| 530 | } |
| 531 | |
| 532 | DEFUN (show_ipv6_ospf6_area_spf_tree, |
| 533 | show_ipv6_ospf6_area_spf_tree_cmd, |
| 534 | "show ipv6 ospf6 area A.B.C.D spf tree", |
| 535 | SHOW_STR |
| 536 | IP6_STR |
| 537 | OSPF6_STR |
| 538 | OSPF6_AREA_STR |
| 539 | OSPF6_AREA_ID_STR |
| 540 | "Shortest Path First caculation\n" |
| 541 | "Show SPF tree\n") |
| 542 | { |
| 543 | u_int32_t area_id; |
| 544 | struct ospf6_area *oa; |
| 545 | struct ospf6_vertex *root; |
| 546 | struct ospf6_route *route; |
| 547 | struct prefix prefix; |
| 548 | |
| 549 | ospf6_linkstate_prefix (ospf6->router_id, htonl (0), &prefix); |
| 550 | |
| 551 | if (inet_pton (AF_INET, argv[0], &area_id) != 1) |
| 552 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 553 | vty_out (vty, "Malformed Area-ID: %s%s", argv[0], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 554 | return CMD_SUCCESS; |
| 555 | } |
| 556 | oa = ospf6_area_lookup (area_id, ospf6); |
| 557 | if (oa == NULL) |
| 558 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 559 | vty_out (vty, "No such Area: %s%s", argv[0], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 560 | return CMD_SUCCESS; |
| 561 | } |
| 562 | |
| 563 | route = ospf6_route_lookup (&prefix, oa->spf_table); |
| 564 | if (route == NULL) |
| 565 | { |
| 566 | vty_out (vty, "LS entry for root not found in area %s%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 567 | oa->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 568 | return CMD_SUCCESS; |
| 569 | } |
| 570 | root = (struct ospf6_vertex *) route->route_option; |
| 571 | ospf6_spf_display_subtree (vty, "", 0, root); |
| 572 | |
| 573 | return CMD_SUCCESS; |
| 574 | } |
| 575 | |
| 576 | DEFUN (show_ipv6_ospf6_area_spf_table, |
| 577 | show_ipv6_ospf6_area_spf_table_cmd, |
| 578 | "show ipv6 ospf6 area A.B.C.D spf table", |
| 579 | SHOW_STR |
| 580 | IP6_STR |
| 581 | OSPF6_STR |
| 582 | OSPF6_AREA_STR |
| 583 | OSPF6_AREA_ID_STR |
| 584 | "Shortest Path First caculation\n" |
| 585 | "Show table contains SPF result\n" |
| 586 | ) |
| 587 | { |
| 588 | u_int32_t area_id; |
| 589 | struct ospf6_area *oa; |
| 590 | |
| 591 | if (inet_pton (AF_INET, argv[0], &area_id) != 1) |
| 592 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 593 | vty_out (vty, "Malformed Area-ID: %s%s", argv[0], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 594 | return CMD_SUCCESS; |
| 595 | } |
| 596 | oa = ospf6_area_lookup (area_id, ospf6); |
| 597 | if (oa == NULL) |
| 598 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 599 | vty_out (vty, "No such Area: %s%s", argv[0], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 600 | return CMD_SUCCESS; |
| 601 | } |
| 602 | |
| 603 | argc--; |
| 604 | argv++; |
| 605 | |
| 606 | ospf6_lsentry_table_show (vty, argc, argv, oa->spf_table); |
| 607 | return CMD_SUCCESS; |
| 608 | } |
| 609 | |
| 610 | ALIAS (show_ipv6_ospf6_area_spf_table, |
| 611 | show_ipv6_ospf6_area_spf_table_1_cmd, |
| 612 | "show ipv6 ospf6 area A.B.C.D spf table (A.B.C.D|A.B.C.D/M|detail)", |
| 613 | SHOW_STR |
| 614 | IP6_STR |
| 615 | OSPF6_STR |
| 616 | OSPF6_AREA_STR |
| 617 | OSPF6_AREA_ID_STR |
| 618 | "Shortest Path First caculation\n" |
| 619 | "Show table contains SPF result\n" |
| 620 | "Specify Router-ID\n" |
| 621 | "Display multiple entry by specifying match-prefix of Router-ID\n" |
| 622 | "Display Detail\n" |
| 623 | ); |
| 624 | |
| 625 | ALIAS (show_ipv6_ospf6_area_spf_table, |
| 626 | show_ipv6_ospf6_area_spf_table_2_cmd, |
| 627 | "show ipv6 ospf6 area A.B.C.D spf table (A.B.C.D|*) (A.B.C.D|A.B.C.D/M|detail)", |
| 628 | SHOW_STR |
| 629 | IP6_STR |
| 630 | OSPF6_STR |
| 631 | OSPF6_AREA_STR |
| 632 | OSPF6_AREA_ID_STR |
| 633 | "Shortest Path First caculation\n" |
| 634 | "Show table contains SPF result\n" |
| 635 | "Specify Router-ID\n" |
| 636 | "Wildcard Router-ID\n" |
| 637 | "Specify Link State ID\n" |
| 638 | "Display multiple entry by specifying match-prefix of Link State ID\n" |
| 639 | "Display Detail\n" |
| 640 | ); |
| 641 | |
| 642 | DEFUN (show_ipv6_ospf6_area_spf_table_3, |
| 643 | show_ipv6_ospf6_area_spf_table_3_cmd, |
| 644 | "show ipv6 ospf6 area A.B.C.D spf table (A.B.C.D|*) A.B.C.D/M detail", |
| 645 | SHOW_STR |
| 646 | IP6_STR |
| 647 | OSPF6_STR |
| 648 | OSPF6_AREA_STR |
| 649 | OSPF6_AREA_ID_STR |
| 650 | "Shortest Path First caculation\n" |
| 651 | "Show table contains SPF result\n" |
| 652 | "Specify Router-ID\n" |
| 653 | "Wildcard Router-ID\n" |
| 654 | "Display multiple entry by specifying match-prefix of Link State ID\n" |
| 655 | "Display Detail\n" |
| 656 | ) |
| 657 | { |
| 658 | u_int32_t area_id; |
| 659 | struct ospf6_area *oa; |
| 660 | char *sargv[CMD_ARGC_MAX]; |
| 661 | int i, sargc; |
| 662 | |
| 663 | if (inet_pton (AF_INET, argv[0], &area_id) != 1) |
| 664 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 665 | vty_out (vty, "Malformed Area-ID: %s%s", argv[0], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 666 | return CMD_SUCCESS; |
| 667 | } |
| 668 | oa = ospf6_area_lookup (area_id, ospf6); |
| 669 | if (oa == NULL) |
| 670 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 671 | vty_out (vty, "No such Area: %s%s", argv[0], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 672 | return CMD_SUCCESS; |
| 673 | } |
| 674 | |
| 675 | argc--; |
| 676 | argv++; |
| 677 | |
| 678 | /* copy argv to sargv and then append "detail" */ |
| 679 | for (i = 0; i < argc; i++) |
| 680 | sargv[i] = argv[i]; |
| 681 | sargc = argc; |
| 682 | sargv[sargc++] = "detail"; |
| 683 | sargv[sargc] = NULL; |
| 684 | |
| 685 | ospf6_lsentry_table_show (vty, sargc, sargv, oa->spf_table); |
| 686 | return CMD_SUCCESS; |
| 687 | } |
| 688 | |
| 689 | DEFUN (show_ipv6_ospf6_spf_table, |
| 690 | show_ipv6_ospf6_spf_table_cmd, |
| 691 | "show ipv6 ospf6 spf table", |
| 692 | SHOW_STR |
| 693 | IP6_STR |
| 694 | OSPF6_STR |
| 695 | "Shortest Path First caculation\n" |
| 696 | "Show table contains SPF result\n" |
| 697 | ) |
| 698 | { |
| 699 | listnode node; |
| 700 | struct ospf6_area *oa; |
| 701 | |
| 702 | for (node = listhead (ospf6->area_list); node; nextnode (node)) |
| 703 | { |
| 704 | oa = (struct ospf6_area *) getdata (node); |
| 705 | ospf6_lsentry_table_show (vty, argc, argv, oa->spf_table); |
| 706 | } |
| 707 | |
| 708 | return CMD_SUCCESS; |
| 709 | } |
| 710 | |
| 711 | ALIAS (show_ipv6_ospf6_spf_table, |
| 712 | show_ipv6_ospf6_spf_table_1_cmd, |
| 713 | "show ipv6 ospf6 spf table (A.B.C.D|A.B.C.D/M|detail)", |
| 714 | SHOW_STR |
| 715 | IP6_STR |
| 716 | OSPF6_STR |
| 717 | "Shortest Path First caculation\n" |
| 718 | "Show table contains SPF result\n" |
| 719 | "Specify Router-ID\n" |
| 720 | "Display multiple entry by specifying match-prefix of Router-ID\n" |
| 721 | "Display Detail\n" |
| 722 | ); |
| 723 | |
| 724 | ALIAS (show_ipv6_ospf6_spf_table, |
| 725 | show_ipv6_ospf6_spf_table_2_cmd, |
| 726 | "show ipv6 ospf6 spf table (A.B.C.D|A.B.C.D/M|*) (A.B.C.D|A.B.C.D/M|detail)", |
| 727 | SHOW_STR |
| 728 | IP6_STR |
| 729 | OSPF6_STR |
| 730 | "Shortest Path First caculation\n" |
| 731 | "Show table contains SPF result\n" |
| 732 | "Specify Router-ID\n" |
| 733 | "Display multiple entry by specifying match-prefix of Router-ID\n" |
| 734 | "Wildcard Router-ID\n" |
| 735 | "Specify Link State ID\n" |
| 736 | "Display multiple entry by specifying match-prefix of Link State ID\n" |
| 737 | "Display Detail\n" |
| 738 | ); |
| 739 | |
| 740 | DEFUN (show_ipv6_ospf6_spf_table_3, |
| 741 | show_ipv6_ospf6_spf_table_3_cmd, |
| 742 | "show ipv6 ospf6 spf table (A.B.C.D|*) A.B.C.D/M detail", |
| 743 | SHOW_STR |
| 744 | IP6_STR |
| 745 | OSPF6_STR |
| 746 | "Shortest Path First caculation\n" |
| 747 | "Show table contains SPF result\n" |
| 748 | "Specify Router-ID\n" |
| 749 | "Wildcard Router-ID\n" |
| 750 | "Display multiple entry by specifying match-prefix of Link State ID\n" |
| 751 | "Display Detail\n" |
| 752 | ) |
| 753 | { |
| 754 | listnode node; |
| 755 | struct ospf6_area *oa; |
| 756 | char *sargv[CMD_ARGC_MAX]; |
| 757 | int i, sargc; |
| 758 | |
| 759 | /* copy argv to sargv and then append "detail" */ |
| 760 | for (i = 0; i < argc; i++) |
| 761 | sargv[i] = argv[i]; |
| 762 | sargc = argc; |
| 763 | sargv[sargc++] = "detail"; |
| 764 | sargv[sargc] = NULL; |
| 765 | |
| 766 | for (node = listhead (ospf6->area_list); node; nextnode (node)) |
| 767 | { |
| 768 | oa = (struct ospf6_area *) getdata (node); |
| 769 | ospf6_lsentry_table_show (vty, sargc, sargv, oa->spf_table); |
| 770 | } |
| 771 | |
| 772 | return CMD_SUCCESS; |
| 773 | } |
| 774 | |
| 775 | DEFUN (show_ipv6_ospf6_simulate_spf_tree_root, |
| 776 | show_ipv6_ospf6_simulate_spf_tree_root_cmd, |
| 777 | "show ipv6 ospf6 simulate spf-tree A.B.C.D area A.B.C.D", |
| 778 | SHOW_STR |
| 779 | IP6_STR |
| 780 | OSPF6_STR |
| 781 | "Shortest Path First caculation\n" |
| 782 | "Show SPF tree\n" |
| 783 | "Specify root's router-id to calculate another router's SPF tree\n") |
| 784 | { |
| 785 | u_int32_t area_id; |
| 786 | struct ospf6_area *oa; |
| 787 | struct ospf6_vertex *root; |
| 788 | struct ospf6_route *route; |
| 789 | struct prefix prefix; |
| 790 | u_int32_t router_id; |
| 791 | struct ospf6_route_table *spf_table; |
| 792 | unsigned char tmp_debug_ospf6_spf = 0; |
| 793 | |
| 794 | inet_pton (AF_INET, argv[0], &router_id); |
| 795 | ospf6_linkstate_prefix (router_id, htonl (0), &prefix); |
| 796 | |
| 797 | if (inet_pton (AF_INET, argv[1], &area_id) != 1) |
| 798 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 799 | vty_out (vty, "Malformed Area-ID: %s%s", argv[1], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 800 | return CMD_SUCCESS; |
| 801 | } |
| 802 | oa = ospf6_area_lookup (area_id, ospf6); |
| 803 | if (oa == NULL) |
| 804 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 805 | vty_out (vty, "No such Area: %s%s", argv[1], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 806 | return CMD_SUCCESS; |
| 807 | } |
| 808 | |
| 809 | tmp_debug_ospf6_spf = conf_debug_ospf6_spf; |
| 810 | conf_debug_ospf6_spf = 0; |
| 811 | |
| 812 | spf_table = ospf6_route_table_create (); |
| 813 | ospf6_spf_calculation (router_id, spf_table, oa); |
| 814 | |
| 815 | conf_debug_ospf6_spf = tmp_debug_ospf6_spf; |
| 816 | |
| 817 | route = ospf6_route_lookup (&prefix, spf_table); |
| 818 | if (route == NULL) |
| 819 | { |
| 820 | ospf6_spf_table_finish (spf_table); |
| 821 | ospf6_route_table_delete (spf_table); |
| 822 | return CMD_SUCCESS; |
| 823 | } |
| 824 | root = (struct ospf6_vertex *) route->route_option; |
| 825 | ospf6_spf_display_subtree (vty, "", 0, root); |
| 826 | |
| 827 | ospf6_spf_table_finish (spf_table); |
| 828 | ospf6_route_table_delete (spf_table); |
| 829 | |
| 830 | return CMD_SUCCESS; |
| 831 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 832 | |
| 833 | void |
| 834 | ospf6_area_init () |
| 835 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 836 | install_element (VIEW_NODE, &show_ipv6_ospf6_spf_tree_cmd); |
| 837 | install_element (VIEW_NODE, &show_ipv6_ospf6_spf_table_cmd); |
| 838 | install_element (VIEW_NODE, &show_ipv6_ospf6_spf_table_1_cmd); |
| 839 | install_element (VIEW_NODE, &show_ipv6_ospf6_spf_table_2_cmd); |
| 840 | install_element (VIEW_NODE, &show_ipv6_ospf6_spf_table_3_cmd); |
| 841 | install_element (VIEW_NODE, &show_ipv6_ospf6_area_spf_tree_cmd); |
| 842 | install_element (VIEW_NODE, &show_ipv6_ospf6_area_spf_table_cmd); |
| 843 | install_element (VIEW_NODE, &show_ipv6_ospf6_area_spf_table_1_cmd); |
| 844 | install_element (VIEW_NODE, &show_ipv6_ospf6_area_spf_table_2_cmd); |
| 845 | install_element (VIEW_NODE, &show_ipv6_ospf6_area_spf_table_3_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 846 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 847 | install_element (VIEW_NODE, &show_ipv6_ospf6_route_intra_cmd); |
| 848 | install_element (VIEW_NODE, &show_ipv6_ospf6_route_intra_detail_cmd); |
| 849 | install_element (VIEW_NODE, &show_ipv6_ospf6_route_intra_match_cmd); |
| 850 | install_element (VIEW_NODE, &show_ipv6_ospf6_route_intra_match_detail_cmd); |
| 851 | install_element (VIEW_NODE, &show_ipv6_ospf6_area_route_intra_cmd); |
| 852 | install_element (VIEW_NODE, &show_ipv6_ospf6_area_route_intra_detail_cmd); |
| 853 | install_element (VIEW_NODE, &show_ipv6_ospf6_area_route_intra_match_cmd); |
| 854 | install_element (VIEW_NODE, &show_ipv6_ospf6_area_route_intra_match_detail_cmd); |
| 855 | |
| 856 | install_element (VIEW_NODE, &show_ipv6_ospf6_simulate_spf_tree_root_cmd); |
| 857 | |
| 858 | install_element (ENABLE_NODE, &show_ipv6_ospf6_spf_tree_cmd); |
| 859 | install_element (ENABLE_NODE, &show_ipv6_ospf6_spf_table_cmd); |
| 860 | install_element (ENABLE_NODE, &show_ipv6_ospf6_spf_table_1_cmd); |
| 861 | install_element (ENABLE_NODE, &show_ipv6_ospf6_spf_table_2_cmd); |
| 862 | install_element (ENABLE_NODE, &show_ipv6_ospf6_spf_table_3_cmd); |
| 863 | install_element (ENABLE_NODE, &show_ipv6_ospf6_area_spf_tree_cmd); |
| 864 | install_element (ENABLE_NODE, &show_ipv6_ospf6_area_spf_table_cmd); |
| 865 | install_element (ENABLE_NODE, &show_ipv6_ospf6_area_spf_table_1_cmd); |
| 866 | install_element (ENABLE_NODE, &show_ipv6_ospf6_area_spf_table_2_cmd); |
| 867 | install_element (ENABLE_NODE, &show_ipv6_ospf6_area_spf_table_3_cmd); |
| 868 | |
| 869 | install_element (ENABLE_NODE, &show_ipv6_ospf6_route_intra_cmd); |
| 870 | install_element (ENABLE_NODE, &show_ipv6_ospf6_route_intra_detail_cmd); |
| 871 | install_element (ENABLE_NODE, &show_ipv6_ospf6_route_intra_match_cmd); |
| 872 | install_element (ENABLE_NODE, &show_ipv6_ospf6_route_intra_match_detail_cmd); |
| 873 | install_element (ENABLE_NODE, &show_ipv6_ospf6_area_route_intra_cmd); |
| 874 | install_element (ENABLE_NODE, &show_ipv6_ospf6_area_route_intra_detail_cmd); |
| 875 | install_element (ENABLE_NODE, &show_ipv6_ospf6_area_route_intra_match_cmd); |
| 876 | install_element (ENABLE_NODE, &show_ipv6_ospf6_area_route_intra_match_detail_cmd); |
| 877 | |
| 878 | install_element (ENABLE_NODE, &show_ipv6_ospf6_simulate_spf_tree_root_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 879 | } |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame^] | 880 | |