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 | |
| 22 | #include <zebra.h> |
| 23 | |
| 24 | #include "log.h" |
| 25 | #include "memory.h" |
| 26 | #include "vty.h" |
| 27 | #include "linklist.h" |
| 28 | #include "prefix.h" |
| 29 | #include "table.h" |
| 30 | #include "thread.h" |
| 31 | #include "command.h" |
| 32 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 33 | #include "ospf6_proto.h" |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 34 | #include "ospf6_message.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 35 | #include "ospf6_lsa.h" |
| 36 | #include "ospf6_lsdb.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 37 | #include "ospf6_route.h" |
| 38 | #include "ospf6_zebra.h" |
| 39 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 40 | #include "ospf6_top.h" |
| 41 | #include "ospf6_area.h" |
| 42 | #include "ospf6_interface.h" |
| 43 | #include "ospf6_neighbor.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 44 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 45 | #include "ospf6_flood.h" |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 46 | #include "ospf6_asbr.h" |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 47 | #include "ospf6_abr.h" |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 48 | #include "ospf6_intra.h" |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 49 | #include "ospf6d.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 50 | |
| 51 | /* global ospf6d variable */ |
| 52 | struct ospf6 *ospf6; |
| 53 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 54 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 55 | ospf6_top_lsdb_hook_add (struct ospf6_lsa *lsa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 56 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 57 | switch (ntohs (lsa->header->type)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 58 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 59 | case OSPF6_LSTYPE_AS_EXTERNAL: |
| 60 | ospf6_asbr_lsa_add (lsa); |
| 61 | break; |
| 62 | |
| 63 | default: |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 64 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 65 | } |
| 66 | } |
| 67 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 68 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 69 | ospf6_top_lsdb_hook_remove (struct ospf6_lsa *lsa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 70 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 71 | switch (ntohs (lsa->header->type)) |
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_AS_EXTERNAL: |
| 74 | ospf6_asbr_lsa_remove (lsa); |
| 75 | break; |
| 76 | |
| 77 | default: |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 78 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 79 | } |
| 80 | } |
| 81 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 82 | static void |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 83 | ospf6_top_route_hook_add (struct ospf6_route *route) |
| 84 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 85 | ospf6_abr_originate_summary (route); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 86 | ospf6_zebra_route_update_add (route); |
| 87 | } |
| 88 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 89 | static void |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 90 | ospf6_top_route_hook_remove (struct ospf6_route *route) |
| 91 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 92 | ospf6_abr_originate_summary (route); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 93 | ospf6_zebra_route_update_remove (route); |
| 94 | } |
| 95 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 96 | static void |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 97 | ospf6_top_brouter_hook_add (struct ospf6_route *route) |
| 98 | { |
hasso | ccb59b1 | 2004-08-25 09:10:37 +0000 | [diff] [blame] | 99 | ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix)); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 100 | ospf6_asbr_lsentry_add (route); |
hasso | ccb59b1 | 2004-08-25 09:10:37 +0000 | [diff] [blame] | 101 | ospf6_abr_originate_summary (route); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 102 | } |
| 103 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 104 | static void |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 105 | ospf6_top_brouter_hook_remove (struct ospf6_route *route) |
| 106 | { |
hasso | ccb59b1 | 2004-08-25 09:10:37 +0000 | [diff] [blame] | 107 | ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix)); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 108 | ospf6_asbr_lsentry_remove (route); |
hasso | ccb59b1 | 2004-08-25 09:10:37 +0000 | [diff] [blame] | 109 | ospf6_abr_originate_summary (route); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 110 | } |
| 111 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 112 | static struct ospf6 * |
| 113 | ospf6_create (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 114 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 115 | struct ospf6 *o; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 116 | |
Stephen Hemminger | 393deb9 | 2008-08-18 14:13:29 -0700 | [diff] [blame] | 117 | o = XCALLOC (MTYPE_OSPF6_TOP, sizeof (struct ospf6)); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 118 | |
| 119 | /* initialize */ |
Takashi Sogabe | 86f72dc | 2009-06-22 13:07:02 +0900 | [diff] [blame^] | 120 | quagga_gettime (QUAGGA_CLK_MONOTONIC, &o->starttime); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 121 | o->area_list = list_new (); |
| 122 | o->area_list->cmp = ospf6_area_cmp; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 123 | o->lsdb = ospf6_lsdb_create (o); |
| 124 | o->lsdb_self = ospf6_lsdb_create (o); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 125 | o->lsdb->hook_add = ospf6_top_lsdb_hook_add; |
| 126 | o->lsdb->hook_remove = ospf6_top_lsdb_hook_remove; |
| 127 | |
Paul Jakma | cf1ce25 | 2006-05-15 10:46:07 +0000 | [diff] [blame] | 128 | o->route_table = OSPF6_ROUTE_TABLE_CREATE (GLOBAL, ROUTES); |
| 129 | o->route_table->scope = o; |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 130 | o->route_table->hook_add = ospf6_top_route_hook_add; |
| 131 | o->route_table->hook_remove = ospf6_top_route_hook_remove; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 132 | |
Paul Jakma | cf1ce25 | 2006-05-15 10:46:07 +0000 | [diff] [blame] | 133 | o->brouter_table = OSPF6_ROUTE_TABLE_CREATE (GLOBAL, BORDER_ROUTERS); |
| 134 | o->brouter_table->scope = o; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 135 | o->brouter_table->hook_add = ospf6_top_brouter_hook_add; |
| 136 | o->brouter_table->hook_remove = ospf6_top_brouter_hook_remove; |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 137 | |
Paul Jakma | cf1ce25 | 2006-05-15 10:46:07 +0000 | [diff] [blame] | 138 | o->external_table = OSPF6_ROUTE_TABLE_CREATE (GLOBAL, EXTERNAL_ROUTES); |
| 139 | o->external_table->scope = o; |
| 140 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 141 | o->external_id_table = route_table_init (); |
| 142 | |
| 143 | return o; |
| 144 | } |
| 145 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 146 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 147 | ospf6_delete (struct ospf6 *o) |
| 148 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 149 | struct listnode *node, *nnode; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 150 | struct ospf6_area *oa; |
| 151 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 152 | for (ALL_LIST_ELEMENTS (o->area_list, node, nnode, oa)) |
| 153 | ospf6_area_delete (oa); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 154 | |
| 155 | ospf6_lsdb_delete (o->lsdb); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 156 | ospf6_lsdb_delete (o->lsdb_self); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 157 | |
| 158 | ospf6_route_table_delete (o->route_table); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 159 | ospf6_route_table_delete (o->brouter_table); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 160 | |
| 161 | ospf6_route_table_delete (o->external_table); |
| 162 | route_table_finish (o->external_id_table); |
| 163 | |
| 164 | XFREE (MTYPE_OSPF6_TOP, o); |
| 165 | } |
| 166 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 167 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 168 | ospf6_enable (struct ospf6 *o) |
| 169 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 170 | struct listnode *node, *nnode; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 171 | struct ospf6_area *oa; |
| 172 | |
| 173 | if (CHECK_FLAG (o->flag, OSPF6_DISABLED)) |
| 174 | { |
| 175 | UNSET_FLAG (o->flag, OSPF6_DISABLED); |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 176 | for (ALL_LIST_ELEMENTS (o->area_list, node, nnode, oa)) |
| 177 | ospf6_area_enable (oa); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 178 | } |
| 179 | } |
| 180 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 181 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 182 | ospf6_disable (struct ospf6 *o) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 183 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 184 | struct listnode *node, *nnode; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 185 | struct ospf6_area *oa; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 186 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 187 | if (! CHECK_FLAG (o->flag, OSPF6_DISABLED)) |
| 188 | { |
| 189 | SET_FLAG (o->flag, OSPF6_DISABLED); |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 190 | |
| 191 | for (ALL_LIST_ELEMENTS (o->area_list, node, nnode, oa)) |
| 192 | ospf6_area_disable (oa); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 193 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 194 | ospf6_lsdb_remove_all (o->lsdb); |
| 195 | ospf6_route_remove_all (o->route_table); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 196 | ospf6_route_remove_all (o->brouter_table); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 197 | } |
| 198 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 199 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 200 | static int |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 201 | ospf6_maxage_remover (struct thread *thread) |
| 202 | { |
| 203 | struct ospf6 *o = (struct ospf6 *) THREAD_ARG (thread); |
| 204 | struct ospf6_area *oa; |
| 205 | struct ospf6_interface *oi; |
| 206 | struct ospf6_neighbor *on; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 207 | struct listnode *i, *j, *k; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 208 | |
| 209 | o->maxage_remover = (struct thread *) NULL; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 210 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 211 | for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 212 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 213 | for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi)) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 214 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 215 | for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, k, on)) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 216 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 217 | if (on->state != OSPF6_NEIGHBOR_EXCHANGE && |
| 218 | on->state != OSPF6_NEIGHBOR_LOADING) |
| 219 | continue; |
| 220 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 221 | return 0; |
| 222 | } |
| 223 | } |
| 224 | } |
| 225 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 226 | for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 227 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 228 | for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi)) |
| 229 | OSPF6_LSDB_MAXAGE_REMOVER (oi->lsdb); |
| 230 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 231 | OSPF6_LSDB_MAXAGE_REMOVER (oa->lsdb); |
| 232 | } |
| 233 | OSPF6_LSDB_MAXAGE_REMOVER (o->lsdb); |
| 234 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 235 | return 0; |
| 236 | } |
| 237 | |
| 238 | void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 239 | ospf6_maxage_remove (struct ospf6 *o) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 240 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 241 | if (o && ! o->maxage_remover) |
| 242 | o->maxage_remover = thread_add_event (master, ospf6_maxage_remover, o, 0); |
| 243 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 244 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 245 | /* start ospf6 */ |
| 246 | DEFUN (router_ospf6, |
| 247 | router_ospf6_cmd, |
| 248 | "router ospf6", |
| 249 | ROUTER_STR |
| 250 | OSPF6_STR) |
| 251 | { |
| 252 | if (ospf6 == NULL) |
| 253 | ospf6 = ospf6_create (); |
| 254 | if (CHECK_FLAG (ospf6->flag, OSPF6_DISABLED)) |
| 255 | ospf6_enable (ospf6); |
| 256 | |
| 257 | /* set current ospf point. */ |
| 258 | vty->node = OSPF6_NODE; |
| 259 | vty->index = ospf6; |
| 260 | |
| 261 | return CMD_SUCCESS; |
| 262 | } |
| 263 | |
| 264 | /* stop ospf6 */ |
| 265 | DEFUN (no_router_ospf6, |
| 266 | no_router_ospf6_cmd, |
| 267 | "no router ospf6", |
| 268 | NO_STR |
| 269 | OSPF6_ROUTER_STR) |
| 270 | { |
| 271 | if (ospf6 == NULL || CHECK_FLAG (ospf6->flag, OSPF6_DISABLED)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 272 | vty_out (vty, "OSPFv3 is not running%s", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 273 | else |
| 274 | ospf6_disable (ospf6); |
| 275 | |
| 276 | /* return to config node . */ |
| 277 | vty->node = CONFIG_NODE; |
| 278 | vty->index = NULL; |
| 279 | |
| 280 | return CMD_SUCCESS; |
| 281 | } |
| 282 | |
| 283 | /* change Router_ID commands. */ |
| 284 | DEFUN (ospf6_router_id, |
| 285 | ospf6_router_id_cmd, |
| 286 | "router-id A.B.C.D", |
| 287 | "Configure OSPF Router-ID\n" |
| 288 | V4NOTATION_STR) |
| 289 | { |
| 290 | int ret; |
| 291 | u_int32_t router_id; |
| 292 | struct ospf6 *o; |
| 293 | |
| 294 | o = (struct ospf6 *) vty->index; |
| 295 | |
| 296 | ret = inet_pton (AF_INET, argv[0], &router_id); |
| 297 | if (ret == 0) |
| 298 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 299 | vty_out (vty, "malformed OSPF Router-ID: %s%s", argv[0], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 300 | return CMD_SUCCESS; |
| 301 | } |
| 302 | |
hasso | c8a440e | 2004-10-11 17:02:40 +0000 | [diff] [blame] | 303 | o->router_id_static = router_id; |
| 304 | if (o->router_id == 0) |
| 305 | o->router_id = router_id; |
| 306 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 307 | return CMD_SUCCESS; |
| 308 | } |
| 309 | |
| 310 | DEFUN (ospf6_interface_area, |
| 311 | ospf6_interface_area_cmd, |
| 312 | "interface IFNAME area A.B.C.D", |
| 313 | "Enable routing on an IPv6 interface\n" |
| 314 | IFNAME_STR |
| 315 | "Specify the OSPF6 area ID\n" |
| 316 | "OSPF6 area ID in IPv4 address notation\n" |
| 317 | ) |
| 318 | { |
| 319 | struct ospf6 *o; |
hasso | 3b68735 | 2004-08-19 06:56:53 +0000 | [diff] [blame] | 320 | struct ospf6_area *oa; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 321 | struct ospf6_interface *oi; |
| 322 | struct interface *ifp; |
| 323 | u_int32_t area_id; |
| 324 | |
| 325 | o = (struct ospf6 *) vty->index; |
| 326 | |
| 327 | /* find/create ospf6 interface */ |
| 328 | ifp = if_get_by_name (argv[0]); |
| 329 | oi = (struct ospf6_interface *) ifp->info; |
| 330 | if (oi == NULL) |
| 331 | oi = ospf6_interface_create (ifp); |
| 332 | if (oi->area) |
| 333 | { |
| 334 | vty_out (vty, "%s already attached to Area %s%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 335 | oi->interface->name, oi->area->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 336 | return CMD_SUCCESS; |
| 337 | } |
| 338 | |
| 339 | /* parse Area-ID */ |
| 340 | if (inet_pton (AF_INET, argv[1], &area_id) != 1) |
| 341 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 342 | vty_out (vty, "Invalid Area-ID: %s%s", argv[1], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 343 | return CMD_SUCCESS; |
| 344 | } |
| 345 | |
| 346 | /* find/create ospf6 area */ |
| 347 | oa = ospf6_area_lookup (area_id, o); |
| 348 | if (oa == NULL) |
| 349 | oa = ospf6_area_create (area_id, o); |
| 350 | |
| 351 | /* attach interface to area */ |
| 352 | listnode_add (oa->if_list, oi); /* sort ?? */ |
| 353 | oi->area = oa; |
| 354 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 355 | SET_FLAG (oa->flag, OSPF6_AREA_ENABLE); |
| 356 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 357 | /* start up */ |
| 358 | thread_add_event (master, interface_up, oi, 0); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 359 | |
hasso | 3b68735 | 2004-08-19 06:56:53 +0000 | [diff] [blame] | 360 | /* If the router is ABR, originate summary routes */ |
| 361 | if (ospf6_is_router_abr (o)) |
| 362 | ospf6_abr_enable_area (oa); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 363 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 364 | return CMD_SUCCESS; |
| 365 | } |
| 366 | |
| 367 | DEFUN (no_ospf6_interface_area, |
| 368 | no_ospf6_interface_area_cmd, |
| 369 | "no interface IFNAME area A.B.C.D", |
| 370 | NO_STR |
| 371 | "Disable routing on an IPv6 interface\n" |
| 372 | IFNAME_STR |
| 373 | "Specify the OSPF6 area ID\n" |
| 374 | "OSPF6 area ID in IPv4 address notation\n" |
| 375 | ) |
| 376 | { |
| 377 | struct ospf6 *o; |
| 378 | struct ospf6_interface *oi; |
hasso | 3b68735 | 2004-08-19 06:56:53 +0000 | [diff] [blame] | 379 | struct ospf6_area *oa; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 380 | struct interface *ifp; |
| 381 | u_int32_t area_id; |
| 382 | |
| 383 | o = (struct ospf6 *) vty->index; |
| 384 | |
| 385 | ifp = if_lookup_by_name (argv[0]); |
| 386 | if (ifp == NULL) |
| 387 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 388 | vty_out (vty, "No such interface %s%s", argv[0], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 389 | return CMD_SUCCESS; |
| 390 | } |
| 391 | |
| 392 | oi = (struct ospf6_interface *) ifp->info; |
| 393 | if (oi == NULL) |
| 394 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 395 | vty_out (vty, "Interface %s not enabled%s", ifp->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 396 | return CMD_SUCCESS; |
| 397 | } |
| 398 | |
| 399 | /* parse Area-ID */ |
| 400 | if (inet_pton (AF_INET, argv[1], &area_id) != 1) |
| 401 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 402 | vty_out (vty, "Invalid Area-ID: %s%s", argv[1], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 403 | return CMD_SUCCESS; |
| 404 | } |
| 405 | |
Jon | 56abbb8 | 2009-02-11 17:30:44 -0800 | [diff] [blame] | 406 | /* Verify Area */ |
| 407 | if (oi->area == NULL) |
| 408 | { |
| 409 | vty_out (vty, "No such Area-ID: %s%s", argv[1], VNL); |
| 410 | return CMD_SUCCESS; |
| 411 | } |
| 412 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 413 | if (oi->area->area_id != area_id) |
| 414 | { |
| 415 | vty_out (vty, "Wrong Area-ID: %s is attached to area %s%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 416 | oi->interface->name, oi->area->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 417 | return CMD_SUCCESS; |
| 418 | } |
| 419 | |
| 420 | thread_execute (master, interface_down, oi, 0); |
| 421 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 422 | oa = oi->area; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 423 | listnode_delete (oi->area->if_list, oi); |
| 424 | oi->area = (struct ospf6_area *) NULL; |
| 425 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 426 | /* Withdraw inter-area routes from this area, if necessary */ |
| 427 | if (oa->if_list->count == 0) |
| 428 | { |
| 429 | UNSET_FLAG (oa->flag, OSPF6_AREA_ENABLE); |
hasso | 3b68735 | 2004-08-19 06:56:53 +0000 | [diff] [blame] | 430 | ospf6_abr_disable_area (oa); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 431 | } |
| 432 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 433 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 434 | } |
| 435 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 436 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 437 | ospf6_show (struct vty *vty, struct ospf6 *o) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 438 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 439 | struct listnode *n; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 440 | struct ospf6_area *oa; |
| 441 | char router_id[16], duration[32]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 442 | struct timeval now, running; |
| 443 | |
| 444 | /* process id, router id */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 445 | inet_ntop (AF_INET, &o->router_id, router_id, sizeof (router_id)); |
| 446 | vty_out (vty, " OSPFv3 Routing Process (0) with Router-ID %s%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 447 | router_id, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 448 | |
| 449 | /* running time */ |
Takashi Sogabe | 86f72dc | 2009-06-22 13:07:02 +0900 | [diff] [blame^] | 450 | quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 451 | timersub (&now, &o->starttime, &running); |
| 452 | timerstring (&running, duration, sizeof (duration)); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 453 | vty_out (vty, " Running %s%s", duration, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 454 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 455 | /* Redistribute configuration */ |
| 456 | /* XXX */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 457 | |
| 458 | /* LSAs */ |
| 459 | vty_out (vty, " Number of AS scoped LSAs is %u%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 460 | o->lsdb->count, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 461 | |
| 462 | /* Areas */ |
| 463 | vty_out (vty, " Number of areas in this router is %u%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 464 | listcount (o->area_list), VNL); |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 465 | |
| 466 | for (ALL_LIST_ELEMENTS_RO (o->area_list, n, oa)) |
| 467 | ospf6_area_show (vty, oa); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 468 | } |
| 469 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 470 | /* show top level structures */ |
| 471 | DEFUN (show_ipv6_ospf6, |
| 472 | show_ipv6_ospf6_cmd, |
| 473 | "show ipv6 ospf6", |
| 474 | SHOW_STR |
| 475 | IP6_STR |
| 476 | OSPF6_STR) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 477 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 478 | OSPF6_CMD_CHECK_RUNNING (); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 479 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 480 | ospf6_show (vty, ospf6); |
| 481 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 482 | } |
| 483 | |
| 484 | DEFUN (show_ipv6_ospf6_route, |
| 485 | show_ipv6_ospf6_route_cmd, |
| 486 | "show ipv6 ospf6 route", |
| 487 | SHOW_STR |
| 488 | IP6_STR |
| 489 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 490 | ROUTE_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 491 | ) |
| 492 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 493 | ospf6_route_table_show (vty, argc, argv, ospf6->route_table); |
| 494 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 495 | } |
| 496 | |
| 497 | ALIAS (show_ipv6_ospf6_route, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 498 | show_ipv6_ospf6_route_detail_cmd, |
hasso | 4846ef6 | 2004-09-03 06:04:00 +0000 | [diff] [blame] | 499 | "show ipv6 ospf6 route (X:X::X:X|X:X::X:X/M|detail|summary)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 500 | SHOW_STR |
| 501 | IP6_STR |
| 502 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 503 | ROUTE_STR |
| 504 | "Specify IPv6 address\n" |
| 505 | "Specify IPv6 prefix\n" |
| 506 | "Detailed information\n" |
| 507 | "Summary of route table\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 508 | ) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 509 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 510 | DEFUN (show_ipv6_ospf6_route_match, |
| 511 | show_ipv6_ospf6_route_match_cmd, |
hasso | 4846ef6 | 2004-09-03 06:04:00 +0000 | [diff] [blame] | 512 | "show ipv6 ospf6 route X:X::X:X/M match", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 513 | SHOW_STR |
| 514 | IP6_STR |
| 515 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 516 | ROUTE_STR |
| 517 | "Specify IPv6 prefix\n" |
| 518 | "Display routes which match the specified route\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 519 | ) |
| 520 | { |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 521 | const char *sargv[CMD_ARGC_MAX]; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 522 | int i, sargc; |
| 523 | |
| 524 | /* copy argv to sargv and then append "match" */ |
| 525 | for (i = 0; i < argc; i++) |
| 526 | sargv[i] = argv[i]; |
| 527 | sargc = argc; |
| 528 | sargv[sargc++] = "match"; |
| 529 | sargv[sargc] = NULL; |
| 530 | |
| 531 | ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table); |
| 532 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 533 | } |
| 534 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 535 | DEFUN (show_ipv6_ospf6_route_match_detail, |
| 536 | show_ipv6_ospf6_route_match_detail_cmd, |
hasso | 4846ef6 | 2004-09-03 06:04:00 +0000 | [diff] [blame] | 537 | "show ipv6 ospf6 route X:X::X:X/M match detail", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 538 | SHOW_STR |
| 539 | IP6_STR |
| 540 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 541 | ROUTE_STR |
| 542 | "Specify IPv6 prefix\n" |
| 543 | "Display routes which match the specified route\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 544 | "Detailed information\n" |
| 545 | ) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 546 | { |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 547 | const char *sargv[CMD_ARGC_MAX]; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 548 | int i, sargc; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 549 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 550 | /* copy argv to sargv and then append "match" and "detail" */ |
| 551 | for (i = 0; i < argc; i++) |
| 552 | sargv[i] = argv[i]; |
| 553 | sargc = argc; |
| 554 | sargv[sargc++] = "match"; |
| 555 | sargv[sargc++] = "detail"; |
| 556 | sargv[sargc] = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 557 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 558 | ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table); |
| 559 | return CMD_SUCCESS; |
| 560 | } |
| 561 | |
Paul Jakma | cb4b884 | 2006-05-15 10:39:30 +0000 | [diff] [blame] | 562 | ALIAS (show_ipv6_ospf6_route_match, |
| 563 | show_ipv6_ospf6_route_longer_cmd, |
| 564 | "show ipv6 ospf6 route X:X::X:X/M longer", |
| 565 | SHOW_STR |
| 566 | IP6_STR |
| 567 | OSPF6_STR |
| 568 | ROUTE_STR |
| 569 | "Specify IPv6 prefix\n" |
| 570 | "Display routes longer than the specified route\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 571 | ) |
Paul Jakma | cb4b884 | 2006-05-15 10:39:30 +0000 | [diff] [blame] | 572 | |
| 573 | DEFUN (show_ipv6_ospf6_route_match_detail, |
| 574 | show_ipv6_ospf6_route_longer_detail_cmd, |
| 575 | "show ipv6 ospf6 route X:X::X:X/M longer detail", |
| 576 | SHOW_STR |
| 577 | IP6_STR |
| 578 | OSPF6_STR |
| 579 | ROUTE_STR |
| 580 | "Specify IPv6 prefix\n" |
| 581 | "Display routes longer than the specified route\n" |
| 582 | "Detailed information\n" |
| 583 | ); |
| 584 | |
hasso | 4846ef6 | 2004-09-03 06:04:00 +0000 | [diff] [blame] | 585 | ALIAS (show_ipv6_ospf6_route, |
| 586 | show_ipv6_ospf6_route_type_cmd, |
| 587 | "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2)", |
| 588 | SHOW_STR |
| 589 | IP6_STR |
| 590 | OSPF6_STR |
| 591 | ROUTE_STR |
| 592 | "Dispaly Intra-Area routes\n" |
| 593 | "Dispaly Inter-Area routes\n" |
| 594 | "Dispaly Type-1 External routes\n" |
| 595 | "Dispaly Type-2 External routes\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 596 | ) |
hasso | 4846ef6 | 2004-09-03 06:04:00 +0000 | [diff] [blame] | 597 | |
| 598 | DEFUN (show_ipv6_ospf6_route_type_detail, |
| 599 | show_ipv6_ospf6_route_type_detail_cmd, |
| 600 | "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2) detail", |
| 601 | SHOW_STR |
| 602 | IP6_STR |
| 603 | OSPF6_STR |
| 604 | ROUTE_STR |
| 605 | "Dispaly Intra-Area routes\n" |
| 606 | "Dispaly Inter-Area routes\n" |
| 607 | "Dispaly Type-1 External routes\n" |
| 608 | "Dispaly Type-2 External routes\n" |
| 609 | "Detailed information\n" |
| 610 | ) |
| 611 | { |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 612 | const char *sargv[CMD_ARGC_MAX]; |
hasso | 4846ef6 | 2004-09-03 06:04:00 +0000 | [diff] [blame] | 613 | int i, sargc; |
| 614 | |
| 615 | /* copy argv to sargv and then append "detail" */ |
| 616 | for (i = 0; i < argc; i++) |
| 617 | sargv[i] = argv[i]; |
| 618 | sargc = argc; |
| 619 | sargv[sargc++] = "detail"; |
| 620 | sargv[sargc] = NULL; |
| 621 | |
| 622 | ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table); |
| 623 | return CMD_SUCCESS; |
| 624 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 625 | |
| 626 | /* OSPF configuration write function. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 627 | static int |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 628 | config_write_ospf6 (struct vty *vty) |
| 629 | { |
| 630 | char router_id[16]; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 631 | struct listnode *j, *k; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 632 | struct ospf6_area *oa; |
| 633 | struct ospf6_interface *oi; |
| 634 | |
| 635 | /* OSPFv6 configuration. */ |
| 636 | if (ospf6 == NULL) |
| 637 | return CMD_SUCCESS; |
| 638 | if (CHECK_FLAG (ospf6->flag, OSPF6_DISABLED)) |
| 639 | return CMD_SUCCESS; |
| 640 | |
hasso | c8a440e | 2004-10-11 17:02:40 +0000 | [diff] [blame] | 641 | inet_ntop (AF_INET, &ospf6->router_id_static, router_id, sizeof (router_id)); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 642 | vty_out (vty, "router ospf6%s", VNL); |
hasso | c8a440e | 2004-10-11 17:02:40 +0000 | [diff] [blame] | 643 | if (ospf6->router_id_static != 0) |
| 644 | vty_out (vty, " router-id %s%s", router_id, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 645 | |
| 646 | ospf6_redistribute_config_write (vty); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 647 | ospf6_area_config_write (vty); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 648 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 649 | for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, j, oa)) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 650 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 651 | for (ALL_LIST_ELEMENTS_RO (oa->if_list, k, oi)) |
| 652 | vty_out (vty, " interface %s area %s%s", |
| 653 | oi->interface->name, oa->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 654 | } |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 655 | vty_out (vty, "!%s", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 656 | return 0; |
| 657 | } |
| 658 | |
| 659 | /* OSPF6 node structure. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 660 | static struct cmd_node ospf6_node = |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 661 | { |
| 662 | OSPF6_NODE, |
| 663 | "%s(config-ospf6)# ", |
hasso | 69b4a81 | 2004-08-26 18:10:36 +0000 | [diff] [blame] | 664 | 1 /* VTYSH */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 665 | }; |
| 666 | |
| 667 | /* Install ospf related commands. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 668 | void |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 669 | ospf6_top_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 670 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 671 | /* Install ospf6 top node. */ |
| 672 | install_node (&ospf6_node, config_write_ospf6); |
| 673 | |
| 674 | install_element (VIEW_NODE, &show_ipv6_ospf6_cmd); |
| 675 | install_element (ENABLE_NODE, &show_ipv6_ospf6_cmd); |
| 676 | install_element (CONFIG_NODE, &router_ospf6_cmd); |
Jon | 6c19d26 | 2009-02-11 17:19:07 -0800 | [diff] [blame] | 677 | install_element (CONFIG_NODE, &no_router_ospf6_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 678 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 679 | install_element (VIEW_NODE, &show_ipv6_ospf6_route_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 680 | install_element (VIEW_NODE, &show_ipv6_ospf6_route_detail_cmd); |
| 681 | install_element (VIEW_NODE, &show_ipv6_ospf6_route_match_cmd); |
| 682 | install_element (VIEW_NODE, &show_ipv6_ospf6_route_match_detail_cmd); |
Paul Jakma | cb4b884 | 2006-05-15 10:39:30 +0000 | [diff] [blame] | 683 | install_element (VIEW_NODE, &show_ipv6_ospf6_route_longer_cmd); |
| 684 | install_element (VIEW_NODE, &show_ipv6_ospf6_route_longer_detail_cmd); |
hasso | 4846ef6 | 2004-09-03 06:04:00 +0000 | [diff] [blame] | 685 | install_element (VIEW_NODE, &show_ipv6_ospf6_route_type_cmd); |
| 686 | install_element (VIEW_NODE, &show_ipv6_ospf6_route_type_detail_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 687 | install_element (ENABLE_NODE, &show_ipv6_ospf6_route_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 688 | install_element (ENABLE_NODE, &show_ipv6_ospf6_route_detail_cmd); |
| 689 | install_element (ENABLE_NODE, &show_ipv6_ospf6_route_match_cmd); |
| 690 | install_element (ENABLE_NODE, &show_ipv6_ospf6_route_match_detail_cmd); |
Paul Jakma | cb4b884 | 2006-05-15 10:39:30 +0000 | [diff] [blame] | 691 | install_element (ENABLE_NODE, &show_ipv6_ospf6_route_longer_cmd); |
| 692 | install_element (ENABLE_NODE, &show_ipv6_ospf6_route_longer_detail_cmd); |
hasso | 4846ef6 | 2004-09-03 06:04:00 +0000 | [diff] [blame] | 693 | install_element (ENABLE_NODE, &show_ipv6_ospf6_route_type_cmd); |
| 694 | install_element (ENABLE_NODE, &show_ipv6_ospf6_route_type_detail_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 695 | |
| 696 | install_default (OSPF6_NODE); |
| 697 | install_element (OSPF6_NODE, &ospf6_router_id_cmd); |
| 698 | install_element (OSPF6_NODE, &ospf6_interface_area_cmd); |
| 699 | install_element (OSPF6_NODE, &no_ospf6_interface_area_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 700 | } |
| 701 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 702 | |