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