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