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