jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * IS-IS Rout(e)ing protocol - isis_circuit.h |
| 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 | #include <stdlib.h> |
| 23 | #include <stdio.h> |
| 24 | #include <ctype.h> |
| 25 | #include <zebra.h> |
hasso | 37da8c0 | 2004-05-19 11:38:40 +0000 | [diff] [blame] | 26 | #ifdef GNU_LINUX |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 27 | #include <net/ethernet.h> |
hasso | 37da8c0 | 2004-05-19 11:38:40 +0000 | [diff] [blame] | 28 | #else |
| 29 | #include <netinet/if_ether.h> |
| 30 | #endif |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 31 | |
| 32 | #include "log.h" |
| 33 | #include "memory.h" |
| 34 | #include "if.h" |
| 35 | #include "linklist.h" |
| 36 | #include "command.h" |
| 37 | #include "thread.h" |
| 38 | #include "hash.h" |
| 39 | #include "prefix.h" |
| 40 | #include "stream.h" |
| 41 | |
| 42 | #include "isisd/dict.h" |
| 43 | #include "isisd/include-netbsd/iso.h" |
| 44 | #include "isisd/isis_constants.h" |
| 45 | #include "isisd/isis_common.h" |
| 46 | #include "isisd/isis_circuit.h" |
| 47 | #include "isisd/isis_tlv.h" |
| 48 | #include "isisd/isis_lsp.h" |
| 49 | #include "isisd/isis_pdu.h" |
| 50 | #include "isisd/isis_network.h" |
| 51 | #include "isisd/isis_misc.h" |
| 52 | #include "isisd/isis_constants.h" |
| 53 | #include "isisd/isis_adjacency.h" |
| 54 | #include "isisd/isis_dr.h" |
| 55 | #include "isisd/isis_flags.h" |
| 56 | #include "isisd/isisd.h" |
| 57 | #include "isisd/isis_csm.h" |
| 58 | #include "isisd/isis_events.h" |
| 59 | |
| 60 | extern struct thread_master *master; |
| 61 | extern struct isis *isis; |
| 62 | |
| 63 | struct isis_circuit * |
| 64 | isis_circuit_new () |
| 65 | { |
| 66 | struct isis_circuit *circuit; |
| 67 | int i; |
| 68 | |
| 69 | circuit = XMALLOC (MTYPE_ISIS_CIRCUIT, sizeof (struct isis_circuit)); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 70 | if (circuit) |
| 71 | { |
| 72 | memset (circuit, 0, sizeof (struct isis_circuit)); |
| 73 | /* set default metrics for circuit */ |
| 74 | for (i = 0; i < 2; i++) |
| 75 | { |
| 76 | circuit->metrics[i].metric_default = DEFAULT_CIRCUIT_METRICS; |
| 77 | circuit->metrics[i].metric_expense = METRICS_UNSUPPORTED; |
| 78 | circuit->metrics[i].metric_error = METRICS_UNSUPPORTED; |
| 79 | circuit->metrics[i].metric_delay = METRICS_UNSUPPORTED; |
| 80 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 81 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 82 | else |
| 83 | { |
| 84 | zlog_err ("Can't malloc isis circuit"); |
| 85 | return NULL; |
| 86 | } |
| 87 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 88 | return circuit; |
| 89 | } |
| 90 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 91 | void |
| 92 | isis_circuit_configure (struct isis_circuit *circuit, struct isis_area *area) |
| 93 | { |
| 94 | int i; |
| 95 | circuit->area = area; |
| 96 | /* |
| 97 | * The level for the circuit is same as for the area, unless configured |
| 98 | * otherwise. |
| 99 | */ |
| 100 | circuit->circuit_is_type = area->is_type; |
| 101 | /* |
| 102 | * Default values |
| 103 | */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 104 | for (i = 0; i < 2; i++) |
| 105 | { |
| 106 | circuit->hello_interval[i] = HELLO_INTERVAL; |
| 107 | circuit->hello_multiplier[i] = HELLO_MULTIPLIER; |
| 108 | circuit->csnp_interval[i] = CSNP_INTERVAL; |
| 109 | circuit->psnp_interval[i] = PSNP_INTERVAL; |
| 110 | circuit->u.bc.priority[i] = DEFAULT_PRIORITY; |
| 111 | } |
| 112 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 113 | { |
| 114 | circuit->u.bc.adjdb[0] = list_new (); |
| 115 | circuit->u.bc.adjdb[1] = list_new (); |
| 116 | circuit->u.bc.pad_hellos = 1; |
| 117 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 118 | circuit->lsp_interval = LSP_INTERVAL; |
| 119 | |
| 120 | /* |
| 121 | * Add the circuit into area |
| 122 | */ |
| 123 | listnode_add (area->circuit_list, circuit); |
| 124 | |
| 125 | circuit->idx = flags_get_index (&area->flags); |
| 126 | circuit->lsp_queue = list_new (); |
| 127 | |
| 128 | return; |
| 129 | } |
| 130 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 131 | void |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 132 | isis_circuit_deconfigure (struct isis_circuit *circuit, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 133 | struct isis_area *area) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 134 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 135 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 136 | /* Remove circuit from area */ |
| 137 | listnode_delete (area->circuit_list, circuit); |
| 138 | /* Free the index of SRM and SSN flags */ |
| 139 | flags_free_index (&area->flags, circuit->idx); |
| 140 | |
| 141 | return; |
| 142 | } |
| 143 | |
| 144 | struct isis_circuit * |
| 145 | circuit_lookup_by_ifp (struct interface *ifp, struct list *list) |
| 146 | { |
| 147 | struct isis_circuit *circuit = NULL; |
| 148 | struct listnode *node; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 149 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 150 | if (!list) |
| 151 | return NULL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 152 | |
| 153 | for (node = listhead (list); node; nextnode (node)) |
| 154 | { |
| 155 | circuit = getdata (node); |
| 156 | if (circuit->interface == ifp) |
| 157 | return circuit; |
| 158 | } |
| 159 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 160 | return NULL; |
| 161 | } |
| 162 | |
| 163 | struct isis_circuit * |
| 164 | circuit_scan_by_ifp (struct interface *ifp) |
| 165 | { |
| 166 | struct isis_area *area; |
| 167 | struct listnode *node; |
| 168 | struct isis_circuit *circuit; |
| 169 | |
| 170 | if (!isis->area_list) |
| 171 | return NULL; |
| 172 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 173 | for (node = listhead (isis->area_list); node; nextnode (node)) |
| 174 | { |
| 175 | area = getdata (node); |
| 176 | circuit = circuit_lookup_by_ifp (ifp, area->circuit_list); |
| 177 | if (circuit) |
| 178 | return circuit; |
| 179 | } |
| 180 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 181 | return circuit_lookup_by_ifp (ifp, isis->init_circ_list); |
| 182 | } |
| 183 | |
| 184 | void |
| 185 | isis_circuit_del (struct isis_circuit *circuit) |
| 186 | { |
| 187 | |
| 188 | if (!circuit) |
| 189 | return; |
| 190 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 191 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 192 | { |
| 193 | /* destroy adjacency databases */ |
| 194 | list_delete (circuit->u.bc.adjdb[0]); |
| 195 | list_delete (circuit->u.bc.adjdb[1]); |
| 196 | /* destroy neighbour lists */ |
| 197 | if (circuit->u.bc.lan_neighs[0]) |
| 198 | list_delete (circuit->u.bc.lan_neighs[0]); |
| 199 | if (circuit->u.bc.lan_neighs[1]) |
| 200 | list_delete (circuit->u.bc.lan_neighs[1]); |
| 201 | /* destroy addresses */ |
| 202 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 203 | if (circuit->ip_addrs) |
| 204 | list_delete (circuit->ip_addrs); |
| 205 | #ifdef HAVE_IPV6 |
| 206 | if (circuit->ipv6_link) |
| 207 | list_delete (circuit->ipv6_link); |
| 208 | if (circuit->ipv6_non_link) |
| 209 | list_delete (circuit->ipv6_non_link); |
| 210 | #endif /* HAVE_IPV6 */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 211 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 212 | /* and lastly the circuit itself */ |
| 213 | XFREE (MTYPE_ISIS_CIRCUIT, circuit); |
| 214 | |
| 215 | return; |
| 216 | } |
| 217 | |
| 218 | void |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 219 | isis_circuit_add_addr (struct isis_circuit *circuit, |
| 220 | struct connected *connected) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 221 | { |
| 222 | struct prefix_ipv4 *ipv4; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 223 | u_char buf[BUFSIZ]; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 224 | #ifdef HAVE_IPV6 |
| 225 | struct prefix_ipv6 *ipv6; |
| 226 | #endif /* HAVE_IPV6 */ |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 227 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 228 | if (!circuit->ip_addrs) |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 229 | circuit->ip_addrs = list_new (); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 230 | #ifdef HAVE_IPV6 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 231 | if (!circuit->ipv6_link) |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 232 | circuit->ipv6_link = list_new (); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 233 | if (!circuit->ipv6_non_link) |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 234 | circuit->ipv6_non_link = list_new (); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 235 | #endif /* HAVE_IPV6 */ |
| 236 | |
| 237 | memset (&buf, 0, BUFSIZ); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 238 | if (connected->address->family == AF_INET) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 239 | { |
| 240 | ipv4 = prefix_ipv4_new (); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 241 | ipv4->prefixlen = connected->address->prefixlen; |
| 242 | ipv4->prefix = connected->address->u.prefix4; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 243 | listnode_add (circuit->ip_addrs, ipv4); |
hasso | 0dae85e | 2004-09-26 19:53:47 +0000 | [diff] [blame] | 244 | if (circuit->area) |
| 245 | lsp_regenerate_schedule (circuit->area); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 246 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 247 | #ifdef EXTREME_DEBUG |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 248 | prefix2str (connected->address, buf, BUFSIZ); |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 249 | zlog_debug ("Added IP address %s to circuit %d", buf, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 250 | circuit->circuit_id); |
| 251 | #endif /* EXTREME_DEBUG */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 252 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 253 | #ifdef HAVE_IPV6 |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 254 | if (connected->address->family == AF_INET6) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 255 | { |
| 256 | ipv6 = prefix_ipv6_new (); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 257 | ipv6->prefixlen = connected->address->prefixlen; |
| 258 | ipv6->prefix = connected->address->u.prefix6; |
| 259 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 260 | if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix)) |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 261 | listnode_add (circuit->ipv6_link, ipv6); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 262 | else |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 263 | listnode_add (circuit->ipv6_non_link, ipv6); |
hasso | 0dae85e | 2004-09-26 19:53:47 +0000 | [diff] [blame] | 264 | if (circuit->area) |
| 265 | lsp_regenerate_schedule (circuit->area); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 266 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 267 | #ifdef EXTREME_DEBUG |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 268 | prefix2str (connected->address, buf, BUFSIZ); |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 269 | zlog_debug ("Added IPv6 address %s to circuit %d", buf, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 270 | circuit->circuit_id); |
| 271 | #endif /* EXTREME_DEBUG */ |
| 272 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 273 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 274 | return; |
| 275 | } |
| 276 | |
| 277 | void |
| 278 | isis_circuit_del_addr (struct isis_circuit *circuit, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 279 | struct connected *connected) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 280 | { |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 281 | struct prefix_ipv4 *ipv4, *ip = NULL; |
| 282 | struct listnode *node; |
| 283 | int found = 0; |
| 284 | u_char buf[BUFSIZ]; |
| 285 | #ifdef HAVE_IPV6 |
| 286 | struct prefix_ipv6 *ipv6, *ip6 = NULL; |
| 287 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 288 | |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 289 | memset (&buf, 0, BUFSIZ); |
| 290 | if (connected->address->family == AF_INET) |
| 291 | { |
| 292 | ipv4 = prefix_ipv4_new (); |
| 293 | ipv4->prefixlen = connected->address->prefixlen; |
| 294 | ipv4->prefix = connected->address->u.prefix4; |
| 295 | |
| 296 | for (node = listhead (circuit->ip_addrs); node; nextnode (node)) |
| 297 | { |
| 298 | ip = getdata (node); |
| 299 | if (prefix_same ((struct prefix *) ip, (struct prefix *) &ipv4)) |
| 300 | break; |
| 301 | } |
| 302 | |
| 303 | if (ip) |
| 304 | { |
| 305 | listnode_delete (circuit->ip_addrs, ip); |
hasso | 0dae85e | 2004-09-26 19:53:47 +0000 | [diff] [blame] | 306 | if (circuit->area) |
| 307 | lsp_regenerate_schedule (circuit->area); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 308 | } |
| 309 | else |
| 310 | { |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 311 | prefix2str (connected->address, (char *)buf, BUFSIZ); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 312 | zlog_warn("Nonexitant ip address %s removal attempt from circuit \ |
| 313 | %d", buf, circuit->circuit_id); |
| 314 | } |
| 315 | } |
| 316 | #ifdef HAVE_IPV6 |
| 317 | if (connected->address->family == AF_INET6) |
| 318 | { |
| 319 | ipv6 = prefix_ipv6_new (); |
| 320 | ipv6->prefixlen = connected->address->prefixlen; |
| 321 | ipv6->prefix = connected->address->u.prefix6; |
| 322 | |
| 323 | if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix)) |
| 324 | { |
| 325 | for (node = listhead (circuit->ipv6_link); node; nextnode (node)) |
| 326 | { |
| 327 | ip6 = getdata (node); |
| 328 | if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6)) |
| 329 | break; |
| 330 | } |
| 331 | if (ip6) |
| 332 | { |
| 333 | listnode_delete (circuit->ipv6_link, ip6); |
| 334 | found = 1; |
| 335 | } |
| 336 | } |
| 337 | else |
| 338 | { |
| 339 | for (node = listhead (circuit->ipv6_non_link); node; nextnode (node)) |
| 340 | { |
| 341 | ip6 = getdata (node); |
| 342 | if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6)) |
| 343 | break; |
| 344 | } |
| 345 | if (ip6) |
| 346 | { |
| 347 | listnode_delete (circuit->ipv6_non_link, ip6); |
| 348 | found = 1; |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | if (!found) |
| 353 | { |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 354 | prefix2str (connected->address, (char *)buf, BUFSIZ); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 355 | zlog_warn("Nonexitant ip address %s removal attempt from \ |
| 356 | circuit %d", buf, circuit->circuit_id); |
| 357 | } |
| 358 | else |
hasso | 0dae85e | 2004-09-26 19:53:47 +0000 | [diff] [blame] | 359 | if (circuit->area) |
| 360 | lsp_regenerate_schedule (circuit->area); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 361 | } |
| 362 | #endif /* HAVE_IPV6 */ |
| 363 | return; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | void |
| 367 | isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp) |
| 368 | { |
| 369 | struct listnode *node; |
| 370 | struct connected *conn; |
| 371 | |
| 372 | circuit->interface = ifp; |
| 373 | ifp->info = circuit; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 374 | |
| 375 | circuit->circuit_id = ifp->ifindex % 255; /* FIXME: Why not ? */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 376 | |
| 377 | /* isis_circuit_update_addrs (circuit, ifp); */ |
| 378 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 379 | if (if_is_broadcast (ifp)) |
| 380 | { |
| 381 | circuit->circ_type = CIRCUIT_T_BROADCAST; |
| 382 | /* |
| 383 | * Get the Hardware Address |
| 384 | */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 385 | #ifdef HAVE_SOCKADDR_DL |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 386 | if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN) |
| 387 | zlog_warn ("unsupported link layer"); |
| 388 | else |
| 389 | memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl), |
| 390 | ETH_ALEN); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 391 | #else |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 392 | if (circuit->interface->hw_addr_len != ETH_ALEN) |
| 393 | { |
| 394 | zlog_warn ("unsupported link layer"); |
| 395 | } |
| 396 | else |
| 397 | { |
| 398 | memcpy (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN); |
| 399 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 400 | #ifdef EXTREME_DEGUG |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 401 | zlog_debug ("isis_circuit_if_add: if_id %d, isomtu %d snpa %s", |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 402 | circuit->interface->ifindex, ISO_MTU (circuit), |
| 403 | snpa_print (circuit->u.bc.snpa)); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 404 | |
| 405 | #endif /* EXTREME_DEBUG */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 406 | #endif /* HAVE_SOCKADDR_DL */ |
| 407 | } |
| 408 | else if (if_is_pointopoint (ifp)) |
| 409 | { |
| 410 | circuit->circ_type = CIRCUIT_T_P2P; |
| 411 | } |
| 412 | else |
| 413 | { |
| 414 | zlog_warn ("isis_circuit_if_add: unsupported media"); |
| 415 | } |
| 416 | |
| 417 | for (node = ifp->connected ? listhead (ifp->connected) : NULL; node; |
| 418 | nextnode (node)) |
| 419 | { |
| 420 | conn = getdata (node); |
| 421 | isis_circuit_add_addr (circuit, conn); |
| 422 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 423 | |
| 424 | return; |
| 425 | } |
| 426 | |
| 427 | void |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 428 | isis_circuit_update_params (struct isis_circuit *circuit, |
| 429 | struct interface *ifp) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 430 | { |
| 431 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 432 | |
| 433 | if (circuit->circuit_id != ifp->ifindex) |
| 434 | { |
| 435 | zlog_warn ("changing circuit_id %d->%d", circuit->circuit_id, |
| 436 | ifp->ifindex); |
| 437 | circuit->circuit_id = ifp->ifindex % 255; |
| 438 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 439 | |
| 440 | /* FIXME: Why is this needed? shouldn't we compare to the area's mtu */ |
| 441 | /* Ofer, this was here in case someone changes the mtu (e.g. with ifconfig) |
| 442 | The areas MTU is the minimum of mtu's of circuits in the area |
| 443 | now we can't catch the change |
| 444 | if (circuit->mtu != ifp->mtu) { |
| 445 | zlog_warn ("changing circuit mtu %d->%d", circuit->mtu, |
| 446 | ifp->mtu); |
| 447 | circuit->mtu = ifp->mtu; |
| 448 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 449 | */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 450 | /* |
| 451 | * Get the Hardware Address |
| 452 | */ |
| 453 | #ifdef HAVE_SOCKADDR_DL |
| 454 | if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 455 | zlog_warn ("unsupported link layer"); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 456 | else |
| 457 | memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl), ETH_ALEN); |
| 458 | #else |
| 459 | if (circuit->interface->hw_addr_len != ETH_ALEN) |
| 460 | { |
| 461 | zlog_warn ("unsupported link layer"); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 462 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 463 | else |
| 464 | { |
| 465 | if (memcmp (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN)) |
| 466 | { |
| 467 | zlog_warn ("changing circuit snpa %s->%s", |
| 468 | snpa_print (circuit->u.bc.snpa), |
| 469 | snpa_print (circuit->interface->hw_addr)); |
| 470 | } |
| 471 | } |
| 472 | #endif |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 473 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 474 | if (if_is_broadcast (ifp)) |
| 475 | { |
| 476 | circuit->circ_type = CIRCUIT_T_BROADCAST; |
| 477 | } |
| 478 | else if (if_is_pointopoint (ifp)) |
| 479 | { |
| 480 | circuit->circ_type = CIRCUIT_T_P2P; |
| 481 | } |
| 482 | else |
| 483 | { |
| 484 | zlog_warn ("isis_circuit_update_params: unsupported media"); |
| 485 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 486 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 487 | return; |
| 488 | } |
| 489 | |
| 490 | void |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 491 | isis_circuit_if_del (struct isis_circuit *circuit) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 492 | { |
| 493 | circuit->interface->info = NULL; |
| 494 | circuit->interface = NULL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 495 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 496 | return; |
| 497 | } |
| 498 | |
| 499 | void |
| 500 | isis_circuit_up (struct isis_circuit *circuit) |
| 501 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 502 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 503 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 504 | { |
| 505 | if (circuit->area->min_bcast_mtu == 0 || |
| 506 | ISO_MTU (circuit) < circuit->area->min_bcast_mtu) |
| 507 | circuit->area->min_bcast_mtu = ISO_MTU (circuit); |
| 508 | /* |
| 509 | * ISO 10589 - 8.4.1 Enabling of broadcast circuits |
| 510 | */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 511 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 512 | /* initilizing the hello sending threads |
| 513 | * for a broadcast IF |
| 514 | */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 515 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 516 | /* 8.4.1 a) commence sending of IIH PDUs */ |
| 517 | |
| 518 | if (circuit->circuit_is_type & IS_LEVEL_1) |
| 519 | { |
| 520 | thread_add_event (master, send_lan_l1_hello, circuit, 0); |
| 521 | circuit->u.bc.lan_neighs[0] = list_new (); |
| 522 | } |
| 523 | |
| 524 | if (circuit->circuit_is_type & IS_LEVEL_2) |
| 525 | { |
| 526 | thread_add_event (master, send_lan_l2_hello, circuit, 0); |
| 527 | circuit->u.bc.lan_neighs[1] = list_new (); |
| 528 | } |
| 529 | |
| 530 | /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */ |
| 531 | /* 8.4.1 c) FIXME: listen for ESH PDUs */ |
| 532 | |
| 533 | /* 8.4.1 d) */ |
| 534 | /* dr election will commence in... */ |
| 535 | if (circuit->circuit_is_type & IS_LEVEL_1) |
| 536 | THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1, |
hasso | bf73101 | 2004-09-17 07:59:57 +0000 | [diff] [blame] | 537 | circuit, 2 * circuit->hello_interval[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 538 | if (circuit->circuit_is_type & IS_LEVEL_2) |
| 539 | THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2, |
hasso | bf73101 | 2004-09-17 07:59:57 +0000 | [diff] [blame] | 540 | circuit, 2 * circuit->hello_interval[1]); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 541 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 542 | else |
| 543 | { |
| 544 | /* initializing the hello send threads |
| 545 | * for a ptp IF |
| 546 | */ |
| 547 | thread_add_event (master, send_p2p_hello, circuit, 0); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 548 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 549 | } |
| 550 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 551 | /* initializing PSNP timers */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 552 | if (circuit->circuit_is_type & IS_LEVEL_1) |
| 553 | { |
| 554 | THREAD_TIMER_ON (master, circuit->t_send_psnp[0], send_l1_psnp, circuit, |
| 555 | isis_jitter (circuit->psnp_interval[0], PSNP_JITTER)); |
| 556 | } |
| 557 | |
| 558 | if (circuit->circuit_is_type & IS_LEVEL_2) |
| 559 | { |
| 560 | THREAD_TIMER_ON (master, circuit->t_send_psnp[1], send_l2_psnp, circuit, |
| 561 | isis_jitter (circuit->psnp_interval[1], PSNP_JITTER)); |
| 562 | } |
| 563 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 564 | /* initialize the circuit streams */ |
| 565 | if (circuit->rcv_stream == NULL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 566 | circuit->rcv_stream = stream_new (ISO_MTU (circuit)); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 567 | |
| 568 | if (circuit->snd_stream == NULL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 569 | circuit->snd_stream = stream_new (ISO_MTU (circuit)); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 570 | |
| 571 | /* unified init for circuits */ |
| 572 | isis_sock_init (circuit); |
| 573 | |
| 574 | #ifdef GNU_LINUX |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 575 | THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit, |
| 576 | circuit->fd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 577 | #else |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 578 | THREAD_TIMER_ON (master, circuit->t_read, isis_receive, circuit, |
| 579 | circuit->fd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 580 | #endif |
| 581 | return; |
| 582 | } |
| 583 | |
| 584 | void |
| 585 | isis_circuit_down (struct isis_circuit *circuit) |
| 586 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 587 | /* Cancel all active threads -- FIXME: wrong place */ |
hasso | d70f99e | 2004-02-11 20:26:31 +0000 | [diff] [blame] | 588 | /* HT: Read thread if GNU_LINUX, TIMER thread otherwise. */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 589 | THREAD_OFF (circuit->t_read); |
| 590 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 591 | { |
| 592 | THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[0]); |
| 593 | THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[1]); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 594 | THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[0]); |
| 595 | THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[1]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 596 | } |
| 597 | else if (circuit->circ_type == CIRCUIT_T_P2P) |
| 598 | { |
| 599 | THREAD_TIMER_OFF (circuit->u.p2p.t_send_p2p_hello); |
| 600 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 601 | /* close the socket */ |
| 602 | close (circuit->fd); |
| 603 | |
| 604 | return; |
| 605 | } |
| 606 | |
| 607 | void |
| 608 | circuit_update_nlpids (struct isis_circuit *circuit) |
| 609 | { |
| 610 | circuit->nlpids.count = 0; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 611 | |
| 612 | if (circuit->ip_router) |
| 613 | { |
| 614 | circuit->nlpids.nlpids[0] = NLPID_IP; |
| 615 | circuit->nlpids.count++; |
| 616 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 617 | #ifdef HAVE_IPV6 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 618 | if (circuit->ipv6_router) |
| 619 | { |
| 620 | circuit->nlpids.nlpids[circuit->nlpids.count] = NLPID_IPV6; |
| 621 | circuit->nlpids.count++; |
| 622 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 623 | #endif /* HAVE_IPV6 */ |
| 624 | return; |
| 625 | } |
| 626 | |
| 627 | int |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 628 | isis_interface_config_write (struct vty *vty) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 629 | { |
| 630 | |
| 631 | int write = 0; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 632 | struct listnode *node; |
| 633 | struct listnode *node2; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 634 | struct interface *ifp; |
| 635 | struct isis_area *area; |
| 636 | struct isis_circuit *c; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 637 | int i; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 638 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 639 | LIST_LOOP (iflist, ifp, node) |
| 640 | { |
| 641 | /* IF name */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 642 | vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 643 | write++; |
| 644 | /* IF desc */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 645 | if (ifp->desc) |
| 646 | { |
| 647 | vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE); |
| 648 | write++; |
| 649 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 650 | /* ISIS Circuit */ |
| 651 | LIST_LOOP (isis->area_list, area, node2) |
| 652 | { |
| 653 | c = circuit_lookup_by_ifp (ifp, area->circuit_list); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 654 | if (c) |
| 655 | { |
| 656 | if (c->ip_router) |
| 657 | { |
| 658 | vty_out (vty, " ip router isis %s%s", area->area_tag, |
| 659 | VTY_NEWLINE); |
| 660 | write++; |
| 661 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 662 | #ifdef HAVE_IPV6 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 663 | if (c->ipv6_router) |
| 664 | { |
| 665 | vty_out (vty, " ipv6 router isis %s%s", area->area_tag, |
| 666 | VTY_NEWLINE); |
| 667 | write++; |
| 668 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 669 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 670 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 671 | /* ISIS - circuit type */ |
| 672 | if (c->circuit_is_type == IS_LEVEL_1) |
| 673 | { |
| 674 | vty_out (vty, " isis circuit-type level-1%s", VTY_NEWLINE); |
| 675 | write++; |
| 676 | } |
| 677 | else |
| 678 | { |
| 679 | if (c->circuit_is_type == IS_LEVEL_2) |
| 680 | { |
| 681 | vty_out (vty, " isis circuit-type level-2-only%s", |
| 682 | VTY_NEWLINE); |
| 683 | write++; |
| 684 | } |
| 685 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 686 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 687 | /* ISIS - CSNP interval - FIXME: compare to cisco */ |
| 688 | if (c->csnp_interval[0] == c->csnp_interval[1]) |
| 689 | { |
| 690 | if (c->csnp_interval[0] != CSNP_INTERVAL) |
| 691 | { |
| 692 | vty_out (vty, " isis csnp-interval %d%s", |
| 693 | c->csnp_interval[0], VTY_NEWLINE); |
| 694 | write++; |
| 695 | } |
| 696 | } |
| 697 | else |
| 698 | { |
| 699 | for (i = 0; i < 2; i++) |
| 700 | { |
| 701 | if (c->csnp_interval[1] != CSNP_INTERVAL) |
| 702 | { |
| 703 | vty_out (vty, " isis csnp-interval %d level-%d%s", |
| 704 | c->csnp_interval[1], i + 1, VTY_NEWLINE); |
| 705 | write++; |
| 706 | } |
| 707 | } |
| 708 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 709 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 710 | /* ISIS - Hello padding - Defaults to true so only display if false */ |
| 711 | if (c->circ_type == CIRCUIT_T_BROADCAST && !c->u.bc.pad_hellos) |
| 712 | { |
| 713 | vty_out (vty, " no isis hello padding%s", VTY_NEWLINE); |
| 714 | write++; |
| 715 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 716 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 717 | /* ISIS - Hello interval - FIXME: compare to cisco */ |
| 718 | if (c->hello_interval[0] == c->hello_interval[1]) |
| 719 | { |
| 720 | if (c->hello_interval[0] != HELLO_INTERVAL) |
| 721 | { |
| 722 | vty_out (vty, " isis hello-interval %d%s", |
| 723 | c->hello_interval[0], VTY_NEWLINE); |
| 724 | write++; |
| 725 | } |
| 726 | } |
| 727 | else |
| 728 | { |
| 729 | for (i = 0; i < 2; i++) |
| 730 | { |
| 731 | if (c->hello_interval[i] != HELLO_INTERVAL) |
| 732 | { |
| 733 | if (c->hello_interval[i] == HELLO_MINIMAL) |
| 734 | { |
| 735 | vty_out (vty, |
| 736 | " isis hello-interval minimal level-%d%s", |
| 737 | i + 1, VTY_NEWLINE); |
| 738 | } |
| 739 | else |
| 740 | { |
| 741 | vty_out (vty, " isis hello-interval %d level-%d%s", |
| 742 | c->hello_interval[i], i + 1, VTY_NEWLINE); |
| 743 | } |
| 744 | write++; |
| 745 | } |
| 746 | } |
| 747 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 748 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 749 | /* ISIS - Hello Multiplier */ |
| 750 | if (c->hello_multiplier[0] == c->hello_multiplier[1]) |
| 751 | { |
| 752 | if (c->hello_multiplier[0] != HELLO_MULTIPLIER) |
| 753 | { |
| 754 | vty_out (vty, " isis hello-multiplier %d%s", |
| 755 | c->hello_multiplier[0], VTY_NEWLINE); |
| 756 | write++; |
| 757 | } |
| 758 | } |
| 759 | else |
| 760 | { |
| 761 | for (i = 0; i < 2; i++) |
| 762 | { |
| 763 | if (c->hello_multiplier[i] != HELLO_MULTIPLIER) |
| 764 | { |
| 765 | vty_out (vty, " isis hello-multiplier %d level-%d%s", |
| 766 | c->hello_multiplier[i], i + 1, VTY_NEWLINE); |
| 767 | write++; |
| 768 | } |
| 769 | } |
| 770 | } |
| 771 | /* ISIS - Priority */ |
| 772 | if (c->circ_type == CIRCUIT_T_BROADCAST) |
| 773 | { |
| 774 | if (c->u.bc.priority[0] == c->u.bc.priority[1]) |
| 775 | { |
| 776 | if (c->u.bc.priority[0] != DEFAULT_PRIORITY) |
| 777 | { |
| 778 | vty_out (vty, " isis priority %d%s", |
| 779 | c->u.bc.priority[0], VTY_NEWLINE); |
| 780 | write++; |
| 781 | } |
| 782 | } |
| 783 | else |
| 784 | { |
| 785 | for (i = 0; i < 2; i++) |
| 786 | { |
| 787 | if (c->u.bc.priority[i] != DEFAULT_PRIORITY) |
| 788 | { |
| 789 | vty_out (vty, " isis priority %d level-%d%s", |
| 790 | c->u.bc.priority[i], i + 1, VTY_NEWLINE); |
| 791 | write++; |
| 792 | } |
| 793 | } |
| 794 | } |
| 795 | } |
| 796 | /* ISIS - Metric */ |
| 797 | if (c->metrics[0].metric_default == c->metrics[1].metric_default) |
| 798 | { |
| 799 | if (c->metrics[0].metric_default != DEFAULT_CIRCUIT_METRICS) |
| 800 | { |
| 801 | vty_out (vty, " isis metric %d%s", |
| 802 | c->metrics[0].metric_default, VTY_NEWLINE); |
| 803 | write++; |
| 804 | } |
| 805 | } |
| 806 | else |
| 807 | { |
| 808 | for (i = 0; i < 2; i++) |
| 809 | { |
| 810 | if (c->metrics[i].metric_default != DEFAULT_CIRCUIT_METRICS) |
| 811 | { |
| 812 | vty_out (vty, " isis metric %d level-%d%s", |
| 813 | c->metrics[i].metric_default, i + 1, |
| 814 | VTY_NEWLINE); |
| 815 | write++; |
| 816 | } |
| 817 | } |
| 818 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 819 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 820 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 821 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 822 | vty_out (vty, "!%s", VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 823 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 824 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 825 | return write; |
| 826 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 827 | |
| 828 | DEFUN (ip_router_isis, |
| 829 | ip_router_isis_cmd, |
| 830 | "ip router isis WORD", |
| 831 | "Interface Internet Protocol config commands\n" |
| 832 | "IP router interface commands\n" |
| 833 | "IS-IS Routing for IP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 834 | "Routing process tag\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 835 | { |
| 836 | struct isis_circuit *c; |
| 837 | struct interface *ifp; |
| 838 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 839 | |
| 840 | ifp = (struct interface *) vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 841 | assert (ifp); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 842 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 843 | area = isis_area_lookup (argv[0]); |
| 844 | |
| 845 | /* Prevent more than one circuit per interface */ |
| 846 | if (area) |
| 847 | c = circuit_lookup_by_ifp (ifp, area->circuit_list); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 848 | else |
| 849 | c = NULL; |
| 850 | if (c && (ifp->info != NULL)) |
| 851 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 852 | #ifdef HAVE_IPV6 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 853 | if (c->ipv6_router == 0) |
| 854 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 855 | #endif /* HAVE_IPV6 */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 856 | vty_out (vty, "ISIS circuit is already defined%s", VTY_NEWLINE); |
| 857 | return CMD_WARNING; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 858 | #ifdef HAVE_IPV6 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 859 | } |
| 860 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 861 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 862 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 863 | /* this is here for ciscopability */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 864 | if (!area) |
| 865 | { |
| 866 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 867 | return CMD_WARNING; |
| 868 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 869 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 870 | if (!c) |
| 871 | { |
| 872 | c = circuit_lookup_by_ifp (ifp, isis->init_circ_list); |
| 873 | c = isis_csm_state_change (ISIS_ENABLE, c, area); |
| 874 | c->interface = ifp; /* this is automatic */ |
| 875 | ifp->info = c; /* hardly related to the FSM */ |
| 876 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 877 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 878 | if (!c) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 879 | return CMD_WARNING; |
| 880 | |
| 881 | c->ip_router = 1; |
| 882 | area->ip_circuits++; |
| 883 | circuit_update_nlpids (c); |
| 884 | |
| 885 | vty->node = INTERFACE_NODE; |
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 | |
| 890 | DEFUN (no_ip_router_isis, |
| 891 | no_ip_router_isis_cmd, |
| 892 | "no ip router isis WORD", |
| 893 | NO_STR |
| 894 | "Interface Internet Protocol config commands\n" |
| 895 | "IP router interface commands\n" |
| 896 | "IS-IS Routing for IP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 897 | "Routing process tag\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 898 | { |
| 899 | struct isis_circuit *circuit = NULL; |
| 900 | struct interface *ifp; |
| 901 | struct isis_area *area; |
| 902 | struct listnode *node; |
| 903 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 904 | ifp = (struct interface *) vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 905 | assert (ifp); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 906 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 907 | area = isis_area_lookup (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 908 | if (!area) |
| 909 | { |
| 910 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 911 | return CMD_WARNING; |
| 912 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 913 | LIST_LOOP (area->circuit_list, circuit, node) |
| 914 | if (circuit->interface == ifp) |
| 915 | break; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 916 | if (!circuit) |
| 917 | { |
| 918 | vty_out (vty, "Can't find ISIS interface %s", VTY_NEWLINE); |
| 919 | return CMD_WARNING; |
| 920 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 921 | circuit->ip_router = 0; |
| 922 | area->ip_circuits--; |
| 923 | #ifdef HAVE_IPV6 |
| 924 | if (circuit->ipv6_router == 0) |
| 925 | #endif |
| 926 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 927 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 928 | return CMD_SUCCESS; |
| 929 | } |
| 930 | |
| 931 | DEFUN (isis_circuit_type, |
| 932 | isis_circuit_type_cmd, |
| 933 | "isis circuit-type (level-1|level-1-2|level-2-only)", |
| 934 | "IS-IS commands\n" |
| 935 | "Configure circuit type for interface\n" |
| 936 | "Level-1 only adjacencies are formed\n" |
| 937 | "Level-1-2 adjacencies are formed\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 938 | "Level-2 only adjacencies are formed\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 939 | { |
| 940 | struct isis_circuit *circuit; |
| 941 | struct interface *ifp; |
| 942 | int circuit_t; |
| 943 | int is_type; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 944 | |
| 945 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 946 | circuit = ifp->info; |
| 947 | /* UGLY - will remove l8r */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 948 | if (circuit == NULL) |
| 949 | { |
| 950 | return CMD_WARNING; |
| 951 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 952 | |
hasso | 13c48f7 | 2004-09-10 21:19:13 +0000 | [diff] [blame] | 953 | /* XXX what to do when ip_router_isis is not executed */ |
| 954 | if (circuit->area == NULL) |
| 955 | return CMD_WARNING; |
| 956 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 957 | assert (circuit); |
| 958 | |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 959 | circuit_t = string2circuit_t ((u_char *)argv[0]); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 960 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 961 | if (!circuit_t) |
| 962 | { |
| 963 | vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE); |
| 964 | return CMD_SUCCESS; |
| 965 | } |
| 966 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 967 | is_type = circuit->area->is_type; |
| 968 | if (is_type == IS_LEVEL_1_AND_2 || is_type == circuit_t) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 969 | isis_event_circuit_type_change (circuit, circuit_t); |
| 970 | else |
| 971 | { |
| 972 | vty_out (vty, "invalid circuit level for area %s.%s", |
| 973 | circuit->area->area_tag, VTY_NEWLINE); |
| 974 | } |
| 975 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 976 | return CMD_SUCCESS; |
| 977 | } |
| 978 | |
| 979 | DEFUN (no_isis_circuit_type, |
| 980 | no_isis_circuit_type_cmd, |
| 981 | "no isis circuit-type (level-1|level-1-2|level-2-only)", |
| 982 | NO_STR |
| 983 | "IS-IS commands\n" |
| 984 | "Configure circuit type for interface\n" |
| 985 | "Level-1 only adjacencies are formed\n" |
| 986 | "Level-1-2 adjacencies are formed\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 987 | "Level-2 only adjacencies are formed\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 988 | { |
| 989 | struct isis_circuit *circuit; |
| 990 | struct interface *ifp; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 991 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 992 | ifp = vty->index; |
| 993 | circuit = ifp->info; |
| 994 | if (circuit == NULL) |
| 995 | { |
| 996 | return CMD_WARNING; |
| 997 | } |
| 998 | |
| 999 | assert (circuit); |
| 1000 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1001 | /* |
| 1002 | * Set the circuits level to its default value which is that of the area |
| 1003 | */ |
| 1004 | isis_event_circuit_type_change (circuit, circuit->area->is_type); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1005 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1006 | return CMD_SUCCESS; |
| 1007 | } |
| 1008 | |
| 1009 | DEFUN (isis_passwd, |
| 1010 | isis_passwd_cmd, |
| 1011 | "isis password WORD", |
| 1012 | "IS-IS commands\n" |
| 1013 | "Configure the authentication password for interface\n" |
| 1014 | "Password\n") |
| 1015 | { |
| 1016 | struct isis_circuit *circuit; |
| 1017 | struct interface *ifp; |
| 1018 | int len; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1019 | |
| 1020 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1021 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1022 | if (circuit == NULL) |
| 1023 | { |
| 1024 | return CMD_WARNING; |
| 1025 | } |
| 1026 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1027 | len = strlen (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1028 | if (len > 254) |
| 1029 | { |
| 1030 | vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE); |
| 1031 | return CMD_WARNING; |
| 1032 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1033 | circuit->passwd.len = len; |
| 1034 | circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT; |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 1035 | strncpy ((char *)circuit->passwd.passwd, argv[0], 255); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1036 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1037 | return CMD_SUCCESS; |
| 1038 | } |
| 1039 | |
| 1040 | DEFUN (no_isis_passwd, |
| 1041 | no_isis_passwd_cmd, |
| 1042 | "no isis password", |
| 1043 | NO_STR |
| 1044 | "IS-IS commands\n" |
| 1045 | "Configure the authentication password for interface\n") |
| 1046 | { |
| 1047 | struct isis_circuit *circuit; |
| 1048 | struct interface *ifp; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1049 | |
| 1050 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1051 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1052 | if (circuit == NULL) |
| 1053 | { |
| 1054 | return CMD_WARNING; |
| 1055 | } |
| 1056 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1057 | memset (&circuit->passwd, 0, sizeof (struct isis_passwd)); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1058 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1059 | return CMD_SUCCESS; |
| 1060 | } |
| 1061 | |
| 1062 | |
| 1063 | DEFUN (isis_priority, |
| 1064 | isis_priority_cmd, |
| 1065 | "isis priority <0-127>", |
| 1066 | "IS-IS commands\n" |
| 1067 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1068 | "Priority value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1069 | { |
| 1070 | struct isis_circuit *circuit; |
| 1071 | struct interface *ifp; |
| 1072 | int prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1073 | |
| 1074 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1075 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1076 | if (circuit == NULL) |
| 1077 | { |
| 1078 | return CMD_WARNING; |
| 1079 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1080 | assert (circuit); |
| 1081 | |
| 1082 | prio = atoi (argv[0]); |
| 1083 | |
| 1084 | circuit->u.bc.priority[0] = prio; |
| 1085 | circuit->u.bc.priority[1] = prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1086 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1087 | return CMD_SUCCESS; |
| 1088 | } |
| 1089 | |
| 1090 | DEFUN (no_isis_priority, |
| 1091 | no_isis_priority_cmd, |
| 1092 | "no isis priority", |
| 1093 | NO_STR |
| 1094 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1095 | "Set priority for Designated Router election\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1096 | { |
| 1097 | struct isis_circuit *circuit; |
| 1098 | struct interface *ifp; |
| 1099 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1100 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1101 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1102 | if (circuit == NULL) |
| 1103 | { |
| 1104 | return CMD_WARNING; |
| 1105 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1106 | assert (circuit); |
| 1107 | |
| 1108 | circuit->u.bc.priority[0] = DEFAULT_PRIORITY; |
| 1109 | circuit->u.bc.priority[1] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1110 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1111 | return CMD_SUCCESS; |
| 1112 | } |
| 1113 | |
| 1114 | ALIAS (no_isis_priority, |
| 1115 | no_isis_priority_arg_cmd, |
| 1116 | "no isis priority <0-127>", |
| 1117 | NO_STR |
| 1118 | "IS-IS commands\n" |
| 1119 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1120 | "Priority value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1121 | |
| 1122 | DEFUN (isis_priority_l1, |
| 1123 | isis_priority_l1_cmd, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1124 | "isis priority <0-127> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1125 | "IS-IS commands\n" |
| 1126 | "Set priority for Designated Router election\n" |
| 1127 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1128 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1129 | { |
| 1130 | struct isis_circuit *circuit; |
| 1131 | struct interface *ifp; |
| 1132 | int prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1133 | |
| 1134 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1135 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1136 | if (circuit == NULL) |
| 1137 | { |
| 1138 | return CMD_WARNING; |
| 1139 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1140 | assert (circuit); |
| 1141 | |
| 1142 | prio = atoi (argv[0]); |
| 1143 | |
| 1144 | circuit->u.bc.priority[0] = prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1145 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1146 | return CMD_SUCCESS; |
| 1147 | } |
| 1148 | |
| 1149 | DEFUN (no_isis_priority_l1, |
| 1150 | no_isis_priority_l1_cmd, |
| 1151 | "no isis priority level-1", |
| 1152 | NO_STR |
| 1153 | "IS-IS commands\n" |
| 1154 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1155 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1156 | { |
| 1157 | struct isis_circuit *circuit; |
| 1158 | struct interface *ifp; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1159 | |
| 1160 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1161 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1162 | if (circuit == NULL) |
| 1163 | { |
| 1164 | return CMD_WARNING; |
| 1165 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1166 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1167 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1168 | circuit->u.bc.priority[0] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1169 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1170 | return CMD_SUCCESS; |
| 1171 | } |
| 1172 | |
| 1173 | ALIAS (no_isis_priority_l1, |
| 1174 | no_isis_priority_l1_arg_cmd, |
| 1175 | "no isis priority <0-127> level-1", |
| 1176 | NO_STR |
| 1177 | "IS-IS commands\n" |
| 1178 | "Set priority for Designated Router election\n" |
| 1179 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1180 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1181 | |
| 1182 | DEFUN (isis_priority_l2, |
| 1183 | isis_priority_l2_cmd, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1184 | "isis priority <0-127> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1185 | "IS-IS commands\n" |
| 1186 | "Set priority for Designated Router election\n" |
| 1187 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1188 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1189 | { |
| 1190 | struct isis_circuit *circuit; |
| 1191 | struct interface *ifp; |
| 1192 | int prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1193 | |
| 1194 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1195 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1196 | if (circuit == NULL) |
| 1197 | { |
| 1198 | return CMD_WARNING; |
| 1199 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1200 | assert (circuit); |
| 1201 | |
| 1202 | prio = atoi (argv[0]); |
| 1203 | |
| 1204 | circuit->u.bc.priority[1] = prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1205 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1206 | return CMD_SUCCESS; |
| 1207 | } |
| 1208 | |
| 1209 | DEFUN (no_isis_priority_l2, |
| 1210 | no_isis_priority_l2_cmd, |
| 1211 | "no isis priority level-2", |
| 1212 | NO_STR |
| 1213 | "IS-IS commands\n" |
| 1214 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1215 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1216 | { |
| 1217 | struct isis_circuit *circuit; |
| 1218 | struct interface *ifp; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1219 | |
| 1220 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1221 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1222 | if (circuit == NULL) |
| 1223 | { |
| 1224 | return CMD_WARNING; |
| 1225 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1226 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1227 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1228 | circuit->u.bc.priority[1] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1229 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1230 | return CMD_SUCCESS; |
| 1231 | } |
| 1232 | |
| 1233 | ALIAS (no_isis_priority_l2, |
| 1234 | no_isis_priority_l2_arg_cmd, |
| 1235 | "no isis priority <0-127> level-2", |
| 1236 | NO_STR |
| 1237 | "IS-IS commands\n" |
| 1238 | "Set priority for Designated Router election\n" |
| 1239 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1240 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1241 | |
| 1242 | /* Metric command */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1243 | DEFUN (isis_metric, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1244 | isis_metric_cmd, |
| 1245 | "isis metric <0-63>", |
| 1246 | "IS-IS commands\n" |
| 1247 | "Set default metric for circuit\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1248 | "Default metric value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1249 | { |
| 1250 | struct isis_circuit *circuit; |
| 1251 | struct interface *ifp; |
| 1252 | int met; |
| 1253 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1254 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1255 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1256 | if (circuit == NULL) |
| 1257 | { |
| 1258 | return CMD_WARNING; |
| 1259 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1260 | assert (circuit); |
| 1261 | |
| 1262 | met = atoi (argv[0]); |
| 1263 | |
| 1264 | circuit->metrics[0].metric_default = met; |
| 1265 | circuit->metrics[1].metric_default = met; |
| 1266 | |
| 1267 | return CMD_SUCCESS; |
| 1268 | } |
| 1269 | |
| 1270 | DEFUN (no_isis_metric, |
| 1271 | no_isis_metric_cmd, |
| 1272 | "no isis metric", |
| 1273 | NO_STR |
| 1274 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1275 | "Set default metric for circuit\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1276 | { |
| 1277 | struct isis_circuit *circuit; |
| 1278 | struct interface *ifp; |
| 1279 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1280 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1281 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1282 | if (circuit == NULL) |
| 1283 | { |
| 1284 | return CMD_WARNING; |
| 1285 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1286 | assert (circuit); |
| 1287 | |
| 1288 | circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRICS; |
| 1289 | circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRICS; |
| 1290 | |
| 1291 | return CMD_SUCCESS; |
| 1292 | } |
| 1293 | |
| 1294 | ALIAS (no_isis_metric, |
| 1295 | no_isis_metric_arg_cmd, |
| 1296 | "no isis metric <0-127>", |
| 1297 | NO_STR |
| 1298 | "IS-IS commands\n" |
| 1299 | "Set default metric for circuit\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1300 | "Default metric value\n") |
| 1301 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1302 | /* end of metrics */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1303 | DEFUN (isis_hello_interval, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1304 | isis_hello_interval_cmd, |
| 1305 | "isis hello-interval (<1-65535>|minimal)", |
| 1306 | "IS-IS commands\n" |
| 1307 | "Set Hello interval\n" |
| 1308 | "Hello interval value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1309 | "Holdtime 1 seconds, interval depends on multiplier\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1310 | { |
| 1311 | struct isis_circuit *circuit; |
| 1312 | struct interface *ifp; |
| 1313 | int interval; |
| 1314 | char c; |
| 1315 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1316 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1317 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1318 | if (circuit == NULL) |
| 1319 | { |
| 1320 | return CMD_WARNING; |
| 1321 | } |
| 1322 | assert (circuit); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1323 | c = *argv[0]; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1324 | if (isdigit ((int) c)) |
| 1325 | { |
| 1326 | interval = atoi (argv[0]); |
| 1327 | } |
| 1328 | else |
| 1329 | interval = HELLO_MINIMAL; /* FIXME: should be calculated */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1330 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1331 | circuit->hello_interval[0] = (u_int16_t) interval; |
| 1332 | circuit->hello_interval[1] = (u_int16_t) interval; |
| 1333 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1334 | return CMD_SUCCESS; |
| 1335 | } |
| 1336 | |
| 1337 | DEFUN (no_isis_hello_interval, |
| 1338 | no_isis_hello_interval_cmd, |
| 1339 | "no isis hello-interval", |
| 1340 | NO_STR |
| 1341 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1342 | "Set Hello interval\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1343 | { |
| 1344 | struct isis_circuit *circuit; |
| 1345 | struct interface *ifp; |
| 1346 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1347 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1348 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1349 | if (circuit == NULL) |
| 1350 | { |
| 1351 | return CMD_WARNING; |
| 1352 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1353 | assert (circuit); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1354 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1355 | |
| 1356 | circuit->hello_interval[0] = HELLO_INTERVAL; /* Default is 1 sec. */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1357 | circuit->hello_interval[1] = HELLO_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1358 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1359 | return CMD_SUCCESS; |
| 1360 | } |
| 1361 | |
| 1362 | ALIAS (no_isis_hello_interval, |
| 1363 | no_isis_hello_interval_arg_cmd, |
| 1364 | "no isis hello-interval (<1-65535>|minimal)", |
| 1365 | NO_STR |
| 1366 | "IS-IS commands\n" |
| 1367 | "Set Hello interval\n" |
| 1368 | "Hello interval value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1369 | "Holdtime 1 second, interval depends on multiplier\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1370 | |
| 1371 | DEFUN (isis_hello_interval_l1, |
| 1372 | isis_hello_interval_l1_cmd, |
| 1373 | "isis hello-interval (<1-65535>|minimal) level-1", |
| 1374 | "IS-IS commands\n" |
| 1375 | "Set Hello interval\n" |
| 1376 | "Hello interval value\n" |
| 1377 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1378 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1379 | { |
| 1380 | struct isis_circuit *circuit; |
| 1381 | struct interface *ifp; |
| 1382 | long interval; |
| 1383 | char c; |
| 1384 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1385 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1386 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1387 | if (circuit == NULL) |
| 1388 | { |
| 1389 | return CMD_WARNING; |
| 1390 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1391 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1392 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1393 | c = *argv[0]; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1394 | if (isdigit ((int) c)) |
| 1395 | { |
| 1396 | interval = atoi (argv[0]); |
| 1397 | } |
| 1398 | else |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1399 | interval = HELLO_MINIMAL; |
| 1400 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1401 | circuit->hello_interval[0] = (u_int16_t) interval; |
| 1402 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1403 | return CMD_SUCCESS; |
| 1404 | } |
| 1405 | |
| 1406 | DEFUN (no_isis_hello_interval_l1, |
| 1407 | no_isis_hello_interval_l1_cmd, |
| 1408 | "no isis hello-interval level-1", |
| 1409 | NO_STR |
| 1410 | "IS-IS commands\n" |
| 1411 | "Set Hello interval\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1412 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1413 | { |
| 1414 | struct isis_circuit *circuit; |
| 1415 | struct interface *ifp; |
| 1416 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1417 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1418 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1419 | if (circuit == NULL) |
| 1420 | { |
| 1421 | return CMD_WARNING; |
| 1422 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1423 | assert (circuit); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1424 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1425 | |
| 1426 | circuit->hello_interval[0] = HELLO_INTERVAL; /* Default is 1 sec. */ |
| 1427 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1428 | return CMD_SUCCESS; |
| 1429 | } |
| 1430 | |
| 1431 | ALIAS (no_isis_hello_interval_l1, |
| 1432 | no_isis_hello_interval_l1_arg_cmd, |
| 1433 | "no isis hello-interval (<1-65535>|minimal) level-1", |
| 1434 | NO_STR |
| 1435 | "IS-IS commands\n" |
| 1436 | "Set Hello interval\n" |
| 1437 | "Hello interval value\n" |
| 1438 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1439 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1440 | |
| 1441 | DEFUN (isis_hello_interval_l2, |
| 1442 | isis_hello_interval_l2_cmd, |
| 1443 | "isis hello-interval (<1-65535>|minimal) level-2", |
| 1444 | "IS-IS commands\n" |
| 1445 | "Set Hello interval\n" |
| 1446 | "Hello interval value\n" |
| 1447 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1448 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1449 | { |
| 1450 | struct isis_circuit *circuit; |
| 1451 | struct interface *ifp; |
| 1452 | long interval; |
| 1453 | char c; |
| 1454 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1455 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1456 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1457 | if (circuit == NULL) |
| 1458 | { |
| 1459 | return CMD_WARNING; |
| 1460 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1461 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1462 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1463 | c = *argv[0]; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1464 | if (isdigit ((int) c)) |
| 1465 | { |
| 1466 | interval = atoi (argv[0]); |
| 1467 | } |
| 1468 | else |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1469 | interval = HELLO_MINIMAL; |
| 1470 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1471 | circuit->hello_interval[1] = (u_int16_t) interval; |
| 1472 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1473 | return CMD_SUCCESS; |
| 1474 | } |
| 1475 | |
| 1476 | DEFUN (no_isis_hello_interval_l2, |
| 1477 | no_isis_hello_interval_l2_cmd, |
| 1478 | "no isis hello-interval level-2", |
| 1479 | NO_STR |
| 1480 | "IS-IS commands\n" |
| 1481 | "Set Hello interval\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1482 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1483 | { |
| 1484 | struct isis_circuit *circuit; |
| 1485 | struct interface *ifp; |
| 1486 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1487 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1488 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1489 | if (circuit == NULL) |
| 1490 | { |
| 1491 | return CMD_WARNING; |
| 1492 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1493 | assert (circuit); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1494 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1495 | |
| 1496 | circuit->hello_interval[1] = HELLO_INTERVAL; /* Default is 1 sec. */ |
| 1497 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1498 | return CMD_SUCCESS; |
| 1499 | } |
| 1500 | |
| 1501 | ALIAS (no_isis_hello_interval_l2, |
| 1502 | no_isis_hello_interval_l2_arg_cmd, |
| 1503 | "no isis hello-interval (<1-65535>|minimal) level-2", |
| 1504 | NO_STR |
| 1505 | "IS-IS commands\n" |
| 1506 | "Set Hello interval\n" |
| 1507 | "Hello interval value\n" |
| 1508 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1509 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1510 | |
| 1511 | DEFUN (isis_hello_multiplier, |
| 1512 | isis_hello_multiplier_cmd, |
| 1513 | "isis hello-multiplier <3-1000>", |
| 1514 | "IS-IS commands\n" |
| 1515 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1516 | "Hello multiplier value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1517 | { |
| 1518 | struct isis_circuit *circuit; |
| 1519 | struct interface *ifp; |
| 1520 | int mult; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1521 | |
| 1522 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1523 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1524 | if (circuit == NULL) |
| 1525 | { |
| 1526 | return CMD_WARNING; |
| 1527 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1528 | assert (circuit); |
| 1529 | |
| 1530 | mult = atoi (argv[0]); |
| 1531 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1532 | circuit->hello_multiplier[0] = (u_int16_t) mult; |
| 1533 | circuit->hello_multiplier[1] = (u_int16_t) mult; |
| 1534 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1535 | return CMD_SUCCESS; |
| 1536 | } |
| 1537 | |
| 1538 | DEFUN (no_isis_hello_multiplier, |
| 1539 | no_isis_hello_multiplier_cmd, |
| 1540 | "no isis hello-multiplier", |
| 1541 | NO_STR |
| 1542 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1543 | "Set multiplier for Hello holding time\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1544 | { |
| 1545 | struct isis_circuit *circuit; |
| 1546 | struct interface *ifp; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1547 | |
| 1548 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1549 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1550 | if (circuit == NULL) |
| 1551 | { |
| 1552 | return CMD_WARNING; |
| 1553 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1554 | assert (circuit); |
| 1555 | |
| 1556 | circuit->hello_multiplier[0] = HELLO_MULTIPLIER; |
| 1557 | circuit->hello_multiplier[1] = HELLO_MULTIPLIER; |
| 1558 | |
| 1559 | return CMD_SUCCESS; |
| 1560 | } |
| 1561 | |
| 1562 | ALIAS (no_isis_hello_multiplier, |
| 1563 | no_isis_hello_multiplier_arg_cmd, |
| 1564 | "no isis hello-multiplier <3-1000>", |
| 1565 | NO_STR |
| 1566 | "IS-IS commands\n" |
| 1567 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1568 | "Hello multiplier value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1569 | |
| 1570 | DEFUN (isis_hello_multiplier_l1, |
| 1571 | isis_hello_multiplier_l1_cmd, |
| 1572 | "isis hello-multiplier <3-1000> level-1", |
| 1573 | "IS-IS commands\n" |
| 1574 | "Set multiplier for Hello holding time\n" |
| 1575 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1576 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1577 | { |
| 1578 | struct isis_circuit *circuit; |
| 1579 | struct interface *ifp; |
| 1580 | int mult; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1581 | |
| 1582 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1583 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1584 | if (circuit == NULL) |
| 1585 | { |
| 1586 | return CMD_WARNING; |
| 1587 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1588 | assert (circuit); |
| 1589 | |
| 1590 | mult = atoi (argv[0]); |
| 1591 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1592 | circuit->hello_multiplier[0] = (u_int16_t) mult; |
| 1593 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1594 | return CMD_SUCCESS; |
| 1595 | } |
| 1596 | |
| 1597 | DEFUN (no_isis_hello_multiplier_l1, |
| 1598 | no_isis_hello_multiplier_l1_cmd, |
| 1599 | "no isis hello-multiplier level-1", |
| 1600 | NO_STR |
| 1601 | "IS-IS commands\n" |
| 1602 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1603 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1604 | { |
| 1605 | struct isis_circuit *circuit; |
| 1606 | struct interface *ifp; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1607 | |
| 1608 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1609 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1610 | if (circuit == NULL) |
| 1611 | { |
| 1612 | return CMD_WARNING; |
| 1613 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1614 | assert (circuit); |
| 1615 | |
| 1616 | circuit->hello_multiplier[0] = HELLO_MULTIPLIER; |
| 1617 | |
| 1618 | return CMD_SUCCESS; |
| 1619 | } |
| 1620 | |
| 1621 | ALIAS (no_isis_hello_multiplier_l1, |
| 1622 | no_isis_hello_multiplier_l1_arg_cmd, |
| 1623 | "no isis hello-multiplier <3-1000> level-1", |
| 1624 | NO_STR |
| 1625 | "IS-IS commands\n" |
| 1626 | "Set multiplier for Hello holding time\n" |
| 1627 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1628 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1629 | |
| 1630 | DEFUN (isis_hello_multiplier_l2, |
| 1631 | isis_hello_multiplier_l2_cmd, |
| 1632 | "isis hello-multiplier <3-1000> level-2", |
| 1633 | "IS-IS commands\n" |
| 1634 | "Set multiplier for Hello holding time\n" |
| 1635 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1636 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1637 | { |
| 1638 | struct isis_circuit *circuit; |
| 1639 | struct interface *ifp; |
| 1640 | int mult; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1641 | |
| 1642 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1643 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1644 | if (circuit == NULL) |
| 1645 | { |
| 1646 | return CMD_WARNING; |
| 1647 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1648 | assert (circuit); |
| 1649 | |
| 1650 | mult = atoi (argv[0]); |
| 1651 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1652 | circuit->hello_multiplier[1] = (u_int16_t) mult; |
| 1653 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1654 | return CMD_SUCCESS; |
| 1655 | } |
| 1656 | |
| 1657 | DEFUN (no_isis_hello_multiplier_l2, |
| 1658 | no_isis_hello_multiplier_l2_cmd, |
| 1659 | "no isis hello-multiplier level-2", |
| 1660 | NO_STR |
| 1661 | "IS-IS commands\n" |
| 1662 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1663 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1664 | { |
| 1665 | struct isis_circuit *circuit; |
| 1666 | struct interface *ifp; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1667 | |
| 1668 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1669 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1670 | if (circuit == NULL) |
| 1671 | { |
| 1672 | return CMD_WARNING; |
| 1673 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1674 | assert (circuit); |
| 1675 | |
| 1676 | circuit->hello_multiplier[1] = HELLO_MULTIPLIER; |
| 1677 | |
| 1678 | return CMD_SUCCESS; |
| 1679 | } |
| 1680 | |
| 1681 | ALIAS (no_isis_hello_multiplier_l2, |
| 1682 | no_isis_hello_multiplier_l2_arg_cmd, |
| 1683 | "no isis hello-multiplier <3-1000> level-2", |
| 1684 | NO_STR |
| 1685 | "IS-IS commands\n" |
| 1686 | "Set multiplier for Hello holding time\n" |
| 1687 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1688 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1689 | |
| 1690 | DEFUN (isis_hello, |
| 1691 | isis_hello_cmd, |
| 1692 | "isis hello padding", |
| 1693 | "IS-IS commands\n" |
| 1694 | "Add padding to IS-IS hello packets\n" |
| 1695 | "Pad hello packets\n" |
| 1696 | "<cr>\n") |
| 1697 | { |
| 1698 | struct interface *ifp; |
| 1699 | struct isis_circuit *circuit; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1700 | |
| 1701 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1702 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1703 | if (circuit == NULL) |
| 1704 | { |
| 1705 | return CMD_WARNING; |
| 1706 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1707 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1708 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1709 | circuit->u.bc.pad_hellos = 1; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1710 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1711 | return CMD_SUCCESS; |
| 1712 | } |
| 1713 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1714 | DEFUN (no_isis_hello, |
| 1715 | no_isis_hello_cmd, |
| 1716 | "no isis hello padding", |
| 1717 | NO_STR |
| 1718 | "IS-IS commands\n" |
| 1719 | "Add padding to IS-IS hello packets\n" |
| 1720 | "Pad hello packets\n" |
| 1721 | "<cr>\n") |
| 1722 | { |
| 1723 | struct isis_circuit *circuit; |
| 1724 | struct interface *ifp; |
| 1725 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1726 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1727 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1728 | if (circuit == NULL) |
| 1729 | { |
| 1730 | return CMD_WARNING; |
| 1731 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1732 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1733 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1734 | circuit->u.bc.pad_hellos = 0; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1735 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1736 | return CMD_SUCCESS; |
| 1737 | } |
| 1738 | |
| 1739 | DEFUN (csnp_interval, |
| 1740 | csnp_interval_cmd, |
| 1741 | "isis csnp-interval <0-65535>", |
| 1742 | "IS-IS commands\n" |
| 1743 | "Set CSNP interval in seconds\n" |
| 1744 | "CSNP interval value\n") |
| 1745 | { |
| 1746 | struct isis_circuit *circuit; |
| 1747 | struct interface *ifp; |
| 1748 | unsigned long interval; |
| 1749 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1750 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1751 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1752 | if (circuit == NULL) |
| 1753 | { |
| 1754 | return CMD_WARNING; |
| 1755 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1756 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1757 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1758 | interval = atol (argv[0]); |
| 1759 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1760 | circuit->csnp_interval[0] = (u_int16_t) interval; |
| 1761 | circuit->csnp_interval[1] = (u_int16_t) interval; |
| 1762 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1763 | return CMD_SUCCESS; |
| 1764 | } |
| 1765 | |
| 1766 | DEFUN (no_csnp_interval, |
| 1767 | no_csnp_interval_cmd, |
| 1768 | "no isis csnp-interval", |
| 1769 | NO_STR |
| 1770 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1771 | "Set CSNP interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1772 | { |
| 1773 | struct isis_circuit *circuit; |
| 1774 | struct interface *ifp; |
| 1775 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1776 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1777 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1778 | if (circuit == NULL) |
| 1779 | { |
| 1780 | return CMD_WARNING; |
| 1781 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1782 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1783 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1784 | circuit->csnp_interval[0] = CSNP_INTERVAL; |
| 1785 | circuit->csnp_interval[1] = CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1786 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1787 | return CMD_SUCCESS; |
| 1788 | } |
| 1789 | |
| 1790 | ALIAS (no_csnp_interval, |
| 1791 | no_csnp_interval_arg_cmd, |
| 1792 | "no isis csnp-interval <0-65535>", |
| 1793 | NO_STR |
| 1794 | "IS-IS commands\n" |
| 1795 | "Set CSNP interval in seconds\n" |
| 1796 | "CSNP interval value\n") |
| 1797 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1798 | DEFUN (csnp_interval_l1, |
| 1799 | csnp_interval_l1_cmd, |
| 1800 | "isis csnp-interval <0-65535> level-1", |
| 1801 | "IS-IS commands\n" |
| 1802 | "Set CSNP interval in seconds\n" |
| 1803 | "CSNP interval value\n" |
| 1804 | "Specify interval for level-1 CSNPs\n") |
| 1805 | { |
| 1806 | struct isis_circuit *circuit; |
| 1807 | struct interface *ifp; |
| 1808 | unsigned long interval; |
| 1809 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1810 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1811 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1812 | if (circuit == NULL) |
| 1813 | { |
| 1814 | return CMD_WARNING; |
| 1815 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1816 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1817 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1818 | interval = atol (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1819 | |
| 1820 | circuit->csnp_interval[0] = (u_int16_t) interval; |
| 1821 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1822 | return CMD_SUCCESS; |
| 1823 | } |
| 1824 | |
| 1825 | DEFUN (no_csnp_interval_l1, |
| 1826 | no_csnp_interval_l1_cmd, |
| 1827 | "no isis csnp-interval level-1", |
| 1828 | NO_STR |
| 1829 | "IS-IS commands\n" |
| 1830 | "Set CSNP interval in seconds\n" |
| 1831 | "Specify interval for level-1 CSNPs\n") |
| 1832 | { |
| 1833 | struct isis_circuit *circuit; |
| 1834 | struct interface *ifp; |
| 1835 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1836 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1837 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1838 | if (circuit == NULL) |
| 1839 | { |
| 1840 | return CMD_WARNING; |
| 1841 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1842 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1843 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1844 | circuit->csnp_interval[0] = CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1845 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1846 | return CMD_SUCCESS; |
| 1847 | } |
| 1848 | |
| 1849 | ALIAS (no_csnp_interval_l1, |
| 1850 | no_csnp_interval_l1_arg_cmd, |
| 1851 | "no isis csnp-interval <0-65535> level-1", |
| 1852 | NO_STR |
| 1853 | "IS-IS commands\n" |
| 1854 | "Set CSNP interval in seconds\n" |
| 1855 | "CSNP interval value\n" |
| 1856 | "Specify interval for level-1 CSNPs\n") |
| 1857 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1858 | DEFUN (csnp_interval_l2, |
| 1859 | csnp_interval_l2_cmd, |
| 1860 | "isis csnp-interval <0-65535> level-2", |
| 1861 | "IS-IS commands\n" |
| 1862 | "Set CSNP interval in seconds\n" |
| 1863 | "CSNP interval value\n" |
| 1864 | "Specify interval for level-2 CSNPs\n") |
| 1865 | { |
| 1866 | struct isis_circuit *circuit; |
| 1867 | struct interface *ifp; |
| 1868 | unsigned long interval; |
| 1869 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1870 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1871 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1872 | if (circuit == NULL) |
| 1873 | { |
| 1874 | return CMD_WARNING; |
| 1875 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1876 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1877 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1878 | interval = atol (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1879 | |
| 1880 | circuit->csnp_interval[1] = (u_int16_t) interval; |
| 1881 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1882 | return CMD_SUCCESS; |
| 1883 | } |
| 1884 | |
| 1885 | DEFUN (no_csnp_interval_l2, |
| 1886 | no_csnp_interval_l2_cmd, |
| 1887 | "no isis csnp-interval level-2", |
| 1888 | NO_STR |
| 1889 | "IS-IS commands\n" |
| 1890 | "Set CSNP interval in seconds\n" |
| 1891 | "Specify interval for level-2 CSNPs\n") |
| 1892 | { |
| 1893 | struct isis_circuit *circuit; |
| 1894 | struct interface *ifp; |
| 1895 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1896 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1897 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1898 | if (circuit == NULL) |
| 1899 | { |
| 1900 | return CMD_WARNING; |
| 1901 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1902 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1903 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1904 | circuit->csnp_interval[1] = CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1905 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1906 | return CMD_SUCCESS; |
| 1907 | } |
| 1908 | |
| 1909 | ALIAS (no_csnp_interval_l2, |
| 1910 | no_csnp_interval_l2_arg_cmd, |
| 1911 | "no isis csnp-interval <0-65535> level-2", |
| 1912 | NO_STR |
| 1913 | "IS-IS commands\n" |
| 1914 | "Set CSNP interval in seconds\n" |
| 1915 | "CSNP interval value\n" |
| 1916 | "Specify interval for level-2 CSNPs\n") |
| 1917 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1918 | #ifdef HAVE_IPV6 |
| 1919 | DEFUN (ipv6_router_isis, |
| 1920 | ipv6_router_isis_cmd, |
| 1921 | "ipv6 router isis WORD", |
| 1922 | "IPv6 interface subcommands\n" |
| 1923 | "IPv6 Router interface commands\n" |
| 1924 | "IS-IS Routing for IPv6\n" |
| 1925 | "Routing process tag\n") |
| 1926 | { |
| 1927 | struct isis_circuit *c; |
| 1928 | struct interface *ifp; |
| 1929 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1930 | |
| 1931 | ifp = (struct interface *) vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1932 | assert (ifp); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1933 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1934 | area = isis_area_lookup (argv[0]); |
| 1935 | |
| 1936 | /* Prevent more than one circuit per interface */ |
| 1937 | if (area) |
| 1938 | c = circuit_lookup_by_ifp (ifp, area->circuit_list); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1939 | else |
| 1940 | c = NULL; |
| 1941 | |
| 1942 | if (c && (ifp->info != NULL)) |
| 1943 | { |
| 1944 | if (c->ipv6_router == 1) |
| 1945 | { |
| 1946 | vty_out (vty, "ISIS circuit is already defined for IPv6%s", |
| 1947 | VTY_NEWLINE); |
| 1948 | return CMD_WARNING; |
| 1949 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1950 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1951 | |
| 1952 | /* this is here for ciscopability */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1953 | if (!area) |
| 1954 | { |
| 1955 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 1956 | return CMD_WARNING; |
| 1957 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1958 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1959 | if (!c) |
| 1960 | { |
| 1961 | c = circuit_lookup_by_ifp (ifp, isis->init_circ_list); |
| 1962 | c = isis_csm_state_change (ISIS_ENABLE, c, area); |
| 1963 | c->interface = ifp; |
| 1964 | ifp->info = c; |
| 1965 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1966 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1967 | if (!c) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1968 | return CMD_WARNING; |
| 1969 | |
| 1970 | c->ipv6_router = 1; |
| 1971 | area->ipv6_circuits++; |
| 1972 | circuit_update_nlpids (c); |
| 1973 | |
| 1974 | vty->node = INTERFACE_NODE; |
| 1975 | |
| 1976 | return CMD_SUCCESS; |
| 1977 | } |
| 1978 | |
| 1979 | DEFUN (no_ipv6_router_isis, |
| 1980 | no_ipv6_router_isis_cmd, |
| 1981 | "no ipv6 router isis WORD", |
| 1982 | NO_STR |
| 1983 | "IPv6 interface subcommands\n" |
| 1984 | "IPv6 Router interface commands\n" |
| 1985 | "IS-IS Routing for IPv6\n" |
| 1986 | "Routing process tag\n") |
| 1987 | { |
| 1988 | struct isis_circuit *c; |
| 1989 | struct interface *ifp; |
| 1990 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1991 | |
| 1992 | ifp = (struct interface *) vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1993 | /* UGLY - will remove l8r |
| 1994 | if (circuit == NULL) { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1995 | return CMD_WARNING; |
| 1996 | } */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1997 | assert (ifp); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1998 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1999 | area = isis_area_lookup (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2000 | if (!area) |
| 2001 | { |
| 2002 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 2003 | return CMD_WARNING; |
| 2004 | } |
| 2005 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2006 | c = circuit_lookup_by_ifp (ifp, area->circuit_list); |
| 2007 | if (!c) |
| 2008 | return CMD_WARNING; |
| 2009 | |
| 2010 | c->ipv6_router = 0; |
| 2011 | area->ipv6_circuits--; |
| 2012 | if (c->ip_router == 0) |
| 2013 | isis_csm_state_change (ISIS_DISABLE, c, area); |
| 2014 | |
| 2015 | return CMD_SUCCESS; |
| 2016 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2017 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2018 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2019 | struct cmd_node interface_node = { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2020 | INTERFACE_NODE, |
| 2021 | "%s(config-if)# ", |
| 2022 | 1, |
| 2023 | }; |
| 2024 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2025 | int |
| 2026 | isis_if_new_hook (struct interface *ifp) |
| 2027 | { |
| 2028 | /* FIXME: Discuss if the circuit should be created here |
| 2029 | ifp->info = XMALLOC (MTYPE_ISIS_IF_INFO, sizeof (struct isis_if_info)); */ |
| 2030 | ifp->info = NULL; |
| 2031 | return 0; |
| 2032 | } |
| 2033 | |
| 2034 | int |
| 2035 | isis_if_delete_hook (struct interface *ifp) |
| 2036 | { |
| 2037 | /* FIXME: Discuss if the circuit should be created here |
| 2038 | XFREE (MTYPE_ISIS_IF_INFO, ifp->info);*/ |
| 2039 | ifp->info = NULL; |
| 2040 | return 0; |
| 2041 | } |
| 2042 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2043 | void |
| 2044 | isis_circuit_init () |
| 2045 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2046 | /* Initialize Zebra interface data structure */ |
| 2047 | if_init (); |
| 2048 | if_add_hook (IF_NEW_HOOK, isis_if_new_hook); |
| 2049 | if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook); |
| 2050 | |
| 2051 | /* Install interface node */ |
| 2052 | install_node (&interface_node, isis_interface_config_write); |
| 2053 | install_element (CONFIG_NODE, &interface_cmd); |
| 2054 | |
| 2055 | install_default (INTERFACE_NODE); |
| 2056 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 2057 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 2058 | |
| 2059 | install_element (INTERFACE_NODE, &ip_router_isis_cmd); |
| 2060 | install_element (INTERFACE_NODE, &no_ip_router_isis_cmd); |
| 2061 | |
| 2062 | install_element (INTERFACE_NODE, &isis_circuit_type_cmd); |
| 2063 | install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd); |
| 2064 | |
| 2065 | install_element (INTERFACE_NODE, &isis_passwd_cmd); |
| 2066 | install_element (INTERFACE_NODE, &no_isis_passwd_cmd); |
| 2067 | |
| 2068 | install_element (INTERFACE_NODE, &isis_priority_cmd); |
| 2069 | install_element (INTERFACE_NODE, &no_isis_priority_cmd); |
| 2070 | install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd); |
| 2071 | install_element (INTERFACE_NODE, &isis_priority_l1_cmd); |
| 2072 | install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd); |
| 2073 | install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd); |
| 2074 | install_element (INTERFACE_NODE, &isis_priority_l2_cmd); |
| 2075 | install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd); |
| 2076 | install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd); |
| 2077 | |
| 2078 | install_element (INTERFACE_NODE, &isis_metric_cmd); |
| 2079 | install_element (INTERFACE_NODE, &no_isis_metric_cmd); |
| 2080 | install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd); |
| 2081 | |
| 2082 | install_element (INTERFACE_NODE, &isis_hello_interval_cmd); |
| 2083 | install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd); |
| 2084 | install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd); |
| 2085 | install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd); |
| 2086 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd); |
| 2087 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd); |
| 2088 | install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd); |
| 2089 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd); |
| 2090 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd); |
| 2091 | |
| 2092 | install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd); |
| 2093 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd); |
| 2094 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd); |
| 2095 | install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd); |
| 2096 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd); |
| 2097 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd); |
| 2098 | install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd); |
| 2099 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd); |
| 2100 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd); |
| 2101 | |
| 2102 | install_element (INTERFACE_NODE, &isis_hello_cmd); |
| 2103 | install_element (INTERFACE_NODE, &no_isis_hello_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2104 | install_element (INTERFACE_NODE, &csnp_interval_cmd); |
| 2105 | install_element (INTERFACE_NODE, &no_csnp_interval_cmd); |
| 2106 | install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd); |
| 2107 | install_element (INTERFACE_NODE, &csnp_interval_l1_cmd); |
| 2108 | install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd); |
| 2109 | install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd); |
| 2110 | install_element (INTERFACE_NODE, &csnp_interval_l2_cmd); |
| 2111 | install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd); |
| 2112 | install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd); |
| 2113 | |
| 2114 | #ifdef HAVE_IPV6 |
| 2115 | install_element (INTERFACE_NODE, &ipv6_router_isis_cmd); |
| 2116 | install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2117 | #endif |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2118 | } |