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