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