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