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