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 | |
| 29 | #include "log.h" |
| 30 | #include "memory.h" |
| 31 | #include "if.h" |
| 32 | #include "linklist.h" |
| 33 | #include "command.h" |
| 34 | #include "thread.h" |
| 35 | #include "hash.h" |
| 36 | #include "prefix.h" |
| 37 | #include "stream.h" |
| 38 | |
| 39 | #include "isisd/dict.h" |
| 40 | #include "isisd/include-netbsd/iso.h" |
| 41 | #include "isisd/isis_constants.h" |
| 42 | #include "isisd/isis_common.h" |
| 43 | #include "isisd/isis_circuit.h" |
| 44 | #include "isisd/isis_tlv.h" |
| 45 | #include "isisd/isis_lsp.h" |
| 46 | #include "isisd/isis_pdu.h" |
| 47 | #include "isisd/isis_network.h" |
| 48 | #include "isisd/isis_misc.h" |
| 49 | #include "isisd/isis_constants.h" |
| 50 | #include "isisd/isis_adjacency.h" |
| 51 | #include "isisd/isis_dr.h" |
| 52 | #include "isisd/isis_flags.h" |
| 53 | #include "isisd/isisd.h" |
| 54 | #include "isisd/isis_csm.h" |
| 55 | #include "isisd/isis_events.h" |
| 56 | |
| 57 | extern struct thread_master *master; |
| 58 | extern struct isis *isis; |
| 59 | |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 60 | /* |
| 61 | * Prototypes. |
| 62 | */ |
| 63 | void isis_circuit_down(struct isis_circuit *); |
| 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)); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 75 | if (circuit) |
| 76 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 77 | /* set default metrics for circuit */ |
| 78 | for (i = 0; i < 2; i++) |
| 79 | { |
| 80 | circuit->metrics[i].metric_default = DEFAULT_CIRCUIT_METRICS; |
| 81 | circuit->metrics[i].metric_expense = METRICS_UNSUPPORTED; |
| 82 | circuit->metrics[i].metric_error = METRICS_UNSUPPORTED; |
| 83 | circuit->metrics[i].metric_delay = METRICS_UNSUPPORTED; |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 84 | circuit->te_metric[i] = DEFAULT_CIRCUIT_METRICS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 85 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 86 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 87 | else |
| 88 | { |
| 89 | zlog_err ("Can't malloc isis circuit"); |
| 90 | return NULL; |
| 91 | } |
| 92 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 93 | return circuit; |
| 94 | } |
| 95 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 96 | void |
| 97 | isis_circuit_configure (struct isis_circuit *circuit, struct isis_area *area) |
| 98 | { |
| 99 | int i; |
| 100 | circuit->area = area; |
| 101 | /* |
| 102 | * The level for the circuit is same as for the area, unless configured |
| 103 | * otherwise. |
| 104 | */ |
| 105 | circuit->circuit_is_type = area->is_type; |
| 106 | /* |
| 107 | * Default values |
| 108 | */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 109 | for (i = 0; i < 2; i++) |
| 110 | { |
| 111 | circuit->hello_interval[i] = HELLO_INTERVAL; |
| 112 | circuit->hello_multiplier[i] = HELLO_MULTIPLIER; |
| 113 | circuit->csnp_interval[i] = CSNP_INTERVAL; |
| 114 | circuit->psnp_interval[i] = PSNP_INTERVAL; |
| 115 | circuit->u.bc.priority[i] = DEFAULT_PRIORITY; |
| 116 | } |
| 117 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 118 | { |
| 119 | circuit->u.bc.adjdb[0] = list_new (); |
| 120 | circuit->u.bc.adjdb[1] = list_new (); |
| 121 | circuit->u.bc.pad_hellos = 1; |
| 122 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 123 | circuit->lsp_interval = LSP_INTERVAL; |
| 124 | |
| 125 | /* |
| 126 | * Add the circuit into area |
| 127 | */ |
| 128 | listnode_add (area->circuit_list, circuit); |
| 129 | |
| 130 | circuit->idx = flags_get_index (&area->flags); |
| 131 | circuit->lsp_queue = list_new (); |
| 132 | |
| 133 | return; |
| 134 | } |
| 135 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 136 | void |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 137 | isis_circuit_deconfigure (struct isis_circuit *circuit, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 138 | struct isis_area *area) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 139 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 140 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 141 | /* Remove circuit from area */ |
| 142 | listnode_delete (area->circuit_list, circuit); |
| 143 | /* Free the index of SRM and SSN flags */ |
| 144 | flags_free_index (&area->flags, circuit->idx); |
| 145 | |
| 146 | return; |
| 147 | } |
| 148 | |
| 149 | struct isis_circuit * |
| 150 | circuit_lookup_by_ifp (struct interface *ifp, struct list *list) |
| 151 | { |
| 152 | struct isis_circuit *circuit = NULL; |
| 153 | struct listnode *node; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 154 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 155 | if (!list) |
| 156 | return NULL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 157 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 158 | for (ALL_LIST_ELEMENTS_RO (list, node, circuit)) |
| 159 | if (circuit->interface == ifp) |
| 160 | return circuit; |
| 161 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 162 | return NULL; |
| 163 | } |
| 164 | |
| 165 | struct isis_circuit * |
| 166 | circuit_scan_by_ifp (struct interface *ifp) |
| 167 | { |
| 168 | struct isis_area *area; |
| 169 | struct listnode *node; |
| 170 | struct isis_circuit *circuit; |
| 171 | |
| 172 | if (!isis->area_list) |
| 173 | return NULL; |
| 174 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 175 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 176 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 177 | circuit = circuit_lookup_by_ifp (ifp, area->circuit_list); |
| 178 | if (circuit) |
| 179 | return circuit; |
| 180 | } |
| 181 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 182 | return circuit_lookup_by_ifp (ifp, isis->init_circ_list); |
| 183 | } |
| 184 | |
| 185 | void |
| 186 | isis_circuit_del (struct isis_circuit *circuit) |
| 187 | { |
| 188 | |
| 189 | if (!circuit) |
| 190 | return; |
| 191 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 192 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 193 | { |
| 194 | /* destroy adjacency databases */ |
hasso | 4660687 | 2004-12-29 19:34:22 +0000 | [diff] [blame] | 195 | if (circuit->u.bc.adjdb[0]) |
| 196 | list_delete (circuit->u.bc.adjdb[0]); |
| 197 | if (circuit->u.bc.adjdb[1]) |
| 198 | list_delete (circuit->u.bc.adjdb[1]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 199 | /* destroy neighbour lists */ |
| 200 | if (circuit->u.bc.lan_neighs[0]) |
| 201 | list_delete (circuit->u.bc.lan_neighs[0]); |
| 202 | if (circuit->u.bc.lan_neighs[1]) |
| 203 | list_delete (circuit->u.bc.lan_neighs[1]); |
| 204 | /* destroy addresses */ |
| 205 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 206 | if (circuit->ip_addrs) |
| 207 | list_delete (circuit->ip_addrs); |
| 208 | #ifdef HAVE_IPV6 |
| 209 | if (circuit->ipv6_link) |
| 210 | list_delete (circuit->ipv6_link); |
| 211 | if (circuit->ipv6_non_link) |
| 212 | list_delete (circuit->ipv6_non_link); |
| 213 | #endif /* HAVE_IPV6 */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 214 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 215 | /* and lastly the circuit itself */ |
| 216 | XFREE (MTYPE_ISIS_CIRCUIT, circuit); |
| 217 | |
| 218 | return; |
| 219 | } |
| 220 | |
| 221 | void |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 222 | isis_circuit_add_addr (struct isis_circuit *circuit, |
| 223 | struct connected *connected) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 224 | { |
| 225 | struct prefix_ipv4 *ipv4; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 226 | u_char buf[BUFSIZ]; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 227 | #ifdef HAVE_IPV6 |
| 228 | struct prefix_ipv6 *ipv6; |
| 229 | #endif /* HAVE_IPV6 */ |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 230 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 231 | if (!circuit->ip_addrs) |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 232 | circuit->ip_addrs = list_new (); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 233 | #ifdef HAVE_IPV6 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 234 | if (!circuit->ipv6_link) |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 235 | circuit->ipv6_link = list_new (); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 236 | if (!circuit->ipv6_non_link) |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 237 | circuit->ipv6_non_link = list_new (); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 238 | #endif /* HAVE_IPV6 */ |
| 239 | |
| 240 | memset (&buf, 0, BUFSIZ); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 241 | if (connected->address->family == AF_INET) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 242 | { |
| 243 | ipv4 = prefix_ipv4_new (); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 244 | ipv4->prefixlen = connected->address->prefixlen; |
| 245 | ipv4->prefix = connected->address->u.prefix4; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 246 | listnode_add (circuit->ip_addrs, ipv4); |
hasso | 0dae85e | 2004-09-26 19:53:47 +0000 | [diff] [blame] | 247 | if (circuit->area) |
| 248 | lsp_regenerate_schedule (circuit->area); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 249 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 250 | #ifdef EXTREME_DEBUG |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 251 | prefix2str (connected->address, buf, BUFSIZ); |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 252 | zlog_debug ("Added IP address %s to circuit %d", buf, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 253 | circuit->circuit_id); |
| 254 | #endif /* EXTREME_DEBUG */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 255 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 256 | #ifdef HAVE_IPV6 |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 257 | if (connected->address->family == AF_INET6) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 258 | { |
| 259 | ipv6 = prefix_ipv6_new (); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 260 | ipv6->prefixlen = connected->address->prefixlen; |
| 261 | ipv6->prefix = connected->address->u.prefix6; |
| 262 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 263 | if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix)) |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 264 | listnode_add (circuit->ipv6_link, ipv6); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 265 | else |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 266 | listnode_add (circuit->ipv6_non_link, ipv6); |
hasso | 0dae85e | 2004-09-26 19:53:47 +0000 | [diff] [blame] | 267 | if (circuit->area) |
| 268 | lsp_regenerate_schedule (circuit->area); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 269 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 270 | #ifdef EXTREME_DEBUG |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 271 | prefix2str (connected->address, buf, BUFSIZ); |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 272 | zlog_debug ("Added IPv6 address %s to circuit %d", buf, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 273 | circuit->circuit_id); |
| 274 | #endif /* EXTREME_DEBUG */ |
| 275 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 276 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 277 | return; |
| 278 | } |
| 279 | |
| 280 | void |
| 281 | isis_circuit_del_addr (struct isis_circuit *circuit, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 282 | struct connected *connected) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 283 | { |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 284 | struct prefix_ipv4 *ipv4, *ip = NULL; |
| 285 | struct listnode *node; |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 286 | u_char buf[BUFSIZ]; |
| 287 | #ifdef HAVE_IPV6 |
| 288 | struct prefix_ipv6 *ipv6, *ip6 = NULL; |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 289 | int found = 0; |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 290 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 291 | |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 292 | memset (&buf, 0, BUFSIZ); |
| 293 | if (connected->address->family == AF_INET) |
| 294 | { |
| 295 | ipv4 = prefix_ipv4_new (); |
| 296 | ipv4->prefixlen = connected->address->prefixlen; |
| 297 | ipv4->prefix = connected->address->u.prefix4; |
| 298 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 299 | for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip)) |
| 300 | if (prefix_same ((struct prefix *) ip, (struct prefix *) &ipv4)) |
| 301 | break; |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 302 | |
| 303 | if (ip) |
| 304 | { |
| 305 | listnode_delete (circuit->ip_addrs, ip); |
hasso | 0dae85e | 2004-09-26 19:53:47 +0000 | [diff] [blame] | 306 | if (circuit->area) |
| 307 | lsp_regenerate_schedule (circuit->area); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 308 | } |
| 309 | else |
| 310 | { |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 311 | prefix2str (connected->address, (char *)buf, BUFSIZ); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 312 | zlog_warn("Nonexitant ip address %s removal attempt from circuit \ |
| 313 | %d", buf, circuit->circuit_id); |
| 314 | } |
| 315 | } |
| 316 | #ifdef HAVE_IPV6 |
| 317 | if (connected->address->family == AF_INET6) |
| 318 | { |
| 319 | ipv6 = prefix_ipv6_new (); |
| 320 | ipv6->prefixlen = connected->address->prefixlen; |
| 321 | ipv6->prefix = connected->address->u.prefix6; |
| 322 | |
| 323 | if (IN6_IS_ADDR_LINKLOCAL (&ipv6->prefix)) |
| 324 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 325 | for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_link, node, ip6)) |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 326 | { |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 327 | if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6)) |
| 328 | break; |
| 329 | } |
| 330 | if (ip6) |
| 331 | { |
| 332 | listnode_delete (circuit->ipv6_link, ip6); |
| 333 | found = 1; |
| 334 | } |
| 335 | } |
| 336 | else |
| 337 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 338 | for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, node, ip6)) |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 339 | { |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 340 | if (prefix_same ((struct prefix *) ip6, (struct prefix *) ipv6)) |
| 341 | break; |
| 342 | } |
| 343 | if (ip6) |
| 344 | { |
| 345 | listnode_delete (circuit->ipv6_non_link, ip6); |
| 346 | found = 1; |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | if (!found) |
| 351 | { |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 352 | prefix2str (connected->address, (char *)buf, BUFSIZ); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 353 | zlog_warn("Nonexitant ip address %s removal attempt from \ |
| 354 | circuit %d", buf, circuit->circuit_id); |
| 355 | } |
| 356 | else |
hasso | 0dae85e | 2004-09-26 19:53:47 +0000 | [diff] [blame] | 357 | if (circuit->area) |
| 358 | lsp_regenerate_schedule (circuit->area); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 359 | } |
| 360 | #endif /* HAVE_IPV6 */ |
| 361 | return; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 362 | } |
| 363 | |
| 364 | void |
| 365 | isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp) |
| 366 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 367 | struct listnode *node, *nnode; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 368 | struct connected *conn; |
| 369 | |
| 370 | circuit->interface = ifp; |
| 371 | ifp->info = circuit; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 372 | |
| 373 | circuit->circuit_id = ifp->ifindex % 255; /* FIXME: Why not ? */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 374 | |
| 375 | /* isis_circuit_update_addrs (circuit, ifp); */ |
| 376 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 377 | if (if_is_broadcast (ifp)) |
| 378 | { |
| 379 | circuit->circ_type = CIRCUIT_T_BROADCAST; |
| 380 | /* |
| 381 | * Get the Hardware Address |
| 382 | */ |
Paul Jakma | 6f0e3f6 | 2007-05-10 02:38:51 +0000 | [diff] [blame^] | 383 | #ifdef HAVE_STRUCT_SOCKADDR_DL |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 384 | if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN) |
| 385 | zlog_warn ("unsupported link layer"); |
| 386 | else |
| 387 | memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl), |
| 388 | ETH_ALEN); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 389 | #else |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 390 | if (circuit->interface->hw_addr_len != ETH_ALEN) |
| 391 | { |
| 392 | zlog_warn ("unsupported link layer"); |
| 393 | } |
| 394 | else |
| 395 | { |
| 396 | memcpy (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN); |
| 397 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 398 | #ifdef EXTREME_DEGUG |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 399 | zlog_debug ("isis_circuit_if_add: if_id %d, isomtu %d snpa %s", |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 400 | circuit->interface->ifindex, ISO_MTU (circuit), |
| 401 | snpa_print (circuit->u.bc.snpa)); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 402 | |
| 403 | #endif /* EXTREME_DEBUG */ |
Paul Jakma | 6f0e3f6 | 2007-05-10 02:38:51 +0000 | [diff] [blame^] | 404 | #endif /* HAVE_STRUCT_SOCKADDR_DL */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 405 | } |
| 406 | else if (if_is_pointopoint (ifp)) |
| 407 | { |
| 408 | circuit->circ_type = CIRCUIT_T_P2P; |
| 409 | } |
| 410 | else |
| 411 | { |
hasso | c89c05d | 2005-09-04 21:36:36 +0000 | [diff] [blame] | 412 | /* It's normal in case of loopback etc. */ |
| 413 | if (isis->debugs & DEBUG_EVENTS) |
| 414 | zlog_debug ("isis_circuit_if_add: unsupported media"); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 415 | } |
| 416 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 417 | for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn)) |
| 418 | isis_circuit_add_addr (circuit, conn); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 419 | |
| 420 | return; |
| 421 | } |
| 422 | |
| 423 | void |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 424 | isis_circuit_update_params (struct isis_circuit *circuit, |
| 425 | struct interface *ifp) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 426 | { |
hasso | b30c5e6 | 2004-12-29 20:06:41 +0000 | [diff] [blame] | 427 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 428 | |
| 429 | if (circuit->circuit_id != ifp->ifindex) |
| 430 | { |
| 431 | zlog_warn ("changing circuit_id %d->%d", circuit->circuit_id, |
| 432 | ifp->ifindex); |
| 433 | circuit->circuit_id = ifp->ifindex % 255; |
| 434 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 435 | |
| 436 | /* FIXME: Why is this needed? shouldn't we compare to the area's mtu */ |
| 437 | /* Ofer, this was here in case someone changes the mtu (e.g. with ifconfig) |
| 438 | The areas MTU is the minimum of mtu's of circuits in the area |
| 439 | now we can't catch the change |
| 440 | if (circuit->mtu != ifp->mtu) { |
| 441 | zlog_warn ("changing circuit mtu %d->%d", circuit->mtu, |
| 442 | ifp->mtu); |
| 443 | circuit->mtu = ifp->mtu; |
| 444 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 445 | */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 446 | /* |
| 447 | * Get the Hardware Address |
| 448 | */ |
Paul Jakma | 6f0e3f6 | 2007-05-10 02:38:51 +0000 | [diff] [blame^] | 449 | #ifdef HAVE_STRUCT_SOCKADDR_DL |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 450 | if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 451 | zlog_warn ("unsupported link layer"); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 452 | else |
| 453 | memcpy (circuit->u.bc.snpa, LLADDR (&circuit->interface->sdl), ETH_ALEN); |
| 454 | #else |
| 455 | if (circuit->interface->hw_addr_len != ETH_ALEN) |
| 456 | { |
| 457 | zlog_warn ("unsupported link layer"); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 458 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 459 | else |
| 460 | { |
| 461 | if (memcmp (circuit->u.bc.snpa, circuit->interface->hw_addr, ETH_ALEN)) |
| 462 | { |
| 463 | zlog_warn ("changing circuit snpa %s->%s", |
| 464 | snpa_print (circuit->u.bc.snpa), |
| 465 | snpa_print (circuit->interface->hw_addr)); |
| 466 | } |
| 467 | } |
| 468 | #endif |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 469 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 470 | if (if_is_broadcast (ifp)) |
| 471 | { |
| 472 | circuit->circ_type = CIRCUIT_T_BROADCAST; |
| 473 | } |
| 474 | else if (if_is_pointopoint (ifp)) |
| 475 | { |
| 476 | circuit->circ_type = CIRCUIT_T_P2P; |
| 477 | } |
| 478 | else |
| 479 | { |
| 480 | zlog_warn ("isis_circuit_update_params: unsupported media"); |
| 481 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 482 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 483 | return; |
| 484 | } |
| 485 | |
| 486 | void |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 487 | isis_circuit_if_del (struct isis_circuit *circuit) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 488 | { |
| 489 | circuit->interface->info = NULL; |
| 490 | circuit->interface = NULL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 491 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 492 | return; |
| 493 | } |
| 494 | |
| 495 | void |
| 496 | isis_circuit_up (struct isis_circuit *circuit) |
| 497 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 498 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 499 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 500 | { |
| 501 | if (circuit->area->min_bcast_mtu == 0 || |
| 502 | ISO_MTU (circuit) < circuit->area->min_bcast_mtu) |
| 503 | circuit->area->min_bcast_mtu = ISO_MTU (circuit); |
| 504 | /* |
| 505 | * ISO 10589 - 8.4.1 Enabling of broadcast circuits |
| 506 | */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 507 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 508 | /* initilizing the hello sending threads |
| 509 | * for a broadcast IF |
| 510 | */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 511 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 512 | /* 8.4.1 a) commence sending of IIH PDUs */ |
| 513 | |
| 514 | if (circuit->circuit_is_type & IS_LEVEL_1) |
| 515 | { |
| 516 | thread_add_event (master, send_lan_l1_hello, circuit, 0); |
| 517 | circuit->u.bc.lan_neighs[0] = list_new (); |
| 518 | } |
| 519 | |
| 520 | if (circuit->circuit_is_type & IS_LEVEL_2) |
| 521 | { |
| 522 | thread_add_event (master, send_lan_l2_hello, circuit, 0); |
| 523 | circuit->u.bc.lan_neighs[1] = list_new (); |
| 524 | } |
| 525 | |
| 526 | /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */ |
| 527 | /* 8.4.1 c) FIXME: listen for ESH PDUs */ |
| 528 | |
| 529 | /* 8.4.1 d) */ |
| 530 | /* dr election will commence in... */ |
| 531 | if (circuit->circuit_is_type & IS_LEVEL_1) |
| 532 | THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1, |
hasso | bf73101 | 2004-09-17 07:59:57 +0000 | [diff] [blame] | 533 | circuit, 2 * circuit->hello_interval[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 534 | if (circuit->circuit_is_type & IS_LEVEL_2) |
| 535 | THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2, |
hasso | bf73101 | 2004-09-17 07:59:57 +0000 | [diff] [blame] | 536 | circuit, 2 * circuit->hello_interval[1]); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 537 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 538 | else |
| 539 | { |
| 540 | /* initializing the hello send threads |
| 541 | * for a ptp IF |
| 542 | */ |
| 543 | thread_add_event (master, send_p2p_hello, circuit, 0); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 544 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 545 | } |
| 546 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 547 | /* initializing PSNP timers */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 548 | if (circuit->circuit_is_type & IS_LEVEL_1) |
| 549 | { |
| 550 | THREAD_TIMER_ON (master, circuit->t_send_psnp[0], send_l1_psnp, circuit, |
| 551 | isis_jitter (circuit->psnp_interval[0], PSNP_JITTER)); |
| 552 | } |
| 553 | |
| 554 | if (circuit->circuit_is_type & IS_LEVEL_2) |
| 555 | { |
| 556 | THREAD_TIMER_ON (master, circuit->t_send_psnp[1], send_l2_psnp, circuit, |
| 557 | isis_jitter (circuit->psnp_interval[1], PSNP_JITTER)); |
| 558 | } |
| 559 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 560 | /* initialize the circuit streams */ |
| 561 | if (circuit->rcv_stream == NULL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 562 | circuit->rcv_stream = stream_new (ISO_MTU (circuit)); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 563 | |
| 564 | if (circuit->snd_stream == NULL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 565 | circuit->snd_stream = stream_new (ISO_MTU (circuit)); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 566 | |
| 567 | /* unified init for circuits */ |
| 568 | isis_sock_init (circuit); |
| 569 | |
| 570 | #ifdef GNU_LINUX |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 571 | THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit, |
| 572 | circuit->fd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 573 | #else |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 574 | THREAD_TIMER_ON (master, circuit->t_read, isis_receive, circuit, |
| 575 | circuit->fd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 576 | #endif |
| 577 | return; |
| 578 | } |
| 579 | |
| 580 | void |
| 581 | isis_circuit_down (struct isis_circuit *circuit) |
| 582 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 583 | /* Cancel all active threads -- FIXME: wrong place */ |
hasso | d70f99e | 2004-02-11 20:26:31 +0000 | [diff] [blame] | 584 | /* HT: Read thread if GNU_LINUX, TIMER thread otherwise. */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 585 | THREAD_OFF (circuit->t_read); |
| 586 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 587 | { |
| 588 | THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[0]); |
| 589 | THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[1]); |
hasso | f891f44 | 2004-09-14 13:54:30 +0000 | [diff] [blame] | 590 | THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[0]); |
| 591 | THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[1]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 592 | } |
| 593 | else if (circuit->circ_type == CIRCUIT_T_P2P) |
| 594 | { |
| 595 | THREAD_TIMER_OFF (circuit->u.p2p.t_send_p2p_hello); |
| 596 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 597 | /* close the socket */ |
| 598 | close (circuit->fd); |
| 599 | |
| 600 | return; |
| 601 | } |
| 602 | |
| 603 | void |
| 604 | circuit_update_nlpids (struct isis_circuit *circuit) |
| 605 | { |
| 606 | circuit->nlpids.count = 0; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 607 | |
| 608 | if (circuit->ip_router) |
| 609 | { |
| 610 | circuit->nlpids.nlpids[0] = NLPID_IP; |
| 611 | circuit->nlpids.count++; |
| 612 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 613 | #ifdef HAVE_IPV6 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 614 | if (circuit->ipv6_router) |
| 615 | { |
| 616 | circuit->nlpids.nlpids[circuit->nlpids.count] = NLPID_IPV6; |
| 617 | circuit->nlpids.count++; |
| 618 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 619 | #endif /* HAVE_IPV6 */ |
| 620 | return; |
| 621 | } |
| 622 | |
| 623 | int |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 624 | isis_interface_config_write (struct vty *vty) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 625 | { |
| 626 | |
| 627 | int write = 0; |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 628 | struct listnode *node, *node2; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 629 | struct interface *ifp; |
| 630 | struct isis_area *area; |
| 631 | struct isis_circuit *c; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 632 | int i; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 633 | |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 634 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 635 | { |
| 636 | /* IF name */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 637 | vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 638 | write++; |
| 639 | /* IF desc */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 640 | if (ifp->desc) |
| 641 | { |
| 642 | vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE); |
| 643 | write++; |
| 644 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 645 | /* ISIS Circuit */ |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 646 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, node2, area)) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 647 | { |
| 648 | c = circuit_lookup_by_ifp (ifp, area->circuit_list); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 649 | if (c) |
| 650 | { |
| 651 | if (c->ip_router) |
| 652 | { |
| 653 | vty_out (vty, " ip router isis %s%s", area->area_tag, |
| 654 | VTY_NEWLINE); |
| 655 | write++; |
| 656 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 657 | #ifdef HAVE_IPV6 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 658 | if (c->ipv6_router) |
| 659 | { |
| 660 | vty_out (vty, " ipv6 router isis %s%s", area->area_tag, |
| 661 | VTY_NEWLINE); |
| 662 | write++; |
| 663 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 664 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 665 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 666 | /* ISIS - circuit type */ |
| 667 | if (c->circuit_is_type == IS_LEVEL_1) |
| 668 | { |
| 669 | vty_out (vty, " isis circuit-type level-1%s", VTY_NEWLINE); |
| 670 | write++; |
| 671 | } |
| 672 | else |
| 673 | { |
| 674 | if (c->circuit_is_type == IS_LEVEL_2) |
| 675 | { |
| 676 | vty_out (vty, " isis circuit-type level-2-only%s", |
| 677 | VTY_NEWLINE); |
| 678 | write++; |
| 679 | } |
| 680 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 681 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 682 | /* ISIS - CSNP interval - FIXME: compare to cisco */ |
| 683 | if (c->csnp_interval[0] == c->csnp_interval[1]) |
| 684 | { |
| 685 | if (c->csnp_interval[0] != CSNP_INTERVAL) |
| 686 | { |
| 687 | vty_out (vty, " isis csnp-interval %d%s", |
| 688 | c->csnp_interval[0], VTY_NEWLINE); |
| 689 | write++; |
| 690 | } |
| 691 | } |
| 692 | else |
| 693 | { |
| 694 | for (i = 0; i < 2; i++) |
| 695 | { |
| 696 | if (c->csnp_interval[1] != CSNP_INTERVAL) |
| 697 | { |
| 698 | vty_out (vty, " isis csnp-interval %d level-%d%s", |
| 699 | c->csnp_interval[1], i + 1, VTY_NEWLINE); |
| 700 | write++; |
| 701 | } |
| 702 | } |
| 703 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 704 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 705 | /* ISIS - Hello padding - Defaults to true so only display if false */ |
| 706 | if (c->circ_type == CIRCUIT_T_BROADCAST && !c->u.bc.pad_hellos) |
| 707 | { |
| 708 | vty_out (vty, " no isis hello padding%s", VTY_NEWLINE); |
| 709 | write++; |
| 710 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 711 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 712 | /* ISIS - Hello interval - FIXME: compare to cisco */ |
| 713 | if (c->hello_interval[0] == c->hello_interval[1]) |
| 714 | { |
| 715 | if (c->hello_interval[0] != HELLO_INTERVAL) |
| 716 | { |
| 717 | vty_out (vty, " isis hello-interval %d%s", |
| 718 | c->hello_interval[0], VTY_NEWLINE); |
| 719 | write++; |
| 720 | } |
| 721 | } |
| 722 | else |
| 723 | { |
| 724 | for (i = 0; i < 2; i++) |
| 725 | { |
| 726 | if (c->hello_interval[i] != HELLO_INTERVAL) |
| 727 | { |
| 728 | if (c->hello_interval[i] == HELLO_MINIMAL) |
| 729 | { |
| 730 | vty_out (vty, |
| 731 | " isis hello-interval minimal level-%d%s", |
| 732 | i + 1, VTY_NEWLINE); |
| 733 | } |
| 734 | else |
| 735 | { |
| 736 | vty_out (vty, " isis hello-interval %d level-%d%s", |
| 737 | c->hello_interval[i], i + 1, VTY_NEWLINE); |
| 738 | } |
| 739 | write++; |
| 740 | } |
| 741 | } |
| 742 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 743 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 744 | /* ISIS - Hello Multiplier */ |
| 745 | if (c->hello_multiplier[0] == c->hello_multiplier[1]) |
| 746 | { |
| 747 | if (c->hello_multiplier[0] != HELLO_MULTIPLIER) |
| 748 | { |
| 749 | vty_out (vty, " isis hello-multiplier %d%s", |
| 750 | c->hello_multiplier[0], VTY_NEWLINE); |
| 751 | write++; |
| 752 | } |
| 753 | } |
| 754 | else |
| 755 | { |
| 756 | for (i = 0; i < 2; i++) |
| 757 | { |
| 758 | if (c->hello_multiplier[i] != HELLO_MULTIPLIER) |
| 759 | { |
| 760 | vty_out (vty, " isis hello-multiplier %d level-%d%s", |
| 761 | c->hello_multiplier[i], i + 1, VTY_NEWLINE); |
| 762 | write++; |
| 763 | } |
| 764 | } |
| 765 | } |
| 766 | /* ISIS - Priority */ |
| 767 | if (c->circ_type == CIRCUIT_T_BROADCAST) |
| 768 | { |
| 769 | if (c->u.bc.priority[0] == c->u.bc.priority[1]) |
| 770 | { |
| 771 | if (c->u.bc.priority[0] != DEFAULT_PRIORITY) |
| 772 | { |
| 773 | vty_out (vty, " isis priority %d%s", |
| 774 | c->u.bc.priority[0], VTY_NEWLINE); |
| 775 | write++; |
| 776 | } |
| 777 | } |
| 778 | else |
| 779 | { |
| 780 | for (i = 0; i < 2; i++) |
| 781 | { |
| 782 | if (c->u.bc.priority[i] != DEFAULT_PRIORITY) |
| 783 | { |
| 784 | vty_out (vty, " isis priority %d level-%d%s", |
| 785 | c->u.bc.priority[i], i + 1, VTY_NEWLINE); |
| 786 | write++; |
| 787 | } |
| 788 | } |
| 789 | } |
| 790 | } |
| 791 | /* ISIS - Metric */ |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 792 | if (c->te_metric[0] == c->te_metric[1]) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 793 | { |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 794 | if (c->te_metric[0] != DEFAULT_CIRCUIT_METRICS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 795 | { |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 796 | vty_out (vty, " isis metric %d%s", c->te_metric[0], |
| 797 | VTY_NEWLINE); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 798 | write++; |
| 799 | } |
| 800 | } |
| 801 | else |
| 802 | { |
| 803 | for (i = 0; i < 2; i++) |
| 804 | { |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 805 | if (c->te_metric[i] != DEFAULT_CIRCUIT_METRICS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 806 | { |
| 807 | vty_out (vty, " isis metric %d level-%d%s", |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 808 | c->te_metric[i], i + 1, VTY_NEWLINE); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 809 | write++; |
| 810 | } |
| 811 | } |
| 812 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 813 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 814 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 815 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 816 | vty_out (vty, "!%s", VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 817 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 818 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 819 | return write; |
| 820 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 821 | |
| 822 | DEFUN (ip_router_isis, |
| 823 | ip_router_isis_cmd, |
| 824 | "ip router isis WORD", |
| 825 | "Interface Internet Protocol config commands\n" |
| 826 | "IP router interface commands\n" |
| 827 | "IS-IS Routing for IP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 828 | "Routing process tag\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 829 | { |
| 830 | struct isis_circuit *c; |
| 831 | struct interface *ifp; |
| 832 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 833 | |
| 834 | ifp = (struct interface *) vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 835 | assert (ifp); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 836 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 837 | area = isis_area_lookup (argv[0]); |
| 838 | |
| 839 | /* Prevent more than one circuit per interface */ |
| 840 | if (area) |
| 841 | c = circuit_lookup_by_ifp (ifp, area->circuit_list); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 842 | else |
| 843 | c = NULL; |
| 844 | if (c && (ifp->info != NULL)) |
| 845 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 846 | #ifdef HAVE_IPV6 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 847 | if (c->ipv6_router == 0) |
| 848 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 849 | #endif /* HAVE_IPV6 */ |
hasso | c89c05d | 2005-09-04 21:36:36 +0000 | [diff] [blame] | 850 | /* FIXME: Find the way to warn only vty users. */ |
| 851 | /* vty_out (vty, "ISIS circuit is already defined%s", VTY_NEWLINE); */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 852 | return CMD_WARNING; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 853 | #ifdef HAVE_IPV6 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 854 | } |
| 855 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 856 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 857 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 858 | /* this is here for ciscopability */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 859 | if (!area) |
| 860 | { |
hasso | c89c05d | 2005-09-04 21:36:36 +0000 | [diff] [blame] | 861 | /* FIXME: Find the way to warn only vty users. */ |
| 862 | /* vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 863 | return CMD_WARNING; |
| 864 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 865 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 866 | if (!c) |
| 867 | { |
| 868 | c = circuit_lookup_by_ifp (ifp, isis->init_circ_list); |
| 869 | c = isis_csm_state_change (ISIS_ENABLE, c, area); |
| 870 | c->interface = ifp; /* this is automatic */ |
| 871 | ifp->info = c; /* hardly related to the FSM */ |
| 872 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 873 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 874 | if (!c) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 875 | return CMD_WARNING; |
| 876 | |
| 877 | c->ip_router = 1; |
| 878 | area->ip_circuits++; |
| 879 | circuit_update_nlpids (c); |
| 880 | |
| 881 | vty->node = INTERFACE_NODE; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 882 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 883 | return CMD_SUCCESS; |
| 884 | } |
| 885 | |
| 886 | DEFUN (no_ip_router_isis, |
| 887 | no_ip_router_isis_cmd, |
| 888 | "no ip router isis WORD", |
| 889 | NO_STR |
| 890 | "Interface Internet Protocol config commands\n" |
| 891 | "IP router interface commands\n" |
| 892 | "IS-IS Routing for IP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 893 | "Routing process tag\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 894 | { |
| 895 | struct isis_circuit *circuit = NULL; |
| 896 | struct interface *ifp; |
| 897 | struct isis_area *area; |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 898 | struct listnode *node; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 899 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 900 | ifp = (struct interface *) vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 901 | assert (ifp); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 902 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 903 | area = isis_area_lookup (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 904 | if (!area) |
| 905 | { |
| 906 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 907 | return CMD_WARNING; |
| 908 | } |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 909 | for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit)) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 910 | if (circuit->interface == ifp) |
| 911 | break; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 912 | if (!circuit) |
| 913 | { |
| 914 | vty_out (vty, "Can't find ISIS interface %s", VTY_NEWLINE); |
| 915 | return CMD_WARNING; |
| 916 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 917 | circuit->ip_router = 0; |
| 918 | area->ip_circuits--; |
| 919 | #ifdef HAVE_IPV6 |
| 920 | if (circuit->ipv6_router == 0) |
| 921 | #endif |
| 922 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 923 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 924 | return CMD_SUCCESS; |
| 925 | } |
| 926 | |
| 927 | DEFUN (isis_circuit_type, |
| 928 | isis_circuit_type_cmd, |
| 929 | "isis circuit-type (level-1|level-1-2|level-2-only)", |
| 930 | "IS-IS commands\n" |
| 931 | "Configure circuit type for interface\n" |
| 932 | "Level-1 only adjacencies are formed\n" |
| 933 | "Level-1-2 adjacencies are formed\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 934 | "Level-2 only adjacencies are formed\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 935 | { |
| 936 | struct isis_circuit *circuit; |
| 937 | struct interface *ifp; |
| 938 | int circuit_t; |
| 939 | int is_type; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 940 | |
| 941 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 942 | circuit = ifp->info; |
| 943 | /* UGLY - will remove l8r */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 944 | if (circuit == NULL) |
| 945 | { |
| 946 | return CMD_WARNING; |
| 947 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 948 | |
hasso | 13c48f7 | 2004-09-10 21:19:13 +0000 | [diff] [blame] | 949 | /* XXX what to do when ip_router_isis is not executed */ |
| 950 | if (circuit->area == NULL) |
| 951 | return CMD_WARNING; |
| 952 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 953 | assert (circuit); |
| 954 | |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 955 | circuit_t = string2circuit_t (argv[0]); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 956 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 957 | if (!circuit_t) |
| 958 | { |
| 959 | vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE); |
| 960 | return CMD_SUCCESS; |
| 961 | } |
| 962 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 963 | is_type = circuit->area->is_type; |
| 964 | if (is_type == IS_LEVEL_1_AND_2 || is_type == circuit_t) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 965 | isis_event_circuit_type_change (circuit, circuit_t); |
| 966 | else |
| 967 | { |
| 968 | vty_out (vty, "invalid circuit level for area %s.%s", |
| 969 | circuit->area->area_tag, VTY_NEWLINE); |
| 970 | } |
| 971 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 972 | return CMD_SUCCESS; |
| 973 | } |
| 974 | |
| 975 | DEFUN (no_isis_circuit_type, |
| 976 | no_isis_circuit_type_cmd, |
| 977 | "no isis circuit-type (level-1|level-1-2|level-2-only)", |
| 978 | NO_STR |
| 979 | "IS-IS commands\n" |
| 980 | "Configure circuit type for interface\n" |
| 981 | "Level-1 only adjacencies are formed\n" |
| 982 | "Level-1-2 adjacencies are formed\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 983 | "Level-2 only adjacencies are formed\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 984 | { |
| 985 | struct isis_circuit *circuit; |
| 986 | struct interface *ifp; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 987 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 988 | ifp = vty->index; |
| 989 | circuit = ifp->info; |
| 990 | if (circuit == NULL) |
| 991 | { |
| 992 | return CMD_WARNING; |
| 993 | } |
| 994 | |
| 995 | assert (circuit); |
| 996 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 997 | /* |
| 998 | * Set the circuits level to its default value which is that of the area |
| 999 | */ |
| 1000 | isis_event_circuit_type_change (circuit, circuit->area->is_type); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1001 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1002 | return CMD_SUCCESS; |
| 1003 | } |
| 1004 | |
| 1005 | DEFUN (isis_passwd, |
| 1006 | isis_passwd_cmd, |
| 1007 | "isis password WORD", |
| 1008 | "IS-IS commands\n" |
| 1009 | "Configure the authentication password for interface\n" |
| 1010 | "Password\n") |
| 1011 | { |
| 1012 | struct isis_circuit *circuit; |
| 1013 | struct interface *ifp; |
| 1014 | int len; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1015 | |
| 1016 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1017 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1018 | if (circuit == NULL) |
| 1019 | { |
| 1020 | return CMD_WARNING; |
| 1021 | } |
| 1022 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1023 | len = strlen (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1024 | if (len > 254) |
| 1025 | { |
| 1026 | vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE); |
| 1027 | return CMD_WARNING; |
| 1028 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1029 | circuit->passwd.len = len; |
| 1030 | circuit->passwd.type = ISIS_PASSWD_TYPE_CLEARTXT; |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 1031 | strncpy ((char *)circuit->passwd.passwd, argv[0], 255); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1032 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1033 | return CMD_SUCCESS; |
| 1034 | } |
| 1035 | |
| 1036 | DEFUN (no_isis_passwd, |
| 1037 | no_isis_passwd_cmd, |
| 1038 | "no isis password", |
| 1039 | NO_STR |
| 1040 | "IS-IS commands\n" |
| 1041 | "Configure the authentication password for interface\n") |
| 1042 | { |
| 1043 | struct isis_circuit *circuit; |
| 1044 | struct interface *ifp; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1045 | |
| 1046 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1047 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1048 | if (circuit == NULL) |
| 1049 | { |
| 1050 | return CMD_WARNING; |
| 1051 | } |
| 1052 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1053 | memset (&circuit->passwd, 0, sizeof (struct isis_passwd)); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1054 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1055 | return CMD_SUCCESS; |
| 1056 | } |
| 1057 | |
| 1058 | |
| 1059 | DEFUN (isis_priority, |
| 1060 | isis_priority_cmd, |
| 1061 | "isis priority <0-127>", |
| 1062 | "IS-IS commands\n" |
| 1063 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1064 | "Priority value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1065 | { |
| 1066 | struct isis_circuit *circuit; |
| 1067 | struct interface *ifp; |
| 1068 | int prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1069 | |
| 1070 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1071 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1072 | if (circuit == NULL) |
| 1073 | { |
| 1074 | return CMD_WARNING; |
| 1075 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1076 | assert (circuit); |
| 1077 | |
| 1078 | prio = atoi (argv[0]); |
| 1079 | |
| 1080 | circuit->u.bc.priority[0] = prio; |
| 1081 | circuit->u.bc.priority[1] = prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1082 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1083 | return CMD_SUCCESS; |
| 1084 | } |
| 1085 | |
| 1086 | DEFUN (no_isis_priority, |
| 1087 | no_isis_priority_cmd, |
| 1088 | "no isis priority", |
| 1089 | NO_STR |
| 1090 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1091 | "Set priority for Designated Router election\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1092 | { |
| 1093 | struct isis_circuit *circuit; |
| 1094 | struct interface *ifp; |
| 1095 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1096 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1097 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1098 | if (circuit == NULL) |
| 1099 | { |
| 1100 | return CMD_WARNING; |
| 1101 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1102 | assert (circuit); |
| 1103 | |
| 1104 | circuit->u.bc.priority[0] = DEFAULT_PRIORITY; |
| 1105 | circuit->u.bc.priority[1] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1106 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1107 | return CMD_SUCCESS; |
| 1108 | } |
| 1109 | |
| 1110 | ALIAS (no_isis_priority, |
| 1111 | no_isis_priority_arg_cmd, |
| 1112 | "no isis priority <0-127>", |
| 1113 | NO_STR |
| 1114 | "IS-IS commands\n" |
| 1115 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1116 | "Priority value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1117 | |
| 1118 | DEFUN (isis_priority_l1, |
| 1119 | isis_priority_l1_cmd, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1120 | "isis priority <0-127> level-1", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1121 | "IS-IS commands\n" |
| 1122 | "Set priority for Designated Router election\n" |
| 1123 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1124 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1125 | { |
| 1126 | struct isis_circuit *circuit; |
| 1127 | struct interface *ifp; |
| 1128 | int prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1129 | |
| 1130 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1131 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1132 | if (circuit == NULL) |
| 1133 | { |
| 1134 | return CMD_WARNING; |
| 1135 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1136 | assert (circuit); |
| 1137 | |
| 1138 | prio = atoi (argv[0]); |
| 1139 | |
| 1140 | circuit->u.bc.priority[0] = prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1141 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1142 | return CMD_SUCCESS; |
| 1143 | } |
| 1144 | |
| 1145 | DEFUN (no_isis_priority_l1, |
| 1146 | no_isis_priority_l1_cmd, |
| 1147 | "no isis priority level-1", |
| 1148 | NO_STR |
| 1149 | "IS-IS commands\n" |
| 1150 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1151 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1152 | { |
| 1153 | struct isis_circuit *circuit; |
| 1154 | struct interface *ifp; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1155 | |
| 1156 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1157 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1158 | if (circuit == NULL) |
| 1159 | { |
| 1160 | return CMD_WARNING; |
| 1161 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1162 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1163 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1164 | circuit->u.bc.priority[0] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1165 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1166 | return CMD_SUCCESS; |
| 1167 | } |
| 1168 | |
| 1169 | ALIAS (no_isis_priority_l1, |
| 1170 | no_isis_priority_l1_arg_cmd, |
| 1171 | "no isis priority <0-127> level-1", |
| 1172 | NO_STR |
| 1173 | "IS-IS commands\n" |
| 1174 | "Set priority for Designated Router election\n" |
| 1175 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1176 | "Specify priority for level-1 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1177 | |
| 1178 | DEFUN (isis_priority_l2, |
| 1179 | isis_priority_l2_cmd, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1180 | "isis priority <0-127> level-2", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1181 | "IS-IS commands\n" |
| 1182 | "Set priority for Designated Router election\n" |
| 1183 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1184 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1185 | { |
| 1186 | struct isis_circuit *circuit; |
| 1187 | struct interface *ifp; |
| 1188 | int prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1189 | |
| 1190 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1191 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1192 | if (circuit == NULL) |
| 1193 | { |
| 1194 | return CMD_WARNING; |
| 1195 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1196 | assert (circuit); |
| 1197 | |
| 1198 | prio = atoi (argv[0]); |
| 1199 | |
| 1200 | circuit->u.bc.priority[1] = prio; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1201 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1202 | return CMD_SUCCESS; |
| 1203 | } |
| 1204 | |
| 1205 | DEFUN (no_isis_priority_l2, |
| 1206 | no_isis_priority_l2_cmd, |
| 1207 | "no isis priority level-2", |
| 1208 | NO_STR |
| 1209 | "IS-IS commands\n" |
| 1210 | "Set priority for Designated Router election\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1211 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1212 | { |
| 1213 | struct isis_circuit *circuit; |
| 1214 | struct interface *ifp; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1215 | |
| 1216 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1217 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1218 | if (circuit == NULL) |
| 1219 | { |
| 1220 | return CMD_WARNING; |
| 1221 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1222 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1223 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1224 | circuit->u.bc.priority[1] = DEFAULT_PRIORITY; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1225 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1226 | return CMD_SUCCESS; |
| 1227 | } |
| 1228 | |
| 1229 | ALIAS (no_isis_priority_l2, |
| 1230 | no_isis_priority_l2_arg_cmd, |
| 1231 | "no isis priority <0-127> level-2", |
| 1232 | NO_STR |
| 1233 | "IS-IS commands\n" |
| 1234 | "Set priority for Designated Router election\n" |
| 1235 | "Priority value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1236 | "Specify priority for level-2 routing\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1237 | |
| 1238 | /* Metric command */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1239 | DEFUN (isis_metric, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1240 | isis_metric_cmd, |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 1241 | "isis metric <0-16777215>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1242 | "IS-IS commands\n" |
| 1243 | "Set default metric for circuit\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1244 | "Default metric value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1245 | { |
| 1246 | struct isis_circuit *circuit; |
| 1247 | struct interface *ifp; |
| 1248 | int met; |
| 1249 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1250 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1251 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1252 | if (circuit == NULL) |
| 1253 | { |
| 1254 | return CMD_WARNING; |
| 1255 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1256 | assert (circuit); |
| 1257 | |
| 1258 | met = atoi (argv[0]); |
| 1259 | |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 1260 | circuit->te_metric[0] = met; |
| 1261 | circuit->te_metric[1] = met; |
| 1262 | |
| 1263 | if (met > 63) |
| 1264 | met = 63; |
| 1265 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1266 | circuit->metrics[0].metric_default = met; |
| 1267 | circuit->metrics[1].metric_default = met; |
| 1268 | |
| 1269 | return CMD_SUCCESS; |
| 1270 | } |
| 1271 | |
| 1272 | DEFUN (no_isis_metric, |
| 1273 | no_isis_metric_cmd, |
| 1274 | "no isis metric", |
| 1275 | NO_STR |
| 1276 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1277 | "Set default metric for circuit\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1278 | { |
| 1279 | struct isis_circuit *circuit; |
| 1280 | struct interface *ifp; |
| 1281 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1282 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1283 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1284 | if (circuit == NULL) |
| 1285 | { |
| 1286 | return CMD_WARNING; |
| 1287 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1288 | assert (circuit); |
| 1289 | |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 1290 | circuit->te_metric[0] = DEFAULT_CIRCUIT_METRICS; |
| 1291 | circuit->te_metric[1] = DEFAULT_CIRCUIT_METRICS; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1292 | circuit->metrics[0].metric_default = DEFAULT_CIRCUIT_METRICS; |
| 1293 | circuit->metrics[1].metric_default = DEFAULT_CIRCUIT_METRICS; |
| 1294 | |
| 1295 | return CMD_SUCCESS; |
| 1296 | } |
| 1297 | |
| 1298 | ALIAS (no_isis_metric, |
| 1299 | no_isis_metric_arg_cmd, |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 1300 | "no isis metric <0-16777215>", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1301 | NO_STR |
| 1302 | "IS-IS commands\n" |
| 1303 | "Set default metric for circuit\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1304 | "Default metric value\n") |
| 1305 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1306 | /* end of metrics */ |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 1307 | DEFUN (isis_hello_interval, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1308 | isis_hello_interval_cmd, |
| 1309 | "isis hello-interval (<1-65535>|minimal)", |
| 1310 | "IS-IS commands\n" |
| 1311 | "Set Hello interval\n" |
| 1312 | "Hello interval value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1313 | "Holdtime 1 seconds, interval depends on multiplier\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1314 | { |
| 1315 | struct isis_circuit *circuit; |
| 1316 | struct interface *ifp; |
| 1317 | int interval; |
| 1318 | char c; |
| 1319 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1320 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1321 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1322 | if (circuit == NULL) |
| 1323 | { |
| 1324 | return CMD_WARNING; |
| 1325 | } |
| 1326 | assert (circuit); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1327 | c = *argv[0]; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1328 | if (isdigit ((int) c)) |
| 1329 | { |
| 1330 | interval = atoi (argv[0]); |
| 1331 | } |
| 1332 | else |
| 1333 | interval = HELLO_MINIMAL; /* FIXME: should be calculated */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1334 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1335 | circuit->hello_interval[0] = (u_int16_t) interval; |
| 1336 | circuit->hello_interval[1] = (u_int16_t) interval; |
| 1337 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1338 | return CMD_SUCCESS; |
| 1339 | } |
| 1340 | |
| 1341 | DEFUN (no_isis_hello_interval, |
| 1342 | no_isis_hello_interval_cmd, |
| 1343 | "no isis hello-interval", |
| 1344 | NO_STR |
| 1345 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1346 | "Set Hello interval\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1347 | { |
| 1348 | struct isis_circuit *circuit; |
| 1349 | struct interface *ifp; |
| 1350 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1351 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1352 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1353 | if (circuit == NULL) |
| 1354 | { |
| 1355 | return CMD_WARNING; |
| 1356 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1357 | assert (circuit); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1358 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1359 | |
| 1360 | circuit->hello_interval[0] = HELLO_INTERVAL; /* Default is 1 sec. */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1361 | circuit->hello_interval[1] = HELLO_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1362 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1363 | return CMD_SUCCESS; |
| 1364 | } |
| 1365 | |
| 1366 | ALIAS (no_isis_hello_interval, |
| 1367 | no_isis_hello_interval_arg_cmd, |
| 1368 | "no isis hello-interval (<1-65535>|minimal)", |
| 1369 | NO_STR |
| 1370 | "IS-IS commands\n" |
| 1371 | "Set Hello interval\n" |
| 1372 | "Hello interval value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1373 | "Holdtime 1 second, interval depends on multiplier\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1374 | |
| 1375 | DEFUN (isis_hello_interval_l1, |
| 1376 | isis_hello_interval_l1_cmd, |
| 1377 | "isis hello-interval (<1-65535>|minimal) level-1", |
| 1378 | "IS-IS commands\n" |
| 1379 | "Set Hello interval\n" |
| 1380 | "Hello interval value\n" |
| 1381 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1382 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1383 | { |
| 1384 | struct isis_circuit *circuit; |
| 1385 | struct interface *ifp; |
| 1386 | long interval; |
| 1387 | char c; |
| 1388 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1389 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1390 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1391 | if (circuit == NULL) |
| 1392 | { |
| 1393 | return CMD_WARNING; |
| 1394 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1395 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1396 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1397 | c = *argv[0]; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1398 | if (isdigit ((int) c)) |
| 1399 | { |
| 1400 | interval = atoi (argv[0]); |
| 1401 | } |
| 1402 | else |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1403 | interval = HELLO_MINIMAL; |
| 1404 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1405 | circuit->hello_interval[0] = (u_int16_t) interval; |
| 1406 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1407 | return CMD_SUCCESS; |
| 1408 | } |
| 1409 | |
| 1410 | DEFUN (no_isis_hello_interval_l1, |
| 1411 | no_isis_hello_interval_l1_cmd, |
| 1412 | "no isis hello-interval level-1", |
| 1413 | NO_STR |
| 1414 | "IS-IS commands\n" |
| 1415 | "Set Hello interval\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1416 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1417 | { |
| 1418 | struct isis_circuit *circuit; |
| 1419 | struct interface *ifp; |
| 1420 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1421 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1422 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1423 | if (circuit == NULL) |
| 1424 | { |
| 1425 | return CMD_WARNING; |
| 1426 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1427 | assert (circuit); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1428 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1429 | |
| 1430 | circuit->hello_interval[0] = HELLO_INTERVAL; /* Default is 1 sec. */ |
| 1431 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1432 | return CMD_SUCCESS; |
| 1433 | } |
| 1434 | |
| 1435 | ALIAS (no_isis_hello_interval_l1, |
| 1436 | no_isis_hello_interval_l1_arg_cmd, |
| 1437 | "no isis hello-interval (<1-65535>|minimal) level-1", |
| 1438 | NO_STR |
| 1439 | "IS-IS commands\n" |
| 1440 | "Set Hello interval\n" |
| 1441 | "Hello interval value\n" |
| 1442 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1443 | "Specify hello-interval for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1444 | |
| 1445 | DEFUN (isis_hello_interval_l2, |
| 1446 | isis_hello_interval_l2_cmd, |
| 1447 | "isis hello-interval (<1-65535>|minimal) level-2", |
| 1448 | "IS-IS commands\n" |
| 1449 | "Set Hello interval\n" |
| 1450 | "Hello interval value\n" |
| 1451 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1452 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1453 | { |
| 1454 | struct isis_circuit *circuit; |
| 1455 | struct interface *ifp; |
| 1456 | long interval; |
| 1457 | char c; |
| 1458 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1459 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1460 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1461 | if (circuit == NULL) |
| 1462 | { |
| 1463 | return CMD_WARNING; |
| 1464 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1465 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1466 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1467 | c = *argv[0]; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1468 | if (isdigit ((int) c)) |
| 1469 | { |
| 1470 | interval = atoi (argv[0]); |
| 1471 | } |
| 1472 | else |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1473 | interval = HELLO_MINIMAL; |
| 1474 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1475 | circuit->hello_interval[1] = (u_int16_t) interval; |
| 1476 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1477 | return CMD_SUCCESS; |
| 1478 | } |
| 1479 | |
| 1480 | DEFUN (no_isis_hello_interval_l2, |
| 1481 | no_isis_hello_interval_l2_cmd, |
| 1482 | "no isis hello-interval level-2", |
| 1483 | NO_STR |
| 1484 | "IS-IS commands\n" |
| 1485 | "Set Hello interval\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1486 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1487 | { |
| 1488 | struct isis_circuit *circuit; |
| 1489 | struct interface *ifp; |
| 1490 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1491 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1492 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1493 | if (circuit == NULL) |
| 1494 | { |
| 1495 | return CMD_WARNING; |
| 1496 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1497 | assert (circuit); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1498 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1499 | |
| 1500 | circuit->hello_interval[1] = HELLO_INTERVAL; /* Default is 1 sec. */ |
| 1501 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1502 | return CMD_SUCCESS; |
| 1503 | } |
| 1504 | |
| 1505 | ALIAS (no_isis_hello_interval_l2, |
| 1506 | no_isis_hello_interval_l2_arg_cmd, |
| 1507 | "no isis hello-interval (<1-65535>|minimal) level-2", |
| 1508 | NO_STR |
| 1509 | "IS-IS commands\n" |
| 1510 | "Set Hello interval\n" |
| 1511 | "Hello interval value\n" |
| 1512 | "Holdtime 1 second, interval depends on multiplier\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1513 | "Specify hello-interval for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1514 | |
| 1515 | DEFUN (isis_hello_multiplier, |
| 1516 | isis_hello_multiplier_cmd, |
| 1517 | "isis hello-multiplier <3-1000>", |
| 1518 | "IS-IS commands\n" |
| 1519 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1520 | "Hello multiplier value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1521 | { |
| 1522 | struct isis_circuit *circuit; |
| 1523 | struct interface *ifp; |
| 1524 | int mult; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1525 | |
| 1526 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1527 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1528 | if (circuit == NULL) |
| 1529 | { |
| 1530 | return CMD_WARNING; |
| 1531 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1532 | assert (circuit); |
| 1533 | |
| 1534 | mult = atoi (argv[0]); |
| 1535 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1536 | circuit->hello_multiplier[0] = (u_int16_t) mult; |
| 1537 | circuit->hello_multiplier[1] = (u_int16_t) mult; |
| 1538 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1539 | return CMD_SUCCESS; |
| 1540 | } |
| 1541 | |
| 1542 | DEFUN (no_isis_hello_multiplier, |
| 1543 | no_isis_hello_multiplier_cmd, |
| 1544 | "no isis hello-multiplier", |
| 1545 | NO_STR |
| 1546 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1547 | "Set multiplier for Hello holding time\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1548 | { |
| 1549 | struct isis_circuit *circuit; |
| 1550 | struct interface *ifp; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1551 | |
| 1552 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1553 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1554 | if (circuit == NULL) |
| 1555 | { |
| 1556 | return CMD_WARNING; |
| 1557 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1558 | assert (circuit); |
| 1559 | |
| 1560 | circuit->hello_multiplier[0] = HELLO_MULTIPLIER; |
| 1561 | circuit->hello_multiplier[1] = HELLO_MULTIPLIER; |
| 1562 | |
| 1563 | return CMD_SUCCESS; |
| 1564 | } |
| 1565 | |
| 1566 | ALIAS (no_isis_hello_multiplier, |
| 1567 | no_isis_hello_multiplier_arg_cmd, |
| 1568 | "no isis hello-multiplier <3-1000>", |
| 1569 | NO_STR |
| 1570 | "IS-IS commands\n" |
| 1571 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1572 | "Hello multiplier value\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1573 | |
| 1574 | DEFUN (isis_hello_multiplier_l1, |
| 1575 | isis_hello_multiplier_l1_cmd, |
| 1576 | "isis hello-multiplier <3-1000> level-1", |
| 1577 | "IS-IS commands\n" |
| 1578 | "Set multiplier for Hello holding time\n" |
| 1579 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1580 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1581 | { |
| 1582 | struct isis_circuit *circuit; |
| 1583 | struct interface *ifp; |
| 1584 | int mult; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1585 | |
| 1586 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1587 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1588 | if (circuit == NULL) |
| 1589 | { |
| 1590 | return CMD_WARNING; |
| 1591 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1592 | assert (circuit); |
| 1593 | |
| 1594 | mult = atoi (argv[0]); |
| 1595 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1596 | circuit->hello_multiplier[0] = (u_int16_t) mult; |
| 1597 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1598 | return CMD_SUCCESS; |
| 1599 | } |
| 1600 | |
| 1601 | DEFUN (no_isis_hello_multiplier_l1, |
| 1602 | no_isis_hello_multiplier_l1_cmd, |
| 1603 | "no isis hello-multiplier level-1", |
| 1604 | NO_STR |
| 1605 | "IS-IS commands\n" |
| 1606 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1607 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1608 | { |
| 1609 | struct isis_circuit *circuit; |
| 1610 | struct interface *ifp; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1611 | |
| 1612 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1613 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1614 | if (circuit == NULL) |
| 1615 | { |
| 1616 | return CMD_WARNING; |
| 1617 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1618 | assert (circuit); |
| 1619 | |
| 1620 | circuit->hello_multiplier[0] = HELLO_MULTIPLIER; |
| 1621 | |
| 1622 | return CMD_SUCCESS; |
| 1623 | } |
| 1624 | |
| 1625 | ALIAS (no_isis_hello_multiplier_l1, |
| 1626 | no_isis_hello_multiplier_l1_arg_cmd, |
| 1627 | "no isis hello-multiplier <3-1000> level-1", |
| 1628 | NO_STR |
| 1629 | "IS-IS commands\n" |
| 1630 | "Set multiplier for Hello holding time\n" |
| 1631 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1632 | "Specify hello multiplier for level-1 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1633 | |
| 1634 | DEFUN (isis_hello_multiplier_l2, |
| 1635 | isis_hello_multiplier_l2_cmd, |
| 1636 | "isis hello-multiplier <3-1000> level-2", |
| 1637 | "IS-IS commands\n" |
| 1638 | "Set multiplier for Hello holding time\n" |
| 1639 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1640 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1641 | { |
| 1642 | struct isis_circuit *circuit; |
| 1643 | struct interface *ifp; |
| 1644 | int mult; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1645 | |
| 1646 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1647 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1648 | if (circuit == NULL) |
| 1649 | { |
| 1650 | return CMD_WARNING; |
| 1651 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1652 | assert (circuit); |
| 1653 | |
| 1654 | mult = atoi (argv[0]); |
| 1655 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1656 | circuit->hello_multiplier[1] = (u_int16_t) mult; |
| 1657 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1658 | return CMD_SUCCESS; |
| 1659 | } |
| 1660 | |
| 1661 | DEFUN (no_isis_hello_multiplier_l2, |
| 1662 | no_isis_hello_multiplier_l2_cmd, |
| 1663 | "no isis hello-multiplier level-2", |
| 1664 | NO_STR |
| 1665 | "IS-IS commands\n" |
| 1666 | "Set multiplier for Hello holding time\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1667 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1668 | { |
| 1669 | struct isis_circuit *circuit; |
| 1670 | struct interface *ifp; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1671 | |
| 1672 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1673 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1674 | if (circuit == NULL) |
| 1675 | { |
| 1676 | return CMD_WARNING; |
| 1677 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1678 | assert (circuit); |
| 1679 | |
| 1680 | circuit->hello_multiplier[1] = HELLO_MULTIPLIER; |
| 1681 | |
| 1682 | return CMD_SUCCESS; |
| 1683 | } |
| 1684 | |
| 1685 | ALIAS (no_isis_hello_multiplier_l2, |
| 1686 | no_isis_hello_multiplier_l2_arg_cmd, |
| 1687 | "no isis hello-multiplier <3-1000> level-2", |
| 1688 | NO_STR |
| 1689 | "IS-IS commands\n" |
| 1690 | "Set multiplier for Hello holding time\n" |
| 1691 | "Hello multiplier value\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1692 | "Specify hello multiplier for level-2 IIHs\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1693 | |
| 1694 | DEFUN (isis_hello, |
| 1695 | isis_hello_cmd, |
| 1696 | "isis hello padding", |
| 1697 | "IS-IS commands\n" |
| 1698 | "Add padding to IS-IS hello packets\n" |
| 1699 | "Pad hello packets\n" |
| 1700 | "<cr>\n") |
| 1701 | { |
| 1702 | struct interface *ifp; |
| 1703 | struct isis_circuit *circuit; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1704 | |
| 1705 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1706 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1707 | if (circuit == NULL) |
| 1708 | { |
| 1709 | return CMD_WARNING; |
| 1710 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1711 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1712 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1713 | circuit->u.bc.pad_hellos = 1; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1714 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1715 | return CMD_SUCCESS; |
| 1716 | } |
| 1717 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1718 | DEFUN (no_isis_hello, |
| 1719 | no_isis_hello_cmd, |
| 1720 | "no isis hello padding", |
| 1721 | NO_STR |
| 1722 | "IS-IS commands\n" |
| 1723 | "Add padding to IS-IS hello packets\n" |
| 1724 | "Pad hello packets\n" |
| 1725 | "<cr>\n") |
| 1726 | { |
| 1727 | struct isis_circuit *circuit; |
| 1728 | struct interface *ifp; |
| 1729 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1730 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1731 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1732 | if (circuit == NULL) |
| 1733 | { |
| 1734 | return CMD_WARNING; |
| 1735 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1736 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1737 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1738 | circuit->u.bc.pad_hellos = 0; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1739 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1740 | return CMD_SUCCESS; |
| 1741 | } |
| 1742 | |
| 1743 | DEFUN (csnp_interval, |
| 1744 | csnp_interval_cmd, |
| 1745 | "isis csnp-interval <0-65535>", |
| 1746 | "IS-IS commands\n" |
| 1747 | "Set CSNP interval in seconds\n" |
| 1748 | "CSNP interval value\n") |
| 1749 | { |
| 1750 | struct isis_circuit *circuit; |
| 1751 | struct interface *ifp; |
| 1752 | unsigned long interval; |
| 1753 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1754 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1755 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1756 | if (circuit == NULL) |
| 1757 | { |
| 1758 | return CMD_WARNING; |
| 1759 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1760 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1761 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1762 | interval = atol (argv[0]); |
| 1763 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1764 | circuit->csnp_interval[0] = (u_int16_t) interval; |
| 1765 | circuit->csnp_interval[1] = (u_int16_t) interval; |
| 1766 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1767 | return CMD_SUCCESS; |
| 1768 | } |
| 1769 | |
| 1770 | DEFUN (no_csnp_interval, |
| 1771 | no_csnp_interval_cmd, |
| 1772 | "no isis csnp-interval", |
| 1773 | NO_STR |
| 1774 | "IS-IS commands\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1775 | "Set CSNP interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1776 | { |
| 1777 | struct isis_circuit *circuit; |
| 1778 | struct interface *ifp; |
| 1779 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1780 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1781 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1782 | if (circuit == NULL) |
| 1783 | { |
| 1784 | return CMD_WARNING; |
| 1785 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1786 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1787 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1788 | circuit->csnp_interval[0] = CSNP_INTERVAL; |
| 1789 | circuit->csnp_interval[1] = CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1790 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1791 | return CMD_SUCCESS; |
| 1792 | } |
| 1793 | |
| 1794 | ALIAS (no_csnp_interval, |
| 1795 | no_csnp_interval_arg_cmd, |
| 1796 | "no isis csnp-interval <0-65535>", |
| 1797 | NO_STR |
| 1798 | "IS-IS commands\n" |
| 1799 | "Set CSNP interval in seconds\n" |
| 1800 | "CSNP interval value\n") |
| 1801 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1802 | DEFUN (csnp_interval_l1, |
| 1803 | csnp_interval_l1_cmd, |
| 1804 | "isis csnp-interval <0-65535> level-1", |
| 1805 | "IS-IS commands\n" |
| 1806 | "Set CSNP interval in seconds\n" |
| 1807 | "CSNP interval value\n" |
| 1808 | "Specify interval for level-1 CSNPs\n") |
| 1809 | { |
| 1810 | struct isis_circuit *circuit; |
| 1811 | struct interface *ifp; |
| 1812 | unsigned long interval; |
| 1813 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1814 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1815 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1816 | if (circuit == NULL) |
| 1817 | { |
| 1818 | return CMD_WARNING; |
| 1819 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1820 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1821 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1822 | interval = atol (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1823 | |
| 1824 | circuit->csnp_interval[0] = (u_int16_t) interval; |
| 1825 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1826 | return CMD_SUCCESS; |
| 1827 | } |
| 1828 | |
| 1829 | DEFUN (no_csnp_interval_l1, |
| 1830 | no_csnp_interval_l1_cmd, |
| 1831 | "no isis csnp-interval level-1", |
| 1832 | NO_STR |
| 1833 | "IS-IS commands\n" |
| 1834 | "Set CSNP interval in seconds\n" |
| 1835 | "Specify interval for level-1 CSNPs\n") |
| 1836 | { |
| 1837 | struct isis_circuit *circuit; |
| 1838 | struct interface *ifp; |
| 1839 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1840 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1841 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1842 | if (circuit == NULL) |
| 1843 | { |
| 1844 | return CMD_WARNING; |
| 1845 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1846 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1847 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1848 | circuit->csnp_interval[0] = CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1849 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1850 | return CMD_SUCCESS; |
| 1851 | } |
| 1852 | |
| 1853 | ALIAS (no_csnp_interval_l1, |
| 1854 | no_csnp_interval_l1_arg_cmd, |
| 1855 | "no isis csnp-interval <0-65535> level-1", |
| 1856 | NO_STR |
| 1857 | "IS-IS commands\n" |
| 1858 | "Set CSNP interval in seconds\n" |
| 1859 | "CSNP interval value\n" |
| 1860 | "Specify interval for level-1 CSNPs\n") |
| 1861 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1862 | DEFUN (csnp_interval_l2, |
| 1863 | csnp_interval_l2_cmd, |
| 1864 | "isis csnp-interval <0-65535> level-2", |
| 1865 | "IS-IS commands\n" |
| 1866 | "Set CSNP interval in seconds\n" |
| 1867 | "CSNP interval value\n" |
| 1868 | "Specify interval for level-2 CSNPs\n") |
| 1869 | { |
| 1870 | struct isis_circuit *circuit; |
| 1871 | struct interface *ifp; |
| 1872 | unsigned long interval; |
| 1873 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1874 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1875 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1876 | if (circuit == NULL) |
| 1877 | { |
| 1878 | return CMD_WARNING; |
| 1879 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1880 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1881 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1882 | interval = atol (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1883 | |
| 1884 | circuit->csnp_interval[1] = (u_int16_t) interval; |
| 1885 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1886 | return CMD_SUCCESS; |
| 1887 | } |
| 1888 | |
| 1889 | DEFUN (no_csnp_interval_l2, |
| 1890 | no_csnp_interval_l2_cmd, |
| 1891 | "no isis csnp-interval level-2", |
| 1892 | NO_STR |
| 1893 | "IS-IS commands\n" |
| 1894 | "Set CSNP interval in seconds\n" |
| 1895 | "Specify interval for level-2 CSNPs\n") |
| 1896 | { |
| 1897 | struct isis_circuit *circuit; |
| 1898 | struct interface *ifp; |
| 1899 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1900 | ifp = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1901 | circuit = ifp->info; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1902 | if (circuit == NULL) |
| 1903 | { |
| 1904 | return CMD_WARNING; |
| 1905 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1906 | assert (circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1907 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1908 | circuit->csnp_interval[1] = CSNP_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1909 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1910 | return CMD_SUCCESS; |
| 1911 | } |
| 1912 | |
| 1913 | ALIAS (no_csnp_interval_l2, |
| 1914 | no_csnp_interval_l2_arg_cmd, |
| 1915 | "no isis csnp-interval <0-65535> level-2", |
| 1916 | NO_STR |
| 1917 | "IS-IS commands\n" |
| 1918 | "Set CSNP interval in seconds\n" |
| 1919 | "CSNP interval value\n" |
| 1920 | "Specify interval for level-2 CSNPs\n") |
| 1921 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1922 | #ifdef HAVE_IPV6 |
| 1923 | DEFUN (ipv6_router_isis, |
| 1924 | ipv6_router_isis_cmd, |
| 1925 | "ipv6 router isis WORD", |
| 1926 | "IPv6 interface subcommands\n" |
| 1927 | "IPv6 Router interface commands\n" |
| 1928 | "IS-IS Routing for IPv6\n" |
| 1929 | "Routing process tag\n") |
| 1930 | { |
| 1931 | struct isis_circuit *c; |
| 1932 | struct interface *ifp; |
| 1933 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1934 | |
| 1935 | ifp = (struct interface *) vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1936 | assert (ifp); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1937 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1938 | area = isis_area_lookup (argv[0]); |
| 1939 | |
| 1940 | /* Prevent more than one circuit per interface */ |
| 1941 | if (area) |
| 1942 | c = circuit_lookup_by_ifp (ifp, area->circuit_list); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1943 | else |
| 1944 | c = NULL; |
| 1945 | |
| 1946 | if (c && (ifp->info != NULL)) |
| 1947 | { |
| 1948 | if (c->ipv6_router == 1) |
| 1949 | { |
| 1950 | vty_out (vty, "ISIS circuit is already defined for IPv6%s", |
| 1951 | VTY_NEWLINE); |
| 1952 | return CMD_WARNING; |
| 1953 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1954 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1955 | |
| 1956 | /* this is here for ciscopability */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1957 | if (!area) |
| 1958 | { |
| 1959 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 1960 | return CMD_WARNING; |
| 1961 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1962 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1963 | if (!c) |
| 1964 | { |
| 1965 | c = circuit_lookup_by_ifp (ifp, isis->init_circ_list); |
| 1966 | c = isis_csm_state_change (ISIS_ENABLE, c, area); |
| 1967 | c->interface = ifp; |
| 1968 | ifp->info = c; |
| 1969 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1970 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1971 | if (!c) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1972 | return CMD_WARNING; |
| 1973 | |
| 1974 | c->ipv6_router = 1; |
| 1975 | area->ipv6_circuits++; |
| 1976 | circuit_update_nlpids (c); |
| 1977 | |
| 1978 | vty->node = INTERFACE_NODE; |
| 1979 | |
| 1980 | return CMD_SUCCESS; |
| 1981 | } |
| 1982 | |
| 1983 | DEFUN (no_ipv6_router_isis, |
| 1984 | no_ipv6_router_isis_cmd, |
| 1985 | "no ipv6 router isis WORD", |
| 1986 | NO_STR |
| 1987 | "IPv6 interface subcommands\n" |
| 1988 | "IPv6 Router interface commands\n" |
| 1989 | "IS-IS Routing for IPv6\n" |
| 1990 | "Routing process tag\n") |
| 1991 | { |
| 1992 | struct isis_circuit *c; |
| 1993 | struct interface *ifp; |
| 1994 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1995 | |
| 1996 | ifp = (struct interface *) vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1997 | /* UGLY - will remove l8r |
| 1998 | if (circuit == NULL) { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1999 | return CMD_WARNING; |
| 2000 | } */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2001 | assert (ifp); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2002 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2003 | area = isis_area_lookup (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2004 | if (!area) |
| 2005 | { |
| 2006 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 2007 | return CMD_WARNING; |
| 2008 | } |
| 2009 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2010 | c = circuit_lookup_by_ifp (ifp, area->circuit_list); |
| 2011 | if (!c) |
| 2012 | return CMD_WARNING; |
| 2013 | |
| 2014 | c->ipv6_router = 0; |
| 2015 | area->ipv6_circuits--; |
| 2016 | if (c->ip_router == 0) |
| 2017 | isis_csm_state_change (ISIS_DISABLE, c, area); |
| 2018 | |
| 2019 | return CMD_SUCCESS; |
| 2020 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2021 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2022 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2023 | struct cmd_node interface_node = { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2024 | INTERFACE_NODE, |
| 2025 | "%s(config-if)# ", |
| 2026 | 1, |
| 2027 | }; |
| 2028 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2029 | int |
| 2030 | isis_if_new_hook (struct interface *ifp) |
| 2031 | { |
| 2032 | /* FIXME: Discuss if the circuit should be created here |
| 2033 | ifp->info = XMALLOC (MTYPE_ISIS_IF_INFO, sizeof (struct isis_if_info)); */ |
| 2034 | ifp->info = NULL; |
| 2035 | return 0; |
| 2036 | } |
| 2037 | |
| 2038 | int |
| 2039 | isis_if_delete_hook (struct interface *ifp) |
| 2040 | { |
| 2041 | /* FIXME: Discuss if the circuit should be created here |
| 2042 | XFREE (MTYPE_ISIS_IF_INFO, ifp->info);*/ |
| 2043 | ifp->info = NULL; |
| 2044 | return 0; |
| 2045 | } |
| 2046 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2047 | void |
| 2048 | isis_circuit_init () |
| 2049 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2050 | /* Initialize Zebra interface data structure */ |
| 2051 | if_init (); |
| 2052 | if_add_hook (IF_NEW_HOOK, isis_if_new_hook); |
| 2053 | if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook); |
| 2054 | |
| 2055 | /* Install interface node */ |
| 2056 | install_node (&interface_node, isis_interface_config_write); |
| 2057 | install_element (CONFIG_NODE, &interface_cmd); |
| 2058 | |
| 2059 | install_default (INTERFACE_NODE); |
| 2060 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 2061 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 2062 | |
| 2063 | install_element (INTERFACE_NODE, &ip_router_isis_cmd); |
| 2064 | install_element (INTERFACE_NODE, &no_ip_router_isis_cmd); |
| 2065 | |
| 2066 | install_element (INTERFACE_NODE, &isis_circuit_type_cmd); |
| 2067 | install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd); |
| 2068 | |
| 2069 | install_element (INTERFACE_NODE, &isis_passwd_cmd); |
| 2070 | install_element (INTERFACE_NODE, &no_isis_passwd_cmd); |
| 2071 | |
| 2072 | install_element (INTERFACE_NODE, &isis_priority_cmd); |
| 2073 | install_element (INTERFACE_NODE, &no_isis_priority_cmd); |
| 2074 | install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd); |
| 2075 | install_element (INTERFACE_NODE, &isis_priority_l1_cmd); |
| 2076 | install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd); |
| 2077 | install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd); |
| 2078 | install_element (INTERFACE_NODE, &isis_priority_l2_cmd); |
| 2079 | install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd); |
| 2080 | install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd); |
| 2081 | |
| 2082 | install_element (INTERFACE_NODE, &isis_metric_cmd); |
| 2083 | install_element (INTERFACE_NODE, &no_isis_metric_cmd); |
| 2084 | install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd); |
| 2085 | |
| 2086 | install_element (INTERFACE_NODE, &isis_hello_interval_cmd); |
| 2087 | install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd); |
| 2088 | install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd); |
| 2089 | install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd); |
| 2090 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd); |
| 2091 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd); |
| 2092 | install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd); |
| 2093 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd); |
| 2094 | install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd); |
| 2095 | |
| 2096 | install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd); |
| 2097 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd); |
| 2098 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd); |
| 2099 | install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd); |
| 2100 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd); |
| 2101 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd); |
| 2102 | install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd); |
| 2103 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd); |
| 2104 | install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd); |
| 2105 | |
| 2106 | install_element (INTERFACE_NODE, &isis_hello_cmd); |
| 2107 | install_element (INTERFACE_NODE, &no_isis_hello_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2108 | install_element (INTERFACE_NODE, &csnp_interval_cmd); |
| 2109 | install_element (INTERFACE_NODE, &no_csnp_interval_cmd); |
| 2110 | install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd); |
| 2111 | install_element (INTERFACE_NODE, &csnp_interval_l1_cmd); |
| 2112 | install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd); |
| 2113 | install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd); |
| 2114 | install_element (INTERFACE_NODE, &csnp_interval_l2_cmd); |
| 2115 | install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd); |
| 2116 | install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd); |
| 2117 | |
| 2118 | #ifdef HAVE_IPV6 |
| 2119 | install_element (INTERFACE_NODE, &ipv6_router_isis_cmd); |
| 2120 | install_element (INTERFACE_NODE, &no_ipv6_router_isis_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2121 | #endif |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2122 | } |