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" |
| 31 | |
| 32 | #include "bgpd/bgpd.h" |
| 33 | #include "bgpd/bgp_attr.h" |
| 34 | #include "bgpd/bgp_aspath.h" |
| 35 | #include "bgpd/bgp_community.h" |
| 36 | #include "bgpd/bgp_debug.h" |
| 37 | #include "bgpd/bgp_mplsvpn.h" |
| 38 | #include "bgpd/bgp_open.h" |
| 39 | #include "bgpd/bgp_route.h" |
| 40 | #include "bgpd/bgp_zebra.h" |
| 41 | |
| 42 | /* Utility function to get address family from current node. */ |
| 43 | afi_t |
| 44 | bgp_node_afi (struct vty *vty) |
| 45 | { |
| 46 | if (vty->node == BGP_IPV6_NODE) |
| 47 | return AFI_IP6; |
| 48 | return AFI_IP; |
| 49 | } |
| 50 | |
| 51 | /* Utility function to get subsequent address family from current |
| 52 | node. */ |
| 53 | safi_t |
| 54 | bgp_node_safi (struct vty *vty) |
| 55 | { |
| 56 | if (vty->node == BGP_VPNV4_NODE) |
| 57 | return SAFI_MPLS_VPN; |
| 58 | if (vty->node == BGP_IPV4M_NODE) |
| 59 | return SAFI_MULTICAST; |
| 60 | return SAFI_UNICAST; |
| 61 | } |
| 62 | |
| 63 | int |
| 64 | peer_address_self_check (union sockunion *su) |
| 65 | { |
| 66 | struct interface *ifp = NULL; |
| 67 | |
| 68 | if (su->sa.sa_family == AF_INET) |
| 69 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); |
| 70 | #ifdef HAVE_IPV6 |
| 71 | else if (su->sa.sa_family == AF_INET6) |
| 72 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); |
| 73 | #endif /* HAVE IPV6 */ |
| 74 | |
| 75 | if (ifp) |
| 76 | return 1; |
| 77 | |
| 78 | return 0; |
| 79 | } |
| 80 | |
| 81 | /* Utility function for looking up peer from VTY. */ |
| 82 | struct peer * |
| 83 | peer_lookup_vty (struct vty *vty, char *ip_str) |
| 84 | { |
| 85 | int ret; |
| 86 | struct bgp *bgp; |
| 87 | union sockunion su; |
| 88 | struct peer *peer; |
| 89 | |
| 90 | bgp = vty->index; |
| 91 | |
| 92 | ret = str2sockunion (ip_str, &su); |
| 93 | if (ret < 0) |
| 94 | { |
| 95 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 96 | return NULL; |
| 97 | } |
| 98 | |
| 99 | peer = peer_lookup (bgp, &su); |
| 100 | if (! peer) |
| 101 | { |
| 102 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE); |
| 103 | return NULL; |
| 104 | } |
| 105 | return peer; |
| 106 | } |
| 107 | |
| 108 | /* Utility function for looking up peer or peer group. */ |
| 109 | struct peer * |
| 110 | peer_and_group_lookup_vty (struct vty *vty, char *peer_str) |
| 111 | { |
| 112 | int ret; |
| 113 | struct bgp *bgp; |
| 114 | union sockunion su; |
| 115 | struct peer *peer; |
| 116 | struct peer_group *group; |
| 117 | |
| 118 | bgp = vty->index; |
| 119 | |
| 120 | ret = str2sockunion (peer_str, &su); |
| 121 | if (ret == 0) |
| 122 | { |
| 123 | peer = peer_lookup (bgp, &su); |
| 124 | if (peer) |
| 125 | return peer; |
| 126 | } |
| 127 | else |
| 128 | { |
| 129 | group = peer_group_lookup (bgp, peer_str); |
| 130 | if (group) |
| 131 | return group->conf; |
| 132 | } |
| 133 | |
| 134 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
| 135 | VTY_NEWLINE); |
| 136 | |
| 137 | return NULL; |
| 138 | } |
| 139 | |
| 140 | int |
| 141 | bgp_vty_return (struct vty *vty, int ret) |
| 142 | { |
| 143 | char *str = NULL; |
| 144 | |
| 145 | switch (ret) |
| 146 | { |
| 147 | case BGP_ERR_INVALID_VALUE: |
| 148 | str = "Invalid value"; |
| 149 | break; |
| 150 | case BGP_ERR_INVALID_FLAG: |
| 151 | str = "Invalid flag"; |
| 152 | break; |
| 153 | case BGP_ERR_PEER_INACTIVE: |
| 154 | str = "Activate the neighbor for the address family first"; |
| 155 | break; |
| 156 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: |
| 157 | str = "Invalid command for a peer-group member"; |
| 158 | break; |
| 159 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
| 160 | str = "Peer-group has been shutdown. Activate the peer-group first"; |
| 161 | break; |
| 162 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: |
| 163 | str = "This peer is a peer-group member. Please change peer-group configuration"; |
| 164 | break; |
| 165 | case BGP_ERR_PEER_FLAG_CONFLICT: |
| 166 | str = "Can't set override-capability and strict-capability-match at the same time"; |
| 167 | break; |
| 168 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: |
| 169 | str = "No activate for peergroup can be given only if peer-group has no members"; |
| 170 | break; |
| 171 | case BGP_ERR_PEER_BELONGS_TO_GROUP: |
| 172 | str = "No activate for an individual peer-group member is invalid"; |
| 173 | break; |
| 174 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: |
| 175 | str = "Activate the peer-group for the address family first"; |
| 176 | break; |
| 177 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
| 178 | str = "Specify remote-as or peer-group remote AS first"; |
| 179 | break; |
| 180 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: |
| 181 | str = "Cannot change the peer-group. Deconfigure first"; |
| 182 | break; |
| 183 | case BGP_ERR_PEER_GROUP_MISMATCH: |
| 184 | str = "Cannot have different peer-group for the neighbor"; |
| 185 | break; |
| 186 | case BGP_ERR_PEER_FILTER_CONFLICT: |
| 187 | str = "Prefix/distribute list can not co-exist"; |
| 188 | break; |
| 189 | case BGP_ERR_NOT_INTERNAL_PEER: |
| 190 | str = "Invalid command. Not an internal neighbor"; |
| 191 | break; |
| 192 | case BGP_ERR_REMOVE_PRIVATE_AS: |
| 193 | str = "Private AS cannot be removed for IBGP peers"; |
| 194 | break; |
| 195 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: |
| 196 | str = "Local-AS allowed only for EBGP peers"; |
| 197 | break; |
| 198 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: |
| 199 | str = "Cannot have local-as same as BGP AS number"; |
| 200 | break; |
| 201 | } |
| 202 | if (str) |
| 203 | { |
| 204 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); |
| 205 | return CMD_WARNING; |
| 206 | } |
| 207 | return CMD_SUCCESS; |
| 208 | } |
| 209 | |
| 210 | /* BGP global configuration. */ |
| 211 | |
| 212 | DEFUN (bgp_multiple_instance_func, |
| 213 | bgp_multiple_instance_cmd, |
| 214 | "bgp multiple-instance", |
| 215 | BGP_STR |
| 216 | "Enable bgp multiple instance\n") |
| 217 | { |
| 218 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); |
| 219 | return CMD_SUCCESS; |
| 220 | } |
| 221 | |
| 222 | DEFUN (no_bgp_multiple_instance, |
| 223 | no_bgp_multiple_instance_cmd, |
| 224 | "no bgp multiple-instance", |
| 225 | NO_STR |
| 226 | BGP_STR |
| 227 | "BGP multiple instance\n") |
| 228 | { |
| 229 | int ret; |
| 230 | |
| 231 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); |
| 232 | if (ret < 0) |
| 233 | { |
| 234 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); |
| 235 | return CMD_WARNING; |
| 236 | } |
| 237 | return CMD_SUCCESS; |
| 238 | } |
| 239 | |
| 240 | DEFUN (bgp_config_type, |
| 241 | bgp_config_type_cmd, |
| 242 | "bgp config-type (cisco|zebra)", |
| 243 | BGP_STR |
| 244 | "Configuration type\n" |
| 245 | "cisco\n" |
| 246 | "zebra\n") |
| 247 | { |
| 248 | if (strncmp (argv[0], "c", 1) == 0) |
| 249 | bgp_option_set (BGP_OPT_CONFIG_CISCO); |
| 250 | else |
| 251 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 252 | |
| 253 | return CMD_SUCCESS; |
| 254 | } |
| 255 | |
| 256 | DEFUN (no_bgp_config_type, |
| 257 | no_bgp_config_type_cmd, |
| 258 | "no bgp config-type", |
| 259 | NO_STR |
| 260 | BGP_STR |
| 261 | "Display configuration type\n") |
| 262 | { |
| 263 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 264 | return CMD_SUCCESS; |
| 265 | } |
| 266 | |
| 267 | DEFUN (no_synchronization, |
| 268 | no_synchronization_cmd, |
| 269 | "no synchronization", |
| 270 | NO_STR |
| 271 | "Perform IGP synchronization\n") |
| 272 | { |
| 273 | return CMD_SUCCESS; |
| 274 | } |
| 275 | |
| 276 | DEFUN (no_auto_summary, |
| 277 | no_auto_summary_cmd, |
| 278 | "no auto-summary", |
| 279 | NO_STR |
| 280 | "Enable automatic network number summarization\n") |
| 281 | { |
| 282 | return CMD_SUCCESS; |
| 283 | } |
| 284 | |
| 285 | /* "router bgp" commands. */ |
| 286 | DEFUN (router_bgp, |
| 287 | router_bgp_cmd, |
| 288 | "router bgp <1-65535>", |
| 289 | ROUTER_STR |
| 290 | BGP_STR |
| 291 | AS_STR) |
| 292 | { |
| 293 | int ret; |
| 294 | as_t as; |
| 295 | struct bgp *bgp; |
| 296 | char *name = NULL; |
| 297 | |
| 298 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535); |
| 299 | |
| 300 | if (argc == 2) |
| 301 | name = argv[1]; |
| 302 | |
| 303 | ret = bgp_get (&bgp, &as, name); |
| 304 | switch (ret) |
| 305 | { |
| 306 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: |
| 307 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", |
| 308 | VTY_NEWLINE); |
| 309 | return CMD_WARNING; |
| 310 | break; |
| 311 | case BGP_ERR_AS_MISMATCH: |
| 312 | vty_out (vty, "BGP is already running; AS is %d%s", as, VTY_NEWLINE); |
| 313 | return CMD_WARNING; |
| 314 | break; |
| 315 | case BGP_ERR_INSTANCE_MISMATCH: |
| 316 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); |
| 317 | vty_out (vty, "BGP instance is already running; AS is %d%s", |
| 318 | as, VTY_NEWLINE); |
| 319 | return CMD_WARNING; |
| 320 | break; |
| 321 | } |
| 322 | |
| 323 | vty->node = BGP_NODE; |
| 324 | vty->index = bgp; |
| 325 | |
| 326 | return CMD_SUCCESS; |
| 327 | } |
| 328 | |
| 329 | ALIAS (router_bgp, |
| 330 | router_bgp_view_cmd, |
| 331 | "router bgp <1-65535> view WORD", |
| 332 | ROUTER_STR |
| 333 | BGP_STR |
| 334 | AS_STR |
| 335 | "BGP view\n" |
| 336 | "view name\n") |
| 337 | |
| 338 | /* "no router bgp" commands. */ |
| 339 | DEFUN (no_router_bgp, |
| 340 | no_router_bgp_cmd, |
| 341 | "no router bgp <1-65535>", |
| 342 | NO_STR |
| 343 | ROUTER_STR |
| 344 | BGP_STR |
| 345 | AS_STR) |
| 346 | { |
| 347 | as_t as; |
| 348 | struct bgp *bgp; |
| 349 | char *name = NULL; |
| 350 | |
| 351 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535); |
| 352 | |
| 353 | if (argc == 2) |
| 354 | name = argv[1]; |
| 355 | |
| 356 | /* Lookup bgp structure. */ |
| 357 | bgp = bgp_lookup (as, name); |
| 358 | if (! bgp) |
| 359 | { |
| 360 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); |
| 361 | return CMD_WARNING; |
| 362 | } |
| 363 | |
| 364 | bgp_delete (bgp); |
| 365 | |
| 366 | return CMD_SUCCESS; |
| 367 | } |
| 368 | |
| 369 | ALIAS (no_router_bgp, |
| 370 | no_router_bgp_view_cmd, |
| 371 | "no router bgp <1-65535> view WORD", |
| 372 | NO_STR |
| 373 | ROUTER_STR |
| 374 | BGP_STR |
| 375 | AS_STR |
| 376 | "BGP view\n" |
| 377 | "view name\n") |
| 378 | |
| 379 | /* BGP router-id. */ |
| 380 | |
| 381 | DEFUN (bgp_router_id, |
| 382 | bgp_router_id_cmd, |
| 383 | "bgp router-id A.B.C.D", |
| 384 | BGP_STR |
| 385 | "Override configured router identifier\n" |
| 386 | "Manually configured router identifier\n") |
| 387 | { |
| 388 | int ret; |
| 389 | struct in_addr id; |
| 390 | struct bgp *bgp; |
| 391 | |
| 392 | bgp = vty->index; |
| 393 | |
| 394 | ret = inet_aton (argv[0], &id); |
| 395 | if (! ret) |
| 396 | { |
| 397 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); |
| 398 | return CMD_WARNING; |
| 399 | } |
| 400 | |
| 401 | bgp_router_id_set (bgp, &id); |
| 402 | |
| 403 | return CMD_SUCCESS; |
| 404 | } |
| 405 | |
| 406 | DEFUN (no_bgp_router_id, |
| 407 | no_bgp_router_id_cmd, |
| 408 | "no bgp router-id", |
| 409 | NO_STR |
| 410 | BGP_STR |
| 411 | "Override configured router identifier\n") |
| 412 | { |
| 413 | int ret; |
| 414 | struct in_addr id; |
| 415 | struct bgp *bgp; |
| 416 | |
| 417 | bgp = vty->index; |
| 418 | |
| 419 | if (argc == 1) |
| 420 | { |
| 421 | ret = inet_aton (argv[0], &id); |
| 422 | if (! ret) |
| 423 | { |
| 424 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); |
| 425 | return CMD_WARNING; |
| 426 | } |
| 427 | |
| 428 | if (! IPV4_ADDR_SAME (&bgp->router_id, &id)) |
| 429 | { |
| 430 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); |
| 431 | return CMD_WARNING; |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | bgp_router_id_unset (bgp); |
| 436 | |
| 437 | return CMD_SUCCESS; |
| 438 | } |
| 439 | |
| 440 | ALIAS (no_bgp_router_id, |
| 441 | no_bgp_router_id_val_cmd, |
| 442 | "no bgp router-id A.B.C.D", |
| 443 | NO_STR |
| 444 | BGP_STR |
| 445 | "Override configured router identifier\n" |
| 446 | "Manually configured router identifier\n") |
| 447 | |
| 448 | /* BGP Cluster ID. */ |
| 449 | |
| 450 | DEFUN (bgp_cluster_id, |
| 451 | bgp_cluster_id_cmd, |
| 452 | "bgp cluster-id A.B.C.D", |
| 453 | BGP_STR |
| 454 | "Configure Route-Reflector Cluster-id\n" |
| 455 | "Route-Reflector Cluster-id in IP address format\n") |
| 456 | { |
| 457 | int ret; |
| 458 | struct bgp *bgp; |
| 459 | struct in_addr cluster; |
| 460 | |
| 461 | bgp = vty->index; |
| 462 | |
| 463 | ret = inet_aton (argv[0], &cluster); |
| 464 | if (! ret) |
| 465 | { |
| 466 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 467 | return CMD_WARNING; |
| 468 | } |
| 469 | |
| 470 | bgp_cluster_id_set (bgp, &cluster); |
| 471 | |
| 472 | return CMD_SUCCESS; |
| 473 | } |
| 474 | |
| 475 | ALIAS (bgp_cluster_id, |
| 476 | bgp_cluster_id32_cmd, |
| 477 | "bgp cluster-id <1-4294967295>", |
| 478 | BGP_STR |
| 479 | "Configure Route-Reflector Cluster-id\n" |
| 480 | "Route-Reflector Cluster-id as 32 bit quantity\n") |
| 481 | |
| 482 | DEFUN (no_bgp_cluster_id, |
| 483 | no_bgp_cluster_id_cmd, |
| 484 | "no bgp cluster-id", |
| 485 | NO_STR |
| 486 | BGP_STR |
| 487 | "Configure Route-Reflector Cluster-id\n") |
| 488 | { |
| 489 | int ret; |
| 490 | struct bgp *bgp; |
| 491 | struct in_addr cluster; |
| 492 | |
| 493 | bgp = vty->index; |
| 494 | |
| 495 | if (argc == 1) |
| 496 | { |
| 497 | ret = inet_aton (argv[0], &cluster); |
| 498 | if (! ret) |
| 499 | { |
| 500 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 501 | return CMD_WARNING; |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | bgp_cluster_id_unset (bgp); |
| 506 | |
| 507 | return CMD_SUCCESS; |
| 508 | } |
| 509 | |
| 510 | ALIAS (no_bgp_cluster_id, |
| 511 | no_bgp_cluster_id_arg_cmd, |
| 512 | "no bgp cluster-id A.B.C.D", |
| 513 | NO_STR |
| 514 | BGP_STR |
| 515 | "Configure Route-Reflector Cluster-id\n" |
| 516 | "Route-Reflector Cluster-id in IP address format\n") |
| 517 | |
| 518 | DEFUN (bgp_confederation_identifier, |
| 519 | bgp_confederation_identifier_cmd, |
| 520 | "bgp confederation identifier <1-65535>", |
| 521 | "BGP specific commands\n" |
| 522 | "AS confederation parameters\n" |
| 523 | "AS number\n" |
| 524 | "Set routing domain confederation AS\n") |
| 525 | { |
| 526 | struct bgp *bgp; |
| 527 | as_t as; |
| 528 | |
| 529 | bgp = vty->index; |
| 530 | |
| 531 | VTY_GET_INTEGER ("AS", as, argv[0]); |
| 532 | |
| 533 | bgp_confederation_id_set (bgp, as); |
| 534 | |
| 535 | return CMD_SUCCESS; |
| 536 | } |
| 537 | |
| 538 | DEFUN (no_bgp_confederation_identifier, |
| 539 | no_bgp_confederation_identifier_cmd, |
| 540 | "no bgp confederation identifier", |
| 541 | NO_STR |
| 542 | "BGP specific commands\n" |
| 543 | "AS confederation parameters\n" |
| 544 | "AS number\n") |
| 545 | { |
| 546 | struct bgp *bgp; |
| 547 | as_t as; |
| 548 | |
| 549 | bgp = vty->index; |
| 550 | |
| 551 | if (argc == 1) |
| 552 | VTY_GET_INTEGER ("AS", as, argv[0]); |
| 553 | |
| 554 | bgp_confederation_id_unset (bgp); |
| 555 | |
| 556 | return CMD_SUCCESS; |
| 557 | } |
| 558 | |
| 559 | ALIAS (no_bgp_confederation_identifier, |
| 560 | no_bgp_confederation_identifier_arg_cmd, |
| 561 | "no bgp confederation identifier <1-65535>", |
| 562 | NO_STR |
| 563 | "BGP specific commands\n" |
| 564 | "AS confederation parameters\n" |
| 565 | "AS number\n" |
| 566 | "Set routing domain confederation AS\n") |
| 567 | |
| 568 | DEFUN (bgp_confederation_peers, |
| 569 | bgp_confederation_peers_cmd, |
| 570 | "bgp confederation peers .<1-65535>", |
| 571 | "BGP specific commands\n" |
| 572 | "AS confederation parameters\n" |
| 573 | "Peer ASs in BGP confederation\n" |
| 574 | AS_STR) |
| 575 | { |
| 576 | struct bgp *bgp; |
| 577 | as_t as; |
| 578 | int i; |
| 579 | |
| 580 | bgp = vty->index; |
| 581 | |
| 582 | for (i = 0; i < argc; i++) |
| 583 | { |
| 584 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, 65535); |
| 585 | |
| 586 | if (bgp->as == as) |
| 587 | { |
| 588 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", |
| 589 | VTY_NEWLINE); |
| 590 | continue; |
| 591 | } |
| 592 | |
| 593 | bgp_confederation_peers_add (bgp, as); |
| 594 | } |
| 595 | return CMD_SUCCESS; |
| 596 | } |
| 597 | |
| 598 | DEFUN (no_bgp_confederation_peers, |
| 599 | no_bgp_confederation_peers_cmd, |
| 600 | "no bgp confederation peers .<1-65535>", |
| 601 | NO_STR |
| 602 | "BGP specific commands\n" |
| 603 | "AS confederation parameters\n" |
| 604 | "Peer ASs in BGP confederation\n" |
| 605 | AS_STR) |
| 606 | { |
| 607 | struct bgp *bgp; |
| 608 | as_t as; |
| 609 | int i; |
| 610 | |
| 611 | bgp = vty->index; |
| 612 | |
| 613 | for (i = 0; i < argc; i++) |
| 614 | { |
| 615 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, 65535); |
| 616 | |
| 617 | bgp_confederation_peers_remove (bgp, as); |
| 618 | } |
| 619 | return CMD_SUCCESS; |
| 620 | } |
| 621 | |
| 622 | /* BGP timers. */ |
| 623 | |
| 624 | DEFUN (bgp_timers, |
| 625 | bgp_timers_cmd, |
| 626 | "timers bgp <0-65535> <0-65535>", |
| 627 | "Adjust routing timers\n" |
| 628 | "BGP timers\n" |
| 629 | "Keepalive interval\n" |
| 630 | "Holdtime\n") |
| 631 | { |
| 632 | struct bgp *bgp; |
| 633 | unsigned long keepalive = 0; |
| 634 | unsigned long holdtime = 0; |
| 635 | |
| 636 | bgp = vty->index; |
| 637 | |
| 638 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); |
| 639 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); |
| 640 | |
| 641 | /* Holdtime value check. */ |
| 642 | if (holdtime < 3 && holdtime != 0) |
| 643 | { |
| 644 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", |
| 645 | VTY_NEWLINE); |
| 646 | return CMD_WARNING; |
| 647 | } |
| 648 | |
| 649 | bgp_timers_set (bgp, keepalive, holdtime); |
| 650 | |
| 651 | return CMD_SUCCESS; |
| 652 | } |
| 653 | |
| 654 | DEFUN (no_bgp_timers, |
| 655 | no_bgp_timers_cmd, |
| 656 | "no timers bgp", |
| 657 | NO_STR |
| 658 | "Adjust routing timers\n" |
| 659 | "BGP timers\n") |
| 660 | { |
| 661 | struct bgp *bgp; |
| 662 | |
| 663 | bgp = vty->index; |
| 664 | bgp_timers_unset (bgp); |
| 665 | |
| 666 | return CMD_SUCCESS; |
| 667 | } |
| 668 | |
| 669 | ALIAS (no_bgp_timers, |
| 670 | no_bgp_timers_arg_cmd, |
| 671 | "no timers bgp <0-65535> <0-65535>", |
| 672 | NO_STR |
| 673 | "Adjust routing timers\n" |
| 674 | "BGP timers\n" |
| 675 | "Keepalive interval\n" |
| 676 | "Holdtime\n") |
| 677 | |
| 678 | DEFUN (bgp_client_to_client_reflection, |
| 679 | bgp_client_to_client_reflection_cmd, |
| 680 | "bgp client-to-client reflection", |
| 681 | "BGP specific commands\n" |
| 682 | "Configure client to client route reflection\n" |
| 683 | "reflection of routes allowed\n") |
| 684 | { |
| 685 | struct bgp *bgp; |
| 686 | |
| 687 | bgp = vty->index; |
| 688 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 689 | return CMD_SUCCESS; |
| 690 | } |
| 691 | |
| 692 | DEFUN (no_bgp_client_to_client_reflection, |
| 693 | no_bgp_client_to_client_reflection_cmd, |
| 694 | "no bgp client-to-client reflection", |
| 695 | NO_STR |
| 696 | "BGP specific commands\n" |
| 697 | "Configure client to client route reflection\n" |
| 698 | "reflection of routes allowed\n") |
| 699 | { |
| 700 | struct bgp *bgp; |
| 701 | |
| 702 | bgp = vty->index; |
| 703 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 704 | return CMD_SUCCESS; |
| 705 | } |
| 706 | |
| 707 | /* "bgp always-compare-med" configuration. */ |
| 708 | DEFUN (bgp_always_compare_med, |
| 709 | bgp_always_compare_med_cmd, |
| 710 | "bgp always-compare-med", |
| 711 | "BGP specific commands\n" |
| 712 | "Allow comparing MED from different neighbors\n") |
| 713 | { |
| 714 | struct bgp *bgp; |
| 715 | |
| 716 | bgp = vty->index; |
| 717 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 718 | return CMD_SUCCESS; |
| 719 | } |
| 720 | |
| 721 | DEFUN (no_bgp_always_compare_med, |
| 722 | no_bgp_always_compare_med_cmd, |
| 723 | "no bgp always-compare-med", |
| 724 | NO_STR |
| 725 | "BGP specific commands\n" |
| 726 | "Allow comparing MED from different neighbors\n") |
| 727 | { |
| 728 | struct bgp *bgp; |
| 729 | |
| 730 | bgp = vty->index; |
| 731 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 732 | return CMD_SUCCESS; |
| 733 | } |
| 734 | |
| 735 | /* "bgp deterministic-med" configuration. */ |
| 736 | DEFUN (bgp_deterministic_med, |
| 737 | bgp_deterministic_med_cmd, |
| 738 | "bgp deterministic-med", |
| 739 | "BGP specific commands\n" |
| 740 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 741 | { |
| 742 | struct bgp *bgp; |
| 743 | |
| 744 | bgp = vty->index; |
| 745 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 746 | return CMD_SUCCESS; |
| 747 | } |
| 748 | |
| 749 | DEFUN (no_bgp_deterministic_med, |
| 750 | no_bgp_deterministic_med_cmd, |
| 751 | "no bgp deterministic-med", |
| 752 | NO_STR |
| 753 | "BGP specific commands\n" |
| 754 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 755 | { |
| 756 | struct bgp *bgp; |
| 757 | |
| 758 | bgp = vty->index; |
| 759 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 760 | return CMD_SUCCESS; |
| 761 | } |
| 762 | |
| 763 | /* "bgp fast-external-failover" configuration. */ |
| 764 | DEFUN (bgp_fast_external_failover, |
| 765 | bgp_fast_external_failover_cmd, |
| 766 | "bgp fast-external-failover", |
| 767 | BGP_STR |
| 768 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 769 | { |
| 770 | struct bgp *bgp; |
| 771 | |
| 772 | bgp = vty->index; |
| 773 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 774 | return CMD_SUCCESS; |
| 775 | } |
| 776 | |
| 777 | DEFUN (no_bgp_fast_external_failover, |
| 778 | no_bgp_fast_external_failover_cmd, |
| 779 | "no bgp fast-external-failover", |
| 780 | NO_STR |
| 781 | BGP_STR |
| 782 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 783 | { |
| 784 | struct bgp *bgp; |
| 785 | |
| 786 | bgp = vty->index; |
| 787 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 788 | return CMD_SUCCESS; |
| 789 | } |
| 790 | |
| 791 | /* "bgp enforce-first-as" configuration. */ |
| 792 | DEFUN (bgp_enforce_first_as, |
| 793 | bgp_enforce_first_as_cmd, |
| 794 | "bgp enforce-first-as", |
| 795 | BGP_STR |
| 796 | "Enforce the first AS for EBGP routes\n") |
| 797 | { |
| 798 | struct bgp *bgp; |
| 799 | |
| 800 | bgp = vty->index; |
| 801 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 802 | return CMD_SUCCESS; |
| 803 | } |
| 804 | |
| 805 | DEFUN (no_bgp_enforce_first_as, |
| 806 | no_bgp_enforce_first_as_cmd, |
| 807 | "no bgp enforce-first-as", |
| 808 | NO_STR |
| 809 | BGP_STR |
| 810 | "Enforce the first AS for EBGP routes\n") |
| 811 | { |
| 812 | struct bgp *bgp; |
| 813 | |
| 814 | bgp = vty->index; |
| 815 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 816 | return CMD_SUCCESS; |
| 817 | } |
| 818 | |
| 819 | /* "bgp bestpath compare-routerid" configuration. */ |
| 820 | DEFUN (bgp_bestpath_compare_router_id, |
| 821 | bgp_bestpath_compare_router_id_cmd, |
| 822 | "bgp bestpath compare-routerid", |
| 823 | "BGP specific commands\n" |
| 824 | "Change the default bestpath selection\n" |
| 825 | "Compare router-id for identical EBGP paths\n") |
| 826 | { |
| 827 | struct bgp *bgp; |
| 828 | |
| 829 | bgp = vty->index; |
| 830 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 831 | return CMD_SUCCESS; |
| 832 | } |
| 833 | |
| 834 | DEFUN (no_bgp_bestpath_compare_router_id, |
| 835 | no_bgp_bestpath_compare_router_id_cmd, |
| 836 | "no bgp bestpath compare-routerid", |
| 837 | NO_STR |
| 838 | "BGP specific commands\n" |
| 839 | "Change the default bestpath selection\n" |
| 840 | "Compare router-id for identical EBGP paths\n") |
| 841 | { |
| 842 | struct bgp *bgp; |
| 843 | |
| 844 | bgp = vty->index; |
| 845 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 846 | return CMD_SUCCESS; |
| 847 | } |
| 848 | |
| 849 | /* "bgp bestpath as-path ignore" configuration. */ |
| 850 | DEFUN (bgp_bestpath_aspath_ignore, |
| 851 | bgp_bestpath_aspath_ignore_cmd, |
| 852 | "bgp bestpath as-path ignore", |
| 853 | "BGP specific commands\n" |
| 854 | "Change the default bestpath selection\n" |
| 855 | "AS-path attribute\n" |
| 856 | "Ignore as-path length in selecting a route\n") |
| 857 | { |
| 858 | struct bgp *bgp; |
| 859 | |
| 860 | bgp = vty->index; |
| 861 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 862 | return CMD_SUCCESS; |
| 863 | } |
| 864 | |
| 865 | DEFUN (no_bgp_bestpath_aspath_ignore, |
| 866 | no_bgp_bestpath_aspath_ignore_cmd, |
| 867 | "no bgp bestpath as-path ignore", |
| 868 | NO_STR |
| 869 | "BGP specific commands\n" |
| 870 | "Change the default bestpath selection\n" |
| 871 | "AS-path attribute\n" |
| 872 | "Ignore as-path length in selecting a route\n") |
| 873 | { |
| 874 | struct bgp *bgp; |
| 875 | |
| 876 | bgp = vty->index; |
| 877 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 878 | return CMD_SUCCESS; |
| 879 | } |
| 880 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 881 | /* "bgp log-neighbor-changes" configuration. */ |
| 882 | DEFUN (bgp_log_neighbor_changes, |
| 883 | bgp_log_neighbor_changes_cmd, |
| 884 | "bgp log-neighbor-changes", |
| 885 | "BGP specific commands\n" |
| 886 | "Log neighbor up/down and reset reason\n") |
| 887 | { |
| 888 | struct bgp *bgp; |
| 889 | |
| 890 | bgp = vty->index; |
| 891 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 892 | return CMD_SUCCESS; |
| 893 | } |
| 894 | |
| 895 | DEFUN (no_bgp_log_neighbor_changes, |
| 896 | no_bgp_log_neighbor_changes_cmd, |
| 897 | "no bgp log-neighbor-changes", |
| 898 | NO_STR |
| 899 | "BGP specific commands\n" |
| 900 | "Log neighbor up/down and reset reason\n") |
| 901 | { |
| 902 | struct bgp *bgp; |
| 903 | |
| 904 | bgp = vty->index; |
| 905 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 906 | return CMD_SUCCESS; |
| 907 | } |
| 908 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 909 | /* "bgp bestpath med" configuration. */ |
| 910 | DEFUN (bgp_bestpath_med, |
| 911 | bgp_bestpath_med_cmd, |
| 912 | "bgp bestpath med (confed|missing-as-worst)", |
| 913 | "BGP specific commands\n" |
| 914 | "Change the default bestpath selection\n" |
| 915 | "MED attribute\n" |
| 916 | "Compare MED among confederation paths\n" |
| 917 | "Treat missing MED as the least preferred one\n") |
| 918 | { |
| 919 | struct bgp *bgp; |
| 920 | |
| 921 | bgp = vty->index; |
| 922 | |
| 923 | if (strncmp (argv[0], "confed", 1) == 0) |
| 924 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 925 | else |
| 926 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 927 | |
| 928 | return CMD_SUCCESS; |
| 929 | } |
| 930 | |
| 931 | DEFUN (bgp_bestpath_med2, |
| 932 | bgp_bestpath_med2_cmd, |
| 933 | "bgp bestpath med confed missing-as-worst", |
| 934 | "BGP specific commands\n" |
| 935 | "Change the default bestpath selection\n" |
| 936 | "MED attribute\n" |
| 937 | "Compare MED among confederation paths\n" |
| 938 | "Treat missing MED as the least preferred one\n") |
| 939 | { |
| 940 | struct bgp *bgp; |
| 941 | |
| 942 | bgp = vty->index; |
| 943 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 944 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 945 | return CMD_SUCCESS; |
| 946 | } |
| 947 | |
| 948 | ALIAS (bgp_bestpath_med2, |
| 949 | bgp_bestpath_med3_cmd, |
| 950 | "bgp bestpath med missing-as-worst confed", |
| 951 | "BGP specific commands\n" |
| 952 | "Change the default bestpath selection\n" |
| 953 | "MED attribute\n" |
| 954 | "Treat missing MED as the least preferred one\n" |
| 955 | "Compare MED among confederation paths\n") |
| 956 | |
| 957 | DEFUN (no_bgp_bestpath_med, |
| 958 | no_bgp_bestpath_med_cmd, |
| 959 | "no bgp bestpath med (confed|missing-as-worst)", |
| 960 | NO_STR |
| 961 | "BGP specific commands\n" |
| 962 | "Change the default bestpath selection\n" |
| 963 | "MED attribute\n" |
| 964 | "Compare MED among confederation paths\n" |
| 965 | "Treat missing MED as the least preferred one\n") |
| 966 | { |
| 967 | struct bgp *bgp; |
| 968 | |
| 969 | bgp = vty->index; |
| 970 | |
| 971 | if (strncmp (argv[0], "confed", 1) == 0) |
| 972 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 973 | else |
| 974 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 975 | |
| 976 | return CMD_SUCCESS; |
| 977 | } |
| 978 | |
| 979 | DEFUN (no_bgp_bestpath_med2, |
| 980 | no_bgp_bestpath_med2_cmd, |
| 981 | "no bgp bestpath med confed missing-as-worst", |
| 982 | NO_STR |
| 983 | "BGP specific commands\n" |
| 984 | "Change the default bestpath selection\n" |
| 985 | "MED attribute\n" |
| 986 | "Compare MED among confederation paths\n" |
| 987 | "Treat missing MED as the least preferred one\n") |
| 988 | { |
| 989 | struct bgp *bgp; |
| 990 | |
| 991 | bgp = vty->index; |
| 992 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 993 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 994 | return CMD_SUCCESS; |
| 995 | } |
| 996 | |
| 997 | ALIAS (no_bgp_bestpath_med2, |
| 998 | no_bgp_bestpath_med3_cmd, |
| 999 | "no bgp bestpath med missing-as-worst confed", |
| 1000 | NO_STR |
| 1001 | "BGP specific commands\n" |
| 1002 | "Change the default bestpath selection\n" |
| 1003 | "MED attribute\n" |
| 1004 | "Treat missing MED as the least preferred one\n" |
| 1005 | "Compare MED among confederation paths\n") |
| 1006 | |
| 1007 | /* "no bgp default ipv4-unicast". */ |
| 1008 | DEFUN (no_bgp_default_ipv4_unicast, |
| 1009 | no_bgp_default_ipv4_unicast_cmd, |
| 1010 | "no bgp default ipv4-unicast", |
| 1011 | NO_STR |
| 1012 | "BGP specific commands\n" |
| 1013 | "Configure BGP defaults\n" |
| 1014 | "Activate ipv4-unicast for a peer by default\n") |
| 1015 | { |
| 1016 | struct bgp *bgp; |
| 1017 | |
| 1018 | bgp = vty->index; |
| 1019 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1020 | return CMD_SUCCESS; |
| 1021 | } |
| 1022 | |
| 1023 | DEFUN (bgp_default_ipv4_unicast, |
| 1024 | bgp_default_ipv4_unicast_cmd, |
| 1025 | "bgp default ipv4-unicast", |
| 1026 | "BGP specific commands\n" |
| 1027 | "Configure BGP defaults\n" |
| 1028 | "Activate ipv4-unicast for a peer by default\n") |
| 1029 | { |
| 1030 | struct bgp *bgp; |
| 1031 | |
| 1032 | bgp = vty->index; |
| 1033 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1034 | return CMD_SUCCESS; |
| 1035 | } |
| 1036 | |
| 1037 | /* "bgp import-check" configuration. */ |
| 1038 | DEFUN (bgp_network_import_check, |
| 1039 | bgp_network_import_check_cmd, |
| 1040 | "bgp network import-check", |
| 1041 | "BGP specific commands\n" |
| 1042 | "BGP network command\n" |
| 1043 | "Check BGP network route exists in IGP\n") |
| 1044 | { |
| 1045 | struct bgp *bgp; |
| 1046 | |
| 1047 | bgp = vty->index; |
| 1048 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1049 | return CMD_SUCCESS; |
| 1050 | } |
| 1051 | |
| 1052 | DEFUN (no_bgp_network_import_check, |
| 1053 | no_bgp_network_import_check_cmd, |
| 1054 | "no bgp network import-check", |
| 1055 | NO_STR |
| 1056 | "BGP specific commands\n" |
| 1057 | "BGP network command\n" |
| 1058 | "Check BGP network route exists in IGP\n") |
| 1059 | { |
| 1060 | struct bgp *bgp; |
| 1061 | |
| 1062 | bgp = vty->index; |
| 1063 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1064 | return CMD_SUCCESS; |
| 1065 | } |
| 1066 | |
| 1067 | DEFUN (bgp_default_local_preference, |
| 1068 | bgp_default_local_preference_cmd, |
| 1069 | "bgp default local-preference <0-4294967295>", |
| 1070 | "BGP specific commands\n" |
| 1071 | "Configure BGP defaults\n" |
| 1072 | "local preference (higher=more preferred)\n" |
| 1073 | "Configure default local preference value\n") |
| 1074 | { |
| 1075 | struct bgp *bgp; |
| 1076 | u_int32_t local_pref; |
| 1077 | |
| 1078 | bgp = vty->index; |
| 1079 | |
| 1080 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); |
| 1081 | |
| 1082 | bgp_default_local_preference_set (bgp, local_pref); |
| 1083 | |
| 1084 | return CMD_SUCCESS; |
| 1085 | } |
| 1086 | |
| 1087 | DEFUN (no_bgp_default_local_preference, |
| 1088 | no_bgp_default_local_preference_cmd, |
| 1089 | "no bgp default local-preference", |
| 1090 | NO_STR |
| 1091 | "BGP specific commands\n" |
| 1092 | "Configure BGP defaults\n" |
| 1093 | "local preference (higher=more preferred)\n") |
| 1094 | { |
| 1095 | struct bgp *bgp; |
| 1096 | |
| 1097 | bgp = vty->index; |
| 1098 | bgp_default_local_preference_unset (bgp); |
| 1099 | return CMD_SUCCESS; |
| 1100 | } |
| 1101 | |
| 1102 | ALIAS (no_bgp_default_local_preference, |
| 1103 | no_bgp_default_local_preference_val_cmd, |
| 1104 | "no bgp default local-preference <0-4294967295>", |
| 1105 | NO_STR |
| 1106 | "BGP specific commands\n" |
| 1107 | "Configure BGP defaults\n" |
| 1108 | "local preference (higher=more preferred)\n" |
| 1109 | "Configure default local preference value\n") |
| 1110 | |
| 1111 | static int |
| 1112 | peer_remote_as_vty (struct vty *vty, char *peer_str, char *as_str, afi_t afi, |
| 1113 | safi_t safi) |
| 1114 | { |
| 1115 | int ret; |
| 1116 | struct bgp *bgp; |
| 1117 | as_t as; |
| 1118 | union sockunion su; |
| 1119 | |
| 1120 | bgp = vty->index; |
| 1121 | |
| 1122 | /* Get AS number. */ |
| 1123 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, 65535); |
| 1124 | |
| 1125 | /* If peer is peer group, call proper function. */ |
| 1126 | ret = str2sockunion (peer_str, &su); |
| 1127 | if (ret < 0) |
| 1128 | { |
| 1129 | ret = peer_group_remote_as (bgp, peer_str, &as); |
| 1130 | if (ret < 0) |
| 1131 | { |
| 1132 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1133 | return CMD_WARNING; |
| 1134 | } |
| 1135 | return CMD_SUCCESS; |
| 1136 | } |
| 1137 | |
| 1138 | if (peer_address_self_check (&su)) |
| 1139 | { |
| 1140 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1141 | VTY_NEWLINE); |
| 1142 | return CMD_WARNING; |
| 1143 | } |
| 1144 | |
| 1145 | ret = peer_remote_as (bgp, &su, &as, afi, safi); |
| 1146 | |
| 1147 | /* This peer belongs to peer group. */ |
| 1148 | switch (ret) |
| 1149 | { |
| 1150 | case BGP_ERR_PEER_GROUP_MEMBER: |
| 1151 | vty_out (vty, "%% Peer-group AS %d. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
| 1152 | return CMD_WARNING; |
| 1153 | break; |
| 1154 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
| 1155 | 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); |
| 1156 | return CMD_WARNING; |
| 1157 | break; |
| 1158 | } |
| 1159 | return bgp_vty_return (vty, ret); |
| 1160 | } |
| 1161 | |
| 1162 | DEFUN (neighbor_remote_as, |
| 1163 | neighbor_remote_as_cmd, |
| 1164 | NEIGHBOR_CMD2 "remote-as <1-65535>", |
| 1165 | NEIGHBOR_STR |
| 1166 | NEIGHBOR_ADDR_STR2 |
| 1167 | "Specify a BGP neighbor\n" |
| 1168 | AS_STR) |
| 1169 | { |
| 1170 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); |
| 1171 | } |
| 1172 | |
| 1173 | DEFUN (neighbor_peer_group, |
| 1174 | neighbor_peer_group_cmd, |
| 1175 | "neighbor WORD peer-group", |
| 1176 | NEIGHBOR_STR |
| 1177 | "Neighbor tag\n" |
| 1178 | "Configure peer-group\n") |
| 1179 | { |
| 1180 | struct bgp *bgp; |
| 1181 | struct peer_group *group; |
| 1182 | |
| 1183 | bgp = vty->index; |
| 1184 | |
| 1185 | group = peer_group_get (bgp, argv[0]); |
| 1186 | if (! group) |
| 1187 | return CMD_WARNING; |
| 1188 | |
| 1189 | return CMD_SUCCESS; |
| 1190 | } |
| 1191 | |
| 1192 | DEFUN (no_neighbor, |
| 1193 | no_neighbor_cmd, |
| 1194 | NO_NEIGHBOR_CMD2, |
| 1195 | NO_STR |
| 1196 | NEIGHBOR_STR |
| 1197 | NEIGHBOR_ADDR_STR2) |
| 1198 | { |
| 1199 | int ret; |
| 1200 | union sockunion su; |
| 1201 | struct peer_group *group; |
| 1202 | struct peer *peer; |
| 1203 | |
| 1204 | ret = str2sockunion (argv[0], &su); |
| 1205 | if (ret < 0) |
| 1206 | { |
| 1207 | group = peer_group_lookup (vty->index, argv[0]); |
| 1208 | if (group) |
| 1209 | peer_group_delete (group); |
| 1210 | else |
| 1211 | { |
| 1212 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1213 | return CMD_WARNING; |
| 1214 | } |
| 1215 | } |
| 1216 | else |
| 1217 | { |
| 1218 | peer = peer_lookup (vty->index, &su); |
| 1219 | if (peer) |
| 1220 | peer_delete (peer); |
| 1221 | } |
| 1222 | |
| 1223 | return CMD_SUCCESS; |
| 1224 | } |
| 1225 | |
| 1226 | ALIAS (no_neighbor, |
| 1227 | no_neighbor_remote_as_cmd, |
| 1228 | NO_NEIGHBOR_CMD "remote-as <1-65535>", |
| 1229 | NO_STR |
| 1230 | NEIGHBOR_STR |
| 1231 | NEIGHBOR_ADDR_STR |
| 1232 | "Specify a BGP neighbor\n" |
| 1233 | AS_STR) |
| 1234 | |
| 1235 | DEFUN (no_neighbor_peer_group, |
| 1236 | no_neighbor_peer_group_cmd, |
| 1237 | "no neighbor WORD peer-group", |
| 1238 | NO_STR |
| 1239 | NEIGHBOR_STR |
| 1240 | "Neighbor tag\n" |
| 1241 | "Configure peer-group\n") |
| 1242 | { |
| 1243 | struct peer_group *group; |
| 1244 | |
| 1245 | group = peer_group_lookup (vty->index, argv[0]); |
| 1246 | if (group) |
| 1247 | peer_group_delete (group); |
| 1248 | else |
| 1249 | { |
| 1250 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1251 | return CMD_WARNING; |
| 1252 | } |
| 1253 | return CMD_SUCCESS; |
| 1254 | } |
| 1255 | |
| 1256 | DEFUN (no_neighbor_peer_group_remote_as, |
| 1257 | no_neighbor_peer_group_remote_as_cmd, |
| 1258 | "no neighbor WORD remote-as <1-65535>", |
| 1259 | NO_STR |
| 1260 | NEIGHBOR_STR |
| 1261 | "Neighbor tag\n" |
| 1262 | "Specify a BGP neighbor\n" |
| 1263 | AS_STR) |
| 1264 | { |
| 1265 | struct peer_group *group; |
| 1266 | |
| 1267 | group = peer_group_lookup (vty->index, argv[0]); |
| 1268 | if (group) |
| 1269 | peer_group_remote_as_delete (group); |
| 1270 | else |
| 1271 | { |
| 1272 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1273 | return CMD_WARNING; |
| 1274 | } |
| 1275 | return CMD_SUCCESS; |
| 1276 | } |
| 1277 | |
| 1278 | DEFUN (neighbor_local_as, |
| 1279 | neighbor_local_as_cmd, |
| 1280 | NEIGHBOR_CMD2 "local-as <1-65535>", |
| 1281 | NEIGHBOR_STR |
| 1282 | NEIGHBOR_ADDR_STR2 |
| 1283 | "Specify a local-as number\n" |
| 1284 | "AS number used as local AS\n") |
| 1285 | { |
| 1286 | struct peer *peer; |
| 1287 | int ret; |
| 1288 | |
| 1289 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1290 | if (! peer) |
| 1291 | return CMD_WARNING; |
| 1292 | |
| 1293 | ret = peer_local_as_set (peer, atoi (argv[1]), 0); |
| 1294 | return bgp_vty_return (vty, ret); |
| 1295 | } |
| 1296 | |
| 1297 | DEFUN (neighbor_local_as_no_prepend, |
| 1298 | neighbor_local_as_no_prepend_cmd, |
| 1299 | NEIGHBOR_CMD2 "local-as <1-65535> no-prepend", |
| 1300 | NEIGHBOR_STR |
| 1301 | NEIGHBOR_ADDR_STR2 |
| 1302 | "Specify a local-as number\n" |
| 1303 | "AS number used as local AS\n" |
| 1304 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1305 | { |
| 1306 | struct peer *peer; |
| 1307 | int ret; |
| 1308 | |
| 1309 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1310 | if (! peer) |
| 1311 | return CMD_WARNING; |
| 1312 | |
| 1313 | ret = peer_local_as_set (peer, atoi (argv[1]), 1); |
| 1314 | return bgp_vty_return (vty, ret); |
| 1315 | } |
| 1316 | |
| 1317 | DEFUN (no_neighbor_local_as, |
| 1318 | no_neighbor_local_as_cmd, |
| 1319 | NO_NEIGHBOR_CMD2 "local-as", |
| 1320 | NO_STR |
| 1321 | NEIGHBOR_STR |
| 1322 | NEIGHBOR_ADDR_STR2 |
| 1323 | "Specify a local-as number\n") |
| 1324 | { |
| 1325 | struct peer *peer; |
| 1326 | int ret; |
| 1327 | |
| 1328 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1329 | if (! peer) |
| 1330 | return CMD_WARNING; |
| 1331 | |
| 1332 | ret = peer_local_as_unset (peer); |
| 1333 | return bgp_vty_return (vty, ret); |
| 1334 | } |
| 1335 | |
| 1336 | ALIAS (no_neighbor_local_as, |
| 1337 | no_neighbor_local_as_val_cmd, |
| 1338 | NO_NEIGHBOR_CMD2 "local-as <1-65535>", |
| 1339 | NO_STR |
| 1340 | NEIGHBOR_STR |
| 1341 | NEIGHBOR_ADDR_STR2 |
| 1342 | "Specify a local-as number\n" |
| 1343 | "AS number used as local AS\n") |
| 1344 | |
| 1345 | ALIAS (no_neighbor_local_as, |
| 1346 | no_neighbor_local_as_val2_cmd, |
| 1347 | NO_NEIGHBOR_CMD2 "local-as <1-65535> no-prepend", |
| 1348 | NO_STR |
| 1349 | NEIGHBOR_STR |
| 1350 | NEIGHBOR_ADDR_STR2 |
| 1351 | "Specify a local-as number\n" |
| 1352 | "AS number used as local AS\n" |
| 1353 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1354 | |
| 1355 | DEFUN (neighbor_activate, |
| 1356 | neighbor_activate_cmd, |
| 1357 | NEIGHBOR_CMD2 "activate", |
| 1358 | NEIGHBOR_STR |
| 1359 | NEIGHBOR_ADDR_STR2 |
| 1360 | "Enable the Address Family for this Neighbor\n") |
| 1361 | { |
| 1362 | struct peer *peer; |
| 1363 | |
| 1364 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1365 | if (! peer) |
| 1366 | return CMD_WARNING; |
| 1367 | |
| 1368 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1369 | |
| 1370 | return CMD_SUCCESS; |
| 1371 | } |
| 1372 | |
| 1373 | DEFUN (no_neighbor_activate, |
| 1374 | no_neighbor_activate_cmd, |
| 1375 | NO_NEIGHBOR_CMD2 "activate", |
| 1376 | NO_STR |
| 1377 | NEIGHBOR_STR |
| 1378 | NEIGHBOR_ADDR_STR2 |
| 1379 | "Enable the Address Family for this Neighbor\n") |
| 1380 | { |
| 1381 | int ret; |
| 1382 | struct peer *peer; |
| 1383 | |
| 1384 | /* Lookup peer. */ |
| 1385 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1386 | if (! peer) |
| 1387 | return CMD_WARNING; |
| 1388 | |
| 1389 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1390 | |
| 1391 | return bgp_vty_return (vty, ret); |
| 1392 | } |
| 1393 | |
| 1394 | DEFUN (neighbor_set_peer_group, |
| 1395 | neighbor_set_peer_group_cmd, |
| 1396 | NEIGHBOR_CMD "peer-group WORD", |
| 1397 | NEIGHBOR_STR |
| 1398 | NEIGHBOR_ADDR_STR |
| 1399 | "Member of the peer-group\n" |
| 1400 | "peer-group name\n") |
| 1401 | { |
| 1402 | int ret; |
| 1403 | as_t as; |
| 1404 | union sockunion su; |
| 1405 | struct bgp *bgp; |
| 1406 | struct peer_group *group; |
| 1407 | |
| 1408 | bgp = vty->index; |
| 1409 | |
| 1410 | ret = str2sockunion (argv[0], &su); |
| 1411 | if (ret < 0) |
| 1412 | { |
| 1413 | vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); |
| 1414 | return CMD_WARNING; |
| 1415 | } |
| 1416 | |
| 1417 | group = peer_group_lookup (bgp, argv[1]); |
| 1418 | if (! group) |
| 1419 | { |
| 1420 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1421 | return CMD_WARNING; |
| 1422 | } |
| 1423 | |
| 1424 | if (peer_address_self_check (&su)) |
| 1425 | { |
| 1426 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1427 | VTY_NEWLINE); |
| 1428 | return CMD_WARNING; |
| 1429 | } |
| 1430 | |
| 1431 | ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty), |
| 1432 | bgp_node_safi (vty), &as); |
| 1433 | |
| 1434 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) |
| 1435 | { |
| 1436 | 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); |
| 1437 | return CMD_WARNING; |
| 1438 | } |
| 1439 | |
| 1440 | return bgp_vty_return (vty, ret); |
| 1441 | } |
| 1442 | |
| 1443 | DEFUN (no_neighbor_set_peer_group, |
| 1444 | no_neighbor_set_peer_group_cmd, |
| 1445 | NO_NEIGHBOR_CMD "peer-group WORD", |
| 1446 | NO_STR |
| 1447 | NEIGHBOR_STR |
| 1448 | NEIGHBOR_ADDR_STR |
| 1449 | "Member of the peer-group\n" |
| 1450 | "peer-group name\n") |
| 1451 | { |
| 1452 | int ret; |
| 1453 | struct bgp *bgp; |
| 1454 | struct peer *peer; |
| 1455 | struct peer_group *group; |
| 1456 | |
| 1457 | bgp = vty->index; |
| 1458 | |
| 1459 | peer = peer_lookup_vty (vty, argv[0]); |
| 1460 | if (! peer) |
| 1461 | return CMD_WARNING; |
| 1462 | |
| 1463 | group = peer_group_lookup (bgp, argv[1]); |
| 1464 | if (! group) |
| 1465 | { |
| 1466 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1467 | return CMD_WARNING; |
| 1468 | } |
| 1469 | |
| 1470 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), |
| 1471 | bgp_node_safi (vty)); |
| 1472 | |
| 1473 | return bgp_vty_return (vty, ret); |
| 1474 | } |
| 1475 | |
| 1476 | int |
| 1477 | peer_flag_modify_vty (struct vty *vty, char *ip_str, u_int16_t flag, int set) |
| 1478 | { |
| 1479 | int ret; |
| 1480 | struct peer *peer; |
| 1481 | |
| 1482 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 1483 | if (! peer) |
| 1484 | return CMD_WARNING; |
| 1485 | |
| 1486 | if (set) |
| 1487 | ret = peer_flag_set (peer, flag); |
| 1488 | else |
| 1489 | ret = peer_flag_unset (peer, flag); |
| 1490 | |
| 1491 | return bgp_vty_return (vty, ret); |
| 1492 | } |
| 1493 | |
| 1494 | int |
| 1495 | peer_flag_set_vty (struct vty *vty, char *ip_str, u_int16_t flag) |
| 1496 | { |
| 1497 | return peer_flag_modify_vty (vty, ip_str, flag, 1); |
| 1498 | } |
| 1499 | |
| 1500 | int |
| 1501 | peer_flag_unset_vty (struct vty *vty, char *ip_str, u_int16_t flag) |
| 1502 | { |
| 1503 | return peer_flag_modify_vty (vty, ip_str, flag, 0); |
| 1504 | } |
| 1505 | |
| 1506 | /* neighbor passive. */ |
| 1507 | DEFUN (neighbor_passive, |
| 1508 | neighbor_passive_cmd, |
| 1509 | NEIGHBOR_CMD2 "passive", |
| 1510 | NEIGHBOR_STR |
| 1511 | NEIGHBOR_ADDR_STR2 |
| 1512 | "Don't send open messages to this neighbor\n") |
| 1513 | { |
| 1514 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1515 | } |
| 1516 | |
| 1517 | DEFUN (no_neighbor_passive, |
| 1518 | no_neighbor_passive_cmd, |
| 1519 | NO_NEIGHBOR_CMD2 "passive", |
| 1520 | NO_STR |
| 1521 | NEIGHBOR_STR |
| 1522 | NEIGHBOR_ADDR_STR2 |
| 1523 | "Don't send open messages to this neighbor\n") |
| 1524 | { |
| 1525 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1526 | } |
| 1527 | |
| 1528 | /* neighbor shutdown. */ |
| 1529 | DEFUN (neighbor_shutdown, |
| 1530 | neighbor_shutdown_cmd, |
| 1531 | NEIGHBOR_CMD2 "shutdown", |
| 1532 | NEIGHBOR_STR |
| 1533 | NEIGHBOR_ADDR_STR2 |
| 1534 | "Administratively shut down this neighbor\n") |
| 1535 | { |
| 1536 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1537 | } |
| 1538 | |
| 1539 | DEFUN (no_neighbor_shutdown, |
| 1540 | no_neighbor_shutdown_cmd, |
| 1541 | NO_NEIGHBOR_CMD2 "shutdown", |
| 1542 | NO_STR |
| 1543 | NEIGHBOR_STR |
| 1544 | NEIGHBOR_ADDR_STR2 |
| 1545 | "Administratively shut down this neighbor\n") |
| 1546 | { |
| 1547 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1548 | } |
| 1549 | |
| 1550 | /* neighbor capability route-refresh. */ |
| 1551 | DEFUN (neighbor_capability_route_refresh, |
| 1552 | neighbor_capability_route_refresh_cmd, |
| 1553 | NEIGHBOR_CMD2 "capability route-refresh", |
| 1554 | NEIGHBOR_STR |
| 1555 | NEIGHBOR_ADDR_STR2 |
| 1556 | "Advertise capability to the peer\n" |
| 1557 | "Advertise route-refresh capability to this neighbor\n") |
| 1558 | { |
| 1559 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_NO_ROUTE_REFRESH_CAP); |
| 1560 | } |
| 1561 | |
| 1562 | DEFUN (no_neighbor_capability_route_refresh, |
| 1563 | no_neighbor_capability_route_refresh_cmd, |
| 1564 | NO_NEIGHBOR_CMD2 "capability route-refresh", |
| 1565 | NO_STR |
| 1566 | NEIGHBOR_STR |
| 1567 | NEIGHBOR_ADDR_STR2 |
| 1568 | "Advertise capability to the peer\n" |
| 1569 | "Advertise route-refresh capability to this neighbor\n") |
| 1570 | { |
| 1571 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_NO_ROUTE_REFRESH_CAP); |
| 1572 | } |
| 1573 | |
| 1574 | /* neighbor capability dynamic. */ |
| 1575 | DEFUN (neighbor_capability_dynamic, |
| 1576 | neighbor_capability_dynamic_cmd, |
| 1577 | NEIGHBOR_CMD2 "capability dynamic", |
| 1578 | NEIGHBOR_STR |
| 1579 | NEIGHBOR_ADDR_STR2 |
| 1580 | "Advertise capability to the peer\n" |
| 1581 | "Advertise dynamic capability to this neighbor\n") |
| 1582 | { |
| 1583 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1584 | } |
| 1585 | |
| 1586 | DEFUN (no_neighbor_capability_dynamic, |
| 1587 | no_neighbor_capability_dynamic_cmd, |
| 1588 | NO_NEIGHBOR_CMD2 "capability dynamic", |
| 1589 | NO_STR |
| 1590 | NEIGHBOR_STR |
| 1591 | NEIGHBOR_ADDR_STR2 |
| 1592 | "Advertise capability to the peer\n" |
| 1593 | "Advertise dynamic capability to this neighbor\n") |
| 1594 | { |
| 1595 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1596 | } |
| 1597 | |
| 1598 | /* neighbor dont-capability-negotiate */ |
| 1599 | DEFUN (neighbor_dont_capability_negotiate, |
| 1600 | neighbor_dont_capability_negotiate_cmd, |
| 1601 | NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1602 | NEIGHBOR_STR |
| 1603 | NEIGHBOR_ADDR_STR2 |
| 1604 | "Do not perform capability negotiation\n") |
| 1605 | { |
| 1606 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1607 | } |
| 1608 | |
| 1609 | DEFUN (no_neighbor_dont_capability_negotiate, |
| 1610 | no_neighbor_dont_capability_negotiate_cmd, |
| 1611 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1612 | NO_STR |
| 1613 | NEIGHBOR_STR |
| 1614 | NEIGHBOR_ADDR_STR2 |
| 1615 | "Do not perform capability negotiation\n") |
| 1616 | { |
| 1617 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1618 | } |
| 1619 | |
| 1620 | int |
| 1621 | peer_af_flag_modify_vty (struct vty *vty, char *peer_str, afi_t afi, |
| 1622 | safi_t safi, u_int16_t flag, int set) |
| 1623 | { |
| 1624 | int ret; |
| 1625 | struct peer *peer; |
| 1626 | |
| 1627 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 1628 | if (! peer) |
| 1629 | return CMD_WARNING; |
| 1630 | |
| 1631 | if (set) |
| 1632 | ret = peer_af_flag_set (peer, afi, safi, flag); |
| 1633 | else |
| 1634 | ret = peer_af_flag_unset (peer, afi, safi, flag); |
| 1635 | |
| 1636 | return bgp_vty_return (vty, ret); |
| 1637 | } |
| 1638 | |
| 1639 | int |
| 1640 | peer_af_flag_set_vty (struct vty *vty, char *peer_str, afi_t afi, |
| 1641 | safi_t safi, u_int16_t flag) |
| 1642 | { |
| 1643 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); |
| 1644 | } |
| 1645 | |
| 1646 | int |
| 1647 | peer_af_flag_unset_vty (struct vty *vty, char *peer_str, afi_t afi, |
| 1648 | safi_t safi, u_int16_t flag) |
| 1649 | { |
| 1650 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); |
| 1651 | } |
| 1652 | |
| 1653 | /* neighbor capability orf prefix-list. */ |
| 1654 | DEFUN (neighbor_capability_orf_prefix, |
| 1655 | neighbor_capability_orf_prefix_cmd, |
| 1656 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 1657 | NEIGHBOR_STR |
| 1658 | NEIGHBOR_ADDR_STR2 |
| 1659 | "Advertise capability to the peer\n" |
| 1660 | "Advertise ORF capability to the peer\n" |
| 1661 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 1662 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 1663 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 1664 | "Capability to SEND the ORF to this neighbor\n") |
| 1665 | { |
| 1666 | u_int16_t flag = 0; |
| 1667 | |
| 1668 | if (strncmp (argv[1], "s", 1) == 0) |
| 1669 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 1670 | else if (strncmp (argv[1], "r", 1) == 0) |
| 1671 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 1672 | else if (strncmp (argv[1], "b", 1) == 0) |
| 1673 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 1674 | else |
| 1675 | return CMD_WARNING; |
| 1676 | |
| 1677 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1678 | bgp_node_safi (vty), flag); |
| 1679 | } |
| 1680 | |
| 1681 | DEFUN (no_neighbor_capability_orf_prefix, |
| 1682 | no_neighbor_capability_orf_prefix_cmd, |
| 1683 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 1684 | NO_STR |
| 1685 | NEIGHBOR_STR |
| 1686 | NEIGHBOR_ADDR_STR2 |
| 1687 | "Advertise capability to the peer\n" |
| 1688 | "Advertise ORF capability to the peer\n" |
| 1689 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 1690 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 1691 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 1692 | "Capability to SEND the ORF to this neighbor\n") |
| 1693 | { |
| 1694 | u_int16_t flag = 0; |
| 1695 | |
| 1696 | if (strncmp (argv[1], "s", 1) == 0) |
| 1697 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 1698 | else if (strncmp (argv[1], "r", 1) == 0) |
| 1699 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 1700 | else if (strncmp (argv[1], "b", 1) == 0) |
| 1701 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 1702 | else |
| 1703 | return CMD_WARNING; |
| 1704 | |
| 1705 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1706 | bgp_node_safi (vty), flag); |
| 1707 | } |
| 1708 | |
| 1709 | /* neighbor next-hop-self. */ |
| 1710 | DEFUN (neighbor_nexthop_self, |
| 1711 | neighbor_nexthop_self_cmd, |
| 1712 | NEIGHBOR_CMD2 "next-hop-self", |
| 1713 | NEIGHBOR_STR |
| 1714 | NEIGHBOR_ADDR_STR2 |
| 1715 | "Disable the next hop calculation for this neighbor\n") |
| 1716 | { |
| 1717 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1718 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 1719 | } |
| 1720 | |
| 1721 | DEFUN (no_neighbor_nexthop_self, |
| 1722 | no_neighbor_nexthop_self_cmd, |
| 1723 | NO_NEIGHBOR_CMD2 "next-hop-self", |
| 1724 | NO_STR |
| 1725 | NEIGHBOR_STR |
| 1726 | NEIGHBOR_ADDR_STR2 |
| 1727 | "Disable the next hop calculation for this neighbor\n") |
| 1728 | { |
| 1729 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1730 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 1731 | } |
| 1732 | |
| 1733 | /* neighbor remove-private-AS. */ |
| 1734 | DEFUN (neighbor_remove_private_as, |
| 1735 | neighbor_remove_private_as_cmd, |
| 1736 | NEIGHBOR_CMD2 "remove-private-AS", |
| 1737 | NEIGHBOR_STR |
| 1738 | NEIGHBOR_ADDR_STR2 |
| 1739 | "Remove private AS number from outbound updates\n") |
| 1740 | { |
| 1741 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1742 | bgp_node_safi (vty), |
| 1743 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 1744 | } |
| 1745 | |
| 1746 | DEFUN (no_neighbor_remove_private_as, |
| 1747 | no_neighbor_remove_private_as_cmd, |
| 1748 | NO_NEIGHBOR_CMD2 "remove-private-AS", |
| 1749 | NO_STR |
| 1750 | NEIGHBOR_STR |
| 1751 | NEIGHBOR_ADDR_STR2 |
| 1752 | "Remove private AS number from outbound updates\n") |
| 1753 | { |
| 1754 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1755 | bgp_node_safi (vty), |
| 1756 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 1757 | } |
| 1758 | |
| 1759 | /* neighbor send-community. */ |
| 1760 | DEFUN (neighbor_send_community, |
| 1761 | neighbor_send_community_cmd, |
| 1762 | NEIGHBOR_CMD2 "send-community", |
| 1763 | NEIGHBOR_STR |
| 1764 | NEIGHBOR_ADDR_STR2 |
| 1765 | "Send Community attribute to this neighbor\n") |
| 1766 | { |
| 1767 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1768 | bgp_node_safi (vty), |
| 1769 | PEER_FLAG_SEND_COMMUNITY); |
| 1770 | } |
| 1771 | |
| 1772 | DEFUN (no_neighbor_send_community, |
| 1773 | no_neighbor_send_community_cmd, |
| 1774 | NO_NEIGHBOR_CMD2 "send-community", |
| 1775 | NO_STR |
| 1776 | NEIGHBOR_STR |
| 1777 | NEIGHBOR_ADDR_STR2 |
| 1778 | "Send Community attribute to this neighbor\n") |
| 1779 | { |
| 1780 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1781 | bgp_node_safi (vty), |
| 1782 | PEER_FLAG_SEND_COMMUNITY); |
| 1783 | } |
| 1784 | |
| 1785 | /* neighbor send-community extended. */ |
| 1786 | DEFUN (neighbor_send_community_type, |
| 1787 | neighbor_send_community_type_cmd, |
| 1788 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 1789 | NEIGHBOR_STR |
| 1790 | NEIGHBOR_ADDR_STR2 |
| 1791 | "Send Community attribute to this neighbor\n" |
| 1792 | "Send Standard and Extended Community attributes\n" |
| 1793 | "Send Extended Community attributes\n" |
| 1794 | "Send Standard Community attributes\n") |
| 1795 | { |
| 1796 | if (strncmp (argv[1], "s", 1) == 0) |
| 1797 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1798 | bgp_node_safi (vty), |
| 1799 | PEER_FLAG_SEND_COMMUNITY); |
| 1800 | if (strncmp (argv[1], "e", 1) == 0) |
| 1801 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1802 | bgp_node_safi (vty), |
| 1803 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 1804 | |
| 1805 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1806 | bgp_node_safi (vty), |
| 1807 | (PEER_FLAG_SEND_COMMUNITY| |
| 1808 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 1809 | } |
| 1810 | |
| 1811 | DEFUN (no_neighbor_send_community_type, |
| 1812 | no_neighbor_send_community_type_cmd, |
| 1813 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 1814 | NO_STR |
| 1815 | NEIGHBOR_STR |
| 1816 | NEIGHBOR_ADDR_STR2 |
| 1817 | "Send Community attribute to this neighbor\n" |
| 1818 | "Send Standard and Extended Community attributes\n" |
| 1819 | "Send Extended Community attributes\n" |
| 1820 | "Send Standard Community attributes\n") |
| 1821 | { |
| 1822 | if (strncmp (argv[1], "s", 1) == 0) |
| 1823 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1824 | bgp_node_safi (vty), |
| 1825 | PEER_FLAG_SEND_COMMUNITY); |
| 1826 | if (strncmp (argv[1], "e", 1) == 0) |
| 1827 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1828 | bgp_node_safi (vty), |
| 1829 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 1830 | |
| 1831 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1832 | bgp_node_safi (vty), |
| 1833 | (PEER_FLAG_SEND_COMMUNITY | |
| 1834 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 1835 | } |
| 1836 | |
| 1837 | /* neighbor soft-reconfig. */ |
| 1838 | DEFUN (neighbor_soft_reconfiguration, |
| 1839 | neighbor_soft_reconfiguration_cmd, |
| 1840 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 1841 | NEIGHBOR_STR |
| 1842 | NEIGHBOR_ADDR_STR2 |
| 1843 | "Per neighbor soft reconfiguration\n" |
| 1844 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 1845 | { |
| 1846 | return peer_af_flag_set_vty (vty, argv[0], |
| 1847 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 1848 | PEER_FLAG_SOFT_RECONFIG); |
| 1849 | } |
| 1850 | |
| 1851 | DEFUN (no_neighbor_soft_reconfiguration, |
| 1852 | no_neighbor_soft_reconfiguration_cmd, |
| 1853 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 1854 | NO_STR |
| 1855 | NEIGHBOR_STR |
| 1856 | NEIGHBOR_ADDR_STR2 |
| 1857 | "Per neighbor soft reconfiguration\n" |
| 1858 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 1859 | { |
| 1860 | return peer_af_flag_unset_vty (vty, argv[0], |
| 1861 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 1862 | PEER_FLAG_SOFT_RECONFIG); |
| 1863 | } |
| 1864 | |
| 1865 | DEFUN (neighbor_route_reflector_client, |
| 1866 | neighbor_route_reflector_client_cmd, |
| 1867 | NEIGHBOR_CMD2 "route-reflector-client", |
| 1868 | NEIGHBOR_STR |
| 1869 | NEIGHBOR_ADDR_STR2 |
| 1870 | "Configure a neighbor as Route Reflector client\n") |
| 1871 | { |
| 1872 | struct peer *peer; |
| 1873 | |
| 1874 | |
| 1875 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1876 | if (! peer) |
| 1877 | return CMD_WARNING; |
| 1878 | |
| 1879 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1880 | bgp_node_safi (vty), |
| 1881 | PEER_FLAG_REFLECTOR_CLIENT); |
| 1882 | } |
| 1883 | |
| 1884 | DEFUN (no_neighbor_route_reflector_client, |
| 1885 | no_neighbor_route_reflector_client_cmd, |
| 1886 | NO_NEIGHBOR_CMD2 "route-reflector-client", |
| 1887 | NO_STR |
| 1888 | NEIGHBOR_STR |
| 1889 | NEIGHBOR_ADDR_STR2 |
| 1890 | "Configure a neighbor as Route Reflector client\n") |
| 1891 | { |
| 1892 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1893 | bgp_node_safi (vty), |
| 1894 | PEER_FLAG_REFLECTOR_CLIENT); |
| 1895 | } |
| 1896 | |
| 1897 | /* neighbor route-server-client. */ |
| 1898 | DEFUN (neighbor_route_server_client, |
| 1899 | neighbor_route_server_client_cmd, |
| 1900 | NEIGHBOR_CMD2 "route-server-client", |
| 1901 | NEIGHBOR_STR |
| 1902 | NEIGHBOR_ADDR_STR2 |
| 1903 | "Configure a neighbor as Route Server client\n") |
| 1904 | { |
| 1905 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1906 | bgp_node_safi (vty), |
| 1907 | PEER_FLAG_RSERVER_CLIENT); |
| 1908 | } |
| 1909 | |
| 1910 | DEFUN (no_neighbor_route_server_client, |
| 1911 | no_neighbor_route_server_client_cmd, |
| 1912 | NO_NEIGHBOR_CMD2 "route-server-client", |
| 1913 | NO_STR |
| 1914 | NEIGHBOR_STR |
| 1915 | NEIGHBOR_ADDR_STR2 |
| 1916 | "Configure a neighbor as Route Server client\n") |
| 1917 | { |
| 1918 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1919 | bgp_node_safi (vty), |
| 1920 | PEER_FLAG_RSERVER_CLIENT); |
| 1921 | } |
| 1922 | |
| 1923 | DEFUN (neighbor_attr_unchanged, |
| 1924 | neighbor_attr_unchanged_cmd, |
| 1925 | NEIGHBOR_CMD2 "attribute-unchanged", |
| 1926 | NEIGHBOR_STR |
| 1927 | NEIGHBOR_ADDR_STR2 |
| 1928 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 1929 | { |
| 1930 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1931 | bgp_node_safi (vty), |
| 1932 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 1933 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 1934 | PEER_FLAG_MED_UNCHANGED)); |
| 1935 | } |
| 1936 | |
| 1937 | DEFUN (neighbor_attr_unchanged1, |
| 1938 | neighbor_attr_unchanged1_cmd, |
| 1939 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 1940 | NEIGHBOR_STR |
| 1941 | NEIGHBOR_ADDR_STR2 |
| 1942 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 1943 | "As-path attribute\n" |
| 1944 | "Nexthop attribute\n" |
| 1945 | "Med attribute\n") |
| 1946 | { |
| 1947 | u_int16_t flags = 0; |
| 1948 | |
| 1949 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 1950 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 1951 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 1952 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 1953 | else if (strncmp (argv[1], "med", 1) == 0) |
| 1954 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 1955 | |
| 1956 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1957 | bgp_node_safi (vty), flags); |
| 1958 | } |
| 1959 | |
| 1960 | DEFUN (neighbor_attr_unchanged2, |
| 1961 | neighbor_attr_unchanged2_cmd, |
| 1962 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 1963 | NEIGHBOR_STR |
| 1964 | NEIGHBOR_ADDR_STR2 |
| 1965 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 1966 | "As-path attribute\n" |
| 1967 | "Nexthop attribute\n" |
| 1968 | "Med attribute\n") |
| 1969 | { |
| 1970 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 1971 | |
| 1972 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 1973 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 1974 | else if (strncmp (argv[1], "med", 1) == 0) |
| 1975 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 1976 | |
| 1977 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1978 | bgp_node_safi (vty), flags); |
| 1979 | |
| 1980 | } |
| 1981 | |
| 1982 | DEFUN (neighbor_attr_unchanged3, |
| 1983 | neighbor_attr_unchanged3_cmd, |
| 1984 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 1985 | NEIGHBOR_STR |
| 1986 | NEIGHBOR_ADDR_STR2 |
| 1987 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 1988 | "Nexthop attribute\n" |
| 1989 | "As-path attribute\n" |
| 1990 | "Med attribute\n") |
| 1991 | { |
| 1992 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 1993 | |
| 1994 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 1995 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 1996 | else if (strncmp (argv[1], "med", 1) == 0) |
| 1997 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 1998 | |
| 1999 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2000 | bgp_node_safi (vty), flags); |
| 2001 | } |
| 2002 | |
| 2003 | DEFUN (neighbor_attr_unchanged4, |
| 2004 | neighbor_attr_unchanged4_cmd, |
| 2005 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2006 | NEIGHBOR_STR |
| 2007 | NEIGHBOR_ADDR_STR2 |
| 2008 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2009 | "Med attribute\n" |
| 2010 | "As-path attribute\n" |
| 2011 | "Nexthop attribute\n") |
| 2012 | { |
| 2013 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2014 | |
| 2015 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2016 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2017 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2018 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2019 | |
| 2020 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2021 | bgp_node_safi (vty), flags); |
| 2022 | } |
| 2023 | |
| 2024 | ALIAS (neighbor_attr_unchanged, |
| 2025 | neighbor_attr_unchanged5_cmd, |
| 2026 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2027 | NEIGHBOR_STR |
| 2028 | NEIGHBOR_ADDR_STR2 |
| 2029 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2030 | "As-path attribute\n" |
| 2031 | "Nexthop attribute\n" |
| 2032 | "Med attribute\n") |
| 2033 | |
| 2034 | ALIAS (neighbor_attr_unchanged, |
| 2035 | neighbor_attr_unchanged6_cmd, |
| 2036 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2037 | NEIGHBOR_STR |
| 2038 | NEIGHBOR_ADDR_STR2 |
| 2039 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2040 | "As-path attribute\n" |
| 2041 | "Med attribute\n" |
| 2042 | "Nexthop attribute\n") |
| 2043 | |
| 2044 | ALIAS (neighbor_attr_unchanged, |
| 2045 | neighbor_attr_unchanged7_cmd, |
| 2046 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2047 | NEIGHBOR_STR |
| 2048 | NEIGHBOR_ADDR_STR2 |
| 2049 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2050 | "Nexthop attribute\n" |
| 2051 | "Med attribute\n" |
| 2052 | "As-path attribute\n") |
| 2053 | |
| 2054 | ALIAS (neighbor_attr_unchanged, |
| 2055 | neighbor_attr_unchanged8_cmd, |
| 2056 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2057 | NEIGHBOR_STR |
| 2058 | NEIGHBOR_ADDR_STR2 |
| 2059 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2060 | "Nexthop attribute\n" |
| 2061 | "As-path attribute\n" |
| 2062 | "Med attribute\n") |
| 2063 | |
| 2064 | ALIAS (neighbor_attr_unchanged, |
| 2065 | neighbor_attr_unchanged9_cmd, |
| 2066 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2067 | NEIGHBOR_STR |
| 2068 | NEIGHBOR_ADDR_STR2 |
| 2069 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2070 | "Med attribute\n" |
| 2071 | "Nexthop attribute\n" |
| 2072 | "As-path attribute\n") |
| 2073 | |
| 2074 | ALIAS (neighbor_attr_unchanged, |
| 2075 | neighbor_attr_unchanged10_cmd, |
| 2076 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2077 | NEIGHBOR_STR |
| 2078 | NEIGHBOR_ADDR_STR2 |
| 2079 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2080 | "Med attribute\n" |
| 2081 | "As-path attribute\n" |
| 2082 | "Nexthop attribute\n") |
| 2083 | |
| 2084 | DEFUN (no_neighbor_attr_unchanged, |
| 2085 | no_neighbor_attr_unchanged_cmd, |
| 2086 | NO_NEIGHBOR_CMD2 "attribute-unchanged", |
| 2087 | NO_STR |
| 2088 | NEIGHBOR_STR |
| 2089 | NEIGHBOR_ADDR_STR2 |
| 2090 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2091 | { |
| 2092 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2093 | bgp_node_safi (vty), |
| 2094 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2095 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2096 | PEER_FLAG_MED_UNCHANGED)); |
| 2097 | } |
| 2098 | |
| 2099 | DEFUN (no_neighbor_attr_unchanged1, |
| 2100 | no_neighbor_attr_unchanged1_cmd, |
| 2101 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2102 | NO_STR |
| 2103 | NEIGHBOR_STR |
| 2104 | NEIGHBOR_ADDR_STR2 |
| 2105 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2106 | "As-path attribute\n" |
| 2107 | "Nexthop attribute\n" |
| 2108 | "Med attribute\n") |
| 2109 | { |
| 2110 | u_int16_t flags = 0; |
| 2111 | |
| 2112 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2113 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2114 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2115 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2116 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2117 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2118 | |
| 2119 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2120 | bgp_node_safi (vty), flags); |
| 2121 | } |
| 2122 | |
| 2123 | DEFUN (no_neighbor_attr_unchanged2, |
| 2124 | no_neighbor_attr_unchanged2_cmd, |
| 2125 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2126 | NO_STR |
| 2127 | NEIGHBOR_STR |
| 2128 | NEIGHBOR_ADDR_STR2 |
| 2129 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2130 | "As-path attribute\n" |
| 2131 | "Nexthop attribute\n" |
| 2132 | "Med attribute\n") |
| 2133 | { |
| 2134 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2135 | |
| 2136 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2137 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2138 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2139 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2140 | |
| 2141 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2142 | bgp_node_safi (vty), flags); |
| 2143 | } |
| 2144 | |
| 2145 | DEFUN (no_neighbor_attr_unchanged3, |
| 2146 | no_neighbor_attr_unchanged3_cmd, |
| 2147 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2148 | NO_STR |
| 2149 | NEIGHBOR_STR |
| 2150 | NEIGHBOR_ADDR_STR2 |
| 2151 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2152 | "Nexthop attribute\n" |
| 2153 | "As-path attribute\n" |
| 2154 | "Med attribute\n") |
| 2155 | { |
| 2156 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2157 | |
| 2158 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2159 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2160 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2161 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2162 | |
| 2163 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2164 | bgp_node_safi (vty), flags); |
| 2165 | } |
| 2166 | |
| 2167 | DEFUN (no_neighbor_attr_unchanged4, |
| 2168 | no_neighbor_attr_unchanged4_cmd, |
| 2169 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2170 | NO_STR |
| 2171 | NEIGHBOR_STR |
| 2172 | NEIGHBOR_ADDR_STR2 |
| 2173 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2174 | "Med attribute\n" |
| 2175 | "As-path attribute\n" |
| 2176 | "Nexthop attribute\n") |
| 2177 | { |
| 2178 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2179 | |
| 2180 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2181 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2182 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2183 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2184 | |
| 2185 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2186 | bgp_node_safi (vty), flags); |
| 2187 | } |
| 2188 | |
| 2189 | ALIAS (no_neighbor_attr_unchanged, |
| 2190 | no_neighbor_attr_unchanged5_cmd, |
| 2191 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2192 | NO_STR |
| 2193 | NEIGHBOR_STR |
| 2194 | NEIGHBOR_ADDR_STR2 |
| 2195 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2196 | "As-path attribute\n" |
| 2197 | "Nexthop attribute\n" |
| 2198 | "Med attribute\n") |
| 2199 | |
| 2200 | ALIAS (no_neighbor_attr_unchanged, |
| 2201 | no_neighbor_attr_unchanged6_cmd, |
| 2202 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2203 | NO_STR |
| 2204 | NEIGHBOR_STR |
| 2205 | NEIGHBOR_ADDR_STR2 |
| 2206 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2207 | "As-path attribute\n" |
| 2208 | "Med attribute\n" |
| 2209 | "Nexthop attribute\n") |
| 2210 | |
| 2211 | ALIAS (no_neighbor_attr_unchanged, |
| 2212 | no_neighbor_attr_unchanged7_cmd, |
| 2213 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2214 | NO_STR |
| 2215 | NEIGHBOR_STR |
| 2216 | NEIGHBOR_ADDR_STR2 |
| 2217 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2218 | "Nexthop attribute\n" |
| 2219 | "Med attribute\n" |
| 2220 | "As-path attribute\n") |
| 2221 | |
| 2222 | ALIAS (no_neighbor_attr_unchanged, |
| 2223 | no_neighbor_attr_unchanged8_cmd, |
| 2224 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2225 | NO_STR |
| 2226 | NEIGHBOR_STR |
| 2227 | NEIGHBOR_ADDR_STR2 |
| 2228 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2229 | "Nexthop attribute\n" |
| 2230 | "As-path attribute\n" |
| 2231 | "Med attribute\n") |
| 2232 | |
| 2233 | ALIAS (no_neighbor_attr_unchanged, |
| 2234 | no_neighbor_attr_unchanged9_cmd, |
| 2235 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2236 | NO_STR |
| 2237 | NEIGHBOR_STR |
| 2238 | NEIGHBOR_ADDR_STR2 |
| 2239 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2240 | "Med attribute\n" |
| 2241 | "Nexthop attribute\n" |
| 2242 | "As-path attribute\n") |
| 2243 | |
| 2244 | ALIAS (no_neighbor_attr_unchanged, |
| 2245 | no_neighbor_attr_unchanged10_cmd, |
| 2246 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2247 | NO_STR |
| 2248 | NEIGHBOR_STR |
| 2249 | NEIGHBOR_ADDR_STR2 |
| 2250 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2251 | "Med attribute\n" |
| 2252 | "As-path attribute\n" |
| 2253 | "Nexthop attribute\n") |
| 2254 | |
| 2255 | /* For old version Zebra compatibility. */ |
| 2256 | DEFUN (neighbor_transparent_as, |
| 2257 | neighbor_transparent_as_cmd, |
| 2258 | NEIGHBOR_CMD "transparent-as", |
| 2259 | NEIGHBOR_STR |
| 2260 | NEIGHBOR_ADDR_STR |
| 2261 | "Do not append my AS number even peer is EBGP peer\n") |
| 2262 | { |
| 2263 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2264 | bgp_node_safi (vty), |
| 2265 | PEER_FLAG_AS_PATH_UNCHANGED); |
| 2266 | } |
| 2267 | |
| 2268 | DEFUN (neighbor_transparent_nexthop, |
| 2269 | neighbor_transparent_nexthop_cmd, |
| 2270 | NEIGHBOR_CMD "transparent-nexthop", |
| 2271 | NEIGHBOR_STR |
| 2272 | NEIGHBOR_ADDR_STR |
| 2273 | "Do not change nexthop even peer is EBGP peer\n") |
| 2274 | { |
| 2275 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2276 | bgp_node_safi (vty), |
| 2277 | PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2278 | } |
| 2279 | |
| 2280 | /* EBGP multihop configuration. */ |
| 2281 | int |
| 2282 | peer_ebgp_multihop_set_vty (struct vty *vty, char *ip_str, char *ttl_str) |
| 2283 | { |
| 2284 | struct peer *peer; |
| 2285 | int ttl; |
| 2286 | |
| 2287 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2288 | if (! peer) |
| 2289 | return CMD_WARNING; |
| 2290 | |
| 2291 | if (! ttl_str) |
| 2292 | ttl = TTL_MAX; |
| 2293 | else |
| 2294 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); |
| 2295 | |
| 2296 | peer_ebgp_multihop_set (peer, ttl); |
| 2297 | |
| 2298 | return CMD_SUCCESS; |
| 2299 | } |
| 2300 | |
| 2301 | int |
| 2302 | peer_ebgp_multihop_unset_vty (struct vty *vty, char *ip_str) |
| 2303 | { |
| 2304 | struct peer *peer; |
| 2305 | |
| 2306 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2307 | if (! peer) |
| 2308 | return CMD_WARNING; |
| 2309 | |
| 2310 | peer_ebgp_multihop_unset (peer); |
| 2311 | |
| 2312 | return CMD_SUCCESS; |
| 2313 | } |
| 2314 | |
| 2315 | /* neighbor ebgp-multihop. */ |
| 2316 | DEFUN (neighbor_ebgp_multihop, |
| 2317 | neighbor_ebgp_multihop_cmd, |
| 2318 | NEIGHBOR_CMD2 "ebgp-multihop", |
| 2319 | NEIGHBOR_STR |
| 2320 | NEIGHBOR_ADDR_STR2 |
| 2321 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2322 | { |
| 2323 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); |
| 2324 | } |
| 2325 | |
| 2326 | DEFUN (neighbor_ebgp_multihop_ttl, |
| 2327 | neighbor_ebgp_multihop_ttl_cmd, |
| 2328 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2329 | NEIGHBOR_STR |
| 2330 | NEIGHBOR_ADDR_STR2 |
| 2331 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2332 | "maximum hop count\n") |
| 2333 | { |
| 2334 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); |
| 2335 | } |
| 2336 | |
| 2337 | DEFUN (no_neighbor_ebgp_multihop, |
| 2338 | no_neighbor_ebgp_multihop_cmd, |
| 2339 | NO_NEIGHBOR_CMD2 "ebgp-multihop", |
| 2340 | NO_STR |
| 2341 | NEIGHBOR_STR |
| 2342 | NEIGHBOR_ADDR_STR2 |
| 2343 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2344 | { |
| 2345 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); |
| 2346 | } |
| 2347 | |
| 2348 | ALIAS (no_neighbor_ebgp_multihop, |
| 2349 | no_neighbor_ebgp_multihop_ttl_cmd, |
| 2350 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2351 | NO_STR |
| 2352 | NEIGHBOR_STR |
| 2353 | NEIGHBOR_ADDR_STR2 |
| 2354 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2355 | "maximum hop count\n") |
| 2356 | |
| 2357 | /* Enforce multihop. */ |
| 2358 | DEFUN (neighbor_enforce_multihop, |
| 2359 | neighbor_enforce_multihop_cmd, |
| 2360 | NEIGHBOR_CMD2 "enforce-multihop", |
| 2361 | NEIGHBOR_STR |
| 2362 | NEIGHBOR_ADDR_STR2 |
| 2363 | "Enforce EBGP neighbors perform multihop\n") |
| 2364 | { |
| 2365 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_ENFORCE_MULTIHOP); |
| 2366 | } |
| 2367 | |
| 2368 | DEFUN (no_neighbor_enforce_multihop, |
| 2369 | no_neighbor_enforce_multihop_cmd, |
| 2370 | NO_NEIGHBOR_CMD2 "enforce-multihop", |
| 2371 | NO_STR |
| 2372 | NEIGHBOR_STR |
| 2373 | NEIGHBOR_ADDR_STR2 |
| 2374 | "Enforce EBGP neighbors perform multihop\n") |
| 2375 | { |
| 2376 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_ENFORCE_MULTIHOP); |
| 2377 | } |
| 2378 | |
| 2379 | DEFUN (neighbor_description, |
| 2380 | neighbor_description_cmd, |
| 2381 | NEIGHBOR_CMD2 "description .LINE", |
| 2382 | NEIGHBOR_STR |
| 2383 | NEIGHBOR_ADDR_STR2 |
| 2384 | "Neighbor specific description\n" |
| 2385 | "Up to 80 characters describing this neighbor\n") |
| 2386 | { |
| 2387 | struct peer *peer; |
| 2388 | struct buffer *b; |
| 2389 | char *str; |
| 2390 | int i; |
| 2391 | |
| 2392 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2393 | if (! peer) |
| 2394 | return CMD_WARNING; |
| 2395 | |
| 2396 | if (argc == 1) |
| 2397 | return CMD_SUCCESS; |
| 2398 | |
| 2399 | /* Make string from buffer. This function should be provided by |
| 2400 | buffer.c. */ |
| 2401 | b = buffer_new (1024); |
| 2402 | for (i = 1; i < argc; i++) |
| 2403 | { |
| 2404 | buffer_putstr (b, (u_char *)argv[i]); |
| 2405 | buffer_putc (b, ' '); |
| 2406 | } |
| 2407 | buffer_putc (b, '\0'); |
| 2408 | str = buffer_getstr (b); |
| 2409 | buffer_free (b); |
| 2410 | |
| 2411 | peer_description_set (peer, str); |
| 2412 | |
| 2413 | free (str); |
| 2414 | |
| 2415 | return CMD_SUCCESS; |
| 2416 | } |
| 2417 | |
| 2418 | DEFUN (no_neighbor_description, |
| 2419 | no_neighbor_description_cmd, |
| 2420 | NO_NEIGHBOR_CMD2 "description", |
| 2421 | NO_STR |
| 2422 | NEIGHBOR_STR |
| 2423 | NEIGHBOR_ADDR_STR2 |
| 2424 | "Neighbor specific description\n") |
| 2425 | { |
| 2426 | struct peer *peer; |
| 2427 | |
| 2428 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2429 | if (! peer) |
| 2430 | return CMD_WARNING; |
| 2431 | |
| 2432 | peer_description_unset (peer); |
| 2433 | |
| 2434 | return CMD_SUCCESS; |
| 2435 | } |
| 2436 | |
| 2437 | ALIAS (no_neighbor_description, |
| 2438 | no_neighbor_description_val_cmd, |
| 2439 | NO_NEIGHBOR_CMD2 "description .LINE", |
| 2440 | NO_STR |
| 2441 | NEIGHBOR_STR |
| 2442 | NEIGHBOR_ADDR_STR2 |
| 2443 | "Neighbor specific description\n" |
| 2444 | "Up to 80 characters describing this neighbor\n") |
| 2445 | |
| 2446 | /* Neighbor update-source. */ |
| 2447 | int |
| 2448 | peer_update_source_vty (struct vty *vty, char *peer_str, char *source_str) |
| 2449 | { |
| 2450 | struct peer *peer; |
| 2451 | union sockunion *su; |
| 2452 | |
| 2453 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2454 | if (! peer) |
| 2455 | return CMD_WARNING; |
| 2456 | |
| 2457 | if (source_str) |
| 2458 | { |
| 2459 | su = sockunion_str2su (source_str); |
| 2460 | if (su) |
| 2461 | { |
| 2462 | peer_update_source_addr_set (peer, su); |
| 2463 | sockunion_free (su); |
| 2464 | } |
| 2465 | else |
| 2466 | peer_update_source_if_set (peer, source_str); |
| 2467 | } |
| 2468 | else |
| 2469 | peer_update_source_unset (peer); |
| 2470 | |
| 2471 | return CMD_SUCCESS; |
| 2472 | } |
| 2473 | |
| 2474 | DEFUN (neighbor_update_source, |
| 2475 | neighbor_update_source_cmd, |
| 2476 | NEIGHBOR_CMD2 "update-source WORD", |
| 2477 | NEIGHBOR_STR |
| 2478 | NEIGHBOR_ADDR_STR2 |
| 2479 | "Source of routing updates\n" |
| 2480 | "Interface name\n") |
| 2481 | { |
| 2482 | return peer_update_source_vty (vty, argv[0], argv[1]); |
| 2483 | } |
| 2484 | |
| 2485 | DEFUN (no_neighbor_update_source, |
| 2486 | no_neighbor_update_source_cmd, |
| 2487 | NO_NEIGHBOR_CMD2 "update-source", |
| 2488 | NO_STR |
| 2489 | NEIGHBOR_STR |
| 2490 | NEIGHBOR_ADDR_STR2 |
| 2491 | "Source of routing updates\n" |
| 2492 | "Interface name\n") |
| 2493 | { |
| 2494 | return peer_update_source_vty (vty, argv[0], NULL); |
| 2495 | } |
| 2496 | |
| 2497 | int |
| 2498 | peer_default_originate_set_vty (struct vty *vty, char *peer_str, afi_t afi, |
| 2499 | safi_t safi, char *rmap, int set) |
| 2500 | { |
| 2501 | int ret; |
| 2502 | struct peer *peer; |
| 2503 | |
| 2504 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2505 | if (! peer) |
| 2506 | return CMD_WARNING; |
| 2507 | |
| 2508 | if (set) |
| 2509 | ret = peer_default_originate_set (peer, afi, safi, rmap); |
| 2510 | else |
| 2511 | ret = peer_default_originate_unset (peer, afi, safi); |
| 2512 | |
| 2513 | return bgp_vty_return (vty, ret); |
| 2514 | } |
| 2515 | |
| 2516 | /* neighbor default-originate. */ |
| 2517 | DEFUN (neighbor_default_originate, |
| 2518 | neighbor_default_originate_cmd, |
| 2519 | NEIGHBOR_CMD2 "default-originate", |
| 2520 | NEIGHBOR_STR |
| 2521 | NEIGHBOR_ADDR_STR2 |
| 2522 | "Originate default route to this neighbor\n") |
| 2523 | { |
| 2524 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2525 | bgp_node_safi (vty), NULL, 1); |
| 2526 | } |
| 2527 | |
| 2528 | DEFUN (neighbor_default_originate_rmap, |
| 2529 | neighbor_default_originate_rmap_cmd, |
| 2530 | NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 2531 | NEIGHBOR_STR |
| 2532 | NEIGHBOR_ADDR_STR2 |
| 2533 | "Originate default route to this neighbor\n" |
| 2534 | "Route-map to specify criteria to originate default\n" |
| 2535 | "route-map name\n") |
| 2536 | { |
| 2537 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2538 | bgp_node_safi (vty), argv[1], 1); |
| 2539 | } |
| 2540 | |
| 2541 | DEFUN (no_neighbor_default_originate, |
| 2542 | no_neighbor_default_originate_cmd, |
| 2543 | NO_NEIGHBOR_CMD2 "default-originate", |
| 2544 | NO_STR |
| 2545 | NEIGHBOR_STR |
| 2546 | NEIGHBOR_ADDR_STR2 |
| 2547 | "Originate default route to this neighbor\n") |
| 2548 | { |
| 2549 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2550 | bgp_node_safi (vty), NULL, 0); |
| 2551 | } |
| 2552 | |
| 2553 | ALIAS (no_neighbor_default_originate, |
| 2554 | no_neighbor_default_originate_rmap_cmd, |
| 2555 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 2556 | NO_STR |
| 2557 | NEIGHBOR_STR |
| 2558 | NEIGHBOR_ADDR_STR2 |
| 2559 | "Originate default route to this neighbor\n" |
| 2560 | "Route-map to specify criteria to originate default\n" |
| 2561 | "route-map name\n") |
| 2562 | |
| 2563 | /* Set neighbor's BGP port. */ |
| 2564 | int |
| 2565 | peer_port_vty (struct vty *vty, char *ip_str, int afi, char *port_str) |
| 2566 | { |
| 2567 | struct peer *peer; |
| 2568 | u_int16_t port; |
| 2569 | struct servent *sp; |
| 2570 | |
| 2571 | peer = peer_lookup_vty (vty, ip_str); |
| 2572 | if (! peer) |
| 2573 | return CMD_WARNING; |
| 2574 | |
| 2575 | if (! port_str) |
| 2576 | { |
| 2577 | sp = getservbyname ("bgp", "tcp"); |
| 2578 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); |
| 2579 | } |
| 2580 | else |
| 2581 | { |
| 2582 | VTY_GET_INTEGER("port", port, port_str); |
| 2583 | } |
| 2584 | |
| 2585 | peer_port_set (peer, port); |
| 2586 | |
| 2587 | return CMD_SUCCESS; |
| 2588 | } |
| 2589 | |
| 2590 | /* Set specified peer's BGP version. */ |
| 2591 | DEFUN (neighbor_port, |
| 2592 | neighbor_port_cmd, |
| 2593 | NEIGHBOR_CMD "port <0-65535>", |
| 2594 | NEIGHBOR_STR |
| 2595 | NEIGHBOR_ADDR_STR |
| 2596 | "Neighbor's BGP port\n" |
| 2597 | "TCP port number\n") |
| 2598 | { |
| 2599 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); |
| 2600 | } |
| 2601 | |
| 2602 | DEFUN (no_neighbor_port, |
| 2603 | no_neighbor_port_cmd, |
| 2604 | NO_NEIGHBOR_CMD "port", |
| 2605 | NO_STR |
| 2606 | NEIGHBOR_STR |
| 2607 | NEIGHBOR_ADDR_STR |
| 2608 | "Neighbor's BGP port\n") |
| 2609 | { |
| 2610 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); |
| 2611 | } |
| 2612 | |
| 2613 | ALIAS (no_neighbor_port, |
| 2614 | no_neighbor_port_val_cmd, |
| 2615 | NO_NEIGHBOR_CMD "port <0-65535>", |
| 2616 | NO_STR |
| 2617 | NEIGHBOR_STR |
| 2618 | NEIGHBOR_ADDR_STR |
| 2619 | "Neighbor's BGP port\n" |
| 2620 | "TCP port number\n") |
| 2621 | |
| 2622 | /* neighbor weight. */ |
| 2623 | int |
| 2624 | peer_weight_set_vty (struct vty *vty, char *ip_str, char *weight_str) |
| 2625 | { |
| 2626 | int ret; |
| 2627 | struct peer *peer; |
| 2628 | unsigned long weight; |
| 2629 | |
| 2630 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2631 | if (! peer) |
| 2632 | return CMD_WARNING; |
| 2633 | |
| 2634 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); |
| 2635 | |
| 2636 | ret = peer_weight_set (peer, weight); |
| 2637 | |
| 2638 | return CMD_SUCCESS; |
| 2639 | } |
| 2640 | |
| 2641 | int |
| 2642 | peer_weight_unset_vty (struct vty *vty, char *ip_str) |
| 2643 | { |
| 2644 | struct peer *peer; |
| 2645 | |
| 2646 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2647 | if (! peer) |
| 2648 | return CMD_WARNING; |
| 2649 | |
| 2650 | peer_weight_unset (peer); |
| 2651 | |
| 2652 | return CMD_SUCCESS; |
| 2653 | } |
| 2654 | |
| 2655 | DEFUN (neighbor_weight, |
| 2656 | neighbor_weight_cmd, |
| 2657 | NEIGHBOR_CMD2 "weight <0-65535>", |
| 2658 | NEIGHBOR_STR |
| 2659 | NEIGHBOR_ADDR_STR2 |
| 2660 | "Set default weight for routes from this neighbor\n" |
| 2661 | "default weight\n") |
| 2662 | { |
| 2663 | return peer_weight_set_vty (vty, argv[0], argv[1]); |
| 2664 | } |
| 2665 | |
| 2666 | DEFUN (no_neighbor_weight, |
| 2667 | no_neighbor_weight_cmd, |
| 2668 | NO_NEIGHBOR_CMD2 "weight", |
| 2669 | NO_STR |
| 2670 | NEIGHBOR_STR |
| 2671 | NEIGHBOR_ADDR_STR2 |
| 2672 | "Set default weight for routes from this neighbor\n") |
| 2673 | { |
| 2674 | return peer_weight_unset_vty (vty, argv[0]); |
| 2675 | } |
| 2676 | |
| 2677 | ALIAS (no_neighbor_weight, |
| 2678 | no_neighbor_weight_val_cmd, |
| 2679 | NO_NEIGHBOR_CMD2 "weight <0-65535>", |
| 2680 | NO_STR |
| 2681 | NEIGHBOR_STR |
| 2682 | NEIGHBOR_ADDR_STR2 |
| 2683 | "Set default weight for routes from this neighbor\n" |
| 2684 | "default weight\n") |
| 2685 | |
| 2686 | /* Override capability negotiation. */ |
| 2687 | DEFUN (neighbor_override_capability, |
| 2688 | neighbor_override_capability_cmd, |
| 2689 | NEIGHBOR_CMD2 "override-capability", |
| 2690 | NEIGHBOR_STR |
| 2691 | NEIGHBOR_ADDR_STR2 |
| 2692 | "Override capability negotiation result\n") |
| 2693 | { |
| 2694 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 2695 | } |
| 2696 | |
| 2697 | DEFUN (no_neighbor_override_capability, |
| 2698 | no_neighbor_override_capability_cmd, |
| 2699 | NO_NEIGHBOR_CMD2 "override-capability", |
| 2700 | NO_STR |
| 2701 | NEIGHBOR_STR |
| 2702 | NEIGHBOR_ADDR_STR2 |
| 2703 | "Override capability negotiation result\n") |
| 2704 | { |
| 2705 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 2706 | } |
| 2707 | |
| 2708 | DEFUN (neighbor_strict_capability, |
| 2709 | neighbor_strict_capability_cmd, |
| 2710 | NEIGHBOR_CMD "strict-capability-match", |
| 2711 | NEIGHBOR_STR |
| 2712 | NEIGHBOR_ADDR_STR |
| 2713 | "Strict capability negotiation match\n") |
| 2714 | { |
| 2715 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 2716 | } |
| 2717 | |
| 2718 | DEFUN (no_neighbor_strict_capability, |
| 2719 | no_neighbor_strict_capability_cmd, |
| 2720 | NO_NEIGHBOR_CMD "strict-capability-match", |
| 2721 | NO_STR |
| 2722 | NEIGHBOR_STR |
| 2723 | NEIGHBOR_ADDR_STR |
| 2724 | "Strict capability negotiation match\n") |
| 2725 | { |
| 2726 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 2727 | } |
| 2728 | |
| 2729 | int |
| 2730 | peer_timers_set_vty (struct vty *vty, char *ip_str, char *keep_str, |
| 2731 | char *hold_str) |
| 2732 | { |
| 2733 | int ret; |
| 2734 | struct peer *peer; |
| 2735 | u_int32_t keepalive; |
| 2736 | u_int32_t holdtime; |
| 2737 | |
| 2738 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2739 | if (! peer) |
| 2740 | return CMD_WARNING; |
| 2741 | |
| 2742 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); |
| 2743 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); |
| 2744 | |
| 2745 | ret = peer_timers_set (peer, keepalive, holdtime); |
| 2746 | |
| 2747 | return bgp_vty_return (vty, ret); |
| 2748 | } |
| 2749 | |
| 2750 | int |
| 2751 | peer_timers_unset_vty (struct vty *vty, char *ip_str) |
| 2752 | { |
| 2753 | int ret; |
| 2754 | struct peer *peer; |
| 2755 | |
| 2756 | peer = peer_lookup_vty (vty, ip_str); |
| 2757 | if (! peer) |
| 2758 | return CMD_WARNING; |
| 2759 | |
| 2760 | ret = peer_timers_unset (peer); |
| 2761 | |
| 2762 | return bgp_vty_return (vty, ret); |
| 2763 | } |
| 2764 | |
| 2765 | DEFUN (neighbor_timers, |
| 2766 | neighbor_timers_cmd, |
| 2767 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", |
| 2768 | NEIGHBOR_STR |
| 2769 | NEIGHBOR_ADDR_STR2 |
| 2770 | "BGP per neighbor timers\n" |
| 2771 | "Keepalive interval\n" |
| 2772 | "Holdtime\n") |
| 2773 | { |
| 2774 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); |
| 2775 | } |
| 2776 | |
| 2777 | DEFUN (no_neighbor_timers, |
| 2778 | no_neighbor_timers_cmd, |
| 2779 | NO_NEIGHBOR_CMD2 "timers", |
| 2780 | NO_STR |
| 2781 | NEIGHBOR_STR |
| 2782 | NEIGHBOR_ADDR_STR2 |
| 2783 | "BGP per neighbor timers\n") |
| 2784 | { |
| 2785 | return peer_timers_unset_vty (vty, argv[0]); |
| 2786 | } |
| 2787 | |
| 2788 | int |
| 2789 | peer_timers_connect_set_vty (struct vty *vty, char *ip_str, char *time_str) |
| 2790 | { |
| 2791 | int ret; |
| 2792 | struct peer *peer; |
| 2793 | u_int32_t connect; |
| 2794 | |
| 2795 | peer = peer_lookup_vty (vty, ip_str); |
| 2796 | if (! peer) |
| 2797 | return CMD_WARNING; |
| 2798 | |
| 2799 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); |
| 2800 | |
| 2801 | ret = peer_timers_connect_set (peer, connect); |
| 2802 | |
| 2803 | return CMD_SUCCESS; |
| 2804 | } |
| 2805 | |
| 2806 | int |
| 2807 | peer_timers_connect_unset_vty (struct vty *vty, char *ip_str) |
| 2808 | { |
| 2809 | int ret; |
| 2810 | struct peer *peer; |
| 2811 | |
| 2812 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2813 | if (! peer) |
| 2814 | return CMD_WARNING; |
| 2815 | |
| 2816 | ret = peer_timers_connect_unset (peer); |
| 2817 | |
| 2818 | return CMD_SUCCESS; |
| 2819 | } |
| 2820 | |
| 2821 | DEFUN (neighbor_timers_connect, |
| 2822 | neighbor_timers_connect_cmd, |
| 2823 | NEIGHBOR_CMD "timers connect <0-65535>", |
| 2824 | NEIGHBOR_STR |
| 2825 | NEIGHBOR_ADDR_STR |
| 2826 | "BGP per neighbor timers\n" |
| 2827 | "BGP connect timer\n" |
| 2828 | "Connect timer\n") |
| 2829 | { |
| 2830 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); |
| 2831 | } |
| 2832 | |
| 2833 | DEFUN (no_neighbor_timers_connect, |
| 2834 | no_neighbor_timers_connect_cmd, |
| 2835 | NO_NEIGHBOR_CMD "timers connect", |
| 2836 | NO_STR |
| 2837 | NEIGHBOR_STR |
| 2838 | NEIGHBOR_ADDR_STR |
| 2839 | "BGP per neighbor timers\n" |
| 2840 | "BGP connect timer\n") |
| 2841 | { |
| 2842 | return peer_timers_connect_unset_vty (vty, argv[0]); |
| 2843 | } |
| 2844 | |
| 2845 | ALIAS (no_neighbor_timers_connect, |
| 2846 | no_neighbor_timers_connect_val_cmd, |
| 2847 | NO_NEIGHBOR_CMD "timers connect <0-65535>", |
| 2848 | NO_STR |
| 2849 | NEIGHBOR_STR |
| 2850 | NEIGHBOR_ADDR_STR |
| 2851 | "BGP per neighbor timers\n" |
| 2852 | "BGP connect timer\n" |
| 2853 | "Connect timer\n") |
| 2854 | |
| 2855 | int |
| 2856 | peer_advertise_interval_vty (struct vty *vty, char *ip_str, char *time_str, |
| 2857 | int set) |
| 2858 | { |
| 2859 | int ret; |
| 2860 | struct peer *peer; |
| 2861 | u_int32_t routeadv = 0; |
| 2862 | |
| 2863 | peer = peer_lookup_vty (vty, ip_str); |
| 2864 | if (! peer) |
| 2865 | return CMD_WARNING; |
| 2866 | |
| 2867 | if (time_str) |
| 2868 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); |
| 2869 | |
| 2870 | if (set) |
| 2871 | ret = peer_advertise_interval_set (peer, routeadv); |
| 2872 | else |
| 2873 | ret = peer_advertise_interval_unset (peer); |
| 2874 | |
| 2875 | return CMD_SUCCESS; |
| 2876 | } |
| 2877 | |
| 2878 | DEFUN (neighbor_advertise_interval, |
| 2879 | neighbor_advertise_interval_cmd, |
| 2880 | NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 2881 | NEIGHBOR_STR |
| 2882 | NEIGHBOR_ADDR_STR |
| 2883 | "Minimum interval between sending BGP routing updates\n" |
| 2884 | "time in seconds\n") |
| 2885 | { |
| 2886 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); |
| 2887 | } |
| 2888 | |
| 2889 | DEFUN (no_neighbor_advertise_interval, |
| 2890 | no_neighbor_advertise_interval_cmd, |
| 2891 | NO_NEIGHBOR_CMD "advertisement-interval", |
| 2892 | NO_STR |
| 2893 | NEIGHBOR_STR |
| 2894 | NEIGHBOR_ADDR_STR |
| 2895 | "Minimum interval between sending BGP routing updates\n") |
| 2896 | { |
| 2897 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); |
| 2898 | } |
| 2899 | |
| 2900 | ALIAS (no_neighbor_advertise_interval, |
| 2901 | no_neighbor_advertise_interval_val_cmd, |
| 2902 | NO_NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 2903 | NO_STR |
| 2904 | NEIGHBOR_STR |
| 2905 | NEIGHBOR_ADDR_STR |
| 2906 | "Minimum interval between sending BGP routing updates\n" |
| 2907 | "time in seconds\n") |
| 2908 | |
| 2909 | int |
| 2910 | peer_version_vty (struct vty *vty, char *ip_str, char *str) |
| 2911 | { |
| 2912 | int ret; |
| 2913 | struct peer *peer; |
| 2914 | int version = BGP_VERSION_4; |
| 2915 | |
| 2916 | peer = peer_lookup_vty (vty, ip_str); |
| 2917 | if (! peer) |
| 2918 | return CMD_WARNING; |
| 2919 | |
| 2920 | /* BGP version string check. */ |
| 2921 | if (str) |
| 2922 | { |
| 2923 | if (strcmp (str, "4") == 0) |
| 2924 | version = BGP_VERSION_4; |
| 2925 | else if (strcmp (str, "4-") == 0) |
| 2926 | version = BGP_VERSION_MP_4_DRAFT_00; |
| 2927 | |
| 2928 | ret = peer_version_set (peer, version); |
| 2929 | } |
| 2930 | else |
| 2931 | ret = peer_version_unset (peer); |
| 2932 | |
| 2933 | return CMD_SUCCESS; |
| 2934 | } |
| 2935 | |
| 2936 | DEFUN (neighbor_version, |
| 2937 | neighbor_version_cmd, |
| 2938 | NEIGHBOR_CMD "version (4|4-)", |
| 2939 | NEIGHBOR_STR |
| 2940 | NEIGHBOR_ADDR_STR |
| 2941 | "Neighbor's BGP version\n" |
| 2942 | "Border Gateway Protocol 4\n" |
| 2943 | "Multiprotocol Extensions for BGP-4(Old Draft)\n") |
| 2944 | { |
| 2945 | return peer_version_vty (vty, argv[0], argv[1]); |
| 2946 | } |
| 2947 | |
| 2948 | DEFUN (no_neighbor_version, |
| 2949 | no_neighbor_version_cmd, |
| 2950 | NO_NEIGHBOR_CMD "version", |
| 2951 | NO_STR |
| 2952 | NEIGHBOR_STR |
| 2953 | NEIGHBOR_ADDR_STR |
| 2954 | "Neighbor's BGP version\n") |
| 2955 | { |
| 2956 | return peer_version_vty (vty, argv[0], NULL); |
| 2957 | } |
| 2958 | |
| 2959 | /* neighbor interface */ |
| 2960 | int |
| 2961 | peer_interface_vty (struct vty *vty, char *ip_str, char *str) |
| 2962 | { |
| 2963 | int ret; |
| 2964 | struct peer *peer; |
| 2965 | |
| 2966 | peer = peer_lookup_vty (vty, ip_str); |
| 2967 | if (! peer) |
| 2968 | return CMD_WARNING; |
| 2969 | |
| 2970 | if (str) |
| 2971 | ret = peer_interface_set (peer, str); |
| 2972 | else |
| 2973 | ret = peer_interface_unset (peer); |
| 2974 | |
| 2975 | return CMD_SUCCESS; |
| 2976 | } |
| 2977 | |
| 2978 | DEFUN (neighbor_interface, |
| 2979 | neighbor_interface_cmd, |
| 2980 | NEIGHBOR_CMD "interface WORD", |
| 2981 | NEIGHBOR_STR |
| 2982 | NEIGHBOR_ADDR_STR |
| 2983 | "Interface\n" |
| 2984 | "Interface name\n") |
| 2985 | { |
| 2986 | return peer_interface_vty (vty, argv[0], argv[1]); |
| 2987 | } |
| 2988 | |
| 2989 | DEFUN (no_neighbor_interface, |
| 2990 | no_neighbor_interface_cmd, |
| 2991 | NO_NEIGHBOR_CMD "interface WORD", |
| 2992 | NO_STR |
| 2993 | NEIGHBOR_STR |
| 2994 | NEIGHBOR_ADDR_STR |
| 2995 | "Interface\n" |
| 2996 | "Interface name\n") |
| 2997 | { |
| 2998 | return peer_interface_vty (vty, argv[0], NULL); |
| 2999 | } |
| 3000 | |
| 3001 | /* Set distribute list to the peer. */ |
| 3002 | int |
| 3003 | peer_distribute_set_vty (struct vty *vty, char *ip_str, afi_t afi, safi_t safi, |
| 3004 | char *name_str, char *direct_str) |
| 3005 | { |
| 3006 | int ret; |
| 3007 | struct peer *peer; |
| 3008 | int direct = FILTER_IN; |
| 3009 | |
| 3010 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3011 | if (! peer) |
| 3012 | return CMD_WARNING; |
| 3013 | |
| 3014 | /* Check filter direction. */ |
| 3015 | if (strncmp (direct_str, "i", 1) == 0) |
| 3016 | direct = FILTER_IN; |
| 3017 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3018 | direct = FILTER_OUT; |
| 3019 | |
| 3020 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); |
| 3021 | |
| 3022 | return bgp_vty_return (vty, ret); |
| 3023 | } |
| 3024 | |
| 3025 | int |
| 3026 | peer_distribute_unset_vty (struct vty *vty, char *ip_str, afi_t afi, |
| 3027 | safi_t safi, char *direct_str) |
| 3028 | { |
| 3029 | int ret; |
| 3030 | struct peer *peer; |
| 3031 | int direct = FILTER_IN; |
| 3032 | |
| 3033 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3034 | if (! peer) |
| 3035 | return CMD_WARNING; |
| 3036 | |
| 3037 | /* Check filter direction. */ |
| 3038 | if (strncmp (direct_str, "i", 1) == 0) |
| 3039 | direct = FILTER_IN; |
| 3040 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3041 | direct = FILTER_OUT; |
| 3042 | |
| 3043 | ret = peer_distribute_unset (peer, afi, safi, direct); |
| 3044 | |
| 3045 | return bgp_vty_return (vty, ret); |
| 3046 | } |
| 3047 | |
| 3048 | DEFUN (neighbor_distribute_list, |
| 3049 | neighbor_distribute_list_cmd, |
| 3050 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3051 | NEIGHBOR_STR |
| 3052 | NEIGHBOR_ADDR_STR2 |
| 3053 | "Filter updates to/from this neighbor\n" |
| 3054 | "IP access-list number\n" |
| 3055 | "IP access-list number (expanded range)\n" |
| 3056 | "IP Access-list name\n" |
| 3057 | "Filter incoming updates\n" |
| 3058 | "Filter outgoing updates\n") |
| 3059 | { |
| 3060 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3061 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3062 | } |
| 3063 | |
| 3064 | DEFUN (no_neighbor_distribute_list, |
| 3065 | no_neighbor_distribute_list_cmd, |
| 3066 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3067 | NO_STR |
| 3068 | NEIGHBOR_STR |
| 3069 | NEIGHBOR_ADDR_STR2 |
| 3070 | "Filter updates to/from this neighbor\n" |
| 3071 | "IP access-list number\n" |
| 3072 | "IP access-list number (expanded range)\n" |
| 3073 | "IP Access-list name\n" |
| 3074 | "Filter incoming updates\n" |
| 3075 | "Filter outgoing updates\n") |
| 3076 | { |
| 3077 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3078 | bgp_node_safi (vty), argv[2]); |
| 3079 | } |
| 3080 | |
| 3081 | /* Set prefix list to the peer. */ |
| 3082 | int |
| 3083 | peer_prefix_list_set_vty (struct vty *vty, char *ip_str, afi_t afi, |
| 3084 | safi_t safi, char *name_str, char *direct_str) |
| 3085 | { |
| 3086 | int ret; |
| 3087 | struct peer *peer; |
| 3088 | int direct = FILTER_IN; |
| 3089 | |
| 3090 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3091 | if (! peer) |
| 3092 | return CMD_WARNING; |
| 3093 | |
| 3094 | /* Check filter direction. */ |
| 3095 | if (strncmp (direct_str, "i", 1) == 0) |
| 3096 | direct = FILTER_IN; |
| 3097 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3098 | direct = FILTER_OUT; |
| 3099 | |
| 3100 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); |
| 3101 | |
| 3102 | return bgp_vty_return (vty, ret); |
| 3103 | } |
| 3104 | |
| 3105 | int |
| 3106 | peer_prefix_list_unset_vty (struct vty *vty, char *ip_str, afi_t afi, |
| 3107 | safi_t safi, char *direct_str) |
| 3108 | { |
| 3109 | int ret; |
| 3110 | struct peer *peer; |
| 3111 | int direct = FILTER_IN; |
| 3112 | |
| 3113 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3114 | if (! peer) |
| 3115 | return CMD_WARNING; |
| 3116 | |
| 3117 | /* Check filter direction. */ |
| 3118 | if (strncmp (direct_str, "i", 1) == 0) |
| 3119 | direct = FILTER_IN; |
| 3120 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3121 | direct = FILTER_OUT; |
| 3122 | |
| 3123 | ret = peer_prefix_list_unset (peer, afi, safi, direct); |
| 3124 | |
| 3125 | return bgp_vty_return (vty, ret); |
| 3126 | } |
| 3127 | |
| 3128 | DEFUN (neighbor_prefix_list, |
| 3129 | neighbor_prefix_list_cmd, |
| 3130 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3131 | NEIGHBOR_STR |
| 3132 | NEIGHBOR_ADDR_STR2 |
| 3133 | "Filter updates to/from this neighbor\n" |
| 3134 | "Name of a prefix list\n" |
| 3135 | "Filter incoming updates\n" |
| 3136 | "Filter outgoing updates\n") |
| 3137 | { |
| 3138 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3139 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3140 | } |
| 3141 | |
| 3142 | DEFUN (no_neighbor_prefix_list, |
| 3143 | no_neighbor_prefix_list_cmd, |
| 3144 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3145 | NO_STR |
| 3146 | NEIGHBOR_STR |
| 3147 | NEIGHBOR_ADDR_STR2 |
| 3148 | "Filter updates to/from this neighbor\n" |
| 3149 | "Name of a prefix list\n" |
| 3150 | "Filter incoming updates\n" |
| 3151 | "Filter outgoing updates\n") |
| 3152 | { |
| 3153 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3154 | bgp_node_safi (vty), argv[2]); |
| 3155 | } |
| 3156 | |
| 3157 | int |
| 3158 | peer_aslist_set_vty (struct vty *vty, char *ip_str, afi_t afi, safi_t safi, |
| 3159 | char *name_str, char *direct_str) |
| 3160 | { |
| 3161 | int ret; |
| 3162 | struct peer *peer; |
| 3163 | int direct = FILTER_IN; |
| 3164 | |
| 3165 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3166 | if (! peer) |
| 3167 | return CMD_WARNING; |
| 3168 | |
| 3169 | /* Check filter direction. */ |
| 3170 | if (strncmp (direct_str, "i", 1) == 0) |
| 3171 | direct = FILTER_IN; |
| 3172 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3173 | direct = FILTER_OUT; |
| 3174 | |
| 3175 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); |
| 3176 | |
| 3177 | return bgp_vty_return (vty, ret); |
| 3178 | } |
| 3179 | |
| 3180 | int |
| 3181 | peer_aslist_unset_vty (struct vty *vty, char *ip_str, afi_t afi, safi_t safi, |
| 3182 | char *direct_str) |
| 3183 | { |
| 3184 | int ret; |
| 3185 | struct peer *peer; |
| 3186 | int direct = FILTER_IN; |
| 3187 | |
| 3188 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3189 | if (! peer) |
| 3190 | return CMD_WARNING; |
| 3191 | |
| 3192 | /* Check filter direction. */ |
| 3193 | if (strncmp (direct_str, "i", 1) == 0) |
| 3194 | direct = FILTER_IN; |
| 3195 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3196 | direct = FILTER_OUT; |
| 3197 | |
| 3198 | ret = peer_aslist_unset (peer, afi, safi, direct); |
| 3199 | |
| 3200 | return bgp_vty_return (vty, ret); |
| 3201 | } |
| 3202 | |
| 3203 | DEFUN (neighbor_filter_list, |
| 3204 | neighbor_filter_list_cmd, |
| 3205 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3206 | NEIGHBOR_STR |
| 3207 | NEIGHBOR_ADDR_STR2 |
| 3208 | "Establish BGP filters\n" |
| 3209 | "AS path access-list name\n" |
| 3210 | "Filter incoming routes\n" |
| 3211 | "Filter outgoing routes\n") |
| 3212 | { |
| 3213 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3214 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3215 | } |
| 3216 | |
| 3217 | DEFUN (no_neighbor_filter_list, |
| 3218 | no_neighbor_filter_list_cmd, |
| 3219 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3220 | NO_STR |
| 3221 | NEIGHBOR_STR |
| 3222 | NEIGHBOR_ADDR_STR2 |
| 3223 | "Establish BGP filters\n" |
| 3224 | "AS path access-list name\n" |
| 3225 | "Filter incoming routes\n" |
| 3226 | "Filter outgoing routes\n") |
| 3227 | { |
| 3228 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3229 | bgp_node_safi (vty), argv[2]); |
| 3230 | } |
| 3231 | |
| 3232 | /* Set route-map to the peer. */ |
| 3233 | int |
| 3234 | peer_route_map_set_vty (struct vty *vty, char *ip_str, afi_t afi, safi_t safi, |
| 3235 | char *name_str, char *direct_str) |
| 3236 | { |
| 3237 | int ret; |
| 3238 | struct peer *peer; |
| 3239 | int direct = FILTER_IN; |
| 3240 | |
| 3241 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3242 | if (! peer) |
| 3243 | return CMD_WARNING; |
| 3244 | |
| 3245 | /* Check filter direction. */ |
| 3246 | if (strncmp (direct_str, "i", 1) == 0) |
| 3247 | direct = FILTER_IN; |
| 3248 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3249 | direct = FILTER_OUT; |
| 3250 | |
| 3251 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); |
| 3252 | |
| 3253 | return bgp_vty_return (vty, ret); |
| 3254 | } |
| 3255 | |
| 3256 | int |
| 3257 | peer_route_map_unset_vty (struct vty *vty, char *ip_str, afi_t afi, |
| 3258 | safi_t safi, char *direct_str) |
| 3259 | { |
| 3260 | int ret; |
| 3261 | struct peer *peer; |
| 3262 | int direct = FILTER_IN; |
| 3263 | |
| 3264 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3265 | if (! peer) |
| 3266 | return CMD_WARNING; |
| 3267 | |
| 3268 | /* Check filter direction. */ |
| 3269 | if (strncmp (direct_str, "i", 1) == 0) |
| 3270 | direct = FILTER_IN; |
| 3271 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3272 | |
| 3273 | direct = FILTER_OUT; |
| 3274 | |
| 3275 | ret = peer_route_map_unset (peer, afi, safi, direct); |
| 3276 | |
| 3277 | return bgp_vty_return (vty, ret); |
| 3278 | } |
| 3279 | |
| 3280 | DEFUN (neighbor_route_map, |
| 3281 | neighbor_route_map_cmd, |
| 3282 | NEIGHBOR_CMD2 "route-map WORD (in|out)", |
| 3283 | NEIGHBOR_STR |
| 3284 | NEIGHBOR_ADDR_STR2 |
| 3285 | "Apply route map to neighbor\n" |
| 3286 | "Name of route map\n" |
| 3287 | "Apply map to incoming routes\n" |
| 3288 | "Apply map to outbound routes\n") |
| 3289 | { |
| 3290 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3291 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3292 | } |
| 3293 | |
| 3294 | DEFUN (no_neighbor_route_map, |
| 3295 | no_neighbor_route_map_cmd, |
| 3296 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out)", |
| 3297 | NO_STR |
| 3298 | NEIGHBOR_STR |
| 3299 | NEIGHBOR_ADDR_STR2 |
| 3300 | "Apply route map to neighbor\n" |
| 3301 | "Name of route map\n" |
| 3302 | "Apply map to incoming routes\n" |
| 3303 | "Apply map to outbound routes\n") |
| 3304 | { |
| 3305 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3306 | bgp_node_safi (vty), argv[2]); |
| 3307 | } |
| 3308 | |
| 3309 | /* Set unsuppress-map to the peer. */ |
| 3310 | int |
| 3311 | peer_unsuppress_map_set_vty (struct vty *vty, char *ip_str, afi_t afi, |
| 3312 | safi_t safi, char *name_str) |
| 3313 | { |
| 3314 | int ret; |
| 3315 | struct peer *peer; |
| 3316 | |
| 3317 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3318 | if (! peer) |
| 3319 | return CMD_WARNING; |
| 3320 | |
| 3321 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); |
| 3322 | |
| 3323 | return bgp_vty_return (vty, ret); |
| 3324 | } |
| 3325 | |
| 3326 | /* Unset route-map from the peer. */ |
| 3327 | int |
| 3328 | peer_unsuppress_map_unset_vty (struct vty *vty, char *ip_str, afi_t afi, |
| 3329 | safi_t safi) |
| 3330 | { |
| 3331 | int ret; |
| 3332 | struct peer *peer; |
| 3333 | |
| 3334 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3335 | if (! peer) |
| 3336 | return CMD_WARNING; |
| 3337 | |
| 3338 | ret = peer_unsuppress_map_unset (peer, afi, safi); |
| 3339 | |
| 3340 | return bgp_vty_return (vty, ret); |
| 3341 | } |
| 3342 | |
| 3343 | DEFUN (neighbor_unsuppress_map, |
| 3344 | neighbor_unsuppress_map_cmd, |
| 3345 | NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3346 | NEIGHBOR_STR |
| 3347 | NEIGHBOR_ADDR_STR2 |
| 3348 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3349 | "Name of route map\n") |
| 3350 | { |
| 3351 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3352 | bgp_node_safi (vty), argv[1]); |
| 3353 | } |
| 3354 | |
| 3355 | DEFUN (no_neighbor_unsuppress_map, |
| 3356 | no_neighbor_unsuppress_map_cmd, |
| 3357 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3358 | NO_STR |
| 3359 | NEIGHBOR_STR |
| 3360 | NEIGHBOR_ADDR_STR2 |
| 3361 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3362 | "Name of route map\n") |
| 3363 | { |
| 3364 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3365 | bgp_node_safi (vty)); |
| 3366 | } |
| 3367 | |
| 3368 | int |
| 3369 | peer_maximum_prefix_set_vty (struct vty *vty, char *ip_str, afi_t afi, |
| 3370 | safi_t safi, char *num_str, int warning) |
| 3371 | { |
| 3372 | int ret; |
| 3373 | struct peer *peer; |
| 3374 | u_int32_t max; |
| 3375 | |
| 3376 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3377 | if (! peer) |
| 3378 | return CMD_WARNING; |
| 3379 | |
| 3380 | VTY_GET_INTEGER ("maxmum number", max, num_str); |
| 3381 | |
| 3382 | ret = peer_maximum_prefix_set (peer, afi, safi, max, warning); |
| 3383 | |
| 3384 | return bgp_vty_return (vty, ret); |
| 3385 | } |
| 3386 | |
| 3387 | int |
| 3388 | peer_maximum_prefix_unset_vty (struct vty *vty, char *ip_str, afi_t afi, |
| 3389 | safi_t safi) |
| 3390 | { |
| 3391 | int ret; |
| 3392 | struct peer *peer; |
| 3393 | |
| 3394 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3395 | if (! peer) |
| 3396 | return CMD_WARNING; |
| 3397 | |
| 3398 | ret = peer_maximum_prefix_unset (peer, afi, safi); |
| 3399 | |
| 3400 | return bgp_vty_return (vty, ret); |
| 3401 | } |
| 3402 | |
| 3403 | /* Maximum number of prefix configuration. prefix count is different |
| 3404 | for each peer configuration. So this configuration can be set for |
| 3405 | each peer configuration. */ |
| 3406 | DEFUN (neighbor_maximum_prefix, |
| 3407 | neighbor_maximum_prefix_cmd, |
| 3408 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3409 | NEIGHBOR_STR |
| 3410 | NEIGHBOR_ADDR_STR2 |
| 3411 | "Maximum number of prefix accept from this peer\n" |
| 3412 | "maximum no. of prefix limit\n") |
| 3413 | { |
| 3414 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3415 | bgp_node_safi (vty), argv[1], 0); |
| 3416 | } |
| 3417 | |
| 3418 | DEFUN (neighbor_maximum_prefix_warning, |
| 3419 | neighbor_maximum_prefix_warning_cmd, |
| 3420 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3421 | NEIGHBOR_STR |
| 3422 | NEIGHBOR_ADDR_STR2 |
| 3423 | "Maximum number of prefix accept from this peer\n" |
| 3424 | "maximum no. of prefix limit\n" |
| 3425 | "Only give warning message when limit is exceeded\n") |
| 3426 | { |
| 3427 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3428 | bgp_node_safi (vty), argv[1], 1); |
| 3429 | } |
| 3430 | |
| 3431 | DEFUN (no_neighbor_maximum_prefix, |
| 3432 | no_neighbor_maximum_prefix_cmd, |
| 3433 | NO_NEIGHBOR_CMD2 "maximum-prefix", |
| 3434 | NO_STR |
| 3435 | NEIGHBOR_STR |
| 3436 | NEIGHBOR_ADDR_STR2 |
| 3437 | "Maximum number of prefix accept from this peer\n") |
| 3438 | { |
| 3439 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3440 | bgp_node_safi (vty)); |
| 3441 | } |
| 3442 | |
| 3443 | ALIAS (no_neighbor_maximum_prefix, |
| 3444 | no_neighbor_maximum_prefix_val_cmd, |
| 3445 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3446 | NO_STR |
| 3447 | NEIGHBOR_STR |
| 3448 | NEIGHBOR_ADDR_STR2 |
| 3449 | "Maximum number of prefix accept from this peer\n" |
| 3450 | "maximum no. of prefix limit\n") |
| 3451 | |
| 3452 | ALIAS (no_neighbor_maximum_prefix, |
| 3453 | no_neighbor_maximum_prefix_val2_cmd, |
| 3454 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3455 | NO_STR |
| 3456 | NEIGHBOR_STR |
| 3457 | NEIGHBOR_ADDR_STR2 |
| 3458 | "Maximum number of prefix accept from this peer\n" |
| 3459 | "maximum no. of prefix limit\n" |
| 3460 | "Only give warning message when limit is exceeded\n") |
| 3461 | |
| 3462 | /* "neighbor allowas-in" */ |
| 3463 | DEFUN (neighbor_allowas_in, |
| 3464 | neighbor_allowas_in_cmd, |
| 3465 | NEIGHBOR_CMD2 "allowas-in", |
| 3466 | NEIGHBOR_STR |
| 3467 | NEIGHBOR_ADDR_STR2 |
| 3468 | "Accept as-path with my AS present in it\n") |
| 3469 | { |
| 3470 | int ret; |
| 3471 | struct peer *peer; |
| 3472 | int allow_num; |
| 3473 | |
| 3474 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3475 | if (! peer) |
| 3476 | return CMD_WARNING; |
| 3477 | |
| 3478 | if (argc == 1) |
| 3479 | allow_num = 3; |
| 3480 | else |
| 3481 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); |
| 3482 | |
| 3483 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), |
| 3484 | allow_num); |
| 3485 | |
| 3486 | return bgp_vty_return (vty, ret); |
| 3487 | } |
| 3488 | |
| 3489 | ALIAS (neighbor_allowas_in, |
| 3490 | neighbor_allowas_in_arg_cmd, |
| 3491 | NEIGHBOR_CMD2 "allowas-in <1-10>", |
| 3492 | NEIGHBOR_STR |
| 3493 | NEIGHBOR_ADDR_STR2 |
| 3494 | "Accept as-path with my AS present in it\n" |
| 3495 | "Number of occurances of AS number\n") |
| 3496 | |
| 3497 | DEFUN (no_neighbor_allowas_in, |
| 3498 | no_neighbor_allowas_in_cmd, |
| 3499 | NO_NEIGHBOR_CMD2 "allowas-in", |
| 3500 | NO_STR |
| 3501 | NEIGHBOR_STR |
| 3502 | NEIGHBOR_ADDR_STR2 |
| 3503 | "allow local ASN appears in aspath attribute\n") |
| 3504 | { |
| 3505 | int ret; |
| 3506 | struct peer *peer; |
| 3507 | |
| 3508 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3509 | if (! peer) |
| 3510 | return CMD_WARNING; |
| 3511 | |
| 3512 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 3513 | |
| 3514 | return bgp_vty_return (vty, ret); |
| 3515 | } |
| 3516 | |
| 3517 | /* Address family configuration. */ |
| 3518 | DEFUN (address_family_ipv4, |
| 3519 | address_family_ipv4_cmd, |
| 3520 | "address-family ipv4", |
| 3521 | "Enter Address Family command mode\n" |
| 3522 | "Address family\n") |
| 3523 | { |
| 3524 | vty->node = BGP_IPV4_NODE; |
| 3525 | return CMD_SUCCESS; |
| 3526 | } |
| 3527 | |
| 3528 | DEFUN (address_family_ipv4_safi, |
| 3529 | address_family_ipv4_safi_cmd, |
| 3530 | "address-family ipv4 (unicast|multicast)", |
| 3531 | "Enter Address Family command mode\n" |
| 3532 | "Address family\n" |
| 3533 | "Address Family modifier\n" |
| 3534 | "Address Family modifier\n") |
| 3535 | { |
| 3536 | if (strncmp (argv[0], "m", 1) == 0) |
| 3537 | vty->node = BGP_IPV4M_NODE; |
| 3538 | else |
| 3539 | vty->node = BGP_IPV4_NODE; |
| 3540 | |
| 3541 | return CMD_SUCCESS; |
| 3542 | } |
| 3543 | |
| 3544 | DEFUN (address_family_ipv6_unicast, |
| 3545 | address_family_ipv6_unicast_cmd, |
| 3546 | "address-family ipv6 unicast", |
| 3547 | "Enter Address Family command mode\n" |
| 3548 | "Address family\n" |
| 3549 | "unicast\n") |
| 3550 | { |
| 3551 | vty->node = BGP_IPV6_NODE; |
| 3552 | return CMD_SUCCESS; |
| 3553 | } |
| 3554 | |
| 3555 | ALIAS (address_family_ipv6_unicast, |
| 3556 | address_family_ipv6_cmd, |
| 3557 | "address-family ipv6", |
| 3558 | "Enter Address Family command mode\n" |
| 3559 | "Address family\n") |
| 3560 | |
| 3561 | DEFUN (address_family_vpnv4, |
| 3562 | address_family_vpnv4_cmd, |
| 3563 | "address-family vpnv4", |
| 3564 | "Enter Address Family command mode\n" |
| 3565 | "Address family\n") |
| 3566 | { |
| 3567 | vty->node = BGP_VPNV4_NODE; |
| 3568 | return CMD_SUCCESS; |
| 3569 | } |
| 3570 | |
| 3571 | ALIAS (address_family_vpnv4, |
| 3572 | address_family_vpnv4_unicast_cmd, |
| 3573 | "address-family vpnv4 unicast", |
| 3574 | "Enter Address Family command mode\n" |
| 3575 | "Address family\n" |
| 3576 | "Address Family Modifier\n") |
| 3577 | |
| 3578 | DEFUN (exit_address_family, |
| 3579 | exit_address_family_cmd, |
| 3580 | "exit-address-family", |
| 3581 | "Exit from Address Family configuration mode\n") |
| 3582 | { |
| 3583 | if (vty->node == BGP_IPV4M_NODE |
| 3584 | || vty->node == BGP_VPNV4_NODE |
| 3585 | || vty->node == BGP_IPV6_NODE) |
| 3586 | vty->node = BGP_NODE; |
| 3587 | return CMD_SUCCESS; |
| 3588 | } |
| 3589 | |
| 3590 | /* BGP clear sort. */ |
| 3591 | enum clear_sort |
| 3592 | { |
| 3593 | clear_all, |
| 3594 | clear_peer, |
| 3595 | clear_group, |
| 3596 | clear_external, |
| 3597 | clear_as |
| 3598 | }; |
| 3599 | |
| 3600 | void |
| 3601 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
| 3602 | safi_t safi, int error) |
| 3603 | { |
| 3604 | switch (error) |
| 3605 | { |
| 3606 | case BGP_ERR_AF_UNCONFIGURED: |
| 3607 | vty_out (vty, |
| 3608 | "%%BGP: Enable %s %s address family for the neighbor %s%s", |
| 3609 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", |
| 3610 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", |
| 3611 | peer->host, VTY_NEWLINE); |
| 3612 | break; |
| 3613 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: |
| 3614 | 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); |
| 3615 | break; |
| 3616 | default: |
| 3617 | break; |
| 3618 | } |
| 3619 | } |
| 3620 | |
| 3621 | /* `clear ip bgp' functions. */ |
| 3622 | int |
| 3623 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, |
| 3624 | enum clear_sort sort,enum bgp_clear_type stype, char *arg) |
| 3625 | { |
| 3626 | int ret; |
| 3627 | struct peer *peer; |
| 3628 | struct listnode *nn; |
| 3629 | |
| 3630 | /* Clear all neighbors. */ |
| 3631 | if (sort == clear_all) |
| 3632 | { |
| 3633 | LIST_LOOP (bgp->peer, peer, nn) |
| 3634 | { |
| 3635 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 3636 | ret = peer_clear (peer); |
| 3637 | else |
| 3638 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 3639 | |
| 3640 | if (ret < 0) |
| 3641 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 3642 | } |
| 3643 | return 0; |
| 3644 | } |
| 3645 | |
| 3646 | /* Clear specified neighbors. */ |
| 3647 | if (sort == clear_peer) |
| 3648 | { |
| 3649 | union sockunion su; |
| 3650 | int ret; |
| 3651 | |
| 3652 | /* Make sockunion for lookup. */ |
| 3653 | ret = str2sockunion (arg, &su); |
| 3654 | if (ret < 0) |
| 3655 | { |
| 3656 | vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE); |
| 3657 | return -1; |
| 3658 | } |
| 3659 | peer = peer_lookup (bgp, &su); |
| 3660 | if (! peer) |
| 3661 | { |
| 3662 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); |
| 3663 | return -1; |
| 3664 | } |
| 3665 | |
| 3666 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 3667 | ret = peer_clear (peer); |
| 3668 | else |
| 3669 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 3670 | |
| 3671 | if (ret < 0) |
| 3672 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 3673 | |
| 3674 | return 0; |
| 3675 | } |
| 3676 | |
| 3677 | /* Clear all peer-group members. */ |
| 3678 | if (sort == clear_group) |
| 3679 | { |
| 3680 | struct peer_group *group; |
| 3681 | |
| 3682 | group = peer_group_lookup (bgp, arg); |
| 3683 | if (! group) |
| 3684 | { |
| 3685 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); |
| 3686 | return -1; |
| 3687 | } |
| 3688 | |
| 3689 | LIST_LOOP (group->peer, peer, nn) |
| 3690 | { |
| 3691 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 3692 | { |
| 3693 | ret = peer_clear (peer); |
| 3694 | continue; |
| 3695 | } |
| 3696 | |
| 3697 | if (! peer->af_group[afi][safi]) |
| 3698 | continue; |
| 3699 | |
| 3700 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 3701 | |
| 3702 | if (ret < 0) |
| 3703 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 3704 | } |
| 3705 | return 0; |
| 3706 | } |
| 3707 | |
| 3708 | if (sort == clear_external) |
| 3709 | { |
| 3710 | LIST_LOOP (bgp->peer, peer, nn) |
| 3711 | { |
| 3712 | if (peer_sort (peer) == BGP_PEER_IBGP) |
| 3713 | continue; |
| 3714 | |
| 3715 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 3716 | ret = peer_clear (peer); |
| 3717 | else |
| 3718 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 3719 | |
| 3720 | if (ret < 0) |
| 3721 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 3722 | } |
| 3723 | return 0; |
| 3724 | } |
| 3725 | |
| 3726 | if (sort == clear_as) |
| 3727 | { |
| 3728 | as_t as; |
| 3729 | unsigned long as_ul; |
| 3730 | char *endptr = NULL; |
| 3731 | int find = 0; |
| 3732 | |
| 3733 | as_ul = strtoul(arg, &endptr, 10); |
| 3734 | |
| 3735 | if ((as_ul == ULONG_MAX) || (*endptr != '\0') || (as_ul > USHRT_MAX)) |
| 3736 | { |
| 3737 | vty_out (vty, "Invalid AS number%s", VTY_NEWLINE); |
| 3738 | return -1; |
| 3739 | } |
| 3740 | as = (as_t) as_ul; |
| 3741 | |
| 3742 | LIST_LOOP (bgp->peer, peer, nn) |
| 3743 | { |
| 3744 | if (peer->as != as) |
| 3745 | continue; |
| 3746 | |
| 3747 | find = 1; |
| 3748 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 3749 | ret = peer_clear (peer); |
| 3750 | else |
| 3751 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 3752 | |
| 3753 | if (ret < 0) |
| 3754 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 3755 | } |
| 3756 | if (! find) |
| 3757 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, |
| 3758 | VTY_NEWLINE); |
| 3759 | return 0; |
| 3760 | } |
| 3761 | |
| 3762 | return 0; |
| 3763 | } |
| 3764 | |
| 3765 | int |
| 3766 | bgp_clear_vty (struct vty *vty, char *name, afi_t afi, safi_t safi, |
| 3767 | enum clear_sort sort, enum bgp_clear_type stype, char *arg) |
| 3768 | { |
| 3769 | int ret; |
| 3770 | struct bgp *bgp; |
| 3771 | |
| 3772 | /* BGP structure lookup. */ |
| 3773 | if (name) |
| 3774 | { |
| 3775 | bgp = bgp_lookup_by_name (name); |
| 3776 | if (bgp == NULL) |
| 3777 | { |
| 3778 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); |
| 3779 | return CMD_WARNING; |
| 3780 | } |
| 3781 | } |
| 3782 | else |
| 3783 | { |
| 3784 | bgp = bgp_get_default (); |
| 3785 | if (bgp == NULL) |
| 3786 | { |
| 3787 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); |
| 3788 | return CMD_WARNING; |
| 3789 | } |
| 3790 | } |
| 3791 | |
| 3792 | ret = bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
| 3793 | if (ret < 0) |
| 3794 | return CMD_WARNING; |
| 3795 | |
| 3796 | return CMD_SUCCESS; |
| 3797 | } |
| 3798 | |
| 3799 | DEFUN (clear_ip_bgp_all, |
| 3800 | clear_ip_bgp_all_cmd, |
| 3801 | "clear ip bgp *", |
| 3802 | CLEAR_STR |
| 3803 | IP_STR |
| 3804 | BGP_STR |
| 3805 | "Clear all peers\n") |
| 3806 | { |
| 3807 | if (argc == 1) |
| 3808 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 3809 | |
| 3810 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 3811 | } |
| 3812 | |
| 3813 | ALIAS (clear_ip_bgp_all, |
| 3814 | clear_bgp_all_cmd, |
| 3815 | "clear bgp *", |
| 3816 | CLEAR_STR |
| 3817 | BGP_STR |
| 3818 | "Clear all peers\n") |
| 3819 | |
| 3820 | ALIAS (clear_ip_bgp_all, |
| 3821 | clear_bgp_ipv6_all_cmd, |
| 3822 | "clear bgp ipv6 *", |
| 3823 | CLEAR_STR |
| 3824 | BGP_STR |
| 3825 | "Address family\n" |
| 3826 | "Clear all peers\n") |
| 3827 | |
| 3828 | ALIAS (clear_ip_bgp_all, |
| 3829 | clear_ip_bgp_instance_all_cmd, |
| 3830 | "clear ip bgp view WORD *", |
| 3831 | CLEAR_STR |
| 3832 | IP_STR |
| 3833 | BGP_STR |
| 3834 | "BGP view\n" |
| 3835 | "view name\n" |
| 3836 | "Clear all peers\n") |
| 3837 | |
| 3838 | ALIAS (clear_ip_bgp_all, |
| 3839 | clear_bgp_instance_all_cmd, |
| 3840 | "clear bgp view WORD *", |
| 3841 | CLEAR_STR |
| 3842 | BGP_STR |
| 3843 | "BGP view\n" |
| 3844 | "view name\n" |
| 3845 | "Clear all peers\n") |
| 3846 | |
| 3847 | DEFUN (clear_ip_bgp_peer, |
| 3848 | clear_ip_bgp_peer_cmd, |
| 3849 | "clear ip bgp (A.B.C.D|X:X::X:X)", |
| 3850 | CLEAR_STR |
| 3851 | IP_STR |
| 3852 | BGP_STR |
| 3853 | "BGP neighbor IP address to clear\n" |
| 3854 | "BGP IPv6 neighbor to clear\n") |
| 3855 | { |
| 3856 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 3857 | } |
| 3858 | |
| 3859 | ALIAS (clear_ip_bgp_peer, |
| 3860 | clear_bgp_peer_cmd, |
| 3861 | "clear bgp (A.B.C.D|X:X::X:X)", |
| 3862 | CLEAR_STR |
| 3863 | BGP_STR |
| 3864 | "BGP neighbor address to clear\n" |
| 3865 | "BGP IPv6 neighbor to clear\n") |
| 3866 | |
| 3867 | ALIAS (clear_ip_bgp_peer, |
| 3868 | clear_bgp_ipv6_peer_cmd, |
| 3869 | "clear bgp ipv6 (A.B.C.D|X:X::X:X)", |
| 3870 | CLEAR_STR |
| 3871 | BGP_STR |
| 3872 | "Address family\n" |
| 3873 | "BGP neighbor address to clear\n" |
| 3874 | "BGP IPv6 neighbor to clear\n") |
| 3875 | |
| 3876 | DEFUN (clear_ip_bgp_peer_group, |
| 3877 | clear_ip_bgp_peer_group_cmd, |
| 3878 | "clear ip bgp peer-group WORD", |
| 3879 | CLEAR_STR |
| 3880 | IP_STR |
| 3881 | BGP_STR |
| 3882 | "Clear all members of peer-group\n" |
| 3883 | "BGP peer-group name\n") |
| 3884 | { |
| 3885 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 3886 | } |
| 3887 | |
| 3888 | ALIAS (clear_ip_bgp_peer_group, |
| 3889 | clear_bgp_peer_group_cmd, |
| 3890 | "clear bgp peer-group WORD", |
| 3891 | CLEAR_STR |
| 3892 | BGP_STR |
| 3893 | "Clear all members of peer-group\n" |
| 3894 | "BGP peer-group name\n") |
| 3895 | |
| 3896 | ALIAS (clear_ip_bgp_peer_group, |
| 3897 | clear_bgp_ipv6_peer_group_cmd, |
| 3898 | "clear bgp ipv6 peer-group WORD", |
| 3899 | CLEAR_STR |
| 3900 | BGP_STR |
| 3901 | "Address family\n" |
| 3902 | "Clear all members of peer-group\n" |
| 3903 | "BGP peer-group name\n") |
| 3904 | |
| 3905 | DEFUN (clear_ip_bgp_external, |
| 3906 | clear_ip_bgp_external_cmd, |
| 3907 | "clear ip bgp external", |
| 3908 | CLEAR_STR |
| 3909 | IP_STR |
| 3910 | BGP_STR |
| 3911 | "Clear all external peers\n") |
| 3912 | { |
| 3913 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
| 3914 | } |
| 3915 | |
| 3916 | ALIAS (clear_ip_bgp_external, |
| 3917 | clear_bgp_external_cmd, |
| 3918 | "clear bgp external", |
| 3919 | CLEAR_STR |
| 3920 | BGP_STR |
| 3921 | "Clear all external peers\n") |
| 3922 | |
| 3923 | ALIAS (clear_ip_bgp_external, |
| 3924 | clear_bgp_ipv6_external_cmd, |
| 3925 | "clear bgp ipv6 external", |
| 3926 | CLEAR_STR |
| 3927 | BGP_STR |
| 3928 | "Address family\n" |
| 3929 | "Clear all external peers\n") |
| 3930 | |
| 3931 | DEFUN (clear_ip_bgp_as, |
| 3932 | clear_ip_bgp_as_cmd, |
| 3933 | "clear ip bgp <1-65535>", |
| 3934 | CLEAR_STR |
| 3935 | IP_STR |
| 3936 | BGP_STR |
| 3937 | "Clear peers with the AS number\n") |
| 3938 | { |
| 3939 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 3940 | } |
| 3941 | |
| 3942 | ALIAS (clear_ip_bgp_as, |
| 3943 | clear_bgp_as_cmd, |
| 3944 | "clear bgp <1-65535>", |
| 3945 | CLEAR_STR |
| 3946 | BGP_STR |
| 3947 | "Clear peers with the AS number\n") |
| 3948 | |
| 3949 | ALIAS (clear_ip_bgp_as, |
| 3950 | clear_bgp_ipv6_as_cmd, |
| 3951 | "clear bgp ipv6 <1-65535>", |
| 3952 | CLEAR_STR |
| 3953 | BGP_STR |
| 3954 | "Address family\n" |
| 3955 | "Clear peers with the AS number\n") |
| 3956 | |
| 3957 | /* Outbound soft-reconfiguration */ |
| 3958 | DEFUN (clear_ip_bgp_all_soft_out, |
| 3959 | clear_ip_bgp_all_soft_out_cmd, |
| 3960 | "clear ip bgp * soft out", |
| 3961 | CLEAR_STR |
| 3962 | IP_STR |
| 3963 | BGP_STR |
| 3964 | "Clear all peers\n" |
| 3965 | "Soft reconfig\n" |
| 3966 | "Soft reconfig outbound update\n") |
| 3967 | { |
| 3968 | if (argc == 1) |
| 3969 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 3970 | BGP_CLEAR_SOFT_OUT, NULL); |
| 3971 | |
| 3972 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 3973 | BGP_CLEAR_SOFT_OUT, NULL); |
| 3974 | } |
| 3975 | |
| 3976 | ALIAS (clear_ip_bgp_all_soft_out, |
| 3977 | clear_ip_bgp_all_out_cmd, |
| 3978 | "clear ip bgp * out", |
| 3979 | CLEAR_STR |
| 3980 | IP_STR |
| 3981 | BGP_STR |
| 3982 | "Clear all peers\n" |
| 3983 | "Soft reconfig outbound update\n") |
| 3984 | |
| 3985 | ALIAS (clear_ip_bgp_all_soft_out, |
| 3986 | clear_ip_bgp_instance_all_soft_out_cmd, |
| 3987 | "clear ip bgp view WORD * soft out", |
| 3988 | CLEAR_STR |
| 3989 | IP_STR |
| 3990 | BGP_STR |
| 3991 | "BGP view\n" |
| 3992 | "view name\n" |
| 3993 | "Clear all peers\n" |
| 3994 | "Soft reconfig\n" |
| 3995 | "Soft reconfig outbound update\n") |
| 3996 | |
| 3997 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, |
| 3998 | clear_ip_bgp_all_ipv4_soft_out_cmd, |
| 3999 | "clear ip bgp * ipv4 (unicast|multicast) soft out", |
| 4000 | CLEAR_STR |
| 4001 | IP_STR |
| 4002 | BGP_STR |
| 4003 | "Clear all peers\n" |
| 4004 | "Address family\n" |
| 4005 | "Address Family modifier\n" |
| 4006 | "Address Family modifier\n" |
| 4007 | "Soft reconfig\n" |
| 4008 | "Soft reconfig outbound update\n") |
| 4009 | { |
| 4010 | if (strncmp (argv[0], "m", 1) == 0) |
| 4011 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 4012 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4013 | |
| 4014 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4015 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4016 | } |
| 4017 | |
| 4018 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, |
| 4019 | clear_ip_bgp_all_ipv4_out_cmd, |
| 4020 | "clear ip bgp * ipv4 (unicast|multicast) out", |
| 4021 | CLEAR_STR |
| 4022 | IP_STR |
| 4023 | BGP_STR |
| 4024 | "Clear all peers\n" |
| 4025 | "Address family\n" |
| 4026 | "Address Family modifier\n" |
| 4027 | "Address Family modifier\n" |
| 4028 | "Soft reconfig outbound update\n") |
| 4029 | |
| 4030 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
| 4031 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, |
| 4032 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", |
| 4033 | CLEAR_STR |
| 4034 | IP_STR |
| 4035 | BGP_STR |
| 4036 | "BGP view\n" |
| 4037 | "view name\n" |
| 4038 | "Clear all peers\n" |
| 4039 | "Address family\n" |
| 4040 | "Address Family modifier\n" |
| 4041 | "Address Family modifier\n" |
| 4042 | "Soft reconfig outbound update\n") |
| 4043 | { |
| 4044 | if (strncmp (argv[1], "m", 1) == 0) |
| 4045 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 4046 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4047 | |
| 4048 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4049 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4050 | } |
| 4051 | |
| 4052 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, |
| 4053 | clear_ip_bgp_all_vpnv4_soft_out_cmd, |
| 4054 | "clear ip bgp * vpnv4 unicast soft out", |
| 4055 | CLEAR_STR |
| 4056 | IP_STR |
| 4057 | BGP_STR |
| 4058 | "Clear all peers\n" |
| 4059 | "Address family\n" |
| 4060 | "Address Family Modifier\n" |
| 4061 | "Soft reconfig\n" |
| 4062 | "Soft reconfig outbound update\n") |
| 4063 | { |
| 4064 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 4065 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4066 | } |
| 4067 | |
| 4068 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, |
| 4069 | clear_ip_bgp_all_vpnv4_out_cmd, |
| 4070 | "clear ip bgp * vpnv4 unicast out", |
| 4071 | CLEAR_STR |
| 4072 | IP_STR |
| 4073 | BGP_STR |
| 4074 | "Clear all peers\n" |
| 4075 | "Address family\n" |
| 4076 | "Address Family Modifier\n" |
| 4077 | "Soft reconfig outbound update\n") |
| 4078 | |
| 4079 | DEFUN (clear_bgp_all_soft_out, |
| 4080 | clear_bgp_all_soft_out_cmd, |
| 4081 | "clear bgp * soft out", |
| 4082 | CLEAR_STR |
| 4083 | BGP_STR |
| 4084 | "Clear all peers\n" |
| 4085 | "Soft reconfig\n" |
| 4086 | "Soft reconfig outbound update\n") |
| 4087 | { |
| 4088 | if (argc == 1) |
| 4089 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 4090 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4091 | |
| 4092 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 4093 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4094 | } |
| 4095 | |
| 4096 | ALIAS (clear_bgp_all_soft_out, |
| 4097 | clear_bgp_instance_all_soft_out_cmd, |
| 4098 | "clear bgp view WORD * soft out", |
| 4099 | CLEAR_STR |
| 4100 | BGP_STR |
| 4101 | "BGP view\n" |
| 4102 | "view name\n" |
| 4103 | "Clear all peers\n" |
| 4104 | "Soft reconfig\n" |
| 4105 | "Soft reconfig outbound update\n") |
| 4106 | |
| 4107 | ALIAS (clear_bgp_all_soft_out, |
| 4108 | clear_bgp_all_out_cmd, |
| 4109 | "clear bgp * out", |
| 4110 | CLEAR_STR |
| 4111 | BGP_STR |
| 4112 | "Clear all peers\n" |
| 4113 | "Soft reconfig outbound update\n") |
| 4114 | |
| 4115 | ALIAS (clear_bgp_all_soft_out, |
| 4116 | clear_bgp_ipv6_all_soft_out_cmd, |
| 4117 | "clear bgp ipv6 * soft out", |
| 4118 | CLEAR_STR |
| 4119 | BGP_STR |
| 4120 | "Address family\n" |
| 4121 | "Clear all peers\n" |
| 4122 | "Soft reconfig\n" |
| 4123 | "Soft reconfig outbound update\n") |
| 4124 | |
| 4125 | ALIAS (clear_bgp_all_soft_out, |
| 4126 | clear_bgp_ipv6_all_out_cmd, |
| 4127 | "clear bgp ipv6 * out", |
| 4128 | CLEAR_STR |
| 4129 | BGP_STR |
| 4130 | "Address family\n" |
| 4131 | "Clear all peers\n" |
| 4132 | "Soft reconfig outbound update\n") |
| 4133 | |
| 4134 | DEFUN (clear_ip_bgp_peer_soft_out, |
| 4135 | clear_ip_bgp_peer_soft_out_cmd, |
| 4136 | "clear ip bgp A.B.C.D soft out", |
| 4137 | CLEAR_STR |
| 4138 | IP_STR |
| 4139 | BGP_STR |
| 4140 | "BGP neighbor address to clear\n" |
| 4141 | "Soft reconfig\n" |
| 4142 | "Soft reconfig outbound update\n") |
| 4143 | { |
| 4144 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4145 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4146 | } |
| 4147 | |
| 4148 | ALIAS (clear_ip_bgp_peer_soft_out, |
| 4149 | clear_ip_bgp_peer_out_cmd, |
| 4150 | "clear ip bgp A.B.C.D out", |
| 4151 | CLEAR_STR |
| 4152 | IP_STR |
| 4153 | BGP_STR |
| 4154 | "BGP neighbor address to clear\n" |
| 4155 | "Soft reconfig outbound update\n") |
| 4156 | |
| 4157 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
| 4158 | clear_ip_bgp_peer_ipv4_soft_out_cmd, |
| 4159 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", |
| 4160 | CLEAR_STR |
| 4161 | IP_STR |
| 4162 | BGP_STR |
| 4163 | "BGP neighbor address to clear\n" |
| 4164 | "Address family\n" |
| 4165 | "Address Family modifier\n" |
| 4166 | "Address Family modifier\n" |
| 4167 | "Soft reconfig\n" |
| 4168 | "Soft reconfig outbound update\n") |
| 4169 | { |
| 4170 | if (strncmp (argv[1], "m", 1) == 0) |
| 4171 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 4172 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4173 | |
| 4174 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4175 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4176 | } |
| 4177 | |
| 4178 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, |
| 4179 | clear_ip_bgp_peer_ipv4_out_cmd, |
| 4180 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", |
| 4181 | CLEAR_STR |
| 4182 | IP_STR |
| 4183 | BGP_STR |
| 4184 | "BGP neighbor address to clear\n" |
| 4185 | "Address family\n" |
| 4186 | "Address Family modifier\n" |
| 4187 | "Address Family modifier\n" |
| 4188 | "Soft reconfig outbound update\n") |
| 4189 | |
| 4190 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4191 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, |
| 4192 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", |
| 4193 | CLEAR_STR |
| 4194 | IP_STR |
| 4195 | BGP_STR |
| 4196 | "BGP neighbor address to clear\n" |
| 4197 | "Address family\n" |
| 4198 | "Address Family Modifier\n" |
| 4199 | "Soft reconfig\n" |
| 4200 | "Soft reconfig outbound update\n") |
| 4201 | { |
| 4202 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 4203 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4204 | } |
| 4205 | |
| 4206 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4207 | clear_ip_bgp_peer_vpnv4_out_cmd, |
| 4208 | "clear ip bgp A.B.C.D vpnv4 unicast out", |
| 4209 | CLEAR_STR |
| 4210 | IP_STR |
| 4211 | BGP_STR |
| 4212 | "BGP neighbor address to clear\n" |
| 4213 | "Address family\n" |
| 4214 | "Address Family Modifier\n" |
| 4215 | "Soft reconfig outbound update\n") |
| 4216 | |
| 4217 | DEFUN (clear_bgp_peer_soft_out, |
| 4218 | clear_bgp_peer_soft_out_cmd, |
| 4219 | "clear bgp (A.B.C.D|X:X::X:X) soft out", |
| 4220 | CLEAR_STR |
| 4221 | BGP_STR |
| 4222 | "BGP neighbor address to clear\n" |
| 4223 | "BGP IPv6 neighbor to clear\n" |
| 4224 | "Soft reconfig\n" |
| 4225 | "Soft reconfig outbound update\n") |
| 4226 | { |
| 4227 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 4228 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4229 | } |
| 4230 | |
| 4231 | ALIAS (clear_bgp_peer_soft_out, |
| 4232 | clear_bgp_ipv6_peer_soft_out_cmd, |
| 4233 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out", |
| 4234 | CLEAR_STR |
| 4235 | BGP_STR |
| 4236 | "Address family\n" |
| 4237 | "BGP neighbor address to clear\n" |
| 4238 | "BGP IPv6 neighbor to clear\n" |
| 4239 | "Soft reconfig\n" |
| 4240 | "Soft reconfig outbound update\n") |
| 4241 | |
| 4242 | ALIAS (clear_bgp_peer_soft_out, |
| 4243 | clear_bgp_peer_out_cmd, |
| 4244 | "clear bgp (A.B.C.D|X:X::X:X) out", |
| 4245 | CLEAR_STR |
| 4246 | BGP_STR |
| 4247 | "BGP neighbor address to clear\n" |
| 4248 | "BGP IPv6 neighbor to clear\n" |
| 4249 | "Soft reconfig outbound update\n") |
| 4250 | |
| 4251 | ALIAS (clear_bgp_peer_soft_out, |
| 4252 | clear_bgp_ipv6_peer_out_cmd, |
| 4253 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) out", |
| 4254 | CLEAR_STR |
| 4255 | BGP_STR |
| 4256 | "Address family\n" |
| 4257 | "BGP neighbor address to clear\n" |
| 4258 | "BGP IPv6 neighbor to clear\n" |
| 4259 | "Soft reconfig outbound update\n") |
| 4260 | |
| 4261 | DEFUN (clear_ip_bgp_peer_group_soft_out, |
| 4262 | clear_ip_bgp_peer_group_soft_out_cmd, |
| 4263 | "clear ip bgp peer-group WORD soft out", |
| 4264 | CLEAR_STR |
| 4265 | IP_STR |
| 4266 | BGP_STR |
| 4267 | "Clear all members of peer-group\n" |
| 4268 | "BGP peer-group name\n" |
| 4269 | "Soft reconfig\n" |
| 4270 | "Soft reconfig outbound update\n") |
| 4271 | { |
| 4272 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4273 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4274 | } |
| 4275 | |
| 4276 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
| 4277 | clear_ip_bgp_peer_group_out_cmd, |
| 4278 | "clear ip bgp peer-group WORD out", |
| 4279 | CLEAR_STR |
| 4280 | IP_STR |
| 4281 | BGP_STR |
| 4282 | "Clear all members of peer-group\n" |
| 4283 | "BGP peer-group name\n" |
| 4284 | "Soft reconfig outbound update\n") |
| 4285 | |
| 4286 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4287 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, |
| 4288 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", |
| 4289 | CLEAR_STR |
| 4290 | IP_STR |
| 4291 | BGP_STR |
| 4292 | "Clear all members of peer-group\n" |
| 4293 | "BGP peer-group name\n" |
| 4294 | "Address family\n" |
| 4295 | "Address Family modifier\n" |
| 4296 | "Address Family modifier\n" |
| 4297 | "Soft reconfig\n" |
| 4298 | "Soft reconfig outbound update\n") |
| 4299 | { |
| 4300 | if (strncmp (argv[1], "m", 1) == 0) |
| 4301 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 4302 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4303 | |
| 4304 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4305 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4306 | } |
| 4307 | |
| 4308 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4309 | clear_ip_bgp_peer_group_ipv4_out_cmd, |
| 4310 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", |
| 4311 | CLEAR_STR |
| 4312 | IP_STR |
| 4313 | BGP_STR |
| 4314 | "Clear all members of peer-group\n" |
| 4315 | "BGP peer-group name\n" |
| 4316 | "Address family\n" |
| 4317 | "Address Family modifier\n" |
| 4318 | "Address Family modifier\n" |
| 4319 | "Soft reconfig outbound update\n") |
| 4320 | |
| 4321 | DEFUN (clear_bgp_peer_group_soft_out, |
| 4322 | clear_bgp_peer_group_soft_out_cmd, |
| 4323 | "clear bgp peer-group WORD soft out", |
| 4324 | CLEAR_STR |
| 4325 | BGP_STR |
| 4326 | "Clear all members of peer-group\n" |
| 4327 | "BGP peer-group name\n" |
| 4328 | "Soft reconfig\n" |
| 4329 | "Soft reconfig outbound update\n") |
| 4330 | { |
| 4331 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 4332 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4333 | } |
| 4334 | |
| 4335 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4336 | clear_bgp_ipv6_peer_group_soft_out_cmd, |
| 4337 | "clear bgp ipv6 peer-group WORD soft out", |
| 4338 | CLEAR_STR |
| 4339 | BGP_STR |
| 4340 | "Address family\n" |
| 4341 | "Clear all members of peer-group\n" |
| 4342 | "BGP peer-group name\n" |
| 4343 | "Soft reconfig\n" |
| 4344 | "Soft reconfig outbound update\n") |
| 4345 | |
| 4346 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4347 | clear_bgp_peer_group_out_cmd, |
| 4348 | "clear bgp peer-group WORD out", |
| 4349 | CLEAR_STR |
| 4350 | BGP_STR |
| 4351 | "Clear all members of peer-group\n" |
| 4352 | "BGP peer-group name\n" |
| 4353 | "Soft reconfig outbound update\n") |
| 4354 | |
| 4355 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4356 | clear_bgp_ipv6_peer_group_out_cmd, |
| 4357 | "clear bgp ipv6 peer-group WORD out", |
| 4358 | CLEAR_STR |
| 4359 | BGP_STR |
| 4360 | "Address family\n" |
| 4361 | "Clear all members of peer-group\n" |
| 4362 | "BGP peer-group name\n" |
| 4363 | "Soft reconfig outbound update\n") |
| 4364 | |
| 4365 | DEFUN (clear_ip_bgp_external_soft_out, |
| 4366 | clear_ip_bgp_external_soft_out_cmd, |
| 4367 | "clear ip bgp external soft out", |
| 4368 | CLEAR_STR |
| 4369 | IP_STR |
| 4370 | BGP_STR |
| 4371 | "Clear all external peers\n" |
| 4372 | "Soft reconfig\n" |
| 4373 | "Soft reconfig outbound update\n") |
| 4374 | { |
| 4375 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 4376 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4377 | } |
| 4378 | |
| 4379 | ALIAS (clear_ip_bgp_external_soft_out, |
| 4380 | clear_ip_bgp_external_out_cmd, |
| 4381 | "clear ip bgp external out", |
| 4382 | CLEAR_STR |
| 4383 | IP_STR |
| 4384 | BGP_STR |
| 4385 | "Clear all external peers\n" |
| 4386 | "Soft reconfig outbound update\n") |
| 4387 | |
| 4388 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, |
| 4389 | clear_ip_bgp_external_ipv4_soft_out_cmd, |
| 4390 | "clear ip bgp external ipv4 (unicast|multicast) soft out", |
| 4391 | CLEAR_STR |
| 4392 | IP_STR |
| 4393 | BGP_STR |
| 4394 | "Clear all external peers\n" |
| 4395 | "Address family\n" |
| 4396 | "Address Family modifier\n" |
| 4397 | "Address Family modifier\n" |
| 4398 | "Soft reconfig\n" |
| 4399 | "Soft reconfig outbound update\n") |
| 4400 | { |
| 4401 | if (strncmp (argv[0], "m", 1) == 0) |
| 4402 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 4403 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4404 | |
| 4405 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 4406 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4407 | } |
| 4408 | |
| 4409 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, |
| 4410 | clear_ip_bgp_external_ipv4_out_cmd, |
| 4411 | "clear ip bgp external ipv4 (unicast|multicast) out", |
| 4412 | CLEAR_STR |
| 4413 | IP_STR |
| 4414 | BGP_STR |
| 4415 | "Clear all external peers\n" |
| 4416 | "Address family\n" |
| 4417 | "Address Family modifier\n" |
| 4418 | "Address Family modifier\n" |
| 4419 | "Soft reconfig outbound update\n") |
| 4420 | |
| 4421 | DEFUN (clear_bgp_external_soft_out, |
| 4422 | clear_bgp_external_soft_out_cmd, |
| 4423 | "clear bgp external soft out", |
| 4424 | CLEAR_STR |
| 4425 | BGP_STR |
| 4426 | "Clear all external peers\n" |
| 4427 | "Soft reconfig\n" |
| 4428 | "Soft reconfig outbound update\n") |
| 4429 | { |
| 4430 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 4431 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4432 | } |
| 4433 | |
| 4434 | ALIAS (clear_bgp_external_soft_out, |
| 4435 | clear_bgp_ipv6_external_soft_out_cmd, |
| 4436 | "clear bgp ipv6 external soft out", |
| 4437 | CLEAR_STR |
| 4438 | BGP_STR |
| 4439 | "Address family\n" |
| 4440 | "Clear all external peers\n" |
| 4441 | "Soft reconfig\n" |
| 4442 | "Soft reconfig outbound update\n") |
| 4443 | |
| 4444 | ALIAS (clear_bgp_external_soft_out, |
| 4445 | clear_bgp_external_out_cmd, |
| 4446 | "clear bgp external out", |
| 4447 | CLEAR_STR |
| 4448 | BGP_STR |
| 4449 | "Clear all external peers\n" |
| 4450 | "Soft reconfig outbound update\n") |
| 4451 | |
| 4452 | ALIAS (clear_bgp_external_soft_out, |
| 4453 | clear_bgp_ipv6_external_out_cmd, |
| 4454 | "clear bgp ipv6 external WORD out", |
| 4455 | CLEAR_STR |
| 4456 | BGP_STR |
| 4457 | "Address family\n" |
| 4458 | "Clear all external peers\n" |
| 4459 | "Soft reconfig outbound update\n") |
| 4460 | |
| 4461 | DEFUN (clear_ip_bgp_as_soft_out, |
| 4462 | clear_ip_bgp_as_soft_out_cmd, |
| 4463 | "clear ip bgp <1-65535> soft out", |
| 4464 | CLEAR_STR |
| 4465 | IP_STR |
| 4466 | BGP_STR |
| 4467 | "Clear peers with the AS number\n" |
| 4468 | "Soft reconfig\n" |
| 4469 | "Soft reconfig outbound update\n") |
| 4470 | { |
| 4471 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 4472 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4473 | } |
| 4474 | |
| 4475 | ALIAS (clear_ip_bgp_as_soft_out, |
| 4476 | clear_ip_bgp_as_out_cmd, |
| 4477 | "clear ip bgp <1-65535> out", |
| 4478 | CLEAR_STR |
| 4479 | IP_STR |
| 4480 | BGP_STR |
| 4481 | "Clear peers with the AS number\n" |
| 4482 | "Soft reconfig outbound update\n") |
| 4483 | |
| 4484 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
| 4485 | clear_ip_bgp_as_ipv4_soft_out_cmd, |
| 4486 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft out", |
| 4487 | CLEAR_STR |
| 4488 | IP_STR |
| 4489 | BGP_STR |
| 4490 | "Clear peers with the AS number\n" |
| 4491 | "Address family\n" |
| 4492 | "Address Family modifier\n" |
| 4493 | "Address Family modifier\n" |
| 4494 | "Soft reconfig\n" |
| 4495 | "Soft reconfig outbound update\n") |
| 4496 | { |
| 4497 | if (strncmp (argv[1], "m", 1) == 0) |
| 4498 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 4499 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4500 | |
| 4501 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 4502 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4503 | } |
| 4504 | |
| 4505 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, |
| 4506 | clear_ip_bgp_as_ipv4_out_cmd, |
| 4507 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) out", |
| 4508 | CLEAR_STR |
| 4509 | IP_STR |
| 4510 | BGP_STR |
| 4511 | "Clear peers with the AS number\n" |
| 4512 | "Address family\n" |
| 4513 | "Address Family modifier\n" |
| 4514 | "Address Family modifier\n" |
| 4515 | "Soft reconfig outbound update\n") |
| 4516 | |
| 4517 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
| 4518 | clear_ip_bgp_as_vpnv4_soft_out_cmd, |
| 4519 | "clear ip bgp <1-65535> vpnv4 unicast soft out", |
| 4520 | CLEAR_STR |
| 4521 | IP_STR |
| 4522 | BGP_STR |
| 4523 | "Clear peers with the AS number\n" |
| 4524 | "Address family\n" |
| 4525 | "Address Family modifier\n" |
| 4526 | "Soft reconfig\n" |
| 4527 | "Soft reconfig outbound update\n") |
| 4528 | { |
| 4529 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 4530 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4531 | } |
| 4532 | |
| 4533 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, |
| 4534 | clear_ip_bgp_as_vpnv4_out_cmd, |
| 4535 | "clear ip bgp <1-65535> vpnv4 unicast out", |
| 4536 | CLEAR_STR |
| 4537 | IP_STR |
| 4538 | BGP_STR |
| 4539 | "Clear peers with the AS number\n" |
| 4540 | "Address family\n" |
| 4541 | "Address Family modifier\n" |
| 4542 | "Soft reconfig outbound update\n") |
| 4543 | |
| 4544 | DEFUN (clear_bgp_as_soft_out, |
| 4545 | clear_bgp_as_soft_out_cmd, |
| 4546 | "clear bgp <1-65535> soft out", |
| 4547 | CLEAR_STR |
| 4548 | BGP_STR |
| 4549 | "Clear peers with the AS number\n" |
| 4550 | "Soft reconfig\n" |
| 4551 | "Soft reconfig outbound update\n") |
| 4552 | { |
| 4553 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 4554 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4555 | } |
| 4556 | |
| 4557 | ALIAS (clear_bgp_as_soft_out, |
| 4558 | clear_bgp_ipv6_as_soft_out_cmd, |
| 4559 | "clear bgp ipv6 <1-65535> soft out", |
| 4560 | CLEAR_STR |
| 4561 | BGP_STR |
| 4562 | "Address family\n" |
| 4563 | "Clear peers with the AS number\n" |
| 4564 | "Soft reconfig\n" |
| 4565 | "Soft reconfig outbound update\n") |
| 4566 | |
| 4567 | ALIAS (clear_bgp_as_soft_out, |
| 4568 | clear_bgp_as_out_cmd, |
| 4569 | "clear bgp <1-65535> out", |
| 4570 | CLEAR_STR |
| 4571 | BGP_STR |
| 4572 | "Clear peers with the AS number\n" |
| 4573 | "Soft reconfig outbound update\n") |
| 4574 | |
| 4575 | ALIAS (clear_bgp_as_soft_out, |
| 4576 | clear_bgp_ipv6_as_out_cmd, |
| 4577 | "clear bgp ipv6 <1-65535> out", |
| 4578 | CLEAR_STR |
| 4579 | BGP_STR |
| 4580 | "Address family\n" |
| 4581 | "Clear peers with the AS number\n" |
| 4582 | "Soft reconfig outbound update\n") |
| 4583 | |
| 4584 | /* Inbound soft-reconfiguration */ |
| 4585 | DEFUN (clear_ip_bgp_all_soft_in, |
| 4586 | clear_ip_bgp_all_soft_in_cmd, |
| 4587 | "clear ip bgp * soft in", |
| 4588 | CLEAR_STR |
| 4589 | IP_STR |
| 4590 | BGP_STR |
| 4591 | "Clear all peers\n" |
| 4592 | "Soft reconfig\n" |
| 4593 | "Soft reconfig inbound update\n") |
| 4594 | { |
| 4595 | if (argc == 1) |
| 4596 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4597 | BGP_CLEAR_SOFT_IN, NULL); |
| 4598 | |
| 4599 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4600 | BGP_CLEAR_SOFT_IN, NULL); |
| 4601 | } |
| 4602 | |
| 4603 | ALIAS (clear_ip_bgp_all_soft_in, |
| 4604 | clear_ip_bgp_instance_all_soft_in_cmd, |
| 4605 | "clear ip bgp view WORD * soft in", |
| 4606 | CLEAR_STR |
| 4607 | IP_STR |
| 4608 | BGP_STR |
| 4609 | "BGP view\n" |
| 4610 | "view name\n" |
| 4611 | "Clear all peers\n" |
| 4612 | "Soft reconfig\n" |
| 4613 | "Soft reconfig inbound update\n") |
| 4614 | |
| 4615 | ALIAS (clear_ip_bgp_all_soft_in, |
| 4616 | clear_ip_bgp_all_in_cmd, |
| 4617 | "clear ip bgp * in", |
| 4618 | CLEAR_STR |
| 4619 | IP_STR |
| 4620 | BGP_STR |
| 4621 | "Clear all peers\n" |
| 4622 | "Soft reconfig inbound update\n") |
| 4623 | |
| 4624 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
| 4625 | clear_ip_bgp_all_in_prefix_filter_cmd, |
| 4626 | "clear ip bgp * in prefix-filter", |
| 4627 | CLEAR_STR |
| 4628 | IP_STR |
| 4629 | BGP_STR |
| 4630 | "Clear all peers\n" |
| 4631 | "Soft reconfig inbound update\n" |
| 4632 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 4633 | { |
| 4634 | if (argc== 1) |
| 4635 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4636 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 4637 | |
| 4638 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4639 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 4640 | } |
| 4641 | |
| 4642 | ALIAS (clear_ip_bgp_all_in_prefix_filter, |
| 4643 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, |
| 4644 | "clear ip bgp view WORD * in prefix-filter", |
| 4645 | CLEAR_STR |
| 4646 | IP_STR |
| 4647 | BGP_STR |
| 4648 | "BGP view\n" |
| 4649 | "view name\n" |
| 4650 | "Clear all peers\n" |
| 4651 | "Soft reconfig inbound update\n" |
| 4652 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 4653 | |
| 4654 | |
| 4655 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
| 4656 | clear_ip_bgp_all_ipv4_soft_in_cmd, |
| 4657 | "clear ip bgp * ipv4 (unicast|multicast) soft in", |
| 4658 | CLEAR_STR |
| 4659 | IP_STR |
| 4660 | BGP_STR |
| 4661 | "Clear all peers\n" |
| 4662 | "Address family\n" |
| 4663 | "Address Family modifier\n" |
| 4664 | "Address Family modifier\n" |
| 4665 | "Soft reconfig\n" |
| 4666 | "Soft reconfig inbound update\n") |
| 4667 | { |
| 4668 | if (strncmp (argv[0], "m", 1) == 0) |
| 4669 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 4670 | BGP_CLEAR_SOFT_IN, NULL); |
| 4671 | |
| 4672 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4673 | BGP_CLEAR_SOFT_IN, NULL); |
| 4674 | } |
| 4675 | |
| 4676 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, |
| 4677 | clear_ip_bgp_all_ipv4_in_cmd, |
| 4678 | "clear ip bgp * ipv4 (unicast|multicast) in", |
| 4679 | CLEAR_STR |
| 4680 | IP_STR |
| 4681 | BGP_STR |
| 4682 | "Clear all peers\n" |
| 4683 | "Address family\n" |
| 4684 | "Address Family modifier\n" |
| 4685 | "Address Family modifier\n" |
| 4686 | "Soft reconfig inbound update\n") |
| 4687 | |
| 4688 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
| 4689 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, |
| 4690 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", |
| 4691 | CLEAR_STR |
| 4692 | IP_STR |
| 4693 | BGP_STR |
| 4694 | "BGP view\n" |
| 4695 | "view name\n" |
| 4696 | "Clear all peers\n" |
| 4697 | "Address family\n" |
| 4698 | "Address Family modifier\n" |
| 4699 | "Address Family modifier\n" |
| 4700 | "Soft reconfig\n" |
| 4701 | "Soft reconfig inbound update\n") |
| 4702 | { |
| 4703 | if (strncmp (argv[1], "m", 1) == 0) |
| 4704 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 4705 | BGP_CLEAR_SOFT_IN, NULL); |
| 4706 | |
| 4707 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4708 | BGP_CLEAR_SOFT_IN, NULL); |
| 4709 | } |
| 4710 | |
| 4711 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
| 4712 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, |
| 4713 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", |
| 4714 | CLEAR_STR |
| 4715 | IP_STR |
| 4716 | BGP_STR |
| 4717 | "Clear all peers\n" |
| 4718 | "Address family\n" |
| 4719 | "Address Family modifier\n" |
| 4720 | "Address Family modifier\n" |
| 4721 | "Soft reconfig inbound update\n" |
| 4722 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 4723 | { |
| 4724 | if (strncmp (argv[0], "m", 1) == 0) |
| 4725 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 4726 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 4727 | |
| 4728 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4729 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 4730 | } |
| 4731 | |
| 4732 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, |
| 4733 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, |
| 4734 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", |
| 4735 | CLEAR_STR |
| 4736 | IP_STR |
| 4737 | BGP_STR |
| 4738 | "Clear all peers\n" |
| 4739 | "Address family\n" |
| 4740 | "Address Family modifier\n" |
| 4741 | "Address Family modifier\n" |
| 4742 | "Soft reconfig inbound update\n" |
| 4743 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 4744 | { |
| 4745 | if (strncmp (argv[1], "m", 1) == 0) |
| 4746 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 4747 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 4748 | |
| 4749 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4750 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 4751 | } |
| 4752 | |
| 4753 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, |
| 4754 | clear_ip_bgp_all_vpnv4_soft_in_cmd, |
| 4755 | "clear ip bgp * vpnv4 unicast soft in", |
| 4756 | CLEAR_STR |
| 4757 | IP_STR |
| 4758 | BGP_STR |
| 4759 | "Clear all peers\n" |
| 4760 | "Address family\n" |
| 4761 | "Address Family Modifier\n" |
| 4762 | "Soft reconfig\n" |
| 4763 | "Soft reconfig inbound update\n") |
| 4764 | { |
| 4765 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 4766 | BGP_CLEAR_SOFT_IN, NULL); |
| 4767 | } |
| 4768 | |
| 4769 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, |
| 4770 | clear_ip_bgp_all_vpnv4_in_cmd, |
| 4771 | "clear ip bgp * vpnv4 unicast in", |
| 4772 | CLEAR_STR |
| 4773 | IP_STR |
| 4774 | BGP_STR |
| 4775 | "Clear all peers\n" |
| 4776 | "Address family\n" |
| 4777 | "Address Family Modifier\n" |
| 4778 | "Soft reconfig inbound update\n") |
| 4779 | |
| 4780 | DEFUN (clear_bgp_all_soft_in, |
| 4781 | clear_bgp_all_soft_in_cmd, |
| 4782 | "clear bgp * soft in", |
| 4783 | CLEAR_STR |
| 4784 | BGP_STR |
| 4785 | "Clear all peers\n" |
| 4786 | "Soft reconfig\n" |
| 4787 | "Soft reconfig inbound update\n") |
| 4788 | { |
| 4789 | if (argc == 1) |
| 4790 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 4791 | BGP_CLEAR_SOFT_IN, NULL); |
| 4792 | |
| 4793 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 4794 | BGP_CLEAR_SOFT_IN, NULL); |
| 4795 | } |
| 4796 | |
| 4797 | ALIAS (clear_bgp_all_soft_in, |
| 4798 | clear_bgp_instance_all_soft_in_cmd, |
| 4799 | "clear bgp view WORD * soft in", |
| 4800 | CLEAR_STR |
| 4801 | BGP_STR |
| 4802 | "BGP view\n" |
| 4803 | "view name\n" |
| 4804 | "Clear all peers\n" |
| 4805 | "Soft reconfig\n" |
| 4806 | "Soft reconfig inbound update\n") |
| 4807 | |
| 4808 | ALIAS (clear_bgp_all_soft_in, |
| 4809 | clear_bgp_ipv6_all_soft_in_cmd, |
| 4810 | "clear bgp ipv6 * soft in", |
| 4811 | CLEAR_STR |
| 4812 | BGP_STR |
| 4813 | "Address family\n" |
| 4814 | "Clear all peers\n" |
| 4815 | "Soft reconfig\n" |
| 4816 | "Soft reconfig inbound update\n") |
| 4817 | |
| 4818 | ALIAS (clear_bgp_all_soft_in, |
| 4819 | clear_bgp_all_in_cmd, |
| 4820 | "clear bgp * in", |
| 4821 | CLEAR_STR |
| 4822 | BGP_STR |
| 4823 | "Clear all peers\n" |
| 4824 | "Soft reconfig inbound update\n") |
| 4825 | |
| 4826 | ALIAS (clear_bgp_all_soft_in, |
| 4827 | clear_bgp_ipv6_all_in_cmd, |
| 4828 | "clear bgp ipv6 * in", |
| 4829 | CLEAR_STR |
| 4830 | BGP_STR |
| 4831 | "Address family\n" |
| 4832 | "Clear all peers\n" |
| 4833 | "Soft reconfig inbound update\n") |
| 4834 | |
| 4835 | DEFUN (clear_bgp_all_in_prefix_filter, |
| 4836 | clear_bgp_all_in_prefix_filter_cmd, |
| 4837 | "clear bgp * in prefix-filter", |
| 4838 | CLEAR_STR |
| 4839 | BGP_STR |
| 4840 | "Clear all peers\n" |
| 4841 | "Soft reconfig inbound update\n" |
| 4842 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 4843 | { |
| 4844 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 4845 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 4846 | } |
| 4847 | |
| 4848 | ALIAS (clear_bgp_all_in_prefix_filter, |
| 4849 | clear_bgp_ipv6_all_in_prefix_filter_cmd, |
| 4850 | "clear bgp ipv6 * in prefix-filter", |
| 4851 | CLEAR_STR |
| 4852 | BGP_STR |
| 4853 | "Address family\n" |
| 4854 | "Clear all peers\n" |
| 4855 | "Soft reconfig inbound update\n" |
| 4856 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 4857 | |
| 4858 | DEFUN (clear_ip_bgp_peer_soft_in, |
| 4859 | clear_ip_bgp_peer_soft_in_cmd, |
| 4860 | "clear ip bgp A.B.C.D soft in", |
| 4861 | CLEAR_STR |
| 4862 | IP_STR |
| 4863 | BGP_STR |
| 4864 | "BGP neighbor address to clear\n" |
| 4865 | "Soft reconfig\n" |
| 4866 | "Soft reconfig inbound update\n") |
| 4867 | { |
| 4868 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4869 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 4870 | } |
| 4871 | |
| 4872 | ALIAS (clear_ip_bgp_peer_soft_in, |
| 4873 | clear_ip_bgp_peer_in_cmd, |
| 4874 | "clear ip bgp A.B.C.D in", |
| 4875 | CLEAR_STR |
| 4876 | IP_STR |
| 4877 | BGP_STR |
| 4878 | "BGP neighbor address to clear\n" |
| 4879 | "Soft reconfig inbound update\n") |
| 4880 | |
| 4881 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
| 4882 | clear_ip_bgp_peer_in_prefix_filter_cmd, |
| 4883 | "clear ip bgp A.B.C.D in prefix-filter", |
| 4884 | CLEAR_STR |
| 4885 | IP_STR |
| 4886 | BGP_STR |
| 4887 | "BGP neighbor address to clear\n" |
| 4888 | "Soft reconfig inbound update\n" |
| 4889 | "Push out the existing ORF prefix-list\n") |
| 4890 | { |
| 4891 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4892 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 4893 | } |
| 4894 | |
| 4895 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, |
| 4896 | clear_ip_bgp_peer_ipv4_soft_in_cmd, |
| 4897 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", |
| 4898 | CLEAR_STR |
| 4899 | IP_STR |
| 4900 | BGP_STR |
| 4901 | "BGP neighbor address to clear\n" |
| 4902 | "Address family\n" |
| 4903 | "Address Family modifier\n" |
| 4904 | "Address Family modifier\n" |
| 4905 | "Soft reconfig\n" |
| 4906 | "Soft reconfig inbound update\n") |
| 4907 | { |
| 4908 | if (strncmp (argv[1], "m", 1) == 0) |
| 4909 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 4910 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 4911 | |
| 4912 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4913 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 4914 | } |
| 4915 | |
| 4916 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, |
| 4917 | clear_ip_bgp_peer_ipv4_in_cmd, |
| 4918 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", |
| 4919 | CLEAR_STR |
| 4920 | IP_STR |
| 4921 | BGP_STR |
| 4922 | "BGP neighbor address to clear\n" |
| 4923 | "Address family\n" |
| 4924 | "Address Family modifier\n" |
| 4925 | "Address Family modifier\n" |
| 4926 | "Soft reconfig inbound update\n") |
| 4927 | |
| 4928 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
| 4929 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, |
| 4930 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", |
| 4931 | CLEAR_STR |
| 4932 | IP_STR |
| 4933 | BGP_STR |
| 4934 | "BGP neighbor address to clear\n" |
| 4935 | "Address family\n" |
| 4936 | "Address Family modifier\n" |
| 4937 | "Address Family modifier\n" |
| 4938 | "Soft reconfig inbound update\n" |
| 4939 | "Push out the existing ORF prefix-list\n") |
| 4940 | { |
| 4941 | if (strncmp (argv[1], "m", 1) == 0) |
| 4942 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 4943 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 4944 | |
| 4945 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4946 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 4947 | } |
| 4948 | |
| 4949 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, |
| 4950 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, |
| 4951 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", |
| 4952 | CLEAR_STR |
| 4953 | IP_STR |
| 4954 | BGP_STR |
| 4955 | "BGP neighbor address to clear\n" |
| 4956 | "Address family\n" |
| 4957 | "Address Family Modifier\n" |
| 4958 | "Soft reconfig\n" |
| 4959 | "Soft reconfig inbound update\n") |
| 4960 | { |
| 4961 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 4962 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 4963 | } |
| 4964 | |
| 4965 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, |
| 4966 | clear_ip_bgp_peer_vpnv4_in_cmd, |
| 4967 | "clear ip bgp A.B.C.D vpnv4 unicast in", |
| 4968 | CLEAR_STR |
| 4969 | IP_STR |
| 4970 | BGP_STR |
| 4971 | "BGP neighbor address to clear\n" |
| 4972 | "Address family\n" |
| 4973 | "Address Family Modifier\n" |
| 4974 | "Soft reconfig inbound update\n") |
| 4975 | |
| 4976 | DEFUN (clear_bgp_peer_soft_in, |
| 4977 | clear_bgp_peer_soft_in_cmd, |
| 4978 | "clear bgp (A.B.C.D|X:X::X:X) soft in", |
| 4979 | CLEAR_STR |
| 4980 | BGP_STR |
| 4981 | "BGP neighbor address to clear\n" |
| 4982 | "BGP IPv6 neighbor to clear\n" |
| 4983 | "Soft reconfig\n" |
| 4984 | "Soft reconfig inbound update\n") |
| 4985 | { |
| 4986 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 4987 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 4988 | } |
| 4989 | |
| 4990 | ALIAS (clear_bgp_peer_soft_in, |
| 4991 | clear_bgp_ipv6_peer_soft_in_cmd, |
| 4992 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in", |
| 4993 | CLEAR_STR |
| 4994 | BGP_STR |
| 4995 | "Address family\n" |
| 4996 | "BGP neighbor address to clear\n" |
| 4997 | "BGP IPv6 neighbor to clear\n" |
| 4998 | "Soft reconfig\n" |
| 4999 | "Soft reconfig inbound update\n") |
| 5000 | |
| 5001 | ALIAS (clear_bgp_peer_soft_in, |
| 5002 | clear_bgp_peer_in_cmd, |
| 5003 | "clear bgp (A.B.C.D|X:X::X:X) in", |
| 5004 | CLEAR_STR |
| 5005 | BGP_STR |
| 5006 | "BGP neighbor address to clear\n" |
| 5007 | "BGP IPv6 neighbor to clear\n" |
| 5008 | "Soft reconfig inbound update\n") |
| 5009 | |
| 5010 | ALIAS (clear_bgp_peer_soft_in, |
| 5011 | clear_bgp_ipv6_peer_in_cmd, |
| 5012 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in", |
| 5013 | CLEAR_STR |
| 5014 | BGP_STR |
| 5015 | "Address family\n" |
| 5016 | "BGP neighbor address to clear\n" |
| 5017 | "BGP IPv6 neighbor to clear\n" |
| 5018 | "Soft reconfig inbound update\n") |
| 5019 | |
| 5020 | DEFUN (clear_bgp_peer_in_prefix_filter, |
| 5021 | clear_bgp_peer_in_prefix_filter_cmd, |
| 5022 | "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5023 | CLEAR_STR |
| 5024 | BGP_STR |
| 5025 | "BGP neighbor address to clear\n" |
| 5026 | "BGP IPv6 neighbor to clear\n" |
| 5027 | "Soft reconfig inbound update\n" |
| 5028 | "Push out the existing ORF prefix-list\n") |
| 5029 | { |
| 5030 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5031 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5032 | } |
| 5033 | |
| 5034 | ALIAS (clear_bgp_peer_in_prefix_filter, |
| 5035 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, |
| 5036 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5037 | CLEAR_STR |
| 5038 | BGP_STR |
| 5039 | "Address family\n" |
| 5040 | "BGP neighbor address to clear\n" |
| 5041 | "BGP IPv6 neighbor to clear\n" |
| 5042 | "Soft reconfig inbound update\n" |
| 5043 | "Push out the existing ORF prefix-list\n") |
| 5044 | |
| 5045 | DEFUN (clear_ip_bgp_peer_group_soft_in, |
| 5046 | clear_ip_bgp_peer_group_soft_in_cmd, |
| 5047 | "clear ip bgp peer-group WORD soft in", |
| 5048 | CLEAR_STR |
| 5049 | IP_STR |
| 5050 | BGP_STR |
| 5051 | "Clear all members of peer-group\n" |
| 5052 | "BGP peer-group name\n" |
| 5053 | "Soft reconfig\n" |
| 5054 | "Soft reconfig inbound update\n") |
| 5055 | { |
| 5056 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5057 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5058 | } |
| 5059 | |
| 5060 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
| 5061 | clear_ip_bgp_peer_group_in_cmd, |
| 5062 | "clear ip bgp peer-group WORD in", |
| 5063 | CLEAR_STR |
| 5064 | IP_STR |
| 5065 | BGP_STR |
| 5066 | "Clear all members of peer-group\n" |
| 5067 | "BGP peer-group name\n" |
| 5068 | "Soft reconfig inbound update\n") |
| 5069 | |
| 5070 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
| 5071 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, |
| 5072 | "clear ip bgp peer-group WORD in prefix-filter", |
| 5073 | CLEAR_STR |
| 5074 | IP_STR |
| 5075 | BGP_STR |
| 5076 | "Clear all members of peer-group\n" |
| 5077 | "BGP peer-group name\n" |
| 5078 | "Soft reconfig inbound update\n" |
| 5079 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5080 | { |
| 5081 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5082 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5083 | } |
| 5084 | |
| 5085 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5086 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, |
| 5087 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", |
| 5088 | CLEAR_STR |
| 5089 | IP_STR |
| 5090 | BGP_STR |
| 5091 | "Clear all members of peer-group\n" |
| 5092 | "BGP peer-group name\n" |
| 5093 | "Address family\n" |
| 5094 | "Address Family modifier\n" |
| 5095 | "Address Family modifier\n" |
| 5096 | "Soft reconfig\n" |
| 5097 | "Soft reconfig inbound update\n") |
| 5098 | { |
| 5099 | if (strncmp (argv[1], "m", 1) == 0) |
| 5100 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5101 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5102 | |
| 5103 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5104 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5105 | } |
| 5106 | |
| 5107 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5108 | clear_ip_bgp_peer_group_ipv4_in_cmd, |
| 5109 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", |
| 5110 | CLEAR_STR |
| 5111 | IP_STR |
| 5112 | BGP_STR |
| 5113 | "Clear all members of peer-group\n" |
| 5114 | "BGP peer-group name\n" |
| 5115 | "Address family\n" |
| 5116 | "Address Family modifier\n" |
| 5117 | "Address Family modifier\n" |
| 5118 | "Soft reconfig inbound update\n") |
| 5119 | |
| 5120 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
| 5121 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, |
| 5122 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", |
| 5123 | CLEAR_STR |
| 5124 | IP_STR |
| 5125 | BGP_STR |
| 5126 | "Clear all members of peer-group\n" |
| 5127 | "BGP peer-group name\n" |
| 5128 | "Address family\n" |
| 5129 | "Address Family modifier\n" |
| 5130 | "Address Family modifier\n" |
| 5131 | "Soft reconfig inbound update\n" |
| 5132 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5133 | { |
| 5134 | if (strncmp (argv[1], "m", 1) == 0) |
| 5135 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5136 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5137 | |
| 5138 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5139 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5140 | } |
| 5141 | |
| 5142 | DEFUN (clear_bgp_peer_group_soft_in, |
| 5143 | clear_bgp_peer_group_soft_in_cmd, |
| 5144 | "clear bgp peer-group WORD soft in", |
| 5145 | CLEAR_STR |
| 5146 | BGP_STR |
| 5147 | "Clear all members of peer-group\n" |
| 5148 | "BGP peer-group name\n" |
| 5149 | "Soft reconfig\n" |
| 5150 | "Soft reconfig inbound update\n") |
| 5151 | { |
| 5152 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5153 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5154 | } |
| 5155 | |
| 5156 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5157 | clear_bgp_ipv6_peer_group_soft_in_cmd, |
| 5158 | "clear bgp ipv6 peer-group WORD soft in", |
| 5159 | CLEAR_STR |
| 5160 | BGP_STR |
| 5161 | "Address family\n" |
| 5162 | "Clear all members of peer-group\n" |
| 5163 | "BGP peer-group name\n" |
| 5164 | "Soft reconfig\n" |
| 5165 | "Soft reconfig inbound update\n") |
| 5166 | |
| 5167 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5168 | clear_bgp_peer_group_in_cmd, |
| 5169 | "clear bgp peer-group WORD in", |
| 5170 | CLEAR_STR |
| 5171 | BGP_STR |
| 5172 | "Clear all members of peer-group\n" |
| 5173 | "BGP peer-group name\n" |
| 5174 | "Soft reconfig inbound update\n") |
| 5175 | |
| 5176 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5177 | clear_bgp_ipv6_peer_group_in_cmd, |
| 5178 | "clear bgp ipv6 peer-group WORD in", |
| 5179 | CLEAR_STR |
| 5180 | BGP_STR |
| 5181 | "Address family\n" |
| 5182 | "Clear all members of peer-group\n" |
| 5183 | "BGP peer-group name\n" |
| 5184 | "Soft reconfig inbound update\n") |
| 5185 | |
| 5186 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
| 5187 | clear_bgp_peer_group_in_prefix_filter_cmd, |
| 5188 | "clear bgp peer-group WORD in prefix-filter", |
| 5189 | CLEAR_STR |
| 5190 | BGP_STR |
| 5191 | "Clear all members of peer-group\n" |
| 5192 | "BGP peer-group name\n" |
| 5193 | "Soft reconfig inbound update\n" |
| 5194 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5195 | { |
| 5196 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5197 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5198 | } |
| 5199 | |
| 5200 | ALIAS (clear_bgp_peer_group_in_prefix_filter, |
| 5201 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, |
| 5202 | "clear bgp ipv6 peer-group WORD in prefix-filter", |
| 5203 | CLEAR_STR |
| 5204 | BGP_STR |
| 5205 | "Address family\n" |
| 5206 | "Clear all members of peer-group\n" |
| 5207 | "BGP peer-group name\n" |
| 5208 | "Soft reconfig inbound update\n" |
| 5209 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5210 | |
| 5211 | DEFUN (clear_ip_bgp_external_soft_in, |
| 5212 | clear_ip_bgp_external_soft_in_cmd, |
| 5213 | "clear ip bgp external soft in", |
| 5214 | CLEAR_STR |
| 5215 | IP_STR |
| 5216 | BGP_STR |
| 5217 | "Clear all external peers\n" |
| 5218 | "Soft reconfig\n" |
| 5219 | "Soft reconfig inbound update\n") |
| 5220 | { |
| 5221 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5222 | BGP_CLEAR_SOFT_IN, NULL); |
| 5223 | } |
| 5224 | |
| 5225 | ALIAS (clear_ip_bgp_external_soft_in, |
| 5226 | clear_ip_bgp_external_in_cmd, |
| 5227 | "clear ip bgp external in", |
| 5228 | CLEAR_STR |
| 5229 | IP_STR |
| 5230 | BGP_STR |
| 5231 | "Clear all external peers\n" |
| 5232 | "Soft reconfig inbound update\n") |
| 5233 | |
| 5234 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
| 5235 | clear_ip_bgp_external_in_prefix_filter_cmd, |
| 5236 | "clear ip bgp external in prefix-filter", |
| 5237 | CLEAR_STR |
| 5238 | IP_STR |
| 5239 | BGP_STR |
| 5240 | "Clear all external peers\n" |
| 5241 | "Soft reconfig inbound update\n" |
| 5242 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5243 | { |
| 5244 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5245 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5246 | } |
| 5247 | |
| 5248 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, |
| 5249 | clear_ip_bgp_external_ipv4_soft_in_cmd, |
| 5250 | "clear ip bgp external ipv4 (unicast|multicast) soft in", |
| 5251 | CLEAR_STR |
| 5252 | IP_STR |
| 5253 | BGP_STR |
| 5254 | "Clear all external peers\n" |
| 5255 | "Address family\n" |
| 5256 | "Address Family modifier\n" |
| 5257 | "Address Family modifier\n" |
| 5258 | "Soft reconfig\n" |
| 5259 | "Soft reconfig inbound update\n") |
| 5260 | { |
| 5261 | if (strncmp (argv[0], "m", 1) == 0) |
| 5262 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5263 | BGP_CLEAR_SOFT_IN, NULL); |
| 5264 | |
| 5265 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5266 | BGP_CLEAR_SOFT_IN, NULL); |
| 5267 | } |
| 5268 | |
| 5269 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, |
| 5270 | clear_ip_bgp_external_ipv4_in_cmd, |
| 5271 | "clear ip bgp external ipv4 (unicast|multicast) in", |
| 5272 | CLEAR_STR |
| 5273 | IP_STR |
| 5274 | BGP_STR |
| 5275 | "Clear all external peers\n" |
| 5276 | "Address family\n" |
| 5277 | "Address Family modifier\n" |
| 5278 | "Address Family modifier\n" |
| 5279 | "Soft reconfig inbound update\n") |
| 5280 | |
| 5281 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
| 5282 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, |
| 5283 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", |
| 5284 | CLEAR_STR |
| 5285 | IP_STR |
| 5286 | BGP_STR |
| 5287 | "Clear all external peers\n" |
| 5288 | "Address family\n" |
| 5289 | "Address Family modifier\n" |
| 5290 | "Address Family modifier\n" |
| 5291 | "Soft reconfig inbound update\n" |
| 5292 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5293 | { |
| 5294 | if (strncmp (argv[0], "m", 1) == 0) |
| 5295 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5296 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5297 | |
| 5298 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5299 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5300 | } |
| 5301 | |
| 5302 | DEFUN (clear_bgp_external_soft_in, |
| 5303 | clear_bgp_external_soft_in_cmd, |
| 5304 | "clear bgp external soft in", |
| 5305 | CLEAR_STR |
| 5306 | BGP_STR |
| 5307 | "Clear all external peers\n" |
| 5308 | "Soft reconfig\n" |
| 5309 | "Soft reconfig inbound update\n") |
| 5310 | { |
| 5311 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5312 | BGP_CLEAR_SOFT_IN, NULL); |
| 5313 | } |
| 5314 | |
| 5315 | ALIAS (clear_bgp_external_soft_in, |
| 5316 | clear_bgp_ipv6_external_soft_in_cmd, |
| 5317 | "clear bgp ipv6 external soft in", |
| 5318 | CLEAR_STR |
| 5319 | BGP_STR |
| 5320 | "Address family\n" |
| 5321 | "Clear all external peers\n" |
| 5322 | "Soft reconfig\n" |
| 5323 | "Soft reconfig inbound update\n") |
| 5324 | |
| 5325 | ALIAS (clear_bgp_external_soft_in, |
| 5326 | clear_bgp_external_in_cmd, |
| 5327 | "clear bgp external in", |
| 5328 | CLEAR_STR |
| 5329 | BGP_STR |
| 5330 | "Clear all external peers\n" |
| 5331 | "Soft reconfig inbound update\n") |
| 5332 | |
| 5333 | ALIAS (clear_bgp_external_soft_in, |
| 5334 | clear_bgp_ipv6_external_in_cmd, |
| 5335 | "clear bgp ipv6 external WORD in", |
| 5336 | CLEAR_STR |
| 5337 | BGP_STR |
| 5338 | "Address family\n" |
| 5339 | "Clear all external peers\n" |
| 5340 | "Soft reconfig inbound update\n") |
| 5341 | |
| 5342 | DEFUN (clear_bgp_external_in_prefix_filter, |
| 5343 | clear_bgp_external_in_prefix_filter_cmd, |
| 5344 | "clear bgp external in prefix-filter", |
| 5345 | CLEAR_STR |
| 5346 | BGP_STR |
| 5347 | "Clear all external peers\n" |
| 5348 | "Soft reconfig inbound update\n" |
| 5349 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5350 | { |
| 5351 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5352 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5353 | } |
| 5354 | |
| 5355 | ALIAS (clear_bgp_external_in_prefix_filter, |
| 5356 | clear_bgp_ipv6_external_in_prefix_filter_cmd, |
| 5357 | "clear bgp ipv6 external in prefix-filter", |
| 5358 | CLEAR_STR |
| 5359 | BGP_STR |
| 5360 | "Address family\n" |
| 5361 | "Clear all external peers\n" |
| 5362 | "Soft reconfig inbound update\n" |
| 5363 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5364 | |
| 5365 | DEFUN (clear_ip_bgp_as_soft_in, |
| 5366 | clear_ip_bgp_as_soft_in_cmd, |
| 5367 | "clear ip bgp <1-65535> soft in", |
| 5368 | CLEAR_STR |
| 5369 | IP_STR |
| 5370 | BGP_STR |
| 5371 | "Clear peers with the AS number\n" |
| 5372 | "Soft reconfig\n" |
| 5373 | "Soft reconfig inbound update\n") |
| 5374 | { |
| 5375 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5376 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5377 | } |
| 5378 | |
| 5379 | ALIAS (clear_ip_bgp_as_soft_in, |
| 5380 | clear_ip_bgp_as_in_cmd, |
| 5381 | "clear ip bgp <1-65535> in", |
| 5382 | CLEAR_STR |
| 5383 | IP_STR |
| 5384 | BGP_STR |
| 5385 | "Clear peers with the AS number\n" |
| 5386 | "Soft reconfig inbound update\n") |
| 5387 | |
| 5388 | DEFUN (clear_ip_bgp_as_in_prefix_filter, |
| 5389 | clear_ip_bgp_as_in_prefix_filter_cmd, |
| 5390 | "clear ip bgp <1-65535> in prefix-filter", |
| 5391 | CLEAR_STR |
| 5392 | IP_STR |
| 5393 | BGP_STR |
| 5394 | "Clear peers with the AS number\n" |
| 5395 | "Soft reconfig inbound update\n" |
| 5396 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5397 | { |
| 5398 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5399 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5400 | } |
| 5401 | |
| 5402 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, |
| 5403 | clear_ip_bgp_as_ipv4_soft_in_cmd, |
| 5404 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft in", |
| 5405 | CLEAR_STR |
| 5406 | IP_STR |
| 5407 | BGP_STR |
| 5408 | "Clear peers with the AS number\n" |
| 5409 | "Address family\n" |
| 5410 | "Address Family modifier\n" |
| 5411 | "Address Family modifier\n" |
| 5412 | "Soft reconfig\n" |
| 5413 | "Soft reconfig inbound update\n") |
| 5414 | { |
| 5415 | if (strncmp (argv[1], "m", 1) == 0) |
| 5416 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5417 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5418 | |
| 5419 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5420 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5421 | } |
| 5422 | |
| 5423 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, |
| 5424 | clear_ip_bgp_as_ipv4_in_cmd, |
| 5425 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) in", |
| 5426 | CLEAR_STR |
| 5427 | IP_STR |
| 5428 | BGP_STR |
| 5429 | "Clear peers with the AS number\n" |
| 5430 | "Address family\n" |
| 5431 | "Address Family modifier\n" |
| 5432 | "Address Family modifier\n" |
| 5433 | "Soft reconfig inbound update\n") |
| 5434 | |
| 5435 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
| 5436 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, |
| 5437 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) in prefix-filter", |
| 5438 | CLEAR_STR |
| 5439 | IP_STR |
| 5440 | BGP_STR |
| 5441 | "Clear peers with the AS number\n" |
| 5442 | "Address family\n" |
| 5443 | "Address Family modifier\n" |
| 5444 | "Address Family modifier\n" |
| 5445 | "Soft reconfig inbound update\n" |
| 5446 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5447 | { |
| 5448 | if (strncmp (argv[1], "m", 1) == 0) |
| 5449 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5450 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5451 | |
| 5452 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5453 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5454 | } |
| 5455 | |
| 5456 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, |
| 5457 | clear_ip_bgp_as_vpnv4_soft_in_cmd, |
| 5458 | "clear ip bgp <1-65535> vpnv4 unicast soft in", |
| 5459 | CLEAR_STR |
| 5460 | IP_STR |
| 5461 | BGP_STR |
| 5462 | "Clear peers with the AS number\n" |
| 5463 | "Address family\n" |
| 5464 | "Address Family modifier\n" |
| 5465 | "Soft reconfig\n" |
| 5466 | "Soft reconfig inbound update\n") |
| 5467 | { |
| 5468 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 5469 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5470 | } |
| 5471 | |
| 5472 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, |
| 5473 | clear_ip_bgp_as_vpnv4_in_cmd, |
| 5474 | "clear ip bgp <1-65535> vpnv4 unicast in", |
| 5475 | CLEAR_STR |
| 5476 | IP_STR |
| 5477 | BGP_STR |
| 5478 | "Clear peers with the AS number\n" |
| 5479 | "Address family\n" |
| 5480 | "Address Family modifier\n" |
| 5481 | "Soft reconfig inbound update\n") |
| 5482 | |
| 5483 | DEFUN (clear_bgp_as_soft_in, |
| 5484 | clear_bgp_as_soft_in_cmd, |
| 5485 | "clear bgp <1-65535> soft in", |
| 5486 | CLEAR_STR |
| 5487 | BGP_STR |
| 5488 | "Clear peers with the AS number\n" |
| 5489 | "Soft reconfig\n" |
| 5490 | "Soft reconfig inbound update\n") |
| 5491 | { |
| 5492 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5493 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5494 | } |
| 5495 | |
| 5496 | ALIAS (clear_bgp_as_soft_in, |
| 5497 | clear_bgp_ipv6_as_soft_in_cmd, |
| 5498 | "clear bgp ipv6 <1-65535> soft in", |
| 5499 | CLEAR_STR |
| 5500 | BGP_STR |
| 5501 | "Address family\n" |
| 5502 | "Clear peers with the AS number\n" |
| 5503 | "Soft reconfig\n" |
| 5504 | "Soft reconfig inbound update\n") |
| 5505 | |
| 5506 | ALIAS (clear_bgp_as_soft_in, |
| 5507 | clear_bgp_as_in_cmd, |
| 5508 | "clear bgp <1-65535> in", |
| 5509 | CLEAR_STR |
| 5510 | BGP_STR |
| 5511 | "Clear peers with the AS number\n" |
| 5512 | "Soft reconfig inbound update\n") |
| 5513 | |
| 5514 | ALIAS (clear_bgp_as_soft_in, |
| 5515 | clear_bgp_ipv6_as_in_cmd, |
| 5516 | "clear bgp ipv6 <1-65535> in", |
| 5517 | CLEAR_STR |
| 5518 | BGP_STR |
| 5519 | "Address family\n" |
| 5520 | "Clear peers with the AS number\n" |
| 5521 | "Soft reconfig inbound update\n") |
| 5522 | |
| 5523 | DEFUN (clear_bgp_as_in_prefix_filter, |
| 5524 | clear_bgp_as_in_prefix_filter_cmd, |
| 5525 | "clear bgp <1-65535> in prefix-filter", |
| 5526 | CLEAR_STR |
| 5527 | BGP_STR |
| 5528 | "Clear peers with the AS number\n" |
| 5529 | "Soft reconfig inbound update\n" |
| 5530 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5531 | { |
| 5532 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5533 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5534 | } |
| 5535 | |
| 5536 | ALIAS (clear_bgp_as_in_prefix_filter, |
| 5537 | clear_bgp_ipv6_as_in_prefix_filter_cmd, |
| 5538 | "clear bgp ipv6 <1-65535> in prefix-filter", |
| 5539 | CLEAR_STR |
| 5540 | BGP_STR |
| 5541 | "Address family\n" |
| 5542 | "Clear peers with the AS number\n" |
| 5543 | "Soft reconfig inbound update\n" |
| 5544 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5545 | |
| 5546 | /* Both soft-reconfiguration */ |
| 5547 | DEFUN (clear_ip_bgp_all_soft, |
| 5548 | clear_ip_bgp_all_soft_cmd, |
| 5549 | "clear ip bgp * soft", |
| 5550 | CLEAR_STR |
| 5551 | IP_STR |
| 5552 | BGP_STR |
| 5553 | "Clear all peers\n" |
| 5554 | "Soft reconfig\n") |
| 5555 | { |
| 5556 | if (argc == 1) |
| 5557 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5558 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5559 | |
| 5560 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5561 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5562 | } |
| 5563 | |
| 5564 | ALIAS (clear_ip_bgp_all_soft, |
| 5565 | clear_ip_bgp_instance_all_soft_cmd, |
| 5566 | "clear ip bgp view WORD * soft", |
| 5567 | CLEAR_STR |
| 5568 | IP_STR |
| 5569 | BGP_STR |
| 5570 | "BGP view\n" |
| 5571 | "view name\n" |
| 5572 | "Clear all peers\n" |
| 5573 | "Soft reconfig\n") |
| 5574 | |
| 5575 | |
| 5576 | DEFUN (clear_ip_bgp_all_ipv4_soft, |
| 5577 | clear_ip_bgp_all_ipv4_soft_cmd, |
| 5578 | "clear ip bgp * ipv4 (unicast|multicast) soft", |
| 5579 | CLEAR_STR |
| 5580 | IP_STR |
| 5581 | BGP_STR |
| 5582 | "Clear all peers\n" |
| 5583 | "Address family\n" |
| 5584 | "Address Family Modifier\n" |
| 5585 | "Address Family Modifier\n" |
| 5586 | "Soft reconfig\n") |
| 5587 | { |
| 5588 | if (strncmp (argv[0], "m", 1) == 0) |
| 5589 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5590 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5591 | |
| 5592 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5593 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5594 | } |
| 5595 | |
| 5596 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, |
| 5597 | clear_ip_bgp_instance_all_ipv4_soft_cmd, |
| 5598 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", |
| 5599 | CLEAR_STR |
| 5600 | IP_STR |
| 5601 | BGP_STR |
| 5602 | "BGP view\n" |
| 5603 | "view name\n" |
| 5604 | "Clear all peers\n" |
| 5605 | "Address family\n" |
| 5606 | "Address Family Modifier\n" |
| 5607 | "Address Family Modifier\n" |
| 5608 | "Soft reconfig\n") |
| 5609 | { |
| 5610 | if (strncmp (argv[1], "m", 1) == 0) |
| 5611 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5612 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5613 | |
| 5614 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5615 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5616 | } |
| 5617 | |
| 5618 | DEFUN (clear_ip_bgp_all_vpnv4_soft, |
| 5619 | clear_ip_bgp_all_vpnv4_soft_cmd, |
| 5620 | "clear ip bgp * vpnv4 unicast soft", |
| 5621 | CLEAR_STR |
| 5622 | IP_STR |
| 5623 | BGP_STR |
| 5624 | "Clear all peers\n" |
| 5625 | "Address family\n" |
| 5626 | "Address Family Modifier\n" |
| 5627 | "Soft reconfig\n") |
| 5628 | { |
| 5629 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 5630 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5631 | } |
| 5632 | |
| 5633 | DEFUN (clear_bgp_all_soft, |
| 5634 | clear_bgp_all_soft_cmd, |
| 5635 | "clear bgp * soft", |
| 5636 | CLEAR_STR |
| 5637 | BGP_STR |
| 5638 | "Clear all peers\n" |
| 5639 | "Soft reconfig\n") |
| 5640 | { |
| 5641 | if (argc == 1) |
| 5642 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 5643 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5644 | |
| 5645 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5646 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5647 | } |
| 5648 | |
| 5649 | ALIAS (clear_bgp_all_soft, |
| 5650 | clear_bgp_instance_all_soft_cmd, |
| 5651 | "clear bgp view WORD * soft", |
| 5652 | CLEAR_STR |
| 5653 | BGP_STR |
| 5654 | "BGP view\n" |
| 5655 | "view name\n" |
| 5656 | "Clear all peers\n" |
| 5657 | "Soft reconfig\n") |
| 5658 | |
| 5659 | ALIAS (clear_bgp_all_soft, |
| 5660 | clear_bgp_ipv6_all_soft_cmd, |
| 5661 | "clear bgp ipv6 * soft", |
| 5662 | CLEAR_STR |
| 5663 | BGP_STR |
| 5664 | "Address family\n" |
| 5665 | "Clear all peers\n" |
| 5666 | "Soft reconfig\n") |
| 5667 | |
| 5668 | DEFUN (clear_ip_bgp_peer_soft, |
| 5669 | clear_ip_bgp_peer_soft_cmd, |
| 5670 | "clear ip bgp A.B.C.D soft", |
| 5671 | CLEAR_STR |
| 5672 | IP_STR |
| 5673 | BGP_STR |
| 5674 | "BGP neighbor address to clear\n" |
| 5675 | "Soft reconfig\n") |
| 5676 | { |
| 5677 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5678 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5679 | } |
| 5680 | |
| 5681 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
| 5682 | clear_ip_bgp_peer_ipv4_soft_cmd, |
| 5683 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", |
| 5684 | CLEAR_STR |
| 5685 | IP_STR |
| 5686 | BGP_STR |
| 5687 | "BGP neighbor address to clear\n" |
| 5688 | "Address family\n" |
| 5689 | "Address Family Modifier\n" |
| 5690 | "Address Family Modifier\n" |
| 5691 | "Soft reconfig\n") |
| 5692 | { |
| 5693 | if (strncmp (argv[1], "m", 1) == 0) |
| 5694 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5695 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5696 | |
| 5697 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5698 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5699 | } |
| 5700 | |
| 5701 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
| 5702 | clear_ip_bgp_peer_vpnv4_soft_cmd, |
| 5703 | "clear ip bgp A.B.C.D vpnv4 unicast soft", |
| 5704 | CLEAR_STR |
| 5705 | IP_STR |
| 5706 | BGP_STR |
| 5707 | "BGP neighbor address to clear\n" |
| 5708 | "Address family\n" |
| 5709 | "Address Family Modifier\n" |
| 5710 | "Soft reconfig\n") |
| 5711 | { |
| 5712 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 5713 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5714 | } |
| 5715 | |
| 5716 | DEFUN (clear_bgp_peer_soft, |
| 5717 | clear_bgp_peer_soft_cmd, |
| 5718 | "clear bgp (A.B.C.D|X:X::X:X) soft", |
| 5719 | CLEAR_STR |
| 5720 | BGP_STR |
| 5721 | "BGP neighbor address to clear\n" |
| 5722 | "BGP IPv6 neighbor to clear\n" |
| 5723 | "Soft reconfig\n") |
| 5724 | { |
| 5725 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5726 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5727 | } |
| 5728 | |
| 5729 | ALIAS (clear_bgp_peer_soft, |
| 5730 | clear_bgp_ipv6_peer_soft_cmd, |
| 5731 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft", |
| 5732 | CLEAR_STR |
| 5733 | BGP_STR |
| 5734 | "Address family\n" |
| 5735 | "BGP neighbor address to clear\n" |
| 5736 | "BGP IPv6 neighbor to clear\n" |
| 5737 | "Soft reconfig\n") |
| 5738 | |
| 5739 | DEFUN (clear_ip_bgp_peer_group_soft, |
| 5740 | clear_ip_bgp_peer_group_soft_cmd, |
| 5741 | "clear ip bgp peer-group WORD soft", |
| 5742 | CLEAR_STR |
| 5743 | IP_STR |
| 5744 | BGP_STR |
| 5745 | "Clear all members of peer-group\n" |
| 5746 | "BGP peer-group name\n" |
| 5747 | "Soft reconfig\n") |
| 5748 | { |
| 5749 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5750 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5751 | } |
| 5752 | |
| 5753 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
| 5754 | clear_ip_bgp_peer_group_ipv4_soft_cmd, |
| 5755 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", |
| 5756 | CLEAR_STR |
| 5757 | IP_STR |
| 5758 | BGP_STR |
| 5759 | "Clear all members of peer-group\n" |
| 5760 | "BGP peer-group name\n" |
| 5761 | "Address family\n" |
| 5762 | "Address Family modifier\n" |
| 5763 | "Address Family modifier\n" |
| 5764 | "Soft reconfig\n") |
| 5765 | { |
| 5766 | if (strncmp (argv[1], "m", 1) == 0) |
| 5767 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5768 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5769 | |
| 5770 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5771 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5772 | } |
| 5773 | |
| 5774 | DEFUN (clear_bgp_peer_group_soft, |
| 5775 | clear_bgp_peer_group_soft_cmd, |
| 5776 | "clear bgp peer-group WORD soft", |
| 5777 | CLEAR_STR |
| 5778 | BGP_STR |
| 5779 | "Clear all members of peer-group\n" |
| 5780 | "BGP peer-group name\n" |
| 5781 | "Soft reconfig\n") |
| 5782 | { |
| 5783 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5784 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5785 | } |
| 5786 | |
| 5787 | ALIAS (clear_bgp_peer_group_soft, |
| 5788 | clear_bgp_ipv6_peer_group_soft_cmd, |
| 5789 | "clear bgp ipv6 peer-group WORD soft", |
| 5790 | CLEAR_STR |
| 5791 | BGP_STR |
| 5792 | "Address family\n" |
| 5793 | "Clear all members of peer-group\n" |
| 5794 | "BGP peer-group name\n" |
| 5795 | "Soft reconfig\n") |
| 5796 | |
| 5797 | DEFUN (clear_ip_bgp_external_soft, |
| 5798 | clear_ip_bgp_external_soft_cmd, |
| 5799 | "clear ip bgp external soft", |
| 5800 | CLEAR_STR |
| 5801 | IP_STR |
| 5802 | BGP_STR |
| 5803 | "Clear all external peers\n" |
| 5804 | "Soft reconfig\n") |
| 5805 | { |
| 5806 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5807 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5808 | } |
| 5809 | |
| 5810 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
| 5811 | clear_ip_bgp_external_ipv4_soft_cmd, |
| 5812 | "clear ip bgp external ipv4 (unicast|multicast) soft", |
| 5813 | CLEAR_STR |
| 5814 | IP_STR |
| 5815 | BGP_STR |
| 5816 | "Clear all external peers\n" |
| 5817 | "Address family\n" |
| 5818 | "Address Family modifier\n" |
| 5819 | "Address Family modifier\n" |
| 5820 | "Soft reconfig\n") |
| 5821 | { |
| 5822 | if (strncmp (argv[0], "m", 1) == 0) |
| 5823 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5824 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5825 | |
| 5826 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5827 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5828 | } |
| 5829 | |
| 5830 | DEFUN (clear_bgp_external_soft, |
| 5831 | clear_bgp_external_soft_cmd, |
| 5832 | "clear bgp external soft", |
| 5833 | CLEAR_STR |
| 5834 | BGP_STR |
| 5835 | "Clear all external peers\n" |
| 5836 | "Soft reconfig\n") |
| 5837 | { |
| 5838 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5839 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5840 | } |
| 5841 | |
| 5842 | ALIAS (clear_bgp_external_soft, |
| 5843 | clear_bgp_ipv6_external_soft_cmd, |
| 5844 | "clear bgp ipv6 external soft", |
| 5845 | CLEAR_STR |
| 5846 | BGP_STR |
| 5847 | "Address family\n" |
| 5848 | "Clear all external peers\n" |
| 5849 | "Soft reconfig\n") |
| 5850 | |
| 5851 | DEFUN (clear_ip_bgp_as_soft, |
| 5852 | clear_ip_bgp_as_soft_cmd, |
| 5853 | "clear ip bgp <1-65535> soft", |
| 5854 | CLEAR_STR |
| 5855 | IP_STR |
| 5856 | BGP_STR |
| 5857 | "Clear peers with the AS number\n" |
| 5858 | "Soft reconfig\n") |
| 5859 | { |
| 5860 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5861 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5862 | } |
| 5863 | |
| 5864 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
| 5865 | clear_ip_bgp_as_ipv4_soft_cmd, |
| 5866 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft", |
| 5867 | CLEAR_STR |
| 5868 | IP_STR |
| 5869 | BGP_STR |
| 5870 | "Clear peers with the AS number\n" |
| 5871 | "Address family\n" |
| 5872 | "Address Family Modifier\n" |
| 5873 | "Address Family Modifier\n" |
| 5874 | "Soft reconfig\n") |
| 5875 | { |
| 5876 | if (strncmp (argv[1], "m", 1) == 0) |
| 5877 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5878 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5879 | |
| 5880 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, |
| 5881 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5882 | } |
| 5883 | |
| 5884 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
| 5885 | clear_ip_bgp_as_vpnv4_soft_cmd, |
| 5886 | "clear ip bgp <1-65535> vpnv4 unicast soft", |
| 5887 | CLEAR_STR |
| 5888 | IP_STR |
| 5889 | BGP_STR |
| 5890 | "Clear peers with the AS number\n" |
| 5891 | "Address family\n" |
| 5892 | "Address Family Modifier\n" |
| 5893 | "Soft reconfig\n") |
| 5894 | { |
| 5895 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 5896 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5897 | } |
| 5898 | |
| 5899 | DEFUN (clear_bgp_as_soft, |
| 5900 | clear_bgp_as_soft_cmd, |
| 5901 | "clear bgp <1-65535> soft", |
| 5902 | CLEAR_STR |
| 5903 | BGP_STR |
| 5904 | "Clear peers with the AS number\n" |
| 5905 | "Soft reconfig\n") |
| 5906 | { |
| 5907 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5908 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 5909 | } |
| 5910 | |
| 5911 | ALIAS (clear_bgp_as_soft, |
| 5912 | clear_bgp_ipv6_as_soft_cmd, |
| 5913 | "clear bgp ipv6 <1-65535> soft", |
| 5914 | CLEAR_STR |
| 5915 | BGP_STR |
| 5916 | "Address family\n" |
| 5917 | "Clear peers with the AS number\n" |
| 5918 | "Soft reconfig\n") |
| 5919 | |
| 5920 | /* Show BGP peer's summary information. */ |
| 5921 | int |
| 5922 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) |
| 5923 | { |
| 5924 | struct peer *peer; |
| 5925 | struct listnode *nn; |
| 5926 | int count = 0; |
| 5927 | char timebuf[BGP_UPTIME_LEN]; |
| 5928 | int len; |
| 5929 | |
| 5930 | /* Header string for each address family. */ |
| 5931 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; |
| 5932 | |
| 5933 | LIST_LOOP (bgp->peer, peer, nn) |
| 5934 | { |
| 5935 | if (peer->afc[afi][safi]) |
| 5936 | { |
| 5937 | if (! count) |
| 5938 | { |
| 5939 | vty_out (vty, |
| 5940 | "BGP router identifier %s, local AS number %d%s", |
| 5941 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); |
| 5942 | vty_out (vty, |
| 5943 | "%ld BGP AS-PATH entries%s", aspath_count (), |
| 5944 | VTY_NEWLINE); |
| 5945 | vty_out (vty, |
| 5946 | "%ld BGP community entries%s", community_count (), |
| 5947 | VTY_NEWLINE); |
| 5948 | |
| 5949 | if (CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
| 5950 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); |
| 5951 | vty_out (vty, "%s", VTY_NEWLINE); |
| 5952 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 5953 | } |
| 5954 | count++; |
| 5955 | |
| 5956 | len = vty_out (vty, "%s", peer->host); |
| 5957 | len = 16 - len; |
| 5958 | if (len < 1) |
| 5959 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 5960 | else |
| 5961 | vty_out (vty, "%*s", len, " "); |
| 5962 | |
| 5963 | switch (peer->version) |
| 5964 | { |
| 5965 | case BGP_VERSION_4: |
| 5966 | vty_out (vty, "4 "); |
| 5967 | break; |
| 5968 | case BGP_VERSION_MP_4_DRAFT_00: |
| 5969 | vty_out (vty, "4-"); |
| 5970 | break; |
| 5971 | } |
| 5972 | |
| 5973 | vty_out (vty, "%5d %7d %7d %8d %4d %4ld ", |
| 5974 | peer->as, |
| 5975 | peer->open_in + peer->update_in + peer->keepalive_in |
| 5976 | + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in, |
| 5977 | peer->open_out + peer->update_out + peer->keepalive_out |
| 5978 | + peer->notify_out + peer->refresh_out |
| 5979 | + peer->dynamic_cap_out, |
| 5980 | 0, 0, peer->obuf->count); |
| 5981 | |
| 5982 | vty_out (vty, "%8s", |
| 5983 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); |
| 5984 | |
| 5985 | if (peer->status == Established) |
| 5986 | { |
| 5987 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); |
| 5988 | } |
| 5989 | else |
| 5990 | { |
| 5991 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) |
| 5992 | vty_out (vty, " Idle (Admin)"); |
| 5993 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 5994 | vty_out (vty, " Idle (PfxCt)"); |
| 5995 | else |
| 5996 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); |
| 5997 | } |
| 5998 | |
| 5999 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6000 | } |
| 6001 | } |
| 6002 | |
| 6003 | if (count) |
| 6004 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, |
| 6005 | count, VTY_NEWLINE); |
| 6006 | else |
| 6007 | vty_out (vty, "No %s neighbor is configured%s", |
| 6008 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 6009 | return CMD_SUCCESS; |
| 6010 | } |
| 6011 | |
| 6012 | int |
| 6013 | bgp_show_summary_vty (struct vty *vty, char *name, afi_t afi, safi_t safi) |
| 6014 | { |
| 6015 | struct bgp *bgp; |
| 6016 | |
| 6017 | if (name) |
| 6018 | { |
| 6019 | bgp = bgp_lookup_by_name (name); |
| 6020 | |
| 6021 | if (! bgp) |
| 6022 | { |
| 6023 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 6024 | return CMD_WARNING; |
| 6025 | } |
| 6026 | |
| 6027 | bgp_show_summary (vty, bgp, afi, safi); |
| 6028 | return CMD_SUCCESS; |
| 6029 | } |
| 6030 | |
| 6031 | bgp = bgp_get_default (); |
| 6032 | |
| 6033 | if (bgp) |
| 6034 | bgp_show_summary (vty, bgp, afi, safi); |
| 6035 | |
| 6036 | return CMD_SUCCESS; |
| 6037 | } |
| 6038 | |
| 6039 | /* `show ip bgp summary' commands. */ |
| 6040 | DEFUN (show_ip_bgp_summary, |
| 6041 | show_ip_bgp_summary_cmd, |
| 6042 | "show ip bgp summary", |
| 6043 | SHOW_STR |
| 6044 | IP_STR |
| 6045 | BGP_STR |
| 6046 | "Summary of BGP neighbor status\n") |
| 6047 | { |
| 6048 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 6049 | } |
| 6050 | |
| 6051 | DEFUN (show_ip_bgp_instance_summary, |
| 6052 | show_ip_bgp_instance_summary_cmd, |
| 6053 | "show ip bgp view WORD summary", |
| 6054 | SHOW_STR |
| 6055 | IP_STR |
| 6056 | BGP_STR |
| 6057 | "BGP view\n" |
| 6058 | "View name\n" |
| 6059 | "Summary of BGP neighbor status\n") |
| 6060 | { |
| 6061 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 6062 | } |
| 6063 | |
| 6064 | DEFUN (show_ip_bgp_ipv4_summary, |
| 6065 | show_ip_bgp_ipv4_summary_cmd, |
| 6066 | "show ip bgp ipv4 (unicast|multicast) summary", |
| 6067 | SHOW_STR |
| 6068 | IP_STR |
| 6069 | BGP_STR |
| 6070 | "Address family\n" |
| 6071 | "Address Family modifier\n" |
| 6072 | "Address Family modifier\n" |
| 6073 | "Summary of BGP neighbor status\n") |
| 6074 | { |
| 6075 | if (strncmp (argv[0], "m", 1) == 0) |
| 6076 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 6077 | |
| 6078 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 6079 | } |
| 6080 | |
| 6081 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
| 6082 | show_ip_bgp_instance_ipv4_summary_cmd, |
| 6083 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", |
| 6084 | SHOW_STR |
| 6085 | IP_STR |
| 6086 | BGP_STR |
| 6087 | "BGP view\n" |
| 6088 | "View name\n" |
| 6089 | "Address family\n" |
| 6090 | "Address Family modifier\n" |
| 6091 | "Address Family modifier\n" |
| 6092 | "Summary of BGP neighbor status\n") |
| 6093 | { |
| 6094 | if (strncmp (argv[1], "m", 1) == 0) |
| 6095 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 6096 | else |
| 6097 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 6098 | } |
| 6099 | |
| 6100 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
| 6101 | show_ip_bgp_vpnv4_all_summary_cmd, |
| 6102 | "show ip bgp vpnv4 all summary", |
| 6103 | SHOW_STR |
| 6104 | IP_STR |
| 6105 | BGP_STR |
| 6106 | "Display VPNv4 NLRI specific information\n" |
| 6107 | "Display information about all VPNv4 NLRIs\n" |
| 6108 | "Summary of BGP neighbor status\n") |
| 6109 | { |
| 6110 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 6111 | } |
| 6112 | |
| 6113 | DEFUN (show_ip_bgp_vpnv4_rd_summary, |
| 6114 | show_ip_bgp_vpnv4_rd_summary_cmd, |
| 6115 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", |
| 6116 | SHOW_STR |
| 6117 | IP_STR |
| 6118 | BGP_STR |
| 6119 | "Display VPNv4 NLRI specific information\n" |
| 6120 | "Display information for a route distinguisher\n" |
| 6121 | "VPN Route Distinguisher\n" |
| 6122 | "Summary of BGP neighbor status\n") |
| 6123 | { |
| 6124 | int ret; |
| 6125 | struct prefix_rd prd; |
| 6126 | |
| 6127 | ret = str2prefix_rd (argv[0], &prd); |
| 6128 | if (! ret) |
| 6129 | { |
| 6130 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); |
| 6131 | return CMD_WARNING; |
| 6132 | } |
| 6133 | |
| 6134 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 6135 | } |
| 6136 | |
| 6137 | #ifdef HAVE_IPV6 |
| 6138 | DEFUN (show_bgp_summary, |
| 6139 | show_bgp_summary_cmd, |
| 6140 | "show bgp summary", |
| 6141 | SHOW_STR |
| 6142 | BGP_STR |
| 6143 | "Summary of BGP neighbor status\n") |
| 6144 | { |
| 6145 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 6146 | } |
| 6147 | |
| 6148 | DEFUN (show_bgp_instance_summary, |
| 6149 | show_bgp_instance_summary_cmd, |
| 6150 | "show bgp view WORD summary", |
| 6151 | SHOW_STR |
| 6152 | BGP_STR |
| 6153 | "BGP view\n" |
| 6154 | "View name\n" |
| 6155 | "Summary of BGP neighbor status\n") |
| 6156 | { |
| 6157 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 6158 | } |
| 6159 | |
| 6160 | ALIAS (show_bgp_summary, |
| 6161 | show_bgp_ipv6_summary_cmd, |
| 6162 | "show bgp ipv6 summary", |
| 6163 | SHOW_STR |
| 6164 | BGP_STR |
| 6165 | "Address family\n" |
| 6166 | "Summary of BGP neighbor status\n") |
| 6167 | |
| 6168 | ALIAS (show_bgp_instance_summary, |
| 6169 | show_bgp_instance_ipv6_summary_cmd, |
| 6170 | "show bgp view WORD ipv6 summary", |
| 6171 | SHOW_STR |
| 6172 | BGP_STR |
| 6173 | "BGP view\n" |
| 6174 | "View name\n" |
| 6175 | "Address family\n" |
| 6176 | "Summary of BGP neighbor status\n") |
| 6177 | |
| 6178 | /* old command */ |
| 6179 | DEFUN (show_ipv6_bgp_summary, |
| 6180 | show_ipv6_bgp_summary_cmd, |
| 6181 | "show ipv6 bgp summary", |
| 6182 | SHOW_STR |
| 6183 | IPV6_STR |
| 6184 | BGP_STR |
| 6185 | "Summary of BGP neighbor status\n") |
| 6186 | { |
| 6187 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 6188 | } |
| 6189 | |
| 6190 | /* old command */ |
| 6191 | DEFUN (show_ipv6_mbgp_summary, |
| 6192 | show_ipv6_mbgp_summary_cmd, |
| 6193 | "show ipv6 mbgp summary", |
| 6194 | SHOW_STR |
| 6195 | IPV6_STR |
| 6196 | MBGP_STR |
| 6197 | "Summary of BGP neighbor status\n") |
| 6198 | { |
| 6199 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 6200 | } |
| 6201 | #endif /* HAVE_IPV6 */ |
| 6202 | |
| 6203 | /* Show BGP peer's information. */ |
| 6204 | enum show_type |
| 6205 | { |
| 6206 | show_all, |
| 6207 | show_peer |
| 6208 | }; |
| 6209 | |
| 6210 | void |
| 6211 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
| 6212 | afi_t afi, safi_t safi, |
| 6213 | u_int16_t adv_smcap, u_int16_t adv_rmcap, |
| 6214 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) |
| 6215 | { |
| 6216 | /* Send-Mode */ |
| 6217 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) |
| 6218 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 6219 | { |
| 6220 | vty_out (vty, " Send-mode: "); |
| 6221 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) |
| 6222 | vty_out (vty, "advertised"); |
| 6223 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 6224 | vty_out (vty, "%sreceived", |
| 6225 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? |
| 6226 | ", " : ""); |
| 6227 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6228 | } |
| 6229 | |
| 6230 | /* Receive-Mode */ |
| 6231 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) |
| 6232 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 6233 | { |
| 6234 | vty_out (vty, " Receive-mode: "); |
| 6235 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) |
| 6236 | vty_out (vty, "advertised"); |
| 6237 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 6238 | vty_out (vty, "%sreceived", |
| 6239 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? |
| 6240 | ", " : ""); |
| 6241 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6242 | } |
| 6243 | } |
| 6244 | |
| 6245 | void |
| 6246 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
| 6247 | { |
| 6248 | struct bgp_filter *filter; |
| 6249 | char orf_pfx_name[BUFSIZ]; |
| 6250 | int orf_pfx_count; |
| 6251 | |
| 6252 | filter = &p->filter[afi][safi]; |
| 6253 | |
| 6254 | vty_out (vty, " For address family: %s %s%s", |
| 6255 | afi == AFI_IP6 ? "IPv6" : |
| 6256 | safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", |
| 6257 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", |
| 6258 | VTY_NEWLINE); |
| 6259 | if (p->af_group[afi][safi]) |
| 6260 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
| 6261 | |
| 6262 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 6263 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 6264 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 6265 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 6266 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) |
| 6267 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 6268 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); |
| 6269 | |
| 6270 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 6271 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 6272 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 6273 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) |
| 6274 | { |
| 6275 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 6276 | ORF_TYPE_PREFIX, VTY_NEWLINE); |
| 6277 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 6278 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 6279 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 6280 | PEER_CAP_ORF_PREFIX_SM_RCV, |
| 6281 | PEER_CAP_ORF_PREFIX_RM_RCV); |
| 6282 | } |
| 6283 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 6284 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 6285 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 6286 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 6287 | { |
| 6288 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 6289 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); |
| 6290 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 6291 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 6292 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 6293 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, |
| 6294 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); |
| 6295 | } |
| 6296 | |
| 6297 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
| 6298 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); |
| 6299 | |
| 6300 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
| 6301 | || orf_pfx_count) |
| 6302 | { |
| 6303 | vty_out (vty, " Outbound Route Filter (ORF):"); |
| 6304 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) |
| 6305 | vty_out (vty, " sent;"); |
| 6306 | if (orf_pfx_count) |
| 6307 | vty_out (vty, " received (%d entries)", orf_pfx_count); |
| 6308 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6309 | } |
| 6310 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) |
| 6311 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); |
| 6312 | |
| 6313 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) |
| 6314 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); |
| 6315 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 6316 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); |
| 6317 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) |
| 6318 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); |
| 6319 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
| 6320 | vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE); |
| 6321 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) |
| 6322 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); |
| 6323 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) |
| 6324 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 6325 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) |
| 6326 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 6327 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) |
| 6328 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 6329 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 6330 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
| 6331 | { |
| 6332 | vty_out (vty, " Community attribute sent to this neighbor"); |
| 6333 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 6334 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
| 6335 | vty_out (vty, " (both)%s", VTY_NEWLINE); |
| 6336 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
| 6337 | vty_out (vty, " (extended)%s", VTY_NEWLINE); |
| 6338 | else |
| 6339 | vty_out (vty, " (standard)%s", VTY_NEWLINE); |
| 6340 | } |
| 6341 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) |
| 6342 | { |
| 6343 | vty_out (vty, " Default information originate,"); |
| 6344 | |
| 6345 | if (p->default_rmap[afi][safi].name) |
| 6346 | vty_out (vty, " default route-map %s%s,", |
| 6347 | p->default_rmap[afi][safi].map ? "*" : "", |
| 6348 | p->default_rmap[afi][safi].name); |
| 6349 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) |
| 6350 | vty_out (vty, " default sent%s", VTY_NEWLINE); |
| 6351 | else |
| 6352 | vty_out (vty, " default not sent%s", VTY_NEWLINE); |
| 6353 | } |
| 6354 | |
| 6355 | if (filter->plist[FILTER_IN].name |
| 6356 | || filter->dlist[FILTER_IN].name |
| 6357 | || filter->aslist[FILTER_IN].name |
| 6358 | || filter->map[FILTER_IN].name) |
| 6359 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
| 6360 | if (filter->plist[FILTER_OUT].name |
| 6361 | || filter->dlist[FILTER_OUT].name |
| 6362 | || filter->aslist[FILTER_OUT].name |
| 6363 | || filter->map[FILTER_OUT].name |
| 6364 | || filter->usmap.name) |
| 6365 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); |
| 6366 | |
| 6367 | /* prefix-list */ |
| 6368 | if (filter->plist[FILTER_IN].name) |
| 6369 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", |
| 6370 | filter->plist[FILTER_IN].plist ? "*" : "", |
| 6371 | filter->plist[FILTER_IN].name, |
| 6372 | VTY_NEWLINE); |
| 6373 | if (filter->plist[FILTER_OUT].name) |
| 6374 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", |
| 6375 | filter->plist[FILTER_OUT].plist ? "*" : "", |
| 6376 | filter->plist[FILTER_OUT].name, |
| 6377 | VTY_NEWLINE); |
| 6378 | |
| 6379 | /* distribute-list */ |
| 6380 | if (filter->dlist[FILTER_IN].name) |
| 6381 | vty_out (vty, " Incoming update network filter list is %s%s%s", |
| 6382 | filter->dlist[FILTER_IN].alist ? "*" : "", |
| 6383 | filter->dlist[FILTER_IN].name, |
| 6384 | VTY_NEWLINE); |
| 6385 | if (filter->dlist[FILTER_OUT].name) |
| 6386 | vty_out (vty, " Outgoing update network filter list is %s%s%s", |
| 6387 | filter->dlist[FILTER_OUT].alist ? "*" : "", |
| 6388 | filter->dlist[FILTER_OUT].name, |
| 6389 | VTY_NEWLINE); |
| 6390 | |
| 6391 | /* filter-list. */ |
| 6392 | if (filter->aslist[FILTER_IN].name) |
| 6393 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", |
| 6394 | filter->aslist[FILTER_IN].aslist ? "*" : "", |
| 6395 | filter->aslist[FILTER_IN].name, |
| 6396 | VTY_NEWLINE); |
| 6397 | if (filter->aslist[FILTER_OUT].name) |
| 6398 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", |
| 6399 | filter->aslist[FILTER_OUT].aslist ? "*" : "", |
| 6400 | filter->aslist[FILTER_OUT].name, |
| 6401 | VTY_NEWLINE); |
| 6402 | |
| 6403 | /* route-map. */ |
| 6404 | if (filter->map[FILTER_IN].name) |
| 6405 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
| 6406 | filter->map[FILTER_IN].map ? "*" : "", |
| 6407 | filter->map[FILTER_IN].name, |
| 6408 | VTY_NEWLINE); |
| 6409 | if (filter->map[FILTER_OUT].name) |
| 6410 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
| 6411 | filter->map[FILTER_OUT].map ? "*" : "", |
| 6412 | filter->map[FILTER_OUT].name, |
| 6413 | VTY_NEWLINE); |
| 6414 | |
| 6415 | /* unsuppress-map */ |
| 6416 | if (filter->usmap.name) |
| 6417 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", |
| 6418 | filter->usmap.map ? "*" : "", |
| 6419 | filter->usmap.name, VTY_NEWLINE); |
| 6420 | |
| 6421 | /* Receive prefix count */ |
| 6422 | vty_out (vty, " %ld accepted prefixes", |
| 6423 | p->pcount[afi][safi]); |
| 6424 | /* Maximum prefix */ |
| 6425 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) |
| 6426 | { |
| 6427 | vty_out (vty, ", maximum limit %ld%s", |
| 6428 | p->pmax[afi][safi], |
| 6429 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
| 6430 | ? " (warning-only)" : ""); |
| 6431 | } |
| 6432 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6433 | |
| 6434 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6435 | } |
| 6436 | |
| 6437 | void |
| 6438 | bgp_show_peer (struct vty *vty, struct peer *p) |
| 6439 | { |
| 6440 | struct bgp *bgp; |
| 6441 | char buf1[BUFSIZ]; |
| 6442 | char timebuf[BGP_UPTIME_LEN]; |
| 6443 | |
| 6444 | bgp = p->bgp; |
| 6445 | |
| 6446 | /* Configured IP address. */ |
| 6447 | vty_out (vty, "BGP neighbor is %s, ", p->host); |
| 6448 | vty_out (vty, "remote AS %d, ", p->as); |
| 6449 | vty_out (vty, "local AS %d%s, ", |
| 6450 | p->change_local_as ? p->change_local_as : p->local_as, |
| 6451 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? |
| 6452 | " no-prepend" : ""); |
| 6453 | vty_out (vty, "%s link%s", |
| 6454 | p->as == p->local_as ? "internal" : "external", |
| 6455 | VTY_NEWLINE); |
| 6456 | |
| 6457 | /* Description. */ |
| 6458 | if (p->desc) |
| 6459 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); |
| 6460 | |
| 6461 | /* Peer-group */ |
| 6462 | if (p->group) |
| 6463 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
| 6464 | p->group->name, VTY_NEWLINE); |
| 6465 | |
| 6466 | /* Administrative shutdown. */ |
| 6467 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) |
| 6468 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); |
| 6469 | |
| 6470 | /* BGP Version. */ |
| 6471 | vty_out (vty, " BGP version 4"); |
| 6472 | if (p->version == BGP_VERSION_MP_4_DRAFT_00) |
| 6473 | vty_out (vty, "(with draft-00 verion of multiporotocol extension)"); |
| 6474 | vty_out (vty, ", remote router ID %s%s", |
| 6475 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), |
| 6476 | VTY_NEWLINE); |
| 6477 | |
| 6478 | /* Confederation */ |
| 6479 | if (bgp_confederation_peers_check (bgp, p->as)) |
| 6480 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
| 6481 | |
| 6482 | /* Status. */ |
| 6483 | vty_out (vty, " BGP state = %s", |
| 6484 | LOOKUP (bgp_status_msg, p->status)); |
| 6485 | if (p->status == Established) |
| 6486 | vty_out (vty, ", up for %8s", |
| 6487 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); |
| 6488 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6489 | |
| 6490 | /* read timer */ |
| 6491 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); |
| 6492 | |
| 6493 | /* Configured timer values. */ |
| 6494 | vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s", |
| 6495 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); |
| 6496 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) |
| 6497 | { |
| 6498 | vty_out (vty, " Configured hold time is %d", p->holdtime); |
| 6499 | vty_out (vty, ", keepalive interval is %d seconds%s", |
| 6500 | p->keepalive, VTY_NEWLINE); |
| 6501 | } |
| 6502 | |
| 6503 | /* Capability. */ |
| 6504 | if (p->status == Established) |
| 6505 | { |
| 6506 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) |
| 6507 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 6508 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) |
| 6509 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) |
| 6510 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) |
| 6511 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
| 6512 | || p->afc_recv[AFI_IP][SAFI_UNICAST] |
| 6513 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] |
| 6514 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] |
| 6515 | #ifdef HAVE_IPV6 |
| 6516 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] |
| 6517 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] |
| 6518 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] |
| 6519 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] |
| 6520 | #endif /* HAVE_IPV6 */ |
| 6521 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] |
| 6522 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) |
| 6523 | { |
| 6524 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); |
| 6525 | |
| 6526 | /* Dynamic */ |
| 6527 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) |
| 6528 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 6529 | { |
| 6530 | vty_out (vty, " Dynamic:"); |
| 6531 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 6532 | vty_out (vty, " advertised"); |
| 6533 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) |
| 6534 | { |
| 6535 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 6536 | vty_out (vty, " and"); |
| 6537 | vty_out (vty, " received"); |
| 6538 | } |
| 6539 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6540 | } |
| 6541 | |
| 6542 | /* Route Refresh */ |
| 6543 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) |
| 6544 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 6545 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
| 6546 | { |
| 6547 | vty_out (vty, " Route refresh:"); |
| 6548 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) |
| 6549 | vty_out (vty, " advertised"); |
| 6550 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 6551 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
| 6552 | { |
| 6553 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) |
| 6554 | vty_out (vty, " and"); |
| 6555 | vty_out (vty, " received"); |
| 6556 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 6557 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
| 6558 | vty_out (vty, " (old and new)"); |
| 6559 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
| 6560 | vty_out (vty, " (old)"); |
| 6561 | else |
| 6562 | vty_out (vty, " (new)"); |
| 6563 | } |
| 6564 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6565 | } |
| 6566 | |
| 6567 | /* IPv4 */ |
| 6568 | if (p->afc_adv[AFI_IP][SAFI_UNICAST] |
| 6569 | || p->afc_recv[AFI_IP][SAFI_UNICAST]) |
| 6570 | { |
| 6571 | vty_out (vty, " Address family IPv4 Unicast:"); |
| 6572 | if (p->afc_adv[AFI_IP][SAFI_UNICAST]) |
| 6573 | vty_out (vty, " advertised"); |
| 6574 | if (p->afc_recv[AFI_IP][SAFI_UNICAST]) |
| 6575 | { |
| 6576 | if (p->afc_adv[AFI_IP][SAFI_UNICAST]) |
| 6577 | vty_out (vty, " and"); |
| 6578 | vty_out (vty, " received"); |
| 6579 | } |
| 6580 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6581 | } |
| 6582 | if (p->afc_adv[AFI_IP][SAFI_MULTICAST] || p->afc_recv[AFI_IP][SAFI_MULTICAST]) |
| 6583 | { |
| 6584 | vty_out (vty, " Address family IPv4 Multicast:"); |
| 6585 | if (p->afc_adv[AFI_IP][SAFI_MULTICAST]) |
| 6586 | vty_out (vty, " advertised"); |
| 6587 | if (p->afc_recv[AFI_IP][SAFI_MULTICAST]) |
| 6588 | { |
| 6589 | if (p->afc_adv[AFI_IP][SAFI_MULTICAST]) |
| 6590 | vty_out (vty, " and"); |
| 6591 | vty_out (vty, " received"); |
| 6592 | } |
| 6593 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6594 | } |
| 6595 | if (p->afc_adv[AFI_IP][SAFI_MPLS_VPN] || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) |
| 6596 | { |
| 6597 | vty_out (vty, " Address family VPNv4 Unicast:"); |
| 6598 | if (p->afc_adv[AFI_IP][SAFI_MPLS_VPN]) |
| 6599 | vty_out (vty, " advertised"); |
| 6600 | if (p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) |
| 6601 | { |
| 6602 | if (p->afc_adv[AFI_IP][SAFI_MPLS_VPN]) |
| 6603 | vty_out (vty, " and"); |
| 6604 | vty_out (vty, " received"); |
| 6605 | } |
| 6606 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6607 | } |
| 6608 | /* IPv6 */ |
| 6609 | #ifdef HAVE_IPV6 |
| 6610 | if (p->afc_adv[AFI_IP6][SAFI_UNICAST] || p->afc_recv[AFI_IP6][SAFI_UNICAST]) |
| 6611 | { |
| 6612 | vty_out (vty, " Address family IPv6 Unicast:"); |
| 6613 | if (p->afc_adv[AFI_IP6][SAFI_UNICAST]) |
| 6614 | vty_out (vty, " advertised"); |
| 6615 | if (p->afc_recv[AFI_IP6][SAFI_UNICAST]) |
| 6616 | { |
| 6617 | if (p->afc_adv[AFI_IP6][SAFI_UNICAST]) |
| 6618 | vty_out (vty, " and"); |
| 6619 | vty_out (vty, " received"); |
| 6620 | } |
| 6621 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6622 | } |
| 6623 | if (p->afc_adv[AFI_IP6][SAFI_MULTICAST] || p->afc_recv[AFI_IP6][SAFI_MULTICAST]) |
| 6624 | { |
| 6625 | vty_out (vty, " Address family IPv6 Multicast:"); |
| 6626 | if (p->afc_adv[AFI_IP6][SAFI_MULTICAST]) |
| 6627 | vty_out (vty, " advertised"); |
| 6628 | if (p->afc_recv[AFI_IP6][SAFI_MULTICAST]) |
| 6629 | { |
| 6630 | if (p->afc_adv[AFI_IP6][SAFI_MULTICAST]) |
| 6631 | vty_out (vty, " and"); |
| 6632 | vty_out (vty, " received"); |
| 6633 | } |
| 6634 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6635 | } |
| 6636 | #endif /* HAVE_IPV6 */ |
| 6637 | } |
| 6638 | } |
| 6639 | |
| 6640 | /* Packet counts. */ |
| 6641 | vty_out(vty, " Received %d messages, %d notifications, %d in queue%s", |
| 6642 | p->open_in + p->update_in + p->keepalive_in + p->refresh_in |
| 6643 | + p->dynamic_cap_in, p->notify_in, 0, VTY_NEWLINE); |
| 6644 | vty_out(vty, " Sent %d messages, %d notifications, %ld in queue%s", |
| 6645 | p->open_out + p->update_out + p->keepalive_out + p->refresh_out |
| 6646 | + p->dynamic_cap_out, p->notify_out, p->obuf->count, VTY_NEWLINE); |
| 6647 | vty_out(vty, " Route refresh request: received %d, sent %d%s", |
| 6648 | p->refresh_in, p->refresh_out, VTY_NEWLINE); |
| 6649 | |
| 6650 | /* advertisement-interval */ |
| 6651 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", |
| 6652 | p->v_routeadv, VTY_NEWLINE); |
| 6653 | |
| 6654 | /* Update-source. */ |
| 6655 | if (p->update_if || p->update_source) |
| 6656 | { |
| 6657 | vty_out (vty, " Update source is "); |
| 6658 | if (p->update_if) |
| 6659 | vty_out (vty, "%s", p->update_if); |
| 6660 | else if (p->update_source) |
| 6661 | vty_out (vty, "%s", |
| 6662 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); |
| 6663 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6664 | } |
| 6665 | |
| 6666 | /* Default weight */ |
| 6667 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) |
| 6668 | vty_out (vty, " Default weight %d%s", p->weight, |
| 6669 | VTY_NEWLINE); |
| 6670 | |
| 6671 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6672 | |
| 6673 | /* Address Family Information */ |
| 6674 | if (p->afc[AFI_IP][SAFI_UNICAST]) |
| 6675 | bgp_show_peer_afi (vty, p, AFI_IP, SAFI_UNICAST); |
| 6676 | if (p->afc[AFI_IP][SAFI_MULTICAST]) |
| 6677 | bgp_show_peer_afi (vty, p, AFI_IP, SAFI_MULTICAST); |
| 6678 | if (p->afc[AFI_IP][SAFI_MPLS_VPN]) |
| 6679 | bgp_show_peer_afi (vty, p, AFI_IP, SAFI_MPLS_VPN); |
| 6680 | #ifdef HAVE_IPV6 |
| 6681 | if (p->afc[AFI_IP6][SAFI_UNICAST]) |
| 6682 | bgp_show_peer_afi (vty, p, AFI_IP6, SAFI_UNICAST); |
| 6683 | if (p->afc[AFI_IP6][SAFI_MULTICAST]) |
| 6684 | bgp_show_peer_afi (vty, p, AFI_IP6, SAFI_MULTICAST); |
| 6685 | #endif /* HAVE_IPV6 */ |
| 6686 | |
| 6687 | vty_out (vty, " Connections established %d; dropped %d%s", |
| 6688 | p->established, p->dropped, |
| 6689 | VTY_NEWLINE); |
| 6690 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 6691 | vty_out (vty, " Last reset %s%s", p->dropped ? peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN) : "never", |
| 6692 | VTY_NEWLINE); |
| 6693 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6694 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 6695 | { |
| 6696 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); |
| 6697 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", |
| 6698 | p->host, VTY_NEWLINE); |
| 6699 | } |
| 6700 | |
| 6701 | /* EBGP Multihop */ |
| 6702 | if (peer_sort (p) != BGP_PEER_IBGP && p->ttl > 1) |
| 6703 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 6704 | p->ttl, VTY_NEWLINE); |
| 6705 | |
| 6706 | /* Local address. */ |
| 6707 | if (p->su_local) |
| 6708 | { |
| 6709 | vty_out (vty, "Local host: %s, Local port: %d%s%s", |
| 6710 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
| 6711 | ntohs (p->su_local->sin.sin_port), |
| 6712 | CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE) ? |
| 6713 | ", passive-mode" : "", |
| 6714 | VTY_NEWLINE); |
| 6715 | } |
| 6716 | |
| 6717 | /* Remote address. */ |
| 6718 | if (p->su_remote) |
| 6719 | { |
| 6720 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", |
| 6721 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
| 6722 | ntohs (p->su_remote->sin.sin_port), |
| 6723 | VTY_NEWLINE); |
| 6724 | } |
| 6725 | |
| 6726 | /* Nexthop display. */ |
| 6727 | if (p->su_local) |
| 6728 | { |
| 6729 | vty_out (vty, "Nexthop: %s%s", |
| 6730 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), |
| 6731 | VTY_NEWLINE); |
| 6732 | #ifdef HAVE_IPV6 |
| 6733 | vty_out (vty, "Nexthop global: %s%s", |
| 6734 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), |
| 6735 | VTY_NEWLINE); |
| 6736 | vty_out (vty, "Nexthop local: %s%s", |
| 6737 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), |
| 6738 | VTY_NEWLINE); |
| 6739 | vty_out (vty, "BGP connection: %s%s", |
| 6740 | p->shared_network ? "shared network" : "non shared network", |
| 6741 | VTY_NEWLINE); |
| 6742 | #endif /* HAVE_IPV6 */ |
| 6743 | } |
| 6744 | |
| 6745 | /* Timer information. */ |
| 6746 | if (p->t_start) |
| 6747 | vty_out (vty, "Next start timer due in %ld seconds%s", |
| 6748 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); |
| 6749 | if (p->t_connect) |
| 6750 | vty_out (vty, "Next connect timer due in %ld seconds%s", |
| 6751 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); |
| 6752 | |
| 6753 | vty_out (vty, "Read thread: %s Write thread: %s%s", |
| 6754 | p->t_read ? "on" : "off", |
| 6755 | p->t_write ? "on" : "off", |
| 6756 | VTY_NEWLINE); |
| 6757 | |
| 6758 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR |
| 6759 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) |
| 6760 | bgp_capability_vty_out (vty, p); |
| 6761 | |
| 6762 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6763 | } |
| 6764 | |
| 6765 | int |
| 6766 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
| 6767 | enum show_type type, union sockunion *su) |
| 6768 | { |
| 6769 | struct listnode *nn; |
| 6770 | struct peer *peer; |
| 6771 | int find = 0; |
| 6772 | |
| 6773 | LIST_LOOP (bgp->peer, peer, nn) |
| 6774 | { |
| 6775 | switch (type) |
| 6776 | { |
| 6777 | case show_all: |
| 6778 | bgp_show_peer (vty, peer); |
| 6779 | break; |
| 6780 | case show_peer: |
| 6781 | if (sockunion_same (&peer->su, su)) |
| 6782 | { |
| 6783 | find = 1; |
| 6784 | bgp_show_peer (vty, peer); |
| 6785 | } |
| 6786 | break; |
| 6787 | } |
| 6788 | } |
| 6789 | |
| 6790 | if (type == show_peer && ! find) |
| 6791 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); |
| 6792 | |
| 6793 | return CMD_SUCCESS; |
| 6794 | } |
| 6795 | |
| 6796 | int |
| 6797 | bgp_show_neighbor_vty (struct vty *vty, char *name, enum show_type type, |
| 6798 | char *ip_str) |
| 6799 | { |
| 6800 | int ret; |
| 6801 | struct bgp *bgp; |
| 6802 | union sockunion su; |
| 6803 | |
| 6804 | if (ip_str) |
| 6805 | { |
| 6806 | ret = str2sockunion (ip_str, &su); |
| 6807 | if (ret < 0) |
| 6808 | { |
| 6809 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 6810 | return CMD_WARNING; |
| 6811 | } |
| 6812 | } |
| 6813 | |
| 6814 | if (name) |
| 6815 | { |
| 6816 | bgp = bgp_lookup_by_name (name); |
| 6817 | |
| 6818 | if (! bgp) |
| 6819 | { |
| 6820 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 6821 | return CMD_WARNING; |
| 6822 | } |
| 6823 | |
| 6824 | bgp_show_neighbor (vty, bgp, type, &su); |
| 6825 | |
| 6826 | return CMD_SUCCESS; |
| 6827 | } |
| 6828 | |
| 6829 | bgp = bgp_get_default (); |
| 6830 | |
| 6831 | if (bgp) |
| 6832 | bgp_show_neighbor (vty, bgp, type, &su); |
| 6833 | |
| 6834 | return CMD_SUCCESS; |
| 6835 | } |
| 6836 | |
| 6837 | /* "show ip bgp neighbors" commands. */ |
| 6838 | DEFUN (show_ip_bgp_neighbors, |
| 6839 | show_ip_bgp_neighbors_cmd, |
| 6840 | "show ip bgp neighbors", |
| 6841 | SHOW_STR |
| 6842 | IP_STR |
| 6843 | BGP_STR |
| 6844 | "Detailed information on TCP and BGP neighbor connections\n") |
| 6845 | { |
| 6846 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); |
| 6847 | } |
| 6848 | |
| 6849 | ALIAS (show_ip_bgp_neighbors, |
| 6850 | show_ip_bgp_ipv4_neighbors_cmd, |
| 6851 | "show ip bgp ipv4 (unicast|multicast) neighbors", |
| 6852 | SHOW_STR |
| 6853 | IP_STR |
| 6854 | BGP_STR |
| 6855 | "Address family\n" |
| 6856 | "Address Family modifier\n" |
| 6857 | "Address Family modifier\n" |
| 6858 | "Detailed information on TCP and BGP neighbor connections\n") |
| 6859 | |
| 6860 | ALIAS (show_ip_bgp_neighbors, |
| 6861 | show_ip_bgp_vpnv4_all_neighbors_cmd, |
| 6862 | "show ip bgp vpnv4 all neighbors", |
| 6863 | SHOW_STR |
| 6864 | IP_STR |
| 6865 | BGP_STR |
| 6866 | "Display VPNv4 NLRI specific information\n" |
| 6867 | "Display information about all VPNv4 NLRIs\n" |
| 6868 | "Detailed information on TCP and BGP neighbor connections\n") |
| 6869 | |
| 6870 | ALIAS (show_ip_bgp_neighbors, |
| 6871 | show_ip_bgp_vpnv4_rd_neighbors_cmd, |
| 6872 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", |
| 6873 | SHOW_STR |
| 6874 | IP_STR |
| 6875 | BGP_STR |
| 6876 | "Display VPNv4 NLRI specific information\n" |
| 6877 | "Display information for a route distinguisher\n" |
| 6878 | "VPN Route Distinguisher\n" |
| 6879 | "Detailed information on TCP and BGP neighbor connections\n") |
| 6880 | |
| 6881 | ALIAS (show_ip_bgp_neighbors, |
| 6882 | show_bgp_neighbors_cmd, |
| 6883 | "show bgp neighbors", |
| 6884 | SHOW_STR |
| 6885 | BGP_STR |
| 6886 | "Detailed information on TCP and BGP neighbor connections\n") |
| 6887 | |
| 6888 | ALIAS (show_ip_bgp_neighbors, |
| 6889 | show_bgp_ipv6_neighbors_cmd, |
| 6890 | "show bgp ipv6 neighbors", |
| 6891 | SHOW_STR |
| 6892 | BGP_STR |
| 6893 | "Address family\n" |
| 6894 | "Detailed information on TCP and BGP neighbor connections\n") |
| 6895 | |
| 6896 | DEFUN (show_ip_bgp_neighbors_peer, |
| 6897 | show_ip_bgp_neighbors_peer_cmd, |
| 6898 | "show ip bgp neighbors (A.B.C.D|X:X::X:X)", |
| 6899 | SHOW_STR |
| 6900 | IP_STR |
| 6901 | BGP_STR |
| 6902 | "Detailed information on TCP and BGP neighbor connections\n" |
| 6903 | "Neighbor to display information about\n" |
| 6904 | "Neighbor to display information about\n") |
| 6905 | { |
| 6906 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); |
| 6907 | } |
| 6908 | |
| 6909 | ALIAS (show_ip_bgp_neighbors_peer, |
| 6910 | show_ip_bgp_ipv4_neighbors_peer_cmd, |
| 6911 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)", |
| 6912 | SHOW_STR |
| 6913 | IP_STR |
| 6914 | BGP_STR |
| 6915 | "Address family\n" |
| 6916 | "Address Family modifier\n" |
| 6917 | "Address Family modifier\n" |
| 6918 | "Detailed information on TCP and BGP neighbor connections\n" |
| 6919 | "Neighbor to display information about\n" |
| 6920 | "Neighbor to display information about\n") |
| 6921 | |
| 6922 | ALIAS (show_ip_bgp_neighbors_peer, |
| 6923 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, |
| 6924 | "show ip bgp vpnv4 all neighbors A.B.C.D", |
| 6925 | SHOW_STR |
| 6926 | IP_STR |
| 6927 | BGP_STR |
| 6928 | "Display VPNv4 NLRI specific information\n" |
| 6929 | "Display information about all VPNv4 NLRIs\n" |
| 6930 | "Detailed information on TCP and BGP neighbor connections\n" |
| 6931 | "Neighbor to display information about\n") |
| 6932 | |
| 6933 | ALIAS (show_ip_bgp_neighbors_peer, |
| 6934 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, |
| 6935 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", |
| 6936 | SHOW_STR |
| 6937 | IP_STR |
| 6938 | BGP_STR |
| 6939 | "Display VPNv4 NLRI specific information\n" |
| 6940 | "Display information about all VPNv4 NLRIs\n" |
| 6941 | "Detailed information on TCP and BGP neighbor connections\n" |
| 6942 | "Neighbor to display information about\n") |
| 6943 | |
| 6944 | ALIAS (show_ip_bgp_neighbors_peer, |
| 6945 | show_bgp_neighbors_peer_cmd, |
| 6946 | "show bgp neighbors (A.B.C.D|X:X::X:X)", |
| 6947 | SHOW_STR |
| 6948 | BGP_STR |
| 6949 | "Detailed information on TCP and BGP neighbor connections\n" |
| 6950 | "Neighbor to display information about\n" |
| 6951 | "Neighbor to display information about\n") |
| 6952 | |
| 6953 | ALIAS (show_ip_bgp_neighbors_peer, |
| 6954 | show_bgp_ipv6_neighbors_peer_cmd, |
| 6955 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 6956 | SHOW_STR |
| 6957 | BGP_STR |
| 6958 | "Address family\n" |
| 6959 | "Detailed information on TCP and BGP neighbor connections\n" |
| 6960 | "Neighbor to display information about\n" |
| 6961 | "Neighbor to display information about\n") |
| 6962 | |
| 6963 | DEFUN (show_ip_bgp_instance_neighbors, |
| 6964 | show_ip_bgp_instance_neighbors_cmd, |
| 6965 | "show ip bgp view WORD neighbors", |
| 6966 | SHOW_STR |
| 6967 | IP_STR |
| 6968 | BGP_STR |
| 6969 | "BGP view\n" |
| 6970 | "View name\n" |
| 6971 | "Detailed information on TCP and BGP neighbor connections\n") |
| 6972 | { |
| 6973 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); |
| 6974 | } |
| 6975 | |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 6976 | ALIAS (show_ip_bgp_instance_neighbors, |
| 6977 | show_bgp_instance_neighbors_cmd, |
| 6978 | "show bgp view WORD neighbors", |
| 6979 | SHOW_STR |
| 6980 | BGP_STR |
| 6981 | "BGP view\n" |
| 6982 | "View name\n" |
| 6983 | "Detailed information on TCP and BGP neighbor connections\n") |
| 6984 | |
| 6985 | ALIAS (show_ip_bgp_instance_neighbors, |
| 6986 | show_bgp_instance_ipv6_neighbors_cmd, |
| 6987 | "show bgp view WORD ipv6 neighbors", |
| 6988 | SHOW_STR |
| 6989 | BGP_STR |
| 6990 | "BGP view\n" |
| 6991 | "View name\n" |
| 6992 | "Address family\n" |
| 6993 | "Detailed information on TCP and BGP neighbor connections\n") |
| 6994 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6995 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
| 6996 | show_ip_bgp_instance_neighbors_peer_cmd, |
| 6997 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 6998 | SHOW_STR |
| 6999 | IP_STR |
| 7000 | BGP_STR |
| 7001 | "BGP view\n" |
| 7002 | "View name\n" |
| 7003 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7004 | "Neighbor to display information about\n" |
| 7005 | "Neighbor to display information about\n") |
| 7006 | { |
| 7007 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); |
| 7008 | } |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 7009 | |
| 7010 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 7011 | show_bgp_instance_neighbors_peer_cmd, |
| 7012 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 7013 | SHOW_STR |
| 7014 | BGP_STR |
| 7015 | "BGP view\n" |
| 7016 | "View name\n" |
| 7017 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7018 | "Neighbor to display information about\n" |
| 7019 | "Neighbor to display information about\n") |
| 7020 | |
| 7021 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 7022 | show_bgp_instance_ipv6_neighbors_peer_cmd, |
| 7023 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 7024 | SHOW_STR |
| 7025 | BGP_STR |
| 7026 | "BGP view\n" |
| 7027 | "View name\n" |
| 7028 | "Address family\n" |
| 7029 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7030 | "Neighbor to display information about\n" |
| 7031 | "Neighbor to display information about\n") |
| 7032 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7033 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
| 7034 | paths' and `show ip mbgp paths'. Those functions results are the |
| 7035 | same.*/ |
| 7036 | DEFUN (show_ip_bgp_paths, |
| 7037 | show_ip_bgp_paths_cmd, |
| 7038 | "show ip bgp paths", |
| 7039 | SHOW_STR |
| 7040 | IP_STR |
| 7041 | BGP_STR |
| 7042 | "Path information\n") |
| 7043 | { |
| 7044 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); |
| 7045 | aspath_print_all_vty (vty); |
| 7046 | return CMD_SUCCESS; |
| 7047 | } |
| 7048 | |
| 7049 | DEFUN (show_ip_bgp_ipv4_paths, |
| 7050 | show_ip_bgp_ipv4_paths_cmd, |
| 7051 | "show ip bgp ipv4 (unicast|multicast) paths", |
| 7052 | SHOW_STR |
| 7053 | IP_STR |
| 7054 | BGP_STR |
| 7055 | "Address family\n" |
| 7056 | "Address Family modifier\n" |
| 7057 | "Address Family modifier\n" |
| 7058 | "Path information\n") |
| 7059 | { |
| 7060 | vty_out (vty, "Address Refcnt Path\r\n"); |
| 7061 | aspath_print_all_vty (vty); |
| 7062 | |
| 7063 | return CMD_SUCCESS; |
| 7064 | } |
| 7065 | |
| 7066 | #include "hash.h" |
| 7067 | |
| 7068 | void |
| 7069 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
| 7070 | { |
| 7071 | struct community *com; |
| 7072 | |
| 7073 | com = (struct community *) backet->data; |
| 7074 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, |
| 7075 | community_str (com), VTY_NEWLINE); |
| 7076 | } |
| 7077 | |
| 7078 | /* Show BGP's community internal data. */ |
| 7079 | DEFUN (show_ip_bgp_community_info, |
| 7080 | show_ip_bgp_community_info_cmd, |
| 7081 | "show ip bgp community-info", |
| 7082 | SHOW_STR |
| 7083 | IP_STR |
| 7084 | BGP_STR |
| 7085 | "List all bgp community information\n") |
| 7086 | { |
| 7087 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); |
| 7088 | |
| 7089 | hash_iterate (community_hash (), |
| 7090 | (void (*) (struct hash_backet *, void *)) |
| 7091 | community_show_all_iterator, |
| 7092 | vty); |
| 7093 | |
| 7094 | return CMD_SUCCESS; |
| 7095 | } |
| 7096 | |
| 7097 | DEFUN (show_ip_bgp_attr_info, |
| 7098 | show_ip_bgp_attr_info_cmd, |
| 7099 | "show ip bgp attribute-info", |
| 7100 | SHOW_STR |
| 7101 | IP_STR |
| 7102 | BGP_STR |
| 7103 | "List all bgp attribute information\n") |
| 7104 | { |
| 7105 | attr_show_all (vty); |
| 7106 | return CMD_SUCCESS; |
| 7107 | } |
| 7108 | |
| 7109 | /* Redistribute VTY commands. */ |
| 7110 | |
| 7111 | /* Utility function to convert user input route type string to route |
| 7112 | type. */ |
| 7113 | static int |
| 7114 | bgp_str2route_type (int afi, char *str) |
| 7115 | { |
| 7116 | if (! str) |
| 7117 | return 0; |
| 7118 | |
| 7119 | if (afi == AFI_IP) |
| 7120 | { |
| 7121 | if (strncmp (str, "k", 1) == 0) |
| 7122 | return ZEBRA_ROUTE_KERNEL; |
| 7123 | else if (strncmp (str, "c", 1) == 0) |
| 7124 | return ZEBRA_ROUTE_CONNECT; |
| 7125 | else if (strncmp (str, "s", 1) == 0) |
| 7126 | return ZEBRA_ROUTE_STATIC; |
| 7127 | else if (strncmp (str, "r", 1) == 0) |
| 7128 | return ZEBRA_ROUTE_RIP; |
| 7129 | else if (strncmp (str, "o", 1) == 0) |
| 7130 | return ZEBRA_ROUTE_OSPF; |
| 7131 | } |
| 7132 | if (afi == AFI_IP6) |
| 7133 | { |
| 7134 | if (strncmp (str, "k", 1) == 0) |
| 7135 | return ZEBRA_ROUTE_KERNEL; |
| 7136 | else if (strncmp (str, "c", 1) == 0) |
| 7137 | return ZEBRA_ROUTE_CONNECT; |
| 7138 | else if (strncmp (str, "s", 1) == 0) |
| 7139 | return ZEBRA_ROUTE_STATIC; |
| 7140 | else if (strncmp (str, "r", 1) == 0) |
| 7141 | return ZEBRA_ROUTE_RIPNG; |
| 7142 | else if (strncmp (str, "o", 1) == 0) |
| 7143 | return ZEBRA_ROUTE_OSPF6; |
| 7144 | } |
| 7145 | return 0; |
| 7146 | } |
| 7147 | |
| 7148 | DEFUN (bgp_redistribute_ipv4, |
| 7149 | bgp_redistribute_ipv4_cmd, |
| 7150 | "redistribute (connected|kernel|ospf|rip|static)", |
| 7151 | "Redistribute information from another routing protocol\n" |
| 7152 | "Connected\n" |
| 7153 | "Kernel routes\n" |
| 7154 | "Open Shurtest Path First (OSPF)\n" |
| 7155 | "Routing Information Protocol (RIP)\n" |
| 7156 | "Static routes\n") |
| 7157 | { |
| 7158 | int type; |
| 7159 | |
| 7160 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 7161 | if (! type) |
| 7162 | { |
| 7163 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7164 | return CMD_WARNING; |
| 7165 | } |
| 7166 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 7167 | } |
| 7168 | |
| 7169 | DEFUN (bgp_redistribute_ipv4_rmap, |
| 7170 | bgp_redistribute_ipv4_rmap_cmd, |
| 7171 | "redistribute (connected|kernel|ospf|rip|static) route-map WORD", |
| 7172 | "Redistribute information from another routing protocol\n" |
| 7173 | "Connected\n" |
| 7174 | "Kernel routes\n" |
| 7175 | "Open Shurtest Path First (OSPF)\n" |
| 7176 | "Routing Information Protocol (RIP)\n" |
| 7177 | "Static routes\n" |
| 7178 | "Route map reference\n" |
| 7179 | "Pointer to route-map entries\n") |
| 7180 | { |
| 7181 | int type; |
| 7182 | |
| 7183 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 7184 | if (! type) |
| 7185 | { |
| 7186 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7187 | return CMD_WARNING; |
| 7188 | } |
| 7189 | |
| 7190 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 7191 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 7192 | } |
| 7193 | |
| 7194 | DEFUN (bgp_redistribute_ipv4_metric, |
| 7195 | bgp_redistribute_ipv4_metric_cmd, |
| 7196 | "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", |
| 7197 | "Redistribute information from another routing protocol\n" |
| 7198 | "Connected\n" |
| 7199 | "Kernel routes\n" |
| 7200 | "Open Shurtest Path First (OSPF)\n" |
| 7201 | "Routing Information Protocol (RIP)\n" |
| 7202 | "Static routes\n" |
| 7203 | "Metric for redistributed routes\n" |
| 7204 | "Default metric\n") |
| 7205 | { |
| 7206 | int type; |
| 7207 | u_int32_t metric; |
| 7208 | |
| 7209 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 7210 | if (! type) |
| 7211 | { |
| 7212 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7213 | return CMD_WARNING; |
| 7214 | } |
| 7215 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 7216 | |
| 7217 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 7218 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 7219 | } |
| 7220 | |
| 7221 | DEFUN (bgp_redistribute_ipv4_rmap_metric, |
| 7222 | bgp_redistribute_ipv4_rmap_metric_cmd, |
| 7223 | "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", |
| 7224 | "Redistribute information from another routing protocol\n" |
| 7225 | "Connected\n" |
| 7226 | "Kernel routes\n" |
| 7227 | "Open Shurtest Path First (OSPF)\n" |
| 7228 | "Routing Information Protocol (RIP)\n" |
| 7229 | "Static routes\n" |
| 7230 | "Route map reference\n" |
| 7231 | "Pointer to route-map entries\n" |
| 7232 | "Metric for redistributed routes\n" |
| 7233 | "Default metric\n") |
| 7234 | { |
| 7235 | int type; |
| 7236 | u_int32_t metric; |
| 7237 | |
| 7238 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 7239 | if (! type) |
| 7240 | { |
| 7241 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7242 | return CMD_WARNING; |
| 7243 | } |
| 7244 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 7245 | |
| 7246 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 7247 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 7248 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 7249 | } |
| 7250 | |
| 7251 | DEFUN (bgp_redistribute_ipv4_metric_rmap, |
| 7252 | bgp_redistribute_ipv4_metric_rmap_cmd, |
| 7253 | "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", |
| 7254 | "Redistribute information from another routing protocol\n" |
| 7255 | "Connected\n" |
| 7256 | "Kernel routes\n" |
| 7257 | "Open Shurtest Path First (OSPF)\n" |
| 7258 | "Routing Information Protocol (RIP)\n" |
| 7259 | "Static routes\n" |
| 7260 | "Metric for redistributed routes\n" |
| 7261 | "Default metric\n" |
| 7262 | "Route map reference\n" |
| 7263 | "Pointer to route-map entries\n") |
| 7264 | { |
| 7265 | int type; |
| 7266 | u_int32_t metric; |
| 7267 | |
| 7268 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 7269 | if (! type) |
| 7270 | { |
| 7271 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7272 | return CMD_WARNING; |
| 7273 | } |
| 7274 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 7275 | |
| 7276 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 7277 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); |
| 7278 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 7279 | } |
| 7280 | |
| 7281 | DEFUN (no_bgp_redistribute_ipv4, |
| 7282 | no_bgp_redistribute_ipv4_cmd, |
| 7283 | "no redistribute (connected|kernel|ospf|rip|static)", |
| 7284 | NO_STR |
| 7285 | "Redistribute information from another routing protocol\n" |
| 7286 | "Connected\n" |
| 7287 | "Kernel routes\n" |
| 7288 | "Open Shurtest Path First (OSPF)\n" |
| 7289 | "Routing Information Protocol (RIP)\n" |
| 7290 | "Static routes\n") |
| 7291 | { |
| 7292 | int type; |
| 7293 | |
| 7294 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 7295 | if (! type) |
| 7296 | { |
| 7297 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7298 | return CMD_WARNING; |
| 7299 | } |
| 7300 | |
| 7301 | return bgp_redistribute_unset (vty->index, AFI_IP, type); |
| 7302 | } |
| 7303 | |
| 7304 | DEFUN (no_bgp_redistribute_ipv4_rmap, |
| 7305 | no_bgp_redistribute_ipv4_rmap_cmd, |
| 7306 | "no redistribute (connected|kernel|ospf|rip|static) route-map WORD", |
| 7307 | NO_STR |
| 7308 | "Redistribute information from another routing protocol\n" |
| 7309 | "Connected\n" |
| 7310 | "Kernel routes\n" |
| 7311 | "Open Shurtest Path First (OSPF)\n" |
| 7312 | "Routing Information Protocol (RIP)\n" |
| 7313 | "Static routes\n" |
| 7314 | "Route map reference\n" |
| 7315 | "Pointer to route-map entries\n") |
| 7316 | { |
| 7317 | int type; |
| 7318 | |
| 7319 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 7320 | if (! type) |
| 7321 | { |
| 7322 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7323 | return CMD_WARNING; |
| 7324 | } |
| 7325 | |
| 7326 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 7327 | return CMD_SUCCESS; |
| 7328 | } |
| 7329 | |
| 7330 | DEFUN (no_bgp_redistribute_ipv4_metric, |
| 7331 | no_bgp_redistribute_ipv4_metric_cmd, |
| 7332 | "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", |
| 7333 | NO_STR |
| 7334 | "Redistribute information from another routing protocol\n" |
| 7335 | "Connected\n" |
| 7336 | "Kernel routes\n" |
| 7337 | "Open Shurtest Path First (OSPF)\n" |
| 7338 | "Routing Information Protocol (RIP)\n" |
| 7339 | "Static routes\n" |
| 7340 | "Metric for redistributed routes\n" |
| 7341 | "Default metric\n") |
| 7342 | { |
| 7343 | int type; |
| 7344 | |
| 7345 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 7346 | if (! type) |
| 7347 | { |
| 7348 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7349 | return CMD_WARNING; |
| 7350 | } |
| 7351 | |
| 7352 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 7353 | return CMD_SUCCESS; |
| 7354 | } |
| 7355 | |
| 7356 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, |
| 7357 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
| 7358 | "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", |
| 7359 | NO_STR |
| 7360 | "Redistribute information from another routing protocol\n" |
| 7361 | "Connected\n" |
| 7362 | "Kernel routes\n" |
| 7363 | "Open Shurtest Path First (OSPF)\n" |
| 7364 | "Routing Information Protocol (RIP)\n" |
| 7365 | "Static routes\n" |
| 7366 | "Route map reference\n" |
| 7367 | "Pointer to route-map entries\n" |
| 7368 | "Metric for redistributed routes\n" |
| 7369 | "Default metric\n") |
| 7370 | { |
| 7371 | int type; |
| 7372 | |
| 7373 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 7374 | if (! type) |
| 7375 | { |
| 7376 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7377 | return CMD_WARNING; |
| 7378 | } |
| 7379 | |
| 7380 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 7381 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 7382 | return CMD_SUCCESS; |
| 7383 | } |
| 7384 | |
| 7385 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, |
| 7386 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
| 7387 | "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", |
| 7388 | NO_STR |
| 7389 | "Redistribute information from another routing protocol\n" |
| 7390 | "Connected\n" |
| 7391 | "Kernel routes\n" |
| 7392 | "Open Shurtest Path First (OSPF)\n" |
| 7393 | "Routing Information Protocol (RIP)\n" |
| 7394 | "Static routes\n" |
| 7395 | "Metric for redistributed routes\n" |
| 7396 | "Default metric\n" |
| 7397 | "Route map reference\n" |
| 7398 | "Pointer to route-map entries\n") |
| 7399 | |
| 7400 | #ifdef HAVE_IPV6 |
| 7401 | DEFUN (bgp_redistribute_ipv6, |
| 7402 | bgp_redistribute_ipv6_cmd, |
| 7403 | "redistribute (connected|kernel|ospf6|ripng|static)", |
| 7404 | "Redistribute information from another routing protocol\n" |
| 7405 | "Connected\n" |
| 7406 | "Kernel routes\n" |
| 7407 | "Open Shurtest Path First (OSPFv3)\n" |
| 7408 | "Routing Information Protocol (RIPng)\n" |
| 7409 | "Static routes\n") |
| 7410 | { |
| 7411 | int type; |
| 7412 | |
| 7413 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 7414 | if (! type) |
| 7415 | { |
| 7416 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7417 | return CMD_WARNING; |
| 7418 | } |
| 7419 | |
| 7420 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 7421 | } |
| 7422 | |
| 7423 | DEFUN (bgp_redistribute_ipv6_rmap, |
| 7424 | bgp_redistribute_ipv6_rmap_cmd, |
| 7425 | "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", |
| 7426 | "Redistribute information from another routing protocol\n" |
| 7427 | "Connected\n" |
| 7428 | "Kernel routes\n" |
| 7429 | "Open Shurtest Path First (OSPFv3)\n" |
| 7430 | "Routing Information Protocol (RIPng)\n" |
| 7431 | "Static routes\n" |
| 7432 | "Route map reference\n" |
| 7433 | "Pointer to route-map entries\n") |
| 7434 | { |
| 7435 | int type; |
| 7436 | |
| 7437 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 7438 | if (! type) |
| 7439 | { |
| 7440 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7441 | return CMD_WARNING; |
| 7442 | } |
| 7443 | |
| 7444 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 7445 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 7446 | } |
| 7447 | |
| 7448 | DEFUN (bgp_redistribute_ipv6_metric, |
| 7449 | bgp_redistribute_ipv6_metric_cmd, |
| 7450 | "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", |
| 7451 | "Redistribute information from another routing protocol\n" |
| 7452 | "Connected\n" |
| 7453 | "Kernel routes\n" |
| 7454 | "Open Shurtest Path First (OSPFv3)\n" |
| 7455 | "Routing Information Protocol (RIPng)\n" |
| 7456 | "Static routes\n" |
| 7457 | "Metric for redistributed routes\n" |
| 7458 | "Default metric\n") |
| 7459 | { |
| 7460 | int type; |
| 7461 | u_int32_t metric; |
| 7462 | |
| 7463 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 7464 | if (! type) |
| 7465 | { |
| 7466 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7467 | return CMD_WARNING; |
| 7468 | } |
| 7469 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 7470 | |
| 7471 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 7472 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 7473 | } |
| 7474 | |
| 7475 | DEFUN (bgp_redistribute_ipv6_rmap_metric, |
| 7476 | bgp_redistribute_ipv6_rmap_metric_cmd, |
| 7477 | "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", |
| 7478 | "Redistribute information from another routing protocol\n" |
| 7479 | "Connected\n" |
| 7480 | "Kernel routes\n" |
| 7481 | "Open Shurtest Path First (OSPFv3)\n" |
| 7482 | "Routing Information Protocol (RIPng)\n" |
| 7483 | "Static routes\n" |
| 7484 | "Route map reference\n" |
| 7485 | "Pointer to route-map entries\n" |
| 7486 | "Metric for redistributed routes\n" |
| 7487 | "Default metric\n") |
| 7488 | { |
| 7489 | int type; |
| 7490 | u_int32_t metric; |
| 7491 | |
| 7492 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 7493 | if (! type) |
| 7494 | { |
| 7495 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7496 | return CMD_WARNING; |
| 7497 | } |
| 7498 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 7499 | |
| 7500 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 7501 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 7502 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 7503 | } |
| 7504 | |
| 7505 | DEFUN (bgp_redistribute_ipv6_metric_rmap, |
| 7506 | bgp_redistribute_ipv6_metric_rmap_cmd, |
| 7507 | "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", |
| 7508 | "Redistribute information from another routing protocol\n" |
| 7509 | "Connected\n" |
| 7510 | "Kernel routes\n" |
| 7511 | "Open Shurtest Path First (OSPFv3)\n" |
| 7512 | "Routing Information Protocol (RIPng)\n" |
| 7513 | "Static routes\n" |
| 7514 | "Metric for redistributed routes\n" |
| 7515 | "Default metric\n" |
| 7516 | "Route map reference\n" |
| 7517 | "Pointer to route-map entries\n") |
| 7518 | { |
| 7519 | int type; |
| 7520 | u_int32_t metric; |
| 7521 | |
| 7522 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 7523 | if (! type) |
| 7524 | { |
| 7525 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7526 | return CMD_WARNING; |
| 7527 | } |
| 7528 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 7529 | |
| 7530 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 7531 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); |
| 7532 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 7533 | } |
| 7534 | |
| 7535 | DEFUN (no_bgp_redistribute_ipv6, |
| 7536 | no_bgp_redistribute_ipv6_cmd, |
| 7537 | "no redistribute (connected|kernel|ospf6|ripng|static)", |
| 7538 | NO_STR |
| 7539 | "Redistribute information from another routing protocol\n" |
| 7540 | "Connected\n" |
| 7541 | "Kernel routes\n" |
| 7542 | "Open Shurtest Path First (OSPFv3)\n" |
| 7543 | "Routing Information Protocol (RIPng)\n" |
| 7544 | "Static routes\n") |
| 7545 | { |
| 7546 | int type; |
| 7547 | |
| 7548 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 7549 | if (! type) |
| 7550 | { |
| 7551 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7552 | return CMD_WARNING; |
| 7553 | } |
| 7554 | |
| 7555 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); |
| 7556 | } |
| 7557 | |
| 7558 | DEFUN (no_bgp_redistribute_ipv6_rmap, |
| 7559 | no_bgp_redistribute_ipv6_rmap_cmd, |
| 7560 | "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", |
| 7561 | NO_STR |
| 7562 | "Redistribute information from another routing protocol\n" |
| 7563 | "Connected\n" |
| 7564 | "Kernel routes\n" |
| 7565 | "Open Shurtest Path First (OSPFv3)\n" |
| 7566 | "Routing Information Protocol (RIPng)\n" |
| 7567 | "Static routes\n" |
| 7568 | "Route map reference\n" |
| 7569 | "Pointer to route-map entries\n") |
| 7570 | { |
| 7571 | int type; |
| 7572 | |
| 7573 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 7574 | if (! type) |
| 7575 | { |
| 7576 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7577 | return CMD_WARNING; |
| 7578 | } |
| 7579 | |
| 7580 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 7581 | return CMD_SUCCESS; |
| 7582 | } |
| 7583 | |
| 7584 | DEFUN (no_bgp_redistribute_ipv6_metric, |
| 7585 | no_bgp_redistribute_ipv6_metric_cmd, |
| 7586 | "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", |
| 7587 | NO_STR |
| 7588 | "Redistribute information from another routing protocol\n" |
| 7589 | "Connected\n" |
| 7590 | "Kernel routes\n" |
| 7591 | "Open Shurtest Path First (OSPFv3)\n" |
| 7592 | "Routing Information Protocol (RIPng)\n" |
| 7593 | "Static routes\n" |
| 7594 | "Metric for redistributed routes\n" |
| 7595 | "Default metric\n") |
| 7596 | { |
| 7597 | int type; |
| 7598 | |
| 7599 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 7600 | if (! type) |
| 7601 | { |
| 7602 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7603 | return CMD_WARNING; |
| 7604 | } |
| 7605 | |
| 7606 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 7607 | return CMD_SUCCESS; |
| 7608 | } |
| 7609 | |
| 7610 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, |
| 7611 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
| 7612 | "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", |
| 7613 | NO_STR |
| 7614 | "Redistribute information from another routing protocol\n" |
| 7615 | "Connected\n" |
| 7616 | "Kernel routes\n" |
| 7617 | "Open Shurtest Path First (OSPFv3)\n" |
| 7618 | "Routing Information Protocol (RIPng)\n" |
| 7619 | "Static routes\n" |
| 7620 | "Route map reference\n" |
| 7621 | "Pointer to route-map entries\n" |
| 7622 | "Metric for redistributed routes\n" |
| 7623 | "Default metric\n") |
| 7624 | { |
| 7625 | int type; |
| 7626 | |
| 7627 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 7628 | if (! type) |
| 7629 | { |
| 7630 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 7631 | return CMD_WARNING; |
| 7632 | } |
| 7633 | |
| 7634 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 7635 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 7636 | return CMD_SUCCESS; |
| 7637 | } |
| 7638 | |
| 7639 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, |
| 7640 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
| 7641 | "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", |
| 7642 | NO_STR |
| 7643 | "Redistribute information from another routing protocol\n" |
| 7644 | "Connected\n" |
| 7645 | "Kernel routes\n" |
| 7646 | "Open Shurtest Path First (OSPFv3)\n" |
| 7647 | "Routing Information Protocol (RIPng)\n" |
| 7648 | "Static routes\n" |
| 7649 | "Metric for redistributed routes\n" |
| 7650 | "Default metric\n" |
| 7651 | "Route map reference\n" |
| 7652 | "Pointer to route-map entries\n") |
| 7653 | #endif /* HAVE_IPV6 */ |
| 7654 | |
| 7655 | int |
| 7656 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 7657 | safi_t safi, int *write) |
| 7658 | { |
| 7659 | int i; |
| 7660 | char *str[] = { "system", "kernel", "connected", "static", "rip", |
| 7661 | "ripng", "ospf", "ospf6", "bgp"}; |
| 7662 | |
| 7663 | /* Unicast redistribution only. */ |
| 7664 | if (safi != SAFI_UNICAST) |
| 7665 | return 0; |
| 7666 | |
| 7667 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 7668 | { |
| 7669 | /* Redistribute BGP does not make sense. */ |
| 7670 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) |
| 7671 | { |
| 7672 | /* Display "address-family" when it is not yet diplayed. */ |
| 7673 | bgp_config_write_family_header (vty, afi, safi, write); |
| 7674 | |
| 7675 | /* "redistribute" configuration. */ |
| 7676 | vty_out (vty, " redistribute %s", str[i]); |
| 7677 | |
| 7678 | if (bgp->redist_metric_flag[afi][i]) |
| 7679 | vty_out (vty, " metric %d", bgp->redist_metric[afi][i]); |
| 7680 | |
| 7681 | if (bgp->rmap[afi][i].name) |
| 7682 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); |
| 7683 | |
| 7684 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7685 | } |
| 7686 | } |
| 7687 | return *write; |
| 7688 | } |
| 7689 | |
| 7690 | /* BGP node structure. */ |
| 7691 | struct cmd_node bgp_node = |
| 7692 | { |
| 7693 | BGP_NODE, |
| 7694 | "%s(config-router)# ", |
| 7695 | 1, |
| 7696 | }; |
| 7697 | |
| 7698 | struct cmd_node bgp_ipv4_unicast_node = |
| 7699 | { |
| 7700 | BGP_IPV4_NODE, |
| 7701 | "%s(config-router-af)# ", |
| 7702 | 1, |
| 7703 | }; |
| 7704 | |
| 7705 | struct cmd_node bgp_ipv4_multicast_node = |
| 7706 | { |
| 7707 | BGP_IPV4M_NODE, |
| 7708 | "%s(config-router-af)# ", |
| 7709 | 1, |
| 7710 | }; |
| 7711 | |
| 7712 | struct cmd_node bgp_ipv6_unicast_node = |
| 7713 | { |
| 7714 | BGP_IPV6_NODE, |
| 7715 | "%s(config-router-af)# ", |
| 7716 | 1, |
| 7717 | }; |
| 7718 | |
| 7719 | struct cmd_node bgp_vpnv4_node = |
| 7720 | { |
| 7721 | BGP_VPNV4_NODE, |
| 7722 | "%s(config-router-af)# ", |
| 7723 | 1 |
| 7724 | }; |
| 7725 | |
| 7726 | void |
| 7727 | bgp_vty_init () |
| 7728 | { |
| 7729 | int bgp_config_write (struct vty *); |
| 7730 | void community_list_vty (); |
| 7731 | |
| 7732 | /* Install bgp top node. */ |
| 7733 | install_node (&bgp_node, bgp_config_write); |
| 7734 | install_node (&bgp_ipv4_unicast_node, NULL); |
| 7735 | install_node (&bgp_ipv4_multicast_node, NULL); |
| 7736 | install_node (&bgp_ipv6_unicast_node, NULL); |
| 7737 | install_node (&bgp_vpnv4_node, NULL); |
| 7738 | |
| 7739 | /* Install default VTY commands to new nodes. */ |
| 7740 | install_default (BGP_NODE); |
| 7741 | install_default (BGP_IPV4_NODE); |
| 7742 | install_default (BGP_IPV4M_NODE); |
| 7743 | install_default (BGP_IPV6_NODE); |
| 7744 | install_default (BGP_VPNV4_NODE); |
| 7745 | |
| 7746 | /* "bgp multiple-instance" commands. */ |
| 7747 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); |
| 7748 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); |
| 7749 | |
| 7750 | /* "bgp config-type" commands. */ |
| 7751 | install_element (CONFIG_NODE, &bgp_config_type_cmd); |
| 7752 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); |
| 7753 | |
| 7754 | /* Dummy commands (Currently not supported) */ |
| 7755 | install_element (BGP_NODE, &no_synchronization_cmd); |
| 7756 | install_element (BGP_NODE, &no_auto_summary_cmd); |
| 7757 | |
| 7758 | /* "router bgp" commands. */ |
| 7759 | install_element (CONFIG_NODE, &router_bgp_cmd); |
| 7760 | install_element (CONFIG_NODE, &router_bgp_view_cmd); |
| 7761 | |
| 7762 | /* "no router bgp" commands. */ |
| 7763 | install_element (CONFIG_NODE, &no_router_bgp_cmd); |
| 7764 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); |
| 7765 | |
| 7766 | /* "bgp router-id" commands. */ |
| 7767 | install_element (BGP_NODE, &bgp_router_id_cmd); |
| 7768 | install_element (BGP_NODE, &no_bgp_router_id_cmd); |
| 7769 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); |
| 7770 | |
| 7771 | /* "bgp cluster-id" commands. */ |
| 7772 | install_element (BGP_NODE, &bgp_cluster_id_cmd); |
| 7773 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); |
| 7774 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); |
| 7775 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); |
| 7776 | |
| 7777 | /* "bgp confederation" commands. */ |
| 7778 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); |
| 7779 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); |
| 7780 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); |
| 7781 | |
| 7782 | /* "bgp confederation peers" commands. */ |
| 7783 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); |
| 7784 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); |
| 7785 | |
| 7786 | /* "timers bgp" commands. */ |
| 7787 | install_element (BGP_NODE, &bgp_timers_cmd); |
| 7788 | install_element (BGP_NODE, &no_bgp_timers_cmd); |
| 7789 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); |
| 7790 | |
| 7791 | /* "bgp client-to-client reflection" commands */ |
| 7792 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); |
| 7793 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); |
| 7794 | |
| 7795 | /* "bgp always-compare-med" commands */ |
| 7796 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); |
| 7797 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); |
| 7798 | |
| 7799 | /* "bgp deterministic-med" commands */ |
| 7800 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); |
| 7801 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); |
| 7802 | |
| 7803 | /* "bgp fast-external-failover" commands */ |
| 7804 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); |
| 7805 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); |
| 7806 | |
| 7807 | /* "bgp enforce-first-as" commands */ |
| 7808 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); |
| 7809 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); |
| 7810 | |
| 7811 | /* "bgp bestpath compare-routerid" commands */ |
| 7812 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); |
| 7813 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); |
| 7814 | |
| 7815 | /* "bgp bestpath as-path ignore" commands */ |
| 7816 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); |
| 7817 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); |
| 7818 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 7819 | /* "bgp log-neighbor-changes" commands */ |
| 7820 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); |
| 7821 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); |
| 7822 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7823 | /* "bgp bestpath med" commands */ |
| 7824 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); |
| 7825 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); |
| 7826 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); |
| 7827 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); |
| 7828 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); |
| 7829 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); |
| 7830 | |
| 7831 | /* "no bgp default ipv4-unicast" commands. */ |
| 7832 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); |
| 7833 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); |
| 7834 | |
| 7835 | /* "bgp network import-check" commands. */ |
| 7836 | install_element (BGP_NODE, &bgp_network_import_check_cmd); |
| 7837 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
| 7838 | |
| 7839 | /* "bgp default local-preference" commands. */ |
| 7840 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); |
| 7841 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); |
| 7842 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); |
| 7843 | |
| 7844 | /* "neighbor remote-as" commands. */ |
| 7845 | install_element (BGP_NODE, &neighbor_remote_as_cmd); |
| 7846 | install_element (BGP_NODE, &no_neighbor_cmd); |
| 7847 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); |
| 7848 | |
| 7849 | /* "neighbor peer-group" commands. */ |
| 7850 | install_element (BGP_NODE, &neighbor_peer_group_cmd); |
| 7851 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); |
| 7852 | install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd); |
| 7853 | |
| 7854 | /* "neighbor local-as" commands. */ |
| 7855 | install_element (BGP_NODE, &neighbor_local_as_cmd); |
| 7856 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); |
| 7857 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
| 7858 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); |
| 7859 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); |
| 7860 | |
| 7861 | /* "neighbor activate" commands. */ |
| 7862 | install_element (BGP_NODE, &neighbor_activate_cmd); |
| 7863 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); |
| 7864 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); |
| 7865 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); |
| 7866 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
| 7867 | |
| 7868 | /* "no neighbor activate" commands. */ |
| 7869 | install_element (BGP_NODE, &no_neighbor_activate_cmd); |
| 7870 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); |
| 7871 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); |
| 7872 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); |
| 7873 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
| 7874 | |
| 7875 | /* "neighbor peer-group set" commands. */ |
| 7876 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
| 7877 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); |
| 7878 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); |
| 7879 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 7880 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
| 7881 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7882 | /* "no neighbor peer-group unset" commands. */ |
| 7883 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); |
| 7884 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 7885 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); |
| 7886 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 7887 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 7888 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7889 | /* "neighbor softreconfiguration inbound" commands.*/ |
| 7890 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); |
| 7891 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 7892 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 7893 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 7894 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 7895 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 7896 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); |
| 7897 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 7898 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 7899 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7900 | |
| 7901 | /* "neighbor attribute-unchanged" commands. */ |
| 7902 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); |
| 7903 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); |
| 7904 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); |
| 7905 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); |
| 7906 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); |
| 7907 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); |
| 7908 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); |
| 7909 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); |
| 7910 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); |
| 7911 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); |
| 7912 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); |
| 7913 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); |
| 7914 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 7915 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 7916 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 7917 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 7918 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 7919 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 7920 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 7921 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 7922 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 7923 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 7924 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); |
| 7925 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 7926 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 7927 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 7928 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 7929 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 7930 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 7931 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 7932 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 7933 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 7934 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 7935 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 7936 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 7937 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 7938 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 7939 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 7940 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 7941 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 7942 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 7943 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 7944 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 7945 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 7946 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); |
| 7947 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); |
| 7948 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); |
| 7949 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); |
| 7950 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); |
| 7951 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); |
| 7952 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); |
| 7953 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); |
| 7954 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); |
| 7955 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); |
| 7956 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); |
| 7957 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 7958 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 7959 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 7960 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 7961 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 7962 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 7963 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 7964 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 7965 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 7966 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 7967 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 7968 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); |
| 7969 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); |
| 7970 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); |
| 7971 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); |
| 7972 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); |
| 7973 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); |
| 7974 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); |
| 7975 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); |
| 7976 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); |
| 7977 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); |
| 7978 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); |
| 7979 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); |
| 7980 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 7981 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 7982 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 7983 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 7984 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 7985 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 7986 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 7987 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 7988 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 7989 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 7990 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
| 7991 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 7992 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 7993 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 7994 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 7995 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 7996 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 7997 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 7998 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 7999 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 8000 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 8001 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8002 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8003 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8004 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8005 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8006 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8007 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8008 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8009 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8010 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8011 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 8012 | |
| 8013 | /* "transparent-as" and "transparent-nexthop" for old version |
| 8014 | compatibility. */ |
| 8015 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); |
| 8016 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); |
| 8017 | |
| 8018 | /* "neighbor next-hop-self" commands. */ |
| 8019 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); |
| 8020 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); |
| 8021 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); |
| 8022 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 8023 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); |
| 8024 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); |
| 8025 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); |
| 8026 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); |
| 8027 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
| 8028 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 8029 | |
| 8030 | /* "neighbor remove-private-AS" commands. */ |
| 8031 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); |
| 8032 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); |
| 8033 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
| 8034 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 8035 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
| 8036 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); |
| 8037 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
| 8038 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); |
| 8039 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
| 8040 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 8041 | |
| 8042 | /* "neighbor send-community" commands.*/ |
| 8043 | install_element (BGP_NODE, &neighbor_send_community_cmd); |
| 8044 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); |
| 8045 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); |
| 8046 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); |
| 8047 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); |
| 8048 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); |
| 8049 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); |
| 8050 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); |
| 8051 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); |
| 8052 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); |
| 8053 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); |
| 8054 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); |
| 8055 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); |
| 8056 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); |
| 8057 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); |
| 8058 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); |
| 8059 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
| 8060 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); |
| 8061 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); |
| 8062 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); |
| 8063 | |
| 8064 | /* "neighbor route-reflector" commands.*/ |
| 8065 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); |
| 8066 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8067 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); |
| 8068 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8069 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); |
| 8070 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8071 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); |
| 8072 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8073 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
| 8074 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8075 | |
| 8076 | /* "neighbor route-server" commands.*/ |
| 8077 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); |
| 8078 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); |
| 8079 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); |
| 8080 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); |
| 8081 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); |
| 8082 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); |
| 8083 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); |
| 8084 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); |
| 8085 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
| 8086 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); |
| 8087 | |
| 8088 | /* "neighbor passive" commands. */ |
| 8089 | install_element (BGP_NODE, &neighbor_passive_cmd); |
| 8090 | install_element (BGP_NODE, &no_neighbor_passive_cmd); |
| 8091 | |
| 8092 | /* "neighbor shutdown" commands. */ |
| 8093 | install_element (BGP_NODE, &neighbor_shutdown_cmd); |
| 8094 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); |
| 8095 | |
| 8096 | /* "neighbor capability route-refresh" commands.*/ |
| 8097 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
| 8098 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); |
| 8099 | |
| 8100 | /* "neighbor capability orf prefix-list" commands.*/ |
| 8101 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); |
| 8102 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 8103 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); |
| 8104 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 8105 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 8106 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 8107 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); |
| 8108 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 8109 | |
| 8110 | /* "neighbor capability dynamic" commands.*/ |
| 8111 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); |
| 8112 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); |
| 8113 | |
| 8114 | /* "neighbor dont-capability-negotiate" commands. */ |
| 8115 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); |
| 8116 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); |
| 8117 | |
| 8118 | /* "neighbor ebgp-multihop" commands. */ |
| 8119 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); |
| 8120 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); |
| 8121 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); |
| 8122 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); |
| 8123 | |
| 8124 | /* "neighbor enforce-multihop" commands. */ |
| 8125 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
| 8126 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); |
| 8127 | |
| 8128 | /* "neighbor description" commands. */ |
| 8129 | install_element (BGP_NODE, &neighbor_description_cmd); |
| 8130 | install_element (BGP_NODE, &no_neighbor_description_cmd); |
| 8131 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); |
| 8132 | |
| 8133 | /* "neighbor update-source" commands. "*/ |
| 8134 | install_element (BGP_NODE, &neighbor_update_source_cmd); |
| 8135 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); |
| 8136 | |
| 8137 | /* "neighbor default-originate" commands. */ |
| 8138 | install_element (BGP_NODE, &neighbor_default_originate_cmd); |
| 8139 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); |
| 8140 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); |
| 8141 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 8142 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); |
| 8143 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); |
| 8144 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); |
| 8145 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 8146 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); |
| 8147 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); |
| 8148 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); |
| 8149 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 8150 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); |
| 8151 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); |
| 8152 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); |
| 8153 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 8154 | |
| 8155 | /* "neighbor port" commands. */ |
| 8156 | install_element (BGP_NODE, &neighbor_port_cmd); |
| 8157 | install_element (BGP_NODE, &no_neighbor_port_cmd); |
| 8158 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); |
| 8159 | |
| 8160 | /* "neighbor weight" commands. */ |
| 8161 | install_element (BGP_NODE, &neighbor_weight_cmd); |
| 8162 | install_element (BGP_NODE, &no_neighbor_weight_cmd); |
| 8163 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); |
| 8164 | |
| 8165 | /* "neighbor override-capability" commands. */ |
| 8166 | install_element (BGP_NODE, &neighbor_override_capability_cmd); |
| 8167 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); |
| 8168 | |
| 8169 | /* "neighbor strict-capability-match" commands. */ |
| 8170 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); |
| 8171 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); |
| 8172 | |
| 8173 | /* "neighbor timers" commands. */ |
| 8174 | install_element (BGP_NODE, &neighbor_timers_cmd); |
| 8175 | install_element (BGP_NODE, &no_neighbor_timers_cmd); |
| 8176 | |
| 8177 | /* "neighbor timers connect" commands. */ |
| 8178 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); |
| 8179 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); |
| 8180 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); |
| 8181 | |
| 8182 | /* "neighbor advertisement-interval" commands. */ |
| 8183 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); |
| 8184 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); |
| 8185 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); |
| 8186 | |
| 8187 | /* "neighbor version" commands. */ |
| 8188 | install_element (BGP_NODE, &neighbor_version_cmd); |
| 8189 | install_element (BGP_NODE, &no_neighbor_version_cmd); |
| 8190 | |
| 8191 | /* "neighbor interface" commands. */ |
| 8192 | install_element (BGP_NODE, &neighbor_interface_cmd); |
| 8193 | install_element (BGP_NODE, &no_neighbor_interface_cmd); |
| 8194 | |
| 8195 | /* "neighbor distribute" commands. */ |
| 8196 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); |
| 8197 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); |
| 8198 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); |
| 8199 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); |
| 8200 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); |
| 8201 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); |
| 8202 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); |
| 8203 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); |
| 8204 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
| 8205 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); |
| 8206 | |
| 8207 | /* "neighbor prefix-list" commands. */ |
| 8208 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); |
| 8209 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); |
| 8210 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); |
| 8211 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); |
| 8212 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); |
| 8213 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); |
| 8214 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); |
| 8215 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); |
| 8216 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
| 8217 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); |
| 8218 | |
| 8219 | /* "neighbor filter-list" commands. */ |
| 8220 | install_element (BGP_NODE, &neighbor_filter_list_cmd); |
| 8221 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); |
| 8222 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); |
| 8223 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); |
| 8224 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); |
| 8225 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); |
| 8226 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); |
| 8227 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); |
| 8228 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
| 8229 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); |
| 8230 | |
| 8231 | /* "neighbor route-map" commands. */ |
| 8232 | install_element (BGP_NODE, &neighbor_route_map_cmd); |
| 8233 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); |
| 8234 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); |
| 8235 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); |
| 8236 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); |
| 8237 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); |
| 8238 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); |
| 8239 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); |
| 8240 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
| 8241 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); |
| 8242 | |
| 8243 | /* "neighbor unsuppress-map" commands. */ |
| 8244 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); |
| 8245 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); |
| 8246 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); |
| 8247 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); |
| 8248 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); |
| 8249 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); |
| 8250 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); |
| 8251 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 8252 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
| 8253 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8254 | |
| 8255 | /* "neighbor maximum-prefix" commands. */ |
| 8256 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); |
| 8257 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
| 8258 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
| 8259 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); |
| 8260 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val2_cmd); |
| 8261 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
| 8262 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
| 8263 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 8264 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
| 8265 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val2_cmd); |
| 8266 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
| 8267 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
| 8268 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 8269 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
| 8270 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val2_cmd); |
| 8271 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
| 8272 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
| 8273 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
| 8274 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); |
| 8275 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val2_cmd); |
| 8276 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
| 8277 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
| 8278 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 8279 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
| 8280 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val2_cmd); |
| 8281 | |
| 8282 | /* "neighbor allowas-in" */ |
| 8283 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); |
| 8284 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); |
| 8285 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); |
| 8286 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
| 8287 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 8288 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); |
| 8289 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
| 8290 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); |
| 8291 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); |
| 8292 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
| 8293 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); |
| 8294 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); |
| 8295 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
| 8296 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 8297 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); |
| 8298 | |
| 8299 | /* address-family commands. */ |
| 8300 | install_element (BGP_NODE, &address_family_ipv4_cmd); |
| 8301 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); |
| 8302 | #ifdef HAVE_IPV6 |
| 8303 | install_element (BGP_NODE, &address_family_ipv6_cmd); |
| 8304 | install_element (BGP_NODE, &address_family_ipv6_unicast_cmd); |
| 8305 | #endif /* HAVE_IPV6 */ |
| 8306 | install_element (BGP_NODE, &address_family_vpnv4_cmd); |
| 8307 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); |
| 8308 | |
| 8309 | /* "exit-address-family" command. */ |
| 8310 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); |
| 8311 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); |
| 8312 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); |
| 8313 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
| 8314 | |
| 8315 | /* "clear ip bgp commands" */ |
| 8316 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); |
| 8317 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); |
| 8318 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); |
| 8319 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
| 8320 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
| 8321 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
| 8322 | #ifdef HAVE_IPV6 |
| 8323 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
| 8324 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); |
| 8325 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); |
| 8326 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
| 8327 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
| 8328 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
| 8329 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
| 8330 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
| 8331 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
| 8332 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
| 8333 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
| 8334 | #endif /* HAVE_IPV6 */ |
| 8335 | |
| 8336 | /* "clear ip bgp neighbor soft in" */ |
| 8337 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); |
| 8338 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); |
| 8339 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); |
| 8340 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
| 8341 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); |
| 8342 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
| 8343 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
| 8344 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
| 8345 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); |
| 8346 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
| 8347 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
| 8348 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); |
| 8349 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
| 8350 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
| 8351 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); |
| 8352 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
| 8353 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
| 8354 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); |
| 8355 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); |
| 8356 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); |
| 8357 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
| 8358 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); |
| 8359 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
| 8360 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
| 8361 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
| 8362 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); |
| 8363 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
| 8364 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
| 8365 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); |
| 8366 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
| 8367 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
| 8368 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); |
| 8369 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
| 8370 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
| 8371 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); |
| 8372 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); |
| 8373 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); |
| 8374 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); |
| 8375 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); |
| 8376 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); |
| 8377 | #ifdef HAVE_IPV6 |
| 8378 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
| 8379 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); |
| 8380 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); |
| 8381 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
| 8382 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); |
| 8383 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
| 8384 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
| 8385 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); |
| 8386 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
| 8387 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
| 8388 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); |
| 8389 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
| 8390 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
| 8391 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); |
| 8392 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
| 8393 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
| 8394 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); |
| 8395 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
| 8396 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
| 8397 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); |
| 8398 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
| 8399 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
| 8400 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); |
| 8401 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
| 8402 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
| 8403 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); |
| 8404 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
| 8405 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
| 8406 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); |
| 8407 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
| 8408 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
| 8409 | #endif /* HAVE_IPV6 */ |
| 8410 | |
| 8411 | /* "clear ip bgp neighbor soft out" */ |
| 8412 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); |
| 8413 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); |
| 8414 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); |
| 8415 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
| 8416 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
| 8417 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
| 8418 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
| 8419 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
| 8420 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
| 8421 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
| 8422 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
| 8423 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
| 8424 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); |
| 8425 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); |
| 8426 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
| 8427 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
| 8428 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
| 8429 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
| 8430 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
| 8431 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
| 8432 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
| 8433 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
| 8434 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
| 8435 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); |
| 8436 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); |
| 8437 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); |
| 8438 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); |
| 8439 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); |
| 8440 | #ifdef HAVE_IPV6 |
| 8441 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
| 8442 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); |
| 8443 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); |
| 8444 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
| 8445 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
| 8446 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
| 8447 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
| 8448 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
| 8449 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
| 8450 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
| 8451 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
| 8452 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
| 8453 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
| 8454 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
| 8455 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
| 8456 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
| 8457 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
| 8458 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
| 8459 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
| 8460 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
| 8461 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
| 8462 | #endif /* HAVE_IPV6 */ |
| 8463 | |
| 8464 | /* "clear ip bgp neighbor soft" */ |
| 8465 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); |
| 8466 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); |
| 8467 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); |
| 8468 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
| 8469 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
| 8470 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
| 8471 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
| 8472 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); |
| 8473 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); |
| 8474 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
| 8475 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
| 8476 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
| 8477 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
| 8478 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); |
| 8479 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); |
| 8480 | #ifdef HAVE_IPV6 |
| 8481 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
| 8482 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); |
| 8483 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); |
| 8484 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
| 8485 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
| 8486 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
| 8487 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
| 8488 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
| 8489 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
| 8490 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
| 8491 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
| 8492 | #endif /* HAVE_IPV6 */ |
| 8493 | |
| 8494 | /* "show ip bgp summary" commands. */ |
| 8495 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); |
| 8496 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
| 8497 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
| 8498 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
| 8499 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 8500 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 8501 | #ifdef HAVE_IPV6 |
| 8502 | install_element (VIEW_NODE, &show_bgp_summary_cmd); |
| 8503 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); |
| 8504 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
| 8505 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
| 8506 | #endif /* HAVE_IPV6 */ |
| 8507 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); |
| 8508 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
| 8509 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
| 8510 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
| 8511 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 8512 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 8513 | #ifdef HAVE_IPV6 |
| 8514 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); |
| 8515 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); |
| 8516 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
| 8517 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
| 8518 | #endif /* HAVE_IPV6 */ |
| 8519 | |
| 8520 | /* "show ip bgp neighbors" commands. */ |
| 8521 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); |
| 8522 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 8523 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 8524 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 8525 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 8526 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 8527 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 8528 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 8529 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 8530 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 8531 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
| 8532 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 8533 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 8534 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 8535 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 8536 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 8537 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 8538 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 8539 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 8540 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 8541 | |
| 8542 | #ifdef HAVE_IPV6 |
| 8543 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); |
| 8544 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 8545 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); |
| 8546 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 8547 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
| 8548 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 8549 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 8550 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8551 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
| 8552 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 8553 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); |
| 8554 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 8555 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
| 8556 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 8557 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 8558 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8559 | |
| 8560 | /* Old commands. */ |
| 8561 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); |
| 8562 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); |
| 8563 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); |
| 8564 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); |
| 8565 | #endif /* HAVE_IPV6 */ |
| 8566 | |
| 8567 | /* "show ip bgp paths" commands. */ |
| 8568 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); |
| 8569 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 8570 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); |
| 8571 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 8572 | |
| 8573 | /* "show ip bgp community" commands. */ |
| 8574 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); |
| 8575 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); |
| 8576 | |
| 8577 | /* "show ip bgp attribute-info" commands. */ |
| 8578 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); |
| 8579 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); |
| 8580 | |
| 8581 | /* "redistribute" commands. */ |
| 8582 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); |
| 8583 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); |
| 8584 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); |
| 8585 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); |
| 8586 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); |
| 8587 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); |
| 8588 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); |
| 8589 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); |
| 8590 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); |
| 8591 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); |
| 8592 | #ifdef HAVE_IPV6 |
| 8593 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); |
| 8594 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); |
| 8595 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); |
| 8596 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); |
| 8597 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); |
| 8598 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); |
| 8599 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); |
| 8600 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); |
| 8601 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); |
| 8602 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); |
| 8603 | #endif /* HAVE_IPV6 */ |
| 8604 | |
| 8605 | /* Community-list. */ |
| 8606 | community_list_vty (); |
| 8607 | } |
| 8608 | |
| 8609 | #include "memory.h" |
| 8610 | #include "bgp_regex.h" |
| 8611 | #include "bgp_clist.h" |
| 8612 | #include "bgp_ecommunity.h" |
| 8613 | |
| 8614 | /* VTY functions. */ |
| 8615 | |
| 8616 | /* Direction value to string conversion. */ |
| 8617 | char * |
| 8618 | community_direct_str (int direct) |
| 8619 | { |
| 8620 | switch (direct) |
| 8621 | { |
| 8622 | case COMMUNITY_DENY: |
| 8623 | return "deny"; |
| 8624 | break; |
| 8625 | case COMMUNITY_PERMIT: |
| 8626 | return "permit"; |
| 8627 | break; |
| 8628 | default: |
| 8629 | return "unknown"; |
| 8630 | break; |
| 8631 | } |
| 8632 | } |
| 8633 | |
| 8634 | /* Display error string. */ |
| 8635 | void |
| 8636 | community_list_perror (struct vty *vty, int ret) |
| 8637 | { |
| 8638 | switch (ret) |
| 8639 | { |
| 8640 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: |
| 8641 | vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE); |
| 8642 | break; |
| 8643 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: |
| 8644 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); |
| 8645 | break; |
| 8646 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: |
| 8647 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); |
| 8648 | break; |
| 8649 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: |
| 8650 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); |
| 8651 | break; |
| 8652 | } |
| 8653 | } |
| 8654 | |
| 8655 | /* VTY interface for community_set() function. */ |
| 8656 | int |
| 8657 | community_list_set_vty (struct vty *vty, int argc, char **argv, int style, |
| 8658 | int reject_all_digit_name) |
| 8659 | { |
| 8660 | int ret; |
| 8661 | int direct; |
| 8662 | char *str; |
| 8663 | |
| 8664 | /* Check the list type. */ |
| 8665 | if (strncmp (argv[1], "p", 1) == 0) |
| 8666 | direct = COMMUNITY_PERMIT; |
| 8667 | else if (strncmp (argv[1], "d", 1) == 0) |
| 8668 | direct = COMMUNITY_DENY; |
| 8669 | else |
| 8670 | { |
| 8671 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 8672 | VTY_NEWLINE); |
| 8673 | return CMD_WARNING; |
| 8674 | } |
| 8675 | |
| 8676 | /* All digit name check. */ |
| 8677 | if (reject_all_digit_name && all_digit (argv[0])) |
| 8678 | { |
| 8679 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 8680 | return CMD_WARNING; |
| 8681 | } |
| 8682 | |
| 8683 | /* Concat community string argument. */ |
| 8684 | if (argc > 1) |
| 8685 | str = argv_concat (argv, argc, 2); |
| 8686 | else |
| 8687 | str = NULL; |
| 8688 | |
| 8689 | /* When community_list_set() return nevetive value, it means |
| 8690 | malformed community string. */ |
| 8691 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); |
| 8692 | |
| 8693 | /* Free temporary community list string allocated by |
| 8694 | argv_concat(). */ |
| 8695 | if (str) |
| 8696 | XFREE (MTYPE_TMP, str); |
| 8697 | |
| 8698 | if (ret < 0) |
| 8699 | { |
| 8700 | /* Display error string. */ |
| 8701 | community_list_perror (vty, ret); |
| 8702 | return CMD_WARNING; |
| 8703 | } |
| 8704 | |
| 8705 | return CMD_SUCCESS; |
| 8706 | } |
| 8707 | |
| 8708 | /* Community-list delete with name. */ |
| 8709 | int |
| 8710 | community_list_unset_all_vty (struct vty *vty, char *name) |
| 8711 | { |
| 8712 | int ret; |
| 8713 | |
| 8714 | ret = community_list_unset (bgp_clist, name, NULL, 0, COMMUNITY_LIST_AUTO); |
| 8715 | |
| 8716 | if (ret < 0) |
| 8717 | { |
| 8718 | community_list_perror (vty, ret); |
| 8719 | return CMD_WARNING; |
| 8720 | } |
| 8721 | return CMD_SUCCESS; |
| 8722 | } |
| 8723 | |
| 8724 | /* Communiyt-list entry delete. */ |
| 8725 | int |
| 8726 | community_list_unset_vty (struct vty *vty, int argc, char **argv, int style) |
| 8727 | { |
| 8728 | int ret; |
| 8729 | int direct; |
| 8730 | char *str; |
| 8731 | |
| 8732 | /* Check the list direct. */ |
| 8733 | if (strncmp (argv[1], "p", 1) == 0) |
| 8734 | direct = COMMUNITY_PERMIT; |
| 8735 | else if (strncmp (argv[1], "d", 1) == 0) |
| 8736 | direct = COMMUNITY_DENY; |
| 8737 | else |
| 8738 | { |
| 8739 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 8740 | VTY_NEWLINE); |
| 8741 | return CMD_WARNING; |
| 8742 | } |
| 8743 | |
| 8744 | /* Concat community string argument. */ |
| 8745 | str = argv_concat (argv, argc, 2); |
| 8746 | |
| 8747 | /* Unset community list. */ |
| 8748 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); |
| 8749 | |
| 8750 | /* Free temporary community list string allocated by |
| 8751 | argv_concat(). */ |
| 8752 | XFREE (MTYPE_TMP, str); |
| 8753 | |
| 8754 | if (ret < 0) |
| 8755 | { |
| 8756 | community_list_perror (vty, ret); |
| 8757 | return CMD_WARNING; |
| 8758 | } |
| 8759 | |
| 8760 | return CMD_SUCCESS; |
| 8761 | } |
| 8762 | |
| 8763 | /* "community-list" keyword help string. */ |
| 8764 | #define COMMUNITY_LIST_STR "Add a community list entry\n" |
| 8765 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" |
| 8766 | |
| 8767 | DEFUN (ip_community_list, |
| 8768 | ip_community_list_cmd, |
| 8769 | "ip community-list WORD (deny|permit) .AA:NN", |
| 8770 | IP_STR |
| 8771 | COMMUNITY_LIST_STR |
| 8772 | "Community list name\n" |
| 8773 | "Specify community to reject\n" |
| 8774 | "Specify community to accept\n" |
| 8775 | COMMUNITY_VAL_STR) |
| 8776 | { |
| 8777 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_AUTO, 1); |
| 8778 | } |
| 8779 | |
| 8780 | DEFUN (ip_community_list_standard, |
| 8781 | ip_community_list_standard_cmd, |
| 8782 | "ip community-list <1-99> (deny|permit) .AA:NN", |
| 8783 | IP_STR |
| 8784 | COMMUNITY_LIST_STR |
| 8785 | "Community list number (standard)\n" |
| 8786 | "Specify community to reject\n" |
| 8787 | "Specify community to accept\n" |
| 8788 | COMMUNITY_VAL_STR) |
| 8789 | { |
| 8790 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
| 8791 | } |
| 8792 | |
| 8793 | ALIAS (ip_community_list_standard, |
| 8794 | ip_community_list_standard2_cmd, |
| 8795 | "ip community-list <1-99> (deny|permit)", |
| 8796 | IP_STR |
| 8797 | COMMUNITY_LIST_STR |
| 8798 | "Community list number (standard)\n" |
| 8799 | "Specify community to reject\n" |
| 8800 | "Specify community to accept\n") |
| 8801 | |
| 8802 | DEFUN (ip_community_list_expanded, |
| 8803 | ip_community_list_expanded_cmd, |
| 8804 | "ip community-list <100-199> (deny|permit) .LINE", |
| 8805 | IP_STR |
| 8806 | COMMUNITY_LIST_STR |
| 8807 | "Community list number (expanded)\n" |
| 8808 | "Specify community to reject\n" |
| 8809 | "Specify community to accept\n" |
| 8810 | "An ordered list as a regular-expression\n") |
| 8811 | { |
| 8812 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
| 8813 | } |
| 8814 | |
| 8815 | DEFUN (ip_community_list_name_standard, |
| 8816 | ip_community_list_name_standard_cmd, |
| 8817 | "ip community-list standard WORD (deny|permit) .AA:NN", |
| 8818 | IP_STR |
| 8819 | COMMUNITY_LIST_STR |
| 8820 | "Add a standard community-list entry\n" |
| 8821 | "Community list name\n" |
| 8822 | "Specify community to reject\n" |
| 8823 | "Specify community to accept\n" |
| 8824 | COMMUNITY_VAL_STR) |
| 8825 | { |
| 8826 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
| 8827 | } |
| 8828 | |
| 8829 | ALIAS (ip_community_list_name_standard, |
| 8830 | ip_community_list_name_standard2_cmd, |
| 8831 | "ip community-list standard WORD (deny|permit)", |
| 8832 | IP_STR |
| 8833 | COMMUNITY_LIST_STR |
| 8834 | "Add a standard community-list entry\n" |
| 8835 | "Community list name\n" |
| 8836 | "Specify community to reject\n" |
| 8837 | "Specify community to accept\n") |
| 8838 | |
| 8839 | DEFUN (ip_community_list_name_expanded, |
| 8840 | ip_community_list_name_expanded_cmd, |
| 8841 | "ip community-list expanded WORD (deny|permit) .LINE", |
| 8842 | IP_STR |
| 8843 | COMMUNITY_LIST_STR |
| 8844 | "Add an expanded community-list entry\n" |
| 8845 | "Community list name\n" |
| 8846 | "Specify community to reject\n" |
| 8847 | "Specify community to accept\n" |
| 8848 | "An ordered list as a regular-expression\n") |
| 8849 | { |
| 8850 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
| 8851 | } |
| 8852 | |
| 8853 | DEFUN (no_ip_community_list_all, |
| 8854 | no_ip_community_list_all_cmd, |
| 8855 | "no ip community-list (WORD|<1-99>|<100-199>)", |
| 8856 | NO_STR |
| 8857 | IP_STR |
| 8858 | COMMUNITY_LIST_STR |
| 8859 | "Community list name\n" |
| 8860 | "Community list number (standard)\n" |
| 8861 | "Community list number (expanded)\n") |
| 8862 | { |
| 8863 | return community_list_unset_all_vty (vty, argv[0]); |
| 8864 | } |
| 8865 | |
| 8866 | DEFUN (no_ip_community_list_name_all, |
| 8867 | no_ip_community_list_name_all_cmd, |
| 8868 | "no ip community-list (standard|expanded) WORD", |
| 8869 | NO_STR |
| 8870 | IP_STR |
| 8871 | COMMUNITY_LIST_STR |
| 8872 | "Add a standard community-list entry\n" |
| 8873 | "Add an expanded community-list entry\n" |
| 8874 | "Community list name\n") |
| 8875 | { |
| 8876 | return community_list_unset_all_vty (vty, argv[1]); |
| 8877 | } |
| 8878 | |
| 8879 | DEFUN (no_ip_community_list, |
| 8880 | no_ip_community_list_cmd, |
| 8881 | "no ip community-list WORD (deny|permit) .AA:NN", |
| 8882 | NO_STR |
| 8883 | IP_STR |
| 8884 | COMMUNITY_LIST_STR |
| 8885 | "Community list name\n" |
| 8886 | "Specify community to reject\n" |
| 8887 | "Specify community to accept\n" |
| 8888 | COMMUNITY_VAL_STR) |
| 8889 | { |
| 8890 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_AUTO); |
| 8891 | } |
| 8892 | |
| 8893 | DEFUN (no_ip_community_list_standard, |
| 8894 | no_ip_community_list_standard_cmd, |
| 8895 | "no ip community-list <1-99> (deny|permit) .AA:NN", |
| 8896 | NO_STR |
| 8897 | IP_STR |
| 8898 | COMMUNITY_LIST_STR |
| 8899 | "Community list number (standard)\n" |
| 8900 | "Specify community to reject\n" |
| 8901 | "Specify community to accept\n" |
| 8902 | COMMUNITY_VAL_STR) |
| 8903 | { |
| 8904 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 8905 | } |
| 8906 | |
| 8907 | DEFUN (no_ip_community_list_expanded, |
| 8908 | no_ip_community_list_expanded_cmd, |
| 8909 | "no ip community-list <100-199> (deny|permit) .LINE", |
| 8910 | NO_STR |
| 8911 | IP_STR |
| 8912 | COMMUNITY_LIST_STR |
| 8913 | "Community list number (expanded)\n" |
| 8914 | "Specify community to reject\n" |
| 8915 | "Specify community to accept\n" |
| 8916 | "An ordered list as a regular-expression\n") |
| 8917 | { |
| 8918 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 8919 | } |
| 8920 | |
| 8921 | DEFUN (no_ip_community_list_name_standard, |
| 8922 | no_ip_community_list_name_standard_cmd, |
| 8923 | "no ip community-list standard WORD (deny|permit) .AA:NN", |
| 8924 | NO_STR |
| 8925 | IP_STR |
| 8926 | COMMUNITY_LIST_STR |
| 8927 | "Specify a standard community-list\n" |
| 8928 | "Community list name\n" |
| 8929 | "Specify community to reject\n" |
| 8930 | "Specify community to accept\n" |
| 8931 | COMMUNITY_VAL_STR) |
| 8932 | { |
| 8933 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 8934 | } |
| 8935 | |
| 8936 | DEFUN (no_ip_community_list_name_expanded, |
| 8937 | no_ip_community_list_name_expanded_cmd, |
| 8938 | "no ip community-list expanded WORD (deny|permit) .LINE", |
| 8939 | NO_STR |
| 8940 | IP_STR |
| 8941 | COMMUNITY_LIST_STR |
| 8942 | "Specify an expanded community-list\n" |
| 8943 | "Community list name\n" |
| 8944 | "Specify community to reject\n" |
| 8945 | "Specify community to accept\n" |
| 8946 | "An ordered list as a regular-expression\n") |
| 8947 | { |
| 8948 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 8949 | } |
| 8950 | |
| 8951 | void |
| 8952 | community_list_show (struct vty *vty, struct community_list *list) |
| 8953 | { |
| 8954 | struct community_entry *entry; |
| 8955 | |
| 8956 | for (entry = list->head; entry; entry = entry->next) |
| 8957 | { |
| 8958 | if (entry == list->head) |
| 8959 | { |
| 8960 | if (all_digit (list->name)) |
| 8961 | vty_out (vty, "Community %s list %s%s", |
| 8962 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 8963 | "standard" : "(expanded) access", |
| 8964 | list->name, VTY_NEWLINE); |
| 8965 | else |
| 8966 | vty_out (vty, "Named Community %s list %s%s", |
| 8967 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 8968 | "standard" : "expanded", |
| 8969 | list->name, VTY_NEWLINE); |
| 8970 | } |
| 8971 | if (entry->any) |
| 8972 | vty_out (vty, " %s%s", |
| 8973 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 8974 | else |
| 8975 | vty_out (vty, " %s %s%s", |
| 8976 | community_direct_str (entry->direct), |
| 8977 | entry->style == COMMUNITY_LIST_STANDARD |
| 8978 | ? community_str (entry->u.com) : entry->config, |
| 8979 | VTY_NEWLINE); |
| 8980 | } |
| 8981 | } |
| 8982 | |
| 8983 | DEFUN (show_ip_community_list, |
| 8984 | show_ip_community_list_cmd, |
| 8985 | "show ip community-list", |
| 8986 | SHOW_STR |
| 8987 | IP_STR |
| 8988 | "List community-list\n") |
| 8989 | { |
| 8990 | struct community_list *list; |
| 8991 | struct community_list_master *cm; |
| 8992 | |
| 8993 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_AUTO); |
| 8994 | if (! cm) |
| 8995 | return CMD_SUCCESS; |
| 8996 | |
| 8997 | for (list = cm->num.head; list; list = list->next) |
| 8998 | community_list_show (vty, list); |
| 8999 | |
| 9000 | for (list = cm->str.head; list; list = list->next) |
| 9001 | community_list_show (vty, list); |
| 9002 | |
| 9003 | return CMD_SUCCESS; |
| 9004 | } |
| 9005 | |
| 9006 | DEFUN (show_ip_community_list_arg, |
| 9007 | show_ip_community_list_arg_cmd, |
| 9008 | "show ip community-list (<1-199>|WORD)", |
| 9009 | SHOW_STR |
| 9010 | IP_STR |
| 9011 | "List community-list\n" |
| 9012 | "Community-list number\n" |
| 9013 | "Community-list name\n") |
| 9014 | { |
| 9015 | struct community_list *list; |
| 9016 | |
| 9017 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_AUTO); |
| 9018 | if (! list) |
| 9019 | { |
| 9020 | vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE); |
| 9021 | return CMD_WARNING; |
| 9022 | } |
| 9023 | |
| 9024 | community_list_show (vty, list); |
| 9025 | |
| 9026 | return CMD_SUCCESS; |
| 9027 | } |
| 9028 | |
| 9029 | int |
| 9030 | extcommunity_list_set_vty (struct vty *vty, int argc, char **argv, int style, |
| 9031 | int reject_all_digit_name) |
| 9032 | { |
| 9033 | int ret; |
| 9034 | int direct; |
| 9035 | char *str; |
| 9036 | |
| 9037 | /* Check the list type. */ |
| 9038 | if (strncmp (argv[1], "p", 1) == 0) |
| 9039 | direct = COMMUNITY_PERMIT; |
| 9040 | else if (strncmp (argv[1], "d", 1) == 0) |
| 9041 | direct = COMMUNITY_DENY; |
| 9042 | else |
| 9043 | { |
| 9044 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 9045 | VTY_NEWLINE); |
| 9046 | return CMD_WARNING; |
| 9047 | } |
| 9048 | |
| 9049 | /* All digit name check. */ |
| 9050 | if (reject_all_digit_name && all_digit (argv[0])) |
| 9051 | { |
| 9052 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 9053 | return CMD_WARNING; |
| 9054 | } |
| 9055 | |
| 9056 | /* Concat community string argument. */ |
| 9057 | if (argc > 1) |
| 9058 | str = argv_concat (argv, argc, 2); |
| 9059 | else |
| 9060 | str = NULL; |
| 9061 | |
| 9062 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); |
| 9063 | |
| 9064 | /* Free temporary community list string allocated by |
| 9065 | argv_concat(). */ |
| 9066 | if (str) |
| 9067 | XFREE (MTYPE_TMP, str); |
| 9068 | |
| 9069 | if (ret < 0) |
| 9070 | { |
| 9071 | community_list_perror (vty, ret); |
| 9072 | return CMD_WARNING; |
| 9073 | } |
| 9074 | return CMD_SUCCESS; |
| 9075 | } |
| 9076 | |
| 9077 | int |
| 9078 | extcommunity_list_unset_all_vty (struct vty *vty, char *name) |
| 9079 | { |
| 9080 | int ret; |
| 9081 | |
| 9082 | ret = extcommunity_list_unset (bgp_clist, name, NULL, 0, EXTCOMMUNITY_LIST_AUTO); |
| 9083 | |
| 9084 | if (ret < 0) |
| 9085 | { |
| 9086 | community_list_perror (vty, ret); |
| 9087 | return CMD_WARNING; |
| 9088 | } |
| 9089 | return CMD_SUCCESS; |
| 9090 | } |
| 9091 | |
| 9092 | int |
| 9093 | extcommunity_list_unset_vty (struct vty *vty, int argc, char **argv, int style) |
| 9094 | { |
| 9095 | int ret; |
| 9096 | int direct; |
| 9097 | char *str; |
| 9098 | |
| 9099 | /* Check the list direct. */ |
| 9100 | if (strncmp (argv[1], "p", 1) == 0) |
| 9101 | direct = COMMUNITY_PERMIT; |
| 9102 | else if (strncmp (argv[1], "d", 1) == 0) |
| 9103 | direct = COMMUNITY_DENY; |
| 9104 | else |
| 9105 | { |
| 9106 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 9107 | VTY_NEWLINE); |
| 9108 | return CMD_WARNING; |
| 9109 | } |
| 9110 | |
| 9111 | /* Concat community string argument. */ |
| 9112 | str = argv_concat (argv, argc, 2); |
| 9113 | |
| 9114 | /* Unset community list. */ |
| 9115 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); |
| 9116 | |
| 9117 | /* Free temporary community list string allocated by |
| 9118 | argv_concat(). */ |
| 9119 | XFREE (MTYPE_TMP, str); |
| 9120 | |
| 9121 | if (ret < 0) |
| 9122 | { |
| 9123 | community_list_perror (vty, ret); |
| 9124 | return CMD_WARNING; |
| 9125 | } |
| 9126 | |
| 9127 | return CMD_SUCCESS; |
| 9128 | } |
| 9129 | |
| 9130 | /* "extcommunity-list" keyword help string. */ |
| 9131 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" |
| 9132 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" |
| 9133 | |
| 9134 | DEFUN (ip_extcommunity_list_standard, |
| 9135 | ip_extcommunity_list_standard_cmd, |
| 9136 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 9137 | IP_STR |
| 9138 | EXTCOMMUNITY_LIST_STR |
| 9139 | "Extended Community list number (standard)\n" |
| 9140 | "Specify community to reject\n" |
| 9141 | "Specify community to accept\n" |
| 9142 | EXTCOMMUNITY_VAL_STR) |
| 9143 | { |
| 9144 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
| 9145 | } |
| 9146 | |
| 9147 | ALIAS (ip_extcommunity_list_standard, |
| 9148 | ip_extcommunity_list_standard2_cmd, |
| 9149 | "ip extcommunity-list <1-99> (deny|permit)", |
| 9150 | IP_STR |
| 9151 | EXTCOMMUNITY_LIST_STR |
| 9152 | "Extended Community list number (standard)\n" |
| 9153 | "Specify community to reject\n" |
| 9154 | "Specify community to accept\n") |
| 9155 | |
| 9156 | DEFUN (ip_extcommunity_list_expanded, |
| 9157 | ip_extcommunity_list_expanded_cmd, |
| 9158 | "ip extcommunity-list <100-199> (deny|permit) .LINE", |
| 9159 | IP_STR |
| 9160 | EXTCOMMUNITY_LIST_STR |
| 9161 | "Extended Community list number (expanded)\n" |
| 9162 | "Specify community to reject\n" |
| 9163 | "Specify community to accept\n" |
| 9164 | "An ordered list as a regular-expression\n") |
| 9165 | { |
| 9166 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
| 9167 | } |
| 9168 | |
| 9169 | DEFUN (ip_extcommunity_list_name_standard, |
| 9170 | ip_extcommunity_list_name_standard_cmd, |
| 9171 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 9172 | IP_STR |
| 9173 | EXTCOMMUNITY_LIST_STR |
| 9174 | "Specify standard extcommunity-list\n" |
| 9175 | "Extended Community list name\n" |
| 9176 | "Specify community to reject\n" |
| 9177 | "Specify community to accept\n" |
| 9178 | EXTCOMMUNITY_VAL_STR) |
| 9179 | { |
| 9180 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
| 9181 | } |
| 9182 | |
| 9183 | ALIAS (ip_extcommunity_list_name_standard, |
| 9184 | ip_extcommunity_list_name_standard2_cmd, |
| 9185 | "ip extcommunity-list standard WORD (deny|permit)", |
| 9186 | IP_STR |
| 9187 | EXTCOMMUNITY_LIST_STR |
| 9188 | "Specify standard extcommunity-list\n" |
| 9189 | "Extended Community list name\n" |
| 9190 | "Specify community to reject\n" |
| 9191 | "Specify community to accept\n") |
| 9192 | |
| 9193 | DEFUN (ip_extcommunity_list_name_expanded, |
| 9194 | ip_extcommunity_list_name_expanded_cmd, |
| 9195 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 9196 | IP_STR |
| 9197 | EXTCOMMUNITY_LIST_STR |
| 9198 | "Specify expanded extcommunity-list\n" |
| 9199 | "Extended Community list name\n" |
| 9200 | "Specify community to reject\n" |
| 9201 | "Specify community to accept\n" |
| 9202 | "An ordered list as a regular-expression\n") |
| 9203 | { |
| 9204 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
| 9205 | } |
| 9206 | |
| 9207 | DEFUN (no_ip_extcommunity_list_all, |
| 9208 | no_ip_extcommunity_list_all_cmd, |
| 9209 | "no ip extcommunity-list (<1-99>|<100-199>)", |
| 9210 | NO_STR |
| 9211 | IP_STR |
| 9212 | EXTCOMMUNITY_LIST_STR |
| 9213 | "Extended Community list number (standard)\n" |
| 9214 | "Extended Community list number (expanded)\n") |
| 9215 | { |
| 9216 | return extcommunity_list_unset_all_vty (vty, argv[0]); |
| 9217 | } |
| 9218 | |
| 9219 | DEFUN (no_ip_extcommunity_list_name_all, |
| 9220 | no_ip_extcommunity_list_name_all_cmd, |
| 9221 | "no ip extcommunity-list (standard|expanded) WORD", |
| 9222 | NO_STR |
| 9223 | IP_STR |
| 9224 | EXTCOMMUNITY_LIST_STR |
| 9225 | "Specify standard extcommunity-list\n" |
| 9226 | "Specify expanded extcommunity-list\n" |
| 9227 | "Extended Community list name\n") |
| 9228 | { |
| 9229 | return extcommunity_list_unset_all_vty (vty, argv[1]); |
| 9230 | } |
| 9231 | |
| 9232 | DEFUN (no_ip_extcommunity_list_standard, |
| 9233 | no_ip_extcommunity_list_standard_cmd, |
| 9234 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 9235 | NO_STR |
| 9236 | IP_STR |
| 9237 | EXTCOMMUNITY_LIST_STR |
| 9238 | "Extended Community list number (standard)\n" |
| 9239 | "Specify community to reject\n" |
| 9240 | "Specify community to accept\n" |
| 9241 | EXTCOMMUNITY_VAL_STR) |
| 9242 | { |
| 9243 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 9244 | } |
| 9245 | |
| 9246 | DEFUN (no_ip_extcommunity_list_expanded, |
| 9247 | no_ip_extcommunity_list_expanded_cmd, |
| 9248 | "no ip extcommunity-list <100-199> (deny|permit) .LINE", |
| 9249 | NO_STR |
| 9250 | IP_STR |
| 9251 | EXTCOMMUNITY_LIST_STR |
| 9252 | "Extended Community list number (expanded)\n" |
| 9253 | "Specify community to reject\n" |
| 9254 | "Specify community to accept\n" |
| 9255 | "An ordered list as a regular-expression\n") |
| 9256 | { |
| 9257 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 9258 | } |
| 9259 | |
| 9260 | DEFUN (no_ip_extcommunity_list_name_standard, |
| 9261 | no_ip_extcommunity_list_name_standard_cmd, |
| 9262 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 9263 | NO_STR |
| 9264 | IP_STR |
| 9265 | EXTCOMMUNITY_LIST_STR |
| 9266 | "Specify standard extcommunity-list\n" |
| 9267 | "Extended Community list name\n" |
| 9268 | "Specify community to reject\n" |
| 9269 | "Specify community to accept\n" |
| 9270 | EXTCOMMUNITY_VAL_STR) |
| 9271 | { |
| 9272 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 9273 | } |
| 9274 | |
| 9275 | DEFUN (no_ip_extcommunity_list_name_expanded, |
| 9276 | no_ip_extcommunity_list_name_expanded_cmd, |
| 9277 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 9278 | NO_STR |
| 9279 | IP_STR |
| 9280 | EXTCOMMUNITY_LIST_STR |
| 9281 | "Specify expanded extcommunity-list\n" |
| 9282 | "Community list name\n" |
| 9283 | "Specify community to reject\n" |
| 9284 | "Specify community to accept\n" |
| 9285 | "An ordered list as a regular-expression\n") |
| 9286 | { |
| 9287 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 9288 | } |
| 9289 | |
| 9290 | void |
| 9291 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
| 9292 | { |
| 9293 | struct community_entry *entry; |
| 9294 | |
| 9295 | for (entry = list->head; entry; entry = entry->next) |
| 9296 | { |
| 9297 | if (entry == list->head) |
| 9298 | { |
| 9299 | if (all_digit (list->name)) |
| 9300 | vty_out (vty, "Extended community %s list %s%s", |
| 9301 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 9302 | "standard" : "(expanded) access", |
| 9303 | list->name, VTY_NEWLINE); |
| 9304 | else |
| 9305 | vty_out (vty, "Named extended community %s list %s%s", |
| 9306 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 9307 | "standard" : "expanded", |
| 9308 | list->name, VTY_NEWLINE); |
| 9309 | } |
| 9310 | if (entry->any) |
| 9311 | vty_out (vty, " %s%s", |
| 9312 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 9313 | else |
| 9314 | vty_out (vty, " %s %s%s", |
| 9315 | community_direct_str (entry->direct), |
| 9316 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 9317 | entry->u.ecom->str : entry->config, |
| 9318 | VTY_NEWLINE); |
| 9319 | } |
| 9320 | } |
| 9321 | |
| 9322 | DEFUN (show_ip_extcommunity_list, |
| 9323 | show_ip_extcommunity_list_cmd, |
| 9324 | "show ip extcommunity-list", |
| 9325 | SHOW_STR |
| 9326 | IP_STR |
| 9327 | "List extended-community list\n") |
| 9328 | { |
| 9329 | struct community_list *list; |
| 9330 | struct community_list_master *cm; |
| 9331 | |
| 9332 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_AUTO); |
| 9333 | if (! cm) |
| 9334 | return CMD_SUCCESS; |
| 9335 | |
| 9336 | for (list = cm->num.head; list; list = list->next) |
| 9337 | extcommunity_list_show (vty, list); |
| 9338 | |
| 9339 | for (list = cm->str.head; list; list = list->next) |
| 9340 | extcommunity_list_show (vty, list); |
| 9341 | |
| 9342 | return CMD_SUCCESS; |
| 9343 | } |
| 9344 | |
| 9345 | DEFUN (show_ip_extcommunity_list_arg, |
| 9346 | show_ip_extcommunity_list_arg_cmd, |
| 9347 | "show ip extcommunity-list (<1-199>|WORD)", |
| 9348 | SHOW_STR |
| 9349 | IP_STR |
| 9350 | "List extended-community list\n" |
| 9351 | "Extcommunity-list number\n" |
| 9352 | "Extcommunity-list name\n") |
| 9353 | { |
| 9354 | struct community_list *list; |
| 9355 | |
| 9356 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_AUTO); |
| 9357 | if (! list) |
| 9358 | { |
| 9359 | vty_out (vty, "%% Can't find extcommunit-list%s", VTY_NEWLINE); |
| 9360 | return CMD_WARNING; |
| 9361 | } |
| 9362 | |
| 9363 | extcommunity_list_show (vty, list); |
| 9364 | |
| 9365 | return CMD_SUCCESS; |
| 9366 | } |
| 9367 | |
| 9368 | /* Return configuration string of community-list entry. */ |
| 9369 | static char * |
| 9370 | community_list_config_str (struct community_entry *entry) |
| 9371 | { |
| 9372 | char *str; |
| 9373 | |
| 9374 | if (entry->any) |
| 9375 | str = ""; |
| 9376 | else |
| 9377 | { |
| 9378 | if (entry->style == COMMUNITY_LIST_STANDARD) |
| 9379 | str = community_str (entry->u.com); |
| 9380 | else |
| 9381 | str = entry->config; |
| 9382 | } |
| 9383 | return str; |
| 9384 | } |
| 9385 | |
| 9386 | /* Display community-list and extcommunity-list configuration. */ |
| 9387 | int |
| 9388 | community_list_config_write (struct vty *vty) |
| 9389 | { |
| 9390 | struct community_list *list; |
| 9391 | struct community_entry *entry; |
| 9392 | struct community_list_master *cm; |
| 9393 | int write = 0; |
| 9394 | |
| 9395 | /* Community-list. */ |
| 9396 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_AUTO); |
| 9397 | |
| 9398 | for (list = cm->num.head; list; list = list->next) |
| 9399 | for (entry = list->head; entry; entry = entry->next) |
| 9400 | { |
| 9401 | if (atol (list->name) < 200) |
| 9402 | vty_out (vty, "ip community-list %s %s %s%s", |
| 9403 | list->name, community_direct_str (entry->direct), |
| 9404 | community_list_config_str (entry), |
| 9405 | VTY_NEWLINE); |
| 9406 | else |
| 9407 | vty_out (vty, "ip community-list %s %s %s %s%s", |
| 9408 | entry->style == COMMUNITY_LIST_STANDARD |
| 9409 | ? "standard" : "expanded", |
| 9410 | list->name, community_direct_str (entry->direct), |
| 9411 | community_list_config_str (entry), |
| 9412 | VTY_NEWLINE); |
| 9413 | write++; |
| 9414 | } |
| 9415 | for (list = cm->str.head; list; list = list->next) |
| 9416 | for (entry = list->head; entry; entry = entry->next) |
| 9417 | { |
| 9418 | vty_out (vty, "ip community-list %s %s %s %s%s", |
| 9419 | entry->style == COMMUNITY_LIST_STANDARD |
| 9420 | ? "standard" : "expanded", |
| 9421 | list->name, community_direct_str (entry->direct), |
| 9422 | community_list_config_str (entry), |
| 9423 | VTY_NEWLINE); |
| 9424 | write++; |
| 9425 | } |
| 9426 | |
| 9427 | /* Extcommunity-list. */ |
| 9428 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_AUTO); |
| 9429 | |
| 9430 | for (list = cm->num.head; list; list = list->next) |
| 9431 | for (entry = list->head; entry; entry = entry->next) |
| 9432 | { |
| 9433 | if (atol (list->name) < 200) |
| 9434 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
| 9435 | list->name, community_direct_str (entry->direct), |
| 9436 | community_list_config_str (entry), VTY_NEWLINE); |
| 9437 | else |
| 9438 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", |
| 9439 | entry->style == EXTCOMMUNITY_LIST_STANDARD |
| 9440 | ? "standard" : "expanded", |
| 9441 | list->name, community_direct_str (entry->direct), |
| 9442 | community_list_config_str (entry), VTY_NEWLINE); |
| 9443 | write++; |
| 9444 | } |
| 9445 | for (list = cm->str.head; list; list = list->next) |
| 9446 | for (entry = list->head; entry; entry = entry->next) |
| 9447 | { |
| 9448 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", |
| 9449 | entry->style == EXTCOMMUNITY_LIST_STANDARD |
| 9450 | ? "standard" : "expanded", |
| 9451 | list->name, community_direct_str (entry->direct), |
| 9452 | community_list_config_str (entry), VTY_NEWLINE); |
| 9453 | write++; |
| 9454 | } |
| 9455 | return write; |
| 9456 | } |
| 9457 | |
| 9458 | struct cmd_node community_list_node = |
| 9459 | { |
| 9460 | COMMUNITY_LIST_NODE, |
| 9461 | "", |
| 9462 | 1 /* Export to vtysh. */ |
| 9463 | }; |
| 9464 | |
| 9465 | void |
| 9466 | community_list_vty () |
| 9467 | { |
| 9468 | install_node (&community_list_node, community_list_config_write); |
| 9469 | |
| 9470 | /* Community-list. */ |
| 9471 | install_element (CONFIG_NODE, &ip_community_list_cmd); |
| 9472 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
| 9473 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); |
| 9474 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); |
| 9475 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); |
| 9476 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); |
| 9477 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); |
| 9478 | install_element (CONFIG_NODE, &no_ip_community_list_all_cmd); |
| 9479 | install_element (CONFIG_NODE, &no_ip_community_list_name_all_cmd); |
| 9480 | install_element (CONFIG_NODE, &no_ip_community_list_cmd); |
| 9481 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
| 9482 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); |
| 9483 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); |
| 9484 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
| 9485 | install_element (VIEW_NODE, &show_ip_community_list_cmd); |
| 9486 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); |
| 9487 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); |
| 9488 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); |
| 9489 | |
| 9490 | /* Extcommunity-list. */ |
| 9491 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); |
| 9492 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); |
| 9493 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); |
| 9494 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); |
| 9495 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); |
| 9496 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); |
| 9497 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_all_cmd); |
| 9498 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_all_cmd); |
| 9499 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
| 9500 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); |
| 9501 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); |
| 9502 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
| 9503 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); |
| 9504 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 9505 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); |
| 9506 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 9507 | } |