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 | |
Paul Jakma | 238497f | 2007-08-07 18:49:18 +0000 | [diff] [blame] | 29 | #ifndef ETHER_ADDR_LEN |
| 30 | #define ETHER_ADDR_LEN ETHERADDRL |
| 31 | #endif |
| 32 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 33 | #include "log.h" |
| 34 | #include "memory.h" |
| 35 | #include "if.h" |
| 36 | #include "linklist.h" |
| 37 | #include "command.h" |
| 38 | #include "thread.h" |
| 39 | #include "hash.h" |
| 40 | #include "prefix.h" |
| 41 | #include "stream.h" |
| 42 | |
| 43 | #include "isisd/dict.h" |
| 44 | #include "isisd/include-netbsd/iso.h" |
| 45 | #include "isisd/isis_constants.h" |
| 46 | #include "isisd/isis_common.h" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 47 | #include "isisd/isis_flags.h" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 48 | #include "isisd/isis_circuit.h" |
| 49 | #include "isisd/isis_tlv.h" |
| 50 | #include "isisd/isis_lsp.h" |
| 51 | #include "isisd/isis_pdu.h" |
| 52 | #include "isisd/isis_network.h" |
| 53 | #include "isisd/isis_misc.h" |
| 54 | #include "isisd/isis_constants.h" |
| 55 | #include "isisd/isis_adjacency.h" |
| 56 | #include "isisd/isis_dr.h" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 57 | #include "isisd/isisd.h" |
| 58 | #include "isisd/isis_csm.h" |
| 59 | #include "isisd/isis_events.h" |
| 60 | |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 61 | /* |
| 62 | * Prototypes. |
| 63 | */ |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 64 | int isis_interface_config_write(struct vty *); |
| 65 | int isis_if_new_hook(struct interface *); |
| 66 | int isis_if_delete_hook(struct interface *); |
| 67 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 68 | struct isis_circuit * |
| 69 | isis_circuit_new () |
| 70 | { |
| 71 | struct isis_circuit *circuit; |
| 72 | int i; |
| 73 | |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 74 | circuit = XCALLOC (MTYPE_ISIS_CIRCUIT, sizeof (struct isis_circuit)); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 75 | if (circuit == NULL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 76 | { |
| 77 | zlog_err ("Can't malloc isis circuit"); |
| 78 | return NULL; |
| 79 | } |
| 80 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 81 | /* |
| 82 | * Default values |
| 83 | */ |
| 84 | circuit->is_type = IS_LEVEL_1_AND_2; |
| 85 | circuit->flags = 0; |
| 86 | circuit->pad_hellos = 1; |
| 87 | for (i = 0; i < 2; i++) |
| 88 | { |
| 89 | circuit->hello_interval[i] = DEFAULT_HELLO_INTERVAL; |
| 90 | circuit->hello_multiplier[i] = DEFAULT_HELLO_MULTIPLIER; |
| 91 | circuit->csnp_interval[i] = DEFAULT_CSNP_INTERVAL; |
| 92 | circuit->psnp_interval[i] = DEFAULT_PSNP_INTERVAL; |
| 93 | circuit->priority[i] = DEFAULT_PRIORITY; |
| 94 | circuit->metrics[i].metric_default = DEFAULT_CIRCUIT_METRIC; |
| 95 | circuit->metrics[i].metric_expense = METRICS_UNSUPPORTED; |
| 96 | circuit->metrics[i].metric_error = METRICS_UNSUPPORTED; |
| 97 | circuit->metrics[i].metric_delay = METRICS_UNSUPPORTED; |
| 98 | circuit->te_metric[i] = DEFAULT_CIRCUIT_METRIC; |
| 99 | } |
| 100 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 101 | return circuit; |
| 102 | } |
| 103 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 104 | void |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 105 | isis_circuit_del (struct isis_circuit *circuit) |
| 106 | { |
| 107 | if (!circuit) |
| 108 | return; |
| 109 | |
| 110 | isis_circuit_if_unbind (circuit, circuit->interface); |
| 111 | |
| 112 | /* and lastly the circuit itself */ |
| 113 | XFREE (MTYPE_ISIS_CIRCUIT, circuit); |
| 114 | |
| 115 | return; |
| 116 | } |
| 117 | |
| 118 | void |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 119 | isis_circuit_configure (struct isis_circuit *circuit, struct isis_area *area) |
| 120 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 121 | assert (area); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 122 | circuit->area = area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 123 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 124 | /* |
Christian Franke | 7324ae1 | 2015-11-10 18:04:48 +0100 | [diff] [blame] | 125 | * Whenever the is-type of an area is changed, the is-type of each circuit |
| 126 | * in that area is updated to a non-empty subset of the area is-type. |
| 127 | * Inversely, when configuring a new circuit, this property should be |
| 128 | * ensured as well. |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 129 | */ |
Christian Franke | 7324ae1 | 2015-11-10 18:04:48 +0100 | [diff] [blame] | 130 | if (area->is_type != IS_LEVEL_1_AND_2) |
| 131 | circuit->is_type = area->is_type; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 132 | |
| 133 | /* |
| 134 | * Add the circuit into area |
| 135 | */ |
| 136 | listnode_add (area->circuit_list, circuit); |
| 137 | |
| 138 | circuit->idx = flags_get_index (&area->flags); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 139 | |
| 140 | return; |
| 141 | } |
| 142 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 143 | void |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 144 | isis_circuit_deconfigure (struct isis_circuit *circuit, struct isis_area *area) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 145 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 146 | /* Free the index of SRM and SSN flags */ |
| 147 | flags_free_index (&area->flags, circuit->idx); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 148 | circuit->idx = 0; |
| 149 | /* Remove circuit from area */ |
| 150 | assert (circuit->area == area); |
| 151 | listnode_delete (area->circuit_list, circuit); |
| 152 | circuit->area = NULL; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 153 | |
| 154 | return; |
| 155 | } |
| 156 | |
| 157 | struct isis_circuit * |
| 158 | circuit_lookup_by_ifp (struct interface *ifp, struct list *list) |
| 159 | { |
| 160 | struct isis_circuit *circuit = NULL; |
| 161 | struct listnode *node; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 162 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 163 | if (!list) |
| 164 | return NULL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 165 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 166 | for (ALL_LIST_ELEMENTS_RO (list, node, circuit)) |
| 167 | if (circuit->interface == ifp) |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 168 | { |
| 169 | assert (ifp->info == circuit); |
| 170 | return circuit; |
| 171 | } |
| 172 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 173 | return NULL; |
| 174 | } |
| 175 | |
| 176 | struct isis_circuit * |
| 177 | circuit_scan_by_ifp (struct interface *ifp) |
| 178 | { |
| 179 | struct isis_area *area; |
| 180 | struct listnode *node; |
| 181 | struct isis_circuit *circuit; |
| 182 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 183 | if (ifp->info) |
| 184 | return (struct isis_circuit *)ifp->info; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 185 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 186 | if (isis->area_list) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 187 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 188 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area)) |
| 189 | { |
| 190 | circuit = circuit_lookup_by_ifp (ifp, area->circuit_list); |
| 191 | if (circuit) |
| 192 | return circuit; |
| 193 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 194 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 195 | return circuit_lookup_by_ifp (ifp, isis->init_circ_list); |
| 196 | } |
| 197 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 198 | static struct isis_circuit * |
| 199 | isis_circuit_lookup (struct vty *vty) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 200 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 201 | struct interface *ifp; |
| 202 | struct isis_circuit *circuit; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 203 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 204 | ifp = (struct interface *) vty->index; |
| 205 | if (!ifp) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 206 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 207 | vty_out (vty, "Invalid interface %s", VTY_NEWLINE); |
| 208 | return NULL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 209 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 210 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 211 | circuit = circuit_scan_by_ifp (ifp); |
| 212 | if (!circuit) |
| 213 | { |
| 214 | vty_out (vty, "ISIS is not enabled on circuit %s%s", |
| 215 | ifp->name, VTY_NEWLINE); |
| 216 | return NULL; |
| 217 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 218 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 219 | return circuit; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | void |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 223 | isis_circuit_add_addr (struct isis_circuit *circuit, |
| 224 | struct connected *connected) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 225 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 226 | struct listnode *node; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 227 | struct prefix_ipv4 *ipv4; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 228 | u_char buf[BUFSIZ]; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 229 | #ifdef HAVE_IPV6 |
| 230 | struct prefix_ipv6 *ipv6; |
| 231 | #endif /* HAVE_IPV6 */ |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 232 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 233 | memset (&buf, 0, BUFSIZ); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 234 | if (connected->address->family == AF_INET) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 235 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 236 | u_int32_t addr = connected->address->u.prefix4.s_addr; |
| 237 | addr = ntohl (addr); |
| 238 | if (IPV4_NET0(addr) || |
| 239 | IPV4_NET127(addr) || |
| 240 | IN_CLASSD(addr) || |
| 241 | IPV4_LINKLOCAL(addr)) |
| 242 | return; |
| 243 | |
| 244 | for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ipv4)) |
| 245 | if (prefix_same ((struct prefix *) ipv4, connected->address)) |
| 246 | return; |
| 247 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 248 | ipv4 = prefix_ipv4_new (); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 249 | ipv4->prefixlen = connected->address->prefixlen; |
| 250 | ipv4->prefix = connected->address->u.prefix4; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 251 | listnode_add (circuit->ip_addrs, ipv4); |
hasso | 0dae85e | 2004-09-26 19:53:47 +0000 | [diff] [blame] | 252 | if (circuit->area) |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 253 | lsp_regenerate_schedule (circuit->area, circuit->is_type, 0); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 254 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 255 | #ifdef EXTREME_DEBUG |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 256 | prefix2str (connected->address, buf, BUFSIZ); |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 257 | zlog_debug ("Added IP address %s to circuit %d", buf, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 258 | circuit->circuit_id); |
| 259 | #endif /* EXTREME_DEBUG */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 260 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 261 | #ifdef HAVE_IPV6 |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 262 | if (connected->address->family == AF_INET6) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 263 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 264 | if (IN6_IS_ADDR_LOOPBACK(&connected->address->u.prefix6)) |
| 265 | return; |
| 266 | |
| 267 | for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_link, node, ipv6)) |
| 268 | if (prefix_same ((struct prefix *) ipv6, connected->address)) |
| 269 | return; |
| 270 | for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, node, ipv6)) |
| 271 | if (prefix_same ((struct prefix *) ipv6, connected->address)) |
| 272 | return; |
| 273 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 274 | ipv6 = prefix_ipv6_new (); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 275 | ipv6->prefixlen = connected->address->prefixlen; |
| 276 | ipv6->prefix = connected->address->u.prefix6; |
| 277 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 278 | if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix)) |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 279 | listnode_add (circuit->ipv6_link, ipv6); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 280 | else |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 281 | listnode_add (circuit->ipv6_non_link, ipv6); |
hasso | 0dae85e | 2004-09-26 19:53:47 +0000 | [diff] [blame] | 282 | if (circuit->area) |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 283 | lsp_regenerate_schedule (circuit->area, circuit->is_type, 0); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 284 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 285 | #ifdef EXTREME_DEBUG |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 286 | prefix2str (connected->address, buf, BUFSIZ); |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 287 | zlog_debug ("Added IPv6 address %s to circuit %d", buf, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 288 | circuit->circuit_id); |
| 289 | #endif /* EXTREME_DEBUG */ |
| 290 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 291 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 292 | return; |
| 293 | } |
| 294 | |
| 295 | void |
| 296 | isis_circuit_del_addr (struct isis_circuit *circuit, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 297 | struct connected *connected) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 298 | { |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 299 | struct prefix_ipv4 *ipv4, *ip = NULL; |
| 300 | struct listnode *node; |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 301 | u_char buf[BUFSIZ]; |
| 302 | #ifdef HAVE_IPV6 |
| 303 | struct prefix_ipv6 *ipv6, *ip6 = NULL; |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 304 | int found = 0; |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 305 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 306 | |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 307 | memset (&buf, 0, BUFSIZ); |
| 308 | if (connected->address->family == AF_INET) |
| 309 | { |
| 310 | ipv4 = prefix_ipv4_new (); |
| 311 | ipv4->prefixlen = connected->address->prefixlen; |
| 312 | ipv4->prefix = connected->address->u.prefix4; |
| 313 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 314 | for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip)) |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 315 | if (prefix_same ((struct prefix *) ip, (struct prefix *) ipv4)) |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 316 | break; |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 317 | |
| 318 | if (ip) |
| 319 | { |
| 320 | listnode_delete (circuit->ip_addrs, ip); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 321 | if (circuit->area) |
| 322 | lsp_regenerate_schedule (circuit->area, circuit->is_type, 0); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 323 | } |
| 324 | else |
| 325 | { |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 326 | prefix2str (connected->address, (char *)buf, BUFSIZ); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 327 | zlog_warn ("Nonexitant ip address %s removal attempt from \ |
| 328 | circuit %d", buf, circuit->circuit_id); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 329 | } |
David Lamparter | e8aca32 | 2012-11-27 01:10:30 +0000 | [diff] [blame] | 330 | |
| 331 | prefix_ipv4_free (ipv4); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 332 | } |
| 333 | #ifdef HAVE_IPV6 |
| 334 | if (connected->address->family == AF_INET6) |
| 335 | { |
| 336 | ipv6 = prefix_ipv6_new (); |
| 337 | ipv6->prefixlen = connected->address->prefixlen; |
| 338 | ipv6->prefix = connected->address->u.prefix6; |
| 339 | |
| 340 | if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix)) |
| 341 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 342 | for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_link, node, ip6)) |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 343 | { |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 344 | if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6)) |
| 345 | break; |
| 346 | } |
| 347 | if (ip6) |
| 348 | { |
| 349 | listnode_delete (circuit->ipv6_link, ip6); |
| 350 | found = 1; |
| 351 | } |
| 352 | } |
| 353 | else |
| 354 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 355 | for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, node, ip6)) |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 356 | { |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 357 | if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6)) |
| 358 | break; |
| 359 | } |
| 360 | if (ip6) |
| 361 | { |
| 362 | listnode_delete (circuit->ipv6_non_link, ip6); |
| 363 | found = 1; |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | if (!found) |
| 368 | { |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 369 | prefix2str (connected->address, (char *)buf, BUFSIZ); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 370 | zlog_warn ("Nonexitant ip address %s removal attempt from \ |
| 371 | circuit %d", buf, circuit->circuit_id); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 372 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 373 | else if (circuit->area) |
| 374 | lsp_regenerate_schedule (circuit->area, circuit->is_type, 0); |
David Lamparter | e8aca32 | 2012-11-27 01:10:30 +0000 | [diff] [blame] | 375 | |
| 376 | prefix_ipv6_free (ipv6); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 377 | } |
| 378 | #endif /* HAVE_IPV6 */ |
| 379 | return; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 380 | } |
| 381 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 382 | static u_char |
| 383 | isis_circuit_id_gen (struct interface *ifp) |
| 384 | { |
| 385 | u_char id = 0; |
| 386 | char ifname[16]; |
| 387 | unsigned int i; |
| 388 | int start = -1, end = -1; |
| 389 | |
| 390 | /* |
| 391 | * Get a stable circuit id from ifname. This makes |
| 392 | * the ifindex from flapping when netdevs are created |
| 393 | * and deleted on the fly. Note that this circuit id |
| 394 | * is used in pseudo lsps so it is better to be stable. |
| 395 | * The following code works on any reasonanle ifname |
| 396 | * like: eth1 or trk-1.1 etc. |
| 397 | */ |
| 398 | for (i = 0; i < strlen (ifp->name); i++) |
| 399 | { |
David Lamparter | 52f02b4 | 2015-04-10 09:14:30 +0200 | [diff] [blame] | 400 | if (isdigit((unsigned char)ifp->name[i])) |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 401 | { |
| 402 | if (start < 0) |
| 403 | { |
| 404 | start = i; |
| 405 | end = i + 1; |
| 406 | } |
| 407 | else |
| 408 | { |
| 409 | end = i + 1; |
| 410 | } |
| 411 | } |
| 412 | else if (start >= 0) |
| 413 | break; |
| 414 | } |
| 415 | |
| 416 | if ((start >= 0) && (end >= start) && (end - start) < 16) |
| 417 | { |
| 418 | memset (ifname, 0, 16); |
| 419 | strncpy (ifname, &ifp->name[start], end - start); |
| 420 | id = (u_char)atoi(ifname); |
| 421 | } |
| 422 | |
| 423 | /* Try to be unique. */ |
| 424 | if (!id) |
| 425 | id = (u_char)((ifp->ifindex & 0xff) | 0x80); |
| 426 | |
| 427 | return id; |
| 428 | } |
| 429 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 430 | void |
| 431 | isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp) |
| 432 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 433 | struct listnode *node, *nnode; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 434 | struct connected *conn; |
| 435 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 436 | circuit->circuit_id = isis_circuit_id_gen (ifp); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 437 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 438 | isis_circuit_if_bind (circuit, ifp); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 439 | /* isis_circuit_update_addrs (circuit, ifp); */ |
| 440 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 441 | if (if_is_broadcast (ifp)) |
| 442 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 443 | if (circuit->circ_type_config == CIRCUIT_T_P2P) |
| 444 | circuit->circ_type = CIRCUIT_T_P2P; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 445 | else |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 446 | circuit->circ_type = CIRCUIT_T_BROADCAST; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 447 | } |
| 448 | else if (if_is_pointopoint (ifp)) |
| 449 | { |
| 450 | circuit->circ_type = CIRCUIT_T_P2P; |
| 451 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 452 | else if (if_is_loopback (ifp)) |
| 453 | { |
| 454 | circuit->circ_type = CIRCUIT_T_LOOPBACK; |
| 455 | circuit->is_passive = 1; |
| 456 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 457 | else |
| 458 | { |
hasso | c89c05d | 2005-09-04 21:36:36 +0000 | [diff] [blame] | 459 | /* It's normal in case of loopback etc. */ |
| 460 | if (isis->debugs & DEBUG_EVENTS) |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 461 | zlog_debug ("isis_circuit_if_add: unsupported media"); |
| 462 | circuit->circ_type = CIRCUIT_T_UNKNOWN; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 463 | } |
| 464 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 465 | circuit->ip_addrs = list_new (); |
| 466 | #ifdef HAVE_IPV6 |
| 467 | circuit->ipv6_link = list_new (); |
| 468 | circuit->ipv6_non_link = list_new (); |
| 469 | #endif /* HAVE_IPV6 */ |
| 470 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 471 | for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn)) |
| 472 | isis_circuit_add_addr (circuit, conn); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 473 | |
| 474 | return; |
| 475 | } |
| 476 | |
| 477 | void |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 478 | isis_circuit_if_del (struct isis_circuit *circuit, struct interface *ifp) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 479 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 480 | struct listnode *node, *nnode; |
| 481 | struct connected *conn; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 482 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 483 | assert (circuit->interface == ifp); |
| 484 | |
| 485 | /* destroy addresses */ |
| 486 | for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn)) |
| 487 | isis_circuit_del_addr (circuit, conn); |
| 488 | |
| 489 | if (circuit->ip_addrs) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 490 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 491 | assert (listcount(circuit->ip_addrs) == 0); |
| 492 | list_delete (circuit->ip_addrs); |
| 493 | circuit->ip_addrs = NULL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 494 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 495 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 496 | #ifdef HAVE_IPV6 |
| 497 | if (circuit->ipv6_link) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 498 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 499 | assert (listcount(circuit->ipv6_link) == 0); |
| 500 | list_delete (circuit->ipv6_link); |
| 501 | circuit->ipv6_link = NULL; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 502 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 503 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 504 | if (circuit->ipv6_non_link) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 505 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 506 | assert (listcount(circuit->ipv6_non_link) == 0); |
| 507 | list_delete (circuit->ipv6_non_link); |
| 508 | circuit->ipv6_non_link = NULL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 509 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 510 | #endif /* HAVE_IPV6 */ |
| 511 | |
| 512 | circuit->circ_type = CIRCUIT_T_UNKNOWN; |
| 513 | circuit->circuit_id = 0; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 514 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 515 | return; |
| 516 | } |
| 517 | |
| 518 | void |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 519 | isis_circuit_if_bind (struct isis_circuit *circuit, struct interface *ifp) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 520 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 521 | assert (circuit != NULL); |
| 522 | assert (ifp != NULL); |
| 523 | if (circuit->interface) |
| 524 | assert (circuit->interface == ifp); |
| 525 | else |
| 526 | circuit->interface = ifp; |
| 527 | if (ifp->info) |
| 528 | assert (ifp->info == circuit); |
| 529 | else |
| 530 | ifp->info = circuit; |
| 531 | } |
| 532 | |
| 533 | void |
| 534 | isis_circuit_if_unbind (struct isis_circuit *circuit, struct interface *ifp) |
| 535 | { |
| 536 | assert (circuit != NULL); |
| 537 | assert (ifp != NULL); |
| 538 | assert (circuit->interface == ifp); |
| 539 | assert (ifp->info == circuit); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 540 | circuit->interface = NULL; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 541 | ifp->info = NULL; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 542 | } |
| 543 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 544 | static void |
| 545 | isis_circuit_update_all_srmflags (struct isis_circuit *circuit, int is_set) |
| 546 | { |
| 547 | struct isis_area *area; |
| 548 | struct isis_lsp *lsp; |
| 549 | dnode_t *dnode, *dnode_next; |
| 550 | int level; |
| 551 | |
| 552 | assert (circuit); |
| 553 | area = circuit->area; |
| 554 | assert (area); |
| 555 | for (level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) |
| 556 | { |
| 557 | if (level & circuit->is_type) |
| 558 | { |
| 559 | if (area->lspdb[level - 1] && |
| 560 | dict_count (area->lspdb[level - 1]) > 0) |
| 561 | { |
| 562 | for (dnode = dict_first (area->lspdb[level - 1]); |
| 563 | dnode != NULL; dnode = dnode_next) |
| 564 | { |
| 565 | dnode_next = dict_next (area->lspdb[level - 1], dnode); |
| 566 | lsp = dnode_get (dnode); |
| 567 | if (is_set) |
| 568 | { |
| 569 | ISIS_SET_FLAG (lsp->SRMflags, circuit); |
| 570 | } |
| 571 | else |
| 572 | { |
| 573 | ISIS_CLEAR_FLAG (lsp->SRMflags, circuit); |
| 574 | } |
| 575 | } |
| 576 | } |
| 577 | } |
| 578 | } |
| 579 | } |
| 580 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame^] | 581 | size_t |
| 582 | isis_circuit_pdu_size(struct isis_circuit *circuit) |
| 583 | { |
| 584 | return ISO_MTU(circuit); |
| 585 | } |
| 586 | |
| 587 | void |
| 588 | isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream) |
| 589 | { |
| 590 | size_t stream_size = isis_circuit_pdu_size(circuit); |
| 591 | |
| 592 | if (!*stream) |
| 593 | { |
| 594 | *stream = stream_new(stream_size); |
| 595 | } |
| 596 | else |
| 597 | { |
| 598 | if (STREAM_SIZE(*stream) != stream_size) |
| 599 | stream_resize(*stream, stream_size); |
| 600 | stream_reset(*stream); |
| 601 | } |
| 602 | } |
| 603 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 604 | int |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 605 | isis_circuit_up (struct isis_circuit *circuit) |
| 606 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 607 | int retv; |
| 608 | |
| 609 | /* Set the flags for all the lsps of the circuit. */ |
| 610 | isis_circuit_update_all_srmflags (circuit, 1); |
| 611 | |
| 612 | if (circuit->state == C_STATE_UP) |
| 613 | return ISIS_OK; |
| 614 | |
| 615 | if (circuit->is_passive) |
| 616 | return ISIS_OK; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 617 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame^] | 618 | if (circuit->area->lsp_mtu > isis_circuit_pdu_size(circuit)) |
| 619 | { |
| 620 | zlog_err("Interface MTU %zu on %s is too low to support area lsp mtu %u!", |
| 621 | isis_circuit_pdu_size(circuit), circuit->interface->name, |
| 622 | circuit->area->lsp_mtu); |
| 623 | isis_circuit_down(circuit); |
| 624 | return ISIS_ERROR; |
| 625 | } |
| 626 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 627 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 628 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 629 | /* |
| 630 | * Get the Hardware Address |
| 631 | */ |
| 632 | #ifdef HAVE_STRUCT_SOCKADDR_DL |
| 633 | #ifndef SUNOS_5 |
| 634 | if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN) |
| 635 | zlog_warn ("unsupported link layer"); |
| 636 | else |
| 637 | memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl), |
| 638 | ETH_ALEN); |
| 639 | #endif |
| 640 | #else |
| 641 | if (circuit->interface->hw_addr_len != ETH_ALEN) |
| 642 | { |
| 643 | zlog_warn ("unsupported link layer"); |
| 644 | } |
| 645 | else |
| 646 | { |
| 647 | memcpy (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN); |
| 648 | } |
| 649 | #ifdef EXTREME_DEGUG |
| 650 | zlog_debug ("isis_circuit_if_add: if_id %d, isomtu %d snpa %s", |
| 651 | circuit->interface->ifindex, ISO_MTU (circuit), |
| 652 | snpa_print (circuit->u.bc.snpa)); |
| 653 | #endif /* EXTREME_DEBUG */ |
| 654 | #endif /* HAVE_STRUCT_SOCKADDR_DL */ |
| 655 | |
| 656 | circuit->u.bc.adjdb[0] = list_new (); |
| 657 | circuit->u.bc.adjdb[1] = list_new (); |
| 658 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 659 | /* |
| 660 | * ISO 10589 - 8.4.1 Enabling of broadcast circuits |
| 661 | */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 662 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 663 | /* initilizing the hello sending threads |
| 664 | * for a broadcast IF |
| 665 | */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 666 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 667 | /* 8.4.1 a) commence sending of IIH PDUs */ |
| 668 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 669 | if (circuit->is_type & IS_LEVEL_1) |
| 670 | { |
| 671 | thread_add_event (master, send_lan_l1_hello, circuit, 0); |
| 672 | circuit->u.bc.lan_neighs[0] = list_new (); |
| 673 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 674 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 675 | if (circuit->is_type & IS_LEVEL_2) |
| 676 | { |
| 677 | thread_add_event (master, send_lan_l2_hello, circuit, 0); |
| 678 | circuit->u.bc.lan_neighs[1] = list_new (); |
| 679 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 680 | |
| 681 | /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */ |
| 682 | /* 8.4.1 c) FIXME: listen for ESH PDUs */ |
| 683 | |
| 684 | /* 8.4.1 d) */ |
| 685 | /* dr election will commence in... */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 686 | if (circuit->is_type & IS_LEVEL_1) |
| 687 | THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1, |
| 688 | circuit, 2 * circuit->hello_interval[0]); |
| 689 | if (circuit->is_type & IS_LEVEL_2) |
| 690 | THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2, |
| 691 | circuit, 2 * circuit->hello_interval[1]); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 692 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 693 | else |
| 694 | { |
| 695 | /* initializing the hello send threads |
| 696 | * for a ptp IF |
| 697 | */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 698 | circuit->u.p2p.neighbor = NULL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 699 | thread_add_event (master, send_p2p_hello, circuit, 0); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 700 | } |
| 701 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 702 | /* initializing PSNP timers */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 703 | if (circuit->is_type & IS_LEVEL_1) |
| 704 | THREAD_TIMER_ON (master, circuit->t_send_psnp[0], send_l1_psnp, circuit, |
| 705 | isis_jitter (circuit->psnp_interval[0], PSNP_JITTER)); |
| 706 | |
| 707 | if (circuit->is_type & IS_LEVEL_2) |
| 708 | THREAD_TIMER_ON (master, circuit->t_send_psnp[1], send_l2_psnp, circuit, |
| 709 | isis_jitter (circuit->psnp_interval[1], PSNP_JITTER)); |
| 710 | |
| 711 | /* unified init for circuits; ignore warnings below this level */ |
| 712 | retv = isis_sock_init (circuit); |
| 713 | if (retv != ISIS_OK) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 714 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 715 | isis_circuit_down (circuit); |
| 716 | return retv; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 717 | } |
| 718 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 719 | /* initialize the circuit streams after opening connection */ |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame^] | 720 | isis_circuit_stream(circuit, &circuit->rcv_stream); |
| 721 | isis_circuit_stream(circuit, &circuit->snd_stream); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 722 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 723 | #ifdef GNU_LINUX |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 724 | THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 725 | circuit->fd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 726 | #else |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 727 | THREAD_TIMER_ON (master, circuit->t_read, isis_receive, circuit, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 728 | circuit->fd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 729 | #endif |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 730 | |
| 731 | circuit->lsp_queue = list_new (); |
| 732 | circuit->lsp_queue_last_cleared = time (NULL); |
| 733 | |
| 734 | return ISIS_OK; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 735 | } |
| 736 | |
| 737 | void |
| 738 | isis_circuit_down (struct isis_circuit *circuit) |
| 739 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 740 | if (circuit->state != C_STATE_UP) |
| 741 | return; |
| 742 | |
| 743 | /* Clear the flags for all the lsps of the circuit. */ |
| 744 | isis_circuit_update_all_srmflags (circuit, 0); |
| 745 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 746 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 747 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 748 | /* destroy neighbour lists */ |
| 749 | if (circuit->u.bc.lan_neighs[0]) |
| 750 | { |
| 751 | list_delete (circuit->u.bc.lan_neighs[0]); |
| 752 | circuit->u.bc.lan_neighs[0] = NULL; |
| 753 | } |
| 754 | if (circuit->u.bc.lan_neighs[1]) |
| 755 | { |
| 756 | list_delete (circuit->u.bc.lan_neighs[1]); |
| 757 | circuit->u.bc.lan_neighs[1] = NULL; |
| 758 | } |
| 759 | /* destroy adjacency databases */ |
| 760 | if (circuit->u.bc.adjdb[0]) |
| 761 | { |
| 762 | circuit->u.bc.adjdb[0]->del = isis_delete_adj; |
| 763 | list_delete (circuit->u.bc.adjdb[0]); |
| 764 | circuit->u.bc.adjdb[0] = NULL; |
| 765 | } |
| 766 | if (circuit->u.bc.adjdb[1]) |
| 767 | { |
| 768 | circuit->u.bc.adjdb[1]->del = isis_delete_adj; |
| 769 | list_delete (circuit->u.bc.adjdb[1]); |
| 770 | circuit->u.bc.adjdb[1] = NULL; |
| 771 | } |
| 772 | if (circuit->u.bc.is_dr[0]) |
| 773 | { |
| 774 | isis_dr_resign (circuit, 1); |
| 775 | circuit->u.bc.is_dr[0] = 0; |
| 776 | } |
| 777 | memset (circuit->u.bc.l1_desig_is, 0, ISIS_SYS_ID_LEN + 1); |
| 778 | if (circuit->u.bc.is_dr[1]) |
| 779 | { |
| 780 | isis_dr_resign (circuit, 2); |
| 781 | circuit->u.bc.is_dr[1] = 0; |
| 782 | } |
| 783 | memset (circuit->u.bc.l2_desig_is, 0, ISIS_SYS_ID_LEN + 1); |
| 784 | memset (circuit->u.bc.snpa, 0, ETH_ALEN); |
| 785 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 786 | THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[0]); |
| 787 | THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[1]); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 788 | THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[0]); |
| 789 | THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[1]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 790 | THREAD_TIMER_OFF (circuit->u.bc.t_refresh_pseudo_lsp[0]); |
| 791 | THREAD_TIMER_OFF (circuit->u.bc.t_refresh_pseudo_lsp[1]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 792 | } |
| 793 | else if (circuit->circ_type == CIRCUIT_T_P2P) |
| 794 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 795 | isis_delete_adj (circuit->u.p2p.neighbor); |
| 796 | circuit->u.p2p.neighbor = NULL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 797 | THREAD_TIMER_OFF (circuit->u.p2p.t_send_p2p_hello); |
| 798 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 799 | |
| 800 | /* Cancel all active threads */ |
| 801 | THREAD_TIMER_OFF (circuit->t_send_csnp[0]); |
| 802 | THREAD_TIMER_OFF (circuit->t_send_csnp[1]); |
| 803 | THREAD_TIMER_OFF (circuit->t_send_psnp[0]); |
| 804 | THREAD_TIMER_OFF (circuit->t_send_psnp[1]); |
| 805 | THREAD_OFF (circuit->t_read); |
| 806 | |
| 807 | if (circuit->lsp_queue) |
| 808 | { |
| 809 | circuit->lsp_queue->del = NULL; |
| 810 | list_delete (circuit->lsp_queue); |
| 811 | circuit->lsp_queue = NULL; |
| 812 | } |
| 813 | |
| 814 | /* send one gratuitous hello to spead up convergence */ |
| 815 | if (circuit->is_type & IS_LEVEL_1) |
| 816 | send_hello (circuit, IS_LEVEL_1); |
| 817 | if (circuit->is_type & IS_LEVEL_2) |
| 818 | send_hello (circuit, IS_LEVEL_2); |
| 819 | |
| 820 | circuit->upadjcount[0] = 0; |
| 821 | circuit->upadjcount[1] = 0; |
| 822 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 823 | /* close the socket */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 824 | if (circuit->fd) |
| 825 | { |
| 826 | close (circuit->fd); |
| 827 | circuit->fd = 0; |
| 828 | } |
| 829 | |
| 830 | if (circuit->rcv_stream != NULL) |
| 831 | { |
| 832 | stream_free (circuit->rcv_stream); |
| 833 | circuit->rcv_stream = NULL; |
| 834 | } |
| 835 | |
| 836 | if (circuit->snd_stream != NULL) |
| 837 | { |
| 838 | stream_free (circuit->snd_stream); |
| 839 | circuit->snd_stream = NULL; |
| 840 | } |
| 841 | |
| 842 | thread_cancel_event (master, circuit); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 843 | |
| 844 | return; |
| 845 | } |
| 846 | |
| 847 | void |
| 848 | circuit_update_nlpids (struct isis_circuit *circuit) |
| 849 | { |
| 850 | circuit->nlpids.count = 0; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 851 | |
| 852 | if (circuit->ip_router) |
| 853 | { |
| 854 | circuit->nlpids.nlpids[0] = NLPID_IP; |
| 855 | circuit->nlpids.count++; |
| 856 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 857 | #ifdef HAVE_IPV6 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 858 | if (circuit->ipv6_router) |
| 859 | { |
| 860 | circuit->nlpids.nlpids[circuit->nlpids.count] = NLPID_IPV6; |
| 861 | circuit->nlpids.count++; |
| 862 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 863 | #endif /* HAVE_IPV6 */ |
| 864 | return; |
| 865 | } |
| 866 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 867 | void |
| 868 | isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty, |
| 869 | char detail) |
| 870 | { |
| 871 | if (detail == ISIS_UI_LEVEL_BRIEF) |
| 872 | { |
| 873 | vty_out (vty, " %-12s", circuit->interface->name); |
| 874 | vty_out (vty, "0x%-7x", circuit->circuit_id); |
| 875 | vty_out (vty, "%-9s", circuit_state2string (circuit->state)); |
| 876 | vty_out (vty, "%-9s", circuit_type2string (circuit->circ_type)); |
| 877 | vty_out (vty, "%-9s", circuit_t2string (circuit->is_type)); |
| 878 | vty_out (vty, "%s", VTY_NEWLINE); |
| 879 | } |
| 880 | |
| 881 | if (detail == ISIS_UI_LEVEL_DETAIL) |
| 882 | { |
| 883 | vty_out (vty, " Interface: %s", circuit->interface->name); |
| 884 | vty_out (vty, ", State: %s", circuit_state2string (circuit->state)); |
| 885 | if (circuit->is_passive) |
| 886 | vty_out (vty, ", Passive"); |
| 887 | else |
| 888 | vty_out (vty, ", Active"); |
| 889 | vty_out (vty, ", Circuit Id: 0x%x", circuit->circuit_id); |
| 890 | vty_out (vty, "%s", VTY_NEWLINE); |
| 891 | vty_out (vty, " Type: %s", circuit_type2string (circuit->circ_type)); |
| 892 | vty_out (vty, ", Level: %s", circuit_t2string (circuit->is_type)); |
| 893 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 894 | vty_out (vty, ", SNPA: %-10s", snpa_print (circuit->u.bc.snpa)); |
| 895 | vty_out (vty, "%s", VTY_NEWLINE); |
| 896 | if (circuit->is_type & IS_LEVEL_1) |
| 897 | { |
| 898 | vty_out (vty, " Level-1 Information:%s", VTY_NEWLINE); |
| 899 | if (circuit->area->newmetric) |
| 900 | vty_out (vty, " Metric: %d", circuit->te_metric[0]); |
| 901 | else |
| 902 | vty_out (vty, " Metric: %d", |
| 903 | circuit->metrics[0].metric_default); |
| 904 | if (!circuit->is_passive) |
| 905 | { |
| 906 | vty_out (vty, ", Active neighbors: %u%s", |
| 907 | circuit->upadjcount[0], VTY_NEWLINE); |
| 908 | vty_out (vty, " Hello interval: %u, " |
| 909 | "Holddown count: %u %s%s", |
| 910 | circuit->hello_interval[0], |
| 911 | circuit->hello_multiplier[0], |
| 912 | (circuit->pad_hellos ? "(pad)" : "(no-pad)"), |
| 913 | VTY_NEWLINE); |
| 914 | vty_out (vty, " CNSP interval: %u, " |
| 915 | "PSNP interval: %u%s", |
| 916 | circuit->csnp_interval[0], |
| 917 | circuit->psnp_interval[0], VTY_NEWLINE); |
| 918 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 919 | vty_out (vty, " LAN Priority: %u, %s%s", |
| 920 | circuit->priority[0], |
| 921 | (circuit->u.bc.is_dr[0] ? \ |
| 922 | "is DIS" : "is not DIS"), VTY_NEWLINE); |
| 923 | } |
| 924 | else |
| 925 | { |
| 926 | vty_out (vty, "%s", VTY_NEWLINE); |
| 927 | } |
| 928 | } |
| 929 | if (circuit->is_type & IS_LEVEL_2) |
| 930 | { |
| 931 | vty_out (vty, " Level-2 Information:%s", VTY_NEWLINE); |
| 932 | if (circuit->area->newmetric) |
| 933 | vty_out (vty, " Metric: %d", circuit->te_metric[1]); |
| 934 | else |
| 935 | vty_out (vty, " Metric: %d", |
| 936 | circuit->metrics[1].metric_default); |
| 937 | if (!circuit->is_passive) |
| 938 | { |
| 939 | vty_out (vty, ", Active neighbors: %u%s", |
| 940 | circuit->upadjcount[1], VTY_NEWLINE); |
| 941 | vty_out (vty, " Hello interval: %u, " |
| 942 | "Holddown count: %u %s%s", |
| 943 | circuit->hello_interval[1], |
| 944 | circuit->hello_multiplier[1], |
| 945 | (circuit->pad_hellos ? "(pad)" : "(no-pad)"), |
| 946 | VTY_NEWLINE); |
| 947 | vty_out (vty, " CNSP interval: %u, " |
| 948 | "PSNP interval: %u%s", |
| 949 | circuit->csnp_interval[1], |
| 950 | circuit->psnp_interval[1], VTY_NEWLINE); |
| 951 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 952 | vty_out (vty, " LAN Priority: %u, %s%s", |
| 953 | circuit->priority[1], |
| 954 | (circuit->u.bc.is_dr[1] ? \ |
| 955 | "is DIS" : "is not DIS"), VTY_NEWLINE); |
| 956 | } |
| 957 | else |
| 958 | { |
| 959 | vty_out (vty, "%s", VTY_NEWLINE); |
| 960 | } |
| 961 | } |
| 962 | if (circuit->ip_addrs && listcount (circuit->ip_addrs) > 0) |
| 963 | { |
| 964 | struct listnode *node; |
| 965 | struct prefix *ip_addr; |
| 966 | u_char buf[BUFSIZ]; |
| 967 | vty_out (vty, " IP Prefix(es):%s", VTY_NEWLINE); |
| 968 | for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip_addr)) |
| 969 | { |
| 970 | prefix2str (ip_addr, (char*)buf, BUFSIZ), |
| 971 | vty_out (vty, " %s%s", buf, VTY_NEWLINE); |
| 972 | } |
| 973 | } |
| 974 | vty_out (vty, "%s", VTY_NEWLINE); |
| 975 | } |
| 976 | return; |
| 977 | } |
| 978 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 979 | int |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 980 | isis_interface_config_write (struct vty *vty) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 981 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 982 | int write = 0; |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 983 | struct listnode *node, *node2; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 984 | struct interface *ifp; |
| 985 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 986 | struct isis_circuit *circuit; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 987 | int i; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 988 | |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 989 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 990 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 991 | /* IF name */ |
| 992 | vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE); |
| 993 | write++; |
| 994 | /* IF desc */ |
| 995 | if (ifp->desc) |
| 996 | { |
| 997 | vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE); |
| 998 | write++; |
| 999 | } |
| 1000 | /* ISIS Circuit */ |
| 1001 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, node2, area)) |
| 1002 | { |
| 1003 | circuit = circuit_lookup_by_ifp (ifp, area->circuit_list); |
| 1004 | if (circuit == NULL) |
| 1005 | continue; |
| 1006 | if (circuit->ip_router) |
| 1007 | { |
| 1008 | vty_out (vty, " ip router isis %s%s", area->area_tag, |
| 1009 | VTY_NEWLINE); |
| 1010 | write++; |
| 1011 | } |
| 1012 | if (circuit->is_passive) |
| 1013 | { |
| 1014 | vty_out (vty, " isis passive%s", VTY_NEWLINE); |
| 1015 | write++; |
| 1016 | } |
| 1017 | if (circuit->circ_type_config == CIRCUIT_T_P2P) |
| 1018 | { |
| 1019 | vty_out (vty, " isis network point-to-point%s", VTY_NEWLINE); |
| 1020 | write++; |
| 1021 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1022 | #ifdef HAVE_IPV6 |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1023 | if (circuit->ipv6_router) |
| 1024 | { |
| 1025 | vty_out (vty, " ipv6 router isis %s%s", area->area_tag, |
| 1026 | VTY_NEWLINE); |
| 1027 | write++; |
| 1028 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1029 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1030 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1031 | /* ISIS - circuit type */ |
| 1032 | if (circuit->is_type == IS_LEVEL_1) |
| 1033 | { |
| 1034 | vty_out (vty, " isis circuit-type level-1%s", VTY_NEWLINE); |
| 1035 | write++; |
| 1036 | } |
| 1037 | else |
| 1038 | { |
| 1039 | if (circuit->is_type == IS_LEVEL_2) |
| 1040 | { |
| 1041 | vty_out (vty, " isis circuit-type level-2-only%s", |
| 1042 | VTY_NEWLINE); |
| 1043 | write++; |
| 1044 | } |
| 1045 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1046 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1047 | /* ISIS - CSNP interval */ |
| 1048 | if (circuit->csnp_interval[0] == circuit->csnp_interval[1]) |
| 1049 | { |
| 1050 | if (circuit->csnp_interval[0] != DEFAULT_CSNP_INTERVAL) |
| 1051 | { |
| 1052 | vty_out (vty, " isis csnp-interval %d%s", |
| 1053 | circuit->csnp_interval[0], VTY_NEWLINE); |
| 1054 | write++; |
| 1055 | } |
| 1056 | } |
| 1057 | else |
| 1058 | { |
| 1059 | for (i = 0; i < 2; i++) |
| 1060 | { |
| 1061 | if (circuit->csnp_interval[i] != DEFAULT_CSNP_INTERVAL) |
| 1062 | { |
| 1063 | vty_out (vty, " isis csnp-interval %d level-%d%s", |
| 1064 | circuit->csnp_interval[i], i + 1, VTY_NEWLINE); |
| 1065 | write++; |
| 1066 | } |
| 1067 | } |
| 1068 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1069 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1070 | /* ISIS - PSNP interval */ |
| 1071 | if (circuit->psnp_interval[0] == circuit->psnp_interval[1]) |
| 1072 | { |
| 1073 | if (circuit->psnp_interval[0] != DEFAULT_PSNP_INTERVAL) |
| 1074 | { |
| 1075 | vty_out (vty, " isis psnp-interval %d%s", |
| 1076 | circuit->psnp_interval[0], VTY_NEWLINE); |
| 1077 | write++; |
| 1078 | } |
| 1079 | } |
| 1080 | else |
| 1081 | { |
| 1082 | for (i = 0; i < 2; i++) |
| 1083 | { |
| 1084 | if (circuit->psnp_interval[i] != DEFAULT_PSNP_INTERVAL) |
| 1085 | { |
| 1086 | vty_out (vty, " isis psnp-interval %d level-%d%s", |
| 1087 | circuit->psnp_interval[i], i + 1, VTY_NEWLINE); |
| 1088 | write++; |
| 1089 | } |
| 1090 | } |
| 1091 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1092 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1093 | /* ISIS - Hello padding - Defaults to true so only display if false */ |
| 1094 | if (circuit->pad_hellos == 0) |
| 1095 | { |
| 1096 | vty_out (vty, " no isis hello padding%s", VTY_NEWLINE); |
| 1097 | write++; |
| 1098 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1099 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1100 | /* ISIS - Hello interval */ |
| 1101 | if (circuit->hello_interval[0] == circuit->hello_interval[1]) |
| 1102 | { |
| 1103 | if (circuit->hello_interval[0] != DEFAULT_HELLO_INTERVAL) |
| 1104 | { |
| 1105 | vty_out (vty, " isis hello-interval %d%s", |
| 1106 | circuit->hello_interval[0], VTY_NEWLINE); |
| 1107 | write++; |
| 1108 | } |
| 1109 | } |
| 1110 | else |
| 1111 | { |
| 1112 | for (i = 0; i < 2; i++) |
| 1113 | { |
| 1114 | if (circuit->hello_interval[i] != DEFAULT_HELLO_INTERVAL) |
| 1115 | { |
| 1116 | vty_out (vty, " isis hello-interval %d level-%d%s", |
| 1117 | circuit->hello_interval[i], i + 1, VTY_NEWLINE); |
| 1118 | write++; |
| 1119 | } |
| 1120 | } |
| 1121 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1122 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1123 | /* ISIS - Hello Multiplier */ |
| 1124 | if (circuit->hello_multiplier[0] == circuit->hello_multiplier[1]) |
| 1125 | { |
| 1126 | if (circuit->hello_multiplier[0] != DEFAULT_HELLO_MULTIPLIER) |
| 1127 | { |
| 1128 | vty_out (vty, " isis hello-multiplier %d%s", |
| 1129 | circuit->hello_multiplier[0], VTY_NEWLINE); |
| 1130 | write++; |
| 1131 | } |
| 1132 | } |
| 1133 | else |
| 1134 | { |
| 1135 | for (i = 0; i < 2; i++) |
| 1136 | { |
| 1137 | if (circuit->hello_multiplier[i] != DEFAULT_HELLO_MULTIPLIER) |
| 1138 | { |
| 1139 | vty_out (vty, " isis hello-multiplier %d level-%d%s", |
| 1140 | circuit->hello_multiplier[i], i + 1, |
| 1141 | VTY_NEWLINE); |
| 1142 | write++; |
| 1143 | } |
| 1144 | } |
| 1145 | } |
| 1146 | |
| 1147 | /* ISIS - Priority */ |
| 1148 | if (circuit->priority[0] == circuit->priority[1]) |
| 1149 | { |
| 1150 | if (circuit->priority[0] != DEFAULT_PRIORITY) |
| 1151 | { |
| 1152 | vty_out (vty, " isis priority %d%s", |
| 1153 | circuit->priority[0], VTY_NEWLINE); |
| 1154 | write++; |
| 1155 | } |
| 1156 | } |
| 1157 | else |
| 1158 | { |
| 1159 | for (i = 0; i < 2; i++) |
| 1160 | { |
| 1161 | if (circuit->priority[i] != DEFAULT_PRIORITY) |
| 1162 | { |
| 1163 | vty_out (vty, " isis priority %d level-%d%s", |
| 1164 | circuit->priority[i], i + 1, VTY_NEWLINE); |
| 1165 | write++; |
| 1166 | } |
| 1167 | } |
| 1168 | } |
| 1169 | |
| 1170 | /* ISIS - Metric */ |
| 1171 | if (circuit->te_metric[0] == circuit->te_metric[1]) |
| 1172 | { |
| 1173 | if (circuit->te_metric[0] != DEFAULT_CIRCUIT_METRIC) |
| 1174 | { |
| 1175 | vty_out (vty, " isis metric %d%s", circuit->te_metric[0], |
| 1176 | VTY_NEWLINE); |
| 1177 | write++; |
| 1178 | } |
| 1179 | } |
| 1180 | else |
| 1181 | { |
| 1182 | for (i = 0; i < 2; i++) |
| 1183 | { |
| 1184 | if (circuit->te_metric[i] != DEFAULT_CIRCUIT_METRIC) |
| 1185 | { |
| 1186 | vty_out (vty, " isis metric %d level-%d%s", |
| 1187 | circuit->te_metric[i], i + 1, VTY_NEWLINE); |
| 1188 | write++; |
| 1189 | } |
| 1190 | } |
| 1191 | } |
| 1192 | if (circuit->passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5) |
| 1193 | { |
| 1194 | vty_out (vty, " isis password md5 %s%s", circuit->passwd.passwd, |
| 1195 | VTY_NEWLINE); |
| 1196 | write++; |
| 1197 | } |
| 1198 | else if (circuit->passwd.type == ISIS_PASSWD_TYPE_CLEARTXT) |
| 1199 | { |
| 1200 | vty_out (vty, " isis password clear %s%s", circuit->passwd.passwd, |
| 1201 | VTY_NEWLINE); |
| 1202 | write++; |
| 1203 | } |
| 1204 | } |
| 1205 | vty_out (vty, "!%s", VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1206 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1207 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1208 | return write; |
| 1209 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1210 | |
| 1211 | DEFUN (ip_router_isis, |
| 1212 | ip_router_isis_cmd, |
| 1213 | "ip router isis WORD", |
| 1214 | "Interface Internet Protocol config commands\n" |
| 1215 | "IP router interface commands\n" |
| 1216 | "IS-IS Routing for IP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1217 | "Routing process tag\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1218 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1219 | struct isis_circuit *circuit; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1220 | struct interface *ifp; |
| 1221 | struct isis_area *area; |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame^] | 1222 | int rv; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1223 | |
| 1224 | ifp = (struct interface *) vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1225 | assert (ifp); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1226 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1227 | /* Prevent more than one area per circuit */ |
| 1228 | circuit = circuit_scan_by_ifp (ifp); |
| 1229 | if (circuit) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1230 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1231 | if (circuit->ip_router == 1) |
| 1232 | { |
| 1233 | if (strcmp (circuit->area->area_tag, argv[0])) |
| 1234 | { |
| 1235 | vty_out (vty, "ISIS circuit is already defined on %s%s", |
| 1236 | circuit->area->area_tag, VTY_NEWLINE); |
| 1237 | return CMD_ERR_NOTHING_TODO; |
| 1238 | } |
| 1239 | return CMD_SUCCESS; |
| 1240 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1241 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1242 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1243 | if (isis_area_get (vty, argv[0]) != CMD_SUCCESS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1244 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1245 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 1246 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1247 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1248 | area = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1249 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1250 | circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area); |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame^] | 1251 | if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP) |
| 1252 | { |
| 1253 | vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE); |
| 1254 | rv = CMD_WARNING; |
| 1255 | } |
| 1256 | else |
| 1257 | { |
| 1258 | isis_circuit_if_bind (circuit, ifp); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1259 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame^] | 1260 | circuit->ip_router = 1; |
| 1261 | area->ip_circuits++; |
| 1262 | circuit_update_nlpids (circuit); |
| 1263 | rv = CMD_SUCCESS; |
| 1264 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1265 | |
| 1266 | vty->node = INTERFACE_NODE; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1267 | vty->index = ifp; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1268 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame^] | 1269 | return rv; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1270 | } |
| 1271 | |
| 1272 | DEFUN (no_ip_router_isis, |
| 1273 | no_ip_router_isis_cmd, |
| 1274 | "no ip router isis WORD", |
| 1275 | NO_STR |
| 1276 | "Interface Internet Protocol config commands\n" |
| 1277 | "IP router interface commands\n" |
| 1278 | "IS-IS Routing for IP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1279 | "Routing process tag\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1280 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1281 | struct interface *ifp; |
| 1282 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1283 | struct isis_circuit *circuit; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1284 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1285 | ifp = (struct interface *) vty->index; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1286 | if (!ifp) |
| 1287 | { |
| 1288 | vty_out (vty, "Invalid interface %s", VTY_NEWLINE); |
| 1289 | return CMD_ERR_NO_MATCH; |
| 1290 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1291 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1292 | area = isis_area_lookup (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1293 | if (!area) |
| 1294 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1295 | vty_out (vty, "Can't find ISIS instance %s%s", |
| 1296 | argv[0], VTY_NEWLINE); |
| 1297 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1298 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1299 | |
| 1300 | circuit = circuit_lookup_by_ifp (ifp, area->circuit_list); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1301 | if (!circuit) |
| 1302 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1303 | vty_out (vty, "ISIS is not enabled on circuit %s%s", |
| 1304 | ifp->name, VTY_NEWLINE); |
| 1305 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1306 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1307 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1308 | circuit->ip_router = 0; |
| 1309 | area->ip_circuits--; |
| 1310 | #ifdef HAVE_IPV6 |
| 1311 | if (circuit->ipv6_router == 0) |
| 1312 | #endif |
| 1313 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1314 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1315 | return CMD_SUCCESS; |
| 1316 | } |
| 1317 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1318 | #ifdef HAVE_IPV6 |
| 1319 | DEFUN (ipv6_router_isis, |
| 1320 | ipv6_router_isis_cmd, |
| 1321 | "ipv6 router isis WORD", |
| 1322 | "IPv6 interface subcommands\n" |
| 1323 | "IPv6 Router interface commands\n" |
| 1324 | "IS-IS Routing for IPv6\n" |
| 1325 | "Routing process tag\n") |
| 1326 | { |
| 1327 | struct isis_circuit *circuit; |
| 1328 | struct interface *ifp; |
| 1329 | struct isis_area *area; |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame^] | 1330 | int rv; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1331 | |
| 1332 | ifp = (struct interface *) vty->index; |
| 1333 | assert (ifp); |
| 1334 | |
| 1335 | /* Prevent more than one area per circuit */ |
| 1336 | circuit = circuit_scan_by_ifp (ifp); |
| 1337 | if (circuit) |
| 1338 | { |
| 1339 | if (circuit->ipv6_router == 1) |
| 1340 | { |
| 1341 | if (strcmp (circuit->area->area_tag, argv[0])) |
| 1342 | { |
| 1343 | vty_out (vty, "ISIS circuit is already defined for IPv6 on %s%s", |
| 1344 | circuit->area->area_tag, VTY_NEWLINE); |
| 1345 | return CMD_ERR_NOTHING_TODO; |
| 1346 | } |
| 1347 | return CMD_SUCCESS; |
| 1348 | } |
| 1349 | } |
| 1350 | |
| 1351 | if (isis_area_get (vty, argv[0]) != CMD_SUCCESS) |
| 1352 | { |
| 1353 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 1354 | return CMD_ERR_NO_MATCH; |
| 1355 | } |
| 1356 | area = vty->index; |
| 1357 | |
| 1358 | circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area); |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame^] | 1359 | if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP) |
| 1360 | { |
| 1361 | vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE); |
| 1362 | rv = CMD_WARNING; |
| 1363 | } |
| 1364 | else |
| 1365 | { |
| 1366 | isis_circuit_if_bind (circuit, ifp); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1367 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame^] | 1368 | circuit->ipv6_router = 1; |
| 1369 | area->ipv6_circuits++; |
| 1370 | circuit_update_nlpids (circuit); |
| 1371 | rv = CMD_SUCCESS; |
| 1372 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1373 | |
| 1374 | vty->node = INTERFACE_NODE; |
| 1375 | vty->index = ifp; |
| 1376 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame^] | 1377 | return rv; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1378 | } |
| 1379 | |
| 1380 | DEFUN (no_ipv6_router_isis, |
| 1381 | no_ipv6_router_isis_cmd, |
| 1382 | "no ipv6 router isis WORD", |
| 1383 | NO_STR |
| 1384 | "IPv6 interface subcommands\n" |
| 1385 | "IPv6 Router interface commands\n" |
| 1386 | "IS-IS Routing for IPv6\n" |
| 1387 | "Routing process tag\n") |
| 1388 | { |
| 1389 | struct interface *ifp; |
| 1390 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1391 | struct isis_circuit *circuit; |
| 1392 | |
| 1393 | ifp = (struct interface *) vty->index; |
| 1394 | if (!ifp) |
| 1395 | { |
| 1396 | vty_out (vty, "Invalid interface %s", VTY_NEWLINE); |
| 1397 | return CMD_ERR_NO_MATCH; |
| 1398 | } |
| 1399 | |
| 1400 | area = isis_area_lookup (argv[0]); |
| 1401 | if (!area) |
| 1402 | { |
| 1403 | vty_out (vty, "Can't find ISIS instance %s%s", |
| 1404 | argv[0], VTY_NEWLINE); |
| 1405 | return CMD_ERR_NO_MATCH; |
| 1406 | } |
| 1407 | |
| 1408 | circuit = circuit_lookup_by_ifp (ifp, area->circuit_list); |
| 1409 | if (!circuit) |
| 1410 | { |
| 1411 | vty_out (vty, "ISIS is not enabled on circuit %s%s", |
| 1412 | ifp->name, VTY_NEWLINE); |
| 1413 | return CMD_ERR_NO_MATCH; |
| 1414 | } |
| 1415 | |
| 1416 | circuit->ipv6_router = 0; |
| 1417 | area->ipv6_circuits--; |
| 1418 | if (circuit->ip_router == 0) |
| 1419 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 1420 | |
| 1421 | return CMD_SUCCESS; |
| 1422 | } |
| 1423 | #endif /* HAVE_IPV6 */ |
| 1424 | |
| 1425 | DEFUN (isis_passive, |
| 1426 | isis_passive_cmd, |
| 1427 | "isis passive", |
| 1428 | "IS-IS commands\n" |
| 1429 | "Configure the passive mode for interface\n") |
| 1430 | { |
| 1431 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1432 | if (!circuit) |
| 1433 | return CMD_ERR_NO_MATCH; |
| 1434 | |
| 1435 | if (circuit->is_passive == 1) |
| 1436 | return CMD_SUCCESS; |
| 1437 | |
| 1438 | if (circuit->state != C_STATE_UP) |
| 1439 | { |
| 1440 | circuit->is_passive = 1; |
| 1441 | } |
| 1442 | else |
| 1443 | { |
| 1444 | struct isis_area *area = circuit->area; |
| 1445 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 1446 | circuit->is_passive = 1; |
| 1447 | isis_csm_state_change (ISIS_ENABLE, circuit, area); |
| 1448 | } |
| 1449 | |
| 1450 | return CMD_SUCCESS; |
| 1451 | } |
| 1452 | |
| 1453 | DEFUN (no_isis_passive, |
| 1454 | no_isis_passive_cmd, |
| 1455 | "no isis passive", |
| 1456 | NO_STR |
| 1457 | "IS-IS commands\n" |
| 1458 | "Configure the passive mode for interface\n") |
| 1459 | { |
| 1460 | struct interface *ifp; |
| 1461 | struct isis_circuit *circuit; |
| 1462 | |
| 1463 | ifp = (struct interface *) vty->index; |
| 1464 | if (!ifp) |
| 1465 | { |
| 1466 | vty_out (vty, "Invalid interface %s", VTY_NEWLINE); |
| 1467 | return CMD_ERR_NO_MATCH; |
| 1468 | } |
| 1469 | |
| 1470 | /* FIXME: what is wrong with circuit = ifp->info ? */ |
| 1471 | circuit = circuit_scan_by_ifp (ifp); |
| 1472 | if (!circuit) |
| 1473 | { |
| 1474 | vty_out (vty, "ISIS is not enabled on circuit %s%s", |
| 1475 | ifp->name, VTY_NEWLINE); |
| 1476 | return CMD_ERR_NO_MATCH; |
| 1477 | } |
| 1478 | |
| 1479 | if (if_is_loopback(ifp)) |
| 1480 | { |
| 1481 | vty_out (vty, "Can't set no passive for loopback interface%s", |
| 1482 | VTY_NEWLINE); |
| 1483 | return CMD_ERR_AMBIGUOUS; |
| 1484 | } |
| 1485 | |
| 1486 | if (circuit->is_passive == 0) |
| 1487 | return CMD_SUCCESS; |
| 1488 | |
| 1489 | if (circuit->state != C_STATE_UP) |
| 1490 | { |
| 1491 | circuit->is_passive = 0; |
| 1492 | } |
| 1493 | else |
| 1494 | { |
| 1495 | struct isis_area *area = circuit->area; |
| 1496 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 1497 | circuit->is_passive = 0; |
| 1498 | isis_csm_state_change (ISIS_ENABLE, circuit, area); |
| 1499 | } |
| 1500 | |
| 1501 | return CMD_SUCCESS; |
| 1502 | } |
| 1503 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1504 | DEFUN (isis_circuit_type, |
| 1505 | isis_circuit_type_cmd, |
| 1506 | "isis circuit-type (level-1|level-1-2|level-2-only)", |
| 1507 | "IS-IS commands\n" |
| 1508 | "Configure circuit type for interface\n" |
| 1509 | "Level-1 only adjacencies are formed\n" |
| 1510 | "Level-1-2 adjacencies are formed\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1511 | "Level-2 only adjacencies are formed\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1512 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1513 | int circuit_type; |
| 1514 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1515 | if (!circuit) |
| 1516 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1517 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1518 | circuit_type = string2circuit_t (argv[0]); |
| 1519 | if (!circuit_type) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1520 | { |
| 1521 | vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1522 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1523 | } |
| 1524 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1525 | if (circuit->state == C_STATE_UP && |
| 1526 | circuit->area->is_type != IS_LEVEL_1_AND_2 && |
| 1527 | circuit->area->is_type != circuit_type) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1528 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1529 | vty_out (vty, "Invalid circuit level for area %s.%s", |
| 1530 | circuit->area->area_tag, VTY_NEWLINE); |
| 1531 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1532 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1533 | isis_event_circuit_type_change (circuit, circuit_type); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1534 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1535 | return CMD_SUCCESS; |
| 1536 | } |
| 1537 | |
| 1538 | DEFUN (no_isis_circuit_type, |
| 1539 | no_isis_circuit_type_cmd, |
| 1540 | "no isis circuit-type (level-1|level-1-2|level-2-only)", |
| 1541 | NO_STR |
| 1542 | "IS-IS commands\n" |
| 1543 | "Configure circuit type for interface\n" |
| 1544 | "Level-1 only adjacencies are formed\n" |
| 1545 | "Level-1-2 adjacencies are formed\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1546 | "Level-2 only adjacencies are formed\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1547 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1548 | int circuit_type; |
| 1549 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1550 | if (!circuit) |
| 1551 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1552 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1553 | /* |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1554 | * Set the circuits level to its default value |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1555 | */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1556 | if (circuit->state == C_STATE_UP) |
| 1557 | circuit_type = circuit->area->is_type; |
| 1558 | else |
| 1559 | circuit_type = IS_LEVEL_1_AND_2; |
| 1560 | isis_event_circuit_type_change (circuit, circuit_type); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1561 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1562 | return CMD_SUCCESS; |
| 1563 | } |
| 1564 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1565 | DEFUN (isis_passwd_md5, |
| 1566 | isis_passwd_md5_cmd, |
| 1567 | "isis password md5 WORD", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1568 | "IS-IS commands\n" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1569 | "Configure the authentication password for a circuit\n" |
| 1570 | "Authentication type\n" |
| 1571 | "Circuit password\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1572 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1573 | int len; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1574 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1575 | if (!circuit) |
| 1576 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1577 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1578 | len = strlen (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1579 | if (len > 254) |
| 1580 | { |
| 1581 | vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1582 | return CMD_ERR_AMBIGUOUS; |
| 1583 | } |
| 1584 | circuit->passwd.len = len; |
| 1585 | circuit->passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5; |
| 1586 | strncpy ((char *)circuit->passwd.passwd, argv[0], 255); |
| 1587 | |
| 1588 | return CMD_SUCCESS; |
| 1589 | } |
| 1590 | |
| 1591 | DEFUN (isis_passwd_clear, |
| 1592 | isis_passwd_clear_cmd, |
| 1593 | "isis password clear WORD", |
| 1594 | "IS-IS commands\n" |
| 1595 | "Configure the authentication password for a circuit\n" |
| 1596 | "Authentication type\n" |
| 1597 | "Circuit password\n") |
| 1598 | { |
| 1599 | int len; |
| 1600 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1601 | if (!circuit) |
| 1602 | return CMD_ERR_NO_MATCH; |
| 1603 | |
| 1604 | len = strlen (argv[0]); |
| 1605 | if (len > 254) |
| 1606 | { |
| 1607 | vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE); |
| 1608 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1609 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1610 | circuit->passwd.len = len; |
| 1611 | circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT; |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 1612 | strncpy ((char *)circuit->passwd.passwd, argv[0], 255); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1613 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1614 | return CMD_SUCCESS; |
| 1615 | } |
| 1616 | |
| 1617 | DEFUN (no_isis_passwd, |
| 1618 | no_isis_passwd_cmd, |
| 1619 | "no isis password", |
| 1620 | NO_STR |
| 1621 | "IS-IS commands\n" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1622 | "Configure the authentication password for a circuit\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1623 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1624 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1625 | if (!circuit) |
| 1626 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1627 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1628 | memset (&circuit->passwd, 0, sizeof (struct isis_passwd)); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1629 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1630 | return CMD_SUCCESS; |
| 1631 | } |
| 1632 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1633 | DEFUN (isis_priority, |
| 1634 | isis_priority_cmd, |
| 1635 | "isis priority <0-127>", |
| 1636 | "IS-IS commands\n" |
| 1637 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1638 | "Priority value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1639 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1640 | int prio; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1641 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1642 | if (!circuit) |
| 1643 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1644 | |
| 1645 | prio = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1646 | if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) |
| 1647 | { |
| 1648 | vty_out (vty, "Invalid priority %d - should be <0-127>%s", |
| 1649 | prio, VTY_NEWLINE); |
| 1650 | return CMD_ERR_AMBIGUOUS; |
| 1651 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1652 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1653 | circuit->priority[0] = prio; |
| 1654 | circuit->priority[1] = prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1655 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1656 | return CMD_SUCCESS; |
| 1657 | } |
| 1658 | |
| 1659 | DEFUN (no_isis_priority, |
| 1660 | no_isis_priority_cmd, |
| 1661 | "no isis priority", |
| 1662 | NO_STR |
| 1663 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1664 | "Set priority for Designated Router election\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1665 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1666 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1667 | if (!circuit) |
| 1668 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1669 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1670 | circuit->priority[0] = DEFAULT_PRIORITY; |
| 1671 | circuit->priority[1] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1672 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1673 | return CMD_SUCCESS; |
| 1674 | } |
| 1675 | |
| 1676 | ALIAS (no_isis_priority, |
| 1677 | no_isis_priority_arg_cmd, |
| 1678 | "no isis priority <0-127>", |
| 1679 | NO_STR |
| 1680 | "IS-IS commands\n" |
| 1681 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1682 | "Priority value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1683 | |
| 1684 | DEFUN (isis_priority_l1, |
| 1685 | isis_priority_l1_cmd, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1686 | "isis priority <0-127> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1687 | "IS-IS commands\n" |
| 1688 | "Set priority for Designated Router election\n" |
| 1689 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1690 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1691 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1692 | int prio; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1693 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1694 | if (!circuit) |
| 1695 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1696 | |
| 1697 | prio = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1698 | if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) |
| 1699 | { |
| 1700 | vty_out (vty, "Invalid priority %d - should be <0-127>%s", |
| 1701 | prio, VTY_NEWLINE); |
| 1702 | return CMD_ERR_AMBIGUOUS; |
| 1703 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1704 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1705 | circuit->priority[0] = prio; |
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 | |
| 1710 | DEFUN (no_isis_priority_l1, |
| 1711 | no_isis_priority_l1_cmd, |
| 1712 | "no isis priority level-1", |
| 1713 | NO_STR |
| 1714 | "IS-IS commands\n" |
| 1715 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1716 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1717 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1718 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1719 | if (!circuit) |
| 1720 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1721 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1722 | circuit->priority[0] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1723 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1724 | return CMD_SUCCESS; |
| 1725 | } |
| 1726 | |
| 1727 | ALIAS (no_isis_priority_l1, |
| 1728 | no_isis_priority_l1_arg_cmd, |
| 1729 | "no isis priority <0-127> level-1", |
| 1730 | NO_STR |
| 1731 | "IS-IS commands\n" |
| 1732 | "Set priority for Designated Router election\n" |
| 1733 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1734 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1735 | |
| 1736 | DEFUN (isis_priority_l2, |
| 1737 | isis_priority_l2_cmd, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1738 | "isis priority <0-127> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1739 | "IS-IS commands\n" |
| 1740 | "Set priority for Designated Router election\n" |
| 1741 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1742 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1743 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1744 | int prio; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1745 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1746 | if (!circuit) |
| 1747 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1748 | |
| 1749 | prio = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1750 | if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) |
| 1751 | { |
| 1752 | vty_out (vty, "Invalid priority %d - should be <0-127>%s", |
| 1753 | prio, VTY_NEWLINE); |
| 1754 | return CMD_ERR_AMBIGUOUS; |
| 1755 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1756 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1757 | circuit->priority[1] = prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1758 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1759 | return CMD_SUCCESS; |
| 1760 | } |
| 1761 | |
| 1762 | DEFUN (no_isis_priority_l2, |
| 1763 | no_isis_priority_l2_cmd, |
| 1764 | "no isis priority level-2", |
| 1765 | NO_STR |
| 1766 | "IS-IS commands\n" |
| 1767 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1768 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1769 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1770 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1771 | if (!circuit) |
| 1772 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1773 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1774 | circuit->priority[1] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1775 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1776 | return CMD_SUCCESS; |
| 1777 | } |
| 1778 | |
| 1779 | ALIAS (no_isis_priority_l2, |
| 1780 | no_isis_priority_l2_arg_cmd, |
| 1781 | "no isis priority <0-127> level-2", |
| 1782 | NO_STR |
| 1783 | "IS-IS commands\n" |
| 1784 | "Set priority for Designated Router election\n" |
| 1785 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1786 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1787 | |
| 1788 | /* Metric command */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1789 | DEFUN (isis_metric, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1790 | isis_metric_cmd, |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 1791 | "isis metric <0-16777215>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1792 | "IS-IS commands\n" |
| 1793 | "Set default metric for circuit\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1794 | "Default metric value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1795 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1796 | int met; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1797 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1798 | if (!circuit) |
| 1799 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1800 | |
| 1801 | met = atoi (argv[0]); |
| 1802 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1803 | /* RFC3787 section 5.1 */ |
| 1804 | if (circuit->area && circuit->area->oldmetric == 1 && |
| 1805 | met > MAX_NARROW_LINK_METRIC) |
| 1806 | { |
| 1807 | vty_out (vty, "Invalid metric %d - should be <0-63> " |
| 1808 | "when narrow metric type enabled%s", |
| 1809 | met, VTY_NEWLINE); |
| 1810 | return CMD_ERR_AMBIGUOUS; |
| 1811 | } |
| 1812 | |
| 1813 | /* RFC4444 */ |
| 1814 | if (circuit->area && circuit->area->newmetric == 1 && |
| 1815 | met > MAX_WIDE_LINK_METRIC) |
| 1816 | { |
| 1817 | vty_out (vty, "Invalid metric %d - should be <0-16777215> " |
| 1818 | "when wide metric type enabled%s", |
| 1819 | met, VTY_NEWLINE); |
| 1820 | return CMD_ERR_AMBIGUOUS; |
| 1821 | } |
| 1822 | |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 1823 | circuit->te_metric[0] = met; |
| 1824 | circuit->te_metric[1] = met; |
| 1825 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1826 | circuit->metrics[0].metric_default = met; |
| 1827 | circuit->metrics[1].metric_default = met; |
| 1828 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1829 | if (circuit->area) |
| 1830 | lsp_regenerate_schedule (circuit->area, circuit->is_type, 0); |
| 1831 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1832 | return CMD_SUCCESS; |
| 1833 | } |
| 1834 | |
| 1835 | DEFUN (no_isis_metric, |
| 1836 | no_isis_metric_cmd, |
| 1837 | "no isis metric", |
| 1838 | NO_STR |
| 1839 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1840 | "Set default metric for circuit\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1841 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1842 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1843 | if (!circuit) |
| 1844 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1845 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1846 | circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC; |
| 1847 | circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC; |
| 1848 | circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC; |
| 1849 | circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1850 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1851 | if (circuit->area) |
| 1852 | lsp_regenerate_schedule (circuit->area, circuit->is_type, 0); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1853 | |
| 1854 | return CMD_SUCCESS; |
| 1855 | } |
| 1856 | |
| 1857 | ALIAS (no_isis_metric, |
| 1858 | no_isis_metric_arg_cmd, |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 1859 | "no isis metric <0-16777215>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1860 | NO_STR |
| 1861 | "IS-IS commands\n" |
| 1862 | "Set default metric for circuit\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1863 | "Default metric value\n") |
| 1864 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1865 | DEFUN (isis_metric_l1, |
| 1866 | isis_metric_l1_cmd, |
| 1867 | "isis metric <0-16777215> level-1", |
| 1868 | "IS-IS commands\n" |
| 1869 | "Set default metric for circuit\n" |
| 1870 | "Default metric value\n" |
| 1871 | "Specify metric for level-1 routing\n") |
| 1872 | { |
| 1873 | int met; |
| 1874 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1875 | if (!circuit) |
| 1876 | return CMD_ERR_NO_MATCH; |
| 1877 | |
| 1878 | met = atoi (argv[0]); |
| 1879 | |
| 1880 | /* RFC3787 section 5.1 */ |
| 1881 | if (circuit->area && circuit->area->oldmetric == 1 && |
| 1882 | met > MAX_NARROW_LINK_METRIC) |
| 1883 | { |
| 1884 | vty_out (vty, "Invalid metric %d - should be <0-63> " |
| 1885 | "when narrow metric type enabled%s", |
| 1886 | met, VTY_NEWLINE); |
| 1887 | return CMD_ERR_AMBIGUOUS; |
| 1888 | } |
| 1889 | |
| 1890 | /* RFC4444 */ |
| 1891 | if (circuit->area && circuit->area->newmetric == 1 && |
| 1892 | met > MAX_WIDE_LINK_METRIC) |
| 1893 | { |
| 1894 | vty_out (vty, "Invalid metric %d - should be <0-16777215> " |
| 1895 | "when wide metric type enabled%s", |
| 1896 | met, VTY_NEWLINE); |
| 1897 | return CMD_ERR_AMBIGUOUS; |
| 1898 | } |
| 1899 | |
| 1900 | circuit->te_metric[0] = met; |
| 1901 | circuit->metrics[0].metric_default = met; |
| 1902 | |
| 1903 | if (circuit->area) |
| 1904 | lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0); |
| 1905 | |
| 1906 | return CMD_SUCCESS; |
| 1907 | } |
| 1908 | |
| 1909 | DEFUN (no_isis_metric_l1, |
| 1910 | no_isis_metric_l1_cmd, |
| 1911 | "no isis metric level-1", |
| 1912 | NO_STR |
| 1913 | "IS-IS commands\n" |
| 1914 | "Set default metric for circuit\n" |
| 1915 | "Specify metric for level-1 routing\n") |
| 1916 | { |
| 1917 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1918 | if (!circuit) |
| 1919 | return CMD_ERR_NO_MATCH; |
| 1920 | |
| 1921 | circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC; |
| 1922 | circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC; |
| 1923 | |
| 1924 | if (circuit->area) |
| 1925 | lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0); |
| 1926 | |
| 1927 | return CMD_SUCCESS; |
| 1928 | } |
| 1929 | |
| 1930 | ALIAS (no_isis_metric_l1, |
| 1931 | no_isis_metric_l1_arg_cmd, |
| 1932 | "no isis metric <0-16777215> level-1", |
| 1933 | NO_STR |
| 1934 | "IS-IS commands\n" |
| 1935 | "Set default metric for circuit\n" |
| 1936 | "Default metric value\n" |
| 1937 | "Specify metric for level-1 routing\n") |
| 1938 | |
| 1939 | DEFUN (isis_metric_l2, |
| 1940 | isis_metric_l2_cmd, |
| 1941 | "isis metric <0-16777215> level-2", |
| 1942 | "IS-IS commands\n" |
| 1943 | "Set default metric for circuit\n" |
| 1944 | "Default metric value\n" |
| 1945 | "Specify metric for level-2 routing\n") |
| 1946 | { |
| 1947 | int met; |
| 1948 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1949 | if (!circuit) |
| 1950 | return CMD_ERR_NO_MATCH; |
| 1951 | |
| 1952 | met = atoi (argv[0]); |
| 1953 | |
| 1954 | /* RFC3787 section 5.1 */ |
| 1955 | if (circuit->area && circuit->area->oldmetric == 1 && |
| 1956 | met > MAX_NARROW_LINK_METRIC) |
| 1957 | { |
| 1958 | vty_out (vty, "Invalid metric %d - should be <0-63> " |
| 1959 | "when narrow metric type enabled%s", |
| 1960 | met, VTY_NEWLINE); |
| 1961 | return CMD_ERR_AMBIGUOUS; |
| 1962 | } |
| 1963 | |
| 1964 | /* RFC4444 */ |
| 1965 | if (circuit->area && circuit->area->newmetric == 1 && |
| 1966 | met > MAX_WIDE_LINK_METRIC) |
| 1967 | { |
| 1968 | vty_out (vty, "Invalid metric %d - should be <0-16777215> " |
| 1969 | "when wide metric type enabled%s", |
| 1970 | met, VTY_NEWLINE); |
| 1971 | return CMD_ERR_AMBIGUOUS; |
| 1972 | } |
| 1973 | |
| 1974 | circuit->te_metric[1] = met; |
| 1975 | circuit->metrics[1].metric_default = met; |
| 1976 | |
| 1977 | if (circuit->area) |
| 1978 | lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0); |
| 1979 | |
| 1980 | return CMD_SUCCESS; |
| 1981 | } |
| 1982 | |
| 1983 | DEFUN (no_isis_metric_l2, |
| 1984 | no_isis_metric_l2_cmd, |
| 1985 | "no isis metric level-2", |
| 1986 | NO_STR |
| 1987 | "IS-IS commands\n" |
| 1988 | "Set default metric for circuit\n" |
| 1989 | "Specify metric for level-2 routing\n") |
| 1990 | { |
| 1991 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1992 | if (!circuit) |
| 1993 | return CMD_ERR_NO_MATCH; |
| 1994 | |
| 1995 | circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC; |
| 1996 | circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC; |
| 1997 | |
| 1998 | if (circuit->area) |
| 1999 | lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0); |
| 2000 | |
| 2001 | return CMD_SUCCESS; |
| 2002 | } |
| 2003 | |
| 2004 | ALIAS (no_isis_metric_l2, |
| 2005 | no_isis_metric_l2_arg_cmd, |
| 2006 | "no isis metric <0-16777215> level-2", |
| 2007 | NO_STR |
| 2008 | "IS-IS commands\n" |
| 2009 | "Set default metric for circuit\n" |
| 2010 | "Default metric value\n" |
| 2011 | "Specify metric for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2012 | /* end of metrics */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2013 | |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 2014 | DEFUN (isis_hello_interval, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2015 | isis_hello_interval_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2016 | "isis hello-interval <1-600>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2017 | "IS-IS commands\n" |
| 2018 | "Set Hello interval\n" |
| 2019 | "Hello interval value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2020 | "Holdtime 1 seconds, interval depends on multiplier\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2021 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2022 | int interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2023 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2024 | if (!circuit) |
| 2025 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2026 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2027 | interval = atoi (argv[0]); |
| 2028 | if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2029 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2030 | vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s", |
| 2031 | interval, VTY_NEWLINE); |
| 2032 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2033 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2034 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2035 | circuit->hello_interval[0] = (u_int16_t) interval; |
| 2036 | circuit->hello_interval[1] = (u_int16_t) interval; |
| 2037 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2038 | return CMD_SUCCESS; |
| 2039 | } |
| 2040 | |
| 2041 | DEFUN (no_isis_hello_interval, |
| 2042 | no_isis_hello_interval_cmd, |
| 2043 | "no isis hello-interval", |
| 2044 | NO_STR |
| 2045 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2046 | "Set Hello interval\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2047 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2048 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2049 | if (!circuit) |
| 2050 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2051 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2052 | circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL; |
| 2053 | circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2054 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2055 | return CMD_SUCCESS; |
| 2056 | } |
| 2057 | |
| 2058 | ALIAS (no_isis_hello_interval, |
| 2059 | no_isis_hello_interval_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2060 | "no isis hello-interval <1-600>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2061 | NO_STR |
| 2062 | "IS-IS commands\n" |
| 2063 | "Set Hello interval\n" |
| 2064 | "Hello interval value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2065 | "Holdtime 1 second, interval depends on multiplier\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2066 | |
| 2067 | DEFUN (isis_hello_interval_l1, |
| 2068 | isis_hello_interval_l1_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2069 | "isis hello-interval <1-600> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2070 | "IS-IS commands\n" |
| 2071 | "Set Hello interval\n" |
| 2072 | "Hello interval value\n" |
| 2073 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2074 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2075 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2076 | long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2077 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2078 | if (!circuit) |
| 2079 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2080 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2081 | interval = atoi (argv[0]); |
| 2082 | if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2083 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2084 | vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", |
| 2085 | interval, VTY_NEWLINE); |
| 2086 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2087 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2088 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2089 | circuit->hello_interval[0] = (u_int16_t) interval; |
| 2090 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2091 | return CMD_SUCCESS; |
| 2092 | } |
| 2093 | |
| 2094 | DEFUN (no_isis_hello_interval_l1, |
| 2095 | no_isis_hello_interval_l1_cmd, |
| 2096 | "no isis hello-interval level-1", |
| 2097 | NO_STR |
| 2098 | "IS-IS commands\n" |
| 2099 | "Set Hello interval\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2100 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2101 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2102 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2103 | if (!circuit) |
| 2104 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2105 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2106 | circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2107 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2108 | return CMD_SUCCESS; |
| 2109 | } |
| 2110 | |
| 2111 | ALIAS (no_isis_hello_interval_l1, |
| 2112 | no_isis_hello_interval_l1_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2113 | "no isis hello-interval <1-600> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2114 | NO_STR |
| 2115 | "IS-IS commands\n" |
| 2116 | "Set Hello interval\n" |
| 2117 | "Hello interval value\n" |
| 2118 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2119 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2120 | |
| 2121 | DEFUN (isis_hello_interval_l2, |
| 2122 | isis_hello_interval_l2_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2123 | "isis hello-interval <1-600> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2124 | "IS-IS commands\n" |
| 2125 | "Set Hello interval\n" |
| 2126 | "Hello interval value\n" |
| 2127 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2128 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2129 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2130 | long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2131 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2132 | if (!circuit) |
| 2133 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2134 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2135 | interval = atoi (argv[0]); |
| 2136 | if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2137 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2138 | vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", |
| 2139 | interval, VTY_NEWLINE); |
| 2140 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2141 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2142 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2143 | circuit->hello_interval[1] = (u_int16_t) interval; |
| 2144 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2145 | return CMD_SUCCESS; |
| 2146 | } |
| 2147 | |
| 2148 | DEFUN (no_isis_hello_interval_l2, |
| 2149 | no_isis_hello_interval_l2_cmd, |
| 2150 | "no isis hello-interval level-2", |
| 2151 | NO_STR |
| 2152 | "IS-IS commands\n" |
| 2153 | "Set Hello interval\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2154 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2155 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2156 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2157 | if (!circuit) |
| 2158 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2159 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2160 | circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2161 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2162 | return CMD_SUCCESS; |
| 2163 | } |
| 2164 | |
| 2165 | ALIAS (no_isis_hello_interval_l2, |
| 2166 | no_isis_hello_interval_l2_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2167 | "no isis hello-interval <1-600> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2168 | NO_STR |
| 2169 | "IS-IS commands\n" |
| 2170 | "Set Hello interval\n" |
| 2171 | "Hello interval value\n" |
| 2172 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2173 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2174 | |
| 2175 | DEFUN (isis_hello_multiplier, |
| 2176 | isis_hello_multiplier_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2177 | "isis hello-multiplier <2-100>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2178 | "IS-IS commands\n" |
| 2179 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2180 | "Hello multiplier value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2181 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2182 | int mult; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2183 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2184 | if (!circuit) |
| 2185 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2186 | |
| 2187 | mult = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2188 | if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) |
| 2189 | { |
| 2190 | vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", |
| 2191 | mult, VTY_NEWLINE); |
| 2192 | return CMD_ERR_AMBIGUOUS; |
| 2193 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2194 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2195 | circuit->hello_multiplier[0] = (u_int16_t) mult; |
| 2196 | circuit->hello_multiplier[1] = (u_int16_t) mult; |
| 2197 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2198 | return CMD_SUCCESS; |
| 2199 | } |
| 2200 | |
| 2201 | DEFUN (no_isis_hello_multiplier, |
| 2202 | no_isis_hello_multiplier_cmd, |
| 2203 | "no isis hello-multiplier", |
| 2204 | NO_STR |
| 2205 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2206 | "Set multiplier for Hello holding time\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2207 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2208 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2209 | if (!circuit) |
| 2210 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2211 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2212 | circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER; |
| 2213 | circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2214 | |
| 2215 | return CMD_SUCCESS; |
| 2216 | } |
| 2217 | |
| 2218 | ALIAS (no_isis_hello_multiplier, |
| 2219 | no_isis_hello_multiplier_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2220 | "no isis hello-multiplier <2-100>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2221 | NO_STR |
| 2222 | "IS-IS commands\n" |
| 2223 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2224 | "Hello multiplier value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2225 | |
| 2226 | DEFUN (isis_hello_multiplier_l1, |
| 2227 | isis_hello_multiplier_l1_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2228 | "isis hello-multiplier <2-100> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2229 | "IS-IS commands\n" |
| 2230 | "Set multiplier for Hello holding time\n" |
| 2231 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2232 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2233 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2234 | int mult; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2235 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2236 | if (!circuit) |
| 2237 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2238 | |
| 2239 | mult = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2240 | if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) |
| 2241 | { |
| 2242 | vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", |
| 2243 | mult, VTY_NEWLINE); |
| 2244 | return CMD_ERR_AMBIGUOUS; |
| 2245 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2246 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2247 | circuit->hello_multiplier[0] = (u_int16_t) mult; |
| 2248 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2249 | return CMD_SUCCESS; |
| 2250 | } |
| 2251 | |
| 2252 | DEFUN (no_isis_hello_multiplier_l1, |
| 2253 | no_isis_hello_multiplier_l1_cmd, |
| 2254 | "no isis hello-multiplier level-1", |
| 2255 | NO_STR |
| 2256 | "IS-IS commands\n" |
| 2257 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2258 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2259 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2260 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2261 | if (!circuit) |
| 2262 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2263 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2264 | circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2265 | |
| 2266 | return CMD_SUCCESS; |
| 2267 | } |
| 2268 | |
| 2269 | ALIAS (no_isis_hello_multiplier_l1, |
| 2270 | no_isis_hello_multiplier_l1_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2271 | "no isis hello-multiplier <2-100> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2272 | NO_STR |
| 2273 | "IS-IS commands\n" |
| 2274 | "Set multiplier for Hello holding time\n" |
| 2275 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2276 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2277 | |
| 2278 | DEFUN (isis_hello_multiplier_l2, |
| 2279 | isis_hello_multiplier_l2_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2280 | "isis hello-multiplier <2-100> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2281 | "IS-IS commands\n" |
| 2282 | "Set multiplier for Hello holding time\n" |
| 2283 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2284 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2285 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2286 | int mult; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2287 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2288 | if (!circuit) |
| 2289 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2290 | |
| 2291 | mult = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2292 | if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) |
| 2293 | { |
| 2294 | vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", |
| 2295 | mult, VTY_NEWLINE); |
| 2296 | return CMD_ERR_AMBIGUOUS; |
| 2297 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2298 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2299 | circuit->hello_multiplier[1] = (u_int16_t) mult; |
| 2300 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2301 | return CMD_SUCCESS; |
| 2302 | } |
| 2303 | |
| 2304 | DEFUN (no_isis_hello_multiplier_l2, |
| 2305 | no_isis_hello_multiplier_l2_cmd, |
| 2306 | "no isis hello-multiplier level-2", |
| 2307 | NO_STR |
| 2308 | "IS-IS commands\n" |
| 2309 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2310 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2311 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2312 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2313 | if (!circuit) |
| 2314 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2315 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2316 | circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2317 | |
| 2318 | return CMD_SUCCESS; |
| 2319 | } |
| 2320 | |
| 2321 | ALIAS (no_isis_hello_multiplier_l2, |
| 2322 | no_isis_hello_multiplier_l2_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2323 | "no isis hello-multiplier <2-100> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2324 | NO_STR |
| 2325 | "IS-IS commands\n" |
| 2326 | "Set multiplier for Hello holding time\n" |
| 2327 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2328 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2329 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2330 | DEFUN (isis_hello_padding, |
| 2331 | isis_hello_padding_cmd, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2332 | "isis hello padding", |
| 2333 | "IS-IS commands\n" |
| 2334 | "Add padding to IS-IS hello packets\n" |
| 2335 | "Pad hello packets\n" |
| 2336 | "<cr>\n") |
| 2337 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2338 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2339 | if (!circuit) |
| 2340 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2341 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2342 | circuit->pad_hellos = 1; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2343 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2344 | return CMD_SUCCESS; |
| 2345 | } |
| 2346 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2347 | DEFUN (no_isis_hello_padding, |
| 2348 | no_isis_hello_padding_cmd, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2349 | "no isis hello padding", |
| 2350 | NO_STR |
| 2351 | "IS-IS commands\n" |
| 2352 | "Add padding to IS-IS hello packets\n" |
| 2353 | "Pad hello packets\n" |
| 2354 | "<cr>\n") |
| 2355 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2356 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2357 | if (!circuit) |
| 2358 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2359 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2360 | circuit->pad_hellos = 0; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2361 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2362 | return CMD_SUCCESS; |
| 2363 | } |
| 2364 | |
| 2365 | DEFUN (csnp_interval, |
| 2366 | csnp_interval_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2367 | "isis csnp-interval <1-600>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2368 | "IS-IS commands\n" |
| 2369 | "Set CSNP interval in seconds\n" |
| 2370 | "CSNP interval value\n") |
| 2371 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2372 | unsigned long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2373 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2374 | if (!circuit) |
| 2375 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2376 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2377 | interval = atol (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2378 | if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) |
| 2379 | { |
| 2380 | vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", |
| 2381 | interval, VTY_NEWLINE); |
| 2382 | return CMD_ERR_AMBIGUOUS; |
| 2383 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2384 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2385 | circuit->csnp_interval[0] = (u_int16_t) interval; |
| 2386 | circuit->csnp_interval[1] = (u_int16_t) interval; |
| 2387 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2388 | return CMD_SUCCESS; |
| 2389 | } |
| 2390 | |
| 2391 | DEFUN (no_csnp_interval, |
| 2392 | no_csnp_interval_cmd, |
| 2393 | "no isis csnp-interval", |
| 2394 | NO_STR |
| 2395 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2396 | "Set CSNP interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2397 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2398 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2399 | if (!circuit) |
| 2400 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2401 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2402 | circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL; |
| 2403 | circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2404 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2405 | return CMD_SUCCESS; |
| 2406 | } |
| 2407 | |
| 2408 | ALIAS (no_csnp_interval, |
| 2409 | no_csnp_interval_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2410 | "no isis csnp-interval <1-600>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2411 | NO_STR |
| 2412 | "IS-IS commands\n" |
| 2413 | "Set CSNP interval in seconds\n" |
| 2414 | "CSNP interval value\n") |
| 2415 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2416 | DEFUN (csnp_interval_l1, |
| 2417 | csnp_interval_l1_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2418 | "isis csnp-interval <1-600> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2419 | "IS-IS commands\n" |
| 2420 | "Set CSNP interval in seconds\n" |
| 2421 | "CSNP interval value\n" |
| 2422 | "Specify interval for level-1 CSNPs\n") |
| 2423 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2424 | unsigned long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2425 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2426 | if (!circuit) |
| 2427 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2428 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2429 | interval = atol (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2430 | if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) |
| 2431 | { |
| 2432 | vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", |
| 2433 | interval, VTY_NEWLINE); |
| 2434 | return CMD_ERR_AMBIGUOUS; |
| 2435 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2436 | |
| 2437 | circuit->csnp_interval[0] = (u_int16_t) interval; |
| 2438 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2439 | return CMD_SUCCESS; |
| 2440 | } |
| 2441 | |
| 2442 | DEFUN (no_csnp_interval_l1, |
| 2443 | no_csnp_interval_l1_cmd, |
| 2444 | "no isis csnp-interval level-1", |
| 2445 | NO_STR |
| 2446 | "IS-IS commands\n" |
| 2447 | "Set CSNP interval in seconds\n" |
| 2448 | "Specify interval for level-1 CSNPs\n") |
| 2449 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2450 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2451 | if (!circuit) |
| 2452 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2453 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2454 | circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2455 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2456 | return CMD_SUCCESS; |
| 2457 | } |
| 2458 | |
| 2459 | ALIAS (no_csnp_interval_l1, |
| 2460 | no_csnp_interval_l1_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2461 | "no isis csnp-interval <1-600> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2462 | NO_STR |
| 2463 | "IS-IS commands\n" |
| 2464 | "Set CSNP interval in seconds\n" |
| 2465 | "CSNP interval value\n" |
| 2466 | "Specify interval for level-1 CSNPs\n") |
| 2467 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2468 | DEFUN (csnp_interval_l2, |
| 2469 | csnp_interval_l2_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2470 | "isis csnp-interval <1-600> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2471 | "IS-IS commands\n" |
| 2472 | "Set CSNP interval in seconds\n" |
| 2473 | "CSNP interval value\n" |
| 2474 | "Specify interval for level-2 CSNPs\n") |
| 2475 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2476 | unsigned long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2477 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2478 | if (!circuit) |
| 2479 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2480 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2481 | interval = atol (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2482 | if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) |
| 2483 | { |
| 2484 | vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", |
| 2485 | interval, VTY_NEWLINE); |
| 2486 | return CMD_ERR_AMBIGUOUS; |
| 2487 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2488 | |
| 2489 | circuit->csnp_interval[1] = (u_int16_t) interval; |
| 2490 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2491 | return CMD_SUCCESS; |
| 2492 | } |
| 2493 | |
| 2494 | DEFUN (no_csnp_interval_l2, |
| 2495 | no_csnp_interval_l2_cmd, |
| 2496 | "no isis csnp-interval level-2", |
| 2497 | NO_STR |
| 2498 | "IS-IS commands\n" |
| 2499 | "Set CSNP interval in seconds\n" |
| 2500 | "Specify interval for level-2 CSNPs\n") |
| 2501 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2502 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2503 | if (!circuit) |
| 2504 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2505 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2506 | circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2507 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2508 | return CMD_SUCCESS; |
| 2509 | } |
| 2510 | |
| 2511 | ALIAS (no_csnp_interval_l2, |
| 2512 | no_csnp_interval_l2_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2513 | "no isis csnp-interval <1-600> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2514 | NO_STR |
| 2515 | "IS-IS commands\n" |
| 2516 | "Set CSNP interval in seconds\n" |
| 2517 | "CSNP interval value\n" |
| 2518 | "Specify interval for level-2 CSNPs\n") |
| 2519 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2520 | DEFUN (psnp_interval, |
| 2521 | psnp_interval_cmd, |
| 2522 | "isis psnp-interval <1-120>", |
| 2523 | "IS-IS commands\n" |
| 2524 | "Set PSNP interval in seconds\n" |
| 2525 | "PSNP interval value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2526 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2527 | unsigned long interval; |
| 2528 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2529 | if (!circuit) |
| 2530 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2531 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2532 | interval = atol (argv[0]); |
| 2533 | if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2534 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2535 | vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", |
| 2536 | interval, VTY_NEWLINE); |
| 2537 | return CMD_ERR_AMBIGUOUS; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2538 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2539 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2540 | circuit->psnp_interval[0] = (u_int16_t) interval; |
| 2541 | circuit->psnp_interval[1] = (u_int16_t) interval; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2542 | |
| 2543 | return CMD_SUCCESS; |
| 2544 | } |
| 2545 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2546 | DEFUN (no_psnp_interval, |
| 2547 | no_psnp_interval_cmd, |
| 2548 | "no isis psnp-interval", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2549 | NO_STR |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2550 | "IS-IS commands\n" |
| 2551 | "Set PSNP interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2552 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2553 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2554 | if (!circuit) |
| 2555 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2556 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2557 | circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL; |
| 2558 | circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2559 | |
| 2560 | return CMD_SUCCESS; |
| 2561 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2562 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2563 | ALIAS (no_psnp_interval, |
| 2564 | no_psnp_interval_arg_cmd, |
| 2565 | "no isis psnp-interval <1-120>", |
| 2566 | NO_STR |
| 2567 | "IS-IS commands\n" |
| 2568 | "Set PSNP interval in seconds\n" |
| 2569 | "PSNP interval value\n") |
| 2570 | |
| 2571 | DEFUN (psnp_interval_l1, |
| 2572 | psnp_interval_l1_cmd, |
| 2573 | "isis psnp-interval <1-120> level-1", |
| 2574 | "IS-IS commands\n" |
| 2575 | "Set PSNP interval in seconds\n" |
| 2576 | "PSNP interval value\n" |
| 2577 | "Specify interval for level-1 PSNPs\n") |
| 2578 | { |
| 2579 | unsigned long interval; |
| 2580 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2581 | if (!circuit) |
| 2582 | return CMD_ERR_NO_MATCH; |
| 2583 | |
| 2584 | interval = atol (argv[0]); |
| 2585 | if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) |
| 2586 | { |
| 2587 | vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", |
| 2588 | interval, VTY_NEWLINE); |
| 2589 | return CMD_ERR_AMBIGUOUS; |
| 2590 | } |
| 2591 | |
| 2592 | circuit->psnp_interval[0] = (u_int16_t) interval; |
| 2593 | |
| 2594 | return CMD_SUCCESS; |
| 2595 | } |
| 2596 | |
| 2597 | DEFUN (no_psnp_interval_l1, |
| 2598 | no_psnp_interval_l1_cmd, |
| 2599 | "no isis psnp-interval level-1", |
| 2600 | NO_STR |
| 2601 | "IS-IS commands\n" |
| 2602 | "Set PSNP interval in seconds\n" |
| 2603 | "Specify interval for level-1 PSNPs\n") |
| 2604 | { |
| 2605 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2606 | if (!circuit) |
| 2607 | return CMD_ERR_NO_MATCH; |
| 2608 | |
| 2609 | circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL; |
| 2610 | |
| 2611 | return CMD_SUCCESS; |
| 2612 | } |
| 2613 | |
| 2614 | ALIAS (no_psnp_interval_l1, |
| 2615 | no_psnp_interval_l1_arg_cmd, |
| 2616 | "no isis psnp-interval <1-120> level-1", |
| 2617 | NO_STR |
| 2618 | "IS-IS commands\n" |
| 2619 | "Set PSNP interval in seconds\n" |
| 2620 | "PSNP interval value\n" |
| 2621 | "Specify interval for level-1 PSNPs\n") |
| 2622 | |
| 2623 | DEFUN (psnp_interval_l2, |
| 2624 | psnp_interval_l2_cmd, |
| 2625 | "isis psnp-interval <1-120> level-2", |
| 2626 | "IS-IS commands\n" |
| 2627 | "Set PSNP interval in seconds\n" |
| 2628 | "PSNP interval value\n" |
| 2629 | "Specify interval for level-2 PSNPs\n") |
| 2630 | { |
| 2631 | unsigned long interval; |
| 2632 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2633 | if (!circuit) |
| 2634 | return CMD_ERR_NO_MATCH; |
| 2635 | |
| 2636 | interval = atol (argv[0]); |
| 2637 | if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) |
| 2638 | { |
| 2639 | vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", |
| 2640 | interval, VTY_NEWLINE); |
| 2641 | return CMD_ERR_AMBIGUOUS; |
| 2642 | } |
| 2643 | |
| 2644 | circuit->psnp_interval[1] = (u_int16_t) interval; |
| 2645 | |
| 2646 | return CMD_SUCCESS; |
| 2647 | } |
| 2648 | |
| 2649 | DEFUN (no_psnp_interval_l2, |
| 2650 | no_psnp_interval_l2_cmd, |
| 2651 | "no isis psnp-interval level-2", |
| 2652 | NO_STR |
| 2653 | "IS-IS commands\n" |
| 2654 | "Set PSNP interval in seconds\n" |
| 2655 | "Specify interval for level-2 PSNPs\n") |
| 2656 | { |
| 2657 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2658 | if (!circuit) |
| 2659 | return CMD_ERR_NO_MATCH; |
| 2660 | |
| 2661 | circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL; |
| 2662 | |
| 2663 | return CMD_SUCCESS; |
| 2664 | } |
| 2665 | |
| 2666 | ALIAS (no_psnp_interval_l2, |
| 2667 | no_psnp_interval_l2_arg_cmd, |
| 2668 | "no isis psnp-interval <1-120> level-2", |
| 2669 | NO_STR |
| 2670 | "IS-IS commands\n" |
| 2671 | "Set PSNP interval in seconds\n" |
| 2672 | "PSNP interval value\n" |
| 2673 | "Specify interval for level-2 PSNPs\n") |
| 2674 | |
| 2675 | struct cmd_node interface_node = { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2676 | INTERFACE_NODE, |
| 2677 | "%s(config-if)# ", |
| 2678 | 1, |
| 2679 | }; |
| 2680 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2681 | DEFUN (isis_network, |
| 2682 | isis_network_cmd, |
| 2683 | "isis network point-to-point", |
| 2684 | "IS-IS commands\n" |
| 2685 | "Set network type\n" |
| 2686 | "point-to-point network type\n") |
| 2687 | { |
| 2688 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2689 | if (!circuit) |
| 2690 | return CMD_ERR_NO_MATCH; |
| 2691 | |
| 2692 | /* RFC5309 section 4 */ |
| 2693 | if (circuit->circ_type == CIRCUIT_T_P2P) |
| 2694 | return CMD_SUCCESS; |
| 2695 | |
| 2696 | if (circuit->state != C_STATE_UP) |
| 2697 | { |
| 2698 | circuit->circ_type = CIRCUIT_T_P2P; |
| 2699 | circuit->circ_type_config = CIRCUIT_T_P2P; |
| 2700 | } |
| 2701 | else |
| 2702 | { |
| 2703 | struct isis_area *area = circuit->area; |
| 2704 | if (!if_is_broadcast (circuit->interface)) |
| 2705 | { |
| 2706 | vty_out (vty, "isis network point-to-point " |
| 2707 | "is valid only on broadcast interfaces%s", |
| 2708 | VTY_NEWLINE); |
| 2709 | return CMD_ERR_AMBIGUOUS; |
| 2710 | } |
| 2711 | |
| 2712 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 2713 | circuit->circ_type = CIRCUIT_T_P2P; |
| 2714 | circuit->circ_type_config = CIRCUIT_T_P2P; |
| 2715 | isis_csm_state_change (ISIS_ENABLE, circuit, area); |
| 2716 | } |
| 2717 | |
| 2718 | return CMD_SUCCESS; |
| 2719 | } |
| 2720 | |
| 2721 | DEFUN (no_isis_network, |
| 2722 | no_isis_network_cmd, |
| 2723 | "no isis network point-to-point", |
| 2724 | NO_STR |
| 2725 | "IS-IS commands\n" |
| 2726 | "Set network type for circuit\n" |
| 2727 | "point-to-point network type\n") |
| 2728 | { |
| 2729 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2730 | if (!circuit) |
| 2731 | return CMD_ERR_NO_MATCH; |
| 2732 | |
| 2733 | /* RFC5309 section 4 */ |
| 2734 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 2735 | return CMD_SUCCESS; |
| 2736 | |
| 2737 | if (circuit->state != C_STATE_UP) |
| 2738 | { |
| 2739 | circuit->circ_type = CIRCUIT_T_BROADCAST; |
| 2740 | circuit->circ_type_config = CIRCUIT_T_BROADCAST; |
| 2741 | } |
| 2742 | else |
| 2743 | { |
| 2744 | struct isis_area *area = circuit->area; |
| 2745 | if (circuit->interface && |
| 2746 | !if_is_broadcast (circuit->interface)) |
| 2747 | { |
| 2748 | vty_out (vty, "no isis network point-to-point " |
| 2749 | "is valid only on broadcast interfaces%s", |
| 2750 | VTY_NEWLINE); |
| 2751 | return CMD_ERR_AMBIGUOUS; |
| 2752 | } |
| 2753 | |
| 2754 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 2755 | circuit->circ_type = CIRCUIT_T_BROADCAST; |
| 2756 | circuit->circ_type_config = CIRCUIT_T_BROADCAST; |
| 2757 | isis_csm_state_change (ISIS_ENABLE, circuit, area); |
| 2758 | } |
| 2759 | |
| 2760 | return CMD_SUCCESS; |
| 2761 | } |
| 2762 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2763 | int |
| 2764 | isis_if_new_hook (struct interface *ifp) |
| 2765 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2766 | return 0; |
| 2767 | } |
| 2768 | |
| 2769 | int |
| 2770 | isis_if_delete_hook (struct interface *ifp) |
| 2771 | { |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2772 | struct isis_circuit *circuit; |
| 2773 | /* Clean up the circuit data */ |
| 2774 | if (ifp && ifp->info) |
| 2775 | { |
| 2776 | circuit = ifp->info; |
| 2777 | isis_csm_state_change (IF_DOWN_FROM_Z, circuit, circuit->area); |
| 2778 | isis_csm_state_change (ISIS_DISABLE, circuit, circuit->area); |
| 2779 | } |
| 2780 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2781 | return 0; |
| 2782 | } |
| 2783 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2784 | void |
| 2785 | isis_circuit_init () |
| 2786 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2787 | /* Initialize Zebra interface data structure */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2788 | if_add_hook (IF_NEW_HOOK, isis_if_new_hook); |
| 2789 | if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook); |
| 2790 | |
| 2791 | /* Install interface node */ |
| 2792 | install_node (&interface_node, isis_interface_config_write); |
| 2793 | install_element (CONFIG_NODE, &interface_cmd); |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2794 | install_element (CONFIG_NODE, &no_interface_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2795 | |
| 2796 | install_default (INTERFACE_NODE); |
| 2797 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 2798 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 2799 | |
| 2800 | install_element (INTERFACE_NODE, &ip_router_isis_cmd); |
| 2801 | install_element (INTERFACE_NODE, &no_ip_router_isis_cmd); |
| 2802 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2803 | install_element (INTERFACE_NODE, &isis_passive_cmd); |
| 2804 | install_element (INTERFACE_NODE, &no_isis_passive_cmd); |
| 2805 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2806 | install_element (INTERFACE_NODE, &isis_circuit_type_cmd); |
| 2807 | install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd); |
| 2808 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2809 | install_element (INTERFACE_NODE, &isis_passwd_clear_cmd); |
| 2810 | install_element (INTERFACE_NODE, &isis_passwd_md5_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2811 | install_element (INTERFACE_NODE, &no_isis_passwd_cmd); |
| 2812 | |
| 2813 | install_element (INTERFACE_NODE, &isis_priority_cmd); |
| 2814 | install_element (INTERFACE_NODE, &no_isis_priority_cmd); |
| 2815 | install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd); |
| 2816 | install_element (INTERFACE_NODE, &isis_priority_l1_cmd); |
| 2817 | install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd); |
| 2818 | install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd); |
| 2819 | install_element (INTERFACE_NODE, &isis_priority_l2_cmd); |
| 2820 | install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd); |
| 2821 | install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd); |
| 2822 | |
| 2823 | install_element (INTERFACE_NODE, &isis_metric_cmd); |
| 2824 | install_element (INTERFACE_NODE, &no_isis_metric_cmd); |
| 2825 | install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2826 | install_element (INTERFACE_NODE, &isis_metric_l1_cmd); |
| 2827 | install_element (INTERFACE_NODE, &no_isis_metric_l1_cmd); |
| 2828 | install_element (INTERFACE_NODE, &no_isis_metric_l1_arg_cmd); |
| 2829 | install_element (INTERFACE_NODE, &isis_metric_l2_cmd); |
| 2830 | install_element (INTERFACE_NODE, &no_isis_metric_l2_cmd); |
| 2831 | install_element (INTERFACE_NODE, &no_isis_metric_l2_arg_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2832 | |
| 2833 | install_element (INTERFACE_NODE, &isis_hello_interval_cmd); |
| 2834 | install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd); |
| 2835 | install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd); |
| 2836 | install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd); |
| 2837 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd); |
| 2838 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd); |
| 2839 | install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd); |
| 2840 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd); |
| 2841 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd); |
| 2842 | |
| 2843 | install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd); |
| 2844 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd); |
| 2845 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd); |
| 2846 | install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd); |
| 2847 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd); |
| 2848 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd); |
| 2849 | install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd); |
| 2850 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd); |
| 2851 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd); |
| 2852 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2853 | install_element (INTERFACE_NODE, &isis_hello_padding_cmd); |
| 2854 | install_element (INTERFACE_NODE, &no_isis_hello_padding_cmd); |
| 2855 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2856 | install_element (INTERFACE_NODE, &csnp_interval_cmd); |
| 2857 | install_element (INTERFACE_NODE, &no_csnp_interval_cmd); |
| 2858 | install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd); |
| 2859 | install_element (INTERFACE_NODE, &csnp_interval_l1_cmd); |
| 2860 | install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd); |
| 2861 | install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd); |
| 2862 | install_element (INTERFACE_NODE, &csnp_interval_l2_cmd); |
| 2863 | install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd); |
| 2864 | install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd); |
| 2865 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2866 | install_element (INTERFACE_NODE, &psnp_interval_cmd); |
| 2867 | install_element (INTERFACE_NODE, &no_psnp_interval_cmd); |
| 2868 | install_element (INTERFACE_NODE, &no_psnp_interval_arg_cmd); |
| 2869 | install_element (INTERFACE_NODE, &psnp_interval_l1_cmd); |
| 2870 | install_element (INTERFACE_NODE, &no_psnp_interval_l1_cmd); |
| 2871 | install_element (INTERFACE_NODE, &no_psnp_interval_l1_arg_cmd); |
| 2872 | install_element (INTERFACE_NODE, &psnp_interval_l2_cmd); |
| 2873 | install_element (INTERFACE_NODE, &no_psnp_interval_l2_cmd); |
| 2874 | install_element (INTERFACE_NODE, &no_psnp_interval_l2_arg_cmd); |
| 2875 | |
| 2876 | install_element (INTERFACE_NODE, &isis_network_cmd); |
| 2877 | install_element (INTERFACE_NODE, &no_isis_network_cmd); |
| 2878 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2879 | #ifdef HAVE_IPV6 |
| 2880 | install_element (INTERFACE_NODE, &ipv6_router_isis_cmd); |
| 2881 | install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2882 | #endif |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2883 | } |