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); |
| 643 | isis_circuit_down(circuit); |
| 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 | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1301 | return rv; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1302 | } |
| 1303 | |
| 1304 | DEFUN (no_ip_router_isis, |
| 1305 | no_ip_router_isis_cmd, |
| 1306 | "no ip router isis WORD", |
| 1307 | NO_STR |
| 1308 | "Interface Internet Protocol config commands\n" |
| 1309 | "IP router interface commands\n" |
| 1310 | "IS-IS Routing for IP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1311 | "Routing process tag\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1312 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1313 | struct interface *ifp; |
| 1314 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1315 | struct isis_circuit *circuit; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1316 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1317 | ifp = (struct interface *) vty->index; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1318 | if (!ifp) |
| 1319 | { |
| 1320 | vty_out (vty, "Invalid interface %s", VTY_NEWLINE); |
| 1321 | return CMD_ERR_NO_MATCH; |
| 1322 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1323 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1324 | area = isis_area_lookup (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1325 | if (!area) |
| 1326 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1327 | vty_out (vty, "Can't find ISIS instance %s%s", |
| 1328 | argv[0], VTY_NEWLINE); |
| 1329 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1330 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1331 | |
| 1332 | circuit = circuit_lookup_by_ifp (ifp, area->circuit_list); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1333 | if (!circuit) |
| 1334 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1335 | vty_out (vty, "ISIS is not enabled on circuit %s%s", |
| 1336 | ifp->name, VTY_NEWLINE); |
| 1337 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1338 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1339 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1340 | circuit->ip_router = 0; |
| 1341 | area->ip_circuits--; |
| 1342 | #ifdef HAVE_IPV6 |
| 1343 | if (circuit->ipv6_router == 0) |
| 1344 | #endif |
| 1345 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1346 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1347 | return CMD_SUCCESS; |
| 1348 | } |
| 1349 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1350 | #ifdef HAVE_IPV6 |
| 1351 | DEFUN (ipv6_router_isis, |
| 1352 | ipv6_router_isis_cmd, |
| 1353 | "ipv6 router isis WORD", |
| 1354 | "IPv6 interface subcommands\n" |
| 1355 | "IPv6 Router interface commands\n" |
| 1356 | "IS-IS Routing for IPv6\n" |
| 1357 | "Routing process tag\n") |
| 1358 | { |
| 1359 | struct isis_circuit *circuit; |
| 1360 | struct interface *ifp; |
| 1361 | struct isis_area *area; |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1362 | int rv; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1363 | |
| 1364 | ifp = (struct interface *) vty->index; |
| 1365 | assert (ifp); |
| 1366 | |
| 1367 | /* Prevent more than one area per circuit */ |
| 1368 | circuit = circuit_scan_by_ifp (ifp); |
| 1369 | if (circuit) |
| 1370 | { |
| 1371 | if (circuit->ipv6_router == 1) |
| 1372 | { |
| 1373 | if (strcmp (circuit->area->area_tag, argv[0])) |
| 1374 | { |
| 1375 | vty_out (vty, "ISIS circuit is already defined for IPv6 on %s%s", |
| 1376 | circuit->area->area_tag, VTY_NEWLINE); |
| 1377 | return CMD_ERR_NOTHING_TODO; |
| 1378 | } |
| 1379 | return CMD_SUCCESS; |
| 1380 | } |
| 1381 | } |
| 1382 | |
| 1383 | if (isis_area_get (vty, argv[0]) != CMD_SUCCESS) |
| 1384 | { |
| 1385 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 1386 | return CMD_ERR_NO_MATCH; |
| 1387 | } |
| 1388 | area = vty->index; |
| 1389 | |
| 1390 | circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area); |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1391 | if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP) |
| 1392 | { |
| 1393 | vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE); |
| 1394 | rv = CMD_WARNING; |
| 1395 | } |
| 1396 | else |
| 1397 | { |
| 1398 | isis_circuit_if_bind (circuit, ifp); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1399 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1400 | circuit->ipv6_router = 1; |
| 1401 | area->ipv6_circuits++; |
| 1402 | circuit_update_nlpids (circuit); |
| 1403 | rv = CMD_SUCCESS; |
| 1404 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1405 | |
| 1406 | vty->node = INTERFACE_NODE; |
| 1407 | vty->index = ifp; |
| 1408 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1409 | return rv; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1410 | } |
| 1411 | |
| 1412 | DEFUN (no_ipv6_router_isis, |
| 1413 | no_ipv6_router_isis_cmd, |
| 1414 | "no ipv6 router isis WORD", |
| 1415 | NO_STR |
| 1416 | "IPv6 interface subcommands\n" |
| 1417 | "IPv6 Router interface commands\n" |
| 1418 | "IS-IS Routing for IPv6\n" |
| 1419 | "Routing process tag\n") |
| 1420 | { |
| 1421 | struct interface *ifp; |
| 1422 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1423 | struct isis_circuit *circuit; |
| 1424 | |
| 1425 | ifp = (struct interface *) vty->index; |
| 1426 | if (!ifp) |
| 1427 | { |
| 1428 | vty_out (vty, "Invalid interface %s", VTY_NEWLINE); |
| 1429 | return CMD_ERR_NO_MATCH; |
| 1430 | } |
| 1431 | |
| 1432 | area = isis_area_lookup (argv[0]); |
| 1433 | if (!area) |
| 1434 | { |
| 1435 | vty_out (vty, "Can't find ISIS instance %s%s", |
| 1436 | argv[0], VTY_NEWLINE); |
| 1437 | return CMD_ERR_NO_MATCH; |
| 1438 | } |
| 1439 | |
| 1440 | circuit = circuit_lookup_by_ifp (ifp, area->circuit_list); |
| 1441 | if (!circuit) |
| 1442 | { |
| 1443 | vty_out (vty, "ISIS is not enabled on circuit %s%s", |
| 1444 | ifp->name, VTY_NEWLINE); |
| 1445 | return CMD_ERR_NO_MATCH; |
| 1446 | } |
| 1447 | |
| 1448 | circuit->ipv6_router = 0; |
| 1449 | area->ipv6_circuits--; |
| 1450 | if (circuit->ip_router == 0) |
| 1451 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 1452 | |
| 1453 | return CMD_SUCCESS; |
| 1454 | } |
| 1455 | #endif /* HAVE_IPV6 */ |
| 1456 | |
| 1457 | DEFUN (isis_passive, |
| 1458 | isis_passive_cmd, |
| 1459 | "isis passive", |
| 1460 | "IS-IS commands\n" |
| 1461 | "Configure the passive mode for interface\n") |
| 1462 | { |
| 1463 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1464 | if (!circuit) |
| 1465 | return CMD_ERR_NO_MATCH; |
| 1466 | |
| 1467 | if (circuit->is_passive == 1) |
| 1468 | return CMD_SUCCESS; |
| 1469 | |
| 1470 | if (circuit->state != C_STATE_UP) |
| 1471 | { |
| 1472 | circuit->is_passive = 1; |
| 1473 | } |
| 1474 | else |
| 1475 | { |
| 1476 | struct isis_area *area = circuit->area; |
| 1477 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 1478 | circuit->is_passive = 1; |
| 1479 | isis_csm_state_change (ISIS_ENABLE, circuit, area); |
| 1480 | } |
| 1481 | |
| 1482 | return CMD_SUCCESS; |
| 1483 | } |
| 1484 | |
| 1485 | DEFUN (no_isis_passive, |
| 1486 | no_isis_passive_cmd, |
| 1487 | "no isis passive", |
| 1488 | NO_STR |
| 1489 | "IS-IS commands\n" |
| 1490 | "Configure the passive mode for interface\n") |
| 1491 | { |
| 1492 | struct interface *ifp; |
| 1493 | struct isis_circuit *circuit; |
| 1494 | |
| 1495 | ifp = (struct interface *) vty->index; |
| 1496 | if (!ifp) |
| 1497 | { |
| 1498 | vty_out (vty, "Invalid interface %s", VTY_NEWLINE); |
| 1499 | return CMD_ERR_NO_MATCH; |
| 1500 | } |
| 1501 | |
| 1502 | /* FIXME: what is wrong with circuit = ifp->info ? */ |
| 1503 | circuit = circuit_scan_by_ifp (ifp); |
| 1504 | if (!circuit) |
| 1505 | { |
| 1506 | vty_out (vty, "ISIS is not enabled on circuit %s%s", |
| 1507 | ifp->name, VTY_NEWLINE); |
| 1508 | return CMD_ERR_NO_MATCH; |
| 1509 | } |
| 1510 | |
| 1511 | if (if_is_loopback(ifp)) |
| 1512 | { |
| 1513 | vty_out (vty, "Can't set no passive for loopback interface%s", |
| 1514 | VTY_NEWLINE); |
| 1515 | return CMD_ERR_AMBIGUOUS; |
| 1516 | } |
| 1517 | |
| 1518 | if (circuit->is_passive == 0) |
| 1519 | return CMD_SUCCESS; |
| 1520 | |
| 1521 | if (circuit->state != C_STATE_UP) |
| 1522 | { |
| 1523 | circuit->is_passive = 0; |
| 1524 | } |
| 1525 | else |
| 1526 | { |
| 1527 | struct isis_area *area = circuit->area; |
| 1528 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 1529 | circuit->is_passive = 0; |
| 1530 | isis_csm_state_change (ISIS_ENABLE, circuit, area); |
| 1531 | } |
| 1532 | |
| 1533 | return CMD_SUCCESS; |
| 1534 | } |
| 1535 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1536 | DEFUN (isis_circuit_type, |
| 1537 | isis_circuit_type_cmd, |
| 1538 | "isis circuit-type (level-1|level-1-2|level-2-only)", |
| 1539 | "IS-IS commands\n" |
| 1540 | "Configure circuit type for interface\n" |
| 1541 | "Level-1 only adjacencies are formed\n" |
| 1542 | "Level-1-2 adjacencies are formed\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1543 | "Level-2 only adjacencies are formed\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1544 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1545 | int circuit_type; |
| 1546 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1547 | if (!circuit) |
| 1548 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1549 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1550 | circuit_type = string2circuit_t (argv[0]); |
| 1551 | if (!circuit_type) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1552 | { |
| 1553 | vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1554 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1555 | } |
| 1556 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1557 | if (circuit->state == C_STATE_UP && |
| 1558 | circuit->area->is_type != IS_LEVEL_1_AND_2 && |
| 1559 | circuit->area->is_type != circuit_type) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1560 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1561 | vty_out (vty, "Invalid circuit level for area %s.%s", |
| 1562 | circuit->area->area_tag, VTY_NEWLINE); |
| 1563 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1564 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1565 | isis_event_circuit_type_change (circuit, circuit_type); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1566 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1567 | return CMD_SUCCESS; |
| 1568 | } |
| 1569 | |
| 1570 | DEFUN (no_isis_circuit_type, |
| 1571 | no_isis_circuit_type_cmd, |
| 1572 | "no isis circuit-type (level-1|level-1-2|level-2-only)", |
| 1573 | NO_STR |
| 1574 | "IS-IS commands\n" |
| 1575 | "Configure circuit type for interface\n" |
| 1576 | "Level-1 only adjacencies are formed\n" |
| 1577 | "Level-1-2 adjacencies are formed\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1578 | "Level-2 only adjacencies are formed\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1579 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1580 | int circuit_type; |
| 1581 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1582 | if (!circuit) |
| 1583 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1584 | |
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 | * Set the circuits level to its default value |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1587 | */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1588 | if (circuit->state == C_STATE_UP) |
| 1589 | circuit_type = circuit->area->is_type; |
| 1590 | else |
| 1591 | circuit_type = IS_LEVEL_1_AND_2; |
| 1592 | isis_event_circuit_type_change (circuit, circuit_type); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1593 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1594 | return CMD_SUCCESS; |
| 1595 | } |
| 1596 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1597 | DEFUN (isis_passwd_md5, |
| 1598 | isis_passwd_md5_cmd, |
| 1599 | "isis password md5 WORD", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1600 | "IS-IS commands\n" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1601 | "Configure the authentication password for a circuit\n" |
| 1602 | "Authentication type\n" |
| 1603 | "Circuit password\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1604 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1605 | int len; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1606 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1607 | if (!circuit) |
| 1608 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1609 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1610 | len = strlen (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1611 | if (len > 254) |
| 1612 | { |
| 1613 | vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1614 | return CMD_ERR_AMBIGUOUS; |
| 1615 | } |
| 1616 | circuit->passwd.len = len; |
| 1617 | circuit->passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5; |
| 1618 | strncpy ((char *)circuit->passwd.passwd, argv[0], 255); |
| 1619 | |
| 1620 | return CMD_SUCCESS; |
| 1621 | } |
| 1622 | |
| 1623 | DEFUN (isis_passwd_clear, |
| 1624 | isis_passwd_clear_cmd, |
| 1625 | "isis password clear WORD", |
| 1626 | "IS-IS commands\n" |
| 1627 | "Configure the authentication password for a circuit\n" |
| 1628 | "Authentication type\n" |
| 1629 | "Circuit password\n") |
| 1630 | { |
| 1631 | int len; |
| 1632 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1633 | if (!circuit) |
| 1634 | return CMD_ERR_NO_MATCH; |
| 1635 | |
| 1636 | len = strlen (argv[0]); |
| 1637 | if (len > 254) |
| 1638 | { |
| 1639 | vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE); |
| 1640 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1641 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1642 | circuit->passwd.len = len; |
| 1643 | circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT; |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 1644 | strncpy ((char *)circuit->passwd.passwd, argv[0], 255); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1645 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1646 | return CMD_SUCCESS; |
| 1647 | } |
| 1648 | |
| 1649 | DEFUN (no_isis_passwd, |
| 1650 | no_isis_passwd_cmd, |
| 1651 | "no isis password", |
| 1652 | NO_STR |
| 1653 | "IS-IS commands\n" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1654 | "Configure the authentication password for a circuit\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1655 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1656 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1657 | if (!circuit) |
| 1658 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1659 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1660 | memset (&circuit->passwd, 0, sizeof (struct isis_passwd)); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1661 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1662 | return CMD_SUCCESS; |
| 1663 | } |
| 1664 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1665 | DEFUN (isis_priority, |
| 1666 | isis_priority_cmd, |
| 1667 | "isis priority <0-127>", |
| 1668 | "IS-IS commands\n" |
| 1669 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1670 | "Priority value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1671 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1672 | int prio; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1673 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1674 | if (!circuit) |
| 1675 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1676 | |
| 1677 | prio = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1678 | if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) |
| 1679 | { |
| 1680 | vty_out (vty, "Invalid priority %d - should be <0-127>%s", |
| 1681 | prio, VTY_NEWLINE); |
| 1682 | return CMD_ERR_AMBIGUOUS; |
| 1683 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1684 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1685 | circuit->priority[0] = prio; |
| 1686 | circuit->priority[1] = prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1687 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1688 | return CMD_SUCCESS; |
| 1689 | } |
| 1690 | |
| 1691 | DEFUN (no_isis_priority, |
| 1692 | no_isis_priority_cmd, |
| 1693 | "no isis priority", |
| 1694 | NO_STR |
| 1695 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1696 | "Set priority for Designated Router election\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1697 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1698 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1699 | if (!circuit) |
| 1700 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1701 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1702 | circuit->priority[0] = DEFAULT_PRIORITY; |
| 1703 | circuit->priority[1] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1704 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1705 | return CMD_SUCCESS; |
| 1706 | } |
| 1707 | |
| 1708 | ALIAS (no_isis_priority, |
| 1709 | no_isis_priority_arg_cmd, |
| 1710 | "no isis priority <0-127>", |
| 1711 | NO_STR |
| 1712 | "IS-IS commands\n" |
| 1713 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1714 | "Priority value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1715 | |
| 1716 | DEFUN (isis_priority_l1, |
| 1717 | isis_priority_l1_cmd, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1718 | "isis priority <0-127> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1719 | "IS-IS commands\n" |
| 1720 | "Set priority for Designated Router election\n" |
| 1721 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1722 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1723 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1724 | int prio; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1725 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1726 | if (!circuit) |
| 1727 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1728 | |
| 1729 | prio = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1730 | if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) |
| 1731 | { |
| 1732 | vty_out (vty, "Invalid priority %d - should be <0-127>%s", |
| 1733 | prio, VTY_NEWLINE); |
| 1734 | return CMD_ERR_AMBIGUOUS; |
| 1735 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1736 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1737 | circuit->priority[0] = prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1738 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1739 | return CMD_SUCCESS; |
| 1740 | } |
| 1741 | |
| 1742 | DEFUN (no_isis_priority_l1, |
| 1743 | no_isis_priority_l1_cmd, |
| 1744 | "no isis priority level-1", |
| 1745 | NO_STR |
| 1746 | "IS-IS commands\n" |
| 1747 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1748 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1749 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1750 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1751 | if (!circuit) |
| 1752 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1753 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1754 | circuit->priority[0] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1755 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1756 | return CMD_SUCCESS; |
| 1757 | } |
| 1758 | |
| 1759 | ALIAS (no_isis_priority_l1, |
| 1760 | no_isis_priority_l1_arg_cmd, |
| 1761 | "no isis priority <0-127> level-1", |
| 1762 | NO_STR |
| 1763 | "IS-IS commands\n" |
| 1764 | "Set priority for Designated Router election\n" |
| 1765 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1766 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1767 | |
| 1768 | DEFUN (isis_priority_l2, |
| 1769 | isis_priority_l2_cmd, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1770 | "isis priority <0-127> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1771 | "IS-IS commands\n" |
| 1772 | "Set priority for Designated Router election\n" |
| 1773 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1774 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1775 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1776 | int prio; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1777 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1778 | if (!circuit) |
| 1779 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1780 | |
| 1781 | prio = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1782 | if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) |
| 1783 | { |
| 1784 | vty_out (vty, "Invalid priority %d - should be <0-127>%s", |
| 1785 | prio, VTY_NEWLINE); |
| 1786 | return CMD_ERR_AMBIGUOUS; |
| 1787 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1788 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1789 | circuit->priority[1] = prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1790 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1791 | return CMD_SUCCESS; |
| 1792 | } |
| 1793 | |
| 1794 | DEFUN (no_isis_priority_l2, |
| 1795 | no_isis_priority_l2_cmd, |
| 1796 | "no isis priority level-2", |
| 1797 | NO_STR |
| 1798 | "IS-IS commands\n" |
| 1799 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1800 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1801 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1802 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1803 | if (!circuit) |
| 1804 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1805 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1806 | circuit->priority[1] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1807 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1808 | return CMD_SUCCESS; |
| 1809 | } |
| 1810 | |
| 1811 | ALIAS (no_isis_priority_l2, |
| 1812 | no_isis_priority_l2_arg_cmd, |
| 1813 | "no isis priority <0-127> level-2", |
| 1814 | NO_STR |
| 1815 | "IS-IS commands\n" |
| 1816 | "Set priority for Designated Router election\n" |
| 1817 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1818 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1819 | |
| 1820 | /* Metric command */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1821 | DEFUN (isis_metric, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1822 | isis_metric_cmd, |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 1823 | "isis metric <0-16777215>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1824 | "IS-IS commands\n" |
| 1825 | "Set default metric for circuit\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1826 | "Default metric value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1827 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1828 | int met; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1829 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1830 | if (!circuit) |
| 1831 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1832 | |
| 1833 | met = atoi (argv[0]); |
| 1834 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1835 | /* RFC3787 section 5.1 */ |
| 1836 | if (circuit->area && circuit->area->oldmetric == 1 && |
| 1837 | met > MAX_NARROW_LINK_METRIC) |
| 1838 | { |
| 1839 | vty_out (vty, "Invalid metric %d - should be <0-63> " |
| 1840 | "when narrow metric type enabled%s", |
| 1841 | met, VTY_NEWLINE); |
| 1842 | return CMD_ERR_AMBIGUOUS; |
| 1843 | } |
| 1844 | |
| 1845 | /* RFC4444 */ |
| 1846 | if (circuit->area && circuit->area->newmetric == 1 && |
| 1847 | met > MAX_WIDE_LINK_METRIC) |
| 1848 | { |
| 1849 | vty_out (vty, "Invalid metric %d - should be <0-16777215> " |
| 1850 | "when wide metric type enabled%s", |
| 1851 | met, VTY_NEWLINE); |
| 1852 | return CMD_ERR_AMBIGUOUS; |
| 1853 | } |
| 1854 | |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 1855 | circuit->te_metric[0] = met; |
| 1856 | circuit->te_metric[1] = met; |
| 1857 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1858 | circuit->metrics[0].metric_default = met; |
| 1859 | circuit->metrics[1].metric_default = met; |
| 1860 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1861 | if (circuit->area) |
| 1862 | lsp_regenerate_schedule (circuit->area, circuit->is_type, 0); |
| 1863 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1864 | return CMD_SUCCESS; |
| 1865 | } |
| 1866 | |
| 1867 | DEFUN (no_isis_metric, |
| 1868 | no_isis_metric_cmd, |
| 1869 | "no isis metric", |
| 1870 | NO_STR |
| 1871 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1872 | "Set default metric for circuit\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1873 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1874 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1875 | if (!circuit) |
| 1876 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1877 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1878 | circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC; |
| 1879 | circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC; |
| 1880 | circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC; |
| 1881 | circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1882 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1883 | if (circuit->area) |
| 1884 | lsp_regenerate_schedule (circuit->area, circuit->is_type, 0); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1885 | |
| 1886 | return CMD_SUCCESS; |
| 1887 | } |
| 1888 | |
| 1889 | ALIAS (no_isis_metric, |
| 1890 | no_isis_metric_arg_cmd, |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 1891 | "no isis metric <0-16777215>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1892 | NO_STR |
| 1893 | "IS-IS commands\n" |
| 1894 | "Set default metric for circuit\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1895 | "Default metric value\n") |
| 1896 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1897 | DEFUN (isis_metric_l1, |
| 1898 | isis_metric_l1_cmd, |
| 1899 | "isis metric <0-16777215> level-1", |
| 1900 | "IS-IS commands\n" |
| 1901 | "Set default metric for circuit\n" |
| 1902 | "Default metric value\n" |
| 1903 | "Specify metric for level-1 routing\n") |
| 1904 | { |
| 1905 | int met; |
| 1906 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1907 | if (!circuit) |
| 1908 | return CMD_ERR_NO_MATCH; |
| 1909 | |
| 1910 | met = atoi (argv[0]); |
| 1911 | |
| 1912 | /* RFC3787 section 5.1 */ |
| 1913 | if (circuit->area && circuit->area->oldmetric == 1 && |
| 1914 | met > MAX_NARROW_LINK_METRIC) |
| 1915 | { |
| 1916 | vty_out (vty, "Invalid metric %d - should be <0-63> " |
| 1917 | "when narrow metric type enabled%s", |
| 1918 | met, VTY_NEWLINE); |
| 1919 | return CMD_ERR_AMBIGUOUS; |
| 1920 | } |
| 1921 | |
| 1922 | /* RFC4444 */ |
| 1923 | if (circuit->area && circuit->area->newmetric == 1 && |
| 1924 | met > MAX_WIDE_LINK_METRIC) |
| 1925 | { |
| 1926 | vty_out (vty, "Invalid metric %d - should be <0-16777215> " |
| 1927 | "when wide metric type enabled%s", |
| 1928 | met, VTY_NEWLINE); |
| 1929 | return CMD_ERR_AMBIGUOUS; |
| 1930 | } |
| 1931 | |
| 1932 | circuit->te_metric[0] = met; |
| 1933 | circuit->metrics[0].metric_default = met; |
| 1934 | |
| 1935 | if (circuit->area) |
| 1936 | lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0); |
| 1937 | |
| 1938 | return CMD_SUCCESS; |
| 1939 | } |
| 1940 | |
| 1941 | DEFUN (no_isis_metric_l1, |
| 1942 | no_isis_metric_l1_cmd, |
| 1943 | "no isis metric level-1", |
| 1944 | NO_STR |
| 1945 | "IS-IS commands\n" |
| 1946 | "Set default metric for circuit\n" |
| 1947 | "Specify metric for level-1 routing\n") |
| 1948 | { |
| 1949 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1950 | if (!circuit) |
| 1951 | return CMD_ERR_NO_MATCH; |
| 1952 | |
| 1953 | circuit->te_metric[0] = DEFAULT_CIRCUIT_METRIC; |
| 1954 | circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRIC; |
| 1955 | |
| 1956 | if (circuit->area) |
| 1957 | lsp_regenerate_schedule (circuit->area, IS_LEVEL_1, 0); |
| 1958 | |
| 1959 | return CMD_SUCCESS; |
| 1960 | } |
| 1961 | |
| 1962 | ALIAS (no_isis_metric_l1, |
| 1963 | no_isis_metric_l1_arg_cmd, |
| 1964 | "no isis metric <0-16777215> level-1", |
| 1965 | NO_STR |
| 1966 | "IS-IS commands\n" |
| 1967 | "Set default metric for circuit\n" |
| 1968 | "Default metric value\n" |
| 1969 | "Specify metric for level-1 routing\n") |
| 1970 | |
| 1971 | DEFUN (isis_metric_l2, |
| 1972 | isis_metric_l2_cmd, |
| 1973 | "isis metric <0-16777215> level-2", |
| 1974 | "IS-IS commands\n" |
| 1975 | "Set default metric for circuit\n" |
| 1976 | "Default metric value\n" |
| 1977 | "Specify metric for level-2 routing\n") |
| 1978 | { |
| 1979 | int met; |
| 1980 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 1981 | if (!circuit) |
| 1982 | return CMD_ERR_NO_MATCH; |
| 1983 | |
| 1984 | met = atoi (argv[0]); |
| 1985 | |
| 1986 | /* RFC3787 section 5.1 */ |
| 1987 | if (circuit->area && circuit->area->oldmetric == 1 && |
| 1988 | met > MAX_NARROW_LINK_METRIC) |
| 1989 | { |
| 1990 | vty_out (vty, "Invalid metric %d - should be <0-63> " |
| 1991 | "when narrow metric type enabled%s", |
| 1992 | met, VTY_NEWLINE); |
| 1993 | return CMD_ERR_AMBIGUOUS; |
| 1994 | } |
| 1995 | |
| 1996 | /* RFC4444 */ |
| 1997 | if (circuit->area && circuit->area->newmetric == 1 && |
| 1998 | met > MAX_WIDE_LINK_METRIC) |
| 1999 | { |
| 2000 | vty_out (vty, "Invalid metric %d - should be <0-16777215> " |
| 2001 | "when wide metric type enabled%s", |
| 2002 | met, VTY_NEWLINE); |
| 2003 | return CMD_ERR_AMBIGUOUS; |
| 2004 | } |
| 2005 | |
| 2006 | circuit->te_metric[1] = met; |
| 2007 | circuit->metrics[1].metric_default = met; |
| 2008 | |
| 2009 | if (circuit->area) |
| 2010 | lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0); |
| 2011 | |
| 2012 | return CMD_SUCCESS; |
| 2013 | } |
| 2014 | |
| 2015 | DEFUN (no_isis_metric_l2, |
| 2016 | no_isis_metric_l2_cmd, |
| 2017 | "no isis metric level-2", |
| 2018 | NO_STR |
| 2019 | "IS-IS commands\n" |
| 2020 | "Set default metric for circuit\n" |
| 2021 | "Specify metric for level-2 routing\n") |
| 2022 | { |
| 2023 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2024 | if (!circuit) |
| 2025 | return CMD_ERR_NO_MATCH; |
| 2026 | |
| 2027 | circuit->te_metric[1] = DEFAULT_CIRCUIT_METRIC; |
| 2028 | circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRIC; |
| 2029 | |
| 2030 | if (circuit->area) |
| 2031 | lsp_regenerate_schedule (circuit->area, IS_LEVEL_2, 0); |
| 2032 | |
| 2033 | return CMD_SUCCESS; |
| 2034 | } |
| 2035 | |
| 2036 | ALIAS (no_isis_metric_l2, |
| 2037 | no_isis_metric_l2_arg_cmd, |
| 2038 | "no isis metric <0-16777215> level-2", |
| 2039 | NO_STR |
| 2040 | "IS-IS commands\n" |
| 2041 | "Set default metric for circuit\n" |
| 2042 | "Default metric value\n" |
| 2043 | "Specify metric for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2044 | /* end of metrics */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2045 | |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 2046 | DEFUN (isis_hello_interval, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2047 | isis_hello_interval_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2048 | "isis hello-interval <1-600>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2049 | "IS-IS commands\n" |
| 2050 | "Set Hello interval\n" |
| 2051 | "Hello interval value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2052 | "Holdtime 1 seconds, interval depends on multiplier\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2053 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2054 | int interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2055 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2056 | if (!circuit) |
| 2057 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2058 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2059 | interval = atoi (argv[0]); |
| 2060 | if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2061 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2062 | vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s", |
| 2063 | interval, VTY_NEWLINE); |
| 2064 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2065 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2066 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2067 | circuit->hello_interval[0] = (u_int16_t) interval; |
| 2068 | circuit->hello_interval[1] = (u_int16_t) interval; |
| 2069 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2070 | return CMD_SUCCESS; |
| 2071 | } |
| 2072 | |
| 2073 | DEFUN (no_isis_hello_interval, |
| 2074 | no_isis_hello_interval_cmd, |
| 2075 | "no isis hello-interval", |
| 2076 | NO_STR |
| 2077 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2078 | "Set Hello interval\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2079 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2080 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2081 | if (!circuit) |
| 2082 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2083 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2084 | circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL; |
| 2085 | circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2086 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2087 | return CMD_SUCCESS; |
| 2088 | } |
| 2089 | |
| 2090 | ALIAS (no_isis_hello_interval, |
| 2091 | no_isis_hello_interval_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2092 | "no isis hello-interval <1-600>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2093 | NO_STR |
| 2094 | "IS-IS commands\n" |
| 2095 | "Set Hello interval\n" |
| 2096 | "Hello interval value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2097 | "Holdtime 1 second, interval depends on multiplier\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2098 | |
| 2099 | DEFUN (isis_hello_interval_l1, |
| 2100 | isis_hello_interval_l1_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2101 | "isis hello-interval <1-600> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2102 | "IS-IS commands\n" |
| 2103 | "Set Hello interval\n" |
| 2104 | "Hello interval value\n" |
| 2105 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2106 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2107 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2108 | long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2109 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2110 | if (!circuit) |
| 2111 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2112 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2113 | interval = atoi (argv[0]); |
| 2114 | if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2115 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2116 | vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", |
| 2117 | interval, VTY_NEWLINE); |
| 2118 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2119 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2120 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2121 | circuit->hello_interval[0] = (u_int16_t) interval; |
| 2122 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2123 | return CMD_SUCCESS; |
| 2124 | } |
| 2125 | |
| 2126 | DEFUN (no_isis_hello_interval_l1, |
| 2127 | no_isis_hello_interval_l1_cmd, |
| 2128 | "no isis hello-interval level-1", |
| 2129 | NO_STR |
| 2130 | "IS-IS commands\n" |
| 2131 | "Set Hello interval\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2132 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2133 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2134 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2135 | if (!circuit) |
| 2136 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2137 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2138 | circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2139 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2140 | return CMD_SUCCESS; |
| 2141 | } |
| 2142 | |
| 2143 | ALIAS (no_isis_hello_interval_l1, |
| 2144 | no_isis_hello_interval_l1_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2145 | "no isis hello-interval <1-600> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2146 | NO_STR |
| 2147 | "IS-IS commands\n" |
| 2148 | "Set Hello interval\n" |
| 2149 | "Hello interval value\n" |
| 2150 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2151 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2152 | |
| 2153 | DEFUN (isis_hello_interval_l2, |
| 2154 | isis_hello_interval_l2_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2155 | "isis hello-interval <1-600> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2156 | "IS-IS commands\n" |
| 2157 | "Set Hello interval\n" |
| 2158 | "Hello interval value\n" |
| 2159 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2160 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2161 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2162 | long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2163 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2164 | if (!circuit) |
| 2165 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2166 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2167 | interval = atoi (argv[0]); |
| 2168 | if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2169 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2170 | vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", |
| 2171 | interval, VTY_NEWLINE); |
| 2172 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2173 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2174 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2175 | circuit->hello_interval[1] = (u_int16_t) interval; |
| 2176 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2177 | return CMD_SUCCESS; |
| 2178 | } |
| 2179 | |
| 2180 | DEFUN (no_isis_hello_interval_l2, |
| 2181 | no_isis_hello_interval_l2_cmd, |
| 2182 | "no isis hello-interval level-2", |
| 2183 | NO_STR |
| 2184 | "IS-IS commands\n" |
| 2185 | "Set Hello interval\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2186 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2187 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2188 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2189 | if (!circuit) |
| 2190 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2191 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2192 | circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2193 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2194 | return CMD_SUCCESS; |
| 2195 | } |
| 2196 | |
| 2197 | ALIAS (no_isis_hello_interval_l2, |
| 2198 | no_isis_hello_interval_l2_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2199 | "no isis hello-interval <1-600> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2200 | NO_STR |
| 2201 | "IS-IS commands\n" |
| 2202 | "Set Hello interval\n" |
| 2203 | "Hello interval value\n" |
| 2204 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2205 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2206 | |
| 2207 | DEFUN (isis_hello_multiplier, |
| 2208 | isis_hello_multiplier_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2209 | "isis hello-multiplier <2-100>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2210 | "IS-IS commands\n" |
| 2211 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2212 | "Hello multiplier value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2213 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2214 | int mult; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2215 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2216 | if (!circuit) |
| 2217 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2218 | |
| 2219 | mult = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2220 | if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) |
| 2221 | { |
| 2222 | vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", |
| 2223 | mult, VTY_NEWLINE); |
| 2224 | return CMD_ERR_AMBIGUOUS; |
| 2225 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2226 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2227 | circuit->hello_multiplier[0] = (u_int16_t) mult; |
| 2228 | circuit->hello_multiplier[1] = (u_int16_t) mult; |
| 2229 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2230 | return CMD_SUCCESS; |
| 2231 | } |
| 2232 | |
| 2233 | DEFUN (no_isis_hello_multiplier, |
| 2234 | no_isis_hello_multiplier_cmd, |
| 2235 | "no isis hello-multiplier", |
| 2236 | NO_STR |
| 2237 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2238 | "Set multiplier for Hello holding time\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2239 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2240 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2241 | if (!circuit) |
| 2242 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2243 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2244 | circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER; |
| 2245 | circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2246 | |
| 2247 | return CMD_SUCCESS; |
| 2248 | } |
| 2249 | |
| 2250 | ALIAS (no_isis_hello_multiplier, |
| 2251 | no_isis_hello_multiplier_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2252 | "no isis hello-multiplier <2-100>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2253 | NO_STR |
| 2254 | "IS-IS commands\n" |
| 2255 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2256 | "Hello multiplier value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2257 | |
| 2258 | DEFUN (isis_hello_multiplier_l1, |
| 2259 | isis_hello_multiplier_l1_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2260 | "isis hello-multiplier <2-100> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2261 | "IS-IS commands\n" |
| 2262 | "Set multiplier for Hello holding time\n" |
| 2263 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2264 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2265 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2266 | int mult; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2267 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2268 | if (!circuit) |
| 2269 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2270 | |
| 2271 | mult = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2272 | if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) |
| 2273 | { |
| 2274 | vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", |
| 2275 | mult, VTY_NEWLINE); |
| 2276 | return CMD_ERR_AMBIGUOUS; |
| 2277 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2278 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2279 | circuit->hello_multiplier[0] = (u_int16_t) mult; |
| 2280 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2281 | return CMD_SUCCESS; |
| 2282 | } |
| 2283 | |
| 2284 | DEFUN (no_isis_hello_multiplier_l1, |
| 2285 | no_isis_hello_multiplier_l1_cmd, |
| 2286 | "no isis hello-multiplier level-1", |
| 2287 | NO_STR |
| 2288 | "IS-IS commands\n" |
| 2289 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2290 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2291 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2292 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2293 | if (!circuit) |
| 2294 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2295 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2296 | circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2297 | |
| 2298 | return CMD_SUCCESS; |
| 2299 | } |
| 2300 | |
| 2301 | ALIAS (no_isis_hello_multiplier_l1, |
| 2302 | no_isis_hello_multiplier_l1_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2303 | "no isis hello-multiplier <2-100> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2304 | NO_STR |
| 2305 | "IS-IS commands\n" |
| 2306 | "Set multiplier for Hello holding time\n" |
| 2307 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2308 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2309 | |
| 2310 | DEFUN (isis_hello_multiplier_l2, |
| 2311 | isis_hello_multiplier_l2_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2312 | "isis hello-multiplier <2-100> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2313 | "IS-IS commands\n" |
| 2314 | "Set multiplier for Hello holding time\n" |
| 2315 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2316 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2317 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2318 | int mult; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2319 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2320 | if (!circuit) |
| 2321 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2322 | |
| 2323 | mult = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2324 | if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) |
| 2325 | { |
| 2326 | vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", |
| 2327 | mult, VTY_NEWLINE); |
| 2328 | return CMD_ERR_AMBIGUOUS; |
| 2329 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2330 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2331 | circuit->hello_multiplier[1] = (u_int16_t) mult; |
| 2332 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2333 | return CMD_SUCCESS; |
| 2334 | } |
| 2335 | |
| 2336 | DEFUN (no_isis_hello_multiplier_l2, |
| 2337 | no_isis_hello_multiplier_l2_cmd, |
| 2338 | "no isis hello-multiplier level-2", |
| 2339 | NO_STR |
| 2340 | "IS-IS commands\n" |
| 2341 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2342 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2343 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2344 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2345 | if (!circuit) |
| 2346 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2347 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2348 | circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2349 | |
| 2350 | return CMD_SUCCESS; |
| 2351 | } |
| 2352 | |
| 2353 | ALIAS (no_isis_hello_multiplier_l2, |
| 2354 | no_isis_hello_multiplier_l2_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2355 | "no isis hello-multiplier <2-100> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2356 | NO_STR |
| 2357 | "IS-IS commands\n" |
| 2358 | "Set multiplier for Hello holding time\n" |
| 2359 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2360 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2361 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2362 | DEFUN (isis_hello_padding, |
| 2363 | isis_hello_padding_cmd, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2364 | "isis hello padding", |
| 2365 | "IS-IS commands\n" |
| 2366 | "Add padding to IS-IS hello packets\n" |
| 2367 | "Pad hello packets\n" |
| 2368 | "<cr>\n") |
| 2369 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2370 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2371 | if (!circuit) |
| 2372 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2373 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2374 | circuit->pad_hellos = 1; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2375 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2376 | return CMD_SUCCESS; |
| 2377 | } |
| 2378 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2379 | DEFUN (no_isis_hello_padding, |
| 2380 | no_isis_hello_padding_cmd, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2381 | "no isis hello padding", |
| 2382 | NO_STR |
| 2383 | "IS-IS commands\n" |
| 2384 | "Add padding to IS-IS hello packets\n" |
| 2385 | "Pad hello packets\n" |
| 2386 | "<cr>\n") |
| 2387 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2388 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2389 | if (!circuit) |
| 2390 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2391 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2392 | circuit->pad_hellos = 0; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2393 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2394 | return CMD_SUCCESS; |
| 2395 | } |
| 2396 | |
| 2397 | DEFUN (csnp_interval, |
| 2398 | csnp_interval_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2399 | "isis csnp-interval <1-600>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2400 | "IS-IS commands\n" |
| 2401 | "Set CSNP interval in seconds\n" |
| 2402 | "CSNP interval value\n") |
| 2403 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2404 | unsigned long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2405 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2406 | if (!circuit) |
| 2407 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2408 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2409 | interval = atol (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2410 | if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) |
| 2411 | { |
| 2412 | vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", |
| 2413 | interval, VTY_NEWLINE); |
| 2414 | return CMD_ERR_AMBIGUOUS; |
| 2415 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2416 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2417 | circuit->csnp_interval[0] = (u_int16_t) interval; |
| 2418 | circuit->csnp_interval[1] = (u_int16_t) interval; |
| 2419 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2420 | return CMD_SUCCESS; |
| 2421 | } |
| 2422 | |
| 2423 | DEFUN (no_csnp_interval, |
| 2424 | no_csnp_interval_cmd, |
| 2425 | "no isis csnp-interval", |
| 2426 | NO_STR |
| 2427 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2428 | "Set CSNP interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2429 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2430 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2431 | if (!circuit) |
| 2432 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2433 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2434 | circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL; |
| 2435 | circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2436 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2437 | return CMD_SUCCESS; |
| 2438 | } |
| 2439 | |
| 2440 | ALIAS (no_csnp_interval, |
| 2441 | no_csnp_interval_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2442 | "no isis csnp-interval <1-600>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2443 | NO_STR |
| 2444 | "IS-IS commands\n" |
| 2445 | "Set CSNP interval in seconds\n" |
| 2446 | "CSNP interval value\n") |
| 2447 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2448 | DEFUN (csnp_interval_l1, |
| 2449 | csnp_interval_l1_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2450 | "isis csnp-interval <1-600> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2451 | "IS-IS commands\n" |
| 2452 | "Set CSNP interval in seconds\n" |
| 2453 | "CSNP interval value\n" |
| 2454 | "Specify interval for level-1 CSNPs\n") |
| 2455 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2456 | unsigned long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2457 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2458 | if (!circuit) |
| 2459 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2460 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2461 | interval = atol (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2462 | if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) |
| 2463 | { |
| 2464 | vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", |
| 2465 | interval, VTY_NEWLINE); |
| 2466 | return CMD_ERR_AMBIGUOUS; |
| 2467 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2468 | |
| 2469 | circuit->csnp_interval[0] = (u_int16_t) interval; |
| 2470 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2471 | return CMD_SUCCESS; |
| 2472 | } |
| 2473 | |
| 2474 | DEFUN (no_csnp_interval_l1, |
| 2475 | no_csnp_interval_l1_cmd, |
| 2476 | "no isis csnp-interval level-1", |
| 2477 | NO_STR |
| 2478 | "IS-IS commands\n" |
| 2479 | "Set CSNP interval in seconds\n" |
| 2480 | "Specify interval for level-1 CSNPs\n") |
| 2481 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2482 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2483 | if (!circuit) |
| 2484 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2485 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2486 | circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2487 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2488 | return CMD_SUCCESS; |
| 2489 | } |
| 2490 | |
| 2491 | ALIAS (no_csnp_interval_l1, |
| 2492 | no_csnp_interval_l1_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2493 | "no isis csnp-interval <1-600> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2494 | NO_STR |
| 2495 | "IS-IS commands\n" |
| 2496 | "Set CSNP interval in seconds\n" |
| 2497 | "CSNP interval value\n" |
| 2498 | "Specify interval for level-1 CSNPs\n") |
| 2499 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2500 | DEFUN (csnp_interval_l2, |
| 2501 | csnp_interval_l2_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2502 | "isis csnp-interval <1-600> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2503 | "IS-IS commands\n" |
| 2504 | "Set CSNP interval in seconds\n" |
| 2505 | "CSNP interval value\n" |
| 2506 | "Specify interval for level-2 CSNPs\n") |
| 2507 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2508 | unsigned long interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2509 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2510 | if (!circuit) |
| 2511 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2512 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2513 | interval = atol (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2514 | if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) |
| 2515 | { |
| 2516 | vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", |
| 2517 | interval, VTY_NEWLINE); |
| 2518 | return CMD_ERR_AMBIGUOUS; |
| 2519 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2520 | |
| 2521 | circuit->csnp_interval[1] = (u_int16_t) interval; |
| 2522 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2523 | return CMD_SUCCESS; |
| 2524 | } |
| 2525 | |
| 2526 | DEFUN (no_csnp_interval_l2, |
| 2527 | no_csnp_interval_l2_cmd, |
| 2528 | "no isis csnp-interval level-2", |
| 2529 | NO_STR |
| 2530 | "IS-IS commands\n" |
| 2531 | "Set CSNP interval in seconds\n" |
| 2532 | "Specify interval for level-2 CSNPs\n") |
| 2533 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2534 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2535 | if (!circuit) |
| 2536 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2537 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2538 | circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2539 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2540 | return CMD_SUCCESS; |
| 2541 | } |
| 2542 | |
| 2543 | ALIAS (no_csnp_interval_l2, |
| 2544 | no_csnp_interval_l2_arg_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2545 | "no isis csnp-interval <1-600> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2546 | NO_STR |
| 2547 | "IS-IS commands\n" |
| 2548 | "Set CSNP interval in seconds\n" |
| 2549 | "CSNP interval value\n" |
| 2550 | "Specify interval for level-2 CSNPs\n") |
| 2551 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2552 | DEFUN (psnp_interval, |
| 2553 | psnp_interval_cmd, |
| 2554 | "isis psnp-interval <1-120>", |
| 2555 | "IS-IS commands\n" |
| 2556 | "Set PSNP interval in seconds\n" |
| 2557 | "PSNP interval value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2558 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2559 | unsigned long interval; |
| 2560 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2561 | if (!circuit) |
| 2562 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2563 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2564 | interval = atol (argv[0]); |
| 2565 | if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2566 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2567 | vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", |
| 2568 | interval, VTY_NEWLINE); |
| 2569 | return CMD_ERR_AMBIGUOUS; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2570 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2571 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2572 | circuit->psnp_interval[0] = (u_int16_t) interval; |
| 2573 | circuit->psnp_interval[1] = (u_int16_t) interval; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2574 | |
| 2575 | return CMD_SUCCESS; |
| 2576 | } |
| 2577 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2578 | DEFUN (no_psnp_interval, |
| 2579 | no_psnp_interval_cmd, |
| 2580 | "no isis psnp-interval", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2581 | NO_STR |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2582 | "IS-IS commands\n" |
| 2583 | "Set PSNP interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2584 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2585 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2586 | if (!circuit) |
| 2587 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2588 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2589 | circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL; |
| 2590 | circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2591 | |
| 2592 | return CMD_SUCCESS; |
| 2593 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2594 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2595 | ALIAS (no_psnp_interval, |
| 2596 | no_psnp_interval_arg_cmd, |
| 2597 | "no isis psnp-interval <1-120>", |
| 2598 | NO_STR |
| 2599 | "IS-IS commands\n" |
| 2600 | "Set PSNP interval in seconds\n" |
| 2601 | "PSNP interval value\n") |
| 2602 | |
| 2603 | DEFUN (psnp_interval_l1, |
| 2604 | psnp_interval_l1_cmd, |
| 2605 | "isis psnp-interval <1-120> level-1", |
| 2606 | "IS-IS commands\n" |
| 2607 | "Set PSNP interval in seconds\n" |
| 2608 | "PSNP interval value\n" |
| 2609 | "Specify interval for level-1 PSNPs\n") |
| 2610 | { |
| 2611 | unsigned long interval; |
| 2612 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2613 | if (!circuit) |
| 2614 | return CMD_ERR_NO_MATCH; |
| 2615 | |
| 2616 | interval = atol (argv[0]); |
| 2617 | if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) |
| 2618 | { |
| 2619 | vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", |
| 2620 | interval, VTY_NEWLINE); |
| 2621 | return CMD_ERR_AMBIGUOUS; |
| 2622 | } |
| 2623 | |
| 2624 | circuit->psnp_interval[0] = (u_int16_t) interval; |
| 2625 | |
| 2626 | return CMD_SUCCESS; |
| 2627 | } |
| 2628 | |
| 2629 | DEFUN (no_psnp_interval_l1, |
| 2630 | no_psnp_interval_l1_cmd, |
| 2631 | "no isis psnp-interval level-1", |
| 2632 | NO_STR |
| 2633 | "IS-IS commands\n" |
| 2634 | "Set PSNP interval in seconds\n" |
| 2635 | "Specify interval for level-1 PSNPs\n") |
| 2636 | { |
| 2637 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2638 | if (!circuit) |
| 2639 | return CMD_ERR_NO_MATCH; |
| 2640 | |
| 2641 | circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL; |
| 2642 | |
| 2643 | return CMD_SUCCESS; |
| 2644 | } |
| 2645 | |
| 2646 | ALIAS (no_psnp_interval_l1, |
| 2647 | no_psnp_interval_l1_arg_cmd, |
| 2648 | "no isis psnp-interval <1-120> level-1", |
| 2649 | NO_STR |
| 2650 | "IS-IS commands\n" |
| 2651 | "Set PSNP interval in seconds\n" |
| 2652 | "PSNP interval value\n" |
| 2653 | "Specify interval for level-1 PSNPs\n") |
| 2654 | |
| 2655 | DEFUN (psnp_interval_l2, |
| 2656 | psnp_interval_l2_cmd, |
| 2657 | "isis psnp-interval <1-120> level-2", |
| 2658 | "IS-IS commands\n" |
| 2659 | "Set PSNP interval in seconds\n" |
| 2660 | "PSNP interval value\n" |
| 2661 | "Specify interval for level-2 PSNPs\n") |
| 2662 | { |
| 2663 | unsigned long interval; |
| 2664 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2665 | if (!circuit) |
| 2666 | return CMD_ERR_NO_MATCH; |
| 2667 | |
| 2668 | interval = atol (argv[0]); |
| 2669 | if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) |
| 2670 | { |
| 2671 | vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", |
| 2672 | interval, VTY_NEWLINE); |
| 2673 | return CMD_ERR_AMBIGUOUS; |
| 2674 | } |
| 2675 | |
| 2676 | circuit->psnp_interval[1] = (u_int16_t) interval; |
| 2677 | |
| 2678 | return CMD_SUCCESS; |
| 2679 | } |
| 2680 | |
| 2681 | DEFUN (no_psnp_interval_l2, |
| 2682 | no_psnp_interval_l2_cmd, |
| 2683 | "no isis psnp-interval level-2", |
| 2684 | NO_STR |
| 2685 | "IS-IS commands\n" |
| 2686 | "Set PSNP interval in seconds\n" |
| 2687 | "Specify interval for level-2 PSNPs\n") |
| 2688 | { |
| 2689 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2690 | if (!circuit) |
| 2691 | return CMD_ERR_NO_MATCH; |
| 2692 | |
| 2693 | circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL; |
| 2694 | |
| 2695 | return CMD_SUCCESS; |
| 2696 | } |
| 2697 | |
| 2698 | ALIAS (no_psnp_interval_l2, |
| 2699 | no_psnp_interval_l2_arg_cmd, |
| 2700 | "no isis psnp-interval <1-120> level-2", |
| 2701 | NO_STR |
| 2702 | "IS-IS commands\n" |
| 2703 | "Set PSNP interval in seconds\n" |
| 2704 | "PSNP interval value\n" |
| 2705 | "Specify interval for level-2 PSNPs\n") |
| 2706 | |
| 2707 | struct cmd_node interface_node = { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2708 | INTERFACE_NODE, |
| 2709 | "%s(config-if)# ", |
| 2710 | 1, |
| 2711 | }; |
| 2712 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2713 | DEFUN (isis_network, |
| 2714 | isis_network_cmd, |
| 2715 | "isis network point-to-point", |
| 2716 | "IS-IS commands\n" |
| 2717 | "Set network type\n" |
| 2718 | "point-to-point network type\n") |
| 2719 | { |
| 2720 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2721 | if (!circuit) |
| 2722 | return CMD_ERR_NO_MATCH; |
| 2723 | |
| 2724 | /* RFC5309 section 4 */ |
| 2725 | if (circuit->circ_type == CIRCUIT_T_P2P) |
| 2726 | return CMD_SUCCESS; |
| 2727 | |
| 2728 | if (circuit->state != C_STATE_UP) |
| 2729 | { |
| 2730 | circuit->circ_type = CIRCUIT_T_P2P; |
| 2731 | circuit->circ_type_config = CIRCUIT_T_P2P; |
| 2732 | } |
| 2733 | else |
| 2734 | { |
| 2735 | struct isis_area *area = circuit->area; |
| 2736 | if (!if_is_broadcast (circuit->interface)) |
| 2737 | { |
| 2738 | vty_out (vty, "isis network point-to-point " |
| 2739 | "is valid only on broadcast interfaces%s", |
| 2740 | VTY_NEWLINE); |
| 2741 | return CMD_ERR_AMBIGUOUS; |
| 2742 | } |
| 2743 | |
| 2744 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 2745 | circuit->circ_type = CIRCUIT_T_P2P; |
| 2746 | circuit->circ_type_config = CIRCUIT_T_P2P; |
| 2747 | isis_csm_state_change (ISIS_ENABLE, circuit, area); |
| 2748 | } |
| 2749 | |
| 2750 | return CMD_SUCCESS; |
| 2751 | } |
| 2752 | |
| 2753 | DEFUN (no_isis_network, |
| 2754 | no_isis_network_cmd, |
| 2755 | "no isis network point-to-point", |
| 2756 | NO_STR |
| 2757 | "IS-IS commands\n" |
| 2758 | "Set network type for circuit\n" |
| 2759 | "point-to-point network type\n") |
| 2760 | { |
| 2761 | struct isis_circuit *circuit = isis_circuit_lookup (vty); |
| 2762 | if (!circuit) |
| 2763 | return CMD_ERR_NO_MATCH; |
| 2764 | |
| 2765 | /* RFC5309 section 4 */ |
| 2766 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 2767 | return CMD_SUCCESS; |
| 2768 | |
| 2769 | if (circuit->state != C_STATE_UP) |
| 2770 | { |
| 2771 | circuit->circ_type = CIRCUIT_T_BROADCAST; |
| 2772 | circuit->circ_type_config = CIRCUIT_T_BROADCAST; |
| 2773 | } |
| 2774 | else |
| 2775 | { |
| 2776 | struct isis_area *area = circuit->area; |
| 2777 | if (circuit->interface && |
| 2778 | !if_is_broadcast (circuit->interface)) |
| 2779 | { |
| 2780 | vty_out (vty, "no isis network point-to-point " |
| 2781 | "is valid only on broadcast interfaces%s", |
| 2782 | VTY_NEWLINE); |
| 2783 | return CMD_ERR_AMBIGUOUS; |
| 2784 | } |
| 2785 | |
| 2786 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 2787 | circuit->circ_type = CIRCUIT_T_BROADCAST; |
| 2788 | circuit->circ_type_config = CIRCUIT_T_BROADCAST; |
| 2789 | isis_csm_state_change (ISIS_ENABLE, circuit, area); |
| 2790 | } |
| 2791 | |
| 2792 | return CMD_SUCCESS; |
| 2793 | } |
| 2794 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2795 | int |
| 2796 | isis_if_new_hook (struct interface *ifp) |
| 2797 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2798 | return 0; |
| 2799 | } |
| 2800 | |
| 2801 | int |
| 2802 | isis_if_delete_hook (struct interface *ifp) |
| 2803 | { |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2804 | struct isis_circuit *circuit; |
| 2805 | /* Clean up the circuit data */ |
| 2806 | if (ifp && ifp->info) |
| 2807 | { |
| 2808 | circuit = ifp->info; |
| 2809 | isis_csm_state_change (IF_DOWN_FROM_Z, circuit, circuit->area); |
| 2810 | isis_csm_state_change (ISIS_DISABLE, circuit, circuit->area); |
| 2811 | } |
| 2812 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2813 | return 0; |
| 2814 | } |
| 2815 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2816 | void |
| 2817 | isis_circuit_init () |
| 2818 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2819 | /* Initialize Zebra interface data structure */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2820 | if_add_hook (IF_NEW_HOOK, isis_if_new_hook); |
| 2821 | if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook); |
| 2822 | |
| 2823 | /* Install interface node */ |
| 2824 | install_node (&interface_node, isis_interface_config_write); |
| 2825 | install_element (CONFIG_NODE, &interface_cmd); |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2826 | install_element (CONFIG_NODE, &no_interface_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2827 | |
| 2828 | install_default (INTERFACE_NODE); |
| 2829 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 2830 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 2831 | |
| 2832 | install_element (INTERFACE_NODE, &ip_router_isis_cmd); |
| 2833 | install_element (INTERFACE_NODE, &no_ip_router_isis_cmd); |
| 2834 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2835 | install_element (INTERFACE_NODE, &isis_passive_cmd); |
| 2836 | install_element (INTERFACE_NODE, &no_isis_passive_cmd); |
| 2837 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2838 | install_element (INTERFACE_NODE, &isis_circuit_type_cmd); |
| 2839 | install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd); |
| 2840 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2841 | install_element (INTERFACE_NODE, &isis_passwd_clear_cmd); |
| 2842 | install_element (INTERFACE_NODE, &isis_passwd_md5_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2843 | install_element (INTERFACE_NODE, &no_isis_passwd_cmd); |
| 2844 | |
| 2845 | install_element (INTERFACE_NODE, &isis_priority_cmd); |
| 2846 | install_element (INTERFACE_NODE, &no_isis_priority_cmd); |
| 2847 | install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd); |
| 2848 | install_element (INTERFACE_NODE, &isis_priority_l1_cmd); |
| 2849 | install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd); |
| 2850 | install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd); |
| 2851 | install_element (INTERFACE_NODE, &isis_priority_l2_cmd); |
| 2852 | install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd); |
| 2853 | install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd); |
| 2854 | |
| 2855 | install_element (INTERFACE_NODE, &isis_metric_cmd); |
| 2856 | install_element (INTERFACE_NODE, &no_isis_metric_cmd); |
| 2857 | install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2858 | install_element (INTERFACE_NODE, &isis_metric_l1_cmd); |
| 2859 | install_element (INTERFACE_NODE, &no_isis_metric_l1_cmd); |
| 2860 | install_element (INTERFACE_NODE, &no_isis_metric_l1_arg_cmd); |
| 2861 | install_element (INTERFACE_NODE, &isis_metric_l2_cmd); |
| 2862 | install_element (INTERFACE_NODE, &no_isis_metric_l2_cmd); |
| 2863 | install_element (INTERFACE_NODE, &no_isis_metric_l2_arg_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2864 | |
| 2865 | install_element (INTERFACE_NODE, &isis_hello_interval_cmd); |
| 2866 | install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd); |
| 2867 | install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd); |
| 2868 | install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd); |
| 2869 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd); |
| 2870 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd); |
| 2871 | install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd); |
| 2872 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd); |
| 2873 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd); |
| 2874 | |
| 2875 | install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd); |
| 2876 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd); |
| 2877 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd); |
| 2878 | install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd); |
| 2879 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd); |
| 2880 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd); |
| 2881 | install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd); |
| 2882 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd); |
| 2883 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd); |
| 2884 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2885 | install_element (INTERFACE_NODE, &isis_hello_padding_cmd); |
| 2886 | install_element (INTERFACE_NODE, &no_isis_hello_padding_cmd); |
| 2887 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2888 | install_element (INTERFACE_NODE, &csnp_interval_cmd); |
| 2889 | install_element (INTERFACE_NODE, &no_csnp_interval_cmd); |
| 2890 | install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd); |
| 2891 | install_element (INTERFACE_NODE, &csnp_interval_l1_cmd); |
| 2892 | install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd); |
| 2893 | install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd); |
| 2894 | install_element (INTERFACE_NODE, &csnp_interval_l2_cmd); |
| 2895 | install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd); |
| 2896 | install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd); |
| 2897 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2898 | install_element (INTERFACE_NODE, &psnp_interval_cmd); |
| 2899 | install_element (INTERFACE_NODE, &no_psnp_interval_cmd); |
| 2900 | install_element (INTERFACE_NODE, &no_psnp_interval_arg_cmd); |
| 2901 | install_element (INTERFACE_NODE, &psnp_interval_l1_cmd); |
| 2902 | install_element (INTERFACE_NODE, &no_psnp_interval_l1_cmd); |
| 2903 | install_element (INTERFACE_NODE, &no_psnp_interval_l1_arg_cmd); |
| 2904 | install_element (INTERFACE_NODE, &psnp_interval_l2_cmd); |
| 2905 | install_element (INTERFACE_NODE, &no_psnp_interval_l2_cmd); |
| 2906 | install_element (INTERFACE_NODE, &no_psnp_interval_l2_arg_cmd); |
| 2907 | |
| 2908 | install_element (INTERFACE_NODE, &isis_network_cmd); |
| 2909 | install_element (INTERFACE_NODE, &no_isis_network_cmd); |
| 2910 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2911 | #ifdef HAVE_IPV6 |
| 2912 | install_element (INTERFACE_NODE, &ipv6_router_isis_cmd); |
| 2913 | install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2914 | #endif |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2915 | } |