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