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