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]); |
Christian Franke | 61010c3 | 2015-11-10 18:43:34 +0100 | [diff] [blame] | 792 | circuit->lsp_regenerate_pending[0] = 0; |
| 793 | circuit->lsp_regenerate_pending[1] = 0; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 794 | } |
| 795 | else if (circuit->circ_type == CIRCUIT_T_P2P) |
| 796 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 797 | isis_delete_adj (circuit->u.p2p.neighbor); |
| 798 | circuit->u.p2p.neighbor = NULL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 799 | THREAD_TIMER_OFF (circuit->u.p2p.t_send_p2p_hello); |
| 800 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 801 | |
| 802 | /* Cancel all active threads */ |
| 803 | THREAD_TIMER_OFF (circuit->t_send_csnp[0]); |
| 804 | THREAD_TIMER_OFF (circuit->t_send_csnp[1]); |
| 805 | THREAD_TIMER_OFF (circuit->t_send_psnp[0]); |
| 806 | THREAD_TIMER_OFF (circuit->t_send_psnp[1]); |
| 807 | THREAD_OFF (circuit->t_read); |
| 808 | |
| 809 | if (circuit->lsp_queue) |
| 810 | { |
| 811 | circuit->lsp_queue->del = NULL; |
| 812 | list_delete (circuit->lsp_queue); |
| 813 | circuit->lsp_queue = NULL; |
| 814 | } |
| 815 | |
| 816 | /* send one gratuitous hello to spead up convergence */ |
| 817 | if (circuit->is_type & IS_LEVEL_1) |
| 818 | send_hello (circuit, IS_LEVEL_1); |
| 819 | if (circuit->is_type & IS_LEVEL_2) |
| 820 | send_hello (circuit, IS_LEVEL_2); |
| 821 | |
| 822 | circuit->upadjcount[0] = 0; |
| 823 | circuit->upadjcount[1] = 0; |
| 824 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 825 | /* close the socket */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 826 | if (circuit->fd) |
| 827 | { |
| 828 | close (circuit->fd); |
| 829 | circuit->fd = 0; |
| 830 | } |
| 831 | |
| 832 | if (circuit->rcv_stream != NULL) |
| 833 | { |
| 834 | stream_free (circuit->rcv_stream); |
| 835 | circuit->rcv_stream = NULL; |
| 836 | } |
| 837 | |
| 838 | if (circuit->snd_stream != NULL) |
| 839 | { |
| 840 | stream_free (circuit->snd_stream); |
| 841 | circuit->snd_stream = NULL; |
| 842 | } |
| 843 | |
| 844 | thread_cancel_event (master, circuit); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 845 | |
| 846 | return; |
| 847 | } |
| 848 | |
| 849 | void |
| 850 | circuit_update_nlpids (struct isis_circuit *circuit) |
| 851 | { |
| 852 | circuit->nlpids.count = 0; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 853 | |
| 854 | if (circuit->ip_router) |
| 855 | { |
| 856 | circuit->nlpids.nlpids[0] = NLPID_IP; |
| 857 | circuit->nlpids.count++; |
| 858 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 859 | #ifdef HAVE_IPV6 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 860 | if (circuit->ipv6_router) |
| 861 | { |
| 862 | circuit->nlpids.nlpids[circuit->nlpids.count] = NLPID_IPV6; |
| 863 | circuit->nlpids.count++; |
| 864 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 865 | #endif /* HAVE_IPV6 */ |
| 866 | return; |
| 867 | } |
| 868 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 869 | void |
| 870 | isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty, |
| 871 | char detail) |
| 872 | { |
| 873 | if (detail == ISIS_UI_LEVEL_BRIEF) |
| 874 | { |
| 875 | vty_out (vty, " %-12s", circuit->interface->name); |
| 876 | vty_out (vty, "0x%-7x", circuit->circuit_id); |
| 877 | vty_out (vty, "%-9s", circuit_state2string (circuit->state)); |
| 878 | vty_out (vty, "%-9s", circuit_type2string (circuit->circ_type)); |
| 879 | vty_out (vty, "%-9s", circuit_t2string (circuit->is_type)); |
| 880 | vty_out (vty, "%s", VTY_NEWLINE); |
| 881 | } |
| 882 | |
| 883 | if (detail == ISIS_UI_LEVEL_DETAIL) |
| 884 | { |
| 885 | vty_out (vty, " Interface: %s", circuit->interface->name); |
| 886 | vty_out (vty, ", State: %s", circuit_state2string (circuit->state)); |
| 887 | if (circuit->is_passive) |
| 888 | vty_out (vty, ", Passive"); |
| 889 | else |
| 890 | vty_out (vty, ", Active"); |
| 891 | vty_out (vty, ", Circuit Id: 0x%x", circuit->circuit_id); |
| 892 | vty_out (vty, "%s", VTY_NEWLINE); |
| 893 | vty_out (vty, " Type: %s", circuit_type2string (circuit->circ_type)); |
| 894 | vty_out (vty, ", Level: %s", circuit_t2string (circuit->is_type)); |
| 895 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 896 | vty_out (vty, ", SNPA: %-10s", snpa_print (circuit->u.bc.snpa)); |
| 897 | vty_out (vty, "%s", VTY_NEWLINE); |
| 898 | if (circuit->is_type & IS_LEVEL_1) |
| 899 | { |
| 900 | vty_out (vty, " Level-1 Information:%s", VTY_NEWLINE); |
| 901 | if (circuit->area->newmetric) |
| 902 | vty_out (vty, " Metric: %d", circuit->te_metric[0]); |
| 903 | else |
| 904 | vty_out (vty, " Metric: %d", |
| 905 | circuit->metrics[0].metric_default); |
| 906 | if (!circuit->is_passive) |
| 907 | { |
| 908 | vty_out (vty, ", Active neighbors: %u%s", |
| 909 | circuit->upadjcount[0], VTY_NEWLINE); |
| 910 | vty_out (vty, " Hello interval: %u, " |
| 911 | "Holddown count: %u %s%s", |
| 912 | circuit->hello_interval[0], |
| 913 | circuit->hello_multiplier[0], |
| 914 | (circuit->pad_hellos ? "(pad)" : "(no-pad)"), |
| 915 | VTY_NEWLINE); |
| 916 | vty_out (vty, " CNSP interval: %u, " |
| 917 | "PSNP interval: %u%s", |
| 918 | circuit->csnp_interval[0], |
| 919 | circuit->psnp_interval[0], VTY_NEWLINE); |
| 920 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 921 | vty_out (vty, " LAN Priority: %u, %s%s", |
| 922 | circuit->priority[0], |
| 923 | (circuit->u.bc.is_dr[0] ? \ |
| 924 | "is DIS" : "is not DIS"), VTY_NEWLINE); |
| 925 | } |
| 926 | else |
| 927 | { |
| 928 | vty_out (vty, "%s", VTY_NEWLINE); |
| 929 | } |
| 930 | } |
| 931 | if (circuit->is_type & IS_LEVEL_2) |
| 932 | { |
| 933 | vty_out (vty, " Level-2 Information:%s", VTY_NEWLINE); |
| 934 | if (circuit->area->newmetric) |
| 935 | vty_out (vty, " Metric: %d", circuit->te_metric[1]); |
| 936 | else |
| 937 | vty_out (vty, " Metric: %d", |
| 938 | circuit->metrics[1].metric_default); |
| 939 | if (!circuit->is_passive) |
| 940 | { |
| 941 | vty_out (vty, ", Active neighbors: %u%s", |
| 942 | circuit->upadjcount[1], VTY_NEWLINE); |
| 943 | vty_out (vty, " Hello interval: %u, " |
| 944 | "Holddown count: %u %s%s", |
| 945 | circuit->hello_interval[1], |
| 946 | circuit->hello_multiplier[1], |
| 947 | (circuit->pad_hellos ? "(pad)" : "(no-pad)"), |
| 948 | VTY_NEWLINE); |
| 949 | vty_out (vty, " CNSP interval: %u, " |
| 950 | "PSNP interval: %u%s", |
| 951 | circuit->csnp_interval[1], |
| 952 | circuit->psnp_interval[1], VTY_NEWLINE); |
| 953 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 954 | vty_out (vty, " LAN Priority: %u, %s%s", |
| 955 | circuit->priority[1], |
| 956 | (circuit->u.bc.is_dr[1] ? \ |
| 957 | "is DIS" : "is not DIS"), VTY_NEWLINE); |
| 958 | } |
| 959 | else |
| 960 | { |
| 961 | vty_out (vty, "%s", VTY_NEWLINE); |
| 962 | } |
| 963 | } |
| 964 | if (circuit->ip_addrs && listcount (circuit->ip_addrs) > 0) |
| 965 | { |
| 966 | struct listnode *node; |
| 967 | struct prefix *ip_addr; |
| 968 | u_char buf[BUFSIZ]; |
| 969 | vty_out (vty, " IP Prefix(es):%s", VTY_NEWLINE); |
| 970 | for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip_addr)) |
| 971 | { |
| 972 | prefix2str (ip_addr, (char*)buf, BUFSIZ), |
| 973 | vty_out (vty, " %s%s", buf, VTY_NEWLINE); |
| 974 | } |
| 975 | } |
| 976 | vty_out (vty, "%s", VTY_NEWLINE); |
| 977 | } |
| 978 | return; |
| 979 | } |
| 980 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 981 | int |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 982 | isis_interface_config_write (struct vty *vty) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 983 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 984 | int write = 0; |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 985 | struct listnode *node, *node2; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 986 | struct interface *ifp; |
| 987 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 988 | struct isis_circuit *circuit; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 989 | int i; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 990 | |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 991 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 992 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 993 | /* IF name */ |
| 994 | vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE); |
| 995 | write++; |
| 996 | /* IF desc */ |
| 997 | if (ifp->desc) |
| 998 | { |
| 999 | vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE); |
| 1000 | write++; |
| 1001 | } |
| 1002 | /* ISIS Circuit */ |
| 1003 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, node2, area)) |
| 1004 | { |
| 1005 | circuit = circuit_lookup_by_ifp (ifp, area->circuit_list); |
| 1006 | if (circuit == NULL) |
| 1007 | continue; |
| 1008 | if (circuit->ip_router) |
| 1009 | { |
| 1010 | vty_out (vty, " ip router isis %s%s", area->area_tag, |
| 1011 | VTY_NEWLINE); |
| 1012 | write++; |
| 1013 | } |
| 1014 | if (circuit->is_passive) |
| 1015 | { |
| 1016 | vty_out (vty, " isis passive%s", VTY_NEWLINE); |
| 1017 | write++; |
| 1018 | } |
| 1019 | if (circuit->circ_type_config == CIRCUIT_T_P2P) |
| 1020 | { |
| 1021 | vty_out (vty, " isis network point-to-point%s", VTY_NEWLINE); |
| 1022 | write++; |
| 1023 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1024 | #ifdef HAVE_IPV6 |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1025 | if (circuit->ipv6_router) |
| 1026 | { |
| 1027 | vty_out (vty, " ipv6 router isis %s%s", area->area_tag, |
| 1028 | VTY_NEWLINE); |
| 1029 | write++; |
| 1030 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1031 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1032 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1033 | /* ISIS - circuit type */ |
| 1034 | if (circuit->is_type == IS_LEVEL_1) |
| 1035 | { |
| 1036 | vty_out (vty, " isis circuit-type level-1%s", VTY_NEWLINE); |
| 1037 | write++; |
| 1038 | } |
| 1039 | else |
| 1040 | { |
| 1041 | if (circuit->is_type == IS_LEVEL_2) |
| 1042 | { |
| 1043 | vty_out (vty, " isis circuit-type level-2-only%s", |
| 1044 | VTY_NEWLINE); |
| 1045 | write++; |
| 1046 | } |
| 1047 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1048 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1049 | /* ISIS - CSNP interval */ |
| 1050 | if (circuit->csnp_interval[0] == circuit->csnp_interval[1]) |
| 1051 | { |
| 1052 | if (circuit->csnp_interval[0] != DEFAULT_CSNP_INTERVAL) |
| 1053 | { |
| 1054 | vty_out (vty, " isis csnp-interval %d%s", |
| 1055 | circuit->csnp_interval[0], VTY_NEWLINE); |
| 1056 | write++; |
| 1057 | } |
| 1058 | } |
| 1059 | else |
| 1060 | { |
| 1061 | for (i = 0; i < 2; i++) |
| 1062 | { |
| 1063 | if (circuit->csnp_interval[i] != DEFAULT_CSNP_INTERVAL) |
| 1064 | { |
| 1065 | vty_out (vty, " isis csnp-interval %d level-%d%s", |
| 1066 | circuit->csnp_interval[i], i + 1, VTY_NEWLINE); |
| 1067 | write++; |
| 1068 | } |
| 1069 | } |
| 1070 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1071 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1072 | /* ISIS - PSNP interval */ |
| 1073 | if (circuit->psnp_interval[0] == circuit->psnp_interval[1]) |
| 1074 | { |
| 1075 | if (circuit->psnp_interval[0] != DEFAULT_PSNP_INTERVAL) |
| 1076 | { |
| 1077 | vty_out (vty, " isis psnp-interval %d%s", |
| 1078 | circuit->psnp_interval[0], VTY_NEWLINE); |
| 1079 | write++; |
| 1080 | } |
| 1081 | } |
| 1082 | else |
| 1083 | { |
| 1084 | for (i = 0; i < 2; i++) |
| 1085 | { |
| 1086 | if (circuit->psnp_interval[i] != DEFAULT_PSNP_INTERVAL) |
| 1087 | { |
| 1088 | vty_out (vty, " isis psnp-interval %d level-%d%s", |
| 1089 | circuit->psnp_interval[i], i + 1, VTY_NEWLINE); |
| 1090 | write++; |
| 1091 | } |
| 1092 | } |
| 1093 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1094 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1095 | /* ISIS - Hello padding - Defaults to true so only display if false */ |
| 1096 | if (circuit->pad_hellos == 0) |
| 1097 | { |
| 1098 | vty_out (vty, " no isis hello padding%s", VTY_NEWLINE); |
| 1099 | write++; |
| 1100 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1101 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1102 | /* ISIS - Hello interval */ |
| 1103 | if (circuit->hello_interval[0] == circuit->hello_interval[1]) |
| 1104 | { |
| 1105 | if (circuit->hello_interval[0] != DEFAULT_HELLO_INTERVAL) |
| 1106 | { |
| 1107 | vty_out (vty, " isis hello-interval %d%s", |
| 1108 | circuit->hello_interval[0], VTY_NEWLINE); |
| 1109 | write++; |
| 1110 | } |
| 1111 | } |
| 1112 | else |
| 1113 | { |
| 1114 | for (i = 0; i < 2; i++) |
| 1115 | { |
| 1116 | if (circuit->hello_interval[i] != DEFAULT_HELLO_INTERVAL) |
| 1117 | { |
| 1118 | vty_out (vty, " isis hello-interval %d level-%d%s", |
| 1119 | circuit->hello_interval[i], i + 1, VTY_NEWLINE); |
| 1120 | write++; |
| 1121 | } |
| 1122 | } |
| 1123 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1124 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1125 | /* ISIS - Hello Multiplier */ |
| 1126 | if (circuit->hello_multiplier[0] == circuit->hello_multiplier[1]) |
| 1127 | { |
| 1128 | if (circuit->hello_multiplier[0] != DEFAULT_HELLO_MULTIPLIER) |
| 1129 | { |
| 1130 | vty_out (vty, " isis hello-multiplier %d%s", |
| 1131 | circuit->hello_multiplier[0], VTY_NEWLINE); |
| 1132 | write++; |
| 1133 | } |
| 1134 | } |
| 1135 | else |
| 1136 | { |
| 1137 | for (i = 0; i < 2; i++) |
| 1138 | { |
| 1139 | if (circuit->hello_multiplier[i] != DEFAULT_HELLO_MULTIPLIER) |
| 1140 | { |
| 1141 | vty_out (vty, " isis hello-multiplier %d level-%d%s", |
| 1142 | circuit->hello_multiplier[i], i + 1, |
| 1143 | VTY_NEWLINE); |
| 1144 | write++; |
| 1145 | } |
| 1146 | } |
| 1147 | } |
| 1148 | |
| 1149 | /* ISIS - Priority */ |
| 1150 | if (circuit->priority[0] == circuit->priority[1]) |
| 1151 | { |
| 1152 | if (circuit->priority[0] != DEFAULT_PRIORITY) |
| 1153 | { |
| 1154 | vty_out (vty, " isis priority %d%s", |
| 1155 | circuit->priority[0], VTY_NEWLINE); |
| 1156 | write++; |
| 1157 | } |
| 1158 | } |
| 1159 | else |
| 1160 | { |
| 1161 | for (i = 0; i < 2; i++) |
| 1162 | { |
| 1163 | if (circuit->priority[i] != DEFAULT_PRIORITY) |
| 1164 | { |
| 1165 | vty_out (vty, " isis priority %d level-%d%s", |
| 1166 | circuit->priority[i], i + 1, VTY_NEWLINE); |
| 1167 | write++; |
| 1168 | } |
| 1169 | } |
| 1170 | } |
| 1171 | |
| 1172 | /* ISIS - Metric */ |
| 1173 | if (circuit->te_metric[0] == circuit->te_metric[1]) |
| 1174 | { |
| 1175 | if (circuit->te_metric[0] != DEFAULT_CIRCUIT_METRIC) |
| 1176 | { |
| 1177 | vty_out (vty, " isis metric %d%s", circuit->te_metric[0], |
| 1178 | VTY_NEWLINE); |
| 1179 | write++; |
| 1180 | } |
| 1181 | } |
| 1182 | else |
| 1183 | { |
| 1184 | for (i = 0; i < 2; i++) |
| 1185 | { |
| 1186 | if (circuit->te_metric[i] != DEFAULT_CIRCUIT_METRIC) |
| 1187 | { |
| 1188 | vty_out (vty, " isis metric %d level-%d%s", |
| 1189 | circuit->te_metric[i], i + 1, VTY_NEWLINE); |
| 1190 | write++; |
| 1191 | } |
| 1192 | } |
| 1193 | } |
| 1194 | if (circuit->passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5) |
| 1195 | { |
| 1196 | vty_out (vty, " isis password md5 %s%s", circuit->passwd.passwd, |
| 1197 | VTY_NEWLINE); |
| 1198 | write++; |
| 1199 | } |
| 1200 | else if (circuit->passwd.type == ISIS_PASSWD_TYPE_CLEARTXT) |
| 1201 | { |
| 1202 | vty_out (vty, " isis password clear %s%s", circuit->passwd.passwd, |
| 1203 | VTY_NEWLINE); |
| 1204 | write++; |
| 1205 | } |
| 1206 | } |
| 1207 | vty_out (vty, "!%s", VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1208 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1209 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1210 | return write; |
| 1211 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1212 | |
| 1213 | DEFUN (ip_router_isis, |
| 1214 | ip_router_isis_cmd, |
| 1215 | "ip router isis WORD", |
| 1216 | "Interface Internet Protocol config commands\n" |
| 1217 | "IP router interface commands\n" |
| 1218 | "IS-IS Routing for IP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1219 | "Routing process tag\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1220 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1221 | struct isis_circuit *circuit; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1222 | struct interface *ifp; |
| 1223 | struct isis_area *area; |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1224 | int rv; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1225 | |
| 1226 | ifp = (struct interface *) vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1227 | assert (ifp); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1228 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1229 | /* Prevent more than one area per circuit */ |
| 1230 | circuit = circuit_scan_by_ifp (ifp); |
| 1231 | if (circuit) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1232 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1233 | if (circuit->ip_router == 1) |
| 1234 | { |
| 1235 | if (strcmp (circuit->area->area_tag, argv[0])) |
| 1236 | { |
| 1237 | vty_out (vty, "ISIS circuit is already defined on %s%s", |
| 1238 | circuit->area->area_tag, VTY_NEWLINE); |
| 1239 | return CMD_ERR_NOTHING_TODO; |
| 1240 | } |
| 1241 | return CMD_SUCCESS; |
| 1242 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1243 | } |
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 | if (isis_area_get (vty, argv[0]) != CMD_SUCCESS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1246 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1247 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 1248 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1249 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1250 | area = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1251 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1252 | circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area); |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1253 | if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP) |
| 1254 | { |
| 1255 | vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE); |
| 1256 | rv = CMD_WARNING; |
| 1257 | } |
| 1258 | else |
| 1259 | { |
| 1260 | isis_circuit_if_bind (circuit, ifp); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1261 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1262 | circuit->ip_router = 1; |
| 1263 | area->ip_circuits++; |
| 1264 | circuit_update_nlpids (circuit); |
| 1265 | rv = CMD_SUCCESS; |
| 1266 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1267 | |
| 1268 | vty->node = INTERFACE_NODE; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1269 | vty->index = ifp; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1270 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1271 | return rv; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1272 | } |
| 1273 | |
| 1274 | DEFUN (no_ip_router_isis, |
| 1275 | no_ip_router_isis_cmd, |
| 1276 | "no ip router isis WORD", |
| 1277 | NO_STR |
| 1278 | "Interface Internet Protocol config commands\n" |
| 1279 | "IP router interface commands\n" |
| 1280 | "IS-IS Routing for IP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1281 | "Routing process tag\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1282 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1283 | struct interface *ifp; |
| 1284 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1285 | struct isis_circuit *circuit; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1286 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1287 | ifp = (struct interface *) vty->index; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1288 | if (!ifp) |
| 1289 | { |
| 1290 | vty_out (vty, "Invalid interface %s", VTY_NEWLINE); |
| 1291 | return CMD_ERR_NO_MATCH; |
| 1292 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1293 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1294 | area = isis_area_lookup (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1295 | if (!area) |
| 1296 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1297 | vty_out (vty, "Can't find ISIS instance %s%s", |
| 1298 | argv[0], VTY_NEWLINE); |
| 1299 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1300 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1301 | |
| 1302 | circuit = circuit_lookup_by_ifp (ifp, area->circuit_list); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1303 | if (!circuit) |
| 1304 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1305 | vty_out (vty, "ISIS is not enabled on circuit %s%s", |
| 1306 | ifp->name, VTY_NEWLINE); |
| 1307 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1308 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1309 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1310 | circuit->ip_router = 0; |
| 1311 | area->ip_circuits--; |
| 1312 | #ifdef HAVE_IPV6 |
| 1313 | if (circuit->ipv6_router == 0) |
| 1314 | #endif |
| 1315 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1316 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1317 | return CMD_SUCCESS; |
| 1318 | } |
| 1319 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1320 | #ifdef HAVE_IPV6 |
| 1321 | DEFUN (ipv6_router_isis, |
| 1322 | ipv6_router_isis_cmd, |
| 1323 | "ipv6 router isis WORD", |
| 1324 | "IPv6 interface subcommands\n" |
| 1325 | "IPv6 Router interface commands\n" |
| 1326 | "IS-IS Routing for IPv6\n" |
| 1327 | "Routing process tag\n") |
| 1328 | { |
| 1329 | struct isis_circuit *circuit; |
| 1330 | struct interface *ifp; |
| 1331 | struct isis_area *area; |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1332 | int rv; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1333 | |
| 1334 | ifp = (struct interface *) vty->index; |
| 1335 | assert (ifp); |
| 1336 | |
| 1337 | /* Prevent more than one area per circuit */ |
| 1338 | circuit = circuit_scan_by_ifp (ifp); |
| 1339 | if (circuit) |
| 1340 | { |
| 1341 | if (circuit->ipv6_router == 1) |
| 1342 | { |
| 1343 | if (strcmp (circuit->area->area_tag, argv[0])) |
| 1344 | { |
| 1345 | vty_out (vty, "ISIS circuit is already defined for IPv6 on %s%s", |
| 1346 | circuit->area->area_tag, VTY_NEWLINE); |
| 1347 | return CMD_ERR_NOTHING_TODO; |
| 1348 | } |
| 1349 | return CMD_SUCCESS; |
| 1350 | } |
| 1351 | } |
| 1352 | |
| 1353 | if (isis_area_get (vty, argv[0]) != CMD_SUCCESS) |
| 1354 | { |
| 1355 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 1356 | return CMD_ERR_NO_MATCH; |
| 1357 | } |
| 1358 | area = vty->index; |
| 1359 | |
| 1360 | circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area); |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1361 | if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP) |
| 1362 | { |
| 1363 | vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE); |
| 1364 | rv = CMD_WARNING; |
| 1365 | } |
| 1366 | else |
| 1367 | { |
| 1368 | isis_circuit_if_bind (circuit, ifp); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1369 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1370 | circuit->ipv6_router = 1; |
| 1371 | area->ipv6_circuits++; |
| 1372 | circuit_update_nlpids (circuit); |
| 1373 | rv = CMD_SUCCESS; |
| 1374 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1375 | |
| 1376 | vty->node = INTERFACE_NODE; |
| 1377 | vty->index = ifp; |
| 1378 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1379 | return rv; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1380 | } |
| 1381 | |
| 1382 | DEFUN (no_ipv6_router_isis, |
| 1383 | no_ipv6_router_isis_cmd, |
| 1384 | "no ipv6 router isis WORD", |
| 1385 | NO_STR |
| 1386 | "IPv6 interface subcommands\n" |
| 1387 | "IPv6 Router interface commands\n" |
| 1388 | "IS-IS Routing for IPv6\n" |
| 1389 | "Routing process tag\n") |
| 1390 | { |
| 1391 | struct interface *ifp; |
| 1392 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1393 | struct isis_circuit *circuit; |
| 1394 | |
| 1395 | ifp = (struct interface *) vty->index; |
| 1396 | if (!ifp) |
| 1397 | { |
| 1398 | vty_out (vty, "Invalid interface %s", VTY_NEWLINE); |
| 1399 | return CMD_ERR_NO_MATCH; |
| 1400 | } |
| 1401 | |
| 1402 | area = isis_area_lookup (argv[0]); |
| 1403 | if (!area) |
| 1404 | { |
| 1405 | vty_out (vty, "Can't find ISIS instance %s%s", |
| 1406 | argv[0], VTY_NEWLINE); |
| 1407 | return CMD_ERR_NO_MATCH; |
| 1408 | } |
| 1409 | |
| 1410 | circuit = circuit_lookup_by_ifp (ifp, area->circuit_list); |
| 1411 | if (!circuit) |
| 1412 | { |
| 1413 | vty_out (vty, "ISIS is not enabled on circuit %s%s", |
| 1414 | ifp->name, VTY_NEWLINE); |
| 1415 | return CMD_ERR_NO_MATCH; |
| 1416 | } |
| 1417 | |
| 1418 | circuit->ipv6_router = 0; |
| 1419 | area->ipv6_circuits--; |
| 1420 | if (circuit->ip_router == 0) |
| 1421 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 1422 | |
| 1423 | return CMD_SUCCESS; |
| 1424 | } |
| 1425 | #endif /* HAVE_IPV6 */ |
| 1426 | |
| 1427 | DEFUN (isis_passive, |
| 1428 | isis_passive_cmd, |
| 1429 | "isis passive", |
| 1430 | "IS-IS commands\n" |
| 1431 | "Configure the passive mode for interface\n") |
| 1432 | { |
| 1433 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1434 | if (!circuit) |
| 1435 | return CMD_ERR_NO_MATCH; |
| 1436 | |
| 1437 | if (circuit->is_passive == 1) |
| 1438 | return CMD_SUCCESS; |
| 1439 | |
| 1440 | if (circuit->state != C_STATE_UP) |
| 1441 | { |
| 1442 | circuit->is_passive = 1; |
| 1443 | } |
| 1444 | else |
| 1445 | { |
| 1446 | struct isis_area *area = circuit->area; |
| 1447 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 1448 | circuit->is_passive = 1; |
| 1449 | isis_csm_state_change (ISIS_ENABLE, circuit, area); |
| 1450 | } |
| 1451 | |
| 1452 | return CMD_SUCCESS; |
| 1453 | } |
| 1454 | |
| 1455 | DEFUN (no_isis_passive, |
| 1456 | no_isis_passive_cmd, |
| 1457 | "no isis passive", |
| 1458 | NO_STR |
| 1459 | "IS-IS commands\n" |
| 1460 | "Configure the passive mode for interface\n") |
| 1461 | { |
| 1462 | struct interface *ifp; |
| 1463 | struct isis_circuit *circuit; |
| 1464 | |
| 1465 | ifp = (struct interface *) vty->index; |
| 1466 | if (!ifp) |
| 1467 | { |
| 1468 | vty_out (vty, "Invalid interface %s", VTY_NEWLINE); |
| 1469 | return CMD_ERR_NO_MATCH; |
| 1470 | } |
| 1471 | |
| 1472 | /* FIXME: what is wrong with circuit = ifp->info ? */ |
| 1473 | circuit = circuit_scan_by_ifp (ifp); |
| 1474 | if (!circuit) |
| 1475 | { |
| 1476 | vty_out (vty, "ISIS is not enabled on circuit %s%s", |
| 1477 | ifp->name, VTY_NEWLINE); |
| 1478 | return CMD_ERR_NO_MATCH; |
| 1479 | } |
| 1480 | |
| 1481 | if (if_is_loopback(ifp)) |
| 1482 | { |
| 1483 | vty_out (vty, "Can't set no passive for loopback interface%s", |
| 1484 | VTY_NEWLINE); |
| 1485 | return CMD_ERR_AMBIGUOUS; |
| 1486 | } |
| 1487 | |
| 1488 | if (circuit->is_passive == 0) |
| 1489 | return CMD_SUCCESS; |
| 1490 | |
| 1491 | if (circuit->state != C_STATE_UP) |
| 1492 | { |
| 1493 | circuit->is_passive = 0; |
| 1494 | } |
| 1495 | else |
| 1496 | { |
| 1497 | struct isis_area *area = circuit->area; |
| 1498 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 1499 | circuit->is_passive = 0; |
| 1500 | isis_csm_state_change (ISIS_ENABLE, circuit, area); |
| 1501 | } |
| 1502 | |
| 1503 | return CMD_SUCCESS; |
| 1504 | } |
| 1505 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1506 | DEFUN (isis_circuit_type, |
| 1507 | isis_circuit_type_cmd, |
| 1508 | "isis circuit-type (level-1|level-1-2|level-2-only)", |
| 1509 | "IS-IS commands\n" |
| 1510 | "Configure circuit type for interface\n" |
| 1511 | "Level-1 only adjacencies are formed\n" |
| 1512 | "Level-1-2 adjacencies are formed\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1513 | "Level-2 only adjacencies are formed\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1514 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1515 | int circuit_type; |
| 1516 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1517 | if (!circuit) |
| 1518 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1519 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1520 | circuit_type = string2circuit_t (argv[0]); |
| 1521 | if (!circuit_type) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1522 | { |
| 1523 | vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1524 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1525 | } |
| 1526 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1527 | if (circuit->state == C_STATE_UP && |
| 1528 | circuit->area->is_type != IS_LEVEL_1_AND_2 && |
| 1529 | circuit->area->is_type != circuit_type) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1530 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1531 | vty_out (vty, "Invalid circuit level for area %s.%s", |
| 1532 | circuit->area->area_tag, VTY_NEWLINE); |
| 1533 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1534 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1535 | isis_event_circuit_type_change (circuit, circuit_type); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1536 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1537 | return CMD_SUCCESS; |
| 1538 | } |
| 1539 | |
| 1540 | DEFUN (no_isis_circuit_type, |
| 1541 | no_isis_circuit_type_cmd, |
| 1542 | "no isis circuit-type (level-1|level-1-2|level-2-only)", |
| 1543 | NO_STR |
| 1544 | "IS-IS commands\n" |
| 1545 | "Configure circuit type for interface\n" |
| 1546 | "Level-1 only adjacencies are formed\n" |
| 1547 | "Level-1-2 adjacencies are formed\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1548 | "Level-2 only adjacencies are formed\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1549 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1550 | int circuit_type; |
| 1551 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1552 | if (!circuit) |
| 1553 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1554 | |
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 | * Set the circuits level to its default value |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1557 | */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1558 | if (circuit->state == C_STATE_UP) |
| 1559 | circuit_type = circuit->area->is_type; |
| 1560 | else |
| 1561 | circuit_type = IS_LEVEL_1_AND_2; |
| 1562 | isis_event_circuit_type_change (circuit, circuit_type); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1563 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1564 | return CMD_SUCCESS; |
| 1565 | } |
| 1566 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1567 | DEFUN (isis_passwd_md5, |
| 1568 | isis_passwd_md5_cmd, |
| 1569 | "isis password md5 WORD", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1570 | "IS-IS commands\n" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1571 | "Configure the authentication password for a circuit\n" |
| 1572 | "Authentication type\n" |
| 1573 | "Circuit password\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1574 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1575 | int len; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1576 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1577 | if (!circuit) |
| 1578 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1579 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1580 | len = strlen (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1581 | if (len > 254) |
| 1582 | { |
| 1583 | vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1584 | return CMD_ERR_AMBIGUOUS; |
| 1585 | } |
| 1586 | circuit->passwd.len = len; |
| 1587 | circuit->passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5; |
| 1588 | strncpy ((char *)circuit->passwd.passwd, argv[0], 255); |
| 1589 | |
| 1590 | return CMD_SUCCESS; |
| 1591 | } |
| 1592 | |
| 1593 | DEFUN (isis_passwd_clear, |
| 1594 | isis_passwd_clear_cmd, |
| 1595 | "isis password clear WORD", |
| 1596 | "IS-IS commands\n" |
| 1597 | "Configure the authentication password for a circuit\n" |
| 1598 | "Authentication type\n" |
| 1599 | "Circuit password\n") |
| 1600 | { |
| 1601 | int len; |
| 1602 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1603 | if (!circuit) |
| 1604 | return CMD_ERR_NO_MATCH; |
| 1605 | |
| 1606 | len = strlen (argv[0]); |
| 1607 | if (len > 254) |
| 1608 | { |
| 1609 | vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE); |
| 1610 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1611 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1612 | circuit->passwd.len = len; |
| 1613 | circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT; |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 1614 | strncpy ((char *)circuit->passwd.passwd, argv[0], 255); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1615 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1616 | return CMD_SUCCESS; |
| 1617 | } |
| 1618 | |
| 1619 | DEFUN (no_isis_passwd, |
| 1620 | no_isis_passwd_cmd, |
| 1621 | "no isis password", |
| 1622 | NO_STR |
| 1623 | "IS-IS commands\n" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1624 | "Configure the authentication password for a circuit\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1625 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1626 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1627 | if (!circuit) |
| 1628 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1629 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1630 | memset (&circuit->passwd, 0, sizeof (struct isis_passwd)); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1631 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1632 | return CMD_SUCCESS; |
| 1633 | } |
| 1634 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1635 | DEFUN (isis_priority, |
| 1636 | isis_priority_cmd, |
| 1637 | "isis priority <0-127>", |
| 1638 | "IS-IS commands\n" |
| 1639 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1640 | "Priority value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1641 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1642 | int prio; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1643 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1644 | if (!circuit) |
| 1645 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1646 | |
| 1647 | prio = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1648 | if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) |
| 1649 | { |
| 1650 | vty_out (vty, "Invalid priority %d - should be <0-127>%s", |
| 1651 | prio, VTY_NEWLINE); |
| 1652 | return CMD_ERR_AMBIGUOUS; |
| 1653 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1654 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1655 | circuit->priority[0] = prio; |
| 1656 | circuit->priority[1] = prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1657 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1658 | return CMD_SUCCESS; |
| 1659 | } |
| 1660 | |
| 1661 | DEFUN (no_isis_priority, |
| 1662 | no_isis_priority_cmd, |
| 1663 | "no isis priority", |
| 1664 | NO_STR |
| 1665 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1666 | "Set priority for Designated Router election\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1667 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1668 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1669 | if (!circuit) |
| 1670 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1671 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1672 | circuit->priority[0] = DEFAULT_PRIORITY; |
| 1673 | circuit->priority[1] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1674 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1675 | return CMD_SUCCESS; |
| 1676 | } |
| 1677 | |
| 1678 | ALIAS (no_isis_priority, |
| 1679 | no_isis_priority_arg_cmd, |
| 1680 | "no isis priority <0-127>", |
| 1681 | NO_STR |
| 1682 | "IS-IS commands\n" |
| 1683 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1684 | "Priority value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1685 | |
| 1686 | DEFUN (isis_priority_l1, |
| 1687 | isis_priority_l1_cmd, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1688 | "isis priority <0-127> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1689 | "IS-IS commands\n" |
| 1690 | "Set priority for Designated Router election\n" |
| 1691 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1692 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1693 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1694 | int prio; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1695 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1696 | if (!circuit) |
| 1697 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1698 | |
| 1699 | prio = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1700 | if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) |
| 1701 | { |
| 1702 | vty_out (vty, "Invalid priority %d - should be <0-127>%s", |
| 1703 | prio, VTY_NEWLINE); |
| 1704 | return CMD_ERR_AMBIGUOUS; |
| 1705 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1706 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1707 | circuit->priority[0] = prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1708 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1709 | return CMD_SUCCESS; |
| 1710 | } |
| 1711 | |
| 1712 | DEFUN (no_isis_priority_l1, |
| 1713 | no_isis_priority_l1_cmd, |
| 1714 | "no isis priority level-1", |
| 1715 | NO_STR |
| 1716 | "IS-IS commands\n" |
| 1717 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1718 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1719 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1720 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1721 | if (!circuit) |
| 1722 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1723 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1724 | circuit->priority[0] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1725 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1726 | return CMD_SUCCESS; |
| 1727 | } |
| 1728 | |
| 1729 | ALIAS (no_isis_priority_l1, |
| 1730 | no_isis_priority_l1_arg_cmd, |
| 1731 | "no isis priority <0-127> level-1", |
| 1732 | NO_STR |
| 1733 | "IS-IS commands\n" |
| 1734 | "Set priority for Designated Router election\n" |
| 1735 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1736 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1737 | |
| 1738 | DEFUN (isis_priority_l2, |
| 1739 | isis_priority_l2_cmd, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1740 | "isis priority <0-127> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1741 | "IS-IS commands\n" |
| 1742 | "Set priority for Designated Router election\n" |
| 1743 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1744 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1745 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1746 | int prio; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1747 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1748 | if (!circuit) |
| 1749 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1750 | |
| 1751 | prio = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1752 | if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) |
| 1753 | { |
| 1754 | vty_out (vty, "Invalid priority %d - should be <0-127>%s", |
| 1755 | prio, VTY_NEWLINE); |
| 1756 | return CMD_ERR_AMBIGUOUS; |
| 1757 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1758 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1759 | circuit->priority[1] = prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1760 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1761 | return CMD_SUCCESS; |
| 1762 | } |
| 1763 | |
| 1764 | DEFUN (no_isis_priority_l2, |
| 1765 | no_isis_priority_l2_cmd, |
| 1766 | "no isis priority level-2", |
| 1767 | NO_STR |
| 1768 | "IS-IS commands\n" |
| 1769 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1770 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1771 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1772 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1773 | if (!circuit) |
| 1774 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1775 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1776 | circuit->priority[1] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1777 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1778 | return CMD_SUCCESS; |
| 1779 | } |
| 1780 | |
| 1781 | ALIAS (no_isis_priority_l2, |
| 1782 | no_isis_priority_l2_arg_cmd, |
| 1783 | "no isis priority <0-127> level-2", |
| 1784 | NO_STR |
| 1785 | "IS-IS commands\n" |
| 1786 | "Set priority for Designated Router election\n" |
| 1787 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1788 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1789 | |
| 1790 | /* Metric command */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1791 | DEFUN (isis_metric, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1792 | isis_metric_cmd, |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 1793 | "isis metric <0-16777215>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1794 | "IS-IS commands\n" |
| 1795 | "Set default metric for circuit\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1796 | "Default metric value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1797 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1798 | int met; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1799 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1800 | if (!circuit) |
| 1801 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1802 | |
| 1803 | met = atoi (argv[0]); |
| 1804 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1805 | /* RFC3787 section 5.1 */ |
| 1806 | if (circuit->area && circuit->area->oldmetric == 1 && |
| 1807 | met > MAX_NARROW_LINK_METRIC) |
| 1808 | { |
| 1809 | vty_out (vty, "Invalid metric %d - should be <0-63> " |
| 1810 | "when narrow metric type enabled%s", |
| 1811 | met, VTY_NEWLINE); |
| 1812 | return CMD_ERR_AMBIGUOUS; |
| 1813 | } |
| 1814 | |
| 1815 | /* RFC4444 */ |
| 1816 | if (circuit->area && circuit->area->newmetric == 1 && |
| 1817 | met > MAX_WIDE_LINK_METRIC) |
| 1818 | { |
| 1819 | vty_out (vty, "Invalid metric %d - should be <0-16777215> " |
| 1820 | "when wide metric type enabled%s", |
| 1821 | met, VTY_NEWLINE); |
| 1822 | return CMD_ERR_AMBIGUOUS; |
| 1823 | } |
| 1824 | |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 1825 | circuit->te_metric[0] = met; |
| 1826 | circuit->te_metric[1] = met; |
| 1827 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1828 | circuit->metrics[0].metric_default = met; |
| 1829 | circuit->metrics[1].metric_default = met; |
| 1830 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1831 | if (circuit->area) |
| 1832 | lsp_regenerate_schedule (circuit->area, circuit->is_type, 0); |
| 1833 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1834 | return CMD_SUCCESS; |
| 1835 | } |
| 1836 | |
| 1837 | DEFUN (no_isis_metric, |
| 1838 | no_isis_metric_cmd, |
| 1839 | "no isis metric", |
| 1840 | NO_STR |
| 1841 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1842 | "Set default metric for circuit\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1843 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1844 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1845 | if (!circuit) |
| 1846 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1847 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1848 | circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC; |
| 1849 | circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC; |
| 1850 | circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC; |
| 1851 | circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1852 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1853 | if (circuit->area) |
| 1854 | lsp_regenerate_schedule (circuit->area, circuit->is_type, 0); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1855 | |
| 1856 | return CMD_SUCCESS; |
| 1857 | } |
| 1858 | |
| 1859 | ALIAS (no_isis_metric, |
| 1860 | no_isis_metric_arg_cmd, |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 1861 | "no isis metric <0-16777215>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1862 | NO_STR |
| 1863 | "IS-IS commands\n" |
| 1864 | "Set default metric for circuit\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1865 | "Default metric value\n") |
| 1866 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1867 | DEFUN (isis_metric_l1, |
| 1868 | isis_metric_l1_cmd, |
| 1869 | "isis metric <0-16777215> level-1", |
| 1870 | "IS-IS commands\n" |
| 1871 | "Set default metric for circuit\n" |
| 1872 | "Default metric value\n" |
| 1873 | "Specify metric for level-1 routing\n") |
| 1874 | { |
| 1875 | int met; |
| 1876 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1877 | if (!circuit) |
| 1878 | return CMD_ERR_NO_MATCH; |
| 1879 | |
| 1880 | met = atoi (argv[0]); |
| 1881 | |
| 1882 | /* RFC3787 section 5.1 */ |
| 1883 | if (circuit->area && circuit->area->oldmetric == 1 && |
| 1884 | met > MAX_NARROW_LINK_METRIC) |
| 1885 | { |
| 1886 | vty_out (vty, "Invalid metric %d - should be <0-63> " |
| 1887 | "when narrow metric type enabled%s", |
| 1888 | met, VTY_NEWLINE); |
| 1889 | return CMD_ERR_AMBIGUOUS; |
| 1890 | } |
| 1891 | |
| 1892 | /* RFC4444 */ |
| 1893 | if (circuit->area && circuit->area->newmetric == 1 && |
| 1894 | met > MAX_WIDE_LINK_METRIC) |
| 1895 | { |
| 1896 | vty_out (vty, "Invalid metric %d - should be <0-16777215> " |
| 1897 | "when wide metric type enabled%s", |
| 1898 | met, VTY_NEWLINE); |
| 1899 | return CMD_ERR_AMBIGUOUS; |
| 1900 | } |
| 1901 | |
| 1902 | circuit->te_metric[0] = met; |
| 1903 | circuit->metrics[0].metric_default = met; |
| 1904 | |
| 1905 | if (circuit->area) |
| 1906 | lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0); |
| 1907 | |
| 1908 | return CMD_SUCCESS; |
| 1909 | } |
| 1910 | |
| 1911 | DEFUN (no_isis_metric_l1, |
| 1912 | no_isis_metric_l1_cmd, |
| 1913 | "no isis metric level-1", |
| 1914 | NO_STR |
| 1915 | "IS-IS commands\n" |
| 1916 | "Set default metric for circuit\n" |
| 1917 | "Specify metric for level-1 routing\n") |
| 1918 | { |
| 1919 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1920 | if (!circuit) |
| 1921 | return CMD_ERR_NO_MATCH; |
| 1922 | |
| 1923 | circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC; |
| 1924 | circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC; |
| 1925 | |
| 1926 | if (circuit->area) |
| 1927 | lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0); |
| 1928 | |
| 1929 | return CMD_SUCCESS; |
| 1930 | } |
| 1931 | |
| 1932 | ALIAS (no_isis_metric_l1, |
| 1933 | no_isis_metric_l1_arg_cmd, |
| 1934 | "no isis metric <0-16777215> level-1", |
| 1935 | NO_STR |
| 1936 | "IS-IS commands\n" |
| 1937 | "Set default metric for circuit\n" |
| 1938 | "Default metric value\n" |
| 1939 | "Specify metric for level-1 routing\n") |
| 1940 | |
| 1941 | DEFUN (isis_metric_l2, |
| 1942 | isis_metric_l2_cmd, |
| 1943 | "isis metric <0-16777215> level-2", |
| 1944 | "IS-IS commands\n" |
| 1945 | "Set default metric for circuit\n" |
| 1946 | "Default metric value\n" |
| 1947 | "Specify metric for level-2 routing\n") |
| 1948 | { |
| 1949 | int met; |
| 1950 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1951 | if (!circuit) |
| 1952 | return CMD_ERR_NO_MATCH; |
| 1953 | |
| 1954 | met = atoi (argv[0]); |
| 1955 | |
| 1956 | /* RFC3787 section 5.1 */ |
| 1957 | if (circuit->area && circuit->area->oldmetric == 1 && |
| 1958 | met > MAX_NARROW_LINK_METRIC) |
| 1959 | { |
| 1960 | vty_out (vty, "Invalid metric %d - should be <0-63> " |
| 1961 | "when narrow metric type enabled%s", |
| 1962 | met, VTY_NEWLINE); |
| 1963 | return CMD_ERR_AMBIGUOUS; |
| 1964 | } |
| 1965 | |
| 1966 | /* RFC4444 */ |
| 1967 | if (circuit->area && circuit->area->newmetric == 1 && |
| 1968 | met > MAX_WIDE_LINK_METRIC) |
| 1969 | { |
| 1970 | vty_out (vty, "Invalid metric %d - should be <0-16777215> " |
| 1971 | "when wide metric type enabled%s", |
| 1972 | met, VTY_NEWLINE); |
| 1973 | return CMD_ERR_AMBIGUOUS; |
| 1974 | } |
| 1975 | |
| 1976 | circuit->te_metric[1] = met; |
| 1977 | circuit->metrics[1].metric_default = met; |
| 1978 | |
| 1979 | if (circuit->area) |
| 1980 | lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0); |
| 1981 | |
| 1982 | return CMD_SUCCESS; |
| 1983 | } |
| 1984 | |
| 1985 | DEFUN (no_isis_metric_l2, |
| 1986 | no_isis_metric_l2_cmd, |
| 1987 | "no isis metric level-2", |
| 1988 | NO_STR |
| 1989 | "IS-IS commands\n" |
| 1990 | "Set default metric for circuit\n" |
| 1991 | "Specify metric for level-2 routing\n") |
| 1992 | { |
| 1993 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1994 | if (!circuit) |
| 1995 | return CMD_ERR_NO_MATCH; |
| 1996 | |
| 1997 | circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC; |
| 1998 | circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC; |
| 1999 | |
| 2000 | if (circuit->area) |
| 2001 | lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0); |
| 2002 | |
| 2003 | return CMD_SUCCESS; |
| 2004 | } |
| 2005 | |
| 2006 | ALIAS (no_isis_metric_l2, |
| 2007 | no_isis_metric_l2_arg_cmd, |
| 2008 | "no isis metric <0-16777215> level-2", |
| 2009 | NO_STR |
| 2010 | "IS-IS commands\n" |
| 2011 | "Set default metric for circuit\n" |
| 2012 | "Default metric value\n" |
| 2013 | "Specify metric for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2014 | /* end of metrics */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2015 | |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 2016 | DEFUN (isis_hello_interval, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2017 | isis_hello_interval_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2018 | "isis hello-interval <1-600>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2019 | "IS-IS commands\n" |
| 2020 | "Set Hello interval\n" |
| 2021 | "Hello interval value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2022 | "Holdtime 1 seconds, interval depends on multiplier\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2023 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2024 | int interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2025 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2026 | if (!circuit) |
| 2027 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2028 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2029 | interval = atoi (argv[0]); |
| 2030 | if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2031 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2032 | vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s", |
| 2033 | interval, VTY_NEWLINE); |
| 2034 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2035 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2036 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2037 | circuit->hello_interval[0] = (u_int16_t) interval; |
| 2038 | circuit->hello_interval[1] = (u_int16_t) interval; |
| 2039 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2040 | return CMD_SUCCESS; |
| 2041 | } |
| 2042 | |
| 2043 | DEFUN (no_isis_hello_interval, |
| 2044 | no_isis_hello_interval_cmd, |
| 2045 | "no isis hello-interval", |
| 2046 | NO_STR |
| 2047 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2048 | "Set Hello interval\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2049 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2050 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2051 | if (!circuit) |
| 2052 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2053 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2054 | circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL; |
| 2055 | circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2056 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2057 | return CMD_SUCCESS; |
| 2058 | } |
| 2059 | |
| 2060 | ALIAS (no_isis_hello_interval, |
| 2061 | no_isis_hello_interval_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2062 | "no isis hello-interval <1-600>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2063 | NO_STR |
| 2064 | "IS-IS commands\n" |
| 2065 | "Set Hello interval\n" |
| 2066 | "Hello interval value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2067 | "Holdtime 1 second, interval depends on multiplier\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2068 | |
| 2069 | DEFUN (isis_hello_interval_l1, |
| 2070 | isis_hello_interval_l1_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2071 | "isis hello-interval <1-600> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2072 | "IS-IS commands\n" |
| 2073 | "Set Hello interval\n" |
| 2074 | "Hello interval value\n" |
| 2075 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2076 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2077 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2078 | long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2079 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2080 | if (!circuit) |
| 2081 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2082 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2083 | interval = atoi (argv[0]); |
| 2084 | if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2085 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2086 | vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", |
| 2087 | interval, VTY_NEWLINE); |
| 2088 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2089 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2090 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2091 | circuit->hello_interval[0] = (u_int16_t) interval; |
| 2092 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2093 | return CMD_SUCCESS; |
| 2094 | } |
| 2095 | |
| 2096 | DEFUN (no_isis_hello_interval_l1, |
| 2097 | no_isis_hello_interval_l1_cmd, |
| 2098 | "no isis hello-interval level-1", |
| 2099 | NO_STR |
| 2100 | "IS-IS commands\n" |
| 2101 | "Set Hello interval\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2102 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2103 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2104 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2105 | if (!circuit) |
| 2106 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2107 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2108 | circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2109 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2110 | return CMD_SUCCESS; |
| 2111 | } |
| 2112 | |
| 2113 | ALIAS (no_isis_hello_interval_l1, |
| 2114 | no_isis_hello_interval_l1_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2115 | "no isis hello-interval <1-600> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2116 | NO_STR |
| 2117 | "IS-IS commands\n" |
| 2118 | "Set Hello interval\n" |
| 2119 | "Hello interval value\n" |
| 2120 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2121 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2122 | |
| 2123 | DEFUN (isis_hello_interval_l2, |
| 2124 | isis_hello_interval_l2_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2125 | "isis hello-interval <1-600> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2126 | "IS-IS commands\n" |
| 2127 | "Set Hello interval\n" |
| 2128 | "Hello interval value\n" |
| 2129 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2130 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2131 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2132 | long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2133 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2134 | if (!circuit) |
| 2135 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2136 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2137 | interval = atoi (argv[0]); |
| 2138 | if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2139 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2140 | vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", |
| 2141 | interval, VTY_NEWLINE); |
| 2142 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2143 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2144 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2145 | circuit->hello_interval[1] = (u_int16_t) interval; |
| 2146 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2147 | return CMD_SUCCESS; |
| 2148 | } |
| 2149 | |
| 2150 | DEFUN (no_isis_hello_interval_l2, |
| 2151 | no_isis_hello_interval_l2_cmd, |
| 2152 | "no isis hello-interval level-2", |
| 2153 | NO_STR |
| 2154 | "IS-IS commands\n" |
| 2155 | "Set Hello interval\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2156 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2157 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2158 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2159 | if (!circuit) |
| 2160 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2161 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2162 | circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2163 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2164 | return CMD_SUCCESS; |
| 2165 | } |
| 2166 | |
| 2167 | ALIAS (no_isis_hello_interval_l2, |
| 2168 | no_isis_hello_interval_l2_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2169 | "no isis hello-interval <1-600> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2170 | NO_STR |
| 2171 | "IS-IS commands\n" |
| 2172 | "Set Hello interval\n" |
| 2173 | "Hello interval value\n" |
| 2174 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2175 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2176 | |
| 2177 | DEFUN (isis_hello_multiplier, |
| 2178 | isis_hello_multiplier_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2179 | "isis hello-multiplier <2-100>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2180 | "IS-IS commands\n" |
| 2181 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2182 | "Hello multiplier value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2183 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2184 | int mult; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2185 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2186 | if (!circuit) |
| 2187 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2188 | |
| 2189 | mult = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2190 | if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) |
| 2191 | { |
| 2192 | vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", |
| 2193 | mult, VTY_NEWLINE); |
| 2194 | return CMD_ERR_AMBIGUOUS; |
| 2195 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2196 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2197 | circuit->hello_multiplier[0] = (u_int16_t) mult; |
| 2198 | circuit->hello_multiplier[1] = (u_int16_t) mult; |
| 2199 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2200 | return CMD_SUCCESS; |
| 2201 | } |
| 2202 | |
| 2203 | DEFUN (no_isis_hello_multiplier, |
| 2204 | no_isis_hello_multiplier_cmd, |
| 2205 | "no isis hello-multiplier", |
| 2206 | NO_STR |
| 2207 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2208 | "Set multiplier for Hello holding time\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2209 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2210 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2211 | if (!circuit) |
| 2212 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2213 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2214 | circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER; |
| 2215 | circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2216 | |
| 2217 | return CMD_SUCCESS; |
| 2218 | } |
| 2219 | |
| 2220 | ALIAS (no_isis_hello_multiplier, |
| 2221 | no_isis_hello_multiplier_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2222 | "no isis hello-multiplier <2-100>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2223 | NO_STR |
| 2224 | "IS-IS commands\n" |
| 2225 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2226 | "Hello multiplier value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2227 | |
| 2228 | DEFUN (isis_hello_multiplier_l1, |
| 2229 | isis_hello_multiplier_l1_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2230 | "isis hello-multiplier <2-100> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2231 | "IS-IS commands\n" |
| 2232 | "Set multiplier for Hello holding time\n" |
| 2233 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2234 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2235 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2236 | int mult; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2237 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2238 | if (!circuit) |
| 2239 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2240 | |
| 2241 | mult = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2242 | if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) |
| 2243 | { |
| 2244 | vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", |
| 2245 | mult, VTY_NEWLINE); |
| 2246 | return CMD_ERR_AMBIGUOUS; |
| 2247 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2248 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2249 | circuit->hello_multiplier[0] = (u_int16_t) mult; |
| 2250 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2251 | return CMD_SUCCESS; |
| 2252 | } |
| 2253 | |
| 2254 | DEFUN (no_isis_hello_multiplier_l1, |
| 2255 | no_isis_hello_multiplier_l1_cmd, |
| 2256 | "no isis hello-multiplier level-1", |
| 2257 | NO_STR |
| 2258 | "IS-IS commands\n" |
| 2259 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2260 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2261 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2262 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2263 | if (!circuit) |
| 2264 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2265 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2266 | circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2267 | |
| 2268 | return CMD_SUCCESS; |
| 2269 | } |
| 2270 | |
| 2271 | ALIAS (no_isis_hello_multiplier_l1, |
| 2272 | no_isis_hello_multiplier_l1_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2273 | "no isis hello-multiplier <2-100> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2274 | NO_STR |
| 2275 | "IS-IS commands\n" |
| 2276 | "Set multiplier for Hello holding time\n" |
| 2277 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2278 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2279 | |
| 2280 | DEFUN (isis_hello_multiplier_l2, |
| 2281 | isis_hello_multiplier_l2_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2282 | "isis hello-multiplier <2-100> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2283 | "IS-IS commands\n" |
| 2284 | "Set multiplier for Hello holding time\n" |
| 2285 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2286 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2287 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2288 | int mult; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2289 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2290 | if (!circuit) |
| 2291 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2292 | |
| 2293 | mult = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2294 | if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) |
| 2295 | { |
| 2296 | vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", |
| 2297 | mult, VTY_NEWLINE); |
| 2298 | return CMD_ERR_AMBIGUOUS; |
| 2299 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2300 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2301 | circuit->hello_multiplier[1] = (u_int16_t) mult; |
| 2302 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2303 | return CMD_SUCCESS; |
| 2304 | } |
| 2305 | |
| 2306 | DEFUN (no_isis_hello_multiplier_l2, |
| 2307 | no_isis_hello_multiplier_l2_cmd, |
| 2308 | "no isis hello-multiplier level-2", |
| 2309 | NO_STR |
| 2310 | "IS-IS commands\n" |
| 2311 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2312 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2313 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2314 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2315 | if (!circuit) |
| 2316 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2317 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2318 | circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2319 | |
| 2320 | return CMD_SUCCESS; |
| 2321 | } |
| 2322 | |
| 2323 | ALIAS (no_isis_hello_multiplier_l2, |
| 2324 | no_isis_hello_multiplier_l2_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2325 | "no isis hello-multiplier <2-100> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2326 | NO_STR |
| 2327 | "IS-IS commands\n" |
| 2328 | "Set multiplier for Hello holding time\n" |
| 2329 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2330 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2331 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2332 | DEFUN (isis_hello_padding, |
| 2333 | isis_hello_padding_cmd, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2334 | "isis hello padding", |
| 2335 | "IS-IS commands\n" |
| 2336 | "Add padding to IS-IS hello packets\n" |
| 2337 | "Pad hello packets\n" |
| 2338 | "<cr>\n") |
| 2339 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2340 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2341 | if (!circuit) |
| 2342 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2343 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2344 | circuit->pad_hellos = 1; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2345 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2346 | return CMD_SUCCESS; |
| 2347 | } |
| 2348 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2349 | DEFUN (no_isis_hello_padding, |
| 2350 | no_isis_hello_padding_cmd, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2351 | "no isis hello padding", |
| 2352 | NO_STR |
| 2353 | "IS-IS commands\n" |
| 2354 | "Add padding to IS-IS hello packets\n" |
| 2355 | "Pad hello packets\n" |
| 2356 | "<cr>\n") |
| 2357 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2358 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2359 | if (!circuit) |
| 2360 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2361 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2362 | circuit->pad_hellos = 0; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2363 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2364 | return CMD_SUCCESS; |
| 2365 | } |
| 2366 | |
| 2367 | DEFUN (csnp_interval, |
| 2368 | csnp_interval_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2369 | "isis csnp-interval <1-600>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2370 | "IS-IS commands\n" |
| 2371 | "Set CSNP interval in seconds\n" |
| 2372 | "CSNP interval value\n") |
| 2373 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2374 | unsigned long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2375 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2376 | if (!circuit) |
| 2377 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2378 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2379 | interval = atol (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2380 | if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) |
| 2381 | { |
| 2382 | vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", |
| 2383 | interval, VTY_NEWLINE); |
| 2384 | return CMD_ERR_AMBIGUOUS; |
| 2385 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2386 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2387 | circuit->csnp_interval[0] = (u_int16_t) interval; |
| 2388 | circuit->csnp_interval[1] = (u_int16_t) interval; |
| 2389 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2390 | return CMD_SUCCESS; |
| 2391 | } |
| 2392 | |
| 2393 | DEFUN (no_csnp_interval, |
| 2394 | no_csnp_interval_cmd, |
| 2395 | "no isis csnp-interval", |
| 2396 | NO_STR |
| 2397 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2398 | "Set CSNP interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2399 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2400 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2401 | if (!circuit) |
| 2402 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2403 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2404 | circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL; |
| 2405 | circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2406 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2407 | return CMD_SUCCESS; |
| 2408 | } |
| 2409 | |
| 2410 | ALIAS (no_csnp_interval, |
| 2411 | no_csnp_interval_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2412 | "no isis csnp-interval <1-600>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2413 | NO_STR |
| 2414 | "IS-IS commands\n" |
| 2415 | "Set CSNP interval in seconds\n" |
| 2416 | "CSNP interval value\n") |
| 2417 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2418 | DEFUN (csnp_interval_l1, |
| 2419 | csnp_interval_l1_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2420 | "isis csnp-interval <1-600> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2421 | "IS-IS commands\n" |
| 2422 | "Set CSNP interval in seconds\n" |
| 2423 | "CSNP interval value\n" |
| 2424 | "Specify interval for level-1 CSNPs\n") |
| 2425 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2426 | unsigned long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2427 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2428 | if (!circuit) |
| 2429 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2430 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2431 | interval = atol (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2432 | if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) |
| 2433 | { |
| 2434 | vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", |
| 2435 | interval, VTY_NEWLINE); |
| 2436 | return CMD_ERR_AMBIGUOUS; |
| 2437 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2438 | |
| 2439 | circuit->csnp_interval[0] = (u_int16_t) interval; |
| 2440 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2441 | return CMD_SUCCESS; |
| 2442 | } |
| 2443 | |
| 2444 | DEFUN (no_csnp_interval_l1, |
| 2445 | no_csnp_interval_l1_cmd, |
| 2446 | "no isis csnp-interval level-1", |
| 2447 | NO_STR |
| 2448 | "IS-IS commands\n" |
| 2449 | "Set CSNP interval in seconds\n" |
| 2450 | "Specify interval for level-1 CSNPs\n") |
| 2451 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2452 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2453 | if (!circuit) |
| 2454 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2455 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2456 | circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2457 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2458 | return CMD_SUCCESS; |
| 2459 | } |
| 2460 | |
| 2461 | ALIAS (no_csnp_interval_l1, |
| 2462 | no_csnp_interval_l1_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2463 | "no isis csnp-interval <1-600> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2464 | NO_STR |
| 2465 | "IS-IS commands\n" |
| 2466 | "Set CSNP interval in seconds\n" |
| 2467 | "CSNP interval value\n" |
| 2468 | "Specify interval for level-1 CSNPs\n") |
| 2469 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2470 | DEFUN (csnp_interval_l2, |
| 2471 | csnp_interval_l2_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2472 | "isis csnp-interval <1-600> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2473 | "IS-IS commands\n" |
| 2474 | "Set CSNP interval in seconds\n" |
| 2475 | "CSNP interval value\n" |
| 2476 | "Specify interval for level-2 CSNPs\n") |
| 2477 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2478 | unsigned long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2479 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2480 | if (!circuit) |
| 2481 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2482 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2483 | interval = atol (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2484 | if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) |
| 2485 | { |
| 2486 | vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", |
| 2487 | interval, VTY_NEWLINE); |
| 2488 | return CMD_ERR_AMBIGUOUS; |
| 2489 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2490 | |
| 2491 | circuit->csnp_interval[1] = (u_int16_t) interval; |
| 2492 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2493 | return CMD_SUCCESS; |
| 2494 | } |
| 2495 | |
| 2496 | DEFUN (no_csnp_interval_l2, |
| 2497 | no_csnp_interval_l2_cmd, |
| 2498 | "no isis csnp-interval level-2", |
| 2499 | NO_STR |
| 2500 | "IS-IS commands\n" |
| 2501 | "Set CSNP interval in seconds\n" |
| 2502 | "Specify interval for level-2 CSNPs\n") |
| 2503 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2504 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2505 | if (!circuit) |
| 2506 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2507 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2508 | circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2509 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2510 | return CMD_SUCCESS; |
| 2511 | } |
| 2512 | |
| 2513 | ALIAS (no_csnp_interval_l2, |
| 2514 | no_csnp_interval_l2_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2515 | "no isis csnp-interval <1-600> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2516 | NO_STR |
| 2517 | "IS-IS commands\n" |
| 2518 | "Set CSNP interval in seconds\n" |
| 2519 | "CSNP interval value\n" |
| 2520 | "Specify interval for level-2 CSNPs\n") |
| 2521 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2522 | DEFUN (psnp_interval, |
| 2523 | psnp_interval_cmd, |
| 2524 | "isis psnp-interval <1-120>", |
| 2525 | "IS-IS commands\n" |
| 2526 | "Set PSNP interval in seconds\n" |
| 2527 | "PSNP interval value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2528 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2529 | unsigned long interval; |
| 2530 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2531 | if (!circuit) |
| 2532 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2533 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2534 | interval = atol (argv[0]); |
| 2535 | if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2536 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2537 | vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", |
| 2538 | interval, VTY_NEWLINE); |
| 2539 | return CMD_ERR_AMBIGUOUS; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2540 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2541 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2542 | circuit->psnp_interval[0] = (u_int16_t) interval; |
| 2543 | circuit->psnp_interval[1] = (u_int16_t) interval; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2544 | |
| 2545 | return CMD_SUCCESS; |
| 2546 | } |
| 2547 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2548 | DEFUN (no_psnp_interval, |
| 2549 | no_psnp_interval_cmd, |
| 2550 | "no isis psnp-interval", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2551 | NO_STR |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2552 | "IS-IS commands\n" |
| 2553 | "Set PSNP interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2554 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2555 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2556 | if (!circuit) |
| 2557 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2558 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2559 | circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL; |
| 2560 | circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2561 | |
| 2562 | return CMD_SUCCESS; |
| 2563 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2564 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2565 | ALIAS (no_psnp_interval, |
| 2566 | no_psnp_interval_arg_cmd, |
| 2567 | "no isis psnp-interval <1-120>", |
| 2568 | NO_STR |
| 2569 | "IS-IS commands\n" |
| 2570 | "Set PSNP interval in seconds\n" |
| 2571 | "PSNP interval value\n") |
| 2572 | |
| 2573 | DEFUN (psnp_interval_l1, |
| 2574 | psnp_interval_l1_cmd, |
| 2575 | "isis psnp-interval <1-120> level-1", |
| 2576 | "IS-IS commands\n" |
| 2577 | "Set PSNP interval in seconds\n" |
| 2578 | "PSNP interval value\n" |
| 2579 | "Specify interval for level-1 PSNPs\n") |
| 2580 | { |
| 2581 | unsigned long interval; |
| 2582 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2583 | if (!circuit) |
| 2584 | return CMD_ERR_NO_MATCH; |
| 2585 | |
| 2586 | interval = atol (argv[0]); |
| 2587 | if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) |
| 2588 | { |
| 2589 | vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", |
| 2590 | interval, VTY_NEWLINE); |
| 2591 | return CMD_ERR_AMBIGUOUS; |
| 2592 | } |
| 2593 | |
| 2594 | circuit->psnp_interval[0] = (u_int16_t) interval; |
| 2595 | |
| 2596 | return CMD_SUCCESS; |
| 2597 | } |
| 2598 | |
| 2599 | DEFUN (no_psnp_interval_l1, |
| 2600 | no_psnp_interval_l1_cmd, |
| 2601 | "no isis psnp-interval level-1", |
| 2602 | NO_STR |
| 2603 | "IS-IS commands\n" |
| 2604 | "Set PSNP interval in seconds\n" |
| 2605 | "Specify interval for level-1 PSNPs\n") |
| 2606 | { |
| 2607 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2608 | if (!circuit) |
| 2609 | return CMD_ERR_NO_MATCH; |
| 2610 | |
| 2611 | circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL; |
| 2612 | |
| 2613 | return CMD_SUCCESS; |
| 2614 | } |
| 2615 | |
| 2616 | ALIAS (no_psnp_interval_l1, |
| 2617 | no_psnp_interval_l1_arg_cmd, |
| 2618 | "no isis psnp-interval <1-120> level-1", |
| 2619 | NO_STR |
| 2620 | "IS-IS commands\n" |
| 2621 | "Set PSNP interval in seconds\n" |
| 2622 | "PSNP interval value\n" |
| 2623 | "Specify interval for level-1 PSNPs\n") |
| 2624 | |
| 2625 | DEFUN (psnp_interval_l2, |
| 2626 | psnp_interval_l2_cmd, |
| 2627 | "isis psnp-interval <1-120> level-2", |
| 2628 | "IS-IS commands\n" |
| 2629 | "Set PSNP interval in seconds\n" |
| 2630 | "PSNP interval value\n" |
| 2631 | "Specify interval for level-2 PSNPs\n") |
| 2632 | { |
| 2633 | unsigned long interval; |
| 2634 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2635 | if (!circuit) |
| 2636 | return CMD_ERR_NO_MATCH; |
| 2637 | |
| 2638 | interval = atol (argv[0]); |
| 2639 | if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) |
| 2640 | { |
| 2641 | vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", |
| 2642 | interval, VTY_NEWLINE); |
| 2643 | return CMD_ERR_AMBIGUOUS; |
| 2644 | } |
| 2645 | |
| 2646 | circuit->psnp_interval[1] = (u_int16_t) interval; |
| 2647 | |
| 2648 | return CMD_SUCCESS; |
| 2649 | } |
| 2650 | |
| 2651 | DEFUN (no_psnp_interval_l2, |
| 2652 | no_psnp_interval_l2_cmd, |
| 2653 | "no isis psnp-interval level-2", |
| 2654 | NO_STR |
| 2655 | "IS-IS commands\n" |
| 2656 | "Set PSNP interval in seconds\n" |
| 2657 | "Specify interval for level-2 PSNPs\n") |
| 2658 | { |
| 2659 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2660 | if (!circuit) |
| 2661 | return CMD_ERR_NO_MATCH; |
| 2662 | |
| 2663 | circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL; |
| 2664 | |
| 2665 | return CMD_SUCCESS; |
| 2666 | } |
| 2667 | |
| 2668 | ALIAS (no_psnp_interval_l2, |
| 2669 | no_psnp_interval_l2_arg_cmd, |
| 2670 | "no isis psnp-interval <1-120> level-2", |
| 2671 | NO_STR |
| 2672 | "IS-IS commands\n" |
| 2673 | "Set PSNP interval in seconds\n" |
| 2674 | "PSNP interval value\n" |
| 2675 | "Specify interval for level-2 PSNPs\n") |
| 2676 | |
| 2677 | struct cmd_node interface_node = { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2678 | INTERFACE_NODE, |
| 2679 | "%s(config-if)# ", |
| 2680 | 1, |
| 2681 | }; |
| 2682 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2683 | DEFUN (isis_network, |
| 2684 | isis_network_cmd, |
| 2685 | "isis network point-to-point", |
| 2686 | "IS-IS commands\n" |
| 2687 | "Set network type\n" |
| 2688 | "point-to-point network type\n") |
| 2689 | { |
| 2690 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2691 | if (!circuit) |
| 2692 | return CMD_ERR_NO_MATCH; |
| 2693 | |
| 2694 | /* RFC5309 section 4 */ |
| 2695 | if (circuit->circ_type == CIRCUIT_T_P2P) |
| 2696 | return CMD_SUCCESS; |
| 2697 | |
| 2698 | if (circuit->state != C_STATE_UP) |
| 2699 | { |
| 2700 | circuit->circ_type = CIRCUIT_T_P2P; |
| 2701 | circuit->circ_type_config = CIRCUIT_T_P2P; |
| 2702 | } |
| 2703 | else |
| 2704 | { |
| 2705 | struct isis_area *area = circuit->area; |
| 2706 | if (!if_is_broadcast (circuit->interface)) |
| 2707 | { |
| 2708 | vty_out (vty, "isis network point-to-point " |
| 2709 | "is valid only on broadcast interfaces%s", |
| 2710 | VTY_NEWLINE); |
| 2711 | return CMD_ERR_AMBIGUOUS; |
| 2712 | } |
| 2713 | |
| 2714 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 2715 | circuit->circ_type = CIRCUIT_T_P2P; |
| 2716 | circuit->circ_type_config = CIRCUIT_T_P2P; |
| 2717 | isis_csm_state_change (ISIS_ENABLE, circuit, area); |
| 2718 | } |
| 2719 | |
| 2720 | return CMD_SUCCESS; |
| 2721 | } |
| 2722 | |
| 2723 | DEFUN (no_isis_network, |
| 2724 | no_isis_network_cmd, |
| 2725 | "no isis network point-to-point", |
| 2726 | NO_STR |
| 2727 | "IS-IS commands\n" |
| 2728 | "Set network type for circuit\n" |
| 2729 | "point-to-point network type\n") |
| 2730 | { |
| 2731 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2732 | if (!circuit) |
| 2733 | return CMD_ERR_NO_MATCH; |
| 2734 | |
| 2735 | /* RFC5309 section 4 */ |
| 2736 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 2737 | return CMD_SUCCESS; |
| 2738 | |
| 2739 | if (circuit->state != C_STATE_UP) |
| 2740 | { |
| 2741 | circuit->circ_type = CIRCUIT_T_BROADCAST; |
| 2742 | circuit->circ_type_config = CIRCUIT_T_BROADCAST; |
| 2743 | } |
| 2744 | else |
| 2745 | { |
| 2746 | struct isis_area *area = circuit->area; |
| 2747 | if (circuit->interface && |
| 2748 | !if_is_broadcast (circuit->interface)) |
| 2749 | { |
| 2750 | vty_out (vty, "no isis network point-to-point " |
| 2751 | "is valid only on broadcast interfaces%s", |
| 2752 | VTY_NEWLINE); |
| 2753 | return CMD_ERR_AMBIGUOUS; |
| 2754 | } |
| 2755 | |
| 2756 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 2757 | circuit->circ_type = CIRCUIT_T_BROADCAST; |
| 2758 | circuit->circ_type_config = CIRCUIT_T_BROADCAST; |
| 2759 | isis_csm_state_change (ISIS_ENABLE, circuit, area); |
| 2760 | } |
| 2761 | |
| 2762 | return CMD_SUCCESS; |
| 2763 | } |
| 2764 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2765 | int |
| 2766 | isis_if_new_hook (struct interface *ifp) |
| 2767 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2768 | return 0; |
| 2769 | } |
| 2770 | |
| 2771 | int |
| 2772 | isis_if_delete_hook (struct interface *ifp) |
| 2773 | { |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2774 | struct isis_circuit *circuit; |
| 2775 | /* Clean up the circuit data */ |
| 2776 | if (ifp && ifp->info) |
| 2777 | { |
| 2778 | circuit = ifp->info; |
| 2779 | isis_csm_state_change (IF_DOWN_FROM_Z, circuit, circuit->area); |
| 2780 | isis_csm_state_change (ISIS_DISABLE, circuit, circuit->area); |
| 2781 | } |
| 2782 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2783 | return 0; |
| 2784 | } |
| 2785 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2786 | void |
| 2787 | isis_circuit_init () |
| 2788 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2789 | /* Initialize Zebra interface data structure */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2790 | if_add_hook (IF_NEW_HOOK, isis_if_new_hook); |
| 2791 | if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook); |
| 2792 | |
| 2793 | /* Install interface node */ |
| 2794 | install_node (&interface_node, isis_interface_config_write); |
| 2795 | install_element (CONFIG_NODE, &interface_cmd); |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2796 | install_element (CONFIG_NODE, &no_interface_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2797 | |
| 2798 | install_default (INTERFACE_NODE); |
| 2799 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 2800 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 2801 | |
| 2802 | install_element (INTERFACE_NODE, &ip_router_isis_cmd); |
| 2803 | install_element (INTERFACE_NODE, &no_ip_router_isis_cmd); |
| 2804 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2805 | install_element (INTERFACE_NODE, &isis_passive_cmd); |
| 2806 | install_element (INTERFACE_NODE, &no_isis_passive_cmd); |
| 2807 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2808 | install_element (INTERFACE_NODE, &isis_circuit_type_cmd); |
| 2809 | install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd); |
| 2810 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2811 | install_element (INTERFACE_NODE, &isis_passwd_clear_cmd); |
| 2812 | install_element (INTERFACE_NODE, &isis_passwd_md5_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2813 | install_element (INTERFACE_NODE, &no_isis_passwd_cmd); |
| 2814 | |
| 2815 | install_element (INTERFACE_NODE, &isis_priority_cmd); |
| 2816 | install_element (INTERFACE_NODE, &no_isis_priority_cmd); |
| 2817 | install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd); |
| 2818 | install_element (INTERFACE_NODE, &isis_priority_l1_cmd); |
| 2819 | install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd); |
| 2820 | install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd); |
| 2821 | install_element (INTERFACE_NODE, &isis_priority_l2_cmd); |
| 2822 | install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd); |
| 2823 | install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd); |
| 2824 | |
| 2825 | install_element (INTERFACE_NODE, &isis_metric_cmd); |
| 2826 | install_element (INTERFACE_NODE, &no_isis_metric_cmd); |
| 2827 | install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2828 | install_element (INTERFACE_NODE, &isis_metric_l1_cmd); |
| 2829 | install_element (INTERFACE_NODE, &no_isis_metric_l1_cmd); |
| 2830 | install_element (INTERFACE_NODE, &no_isis_metric_l1_arg_cmd); |
| 2831 | install_element (INTERFACE_NODE, &isis_metric_l2_cmd); |
| 2832 | install_element (INTERFACE_NODE, &no_isis_metric_l2_cmd); |
| 2833 | install_element (INTERFACE_NODE, &no_isis_metric_l2_arg_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2834 | |
| 2835 | install_element (INTERFACE_NODE, &isis_hello_interval_cmd); |
| 2836 | install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd); |
| 2837 | install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd); |
| 2838 | install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd); |
| 2839 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd); |
| 2840 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd); |
| 2841 | install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd); |
| 2842 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd); |
| 2843 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd); |
| 2844 | |
| 2845 | install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd); |
| 2846 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd); |
| 2847 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd); |
| 2848 | install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd); |
| 2849 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd); |
| 2850 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd); |
| 2851 | install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd); |
| 2852 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd); |
| 2853 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd); |
| 2854 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2855 | install_element (INTERFACE_NODE, &isis_hello_padding_cmd); |
| 2856 | install_element (INTERFACE_NODE, &no_isis_hello_padding_cmd); |
| 2857 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2858 | install_element (INTERFACE_NODE, &csnp_interval_cmd); |
| 2859 | install_element (INTERFACE_NODE, &no_csnp_interval_cmd); |
| 2860 | install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd); |
| 2861 | install_element (INTERFACE_NODE, &csnp_interval_l1_cmd); |
| 2862 | install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd); |
| 2863 | install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd); |
| 2864 | install_element (INTERFACE_NODE, &csnp_interval_l2_cmd); |
| 2865 | install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd); |
| 2866 | install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd); |
| 2867 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2868 | install_element (INTERFACE_NODE, &psnp_interval_cmd); |
| 2869 | install_element (INTERFACE_NODE, &no_psnp_interval_cmd); |
| 2870 | install_element (INTERFACE_NODE, &no_psnp_interval_arg_cmd); |
| 2871 | install_element (INTERFACE_NODE, &psnp_interval_l1_cmd); |
| 2872 | install_element (INTERFACE_NODE, &no_psnp_interval_l1_cmd); |
| 2873 | install_element (INTERFACE_NODE, &no_psnp_interval_l1_arg_cmd); |
| 2874 | install_element (INTERFACE_NODE, &psnp_interval_l2_cmd); |
| 2875 | install_element (INTERFACE_NODE, &no_psnp_interval_l2_cmd); |
| 2876 | install_element (INTERFACE_NODE, &no_psnp_interval_l2_arg_cmd); |
| 2877 | |
| 2878 | install_element (INTERFACE_NODE, &isis_network_cmd); |
| 2879 | install_element (INTERFACE_NODE, &no_isis_network_cmd); |
| 2880 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2881 | #ifdef HAVE_IPV6 |
| 2882 | install_element (INTERFACE_NODE, &ipv6_router_isis_cmd); |
| 2883 | install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2884 | #endif |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2885 | } |