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