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