jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * IS-IS Rout(e)ing protocol - isisd.c |
| 3 | * |
| 4 | * Copyright (C) 2001,2002 Sampo Saaristo |
| 5 | * Tampere University of Technology |
| 6 | * Institute of Communications Engineering |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public Licenseas published by the Free |
| 10 | * Software Foundation; either version 2 of the License, or (at your option) |
| 11 | * any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful,but WITHOUT |
| 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 16 | * more details. |
| 17 | |
| 18 | * You should have received a copy of the GNU General Public License along |
| 19 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 21 | */ |
| 22 | |
| 23 | #include <string.h> |
| 24 | #include <zebra.h> |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 25 | |
| 26 | #include "thread.h" |
| 27 | #include "vty.h" |
| 28 | #include "command.h" |
| 29 | #include "log.h" |
| 30 | #include "memory.h" |
| 31 | #include "linklist.h" |
| 32 | #include "if.h" |
| 33 | #include "hash.h" |
| 34 | #include "stream.h" |
| 35 | #include "prefix.h" |
| 36 | #include "table.h" |
| 37 | |
| 38 | #include "isisd/dict.h" |
| 39 | #include "isisd/include-netbsd/iso.h" |
| 40 | #include "isisd/isis_constants.h" |
| 41 | #include "isisd/isis_common.h" |
| 42 | #include "isisd/isis_circuit.h" |
| 43 | #include "isisd/isis_flags.h" |
| 44 | #include "isisd/isisd.h" |
| 45 | #include "isisd/isis_dynhn.h" |
| 46 | #include "isisd/isis_adjacency.h" |
| 47 | #include "isisd/isis_pdu.h" |
| 48 | #include "isisd/isis_misc.h" |
| 49 | #include "isisd/isis_constants.h" |
| 50 | #include "isisd/isis_tlv.h" |
| 51 | #include "isisd/isis_lsp.h" |
| 52 | #include "isisd/isis_spf.h" |
| 53 | #include "isisd/isis_route.h" |
| 54 | #include "isisd/isis_zebra.h" |
| 55 | #include "isisd/isis_events.h" |
| 56 | |
| 57 | #ifdef TOPOLOGY_GENERATE |
| 58 | #include "spgrid.h" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 59 | u_char DEFAULT_TOPOLOGY_BASEIS[6] = { 0xFE, 0xED, 0xFE, 0xED, 0x00, 0x00 }; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 60 | #endif /* TOPOLOGY_GENERATE */ |
| 61 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 62 | struct isis *isis = NULL; |
hasso | 73d1aea | 2004-09-24 10:45:28 +0000 | [diff] [blame] | 63 | extern struct thread_master *master; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 64 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 65 | void |
| 66 | isis_new (unsigned long process_id) |
| 67 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 68 | isis = XMALLOC (MTYPE_ISIS, sizeof (struct isis)); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 69 | bzero (isis, sizeof (struct isis)); |
| 70 | /* |
| 71 | * Default values |
| 72 | */ |
| 73 | isis->max_area_addrs = 3; |
| 74 | |
| 75 | isis->process_id = process_id; |
| 76 | isis->area_list = list_new (); |
| 77 | isis->init_circ_list = list_new (); |
| 78 | isis->uptime = time (NULL); |
| 79 | isis->nexthops = list_new (); |
| 80 | #ifdef HAVE_IPV6 |
| 81 | isis->nexthops6 = list_new (); |
| 82 | #endif /* HAVE_IPV6 */ |
| 83 | /* |
| 84 | * uncomment the next line for full debugs |
| 85 | */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 86 | /* isis->debugs = 0xFFFF; */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | struct isis_area * |
| 90 | isis_area_create () |
| 91 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 92 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 93 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 94 | area = XMALLOC (MTYPE_ISIS_AREA, sizeof (struct isis_area)); |
| 95 | memset (area, 0, sizeof (struct isis_area)); |
| 96 | |
| 97 | /* |
| 98 | * The first instance is level-1-2 rest are level-1, unless otherwise |
| 99 | * configured |
| 100 | */ |
| 101 | if (listcount (isis->area_list) > 0) |
| 102 | area->is_type = IS_LEVEL_1; |
| 103 | else |
| 104 | area->is_type = IS_LEVEL_1_AND_2; |
| 105 | /* |
| 106 | * intialize the databases |
| 107 | */ |
| 108 | area->lspdb[0] = lsp_db_init (); |
| 109 | area->lspdb[1] = lsp_db_init (); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 110 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 111 | spftree_area_init (area); |
| 112 | area->route_table = route_table_init (); |
| 113 | #ifdef HAVE_IPV6 |
| 114 | area->route_table6 = route_table_init (); |
| 115 | #endif /* HAVE_IPV6 */ |
| 116 | area->circuit_list = list_new (); |
| 117 | area->area_addrs = list_new (); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 118 | THREAD_TIMER_ON (master, area->t_tick, lsp_tick, area, 1); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 119 | area->flags.maxindex = -1; |
| 120 | /* |
| 121 | * Default values |
| 122 | */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 123 | area->max_lsp_lifetime[0] = MAX_AGE; /* 1200 */ |
| 124 | area->max_lsp_lifetime[1] = MAX_AGE; /* 1200 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 125 | area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT; |
| 126 | area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 127 | area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900 */ |
| 128 | area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 129 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; |
| 130 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; |
| 131 | area->dynhostname = 1; |
| 132 | area->lsp_frag_threshold = 90; |
| 133 | #ifdef TOPOLOGY_GENERATE |
| 134 | memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN); |
| 135 | #endif /* TOPOLOGY_GENERATE */ |
| 136 | |
| 137 | /* FIXME: Think of a better way... */ |
| 138 | area->min_bcast_mtu = 1497; |
| 139 | |
| 140 | return area; |
| 141 | } |
| 142 | |
| 143 | struct isis_area * |
hasso | f90a5f6 | 2004-10-11 13:11:56 +0000 | [diff] [blame] | 144 | isis_area_lookup (const char *area_tag) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 145 | { |
| 146 | struct isis_area *area; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 147 | struct listnode *node, *nnode; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 148 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 149 | for (ALL_LIST_ELEMENTS (isis->area_list, node, nnode, area)) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 150 | if ((area->area_tag == NULL && area_tag == NULL) || |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 151 | (area->area_tag && area_tag |
| 152 | && strcmp (area->area_tag, area_tag) == 0)) |
| 153 | return area; |
| 154 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 155 | return NULL; |
| 156 | } |
| 157 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 158 | int |
hasso | f90a5f6 | 2004-10-11 13:11:56 +0000 | [diff] [blame] | 159 | isis_area_get (struct vty *vty, const char *area_tag) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 160 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 161 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 162 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 163 | area = isis_area_lookup (area_tag); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 164 | |
| 165 | if (area) |
| 166 | { |
| 167 | vty->node = ISIS_NODE; |
| 168 | vty->index = area; |
| 169 | return CMD_SUCCESS; |
| 170 | } |
| 171 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 172 | area = isis_area_create (); |
| 173 | area->area_tag = strdup (area_tag); |
| 174 | listnode_add (isis->area_list, area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 175 | |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 176 | zlog_debug ("new IS-IS area instance %s", area->area_tag); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 177 | |
| 178 | vty->node = ISIS_NODE; |
| 179 | vty->index = area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 180 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 181 | return CMD_SUCCESS; |
| 182 | } |
| 183 | |
| 184 | int |
hasso | f90a5f6 | 2004-10-11 13:11:56 +0000 | [diff] [blame] | 185 | isis_area_destroy (struct vty *vty, const char *area_tag) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 186 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 187 | struct isis_area *area; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 188 | struct listnode *node, *nnode; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 189 | struct isis_circuit *circuit; |
| 190 | |
| 191 | area = isis_area_lookup (area_tag); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 192 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 193 | if (area == NULL) |
| 194 | { |
| 195 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 196 | return CMD_WARNING; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 197 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 198 | |
| 199 | if (area->circuit_list) |
| 200 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 201 | for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit)) |
| 202 | isis_circuit_del (circuit); |
| 203 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 204 | list_delete (area->circuit_list); |
| 205 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 206 | listnode_delete (isis->area_list, area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 207 | THREAD_TIMER_OFF (area->t_tick); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 208 | if (area->t_remove_aged) |
| 209 | thread_cancel (area->t_remove_aged); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 210 | THREAD_TIMER_OFF (area->t_lsp_refresh[0]); |
| 211 | THREAD_TIMER_OFF (area->t_lsp_refresh[1]); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 212 | |
| 213 | XFREE (MTYPE_ISIS_AREA, area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 214 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 215 | return CMD_SUCCESS; |
| 216 | } |
| 217 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 218 | int |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 219 | area_net_title (struct vty *vty, u_char *net_title) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 220 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 221 | struct isis_area *area; |
| 222 | struct area_addr *addr; |
| 223 | struct area_addr *addrp; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 224 | struct listnode *node, *nnode; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 225 | |
| 226 | u_char buff[255]; |
| 227 | area = vty->index; |
| 228 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 229 | if (!area) |
| 230 | { |
| 231 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 232 | return CMD_WARNING; |
| 233 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 234 | |
| 235 | /* We check that we are not over the maximal number of addresses */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 236 | if (listcount (area->area_addrs) >= isis->max_area_addrs) |
| 237 | { |
| 238 | vty_out (vty, "Maximum of area addresses (%d) already reached %s", |
| 239 | isis->max_area_addrs, VTY_NEWLINE); |
| 240 | return CMD_WARNING; |
| 241 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 242 | |
| 243 | addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr)); |
| 244 | addr->addr_len = dotformat2buff (buff, net_title); |
| 245 | memcpy (addr->area_addr, buff, addr->addr_len); |
| 246 | #ifdef EXTREME_DEBUG |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 247 | zlog_debug ("added area address %s for area %s (address length %d)", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 248 | net_title, area->area_tag, addr->addr_len); |
| 249 | #endif /* EXTREME_DEBUG */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 250 | if (addr->addr_len < 8 || addr->addr_len > 20) |
| 251 | { |
| 252 | zlog_warn ("area address must be at least 8..20 octets long (%d)", |
| 253 | addr->addr_len); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 254 | XFREE (MTYPE_ISIS_AREA_ADDR, addr); |
| 255 | return CMD_WARNING; |
| 256 | } |
| 257 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 258 | if (isis->sysid_set == 0) |
| 259 | { |
| 260 | /* |
| 261 | * First area address - get the SystemID for this router |
| 262 | */ |
| 263 | memcpy (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN), ISIS_SYS_ID_LEN); |
| 264 | isis->sysid_set = 1; |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 265 | zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid)); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 266 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 267 | else |
| 268 | { |
| 269 | /* |
| 270 | * Check that the SystemID portions match |
| 271 | */ |
| 272 | if (memcmp (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN), |
| 273 | ISIS_SYS_ID_LEN)) |
| 274 | { |
| 275 | vty_out (vty, |
| 276 | "System ID must not change when defining additional area" |
| 277 | " addresses%s", VTY_NEWLINE); |
| 278 | XFREE (MTYPE_ISIS_AREA_ADDR, addr); |
| 279 | return CMD_WARNING; |
| 280 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 281 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 282 | /* now we see that we don't already have this address */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 283 | for (ALL_LIST_ELEMENTS (area->area_addrs, node, nnode, addrp)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 284 | { |
| 285 | if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == (addr->addr_len)) |
| 286 | { |
| 287 | if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len)) |
| 288 | { |
| 289 | XFREE (MTYPE_ISIS_AREA_ADDR, addr); |
| 290 | return CMD_SUCCESS; /* silent fail */ |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 296 | /* |
| 297 | * Forget the systemID part of the address |
| 298 | */ |
| 299 | addr->addr_len -= (ISIS_SYS_ID_LEN + 1); |
| 300 | listnode_add (area->area_addrs, addr); |
| 301 | |
| 302 | /* only now we can safely generate our LSPs for this area */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 303 | if (listcount (area->area_addrs) > 0) |
| 304 | { |
| 305 | lsp_l1_generate (area); |
| 306 | lsp_l2_generate (area); |
| 307 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 308 | |
| 309 | return CMD_SUCCESS; |
| 310 | } |
| 311 | |
| 312 | int |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 313 | area_clear_net_title (struct vty *vty, u_char *net_title) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 314 | { |
| 315 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 316 | struct area_addr addr, *addrp = NULL; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 317 | struct listnode *node, *nnode; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 318 | u_char buff[255]; |
| 319 | |
| 320 | area = vty->index; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 321 | if (!area) |
| 322 | { |
| 323 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 324 | return CMD_WARNING; |
| 325 | } |
| 326 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 327 | addr.addr_len = dotformat2buff (buff, net_title); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 328 | if (addr.addr_len < 8 || addr.addr_len > 20) |
| 329 | { |
| 330 | vty_out (vty, "Unsupported area address length %d, should be 8...20 %s", |
| 331 | addr.addr_len, VTY_NEWLINE); |
| 332 | return CMD_WARNING; |
| 333 | } |
| 334 | |
| 335 | memcpy (addr.area_addr, buff, (int) addr.addr_len); |
| 336 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 337 | for (ALL_LIST_ELEMENTS (area->area_addrs, node, nnode, addrp)) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 338 | if (addrp->addr_len == addr.addr_len && |
| 339 | !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 340 | break; |
| 341 | |
| 342 | if (!addrp) |
| 343 | { |
| 344 | vty_out (vty, "No area address %s for area %s %s", net_title, |
| 345 | area->area_tag, VTY_NEWLINE); |
| 346 | return CMD_WARNING; |
| 347 | } |
| 348 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 349 | listnode_delete (area->area_addrs, addrp); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 350 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 351 | return CMD_SUCCESS; |
| 352 | } |
| 353 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 354 | /* |
| 355 | * 'show clns neighbors' command |
| 356 | */ |
| 357 | |
| 358 | int |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 359 | show_clns_neigh (struct vty *vty, char detail) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 360 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 361 | struct listnode *anode, *annode, *cnode, *cnnode; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 362 | struct isis_area *area; |
| 363 | struct isis_circuit *circuit; |
| 364 | struct list *db; |
| 365 | int i; |
| 366 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 367 | if (!isis) |
| 368 | { |
| 369 | vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE); |
| 370 | return CMD_SUCCESS; |
| 371 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 372 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 373 | for (ALL_LIST_ELEMENTS (isis->area_list, anode, annode, area)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 374 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 375 | vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 376 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 377 | if (detail == ISIS_UI_LEVEL_BRIEF) |
| 378 | vty_out (vty, " System Id Interface L State " |
| 379 | "Holdtime SNPA%s", VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 380 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 381 | for (ALL_LIST_ELEMENTS (area->circuit_list, cnode, cnnode, circuit)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 382 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 383 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 384 | { |
| 385 | for (i = 0; i < 2; i++) |
| 386 | { |
| 387 | db = circuit->u.bc.adjdb[i]; |
| 388 | if (db && db->count) |
| 389 | { |
| 390 | if (detail == ISIS_UI_LEVEL_BRIEF) |
| 391 | isis_adjdb_iterate (db, |
| 392 | (void (*) |
| 393 | (struct isis_adjacency *, |
| 394 | void *)) isis_adj_print_vty, |
| 395 | vty); |
| 396 | if (detail == ISIS_UI_LEVEL_DETAIL) |
| 397 | isis_adjdb_iterate (db, |
| 398 | (void (*) |
| 399 | (struct isis_adjacency *, |
| 400 | void *)) |
| 401 | isis_adj_print_vty_detail, vty); |
| 402 | if (detail == ISIS_UI_LEVEL_EXTENSIVE) |
| 403 | isis_adjdb_iterate (db, |
| 404 | (void (*) |
| 405 | (struct isis_adjacency *, |
| 406 | void *)) |
| 407 | isis_adj_print_vty_extensive, |
| 408 | vty); |
| 409 | } |
| 410 | } |
| 411 | } |
| 412 | else if (circuit->circ_type == CIRCUIT_T_P2P && |
| 413 | circuit->u.p2p.neighbor) |
| 414 | { |
| 415 | if (detail == ISIS_UI_LEVEL_BRIEF) |
| 416 | isis_adj_p2p_print_vty (circuit->u.p2p.neighbor, vty); |
| 417 | if (detail == ISIS_UI_LEVEL_DETAIL) |
| 418 | isis_adj_p2p_print_vty_detail (circuit->u.p2p.neighbor, vty); |
| 419 | if (detail == ISIS_UI_LEVEL_EXTENSIVE) |
| 420 | isis_adj_p2p_print_vty_extensive (circuit->u.p2p.neighbor, |
| 421 | vty); |
| 422 | } |
| 423 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 424 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 425 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 426 | return CMD_SUCCESS; |
| 427 | } |
| 428 | |
| 429 | DEFUN (show_clns_neighbors, |
| 430 | show_clns_neighbors_cmd, |
| 431 | "show clns neighbors", |
| 432 | SHOW_STR |
| 433 | "clns network information\n" |
| 434 | "CLNS neighbor adjacencies\n") |
| 435 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 436 | return show_clns_neigh (vty, ISIS_UI_LEVEL_BRIEF); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 437 | } |
| 438 | |
| 439 | ALIAS (show_clns_neighbors, |
| 440 | show_isis_neighbors_cmd, |
| 441 | "show isis neighbors", |
| 442 | SHOW_STR |
| 443 | "IS-IS network information\n" |
| 444 | "IS-IS neighbor adjacencies\n") |
| 445 | |
| 446 | DEFUN (show_clns_neighbors_detail, |
| 447 | show_clns_neighbors_detail_cmd, |
| 448 | "show clns neighbors detail", |
| 449 | SHOW_STR |
| 450 | "clns network information\n" |
| 451 | "CLNS neighbor adjacencies\n" |
| 452 | "show detailed information\n") |
| 453 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 454 | return show_clns_neigh (vty, ISIS_UI_LEVEL_DETAIL); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 455 | } |
| 456 | |
| 457 | ALIAS (show_clns_neighbors_detail, |
| 458 | show_isis_neighbors_detail_cmd, |
| 459 | "show isis neighbors detail", |
| 460 | SHOW_STR |
| 461 | "IS-IS network information\n" |
| 462 | "IS-IS neighbor adjacencies\n" |
| 463 | "show detailed information\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 464 | /* |
| 465 | * 'isis debug', 'show debugging' |
| 466 | */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 467 | void |
| 468 | print_debug (struct vty *vty, int flags, int onoff) |
| 469 | { |
| 470 | char onoffs[4]; |
| 471 | if (onoff) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 472 | strcpy (onoffs, "on"); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 473 | else |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 474 | strcpy (onoffs, "off"); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 475 | |
| 476 | if (flags & DEBUG_ADJ_PACKETS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 477 | vty_out (vty, "IS-IS Adjacency related packets debugging is %s%s", onoffs, |
| 478 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 479 | if (flags & DEBUG_CHECKSUM_ERRORS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 480 | vty_out (vty, "IS-IS checksum errors debugging is %s%s", onoffs, |
| 481 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 482 | if (flags & DEBUG_LOCAL_UPDATES) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 483 | vty_out (vty, "IS-IS local updates debugging is %s%s", onoffs, |
| 484 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 485 | if (flags & DEBUG_PROTOCOL_ERRORS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 486 | vty_out (vty, "IS-IS protocol errors debugging is %s%s", onoffs, |
| 487 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 488 | if (flags & DEBUG_SNP_PACKETS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 489 | vty_out (vty, "IS-IS CSNP/PSNP packets debugging is %s%s", onoffs, |
| 490 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 491 | if (flags & DEBUG_SPF_EVENTS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 492 | vty_out (vty, "IS-IS SPF events debugging is %s%s", onoffs, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 493 | if (flags & DEBUG_SPF_STATS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 494 | vty_out (vty, "IS-IS SPF Timing and Statistics Data debugging is %s%s", |
| 495 | onoffs, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 496 | if (flags & DEBUG_SPF_TRIGGERS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 497 | vty_out (vty, "IS-IS SPF triggering events debugging is %s%s", onoffs, |
| 498 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 499 | if (flags & DEBUG_UPDATE_PACKETS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 500 | vty_out (vty, "IS-IS Update related packet debugging is %s%s", onoffs, |
| 501 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 502 | if (flags & DEBUG_RTE_EVENTS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 503 | vty_out (vty, "IS-IS Route related debuggin is %s%s", onoffs, |
| 504 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 505 | if (flags & DEBUG_EVENTS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 506 | vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 507 | |
| 508 | } |
| 509 | |
| 510 | DEFUN (show_debugging, |
| 511 | show_debugging_cmd, |
| 512 | "show debugging", |
| 513 | SHOW_STR |
| 514 | "State of each debugging option\n") |
| 515 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 516 | vty_out (vty, "IS-IS:%s", VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 517 | print_debug (vty, isis->debugs, 1); |
| 518 | return CMD_SUCCESS; |
| 519 | } |
| 520 | |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 521 | /* Debug node. */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 522 | static struct cmd_node debug_node = { |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 523 | DEBUG_NODE, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 524 | "", |
| 525 | 1 |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 526 | }; |
| 527 | |
| 528 | static int |
| 529 | config_write_debug (struct vty *vty) |
| 530 | { |
| 531 | int write = 0; |
| 532 | int flags = isis->debugs; |
| 533 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 534 | if (flags & DEBUG_ADJ_PACKETS) |
| 535 | { |
| 536 | vty_out (vty, "debug isis adj-packets%s", VTY_NEWLINE); |
| 537 | write++; |
| 538 | } |
| 539 | if (flags & DEBUG_CHECKSUM_ERRORS) |
| 540 | { |
| 541 | vty_out (vty, "debug isis checksum-errors%s", VTY_NEWLINE); |
| 542 | write++; |
| 543 | } |
| 544 | if (flags & DEBUG_LOCAL_UPDATES) |
| 545 | { |
| 546 | vty_out (vty, "debug isis local-updates%s", VTY_NEWLINE); |
| 547 | write++; |
| 548 | } |
| 549 | if (flags & DEBUG_PROTOCOL_ERRORS) |
| 550 | { |
| 551 | vty_out (vty, "debug isis protocol-errors%s", VTY_NEWLINE); |
| 552 | write++; |
| 553 | } |
| 554 | if (flags & DEBUG_SNP_PACKETS) |
| 555 | { |
| 556 | vty_out (vty, "debug isis snp-packets%s", VTY_NEWLINE); |
| 557 | write++; |
| 558 | } |
| 559 | if (flags & DEBUG_SPF_EVENTS) |
| 560 | { |
| 561 | vty_out (vty, "debug isis spf-events%s", VTY_NEWLINE); |
| 562 | write++; |
| 563 | } |
| 564 | if (flags & DEBUG_SPF_STATS) |
| 565 | { |
| 566 | vty_out (vty, "debug isis spf-statistics%s", VTY_NEWLINE); |
| 567 | write++; |
| 568 | } |
| 569 | if (flags & DEBUG_SPF_TRIGGERS) |
| 570 | { |
| 571 | vty_out (vty, "debug isis spf-triggers%s", VTY_NEWLINE); |
| 572 | write++; |
| 573 | } |
| 574 | if (flags & DEBUG_UPDATE_PACKETS) |
| 575 | { |
| 576 | vty_out (vty, "debug isis update-packets%s", VTY_NEWLINE); |
| 577 | write++; |
| 578 | } |
| 579 | if (flags & DEBUG_RTE_EVENTS) |
| 580 | { |
| 581 | vty_out (vty, "debug isis route-events%s", VTY_NEWLINE); |
| 582 | write++; |
| 583 | } |
| 584 | if (flags & DEBUG_EVENTS) |
| 585 | { |
| 586 | vty_out (vty, "debug isis events%s", VTY_NEWLINE); |
| 587 | write++; |
| 588 | } |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 589 | |
| 590 | return write; |
| 591 | } |
| 592 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 593 | DEFUN (debug_isis_adj, |
| 594 | debug_isis_adj_cmd, |
| 595 | "debug isis adj-packets", |
| 596 | DEBUG_STR |
| 597 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 598 | "IS-IS Adjacency related packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 599 | { |
| 600 | isis->debugs |= DEBUG_ADJ_PACKETS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 601 | print_debug (vty, DEBUG_ADJ_PACKETS, 1); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 602 | |
| 603 | return CMD_SUCCESS; |
| 604 | } |
| 605 | |
| 606 | DEFUN (no_debug_isis_adj, |
| 607 | no_debug_isis_adj_cmd, |
| 608 | "no debug isis adj-packets", |
| 609 | UNDEBUG_STR |
| 610 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 611 | "IS-IS Adjacency related packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 612 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 613 | isis->debugs &= ~DEBUG_ADJ_PACKETS; |
| 614 | print_debug (vty, DEBUG_ADJ_PACKETS, 0); |
| 615 | |
| 616 | return CMD_SUCCESS; |
| 617 | } |
| 618 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 619 | DEFUN (debug_isis_csum, |
| 620 | debug_isis_csum_cmd, |
| 621 | "debug isis checksum-errors", |
| 622 | DEBUG_STR |
| 623 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 624 | "IS-IS LSP checksum errors\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 625 | { |
| 626 | isis->debugs |= DEBUG_CHECKSUM_ERRORS; |
| 627 | print_debug (vty, DEBUG_CHECKSUM_ERRORS, 1); |
| 628 | |
| 629 | return CMD_SUCCESS; |
| 630 | } |
| 631 | |
| 632 | DEFUN (no_debug_isis_csum, |
| 633 | no_debug_isis_csum_cmd, |
| 634 | "no debug isis checksum-errors", |
| 635 | UNDEBUG_STR |
| 636 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 637 | "IS-IS LSP checksum errors\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 638 | { |
| 639 | isis->debugs &= ~DEBUG_CHECKSUM_ERRORS; |
| 640 | print_debug (vty, DEBUG_CHECKSUM_ERRORS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 641 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 642 | return CMD_SUCCESS; |
| 643 | } |
| 644 | |
| 645 | DEFUN (debug_isis_lupd, |
| 646 | debug_isis_lupd_cmd, |
| 647 | "debug isis local-updates", |
| 648 | DEBUG_STR |
| 649 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 650 | "IS-IS local update packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 651 | { |
| 652 | isis->debugs |= DEBUG_LOCAL_UPDATES; |
| 653 | print_debug (vty, DEBUG_LOCAL_UPDATES, 1); |
| 654 | |
| 655 | return CMD_SUCCESS; |
| 656 | } |
| 657 | |
| 658 | DEFUN (no_debug_isis_lupd, |
| 659 | no_debug_isis_lupd_cmd, |
| 660 | "no debug isis local-updates", |
| 661 | UNDEBUG_STR |
| 662 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 663 | "IS-IS local update packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 664 | { |
| 665 | isis->debugs &= ~DEBUG_LOCAL_UPDATES; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 666 | print_debug (vty, DEBUG_LOCAL_UPDATES, 0); |
| 667 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 668 | return CMD_SUCCESS; |
| 669 | } |
| 670 | |
| 671 | DEFUN (debug_isis_err, |
| 672 | debug_isis_err_cmd, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 673 | "debug isis protocol-errors", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 674 | DEBUG_STR |
| 675 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 676 | "IS-IS LSP protocol errors\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 677 | { |
| 678 | isis->debugs |= DEBUG_PROTOCOL_ERRORS; |
| 679 | print_debug (vty, DEBUG_PROTOCOL_ERRORS, 1); |
| 680 | |
| 681 | return CMD_SUCCESS; |
| 682 | } |
| 683 | |
| 684 | DEFUN (no_debug_isis_err, |
| 685 | no_debug_isis_err_cmd, |
| 686 | "no debug isis protocol-errors", |
| 687 | UNDEBUG_STR |
| 688 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 689 | "IS-IS LSP protocol errors\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 690 | { |
| 691 | isis->debugs &= ~DEBUG_PROTOCOL_ERRORS; |
| 692 | print_debug (vty, DEBUG_PROTOCOL_ERRORS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 693 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 694 | return CMD_SUCCESS; |
| 695 | } |
| 696 | |
| 697 | DEFUN (debug_isis_snp, |
| 698 | debug_isis_snp_cmd, |
| 699 | "debug isis snp-packets", |
| 700 | DEBUG_STR |
| 701 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 702 | "IS-IS CSNP/PSNP packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 703 | { |
| 704 | isis->debugs |= DEBUG_SNP_PACKETS; |
| 705 | print_debug (vty, DEBUG_SNP_PACKETS, 1); |
| 706 | |
| 707 | return CMD_SUCCESS; |
| 708 | } |
| 709 | |
| 710 | DEFUN (no_debug_isis_snp, |
| 711 | no_debug_isis_snp_cmd, |
| 712 | "no debug isis snp-packets", |
| 713 | UNDEBUG_STR |
| 714 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 715 | "IS-IS CSNP/PSNP packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 716 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 717 | isis->debugs &= ~DEBUG_SNP_PACKETS; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 718 | print_debug (vty, DEBUG_SNP_PACKETS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 719 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 720 | return CMD_SUCCESS; |
| 721 | } |
| 722 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 723 | DEFUN (debug_isis_upd, |
| 724 | debug_isis_upd_cmd, |
| 725 | "debug isis update-packets", |
| 726 | DEBUG_STR |
| 727 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 728 | "IS-IS Update related packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 729 | { |
| 730 | isis->debugs |= DEBUG_UPDATE_PACKETS; |
| 731 | print_debug (vty, DEBUG_UPDATE_PACKETS, 1); |
| 732 | |
| 733 | return CMD_SUCCESS; |
| 734 | } |
| 735 | |
| 736 | DEFUN (no_debug_isis_upd, |
| 737 | no_debug_isis_upd_cmd, |
| 738 | "no debug isis update-packets", |
| 739 | UNDEBUG_STR |
| 740 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 741 | "IS-IS Update related packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 742 | { |
| 743 | isis->debugs &= ~DEBUG_UPDATE_PACKETS; |
| 744 | print_debug (vty, DEBUG_UPDATE_PACKETS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 745 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 746 | return CMD_SUCCESS; |
| 747 | } |
| 748 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 749 | DEFUN (debug_isis_spfevents, |
| 750 | debug_isis_spfevents_cmd, |
| 751 | "debug isis spf-events", |
| 752 | DEBUG_STR |
| 753 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 754 | "IS-IS Shortest Path First Events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 755 | { |
| 756 | isis->debugs |= DEBUG_SPF_EVENTS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 757 | print_debug (vty, DEBUG_SPF_EVENTS, 1); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 758 | |
| 759 | return CMD_SUCCESS; |
| 760 | } |
| 761 | |
| 762 | DEFUN (no_debug_isis_spfevents, |
| 763 | no_debug_isis_spfevents_cmd, |
| 764 | "no debug isis spf-events", |
| 765 | UNDEBUG_STR |
| 766 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 767 | "IS-IS Shortest Path First Events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 768 | { |
| 769 | isis->debugs &= ~DEBUG_SPF_EVENTS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 770 | print_debug (vty, DEBUG_SPF_EVENTS, 0); |
| 771 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 772 | return CMD_SUCCESS; |
| 773 | } |
| 774 | |
| 775 | |
| 776 | DEFUN (debug_isis_spfstats, |
| 777 | debug_isis_spfstats_cmd, |
| 778 | "debug isis spf-statistics ", |
| 779 | DEBUG_STR |
| 780 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 781 | "IS-IS SPF Timing and Statistic Data\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 782 | { |
| 783 | isis->debugs |= DEBUG_SPF_STATS; |
| 784 | print_debug (vty, DEBUG_SPF_STATS, 1); |
| 785 | |
| 786 | return CMD_SUCCESS; |
| 787 | } |
| 788 | |
| 789 | DEFUN (no_debug_isis_spfstats, |
| 790 | no_debug_isis_spfstats_cmd, |
| 791 | "no debug isis spf-statistics", |
| 792 | UNDEBUG_STR |
| 793 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 794 | "IS-IS SPF Timing and Statistic Data\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 795 | { |
| 796 | isis->debugs &= ~DEBUG_SPF_STATS; |
| 797 | print_debug (vty, DEBUG_SPF_STATS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 798 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 799 | return CMD_SUCCESS; |
| 800 | } |
| 801 | |
| 802 | DEFUN (debug_isis_spftrigg, |
| 803 | debug_isis_spftrigg_cmd, |
| 804 | "debug isis spf-triggers", |
| 805 | DEBUG_STR |
| 806 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 807 | "IS-IS SPF triggering events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 808 | { |
| 809 | isis->debugs |= DEBUG_SPF_TRIGGERS; |
| 810 | print_debug (vty, DEBUG_SPF_TRIGGERS, 1); |
| 811 | |
| 812 | return CMD_SUCCESS; |
| 813 | } |
| 814 | |
| 815 | DEFUN (no_debug_isis_spftrigg, |
| 816 | no_debug_isis_spftrigg_cmd, |
| 817 | "no debug isis spf-triggers", |
| 818 | UNDEBUG_STR |
| 819 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 820 | "IS-IS SPF triggering events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 821 | { |
| 822 | isis->debugs &= ~DEBUG_SPF_TRIGGERS; |
| 823 | print_debug (vty, DEBUG_SPF_TRIGGERS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 824 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 825 | return CMD_SUCCESS; |
| 826 | } |
| 827 | |
| 828 | DEFUN (debug_isis_rtevents, |
| 829 | debug_isis_rtevents_cmd, |
| 830 | "debug isis route-events", |
| 831 | DEBUG_STR |
| 832 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 833 | "IS-IS Route related events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 834 | { |
| 835 | isis->debugs |= DEBUG_RTE_EVENTS; |
| 836 | print_debug (vty, DEBUG_RTE_EVENTS, 1); |
| 837 | |
| 838 | return CMD_SUCCESS; |
| 839 | } |
| 840 | |
| 841 | DEFUN (no_debug_isis_rtevents, |
| 842 | no_debug_isis_rtevents_cmd, |
| 843 | "no debug isis route-events", |
| 844 | UNDEBUG_STR |
| 845 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 846 | "IS-IS Route related events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 847 | { |
| 848 | isis->debugs &= ~DEBUG_RTE_EVENTS; |
| 849 | print_debug (vty, DEBUG_RTE_EVENTS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 850 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 851 | return CMD_SUCCESS; |
| 852 | } |
| 853 | |
| 854 | DEFUN (debug_isis_events, |
| 855 | debug_isis_events_cmd, |
| 856 | "debug isis events", |
| 857 | DEBUG_STR |
| 858 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 859 | "IS-IS Events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 860 | { |
| 861 | isis->debugs |= DEBUG_EVENTS; |
| 862 | print_debug (vty, DEBUG_EVENTS, 1); |
| 863 | |
| 864 | return CMD_SUCCESS; |
| 865 | } |
| 866 | |
| 867 | DEFUN (no_debug_isis_events, |
| 868 | no_debug_isis_events_cmd, |
| 869 | "no debug isis events", |
| 870 | UNDEBUG_STR |
| 871 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 872 | "IS-IS Events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 873 | { |
| 874 | isis->debugs &= ~DEBUG_EVENTS; |
| 875 | print_debug (vty, DEBUG_EVENTS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 876 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 877 | return CMD_SUCCESS; |
| 878 | } |
| 879 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 880 | DEFUN (show_hostname, |
| 881 | show_hostname_cmd, |
| 882 | "show isis hostname", |
| 883 | SHOW_STR |
| 884 | "IS-IS information\n" |
| 885 | "IS-IS Dynamic hostname mapping\n") |
| 886 | { |
| 887 | dynhn_print_all (vty); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 888 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 889 | return CMD_SUCCESS; |
| 890 | } |
| 891 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 892 | DEFUN (show_database, |
| 893 | show_database_cmd, |
| 894 | "show isis database", |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 895 | SHOW_STR "IS-IS information\n" "IS-IS link state database\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 896 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 897 | struct listnode *node, *nnode; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 898 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 899 | int level, lsp_count; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 900 | |
| 901 | if (isis->area_list->count == 0) |
| 902 | return CMD_SUCCESS; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 903 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 904 | for (ALL_LIST_ELEMENTS (isis->area_list, node, nnode, area)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 905 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 906 | vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null", |
| 907 | VTY_NEWLINE); |
| 908 | for (level = 0; level < ISIS_LEVELS; level++) |
| 909 | { |
| 910 | if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0) |
| 911 | { |
| 912 | vty_out (vty, "IS-IS Level-%d link-state database:%s", |
| 913 | level + 1, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 914 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 915 | lsp_count = lsp_print_all (vty, area->lspdb[level], |
| 916 | ISIS_UI_LEVEL_BRIEF, |
| 917 | area->dynhostname); |
| 918 | |
| 919 | vty_out (vty, "%s %u LSPs%s%s", |
| 920 | VTY_NEWLINE, lsp_count, VTY_NEWLINE, VTY_NEWLINE); |
| 921 | } |
| 922 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 923 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 924 | |
| 925 | return CMD_SUCCESS; |
| 926 | } |
| 927 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 928 | DEFUN (show_database_detail, |
| 929 | show_database_detail_cmd, |
| 930 | "show isis database detail", |
| 931 | SHOW_STR |
| 932 | "IS-IS information\n" |
| 933 | "IS-IS link state database\n") |
| 934 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 935 | struct listnode *node, *nnode; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 936 | struct isis_area *area; |
| 937 | int level, lsp_count; |
| 938 | |
| 939 | if (isis->area_list->count == 0) |
| 940 | return CMD_SUCCESS; |
| 941 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 942 | for (ALL_LIST_ELEMENTS (isis->area_list, node, nnode, area)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 943 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 944 | vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null", |
| 945 | VTY_NEWLINE); |
| 946 | for (level = 0; level < ISIS_LEVELS; level++) |
| 947 | { |
| 948 | if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0) |
| 949 | { |
| 950 | vty_out (vty, "IS-IS Level-%d Link State Database:%s", |
| 951 | level + 1, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 952 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 953 | lsp_count = lsp_print_all (vty, area->lspdb[level], |
| 954 | ISIS_UI_LEVEL_DETAIL, |
| 955 | area->dynhostname); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 956 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 957 | vty_out (vty, "%s %u LSPs%s%s", |
| 958 | VTY_NEWLINE, lsp_count, VTY_NEWLINE, VTY_NEWLINE); |
| 959 | } |
| 960 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 961 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 962 | |
| 963 | return CMD_SUCCESS; |
| 964 | } |
| 965 | |
| 966 | /* |
| 967 | * 'router isis' command |
| 968 | */ |
| 969 | DEFUN (router_isis, |
| 970 | router_isis_cmd, |
| 971 | "router isis WORD", |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 972 | ROUTER_STR |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 973 | "ISO IS-IS\n" |
| 974 | "ISO Routing area tag") |
| 975 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 976 | return isis_area_get (vty, argv[0]); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 977 | } |
| 978 | |
| 979 | /* |
| 980 | *'no router isis' command |
| 981 | */ |
| 982 | DEFUN (no_router_isis, |
| 983 | no_router_isis_cmd, |
| 984 | "no router isis WORD", |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 985 | "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 986 | { |
| 987 | return isis_area_destroy (vty, argv[0]); |
| 988 | } |
| 989 | |
| 990 | /* |
| 991 | * 'net' command |
| 992 | */ |
| 993 | DEFUN (net, |
| 994 | net_cmd, |
| 995 | "net WORD", |
| 996 | "A Network Entity Title for this process (OSI only)\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 997 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 998 | { |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 999 | return area_net_title (vty, (u_char *)argv[0]); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1000 | } |
| 1001 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1002 | /* |
| 1003 | * 'no net' command |
| 1004 | */ |
| 1005 | DEFUN (no_net, |
| 1006 | no_net_cmd, |
| 1007 | "no net WORD", |
| 1008 | NO_STR |
| 1009 | "A Network Entity Title for this process (OSI only)\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1010 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1011 | { |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 1012 | return area_clear_net_title (vty, (u_char *)argv[0]); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1013 | } |
| 1014 | |
| 1015 | DEFUN (area_passwd, |
| 1016 | area_passwd_cmd, |
| 1017 | "area-password WORD", |
| 1018 | "Configure the authentication password for an area\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1019 | "Area password\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1020 | { |
| 1021 | struct isis_area *area; |
| 1022 | int len; |
| 1023 | |
| 1024 | area = vty->index; |
| 1025 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1026 | if (!area) |
| 1027 | { |
| 1028 | vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE); |
| 1029 | return CMD_WARNING; |
| 1030 | } |
| 1031 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1032 | len = strlen (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1033 | if (len > 254) |
| 1034 | { |
| 1035 | vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE); |
| 1036 | return CMD_WARNING; |
| 1037 | } |
| 1038 | area->area_passwd.len = (u_char) len; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1039 | area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT; |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 1040 | strncpy ((char *)area->area_passwd.passwd, argv[0], 255); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1041 | |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1042 | if (argc > 1) |
| 1043 | { |
| 1044 | SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND); |
| 1045 | if (strncmp(argv[1], "v", 1) == 0) |
| 1046 | SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1047 | else |
| 1048 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1049 | } |
| 1050 | else |
| 1051 | { |
| 1052 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND); |
| 1053 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1054 | } |
| 1055 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1056 | return CMD_SUCCESS; |
| 1057 | } |
| 1058 | |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1059 | ALIAS (area_passwd, |
| 1060 | area_passwd_snpauth_cmd, |
| 1061 | "area-password WORD authenticate snp (send-only|validate)", |
| 1062 | "Configure the authentication password for an area\n" |
| 1063 | "Area password\n" |
| 1064 | "Authentication\n" |
| 1065 | "SNP PDUs\n" |
| 1066 | "Send but do not check PDUs on receiving\n" |
| 1067 | "Send and check PDUs on receiving\n"); |
| 1068 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1069 | DEFUN (no_area_passwd, |
| 1070 | no_area_passwd_cmd, |
| 1071 | "no area-password", |
| 1072 | NO_STR |
| 1073 | "Configure the authentication password for an area\n") |
| 1074 | { |
| 1075 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1076 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1077 | area = vty->index; |
| 1078 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1079 | if (!area) |
| 1080 | { |
| 1081 | vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE); |
| 1082 | return CMD_WARNING; |
| 1083 | } |
| 1084 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1085 | memset (&area->area_passwd, 0, sizeof (struct isis_passwd)); |
| 1086 | |
| 1087 | return CMD_SUCCESS; |
| 1088 | } |
| 1089 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1090 | DEFUN (domain_passwd, |
| 1091 | domain_passwd_cmd, |
| 1092 | "domain-password WORD", |
| 1093 | "Set the authentication password for a routing domain\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1094 | "Routing domain password\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1095 | { |
| 1096 | struct isis_area *area; |
| 1097 | int len; |
| 1098 | |
| 1099 | area = vty->index; |
| 1100 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1101 | if (!area) |
| 1102 | { |
| 1103 | vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE); |
| 1104 | return CMD_WARNING; |
| 1105 | } |
| 1106 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1107 | len = strlen (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1108 | if (len > 254) |
| 1109 | { |
| 1110 | vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE); |
| 1111 | return CMD_WARNING; |
| 1112 | } |
| 1113 | area->domain_passwd.len = (u_char) len; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1114 | area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT; |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 1115 | strncpy ((char *)area->domain_passwd.passwd, argv[0], 255); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1116 | |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1117 | if (argc > 1) |
| 1118 | { |
| 1119 | SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND); |
| 1120 | if (strncmp(argv[1], "v", 1) == 0) |
| 1121 | SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1122 | else |
| 1123 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1124 | } |
| 1125 | else |
| 1126 | { |
| 1127 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND); |
| 1128 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1129 | } |
| 1130 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1131 | return CMD_SUCCESS; |
| 1132 | } |
| 1133 | |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1134 | ALIAS (domain_passwd, |
| 1135 | domain_passwd_snpauth_cmd, |
| 1136 | "domain-password WORD authenticate snp (send-only|validate)", |
| 1137 | "Set the authentication password for a routing domain\n" |
| 1138 | "Routing domain password\n" |
| 1139 | "Authentication\n" |
| 1140 | "SNP PDUs\n" |
| 1141 | "Send but do not check PDUs on receiving\n" |
| 1142 | "Send and check PDUs on receiving\n"); |
| 1143 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1144 | DEFUN (no_domain_passwd, |
| 1145 | no_domain_passwd_cmd, |
| 1146 | "no domain-password WORD", |
| 1147 | NO_STR |
| 1148 | "Set the authentication password for a routing domain\n") |
| 1149 | { |
| 1150 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1151 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1152 | area = vty->index; |
| 1153 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1154 | if (!area) |
| 1155 | { |
| 1156 | vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE); |
| 1157 | return CMD_WARNING; |
| 1158 | } |
| 1159 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1160 | memset (&area->domain_passwd, 0, sizeof (struct isis_passwd)); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1161 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1162 | return CMD_SUCCESS; |
| 1163 | } |
| 1164 | |
| 1165 | DEFUN (is_type, |
| 1166 | is_type_cmd, |
| 1167 | "is-type (level-1|level-1-2|level-2-only)", |
| 1168 | "IS Level for this routing process (OSI only)\n" |
| 1169 | "Act as a station router only\n" |
| 1170 | "Act as both a station router and an area router\n" |
| 1171 | "Act as an area router only\n") |
| 1172 | { |
| 1173 | struct isis_area *area; |
| 1174 | int type; |
| 1175 | |
| 1176 | area = vty->index; |
| 1177 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1178 | if (!area) |
| 1179 | { |
| 1180 | vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE); |
| 1181 | return CMD_WARNING; |
| 1182 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1183 | |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 1184 | type = string2circuit_t ((u_char *)argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1185 | if (!type) |
| 1186 | { |
| 1187 | vty_out (vty, "Unknown IS level %s", VTY_NEWLINE); |
| 1188 | return CMD_SUCCESS; |
| 1189 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1190 | |
| 1191 | isis_event_system_type_change (area, type); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1192 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1193 | return CMD_SUCCESS; |
| 1194 | } |
| 1195 | |
| 1196 | DEFUN (no_is_type, |
| 1197 | no_is_type_cmd, |
| 1198 | "no is-type (level-1|level-1-2|level-2-only)", |
| 1199 | NO_STR |
| 1200 | "IS Level for this routing process (OSI only)\n" |
| 1201 | "Act as a station router only\n" |
| 1202 | "Act as both a station router and an area router\n" |
| 1203 | "Act as an area router only\n") |
| 1204 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1205 | struct isis_area *area; |
| 1206 | int type; |
| 1207 | |
| 1208 | area = vty->index; |
| 1209 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1210 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1211 | /* |
| 1212 | * Put the is-type back to default. Which is level-1-2 on first |
| 1213 | * circuit for the area level-1 for the rest |
| 1214 | */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1215 | if (listgetdata (listhead (isis->area_list)) == area) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1216 | type = IS_LEVEL_1_AND_2; |
| 1217 | else |
| 1218 | type = IS_LEVEL_1; |
| 1219 | |
| 1220 | isis_event_system_type_change (area, type); |
| 1221 | |
| 1222 | return CMD_SUCCESS; |
| 1223 | } |
| 1224 | |
| 1225 | DEFUN (lsp_gen_interval, |
| 1226 | lsp_gen_interval_cmd, |
| 1227 | "lsp-gen-interval <1-120>", |
| 1228 | "Minimum interval between regenerating same LSP\n" |
| 1229 | "Minimum interval in seconds\n") |
| 1230 | { |
| 1231 | struct isis_area *area; |
| 1232 | uint16_t interval; |
| 1233 | |
| 1234 | area = vty->index; |
| 1235 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1236 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1237 | interval = atoi (argv[0]); |
| 1238 | area->lsp_gen_interval[0] = interval; |
| 1239 | area->lsp_gen_interval[1] = interval; |
| 1240 | |
| 1241 | return CMD_SUCCESS; |
| 1242 | } |
| 1243 | |
| 1244 | DEFUN (no_lsp_gen_interval, |
| 1245 | no_lsp_gen_interval_cmd, |
| 1246 | "no lsp-gen-interval", |
| 1247 | NO_STR |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1248 | "Minimum interval between regenerating same LSP\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1249 | { |
| 1250 | struct isis_area *area; |
| 1251 | |
| 1252 | area = vty->index; |
| 1253 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1254 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1255 | area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT; |
| 1256 | area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT; |
| 1257 | |
| 1258 | return CMD_SUCCESS; |
| 1259 | } |
| 1260 | |
| 1261 | ALIAS (no_lsp_gen_interval, |
| 1262 | no_lsp_gen_interval_arg_cmd, |
| 1263 | "no lsp-gen-interval <1-120>", |
| 1264 | NO_STR |
| 1265 | "Minimum interval between regenerating same LSP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1266 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1267 | |
| 1268 | DEFUN (lsp_gen_interval_l1, |
| 1269 | lsp_gen_interval_l1_cmd, |
| 1270 | "lsp-gen-interval level-1 <1-120>", |
| 1271 | "Minimum interval between regenerating same LSP\n" |
| 1272 | "Set interval for level 1 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1273 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1274 | { |
| 1275 | struct isis_area *area; |
| 1276 | uint16_t interval; |
| 1277 | |
| 1278 | area = vty->index; |
| 1279 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1280 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1281 | interval = atoi (argv[0]); |
| 1282 | area->lsp_gen_interval[0] = interval; |
| 1283 | |
| 1284 | return CMD_SUCCESS; |
| 1285 | } |
| 1286 | |
| 1287 | DEFUN (no_lsp_gen_interval_l1, |
| 1288 | no_lsp_gen_interval_l1_cmd, |
| 1289 | "no lsp-gen-interval level-1", |
| 1290 | NO_STR |
| 1291 | "Minimum interval between regenerating same LSP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1292 | "Set interval for level 1 only\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1293 | { |
| 1294 | struct isis_area *area; |
| 1295 | |
| 1296 | area = vty->index; |
| 1297 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1298 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1299 | area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT; |
| 1300 | |
| 1301 | return CMD_SUCCESS; |
| 1302 | } |
| 1303 | |
| 1304 | ALIAS (no_lsp_gen_interval_l1, |
| 1305 | no_lsp_gen_interval_l1_arg_cmd, |
| 1306 | "no lsp-gen-interval level-1 <1-120>", |
| 1307 | NO_STR |
| 1308 | "Minimum interval between regenerating same LSP\n" |
| 1309 | "Set interval for level 1 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1310 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1311 | |
| 1312 | DEFUN (lsp_gen_interval_l2, |
| 1313 | lsp_gen_interval_l2_cmd, |
| 1314 | "lsp-gen-interval level-2 <1-120>", |
| 1315 | "Minimum interval between regenerating same LSP\n" |
| 1316 | "Set interval for level 2 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1317 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1318 | { |
| 1319 | struct isis_area *area; |
| 1320 | int interval; |
| 1321 | |
| 1322 | area = vty->index; |
| 1323 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1324 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1325 | interval = atoi (argv[0]); |
| 1326 | area->lsp_gen_interval[1] = interval; |
| 1327 | |
| 1328 | return CMD_SUCCESS; |
| 1329 | } |
| 1330 | |
| 1331 | DEFUN (no_lsp_gen_interval_l2, |
| 1332 | no_lsp_gen_interval_l2_cmd, |
| 1333 | "no lsp-gen-interval level-2", |
| 1334 | NO_STR |
| 1335 | "Minimum interval between regenerating same LSP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1336 | "Set interval for level 2 only\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1337 | { |
| 1338 | struct isis_area *area; |
| 1339 | int interval; |
| 1340 | |
| 1341 | area = vty->index; |
| 1342 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1343 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1344 | interval = atoi (argv[0]); |
| 1345 | area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT; |
| 1346 | |
| 1347 | return CMD_SUCCESS; |
| 1348 | } |
| 1349 | |
| 1350 | ALIAS (no_lsp_gen_interval_l2, |
| 1351 | no_lsp_gen_interval_l2_arg_cmd, |
| 1352 | "no lsp-gen-interval level-2 <1-120>", |
| 1353 | NO_STR |
| 1354 | "Minimum interval between regenerating same LSP\n" |
| 1355 | "Set interval for level 2 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1356 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1357 | |
| 1358 | DEFUN (metric_style, |
| 1359 | metric_style_cmd, |
| 1360 | "metric-style (narrow|wide)", |
| 1361 | "Use old-style (ISO 10589) or new-style packet formats\n" |
| 1362 | "Use old style of TLVs with narrow metric\n" |
| 1363 | "Use new style of TLVs to carry wider metric\n") |
| 1364 | { |
| 1365 | struct isis_area *area; |
| 1366 | |
| 1367 | area = vty->index; |
| 1368 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1369 | if (!strcmp (argv[0], "wide")) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1370 | area->newmetric = 1; |
| 1371 | else |
| 1372 | area->newmetric = 0; |
| 1373 | |
| 1374 | return CMD_SUCCESS; |
| 1375 | } |
| 1376 | |
| 1377 | DEFUN (no_metric_style, |
| 1378 | no_metric_style_cmd, |
| 1379 | "no metric-style (narrow|wide)", |
| 1380 | NO_STR |
| 1381 | "Use old-style (ISO 10589) or new-style packet formats\n" |
| 1382 | "Use old style of TLVs with narrow metric\n" |
| 1383 | "Use new style of TLVs to carry wider metric\n") |
| 1384 | { |
| 1385 | struct isis_area *area; |
| 1386 | |
| 1387 | area = vty->index; |
| 1388 | assert (area); |
| 1389 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1390 | if (!strcmp (argv[0], "wide")) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1391 | area->newmetric = 0; |
| 1392 | else |
| 1393 | area->newmetric = 1; |
| 1394 | |
| 1395 | return CMD_SUCCESS; |
| 1396 | } |
| 1397 | |
| 1398 | DEFUN (dynamic_hostname, |
| 1399 | dynamic_hostname_cmd, |
| 1400 | "hostname dynamic", |
| 1401 | "Dynamic hostname for IS-IS\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1402 | "Dynamic hostname\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1403 | { |
| 1404 | struct isis_area *area; |
| 1405 | |
| 1406 | area = vty->index; |
| 1407 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1408 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1409 | area->dynhostname = 1; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1410 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1411 | return CMD_SUCCESS; |
| 1412 | } |
| 1413 | |
| 1414 | DEFUN (no_dynamic_hostname, |
| 1415 | no_dynamic_hostname_cmd, |
| 1416 | "no hostname dynamic", |
| 1417 | NO_STR |
| 1418 | "Dynamic hostname for IS-IS\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1419 | "Dynamic hostname\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1420 | { |
| 1421 | struct isis_area *area; |
| 1422 | |
| 1423 | area = vty->index; |
| 1424 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1425 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1426 | area->dynhostname = 0; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1427 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1428 | return CMD_SUCCESS; |
| 1429 | } |
| 1430 | |
| 1431 | DEFUN (spf_interval, |
| 1432 | spf_interval_cmd, |
| 1433 | "spf-interval <1-120>", |
hasso | 2097cd8 | 2003-12-23 11:51:08 +0000 | [diff] [blame] | 1434 | "Minimum interval between SPF calculations\n" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1435 | "Minimum interval between consecutive SPFs in seconds\n") |
| 1436 | { |
| 1437 | struct isis_area *area; |
| 1438 | u_int16_t interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1439 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1440 | area = vty->index; |
| 1441 | interval = atoi (argv[0]); |
| 1442 | area->min_spf_interval[0] = interval; |
| 1443 | area->min_spf_interval[1] = interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1444 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1445 | return CMD_SUCCESS; |
| 1446 | } |
| 1447 | |
| 1448 | DEFUN (no_spf_interval, |
| 1449 | no_spf_interval_cmd, |
| 1450 | "no spf-interval", |
| 1451 | NO_STR |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1452 | "Minimum interval between SPF calculations\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1453 | { |
| 1454 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1455 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1456 | area = vty->index; |
| 1457 | |
| 1458 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; |
| 1459 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1460 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1461 | return CMD_SUCCESS; |
| 1462 | } |
| 1463 | |
| 1464 | ALIAS (no_spf_interval, |
| 1465 | no_spf_interval_arg_cmd, |
| 1466 | "no spf-interval <1-120>", |
| 1467 | NO_STR |
| 1468 | "Minimum interval between SPF calculations\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1469 | "Minimum interval between consecutive SPFs in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1470 | |
| 1471 | DEFUN (spf_interval_l1, |
| 1472 | spf_interval_l1_cmd, |
| 1473 | "spf-interval level-1 <1-120>", |
| 1474 | "Minimum interval between SPF calculations\n" |
| 1475 | "Set interval for level 1 only\n" |
| 1476 | "Minimum interval between consecutive SPFs in seconds\n") |
| 1477 | { |
| 1478 | struct isis_area *area; |
| 1479 | u_int16_t interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1480 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1481 | area = vty->index; |
| 1482 | interval = atoi (argv[0]); |
| 1483 | area->min_spf_interval[0] = interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1484 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1485 | return CMD_SUCCESS; |
| 1486 | } |
| 1487 | |
| 1488 | DEFUN (no_spf_interval_l1, |
| 1489 | no_spf_interval_l1_cmd, |
| 1490 | "no spf-interval level-1", |
| 1491 | NO_STR |
| 1492 | "Minimum interval between SPF calculations\n" |
| 1493 | "Set interval for level 1 only\n") |
| 1494 | { |
| 1495 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1496 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1497 | area = vty->index; |
| 1498 | |
| 1499 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1500 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1501 | return CMD_SUCCESS; |
| 1502 | } |
| 1503 | |
| 1504 | ALIAS (no_spf_interval, |
| 1505 | no_spf_interval_l1_arg_cmd, |
| 1506 | "no spf-interval level-1 <1-120>", |
| 1507 | NO_STR |
| 1508 | "Minimum interval between SPF calculations\n" |
| 1509 | "Set interval for level 1 only\n" |
| 1510 | "Minimum interval between consecutive SPFs in seconds\n") |
| 1511 | |
| 1512 | DEFUN (spf_interval_l2, |
| 1513 | spf_interval_l2_cmd, |
| 1514 | "spf-interval level-2 <1-120>", |
| 1515 | "Minimum interval between SPF calculations\n" |
| 1516 | "Set interval for level 2 only\n" |
| 1517 | "Minimum interval between consecutive SPFs in seconds\n") |
| 1518 | { |
| 1519 | struct isis_area *area; |
| 1520 | u_int16_t interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1521 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1522 | area = vty->index; |
| 1523 | interval = atoi (argv[0]); |
| 1524 | area->min_spf_interval[1] = interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1525 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1526 | return CMD_SUCCESS; |
| 1527 | } |
| 1528 | |
| 1529 | DEFUN (no_spf_interval_l2, |
| 1530 | no_spf_interval_l2_cmd, |
| 1531 | "no spf-interval level-2", |
| 1532 | NO_STR |
| 1533 | "Minimum interval between SPF calculations\n" |
| 1534 | "Set interval for level 2 only\n") |
| 1535 | { |
| 1536 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1537 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1538 | area = vty->index; |
| 1539 | |
| 1540 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1541 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1542 | return CMD_SUCCESS; |
| 1543 | } |
| 1544 | |
| 1545 | ALIAS (no_spf_interval, |
| 1546 | no_spf_interval_l2_arg_cmd, |
| 1547 | "no spf-interval level-2 <1-120>", |
| 1548 | NO_STR |
| 1549 | "Minimum interval between SPF calculations\n" |
| 1550 | "Set interval for level 2 only\n" |
| 1551 | "Minimum interval between consecutive SPFs in seconds\n") |
| 1552 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1553 | #ifdef TOPOLOGY_GENERATE |
| 1554 | DEFUN (topology_generate_grid, |
| 1555 | topology_generate_grid_cmd, |
| 1556 | "topology generate grid <1-100> <1-100> <1-65000> [param] [param] " |
| 1557 | "[param]", |
| 1558 | "Topology for IS-IS\n" |
| 1559 | "Topology for IS-IS\n" |
| 1560 | "Topology grid for IS-IS\n" |
| 1561 | "X parameter of the grid\n" |
| 1562 | "Y parameter of the grid\n" |
| 1563 | "Random seed\n" |
| 1564 | "Optional param 1\n" |
| 1565 | "Optional param 2\n" |
| 1566 | "Optional param 3\n" |
| 1567 | "Topology\n") |
| 1568 | { |
| 1569 | struct isis_area *area; |
| 1570 | |
| 1571 | area = vty->index; |
| 1572 | assert (area); |
| 1573 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1574 | if (!spgrid_check_params (vty, argc, argv)) |
| 1575 | { |
| 1576 | if (area->topology) |
| 1577 | list_delete (area->topology); |
| 1578 | area->topology = list_new (); |
| 1579 | memcpy (area->top_params, vty->buf, 200); |
| 1580 | gen_spgrid_topology (vty, area->topology); |
| 1581 | remove_topology_lsps (area); |
| 1582 | generate_topology_lsps (area); |
| 1583 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1584 | |
| 1585 | return CMD_SUCCESS; |
| 1586 | } |
| 1587 | |
hasso | f695b01 | 2005-04-02 19:03:39 +0000 | [diff] [blame] | 1588 | DEFUN (show_isis_generated_topology, |
| 1589 | show_isis_generated_topology_cmd, |
| 1590 | "show isis generated-topology", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1591 | SHOW_STR |
| 1592 | "clns network information\n" |
| 1593 | "CLNS neighbor adjacencies\n") |
| 1594 | { |
| 1595 | struct isis_area *area; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1596 | struct listnode *node, *nnode; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1597 | struct listnode *node2; |
| 1598 | struct arc *arc; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1599 | for (ALL_LIST_ELEMENTS (isis->area_list, node, nnode, area)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1600 | { |
| 1601 | if (area->topology) |
| 1602 | { |
| 1603 | vty_out (vty, "Topology for isis area:%s%s", area->area_tag, |
| 1604 | VTY_NEWLINE); |
| 1605 | LIST_LOOP (area->topology, arc, node2) |
| 1606 | { |
| 1607 | vty_out (vty, "a %ld %ld %ld%s", arc->from_node, arc->to_node, |
| 1608 | arc->distance, VTY_NEWLINE); |
| 1609 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1610 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1611 | } |
| 1612 | return CMD_SUCCESS; |
| 1613 | } |
| 1614 | |
| 1615 | /* |
| 1616 | * 'topology base-is' command |
| 1617 | */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1618 | DEFUN (topology_baseis, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1619 | topology_baseis_cmd, |
| 1620 | "topology base-is WORD", |
| 1621 | "Topology for IS-IS\n" |
| 1622 | "Topology for IS-IS\n" |
| 1623 | "A Network IS Base for this topology" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1624 | "XX.XXXX.XXXX.XX Network entity title (NET)\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1625 | { |
| 1626 | struct isis_area *area; |
| 1627 | u_char buff[ISIS_SYS_ID_LEN]; |
| 1628 | |
| 1629 | area = vty->index; |
| 1630 | assert (area); |
| 1631 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1632 | if (sysid2buff (buff, argv[0])) |
| 1633 | { |
| 1634 | sysid2buff (area->topology_baseis, argv[0]); |
| 1635 | } |
| 1636 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1637 | return CMD_SUCCESS; |
| 1638 | } |
| 1639 | |
| 1640 | /* |
| 1641 | * 'no net' command |
| 1642 | */ |
| 1643 | DEFUN (no_topology_baseis, |
| 1644 | no_topology_baseis_cmd, |
| 1645 | "no topology base-is WORD", |
| 1646 | NO_STR |
| 1647 | "A Network Entity Title for this process (OSI only)" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1648 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1649 | { |
| 1650 | struct isis_area *area; |
| 1651 | |
| 1652 | area = vty->index; |
| 1653 | assert (area); |
| 1654 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1655 | memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1656 | return CMD_SUCCESS; |
| 1657 | } |
| 1658 | |
| 1659 | #endif /* TOPOLOGY_GENERATE */ |
| 1660 | |
| 1661 | DEFUN (lsp_lifetime, |
| 1662 | lsp_lifetime_cmd, |
| 1663 | "lsp-lifetime <380-65535>", |
| 1664 | "Maximum LSP lifetime\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1665 | "LSP lifetime in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1666 | { |
| 1667 | struct isis_area *area; |
| 1668 | uint16_t interval; |
| 1669 | |
| 1670 | area = vty->index; |
| 1671 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1672 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1673 | interval = atoi (argv[0]); |
| 1674 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1675 | if (interval < ISIS_MIN_LSP_LIFETIME) |
| 1676 | { |
| 1677 | vty_out (vty, "LSP lifetime (%us) below %us%s", |
| 1678 | interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1679 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1680 | return CMD_WARNING; |
| 1681 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1682 | |
| 1683 | |
| 1684 | area->max_lsp_lifetime[0] = interval; |
| 1685 | area->max_lsp_lifetime[1] = interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1686 | area->lsp_refresh[0] = interval - 300; |
| 1687 | area->lsp_refresh[1] = interval - 300; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1688 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1689 | if (area->t_lsp_refresh[0]) |
| 1690 | { |
| 1691 | thread_cancel (area->t_lsp_refresh[0]); |
| 1692 | thread_execute (master, lsp_refresh_l1, area, 0); |
| 1693 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1694 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1695 | if (area->t_lsp_refresh[1]) |
| 1696 | { |
| 1697 | thread_cancel (area->t_lsp_refresh[1]); |
| 1698 | thread_execute (master, lsp_refresh_l2, area, 0); |
| 1699 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1700 | |
| 1701 | |
| 1702 | return CMD_SUCCESS; |
| 1703 | } |
| 1704 | |
| 1705 | DEFUN (no_lsp_lifetime, |
| 1706 | no_lsp_lifetime_cmd, |
| 1707 | "no lsp-lifetime", |
| 1708 | NO_STR |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1709 | "LSP lifetime in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1710 | { |
| 1711 | struct isis_area *area; |
| 1712 | |
| 1713 | area = vty->index; |
| 1714 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1715 | |
| 1716 | area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */ |
| 1717 | area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */ |
| 1718 | area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */ |
| 1719 | area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1720 | |
| 1721 | return CMD_SUCCESS; |
| 1722 | } |
| 1723 | |
| 1724 | ALIAS (no_lsp_lifetime, |
| 1725 | no_lsp_lifetime_arg_cmd, |
| 1726 | "no lsp-lifetime <380-65535>", |
| 1727 | NO_STR |
| 1728 | "Maximum LSP lifetime\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1729 | "LSP lifetime in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1730 | |
| 1731 | DEFUN (lsp_lifetime_l1, |
| 1732 | lsp_lifetime_l1_cmd, |
| 1733 | "lsp-lifetime level-1 <380-65535>", |
| 1734 | "Maximum LSP lifetime for Level 1 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1735 | "LSP lifetime for Level 1 only in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1736 | { |
| 1737 | struct isis_area *area; |
| 1738 | uint16_t interval; |
| 1739 | |
| 1740 | area = vty->index; |
| 1741 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1742 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1743 | interval = atoi (argv[0]); |
| 1744 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1745 | if (interval < ISIS_MIN_LSP_LIFETIME) |
| 1746 | { |
| 1747 | vty_out (vty, "Level-1 LSP lifetime (%us) below %us%s", |
| 1748 | interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1749 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1750 | return CMD_WARNING; |
| 1751 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1752 | |
| 1753 | |
| 1754 | area->max_lsp_lifetime[0] = interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1755 | area->lsp_refresh[0] = interval - 300; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1756 | |
| 1757 | return CMD_SUCCESS; |
| 1758 | } |
| 1759 | |
| 1760 | DEFUN (no_lsp_lifetime_l1, |
| 1761 | no_lsp_lifetime_l1_cmd, |
| 1762 | "no lsp-lifetime level-1", |
| 1763 | NO_STR |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1764 | "LSP lifetime for Level 1 only in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1765 | { |
| 1766 | struct isis_area *area; |
| 1767 | |
| 1768 | area = vty->index; |
| 1769 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1770 | |
| 1771 | area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */ |
| 1772 | area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1773 | |
| 1774 | return CMD_SUCCESS; |
| 1775 | } |
| 1776 | |
| 1777 | ALIAS (no_lsp_lifetime_l1, |
| 1778 | no_lsp_lifetime_l1_arg_cmd, |
| 1779 | "no lsp-lifetime level-1 <380-65535>", |
| 1780 | NO_STR |
| 1781 | "Maximum LSP lifetime for Level 1 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1782 | "LSP lifetime for Level 1 only in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1783 | |
| 1784 | DEFUN (lsp_lifetime_l2, |
| 1785 | lsp_lifetime_l2_cmd, |
| 1786 | "lsp-lifetime level-2 <380-65535>", |
| 1787 | "Maximum LSP lifetime for Level 2 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1788 | "LSP lifetime for Level 2 only in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1789 | { |
| 1790 | struct isis_area *area; |
| 1791 | uint16_t interval; |
| 1792 | |
| 1793 | area = vty->index; |
| 1794 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1795 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1796 | interval = atoi (argv[0]); |
| 1797 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1798 | if (interval < ISIS_MIN_LSP_LIFETIME) |
| 1799 | { |
| 1800 | vty_out (vty, "Level-2 LSP lifetime (%us) below %us%s", |
| 1801 | interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1802 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1803 | return CMD_WARNING; |
| 1804 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1805 | |
| 1806 | area->max_lsp_lifetime[1] = interval; |
| 1807 | area->lsp_refresh[1] = interval - 300; |
| 1808 | |
| 1809 | return CMD_SUCCESS; |
| 1810 | } |
| 1811 | |
| 1812 | DEFUN (no_lsp_lifetime_l2, |
| 1813 | no_lsp_lifetime_l2_cmd, |
| 1814 | "no lsp-lifetime level-2", |
| 1815 | NO_STR |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1816 | "LSP lifetime for Level 2 only in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1817 | { |
| 1818 | struct isis_area *area; |
| 1819 | |
| 1820 | area = vty->index; |
| 1821 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1822 | |
| 1823 | area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */ |
| 1824 | area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1825 | |
| 1826 | return CMD_SUCCESS; |
| 1827 | } |
| 1828 | |
| 1829 | ALIAS (no_lsp_lifetime_l2, |
| 1830 | no_lsp_lifetime_l2_arg_cmd, |
| 1831 | "no lsp-lifetime level-2 <380-65535>", |
| 1832 | NO_STR |
| 1833 | "Maximum LSP lifetime for Level 2 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1834 | "LSP lifetime for Level 2 only in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1835 | |
| 1836 | /* IS-IS configuration write function */ |
| 1837 | int |
| 1838 | isis_config_write (struct vty *vty) |
| 1839 | { |
| 1840 | int write = 0; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1841 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1842 | if (isis != NULL) |
| 1843 | { |
| 1844 | struct isis_area *area; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1845 | struct listnode *node, *nnode; |
| 1846 | struct listnode *node2, *nnode2; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1847 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1848 | for (ALL_LIST_ELEMENTS (isis->area_list, node, nnode, area)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1849 | { |
| 1850 | /* ISIS - Area name */ |
| 1851 | vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE); |
| 1852 | write++; |
| 1853 | /* ISIS - Net */ |
| 1854 | if (listcount (area->area_addrs) > 0) |
| 1855 | { |
| 1856 | struct area_addr *area_addr; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1857 | for (ALL_LIST_ELEMENTS (area->area_addrs, node2, nnode2, area_addr)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1858 | { |
| 1859 | vty_out (vty, " net %s%s", |
| 1860 | isonet_print (area_addr->area_addr, |
| 1861 | area_addr->addr_len + ISIS_SYS_ID_LEN + |
| 1862 | 1), VTY_NEWLINE); |
| 1863 | write++; |
| 1864 | } |
| 1865 | } |
| 1866 | /* ISIS - Dynamic hostname - Defaults to true so only display if false */ |
| 1867 | if (!area->dynhostname) |
| 1868 | { |
| 1869 | vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE); |
| 1870 | write++; |
| 1871 | } |
| 1872 | /* ISIS - Metric-Style - when true displays wide */ |
| 1873 | if (area->newmetric) |
| 1874 | { |
| 1875 | vty_out (vty, " metric-style wide%s", VTY_NEWLINE); |
| 1876 | write++; |
| 1877 | } |
| 1878 | /* ISIS - Area is-type (level-1-2 is default) */ |
| 1879 | if (area->is_type == IS_LEVEL_1) |
| 1880 | { |
| 1881 | vty_out (vty, " is-type level-1%s", VTY_NEWLINE); |
| 1882 | write++; |
| 1883 | } |
| 1884 | else |
| 1885 | { |
| 1886 | if (area->is_type == IS_LEVEL_2) |
| 1887 | { |
| 1888 | vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE); |
| 1889 | write++; |
| 1890 | } |
| 1891 | } |
| 1892 | /* ISIS - Lsp generation interval */ |
| 1893 | if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1]) |
| 1894 | { |
| 1895 | if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT) |
| 1896 | { |
| 1897 | vty_out (vty, " lsp-gen-interval %d%s", |
| 1898 | area->lsp_gen_interval[0], VTY_NEWLINE); |
| 1899 | write++; |
| 1900 | } |
| 1901 | } |
| 1902 | else |
| 1903 | { |
| 1904 | if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT) |
| 1905 | { |
| 1906 | vty_out (vty, " lsp-gen-interval level-1 %d%s", |
| 1907 | area->lsp_gen_interval[0], VTY_NEWLINE); |
| 1908 | write++; |
| 1909 | } |
| 1910 | if (area->lsp_gen_interval[1] != LSP_GEN_INTERVAL_DEFAULT) |
| 1911 | { |
| 1912 | vty_out (vty, " lsp-gen-interval level-2 %d%s", |
| 1913 | area->lsp_gen_interval[1], VTY_NEWLINE); |
| 1914 | write++; |
| 1915 | } |
| 1916 | } |
| 1917 | /* ISIS - LSP lifetime */ |
| 1918 | if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1]) |
| 1919 | { |
| 1920 | if (area->max_lsp_lifetime[0] != MAX_AGE) |
| 1921 | { |
| 1922 | vty_out (vty, " lsp-lifetime %u%s", area->max_lsp_lifetime[0], |
| 1923 | VTY_NEWLINE); |
| 1924 | write++; |
| 1925 | } |
| 1926 | } |
| 1927 | else |
| 1928 | { |
| 1929 | if (area->max_lsp_lifetime[0] != MAX_AGE) |
| 1930 | { |
| 1931 | vty_out (vty, " lsp-lifetime level-1 %u%s", |
| 1932 | area->max_lsp_lifetime[0], VTY_NEWLINE); |
| 1933 | write++; |
| 1934 | } |
| 1935 | if (area->max_lsp_lifetime[1] != MAX_AGE) |
| 1936 | { |
| 1937 | vty_out (vty, " lsp-lifetime level-2 %u%s", |
| 1938 | area->max_lsp_lifetime[1], VTY_NEWLINE); |
| 1939 | write++; |
| 1940 | } |
| 1941 | } |
hasso | 53c997c | 2004-09-15 16:21:59 +0000 | [diff] [blame] | 1942 | /* Authentication passwords. */ |
| 1943 | if (area->area_passwd.len > 0) |
| 1944 | { |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1945 | vty_out(vty, " area-password %s", area->area_passwd.passwd); |
| 1946 | if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND)) |
| 1947 | { |
| 1948 | vty_out(vty, " authenticate snp "); |
| 1949 | if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV)) |
| 1950 | vty_out(vty, "validate"); |
| 1951 | else |
| 1952 | vty_out(vty, "send-only"); |
| 1953 | } |
| 1954 | vty_out(vty, "%s", VTY_NEWLINE); |
hasso | 53c997c | 2004-09-15 16:21:59 +0000 | [diff] [blame] | 1955 | write++; |
| 1956 | } |
| 1957 | if (area->domain_passwd.len > 0) |
| 1958 | { |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1959 | vty_out(vty, " domain-password %s", area->domain_passwd.passwd); |
| 1960 | if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND)) |
| 1961 | { |
| 1962 | vty_out(vty, " authenticate snp "); |
| 1963 | if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV)) |
| 1964 | vty_out(vty, "validate"); |
| 1965 | else |
| 1966 | vty_out(vty, "send-only"); |
| 1967 | } |
| 1968 | vty_out(vty, "%s", VTY_NEWLINE); |
hasso | 53c997c | 2004-09-15 16:21:59 +0000 | [diff] [blame] | 1969 | write++; |
| 1970 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1971 | #ifdef TOPOLOGY_GENERATE |
| 1972 | /* seems we save the whole command line here */ |
| 1973 | if (area->top_params) |
| 1974 | { |
| 1975 | vty_out (vty, " %s%s", area->top_params, VTY_NEWLINE); |
| 1976 | write++; |
| 1977 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1978 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1979 | if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, |
| 1980 | ISIS_SYS_ID_LEN)) |
| 1981 | { |
| 1982 | vty_out (vty, " topology base_is %s%s", |
| 1983 | sysid_print (area->topology_baseis), VTY_NEWLINE); |
| 1984 | write++; |
| 1985 | } |
| 1986 | |
| 1987 | #endif /* TOPOLOGY_GENERATE */ |
| 1988 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1989 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1990 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1991 | return write; |
| 1992 | } |
| 1993 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1994 | struct cmd_node isis_node = { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1995 | ISIS_NODE, |
hasso | 2097cd8 | 2003-12-23 11:51:08 +0000 | [diff] [blame] | 1996 | "%s(config-router)# ", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1997 | 1 |
| 1998 | }; |
| 1999 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2000 | void |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2001 | isis_init () |
| 2002 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2003 | /* Install IS-IS top node */ |
| 2004 | install_node (&isis_node, isis_config_write); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2005 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2006 | install_element (VIEW_NODE, &show_clns_neighbors_cmd); |
| 2007 | install_element (VIEW_NODE, &show_isis_neighbors_cmd); |
| 2008 | install_element (VIEW_NODE, &show_clns_neighbors_detail_cmd); |
| 2009 | install_element (VIEW_NODE, &show_isis_neighbors_detail_cmd); |
| 2010 | |
| 2011 | install_element (VIEW_NODE, &show_hostname_cmd); |
| 2012 | install_element (VIEW_NODE, &show_database_cmd); |
| 2013 | install_element (VIEW_NODE, &show_database_detail_cmd); |
| 2014 | |
| 2015 | install_element (ENABLE_NODE, &show_clns_neighbors_cmd); |
| 2016 | install_element (ENABLE_NODE, &show_isis_neighbors_cmd); |
| 2017 | install_element (ENABLE_NODE, &show_clns_neighbors_detail_cmd); |
| 2018 | install_element (ENABLE_NODE, &show_isis_neighbors_detail_cmd); |
| 2019 | |
| 2020 | install_element (ENABLE_NODE, &show_hostname_cmd); |
| 2021 | install_element (ENABLE_NODE, &show_database_cmd); |
| 2022 | install_element (ENABLE_NODE, &show_database_detail_cmd); |
| 2023 | install_element (ENABLE_NODE, &show_debugging_cmd); |
| 2024 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2025 | install_node (&debug_node, config_write_debug); |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 2026 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2027 | install_element (ENABLE_NODE, &debug_isis_adj_cmd); |
| 2028 | install_element (ENABLE_NODE, &no_debug_isis_adj_cmd); |
| 2029 | install_element (ENABLE_NODE, &debug_isis_csum_cmd); |
| 2030 | install_element (ENABLE_NODE, &no_debug_isis_csum_cmd); |
| 2031 | install_element (ENABLE_NODE, &debug_isis_lupd_cmd); |
| 2032 | install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd); |
| 2033 | install_element (ENABLE_NODE, &debug_isis_err_cmd); |
| 2034 | install_element (ENABLE_NODE, &no_debug_isis_err_cmd); |
| 2035 | install_element (ENABLE_NODE, &debug_isis_snp_cmd); |
| 2036 | install_element (ENABLE_NODE, &no_debug_isis_snp_cmd); |
| 2037 | install_element (ENABLE_NODE, &debug_isis_upd_cmd); |
| 2038 | install_element (ENABLE_NODE, &no_debug_isis_upd_cmd); |
| 2039 | install_element (ENABLE_NODE, &debug_isis_spfevents_cmd); |
| 2040 | install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd); |
| 2041 | install_element (ENABLE_NODE, &debug_isis_spfstats_cmd); |
| 2042 | install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd); |
| 2043 | install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd); |
| 2044 | install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd); |
| 2045 | install_element (ENABLE_NODE, &debug_isis_rtevents_cmd); |
| 2046 | install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd); |
| 2047 | install_element (ENABLE_NODE, &debug_isis_events_cmd); |
| 2048 | install_element (ENABLE_NODE, &no_debug_isis_events_cmd); |
| 2049 | |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 2050 | install_element (CONFIG_NODE, &debug_isis_adj_cmd); |
| 2051 | install_element (CONFIG_NODE, &no_debug_isis_adj_cmd); |
| 2052 | install_element (CONFIG_NODE, &debug_isis_csum_cmd); |
| 2053 | install_element (CONFIG_NODE, &no_debug_isis_csum_cmd); |
| 2054 | install_element (CONFIG_NODE, &debug_isis_lupd_cmd); |
| 2055 | install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd); |
| 2056 | install_element (CONFIG_NODE, &debug_isis_err_cmd); |
| 2057 | install_element (CONFIG_NODE, &no_debug_isis_err_cmd); |
| 2058 | install_element (CONFIG_NODE, &debug_isis_snp_cmd); |
| 2059 | install_element (CONFIG_NODE, &no_debug_isis_snp_cmd); |
| 2060 | install_element (CONFIG_NODE, &debug_isis_upd_cmd); |
| 2061 | install_element (CONFIG_NODE, &no_debug_isis_upd_cmd); |
| 2062 | install_element (CONFIG_NODE, &debug_isis_spfevents_cmd); |
| 2063 | install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd); |
| 2064 | install_element (CONFIG_NODE, &debug_isis_spfstats_cmd); |
| 2065 | install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd); |
| 2066 | install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd); |
| 2067 | install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd); |
| 2068 | install_element (CONFIG_NODE, &debug_isis_rtevents_cmd); |
| 2069 | install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd); |
| 2070 | install_element (CONFIG_NODE, &debug_isis_events_cmd); |
| 2071 | install_element (CONFIG_NODE, &no_debug_isis_events_cmd); |
| 2072 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2073 | install_element (CONFIG_NODE, &router_isis_cmd); |
| 2074 | install_element (CONFIG_NODE, &no_router_isis_cmd); |
| 2075 | |
| 2076 | install_default (ISIS_NODE); |
| 2077 | |
| 2078 | install_element (ISIS_NODE, &net_cmd); |
| 2079 | install_element (ISIS_NODE, &no_net_cmd); |
| 2080 | |
| 2081 | install_element (ISIS_NODE, &is_type_cmd); |
| 2082 | install_element (ISIS_NODE, &no_is_type_cmd); |
| 2083 | |
| 2084 | install_element (ISIS_NODE, &area_passwd_cmd); |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 2085 | install_element (ISIS_NODE, &area_passwd_snpauth_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2086 | install_element (ISIS_NODE, &no_area_passwd_cmd); |
| 2087 | |
| 2088 | install_element (ISIS_NODE, &domain_passwd_cmd); |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 2089 | install_element (ISIS_NODE, &domain_passwd_snpauth_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2090 | install_element (ISIS_NODE, &no_domain_passwd_cmd); |
| 2091 | |
| 2092 | install_element (ISIS_NODE, &lsp_gen_interval_cmd); |
| 2093 | install_element (ISIS_NODE, &no_lsp_gen_interval_cmd); |
| 2094 | install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd); |
| 2095 | install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd); |
| 2096 | install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd); |
| 2097 | install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd); |
| 2098 | install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd); |
| 2099 | install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd); |
| 2100 | install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd); |
| 2101 | |
| 2102 | install_element (ISIS_NODE, &spf_interval_cmd); |
| 2103 | install_element (ISIS_NODE, &no_spf_interval_cmd); |
| 2104 | install_element (ISIS_NODE, &no_spf_interval_arg_cmd); |
| 2105 | install_element (ISIS_NODE, &spf_interval_l1_cmd); |
| 2106 | install_element (ISIS_NODE, &no_spf_interval_l1_cmd); |
| 2107 | install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd); |
| 2108 | install_element (ISIS_NODE, &spf_interval_l2_cmd); |
| 2109 | install_element (ISIS_NODE, &no_spf_interval_l2_cmd); |
| 2110 | install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2111 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2112 | install_element (ISIS_NODE, &lsp_lifetime_cmd); |
| 2113 | install_element (ISIS_NODE, &no_lsp_lifetime_cmd); |
| 2114 | install_element (ISIS_NODE, &no_lsp_lifetime_arg_cmd); |
| 2115 | install_element (ISIS_NODE, &lsp_lifetime_l1_cmd); |
| 2116 | install_element (ISIS_NODE, &no_lsp_lifetime_l1_cmd); |
| 2117 | install_element (ISIS_NODE, &no_lsp_lifetime_l1_arg_cmd); |
| 2118 | install_element (ISIS_NODE, &lsp_lifetime_l2_cmd); |
| 2119 | install_element (ISIS_NODE, &no_lsp_lifetime_l2_cmd); |
| 2120 | install_element (ISIS_NODE, &no_lsp_lifetime_l2_arg_cmd); |
| 2121 | |
| 2122 | install_element (ISIS_NODE, &dynamic_hostname_cmd); |
| 2123 | install_element (ISIS_NODE, &no_dynamic_hostname_cmd); |
| 2124 | |
| 2125 | install_element (ISIS_NODE, &metric_style_cmd); |
| 2126 | install_element (ISIS_NODE, &no_metric_style_cmd); |
| 2127 | #ifdef TOPOLOGY_GENERATE |
| 2128 | install_element (ISIS_NODE, &topology_generate_grid_cmd); |
| 2129 | install_element (ISIS_NODE, &topology_baseis_cmd); |
| 2130 | install_element (ISIS_NODE, &no_topology_baseis_cmd); |
hasso | f695b01 | 2005-04-02 19:03:39 +0000 | [diff] [blame] | 2131 | install_element (VIEW_NODE, &show_isis_generated_topology_cmd); |
| 2132 | install_element (ENABLE_NODE, &show_isis_generated_topology_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2133 | #endif /* TOPOLOGY_GENERATE */ |
| 2134 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2135 | isis_new (0); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2136 | isis_circuit_init (); |
| 2137 | isis_zebra_init (); |
| 2138 | isis_spf_cmds_init (); |
| 2139 | } |