paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* BGP VTY interface. |
| 2 | Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro |
| 3 | |
| 4 | This file is part of GNU Zebra. |
| 5 | |
| 6 | GNU Zebra is free software; you can redistribute it and/or modify it |
| 7 | under the terms of the GNU General Public License as published by the |
| 8 | Free Software Foundation; either version 2, or (at your option) any |
| 9 | later version. |
| 10 | |
| 11 | GNU Zebra is distributed in the hope that it will be useful, but |
| 12 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with GNU Zebra; see the file COPYING. If not, write to the Free |
| 18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 19 | 02111-1307, USA. */ |
| 20 | |
| 21 | #include <zebra.h> |
| 22 | |
| 23 | #include "command.h" |
| 24 | #include "prefix.h" |
| 25 | #include "plist.h" |
| 26 | #include "buffer.h" |
| 27 | #include "linklist.h" |
| 28 | #include "stream.h" |
| 29 | #include "thread.h" |
| 30 | #include "log.h" |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 31 | #include "memory.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 32 | |
| 33 | #include "bgpd/bgpd.h" |
| 34 | #include "bgpd/bgp_attr.h" |
| 35 | #include "bgpd/bgp_aspath.h" |
| 36 | #include "bgpd/bgp_community.h" |
| 37 | #include "bgpd/bgp_debug.h" |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 38 | #include "bgpd/bgp_fsm.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 39 | #include "bgpd/bgp_mplsvpn.h" |
| 40 | #include "bgpd/bgp_open.h" |
| 41 | #include "bgpd/bgp_route.h" |
| 42 | #include "bgpd/bgp_zebra.h" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 43 | #include "bgpd/bgp_table.h" |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 44 | #include "bgpd/bgp_vty.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 45 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 46 | extern struct in_addr router_id_zebra; |
| 47 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 48 | /* Utility function to get address family from current node. */ |
| 49 | afi_t |
| 50 | bgp_node_afi (struct vty *vty) |
| 51 | { |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 52 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 53 | return AFI_IP6; |
| 54 | return AFI_IP; |
| 55 | } |
| 56 | |
| 57 | /* Utility function to get subsequent address family from current |
| 58 | node. */ |
| 59 | safi_t |
| 60 | bgp_node_safi (struct vty *vty) |
| 61 | { |
| 62 | if (vty->node == BGP_VPNV4_NODE) |
| 63 | return SAFI_MPLS_VPN; |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 64 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 65 | return SAFI_MULTICAST; |
| 66 | return SAFI_UNICAST; |
| 67 | } |
| 68 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 69 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 70 | peer_address_self_check (union sockunion *su) |
| 71 | { |
| 72 | struct interface *ifp = NULL; |
| 73 | |
| 74 | if (su->sa.sa_family == AF_INET) |
| 75 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); |
| 76 | #ifdef HAVE_IPV6 |
| 77 | else if (su->sa.sa_family == AF_INET6) |
| 78 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); |
| 79 | #endif /* HAVE IPV6 */ |
| 80 | |
| 81 | if (ifp) |
| 82 | return 1; |
| 83 | |
| 84 | return 0; |
| 85 | } |
| 86 | |
| 87 | /* Utility function for looking up peer from VTY. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 88 | static struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 89 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 90 | { |
| 91 | int ret; |
| 92 | struct bgp *bgp; |
| 93 | union sockunion su; |
| 94 | struct peer *peer; |
| 95 | |
| 96 | bgp = vty->index; |
| 97 | |
| 98 | ret = str2sockunion (ip_str, &su); |
| 99 | if (ret < 0) |
| 100 | { |
| 101 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 102 | return NULL; |
| 103 | } |
| 104 | |
| 105 | peer = peer_lookup (bgp, &su); |
| 106 | if (! peer) |
| 107 | { |
| 108 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE); |
| 109 | return NULL; |
| 110 | } |
| 111 | return peer; |
| 112 | } |
| 113 | |
| 114 | /* Utility function for looking up peer or peer group. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 115 | static struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 116 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 117 | { |
| 118 | int ret; |
| 119 | struct bgp *bgp; |
| 120 | union sockunion su; |
| 121 | struct peer *peer; |
| 122 | struct peer_group *group; |
| 123 | |
| 124 | bgp = vty->index; |
| 125 | |
| 126 | ret = str2sockunion (peer_str, &su); |
| 127 | if (ret == 0) |
| 128 | { |
| 129 | peer = peer_lookup (bgp, &su); |
| 130 | if (peer) |
| 131 | return peer; |
| 132 | } |
| 133 | else |
| 134 | { |
| 135 | group = peer_group_lookup (bgp, peer_str); |
| 136 | if (group) |
| 137 | return group->conf; |
| 138 | } |
| 139 | |
| 140 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
| 141 | VTY_NEWLINE); |
| 142 | |
| 143 | return NULL; |
| 144 | } |
| 145 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 146 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 147 | bgp_vty_return (struct vty *vty, int ret) |
| 148 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 149 | const char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 150 | |
| 151 | switch (ret) |
| 152 | { |
| 153 | case BGP_ERR_INVALID_VALUE: |
| 154 | str = "Invalid value"; |
| 155 | break; |
| 156 | case BGP_ERR_INVALID_FLAG: |
| 157 | str = "Invalid flag"; |
| 158 | break; |
| 159 | case BGP_ERR_PEER_INACTIVE: |
| 160 | str = "Activate the neighbor for the address family first"; |
| 161 | break; |
| 162 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: |
| 163 | str = "Invalid command for a peer-group member"; |
| 164 | break; |
| 165 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
| 166 | str = "Peer-group has been shutdown. Activate the peer-group first"; |
| 167 | break; |
| 168 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: |
| 169 | str = "This peer is a peer-group member. Please change peer-group configuration"; |
| 170 | break; |
| 171 | case BGP_ERR_PEER_FLAG_CONFLICT: |
| 172 | str = "Can't set override-capability and strict-capability-match at the same time"; |
| 173 | break; |
| 174 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: |
| 175 | str = "No activate for peergroup can be given only if peer-group has no members"; |
| 176 | break; |
| 177 | case BGP_ERR_PEER_BELONGS_TO_GROUP: |
| 178 | str = "No activate for an individual peer-group member is invalid"; |
| 179 | break; |
| 180 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: |
| 181 | str = "Activate the peer-group for the address family first"; |
| 182 | break; |
| 183 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
| 184 | str = "Specify remote-as or peer-group remote AS first"; |
| 185 | break; |
| 186 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: |
| 187 | str = "Cannot change the peer-group. Deconfigure first"; |
| 188 | break; |
| 189 | case BGP_ERR_PEER_GROUP_MISMATCH: |
| 190 | str = "Cannot have different peer-group for the neighbor"; |
| 191 | break; |
| 192 | case BGP_ERR_PEER_FILTER_CONFLICT: |
| 193 | str = "Prefix/distribute list can not co-exist"; |
| 194 | break; |
| 195 | case BGP_ERR_NOT_INTERNAL_PEER: |
| 196 | str = "Invalid command. Not an internal neighbor"; |
| 197 | break; |
| 198 | case BGP_ERR_REMOVE_PRIVATE_AS: |
| 199 | str = "Private AS cannot be removed for IBGP peers"; |
| 200 | break; |
| 201 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: |
| 202 | str = "Local-AS allowed only for EBGP peers"; |
| 203 | break; |
| 204 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: |
| 205 | str = "Cannot have local-as same as BGP AS number"; |
| 206 | break; |
| 207 | } |
| 208 | if (str) |
| 209 | { |
| 210 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); |
| 211 | return CMD_WARNING; |
| 212 | } |
| 213 | return CMD_SUCCESS; |
| 214 | } |
| 215 | |
| 216 | /* BGP global configuration. */ |
| 217 | |
| 218 | DEFUN (bgp_multiple_instance_func, |
| 219 | bgp_multiple_instance_cmd, |
| 220 | "bgp multiple-instance", |
| 221 | BGP_STR |
| 222 | "Enable bgp multiple instance\n") |
| 223 | { |
| 224 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); |
| 225 | return CMD_SUCCESS; |
| 226 | } |
| 227 | |
| 228 | DEFUN (no_bgp_multiple_instance, |
| 229 | no_bgp_multiple_instance_cmd, |
| 230 | "no bgp multiple-instance", |
| 231 | NO_STR |
| 232 | BGP_STR |
| 233 | "BGP multiple instance\n") |
| 234 | { |
| 235 | int ret; |
| 236 | |
| 237 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); |
| 238 | if (ret < 0) |
| 239 | { |
| 240 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); |
| 241 | return CMD_WARNING; |
| 242 | } |
| 243 | return CMD_SUCCESS; |
| 244 | } |
| 245 | |
| 246 | DEFUN (bgp_config_type, |
| 247 | bgp_config_type_cmd, |
| 248 | "bgp config-type (cisco|zebra)", |
| 249 | BGP_STR |
| 250 | "Configuration type\n" |
| 251 | "cisco\n" |
| 252 | "zebra\n") |
| 253 | { |
| 254 | if (strncmp (argv[0], "c", 1) == 0) |
| 255 | bgp_option_set (BGP_OPT_CONFIG_CISCO); |
| 256 | else |
| 257 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 258 | |
| 259 | return CMD_SUCCESS; |
| 260 | } |
| 261 | |
| 262 | DEFUN (no_bgp_config_type, |
| 263 | no_bgp_config_type_cmd, |
| 264 | "no bgp config-type", |
| 265 | NO_STR |
| 266 | BGP_STR |
| 267 | "Display configuration type\n") |
| 268 | { |
| 269 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 270 | return CMD_SUCCESS; |
| 271 | } |
| 272 | |
| 273 | DEFUN (no_synchronization, |
| 274 | no_synchronization_cmd, |
| 275 | "no synchronization", |
| 276 | NO_STR |
| 277 | "Perform IGP synchronization\n") |
| 278 | { |
| 279 | return CMD_SUCCESS; |
| 280 | } |
| 281 | |
| 282 | DEFUN (no_auto_summary, |
| 283 | no_auto_summary_cmd, |
| 284 | "no auto-summary", |
| 285 | NO_STR |
| 286 | "Enable automatic network number summarization\n") |
| 287 | { |
| 288 | return CMD_SUCCESS; |
| 289 | } |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 290 | |
| 291 | DEFUN_DEPRECATED (neighbor_version, |
| 292 | neighbor_version_cmd, |
| 293 | NEIGHBOR_CMD "version (4|4-)", |
| 294 | NEIGHBOR_STR |
| 295 | NEIGHBOR_ADDR_STR |
| 296 | "Set the BGP version to match a neighbor\n" |
| 297 | "Neighbor's BGP version\n") |
| 298 | { |
| 299 | return CMD_SUCCESS; |
| 300 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 301 | |
| 302 | /* "router bgp" commands. */ |
| 303 | DEFUN (router_bgp, |
| 304 | router_bgp_cmd, |
| 305 | "router bgp <1-65535>", |
| 306 | ROUTER_STR |
| 307 | BGP_STR |
| 308 | AS_STR) |
| 309 | { |
| 310 | int ret; |
| 311 | as_t as; |
| 312 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 313 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 314 | |
| 315 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535); |
| 316 | |
| 317 | if (argc == 2) |
| 318 | name = argv[1]; |
| 319 | |
| 320 | ret = bgp_get (&bgp, &as, name); |
| 321 | switch (ret) |
| 322 | { |
| 323 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: |
| 324 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", |
| 325 | VTY_NEWLINE); |
| 326 | return CMD_WARNING; |
| 327 | break; |
| 328 | case BGP_ERR_AS_MISMATCH: |
| 329 | vty_out (vty, "BGP is already running; AS is %d%s", as, VTY_NEWLINE); |
| 330 | return CMD_WARNING; |
| 331 | break; |
| 332 | case BGP_ERR_INSTANCE_MISMATCH: |
| 333 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); |
| 334 | vty_out (vty, "BGP instance is already running; AS is %d%s", |
| 335 | as, VTY_NEWLINE); |
| 336 | return CMD_WARNING; |
| 337 | break; |
| 338 | } |
| 339 | |
| 340 | vty->node = BGP_NODE; |
| 341 | vty->index = bgp; |
| 342 | |
| 343 | return CMD_SUCCESS; |
| 344 | } |
| 345 | |
| 346 | ALIAS (router_bgp, |
| 347 | router_bgp_view_cmd, |
| 348 | "router bgp <1-65535> view WORD", |
| 349 | ROUTER_STR |
| 350 | BGP_STR |
| 351 | AS_STR |
| 352 | "BGP view\n" |
| 353 | "view name\n") |
| 354 | |
| 355 | /* "no router bgp" commands. */ |
| 356 | DEFUN (no_router_bgp, |
| 357 | no_router_bgp_cmd, |
| 358 | "no router bgp <1-65535>", |
| 359 | NO_STR |
| 360 | ROUTER_STR |
| 361 | BGP_STR |
| 362 | AS_STR) |
| 363 | { |
| 364 | as_t as; |
| 365 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 366 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 367 | |
| 368 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535); |
| 369 | |
| 370 | if (argc == 2) |
| 371 | name = argv[1]; |
| 372 | |
| 373 | /* Lookup bgp structure. */ |
| 374 | bgp = bgp_lookup (as, name); |
| 375 | if (! bgp) |
| 376 | { |
| 377 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); |
| 378 | return CMD_WARNING; |
| 379 | } |
| 380 | |
| 381 | bgp_delete (bgp); |
| 382 | |
| 383 | return CMD_SUCCESS; |
| 384 | } |
| 385 | |
| 386 | ALIAS (no_router_bgp, |
| 387 | no_router_bgp_view_cmd, |
| 388 | "no router bgp <1-65535> view WORD", |
| 389 | NO_STR |
| 390 | ROUTER_STR |
| 391 | BGP_STR |
| 392 | AS_STR |
| 393 | "BGP view\n" |
| 394 | "view name\n") |
| 395 | |
| 396 | /* BGP router-id. */ |
| 397 | |
| 398 | DEFUN (bgp_router_id, |
| 399 | bgp_router_id_cmd, |
| 400 | "bgp router-id A.B.C.D", |
| 401 | BGP_STR |
| 402 | "Override configured router identifier\n" |
| 403 | "Manually configured router identifier\n") |
| 404 | { |
| 405 | int ret; |
| 406 | struct in_addr id; |
| 407 | struct bgp *bgp; |
| 408 | |
| 409 | bgp = vty->index; |
| 410 | |
| 411 | ret = inet_aton (argv[0], &id); |
| 412 | if (! ret) |
| 413 | { |
| 414 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); |
| 415 | return CMD_WARNING; |
| 416 | } |
| 417 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 418 | bgp->router_id_static = id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 419 | bgp_router_id_set (bgp, &id); |
| 420 | |
| 421 | return CMD_SUCCESS; |
| 422 | } |
| 423 | |
| 424 | DEFUN (no_bgp_router_id, |
| 425 | no_bgp_router_id_cmd, |
| 426 | "no bgp router-id", |
| 427 | NO_STR |
| 428 | BGP_STR |
| 429 | "Override configured router identifier\n") |
| 430 | { |
| 431 | int ret; |
| 432 | struct in_addr id; |
| 433 | struct bgp *bgp; |
| 434 | |
| 435 | bgp = vty->index; |
| 436 | |
| 437 | if (argc == 1) |
| 438 | { |
| 439 | ret = inet_aton (argv[0], &id); |
| 440 | if (! ret) |
| 441 | { |
| 442 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); |
| 443 | return CMD_WARNING; |
| 444 | } |
| 445 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 446 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 447 | { |
| 448 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); |
| 449 | return CMD_WARNING; |
| 450 | } |
| 451 | } |
| 452 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 453 | bgp->router_id_static.s_addr = 0; |
| 454 | bgp_router_id_set (bgp, &router_id_zebra); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 455 | |
| 456 | return CMD_SUCCESS; |
| 457 | } |
| 458 | |
| 459 | ALIAS (no_bgp_router_id, |
| 460 | no_bgp_router_id_val_cmd, |
| 461 | "no bgp router-id A.B.C.D", |
| 462 | NO_STR |
| 463 | BGP_STR |
| 464 | "Override configured router identifier\n" |
| 465 | "Manually configured router identifier\n") |
| 466 | |
| 467 | /* BGP Cluster ID. */ |
| 468 | |
| 469 | DEFUN (bgp_cluster_id, |
| 470 | bgp_cluster_id_cmd, |
| 471 | "bgp cluster-id A.B.C.D", |
| 472 | BGP_STR |
| 473 | "Configure Route-Reflector Cluster-id\n" |
| 474 | "Route-Reflector Cluster-id in IP address format\n") |
| 475 | { |
| 476 | int ret; |
| 477 | struct bgp *bgp; |
| 478 | struct in_addr cluster; |
| 479 | |
| 480 | bgp = vty->index; |
| 481 | |
| 482 | ret = inet_aton (argv[0], &cluster); |
| 483 | if (! ret) |
| 484 | { |
| 485 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 486 | return CMD_WARNING; |
| 487 | } |
| 488 | |
| 489 | bgp_cluster_id_set (bgp, &cluster); |
| 490 | |
| 491 | return CMD_SUCCESS; |
| 492 | } |
| 493 | |
| 494 | ALIAS (bgp_cluster_id, |
| 495 | bgp_cluster_id32_cmd, |
| 496 | "bgp cluster-id <1-4294967295>", |
| 497 | BGP_STR |
| 498 | "Configure Route-Reflector Cluster-id\n" |
| 499 | "Route-Reflector Cluster-id as 32 bit quantity\n") |
| 500 | |
| 501 | DEFUN (no_bgp_cluster_id, |
| 502 | no_bgp_cluster_id_cmd, |
| 503 | "no bgp cluster-id", |
| 504 | NO_STR |
| 505 | BGP_STR |
| 506 | "Configure Route-Reflector Cluster-id\n") |
| 507 | { |
| 508 | int ret; |
| 509 | struct bgp *bgp; |
| 510 | struct in_addr cluster; |
| 511 | |
| 512 | bgp = vty->index; |
| 513 | |
| 514 | if (argc == 1) |
| 515 | { |
| 516 | ret = inet_aton (argv[0], &cluster); |
| 517 | if (! ret) |
| 518 | { |
| 519 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 520 | return CMD_WARNING; |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | bgp_cluster_id_unset (bgp); |
| 525 | |
| 526 | return CMD_SUCCESS; |
| 527 | } |
| 528 | |
| 529 | ALIAS (no_bgp_cluster_id, |
| 530 | no_bgp_cluster_id_arg_cmd, |
| 531 | "no bgp cluster-id A.B.C.D", |
| 532 | NO_STR |
| 533 | BGP_STR |
| 534 | "Configure Route-Reflector Cluster-id\n" |
| 535 | "Route-Reflector Cluster-id in IP address format\n") |
| 536 | |
| 537 | DEFUN (bgp_confederation_identifier, |
| 538 | bgp_confederation_identifier_cmd, |
| 539 | "bgp confederation identifier <1-65535>", |
| 540 | "BGP specific commands\n" |
| 541 | "AS confederation parameters\n" |
| 542 | "AS number\n" |
| 543 | "Set routing domain confederation AS\n") |
| 544 | { |
| 545 | struct bgp *bgp; |
| 546 | as_t as; |
| 547 | |
| 548 | bgp = vty->index; |
| 549 | |
| 550 | VTY_GET_INTEGER ("AS", as, argv[0]); |
| 551 | |
| 552 | bgp_confederation_id_set (bgp, as); |
| 553 | |
| 554 | return CMD_SUCCESS; |
| 555 | } |
| 556 | |
| 557 | DEFUN (no_bgp_confederation_identifier, |
| 558 | no_bgp_confederation_identifier_cmd, |
| 559 | "no bgp confederation identifier", |
| 560 | NO_STR |
| 561 | "BGP specific commands\n" |
| 562 | "AS confederation parameters\n" |
| 563 | "AS number\n") |
| 564 | { |
| 565 | struct bgp *bgp; |
| 566 | as_t as; |
| 567 | |
| 568 | bgp = vty->index; |
| 569 | |
| 570 | if (argc == 1) |
| 571 | VTY_GET_INTEGER ("AS", as, argv[0]); |
| 572 | |
| 573 | bgp_confederation_id_unset (bgp); |
| 574 | |
| 575 | return CMD_SUCCESS; |
| 576 | } |
| 577 | |
| 578 | ALIAS (no_bgp_confederation_identifier, |
| 579 | no_bgp_confederation_identifier_arg_cmd, |
| 580 | "no bgp confederation identifier <1-65535>", |
| 581 | NO_STR |
| 582 | "BGP specific commands\n" |
| 583 | "AS confederation parameters\n" |
| 584 | "AS number\n" |
| 585 | "Set routing domain confederation AS\n") |
| 586 | |
| 587 | DEFUN (bgp_confederation_peers, |
| 588 | bgp_confederation_peers_cmd, |
| 589 | "bgp confederation peers .<1-65535>", |
| 590 | "BGP specific commands\n" |
| 591 | "AS confederation parameters\n" |
| 592 | "Peer ASs in BGP confederation\n" |
| 593 | AS_STR) |
| 594 | { |
| 595 | struct bgp *bgp; |
| 596 | as_t as; |
| 597 | int i; |
| 598 | |
| 599 | bgp = vty->index; |
| 600 | |
| 601 | for (i = 0; i < argc; i++) |
| 602 | { |
| 603 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, 65535); |
| 604 | |
| 605 | if (bgp->as == as) |
| 606 | { |
| 607 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", |
| 608 | VTY_NEWLINE); |
| 609 | continue; |
| 610 | } |
| 611 | |
| 612 | bgp_confederation_peers_add (bgp, as); |
| 613 | } |
| 614 | return CMD_SUCCESS; |
| 615 | } |
| 616 | |
| 617 | DEFUN (no_bgp_confederation_peers, |
| 618 | no_bgp_confederation_peers_cmd, |
| 619 | "no bgp confederation peers .<1-65535>", |
| 620 | NO_STR |
| 621 | "BGP specific commands\n" |
| 622 | "AS confederation parameters\n" |
| 623 | "Peer ASs in BGP confederation\n" |
| 624 | AS_STR) |
| 625 | { |
| 626 | struct bgp *bgp; |
| 627 | as_t as; |
| 628 | int i; |
| 629 | |
| 630 | bgp = vty->index; |
| 631 | |
| 632 | for (i = 0; i < argc; i++) |
| 633 | { |
| 634 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, 65535); |
| 635 | |
| 636 | bgp_confederation_peers_remove (bgp, as); |
| 637 | } |
| 638 | return CMD_SUCCESS; |
| 639 | } |
| 640 | |
| 641 | /* BGP timers. */ |
| 642 | |
| 643 | DEFUN (bgp_timers, |
| 644 | bgp_timers_cmd, |
| 645 | "timers bgp <0-65535> <0-65535>", |
| 646 | "Adjust routing timers\n" |
| 647 | "BGP timers\n" |
| 648 | "Keepalive interval\n" |
| 649 | "Holdtime\n") |
| 650 | { |
| 651 | struct bgp *bgp; |
| 652 | unsigned long keepalive = 0; |
| 653 | unsigned long holdtime = 0; |
| 654 | |
| 655 | bgp = vty->index; |
| 656 | |
| 657 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); |
| 658 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); |
| 659 | |
| 660 | /* Holdtime value check. */ |
| 661 | if (holdtime < 3 && holdtime != 0) |
| 662 | { |
| 663 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", |
| 664 | VTY_NEWLINE); |
| 665 | return CMD_WARNING; |
| 666 | } |
| 667 | |
| 668 | bgp_timers_set (bgp, keepalive, holdtime); |
| 669 | |
| 670 | return CMD_SUCCESS; |
| 671 | } |
| 672 | |
| 673 | DEFUN (no_bgp_timers, |
| 674 | no_bgp_timers_cmd, |
| 675 | "no timers bgp", |
| 676 | NO_STR |
| 677 | "Adjust routing timers\n" |
| 678 | "BGP timers\n") |
| 679 | { |
| 680 | struct bgp *bgp; |
| 681 | |
| 682 | bgp = vty->index; |
| 683 | bgp_timers_unset (bgp); |
| 684 | |
| 685 | return CMD_SUCCESS; |
| 686 | } |
| 687 | |
| 688 | ALIAS (no_bgp_timers, |
| 689 | no_bgp_timers_arg_cmd, |
| 690 | "no timers bgp <0-65535> <0-65535>", |
| 691 | NO_STR |
| 692 | "Adjust routing timers\n" |
| 693 | "BGP timers\n" |
| 694 | "Keepalive interval\n" |
| 695 | "Holdtime\n") |
| 696 | |
| 697 | DEFUN (bgp_client_to_client_reflection, |
| 698 | bgp_client_to_client_reflection_cmd, |
| 699 | "bgp client-to-client reflection", |
| 700 | "BGP specific commands\n" |
| 701 | "Configure client to client route reflection\n" |
| 702 | "reflection of routes allowed\n") |
| 703 | { |
| 704 | struct bgp *bgp; |
| 705 | |
| 706 | bgp = vty->index; |
| 707 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 708 | return CMD_SUCCESS; |
| 709 | } |
| 710 | |
| 711 | DEFUN (no_bgp_client_to_client_reflection, |
| 712 | no_bgp_client_to_client_reflection_cmd, |
| 713 | "no bgp client-to-client reflection", |
| 714 | NO_STR |
| 715 | "BGP specific commands\n" |
| 716 | "Configure client to client route reflection\n" |
| 717 | "reflection of routes allowed\n") |
| 718 | { |
| 719 | struct bgp *bgp; |
| 720 | |
| 721 | bgp = vty->index; |
| 722 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 723 | return CMD_SUCCESS; |
| 724 | } |
| 725 | |
| 726 | /* "bgp always-compare-med" configuration. */ |
| 727 | DEFUN (bgp_always_compare_med, |
| 728 | bgp_always_compare_med_cmd, |
| 729 | "bgp always-compare-med", |
| 730 | "BGP specific commands\n" |
| 731 | "Allow comparing MED from different neighbors\n") |
| 732 | { |
| 733 | struct bgp *bgp; |
| 734 | |
| 735 | bgp = vty->index; |
| 736 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 737 | return CMD_SUCCESS; |
| 738 | } |
| 739 | |
| 740 | DEFUN (no_bgp_always_compare_med, |
| 741 | no_bgp_always_compare_med_cmd, |
| 742 | "no bgp always-compare-med", |
| 743 | NO_STR |
| 744 | "BGP specific commands\n" |
| 745 | "Allow comparing MED from different neighbors\n") |
| 746 | { |
| 747 | struct bgp *bgp; |
| 748 | |
| 749 | bgp = vty->index; |
| 750 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 751 | return CMD_SUCCESS; |
| 752 | } |
| 753 | |
| 754 | /* "bgp deterministic-med" configuration. */ |
| 755 | DEFUN (bgp_deterministic_med, |
| 756 | bgp_deterministic_med_cmd, |
| 757 | "bgp deterministic-med", |
| 758 | "BGP specific commands\n" |
| 759 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 760 | { |
| 761 | struct bgp *bgp; |
| 762 | |
| 763 | bgp = vty->index; |
| 764 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 765 | return CMD_SUCCESS; |
| 766 | } |
| 767 | |
| 768 | DEFUN (no_bgp_deterministic_med, |
| 769 | no_bgp_deterministic_med_cmd, |
| 770 | "no bgp deterministic-med", |
| 771 | NO_STR |
| 772 | "BGP specific commands\n" |
| 773 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 774 | { |
| 775 | struct bgp *bgp; |
| 776 | |
| 777 | bgp = vty->index; |
| 778 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 779 | return CMD_SUCCESS; |
| 780 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 781 | |
| 782 | /* "bgp graceful-restart" configuration. */ |
| 783 | DEFUN (bgp_graceful_restart, |
| 784 | bgp_graceful_restart_cmd, |
| 785 | "bgp graceful-restart", |
| 786 | "BGP specific commands\n" |
| 787 | "Graceful restart capability parameters\n") |
| 788 | { |
| 789 | struct bgp *bgp; |
| 790 | |
| 791 | bgp = vty->index; |
| 792 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 793 | return CMD_SUCCESS; |
| 794 | } |
| 795 | |
| 796 | DEFUN (no_bgp_graceful_restart, |
| 797 | no_bgp_graceful_restart_cmd, |
| 798 | "no bgp graceful-restart", |
| 799 | NO_STR |
| 800 | "BGP specific commands\n" |
| 801 | "Graceful restart capability parameters\n") |
| 802 | { |
| 803 | struct bgp *bgp; |
| 804 | |
| 805 | bgp = vty->index; |
| 806 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 807 | return CMD_SUCCESS; |
| 808 | } |
| 809 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 810 | DEFUN (bgp_graceful_restart_stalepath_time, |
| 811 | bgp_graceful_restart_stalepath_time_cmd, |
| 812 | "bgp graceful-restart stalepath-time <1-3600>", |
| 813 | "BGP specific commands\n" |
| 814 | "Graceful restart capability parameters\n" |
| 815 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 816 | "Delay value (seconds)\n") |
| 817 | { |
| 818 | struct bgp *bgp; |
| 819 | u_int32_t stalepath; |
| 820 | |
| 821 | bgp = vty->index; |
| 822 | if (! bgp) |
| 823 | return CMD_WARNING; |
| 824 | |
| 825 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); |
| 826 | bgp->stalepath_time = stalepath; |
| 827 | return CMD_SUCCESS; |
| 828 | } |
| 829 | |
| 830 | DEFUN (no_bgp_graceful_restart_stalepath_time, |
| 831 | no_bgp_graceful_restart_stalepath_time_cmd, |
| 832 | "no bgp graceful-restart stalepath-time", |
| 833 | NO_STR |
| 834 | "BGP specific commands\n" |
| 835 | "Graceful restart capability parameters\n" |
| 836 | "Set the max time to hold onto restarting peer's stale paths\n") |
| 837 | { |
| 838 | struct bgp *bgp; |
| 839 | |
| 840 | bgp = vty->index; |
| 841 | if (! bgp) |
| 842 | return CMD_WARNING; |
| 843 | |
| 844 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; |
| 845 | return CMD_SUCCESS; |
| 846 | } |
| 847 | |
| 848 | ALIAS (no_bgp_graceful_restart_stalepath_time, |
| 849 | no_bgp_graceful_restart_stalepath_time_val_cmd, |
| 850 | "no bgp graceful-restart stalepath-time <1-3600>", |
| 851 | NO_STR |
| 852 | "BGP specific commands\n" |
| 853 | "Graceful restart capability parameters\n" |
| 854 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 855 | "Delay value (seconds)\n") |
| 856 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 857 | /* "bgp fast-external-failover" configuration. */ |
| 858 | DEFUN (bgp_fast_external_failover, |
| 859 | bgp_fast_external_failover_cmd, |
| 860 | "bgp fast-external-failover", |
| 861 | BGP_STR |
| 862 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 863 | { |
| 864 | struct bgp *bgp; |
| 865 | |
| 866 | bgp = vty->index; |
| 867 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 868 | return CMD_SUCCESS; |
| 869 | } |
| 870 | |
| 871 | DEFUN (no_bgp_fast_external_failover, |
| 872 | no_bgp_fast_external_failover_cmd, |
| 873 | "no bgp fast-external-failover", |
| 874 | NO_STR |
| 875 | BGP_STR |
| 876 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 877 | { |
| 878 | struct bgp *bgp; |
| 879 | |
| 880 | bgp = vty->index; |
| 881 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 882 | return CMD_SUCCESS; |
| 883 | } |
| 884 | |
| 885 | /* "bgp enforce-first-as" configuration. */ |
| 886 | DEFUN (bgp_enforce_first_as, |
| 887 | bgp_enforce_first_as_cmd, |
| 888 | "bgp enforce-first-as", |
| 889 | BGP_STR |
| 890 | "Enforce the first AS for EBGP routes\n") |
| 891 | { |
| 892 | struct bgp *bgp; |
| 893 | |
| 894 | bgp = vty->index; |
| 895 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 896 | return CMD_SUCCESS; |
| 897 | } |
| 898 | |
| 899 | DEFUN (no_bgp_enforce_first_as, |
| 900 | no_bgp_enforce_first_as_cmd, |
| 901 | "no bgp enforce-first-as", |
| 902 | NO_STR |
| 903 | BGP_STR |
| 904 | "Enforce the first AS for EBGP routes\n") |
| 905 | { |
| 906 | struct bgp *bgp; |
| 907 | |
| 908 | bgp = vty->index; |
| 909 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 910 | return CMD_SUCCESS; |
| 911 | } |
| 912 | |
| 913 | /* "bgp bestpath compare-routerid" configuration. */ |
| 914 | DEFUN (bgp_bestpath_compare_router_id, |
| 915 | bgp_bestpath_compare_router_id_cmd, |
| 916 | "bgp bestpath compare-routerid", |
| 917 | "BGP specific commands\n" |
| 918 | "Change the default bestpath selection\n" |
| 919 | "Compare router-id for identical EBGP paths\n") |
| 920 | { |
| 921 | struct bgp *bgp; |
| 922 | |
| 923 | bgp = vty->index; |
| 924 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 925 | return CMD_SUCCESS; |
| 926 | } |
| 927 | |
| 928 | DEFUN (no_bgp_bestpath_compare_router_id, |
| 929 | no_bgp_bestpath_compare_router_id_cmd, |
| 930 | "no bgp bestpath compare-routerid", |
| 931 | NO_STR |
| 932 | "BGP specific commands\n" |
| 933 | "Change the default bestpath selection\n" |
| 934 | "Compare router-id for identical EBGP paths\n") |
| 935 | { |
| 936 | struct bgp *bgp; |
| 937 | |
| 938 | bgp = vty->index; |
| 939 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 940 | return CMD_SUCCESS; |
| 941 | } |
| 942 | |
| 943 | /* "bgp bestpath as-path ignore" configuration. */ |
| 944 | DEFUN (bgp_bestpath_aspath_ignore, |
| 945 | bgp_bestpath_aspath_ignore_cmd, |
| 946 | "bgp bestpath as-path ignore", |
| 947 | "BGP specific commands\n" |
| 948 | "Change the default bestpath selection\n" |
| 949 | "AS-path attribute\n" |
| 950 | "Ignore as-path length in selecting a route\n") |
| 951 | { |
| 952 | struct bgp *bgp; |
| 953 | |
| 954 | bgp = vty->index; |
| 955 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 956 | return CMD_SUCCESS; |
| 957 | } |
| 958 | |
| 959 | DEFUN (no_bgp_bestpath_aspath_ignore, |
| 960 | no_bgp_bestpath_aspath_ignore_cmd, |
| 961 | "no bgp bestpath as-path ignore", |
| 962 | NO_STR |
| 963 | "BGP specific commands\n" |
| 964 | "Change the default bestpath selection\n" |
| 965 | "AS-path attribute\n" |
| 966 | "Ignore as-path length in selecting a route\n") |
| 967 | { |
| 968 | struct bgp *bgp; |
| 969 | |
| 970 | bgp = vty->index; |
| 971 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 972 | return CMD_SUCCESS; |
| 973 | } |
| 974 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 975 | /* "bgp bestpath as-path confed" configuration. */ |
| 976 | DEFUN (bgp_bestpath_aspath_confed, |
| 977 | bgp_bestpath_aspath_confed_cmd, |
| 978 | "bgp bestpath as-path confed", |
| 979 | "BGP specific commands\n" |
| 980 | "Change the default bestpath selection\n" |
| 981 | "AS-path attribute\n" |
| 982 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 983 | { |
| 984 | struct bgp *bgp; |
| 985 | |
| 986 | bgp = vty->index; |
| 987 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); |
| 988 | return CMD_SUCCESS; |
| 989 | } |
| 990 | |
| 991 | DEFUN (no_bgp_bestpath_aspath_confed, |
| 992 | no_bgp_bestpath_aspath_confed_cmd, |
| 993 | "no bgp bestpath as-path confed", |
| 994 | NO_STR |
| 995 | "BGP specific commands\n" |
| 996 | "Change the default bestpath selection\n" |
| 997 | "AS-path attribute\n" |
| 998 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 999 | { |
| 1000 | struct bgp *bgp; |
| 1001 | |
| 1002 | bgp = vty->index; |
| 1003 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); |
| 1004 | return CMD_SUCCESS; |
| 1005 | } |
| 1006 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 1007 | /* "bgp log-neighbor-changes" configuration. */ |
| 1008 | DEFUN (bgp_log_neighbor_changes, |
| 1009 | bgp_log_neighbor_changes_cmd, |
| 1010 | "bgp log-neighbor-changes", |
| 1011 | "BGP specific commands\n" |
| 1012 | "Log neighbor up/down and reset reason\n") |
| 1013 | { |
| 1014 | struct bgp *bgp; |
| 1015 | |
| 1016 | bgp = vty->index; |
| 1017 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1018 | return CMD_SUCCESS; |
| 1019 | } |
| 1020 | |
| 1021 | DEFUN (no_bgp_log_neighbor_changes, |
| 1022 | no_bgp_log_neighbor_changes_cmd, |
| 1023 | "no bgp log-neighbor-changes", |
| 1024 | NO_STR |
| 1025 | "BGP specific commands\n" |
| 1026 | "Log neighbor up/down and reset reason\n") |
| 1027 | { |
| 1028 | struct bgp *bgp; |
| 1029 | |
| 1030 | bgp = vty->index; |
| 1031 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1032 | return CMD_SUCCESS; |
| 1033 | } |
| 1034 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1035 | /* "bgp bestpath med" configuration. */ |
| 1036 | DEFUN (bgp_bestpath_med, |
| 1037 | bgp_bestpath_med_cmd, |
| 1038 | "bgp bestpath med (confed|missing-as-worst)", |
| 1039 | "BGP specific commands\n" |
| 1040 | "Change the default bestpath selection\n" |
| 1041 | "MED attribute\n" |
| 1042 | "Compare MED among confederation paths\n" |
| 1043 | "Treat missing MED as the least preferred one\n") |
| 1044 | { |
| 1045 | struct bgp *bgp; |
| 1046 | |
| 1047 | bgp = vty->index; |
| 1048 | |
| 1049 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1050 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1051 | else |
| 1052 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1053 | |
| 1054 | return CMD_SUCCESS; |
| 1055 | } |
| 1056 | |
| 1057 | DEFUN (bgp_bestpath_med2, |
| 1058 | bgp_bestpath_med2_cmd, |
| 1059 | "bgp bestpath med confed missing-as-worst", |
| 1060 | "BGP specific commands\n" |
| 1061 | "Change the default bestpath selection\n" |
| 1062 | "MED attribute\n" |
| 1063 | "Compare MED among confederation paths\n" |
| 1064 | "Treat missing MED as the least preferred one\n") |
| 1065 | { |
| 1066 | struct bgp *bgp; |
| 1067 | |
| 1068 | bgp = vty->index; |
| 1069 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1070 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1071 | return CMD_SUCCESS; |
| 1072 | } |
| 1073 | |
| 1074 | ALIAS (bgp_bestpath_med2, |
| 1075 | bgp_bestpath_med3_cmd, |
| 1076 | "bgp bestpath med missing-as-worst confed", |
| 1077 | "BGP specific commands\n" |
| 1078 | "Change the default bestpath selection\n" |
| 1079 | "MED attribute\n" |
| 1080 | "Treat missing MED as the least preferred one\n" |
| 1081 | "Compare MED among confederation paths\n") |
| 1082 | |
| 1083 | DEFUN (no_bgp_bestpath_med, |
| 1084 | no_bgp_bestpath_med_cmd, |
| 1085 | "no bgp bestpath med (confed|missing-as-worst)", |
| 1086 | NO_STR |
| 1087 | "BGP specific commands\n" |
| 1088 | "Change the default bestpath selection\n" |
| 1089 | "MED attribute\n" |
| 1090 | "Compare MED among confederation paths\n" |
| 1091 | "Treat missing MED as the least preferred one\n") |
| 1092 | { |
| 1093 | struct bgp *bgp; |
| 1094 | |
| 1095 | bgp = vty->index; |
| 1096 | |
| 1097 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1098 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1099 | else |
| 1100 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1101 | |
| 1102 | return CMD_SUCCESS; |
| 1103 | } |
| 1104 | |
| 1105 | DEFUN (no_bgp_bestpath_med2, |
| 1106 | no_bgp_bestpath_med2_cmd, |
| 1107 | "no bgp bestpath med confed missing-as-worst", |
| 1108 | NO_STR |
| 1109 | "BGP specific commands\n" |
| 1110 | "Change the default bestpath selection\n" |
| 1111 | "MED attribute\n" |
| 1112 | "Compare MED among confederation paths\n" |
| 1113 | "Treat missing MED as the least preferred one\n") |
| 1114 | { |
| 1115 | struct bgp *bgp; |
| 1116 | |
| 1117 | bgp = vty->index; |
| 1118 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1119 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1120 | return CMD_SUCCESS; |
| 1121 | } |
| 1122 | |
| 1123 | ALIAS (no_bgp_bestpath_med2, |
| 1124 | no_bgp_bestpath_med3_cmd, |
| 1125 | "no bgp bestpath med missing-as-worst confed", |
| 1126 | NO_STR |
| 1127 | "BGP specific commands\n" |
| 1128 | "Change the default bestpath selection\n" |
| 1129 | "MED attribute\n" |
| 1130 | "Treat missing MED as the least preferred one\n" |
| 1131 | "Compare MED among confederation paths\n") |
| 1132 | |
| 1133 | /* "no bgp default ipv4-unicast". */ |
| 1134 | DEFUN (no_bgp_default_ipv4_unicast, |
| 1135 | no_bgp_default_ipv4_unicast_cmd, |
| 1136 | "no bgp default ipv4-unicast", |
| 1137 | NO_STR |
| 1138 | "BGP specific commands\n" |
| 1139 | "Configure BGP defaults\n" |
| 1140 | "Activate ipv4-unicast for a peer by default\n") |
| 1141 | { |
| 1142 | struct bgp *bgp; |
| 1143 | |
| 1144 | bgp = vty->index; |
| 1145 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1146 | return CMD_SUCCESS; |
| 1147 | } |
| 1148 | |
| 1149 | DEFUN (bgp_default_ipv4_unicast, |
| 1150 | bgp_default_ipv4_unicast_cmd, |
| 1151 | "bgp default ipv4-unicast", |
| 1152 | "BGP specific commands\n" |
| 1153 | "Configure BGP defaults\n" |
| 1154 | "Activate ipv4-unicast for a peer by default\n") |
| 1155 | { |
| 1156 | struct bgp *bgp; |
| 1157 | |
| 1158 | bgp = vty->index; |
| 1159 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1160 | return CMD_SUCCESS; |
| 1161 | } |
| 1162 | |
| 1163 | /* "bgp import-check" configuration. */ |
| 1164 | DEFUN (bgp_network_import_check, |
| 1165 | bgp_network_import_check_cmd, |
| 1166 | "bgp network import-check", |
| 1167 | "BGP specific commands\n" |
| 1168 | "BGP network command\n" |
| 1169 | "Check BGP network route exists in IGP\n") |
| 1170 | { |
| 1171 | struct bgp *bgp; |
| 1172 | |
| 1173 | bgp = vty->index; |
| 1174 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1175 | return CMD_SUCCESS; |
| 1176 | } |
| 1177 | |
| 1178 | DEFUN (no_bgp_network_import_check, |
| 1179 | no_bgp_network_import_check_cmd, |
| 1180 | "no bgp network import-check", |
| 1181 | NO_STR |
| 1182 | "BGP specific commands\n" |
| 1183 | "BGP network command\n" |
| 1184 | "Check BGP network route exists in IGP\n") |
| 1185 | { |
| 1186 | struct bgp *bgp; |
| 1187 | |
| 1188 | bgp = vty->index; |
| 1189 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1190 | return CMD_SUCCESS; |
| 1191 | } |
| 1192 | |
| 1193 | DEFUN (bgp_default_local_preference, |
| 1194 | bgp_default_local_preference_cmd, |
| 1195 | "bgp default local-preference <0-4294967295>", |
| 1196 | "BGP specific commands\n" |
| 1197 | "Configure BGP defaults\n" |
| 1198 | "local preference (higher=more preferred)\n" |
| 1199 | "Configure default local preference value\n") |
| 1200 | { |
| 1201 | struct bgp *bgp; |
| 1202 | u_int32_t local_pref; |
| 1203 | |
| 1204 | bgp = vty->index; |
| 1205 | |
| 1206 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); |
| 1207 | |
| 1208 | bgp_default_local_preference_set (bgp, local_pref); |
| 1209 | |
| 1210 | return CMD_SUCCESS; |
| 1211 | } |
| 1212 | |
| 1213 | DEFUN (no_bgp_default_local_preference, |
| 1214 | no_bgp_default_local_preference_cmd, |
| 1215 | "no bgp default local-preference", |
| 1216 | NO_STR |
| 1217 | "BGP specific commands\n" |
| 1218 | "Configure BGP defaults\n" |
| 1219 | "local preference (higher=more preferred)\n") |
| 1220 | { |
| 1221 | struct bgp *bgp; |
| 1222 | |
| 1223 | bgp = vty->index; |
| 1224 | bgp_default_local_preference_unset (bgp); |
| 1225 | return CMD_SUCCESS; |
| 1226 | } |
| 1227 | |
| 1228 | ALIAS (no_bgp_default_local_preference, |
| 1229 | no_bgp_default_local_preference_val_cmd, |
| 1230 | "no bgp default local-preference <0-4294967295>", |
| 1231 | NO_STR |
| 1232 | "BGP specific commands\n" |
| 1233 | "Configure BGP defaults\n" |
| 1234 | "local preference (higher=more preferred)\n" |
| 1235 | "Configure default local preference value\n") |
| 1236 | |
| 1237 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1238 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
| 1239 | const char *as_str, afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1240 | { |
| 1241 | int ret; |
| 1242 | struct bgp *bgp; |
| 1243 | as_t as; |
| 1244 | union sockunion su; |
| 1245 | |
| 1246 | bgp = vty->index; |
| 1247 | |
| 1248 | /* Get AS number. */ |
| 1249 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, 65535); |
| 1250 | |
| 1251 | /* If peer is peer group, call proper function. */ |
| 1252 | ret = str2sockunion (peer_str, &su); |
| 1253 | if (ret < 0) |
| 1254 | { |
| 1255 | ret = peer_group_remote_as (bgp, peer_str, &as); |
| 1256 | if (ret < 0) |
| 1257 | { |
| 1258 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1259 | return CMD_WARNING; |
| 1260 | } |
| 1261 | return CMD_SUCCESS; |
| 1262 | } |
| 1263 | |
| 1264 | if (peer_address_self_check (&su)) |
| 1265 | { |
| 1266 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1267 | VTY_NEWLINE); |
| 1268 | return CMD_WARNING; |
| 1269 | } |
| 1270 | |
| 1271 | ret = peer_remote_as (bgp, &su, &as, afi, safi); |
| 1272 | |
| 1273 | /* This peer belongs to peer group. */ |
| 1274 | switch (ret) |
| 1275 | { |
| 1276 | case BGP_ERR_PEER_GROUP_MEMBER: |
| 1277 | vty_out (vty, "%% Peer-group AS %d. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
| 1278 | return CMD_WARNING; |
| 1279 | break; |
| 1280 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
| 1281 | vty_out (vty, "%% The AS# can not be changed from %d to %s, peer-group members must be all internal or all external%s", as, as_str, VTY_NEWLINE); |
| 1282 | return CMD_WARNING; |
| 1283 | break; |
| 1284 | } |
| 1285 | return bgp_vty_return (vty, ret); |
| 1286 | } |
| 1287 | |
| 1288 | DEFUN (neighbor_remote_as, |
| 1289 | neighbor_remote_as_cmd, |
| 1290 | NEIGHBOR_CMD2 "remote-as <1-65535>", |
| 1291 | NEIGHBOR_STR |
| 1292 | NEIGHBOR_ADDR_STR2 |
| 1293 | "Specify a BGP neighbor\n" |
| 1294 | AS_STR) |
| 1295 | { |
| 1296 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); |
| 1297 | } |
| 1298 | |
| 1299 | DEFUN (neighbor_peer_group, |
| 1300 | neighbor_peer_group_cmd, |
| 1301 | "neighbor WORD peer-group", |
| 1302 | NEIGHBOR_STR |
| 1303 | "Neighbor tag\n" |
| 1304 | "Configure peer-group\n") |
| 1305 | { |
| 1306 | struct bgp *bgp; |
| 1307 | struct peer_group *group; |
| 1308 | |
| 1309 | bgp = vty->index; |
| 1310 | |
| 1311 | group = peer_group_get (bgp, argv[0]); |
| 1312 | if (! group) |
| 1313 | return CMD_WARNING; |
| 1314 | |
| 1315 | return CMD_SUCCESS; |
| 1316 | } |
| 1317 | |
| 1318 | DEFUN (no_neighbor, |
| 1319 | no_neighbor_cmd, |
| 1320 | NO_NEIGHBOR_CMD2, |
| 1321 | NO_STR |
| 1322 | NEIGHBOR_STR |
| 1323 | NEIGHBOR_ADDR_STR2) |
| 1324 | { |
| 1325 | int ret; |
| 1326 | union sockunion su; |
| 1327 | struct peer_group *group; |
| 1328 | struct peer *peer; |
| 1329 | |
| 1330 | ret = str2sockunion (argv[0], &su); |
| 1331 | if (ret < 0) |
| 1332 | { |
| 1333 | group = peer_group_lookup (vty->index, argv[0]); |
| 1334 | if (group) |
| 1335 | peer_group_delete (group); |
| 1336 | else |
| 1337 | { |
| 1338 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1339 | return CMD_WARNING; |
| 1340 | } |
| 1341 | } |
| 1342 | else |
| 1343 | { |
| 1344 | peer = peer_lookup (vty->index, &su); |
| 1345 | if (peer) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 1346 | peer_delete (peer); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1347 | } |
| 1348 | |
| 1349 | return CMD_SUCCESS; |
| 1350 | } |
| 1351 | |
| 1352 | ALIAS (no_neighbor, |
| 1353 | no_neighbor_remote_as_cmd, |
| 1354 | NO_NEIGHBOR_CMD "remote-as <1-65535>", |
| 1355 | NO_STR |
| 1356 | NEIGHBOR_STR |
| 1357 | NEIGHBOR_ADDR_STR |
| 1358 | "Specify a BGP neighbor\n" |
| 1359 | AS_STR) |
| 1360 | |
| 1361 | DEFUN (no_neighbor_peer_group, |
| 1362 | no_neighbor_peer_group_cmd, |
| 1363 | "no neighbor WORD peer-group", |
| 1364 | NO_STR |
| 1365 | NEIGHBOR_STR |
| 1366 | "Neighbor tag\n" |
| 1367 | "Configure peer-group\n") |
| 1368 | { |
| 1369 | struct peer_group *group; |
| 1370 | |
| 1371 | group = peer_group_lookup (vty->index, argv[0]); |
| 1372 | if (group) |
| 1373 | peer_group_delete (group); |
| 1374 | else |
| 1375 | { |
| 1376 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1377 | return CMD_WARNING; |
| 1378 | } |
| 1379 | return CMD_SUCCESS; |
| 1380 | } |
| 1381 | |
| 1382 | DEFUN (no_neighbor_peer_group_remote_as, |
| 1383 | no_neighbor_peer_group_remote_as_cmd, |
| 1384 | "no neighbor WORD remote-as <1-65535>", |
| 1385 | NO_STR |
| 1386 | NEIGHBOR_STR |
| 1387 | "Neighbor tag\n" |
| 1388 | "Specify a BGP neighbor\n" |
| 1389 | AS_STR) |
| 1390 | { |
| 1391 | struct peer_group *group; |
| 1392 | |
| 1393 | group = peer_group_lookup (vty->index, argv[0]); |
| 1394 | if (group) |
| 1395 | peer_group_remote_as_delete (group); |
| 1396 | else |
| 1397 | { |
| 1398 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1399 | return CMD_WARNING; |
| 1400 | } |
| 1401 | return CMD_SUCCESS; |
| 1402 | } |
| 1403 | |
| 1404 | DEFUN (neighbor_local_as, |
| 1405 | neighbor_local_as_cmd, |
| 1406 | NEIGHBOR_CMD2 "local-as <1-65535>", |
| 1407 | NEIGHBOR_STR |
| 1408 | NEIGHBOR_ADDR_STR2 |
| 1409 | "Specify a local-as number\n" |
| 1410 | "AS number used as local AS\n") |
| 1411 | { |
| 1412 | struct peer *peer; |
| 1413 | int ret; |
| 1414 | |
| 1415 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1416 | if (! peer) |
| 1417 | return CMD_WARNING; |
| 1418 | |
| 1419 | ret = peer_local_as_set (peer, atoi (argv[1]), 0); |
| 1420 | return bgp_vty_return (vty, ret); |
| 1421 | } |
| 1422 | |
| 1423 | DEFUN (neighbor_local_as_no_prepend, |
| 1424 | neighbor_local_as_no_prepend_cmd, |
| 1425 | NEIGHBOR_CMD2 "local-as <1-65535> no-prepend", |
| 1426 | NEIGHBOR_STR |
| 1427 | NEIGHBOR_ADDR_STR2 |
| 1428 | "Specify a local-as number\n" |
| 1429 | "AS number used as local AS\n" |
| 1430 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1431 | { |
| 1432 | struct peer *peer; |
| 1433 | int ret; |
| 1434 | |
| 1435 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1436 | if (! peer) |
| 1437 | return CMD_WARNING; |
| 1438 | |
| 1439 | ret = peer_local_as_set (peer, atoi (argv[1]), 1); |
| 1440 | return bgp_vty_return (vty, ret); |
| 1441 | } |
| 1442 | |
| 1443 | DEFUN (no_neighbor_local_as, |
| 1444 | no_neighbor_local_as_cmd, |
| 1445 | NO_NEIGHBOR_CMD2 "local-as", |
| 1446 | NO_STR |
| 1447 | NEIGHBOR_STR |
| 1448 | NEIGHBOR_ADDR_STR2 |
| 1449 | "Specify a local-as number\n") |
| 1450 | { |
| 1451 | struct peer *peer; |
| 1452 | int ret; |
| 1453 | |
| 1454 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1455 | if (! peer) |
| 1456 | return CMD_WARNING; |
| 1457 | |
| 1458 | ret = peer_local_as_unset (peer); |
| 1459 | return bgp_vty_return (vty, ret); |
| 1460 | } |
| 1461 | |
| 1462 | ALIAS (no_neighbor_local_as, |
| 1463 | no_neighbor_local_as_val_cmd, |
| 1464 | NO_NEIGHBOR_CMD2 "local-as <1-65535>", |
| 1465 | NO_STR |
| 1466 | NEIGHBOR_STR |
| 1467 | NEIGHBOR_ADDR_STR2 |
| 1468 | "Specify a local-as number\n" |
| 1469 | "AS number used as local AS\n") |
| 1470 | |
| 1471 | ALIAS (no_neighbor_local_as, |
| 1472 | no_neighbor_local_as_val2_cmd, |
| 1473 | NO_NEIGHBOR_CMD2 "local-as <1-65535> no-prepend", |
| 1474 | NO_STR |
| 1475 | NEIGHBOR_STR |
| 1476 | NEIGHBOR_ADDR_STR2 |
| 1477 | "Specify a local-as number\n" |
| 1478 | "AS number used as local AS\n" |
| 1479 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1480 | |
| 1481 | DEFUN (neighbor_activate, |
| 1482 | neighbor_activate_cmd, |
| 1483 | NEIGHBOR_CMD2 "activate", |
| 1484 | NEIGHBOR_STR |
| 1485 | NEIGHBOR_ADDR_STR2 |
| 1486 | "Enable the Address Family for this Neighbor\n") |
| 1487 | { |
| 1488 | struct peer *peer; |
| 1489 | |
| 1490 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1491 | if (! peer) |
| 1492 | return CMD_WARNING; |
| 1493 | |
| 1494 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1495 | |
| 1496 | return CMD_SUCCESS; |
| 1497 | } |
| 1498 | |
| 1499 | DEFUN (no_neighbor_activate, |
| 1500 | no_neighbor_activate_cmd, |
| 1501 | NO_NEIGHBOR_CMD2 "activate", |
| 1502 | NO_STR |
| 1503 | NEIGHBOR_STR |
| 1504 | NEIGHBOR_ADDR_STR2 |
| 1505 | "Enable the Address Family for this Neighbor\n") |
| 1506 | { |
| 1507 | int ret; |
| 1508 | struct peer *peer; |
| 1509 | |
| 1510 | /* Lookup peer. */ |
| 1511 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1512 | if (! peer) |
| 1513 | return CMD_WARNING; |
| 1514 | |
| 1515 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1516 | |
| 1517 | return bgp_vty_return (vty, ret); |
| 1518 | } |
| 1519 | |
| 1520 | DEFUN (neighbor_set_peer_group, |
| 1521 | neighbor_set_peer_group_cmd, |
| 1522 | NEIGHBOR_CMD "peer-group WORD", |
| 1523 | NEIGHBOR_STR |
| 1524 | NEIGHBOR_ADDR_STR |
| 1525 | "Member of the peer-group\n" |
| 1526 | "peer-group name\n") |
| 1527 | { |
| 1528 | int ret; |
| 1529 | as_t as; |
| 1530 | union sockunion su; |
| 1531 | struct bgp *bgp; |
| 1532 | struct peer_group *group; |
| 1533 | |
| 1534 | bgp = vty->index; |
| 1535 | |
| 1536 | ret = str2sockunion (argv[0], &su); |
| 1537 | if (ret < 0) |
| 1538 | { |
| 1539 | vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); |
| 1540 | return CMD_WARNING; |
| 1541 | } |
| 1542 | |
| 1543 | group = peer_group_lookup (bgp, argv[1]); |
| 1544 | if (! group) |
| 1545 | { |
| 1546 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1547 | return CMD_WARNING; |
| 1548 | } |
| 1549 | |
| 1550 | if (peer_address_self_check (&su)) |
| 1551 | { |
| 1552 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1553 | VTY_NEWLINE); |
| 1554 | return CMD_WARNING; |
| 1555 | } |
| 1556 | |
| 1557 | ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty), |
| 1558 | bgp_node_safi (vty), &as); |
| 1559 | |
| 1560 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) |
| 1561 | { |
| 1562 | vty_out (vty, "%% Peer with AS %d cannot be in this peer-group, members must be all internal or all external%s", as, VTY_NEWLINE); |
| 1563 | return CMD_WARNING; |
| 1564 | } |
| 1565 | |
| 1566 | return bgp_vty_return (vty, ret); |
| 1567 | } |
| 1568 | |
| 1569 | DEFUN (no_neighbor_set_peer_group, |
| 1570 | no_neighbor_set_peer_group_cmd, |
| 1571 | NO_NEIGHBOR_CMD "peer-group WORD", |
| 1572 | NO_STR |
| 1573 | NEIGHBOR_STR |
| 1574 | NEIGHBOR_ADDR_STR |
| 1575 | "Member of the peer-group\n" |
| 1576 | "peer-group name\n") |
| 1577 | { |
| 1578 | int ret; |
| 1579 | struct bgp *bgp; |
| 1580 | struct peer *peer; |
| 1581 | struct peer_group *group; |
| 1582 | |
| 1583 | bgp = vty->index; |
| 1584 | |
| 1585 | peer = peer_lookup_vty (vty, argv[0]); |
| 1586 | if (! peer) |
| 1587 | return CMD_WARNING; |
| 1588 | |
| 1589 | group = peer_group_lookup (bgp, argv[1]); |
| 1590 | if (! group) |
| 1591 | { |
| 1592 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1593 | return CMD_WARNING; |
| 1594 | } |
| 1595 | |
| 1596 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), |
| 1597 | bgp_node_safi (vty)); |
| 1598 | |
| 1599 | return bgp_vty_return (vty, ret); |
| 1600 | } |
| 1601 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1602 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1603 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
| 1604 | u_int16_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1605 | { |
| 1606 | int ret; |
| 1607 | struct peer *peer; |
| 1608 | |
| 1609 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 1610 | if (! peer) |
| 1611 | return CMD_WARNING; |
| 1612 | |
| 1613 | if (set) |
| 1614 | ret = peer_flag_set (peer, flag); |
| 1615 | else |
| 1616 | ret = peer_flag_unset (peer, flag); |
| 1617 | |
| 1618 | return bgp_vty_return (vty, ret); |
| 1619 | } |
| 1620 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1621 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1622 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1623 | { |
| 1624 | return peer_flag_modify_vty (vty, ip_str, flag, 1); |
| 1625 | } |
| 1626 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1627 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1628 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1629 | { |
| 1630 | return peer_flag_modify_vty (vty, ip_str, flag, 0); |
| 1631 | } |
| 1632 | |
| 1633 | /* neighbor passive. */ |
| 1634 | DEFUN (neighbor_passive, |
| 1635 | neighbor_passive_cmd, |
| 1636 | NEIGHBOR_CMD2 "passive", |
| 1637 | NEIGHBOR_STR |
| 1638 | NEIGHBOR_ADDR_STR2 |
| 1639 | "Don't send open messages to this neighbor\n") |
| 1640 | { |
| 1641 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1642 | } |
| 1643 | |
| 1644 | DEFUN (no_neighbor_passive, |
| 1645 | no_neighbor_passive_cmd, |
| 1646 | NO_NEIGHBOR_CMD2 "passive", |
| 1647 | NO_STR |
| 1648 | NEIGHBOR_STR |
| 1649 | NEIGHBOR_ADDR_STR2 |
| 1650 | "Don't send open messages to this neighbor\n") |
| 1651 | { |
| 1652 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1653 | } |
| 1654 | |
| 1655 | /* neighbor shutdown. */ |
| 1656 | DEFUN (neighbor_shutdown, |
| 1657 | neighbor_shutdown_cmd, |
| 1658 | NEIGHBOR_CMD2 "shutdown", |
| 1659 | NEIGHBOR_STR |
| 1660 | NEIGHBOR_ADDR_STR2 |
| 1661 | "Administratively shut down this neighbor\n") |
| 1662 | { |
| 1663 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1664 | } |
| 1665 | |
| 1666 | DEFUN (no_neighbor_shutdown, |
| 1667 | no_neighbor_shutdown_cmd, |
| 1668 | NO_NEIGHBOR_CMD2 "shutdown", |
| 1669 | NO_STR |
| 1670 | NEIGHBOR_STR |
| 1671 | NEIGHBOR_ADDR_STR2 |
| 1672 | "Administratively shut down this neighbor\n") |
| 1673 | { |
| 1674 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1675 | } |
| 1676 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1677 | /* Deprecated neighbor capability route-refresh. */ |
| 1678 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, |
| 1679 | neighbor_capability_route_refresh_cmd, |
| 1680 | NEIGHBOR_CMD2 "capability route-refresh", |
| 1681 | NEIGHBOR_STR |
| 1682 | NEIGHBOR_ADDR_STR2 |
| 1683 | "Advertise capability to the peer\n" |
| 1684 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1685 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1686 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1687 | } |
| 1688 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1689 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
| 1690 | no_neighbor_capability_route_refresh_cmd, |
| 1691 | NO_NEIGHBOR_CMD2 "capability route-refresh", |
| 1692 | NO_STR |
| 1693 | NEIGHBOR_STR |
| 1694 | NEIGHBOR_ADDR_STR2 |
| 1695 | "Advertise capability to the peer\n" |
| 1696 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1697 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1698 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1699 | } |
| 1700 | |
| 1701 | /* neighbor capability dynamic. */ |
| 1702 | DEFUN (neighbor_capability_dynamic, |
| 1703 | neighbor_capability_dynamic_cmd, |
| 1704 | NEIGHBOR_CMD2 "capability dynamic", |
| 1705 | NEIGHBOR_STR |
| 1706 | NEIGHBOR_ADDR_STR2 |
| 1707 | "Advertise capability to the peer\n" |
| 1708 | "Advertise dynamic capability to this neighbor\n") |
| 1709 | { |
| 1710 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1711 | } |
| 1712 | |
| 1713 | DEFUN (no_neighbor_capability_dynamic, |
| 1714 | no_neighbor_capability_dynamic_cmd, |
| 1715 | NO_NEIGHBOR_CMD2 "capability dynamic", |
| 1716 | NO_STR |
| 1717 | NEIGHBOR_STR |
| 1718 | NEIGHBOR_ADDR_STR2 |
| 1719 | "Advertise capability to the peer\n" |
| 1720 | "Advertise dynamic capability to this neighbor\n") |
| 1721 | { |
| 1722 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1723 | } |
| 1724 | |
| 1725 | /* neighbor dont-capability-negotiate */ |
| 1726 | DEFUN (neighbor_dont_capability_negotiate, |
| 1727 | neighbor_dont_capability_negotiate_cmd, |
| 1728 | NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1729 | NEIGHBOR_STR |
| 1730 | NEIGHBOR_ADDR_STR2 |
| 1731 | "Do not perform capability negotiation\n") |
| 1732 | { |
| 1733 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1734 | } |
| 1735 | |
| 1736 | DEFUN (no_neighbor_dont_capability_negotiate, |
| 1737 | no_neighbor_dont_capability_negotiate_cmd, |
| 1738 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1739 | NO_STR |
| 1740 | NEIGHBOR_STR |
| 1741 | NEIGHBOR_ADDR_STR2 |
| 1742 | "Do not perform capability negotiation\n") |
| 1743 | { |
| 1744 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1745 | } |
| 1746 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1747 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1748 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 1749 | safi_t safi, u_int32_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1750 | { |
| 1751 | int ret; |
| 1752 | struct peer *peer; |
| 1753 | |
| 1754 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 1755 | if (! peer) |
| 1756 | return CMD_WARNING; |
| 1757 | |
| 1758 | if (set) |
| 1759 | ret = peer_af_flag_set (peer, afi, safi, flag); |
| 1760 | else |
| 1761 | ret = peer_af_flag_unset (peer, afi, safi, flag); |
| 1762 | |
| 1763 | return bgp_vty_return (vty, ret); |
| 1764 | } |
| 1765 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1766 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1767 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 1768 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1769 | { |
| 1770 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); |
| 1771 | } |
| 1772 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1773 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1774 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 1775 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1776 | { |
| 1777 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); |
| 1778 | } |
| 1779 | |
| 1780 | /* neighbor capability orf prefix-list. */ |
| 1781 | DEFUN (neighbor_capability_orf_prefix, |
| 1782 | neighbor_capability_orf_prefix_cmd, |
| 1783 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 1784 | NEIGHBOR_STR |
| 1785 | NEIGHBOR_ADDR_STR2 |
| 1786 | "Advertise capability to the peer\n" |
| 1787 | "Advertise ORF capability to the peer\n" |
| 1788 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 1789 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 1790 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 1791 | "Capability to SEND the ORF to this neighbor\n") |
| 1792 | { |
| 1793 | u_int16_t flag = 0; |
| 1794 | |
| 1795 | if (strncmp (argv[1], "s", 1) == 0) |
| 1796 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 1797 | else if (strncmp (argv[1], "r", 1) == 0) |
| 1798 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 1799 | else if (strncmp (argv[1], "b", 1) == 0) |
| 1800 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 1801 | else |
| 1802 | return CMD_WARNING; |
| 1803 | |
| 1804 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1805 | bgp_node_safi (vty), flag); |
| 1806 | } |
| 1807 | |
| 1808 | DEFUN (no_neighbor_capability_orf_prefix, |
| 1809 | no_neighbor_capability_orf_prefix_cmd, |
| 1810 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 1811 | NO_STR |
| 1812 | NEIGHBOR_STR |
| 1813 | NEIGHBOR_ADDR_STR2 |
| 1814 | "Advertise capability to the peer\n" |
| 1815 | "Advertise ORF capability to the peer\n" |
| 1816 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 1817 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 1818 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 1819 | "Capability to SEND the ORF to this neighbor\n") |
| 1820 | { |
| 1821 | u_int16_t flag = 0; |
| 1822 | |
| 1823 | if (strncmp (argv[1], "s", 1) == 0) |
| 1824 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 1825 | else if (strncmp (argv[1], "r", 1) == 0) |
| 1826 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 1827 | else if (strncmp (argv[1], "b", 1) == 0) |
| 1828 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 1829 | else |
| 1830 | return CMD_WARNING; |
| 1831 | |
| 1832 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1833 | bgp_node_safi (vty), flag); |
| 1834 | } |
| 1835 | |
| 1836 | /* neighbor next-hop-self. */ |
| 1837 | DEFUN (neighbor_nexthop_self, |
| 1838 | neighbor_nexthop_self_cmd, |
| 1839 | NEIGHBOR_CMD2 "next-hop-self", |
| 1840 | NEIGHBOR_STR |
| 1841 | NEIGHBOR_ADDR_STR2 |
| 1842 | "Disable the next hop calculation for this neighbor\n") |
| 1843 | { |
| 1844 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1845 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 1846 | } |
| 1847 | |
| 1848 | DEFUN (no_neighbor_nexthop_self, |
| 1849 | no_neighbor_nexthop_self_cmd, |
| 1850 | NO_NEIGHBOR_CMD2 "next-hop-self", |
| 1851 | NO_STR |
| 1852 | NEIGHBOR_STR |
| 1853 | NEIGHBOR_ADDR_STR2 |
| 1854 | "Disable the next hop calculation for this neighbor\n") |
| 1855 | { |
| 1856 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1857 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 1858 | } |
| 1859 | |
| 1860 | /* neighbor remove-private-AS. */ |
| 1861 | DEFUN (neighbor_remove_private_as, |
| 1862 | neighbor_remove_private_as_cmd, |
| 1863 | NEIGHBOR_CMD2 "remove-private-AS", |
| 1864 | NEIGHBOR_STR |
| 1865 | NEIGHBOR_ADDR_STR2 |
| 1866 | "Remove private AS number from outbound updates\n") |
| 1867 | { |
| 1868 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1869 | bgp_node_safi (vty), |
| 1870 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 1871 | } |
| 1872 | |
| 1873 | DEFUN (no_neighbor_remove_private_as, |
| 1874 | no_neighbor_remove_private_as_cmd, |
| 1875 | NO_NEIGHBOR_CMD2 "remove-private-AS", |
| 1876 | NO_STR |
| 1877 | NEIGHBOR_STR |
| 1878 | NEIGHBOR_ADDR_STR2 |
| 1879 | "Remove private AS number from outbound updates\n") |
| 1880 | { |
| 1881 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1882 | bgp_node_safi (vty), |
| 1883 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 1884 | } |
| 1885 | |
| 1886 | /* neighbor send-community. */ |
| 1887 | DEFUN (neighbor_send_community, |
| 1888 | neighbor_send_community_cmd, |
| 1889 | NEIGHBOR_CMD2 "send-community", |
| 1890 | NEIGHBOR_STR |
| 1891 | NEIGHBOR_ADDR_STR2 |
| 1892 | "Send Community attribute to this neighbor\n") |
| 1893 | { |
| 1894 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1895 | bgp_node_safi (vty), |
| 1896 | PEER_FLAG_SEND_COMMUNITY); |
| 1897 | } |
| 1898 | |
| 1899 | DEFUN (no_neighbor_send_community, |
| 1900 | no_neighbor_send_community_cmd, |
| 1901 | NO_NEIGHBOR_CMD2 "send-community", |
| 1902 | NO_STR |
| 1903 | NEIGHBOR_STR |
| 1904 | NEIGHBOR_ADDR_STR2 |
| 1905 | "Send Community attribute to this neighbor\n") |
| 1906 | { |
| 1907 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1908 | bgp_node_safi (vty), |
| 1909 | PEER_FLAG_SEND_COMMUNITY); |
| 1910 | } |
| 1911 | |
| 1912 | /* neighbor send-community extended. */ |
| 1913 | DEFUN (neighbor_send_community_type, |
| 1914 | neighbor_send_community_type_cmd, |
| 1915 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 1916 | NEIGHBOR_STR |
| 1917 | NEIGHBOR_ADDR_STR2 |
| 1918 | "Send Community attribute to this neighbor\n" |
| 1919 | "Send Standard and Extended Community attributes\n" |
| 1920 | "Send Extended Community attributes\n" |
| 1921 | "Send Standard Community attributes\n") |
| 1922 | { |
| 1923 | if (strncmp (argv[1], "s", 1) == 0) |
| 1924 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1925 | bgp_node_safi (vty), |
| 1926 | PEER_FLAG_SEND_COMMUNITY); |
| 1927 | if (strncmp (argv[1], "e", 1) == 0) |
| 1928 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1929 | bgp_node_safi (vty), |
| 1930 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 1931 | |
| 1932 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1933 | bgp_node_safi (vty), |
| 1934 | (PEER_FLAG_SEND_COMMUNITY| |
| 1935 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 1936 | } |
| 1937 | |
| 1938 | DEFUN (no_neighbor_send_community_type, |
| 1939 | no_neighbor_send_community_type_cmd, |
| 1940 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 1941 | NO_STR |
| 1942 | NEIGHBOR_STR |
| 1943 | NEIGHBOR_ADDR_STR2 |
| 1944 | "Send Community attribute to this neighbor\n" |
| 1945 | "Send Standard and Extended Community attributes\n" |
| 1946 | "Send Extended Community attributes\n" |
| 1947 | "Send Standard Community attributes\n") |
| 1948 | { |
| 1949 | if (strncmp (argv[1], "s", 1) == 0) |
| 1950 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1951 | bgp_node_safi (vty), |
| 1952 | PEER_FLAG_SEND_COMMUNITY); |
| 1953 | if (strncmp (argv[1], "e", 1) == 0) |
| 1954 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1955 | bgp_node_safi (vty), |
| 1956 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 1957 | |
| 1958 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1959 | bgp_node_safi (vty), |
| 1960 | (PEER_FLAG_SEND_COMMUNITY | |
| 1961 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 1962 | } |
| 1963 | |
| 1964 | /* neighbor soft-reconfig. */ |
| 1965 | DEFUN (neighbor_soft_reconfiguration, |
| 1966 | neighbor_soft_reconfiguration_cmd, |
| 1967 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 1968 | NEIGHBOR_STR |
| 1969 | NEIGHBOR_ADDR_STR2 |
| 1970 | "Per neighbor soft reconfiguration\n" |
| 1971 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 1972 | { |
| 1973 | return peer_af_flag_set_vty (vty, argv[0], |
| 1974 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 1975 | PEER_FLAG_SOFT_RECONFIG); |
| 1976 | } |
| 1977 | |
| 1978 | DEFUN (no_neighbor_soft_reconfiguration, |
| 1979 | no_neighbor_soft_reconfiguration_cmd, |
| 1980 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 1981 | NO_STR |
| 1982 | NEIGHBOR_STR |
| 1983 | NEIGHBOR_ADDR_STR2 |
| 1984 | "Per neighbor soft reconfiguration\n" |
| 1985 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 1986 | { |
| 1987 | return peer_af_flag_unset_vty (vty, argv[0], |
| 1988 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 1989 | PEER_FLAG_SOFT_RECONFIG); |
| 1990 | } |
| 1991 | |
| 1992 | DEFUN (neighbor_route_reflector_client, |
| 1993 | neighbor_route_reflector_client_cmd, |
| 1994 | NEIGHBOR_CMD2 "route-reflector-client", |
| 1995 | NEIGHBOR_STR |
| 1996 | NEIGHBOR_ADDR_STR2 |
| 1997 | "Configure a neighbor as Route Reflector client\n") |
| 1998 | { |
| 1999 | struct peer *peer; |
| 2000 | |
| 2001 | |
| 2002 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2003 | if (! peer) |
| 2004 | return CMD_WARNING; |
| 2005 | |
| 2006 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2007 | bgp_node_safi (vty), |
| 2008 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2009 | } |
| 2010 | |
| 2011 | DEFUN (no_neighbor_route_reflector_client, |
| 2012 | no_neighbor_route_reflector_client_cmd, |
| 2013 | NO_NEIGHBOR_CMD2 "route-reflector-client", |
| 2014 | NO_STR |
| 2015 | NEIGHBOR_STR |
| 2016 | NEIGHBOR_ADDR_STR2 |
| 2017 | "Configure a neighbor as Route Reflector client\n") |
| 2018 | { |
| 2019 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2020 | bgp_node_safi (vty), |
| 2021 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2022 | } |
| 2023 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2024 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2025 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
| 2026 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2027 | { |
| 2028 | int ret; |
| 2029 | struct bgp *bgp; |
| 2030 | struct peer *peer; |
| 2031 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2032 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2033 | struct bgp_filter *pfilter; |
| 2034 | struct bgp_filter *gfilter; |
| 2035 | |
| 2036 | bgp = vty->index; |
| 2037 | |
| 2038 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2039 | if ( ! peer ) |
| 2040 | return CMD_WARNING; |
| 2041 | |
| 2042 | /* If it is already a RS-Client, don't do anything. */ |
| 2043 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2044 | return CMD_SUCCESS; |
| 2045 | |
| 2046 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2047 | { |
| 2048 | peer = peer_lock (peer); /* rsclient peer list reference */ |
| 2049 | listnode_add_sort (bgp->rsclient, peer); |
| 2050 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2051 | |
| 2052 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2053 | if (ret < 0) |
| 2054 | return bgp_vty_return (vty, ret); |
| 2055 | |
| 2056 | peer->rib[afi][safi] = bgp_table_init (); |
| 2057 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
| 2058 | peer->rib[afi][safi]->owner = peer; |
| 2059 | |
| 2060 | /* Check for existing 'network' and 'redistribute' routes. */ |
| 2061 | bgp_check_local_routes_rsclient (peer, afi, safi); |
| 2062 | |
| 2063 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ |
| 2064 | bgp_soft_reconfig_rsclient (peer, afi, safi); |
| 2065 | |
| 2066 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2067 | { |
| 2068 | group = peer->group; |
| 2069 | gfilter = &peer->filter[afi][safi]; |
| 2070 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2071 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2072 | { |
| 2073 | pfilter = &peer->filter[afi][safi]; |
| 2074 | |
| 2075 | /* Members of a non-RS-Client group should not be RS-Clients, as that |
| 2076 | is checked when the become part of the peer-group */ |
| 2077 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2078 | if (ret < 0) |
| 2079 | return bgp_vty_return (vty, ret); |
| 2080 | |
| 2081 | /* Make peer's RIB point to group's RIB. */ |
| 2082 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; |
| 2083 | |
| 2084 | /* Import policy. */ |
| 2085 | if (pfilter->map[RMAP_IMPORT].name) |
| 2086 | free (pfilter->map[RMAP_IMPORT].name); |
| 2087 | if (gfilter->map[RMAP_IMPORT].name) |
| 2088 | { |
| 2089 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); |
| 2090 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; |
| 2091 | } |
| 2092 | else |
| 2093 | { |
| 2094 | pfilter->map[RMAP_IMPORT].name = NULL; |
| 2095 | pfilter->map[RMAP_IMPORT].map =NULL; |
| 2096 | } |
| 2097 | |
| 2098 | /* Export policy. */ |
| 2099 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) |
| 2100 | { |
| 2101 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); |
| 2102 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; |
| 2103 | } |
| 2104 | } |
| 2105 | } |
| 2106 | return CMD_SUCCESS; |
| 2107 | } |
| 2108 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2109 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2110 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
| 2111 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2112 | { |
| 2113 | int ret; |
| 2114 | struct bgp *bgp; |
| 2115 | struct peer *peer; |
| 2116 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2117 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2118 | |
| 2119 | bgp = vty->index; |
| 2120 | |
| 2121 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2122 | if ( ! peer ) |
| 2123 | return CMD_WARNING; |
| 2124 | |
| 2125 | /* If it is not a RS-Client, don't do anything. */ |
| 2126 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2127 | return CMD_SUCCESS; |
| 2128 | |
| 2129 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2130 | { |
| 2131 | group = peer->group; |
| 2132 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2133 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2134 | { |
| 2135 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2136 | if (ret < 0) |
| 2137 | return bgp_vty_return (vty, ret); |
| 2138 | |
| 2139 | peer->rib[afi][safi] = NULL; |
| 2140 | } |
| 2141 | |
| 2142 | peer = group->conf; |
| 2143 | } |
| 2144 | |
| 2145 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2146 | if (ret < 0) |
| 2147 | return bgp_vty_return (vty, ret); |
| 2148 | |
| 2149 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2150 | { |
| 2151 | peer_unlock (peer); /* peer bgp rsclient reference */ |
| 2152 | listnode_delete (bgp->rsclient, peer); |
| 2153 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2154 | |
| 2155 | bgp_table_finish (peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
| 2156 | |
| 2157 | return CMD_SUCCESS; |
| 2158 | } |
| 2159 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2160 | /* neighbor route-server-client. */ |
| 2161 | DEFUN (neighbor_route_server_client, |
| 2162 | neighbor_route_server_client_cmd, |
| 2163 | NEIGHBOR_CMD2 "route-server-client", |
| 2164 | NEIGHBOR_STR |
| 2165 | NEIGHBOR_ADDR_STR2 |
| 2166 | "Configure a neighbor as Route Server client\n") |
| 2167 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2168 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
| 2169 | bgp_node_safi(vty)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2170 | } |
| 2171 | |
| 2172 | DEFUN (no_neighbor_route_server_client, |
| 2173 | no_neighbor_route_server_client_cmd, |
| 2174 | NO_NEIGHBOR_CMD2 "route-server-client", |
| 2175 | NO_STR |
| 2176 | NEIGHBOR_STR |
| 2177 | NEIGHBOR_ADDR_STR2 |
| 2178 | "Configure a neighbor as Route Server client\n") |
| 2179 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2180 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), |
| 2181 | bgp_node_safi(vty)); |
| 2182 | } |
| 2183 | |
| 2184 | DEFUN (neighbor_nexthop_local_unchanged, |
| 2185 | neighbor_nexthop_local_unchanged_cmd, |
| 2186 | NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2187 | NEIGHBOR_STR |
| 2188 | NEIGHBOR_ADDR_STR2 |
| 2189 | "Configure treatment of outgoing link-local nexthop attribute\n" |
| 2190 | "Leave link-local nexthop unchanged for this peer\n") |
| 2191 | { |
| 2192 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2193 | bgp_node_safi (vty), |
| 2194 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
| 2195 | } |
| 2196 | |
| 2197 | DEFUN (no_neighbor_nexthop_local_unchanged, |
| 2198 | no_neighbor_nexthop_local_unchanged_cmd, |
| 2199 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2200 | NO_STR |
| 2201 | NEIGHBOR_STR |
| 2202 | NEIGHBOR_ADDR_STR2 |
| 2203 | "Configure treatment of outgoing link-local-nexthop attribute\n" |
| 2204 | "Leave link-local nexthop unchanged for this peer\n") |
| 2205 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2206 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2207 | bgp_node_safi (vty), |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2208 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2209 | } |
| 2210 | |
| 2211 | DEFUN (neighbor_attr_unchanged, |
| 2212 | neighbor_attr_unchanged_cmd, |
| 2213 | NEIGHBOR_CMD2 "attribute-unchanged", |
| 2214 | NEIGHBOR_STR |
| 2215 | NEIGHBOR_ADDR_STR2 |
| 2216 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2217 | { |
| 2218 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2219 | bgp_node_safi (vty), |
| 2220 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2221 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2222 | PEER_FLAG_MED_UNCHANGED)); |
| 2223 | } |
| 2224 | |
| 2225 | DEFUN (neighbor_attr_unchanged1, |
| 2226 | neighbor_attr_unchanged1_cmd, |
| 2227 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2228 | NEIGHBOR_STR |
| 2229 | NEIGHBOR_ADDR_STR2 |
| 2230 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2231 | "As-path attribute\n" |
| 2232 | "Nexthop attribute\n" |
| 2233 | "Med attribute\n") |
| 2234 | { |
| 2235 | u_int16_t flags = 0; |
| 2236 | |
| 2237 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2238 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2239 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2240 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2241 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2242 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2243 | |
| 2244 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2245 | bgp_node_safi (vty), flags); |
| 2246 | } |
| 2247 | |
| 2248 | DEFUN (neighbor_attr_unchanged2, |
| 2249 | neighbor_attr_unchanged2_cmd, |
| 2250 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2251 | NEIGHBOR_STR |
| 2252 | NEIGHBOR_ADDR_STR2 |
| 2253 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2254 | "As-path attribute\n" |
| 2255 | "Nexthop attribute\n" |
| 2256 | "Med attribute\n") |
| 2257 | { |
| 2258 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2259 | |
| 2260 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2261 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2262 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2263 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2264 | |
| 2265 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2266 | bgp_node_safi (vty), flags); |
| 2267 | |
| 2268 | } |
| 2269 | |
| 2270 | DEFUN (neighbor_attr_unchanged3, |
| 2271 | neighbor_attr_unchanged3_cmd, |
| 2272 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2273 | NEIGHBOR_STR |
| 2274 | NEIGHBOR_ADDR_STR2 |
| 2275 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2276 | "Nexthop attribute\n" |
| 2277 | "As-path attribute\n" |
| 2278 | "Med attribute\n") |
| 2279 | { |
| 2280 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2281 | |
| 2282 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2283 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2284 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2285 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2286 | |
| 2287 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2288 | bgp_node_safi (vty), flags); |
| 2289 | } |
| 2290 | |
| 2291 | DEFUN (neighbor_attr_unchanged4, |
| 2292 | neighbor_attr_unchanged4_cmd, |
| 2293 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2294 | NEIGHBOR_STR |
| 2295 | NEIGHBOR_ADDR_STR2 |
| 2296 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2297 | "Med attribute\n" |
| 2298 | "As-path attribute\n" |
| 2299 | "Nexthop attribute\n") |
| 2300 | { |
| 2301 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2302 | |
| 2303 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2304 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2305 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2306 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2307 | |
| 2308 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2309 | bgp_node_safi (vty), flags); |
| 2310 | } |
| 2311 | |
| 2312 | ALIAS (neighbor_attr_unchanged, |
| 2313 | neighbor_attr_unchanged5_cmd, |
| 2314 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2315 | NEIGHBOR_STR |
| 2316 | NEIGHBOR_ADDR_STR2 |
| 2317 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2318 | "As-path attribute\n" |
| 2319 | "Nexthop attribute\n" |
| 2320 | "Med attribute\n") |
| 2321 | |
| 2322 | ALIAS (neighbor_attr_unchanged, |
| 2323 | neighbor_attr_unchanged6_cmd, |
| 2324 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2325 | NEIGHBOR_STR |
| 2326 | NEIGHBOR_ADDR_STR2 |
| 2327 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2328 | "As-path attribute\n" |
| 2329 | "Med attribute\n" |
| 2330 | "Nexthop attribute\n") |
| 2331 | |
| 2332 | ALIAS (neighbor_attr_unchanged, |
| 2333 | neighbor_attr_unchanged7_cmd, |
| 2334 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2335 | NEIGHBOR_STR |
| 2336 | NEIGHBOR_ADDR_STR2 |
| 2337 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2338 | "Nexthop attribute\n" |
| 2339 | "Med attribute\n" |
| 2340 | "As-path attribute\n") |
| 2341 | |
| 2342 | ALIAS (neighbor_attr_unchanged, |
| 2343 | neighbor_attr_unchanged8_cmd, |
| 2344 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2345 | NEIGHBOR_STR |
| 2346 | NEIGHBOR_ADDR_STR2 |
| 2347 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2348 | "Nexthop attribute\n" |
| 2349 | "As-path attribute\n" |
| 2350 | "Med attribute\n") |
| 2351 | |
| 2352 | ALIAS (neighbor_attr_unchanged, |
| 2353 | neighbor_attr_unchanged9_cmd, |
| 2354 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2355 | NEIGHBOR_STR |
| 2356 | NEIGHBOR_ADDR_STR2 |
| 2357 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2358 | "Med attribute\n" |
| 2359 | "Nexthop attribute\n" |
| 2360 | "As-path attribute\n") |
| 2361 | |
| 2362 | ALIAS (neighbor_attr_unchanged, |
| 2363 | neighbor_attr_unchanged10_cmd, |
| 2364 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2365 | NEIGHBOR_STR |
| 2366 | NEIGHBOR_ADDR_STR2 |
| 2367 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2368 | "Med attribute\n" |
| 2369 | "As-path attribute\n" |
| 2370 | "Nexthop attribute\n") |
| 2371 | |
| 2372 | DEFUN (no_neighbor_attr_unchanged, |
| 2373 | no_neighbor_attr_unchanged_cmd, |
| 2374 | NO_NEIGHBOR_CMD2 "attribute-unchanged", |
| 2375 | NO_STR |
| 2376 | NEIGHBOR_STR |
| 2377 | NEIGHBOR_ADDR_STR2 |
| 2378 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2379 | { |
| 2380 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2381 | bgp_node_safi (vty), |
| 2382 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2383 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2384 | PEER_FLAG_MED_UNCHANGED)); |
| 2385 | } |
| 2386 | |
| 2387 | DEFUN (no_neighbor_attr_unchanged1, |
| 2388 | no_neighbor_attr_unchanged1_cmd, |
| 2389 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2390 | NO_STR |
| 2391 | NEIGHBOR_STR |
| 2392 | NEIGHBOR_ADDR_STR2 |
| 2393 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2394 | "As-path attribute\n" |
| 2395 | "Nexthop attribute\n" |
| 2396 | "Med attribute\n") |
| 2397 | { |
| 2398 | u_int16_t flags = 0; |
| 2399 | |
| 2400 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2401 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2402 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2403 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2404 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2405 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2406 | |
| 2407 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2408 | bgp_node_safi (vty), flags); |
| 2409 | } |
| 2410 | |
| 2411 | DEFUN (no_neighbor_attr_unchanged2, |
| 2412 | no_neighbor_attr_unchanged2_cmd, |
| 2413 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2414 | NO_STR |
| 2415 | NEIGHBOR_STR |
| 2416 | NEIGHBOR_ADDR_STR2 |
| 2417 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2418 | "As-path attribute\n" |
| 2419 | "Nexthop attribute\n" |
| 2420 | "Med attribute\n") |
| 2421 | { |
| 2422 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2423 | |
| 2424 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2425 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2426 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2427 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2428 | |
| 2429 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2430 | bgp_node_safi (vty), flags); |
| 2431 | } |
| 2432 | |
| 2433 | DEFUN (no_neighbor_attr_unchanged3, |
| 2434 | no_neighbor_attr_unchanged3_cmd, |
| 2435 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2436 | NO_STR |
| 2437 | NEIGHBOR_STR |
| 2438 | NEIGHBOR_ADDR_STR2 |
| 2439 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2440 | "Nexthop attribute\n" |
| 2441 | "As-path attribute\n" |
| 2442 | "Med attribute\n") |
| 2443 | { |
| 2444 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2445 | |
| 2446 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2447 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2448 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2449 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2450 | |
| 2451 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2452 | bgp_node_safi (vty), flags); |
| 2453 | } |
| 2454 | |
| 2455 | DEFUN (no_neighbor_attr_unchanged4, |
| 2456 | no_neighbor_attr_unchanged4_cmd, |
| 2457 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2458 | NO_STR |
| 2459 | NEIGHBOR_STR |
| 2460 | NEIGHBOR_ADDR_STR2 |
| 2461 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2462 | "Med attribute\n" |
| 2463 | "As-path attribute\n" |
| 2464 | "Nexthop attribute\n") |
| 2465 | { |
| 2466 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2467 | |
| 2468 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2469 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2470 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2471 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2472 | |
| 2473 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2474 | bgp_node_safi (vty), flags); |
| 2475 | } |
| 2476 | |
| 2477 | ALIAS (no_neighbor_attr_unchanged, |
| 2478 | no_neighbor_attr_unchanged5_cmd, |
| 2479 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2480 | NO_STR |
| 2481 | NEIGHBOR_STR |
| 2482 | NEIGHBOR_ADDR_STR2 |
| 2483 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2484 | "As-path attribute\n" |
| 2485 | "Nexthop attribute\n" |
| 2486 | "Med attribute\n") |
| 2487 | |
| 2488 | ALIAS (no_neighbor_attr_unchanged, |
| 2489 | no_neighbor_attr_unchanged6_cmd, |
| 2490 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2491 | NO_STR |
| 2492 | NEIGHBOR_STR |
| 2493 | NEIGHBOR_ADDR_STR2 |
| 2494 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2495 | "As-path attribute\n" |
| 2496 | "Med attribute\n" |
| 2497 | "Nexthop attribute\n") |
| 2498 | |
| 2499 | ALIAS (no_neighbor_attr_unchanged, |
| 2500 | no_neighbor_attr_unchanged7_cmd, |
| 2501 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2502 | NO_STR |
| 2503 | NEIGHBOR_STR |
| 2504 | NEIGHBOR_ADDR_STR2 |
| 2505 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2506 | "Nexthop attribute\n" |
| 2507 | "Med attribute\n" |
| 2508 | "As-path attribute\n") |
| 2509 | |
| 2510 | ALIAS (no_neighbor_attr_unchanged, |
| 2511 | no_neighbor_attr_unchanged8_cmd, |
| 2512 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2513 | NO_STR |
| 2514 | NEIGHBOR_STR |
| 2515 | NEIGHBOR_ADDR_STR2 |
| 2516 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2517 | "Nexthop attribute\n" |
| 2518 | "As-path attribute\n" |
| 2519 | "Med attribute\n") |
| 2520 | |
| 2521 | ALIAS (no_neighbor_attr_unchanged, |
| 2522 | no_neighbor_attr_unchanged9_cmd, |
| 2523 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2524 | NO_STR |
| 2525 | NEIGHBOR_STR |
| 2526 | NEIGHBOR_ADDR_STR2 |
| 2527 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2528 | "Med attribute\n" |
| 2529 | "Nexthop attribute\n" |
| 2530 | "As-path attribute\n") |
| 2531 | |
| 2532 | ALIAS (no_neighbor_attr_unchanged, |
| 2533 | no_neighbor_attr_unchanged10_cmd, |
| 2534 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2535 | NO_STR |
| 2536 | NEIGHBOR_STR |
| 2537 | NEIGHBOR_ADDR_STR2 |
| 2538 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2539 | "Med attribute\n" |
| 2540 | "As-path attribute\n" |
| 2541 | "Nexthop attribute\n") |
| 2542 | |
| 2543 | /* For old version Zebra compatibility. */ |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2544 | DEFUN_DEPRECATED (neighbor_transparent_as, |
| 2545 | neighbor_transparent_as_cmd, |
| 2546 | NEIGHBOR_CMD "transparent-as", |
| 2547 | NEIGHBOR_STR |
| 2548 | NEIGHBOR_ADDR_STR |
| 2549 | "Do not append my AS number even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2550 | { |
| 2551 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2552 | bgp_node_safi (vty), |
| 2553 | PEER_FLAG_AS_PATH_UNCHANGED); |
| 2554 | } |
| 2555 | |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2556 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
| 2557 | neighbor_transparent_nexthop_cmd, |
| 2558 | NEIGHBOR_CMD "transparent-nexthop", |
| 2559 | NEIGHBOR_STR |
| 2560 | NEIGHBOR_ADDR_STR |
| 2561 | "Do not change nexthop even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2562 | { |
| 2563 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2564 | bgp_node_safi (vty), |
| 2565 | PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2566 | } |
| 2567 | |
| 2568 | /* EBGP multihop configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2569 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2570 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
| 2571 | const char *ttl_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2572 | { |
| 2573 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2574 | unsigned int ttl; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2575 | |
| 2576 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2577 | if (! peer) |
| 2578 | return CMD_WARNING; |
| 2579 | |
| 2580 | if (! ttl_str) |
| 2581 | ttl = TTL_MAX; |
| 2582 | else |
| 2583 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); |
| 2584 | |
| 2585 | peer_ebgp_multihop_set (peer, ttl); |
| 2586 | |
| 2587 | return CMD_SUCCESS; |
| 2588 | } |
| 2589 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2590 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2591 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2592 | { |
| 2593 | struct peer *peer; |
| 2594 | |
| 2595 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2596 | if (! peer) |
| 2597 | return CMD_WARNING; |
| 2598 | |
| 2599 | peer_ebgp_multihop_unset (peer); |
| 2600 | |
| 2601 | return CMD_SUCCESS; |
| 2602 | } |
| 2603 | |
| 2604 | /* neighbor ebgp-multihop. */ |
| 2605 | DEFUN (neighbor_ebgp_multihop, |
| 2606 | neighbor_ebgp_multihop_cmd, |
| 2607 | NEIGHBOR_CMD2 "ebgp-multihop", |
| 2608 | NEIGHBOR_STR |
| 2609 | NEIGHBOR_ADDR_STR2 |
| 2610 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2611 | { |
| 2612 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); |
| 2613 | } |
| 2614 | |
| 2615 | DEFUN (neighbor_ebgp_multihop_ttl, |
| 2616 | neighbor_ebgp_multihop_ttl_cmd, |
| 2617 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2618 | NEIGHBOR_STR |
| 2619 | NEIGHBOR_ADDR_STR2 |
| 2620 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2621 | "maximum hop count\n") |
| 2622 | { |
| 2623 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); |
| 2624 | } |
| 2625 | |
| 2626 | DEFUN (no_neighbor_ebgp_multihop, |
| 2627 | no_neighbor_ebgp_multihop_cmd, |
| 2628 | NO_NEIGHBOR_CMD2 "ebgp-multihop", |
| 2629 | NO_STR |
| 2630 | NEIGHBOR_STR |
| 2631 | NEIGHBOR_ADDR_STR2 |
| 2632 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2633 | { |
| 2634 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); |
| 2635 | } |
| 2636 | |
| 2637 | ALIAS (no_neighbor_ebgp_multihop, |
| 2638 | no_neighbor_ebgp_multihop_ttl_cmd, |
| 2639 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2640 | NO_STR |
| 2641 | NEIGHBOR_STR |
| 2642 | NEIGHBOR_ADDR_STR2 |
| 2643 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2644 | "maximum hop count\n") |
| 2645 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2646 | /* disable-connected-check */ |
| 2647 | DEFUN (neighbor_disable_connected_check, |
| 2648 | neighbor_disable_connected_check_cmd, |
| 2649 | NEIGHBOR_CMD2 "disable-connected-check", |
| 2650 | NEIGHBOR_STR |
| 2651 | NEIGHBOR_ADDR_STR2 |
| 2652 | "one-hop away EBGP peer using loopback address\n") |
| 2653 | { |
| 2654 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2655 | } |
| 2656 | |
| 2657 | DEFUN (no_neighbor_disable_connected_check, |
| 2658 | no_neighbor_disable_connected_check_cmd, |
| 2659 | NO_NEIGHBOR_CMD2 "disable-connected-check", |
| 2660 | NO_STR |
| 2661 | NEIGHBOR_STR |
| 2662 | NEIGHBOR_ADDR_STR2 |
| 2663 | "one-hop away EBGP peer using loopback address\n") |
| 2664 | { |
| 2665 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2666 | } |
| 2667 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2668 | /* Enforce multihop. */ |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2669 | ALIAS (neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2670 | neighbor_enforce_multihop_cmd, |
| 2671 | NEIGHBOR_CMD2 "enforce-multihop", |
| 2672 | NEIGHBOR_STR |
| 2673 | NEIGHBOR_ADDR_STR2 |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2674 | "Enforce EBGP neighbors perform multihop\n"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2675 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2676 | /* Enforce multihop. */ |
| 2677 | ALIAS (no_neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2678 | no_neighbor_enforce_multihop_cmd, |
| 2679 | NO_NEIGHBOR_CMD2 "enforce-multihop", |
| 2680 | NO_STR |
| 2681 | NEIGHBOR_STR |
| 2682 | NEIGHBOR_ADDR_STR2 |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2683 | "Enforce EBGP neighbors perform multihop\n"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2684 | |
| 2685 | DEFUN (neighbor_description, |
| 2686 | neighbor_description_cmd, |
| 2687 | NEIGHBOR_CMD2 "description .LINE", |
| 2688 | NEIGHBOR_STR |
| 2689 | NEIGHBOR_ADDR_STR2 |
| 2690 | "Neighbor specific description\n" |
| 2691 | "Up to 80 characters describing this neighbor\n") |
| 2692 | { |
| 2693 | struct peer *peer; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2694 | char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2695 | |
| 2696 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2697 | if (! peer) |
| 2698 | return CMD_WARNING; |
| 2699 | |
| 2700 | if (argc == 1) |
| 2701 | return CMD_SUCCESS; |
| 2702 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2703 | str = argv_concat(argv, argc, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2704 | |
| 2705 | peer_description_set (peer, str); |
| 2706 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2707 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2708 | |
| 2709 | return CMD_SUCCESS; |
| 2710 | } |
| 2711 | |
| 2712 | DEFUN (no_neighbor_description, |
| 2713 | no_neighbor_description_cmd, |
| 2714 | NO_NEIGHBOR_CMD2 "description", |
| 2715 | NO_STR |
| 2716 | NEIGHBOR_STR |
| 2717 | NEIGHBOR_ADDR_STR2 |
| 2718 | "Neighbor specific description\n") |
| 2719 | { |
| 2720 | struct peer *peer; |
| 2721 | |
| 2722 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2723 | if (! peer) |
| 2724 | return CMD_WARNING; |
| 2725 | |
| 2726 | peer_description_unset (peer); |
| 2727 | |
| 2728 | return CMD_SUCCESS; |
| 2729 | } |
| 2730 | |
| 2731 | ALIAS (no_neighbor_description, |
| 2732 | no_neighbor_description_val_cmd, |
| 2733 | NO_NEIGHBOR_CMD2 "description .LINE", |
| 2734 | NO_STR |
| 2735 | NEIGHBOR_STR |
| 2736 | NEIGHBOR_ADDR_STR2 |
| 2737 | "Neighbor specific description\n" |
| 2738 | "Up to 80 characters describing this neighbor\n") |
| 2739 | |
| 2740 | /* Neighbor update-source. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2741 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2742 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
| 2743 | const char *source_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2744 | { |
| 2745 | struct peer *peer; |
| 2746 | union sockunion *su; |
| 2747 | |
| 2748 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2749 | if (! peer) |
| 2750 | return CMD_WARNING; |
| 2751 | |
| 2752 | if (source_str) |
| 2753 | { |
| 2754 | su = sockunion_str2su (source_str); |
| 2755 | if (su) |
| 2756 | { |
| 2757 | peer_update_source_addr_set (peer, su); |
| 2758 | sockunion_free (su); |
| 2759 | } |
| 2760 | else |
| 2761 | peer_update_source_if_set (peer, source_str); |
| 2762 | } |
| 2763 | else |
| 2764 | peer_update_source_unset (peer); |
| 2765 | |
| 2766 | return CMD_SUCCESS; |
| 2767 | } |
| 2768 | |
| 2769 | DEFUN (neighbor_update_source, |
| 2770 | neighbor_update_source_cmd, |
| 2771 | NEIGHBOR_CMD2 "update-source WORD", |
| 2772 | NEIGHBOR_STR |
| 2773 | NEIGHBOR_ADDR_STR2 |
| 2774 | "Source of routing updates\n" |
| 2775 | "Interface name\n") |
| 2776 | { |
| 2777 | return peer_update_source_vty (vty, argv[0], argv[1]); |
| 2778 | } |
| 2779 | |
| 2780 | DEFUN (no_neighbor_update_source, |
| 2781 | no_neighbor_update_source_cmd, |
| 2782 | NO_NEIGHBOR_CMD2 "update-source", |
| 2783 | NO_STR |
| 2784 | NEIGHBOR_STR |
| 2785 | NEIGHBOR_ADDR_STR2 |
| 2786 | "Source of routing updates\n" |
| 2787 | "Interface name\n") |
| 2788 | { |
| 2789 | return peer_update_source_vty (vty, argv[0], NULL); |
| 2790 | } |
| 2791 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2792 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2793 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
| 2794 | afi_t afi, safi_t safi, |
| 2795 | const char *rmap, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2796 | { |
| 2797 | int ret; |
| 2798 | struct peer *peer; |
| 2799 | |
| 2800 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2801 | if (! peer) |
| 2802 | return CMD_WARNING; |
| 2803 | |
| 2804 | if (set) |
| 2805 | ret = peer_default_originate_set (peer, afi, safi, rmap); |
| 2806 | else |
| 2807 | ret = peer_default_originate_unset (peer, afi, safi); |
| 2808 | |
| 2809 | return bgp_vty_return (vty, ret); |
| 2810 | } |
| 2811 | |
| 2812 | /* neighbor default-originate. */ |
| 2813 | DEFUN (neighbor_default_originate, |
| 2814 | neighbor_default_originate_cmd, |
| 2815 | NEIGHBOR_CMD2 "default-originate", |
| 2816 | NEIGHBOR_STR |
| 2817 | NEIGHBOR_ADDR_STR2 |
| 2818 | "Originate default route to this neighbor\n") |
| 2819 | { |
| 2820 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2821 | bgp_node_safi (vty), NULL, 1); |
| 2822 | } |
| 2823 | |
| 2824 | DEFUN (neighbor_default_originate_rmap, |
| 2825 | neighbor_default_originate_rmap_cmd, |
| 2826 | NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 2827 | NEIGHBOR_STR |
| 2828 | NEIGHBOR_ADDR_STR2 |
| 2829 | "Originate default route to this neighbor\n" |
| 2830 | "Route-map to specify criteria to originate default\n" |
| 2831 | "route-map name\n") |
| 2832 | { |
| 2833 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2834 | bgp_node_safi (vty), argv[1], 1); |
| 2835 | } |
| 2836 | |
| 2837 | DEFUN (no_neighbor_default_originate, |
| 2838 | no_neighbor_default_originate_cmd, |
| 2839 | NO_NEIGHBOR_CMD2 "default-originate", |
| 2840 | NO_STR |
| 2841 | NEIGHBOR_STR |
| 2842 | NEIGHBOR_ADDR_STR2 |
| 2843 | "Originate default route to this neighbor\n") |
| 2844 | { |
| 2845 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2846 | bgp_node_safi (vty), NULL, 0); |
| 2847 | } |
| 2848 | |
| 2849 | ALIAS (no_neighbor_default_originate, |
| 2850 | no_neighbor_default_originate_rmap_cmd, |
| 2851 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 2852 | NO_STR |
| 2853 | NEIGHBOR_STR |
| 2854 | NEIGHBOR_ADDR_STR2 |
| 2855 | "Originate default route to this neighbor\n" |
| 2856 | "Route-map to specify criteria to originate default\n" |
| 2857 | "route-map name\n") |
| 2858 | |
| 2859 | /* Set neighbor's BGP port. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2860 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2861 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
| 2862 | const char *port_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2863 | { |
| 2864 | struct peer *peer; |
| 2865 | u_int16_t port; |
| 2866 | struct servent *sp; |
| 2867 | |
| 2868 | peer = peer_lookup_vty (vty, ip_str); |
| 2869 | if (! peer) |
| 2870 | return CMD_WARNING; |
| 2871 | |
| 2872 | if (! port_str) |
| 2873 | { |
| 2874 | sp = getservbyname ("bgp", "tcp"); |
| 2875 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); |
| 2876 | } |
| 2877 | else |
| 2878 | { |
| 2879 | VTY_GET_INTEGER("port", port, port_str); |
| 2880 | } |
| 2881 | |
| 2882 | peer_port_set (peer, port); |
| 2883 | |
| 2884 | return CMD_SUCCESS; |
| 2885 | } |
| 2886 | |
hasso | f418446 | 2005-02-01 20:13:16 +0000 | [diff] [blame] | 2887 | /* Set specified peer's BGP port. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2888 | DEFUN (neighbor_port, |
| 2889 | neighbor_port_cmd, |
| 2890 | NEIGHBOR_CMD "port <0-65535>", |
| 2891 | NEIGHBOR_STR |
| 2892 | NEIGHBOR_ADDR_STR |
| 2893 | "Neighbor's BGP port\n" |
| 2894 | "TCP port number\n") |
| 2895 | { |
| 2896 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); |
| 2897 | } |
| 2898 | |
| 2899 | DEFUN (no_neighbor_port, |
| 2900 | no_neighbor_port_cmd, |
| 2901 | NO_NEIGHBOR_CMD "port", |
| 2902 | NO_STR |
| 2903 | NEIGHBOR_STR |
| 2904 | NEIGHBOR_ADDR_STR |
| 2905 | "Neighbor's BGP port\n") |
| 2906 | { |
| 2907 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); |
| 2908 | } |
| 2909 | |
| 2910 | ALIAS (no_neighbor_port, |
| 2911 | no_neighbor_port_val_cmd, |
| 2912 | NO_NEIGHBOR_CMD "port <0-65535>", |
| 2913 | NO_STR |
| 2914 | NEIGHBOR_STR |
| 2915 | NEIGHBOR_ADDR_STR |
| 2916 | "Neighbor's BGP port\n" |
| 2917 | "TCP port number\n") |
| 2918 | |
| 2919 | /* neighbor weight. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2920 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2921 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
| 2922 | const char *weight_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2923 | { |
| 2924 | int ret; |
| 2925 | struct peer *peer; |
| 2926 | unsigned long weight; |
| 2927 | |
| 2928 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2929 | if (! peer) |
| 2930 | return CMD_WARNING; |
| 2931 | |
| 2932 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); |
| 2933 | |
| 2934 | ret = peer_weight_set (peer, weight); |
| 2935 | |
| 2936 | return CMD_SUCCESS; |
| 2937 | } |
| 2938 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2939 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2940 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2941 | { |
| 2942 | struct peer *peer; |
| 2943 | |
| 2944 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2945 | if (! peer) |
| 2946 | return CMD_WARNING; |
| 2947 | |
| 2948 | peer_weight_unset (peer); |
| 2949 | |
| 2950 | return CMD_SUCCESS; |
| 2951 | } |
| 2952 | |
| 2953 | DEFUN (neighbor_weight, |
| 2954 | neighbor_weight_cmd, |
| 2955 | NEIGHBOR_CMD2 "weight <0-65535>", |
| 2956 | NEIGHBOR_STR |
| 2957 | NEIGHBOR_ADDR_STR2 |
| 2958 | "Set default weight for routes from this neighbor\n" |
| 2959 | "default weight\n") |
| 2960 | { |
| 2961 | return peer_weight_set_vty (vty, argv[0], argv[1]); |
| 2962 | } |
| 2963 | |
| 2964 | DEFUN (no_neighbor_weight, |
| 2965 | no_neighbor_weight_cmd, |
| 2966 | NO_NEIGHBOR_CMD2 "weight", |
| 2967 | NO_STR |
| 2968 | NEIGHBOR_STR |
| 2969 | NEIGHBOR_ADDR_STR2 |
| 2970 | "Set default weight for routes from this neighbor\n") |
| 2971 | { |
| 2972 | return peer_weight_unset_vty (vty, argv[0]); |
| 2973 | } |
| 2974 | |
| 2975 | ALIAS (no_neighbor_weight, |
| 2976 | no_neighbor_weight_val_cmd, |
| 2977 | NO_NEIGHBOR_CMD2 "weight <0-65535>", |
| 2978 | NO_STR |
| 2979 | NEIGHBOR_STR |
| 2980 | NEIGHBOR_ADDR_STR2 |
| 2981 | "Set default weight for routes from this neighbor\n" |
| 2982 | "default weight\n") |
| 2983 | |
| 2984 | /* Override capability negotiation. */ |
| 2985 | DEFUN (neighbor_override_capability, |
| 2986 | neighbor_override_capability_cmd, |
| 2987 | NEIGHBOR_CMD2 "override-capability", |
| 2988 | NEIGHBOR_STR |
| 2989 | NEIGHBOR_ADDR_STR2 |
| 2990 | "Override capability negotiation result\n") |
| 2991 | { |
| 2992 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 2993 | } |
| 2994 | |
| 2995 | DEFUN (no_neighbor_override_capability, |
| 2996 | no_neighbor_override_capability_cmd, |
| 2997 | NO_NEIGHBOR_CMD2 "override-capability", |
| 2998 | NO_STR |
| 2999 | NEIGHBOR_STR |
| 3000 | NEIGHBOR_ADDR_STR2 |
| 3001 | "Override capability negotiation result\n") |
| 3002 | { |
| 3003 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 3004 | } |
| 3005 | |
| 3006 | DEFUN (neighbor_strict_capability, |
| 3007 | neighbor_strict_capability_cmd, |
| 3008 | NEIGHBOR_CMD "strict-capability-match", |
| 3009 | NEIGHBOR_STR |
| 3010 | NEIGHBOR_ADDR_STR |
| 3011 | "Strict capability negotiation match\n") |
| 3012 | { |
| 3013 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3014 | } |
| 3015 | |
| 3016 | DEFUN (no_neighbor_strict_capability, |
| 3017 | no_neighbor_strict_capability_cmd, |
| 3018 | NO_NEIGHBOR_CMD "strict-capability-match", |
| 3019 | NO_STR |
| 3020 | NEIGHBOR_STR |
| 3021 | NEIGHBOR_ADDR_STR |
| 3022 | "Strict capability negotiation match\n") |
| 3023 | { |
| 3024 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3025 | } |
| 3026 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3027 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3028 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
| 3029 | const char *keep_str, const char *hold_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3030 | { |
| 3031 | int ret; |
| 3032 | struct peer *peer; |
| 3033 | u_int32_t keepalive; |
| 3034 | u_int32_t holdtime; |
| 3035 | |
| 3036 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3037 | if (! peer) |
| 3038 | return CMD_WARNING; |
| 3039 | |
| 3040 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); |
| 3041 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); |
| 3042 | |
| 3043 | ret = peer_timers_set (peer, keepalive, holdtime); |
| 3044 | |
| 3045 | return bgp_vty_return (vty, ret); |
| 3046 | } |
| 3047 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3048 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3049 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3050 | { |
| 3051 | int ret; |
| 3052 | struct peer *peer; |
| 3053 | |
| 3054 | peer = peer_lookup_vty (vty, ip_str); |
| 3055 | if (! peer) |
| 3056 | return CMD_WARNING; |
| 3057 | |
| 3058 | ret = peer_timers_unset (peer); |
| 3059 | |
| 3060 | return bgp_vty_return (vty, ret); |
| 3061 | } |
| 3062 | |
| 3063 | DEFUN (neighbor_timers, |
| 3064 | neighbor_timers_cmd, |
| 3065 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", |
| 3066 | NEIGHBOR_STR |
| 3067 | NEIGHBOR_ADDR_STR2 |
| 3068 | "BGP per neighbor timers\n" |
| 3069 | "Keepalive interval\n" |
| 3070 | "Holdtime\n") |
| 3071 | { |
| 3072 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); |
| 3073 | } |
| 3074 | |
| 3075 | DEFUN (no_neighbor_timers, |
| 3076 | no_neighbor_timers_cmd, |
| 3077 | NO_NEIGHBOR_CMD2 "timers", |
| 3078 | NO_STR |
| 3079 | NEIGHBOR_STR |
| 3080 | NEIGHBOR_ADDR_STR2 |
| 3081 | "BGP per neighbor timers\n") |
| 3082 | { |
| 3083 | return peer_timers_unset_vty (vty, argv[0]); |
| 3084 | } |
| 3085 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3086 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3087 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
| 3088 | const char *time_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3089 | { |
| 3090 | int ret; |
| 3091 | struct peer *peer; |
| 3092 | u_int32_t connect; |
| 3093 | |
| 3094 | peer = peer_lookup_vty (vty, ip_str); |
| 3095 | if (! peer) |
| 3096 | return CMD_WARNING; |
| 3097 | |
| 3098 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); |
| 3099 | |
| 3100 | ret = peer_timers_connect_set (peer, connect); |
| 3101 | |
| 3102 | return CMD_SUCCESS; |
| 3103 | } |
| 3104 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3105 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3106 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3107 | { |
| 3108 | int ret; |
| 3109 | struct peer *peer; |
| 3110 | |
| 3111 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3112 | if (! peer) |
| 3113 | return CMD_WARNING; |
| 3114 | |
| 3115 | ret = peer_timers_connect_unset (peer); |
| 3116 | |
| 3117 | return CMD_SUCCESS; |
| 3118 | } |
| 3119 | |
| 3120 | DEFUN (neighbor_timers_connect, |
| 3121 | neighbor_timers_connect_cmd, |
| 3122 | NEIGHBOR_CMD "timers connect <0-65535>", |
| 3123 | NEIGHBOR_STR |
| 3124 | NEIGHBOR_ADDR_STR |
| 3125 | "BGP per neighbor timers\n" |
| 3126 | "BGP connect timer\n" |
| 3127 | "Connect timer\n") |
| 3128 | { |
| 3129 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); |
| 3130 | } |
| 3131 | |
| 3132 | DEFUN (no_neighbor_timers_connect, |
| 3133 | no_neighbor_timers_connect_cmd, |
| 3134 | NO_NEIGHBOR_CMD "timers connect", |
| 3135 | NO_STR |
| 3136 | NEIGHBOR_STR |
| 3137 | NEIGHBOR_ADDR_STR |
| 3138 | "BGP per neighbor timers\n" |
| 3139 | "BGP connect timer\n") |
| 3140 | { |
| 3141 | return peer_timers_connect_unset_vty (vty, argv[0]); |
| 3142 | } |
| 3143 | |
| 3144 | ALIAS (no_neighbor_timers_connect, |
| 3145 | no_neighbor_timers_connect_val_cmd, |
| 3146 | NO_NEIGHBOR_CMD "timers connect <0-65535>", |
| 3147 | NO_STR |
| 3148 | NEIGHBOR_STR |
| 3149 | NEIGHBOR_ADDR_STR |
| 3150 | "BGP per neighbor timers\n" |
| 3151 | "BGP connect timer\n" |
| 3152 | "Connect timer\n") |
| 3153 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3154 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3155 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
| 3156 | const char *time_str, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3157 | { |
| 3158 | int ret; |
| 3159 | struct peer *peer; |
| 3160 | u_int32_t routeadv = 0; |
| 3161 | |
| 3162 | peer = peer_lookup_vty (vty, ip_str); |
| 3163 | if (! peer) |
| 3164 | return CMD_WARNING; |
| 3165 | |
| 3166 | if (time_str) |
| 3167 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); |
| 3168 | |
| 3169 | if (set) |
| 3170 | ret = peer_advertise_interval_set (peer, routeadv); |
| 3171 | else |
| 3172 | ret = peer_advertise_interval_unset (peer); |
| 3173 | |
| 3174 | return CMD_SUCCESS; |
| 3175 | } |
| 3176 | |
| 3177 | DEFUN (neighbor_advertise_interval, |
| 3178 | neighbor_advertise_interval_cmd, |
| 3179 | NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3180 | NEIGHBOR_STR |
| 3181 | NEIGHBOR_ADDR_STR |
| 3182 | "Minimum interval between sending BGP routing updates\n" |
| 3183 | "time in seconds\n") |
| 3184 | { |
| 3185 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); |
| 3186 | } |
| 3187 | |
| 3188 | DEFUN (no_neighbor_advertise_interval, |
| 3189 | no_neighbor_advertise_interval_cmd, |
| 3190 | NO_NEIGHBOR_CMD "advertisement-interval", |
| 3191 | NO_STR |
| 3192 | NEIGHBOR_STR |
| 3193 | NEIGHBOR_ADDR_STR |
| 3194 | "Minimum interval between sending BGP routing updates\n") |
| 3195 | { |
| 3196 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); |
| 3197 | } |
| 3198 | |
| 3199 | ALIAS (no_neighbor_advertise_interval, |
| 3200 | no_neighbor_advertise_interval_val_cmd, |
| 3201 | NO_NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3202 | NO_STR |
| 3203 | NEIGHBOR_STR |
| 3204 | NEIGHBOR_ADDR_STR |
| 3205 | "Minimum interval between sending BGP routing updates\n" |
| 3206 | "time in seconds\n") |
| 3207 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3208 | /* neighbor interface */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3209 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3210 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3211 | { |
| 3212 | int ret; |
| 3213 | struct peer *peer; |
| 3214 | |
| 3215 | peer = peer_lookup_vty (vty, ip_str); |
| 3216 | if (! peer) |
| 3217 | return CMD_WARNING; |
| 3218 | |
| 3219 | if (str) |
| 3220 | ret = peer_interface_set (peer, str); |
| 3221 | else |
| 3222 | ret = peer_interface_unset (peer); |
| 3223 | |
| 3224 | return CMD_SUCCESS; |
| 3225 | } |
| 3226 | |
| 3227 | DEFUN (neighbor_interface, |
| 3228 | neighbor_interface_cmd, |
| 3229 | NEIGHBOR_CMD "interface WORD", |
| 3230 | NEIGHBOR_STR |
| 3231 | NEIGHBOR_ADDR_STR |
| 3232 | "Interface\n" |
| 3233 | "Interface name\n") |
| 3234 | { |
| 3235 | return peer_interface_vty (vty, argv[0], argv[1]); |
| 3236 | } |
| 3237 | |
| 3238 | DEFUN (no_neighbor_interface, |
| 3239 | no_neighbor_interface_cmd, |
| 3240 | NO_NEIGHBOR_CMD "interface WORD", |
| 3241 | NO_STR |
| 3242 | NEIGHBOR_STR |
| 3243 | NEIGHBOR_ADDR_STR |
| 3244 | "Interface\n" |
| 3245 | "Interface name\n") |
| 3246 | { |
| 3247 | return peer_interface_vty (vty, argv[0], NULL); |
| 3248 | } |
| 3249 | |
| 3250 | /* Set distribute list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3251 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3252 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
| 3253 | afi_t afi, safi_t safi, |
| 3254 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3255 | { |
| 3256 | int ret; |
| 3257 | struct peer *peer; |
| 3258 | int direct = FILTER_IN; |
| 3259 | |
| 3260 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3261 | if (! peer) |
| 3262 | return CMD_WARNING; |
| 3263 | |
| 3264 | /* Check filter direction. */ |
| 3265 | if (strncmp (direct_str, "i", 1) == 0) |
| 3266 | direct = FILTER_IN; |
| 3267 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3268 | direct = FILTER_OUT; |
| 3269 | |
| 3270 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); |
| 3271 | |
| 3272 | return bgp_vty_return (vty, ret); |
| 3273 | } |
| 3274 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3275 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3276 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3277 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3278 | { |
| 3279 | int ret; |
| 3280 | struct peer *peer; |
| 3281 | int direct = FILTER_IN; |
| 3282 | |
| 3283 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3284 | if (! peer) |
| 3285 | return CMD_WARNING; |
| 3286 | |
| 3287 | /* Check filter direction. */ |
| 3288 | if (strncmp (direct_str, "i", 1) == 0) |
| 3289 | direct = FILTER_IN; |
| 3290 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3291 | direct = FILTER_OUT; |
| 3292 | |
| 3293 | ret = peer_distribute_unset (peer, afi, safi, direct); |
| 3294 | |
| 3295 | return bgp_vty_return (vty, ret); |
| 3296 | } |
| 3297 | |
| 3298 | DEFUN (neighbor_distribute_list, |
| 3299 | neighbor_distribute_list_cmd, |
| 3300 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3301 | NEIGHBOR_STR |
| 3302 | NEIGHBOR_ADDR_STR2 |
| 3303 | "Filter updates to/from this neighbor\n" |
| 3304 | "IP access-list number\n" |
| 3305 | "IP access-list number (expanded range)\n" |
| 3306 | "IP Access-list name\n" |
| 3307 | "Filter incoming updates\n" |
| 3308 | "Filter outgoing updates\n") |
| 3309 | { |
| 3310 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3311 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3312 | } |
| 3313 | |
| 3314 | DEFUN (no_neighbor_distribute_list, |
| 3315 | no_neighbor_distribute_list_cmd, |
| 3316 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3317 | NO_STR |
| 3318 | NEIGHBOR_STR |
| 3319 | NEIGHBOR_ADDR_STR2 |
| 3320 | "Filter updates to/from this neighbor\n" |
| 3321 | "IP access-list number\n" |
| 3322 | "IP access-list number (expanded range)\n" |
| 3323 | "IP Access-list name\n" |
| 3324 | "Filter incoming updates\n" |
| 3325 | "Filter outgoing updates\n") |
| 3326 | { |
| 3327 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3328 | bgp_node_safi (vty), argv[2]); |
| 3329 | } |
| 3330 | |
| 3331 | /* Set prefix list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3332 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3333 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3334 | safi_t safi, const char *name_str, |
| 3335 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3336 | { |
| 3337 | int ret; |
| 3338 | struct peer *peer; |
| 3339 | int direct = FILTER_IN; |
| 3340 | |
| 3341 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3342 | if (! peer) |
| 3343 | return CMD_WARNING; |
| 3344 | |
| 3345 | /* Check filter direction. */ |
| 3346 | if (strncmp (direct_str, "i", 1) == 0) |
| 3347 | direct = FILTER_IN; |
| 3348 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3349 | direct = FILTER_OUT; |
| 3350 | |
| 3351 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); |
| 3352 | |
| 3353 | return bgp_vty_return (vty, ret); |
| 3354 | } |
| 3355 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3356 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3357 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3358 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3359 | { |
| 3360 | int ret; |
| 3361 | struct peer *peer; |
| 3362 | int direct = FILTER_IN; |
| 3363 | |
| 3364 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3365 | if (! peer) |
| 3366 | return CMD_WARNING; |
| 3367 | |
| 3368 | /* Check filter direction. */ |
| 3369 | if (strncmp (direct_str, "i", 1) == 0) |
| 3370 | direct = FILTER_IN; |
| 3371 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3372 | direct = FILTER_OUT; |
| 3373 | |
| 3374 | ret = peer_prefix_list_unset (peer, afi, safi, direct); |
| 3375 | |
| 3376 | return bgp_vty_return (vty, ret); |
| 3377 | } |
| 3378 | |
| 3379 | DEFUN (neighbor_prefix_list, |
| 3380 | neighbor_prefix_list_cmd, |
| 3381 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3382 | NEIGHBOR_STR |
| 3383 | NEIGHBOR_ADDR_STR2 |
| 3384 | "Filter updates to/from this neighbor\n" |
| 3385 | "Name of a prefix list\n" |
| 3386 | "Filter incoming updates\n" |
| 3387 | "Filter outgoing updates\n") |
| 3388 | { |
| 3389 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3390 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3391 | } |
| 3392 | |
| 3393 | DEFUN (no_neighbor_prefix_list, |
| 3394 | no_neighbor_prefix_list_cmd, |
| 3395 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3396 | NO_STR |
| 3397 | NEIGHBOR_STR |
| 3398 | NEIGHBOR_ADDR_STR2 |
| 3399 | "Filter updates to/from this neighbor\n" |
| 3400 | "Name of a prefix list\n" |
| 3401 | "Filter incoming updates\n" |
| 3402 | "Filter outgoing updates\n") |
| 3403 | { |
| 3404 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3405 | bgp_node_safi (vty), argv[2]); |
| 3406 | } |
| 3407 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3408 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3409 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
| 3410 | afi_t afi, safi_t safi, |
| 3411 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3412 | { |
| 3413 | int ret; |
| 3414 | struct peer *peer; |
| 3415 | int direct = FILTER_IN; |
| 3416 | |
| 3417 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3418 | if (! peer) |
| 3419 | return CMD_WARNING; |
| 3420 | |
| 3421 | /* Check filter direction. */ |
| 3422 | if (strncmp (direct_str, "i", 1) == 0) |
| 3423 | direct = FILTER_IN; |
| 3424 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3425 | direct = FILTER_OUT; |
| 3426 | |
| 3427 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); |
| 3428 | |
| 3429 | return bgp_vty_return (vty, ret); |
| 3430 | } |
| 3431 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3432 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3433 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
| 3434 | afi_t afi, safi_t safi, |
| 3435 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3436 | { |
| 3437 | int ret; |
| 3438 | struct peer *peer; |
| 3439 | int direct = FILTER_IN; |
| 3440 | |
| 3441 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3442 | if (! peer) |
| 3443 | return CMD_WARNING; |
| 3444 | |
| 3445 | /* Check filter direction. */ |
| 3446 | if (strncmp (direct_str, "i", 1) == 0) |
| 3447 | direct = FILTER_IN; |
| 3448 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3449 | direct = FILTER_OUT; |
| 3450 | |
| 3451 | ret = peer_aslist_unset (peer, afi, safi, direct); |
| 3452 | |
| 3453 | return bgp_vty_return (vty, ret); |
| 3454 | } |
| 3455 | |
| 3456 | DEFUN (neighbor_filter_list, |
| 3457 | neighbor_filter_list_cmd, |
| 3458 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3459 | NEIGHBOR_STR |
| 3460 | NEIGHBOR_ADDR_STR2 |
| 3461 | "Establish BGP filters\n" |
| 3462 | "AS path access-list name\n" |
| 3463 | "Filter incoming routes\n" |
| 3464 | "Filter outgoing routes\n") |
| 3465 | { |
| 3466 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3467 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3468 | } |
| 3469 | |
| 3470 | DEFUN (no_neighbor_filter_list, |
| 3471 | no_neighbor_filter_list_cmd, |
| 3472 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3473 | NO_STR |
| 3474 | NEIGHBOR_STR |
| 3475 | NEIGHBOR_ADDR_STR2 |
| 3476 | "Establish BGP filters\n" |
| 3477 | "AS path access-list name\n" |
| 3478 | "Filter incoming routes\n" |
| 3479 | "Filter outgoing routes\n") |
| 3480 | { |
| 3481 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3482 | bgp_node_safi (vty), argv[2]); |
| 3483 | } |
| 3484 | |
| 3485 | /* Set route-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3486 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3487 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
| 3488 | afi_t afi, safi_t safi, |
| 3489 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3490 | { |
| 3491 | int ret; |
| 3492 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3493 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3494 | |
| 3495 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3496 | if (! peer) |
| 3497 | return CMD_WARNING; |
| 3498 | |
| 3499 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3500 | if (strncmp (direct_str, "in", 2) == 0) |
| 3501 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3502 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3503 | direct = RMAP_OUT; |
| 3504 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3505 | direct = RMAP_IMPORT; |
| 3506 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3507 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3508 | |
| 3509 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); |
| 3510 | |
| 3511 | return bgp_vty_return (vty, ret); |
| 3512 | } |
| 3513 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3514 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3515 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3516 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3517 | { |
| 3518 | int ret; |
| 3519 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3520 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3521 | |
| 3522 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3523 | if (! peer) |
| 3524 | return CMD_WARNING; |
| 3525 | |
| 3526 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3527 | if (strncmp (direct_str, "in", 2) == 0) |
| 3528 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3529 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3530 | direct = RMAP_OUT; |
| 3531 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3532 | direct = RMAP_IMPORT; |
| 3533 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3534 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3535 | |
| 3536 | ret = peer_route_map_unset (peer, afi, safi, direct); |
| 3537 | |
| 3538 | return bgp_vty_return (vty, ret); |
| 3539 | } |
| 3540 | |
| 3541 | DEFUN (neighbor_route_map, |
| 3542 | neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3543 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3544 | NEIGHBOR_STR |
| 3545 | NEIGHBOR_ADDR_STR2 |
| 3546 | "Apply route map to neighbor\n" |
| 3547 | "Name of route map\n" |
| 3548 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3549 | "Apply map to outbound routes\n" |
| 3550 | "Apply map to routes going into a Route-Server client's table\n" |
| 3551 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3552 | { |
| 3553 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3554 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3555 | } |
| 3556 | |
| 3557 | DEFUN (no_neighbor_route_map, |
| 3558 | no_neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3559 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3560 | NO_STR |
| 3561 | NEIGHBOR_STR |
| 3562 | NEIGHBOR_ADDR_STR2 |
| 3563 | "Apply route map to neighbor\n" |
| 3564 | "Name of route map\n" |
| 3565 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3566 | "Apply map to outbound routes\n" |
| 3567 | "Apply map to routes going into a Route-Server client's table\n" |
| 3568 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3569 | { |
| 3570 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3571 | bgp_node_safi (vty), argv[2]); |
| 3572 | } |
| 3573 | |
| 3574 | /* Set unsuppress-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3575 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3576 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3577 | safi_t safi, const char *name_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3578 | { |
| 3579 | int ret; |
| 3580 | struct peer *peer; |
| 3581 | |
| 3582 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3583 | if (! peer) |
| 3584 | return CMD_WARNING; |
| 3585 | |
| 3586 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); |
| 3587 | |
| 3588 | return bgp_vty_return (vty, ret); |
| 3589 | } |
| 3590 | |
| 3591 | /* Unset route-map from the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3592 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3593 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3594 | safi_t safi) |
| 3595 | { |
| 3596 | int ret; |
| 3597 | struct peer *peer; |
| 3598 | |
| 3599 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3600 | if (! peer) |
| 3601 | return CMD_WARNING; |
| 3602 | |
| 3603 | ret = peer_unsuppress_map_unset (peer, afi, safi); |
| 3604 | |
| 3605 | return bgp_vty_return (vty, ret); |
| 3606 | } |
| 3607 | |
| 3608 | DEFUN (neighbor_unsuppress_map, |
| 3609 | neighbor_unsuppress_map_cmd, |
| 3610 | NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3611 | NEIGHBOR_STR |
| 3612 | NEIGHBOR_ADDR_STR2 |
| 3613 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3614 | "Name of route map\n") |
| 3615 | { |
| 3616 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3617 | bgp_node_safi (vty), argv[1]); |
| 3618 | } |
| 3619 | |
| 3620 | DEFUN (no_neighbor_unsuppress_map, |
| 3621 | no_neighbor_unsuppress_map_cmd, |
| 3622 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3623 | NO_STR |
| 3624 | NEIGHBOR_STR |
| 3625 | NEIGHBOR_ADDR_STR2 |
| 3626 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3627 | "Name of route map\n") |
| 3628 | { |
| 3629 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3630 | bgp_node_safi (vty)); |
| 3631 | } |
| 3632 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3633 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3634 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3635 | safi_t safi, const char *num_str, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3636 | const char *threshold_str, int warning, |
| 3637 | const char *restart_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3638 | { |
| 3639 | int ret; |
| 3640 | struct peer *peer; |
| 3641 | u_int32_t max; |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3642 | u_char threshold; |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3643 | u_int16_t restart; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3644 | |
| 3645 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3646 | if (! peer) |
| 3647 | return CMD_WARNING; |
| 3648 | |
| 3649 | VTY_GET_INTEGER ("maxmum number", max, num_str); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3650 | if (threshold_str) |
| 3651 | threshold = atoi (threshold_str); |
| 3652 | else |
| 3653 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3654 | |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3655 | if (restart_str) |
| 3656 | restart = atoi (restart_str); |
| 3657 | else |
| 3658 | restart = 0; |
| 3659 | |
| 3660 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3661 | |
| 3662 | return bgp_vty_return (vty, ret); |
| 3663 | } |
| 3664 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3665 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3666 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3667 | safi_t safi) |
| 3668 | { |
| 3669 | int ret; |
| 3670 | struct peer *peer; |
| 3671 | |
| 3672 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3673 | if (! peer) |
| 3674 | return CMD_WARNING; |
| 3675 | |
| 3676 | ret = peer_maximum_prefix_unset (peer, afi, safi); |
| 3677 | |
| 3678 | return bgp_vty_return (vty, ret); |
| 3679 | } |
| 3680 | |
| 3681 | /* Maximum number of prefix configuration. prefix count is different |
| 3682 | for each peer configuration. So this configuration can be set for |
| 3683 | each peer configuration. */ |
| 3684 | DEFUN (neighbor_maximum_prefix, |
| 3685 | neighbor_maximum_prefix_cmd, |
| 3686 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3687 | NEIGHBOR_STR |
| 3688 | NEIGHBOR_ADDR_STR2 |
| 3689 | "Maximum number of prefix accept from this peer\n" |
| 3690 | "maximum no. of prefix limit\n") |
| 3691 | { |
| 3692 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3693 | bgp_node_safi (vty), argv[1], NULL, 0, |
| 3694 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3695 | } |
| 3696 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3697 | DEFUN (neighbor_maximum_prefix_threshold, |
| 3698 | neighbor_maximum_prefix_threshold_cmd, |
| 3699 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", |
| 3700 | NEIGHBOR_STR |
| 3701 | NEIGHBOR_ADDR_STR2 |
| 3702 | "Maximum number of prefix accept from this peer\n" |
| 3703 | "maximum no. of prefix limit\n" |
| 3704 | "Threshold value (%) at which to generate a warning msg\n") |
| 3705 | { |
| 3706 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3707 | bgp_node_safi (vty), argv[1], argv[2], 0, |
| 3708 | NULL); |
| 3709 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3710 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3711 | DEFUN (neighbor_maximum_prefix_warning, |
| 3712 | neighbor_maximum_prefix_warning_cmd, |
| 3713 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3714 | NEIGHBOR_STR |
| 3715 | NEIGHBOR_ADDR_STR2 |
| 3716 | "Maximum number of prefix accept from this peer\n" |
| 3717 | "maximum no. of prefix limit\n" |
| 3718 | "Only give warning message when limit is exceeded\n") |
| 3719 | { |
| 3720 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3721 | bgp_node_safi (vty), argv[1], NULL, 1, |
| 3722 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3723 | } |
| 3724 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3725 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
| 3726 | neighbor_maximum_prefix_threshold_warning_cmd, |
| 3727 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 3728 | NEIGHBOR_STR |
| 3729 | NEIGHBOR_ADDR_STR2 |
| 3730 | "Maximum number of prefix accept from this peer\n" |
| 3731 | "maximum no. of prefix limit\n" |
| 3732 | "Threshold value (%) at which to generate a warning msg\n" |
| 3733 | "Only give warning message when limit is exceeded\n") |
| 3734 | { |
| 3735 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3736 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
| 3737 | } |
| 3738 | |
| 3739 | DEFUN (neighbor_maximum_prefix_restart, |
| 3740 | neighbor_maximum_prefix_restart_cmd, |
| 3741 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
| 3742 | NEIGHBOR_STR |
| 3743 | NEIGHBOR_ADDR_STR2 |
| 3744 | "Maximum number of prefix accept from this peer\n" |
| 3745 | "maximum no. of prefix limit\n" |
| 3746 | "Restart bgp connection after limit is exceeded\n" |
| 3747 | "Restart interval in minutes") |
| 3748 | { |
| 3749 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3750 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); |
| 3751 | } |
| 3752 | |
| 3753 | DEFUN (neighbor_maximum_prefix_threshold_restart, |
| 3754 | neighbor_maximum_prefix_threshold_restart_cmd, |
| 3755 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 3756 | NEIGHBOR_STR |
| 3757 | NEIGHBOR_ADDR_STR2 |
| 3758 | "Maximum number of prefix accept from this peer\n" |
| 3759 | "maximum no. of prefix limit\n" |
| 3760 | "Threshold value (%) at which to generate a warning msg\n" |
| 3761 | "Restart bgp connection after limit is exceeded\n" |
| 3762 | "Restart interval in minutes") |
| 3763 | { |
| 3764 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3765 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); |
| 3766 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3767 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3768 | DEFUN (no_neighbor_maximum_prefix, |
| 3769 | no_neighbor_maximum_prefix_cmd, |
| 3770 | NO_NEIGHBOR_CMD2 "maximum-prefix", |
| 3771 | NO_STR |
| 3772 | NEIGHBOR_STR |
| 3773 | NEIGHBOR_ADDR_STR2 |
| 3774 | "Maximum number of prefix accept from this peer\n") |
| 3775 | { |
| 3776 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3777 | bgp_node_safi (vty)); |
| 3778 | } |
| 3779 | |
| 3780 | ALIAS (no_neighbor_maximum_prefix, |
| 3781 | no_neighbor_maximum_prefix_val_cmd, |
| 3782 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3783 | NO_STR |
| 3784 | NEIGHBOR_STR |
| 3785 | NEIGHBOR_ADDR_STR2 |
| 3786 | "Maximum number of prefix accept from this peer\n" |
| 3787 | "maximum no. of prefix limit\n") |
| 3788 | |
| 3789 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3790 | no_neighbor_maximum_prefix_threshold_cmd, |
| 3791 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3792 | NO_STR |
| 3793 | NEIGHBOR_STR |
| 3794 | NEIGHBOR_ADDR_STR2 |
| 3795 | "Maximum number of prefix accept from this peer\n" |
| 3796 | "maximum no. of prefix limit\n" |
| 3797 | "Threshold value (%) at which to generate a warning msg\n") |
| 3798 | |
| 3799 | ALIAS (no_neighbor_maximum_prefix, |
| 3800 | no_neighbor_maximum_prefix_warning_cmd, |
| 3801 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3802 | NO_STR |
| 3803 | NEIGHBOR_STR |
| 3804 | NEIGHBOR_ADDR_STR2 |
| 3805 | "Maximum number of prefix accept from this peer\n" |
| 3806 | "maximum no. of prefix limit\n" |
| 3807 | "Only give warning message when limit is exceeded\n"); |
| 3808 | |
| 3809 | ALIAS (no_neighbor_maximum_prefix, |
| 3810 | no_neighbor_maximum_prefix_threshold_warning_cmd, |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3811 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 3812 | NO_STR |
| 3813 | NEIGHBOR_STR |
| 3814 | NEIGHBOR_ADDR_STR2 |
| 3815 | "Maximum number of prefix accept from this peer\n" |
| 3816 | "maximum no. of prefix limit\n" |
| 3817 | "Threshold value (%) at which to generate a warning msg\n" |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3818 | "Only give warning message when limit is exceeded\n"); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3819 | |
| 3820 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3821 | no_neighbor_maximum_prefix_restart_cmd, |
| 3822 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3823 | NO_STR |
| 3824 | NEIGHBOR_STR |
| 3825 | NEIGHBOR_ADDR_STR2 |
| 3826 | "Maximum number of prefix accept from this peer\n" |
| 3827 | "maximum no. of prefix limit\n" |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3828 | "Restart bgp connection after limit is exceeded\n" |
| 3829 | "Restart interval in minutes") |
| 3830 | |
| 3831 | ALIAS (no_neighbor_maximum_prefix, |
| 3832 | no_neighbor_maximum_prefix_threshold_restart_cmd, |
| 3833 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 3834 | NO_STR |
| 3835 | NEIGHBOR_STR |
| 3836 | NEIGHBOR_ADDR_STR2 |
| 3837 | "Maximum number of prefix accept from this peer\n" |
| 3838 | "maximum no. of prefix limit\n" |
| 3839 | "Threshold value (%) at which to generate a warning msg\n" |
| 3840 | "Restart bgp connection after limit is exceeded\n" |
| 3841 | "Restart interval in minutes") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3842 | |
| 3843 | /* "neighbor allowas-in" */ |
| 3844 | DEFUN (neighbor_allowas_in, |
| 3845 | neighbor_allowas_in_cmd, |
| 3846 | NEIGHBOR_CMD2 "allowas-in", |
| 3847 | NEIGHBOR_STR |
| 3848 | NEIGHBOR_ADDR_STR2 |
| 3849 | "Accept as-path with my AS present in it\n") |
| 3850 | { |
| 3851 | int ret; |
| 3852 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3853 | unsigned int allow_num; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3854 | |
| 3855 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3856 | if (! peer) |
| 3857 | return CMD_WARNING; |
| 3858 | |
| 3859 | if (argc == 1) |
| 3860 | allow_num = 3; |
| 3861 | else |
| 3862 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); |
| 3863 | |
| 3864 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), |
| 3865 | allow_num); |
| 3866 | |
| 3867 | return bgp_vty_return (vty, ret); |
| 3868 | } |
| 3869 | |
| 3870 | ALIAS (neighbor_allowas_in, |
| 3871 | neighbor_allowas_in_arg_cmd, |
| 3872 | NEIGHBOR_CMD2 "allowas-in <1-10>", |
| 3873 | NEIGHBOR_STR |
| 3874 | NEIGHBOR_ADDR_STR2 |
| 3875 | "Accept as-path with my AS present in it\n" |
| 3876 | "Number of occurances of AS number\n") |
| 3877 | |
| 3878 | DEFUN (no_neighbor_allowas_in, |
| 3879 | no_neighbor_allowas_in_cmd, |
| 3880 | NO_NEIGHBOR_CMD2 "allowas-in", |
| 3881 | NO_STR |
| 3882 | NEIGHBOR_STR |
| 3883 | NEIGHBOR_ADDR_STR2 |
| 3884 | "allow local ASN appears in aspath attribute\n") |
| 3885 | { |
| 3886 | int ret; |
| 3887 | struct peer *peer; |
| 3888 | |
| 3889 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3890 | if (! peer) |
| 3891 | return CMD_WARNING; |
| 3892 | |
| 3893 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 3894 | |
| 3895 | return bgp_vty_return (vty, ret); |
| 3896 | } |
| 3897 | |
| 3898 | /* Address family configuration. */ |
| 3899 | DEFUN (address_family_ipv4, |
| 3900 | address_family_ipv4_cmd, |
| 3901 | "address-family ipv4", |
| 3902 | "Enter Address Family command mode\n" |
| 3903 | "Address family\n") |
| 3904 | { |
| 3905 | vty->node = BGP_IPV4_NODE; |
| 3906 | return CMD_SUCCESS; |
| 3907 | } |
| 3908 | |
| 3909 | DEFUN (address_family_ipv4_safi, |
| 3910 | address_family_ipv4_safi_cmd, |
| 3911 | "address-family ipv4 (unicast|multicast)", |
| 3912 | "Enter Address Family command mode\n" |
| 3913 | "Address family\n" |
| 3914 | "Address Family modifier\n" |
| 3915 | "Address Family modifier\n") |
| 3916 | { |
| 3917 | if (strncmp (argv[0], "m", 1) == 0) |
| 3918 | vty->node = BGP_IPV4M_NODE; |
| 3919 | else |
| 3920 | vty->node = BGP_IPV4_NODE; |
| 3921 | |
| 3922 | return CMD_SUCCESS; |
| 3923 | } |
| 3924 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 3925 | DEFUN (address_family_ipv6, |
| 3926 | address_family_ipv6_cmd, |
| 3927 | "address-family ipv6", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3928 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 3929 | "Address family\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3930 | { |
| 3931 | vty->node = BGP_IPV6_NODE; |
| 3932 | return CMD_SUCCESS; |
| 3933 | } |
| 3934 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 3935 | DEFUN (address_family_ipv6_safi, |
| 3936 | address_family_ipv6_safi_cmd, |
| 3937 | "address-family ipv6 (unicast|multicast)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3938 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 3939 | "Address family\n" |
| 3940 | "Address Family modifier\n" |
| 3941 | "Address Family modifier\n") |
| 3942 | { |
| 3943 | if (strncmp (argv[0], "m", 1) == 0) |
| 3944 | vty->node = BGP_IPV6M_NODE; |
| 3945 | else |
| 3946 | vty->node = BGP_IPV6_NODE; |
| 3947 | |
| 3948 | return CMD_SUCCESS; |
| 3949 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3950 | |
| 3951 | DEFUN (address_family_vpnv4, |
| 3952 | address_family_vpnv4_cmd, |
| 3953 | "address-family vpnv4", |
| 3954 | "Enter Address Family command mode\n" |
| 3955 | "Address family\n") |
| 3956 | { |
| 3957 | vty->node = BGP_VPNV4_NODE; |
| 3958 | return CMD_SUCCESS; |
| 3959 | } |
| 3960 | |
| 3961 | ALIAS (address_family_vpnv4, |
| 3962 | address_family_vpnv4_unicast_cmd, |
| 3963 | "address-family vpnv4 unicast", |
| 3964 | "Enter Address Family command mode\n" |
| 3965 | "Address family\n" |
| 3966 | "Address Family Modifier\n") |
| 3967 | |
| 3968 | DEFUN (exit_address_family, |
| 3969 | exit_address_family_cmd, |
| 3970 | "exit-address-family", |
| 3971 | "Exit from Address Family configuration mode\n") |
| 3972 | { |
hasso | a8a80d5 | 2005-04-09 13:07:47 +0000 | [diff] [blame] | 3973 | if (vty->node == BGP_IPV4_NODE |
| 3974 | || vty->node == BGP_IPV4M_NODE |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3975 | || vty->node == BGP_VPNV4_NODE |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 3976 | || vty->node == BGP_IPV6_NODE |
| 3977 | || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3978 | vty->node = BGP_NODE; |
| 3979 | return CMD_SUCCESS; |
| 3980 | } |
| 3981 | |
| 3982 | /* BGP clear sort. */ |
| 3983 | enum clear_sort |
| 3984 | { |
| 3985 | clear_all, |
| 3986 | clear_peer, |
| 3987 | clear_group, |
| 3988 | clear_external, |
| 3989 | clear_as |
| 3990 | }; |
| 3991 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3992 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3993 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
| 3994 | safi_t safi, int error) |
| 3995 | { |
| 3996 | switch (error) |
| 3997 | { |
| 3998 | case BGP_ERR_AF_UNCONFIGURED: |
| 3999 | vty_out (vty, |
| 4000 | "%%BGP: Enable %s %s address family for the neighbor %s%s", |
| 4001 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", |
| 4002 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", |
| 4003 | peer->host, VTY_NEWLINE); |
| 4004 | break; |
| 4005 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: |
| 4006 | vty_out (vty, "%%BGP: Inbound soft reconfig for %s not possible as it%s has neither refresh capability, nor inbound soft reconfig%s", peer->host, VTY_NEWLINE, VTY_NEWLINE); |
| 4007 | break; |
| 4008 | default: |
| 4009 | break; |
| 4010 | } |
| 4011 | } |
| 4012 | |
| 4013 | /* `clear ip bgp' functions. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4014 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4015 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4016 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4017 | { |
| 4018 | int ret; |
| 4019 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4020 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4021 | |
| 4022 | /* Clear all neighbors. */ |
| 4023 | if (sort == clear_all) |
| 4024 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4025 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4026 | { |
| 4027 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4028 | ret = peer_clear (peer); |
| 4029 | else |
| 4030 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4031 | |
| 4032 | if (ret < 0) |
| 4033 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4034 | } |
| 4035 | return 0; |
| 4036 | } |
| 4037 | |
| 4038 | /* Clear specified neighbors. */ |
| 4039 | if (sort == clear_peer) |
| 4040 | { |
| 4041 | union sockunion su; |
| 4042 | int ret; |
| 4043 | |
| 4044 | /* Make sockunion for lookup. */ |
| 4045 | ret = str2sockunion (arg, &su); |
| 4046 | if (ret < 0) |
| 4047 | { |
| 4048 | vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE); |
| 4049 | return -1; |
| 4050 | } |
| 4051 | peer = peer_lookup (bgp, &su); |
| 4052 | if (! peer) |
| 4053 | { |
| 4054 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); |
| 4055 | return -1; |
| 4056 | } |
| 4057 | |
| 4058 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4059 | ret = peer_clear (peer); |
| 4060 | else |
| 4061 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4062 | |
| 4063 | if (ret < 0) |
| 4064 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4065 | |
| 4066 | return 0; |
| 4067 | } |
| 4068 | |
| 4069 | /* Clear all peer-group members. */ |
| 4070 | if (sort == clear_group) |
| 4071 | { |
| 4072 | struct peer_group *group; |
| 4073 | |
| 4074 | group = peer_group_lookup (bgp, arg); |
| 4075 | if (! group) |
| 4076 | { |
| 4077 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); |
| 4078 | return -1; |
| 4079 | } |
| 4080 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4081 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4082 | { |
| 4083 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4084 | { |
| 4085 | ret = peer_clear (peer); |
| 4086 | continue; |
| 4087 | } |
| 4088 | |
| 4089 | if (! peer->af_group[afi][safi]) |
| 4090 | continue; |
| 4091 | |
| 4092 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4093 | |
| 4094 | if (ret < 0) |
| 4095 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4096 | } |
| 4097 | return 0; |
| 4098 | } |
| 4099 | |
| 4100 | if (sort == clear_external) |
| 4101 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4102 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4103 | { |
| 4104 | if (peer_sort (peer) == BGP_PEER_IBGP) |
| 4105 | continue; |
| 4106 | |
| 4107 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4108 | ret = peer_clear (peer); |
| 4109 | else |
| 4110 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4111 | |
| 4112 | if (ret < 0) |
| 4113 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4114 | } |
| 4115 | return 0; |
| 4116 | } |
| 4117 | |
| 4118 | if (sort == clear_as) |
| 4119 | { |
| 4120 | as_t as; |
| 4121 | unsigned long as_ul; |
| 4122 | char *endptr = NULL; |
| 4123 | int find = 0; |
| 4124 | |
| 4125 | as_ul = strtoul(arg, &endptr, 10); |
| 4126 | |
| 4127 | if ((as_ul == ULONG_MAX) || (*endptr != '\0') || (as_ul > USHRT_MAX)) |
| 4128 | { |
| 4129 | vty_out (vty, "Invalid AS number%s", VTY_NEWLINE); |
| 4130 | return -1; |
| 4131 | } |
| 4132 | as = (as_t) as_ul; |
| 4133 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4134 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4135 | { |
| 4136 | if (peer->as != as) |
| 4137 | continue; |
| 4138 | |
| 4139 | find = 1; |
| 4140 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4141 | ret = peer_clear (peer); |
| 4142 | else |
| 4143 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4144 | |
| 4145 | if (ret < 0) |
| 4146 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4147 | } |
| 4148 | if (! find) |
| 4149 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, |
| 4150 | VTY_NEWLINE); |
| 4151 | return 0; |
| 4152 | } |
| 4153 | |
| 4154 | return 0; |
| 4155 | } |
| 4156 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4157 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4158 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
| 4159 | enum clear_sort sort, enum bgp_clear_type stype, |
| 4160 | const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4161 | { |
| 4162 | int ret; |
| 4163 | struct bgp *bgp; |
| 4164 | |
| 4165 | /* BGP structure lookup. */ |
| 4166 | if (name) |
| 4167 | { |
| 4168 | bgp = bgp_lookup_by_name (name); |
| 4169 | if (bgp == NULL) |
| 4170 | { |
| 4171 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); |
| 4172 | return CMD_WARNING; |
| 4173 | } |
| 4174 | } |
| 4175 | else |
| 4176 | { |
| 4177 | bgp = bgp_get_default (); |
| 4178 | if (bgp == NULL) |
| 4179 | { |
| 4180 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); |
| 4181 | return CMD_WARNING; |
| 4182 | } |
| 4183 | } |
| 4184 | |
| 4185 | ret = bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
| 4186 | if (ret < 0) |
| 4187 | return CMD_WARNING; |
| 4188 | |
| 4189 | return CMD_SUCCESS; |
| 4190 | } |
| 4191 | |
| 4192 | DEFUN (clear_ip_bgp_all, |
| 4193 | clear_ip_bgp_all_cmd, |
| 4194 | "clear ip bgp *", |
| 4195 | CLEAR_STR |
| 4196 | IP_STR |
| 4197 | BGP_STR |
| 4198 | "Clear all peers\n") |
| 4199 | { |
| 4200 | if (argc == 1) |
| 4201 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4202 | |
| 4203 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4204 | } |
| 4205 | |
| 4206 | ALIAS (clear_ip_bgp_all, |
| 4207 | clear_bgp_all_cmd, |
| 4208 | "clear bgp *", |
| 4209 | CLEAR_STR |
| 4210 | BGP_STR |
| 4211 | "Clear all peers\n") |
| 4212 | |
| 4213 | ALIAS (clear_ip_bgp_all, |
| 4214 | clear_bgp_ipv6_all_cmd, |
| 4215 | "clear bgp ipv6 *", |
| 4216 | CLEAR_STR |
| 4217 | BGP_STR |
| 4218 | "Address family\n" |
| 4219 | "Clear all peers\n") |
| 4220 | |
| 4221 | ALIAS (clear_ip_bgp_all, |
| 4222 | clear_ip_bgp_instance_all_cmd, |
| 4223 | "clear ip bgp view WORD *", |
| 4224 | CLEAR_STR |
| 4225 | IP_STR |
| 4226 | BGP_STR |
| 4227 | "BGP view\n" |
| 4228 | "view name\n" |
| 4229 | "Clear all peers\n") |
| 4230 | |
| 4231 | ALIAS (clear_ip_bgp_all, |
| 4232 | clear_bgp_instance_all_cmd, |
| 4233 | "clear bgp view WORD *", |
| 4234 | CLEAR_STR |
| 4235 | BGP_STR |
| 4236 | "BGP view\n" |
| 4237 | "view name\n" |
| 4238 | "Clear all peers\n") |
| 4239 | |
| 4240 | DEFUN (clear_ip_bgp_peer, |
| 4241 | clear_ip_bgp_peer_cmd, |
| 4242 | "clear ip bgp (A.B.C.D|X:X::X:X)", |
| 4243 | CLEAR_STR |
| 4244 | IP_STR |
| 4245 | BGP_STR |
| 4246 | "BGP neighbor IP address to clear\n" |
| 4247 | "BGP IPv6 neighbor to clear\n") |
| 4248 | { |
| 4249 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4250 | } |
| 4251 | |
| 4252 | ALIAS (clear_ip_bgp_peer, |
| 4253 | clear_bgp_peer_cmd, |
| 4254 | "clear bgp (A.B.C.D|X:X::X:X)", |
| 4255 | CLEAR_STR |
| 4256 | BGP_STR |
| 4257 | "BGP neighbor address to clear\n" |
| 4258 | "BGP IPv6 neighbor to clear\n") |
| 4259 | |
| 4260 | ALIAS (clear_ip_bgp_peer, |
| 4261 | clear_bgp_ipv6_peer_cmd, |
| 4262 | "clear bgp ipv6 (A.B.C.D|X:X::X:X)", |
| 4263 | CLEAR_STR |
| 4264 | BGP_STR |
| 4265 | "Address family\n" |
| 4266 | "BGP neighbor address to clear\n" |
| 4267 | "BGP IPv6 neighbor to clear\n") |
| 4268 | |
| 4269 | DEFUN (clear_ip_bgp_peer_group, |
| 4270 | clear_ip_bgp_peer_group_cmd, |
| 4271 | "clear ip bgp peer-group WORD", |
| 4272 | CLEAR_STR |
| 4273 | IP_STR |
| 4274 | BGP_STR |
| 4275 | "Clear all members of peer-group\n" |
| 4276 | "BGP peer-group name\n") |
| 4277 | { |
| 4278 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4279 | } |
| 4280 | |
| 4281 | ALIAS (clear_ip_bgp_peer_group, |
| 4282 | clear_bgp_peer_group_cmd, |
| 4283 | "clear bgp peer-group WORD", |
| 4284 | CLEAR_STR |
| 4285 | BGP_STR |
| 4286 | "Clear all members of peer-group\n" |
| 4287 | "BGP peer-group name\n") |
| 4288 | |
| 4289 | ALIAS (clear_ip_bgp_peer_group, |
| 4290 | clear_bgp_ipv6_peer_group_cmd, |
| 4291 | "clear bgp ipv6 peer-group WORD", |
| 4292 | CLEAR_STR |
| 4293 | BGP_STR |
| 4294 | "Address family\n" |
| 4295 | "Clear all members of peer-group\n" |
| 4296 | "BGP peer-group name\n") |
| 4297 | |
| 4298 | DEFUN (clear_ip_bgp_external, |
| 4299 | clear_ip_bgp_external_cmd, |
| 4300 | "clear ip bgp external", |
| 4301 | CLEAR_STR |
| 4302 | IP_STR |
| 4303 | BGP_STR |
| 4304 | "Clear all external peers\n") |
| 4305 | { |
| 4306 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
| 4307 | } |
| 4308 | |
| 4309 | ALIAS (clear_ip_bgp_external, |
| 4310 | clear_bgp_external_cmd, |
| 4311 | "clear bgp external", |
| 4312 | CLEAR_STR |
| 4313 | BGP_STR |
| 4314 | "Clear all external peers\n") |
| 4315 | |
| 4316 | ALIAS (clear_ip_bgp_external, |
| 4317 | clear_bgp_ipv6_external_cmd, |
| 4318 | "clear bgp ipv6 external", |
| 4319 | CLEAR_STR |
| 4320 | BGP_STR |
| 4321 | "Address family\n" |
| 4322 | "Clear all external peers\n") |
| 4323 | |
| 4324 | DEFUN (clear_ip_bgp_as, |
| 4325 | clear_ip_bgp_as_cmd, |
| 4326 | "clear ip bgp <1-65535>", |
| 4327 | CLEAR_STR |
| 4328 | IP_STR |
| 4329 | BGP_STR |
| 4330 | "Clear peers with the AS number\n") |
| 4331 | { |
| 4332 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4333 | } |
| 4334 | |
| 4335 | ALIAS (clear_ip_bgp_as, |
| 4336 | clear_bgp_as_cmd, |
| 4337 | "clear bgp <1-65535>", |
| 4338 | CLEAR_STR |
| 4339 | BGP_STR |
| 4340 | "Clear peers with the AS number\n") |
| 4341 | |
| 4342 | ALIAS (clear_ip_bgp_as, |
| 4343 | clear_bgp_ipv6_as_cmd, |
| 4344 | "clear bgp ipv6 <1-65535>", |
| 4345 | CLEAR_STR |
| 4346 | BGP_STR |
| 4347 | "Address family\n" |
| 4348 | "Clear peers with the AS number\n") |
| 4349 | |
| 4350 | /* Outbound soft-reconfiguration */ |
| 4351 | DEFUN (clear_ip_bgp_all_soft_out, |
| 4352 | clear_ip_bgp_all_soft_out_cmd, |
| 4353 | "clear ip bgp * soft out", |
| 4354 | CLEAR_STR |
| 4355 | IP_STR |
| 4356 | BGP_STR |
| 4357 | "Clear all peers\n" |
| 4358 | "Soft reconfig\n" |
| 4359 | "Soft reconfig outbound update\n") |
| 4360 | { |
| 4361 | if (argc == 1) |
| 4362 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4363 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4364 | |
| 4365 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4366 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4367 | } |
| 4368 | |
| 4369 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4370 | clear_ip_bgp_all_out_cmd, |
| 4371 | "clear ip bgp * out", |
| 4372 | CLEAR_STR |
| 4373 | IP_STR |
| 4374 | BGP_STR |
| 4375 | "Clear all peers\n" |
| 4376 | "Soft reconfig outbound update\n") |
| 4377 | |
| 4378 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4379 | clear_ip_bgp_instance_all_soft_out_cmd, |
| 4380 | "clear ip bgp view WORD * soft out", |
| 4381 | CLEAR_STR |
| 4382 | IP_STR |
| 4383 | BGP_STR |
| 4384 | "BGP view\n" |
| 4385 | "view name\n" |
| 4386 | "Clear all peers\n" |
| 4387 | "Soft reconfig\n" |
| 4388 | "Soft reconfig outbound update\n") |
| 4389 | |
| 4390 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, |
| 4391 | clear_ip_bgp_all_ipv4_soft_out_cmd, |
| 4392 | "clear ip bgp * ipv4 (unicast|multicast) soft out", |
| 4393 | CLEAR_STR |
| 4394 | IP_STR |
| 4395 | BGP_STR |
| 4396 | "Clear all peers\n" |
| 4397 | "Address family\n" |
| 4398 | "Address Family modifier\n" |
| 4399 | "Address Family modifier\n" |
| 4400 | "Soft reconfig\n" |
| 4401 | "Soft reconfig outbound update\n") |
| 4402 | { |
| 4403 | if (strncmp (argv[0], "m", 1) == 0) |
| 4404 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 4405 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4406 | |
| 4407 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4408 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4409 | } |
| 4410 | |
| 4411 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, |
| 4412 | clear_ip_bgp_all_ipv4_out_cmd, |
| 4413 | "clear ip bgp * ipv4 (unicast|multicast) out", |
| 4414 | CLEAR_STR |
| 4415 | IP_STR |
| 4416 | BGP_STR |
| 4417 | "Clear all peers\n" |
| 4418 | "Address family\n" |
| 4419 | "Address Family modifier\n" |
| 4420 | "Address Family modifier\n" |
| 4421 | "Soft reconfig outbound update\n") |
| 4422 | |
| 4423 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
| 4424 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, |
| 4425 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", |
| 4426 | CLEAR_STR |
| 4427 | IP_STR |
| 4428 | BGP_STR |
| 4429 | "BGP view\n" |
| 4430 | "view name\n" |
| 4431 | "Clear all peers\n" |
| 4432 | "Address family\n" |
| 4433 | "Address Family modifier\n" |
| 4434 | "Address Family modifier\n" |
| 4435 | "Soft reconfig outbound update\n") |
| 4436 | { |
| 4437 | if (strncmp (argv[1], "m", 1) == 0) |
| 4438 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 4439 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4440 | |
| 4441 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4442 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4443 | } |
| 4444 | |
| 4445 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, |
| 4446 | clear_ip_bgp_all_vpnv4_soft_out_cmd, |
| 4447 | "clear ip bgp * vpnv4 unicast soft out", |
| 4448 | CLEAR_STR |
| 4449 | IP_STR |
| 4450 | BGP_STR |
| 4451 | "Clear all peers\n" |
| 4452 | "Address family\n" |
| 4453 | "Address Family Modifier\n" |
| 4454 | "Soft reconfig\n" |
| 4455 | "Soft reconfig outbound update\n") |
| 4456 | { |
| 4457 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 4458 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4459 | } |
| 4460 | |
| 4461 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, |
| 4462 | clear_ip_bgp_all_vpnv4_out_cmd, |
| 4463 | "clear ip bgp * vpnv4 unicast out", |
| 4464 | CLEAR_STR |
| 4465 | IP_STR |
| 4466 | BGP_STR |
| 4467 | "Clear all peers\n" |
| 4468 | "Address family\n" |
| 4469 | "Address Family Modifier\n" |
| 4470 | "Soft reconfig outbound update\n") |
| 4471 | |
| 4472 | DEFUN (clear_bgp_all_soft_out, |
| 4473 | clear_bgp_all_soft_out_cmd, |
| 4474 | "clear bgp * soft out", |
| 4475 | CLEAR_STR |
| 4476 | BGP_STR |
| 4477 | "Clear all peers\n" |
| 4478 | "Soft reconfig\n" |
| 4479 | "Soft reconfig outbound update\n") |
| 4480 | { |
| 4481 | if (argc == 1) |
| 4482 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 4483 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4484 | |
| 4485 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 4486 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4487 | } |
| 4488 | |
| 4489 | ALIAS (clear_bgp_all_soft_out, |
| 4490 | clear_bgp_instance_all_soft_out_cmd, |
| 4491 | "clear bgp view WORD * soft out", |
| 4492 | CLEAR_STR |
| 4493 | BGP_STR |
| 4494 | "BGP view\n" |
| 4495 | "view name\n" |
| 4496 | "Clear all peers\n" |
| 4497 | "Soft reconfig\n" |
| 4498 | "Soft reconfig outbound update\n") |
| 4499 | |
| 4500 | ALIAS (clear_bgp_all_soft_out, |
| 4501 | clear_bgp_all_out_cmd, |
| 4502 | "clear bgp * out", |
| 4503 | CLEAR_STR |
| 4504 | BGP_STR |
| 4505 | "Clear all peers\n" |
| 4506 | "Soft reconfig outbound update\n") |
| 4507 | |
| 4508 | ALIAS (clear_bgp_all_soft_out, |
| 4509 | clear_bgp_ipv6_all_soft_out_cmd, |
| 4510 | "clear bgp ipv6 * soft out", |
| 4511 | CLEAR_STR |
| 4512 | BGP_STR |
| 4513 | "Address family\n" |
| 4514 | "Clear all peers\n" |
| 4515 | "Soft reconfig\n" |
| 4516 | "Soft reconfig outbound update\n") |
| 4517 | |
| 4518 | ALIAS (clear_bgp_all_soft_out, |
| 4519 | clear_bgp_ipv6_all_out_cmd, |
| 4520 | "clear bgp ipv6 * out", |
| 4521 | CLEAR_STR |
| 4522 | BGP_STR |
| 4523 | "Address family\n" |
| 4524 | "Clear all peers\n" |
| 4525 | "Soft reconfig outbound update\n") |
| 4526 | |
| 4527 | DEFUN (clear_ip_bgp_peer_soft_out, |
| 4528 | clear_ip_bgp_peer_soft_out_cmd, |
| 4529 | "clear ip bgp A.B.C.D soft out", |
| 4530 | CLEAR_STR |
| 4531 | IP_STR |
| 4532 | BGP_STR |
| 4533 | "BGP neighbor address to clear\n" |
| 4534 | "Soft reconfig\n" |
| 4535 | "Soft reconfig outbound update\n") |
| 4536 | { |
| 4537 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4538 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4539 | } |
| 4540 | |
| 4541 | ALIAS (clear_ip_bgp_peer_soft_out, |
| 4542 | clear_ip_bgp_peer_out_cmd, |
| 4543 | "clear ip bgp A.B.C.D out", |
| 4544 | CLEAR_STR |
| 4545 | IP_STR |
| 4546 | BGP_STR |
| 4547 | "BGP neighbor address to clear\n" |
| 4548 | "Soft reconfig outbound update\n") |
| 4549 | |
| 4550 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
| 4551 | clear_ip_bgp_peer_ipv4_soft_out_cmd, |
| 4552 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", |
| 4553 | CLEAR_STR |
| 4554 | IP_STR |
| 4555 | BGP_STR |
| 4556 | "BGP neighbor address to clear\n" |
| 4557 | "Address family\n" |
| 4558 | "Address Family modifier\n" |
| 4559 | "Address Family modifier\n" |
| 4560 | "Soft reconfig\n" |
| 4561 | "Soft reconfig outbound update\n") |
| 4562 | { |
| 4563 | if (strncmp (argv[1], "m", 1) == 0) |
| 4564 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 4565 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4566 | |
| 4567 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4568 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4569 | } |
| 4570 | |
| 4571 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, |
| 4572 | clear_ip_bgp_peer_ipv4_out_cmd, |
| 4573 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", |
| 4574 | CLEAR_STR |
| 4575 | IP_STR |
| 4576 | BGP_STR |
| 4577 | "BGP neighbor address to clear\n" |
| 4578 | "Address family\n" |
| 4579 | "Address Family modifier\n" |
| 4580 | "Address Family modifier\n" |
| 4581 | "Soft reconfig outbound update\n") |
| 4582 | |
| 4583 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4584 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, |
| 4585 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", |
| 4586 | CLEAR_STR |
| 4587 | IP_STR |
| 4588 | BGP_STR |
| 4589 | "BGP neighbor address to clear\n" |
| 4590 | "Address family\n" |
| 4591 | "Address Family Modifier\n" |
| 4592 | "Soft reconfig\n" |
| 4593 | "Soft reconfig outbound update\n") |
| 4594 | { |
| 4595 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 4596 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4597 | } |
| 4598 | |
| 4599 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4600 | clear_ip_bgp_peer_vpnv4_out_cmd, |
| 4601 | "clear ip bgp A.B.C.D vpnv4 unicast out", |
| 4602 | CLEAR_STR |
| 4603 | IP_STR |
| 4604 | BGP_STR |
| 4605 | "BGP neighbor address to clear\n" |
| 4606 | "Address family\n" |
| 4607 | "Address Family Modifier\n" |
| 4608 | "Soft reconfig outbound update\n") |
| 4609 | |
| 4610 | DEFUN (clear_bgp_peer_soft_out, |
| 4611 | clear_bgp_peer_soft_out_cmd, |
| 4612 | "clear bgp (A.B.C.D|X:X::X:X) soft out", |
| 4613 | CLEAR_STR |
| 4614 | BGP_STR |
| 4615 | "BGP neighbor address to clear\n" |
| 4616 | "BGP IPv6 neighbor to clear\n" |
| 4617 | "Soft reconfig\n" |
| 4618 | "Soft reconfig outbound update\n") |
| 4619 | { |
| 4620 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 4621 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4622 | } |
| 4623 | |
| 4624 | ALIAS (clear_bgp_peer_soft_out, |
| 4625 | clear_bgp_ipv6_peer_soft_out_cmd, |
| 4626 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out", |
| 4627 | CLEAR_STR |
| 4628 | BGP_STR |
| 4629 | "Address family\n" |
| 4630 | "BGP neighbor address to clear\n" |
| 4631 | "BGP IPv6 neighbor to clear\n" |
| 4632 | "Soft reconfig\n" |
| 4633 | "Soft reconfig outbound update\n") |
| 4634 | |
| 4635 | ALIAS (clear_bgp_peer_soft_out, |
| 4636 | clear_bgp_peer_out_cmd, |
| 4637 | "clear bgp (A.B.C.D|X:X::X:X) out", |
| 4638 | CLEAR_STR |
| 4639 | BGP_STR |
| 4640 | "BGP neighbor address to clear\n" |
| 4641 | "BGP IPv6 neighbor to clear\n" |
| 4642 | "Soft reconfig outbound update\n") |
| 4643 | |
| 4644 | ALIAS (clear_bgp_peer_soft_out, |
| 4645 | clear_bgp_ipv6_peer_out_cmd, |
| 4646 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) out", |
| 4647 | CLEAR_STR |
| 4648 | BGP_STR |
| 4649 | "Address family\n" |
| 4650 | "BGP neighbor address to clear\n" |
| 4651 | "BGP IPv6 neighbor to clear\n" |
| 4652 | "Soft reconfig outbound update\n") |
| 4653 | |
| 4654 | DEFUN (clear_ip_bgp_peer_group_soft_out, |
| 4655 | clear_ip_bgp_peer_group_soft_out_cmd, |
| 4656 | "clear ip bgp peer-group WORD soft out", |
| 4657 | CLEAR_STR |
| 4658 | IP_STR |
| 4659 | BGP_STR |
| 4660 | "Clear all members of peer-group\n" |
| 4661 | "BGP peer-group name\n" |
| 4662 | "Soft reconfig\n" |
| 4663 | "Soft reconfig outbound update\n") |
| 4664 | { |
| 4665 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4666 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4667 | } |
| 4668 | |
| 4669 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
| 4670 | clear_ip_bgp_peer_group_out_cmd, |
| 4671 | "clear ip bgp peer-group WORD out", |
| 4672 | CLEAR_STR |
| 4673 | IP_STR |
| 4674 | BGP_STR |
| 4675 | "Clear all members of peer-group\n" |
| 4676 | "BGP peer-group name\n" |
| 4677 | "Soft reconfig outbound update\n") |
| 4678 | |
| 4679 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4680 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, |
| 4681 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", |
| 4682 | CLEAR_STR |
| 4683 | IP_STR |
| 4684 | BGP_STR |
| 4685 | "Clear all members of peer-group\n" |
| 4686 | "BGP peer-group name\n" |
| 4687 | "Address family\n" |
| 4688 | "Address Family modifier\n" |
| 4689 | "Address Family modifier\n" |
| 4690 | "Soft reconfig\n" |
| 4691 | "Soft reconfig outbound update\n") |
| 4692 | { |
| 4693 | if (strncmp (argv[1], "m", 1) == 0) |
| 4694 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 4695 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4696 | |
| 4697 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4698 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4699 | } |
| 4700 | |
| 4701 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4702 | clear_ip_bgp_peer_group_ipv4_out_cmd, |
| 4703 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", |
| 4704 | CLEAR_STR |
| 4705 | IP_STR |
| 4706 | BGP_STR |
| 4707 | "Clear all members of peer-group\n" |
| 4708 | "BGP peer-group name\n" |
| 4709 | "Address family\n" |
| 4710 | "Address Family modifier\n" |
| 4711 | "Address Family modifier\n" |
| 4712 | "Soft reconfig outbound update\n") |
| 4713 | |
| 4714 | DEFUN (clear_bgp_peer_group_soft_out, |
| 4715 | clear_bgp_peer_group_soft_out_cmd, |
| 4716 | "clear bgp peer-group WORD soft out", |
| 4717 | CLEAR_STR |
| 4718 | BGP_STR |
| 4719 | "Clear all members of peer-group\n" |
| 4720 | "BGP peer-group name\n" |
| 4721 | "Soft reconfig\n" |
| 4722 | "Soft reconfig outbound update\n") |
| 4723 | { |
| 4724 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 4725 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4726 | } |
| 4727 | |
| 4728 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4729 | clear_bgp_ipv6_peer_group_soft_out_cmd, |
| 4730 | "clear bgp ipv6 peer-group WORD soft out", |
| 4731 | CLEAR_STR |
| 4732 | BGP_STR |
| 4733 | "Address family\n" |
| 4734 | "Clear all members of peer-group\n" |
| 4735 | "BGP peer-group name\n" |
| 4736 | "Soft reconfig\n" |
| 4737 | "Soft reconfig outbound update\n") |
| 4738 | |
| 4739 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4740 | clear_bgp_peer_group_out_cmd, |
| 4741 | "clear bgp peer-group WORD out", |
| 4742 | CLEAR_STR |
| 4743 | BGP_STR |
| 4744 | "Clear all members of peer-group\n" |
| 4745 | "BGP peer-group name\n" |
| 4746 | "Soft reconfig outbound update\n") |
| 4747 | |
| 4748 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4749 | clear_bgp_ipv6_peer_group_out_cmd, |
| 4750 | "clear bgp ipv6 peer-group WORD out", |
| 4751 | CLEAR_STR |
| 4752 | BGP_STR |
| 4753 | "Address family\n" |
| 4754 | "Clear all members of peer-group\n" |
| 4755 | "BGP peer-group name\n" |
| 4756 | "Soft reconfig outbound update\n") |
| 4757 | |
| 4758 | DEFUN (clear_ip_bgp_external_soft_out, |
| 4759 | clear_ip_bgp_external_soft_out_cmd, |
| 4760 | "clear ip bgp external soft out", |
| 4761 | CLEAR_STR |
| 4762 | IP_STR |
| 4763 | BGP_STR |
| 4764 | "Clear all external peers\n" |
| 4765 | "Soft reconfig\n" |
| 4766 | "Soft reconfig outbound update\n") |
| 4767 | { |
| 4768 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 4769 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4770 | } |
| 4771 | |
| 4772 | ALIAS (clear_ip_bgp_external_soft_out, |
| 4773 | clear_ip_bgp_external_out_cmd, |
| 4774 | "clear ip bgp external out", |
| 4775 | CLEAR_STR |
| 4776 | IP_STR |
| 4777 | BGP_STR |
| 4778 | "Clear all external peers\n" |
| 4779 | "Soft reconfig outbound update\n") |
| 4780 | |
| 4781 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, |
| 4782 | clear_ip_bgp_external_ipv4_soft_out_cmd, |
| 4783 | "clear ip bgp external ipv4 (unicast|multicast) soft out", |
| 4784 | CLEAR_STR |
| 4785 | IP_STR |
| 4786 | BGP_STR |
| 4787 | "Clear all external peers\n" |
| 4788 | "Address family\n" |
| 4789 | "Address Family modifier\n" |
| 4790 | "Address Family modifier\n" |
| 4791 | "Soft reconfig\n" |
| 4792 | "Soft reconfig outbound update\n") |
| 4793 | { |
| 4794 | if (strncmp (argv[0], "m", 1) == 0) |
| 4795 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 4796 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4797 | |
| 4798 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 4799 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4800 | } |
| 4801 | |
| 4802 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, |
| 4803 | clear_ip_bgp_external_ipv4_out_cmd, |
| 4804 | "clear ip bgp external ipv4 (unicast|multicast) out", |
| 4805 | CLEAR_STR |
| 4806 | IP_STR |
| 4807 | BGP_STR |
| 4808 | "Clear all external peers\n" |
| 4809 | "Address family\n" |
| 4810 | "Address Family modifier\n" |
| 4811 | "Address Family modifier\n" |
| 4812 | "Soft reconfig outbound update\n") |
| 4813 | |
| 4814 | DEFUN (clear_bgp_external_soft_out, |
| 4815 | clear_bgp_external_soft_out_cmd, |
| 4816 | "clear bgp external soft out", |
| 4817 | CLEAR_STR |
| 4818 | BGP_STR |
| 4819 | "Clear all external peers\n" |
| 4820 | "Soft reconfig\n" |
| 4821 | "Soft reconfig outbound update\n") |
| 4822 | { |
| 4823 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 4824 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4825 | } |
| 4826 | |
| 4827 | ALIAS (clear_bgp_external_soft_out, |
| 4828 | clear_bgp_ipv6_external_soft_out_cmd, |
| 4829 | "clear bgp ipv6 external soft out", |
| 4830 | CLEAR_STR |
| 4831 | BGP_STR |
| 4832 | "Address family\n" |
| 4833 | "Clear all external peers\n" |
| 4834 | "Soft reconfig\n" |
| 4835 | "Soft reconfig outbound update\n") |
| 4836 | |
| 4837 | ALIAS (clear_bgp_external_soft_out, |
| 4838 | clear_bgp_external_out_cmd, |
| 4839 | "clear bgp external out", |
| 4840 | CLEAR_STR |
| 4841 | BGP_STR |
| 4842 | "Clear all external peers\n" |
| 4843 | "Soft reconfig outbound update\n") |
| 4844 | |
| 4845 | ALIAS (clear_bgp_external_soft_out, |
| 4846 | clear_bgp_ipv6_external_out_cmd, |
| 4847 | "clear bgp ipv6 external WORD out", |
| 4848 | CLEAR_STR |
| 4849 | BGP_STR |
| 4850 | "Address family\n" |
| 4851 | "Clear all external peers\n" |
| 4852 | "Soft reconfig outbound update\n") |
| 4853 | |
| 4854 | DEFUN (clear_ip_bgp_as_soft_out, |
| 4855 | clear_ip_bgp_as_soft_out_cmd, |
| 4856 | "clear ip bgp <1-65535> soft out", |
| 4857 | CLEAR_STR |
| 4858 | IP_STR |
| 4859 | BGP_STR |
| 4860 | "Clear peers with the AS number\n" |
| 4861 | "Soft reconfig\n" |
| 4862 | "Soft reconfig outbound update\n") |
| 4863 | { |
| 4864 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 4865 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4866 | } |
| 4867 | |
| 4868 | ALIAS (clear_ip_bgp_as_soft_out, |
| 4869 | clear_ip_bgp_as_out_cmd, |
| 4870 | "clear ip bgp <1-65535> out", |
| 4871 | CLEAR_STR |
| 4872 | IP_STR |
| 4873 | BGP_STR |
| 4874 | "Clear peers with the AS number\n" |
| 4875 | "Soft reconfig outbound update\n") |
| 4876 | |
| 4877 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
| 4878 | clear_ip_bgp_as_ipv4_soft_out_cmd, |
| 4879 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft out", |
| 4880 | CLEAR_STR |
| 4881 | IP_STR |
| 4882 | BGP_STR |
| 4883 | "Clear peers with the AS number\n" |
| 4884 | "Address family\n" |
| 4885 | "Address Family modifier\n" |
| 4886 | "Address Family modifier\n" |
| 4887 | "Soft reconfig\n" |
| 4888 | "Soft reconfig outbound update\n") |
| 4889 | { |
| 4890 | if (strncmp (argv[1], "m", 1) == 0) |
| 4891 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 4892 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4893 | |
| 4894 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 4895 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4896 | } |
| 4897 | |
| 4898 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, |
| 4899 | clear_ip_bgp_as_ipv4_out_cmd, |
| 4900 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) out", |
| 4901 | CLEAR_STR |
| 4902 | IP_STR |
| 4903 | BGP_STR |
| 4904 | "Clear peers with the AS number\n" |
| 4905 | "Address family\n" |
| 4906 | "Address Family modifier\n" |
| 4907 | "Address Family modifier\n" |
| 4908 | "Soft reconfig outbound update\n") |
| 4909 | |
| 4910 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
| 4911 | clear_ip_bgp_as_vpnv4_soft_out_cmd, |
| 4912 | "clear ip bgp <1-65535> vpnv4 unicast soft out", |
| 4913 | CLEAR_STR |
| 4914 | IP_STR |
| 4915 | BGP_STR |
| 4916 | "Clear peers with the AS number\n" |
| 4917 | "Address family\n" |
| 4918 | "Address Family modifier\n" |
| 4919 | "Soft reconfig\n" |
| 4920 | "Soft reconfig outbound update\n") |
| 4921 | { |
| 4922 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 4923 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4924 | } |
| 4925 | |
| 4926 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, |
| 4927 | clear_ip_bgp_as_vpnv4_out_cmd, |
| 4928 | "clear ip bgp <1-65535> vpnv4 unicast out", |
| 4929 | CLEAR_STR |
| 4930 | IP_STR |
| 4931 | BGP_STR |
| 4932 | "Clear peers with the AS number\n" |
| 4933 | "Address family\n" |
| 4934 | "Address Family modifier\n" |
| 4935 | "Soft reconfig outbound update\n") |
| 4936 | |
| 4937 | DEFUN (clear_bgp_as_soft_out, |
| 4938 | clear_bgp_as_soft_out_cmd, |
| 4939 | "clear bgp <1-65535> soft out", |
| 4940 | CLEAR_STR |
| 4941 | BGP_STR |
| 4942 | "Clear peers with the AS number\n" |
| 4943 | "Soft reconfig\n" |
| 4944 | "Soft reconfig outbound update\n") |
| 4945 | { |
| 4946 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 4947 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4948 | } |
| 4949 | |
| 4950 | ALIAS (clear_bgp_as_soft_out, |
| 4951 | clear_bgp_ipv6_as_soft_out_cmd, |
| 4952 | "clear bgp ipv6 <1-65535> soft out", |
| 4953 | CLEAR_STR |
| 4954 | BGP_STR |
| 4955 | "Address family\n" |
| 4956 | "Clear peers with the AS number\n" |
| 4957 | "Soft reconfig\n" |
| 4958 | "Soft reconfig outbound update\n") |
| 4959 | |
| 4960 | ALIAS (clear_bgp_as_soft_out, |
| 4961 | clear_bgp_as_out_cmd, |
| 4962 | "clear bgp <1-65535> out", |
| 4963 | CLEAR_STR |
| 4964 | BGP_STR |
| 4965 | "Clear peers with the AS number\n" |
| 4966 | "Soft reconfig outbound update\n") |
| 4967 | |
| 4968 | ALIAS (clear_bgp_as_soft_out, |
| 4969 | clear_bgp_ipv6_as_out_cmd, |
| 4970 | "clear bgp ipv6 <1-65535> out", |
| 4971 | CLEAR_STR |
| 4972 | BGP_STR |
| 4973 | "Address family\n" |
| 4974 | "Clear peers with the AS number\n" |
| 4975 | "Soft reconfig outbound update\n") |
| 4976 | |
| 4977 | /* Inbound soft-reconfiguration */ |
| 4978 | DEFUN (clear_ip_bgp_all_soft_in, |
| 4979 | clear_ip_bgp_all_soft_in_cmd, |
| 4980 | "clear ip bgp * soft in", |
| 4981 | CLEAR_STR |
| 4982 | IP_STR |
| 4983 | BGP_STR |
| 4984 | "Clear all peers\n" |
| 4985 | "Soft reconfig\n" |
| 4986 | "Soft reconfig inbound update\n") |
| 4987 | { |
| 4988 | if (argc == 1) |
| 4989 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4990 | BGP_CLEAR_SOFT_IN, NULL); |
| 4991 | |
| 4992 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4993 | BGP_CLEAR_SOFT_IN, NULL); |
| 4994 | } |
| 4995 | |
| 4996 | ALIAS (clear_ip_bgp_all_soft_in, |
| 4997 | clear_ip_bgp_instance_all_soft_in_cmd, |
| 4998 | "clear ip bgp view WORD * soft in", |
| 4999 | CLEAR_STR |
| 5000 | IP_STR |
| 5001 | BGP_STR |
| 5002 | "BGP view\n" |
| 5003 | "view name\n" |
| 5004 | "Clear all peers\n" |
| 5005 | "Soft reconfig\n" |
| 5006 | "Soft reconfig inbound update\n") |
| 5007 | |
| 5008 | ALIAS (clear_ip_bgp_all_soft_in, |
| 5009 | clear_ip_bgp_all_in_cmd, |
| 5010 | "clear ip bgp * in", |
| 5011 | CLEAR_STR |
| 5012 | IP_STR |
| 5013 | BGP_STR |
| 5014 | "Clear all peers\n" |
| 5015 | "Soft reconfig inbound update\n") |
| 5016 | |
| 5017 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
| 5018 | clear_ip_bgp_all_in_prefix_filter_cmd, |
| 5019 | "clear ip bgp * in prefix-filter", |
| 5020 | CLEAR_STR |
| 5021 | IP_STR |
| 5022 | BGP_STR |
| 5023 | "Clear all peers\n" |
| 5024 | "Soft reconfig inbound update\n" |
| 5025 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5026 | { |
| 5027 | if (argc== 1) |
| 5028 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5029 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5030 | |
| 5031 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5032 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5033 | } |
| 5034 | |
| 5035 | ALIAS (clear_ip_bgp_all_in_prefix_filter, |
| 5036 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, |
| 5037 | "clear ip bgp view WORD * in prefix-filter", |
| 5038 | CLEAR_STR |
| 5039 | IP_STR |
| 5040 | BGP_STR |
| 5041 | "BGP view\n" |
| 5042 | "view name\n" |
| 5043 | "Clear all peers\n" |
| 5044 | "Soft reconfig inbound update\n" |
| 5045 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5046 | |
| 5047 | |
| 5048 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
| 5049 | clear_ip_bgp_all_ipv4_soft_in_cmd, |
| 5050 | "clear ip bgp * ipv4 (unicast|multicast) soft in", |
| 5051 | CLEAR_STR |
| 5052 | IP_STR |
| 5053 | BGP_STR |
| 5054 | "Clear all peers\n" |
| 5055 | "Address family\n" |
| 5056 | "Address Family modifier\n" |
| 5057 | "Address Family modifier\n" |
| 5058 | "Soft reconfig\n" |
| 5059 | "Soft reconfig inbound update\n") |
| 5060 | { |
| 5061 | if (strncmp (argv[0], "m", 1) == 0) |
| 5062 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5063 | BGP_CLEAR_SOFT_IN, NULL); |
| 5064 | |
| 5065 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5066 | BGP_CLEAR_SOFT_IN, NULL); |
| 5067 | } |
| 5068 | |
| 5069 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, |
| 5070 | clear_ip_bgp_all_ipv4_in_cmd, |
| 5071 | "clear ip bgp * ipv4 (unicast|multicast) in", |
| 5072 | CLEAR_STR |
| 5073 | IP_STR |
| 5074 | BGP_STR |
| 5075 | "Clear all peers\n" |
| 5076 | "Address family\n" |
| 5077 | "Address Family modifier\n" |
| 5078 | "Address Family modifier\n" |
| 5079 | "Soft reconfig inbound update\n") |
| 5080 | |
| 5081 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
| 5082 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, |
| 5083 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", |
| 5084 | CLEAR_STR |
| 5085 | IP_STR |
| 5086 | BGP_STR |
| 5087 | "BGP view\n" |
| 5088 | "view name\n" |
| 5089 | "Clear all peers\n" |
| 5090 | "Address family\n" |
| 5091 | "Address Family modifier\n" |
| 5092 | "Address Family modifier\n" |
| 5093 | "Soft reconfig\n" |
| 5094 | "Soft reconfig inbound update\n") |
| 5095 | { |
| 5096 | if (strncmp (argv[1], "m", 1) == 0) |
| 5097 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5098 | BGP_CLEAR_SOFT_IN, NULL); |
| 5099 | |
| 5100 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5101 | BGP_CLEAR_SOFT_IN, NULL); |
| 5102 | } |
| 5103 | |
| 5104 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
| 5105 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, |
| 5106 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", |
| 5107 | CLEAR_STR |
| 5108 | IP_STR |
| 5109 | BGP_STR |
| 5110 | "Clear all peers\n" |
| 5111 | "Address family\n" |
| 5112 | "Address Family modifier\n" |
| 5113 | "Address Family modifier\n" |
| 5114 | "Soft reconfig inbound update\n" |
| 5115 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5116 | { |
| 5117 | if (strncmp (argv[0], "m", 1) == 0) |
| 5118 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5119 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5120 | |
| 5121 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5122 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5123 | } |
| 5124 | |
| 5125 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, |
| 5126 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, |
| 5127 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", |
| 5128 | CLEAR_STR |
| 5129 | IP_STR |
| 5130 | BGP_STR |
| 5131 | "Clear all peers\n" |
| 5132 | "Address family\n" |
| 5133 | "Address Family modifier\n" |
| 5134 | "Address Family modifier\n" |
| 5135 | "Soft reconfig inbound update\n" |
| 5136 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5137 | { |
| 5138 | if (strncmp (argv[1], "m", 1) == 0) |
| 5139 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5140 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5141 | |
| 5142 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5143 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5144 | } |
| 5145 | |
| 5146 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, |
| 5147 | clear_ip_bgp_all_vpnv4_soft_in_cmd, |
| 5148 | "clear ip bgp * vpnv4 unicast soft in", |
| 5149 | CLEAR_STR |
| 5150 | IP_STR |
| 5151 | BGP_STR |
| 5152 | "Clear all peers\n" |
| 5153 | "Address family\n" |
| 5154 | "Address Family Modifier\n" |
| 5155 | "Soft reconfig\n" |
| 5156 | "Soft reconfig inbound update\n") |
| 5157 | { |
| 5158 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 5159 | BGP_CLEAR_SOFT_IN, NULL); |
| 5160 | } |
| 5161 | |
| 5162 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, |
| 5163 | clear_ip_bgp_all_vpnv4_in_cmd, |
| 5164 | "clear ip bgp * vpnv4 unicast in", |
| 5165 | CLEAR_STR |
| 5166 | IP_STR |
| 5167 | BGP_STR |
| 5168 | "Clear all peers\n" |
| 5169 | "Address family\n" |
| 5170 | "Address Family Modifier\n" |
| 5171 | "Soft reconfig inbound update\n") |
| 5172 | |
| 5173 | DEFUN (clear_bgp_all_soft_in, |
| 5174 | clear_bgp_all_soft_in_cmd, |
| 5175 | "clear bgp * soft in", |
| 5176 | CLEAR_STR |
| 5177 | BGP_STR |
| 5178 | "Clear all peers\n" |
| 5179 | "Soft reconfig\n" |
| 5180 | "Soft reconfig inbound update\n") |
| 5181 | { |
| 5182 | if (argc == 1) |
| 5183 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 5184 | BGP_CLEAR_SOFT_IN, NULL); |
| 5185 | |
| 5186 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5187 | BGP_CLEAR_SOFT_IN, NULL); |
| 5188 | } |
| 5189 | |
| 5190 | ALIAS (clear_bgp_all_soft_in, |
| 5191 | clear_bgp_instance_all_soft_in_cmd, |
| 5192 | "clear bgp view WORD * soft in", |
| 5193 | CLEAR_STR |
| 5194 | BGP_STR |
| 5195 | "BGP view\n" |
| 5196 | "view name\n" |
| 5197 | "Clear all peers\n" |
| 5198 | "Soft reconfig\n" |
| 5199 | "Soft reconfig inbound update\n") |
| 5200 | |
| 5201 | ALIAS (clear_bgp_all_soft_in, |
| 5202 | clear_bgp_ipv6_all_soft_in_cmd, |
| 5203 | "clear bgp ipv6 * soft in", |
| 5204 | CLEAR_STR |
| 5205 | BGP_STR |
| 5206 | "Address family\n" |
| 5207 | "Clear all peers\n" |
| 5208 | "Soft reconfig\n" |
| 5209 | "Soft reconfig inbound update\n") |
| 5210 | |
| 5211 | ALIAS (clear_bgp_all_soft_in, |
| 5212 | clear_bgp_all_in_cmd, |
| 5213 | "clear bgp * in", |
| 5214 | CLEAR_STR |
| 5215 | BGP_STR |
| 5216 | "Clear all peers\n" |
| 5217 | "Soft reconfig inbound update\n") |
| 5218 | |
| 5219 | ALIAS (clear_bgp_all_soft_in, |
| 5220 | clear_bgp_ipv6_all_in_cmd, |
| 5221 | "clear bgp ipv6 * in", |
| 5222 | CLEAR_STR |
| 5223 | BGP_STR |
| 5224 | "Address family\n" |
| 5225 | "Clear all peers\n" |
| 5226 | "Soft reconfig inbound update\n") |
| 5227 | |
| 5228 | DEFUN (clear_bgp_all_in_prefix_filter, |
| 5229 | clear_bgp_all_in_prefix_filter_cmd, |
| 5230 | "clear bgp * in prefix-filter", |
| 5231 | CLEAR_STR |
| 5232 | BGP_STR |
| 5233 | "Clear all peers\n" |
| 5234 | "Soft reconfig inbound update\n" |
| 5235 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5236 | { |
| 5237 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5238 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5239 | } |
| 5240 | |
| 5241 | ALIAS (clear_bgp_all_in_prefix_filter, |
| 5242 | clear_bgp_ipv6_all_in_prefix_filter_cmd, |
| 5243 | "clear bgp ipv6 * in prefix-filter", |
| 5244 | CLEAR_STR |
| 5245 | BGP_STR |
| 5246 | "Address family\n" |
| 5247 | "Clear all peers\n" |
| 5248 | "Soft reconfig inbound update\n" |
| 5249 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5250 | |
| 5251 | DEFUN (clear_ip_bgp_peer_soft_in, |
| 5252 | clear_ip_bgp_peer_soft_in_cmd, |
| 5253 | "clear ip bgp A.B.C.D soft in", |
| 5254 | CLEAR_STR |
| 5255 | IP_STR |
| 5256 | BGP_STR |
| 5257 | "BGP neighbor address to clear\n" |
| 5258 | "Soft reconfig\n" |
| 5259 | "Soft reconfig inbound update\n") |
| 5260 | { |
| 5261 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5262 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5263 | } |
| 5264 | |
| 5265 | ALIAS (clear_ip_bgp_peer_soft_in, |
| 5266 | clear_ip_bgp_peer_in_cmd, |
| 5267 | "clear ip bgp A.B.C.D in", |
| 5268 | CLEAR_STR |
| 5269 | IP_STR |
| 5270 | BGP_STR |
| 5271 | "BGP neighbor address to clear\n" |
| 5272 | "Soft reconfig inbound update\n") |
| 5273 | |
| 5274 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
| 5275 | clear_ip_bgp_peer_in_prefix_filter_cmd, |
| 5276 | "clear ip bgp A.B.C.D in prefix-filter", |
| 5277 | CLEAR_STR |
| 5278 | IP_STR |
| 5279 | BGP_STR |
| 5280 | "BGP neighbor address to clear\n" |
| 5281 | "Soft reconfig inbound update\n" |
| 5282 | "Push out the existing ORF prefix-list\n") |
| 5283 | { |
| 5284 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5285 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5286 | } |
| 5287 | |
| 5288 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, |
| 5289 | clear_ip_bgp_peer_ipv4_soft_in_cmd, |
| 5290 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", |
| 5291 | CLEAR_STR |
| 5292 | IP_STR |
| 5293 | BGP_STR |
| 5294 | "BGP neighbor address to clear\n" |
| 5295 | "Address family\n" |
| 5296 | "Address Family modifier\n" |
| 5297 | "Address Family modifier\n" |
| 5298 | "Soft reconfig\n" |
| 5299 | "Soft reconfig inbound update\n") |
| 5300 | { |
| 5301 | if (strncmp (argv[1], "m", 1) == 0) |
| 5302 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5303 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5304 | |
| 5305 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5306 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5307 | } |
| 5308 | |
| 5309 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, |
| 5310 | clear_ip_bgp_peer_ipv4_in_cmd, |
| 5311 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", |
| 5312 | CLEAR_STR |
| 5313 | IP_STR |
| 5314 | BGP_STR |
| 5315 | "BGP neighbor address to clear\n" |
| 5316 | "Address family\n" |
| 5317 | "Address Family modifier\n" |
| 5318 | "Address Family modifier\n" |
| 5319 | "Soft reconfig inbound update\n") |
| 5320 | |
| 5321 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
| 5322 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, |
| 5323 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", |
| 5324 | CLEAR_STR |
| 5325 | IP_STR |
| 5326 | BGP_STR |
| 5327 | "BGP neighbor address to clear\n" |
| 5328 | "Address family\n" |
| 5329 | "Address Family modifier\n" |
| 5330 | "Address Family modifier\n" |
| 5331 | "Soft reconfig inbound update\n" |
| 5332 | "Push out the existing ORF prefix-list\n") |
| 5333 | { |
| 5334 | if (strncmp (argv[1], "m", 1) == 0) |
| 5335 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5336 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5337 | |
| 5338 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5339 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5340 | } |
| 5341 | |
| 5342 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5343 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, |
| 5344 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", |
| 5345 | CLEAR_STR |
| 5346 | IP_STR |
| 5347 | BGP_STR |
| 5348 | "BGP neighbor address to clear\n" |
| 5349 | "Address family\n" |
| 5350 | "Address Family Modifier\n" |
| 5351 | "Soft reconfig\n" |
| 5352 | "Soft reconfig inbound update\n") |
| 5353 | { |
| 5354 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 5355 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5356 | } |
| 5357 | |
| 5358 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5359 | clear_ip_bgp_peer_vpnv4_in_cmd, |
| 5360 | "clear ip bgp A.B.C.D vpnv4 unicast in", |
| 5361 | CLEAR_STR |
| 5362 | IP_STR |
| 5363 | BGP_STR |
| 5364 | "BGP neighbor address to clear\n" |
| 5365 | "Address family\n" |
| 5366 | "Address Family Modifier\n" |
| 5367 | "Soft reconfig inbound update\n") |
| 5368 | |
| 5369 | DEFUN (clear_bgp_peer_soft_in, |
| 5370 | clear_bgp_peer_soft_in_cmd, |
| 5371 | "clear bgp (A.B.C.D|X:X::X:X) soft in", |
| 5372 | CLEAR_STR |
| 5373 | BGP_STR |
| 5374 | "BGP neighbor address to clear\n" |
| 5375 | "BGP IPv6 neighbor to clear\n" |
| 5376 | "Soft reconfig\n" |
| 5377 | "Soft reconfig inbound update\n") |
| 5378 | { |
| 5379 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5380 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5381 | } |
| 5382 | |
| 5383 | ALIAS (clear_bgp_peer_soft_in, |
| 5384 | clear_bgp_ipv6_peer_soft_in_cmd, |
| 5385 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in", |
| 5386 | CLEAR_STR |
| 5387 | BGP_STR |
| 5388 | "Address family\n" |
| 5389 | "BGP neighbor address to clear\n" |
| 5390 | "BGP IPv6 neighbor to clear\n" |
| 5391 | "Soft reconfig\n" |
| 5392 | "Soft reconfig inbound update\n") |
| 5393 | |
| 5394 | ALIAS (clear_bgp_peer_soft_in, |
| 5395 | clear_bgp_peer_in_cmd, |
| 5396 | "clear bgp (A.B.C.D|X:X::X:X) in", |
| 5397 | CLEAR_STR |
| 5398 | BGP_STR |
| 5399 | "BGP neighbor address to clear\n" |
| 5400 | "BGP IPv6 neighbor to clear\n" |
| 5401 | "Soft reconfig inbound update\n") |
| 5402 | |
| 5403 | ALIAS (clear_bgp_peer_soft_in, |
| 5404 | clear_bgp_ipv6_peer_in_cmd, |
| 5405 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in", |
| 5406 | CLEAR_STR |
| 5407 | BGP_STR |
| 5408 | "Address family\n" |
| 5409 | "BGP neighbor address to clear\n" |
| 5410 | "BGP IPv6 neighbor to clear\n" |
| 5411 | "Soft reconfig inbound update\n") |
| 5412 | |
| 5413 | DEFUN (clear_bgp_peer_in_prefix_filter, |
| 5414 | clear_bgp_peer_in_prefix_filter_cmd, |
| 5415 | "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5416 | CLEAR_STR |
| 5417 | BGP_STR |
| 5418 | "BGP neighbor address to clear\n" |
| 5419 | "BGP IPv6 neighbor to clear\n" |
| 5420 | "Soft reconfig inbound update\n" |
| 5421 | "Push out the existing ORF prefix-list\n") |
| 5422 | { |
| 5423 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5424 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5425 | } |
| 5426 | |
| 5427 | ALIAS (clear_bgp_peer_in_prefix_filter, |
| 5428 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, |
| 5429 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5430 | CLEAR_STR |
| 5431 | BGP_STR |
| 5432 | "Address family\n" |
| 5433 | "BGP neighbor address to clear\n" |
| 5434 | "BGP IPv6 neighbor to clear\n" |
| 5435 | "Soft reconfig inbound update\n" |
| 5436 | "Push out the existing ORF prefix-list\n") |
| 5437 | |
| 5438 | DEFUN (clear_ip_bgp_peer_group_soft_in, |
| 5439 | clear_ip_bgp_peer_group_soft_in_cmd, |
| 5440 | "clear ip bgp peer-group WORD soft in", |
| 5441 | CLEAR_STR |
| 5442 | IP_STR |
| 5443 | BGP_STR |
| 5444 | "Clear all members of peer-group\n" |
| 5445 | "BGP peer-group name\n" |
| 5446 | "Soft reconfig\n" |
| 5447 | "Soft reconfig inbound update\n") |
| 5448 | { |
| 5449 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5450 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5451 | } |
| 5452 | |
| 5453 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
| 5454 | clear_ip_bgp_peer_group_in_cmd, |
| 5455 | "clear ip bgp peer-group WORD in", |
| 5456 | CLEAR_STR |
| 5457 | IP_STR |
| 5458 | BGP_STR |
| 5459 | "Clear all members of peer-group\n" |
| 5460 | "BGP peer-group name\n" |
| 5461 | "Soft reconfig inbound update\n") |
| 5462 | |
| 5463 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
| 5464 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, |
| 5465 | "clear ip bgp peer-group WORD in prefix-filter", |
| 5466 | CLEAR_STR |
| 5467 | IP_STR |
| 5468 | BGP_STR |
| 5469 | "Clear all members of peer-group\n" |
| 5470 | "BGP peer-group name\n" |
| 5471 | "Soft reconfig inbound update\n" |
| 5472 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5473 | { |
| 5474 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5475 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5476 | } |
| 5477 | |
| 5478 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5479 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, |
| 5480 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", |
| 5481 | CLEAR_STR |
| 5482 | IP_STR |
| 5483 | BGP_STR |
| 5484 | "Clear all members of peer-group\n" |
| 5485 | "BGP peer-group name\n" |
| 5486 | "Address family\n" |
| 5487 | "Address Family modifier\n" |
| 5488 | "Address Family modifier\n" |
| 5489 | "Soft reconfig\n" |
| 5490 | "Soft reconfig inbound update\n") |
| 5491 | { |
| 5492 | if (strncmp (argv[1], "m", 1) == 0) |
| 5493 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5494 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5495 | |
| 5496 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5497 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5498 | } |
| 5499 | |
| 5500 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5501 | clear_ip_bgp_peer_group_ipv4_in_cmd, |
| 5502 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", |
| 5503 | CLEAR_STR |
| 5504 | IP_STR |
| 5505 | BGP_STR |
| 5506 | "Clear all members of peer-group\n" |
| 5507 | "BGP peer-group name\n" |
| 5508 | "Address family\n" |
| 5509 | "Address Family modifier\n" |
| 5510 | "Address Family modifier\n" |
| 5511 | "Soft reconfig inbound update\n") |
| 5512 | |
| 5513 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
| 5514 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, |
| 5515 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", |
| 5516 | CLEAR_STR |
| 5517 | IP_STR |
| 5518 | BGP_STR |
| 5519 | "Clear all members of peer-group\n" |
| 5520 | "BGP peer-group name\n" |
| 5521 | "Address family\n" |
| 5522 | "Address Family modifier\n" |
| 5523 | "Address Family modifier\n" |
| 5524 | "Soft reconfig inbound update\n" |
| 5525 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5526 | { |
| 5527 | if (strncmp (argv[1], "m", 1) == 0) |
| 5528 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5529 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5530 | |
| 5531 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5532 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5533 | } |
| 5534 | |
| 5535 | DEFUN (clear_bgp_peer_group_soft_in, |
| 5536 | clear_bgp_peer_group_soft_in_cmd, |
| 5537 | "clear bgp peer-group WORD soft in", |
| 5538 | CLEAR_STR |
| 5539 | BGP_STR |
| 5540 | "Clear all members of peer-group\n" |
| 5541 | "BGP peer-group name\n" |
| 5542 | "Soft reconfig\n" |
| 5543 | "Soft reconfig inbound update\n") |
| 5544 | { |
| 5545 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5546 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5547 | } |
| 5548 | |
| 5549 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5550 | clear_bgp_ipv6_peer_group_soft_in_cmd, |
| 5551 | "clear bgp ipv6 peer-group WORD soft in", |
| 5552 | CLEAR_STR |
| 5553 | BGP_STR |
| 5554 | "Address family\n" |
| 5555 | "Clear all members of peer-group\n" |
| 5556 | "BGP peer-group name\n" |
| 5557 | "Soft reconfig\n" |
| 5558 | "Soft reconfig inbound update\n") |
| 5559 | |
| 5560 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5561 | clear_bgp_peer_group_in_cmd, |
| 5562 | "clear bgp peer-group WORD in", |
| 5563 | CLEAR_STR |
| 5564 | BGP_STR |
| 5565 | "Clear all members of peer-group\n" |
| 5566 | "BGP peer-group name\n" |
| 5567 | "Soft reconfig inbound update\n") |
| 5568 | |
| 5569 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5570 | clear_bgp_ipv6_peer_group_in_cmd, |
| 5571 | "clear bgp ipv6 peer-group WORD in", |
| 5572 | CLEAR_STR |
| 5573 | BGP_STR |
| 5574 | "Address family\n" |
| 5575 | "Clear all members of peer-group\n" |
| 5576 | "BGP peer-group name\n" |
| 5577 | "Soft reconfig inbound update\n") |
| 5578 | |
| 5579 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
| 5580 | clear_bgp_peer_group_in_prefix_filter_cmd, |
| 5581 | "clear bgp peer-group WORD in prefix-filter", |
| 5582 | CLEAR_STR |
| 5583 | BGP_STR |
| 5584 | "Clear all members of peer-group\n" |
| 5585 | "BGP peer-group name\n" |
| 5586 | "Soft reconfig inbound update\n" |
| 5587 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5588 | { |
| 5589 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5590 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5591 | } |
| 5592 | |
| 5593 | ALIAS (clear_bgp_peer_group_in_prefix_filter, |
| 5594 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, |
| 5595 | "clear bgp ipv6 peer-group WORD in prefix-filter", |
| 5596 | CLEAR_STR |
| 5597 | BGP_STR |
| 5598 | "Address family\n" |
| 5599 | "Clear all members of peer-group\n" |
| 5600 | "BGP peer-group name\n" |
| 5601 | "Soft reconfig inbound update\n" |
| 5602 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5603 | |
| 5604 | DEFUN (clear_ip_bgp_external_soft_in, |
| 5605 | clear_ip_bgp_external_soft_in_cmd, |
| 5606 | "clear ip bgp external soft in", |
| 5607 | CLEAR_STR |
| 5608 | IP_STR |
| 5609 | BGP_STR |
| 5610 | "Clear all external peers\n" |
| 5611 | "Soft reconfig\n" |
| 5612 | "Soft reconfig inbound update\n") |
| 5613 | { |
| 5614 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5615 | BGP_CLEAR_SOFT_IN, NULL); |
| 5616 | } |
| 5617 | |
| 5618 | ALIAS (clear_ip_bgp_external_soft_in, |
| 5619 | clear_ip_bgp_external_in_cmd, |
| 5620 | "clear ip bgp external in", |
| 5621 | CLEAR_STR |
| 5622 | IP_STR |
| 5623 | BGP_STR |
| 5624 | "Clear all external peers\n" |
| 5625 | "Soft reconfig inbound update\n") |
| 5626 | |
| 5627 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
| 5628 | clear_ip_bgp_external_in_prefix_filter_cmd, |
| 5629 | "clear ip bgp external in prefix-filter", |
| 5630 | CLEAR_STR |
| 5631 | IP_STR |
| 5632 | BGP_STR |
| 5633 | "Clear all external peers\n" |
| 5634 | "Soft reconfig inbound update\n" |
| 5635 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5636 | { |
| 5637 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5638 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5639 | } |
| 5640 | |
| 5641 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, |
| 5642 | clear_ip_bgp_external_ipv4_soft_in_cmd, |
| 5643 | "clear ip bgp external ipv4 (unicast|multicast) soft in", |
| 5644 | CLEAR_STR |
| 5645 | IP_STR |
| 5646 | BGP_STR |
| 5647 | "Clear all external peers\n" |
| 5648 | "Address family\n" |
| 5649 | "Address Family modifier\n" |
| 5650 | "Address Family modifier\n" |
| 5651 | "Soft reconfig\n" |
| 5652 | "Soft reconfig inbound update\n") |
| 5653 | { |
| 5654 | if (strncmp (argv[0], "m", 1) == 0) |
| 5655 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5656 | BGP_CLEAR_SOFT_IN, NULL); |
| 5657 | |
| 5658 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5659 | BGP_CLEAR_SOFT_IN, NULL); |
| 5660 | } |
| 5661 | |
| 5662 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, |
| 5663 | clear_ip_bgp_external_ipv4_in_cmd, |
| 5664 | "clear ip bgp external ipv4 (unicast|multicast) in", |
| 5665 | CLEAR_STR |
| 5666 | IP_STR |
| 5667 | BGP_STR |
| 5668 | "Clear all external peers\n" |
| 5669 | "Address family\n" |
| 5670 | "Address Family modifier\n" |
| 5671 | "Address Family modifier\n" |
| 5672 | "Soft reconfig inbound update\n") |
| 5673 | |
| 5674 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
| 5675 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, |
| 5676 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", |
| 5677 | CLEAR_STR |
| 5678 | IP_STR |
| 5679 | BGP_STR |
| 5680 | "Clear all external peers\n" |
| 5681 | "Address family\n" |
| 5682 | "Address Family modifier\n" |
| 5683 | "Address Family modifier\n" |
| 5684 | "Soft reconfig inbound update\n" |
| 5685 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5686 | { |
| 5687 | if (strncmp (argv[0], "m", 1) == 0) |
| 5688 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5689 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5690 | |
| 5691 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5692 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5693 | } |
| 5694 | |
| 5695 | DEFUN (clear_bgp_external_soft_in, |
| 5696 | clear_bgp_external_soft_in_cmd, |
| 5697 | "clear bgp external soft in", |
| 5698 | CLEAR_STR |
| 5699 | BGP_STR |
| 5700 | "Clear all external peers\n" |
| 5701 | "Soft reconfig\n" |
| 5702 | "Soft reconfig inbound update\n") |
| 5703 | { |
| 5704 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5705 | BGP_CLEAR_SOFT_IN, NULL); |
| 5706 | } |
| 5707 | |
| 5708 | ALIAS (clear_bgp_external_soft_in, |
| 5709 | clear_bgp_ipv6_external_soft_in_cmd, |
| 5710 | "clear bgp ipv6 external soft in", |
| 5711 | CLEAR_STR |
| 5712 | BGP_STR |
| 5713 | "Address family\n" |
| 5714 | "Clear all external peers\n" |
| 5715 | "Soft reconfig\n" |
| 5716 | "Soft reconfig inbound update\n") |
| 5717 | |
| 5718 | ALIAS (clear_bgp_external_soft_in, |
| 5719 | clear_bgp_external_in_cmd, |
| 5720 | "clear bgp external in", |
| 5721 | CLEAR_STR |
| 5722 | BGP_STR |
| 5723 | "Clear all external peers\n" |
| 5724 | "Soft reconfig inbound update\n") |
| 5725 | |
| 5726 | ALIAS (clear_bgp_external_soft_in, |
| 5727 | clear_bgp_ipv6_external_in_cmd, |
| 5728 | "clear bgp ipv6 external WORD in", |
| 5729 | CLEAR_STR |
| 5730 | BGP_STR |
| 5731 | "Address family\n" |
| 5732 | "Clear all external peers\n" |
| 5733 | "Soft reconfig inbound update\n") |
| 5734 | |
| 5735 | DEFUN (clear_bgp_external_in_prefix_filter, |
| 5736 | clear_bgp_external_in_prefix_filter_cmd, |
| 5737 | "clear bgp external in prefix-filter", |
| 5738 | CLEAR_STR |
| 5739 | BGP_STR |
| 5740 | "Clear all external peers\n" |
| 5741 | "Soft reconfig inbound update\n" |
| 5742 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5743 | { |
| 5744 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5745 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5746 | } |
| 5747 | |
| 5748 | ALIAS (clear_bgp_external_in_prefix_filter, |
| 5749 | clear_bgp_ipv6_external_in_prefix_filter_cmd, |
| 5750 | "clear bgp ipv6 external in prefix-filter", |
| 5751 | CLEAR_STR |
| 5752 | BGP_STR |
| 5753 | "Address family\n" |
| 5754 | "Clear all external peers\n" |
| 5755 | "Soft reconfig inbound update\n" |
| 5756 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5757 | |
| 5758 | DEFUN (clear_ip_bgp_as_soft_in, |
| 5759 | clear_ip_bgp_as_soft_in_cmd, |
| 5760 | "clear ip bgp <1-65535> soft in", |
| 5761 | CLEAR_STR |
| 5762 | IP_STR |
| 5763 | BGP_STR |
| 5764 | "Clear peers with the AS number\n" |
| 5765 | "Soft reconfig\n" |
| 5766 | "Soft reconfig inbound update\n") |
| 5767 | { |
| 5768 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5769 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5770 | } |
| 5771 | |
| 5772 | ALIAS (clear_ip_bgp_as_soft_in, |
| 5773 | clear_ip_bgp_as_in_cmd, |
| 5774 | "clear ip bgp <1-65535> in", |
| 5775 | CLEAR_STR |
| 5776 | IP_STR |
| 5777 | BGP_STR |
| 5778 | "Clear peers with the AS number\n" |
| 5779 | "Soft reconfig inbound update\n") |
| 5780 | |
| 5781 | DEFUN (clear_ip_bgp_as_in_prefix_filter, |
| 5782 | clear_ip_bgp_as_in_prefix_filter_cmd, |
| 5783 | "clear ip bgp <1-65535> in prefix-filter", |
| 5784 | CLEAR_STR |
| 5785 | IP_STR |
| 5786 | BGP_STR |
| 5787 | "Clear peers with the AS number\n" |
| 5788 | "Soft reconfig inbound update\n" |
| 5789 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5790 | { |
| 5791 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5792 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5793 | } |
| 5794 | |
| 5795 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, |
| 5796 | clear_ip_bgp_as_ipv4_soft_in_cmd, |
| 5797 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft in", |
| 5798 | CLEAR_STR |
| 5799 | IP_STR |
| 5800 | BGP_STR |
| 5801 | "Clear peers with the AS number\n" |
| 5802 | "Address family\n" |
| 5803 | "Address Family modifier\n" |
| 5804 | "Address Family modifier\n" |
| 5805 | "Soft reconfig\n" |
| 5806 | "Soft reconfig inbound update\n") |
| 5807 | { |
| 5808 | if (strncmp (argv[1], "m", 1) == 0) |
| 5809 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5810 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5811 | |
| 5812 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5813 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5814 | } |
| 5815 | |
| 5816 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, |
| 5817 | clear_ip_bgp_as_ipv4_in_cmd, |
| 5818 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) in", |
| 5819 | CLEAR_STR |
| 5820 | IP_STR |
| 5821 | BGP_STR |
| 5822 | "Clear peers with the AS number\n" |
| 5823 | "Address family\n" |
| 5824 | "Address Family modifier\n" |
| 5825 | "Address Family modifier\n" |
| 5826 | "Soft reconfig inbound update\n") |
| 5827 | |
| 5828 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
| 5829 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, |
| 5830 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) in prefix-filter", |
| 5831 | CLEAR_STR |
| 5832 | IP_STR |
| 5833 | BGP_STR |
| 5834 | "Clear peers with the AS number\n" |
| 5835 | "Address family\n" |
| 5836 | "Address Family modifier\n" |
| 5837 | "Address Family modifier\n" |
| 5838 | "Soft reconfig inbound update\n" |
| 5839 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5840 | { |
| 5841 | if (strncmp (argv[1], "m", 1) == 0) |
| 5842 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5843 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5844 | |
| 5845 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5846 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5847 | } |
| 5848 | |
| 5849 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, |
| 5850 | clear_ip_bgp_as_vpnv4_soft_in_cmd, |
| 5851 | "clear ip bgp <1-65535> vpnv4 unicast soft in", |
| 5852 | CLEAR_STR |
| 5853 | IP_STR |
| 5854 | BGP_STR |
| 5855 | "Clear peers with the AS number\n" |
| 5856 | "Address family\n" |
| 5857 | "Address Family modifier\n" |
| 5858 | "Soft reconfig\n" |
| 5859 | "Soft reconfig inbound update\n") |
| 5860 | { |
| 5861 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 5862 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5863 | } |
| 5864 | |
| 5865 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, |
| 5866 | clear_ip_bgp_as_vpnv4_in_cmd, |
| 5867 | "clear ip bgp <1-65535> vpnv4 unicast in", |
| 5868 | CLEAR_STR |
| 5869 | IP_STR |
| 5870 | BGP_STR |
| 5871 | "Clear peers with the AS number\n" |
| 5872 | "Address family\n" |
| 5873 | "Address Family modifier\n" |
| 5874 | "Soft reconfig inbound update\n") |
| 5875 | |
| 5876 | DEFUN (clear_bgp_as_soft_in, |
| 5877 | clear_bgp_as_soft_in_cmd, |
| 5878 | "clear bgp <1-65535> soft in", |
| 5879 | CLEAR_STR |
| 5880 | BGP_STR |
| 5881 | "Clear peers with the AS number\n" |
| 5882 | "Soft reconfig\n" |
| 5883 | "Soft reconfig inbound update\n") |
| 5884 | { |
| 5885 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5886 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5887 | } |
| 5888 | |
| 5889 | ALIAS (clear_bgp_as_soft_in, |
| 5890 | clear_bgp_ipv6_as_soft_in_cmd, |
| 5891 | "clear bgp ipv6 <1-65535> soft in", |
| 5892 | CLEAR_STR |
| 5893 | BGP_STR |
| 5894 | "Address family\n" |
| 5895 | "Clear peers with the AS number\n" |
| 5896 | "Soft reconfig\n" |
| 5897 | "Soft reconfig inbound update\n") |
| 5898 | |
| 5899 | ALIAS (clear_bgp_as_soft_in, |
| 5900 | clear_bgp_as_in_cmd, |
| 5901 | "clear bgp <1-65535> in", |
| 5902 | CLEAR_STR |
| 5903 | BGP_STR |
| 5904 | "Clear peers with the AS number\n" |
| 5905 | "Soft reconfig inbound update\n") |
| 5906 | |
| 5907 | ALIAS (clear_bgp_as_soft_in, |
| 5908 | clear_bgp_ipv6_as_in_cmd, |
| 5909 | "clear bgp ipv6 <1-65535> in", |
| 5910 | CLEAR_STR |
| 5911 | BGP_STR |
| 5912 | "Address family\n" |
| 5913 | "Clear peers with the AS number\n" |
| 5914 | "Soft reconfig inbound update\n") |
| 5915 | |
| 5916 | DEFUN (clear_bgp_as_in_prefix_filter, |
| 5917 | clear_bgp_as_in_prefix_filter_cmd, |
| 5918 | "clear bgp <1-65535> in prefix-filter", |
| 5919 | CLEAR_STR |
| 5920 | BGP_STR |
| 5921 | "Clear peers with the AS number\n" |
| 5922 | "Soft reconfig inbound update\n" |
| 5923 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5924 | { |
| 5925 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5926 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5927 | } |
| 5928 | |
| 5929 | ALIAS (clear_bgp_as_in_prefix_filter, |
| 5930 | clear_bgp_ipv6_as_in_prefix_filter_cmd, |
| 5931 | "clear bgp ipv6 <1-65535> in prefix-filter", |
| 5932 | CLEAR_STR |
| 5933 | BGP_STR |
| 5934 | "Address family\n" |
| 5935 | "Clear peers with the AS number\n" |
| 5936 | "Soft reconfig inbound update\n" |
| 5937 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5938 | |
| 5939 | /* Both soft-reconfiguration */ |
| 5940 | DEFUN (clear_ip_bgp_all_soft, |
| 5941 | clear_ip_bgp_all_soft_cmd, |
| 5942 | "clear ip bgp * soft", |
| 5943 | CLEAR_STR |
| 5944 | IP_STR |
| 5945 | BGP_STR |
| 5946 | "Clear all peers\n" |
| 5947 | "Soft reconfig\n") |
| 5948 | { |
| 5949 | if (argc == 1) |
| 5950 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5951 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5952 | |
| 5953 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5954 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5955 | } |
| 5956 | |
| 5957 | ALIAS (clear_ip_bgp_all_soft, |
| 5958 | clear_ip_bgp_instance_all_soft_cmd, |
| 5959 | "clear ip bgp view WORD * soft", |
| 5960 | CLEAR_STR |
| 5961 | IP_STR |
| 5962 | BGP_STR |
| 5963 | "BGP view\n" |
| 5964 | "view name\n" |
| 5965 | "Clear all peers\n" |
| 5966 | "Soft reconfig\n") |
| 5967 | |
| 5968 | |
| 5969 | DEFUN (clear_ip_bgp_all_ipv4_soft, |
| 5970 | clear_ip_bgp_all_ipv4_soft_cmd, |
| 5971 | "clear ip bgp * ipv4 (unicast|multicast) soft", |
| 5972 | CLEAR_STR |
| 5973 | IP_STR |
| 5974 | BGP_STR |
| 5975 | "Clear all peers\n" |
| 5976 | "Address family\n" |
| 5977 | "Address Family Modifier\n" |
| 5978 | "Address Family Modifier\n" |
| 5979 | "Soft reconfig\n") |
| 5980 | { |
| 5981 | if (strncmp (argv[0], "m", 1) == 0) |
| 5982 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5983 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5984 | |
| 5985 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5986 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5987 | } |
| 5988 | |
| 5989 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, |
| 5990 | clear_ip_bgp_instance_all_ipv4_soft_cmd, |
| 5991 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", |
| 5992 | CLEAR_STR |
| 5993 | IP_STR |
| 5994 | BGP_STR |
| 5995 | "BGP view\n" |
| 5996 | "view name\n" |
| 5997 | "Clear all peers\n" |
| 5998 | "Address family\n" |
| 5999 | "Address Family Modifier\n" |
| 6000 | "Address Family Modifier\n" |
| 6001 | "Soft reconfig\n") |
| 6002 | { |
| 6003 | if (strncmp (argv[1], "m", 1) == 0) |
| 6004 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 6005 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6006 | |
| 6007 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6008 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6009 | } |
| 6010 | |
| 6011 | DEFUN (clear_ip_bgp_all_vpnv4_soft, |
| 6012 | clear_ip_bgp_all_vpnv4_soft_cmd, |
| 6013 | "clear ip bgp * vpnv4 unicast soft", |
| 6014 | CLEAR_STR |
| 6015 | IP_STR |
| 6016 | BGP_STR |
| 6017 | "Clear all peers\n" |
| 6018 | "Address family\n" |
| 6019 | "Address Family Modifier\n" |
| 6020 | "Soft reconfig\n") |
| 6021 | { |
| 6022 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 6023 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6024 | } |
| 6025 | |
| 6026 | DEFUN (clear_bgp_all_soft, |
| 6027 | clear_bgp_all_soft_cmd, |
| 6028 | "clear bgp * soft", |
| 6029 | CLEAR_STR |
| 6030 | BGP_STR |
| 6031 | "Clear all peers\n" |
| 6032 | "Soft reconfig\n") |
| 6033 | { |
| 6034 | if (argc == 1) |
| 6035 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6036 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6037 | |
| 6038 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6039 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6040 | } |
| 6041 | |
| 6042 | ALIAS (clear_bgp_all_soft, |
| 6043 | clear_bgp_instance_all_soft_cmd, |
| 6044 | "clear bgp view WORD * soft", |
| 6045 | CLEAR_STR |
| 6046 | BGP_STR |
| 6047 | "BGP view\n" |
| 6048 | "view name\n" |
| 6049 | "Clear all peers\n" |
| 6050 | "Soft reconfig\n") |
| 6051 | |
| 6052 | ALIAS (clear_bgp_all_soft, |
| 6053 | clear_bgp_ipv6_all_soft_cmd, |
| 6054 | "clear bgp ipv6 * soft", |
| 6055 | CLEAR_STR |
| 6056 | BGP_STR |
| 6057 | "Address family\n" |
| 6058 | "Clear all peers\n" |
| 6059 | "Soft reconfig\n") |
| 6060 | |
| 6061 | DEFUN (clear_ip_bgp_peer_soft, |
| 6062 | clear_ip_bgp_peer_soft_cmd, |
| 6063 | "clear ip bgp A.B.C.D soft", |
| 6064 | CLEAR_STR |
| 6065 | IP_STR |
| 6066 | BGP_STR |
| 6067 | "BGP neighbor address to clear\n" |
| 6068 | "Soft reconfig\n") |
| 6069 | { |
| 6070 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6071 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6072 | } |
| 6073 | |
| 6074 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
| 6075 | clear_ip_bgp_peer_ipv4_soft_cmd, |
| 6076 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", |
| 6077 | CLEAR_STR |
| 6078 | IP_STR |
| 6079 | BGP_STR |
| 6080 | "BGP neighbor address to clear\n" |
| 6081 | "Address family\n" |
| 6082 | "Address Family Modifier\n" |
| 6083 | "Address Family Modifier\n" |
| 6084 | "Soft reconfig\n") |
| 6085 | { |
| 6086 | if (strncmp (argv[1], "m", 1) == 0) |
| 6087 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 6088 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6089 | |
| 6090 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6091 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6092 | } |
| 6093 | |
| 6094 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
| 6095 | clear_ip_bgp_peer_vpnv4_soft_cmd, |
| 6096 | "clear ip bgp A.B.C.D vpnv4 unicast soft", |
| 6097 | CLEAR_STR |
| 6098 | IP_STR |
| 6099 | BGP_STR |
| 6100 | "BGP neighbor address to clear\n" |
| 6101 | "Address family\n" |
| 6102 | "Address Family Modifier\n" |
| 6103 | "Soft reconfig\n") |
| 6104 | { |
| 6105 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 6106 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6107 | } |
| 6108 | |
| 6109 | DEFUN (clear_bgp_peer_soft, |
| 6110 | clear_bgp_peer_soft_cmd, |
| 6111 | "clear bgp (A.B.C.D|X:X::X:X) soft", |
| 6112 | CLEAR_STR |
| 6113 | BGP_STR |
| 6114 | "BGP neighbor address to clear\n" |
| 6115 | "BGP IPv6 neighbor to clear\n" |
| 6116 | "Soft reconfig\n") |
| 6117 | { |
| 6118 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6119 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6120 | } |
| 6121 | |
| 6122 | ALIAS (clear_bgp_peer_soft, |
| 6123 | clear_bgp_ipv6_peer_soft_cmd, |
| 6124 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft", |
| 6125 | CLEAR_STR |
| 6126 | BGP_STR |
| 6127 | "Address family\n" |
| 6128 | "BGP neighbor address to clear\n" |
| 6129 | "BGP IPv6 neighbor to clear\n" |
| 6130 | "Soft reconfig\n") |
| 6131 | |
| 6132 | DEFUN (clear_ip_bgp_peer_group_soft, |
| 6133 | clear_ip_bgp_peer_group_soft_cmd, |
| 6134 | "clear ip bgp peer-group WORD soft", |
| 6135 | CLEAR_STR |
| 6136 | IP_STR |
| 6137 | BGP_STR |
| 6138 | "Clear all members of peer-group\n" |
| 6139 | "BGP peer-group name\n" |
| 6140 | "Soft reconfig\n") |
| 6141 | { |
| 6142 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6143 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6144 | } |
| 6145 | |
| 6146 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
| 6147 | clear_ip_bgp_peer_group_ipv4_soft_cmd, |
| 6148 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", |
| 6149 | CLEAR_STR |
| 6150 | IP_STR |
| 6151 | BGP_STR |
| 6152 | "Clear all members of peer-group\n" |
| 6153 | "BGP peer-group name\n" |
| 6154 | "Address family\n" |
| 6155 | "Address Family modifier\n" |
| 6156 | "Address Family modifier\n" |
| 6157 | "Soft reconfig\n") |
| 6158 | { |
| 6159 | if (strncmp (argv[1], "m", 1) == 0) |
| 6160 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 6161 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6162 | |
| 6163 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6164 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6165 | } |
| 6166 | |
| 6167 | DEFUN (clear_bgp_peer_group_soft, |
| 6168 | clear_bgp_peer_group_soft_cmd, |
| 6169 | "clear bgp peer-group WORD soft", |
| 6170 | CLEAR_STR |
| 6171 | BGP_STR |
| 6172 | "Clear all members of peer-group\n" |
| 6173 | "BGP peer-group name\n" |
| 6174 | "Soft reconfig\n") |
| 6175 | { |
| 6176 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 6177 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6178 | } |
| 6179 | |
| 6180 | ALIAS (clear_bgp_peer_group_soft, |
| 6181 | clear_bgp_ipv6_peer_group_soft_cmd, |
| 6182 | "clear bgp ipv6 peer-group WORD soft", |
| 6183 | CLEAR_STR |
| 6184 | BGP_STR |
| 6185 | "Address family\n" |
| 6186 | "Clear all members of peer-group\n" |
| 6187 | "BGP peer-group name\n" |
| 6188 | "Soft reconfig\n") |
| 6189 | |
| 6190 | DEFUN (clear_ip_bgp_external_soft, |
| 6191 | clear_ip_bgp_external_soft_cmd, |
| 6192 | "clear ip bgp external soft", |
| 6193 | CLEAR_STR |
| 6194 | IP_STR |
| 6195 | BGP_STR |
| 6196 | "Clear all external peers\n" |
| 6197 | "Soft reconfig\n") |
| 6198 | { |
| 6199 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6200 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6201 | } |
| 6202 | |
| 6203 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
| 6204 | clear_ip_bgp_external_ipv4_soft_cmd, |
| 6205 | "clear ip bgp external ipv4 (unicast|multicast) soft", |
| 6206 | CLEAR_STR |
| 6207 | IP_STR |
| 6208 | BGP_STR |
| 6209 | "Clear all external peers\n" |
| 6210 | "Address family\n" |
| 6211 | "Address Family modifier\n" |
| 6212 | "Address Family modifier\n" |
| 6213 | "Soft reconfig\n") |
| 6214 | { |
| 6215 | if (strncmp (argv[0], "m", 1) == 0) |
| 6216 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 6217 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6218 | |
| 6219 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6220 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6221 | } |
| 6222 | |
| 6223 | DEFUN (clear_bgp_external_soft, |
| 6224 | clear_bgp_external_soft_cmd, |
| 6225 | "clear bgp external soft", |
| 6226 | CLEAR_STR |
| 6227 | BGP_STR |
| 6228 | "Clear all external peers\n" |
| 6229 | "Soft reconfig\n") |
| 6230 | { |
| 6231 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 6232 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6233 | } |
| 6234 | |
| 6235 | ALIAS (clear_bgp_external_soft, |
| 6236 | clear_bgp_ipv6_external_soft_cmd, |
| 6237 | "clear bgp ipv6 external soft", |
| 6238 | CLEAR_STR |
| 6239 | BGP_STR |
| 6240 | "Address family\n" |
| 6241 | "Clear all external peers\n" |
| 6242 | "Soft reconfig\n") |
| 6243 | |
| 6244 | DEFUN (clear_ip_bgp_as_soft, |
| 6245 | clear_ip_bgp_as_soft_cmd, |
| 6246 | "clear ip bgp <1-65535> soft", |
| 6247 | CLEAR_STR |
| 6248 | IP_STR |
| 6249 | BGP_STR |
| 6250 | "Clear peers with the AS number\n" |
| 6251 | "Soft reconfig\n") |
| 6252 | { |
| 6253 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6254 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6255 | } |
| 6256 | |
| 6257 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
| 6258 | clear_ip_bgp_as_ipv4_soft_cmd, |
| 6259 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft", |
| 6260 | CLEAR_STR |
| 6261 | IP_STR |
| 6262 | BGP_STR |
| 6263 | "Clear peers with the AS number\n" |
| 6264 | "Address family\n" |
| 6265 | "Address Family Modifier\n" |
| 6266 | "Address Family Modifier\n" |
| 6267 | "Soft reconfig\n") |
| 6268 | { |
| 6269 | if (strncmp (argv[1], "m", 1) == 0) |
| 6270 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6271 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6272 | |
| 6273 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, |
| 6274 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6275 | } |
| 6276 | |
| 6277 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
| 6278 | clear_ip_bgp_as_vpnv4_soft_cmd, |
| 6279 | "clear ip bgp <1-65535> vpnv4 unicast soft", |
| 6280 | CLEAR_STR |
| 6281 | IP_STR |
| 6282 | BGP_STR |
| 6283 | "Clear peers with the AS number\n" |
| 6284 | "Address family\n" |
| 6285 | "Address Family Modifier\n" |
| 6286 | "Soft reconfig\n") |
| 6287 | { |
| 6288 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 6289 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6290 | } |
| 6291 | |
| 6292 | DEFUN (clear_bgp_as_soft, |
| 6293 | clear_bgp_as_soft_cmd, |
| 6294 | "clear bgp <1-65535> soft", |
| 6295 | CLEAR_STR |
| 6296 | BGP_STR |
| 6297 | "Clear peers with the AS number\n" |
| 6298 | "Soft reconfig\n") |
| 6299 | { |
| 6300 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6301 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6302 | } |
| 6303 | |
| 6304 | ALIAS (clear_bgp_as_soft, |
| 6305 | clear_bgp_ipv6_as_soft_cmd, |
| 6306 | "clear bgp ipv6 <1-65535> soft", |
| 6307 | CLEAR_STR |
| 6308 | BGP_STR |
| 6309 | "Address family\n" |
| 6310 | "Clear peers with the AS number\n" |
| 6311 | "Soft reconfig\n") |
| 6312 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6313 | /* RS-client soft reconfiguration. */ |
| 6314 | #ifdef HAVE_IPV6 |
| 6315 | DEFUN (clear_bgp_all_rsclient, |
| 6316 | clear_bgp_all_rsclient_cmd, |
| 6317 | "clear bgp * rsclient", |
| 6318 | CLEAR_STR |
| 6319 | BGP_STR |
| 6320 | "Clear all peers\n" |
| 6321 | "Soft reconfig for rsclient RIB\n") |
| 6322 | { |
| 6323 | if (argc == 1) |
| 6324 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6325 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6326 | |
| 6327 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6328 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6329 | } |
| 6330 | |
| 6331 | ALIAS (clear_bgp_all_rsclient, |
| 6332 | clear_bgp_ipv6_all_rsclient_cmd, |
| 6333 | "clear bgp ipv6 * rsclient", |
| 6334 | CLEAR_STR |
| 6335 | BGP_STR |
| 6336 | "Address family\n" |
| 6337 | "Clear all peers\n" |
| 6338 | "Soft reconfig for rsclient RIB\n") |
| 6339 | |
| 6340 | ALIAS (clear_bgp_all_rsclient, |
| 6341 | clear_bgp_instance_all_rsclient_cmd, |
| 6342 | "clear bgp view WORD * rsclient", |
| 6343 | CLEAR_STR |
| 6344 | BGP_STR |
| 6345 | "BGP view\n" |
| 6346 | "view name\n" |
| 6347 | "Clear all peers\n" |
| 6348 | "Soft reconfig for rsclient RIB\n") |
| 6349 | |
| 6350 | ALIAS (clear_bgp_all_rsclient, |
| 6351 | clear_bgp_ipv6_instance_all_rsclient_cmd, |
| 6352 | "clear bgp ipv6 view WORD * rsclient", |
| 6353 | CLEAR_STR |
| 6354 | BGP_STR |
| 6355 | "Address family\n" |
| 6356 | "BGP view\n" |
| 6357 | "view name\n" |
| 6358 | "Clear all peers\n" |
| 6359 | "Soft reconfig for rsclient RIB\n") |
| 6360 | #endif /* HAVE_IPV6 */ |
| 6361 | |
| 6362 | DEFUN (clear_ip_bgp_all_rsclient, |
| 6363 | clear_ip_bgp_all_rsclient_cmd, |
| 6364 | "clear ip bgp * rsclient", |
| 6365 | CLEAR_STR |
| 6366 | IP_STR |
| 6367 | BGP_STR |
| 6368 | "Clear all peers\n" |
| 6369 | "Soft reconfig for rsclient RIB\n") |
| 6370 | { |
| 6371 | if (argc == 1) |
| 6372 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6373 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6374 | |
| 6375 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6376 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6377 | } |
| 6378 | |
| 6379 | ALIAS (clear_ip_bgp_all_rsclient, |
| 6380 | clear_ip_bgp_instance_all_rsclient_cmd, |
| 6381 | "clear ip bgp view WORD * rsclient", |
| 6382 | CLEAR_STR |
| 6383 | IP_STR |
| 6384 | BGP_STR |
| 6385 | "BGP view\n" |
| 6386 | "view name\n" |
| 6387 | "Clear all peers\n" |
| 6388 | "Soft reconfig for rsclient RIB\n") |
| 6389 | |
| 6390 | #ifdef HAVE_IPV6 |
| 6391 | DEFUN (clear_bgp_peer_rsclient, |
| 6392 | clear_bgp_peer_rsclient_cmd, |
| 6393 | "clear bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6394 | CLEAR_STR |
| 6395 | BGP_STR |
| 6396 | "BGP neighbor IP address to clear\n" |
| 6397 | "BGP IPv6 neighbor to clear\n" |
| 6398 | "Soft reconfig for rsclient RIB\n") |
| 6399 | { |
| 6400 | if (argc == 2) |
| 6401 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6402 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6403 | |
| 6404 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6405 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6406 | } |
| 6407 | |
| 6408 | ALIAS (clear_bgp_peer_rsclient, |
| 6409 | clear_bgp_ipv6_peer_rsclient_cmd, |
| 6410 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient", |
| 6411 | CLEAR_STR |
| 6412 | BGP_STR |
| 6413 | "Address family\n" |
| 6414 | "BGP neighbor IP address to clear\n" |
| 6415 | "BGP IPv6 neighbor to clear\n" |
| 6416 | "Soft reconfig for rsclient RIB\n") |
| 6417 | |
| 6418 | ALIAS (clear_bgp_peer_rsclient, |
| 6419 | clear_bgp_instance_peer_rsclient_cmd, |
| 6420 | "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6421 | CLEAR_STR |
| 6422 | BGP_STR |
| 6423 | "BGP view\n" |
| 6424 | "view name\n" |
| 6425 | "BGP neighbor IP address to clear\n" |
| 6426 | "BGP IPv6 neighbor to clear\n" |
| 6427 | "Soft reconfig for rsclient RIB\n") |
| 6428 | |
| 6429 | ALIAS (clear_bgp_peer_rsclient, |
| 6430 | clear_bgp_ipv6_instance_peer_rsclient_cmd, |
| 6431 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6432 | CLEAR_STR |
| 6433 | BGP_STR |
| 6434 | "Address family\n" |
| 6435 | "BGP view\n" |
| 6436 | "view name\n" |
| 6437 | "BGP neighbor IP address to clear\n" |
| 6438 | "BGP IPv6 neighbor to clear\n" |
| 6439 | "Soft reconfig for rsclient RIB\n") |
| 6440 | #endif /* HAVE_IPV6 */ |
| 6441 | |
| 6442 | DEFUN (clear_ip_bgp_peer_rsclient, |
| 6443 | clear_ip_bgp_peer_rsclient_cmd, |
| 6444 | "clear ip bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6445 | CLEAR_STR |
| 6446 | IP_STR |
| 6447 | BGP_STR |
| 6448 | "BGP neighbor IP address to clear\n" |
| 6449 | "BGP IPv6 neighbor to clear\n" |
| 6450 | "Soft reconfig for rsclient RIB\n") |
| 6451 | { |
| 6452 | if (argc == 2) |
| 6453 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, |
| 6454 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6455 | |
| 6456 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6457 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6458 | } |
| 6459 | |
| 6460 | ALIAS (clear_ip_bgp_peer_rsclient, |
| 6461 | clear_ip_bgp_instance_peer_rsclient_cmd, |
| 6462 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6463 | CLEAR_STR |
| 6464 | IP_STR |
| 6465 | BGP_STR |
| 6466 | "BGP view\n" |
| 6467 | "view name\n" |
| 6468 | "BGP neighbor IP address to clear\n" |
| 6469 | "BGP IPv6 neighbor to clear\n" |
| 6470 | "Soft reconfig for rsclient RIB\n") |
| 6471 | |
| 6472 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6473 | /* Show BGP peer's summary information. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6474 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6475 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) |
| 6476 | { |
| 6477 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6478 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6479 | int count = 0; |
| 6480 | char timebuf[BGP_UPTIME_LEN]; |
| 6481 | int len; |
| 6482 | |
| 6483 | /* Header string for each address family. */ |
| 6484 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; |
| 6485 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6486 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6487 | { |
| 6488 | if (peer->afc[afi][safi]) |
| 6489 | { |
| 6490 | if (! count) |
| 6491 | { |
| 6492 | vty_out (vty, |
| 6493 | "BGP router identifier %s, local AS number %d%s", |
| 6494 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); |
| 6495 | vty_out (vty, |
| 6496 | "%ld BGP AS-PATH entries%s", aspath_count (), |
| 6497 | VTY_NEWLINE); |
| 6498 | vty_out (vty, |
| 6499 | "%ld BGP community entries%s", community_count (), |
| 6500 | VTY_NEWLINE); |
| 6501 | |
| 6502 | if (CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
| 6503 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); |
| 6504 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6505 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 6506 | } |
| 6507 | count++; |
| 6508 | |
| 6509 | len = vty_out (vty, "%s", peer->host); |
| 6510 | len = 16 - len; |
| 6511 | if (len < 1) |
| 6512 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 6513 | else |
| 6514 | vty_out (vty, "%*s", len, " "); |
| 6515 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 6516 | vty_out (vty, "4 "); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6517 | |
| 6518 | vty_out (vty, "%5d %7d %7d %8d %4d %4ld ", |
| 6519 | peer->as, |
| 6520 | peer->open_in + peer->update_in + peer->keepalive_in |
| 6521 | + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in, |
| 6522 | peer->open_out + peer->update_out + peer->keepalive_out |
| 6523 | + peer->notify_out + peer->refresh_out |
| 6524 | + peer->dynamic_cap_out, |
| 6525 | 0, 0, peer->obuf->count); |
| 6526 | |
| 6527 | vty_out (vty, "%8s", |
| 6528 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); |
| 6529 | |
| 6530 | if (peer->status == Established) |
| 6531 | { |
| 6532 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); |
| 6533 | } |
| 6534 | else |
| 6535 | { |
| 6536 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) |
| 6537 | vty_out (vty, " Idle (Admin)"); |
| 6538 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 6539 | vty_out (vty, " Idle (PfxCt)"); |
| 6540 | else |
| 6541 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); |
| 6542 | } |
| 6543 | |
| 6544 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6545 | } |
| 6546 | } |
| 6547 | |
| 6548 | if (count) |
| 6549 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, |
| 6550 | count, VTY_NEWLINE); |
| 6551 | else |
| 6552 | vty_out (vty, "No %s neighbor is configured%s", |
| 6553 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 6554 | return CMD_SUCCESS; |
| 6555 | } |
| 6556 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6557 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 6558 | bgp_show_summary_vty (struct vty *vty, const char *name, |
| 6559 | afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6560 | { |
| 6561 | struct bgp *bgp; |
| 6562 | |
| 6563 | if (name) |
| 6564 | { |
| 6565 | bgp = bgp_lookup_by_name (name); |
| 6566 | |
| 6567 | if (! bgp) |
| 6568 | { |
| 6569 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 6570 | return CMD_WARNING; |
| 6571 | } |
| 6572 | |
| 6573 | bgp_show_summary (vty, bgp, afi, safi); |
| 6574 | return CMD_SUCCESS; |
| 6575 | } |
| 6576 | |
| 6577 | bgp = bgp_get_default (); |
| 6578 | |
| 6579 | if (bgp) |
| 6580 | bgp_show_summary (vty, bgp, afi, safi); |
| 6581 | |
| 6582 | return CMD_SUCCESS; |
| 6583 | } |
| 6584 | |
| 6585 | /* `show ip bgp summary' commands. */ |
| 6586 | DEFUN (show_ip_bgp_summary, |
| 6587 | show_ip_bgp_summary_cmd, |
| 6588 | "show ip bgp summary", |
| 6589 | SHOW_STR |
| 6590 | IP_STR |
| 6591 | BGP_STR |
| 6592 | "Summary of BGP neighbor status\n") |
| 6593 | { |
| 6594 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 6595 | } |
| 6596 | |
| 6597 | DEFUN (show_ip_bgp_instance_summary, |
| 6598 | show_ip_bgp_instance_summary_cmd, |
| 6599 | "show ip bgp view WORD summary", |
| 6600 | SHOW_STR |
| 6601 | IP_STR |
| 6602 | BGP_STR |
| 6603 | "BGP view\n" |
| 6604 | "View name\n" |
| 6605 | "Summary of BGP neighbor status\n") |
| 6606 | { |
| 6607 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 6608 | } |
| 6609 | |
| 6610 | DEFUN (show_ip_bgp_ipv4_summary, |
| 6611 | show_ip_bgp_ipv4_summary_cmd, |
| 6612 | "show ip bgp ipv4 (unicast|multicast) summary", |
| 6613 | SHOW_STR |
| 6614 | IP_STR |
| 6615 | BGP_STR |
| 6616 | "Address family\n" |
| 6617 | "Address Family modifier\n" |
| 6618 | "Address Family modifier\n" |
| 6619 | "Summary of BGP neighbor status\n") |
| 6620 | { |
| 6621 | if (strncmp (argv[0], "m", 1) == 0) |
| 6622 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 6623 | |
| 6624 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 6625 | } |
| 6626 | |
| 6627 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
| 6628 | show_ip_bgp_instance_ipv4_summary_cmd, |
| 6629 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", |
| 6630 | SHOW_STR |
| 6631 | IP_STR |
| 6632 | BGP_STR |
| 6633 | "BGP view\n" |
| 6634 | "View name\n" |
| 6635 | "Address family\n" |
| 6636 | "Address Family modifier\n" |
| 6637 | "Address Family modifier\n" |
| 6638 | "Summary of BGP neighbor status\n") |
| 6639 | { |
| 6640 | if (strncmp (argv[1], "m", 1) == 0) |
| 6641 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 6642 | else |
| 6643 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 6644 | } |
| 6645 | |
| 6646 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
| 6647 | show_ip_bgp_vpnv4_all_summary_cmd, |
| 6648 | "show ip bgp vpnv4 all summary", |
| 6649 | SHOW_STR |
| 6650 | IP_STR |
| 6651 | BGP_STR |
| 6652 | "Display VPNv4 NLRI specific information\n" |
| 6653 | "Display information about all VPNv4 NLRIs\n" |
| 6654 | "Summary of BGP neighbor status\n") |
| 6655 | { |
| 6656 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 6657 | } |
| 6658 | |
| 6659 | DEFUN (show_ip_bgp_vpnv4_rd_summary, |
| 6660 | show_ip_bgp_vpnv4_rd_summary_cmd, |
| 6661 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", |
| 6662 | SHOW_STR |
| 6663 | IP_STR |
| 6664 | BGP_STR |
| 6665 | "Display VPNv4 NLRI specific information\n" |
| 6666 | "Display information for a route distinguisher\n" |
| 6667 | "VPN Route Distinguisher\n" |
| 6668 | "Summary of BGP neighbor status\n") |
| 6669 | { |
| 6670 | int ret; |
| 6671 | struct prefix_rd prd; |
| 6672 | |
| 6673 | ret = str2prefix_rd (argv[0], &prd); |
| 6674 | if (! ret) |
| 6675 | { |
| 6676 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); |
| 6677 | return CMD_WARNING; |
| 6678 | } |
| 6679 | |
| 6680 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 6681 | } |
| 6682 | |
| 6683 | #ifdef HAVE_IPV6 |
| 6684 | DEFUN (show_bgp_summary, |
| 6685 | show_bgp_summary_cmd, |
| 6686 | "show bgp summary", |
| 6687 | SHOW_STR |
| 6688 | BGP_STR |
| 6689 | "Summary of BGP neighbor status\n") |
| 6690 | { |
| 6691 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 6692 | } |
| 6693 | |
| 6694 | DEFUN (show_bgp_instance_summary, |
| 6695 | show_bgp_instance_summary_cmd, |
| 6696 | "show bgp view WORD summary", |
| 6697 | SHOW_STR |
| 6698 | BGP_STR |
| 6699 | "BGP view\n" |
| 6700 | "View name\n" |
| 6701 | "Summary of BGP neighbor status\n") |
| 6702 | { |
| 6703 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 6704 | } |
| 6705 | |
| 6706 | ALIAS (show_bgp_summary, |
| 6707 | show_bgp_ipv6_summary_cmd, |
| 6708 | "show bgp ipv6 summary", |
| 6709 | SHOW_STR |
| 6710 | BGP_STR |
| 6711 | "Address family\n" |
| 6712 | "Summary of BGP neighbor status\n") |
| 6713 | |
| 6714 | ALIAS (show_bgp_instance_summary, |
| 6715 | show_bgp_instance_ipv6_summary_cmd, |
| 6716 | "show bgp view WORD ipv6 summary", |
| 6717 | SHOW_STR |
| 6718 | BGP_STR |
| 6719 | "BGP view\n" |
| 6720 | "View name\n" |
| 6721 | "Address family\n" |
| 6722 | "Summary of BGP neighbor status\n") |
| 6723 | |
| 6724 | /* old command */ |
| 6725 | DEFUN (show_ipv6_bgp_summary, |
| 6726 | show_ipv6_bgp_summary_cmd, |
| 6727 | "show ipv6 bgp summary", |
| 6728 | SHOW_STR |
| 6729 | IPV6_STR |
| 6730 | BGP_STR |
| 6731 | "Summary of BGP neighbor status\n") |
| 6732 | { |
| 6733 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 6734 | } |
| 6735 | |
| 6736 | /* old command */ |
| 6737 | DEFUN (show_ipv6_mbgp_summary, |
| 6738 | show_ipv6_mbgp_summary_cmd, |
| 6739 | "show ipv6 mbgp summary", |
| 6740 | SHOW_STR |
| 6741 | IPV6_STR |
| 6742 | MBGP_STR |
| 6743 | "Summary of BGP neighbor status\n") |
| 6744 | { |
| 6745 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 6746 | } |
| 6747 | #endif /* HAVE_IPV6 */ |
| 6748 | |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 6749 | const char * |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6750 | afi_safi_print (afi_t afi, safi_t safi) |
| 6751 | { |
| 6752 | if (afi == AFI_IP && safi == SAFI_UNICAST) |
| 6753 | return "IPv4 Unicast"; |
| 6754 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) |
| 6755 | return "IPv4 Multicast"; |
| 6756 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) |
| 6757 | return "VPNv4 Unicast"; |
| 6758 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) |
| 6759 | return "IPv6 Unicast"; |
| 6760 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) |
| 6761 | return "IPv6 Multicast"; |
| 6762 | else |
| 6763 | return "Unknown"; |
| 6764 | } |
| 6765 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6766 | /* Show BGP peer's information. */ |
| 6767 | enum show_type |
| 6768 | { |
| 6769 | show_all, |
| 6770 | show_peer |
| 6771 | }; |
| 6772 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6773 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6774 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
| 6775 | afi_t afi, safi_t safi, |
| 6776 | u_int16_t adv_smcap, u_int16_t adv_rmcap, |
| 6777 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) |
| 6778 | { |
| 6779 | /* Send-Mode */ |
| 6780 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) |
| 6781 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 6782 | { |
| 6783 | vty_out (vty, " Send-mode: "); |
| 6784 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) |
| 6785 | vty_out (vty, "advertised"); |
| 6786 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 6787 | vty_out (vty, "%sreceived", |
| 6788 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? |
| 6789 | ", " : ""); |
| 6790 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6791 | } |
| 6792 | |
| 6793 | /* Receive-Mode */ |
| 6794 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) |
| 6795 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 6796 | { |
| 6797 | vty_out (vty, " Receive-mode: "); |
| 6798 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) |
| 6799 | vty_out (vty, "advertised"); |
| 6800 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 6801 | vty_out (vty, "%sreceived", |
| 6802 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? |
| 6803 | ", " : ""); |
| 6804 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6805 | } |
| 6806 | } |
| 6807 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6808 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6809 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
| 6810 | { |
| 6811 | struct bgp_filter *filter; |
| 6812 | char orf_pfx_name[BUFSIZ]; |
| 6813 | int orf_pfx_count; |
| 6814 | |
| 6815 | filter = &p->filter[afi][safi]; |
| 6816 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6817 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6818 | VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6819 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6820 | if (p->af_group[afi][safi]) |
| 6821 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
| 6822 | |
| 6823 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 6824 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 6825 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 6826 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 6827 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) |
| 6828 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 6829 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); |
| 6830 | |
| 6831 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 6832 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 6833 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 6834 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) |
| 6835 | { |
| 6836 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 6837 | ORF_TYPE_PREFIX, VTY_NEWLINE); |
| 6838 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 6839 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 6840 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 6841 | PEER_CAP_ORF_PREFIX_SM_RCV, |
| 6842 | PEER_CAP_ORF_PREFIX_RM_RCV); |
| 6843 | } |
| 6844 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 6845 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 6846 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 6847 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 6848 | { |
| 6849 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 6850 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); |
| 6851 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 6852 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 6853 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 6854 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, |
| 6855 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); |
| 6856 | } |
| 6857 | |
| 6858 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
| 6859 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); |
| 6860 | |
| 6861 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
| 6862 | || orf_pfx_count) |
| 6863 | { |
| 6864 | vty_out (vty, " Outbound Route Filter (ORF):"); |
| 6865 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) |
| 6866 | vty_out (vty, " sent;"); |
| 6867 | if (orf_pfx_count) |
| 6868 | vty_out (vty, " received (%d entries)", orf_pfx_count); |
| 6869 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6870 | } |
| 6871 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) |
| 6872 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); |
| 6873 | |
| 6874 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) |
| 6875 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); |
| 6876 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 6877 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); |
| 6878 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) |
| 6879 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); |
| 6880 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
| 6881 | vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE); |
| 6882 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) |
| 6883 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); |
| 6884 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) |
| 6885 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 6886 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) |
| 6887 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 6888 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) |
| 6889 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 6890 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 6891 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
| 6892 | { |
| 6893 | vty_out (vty, " Community attribute sent to this neighbor"); |
| 6894 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 6895 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6896 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6897 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6898 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6899 | else |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6900 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6901 | } |
| 6902 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) |
| 6903 | { |
| 6904 | vty_out (vty, " Default information originate,"); |
| 6905 | |
| 6906 | if (p->default_rmap[afi][safi].name) |
| 6907 | vty_out (vty, " default route-map %s%s,", |
| 6908 | p->default_rmap[afi][safi].map ? "*" : "", |
| 6909 | p->default_rmap[afi][safi].name); |
| 6910 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) |
| 6911 | vty_out (vty, " default sent%s", VTY_NEWLINE); |
| 6912 | else |
| 6913 | vty_out (vty, " default not sent%s", VTY_NEWLINE); |
| 6914 | } |
| 6915 | |
| 6916 | if (filter->plist[FILTER_IN].name |
| 6917 | || filter->dlist[FILTER_IN].name |
| 6918 | || filter->aslist[FILTER_IN].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6919 | || filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6920 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
| 6921 | if (filter->plist[FILTER_OUT].name |
| 6922 | || filter->dlist[FILTER_OUT].name |
| 6923 | || filter->aslist[FILTER_OUT].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6924 | || filter->map[RMAP_OUT].name |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6925 | || filter->usmap.name) |
| 6926 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6927 | if (filter->map[RMAP_IMPORT].name) |
| 6928 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); |
| 6929 | if (filter->map[RMAP_EXPORT].name) |
| 6930 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6931 | |
| 6932 | /* prefix-list */ |
| 6933 | if (filter->plist[FILTER_IN].name) |
| 6934 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", |
| 6935 | filter->plist[FILTER_IN].plist ? "*" : "", |
| 6936 | filter->plist[FILTER_IN].name, |
| 6937 | VTY_NEWLINE); |
| 6938 | if (filter->plist[FILTER_OUT].name) |
| 6939 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", |
| 6940 | filter->plist[FILTER_OUT].plist ? "*" : "", |
| 6941 | filter->plist[FILTER_OUT].name, |
| 6942 | VTY_NEWLINE); |
| 6943 | |
| 6944 | /* distribute-list */ |
| 6945 | if (filter->dlist[FILTER_IN].name) |
| 6946 | vty_out (vty, " Incoming update network filter list is %s%s%s", |
| 6947 | filter->dlist[FILTER_IN].alist ? "*" : "", |
| 6948 | filter->dlist[FILTER_IN].name, |
| 6949 | VTY_NEWLINE); |
| 6950 | if (filter->dlist[FILTER_OUT].name) |
| 6951 | vty_out (vty, " Outgoing update network filter list is %s%s%s", |
| 6952 | filter->dlist[FILTER_OUT].alist ? "*" : "", |
| 6953 | filter->dlist[FILTER_OUT].name, |
| 6954 | VTY_NEWLINE); |
| 6955 | |
| 6956 | /* filter-list. */ |
| 6957 | if (filter->aslist[FILTER_IN].name) |
| 6958 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", |
| 6959 | filter->aslist[FILTER_IN].aslist ? "*" : "", |
| 6960 | filter->aslist[FILTER_IN].name, |
| 6961 | VTY_NEWLINE); |
| 6962 | if (filter->aslist[FILTER_OUT].name) |
| 6963 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", |
| 6964 | filter->aslist[FILTER_OUT].aslist ? "*" : "", |
| 6965 | filter->aslist[FILTER_OUT].name, |
| 6966 | VTY_NEWLINE); |
| 6967 | |
| 6968 | /* route-map. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6969 | if (filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6970 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6971 | filter->map[RMAP_IN].map ? "*" : "", |
| 6972 | filter->map[RMAP_IN].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6973 | VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6974 | if (filter->map[RMAP_OUT].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6975 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6976 | filter->map[RMAP_OUT].map ? "*" : "", |
| 6977 | filter->map[RMAP_OUT].name, |
| 6978 | VTY_NEWLINE); |
| 6979 | if (filter->map[RMAP_IMPORT].name) |
| 6980 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", |
| 6981 | filter->map[RMAP_IMPORT].map ? "*" : "", |
| 6982 | filter->map[RMAP_IMPORT].name, |
| 6983 | VTY_NEWLINE); |
| 6984 | if (filter->map[RMAP_EXPORT].name) |
| 6985 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", |
| 6986 | filter->map[RMAP_EXPORT].map ? "*" : "", |
| 6987 | filter->map[RMAP_EXPORT].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6988 | VTY_NEWLINE); |
| 6989 | |
| 6990 | /* unsuppress-map */ |
| 6991 | if (filter->usmap.name) |
| 6992 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", |
| 6993 | filter->usmap.map ? "*" : "", |
| 6994 | filter->usmap.name, VTY_NEWLINE); |
| 6995 | |
| 6996 | /* Receive prefix count */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 6997 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
| 6998 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6999 | /* Maximum prefix */ |
| 7000 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) |
| 7001 | { |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7002 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7003 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7004 | ? " (warning-only)" : "", VTY_NEWLINE); |
| 7005 | vty_out (vty, " Threshold for warning message %d%%", |
| 7006 | p->pmax_threshold[afi][safi]); |
| 7007 | if (p->pmax_restart[afi][safi]) |
| 7008 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); |
| 7009 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7010 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7011 | |
| 7012 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7013 | } |
| 7014 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7015 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7016 | bgp_show_peer (struct vty *vty, struct peer *p) |
| 7017 | { |
| 7018 | struct bgp *bgp; |
| 7019 | char buf1[BUFSIZ]; |
| 7020 | char timebuf[BGP_UPTIME_LEN]; |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7021 | afi_t afi; |
| 7022 | safi_t safi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7023 | |
| 7024 | bgp = p->bgp; |
| 7025 | |
| 7026 | /* Configured IP address. */ |
| 7027 | vty_out (vty, "BGP neighbor is %s, ", p->host); |
| 7028 | vty_out (vty, "remote AS %d, ", p->as); |
| 7029 | vty_out (vty, "local AS %d%s, ", |
| 7030 | p->change_local_as ? p->change_local_as : p->local_as, |
| 7031 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? |
| 7032 | " no-prepend" : ""); |
| 7033 | vty_out (vty, "%s link%s", |
| 7034 | p->as == p->local_as ? "internal" : "external", |
| 7035 | VTY_NEWLINE); |
| 7036 | |
| 7037 | /* Description. */ |
| 7038 | if (p->desc) |
| 7039 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); |
| 7040 | |
| 7041 | /* Peer-group */ |
| 7042 | if (p->group) |
| 7043 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
| 7044 | p->group->name, VTY_NEWLINE); |
| 7045 | |
| 7046 | /* Administrative shutdown. */ |
| 7047 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) |
| 7048 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); |
| 7049 | |
| 7050 | /* BGP Version. */ |
| 7051 | vty_out (vty, " BGP version 4"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7052 | vty_out (vty, ", remote router ID %s%s", |
| 7053 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), |
| 7054 | VTY_NEWLINE); |
| 7055 | |
| 7056 | /* Confederation */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7057 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
| 7058 | && bgp_confederation_peers_check (bgp, p->as)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7059 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
| 7060 | |
| 7061 | /* Status. */ |
| 7062 | vty_out (vty, " BGP state = %s", |
| 7063 | LOOKUP (bgp_status_msg, p->status)); |
| 7064 | if (p->status == Established) |
| 7065 | vty_out (vty, ", up for %8s", |
| 7066 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7067 | else if (p->status == Active) |
| 7068 | { |
| 7069 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) |
| 7070 | vty_out (vty, " (passive)"); |
| 7071 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) |
| 7072 | vty_out (vty, " (NSF passive)"); |
| 7073 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7074 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7075 | |
| 7076 | /* read timer */ |
| 7077 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); |
| 7078 | |
| 7079 | /* Configured timer values. */ |
| 7080 | vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s", |
| 7081 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); |
| 7082 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) |
| 7083 | { |
| 7084 | vty_out (vty, " Configured hold time is %d", p->holdtime); |
| 7085 | vty_out (vty, ", keepalive interval is %d seconds%s", |
| 7086 | p->keepalive, VTY_NEWLINE); |
| 7087 | } |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7088 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7089 | /* Capability. */ |
| 7090 | if (p->status == Established) |
| 7091 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7092 | if (p->cap |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7093 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
| 7094 | || p->afc_recv[AFI_IP][SAFI_UNICAST] |
| 7095 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] |
| 7096 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] |
| 7097 | #ifdef HAVE_IPV6 |
| 7098 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] |
| 7099 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] |
| 7100 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] |
| 7101 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] |
| 7102 | #endif /* HAVE_IPV6 */ |
| 7103 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] |
| 7104 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) |
| 7105 | { |
| 7106 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); |
| 7107 | |
| 7108 | /* Dynamic */ |
| 7109 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) |
| 7110 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7111 | { |
| 7112 | vty_out (vty, " Dynamic:"); |
| 7113 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7114 | vty_out (vty, " advertised"); |
| 7115 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7116 | vty_out (vty, " %sreceived", |
| 7117 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7118 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7119 | } |
| 7120 | |
| 7121 | /* Route Refresh */ |
| 7122 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) |
| 7123 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7124 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
| 7125 | { |
| 7126 | vty_out (vty, " Route refresh:"); |
| 7127 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) |
| 7128 | vty_out (vty, " advertised"); |
| 7129 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7130 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7131 | vty_out (vty, " %sreceived(%s)", |
| 7132 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", |
| 7133 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) |
| 7134 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? |
| 7135 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); |
| 7136 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7137 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7138 | } |
| 7139 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7140 | /* Multiprotocol Extensions */ |
| 7141 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7142 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7143 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7144 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7145 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
| 7146 | if (p->afc_adv[afi][safi]) |
| 7147 | vty_out (vty, " advertised"); |
| 7148 | if (p->afc_recv[afi][safi]) |
| 7149 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); |
| 7150 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7151 | } |
| 7152 | |
| 7153 | /* Gracefull Restart */ |
| 7154 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7155 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7156 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7157 | vty_out (vty, " Graceful Restart Capabilty:"); |
| 7158 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7159 | vty_out (vty, " advertised"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7160 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
| 7161 | vty_out (vty, " %sreceived", |
| 7162 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7163 | vty_out (vty, "%s", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7164 | |
| 7165 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7166 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7167 | int restart_af_count = 0; |
| 7168 | |
| 7169 | vty_out (vty, " Remote Restart timer is %d seconds%s", |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7170 | p->v_gr_restart, VTY_NEWLINE); |
| 7171 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7172 | |
| 7173 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7174 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7175 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) |
| 7176 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7177 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
| 7178 | afi_safi_print (afi, safi), |
| 7179 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? |
| 7180 | "preserved" : "not preserved"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7181 | restart_af_count++; |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7182 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7183 | if (! restart_af_count) |
| 7184 | vty_out (vty, "none"); |
| 7185 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7186 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7187 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7188 | } |
| 7189 | } |
| 7190 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7191 | /* graceful restart information */ |
| 7192 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7193 | || p->t_gr_restart |
| 7194 | || p->t_gr_stale) |
| 7195 | { |
| 7196 | int eor_send_af_count = 0; |
| 7197 | int eor_receive_af_count = 0; |
| 7198 | |
| 7199 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); |
| 7200 | if (p->status == Established) |
| 7201 | { |
| 7202 | vty_out (vty, " End-of-RIB send: "); |
| 7203 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7204 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7205 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) |
| 7206 | { |
| 7207 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", |
| 7208 | afi_safi_print (afi, safi)); |
| 7209 | eor_send_af_count++; |
| 7210 | } |
| 7211 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7212 | |
| 7213 | vty_out (vty, " End-of-RIB received: "); |
| 7214 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7215 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7216 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) |
| 7217 | { |
| 7218 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", |
| 7219 | afi_safi_print (afi, safi)); |
| 7220 | eor_receive_af_count++; |
| 7221 | } |
| 7222 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7223 | } |
| 7224 | |
| 7225 | if (p->t_gr_restart) |
| 7226 | { |
| 7227 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
| 7228 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); |
| 7229 | } |
| 7230 | if (p->t_gr_stale) |
| 7231 | { |
| 7232 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
| 7233 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); |
| 7234 | } |
| 7235 | } |
| 7236 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7237 | /* Packet counts. */ |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7238 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
| 7239 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); |
| 7240 | vty_out (vty, " Outq depth is %ld%s", p->obuf->count, VTY_NEWLINE); |
| 7241 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
| 7242 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); |
| 7243 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); |
| 7244 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); |
| 7245 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); |
| 7246 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); |
| 7247 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); |
| 7248 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + |
| 7249 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, |
| 7250 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + |
| 7251 | p->dynamic_cap_in, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7252 | |
| 7253 | /* advertisement-interval */ |
| 7254 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", |
| 7255 | p->v_routeadv, VTY_NEWLINE); |
| 7256 | |
| 7257 | /* Update-source. */ |
| 7258 | if (p->update_if || p->update_source) |
| 7259 | { |
| 7260 | vty_out (vty, " Update source is "); |
| 7261 | if (p->update_if) |
| 7262 | vty_out (vty, "%s", p->update_if); |
| 7263 | else if (p->update_source) |
| 7264 | vty_out (vty, "%s", |
| 7265 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); |
| 7266 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7267 | } |
| 7268 | |
| 7269 | /* Default weight */ |
| 7270 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) |
| 7271 | vty_out (vty, " Default weight %d%s", p->weight, |
| 7272 | VTY_NEWLINE); |
| 7273 | |
| 7274 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7275 | |
| 7276 | /* Address Family Information */ |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7277 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7278 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7279 | if (p->afc[afi][safi]) |
| 7280 | bgp_show_peer_afi (vty, p, afi, safi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7281 | |
| 7282 | vty_out (vty, " Connections established %d; dropped %d%s", |
| 7283 | p->established, p->dropped, |
| 7284 | VTY_NEWLINE); |
| 7285 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7286 | if (! p->dropped) |
| 7287 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); |
| 7288 | else |
| 7289 | vty_out (vty, " Last reset %s, due to %s%s", |
| 7290 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), |
| 7291 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 7292 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7293 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7294 | { |
| 7295 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7296 | |
| 7297 | if (p->t_pmax_restart) |
| 7298 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", |
| 7299 | p->host, thread_timer_remain_second (p->t_pmax_restart), |
| 7300 | VTY_NEWLINE); |
| 7301 | else |
| 7302 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", |
| 7303 | p->host, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7304 | } |
| 7305 | |
| 7306 | /* EBGP Multihop */ |
| 7307 | if (peer_sort (p) != BGP_PEER_IBGP && p->ttl > 1) |
| 7308 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 7309 | p->ttl, VTY_NEWLINE); |
| 7310 | |
| 7311 | /* Local address. */ |
| 7312 | if (p->su_local) |
| 7313 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7314 | vty_out (vty, "Local host: %s, Local port: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7315 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
| 7316 | ntohs (p->su_local->sin.sin_port), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7317 | VTY_NEWLINE); |
| 7318 | } |
| 7319 | |
| 7320 | /* Remote address. */ |
| 7321 | if (p->su_remote) |
| 7322 | { |
| 7323 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", |
| 7324 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
| 7325 | ntohs (p->su_remote->sin.sin_port), |
| 7326 | VTY_NEWLINE); |
| 7327 | } |
| 7328 | |
| 7329 | /* Nexthop display. */ |
| 7330 | if (p->su_local) |
| 7331 | { |
| 7332 | vty_out (vty, "Nexthop: %s%s", |
| 7333 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), |
| 7334 | VTY_NEWLINE); |
| 7335 | #ifdef HAVE_IPV6 |
| 7336 | vty_out (vty, "Nexthop global: %s%s", |
| 7337 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), |
| 7338 | VTY_NEWLINE); |
| 7339 | vty_out (vty, "Nexthop local: %s%s", |
| 7340 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), |
| 7341 | VTY_NEWLINE); |
| 7342 | vty_out (vty, "BGP connection: %s%s", |
| 7343 | p->shared_network ? "shared network" : "non shared network", |
| 7344 | VTY_NEWLINE); |
| 7345 | #endif /* HAVE_IPV6 */ |
| 7346 | } |
| 7347 | |
| 7348 | /* Timer information. */ |
| 7349 | if (p->t_start) |
| 7350 | vty_out (vty, "Next start timer due in %ld seconds%s", |
| 7351 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); |
| 7352 | if (p->t_connect) |
| 7353 | vty_out (vty, "Next connect timer due in %ld seconds%s", |
| 7354 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); |
| 7355 | |
| 7356 | vty_out (vty, "Read thread: %s Write thread: %s%s", |
| 7357 | p->t_read ? "on" : "off", |
| 7358 | p->t_write ? "on" : "off", |
| 7359 | VTY_NEWLINE); |
| 7360 | |
| 7361 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR |
| 7362 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) |
| 7363 | bgp_capability_vty_out (vty, p); |
| 7364 | |
| 7365 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7366 | } |
| 7367 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7368 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7369 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
| 7370 | enum show_type type, union sockunion *su) |
| 7371 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7372 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7373 | struct peer *peer; |
| 7374 | int find = 0; |
| 7375 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7376 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7377 | { |
| 7378 | switch (type) |
| 7379 | { |
| 7380 | case show_all: |
| 7381 | bgp_show_peer (vty, peer); |
| 7382 | break; |
| 7383 | case show_peer: |
| 7384 | if (sockunion_same (&peer->su, su)) |
| 7385 | { |
| 7386 | find = 1; |
| 7387 | bgp_show_peer (vty, peer); |
| 7388 | } |
| 7389 | break; |
| 7390 | } |
| 7391 | } |
| 7392 | |
| 7393 | if (type == show_peer && ! find) |
| 7394 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); |
| 7395 | |
| 7396 | return CMD_SUCCESS; |
| 7397 | } |
| 7398 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7399 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7400 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
| 7401 | enum show_type type, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7402 | { |
| 7403 | int ret; |
| 7404 | struct bgp *bgp; |
| 7405 | union sockunion su; |
| 7406 | |
| 7407 | if (ip_str) |
| 7408 | { |
| 7409 | ret = str2sockunion (ip_str, &su); |
| 7410 | if (ret < 0) |
| 7411 | { |
| 7412 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 7413 | return CMD_WARNING; |
| 7414 | } |
| 7415 | } |
| 7416 | |
| 7417 | if (name) |
| 7418 | { |
| 7419 | bgp = bgp_lookup_by_name (name); |
| 7420 | |
| 7421 | if (! bgp) |
| 7422 | { |
| 7423 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7424 | return CMD_WARNING; |
| 7425 | } |
| 7426 | |
| 7427 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7428 | |
| 7429 | return CMD_SUCCESS; |
| 7430 | } |
| 7431 | |
| 7432 | bgp = bgp_get_default (); |
| 7433 | |
| 7434 | if (bgp) |
| 7435 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7436 | |
| 7437 | return CMD_SUCCESS; |
| 7438 | } |
| 7439 | |
| 7440 | /* "show ip bgp neighbors" commands. */ |
| 7441 | DEFUN (show_ip_bgp_neighbors, |
| 7442 | show_ip_bgp_neighbors_cmd, |
| 7443 | "show ip bgp neighbors", |
| 7444 | SHOW_STR |
| 7445 | IP_STR |
| 7446 | BGP_STR |
| 7447 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7448 | { |
| 7449 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); |
| 7450 | } |
| 7451 | |
| 7452 | ALIAS (show_ip_bgp_neighbors, |
| 7453 | show_ip_bgp_ipv4_neighbors_cmd, |
| 7454 | "show ip bgp ipv4 (unicast|multicast) neighbors", |
| 7455 | SHOW_STR |
| 7456 | IP_STR |
| 7457 | BGP_STR |
| 7458 | "Address family\n" |
| 7459 | "Address Family modifier\n" |
| 7460 | "Address Family modifier\n" |
| 7461 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7462 | |
| 7463 | ALIAS (show_ip_bgp_neighbors, |
| 7464 | show_ip_bgp_vpnv4_all_neighbors_cmd, |
| 7465 | "show ip bgp vpnv4 all neighbors", |
| 7466 | SHOW_STR |
| 7467 | IP_STR |
| 7468 | BGP_STR |
| 7469 | "Display VPNv4 NLRI specific information\n" |
| 7470 | "Display information about all VPNv4 NLRIs\n" |
| 7471 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7472 | |
| 7473 | ALIAS (show_ip_bgp_neighbors, |
| 7474 | show_ip_bgp_vpnv4_rd_neighbors_cmd, |
| 7475 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", |
| 7476 | SHOW_STR |
| 7477 | IP_STR |
| 7478 | BGP_STR |
| 7479 | "Display VPNv4 NLRI specific information\n" |
| 7480 | "Display information for a route distinguisher\n" |
| 7481 | "VPN Route Distinguisher\n" |
| 7482 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7483 | |
| 7484 | ALIAS (show_ip_bgp_neighbors, |
| 7485 | show_bgp_neighbors_cmd, |
| 7486 | "show bgp neighbors", |
| 7487 | SHOW_STR |
| 7488 | BGP_STR |
| 7489 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7490 | |
| 7491 | ALIAS (show_ip_bgp_neighbors, |
| 7492 | show_bgp_ipv6_neighbors_cmd, |
| 7493 | "show bgp ipv6 neighbors", |
| 7494 | SHOW_STR |
| 7495 | BGP_STR |
| 7496 | "Address family\n" |
| 7497 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7498 | |
| 7499 | DEFUN (show_ip_bgp_neighbors_peer, |
| 7500 | show_ip_bgp_neighbors_peer_cmd, |
| 7501 | "show ip bgp neighbors (A.B.C.D|X:X::X:X)", |
| 7502 | SHOW_STR |
| 7503 | IP_STR |
| 7504 | BGP_STR |
| 7505 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7506 | "Neighbor to display information about\n" |
| 7507 | "Neighbor to display information about\n") |
| 7508 | { |
| 7509 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); |
| 7510 | } |
| 7511 | |
| 7512 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7513 | show_ip_bgp_ipv4_neighbors_peer_cmd, |
| 7514 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)", |
| 7515 | SHOW_STR |
| 7516 | IP_STR |
| 7517 | BGP_STR |
| 7518 | "Address family\n" |
| 7519 | "Address Family modifier\n" |
| 7520 | "Address Family modifier\n" |
| 7521 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7522 | "Neighbor to display information about\n" |
| 7523 | "Neighbor to display information about\n") |
| 7524 | |
| 7525 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7526 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, |
| 7527 | "show ip bgp vpnv4 all neighbors A.B.C.D", |
| 7528 | SHOW_STR |
| 7529 | IP_STR |
| 7530 | BGP_STR |
| 7531 | "Display VPNv4 NLRI specific information\n" |
| 7532 | "Display information about all VPNv4 NLRIs\n" |
| 7533 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7534 | "Neighbor to display information about\n") |
| 7535 | |
| 7536 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7537 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, |
| 7538 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", |
| 7539 | SHOW_STR |
| 7540 | IP_STR |
| 7541 | BGP_STR |
| 7542 | "Display VPNv4 NLRI specific information\n" |
| 7543 | "Display information about all VPNv4 NLRIs\n" |
| 7544 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7545 | "Neighbor to display information about\n") |
| 7546 | |
| 7547 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7548 | show_bgp_neighbors_peer_cmd, |
| 7549 | "show bgp neighbors (A.B.C.D|X:X::X:X)", |
| 7550 | SHOW_STR |
| 7551 | BGP_STR |
| 7552 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7553 | "Neighbor to display information about\n" |
| 7554 | "Neighbor to display information about\n") |
| 7555 | |
| 7556 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7557 | show_bgp_ipv6_neighbors_peer_cmd, |
| 7558 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 7559 | SHOW_STR |
| 7560 | BGP_STR |
| 7561 | "Address family\n" |
| 7562 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7563 | "Neighbor to display information about\n" |
| 7564 | "Neighbor to display information about\n") |
| 7565 | |
| 7566 | DEFUN (show_ip_bgp_instance_neighbors, |
| 7567 | show_ip_bgp_instance_neighbors_cmd, |
| 7568 | "show ip bgp view WORD neighbors", |
| 7569 | SHOW_STR |
| 7570 | IP_STR |
| 7571 | BGP_STR |
| 7572 | "BGP view\n" |
| 7573 | "View name\n" |
| 7574 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7575 | { |
| 7576 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); |
| 7577 | } |
| 7578 | |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 7579 | ALIAS (show_ip_bgp_instance_neighbors, |
| 7580 | show_bgp_instance_neighbors_cmd, |
| 7581 | "show bgp view WORD neighbors", |
| 7582 | SHOW_STR |
| 7583 | BGP_STR |
| 7584 | "BGP view\n" |
| 7585 | "View name\n" |
| 7586 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7587 | |
| 7588 | ALIAS (show_ip_bgp_instance_neighbors, |
| 7589 | show_bgp_instance_ipv6_neighbors_cmd, |
| 7590 | "show bgp view WORD ipv6 neighbors", |
| 7591 | SHOW_STR |
| 7592 | BGP_STR |
| 7593 | "BGP view\n" |
| 7594 | "View name\n" |
| 7595 | "Address family\n" |
| 7596 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7597 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7598 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
| 7599 | show_ip_bgp_instance_neighbors_peer_cmd, |
| 7600 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 7601 | SHOW_STR |
| 7602 | IP_STR |
| 7603 | BGP_STR |
| 7604 | "BGP view\n" |
| 7605 | "View name\n" |
| 7606 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7607 | "Neighbor to display information about\n" |
| 7608 | "Neighbor to display information about\n") |
| 7609 | { |
| 7610 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); |
| 7611 | } |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 7612 | |
| 7613 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 7614 | show_bgp_instance_neighbors_peer_cmd, |
| 7615 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 7616 | SHOW_STR |
| 7617 | BGP_STR |
| 7618 | "BGP view\n" |
| 7619 | "View name\n" |
| 7620 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7621 | "Neighbor to display information about\n" |
| 7622 | "Neighbor to display information about\n") |
| 7623 | |
| 7624 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 7625 | show_bgp_instance_ipv6_neighbors_peer_cmd, |
| 7626 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 7627 | SHOW_STR |
| 7628 | BGP_STR |
| 7629 | "BGP view\n" |
| 7630 | "View name\n" |
| 7631 | "Address family\n" |
| 7632 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7633 | "Neighbor to display information about\n" |
| 7634 | "Neighbor to display information about\n") |
| 7635 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7636 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
| 7637 | paths' and `show ip mbgp paths'. Those functions results are the |
| 7638 | same.*/ |
| 7639 | DEFUN (show_ip_bgp_paths, |
| 7640 | show_ip_bgp_paths_cmd, |
| 7641 | "show ip bgp paths", |
| 7642 | SHOW_STR |
| 7643 | IP_STR |
| 7644 | BGP_STR |
| 7645 | "Path information\n") |
| 7646 | { |
| 7647 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); |
| 7648 | aspath_print_all_vty (vty); |
| 7649 | return CMD_SUCCESS; |
| 7650 | } |
| 7651 | |
| 7652 | DEFUN (show_ip_bgp_ipv4_paths, |
| 7653 | show_ip_bgp_ipv4_paths_cmd, |
| 7654 | "show ip bgp ipv4 (unicast|multicast) paths", |
| 7655 | SHOW_STR |
| 7656 | IP_STR |
| 7657 | BGP_STR |
| 7658 | "Address family\n" |
| 7659 | "Address Family modifier\n" |
| 7660 | "Address Family modifier\n" |
| 7661 | "Path information\n") |
| 7662 | { |
| 7663 | vty_out (vty, "Address Refcnt Path\r\n"); |
| 7664 | aspath_print_all_vty (vty); |
| 7665 | |
| 7666 | return CMD_SUCCESS; |
| 7667 | } |
| 7668 | |
| 7669 | #include "hash.h" |
| 7670 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7671 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7672 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
| 7673 | { |
| 7674 | struct community *com; |
| 7675 | |
| 7676 | com = (struct community *) backet->data; |
| 7677 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, |
| 7678 | community_str (com), VTY_NEWLINE); |
| 7679 | } |
| 7680 | |
| 7681 | /* Show BGP's community internal data. */ |
| 7682 | DEFUN (show_ip_bgp_community_info, |
| 7683 | show_ip_bgp_community_info_cmd, |
| 7684 | "show ip bgp community-info", |
| 7685 | SHOW_STR |
| 7686 | IP_STR |
| 7687 | BGP_STR |
| 7688 | "List all bgp community information\n") |
| 7689 | { |
| 7690 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); |
| 7691 | |
| 7692 | hash_iterate (community_hash (), |
| 7693 | (void (*) (struct hash_backet *, void *)) |
| 7694 | community_show_all_iterator, |
| 7695 | vty); |
| 7696 | |
| 7697 | return CMD_SUCCESS; |
| 7698 | } |
| 7699 | |
| 7700 | DEFUN (show_ip_bgp_attr_info, |
| 7701 | show_ip_bgp_attr_info_cmd, |
| 7702 | "show ip bgp attribute-info", |
| 7703 | SHOW_STR |
| 7704 | IP_STR |
| 7705 | BGP_STR |
| 7706 | "List all bgp attribute information\n") |
| 7707 | { |
| 7708 | attr_show_all (vty); |
| 7709 | return CMD_SUCCESS; |
| 7710 | } |
| 7711 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7712 | static int |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7713 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
| 7714 | afi_t afi, safi_t safi) |
| 7715 | { |
| 7716 | char timebuf[BGP_UPTIME_LEN]; |
| 7717 | char rmbuf[14]; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7718 | const char *rmname; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7719 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7720 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7721 | int len; |
| 7722 | int count = 0; |
| 7723 | |
| 7724 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) |
| 7725 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7726 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7727 | { |
| 7728 | count++; |
| 7729 | bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 7730 | } |
| 7731 | return count; |
| 7732 | } |
| 7733 | |
| 7734 | len = vty_out (vty, "%s", rsclient->host); |
| 7735 | len = 16 - len; |
| 7736 | |
| 7737 | if (len < 1) |
| 7738 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 7739 | else |
| 7740 | vty_out (vty, "%*s", len, " "); |
| 7741 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 7742 | vty_out (vty, "4 "); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7743 | |
| 7744 | vty_out (vty, "%5d ", rsclient->as); |
| 7745 | |
| 7746 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); |
| 7747 | if ( rmname && strlen (rmname) > 13 ) |
| 7748 | { |
| 7749 | sprintf (rmbuf, "%13s", "..."); |
| 7750 | rmname = strncpy (rmbuf, rmname, 10); |
| 7751 | } |
| 7752 | else if (! rmname) |
| 7753 | rmname = "<none>"; |
| 7754 | vty_out (vty, " %13s ", rmname); |
| 7755 | |
| 7756 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); |
| 7757 | if ( rmname && strlen (rmname) > 13 ) |
| 7758 | { |
| 7759 | sprintf (rmbuf, "%13s", "..."); |
| 7760 | rmname = strncpy (rmbuf, rmname, 10); |
| 7761 | } |
| 7762 | else if (! rmname) |
| 7763 | rmname = "<none>"; |
| 7764 | vty_out (vty, " %13s ", rmname); |
| 7765 | |
| 7766 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); |
| 7767 | |
| 7768 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) |
| 7769 | vty_out (vty, " Idle (Admin)"); |
| 7770 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7771 | vty_out (vty, " Idle (PfxCt)"); |
| 7772 | else |
| 7773 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); |
| 7774 | |
| 7775 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7776 | |
| 7777 | return 1; |
| 7778 | } |
| 7779 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7780 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7781 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
| 7782 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7783 | { |
| 7784 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7785 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7786 | int count = 0; |
| 7787 | |
| 7788 | /* Header string for each address family. */ |
| 7789 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; |
| 7790 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7791 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7792 | { |
| 7793 | if (peer->afc[afi][safi] && |
| 7794 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 7795 | { |
| 7796 | if (! count) |
| 7797 | { |
| 7798 | vty_out (vty, |
| 7799 | "Route Server's BGP router identifier %s%s", |
| 7800 | inet_ntoa (bgp->router_id), VTY_NEWLINE); |
| 7801 | vty_out (vty, |
| 7802 | "Route Server's local AS number %d%s", bgp->as, |
| 7803 | VTY_NEWLINE); |
| 7804 | |
| 7805 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7806 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 7807 | } |
| 7808 | |
| 7809 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 7810 | } |
| 7811 | } |
| 7812 | |
| 7813 | if (count) |
| 7814 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, |
| 7815 | count, VTY_NEWLINE); |
| 7816 | else |
| 7817 | vty_out (vty, "No %s Route Server Client is configured%s", |
| 7818 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 7819 | |
| 7820 | return CMD_SUCCESS; |
| 7821 | } |
| 7822 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7823 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7824 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
| 7825 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7826 | { |
| 7827 | struct bgp *bgp; |
| 7828 | |
| 7829 | if (name) |
| 7830 | { |
| 7831 | bgp = bgp_lookup_by_name (name); |
| 7832 | |
| 7833 | if (! bgp) |
| 7834 | { |
| 7835 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7836 | return CMD_WARNING; |
| 7837 | } |
| 7838 | |
| 7839 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 7840 | return CMD_SUCCESS; |
| 7841 | } |
| 7842 | |
| 7843 | bgp = bgp_get_default (); |
| 7844 | |
| 7845 | if (bgp) |
| 7846 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 7847 | |
| 7848 | return CMD_SUCCESS; |
| 7849 | } |
| 7850 | |
| 7851 | /* 'show bgp rsclient' commands. */ |
| 7852 | DEFUN (show_ip_bgp_rsclient_summary, |
| 7853 | show_ip_bgp_rsclient_summary_cmd, |
| 7854 | "show ip bgp rsclient summary", |
| 7855 | SHOW_STR |
| 7856 | IP_STR |
| 7857 | BGP_STR |
| 7858 | "Information about Route Server Clients\n" |
| 7859 | "Summary of all Route Server Clients\n") |
| 7860 | { |
| 7861 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 7862 | } |
| 7863 | |
| 7864 | DEFUN (show_ip_bgp_instance_rsclient_summary, |
| 7865 | show_ip_bgp_instance_rsclient_summary_cmd, |
| 7866 | "show ip bgp view WORD rsclient summary", |
| 7867 | SHOW_STR |
| 7868 | IP_STR |
| 7869 | BGP_STR |
| 7870 | "BGP view\n" |
| 7871 | "View name\n" |
| 7872 | "Information about Route Server Clients\n" |
| 7873 | "Summary of all Route Server Clients\n") |
| 7874 | { |
| 7875 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 7876 | } |
| 7877 | |
| 7878 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, |
| 7879 | show_ip_bgp_ipv4_rsclient_summary_cmd, |
| 7880 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", |
| 7881 | SHOW_STR |
| 7882 | IP_STR |
| 7883 | BGP_STR |
| 7884 | "Address family\n" |
| 7885 | "Address Family modifier\n" |
| 7886 | "Address Family modifier\n" |
| 7887 | "Information about Route Server Clients\n" |
| 7888 | "Summary of all Route Server Clients\n") |
| 7889 | { |
| 7890 | if (strncmp (argv[0], "m", 1) == 0) |
| 7891 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 7892 | |
| 7893 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 7894 | } |
| 7895 | |
| 7896 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, |
| 7897 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, |
| 7898 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 7899 | SHOW_STR |
| 7900 | IP_STR |
| 7901 | BGP_STR |
| 7902 | "BGP view\n" |
| 7903 | "View name\n" |
| 7904 | "Address family\n" |
| 7905 | "Address Family modifier\n" |
| 7906 | "Address Family modifier\n" |
| 7907 | "Information about Route Server Clients\n" |
| 7908 | "Summary of all Route Server Clients\n") |
| 7909 | { |
| 7910 | if (strncmp (argv[1], "m", 1) == 0) |
| 7911 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 7912 | |
| 7913 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 7914 | } |
| 7915 | |
| 7916 | #ifdef HAVE_IPV6 |
| 7917 | DEFUN (show_bgp_rsclient_summary, |
| 7918 | show_bgp_rsclient_summary_cmd, |
| 7919 | "show bgp rsclient summary", |
| 7920 | SHOW_STR |
| 7921 | BGP_STR |
| 7922 | "Information about Route Server Clients\n" |
| 7923 | "Summary of all Route Server Clients\n") |
| 7924 | { |
| 7925 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7926 | } |
| 7927 | |
| 7928 | DEFUN (show_bgp_instance_rsclient_summary, |
| 7929 | show_bgp_instance_rsclient_summary_cmd, |
| 7930 | "show bgp view WORD rsclient summary", |
| 7931 | SHOW_STR |
| 7932 | BGP_STR |
| 7933 | "BGP view\n" |
| 7934 | "View name\n" |
| 7935 | "Information about Route Server Clients\n" |
| 7936 | "Summary of all Route Server Clients\n") |
| 7937 | { |
| 7938 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 7939 | } |
| 7940 | |
| 7941 | ALIAS (show_bgp_rsclient_summary, |
| 7942 | show_bgp_ipv6_rsclient_summary_cmd, |
| 7943 | "show bgp ipv6 rsclient summary", |
| 7944 | SHOW_STR |
| 7945 | BGP_STR |
| 7946 | "Address family\n" |
| 7947 | "Information about Route Server Clients\n" |
| 7948 | "Summary of all Route Server Clients\n") |
| 7949 | |
| 7950 | ALIAS (show_bgp_instance_rsclient_summary, |
| 7951 | show_bgp_instance_ipv6_rsclient_summary_cmd, |
| 7952 | "show bgp view WORD ipv6 rsclient summary", |
| 7953 | SHOW_STR |
| 7954 | BGP_STR |
| 7955 | "BGP view\n" |
| 7956 | "View name\n" |
| 7957 | "Address family\n" |
| 7958 | "Information about Route Server Clients\n" |
| 7959 | "Summary of all Route Server Clients\n") |
| 7960 | #endif /* HAVE IPV6 */ |
| 7961 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7962 | /* Redistribute VTY commands. */ |
| 7963 | |
| 7964 | /* Utility function to convert user input route type string to route |
| 7965 | type. */ |
| 7966 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7967 | bgp_str2route_type (int afi, const char *str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7968 | { |
| 7969 | if (! str) |
| 7970 | return 0; |
| 7971 | |
| 7972 | if (afi == AFI_IP) |
| 7973 | { |
| 7974 | if (strncmp (str, "k", 1) == 0) |
| 7975 | return ZEBRA_ROUTE_KERNEL; |
| 7976 | else if (strncmp (str, "c", 1) == 0) |
| 7977 | return ZEBRA_ROUTE_CONNECT; |
| 7978 | else if (strncmp (str, "s", 1) == 0) |
| 7979 | return ZEBRA_ROUTE_STATIC; |
| 7980 | else if (strncmp (str, "r", 1) == 0) |
| 7981 | return ZEBRA_ROUTE_RIP; |
| 7982 | else if (strncmp (str, "o", 1) == 0) |
| 7983 | return ZEBRA_ROUTE_OSPF; |
| 7984 | } |
| 7985 | if (afi == AFI_IP6) |
| 7986 | { |
| 7987 | if (strncmp (str, "k", 1) == 0) |
| 7988 | return ZEBRA_ROUTE_KERNEL; |
| 7989 | else if (strncmp (str, "c", 1) == 0) |
| 7990 | return ZEBRA_ROUTE_CONNECT; |
| 7991 | else if (strncmp (str, "s", 1) == 0) |
| 7992 | return ZEBRA_ROUTE_STATIC; |
| 7993 | else if (strncmp (str, "r", 1) == 0) |
| 7994 | return ZEBRA_ROUTE_RIPNG; |
| 7995 | else if (strncmp (str, "o", 1) == 0) |
| 7996 | return ZEBRA_ROUTE_OSPF6; |
| 7997 | } |
| 7998 | return 0; |
| 7999 | } |
| 8000 | |
| 8001 | DEFUN (bgp_redistribute_ipv4, |
| 8002 | bgp_redistribute_ipv4_cmd, |
| 8003 | "redistribute (connected|kernel|ospf|rip|static)", |
| 8004 | "Redistribute information from another routing protocol\n" |
| 8005 | "Connected\n" |
| 8006 | "Kernel routes\n" |
| 8007 | "Open Shurtest Path First (OSPF)\n" |
| 8008 | "Routing Information Protocol (RIP)\n" |
| 8009 | "Static routes\n") |
| 8010 | { |
| 8011 | int type; |
| 8012 | |
| 8013 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8014 | if (! type) |
| 8015 | { |
| 8016 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8017 | return CMD_WARNING; |
| 8018 | } |
| 8019 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8020 | } |
| 8021 | |
| 8022 | DEFUN (bgp_redistribute_ipv4_rmap, |
| 8023 | bgp_redistribute_ipv4_rmap_cmd, |
| 8024 | "redistribute (connected|kernel|ospf|rip|static) route-map WORD", |
| 8025 | "Redistribute information from another routing protocol\n" |
| 8026 | "Connected\n" |
| 8027 | "Kernel routes\n" |
| 8028 | "Open Shurtest Path First (OSPF)\n" |
| 8029 | "Routing Information Protocol (RIP)\n" |
| 8030 | "Static routes\n" |
| 8031 | "Route map reference\n" |
| 8032 | "Pointer to route-map entries\n") |
| 8033 | { |
| 8034 | int type; |
| 8035 | |
| 8036 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8037 | if (! type) |
| 8038 | { |
| 8039 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8040 | return CMD_WARNING; |
| 8041 | } |
| 8042 | |
| 8043 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8044 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8045 | } |
| 8046 | |
| 8047 | DEFUN (bgp_redistribute_ipv4_metric, |
| 8048 | bgp_redistribute_ipv4_metric_cmd, |
| 8049 | "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", |
| 8050 | "Redistribute information from another routing protocol\n" |
| 8051 | "Connected\n" |
| 8052 | "Kernel routes\n" |
| 8053 | "Open Shurtest Path First (OSPF)\n" |
| 8054 | "Routing Information Protocol (RIP)\n" |
| 8055 | "Static routes\n" |
| 8056 | "Metric for redistributed routes\n" |
| 8057 | "Default metric\n") |
| 8058 | { |
| 8059 | int type; |
| 8060 | u_int32_t metric; |
| 8061 | |
| 8062 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8063 | if (! type) |
| 8064 | { |
| 8065 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8066 | return CMD_WARNING; |
| 8067 | } |
| 8068 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8069 | |
| 8070 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8071 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8072 | } |
| 8073 | |
| 8074 | DEFUN (bgp_redistribute_ipv4_rmap_metric, |
| 8075 | bgp_redistribute_ipv4_rmap_metric_cmd, |
| 8076 | "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", |
| 8077 | "Redistribute information from another routing protocol\n" |
| 8078 | "Connected\n" |
| 8079 | "Kernel routes\n" |
| 8080 | "Open Shurtest Path First (OSPF)\n" |
| 8081 | "Routing Information Protocol (RIP)\n" |
| 8082 | "Static routes\n" |
| 8083 | "Route map reference\n" |
| 8084 | "Pointer to route-map entries\n" |
| 8085 | "Metric for redistributed routes\n" |
| 8086 | "Default metric\n") |
| 8087 | { |
| 8088 | int type; |
| 8089 | u_int32_t metric; |
| 8090 | |
| 8091 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8092 | if (! type) |
| 8093 | { |
| 8094 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8095 | return CMD_WARNING; |
| 8096 | } |
| 8097 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8098 | |
| 8099 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8100 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8101 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8102 | } |
| 8103 | |
| 8104 | DEFUN (bgp_redistribute_ipv4_metric_rmap, |
| 8105 | bgp_redistribute_ipv4_metric_rmap_cmd, |
| 8106 | "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", |
| 8107 | "Redistribute information from another routing protocol\n" |
| 8108 | "Connected\n" |
| 8109 | "Kernel routes\n" |
| 8110 | "Open Shurtest Path First (OSPF)\n" |
| 8111 | "Routing Information Protocol (RIP)\n" |
| 8112 | "Static routes\n" |
| 8113 | "Metric for redistributed routes\n" |
| 8114 | "Default metric\n" |
| 8115 | "Route map reference\n" |
| 8116 | "Pointer to route-map entries\n") |
| 8117 | { |
| 8118 | int type; |
| 8119 | u_int32_t metric; |
| 8120 | |
| 8121 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8122 | if (! type) |
| 8123 | { |
| 8124 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8125 | return CMD_WARNING; |
| 8126 | } |
| 8127 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8128 | |
| 8129 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8130 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); |
| 8131 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8132 | } |
| 8133 | |
| 8134 | DEFUN (no_bgp_redistribute_ipv4, |
| 8135 | no_bgp_redistribute_ipv4_cmd, |
| 8136 | "no redistribute (connected|kernel|ospf|rip|static)", |
| 8137 | NO_STR |
| 8138 | "Redistribute information from another routing protocol\n" |
| 8139 | "Connected\n" |
| 8140 | "Kernel routes\n" |
| 8141 | "Open Shurtest Path First (OSPF)\n" |
| 8142 | "Routing Information Protocol (RIP)\n" |
| 8143 | "Static routes\n") |
| 8144 | { |
| 8145 | int type; |
| 8146 | |
| 8147 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8148 | if (! type) |
| 8149 | { |
| 8150 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8151 | return CMD_WARNING; |
| 8152 | } |
| 8153 | |
| 8154 | return bgp_redistribute_unset (vty->index, AFI_IP, type); |
| 8155 | } |
| 8156 | |
| 8157 | DEFUN (no_bgp_redistribute_ipv4_rmap, |
| 8158 | no_bgp_redistribute_ipv4_rmap_cmd, |
| 8159 | "no redistribute (connected|kernel|ospf|rip|static) route-map WORD", |
| 8160 | NO_STR |
| 8161 | "Redistribute information from another routing protocol\n" |
| 8162 | "Connected\n" |
| 8163 | "Kernel routes\n" |
| 8164 | "Open Shurtest Path First (OSPF)\n" |
| 8165 | "Routing Information Protocol (RIP)\n" |
| 8166 | "Static routes\n" |
| 8167 | "Route map reference\n" |
| 8168 | "Pointer to route-map entries\n") |
| 8169 | { |
| 8170 | int type; |
| 8171 | |
| 8172 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8173 | if (! type) |
| 8174 | { |
| 8175 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8176 | return CMD_WARNING; |
| 8177 | } |
| 8178 | |
| 8179 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8180 | return CMD_SUCCESS; |
| 8181 | } |
| 8182 | |
| 8183 | DEFUN (no_bgp_redistribute_ipv4_metric, |
| 8184 | no_bgp_redistribute_ipv4_metric_cmd, |
| 8185 | "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", |
| 8186 | NO_STR |
| 8187 | "Redistribute information from another routing protocol\n" |
| 8188 | "Connected\n" |
| 8189 | "Kernel routes\n" |
| 8190 | "Open Shurtest Path First (OSPF)\n" |
| 8191 | "Routing Information Protocol (RIP)\n" |
| 8192 | "Static routes\n" |
| 8193 | "Metric for redistributed routes\n" |
| 8194 | "Default metric\n") |
| 8195 | { |
| 8196 | int type; |
| 8197 | |
| 8198 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8199 | if (! type) |
| 8200 | { |
| 8201 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8202 | return CMD_WARNING; |
| 8203 | } |
| 8204 | |
| 8205 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8206 | return CMD_SUCCESS; |
| 8207 | } |
| 8208 | |
| 8209 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, |
| 8210 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
| 8211 | "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", |
| 8212 | NO_STR |
| 8213 | "Redistribute information from another routing protocol\n" |
| 8214 | "Connected\n" |
| 8215 | "Kernel routes\n" |
| 8216 | "Open Shurtest Path First (OSPF)\n" |
| 8217 | "Routing Information Protocol (RIP)\n" |
| 8218 | "Static routes\n" |
| 8219 | "Route map reference\n" |
| 8220 | "Pointer to route-map entries\n" |
| 8221 | "Metric for redistributed routes\n" |
| 8222 | "Default metric\n") |
| 8223 | { |
| 8224 | int type; |
| 8225 | |
| 8226 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8227 | if (! type) |
| 8228 | { |
| 8229 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8230 | return CMD_WARNING; |
| 8231 | } |
| 8232 | |
| 8233 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8234 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8235 | return CMD_SUCCESS; |
| 8236 | } |
| 8237 | |
| 8238 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, |
| 8239 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
| 8240 | "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", |
| 8241 | NO_STR |
| 8242 | "Redistribute information from another routing protocol\n" |
| 8243 | "Connected\n" |
| 8244 | "Kernel routes\n" |
| 8245 | "Open Shurtest Path First (OSPF)\n" |
| 8246 | "Routing Information Protocol (RIP)\n" |
| 8247 | "Static routes\n" |
| 8248 | "Metric for redistributed routes\n" |
| 8249 | "Default metric\n" |
| 8250 | "Route map reference\n" |
| 8251 | "Pointer to route-map entries\n") |
| 8252 | |
| 8253 | #ifdef HAVE_IPV6 |
| 8254 | DEFUN (bgp_redistribute_ipv6, |
| 8255 | bgp_redistribute_ipv6_cmd, |
| 8256 | "redistribute (connected|kernel|ospf6|ripng|static)", |
| 8257 | "Redistribute information from another routing protocol\n" |
| 8258 | "Connected\n" |
| 8259 | "Kernel routes\n" |
| 8260 | "Open Shurtest Path First (OSPFv3)\n" |
| 8261 | "Routing Information Protocol (RIPng)\n" |
| 8262 | "Static routes\n") |
| 8263 | { |
| 8264 | int type; |
| 8265 | |
| 8266 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8267 | if (! type) |
| 8268 | { |
| 8269 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8270 | return CMD_WARNING; |
| 8271 | } |
| 8272 | |
| 8273 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8274 | } |
| 8275 | |
| 8276 | DEFUN (bgp_redistribute_ipv6_rmap, |
| 8277 | bgp_redistribute_ipv6_rmap_cmd, |
| 8278 | "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", |
| 8279 | "Redistribute information from another routing protocol\n" |
| 8280 | "Connected\n" |
| 8281 | "Kernel routes\n" |
| 8282 | "Open Shurtest Path First (OSPFv3)\n" |
| 8283 | "Routing Information Protocol (RIPng)\n" |
| 8284 | "Static routes\n" |
| 8285 | "Route map reference\n" |
| 8286 | "Pointer to route-map entries\n") |
| 8287 | { |
| 8288 | int type; |
| 8289 | |
| 8290 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8291 | if (! type) |
| 8292 | { |
| 8293 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8294 | return CMD_WARNING; |
| 8295 | } |
| 8296 | |
| 8297 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8298 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8299 | } |
| 8300 | |
| 8301 | DEFUN (bgp_redistribute_ipv6_metric, |
| 8302 | bgp_redistribute_ipv6_metric_cmd, |
| 8303 | "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", |
| 8304 | "Redistribute information from another routing protocol\n" |
| 8305 | "Connected\n" |
| 8306 | "Kernel routes\n" |
| 8307 | "Open Shurtest Path First (OSPFv3)\n" |
| 8308 | "Routing Information Protocol (RIPng)\n" |
| 8309 | "Static routes\n" |
| 8310 | "Metric for redistributed routes\n" |
| 8311 | "Default metric\n") |
| 8312 | { |
| 8313 | int type; |
| 8314 | u_int32_t metric; |
| 8315 | |
| 8316 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8317 | if (! type) |
| 8318 | { |
| 8319 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8320 | return CMD_WARNING; |
| 8321 | } |
| 8322 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8323 | |
| 8324 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8325 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8326 | } |
| 8327 | |
| 8328 | DEFUN (bgp_redistribute_ipv6_rmap_metric, |
| 8329 | bgp_redistribute_ipv6_rmap_metric_cmd, |
| 8330 | "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", |
| 8331 | "Redistribute information from another routing protocol\n" |
| 8332 | "Connected\n" |
| 8333 | "Kernel routes\n" |
| 8334 | "Open Shurtest Path First (OSPFv3)\n" |
| 8335 | "Routing Information Protocol (RIPng)\n" |
| 8336 | "Static routes\n" |
| 8337 | "Route map reference\n" |
| 8338 | "Pointer to route-map entries\n" |
| 8339 | "Metric for redistributed routes\n" |
| 8340 | "Default metric\n") |
| 8341 | { |
| 8342 | int type; |
| 8343 | u_int32_t metric; |
| 8344 | |
| 8345 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8346 | if (! type) |
| 8347 | { |
| 8348 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8349 | return CMD_WARNING; |
| 8350 | } |
| 8351 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8352 | |
| 8353 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8354 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8355 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8356 | } |
| 8357 | |
| 8358 | DEFUN (bgp_redistribute_ipv6_metric_rmap, |
| 8359 | bgp_redistribute_ipv6_metric_rmap_cmd, |
| 8360 | "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", |
| 8361 | "Redistribute information from another routing protocol\n" |
| 8362 | "Connected\n" |
| 8363 | "Kernel routes\n" |
| 8364 | "Open Shurtest Path First (OSPFv3)\n" |
| 8365 | "Routing Information Protocol (RIPng)\n" |
| 8366 | "Static routes\n" |
| 8367 | "Metric for redistributed routes\n" |
| 8368 | "Default metric\n" |
| 8369 | "Route map reference\n" |
| 8370 | "Pointer to route-map entries\n") |
| 8371 | { |
| 8372 | int type; |
| 8373 | u_int32_t metric; |
| 8374 | |
| 8375 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8376 | if (! type) |
| 8377 | { |
| 8378 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8379 | return CMD_WARNING; |
| 8380 | } |
| 8381 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8382 | |
| 8383 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8384 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); |
| 8385 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8386 | } |
| 8387 | |
| 8388 | DEFUN (no_bgp_redistribute_ipv6, |
| 8389 | no_bgp_redistribute_ipv6_cmd, |
| 8390 | "no redistribute (connected|kernel|ospf6|ripng|static)", |
| 8391 | NO_STR |
| 8392 | "Redistribute information from another routing protocol\n" |
| 8393 | "Connected\n" |
| 8394 | "Kernel routes\n" |
| 8395 | "Open Shurtest Path First (OSPFv3)\n" |
| 8396 | "Routing Information Protocol (RIPng)\n" |
| 8397 | "Static routes\n") |
| 8398 | { |
| 8399 | int type; |
| 8400 | |
| 8401 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8402 | if (! type) |
| 8403 | { |
| 8404 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8405 | return CMD_WARNING; |
| 8406 | } |
| 8407 | |
| 8408 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); |
| 8409 | } |
| 8410 | |
| 8411 | DEFUN (no_bgp_redistribute_ipv6_rmap, |
| 8412 | no_bgp_redistribute_ipv6_rmap_cmd, |
| 8413 | "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", |
| 8414 | NO_STR |
| 8415 | "Redistribute information from another routing protocol\n" |
| 8416 | "Connected\n" |
| 8417 | "Kernel routes\n" |
| 8418 | "Open Shurtest Path First (OSPFv3)\n" |
| 8419 | "Routing Information Protocol (RIPng)\n" |
| 8420 | "Static routes\n" |
| 8421 | "Route map reference\n" |
| 8422 | "Pointer to route-map entries\n") |
| 8423 | { |
| 8424 | int type; |
| 8425 | |
| 8426 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8427 | if (! type) |
| 8428 | { |
| 8429 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8430 | return CMD_WARNING; |
| 8431 | } |
| 8432 | |
| 8433 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8434 | return CMD_SUCCESS; |
| 8435 | } |
| 8436 | |
| 8437 | DEFUN (no_bgp_redistribute_ipv6_metric, |
| 8438 | no_bgp_redistribute_ipv6_metric_cmd, |
| 8439 | "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", |
| 8440 | NO_STR |
| 8441 | "Redistribute information from another routing protocol\n" |
| 8442 | "Connected\n" |
| 8443 | "Kernel routes\n" |
| 8444 | "Open Shurtest Path First (OSPFv3)\n" |
| 8445 | "Routing Information Protocol (RIPng)\n" |
| 8446 | "Static routes\n" |
| 8447 | "Metric for redistributed routes\n" |
| 8448 | "Default metric\n") |
| 8449 | { |
| 8450 | int type; |
| 8451 | |
| 8452 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8453 | if (! type) |
| 8454 | { |
| 8455 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8456 | return CMD_WARNING; |
| 8457 | } |
| 8458 | |
| 8459 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8460 | return CMD_SUCCESS; |
| 8461 | } |
| 8462 | |
| 8463 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, |
| 8464 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
| 8465 | "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", |
| 8466 | NO_STR |
| 8467 | "Redistribute information from another routing protocol\n" |
| 8468 | "Connected\n" |
| 8469 | "Kernel routes\n" |
| 8470 | "Open Shurtest Path First (OSPFv3)\n" |
| 8471 | "Routing Information Protocol (RIPng)\n" |
| 8472 | "Static routes\n" |
| 8473 | "Route map reference\n" |
| 8474 | "Pointer to route-map entries\n" |
| 8475 | "Metric for redistributed routes\n" |
| 8476 | "Default metric\n") |
| 8477 | { |
| 8478 | int type; |
| 8479 | |
| 8480 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8481 | if (! type) |
| 8482 | { |
| 8483 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8484 | return CMD_WARNING; |
| 8485 | } |
| 8486 | |
| 8487 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8488 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8489 | return CMD_SUCCESS; |
| 8490 | } |
| 8491 | |
| 8492 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, |
| 8493 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
| 8494 | "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", |
| 8495 | NO_STR |
| 8496 | "Redistribute information from another routing protocol\n" |
| 8497 | "Connected\n" |
| 8498 | "Kernel routes\n" |
| 8499 | "Open Shurtest Path First (OSPFv3)\n" |
| 8500 | "Routing Information Protocol (RIPng)\n" |
| 8501 | "Static routes\n" |
| 8502 | "Metric for redistributed routes\n" |
| 8503 | "Default metric\n" |
| 8504 | "Route map reference\n" |
| 8505 | "Pointer to route-map entries\n") |
| 8506 | #endif /* HAVE_IPV6 */ |
| 8507 | |
| 8508 | int |
| 8509 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 8510 | safi_t safi, int *write) |
| 8511 | { |
| 8512 | int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8513 | |
| 8514 | /* Unicast redistribution only. */ |
| 8515 | if (safi != SAFI_UNICAST) |
| 8516 | return 0; |
| 8517 | |
| 8518 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 8519 | { |
| 8520 | /* Redistribute BGP does not make sense. */ |
| 8521 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) |
| 8522 | { |
| 8523 | /* Display "address-family" when it is not yet diplayed. */ |
| 8524 | bgp_config_write_family_header (vty, afi, safi, write); |
| 8525 | |
| 8526 | /* "redistribute" configuration. */ |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 8527 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8528 | |
| 8529 | if (bgp->redist_metric_flag[afi][i]) |
| 8530 | vty_out (vty, " metric %d", bgp->redist_metric[afi][i]); |
| 8531 | |
| 8532 | if (bgp->rmap[afi][i].name) |
| 8533 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); |
| 8534 | |
| 8535 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8536 | } |
| 8537 | } |
| 8538 | return *write; |
| 8539 | } |
| 8540 | |
| 8541 | /* BGP node structure. */ |
| 8542 | struct cmd_node bgp_node = |
| 8543 | { |
| 8544 | BGP_NODE, |
| 8545 | "%s(config-router)# ", |
| 8546 | 1, |
| 8547 | }; |
| 8548 | |
| 8549 | struct cmd_node bgp_ipv4_unicast_node = |
| 8550 | { |
| 8551 | BGP_IPV4_NODE, |
| 8552 | "%s(config-router-af)# ", |
| 8553 | 1, |
| 8554 | }; |
| 8555 | |
| 8556 | struct cmd_node bgp_ipv4_multicast_node = |
| 8557 | { |
| 8558 | BGP_IPV4M_NODE, |
| 8559 | "%s(config-router-af)# ", |
| 8560 | 1, |
| 8561 | }; |
| 8562 | |
| 8563 | struct cmd_node bgp_ipv6_unicast_node = |
| 8564 | { |
| 8565 | BGP_IPV6_NODE, |
| 8566 | "%s(config-router-af)# ", |
| 8567 | 1, |
| 8568 | }; |
| 8569 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8570 | struct cmd_node bgp_ipv6_multicast_node = |
| 8571 | { |
| 8572 | BGP_IPV6M_NODE, |
| 8573 | "%s(config-router-af)# ", |
| 8574 | 1, |
| 8575 | }; |
| 8576 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8577 | struct cmd_node bgp_vpnv4_node = |
| 8578 | { |
| 8579 | BGP_VPNV4_NODE, |
| 8580 | "%s(config-router-af)# ", |
| 8581 | 1 |
| 8582 | }; |
| 8583 | |
paul | 1f8ae70 | 2005-09-09 23:49:49 +0000 | [diff] [blame] | 8584 | static void community_list_vty (void); |
| 8585 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8586 | void |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8587 | bgp_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8588 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8589 | /* Install bgp top node. */ |
| 8590 | install_node (&bgp_node, bgp_config_write); |
| 8591 | install_node (&bgp_ipv4_unicast_node, NULL); |
| 8592 | install_node (&bgp_ipv4_multicast_node, NULL); |
| 8593 | install_node (&bgp_ipv6_unicast_node, NULL); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8594 | install_node (&bgp_ipv6_multicast_node, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8595 | install_node (&bgp_vpnv4_node, NULL); |
| 8596 | |
| 8597 | /* Install default VTY commands to new nodes. */ |
| 8598 | install_default (BGP_NODE); |
| 8599 | install_default (BGP_IPV4_NODE); |
| 8600 | install_default (BGP_IPV4M_NODE); |
| 8601 | install_default (BGP_IPV6_NODE); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8602 | install_default (BGP_IPV6M_NODE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8603 | install_default (BGP_VPNV4_NODE); |
| 8604 | |
| 8605 | /* "bgp multiple-instance" commands. */ |
| 8606 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); |
| 8607 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); |
| 8608 | |
| 8609 | /* "bgp config-type" commands. */ |
| 8610 | install_element (CONFIG_NODE, &bgp_config_type_cmd); |
| 8611 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); |
| 8612 | |
| 8613 | /* Dummy commands (Currently not supported) */ |
| 8614 | install_element (BGP_NODE, &no_synchronization_cmd); |
| 8615 | install_element (BGP_NODE, &no_auto_summary_cmd); |
| 8616 | |
| 8617 | /* "router bgp" commands. */ |
| 8618 | install_element (CONFIG_NODE, &router_bgp_cmd); |
| 8619 | install_element (CONFIG_NODE, &router_bgp_view_cmd); |
| 8620 | |
| 8621 | /* "no router bgp" commands. */ |
| 8622 | install_element (CONFIG_NODE, &no_router_bgp_cmd); |
| 8623 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); |
| 8624 | |
| 8625 | /* "bgp router-id" commands. */ |
| 8626 | install_element (BGP_NODE, &bgp_router_id_cmd); |
| 8627 | install_element (BGP_NODE, &no_bgp_router_id_cmd); |
| 8628 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); |
| 8629 | |
| 8630 | /* "bgp cluster-id" commands. */ |
| 8631 | install_element (BGP_NODE, &bgp_cluster_id_cmd); |
| 8632 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); |
| 8633 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); |
| 8634 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); |
| 8635 | |
| 8636 | /* "bgp confederation" commands. */ |
| 8637 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); |
| 8638 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); |
| 8639 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); |
| 8640 | |
| 8641 | /* "bgp confederation peers" commands. */ |
| 8642 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); |
| 8643 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); |
| 8644 | |
| 8645 | /* "timers bgp" commands. */ |
| 8646 | install_element (BGP_NODE, &bgp_timers_cmd); |
| 8647 | install_element (BGP_NODE, &no_bgp_timers_cmd); |
| 8648 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); |
| 8649 | |
| 8650 | /* "bgp client-to-client reflection" commands */ |
| 8651 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); |
| 8652 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); |
| 8653 | |
| 8654 | /* "bgp always-compare-med" commands */ |
| 8655 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); |
| 8656 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); |
| 8657 | |
| 8658 | /* "bgp deterministic-med" commands */ |
| 8659 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); |
| 8660 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 8661 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 8662 | /* "bgp graceful-restart" commands */ |
| 8663 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); |
| 8664 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 8665 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
| 8666 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); |
| 8667 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8668 | |
| 8669 | /* "bgp fast-external-failover" commands */ |
| 8670 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); |
| 8671 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); |
| 8672 | |
| 8673 | /* "bgp enforce-first-as" commands */ |
| 8674 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); |
| 8675 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); |
| 8676 | |
| 8677 | /* "bgp bestpath compare-routerid" commands */ |
| 8678 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); |
| 8679 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); |
| 8680 | |
| 8681 | /* "bgp bestpath as-path ignore" commands */ |
| 8682 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); |
| 8683 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); |
| 8684 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 8685 | /* "bgp bestpath as-path confed" commands */ |
| 8686 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); |
| 8687 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); |
| 8688 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 8689 | /* "bgp log-neighbor-changes" commands */ |
| 8690 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); |
| 8691 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); |
| 8692 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8693 | /* "bgp bestpath med" commands */ |
| 8694 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); |
| 8695 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); |
| 8696 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); |
| 8697 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); |
| 8698 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); |
| 8699 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); |
| 8700 | |
| 8701 | /* "no bgp default ipv4-unicast" commands. */ |
| 8702 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); |
| 8703 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); |
| 8704 | |
| 8705 | /* "bgp network import-check" commands. */ |
| 8706 | install_element (BGP_NODE, &bgp_network_import_check_cmd); |
| 8707 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
| 8708 | |
| 8709 | /* "bgp default local-preference" commands. */ |
| 8710 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); |
| 8711 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); |
| 8712 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); |
| 8713 | |
| 8714 | /* "neighbor remote-as" commands. */ |
| 8715 | install_element (BGP_NODE, &neighbor_remote_as_cmd); |
| 8716 | install_element (BGP_NODE, &no_neighbor_cmd); |
| 8717 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); |
| 8718 | |
| 8719 | /* "neighbor peer-group" commands. */ |
| 8720 | install_element (BGP_NODE, &neighbor_peer_group_cmd); |
| 8721 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); |
| 8722 | install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd); |
| 8723 | |
| 8724 | /* "neighbor local-as" commands. */ |
| 8725 | install_element (BGP_NODE, &neighbor_local_as_cmd); |
| 8726 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); |
| 8727 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
| 8728 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); |
| 8729 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); |
| 8730 | |
| 8731 | /* "neighbor activate" commands. */ |
| 8732 | install_element (BGP_NODE, &neighbor_activate_cmd); |
| 8733 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); |
| 8734 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); |
| 8735 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8736 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8737 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
| 8738 | |
| 8739 | /* "no neighbor activate" commands. */ |
| 8740 | install_element (BGP_NODE, &no_neighbor_activate_cmd); |
| 8741 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); |
| 8742 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); |
| 8743 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8744 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8745 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
| 8746 | |
| 8747 | /* "neighbor peer-group set" commands. */ |
| 8748 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
| 8749 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); |
| 8750 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); |
| 8751 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8752 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 8753 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
| 8754 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8755 | /* "no neighbor peer-group unset" commands. */ |
| 8756 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); |
| 8757 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 8758 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); |
| 8759 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8760 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 8761 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 8762 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8763 | /* "neighbor softreconfiguration inbound" commands.*/ |
| 8764 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8765 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 8766 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8767 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 8768 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8769 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 8770 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8771 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8772 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8773 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 8774 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8775 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8776 | |
| 8777 | /* "neighbor attribute-unchanged" commands. */ |
| 8778 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); |
| 8779 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); |
| 8780 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); |
| 8781 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); |
| 8782 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); |
| 8783 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); |
| 8784 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); |
| 8785 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); |
| 8786 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); |
| 8787 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); |
| 8788 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); |
| 8789 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8790 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8791 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8792 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8793 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8794 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8795 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8796 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8797 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8798 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8799 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 8800 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); |
| 8801 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 8802 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 8803 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 8804 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 8805 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 8806 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 8807 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 8808 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 8809 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 8810 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 8811 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8812 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8813 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8814 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8815 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8816 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8817 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8818 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8819 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8820 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8821 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 8822 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); |
| 8823 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); |
| 8824 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); |
| 8825 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); |
| 8826 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); |
| 8827 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); |
| 8828 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); |
| 8829 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); |
| 8830 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); |
| 8831 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); |
| 8832 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); |
| 8833 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8834 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8835 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8836 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8837 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8838 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8839 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8840 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8841 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8842 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8843 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 8844 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); |
| 8845 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); |
| 8846 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); |
| 8847 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); |
| 8848 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); |
| 8849 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); |
| 8850 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); |
| 8851 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); |
| 8852 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); |
| 8853 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); |
| 8854 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); |
| 8855 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8856 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8857 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8858 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8859 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8860 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8861 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8862 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8863 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8864 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8865 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8866 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
| 8867 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); |
| 8868 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); |
| 8869 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); |
| 8870 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); |
| 8871 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); |
| 8872 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); |
| 8873 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); |
| 8874 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); |
| 8875 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); |
| 8876 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); |
| 8877 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8878 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8879 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8880 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8881 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8882 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8883 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8884 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8885 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8886 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8887 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8888 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
| 8889 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 8890 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 8891 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 8892 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 8893 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 8894 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 8895 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 8896 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 8897 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 8898 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 8899 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8900 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8901 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8902 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8903 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8904 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8905 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8906 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8907 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8908 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8909 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 8910 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8911 | /* "nexthop-local unchanged" commands */ |
| 8912 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); |
| 8913 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); |
| 8914 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8915 | /* "transparent-as" and "transparent-nexthop" for old version |
| 8916 | compatibility. */ |
| 8917 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); |
| 8918 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); |
| 8919 | |
| 8920 | /* "neighbor next-hop-self" commands. */ |
| 8921 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); |
| 8922 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); |
| 8923 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); |
| 8924 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 8925 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); |
| 8926 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); |
| 8927 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); |
| 8928 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8929 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
| 8930 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8931 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
| 8932 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 8933 | |
| 8934 | /* "neighbor remove-private-AS" commands. */ |
| 8935 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); |
| 8936 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); |
| 8937 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
| 8938 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 8939 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
| 8940 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); |
| 8941 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
| 8942 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8943 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
| 8944 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8945 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
| 8946 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 8947 | |
| 8948 | /* "neighbor send-community" commands.*/ |
| 8949 | install_element (BGP_NODE, &neighbor_send_community_cmd); |
| 8950 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); |
| 8951 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); |
| 8952 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); |
| 8953 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); |
| 8954 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); |
| 8955 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); |
| 8956 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); |
| 8957 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); |
| 8958 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); |
| 8959 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); |
| 8960 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); |
| 8961 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); |
| 8962 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); |
| 8963 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); |
| 8964 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8965 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
| 8966 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); |
| 8967 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); |
| 8968 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8969 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
| 8970 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); |
| 8971 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); |
| 8972 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); |
| 8973 | |
| 8974 | /* "neighbor route-reflector" commands.*/ |
| 8975 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); |
| 8976 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8977 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); |
| 8978 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8979 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); |
| 8980 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8981 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); |
| 8982 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8983 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
| 8984 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8985 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
| 8986 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8987 | |
| 8988 | /* "neighbor route-server" commands.*/ |
| 8989 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); |
| 8990 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); |
| 8991 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); |
| 8992 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); |
| 8993 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); |
| 8994 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); |
| 8995 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); |
| 8996 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8997 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
| 8998 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8999 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
| 9000 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9001 | |
| 9002 | /* "neighbor passive" commands. */ |
| 9003 | install_element (BGP_NODE, &neighbor_passive_cmd); |
| 9004 | install_element (BGP_NODE, &no_neighbor_passive_cmd); |
| 9005 | |
| 9006 | /* "neighbor shutdown" commands. */ |
| 9007 | install_element (BGP_NODE, &neighbor_shutdown_cmd); |
| 9008 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); |
| 9009 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 9010 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9011 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
| 9012 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); |
| 9013 | |
| 9014 | /* "neighbor capability orf prefix-list" commands.*/ |
| 9015 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9016 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9017 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9018 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9019 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9020 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9021 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9022 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9023 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9024 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9025 | |
| 9026 | /* "neighbor capability dynamic" commands.*/ |
| 9027 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); |
| 9028 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); |
| 9029 | |
| 9030 | /* "neighbor dont-capability-negotiate" commands. */ |
| 9031 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); |
| 9032 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); |
| 9033 | |
| 9034 | /* "neighbor ebgp-multihop" commands. */ |
| 9035 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); |
| 9036 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); |
| 9037 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); |
| 9038 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); |
| 9039 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 9040 | /* "neighbor disable-connected-check" commands. */ |
| 9041 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); |
| 9042 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9043 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
| 9044 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); |
| 9045 | |
| 9046 | /* "neighbor description" commands. */ |
| 9047 | install_element (BGP_NODE, &neighbor_description_cmd); |
| 9048 | install_element (BGP_NODE, &no_neighbor_description_cmd); |
| 9049 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); |
| 9050 | |
| 9051 | /* "neighbor update-source" commands. "*/ |
| 9052 | install_element (BGP_NODE, &neighbor_update_source_cmd); |
| 9053 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); |
| 9054 | |
| 9055 | /* "neighbor default-originate" commands. */ |
| 9056 | install_element (BGP_NODE, &neighbor_default_originate_cmd); |
| 9057 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); |
| 9058 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); |
| 9059 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9060 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); |
| 9061 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); |
| 9062 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); |
| 9063 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9064 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); |
| 9065 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9066 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); |
| 9067 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9068 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); |
| 9069 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); |
| 9070 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); |
| 9071 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9072 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
| 9073 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9074 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); |
| 9075 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9076 | |
| 9077 | /* "neighbor port" commands. */ |
| 9078 | install_element (BGP_NODE, &neighbor_port_cmd); |
| 9079 | install_element (BGP_NODE, &no_neighbor_port_cmd); |
| 9080 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); |
| 9081 | |
| 9082 | /* "neighbor weight" commands. */ |
| 9083 | install_element (BGP_NODE, &neighbor_weight_cmd); |
| 9084 | install_element (BGP_NODE, &no_neighbor_weight_cmd); |
| 9085 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); |
| 9086 | |
| 9087 | /* "neighbor override-capability" commands. */ |
| 9088 | install_element (BGP_NODE, &neighbor_override_capability_cmd); |
| 9089 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); |
| 9090 | |
| 9091 | /* "neighbor strict-capability-match" commands. */ |
| 9092 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); |
| 9093 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); |
| 9094 | |
| 9095 | /* "neighbor timers" commands. */ |
| 9096 | install_element (BGP_NODE, &neighbor_timers_cmd); |
| 9097 | install_element (BGP_NODE, &no_neighbor_timers_cmd); |
| 9098 | |
| 9099 | /* "neighbor timers connect" commands. */ |
| 9100 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); |
| 9101 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); |
| 9102 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); |
| 9103 | |
| 9104 | /* "neighbor advertisement-interval" commands. */ |
| 9105 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); |
| 9106 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); |
| 9107 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); |
| 9108 | |
| 9109 | /* "neighbor version" commands. */ |
| 9110 | install_element (BGP_NODE, &neighbor_version_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9111 | |
| 9112 | /* "neighbor interface" commands. */ |
| 9113 | install_element (BGP_NODE, &neighbor_interface_cmd); |
| 9114 | install_element (BGP_NODE, &no_neighbor_interface_cmd); |
| 9115 | |
| 9116 | /* "neighbor distribute" commands. */ |
| 9117 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); |
| 9118 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); |
| 9119 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); |
| 9120 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9121 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); |
| 9122 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); |
| 9123 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); |
| 9124 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9125 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
| 9126 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9127 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
| 9128 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9129 | |
| 9130 | /* "neighbor prefix-list" commands. */ |
| 9131 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); |
| 9132 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); |
| 9133 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); |
| 9134 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9135 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); |
| 9136 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); |
| 9137 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); |
| 9138 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9139 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
| 9140 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9141 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
| 9142 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9143 | |
| 9144 | /* "neighbor filter-list" commands. */ |
| 9145 | install_element (BGP_NODE, &neighbor_filter_list_cmd); |
| 9146 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); |
| 9147 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); |
| 9148 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); |
| 9149 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); |
| 9150 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); |
| 9151 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); |
| 9152 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9153 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
| 9154 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9155 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
| 9156 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); |
| 9157 | |
| 9158 | /* "neighbor route-map" commands. */ |
| 9159 | install_element (BGP_NODE, &neighbor_route_map_cmd); |
| 9160 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); |
| 9161 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); |
| 9162 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); |
| 9163 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); |
| 9164 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); |
| 9165 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); |
| 9166 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9167 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
| 9168 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9169 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
| 9170 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); |
| 9171 | |
| 9172 | /* "neighbor unsuppress-map" commands. */ |
| 9173 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); |
| 9174 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9175 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9176 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9177 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); |
| 9178 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9179 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); |
| 9180 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9181 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
| 9182 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9183 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9184 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9185 | |
| 9186 | /* "neighbor maximum-prefix" commands. */ |
| 9187 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9188 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9189 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9190 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9191 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9192 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9193 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9194 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9195 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9196 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9197 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9198 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9199 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9200 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9201 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9202 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9203 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9204 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9205 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9206 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9207 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9208 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9209 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9210 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9211 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9212 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9213 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9214 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9215 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9216 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9217 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9218 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9219 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9220 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9221 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9222 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9223 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9224 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9225 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9226 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9227 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9228 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9229 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9230 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9231 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9232 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9233 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9234 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9235 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9236 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9237 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9238 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9239 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
| 9240 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
| 9241 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); |
| 9242 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
| 9243 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9244 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
| 9245 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9246 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
| 9247 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9248 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9249 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9250 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9251 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9252 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9253 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9254 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9255 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9256 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9257 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9258 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9259 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9260 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9261 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9262 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9263 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9264 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9265 | |
| 9266 | /* "neighbor allowas-in" */ |
| 9267 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); |
| 9268 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); |
| 9269 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); |
| 9270 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
| 9271 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9272 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9273 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
| 9274 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9275 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); |
| 9276 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
| 9277 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); |
| 9278 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9279 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
| 9280 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9281 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9282 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
| 9283 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9284 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9285 | |
| 9286 | /* address-family commands. */ |
| 9287 | install_element (BGP_NODE, &address_family_ipv4_cmd); |
| 9288 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); |
| 9289 | #ifdef HAVE_IPV6 |
| 9290 | install_element (BGP_NODE, &address_family_ipv6_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9291 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9292 | #endif /* HAVE_IPV6 */ |
| 9293 | install_element (BGP_NODE, &address_family_vpnv4_cmd); |
| 9294 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); |
| 9295 | |
| 9296 | /* "exit-address-family" command. */ |
| 9297 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); |
| 9298 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); |
| 9299 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9300 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9301 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
| 9302 | |
| 9303 | /* "clear ip bgp commands" */ |
| 9304 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); |
| 9305 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); |
| 9306 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); |
| 9307 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
| 9308 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
| 9309 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
| 9310 | #ifdef HAVE_IPV6 |
| 9311 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
| 9312 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); |
| 9313 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); |
| 9314 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
| 9315 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
| 9316 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
| 9317 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
| 9318 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
| 9319 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
| 9320 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
| 9321 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
| 9322 | #endif /* HAVE_IPV6 */ |
| 9323 | |
| 9324 | /* "clear ip bgp neighbor soft in" */ |
| 9325 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); |
| 9326 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); |
| 9327 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); |
| 9328 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
| 9329 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); |
| 9330 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
| 9331 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
| 9332 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
| 9333 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); |
| 9334 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
| 9335 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
| 9336 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); |
| 9337 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
| 9338 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
| 9339 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); |
| 9340 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
| 9341 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
| 9342 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); |
| 9343 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); |
| 9344 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); |
| 9345 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
| 9346 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); |
| 9347 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
| 9348 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
| 9349 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
| 9350 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); |
| 9351 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
| 9352 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
| 9353 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); |
| 9354 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
| 9355 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
| 9356 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); |
| 9357 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
| 9358 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
| 9359 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); |
| 9360 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); |
| 9361 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); |
| 9362 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); |
| 9363 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); |
| 9364 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); |
| 9365 | #ifdef HAVE_IPV6 |
| 9366 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
| 9367 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); |
| 9368 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); |
| 9369 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
| 9370 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); |
| 9371 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
| 9372 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
| 9373 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); |
| 9374 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
| 9375 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
| 9376 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); |
| 9377 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
| 9378 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
| 9379 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); |
| 9380 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
| 9381 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
| 9382 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); |
| 9383 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
| 9384 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
| 9385 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); |
| 9386 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
| 9387 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
| 9388 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); |
| 9389 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
| 9390 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
| 9391 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); |
| 9392 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
| 9393 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
| 9394 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); |
| 9395 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
| 9396 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
| 9397 | #endif /* HAVE_IPV6 */ |
| 9398 | |
| 9399 | /* "clear ip bgp neighbor soft out" */ |
| 9400 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); |
| 9401 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); |
| 9402 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); |
| 9403 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
| 9404 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
| 9405 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
| 9406 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
| 9407 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
| 9408 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
| 9409 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
| 9410 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
| 9411 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
| 9412 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); |
| 9413 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); |
| 9414 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
| 9415 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
| 9416 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
| 9417 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
| 9418 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
| 9419 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
| 9420 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
| 9421 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
| 9422 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
| 9423 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); |
| 9424 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); |
| 9425 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); |
| 9426 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); |
| 9427 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); |
| 9428 | #ifdef HAVE_IPV6 |
| 9429 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
| 9430 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); |
| 9431 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); |
| 9432 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
| 9433 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
| 9434 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
| 9435 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
| 9436 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
| 9437 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
| 9438 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
| 9439 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
| 9440 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
| 9441 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
| 9442 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
| 9443 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
| 9444 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
| 9445 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
| 9446 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
| 9447 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
| 9448 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
| 9449 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
| 9450 | #endif /* HAVE_IPV6 */ |
| 9451 | |
| 9452 | /* "clear ip bgp neighbor soft" */ |
| 9453 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); |
| 9454 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); |
| 9455 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); |
| 9456 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
| 9457 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
| 9458 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
| 9459 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
| 9460 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); |
| 9461 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); |
| 9462 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
| 9463 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
| 9464 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
| 9465 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
| 9466 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); |
| 9467 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); |
| 9468 | #ifdef HAVE_IPV6 |
| 9469 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
| 9470 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); |
| 9471 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); |
| 9472 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
| 9473 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
| 9474 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
| 9475 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
| 9476 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
| 9477 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
| 9478 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
| 9479 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
| 9480 | #endif /* HAVE_IPV6 */ |
| 9481 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9482 | /* "clear ip bgp neighbor rsclient" */ |
| 9483 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); |
| 9484 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); |
| 9485 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); |
| 9486 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); |
| 9487 | #ifdef HAVE_IPV6 |
| 9488 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); |
| 9489 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); |
| 9490 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); |
| 9491 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); |
| 9492 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); |
| 9493 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); |
| 9494 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); |
| 9495 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); |
| 9496 | #endif /* HAVE_IPV6 */ |
| 9497 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9498 | /* "show ip bgp summary" commands. */ |
| 9499 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); |
| 9500 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9501 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
| 9502 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
| 9503 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9504 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9505 | #ifdef HAVE_IPV6 |
| 9506 | install_element (VIEW_NODE, &show_bgp_summary_cmd); |
| 9507 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); |
| 9508 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
| 9509 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
| 9510 | #endif /* HAVE_IPV6 */ |
| 9511 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); |
| 9512 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9513 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
| 9514 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
| 9515 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9516 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9517 | #ifdef HAVE_IPV6 |
| 9518 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); |
| 9519 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); |
| 9520 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
| 9521 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
| 9522 | #endif /* HAVE_IPV6 */ |
| 9523 | |
| 9524 | /* "show ip bgp neighbors" commands. */ |
| 9525 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); |
| 9526 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 9527 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 9528 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 9529 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 9530 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 9531 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 9532 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 9533 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 9534 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 9535 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
| 9536 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 9537 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 9538 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 9539 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 9540 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 9541 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 9542 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 9543 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 9544 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 9545 | |
| 9546 | #ifdef HAVE_IPV6 |
| 9547 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); |
| 9548 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 9549 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); |
| 9550 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 9551 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
| 9552 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 9553 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 9554 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9555 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
| 9556 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 9557 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); |
| 9558 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 9559 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
| 9560 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 9561 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 9562 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9563 | |
| 9564 | /* Old commands. */ |
| 9565 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); |
| 9566 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); |
| 9567 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); |
| 9568 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); |
| 9569 | #endif /* HAVE_IPV6 */ |
| 9570 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9571 | /* "show ip bgp rsclient" commands. */ |
| 9572 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 9573 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 9574 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 9575 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
| 9576 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 9577 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 9578 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 9579 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
| 9580 | |
| 9581 | #ifdef HAVE_IPV6 |
| 9582 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); |
| 9583 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 9584 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 9585 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
| 9586 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
| 9587 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 9588 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 9589 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
| 9590 | #endif /* HAVE_IPV6 */ |
| 9591 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9592 | /* "show ip bgp paths" commands. */ |
| 9593 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); |
| 9594 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 9595 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); |
| 9596 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 9597 | |
| 9598 | /* "show ip bgp community" commands. */ |
| 9599 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); |
| 9600 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); |
| 9601 | |
| 9602 | /* "show ip bgp attribute-info" commands. */ |
| 9603 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); |
| 9604 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); |
| 9605 | |
| 9606 | /* "redistribute" commands. */ |
| 9607 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); |
| 9608 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); |
| 9609 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); |
| 9610 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); |
| 9611 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); |
| 9612 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); |
| 9613 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); |
| 9614 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); |
| 9615 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); |
| 9616 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); |
| 9617 | #ifdef HAVE_IPV6 |
| 9618 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); |
| 9619 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); |
| 9620 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); |
| 9621 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); |
| 9622 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); |
| 9623 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); |
| 9624 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); |
| 9625 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); |
| 9626 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); |
| 9627 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); |
| 9628 | #endif /* HAVE_IPV6 */ |
| 9629 | |
| 9630 | /* Community-list. */ |
| 9631 | community_list_vty (); |
| 9632 | } |
| 9633 | |
| 9634 | #include "memory.h" |
| 9635 | #include "bgp_regex.h" |
| 9636 | #include "bgp_clist.h" |
| 9637 | #include "bgp_ecommunity.h" |
| 9638 | |
| 9639 | /* VTY functions. */ |
| 9640 | |
| 9641 | /* Direction value to string conversion. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9642 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9643 | community_direct_str (int direct) |
| 9644 | { |
| 9645 | switch (direct) |
| 9646 | { |
| 9647 | case COMMUNITY_DENY: |
| 9648 | return "deny"; |
| 9649 | break; |
| 9650 | case COMMUNITY_PERMIT: |
| 9651 | return "permit"; |
| 9652 | break; |
| 9653 | default: |
| 9654 | return "unknown"; |
| 9655 | break; |
| 9656 | } |
| 9657 | } |
| 9658 | |
| 9659 | /* Display error string. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9660 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9661 | community_list_perror (struct vty *vty, int ret) |
| 9662 | { |
| 9663 | switch (ret) |
| 9664 | { |
| 9665 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: |
| 9666 | vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE); |
| 9667 | break; |
| 9668 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: |
| 9669 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); |
| 9670 | break; |
| 9671 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: |
| 9672 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); |
| 9673 | break; |
| 9674 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: |
| 9675 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); |
| 9676 | break; |
| 9677 | } |
| 9678 | } |
| 9679 | |
| 9680 | /* VTY interface for community_set() function. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9681 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 9682 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 9683 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9684 | { |
| 9685 | int ret; |
| 9686 | int direct; |
| 9687 | char *str; |
| 9688 | |
| 9689 | /* Check the list type. */ |
| 9690 | if (strncmp (argv[1], "p", 1) == 0) |
| 9691 | direct = COMMUNITY_PERMIT; |
| 9692 | else if (strncmp (argv[1], "d", 1) == 0) |
| 9693 | direct = COMMUNITY_DENY; |
| 9694 | else |
| 9695 | { |
| 9696 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 9697 | VTY_NEWLINE); |
| 9698 | return CMD_WARNING; |
| 9699 | } |
| 9700 | |
| 9701 | /* All digit name check. */ |
| 9702 | if (reject_all_digit_name && all_digit (argv[0])) |
| 9703 | { |
| 9704 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 9705 | return CMD_WARNING; |
| 9706 | } |
| 9707 | |
| 9708 | /* Concat community string argument. */ |
| 9709 | if (argc > 1) |
| 9710 | str = argv_concat (argv, argc, 2); |
| 9711 | else |
| 9712 | str = NULL; |
| 9713 | |
| 9714 | /* When community_list_set() return nevetive value, it means |
| 9715 | malformed community string. */ |
| 9716 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); |
| 9717 | |
| 9718 | /* Free temporary community list string allocated by |
| 9719 | argv_concat(). */ |
| 9720 | if (str) |
| 9721 | XFREE (MTYPE_TMP, str); |
| 9722 | |
| 9723 | if (ret < 0) |
| 9724 | { |
| 9725 | /* Display error string. */ |
| 9726 | community_list_perror (vty, ret); |
| 9727 | return CMD_WARNING; |
| 9728 | } |
| 9729 | |
| 9730 | return CMD_SUCCESS; |
| 9731 | } |
| 9732 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9733 | /* Communiyt-list entry delete. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9734 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9735 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 9736 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9737 | { |
| 9738 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9739 | int direct = 0; |
| 9740 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9741 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9742 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9743 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9744 | /* Check the list direct. */ |
| 9745 | if (strncmp (argv[1], "p", 1) == 0) |
| 9746 | direct = COMMUNITY_PERMIT; |
| 9747 | else if (strncmp (argv[1], "d", 1) == 0) |
| 9748 | direct = COMMUNITY_DENY; |
| 9749 | else |
| 9750 | { |
| 9751 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 9752 | VTY_NEWLINE); |
| 9753 | return CMD_WARNING; |
| 9754 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9755 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9756 | /* Concat community string argument. */ |
| 9757 | str = argv_concat (argv, argc, 2); |
| 9758 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9759 | |
| 9760 | /* Unset community list. */ |
| 9761 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); |
| 9762 | |
| 9763 | /* Free temporary community list string allocated by |
| 9764 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9765 | if (str) |
| 9766 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9767 | |
| 9768 | if (ret < 0) |
| 9769 | { |
| 9770 | community_list_perror (vty, ret); |
| 9771 | return CMD_WARNING; |
| 9772 | } |
| 9773 | |
| 9774 | return CMD_SUCCESS; |
| 9775 | } |
| 9776 | |
| 9777 | /* "community-list" keyword help string. */ |
| 9778 | #define COMMUNITY_LIST_STR "Add a community list entry\n" |
| 9779 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" |
| 9780 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9781 | DEFUN (ip_community_list_standard, |
| 9782 | ip_community_list_standard_cmd, |
| 9783 | "ip community-list <1-99> (deny|permit) .AA:NN", |
| 9784 | IP_STR |
| 9785 | COMMUNITY_LIST_STR |
| 9786 | "Community list number (standard)\n" |
| 9787 | "Specify community to reject\n" |
| 9788 | "Specify community to accept\n" |
| 9789 | COMMUNITY_VAL_STR) |
| 9790 | { |
| 9791 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
| 9792 | } |
| 9793 | |
| 9794 | ALIAS (ip_community_list_standard, |
| 9795 | ip_community_list_standard2_cmd, |
| 9796 | "ip community-list <1-99> (deny|permit)", |
| 9797 | IP_STR |
| 9798 | COMMUNITY_LIST_STR |
| 9799 | "Community list number (standard)\n" |
| 9800 | "Specify community to reject\n" |
| 9801 | "Specify community to accept\n") |
| 9802 | |
| 9803 | DEFUN (ip_community_list_expanded, |
| 9804 | ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9805 | "ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9806 | IP_STR |
| 9807 | COMMUNITY_LIST_STR |
| 9808 | "Community list number (expanded)\n" |
| 9809 | "Specify community to reject\n" |
| 9810 | "Specify community to accept\n" |
| 9811 | "An ordered list as a regular-expression\n") |
| 9812 | { |
| 9813 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
| 9814 | } |
| 9815 | |
| 9816 | DEFUN (ip_community_list_name_standard, |
| 9817 | ip_community_list_name_standard_cmd, |
| 9818 | "ip community-list standard WORD (deny|permit) .AA:NN", |
| 9819 | IP_STR |
| 9820 | COMMUNITY_LIST_STR |
| 9821 | "Add a standard community-list entry\n" |
| 9822 | "Community list name\n" |
| 9823 | "Specify community to reject\n" |
| 9824 | "Specify community to accept\n" |
| 9825 | COMMUNITY_VAL_STR) |
| 9826 | { |
| 9827 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
| 9828 | } |
| 9829 | |
| 9830 | ALIAS (ip_community_list_name_standard, |
| 9831 | ip_community_list_name_standard2_cmd, |
| 9832 | "ip community-list standard WORD (deny|permit)", |
| 9833 | IP_STR |
| 9834 | COMMUNITY_LIST_STR |
| 9835 | "Add a standard community-list entry\n" |
| 9836 | "Community list name\n" |
| 9837 | "Specify community to reject\n" |
| 9838 | "Specify community to accept\n") |
| 9839 | |
| 9840 | DEFUN (ip_community_list_name_expanded, |
| 9841 | ip_community_list_name_expanded_cmd, |
| 9842 | "ip community-list expanded WORD (deny|permit) .LINE", |
| 9843 | IP_STR |
| 9844 | COMMUNITY_LIST_STR |
| 9845 | "Add an expanded community-list entry\n" |
| 9846 | "Community list name\n" |
| 9847 | "Specify community to reject\n" |
| 9848 | "Specify community to accept\n" |
| 9849 | "An ordered list as a regular-expression\n") |
| 9850 | { |
| 9851 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
| 9852 | } |
| 9853 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9854 | DEFUN (no_ip_community_list_standard_all, |
| 9855 | no_ip_community_list_standard_all_cmd, |
| 9856 | "no ip community-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9857 | NO_STR |
| 9858 | IP_STR |
| 9859 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9860 | "Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9861 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9862 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9863 | } |
| 9864 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9865 | DEFUN (no_ip_community_list_expanded_all, |
| 9866 | no_ip_community_list_expanded_all_cmd, |
| 9867 | "no ip community-list <100-500>", |
| 9868 | NO_STR |
| 9869 | IP_STR |
| 9870 | COMMUNITY_LIST_STR |
| 9871 | "Community list number (expanded)\n") |
| 9872 | { |
| 9873 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 9874 | } |
| 9875 | |
| 9876 | DEFUN (no_ip_community_list_name_standard_all, |
| 9877 | no_ip_community_list_name_standard_all_cmd, |
| 9878 | "no ip community-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9879 | NO_STR |
| 9880 | IP_STR |
| 9881 | COMMUNITY_LIST_STR |
| 9882 | "Add a standard community-list entry\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9883 | "Community list name\n") |
| 9884 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9885 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9886 | } |
| 9887 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9888 | DEFUN (no_ip_community_list_name_expanded_all, |
| 9889 | no_ip_community_list_name_expanded_all_cmd, |
| 9890 | "no ip community-list expanded WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9891 | NO_STR |
| 9892 | IP_STR |
| 9893 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9894 | "Add an expanded community-list entry\n" |
| 9895 | "Community list name\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9896 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9897 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9898 | } |
| 9899 | |
| 9900 | DEFUN (no_ip_community_list_standard, |
| 9901 | no_ip_community_list_standard_cmd, |
| 9902 | "no ip community-list <1-99> (deny|permit) .AA:NN", |
| 9903 | NO_STR |
| 9904 | IP_STR |
| 9905 | COMMUNITY_LIST_STR |
| 9906 | "Community list number (standard)\n" |
| 9907 | "Specify community to reject\n" |
| 9908 | "Specify community to accept\n" |
| 9909 | COMMUNITY_VAL_STR) |
| 9910 | { |
| 9911 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 9912 | } |
| 9913 | |
| 9914 | DEFUN (no_ip_community_list_expanded, |
| 9915 | no_ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9916 | "no ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9917 | NO_STR |
| 9918 | IP_STR |
| 9919 | COMMUNITY_LIST_STR |
| 9920 | "Community list number (expanded)\n" |
| 9921 | "Specify community to reject\n" |
| 9922 | "Specify community to accept\n" |
| 9923 | "An ordered list as a regular-expression\n") |
| 9924 | { |
| 9925 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 9926 | } |
| 9927 | |
| 9928 | DEFUN (no_ip_community_list_name_standard, |
| 9929 | no_ip_community_list_name_standard_cmd, |
| 9930 | "no ip community-list standard WORD (deny|permit) .AA:NN", |
| 9931 | NO_STR |
| 9932 | IP_STR |
| 9933 | COMMUNITY_LIST_STR |
| 9934 | "Specify a standard community-list\n" |
| 9935 | "Community list name\n" |
| 9936 | "Specify community to reject\n" |
| 9937 | "Specify community to accept\n" |
| 9938 | COMMUNITY_VAL_STR) |
| 9939 | { |
| 9940 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 9941 | } |
| 9942 | |
| 9943 | DEFUN (no_ip_community_list_name_expanded, |
| 9944 | no_ip_community_list_name_expanded_cmd, |
| 9945 | "no ip community-list expanded WORD (deny|permit) .LINE", |
| 9946 | NO_STR |
| 9947 | IP_STR |
| 9948 | COMMUNITY_LIST_STR |
| 9949 | "Specify an expanded community-list\n" |
| 9950 | "Community list name\n" |
| 9951 | "Specify community to reject\n" |
| 9952 | "Specify community to accept\n" |
| 9953 | "An ordered list as a regular-expression\n") |
| 9954 | { |
| 9955 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 9956 | } |
| 9957 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9958 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9959 | community_list_show (struct vty *vty, struct community_list *list) |
| 9960 | { |
| 9961 | struct community_entry *entry; |
| 9962 | |
| 9963 | for (entry = list->head; entry; entry = entry->next) |
| 9964 | { |
| 9965 | if (entry == list->head) |
| 9966 | { |
| 9967 | if (all_digit (list->name)) |
| 9968 | vty_out (vty, "Community %s list %s%s", |
| 9969 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 9970 | "standard" : "(expanded) access", |
| 9971 | list->name, VTY_NEWLINE); |
| 9972 | else |
| 9973 | vty_out (vty, "Named Community %s list %s%s", |
| 9974 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 9975 | "standard" : "expanded", |
| 9976 | list->name, VTY_NEWLINE); |
| 9977 | } |
| 9978 | if (entry->any) |
| 9979 | vty_out (vty, " %s%s", |
| 9980 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 9981 | else |
| 9982 | vty_out (vty, " %s %s%s", |
| 9983 | community_direct_str (entry->direct), |
| 9984 | entry->style == COMMUNITY_LIST_STANDARD |
| 9985 | ? community_str (entry->u.com) : entry->config, |
| 9986 | VTY_NEWLINE); |
| 9987 | } |
| 9988 | } |
| 9989 | |
| 9990 | DEFUN (show_ip_community_list, |
| 9991 | show_ip_community_list_cmd, |
| 9992 | "show ip community-list", |
| 9993 | SHOW_STR |
| 9994 | IP_STR |
| 9995 | "List community-list\n") |
| 9996 | { |
| 9997 | struct community_list *list; |
| 9998 | struct community_list_master *cm; |
| 9999 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10000 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10001 | if (! cm) |
| 10002 | return CMD_SUCCESS; |
| 10003 | |
| 10004 | for (list = cm->num.head; list; list = list->next) |
| 10005 | community_list_show (vty, list); |
| 10006 | |
| 10007 | for (list = cm->str.head; list; list = list->next) |
| 10008 | community_list_show (vty, list); |
| 10009 | |
| 10010 | return CMD_SUCCESS; |
| 10011 | } |
| 10012 | |
| 10013 | DEFUN (show_ip_community_list_arg, |
| 10014 | show_ip_community_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10015 | "show ip community-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10016 | SHOW_STR |
| 10017 | IP_STR |
| 10018 | "List community-list\n" |
| 10019 | "Community-list number\n" |
| 10020 | "Community-list name\n") |
| 10021 | { |
| 10022 | struct community_list *list; |
| 10023 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10024 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10025 | if (! list) |
| 10026 | { |
| 10027 | vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE); |
| 10028 | return CMD_WARNING; |
| 10029 | } |
| 10030 | |
| 10031 | community_list_show (vty, list); |
| 10032 | |
| 10033 | return CMD_SUCCESS; |
| 10034 | } |
| 10035 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10036 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10037 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10038 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10039 | { |
| 10040 | int ret; |
| 10041 | int direct; |
| 10042 | char *str; |
| 10043 | |
| 10044 | /* Check the list type. */ |
| 10045 | if (strncmp (argv[1], "p", 1) == 0) |
| 10046 | direct = COMMUNITY_PERMIT; |
| 10047 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10048 | direct = COMMUNITY_DENY; |
| 10049 | else |
| 10050 | { |
| 10051 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10052 | VTY_NEWLINE); |
| 10053 | return CMD_WARNING; |
| 10054 | } |
| 10055 | |
| 10056 | /* All digit name check. */ |
| 10057 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10058 | { |
| 10059 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10060 | return CMD_WARNING; |
| 10061 | } |
| 10062 | |
| 10063 | /* Concat community string argument. */ |
| 10064 | if (argc > 1) |
| 10065 | str = argv_concat (argv, argc, 2); |
| 10066 | else |
| 10067 | str = NULL; |
| 10068 | |
| 10069 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); |
| 10070 | |
| 10071 | /* Free temporary community list string allocated by |
| 10072 | argv_concat(). */ |
| 10073 | if (str) |
| 10074 | XFREE (MTYPE_TMP, str); |
| 10075 | |
| 10076 | if (ret < 0) |
| 10077 | { |
| 10078 | community_list_perror (vty, ret); |
| 10079 | return CMD_WARNING; |
| 10080 | } |
| 10081 | return CMD_SUCCESS; |
| 10082 | } |
| 10083 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10084 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10085 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10086 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10087 | { |
| 10088 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10089 | int direct = 0; |
| 10090 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10091 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10092 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10093 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10094 | /* Check the list direct. */ |
| 10095 | if (strncmp (argv[1], "p", 1) == 0) |
| 10096 | direct = COMMUNITY_PERMIT; |
| 10097 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10098 | direct = COMMUNITY_DENY; |
| 10099 | else |
| 10100 | { |
| 10101 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10102 | VTY_NEWLINE); |
| 10103 | return CMD_WARNING; |
| 10104 | } |
| 10105 | |
| 10106 | /* Concat community string argument. */ |
| 10107 | str = argv_concat (argv, argc, 2); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10108 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10109 | |
| 10110 | /* Unset community list. */ |
| 10111 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10112 | |
| 10113 | /* Free temporary community list string allocated by |
| 10114 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10115 | if (str) |
| 10116 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10117 | |
| 10118 | if (ret < 0) |
| 10119 | { |
| 10120 | community_list_perror (vty, ret); |
| 10121 | return CMD_WARNING; |
| 10122 | } |
| 10123 | |
| 10124 | return CMD_SUCCESS; |
| 10125 | } |
| 10126 | |
| 10127 | /* "extcommunity-list" keyword help string. */ |
| 10128 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" |
| 10129 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" |
| 10130 | |
| 10131 | DEFUN (ip_extcommunity_list_standard, |
| 10132 | ip_extcommunity_list_standard_cmd, |
| 10133 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10134 | IP_STR |
| 10135 | EXTCOMMUNITY_LIST_STR |
| 10136 | "Extended Community list number (standard)\n" |
| 10137 | "Specify community to reject\n" |
| 10138 | "Specify community to accept\n" |
| 10139 | EXTCOMMUNITY_VAL_STR) |
| 10140 | { |
| 10141 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
| 10142 | } |
| 10143 | |
| 10144 | ALIAS (ip_extcommunity_list_standard, |
| 10145 | ip_extcommunity_list_standard2_cmd, |
| 10146 | "ip extcommunity-list <1-99> (deny|permit)", |
| 10147 | IP_STR |
| 10148 | EXTCOMMUNITY_LIST_STR |
| 10149 | "Extended Community list number (standard)\n" |
| 10150 | "Specify community to reject\n" |
| 10151 | "Specify community to accept\n") |
| 10152 | |
| 10153 | DEFUN (ip_extcommunity_list_expanded, |
| 10154 | ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10155 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10156 | IP_STR |
| 10157 | EXTCOMMUNITY_LIST_STR |
| 10158 | "Extended Community list number (expanded)\n" |
| 10159 | "Specify community to reject\n" |
| 10160 | "Specify community to accept\n" |
| 10161 | "An ordered list as a regular-expression\n") |
| 10162 | { |
| 10163 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
| 10164 | } |
| 10165 | |
| 10166 | DEFUN (ip_extcommunity_list_name_standard, |
| 10167 | ip_extcommunity_list_name_standard_cmd, |
| 10168 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10169 | IP_STR |
| 10170 | EXTCOMMUNITY_LIST_STR |
| 10171 | "Specify standard extcommunity-list\n" |
| 10172 | "Extended Community list name\n" |
| 10173 | "Specify community to reject\n" |
| 10174 | "Specify community to accept\n" |
| 10175 | EXTCOMMUNITY_VAL_STR) |
| 10176 | { |
| 10177 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
| 10178 | } |
| 10179 | |
| 10180 | ALIAS (ip_extcommunity_list_name_standard, |
| 10181 | ip_extcommunity_list_name_standard2_cmd, |
| 10182 | "ip extcommunity-list standard WORD (deny|permit)", |
| 10183 | IP_STR |
| 10184 | EXTCOMMUNITY_LIST_STR |
| 10185 | "Specify standard extcommunity-list\n" |
| 10186 | "Extended Community list name\n" |
| 10187 | "Specify community to reject\n" |
| 10188 | "Specify community to accept\n") |
| 10189 | |
| 10190 | DEFUN (ip_extcommunity_list_name_expanded, |
| 10191 | ip_extcommunity_list_name_expanded_cmd, |
| 10192 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10193 | IP_STR |
| 10194 | EXTCOMMUNITY_LIST_STR |
| 10195 | "Specify expanded extcommunity-list\n" |
| 10196 | "Extended Community list name\n" |
| 10197 | "Specify community to reject\n" |
| 10198 | "Specify community to accept\n" |
| 10199 | "An ordered list as a regular-expression\n") |
| 10200 | { |
| 10201 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
| 10202 | } |
| 10203 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10204 | DEFUN (no_ip_extcommunity_list_standard_all, |
| 10205 | no_ip_extcommunity_list_standard_all_cmd, |
| 10206 | "no ip extcommunity-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10207 | NO_STR |
| 10208 | IP_STR |
| 10209 | EXTCOMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10210 | "Extended Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10211 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10212 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10213 | } |
| 10214 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10215 | DEFUN (no_ip_extcommunity_list_expanded_all, |
| 10216 | no_ip_extcommunity_list_expanded_all_cmd, |
| 10217 | "no ip extcommunity-list <100-500>", |
| 10218 | NO_STR |
| 10219 | IP_STR |
| 10220 | EXTCOMMUNITY_LIST_STR |
| 10221 | "Extended Community list number (expanded)\n") |
| 10222 | { |
| 10223 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10224 | } |
| 10225 | |
| 10226 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
| 10227 | no_ip_extcommunity_list_name_standard_all_cmd, |
| 10228 | "no ip extcommunity-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10229 | NO_STR |
| 10230 | IP_STR |
| 10231 | EXTCOMMUNITY_LIST_STR |
| 10232 | "Specify standard extcommunity-list\n" |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10233 | "Extended Community list name\n") |
| 10234 | { |
| 10235 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10236 | } |
| 10237 | |
| 10238 | DEFUN (no_ip_extcommunity_list_name_expanded_all, |
| 10239 | no_ip_extcommunity_list_name_expanded_all_cmd, |
| 10240 | "no ip extcommunity-list expanded WORD", |
| 10241 | NO_STR |
| 10242 | IP_STR |
| 10243 | EXTCOMMUNITY_LIST_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10244 | "Specify expanded extcommunity-list\n" |
| 10245 | "Extended Community list name\n") |
| 10246 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10247 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10248 | } |
| 10249 | |
| 10250 | DEFUN (no_ip_extcommunity_list_standard, |
| 10251 | no_ip_extcommunity_list_standard_cmd, |
| 10252 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10253 | NO_STR |
| 10254 | IP_STR |
| 10255 | EXTCOMMUNITY_LIST_STR |
| 10256 | "Extended Community list number (standard)\n" |
| 10257 | "Specify community to reject\n" |
| 10258 | "Specify community to accept\n" |
| 10259 | EXTCOMMUNITY_VAL_STR) |
| 10260 | { |
| 10261 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10262 | } |
| 10263 | |
| 10264 | DEFUN (no_ip_extcommunity_list_expanded, |
| 10265 | no_ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10266 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10267 | NO_STR |
| 10268 | IP_STR |
| 10269 | EXTCOMMUNITY_LIST_STR |
| 10270 | "Extended Community list number (expanded)\n" |
| 10271 | "Specify community to reject\n" |
| 10272 | "Specify community to accept\n" |
| 10273 | "An ordered list as a regular-expression\n") |
| 10274 | { |
| 10275 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10276 | } |
| 10277 | |
| 10278 | DEFUN (no_ip_extcommunity_list_name_standard, |
| 10279 | no_ip_extcommunity_list_name_standard_cmd, |
| 10280 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10281 | NO_STR |
| 10282 | IP_STR |
| 10283 | EXTCOMMUNITY_LIST_STR |
| 10284 | "Specify standard extcommunity-list\n" |
| 10285 | "Extended Community list name\n" |
| 10286 | "Specify community to reject\n" |
| 10287 | "Specify community to accept\n" |
| 10288 | EXTCOMMUNITY_VAL_STR) |
| 10289 | { |
| 10290 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10291 | } |
| 10292 | |
| 10293 | DEFUN (no_ip_extcommunity_list_name_expanded, |
| 10294 | no_ip_extcommunity_list_name_expanded_cmd, |
| 10295 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10296 | NO_STR |
| 10297 | IP_STR |
| 10298 | EXTCOMMUNITY_LIST_STR |
| 10299 | "Specify expanded extcommunity-list\n" |
| 10300 | "Community list name\n" |
| 10301 | "Specify community to reject\n" |
| 10302 | "Specify community to accept\n" |
| 10303 | "An ordered list as a regular-expression\n") |
| 10304 | { |
| 10305 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10306 | } |
| 10307 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10308 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10309 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
| 10310 | { |
| 10311 | struct community_entry *entry; |
| 10312 | |
| 10313 | for (entry = list->head; entry; entry = entry->next) |
| 10314 | { |
| 10315 | if (entry == list->head) |
| 10316 | { |
| 10317 | if (all_digit (list->name)) |
| 10318 | vty_out (vty, "Extended community %s list %s%s", |
| 10319 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10320 | "standard" : "(expanded) access", |
| 10321 | list->name, VTY_NEWLINE); |
| 10322 | else |
| 10323 | vty_out (vty, "Named extended community %s list %s%s", |
| 10324 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10325 | "standard" : "expanded", |
| 10326 | list->name, VTY_NEWLINE); |
| 10327 | } |
| 10328 | if (entry->any) |
| 10329 | vty_out (vty, " %s%s", |
| 10330 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10331 | else |
| 10332 | vty_out (vty, " %s %s%s", |
| 10333 | community_direct_str (entry->direct), |
| 10334 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10335 | entry->u.ecom->str : entry->config, |
| 10336 | VTY_NEWLINE); |
| 10337 | } |
| 10338 | } |
| 10339 | |
| 10340 | DEFUN (show_ip_extcommunity_list, |
| 10341 | show_ip_extcommunity_list_cmd, |
| 10342 | "show ip extcommunity-list", |
| 10343 | SHOW_STR |
| 10344 | IP_STR |
| 10345 | "List extended-community list\n") |
| 10346 | { |
| 10347 | struct community_list *list; |
| 10348 | struct community_list_master *cm; |
| 10349 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10350 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10351 | if (! cm) |
| 10352 | return CMD_SUCCESS; |
| 10353 | |
| 10354 | for (list = cm->num.head; list; list = list->next) |
| 10355 | extcommunity_list_show (vty, list); |
| 10356 | |
| 10357 | for (list = cm->str.head; list; list = list->next) |
| 10358 | extcommunity_list_show (vty, list); |
| 10359 | |
| 10360 | return CMD_SUCCESS; |
| 10361 | } |
| 10362 | |
| 10363 | DEFUN (show_ip_extcommunity_list_arg, |
| 10364 | show_ip_extcommunity_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10365 | "show ip extcommunity-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10366 | SHOW_STR |
| 10367 | IP_STR |
| 10368 | "List extended-community list\n" |
| 10369 | "Extcommunity-list number\n" |
| 10370 | "Extcommunity-list name\n") |
| 10371 | { |
| 10372 | struct community_list *list; |
| 10373 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10374 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10375 | if (! list) |
| 10376 | { |
| 10377 | vty_out (vty, "%% Can't find extcommunit-list%s", VTY_NEWLINE); |
| 10378 | return CMD_WARNING; |
| 10379 | } |
| 10380 | |
| 10381 | extcommunity_list_show (vty, list); |
| 10382 | |
| 10383 | return CMD_SUCCESS; |
| 10384 | } |
| 10385 | |
| 10386 | /* Return configuration string of community-list entry. */ |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10387 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10388 | community_list_config_str (struct community_entry *entry) |
| 10389 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10390 | const char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10391 | |
| 10392 | if (entry->any) |
| 10393 | str = ""; |
| 10394 | else |
| 10395 | { |
| 10396 | if (entry->style == COMMUNITY_LIST_STANDARD) |
| 10397 | str = community_str (entry->u.com); |
| 10398 | else |
| 10399 | str = entry->config; |
| 10400 | } |
| 10401 | return str; |
| 10402 | } |
| 10403 | |
| 10404 | /* Display community-list and extcommunity-list configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10405 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10406 | community_list_config_write (struct vty *vty) |
| 10407 | { |
| 10408 | struct community_list *list; |
| 10409 | struct community_entry *entry; |
| 10410 | struct community_list_master *cm; |
| 10411 | int write = 0; |
| 10412 | |
| 10413 | /* Community-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10414 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10415 | |
| 10416 | for (list = cm->num.head; list; list = list->next) |
| 10417 | for (entry = list->head; entry; entry = entry->next) |
| 10418 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10419 | vty_out (vty, "ip community-list %s %s %s%s", |
| 10420 | list->name, community_direct_str (entry->direct), |
| 10421 | community_list_config_str (entry), |
| 10422 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10423 | write++; |
| 10424 | } |
| 10425 | for (list = cm->str.head; list; list = list->next) |
| 10426 | for (entry = list->head; entry; entry = entry->next) |
| 10427 | { |
| 10428 | vty_out (vty, "ip community-list %s %s %s %s%s", |
| 10429 | entry->style == COMMUNITY_LIST_STANDARD |
| 10430 | ? "standard" : "expanded", |
| 10431 | list->name, community_direct_str (entry->direct), |
| 10432 | community_list_config_str (entry), |
| 10433 | VTY_NEWLINE); |
| 10434 | write++; |
| 10435 | } |
| 10436 | |
| 10437 | /* Extcommunity-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10438 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10439 | |
| 10440 | for (list = cm->num.head; list; list = list->next) |
| 10441 | for (entry = list->head; entry; entry = entry->next) |
| 10442 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10443 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
| 10444 | list->name, community_direct_str (entry->direct), |
| 10445 | community_list_config_str (entry), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10446 | write++; |
| 10447 | } |
| 10448 | for (list = cm->str.head; list; list = list->next) |
| 10449 | for (entry = list->head; entry; entry = entry->next) |
| 10450 | { |
| 10451 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", |
| 10452 | entry->style == EXTCOMMUNITY_LIST_STANDARD |
| 10453 | ? "standard" : "expanded", |
| 10454 | list->name, community_direct_str (entry->direct), |
| 10455 | community_list_config_str (entry), VTY_NEWLINE); |
| 10456 | write++; |
| 10457 | } |
| 10458 | return write; |
| 10459 | } |
| 10460 | |
| 10461 | struct cmd_node community_list_node = |
| 10462 | { |
| 10463 | COMMUNITY_LIST_NODE, |
| 10464 | "", |
| 10465 | 1 /* Export to vtysh. */ |
| 10466 | }; |
| 10467 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10468 | static void |
| 10469 | community_list_vty (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10470 | { |
| 10471 | install_node (&community_list_node, community_list_config_write); |
| 10472 | |
| 10473 | /* Community-list. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10474 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
| 10475 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); |
| 10476 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); |
| 10477 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); |
| 10478 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); |
| 10479 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10480 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
| 10481 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
| 10482 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); |
| 10483 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10484 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
| 10485 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); |
| 10486 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); |
| 10487 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
| 10488 | install_element (VIEW_NODE, &show_ip_community_list_cmd); |
| 10489 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); |
| 10490 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); |
| 10491 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); |
| 10492 | |
| 10493 | /* Extcommunity-list. */ |
| 10494 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); |
| 10495 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); |
| 10496 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); |
| 10497 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); |
| 10498 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); |
| 10499 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10500 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
| 10501 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
| 10502 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); |
| 10503 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10504 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
| 10505 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); |
| 10506 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); |
| 10507 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
| 10508 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); |
| 10509 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 10510 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); |
| 10511 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 10512 | } |