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