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