paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* BGP VTY interface. |
| 2 | Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro |
| 3 | |
| 4 | This file is part of GNU Zebra. |
| 5 | |
| 6 | GNU Zebra is free software; you can redistribute it and/or modify it |
| 7 | under the terms of the GNU General Public License as published by the |
| 8 | Free Software Foundation; either version 2, or (at your option) any |
| 9 | later version. |
| 10 | |
| 11 | GNU Zebra is distributed in the hope that it will be useful, but |
| 12 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with GNU Zebra; see the file COPYING. If not, write to the Free |
| 18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 19 | 02111-1307, USA. */ |
| 20 | |
| 21 | #include <zebra.h> |
| 22 | |
| 23 | #include "command.h" |
| 24 | #include "prefix.h" |
| 25 | #include "plist.h" |
| 26 | #include "buffer.h" |
| 27 | #include "linklist.h" |
| 28 | #include "stream.h" |
| 29 | #include "thread.h" |
| 30 | #include "log.h" |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 31 | #include "memory.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 32 | |
| 33 | #include "bgpd/bgpd.h" |
| 34 | #include "bgpd/bgp_attr.h" |
| 35 | #include "bgpd/bgp_aspath.h" |
| 36 | #include "bgpd/bgp_community.h" |
| 37 | #include "bgpd/bgp_debug.h" |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 38 | #include "bgpd/bgp_fsm.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 39 | #include "bgpd/bgp_mplsvpn.h" |
| 40 | #include "bgpd/bgp_open.h" |
| 41 | #include "bgpd/bgp_route.h" |
| 42 | #include "bgpd/bgp_zebra.h" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 43 | #include "bgpd/bgp_table.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 44 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 45 | extern struct in_addr router_id_zebra; |
| 46 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 47 | /* Utility function to get address family from current node. */ |
| 48 | afi_t |
| 49 | bgp_node_afi (struct vty *vty) |
| 50 | { |
| 51 | if (vty->node == BGP_IPV6_NODE) |
| 52 | return AFI_IP6; |
| 53 | return AFI_IP; |
| 54 | } |
| 55 | |
| 56 | /* Utility function to get subsequent address family from current |
| 57 | node. */ |
| 58 | safi_t |
| 59 | bgp_node_safi (struct vty *vty) |
| 60 | { |
| 61 | if (vty->node == BGP_VPNV4_NODE) |
| 62 | return SAFI_MPLS_VPN; |
| 63 | if (vty->node == BGP_IPV4M_NODE) |
| 64 | return SAFI_MULTICAST; |
| 65 | return SAFI_UNICAST; |
| 66 | } |
| 67 | |
| 68 | int |
| 69 | peer_address_self_check (union sockunion *su) |
| 70 | { |
| 71 | struct interface *ifp = NULL; |
| 72 | |
| 73 | if (su->sa.sa_family == AF_INET) |
| 74 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); |
| 75 | #ifdef HAVE_IPV6 |
| 76 | else if (su->sa.sa_family == AF_INET6) |
| 77 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); |
| 78 | #endif /* HAVE IPV6 */ |
| 79 | |
| 80 | if (ifp) |
| 81 | return 1; |
| 82 | |
| 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | /* Utility function for looking up peer from VTY. */ |
| 87 | struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 88 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 89 | { |
| 90 | int ret; |
| 91 | struct bgp *bgp; |
| 92 | union sockunion su; |
| 93 | struct peer *peer; |
| 94 | |
| 95 | bgp = vty->index; |
| 96 | |
| 97 | ret = str2sockunion (ip_str, &su); |
| 98 | if (ret < 0) |
| 99 | { |
| 100 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 101 | return NULL; |
| 102 | } |
| 103 | |
| 104 | peer = peer_lookup (bgp, &su); |
| 105 | if (! peer) |
| 106 | { |
| 107 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE); |
| 108 | return NULL; |
| 109 | } |
| 110 | return peer; |
| 111 | } |
| 112 | |
| 113 | /* Utility function for looking up peer or peer group. */ |
| 114 | struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 115 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 116 | { |
| 117 | int ret; |
| 118 | struct bgp *bgp; |
| 119 | union sockunion su; |
| 120 | struct peer *peer; |
| 121 | struct peer_group *group; |
| 122 | |
| 123 | bgp = vty->index; |
| 124 | |
| 125 | ret = str2sockunion (peer_str, &su); |
| 126 | if (ret == 0) |
| 127 | { |
| 128 | peer = peer_lookup (bgp, &su); |
| 129 | if (peer) |
| 130 | return peer; |
| 131 | } |
| 132 | else |
| 133 | { |
| 134 | group = peer_group_lookup (bgp, peer_str); |
| 135 | if (group) |
| 136 | return group->conf; |
| 137 | } |
| 138 | |
| 139 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
| 140 | VTY_NEWLINE); |
| 141 | |
| 142 | return NULL; |
| 143 | } |
| 144 | |
| 145 | int |
| 146 | bgp_vty_return (struct vty *vty, int ret) |
| 147 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 148 | const char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 149 | |
| 150 | switch (ret) |
| 151 | { |
| 152 | case BGP_ERR_INVALID_VALUE: |
| 153 | str = "Invalid value"; |
| 154 | break; |
| 155 | case BGP_ERR_INVALID_FLAG: |
| 156 | str = "Invalid flag"; |
| 157 | break; |
| 158 | case BGP_ERR_PEER_INACTIVE: |
| 159 | str = "Activate the neighbor for the address family first"; |
| 160 | break; |
| 161 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: |
| 162 | str = "Invalid command for a peer-group member"; |
| 163 | break; |
| 164 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
| 165 | str = "Peer-group has been shutdown. Activate the peer-group first"; |
| 166 | break; |
| 167 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: |
| 168 | str = "This peer is a peer-group member. Please change peer-group configuration"; |
| 169 | break; |
| 170 | case BGP_ERR_PEER_FLAG_CONFLICT: |
| 171 | str = "Can't set override-capability and strict-capability-match at the same time"; |
| 172 | break; |
| 173 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: |
| 174 | str = "No activate for peergroup can be given only if peer-group has no members"; |
| 175 | break; |
| 176 | case BGP_ERR_PEER_BELONGS_TO_GROUP: |
| 177 | str = "No activate for an individual peer-group member is invalid"; |
| 178 | break; |
| 179 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: |
| 180 | str = "Activate the peer-group for the address family first"; |
| 181 | break; |
| 182 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
| 183 | str = "Specify remote-as or peer-group remote AS first"; |
| 184 | break; |
| 185 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: |
| 186 | str = "Cannot change the peer-group. Deconfigure first"; |
| 187 | break; |
| 188 | case BGP_ERR_PEER_GROUP_MISMATCH: |
| 189 | str = "Cannot have different peer-group for the neighbor"; |
| 190 | break; |
| 191 | case BGP_ERR_PEER_FILTER_CONFLICT: |
| 192 | str = "Prefix/distribute list can not co-exist"; |
| 193 | break; |
| 194 | case BGP_ERR_NOT_INTERNAL_PEER: |
| 195 | str = "Invalid command. Not an internal neighbor"; |
| 196 | break; |
| 197 | case BGP_ERR_REMOVE_PRIVATE_AS: |
| 198 | str = "Private AS cannot be removed for IBGP peers"; |
| 199 | break; |
| 200 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: |
| 201 | str = "Local-AS allowed only for EBGP peers"; |
| 202 | break; |
| 203 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: |
| 204 | str = "Cannot have local-as same as BGP AS number"; |
| 205 | break; |
| 206 | } |
| 207 | if (str) |
| 208 | { |
| 209 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); |
| 210 | return CMD_WARNING; |
| 211 | } |
| 212 | return CMD_SUCCESS; |
| 213 | } |
| 214 | |
| 215 | /* BGP global configuration. */ |
| 216 | |
| 217 | DEFUN (bgp_multiple_instance_func, |
| 218 | bgp_multiple_instance_cmd, |
| 219 | "bgp multiple-instance", |
| 220 | BGP_STR |
| 221 | "Enable bgp multiple instance\n") |
| 222 | { |
| 223 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); |
| 224 | return CMD_SUCCESS; |
| 225 | } |
| 226 | |
| 227 | DEFUN (no_bgp_multiple_instance, |
| 228 | no_bgp_multiple_instance_cmd, |
| 229 | "no bgp multiple-instance", |
| 230 | NO_STR |
| 231 | BGP_STR |
| 232 | "BGP multiple instance\n") |
| 233 | { |
| 234 | int ret; |
| 235 | |
| 236 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); |
| 237 | if (ret < 0) |
| 238 | { |
| 239 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); |
| 240 | return CMD_WARNING; |
| 241 | } |
| 242 | return CMD_SUCCESS; |
| 243 | } |
| 244 | |
| 245 | DEFUN (bgp_config_type, |
| 246 | bgp_config_type_cmd, |
| 247 | "bgp config-type (cisco|zebra)", |
| 248 | BGP_STR |
| 249 | "Configuration type\n" |
| 250 | "cisco\n" |
| 251 | "zebra\n") |
| 252 | { |
| 253 | if (strncmp (argv[0], "c", 1) == 0) |
| 254 | bgp_option_set (BGP_OPT_CONFIG_CISCO); |
| 255 | else |
| 256 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 257 | |
| 258 | return CMD_SUCCESS; |
| 259 | } |
| 260 | |
| 261 | DEFUN (no_bgp_config_type, |
| 262 | no_bgp_config_type_cmd, |
| 263 | "no bgp config-type", |
| 264 | NO_STR |
| 265 | BGP_STR |
| 266 | "Display configuration type\n") |
| 267 | { |
| 268 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 269 | return CMD_SUCCESS; |
| 270 | } |
| 271 | |
| 272 | DEFUN (no_synchronization, |
| 273 | no_synchronization_cmd, |
| 274 | "no synchronization", |
| 275 | NO_STR |
| 276 | "Perform IGP synchronization\n") |
| 277 | { |
| 278 | return CMD_SUCCESS; |
| 279 | } |
| 280 | |
| 281 | DEFUN (no_auto_summary, |
| 282 | no_auto_summary_cmd, |
| 283 | "no auto-summary", |
| 284 | NO_STR |
| 285 | "Enable automatic network number summarization\n") |
| 286 | { |
| 287 | return CMD_SUCCESS; |
| 288 | } |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 289 | |
| 290 | DEFUN_DEPRECATED (neighbor_version, |
| 291 | neighbor_version_cmd, |
| 292 | NEIGHBOR_CMD "version (4|4-)", |
| 293 | NEIGHBOR_STR |
| 294 | NEIGHBOR_ADDR_STR |
| 295 | "Set the BGP version to match a neighbor\n" |
| 296 | "Neighbor's BGP version\n") |
| 297 | { |
| 298 | return CMD_SUCCESS; |
| 299 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 300 | |
| 301 | /* "router bgp" commands. */ |
| 302 | DEFUN (router_bgp, |
| 303 | router_bgp_cmd, |
| 304 | "router bgp <1-65535>", |
| 305 | ROUTER_STR |
| 306 | BGP_STR |
| 307 | AS_STR) |
| 308 | { |
| 309 | int ret; |
| 310 | as_t as; |
| 311 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 312 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 313 | |
| 314 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535); |
| 315 | |
| 316 | if (argc == 2) |
| 317 | name = argv[1]; |
| 318 | |
| 319 | ret = bgp_get (&bgp, &as, name); |
| 320 | switch (ret) |
| 321 | { |
| 322 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: |
| 323 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", |
| 324 | VTY_NEWLINE); |
| 325 | return CMD_WARNING; |
| 326 | break; |
| 327 | case BGP_ERR_AS_MISMATCH: |
| 328 | vty_out (vty, "BGP is already running; AS is %d%s", as, VTY_NEWLINE); |
| 329 | return CMD_WARNING; |
| 330 | break; |
| 331 | case BGP_ERR_INSTANCE_MISMATCH: |
| 332 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); |
| 333 | vty_out (vty, "BGP instance is already running; AS is %d%s", |
| 334 | as, VTY_NEWLINE); |
| 335 | return CMD_WARNING; |
| 336 | break; |
| 337 | } |
| 338 | |
| 339 | vty->node = BGP_NODE; |
| 340 | vty->index = bgp; |
| 341 | |
| 342 | return CMD_SUCCESS; |
| 343 | } |
| 344 | |
| 345 | ALIAS (router_bgp, |
| 346 | router_bgp_view_cmd, |
| 347 | "router bgp <1-65535> view WORD", |
| 348 | ROUTER_STR |
| 349 | BGP_STR |
| 350 | AS_STR |
| 351 | "BGP view\n" |
| 352 | "view name\n") |
| 353 | |
| 354 | /* "no router bgp" commands. */ |
| 355 | DEFUN (no_router_bgp, |
| 356 | no_router_bgp_cmd, |
| 357 | "no router bgp <1-65535>", |
| 358 | NO_STR |
| 359 | ROUTER_STR |
| 360 | BGP_STR |
| 361 | AS_STR) |
| 362 | { |
| 363 | as_t as; |
| 364 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 365 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 366 | |
| 367 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535); |
| 368 | |
| 369 | if (argc == 2) |
| 370 | name = argv[1]; |
| 371 | |
| 372 | /* Lookup bgp structure. */ |
| 373 | bgp = bgp_lookup (as, name); |
| 374 | if (! bgp) |
| 375 | { |
| 376 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); |
| 377 | return CMD_WARNING; |
| 378 | } |
| 379 | |
| 380 | bgp_delete (bgp); |
| 381 | |
| 382 | return CMD_SUCCESS; |
| 383 | } |
| 384 | |
| 385 | ALIAS (no_router_bgp, |
| 386 | no_router_bgp_view_cmd, |
| 387 | "no router bgp <1-65535> view WORD", |
| 388 | NO_STR |
| 389 | ROUTER_STR |
| 390 | BGP_STR |
| 391 | AS_STR |
| 392 | "BGP view\n" |
| 393 | "view name\n") |
| 394 | |
| 395 | /* BGP router-id. */ |
| 396 | |
| 397 | DEFUN (bgp_router_id, |
| 398 | bgp_router_id_cmd, |
| 399 | "bgp router-id A.B.C.D", |
| 400 | BGP_STR |
| 401 | "Override configured router identifier\n" |
| 402 | "Manually configured router identifier\n") |
| 403 | { |
| 404 | int ret; |
| 405 | struct in_addr id; |
| 406 | struct bgp *bgp; |
| 407 | |
| 408 | bgp = vty->index; |
| 409 | |
| 410 | ret = inet_aton (argv[0], &id); |
| 411 | if (! ret) |
| 412 | { |
| 413 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); |
| 414 | return CMD_WARNING; |
| 415 | } |
| 416 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 417 | bgp->router_id_static = id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 418 | bgp_router_id_set (bgp, &id); |
| 419 | |
| 420 | return CMD_SUCCESS; |
| 421 | } |
| 422 | |
| 423 | DEFUN (no_bgp_router_id, |
| 424 | no_bgp_router_id_cmd, |
| 425 | "no bgp router-id", |
| 426 | NO_STR |
| 427 | BGP_STR |
| 428 | "Override configured router identifier\n") |
| 429 | { |
| 430 | int ret; |
| 431 | struct in_addr id; |
| 432 | struct bgp *bgp; |
| 433 | |
| 434 | bgp = vty->index; |
| 435 | |
| 436 | if (argc == 1) |
| 437 | { |
| 438 | ret = inet_aton (argv[0], &id); |
| 439 | if (! ret) |
| 440 | { |
| 441 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); |
| 442 | return CMD_WARNING; |
| 443 | } |
| 444 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 445 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 446 | { |
| 447 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); |
| 448 | return CMD_WARNING; |
| 449 | } |
| 450 | } |
| 451 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 452 | bgp->router_id_static.s_addr = 0; |
| 453 | bgp_router_id_set (bgp, &router_id_zebra); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 454 | |
| 455 | return CMD_SUCCESS; |
| 456 | } |
| 457 | |
| 458 | ALIAS (no_bgp_router_id, |
| 459 | no_bgp_router_id_val_cmd, |
| 460 | "no bgp router-id A.B.C.D", |
| 461 | NO_STR |
| 462 | BGP_STR |
| 463 | "Override configured router identifier\n" |
| 464 | "Manually configured router identifier\n") |
| 465 | |
| 466 | /* BGP Cluster ID. */ |
| 467 | |
| 468 | DEFUN (bgp_cluster_id, |
| 469 | bgp_cluster_id_cmd, |
| 470 | "bgp cluster-id A.B.C.D", |
| 471 | BGP_STR |
| 472 | "Configure Route-Reflector Cluster-id\n" |
| 473 | "Route-Reflector Cluster-id in IP address format\n") |
| 474 | { |
| 475 | int ret; |
| 476 | struct bgp *bgp; |
| 477 | struct in_addr cluster; |
| 478 | |
| 479 | bgp = vty->index; |
| 480 | |
| 481 | ret = inet_aton (argv[0], &cluster); |
| 482 | if (! ret) |
| 483 | { |
| 484 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 485 | return CMD_WARNING; |
| 486 | } |
| 487 | |
| 488 | bgp_cluster_id_set (bgp, &cluster); |
| 489 | |
| 490 | return CMD_SUCCESS; |
| 491 | } |
| 492 | |
| 493 | ALIAS (bgp_cluster_id, |
| 494 | bgp_cluster_id32_cmd, |
| 495 | "bgp cluster-id <1-4294967295>", |
| 496 | BGP_STR |
| 497 | "Configure Route-Reflector Cluster-id\n" |
| 498 | "Route-Reflector Cluster-id as 32 bit quantity\n") |
| 499 | |
| 500 | DEFUN (no_bgp_cluster_id, |
| 501 | no_bgp_cluster_id_cmd, |
| 502 | "no bgp cluster-id", |
| 503 | NO_STR |
| 504 | BGP_STR |
| 505 | "Configure Route-Reflector Cluster-id\n") |
| 506 | { |
| 507 | int ret; |
| 508 | struct bgp *bgp; |
| 509 | struct in_addr cluster; |
| 510 | |
| 511 | bgp = vty->index; |
| 512 | |
| 513 | if (argc == 1) |
| 514 | { |
| 515 | ret = inet_aton (argv[0], &cluster); |
| 516 | if (! ret) |
| 517 | { |
| 518 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 519 | return CMD_WARNING; |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | bgp_cluster_id_unset (bgp); |
| 524 | |
| 525 | return CMD_SUCCESS; |
| 526 | } |
| 527 | |
| 528 | ALIAS (no_bgp_cluster_id, |
| 529 | no_bgp_cluster_id_arg_cmd, |
| 530 | "no bgp cluster-id A.B.C.D", |
| 531 | NO_STR |
| 532 | BGP_STR |
| 533 | "Configure Route-Reflector Cluster-id\n" |
| 534 | "Route-Reflector Cluster-id in IP address format\n") |
| 535 | |
| 536 | DEFUN (bgp_confederation_identifier, |
| 537 | bgp_confederation_identifier_cmd, |
| 538 | "bgp confederation identifier <1-65535>", |
| 539 | "BGP specific commands\n" |
| 540 | "AS confederation parameters\n" |
| 541 | "AS number\n" |
| 542 | "Set routing domain confederation AS\n") |
| 543 | { |
| 544 | struct bgp *bgp; |
| 545 | as_t as; |
| 546 | |
| 547 | bgp = vty->index; |
| 548 | |
| 549 | VTY_GET_INTEGER ("AS", as, argv[0]); |
| 550 | |
| 551 | bgp_confederation_id_set (bgp, as); |
| 552 | |
| 553 | return CMD_SUCCESS; |
| 554 | } |
| 555 | |
| 556 | DEFUN (no_bgp_confederation_identifier, |
| 557 | no_bgp_confederation_identifier_cmd, |
| 558 | "no bgp confederation identifier", |
| 559 | NO_STR |
| 560 | "BGP specific commands\n" |
| 561 | "AS confederation parameters\n" |
| 562 | "AS number\n") |
| 563 | { |
| 564 | struct bgp *bgp; |
| 565 | as_t as; |
| 566 | |
| 567 | bgp = vty->index; |
| 568 | |
| 569 | if (argc == 1) |
| 570 | VTY_GET_INTEGER ("AS", as, argv[0]); |
| 571 | |
| 572 | bgp_confederation_id_unset (bgp); |
| 573 | |
| 574 | return CMD_SUCCESS; |
| 575 | } |
| 576 | |
| 577 | ALIAS (no_bgp_confederation_identifier, |
| 578 | no_bgp_confederation_identifier_arg_cmd, |
| 579 | "no bgp confederation identifier <1-65535>", |
| 580 | NO_STR |
| 581 | "BGP specific commands\n" |
| 582 | "AS confederation parameters\n" |
| 583 | "AS number\n" |
| 584 | "Set routing domain confederation AS\n") |
| 585 | |
| 586 | DEFUN (bgp_confederation_peers, |
| 587 | bgp_confederation_peers_cmd, |
| 588 | "bgp confederation peers .<1-65535>", |
| 589 | "BGP specific commands\n" |
| 590 | "AS confederation parameters\n" |
| 591 | "Peer ASs in BGP confederation\n" |
| 592 | AS_STR) |
| 593 | { |
| 594 | struct bgp *bgp; |
| 595 | as_t as; |
| 596 | int i; |
| 597 | |
| 598 | bgp = vty->index; |
| 599 | |
| 600 | for (i = 0; i < argc; i++) |
| 601 | { |
| 602 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, 65535); |
| 603 | |
| 604 | if (bgp->as == as) |
| 605 | { |
| 606 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", |
| 607 | VTY_NEWLINE); |
| 608 | continue; |
| 609 | } |
| 610 | |
| 611 | bgp_confederation_peers_add (bgp, as); |
| 612 | } |
| 613 | return CMD_SUCCESS; |
| 614 | } |
| 615 | |
| 616 | DEFUN (no_bgp_confederation_peers, |
| 617 | no_bgp_confederation_peers_cmd, |
| 618 | "no bgp confederation peers .<1-65535>", |
| 619 | NO_STR |
| 620 | "BGP specific commands\n" |
| 621 | "AS confederation parameters\n" |
| 622 | "Peer ASs in BGP confederation\n" |
| 623 | AS_STR) |
| 624 | { |
| 625 | struct bgp *bgp; |
| 626 | as_t as; |
| 627 | int i; |
| 628 | |
| 629 | bgp = vty->index; |
| 630 | |
| 631 | for (i = 0; i < argc; i++) |
| 632 | { |
| 633 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, 65535); |
| 634 | |
| 635 | bgp_confederation_peers_remove (bgp, as); |
| 636 | } |
| 637 | return CMD_SUCCESS; |
| 638 | } |
| 639 | |
| 640 | /* BGP timers. */ |
| 641 | |
| 642 | DEFUN (bgp_timers, |
| 643 | bgp_timers_cmd, |
| 644 | "timers bgp <0-65535> <0-65535>", |
| 645 | "Adjust routing timers\n" |
| 646 | "BGP timers\n" |
| 647 | "Keepalive interval\n" |
| 648 | "Holdtime\n") |
| 649 | { |
| 650 | struct bgp *bgp; |
| 651 | unsigned long keepalive = 0; |
| 652 | unsigned long holdtime = 0; |
| 653 | |
| 654 | bgp = vty->index; |
| 655 | |
| 656 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); |
| 657 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); |
| 658 | |
| 659 | /* Holdtime value check. */ |
| 660 | if (holdtime < 3 && holdtime != 0) |
| 661 | { |
| 662 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", |
| 663 | VTY_NEWLINE); |
| 664 | return CMD_WARNING; |
| 665 | } |
| 666 | |
| 667 | bgp_timers_set (bgp, keepalive, holdtime); |
| 668 | |
| 669 | return CMD_SUCCESS; |
| 670 | } |
| 671 | |
| 672 | DEFUN (no_bgp_timers, |
| 673 | no_bgp_timers_cmd, |
| 674 | "no timers bgp", |
| 675 | NO_STR |
| 676 | "Adjust routing timers\n" |
| 677 | "BGP timers\n") |
| 678 | { |
| 679 | struct bgp *bgp; |
| 680 | |
| 681 | bgp = vty->index; |
| 682 | bgp_timers_unset (bgp); |
| 683 | |
| 684 | return CMD_SUCCESS; |
| 685 | } |
| 686 | |
| 687 | ALIAS (no_bgp_timers, |
| 688 | no_bgp_timers_arg_cmd, |
| 689 | "no timers bgp <0-65535> <0-65535>", |
| 690 | NO_STR |
| 691 | "Adjust routing timers\n" |
| 692 | "BGP timers\n" |
| 693 | "Keepalive interval\n" |
| 694 | "Holdtime\n") |
| 695 | |
| 696 | DEFUN (bgp_client_to_client_reflection, |
| 697 | bgp_client_to_client_reflection_cmd, |
| 698 | "bgp client-to-client reflection", |
| 699 | "BGP specific commands\n" |
| 700 | "Configure client to client route reflection\n" |
| 701 | "reflection of routes allowed\n") |
| 702 | { |
| 703 | struct bgp *bgp; |
| 704 | |
| 705 | bgp = vty->index; |
| 706 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 707 | return CMD_SUCCESS; |
| 708 | } |
| 709 | |
| 710 | DEFUN (no_bgp_client_to_client_reflection, |
| 711 | no_bgp_client_to_client_reflection_cmd, |
| 712 | "no bgp client-to-client reflection", |
| 713 | NO_STR |
| 714 | "BGP specific commands\n" |
| 715 | "Configure client to client route reflection\n" |
| 716 | "reflection of routes allowed\n") |
| 717 | { |
| 718 | struct bgp *bgp; |
| 719 | |
| 720 | bgp = vty->index; |
| 721 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 722 | return CMD_SUCCESS; |
| 723 | } |
| 724 | |
| 725 | /* "bgp always-compare-med" configuration. */ |
| 726 | DEFUN (bgp_always_compare_med, |
| 727 | bgp_always_compare_med_cmd, |
| 728 | "bgp always-compare-med", |
| 729 | "BGP specific commands\n" |
| 730 | "Allow comparing MED from different neighbors\n") |
| 731 | { |
| 732 | struct bgp *bgp; |
| 733 | |
| 734 | bgp = vty->index; |
| 735 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 736 | return CMD_SUCCESS; |
| 737 | } |
| 738 | |
| 739 | DEFUN (no_bgp_always_compare_med, |
| 740 | no_bgp_always_compare_med_cmd, |
| 741 | "no bgp always-compare-med", |
| 742 | NO_STR |
| 743 | "BGP specific commands\n" |
| 744 | "Allow comparing MED from different neighbors\n") |
| 745 | { |
| 746 | struct bgp *bgp; |
| 747 | |
| 748 | bgp = vty->index; |
| 749 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 750 | return CMD_SUCCESS; |
| 751 | } |
| 752 | |
| 753 | /* "bgp deterministic-med" configuration. */ |
| 754 | DEFUN (bgp_deterministic_med, |
| 755 | bgp_deterministic_med_cmd, |
| 756 | "bgp deterministic-med", |
| 757 | "BGP specific commands\n" |
| 758 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 759 | { |
| 760 | struct bgp *bgp; |
| 761 | |
| 762 | bgp = vty->index; |
| 763 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 764 | return CMD_SUCCESS; |
| 765 | } |
| 766 | |
| 767 | DEFUN (no_bgp_deterministic_med, |
| 768 | no_bgp_deterministic_med_cmd, |
| 769 | "no bgp deterministic-med", |
| 770 | NO_STR |
| 771 | "BGP specific commands\n" |
| 772 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 773 | { |
| 774 | struct bgp *bgp; |
| 775 | |
| 776 | bgp = vty->index; |
| 777 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 778 | return CMD_SUCCESS; |
| 779 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 780 | |
| 781 | /* "bgp graceful-restart" configuration. */ |
| 782 | DEFUN (bgp_graceful_restart, |
| 783 | bgp_graceful_restart_cmd, |
| 784 | "bgp graceful-restart", |
| 785 | "BGP specific commands\n" |
| 786 | "Graceful restart capability parameters\n") |
| 787 | { |
| 788 | struct bgp *bgp; |
| 789 | |
| 790 | bgp = vty->index; |
| 791 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 792 | return CMD_SUCCESS; |
| 793 | } |
| 794 | |
| 795 | DEFUN (no_bgp_graceful_restart, |
| 796 | no_bgp_graceful_restart_cmd, |
| 797 | "no bgp graceful-restart", |
| 798 | NO_STR |
| 799 | "BGP specific commands\n" |
| 800 | "Graceful restart capability parameters\n") |
| 801 | { |
| 802 | struct bgp *bgp; |
| 803 | |
| 804 | bgp = vty->index; |
| 805 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 806 | return CMD_SUCCESS; |
| 807 | } |
| 808 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 809 | DEFUN (bgp_graceful_restart_stalepath_time, |
| 810 | bgp_graceful_restart_stalepath_time_cmd, |
| 811 | "bgp graceful-restart stalepath-time <1-3600>", |
| 812 | "BGP specific commands\n" |
| 813 | "Graceful restart capability parameters\n" |
| 814 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 815 | "Delay value (seconds)\n") |
| 816 | { |
| 817 | struct bgp *bgp; |
| 818 | u_int32_t stalepath; |
| 819 | |
| 820 | bgp = vty->index; |
| 821 | if (! bgp) |
| 822 | return CMD_WARNING; |
| 823 | |
| 824 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); |
| 825 | bgp->stalepath_time = stalepath; |
| 826 | return CMD_SUCCESS; |
| 827 | } |
| 828 | |
| 829 | DEFUN (no_bgp_graceful_restart_stalepath_time, |
| 830 | no_bgp_graceful_restart_stalepath_time_cmd, |
| 831 | "no bgp graceful-restart stalepath-time", |
| 832 | NO_STR |
| 833 | "BGP specific commands\n" |
| 834 | "Graceful restart capability parameters\n" |
| 835 | "Set the max time to hold onto restarting peer's stale paths\n") |
| 836 | { |
| 837 | struct bgp *bgp; |
| 838 | |
| 839 | bgp = vty->index; |
| 840 | if (! bgp) |
| 841 | return CMD_WARNING; |
| 842 | |
| 843 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; |
| 844 | return CMD_SUCCESS; |
| 845 | } |
| 846 | |
| 847 | ALIAS (no_bgp_graceful_restart_stalepath_time, |
| 848 | no_bgp_graceful_restart_stalepath_time_val_cmd, |
| 849 | "no bgp graceful-restart stalepath-time <1-3600>", |
| 850 | NO_STR |
| 851 | "BGP specific commands\n" |
| 852 | "Graceful restart capability parameters\n" |
| 853 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 854 | "Delay value (seconds)\n") |
| 855 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 856 | /* "bgp fast-external-failover" configuration. */ |
| 857 | DEFUN (bgp_fast_external_failover, |
| 858 | bgp_fast_external_failover_cmd, |
| 859 | "bgp fast-external-failover", |
| 860 | BGP_STR |
| 861 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 862 | { |
| 863 | struct bgp *bgp; |
| 864 | |
| 865 | bgp = vty->index; |
| 866 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 867 | return CMD_SUCCESS; |
| 868 | } |
| 869 | |
| 870 | DEFUN (no_bgp_fast_external_failover, |
| 871 | no_bgp_fast_external_failover_cmd, |
| 872 | "no bgp fast-external-failover", |
| 873 | NO_STR |
| 874 | BGP_STR |
| 875 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 876 | { |
| 877 | struct bgp *bgp; |
| 878 | |
| 879 | bgp = vty->index; |
| 880 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 881 | return CMD_SUCCESS; |
| 882 | } |
| 883 | |
| 884 | /* "bgp enforce-first-as" configuration. */ |
| 885 | DEFUN (bgp_enforce_first_as, |
| 886 | bgp_enforce_first_as_cmd, |
| 887 | "bgp enforce-first-as", |
| 888 | BGP_STR |
| 889 | "Enforce the first AS for EBGP routes\n") |
| 890 | { |
| 891 | struct bgp *bgp; |
| 892 | |
| 893 | bgp = vty->index; |
| 894 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 895 | return CMD_SUCCESS; |
| 896 | } |
| 897 | |
| 898 | DEFUN (no_bgp_enforce_first_as, |
| 899 | no_bgp_enforce_first_as_cmd, |
| 900 | "no bgp enforce-first-as", |
| 901 | NO_STR |
| 902 | BGP_STR |
| 903 | "Enforce the first AS for EBGP routes\n") |
| 904 | { |
| 905 | struct bgp *bgp; |
| 906 | |
| 907 | bgp = vty->index; |
| 908 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 909 | return CMD_SUCCESS; |
| 910 | } |
| 911 | |
| 912 | /* "bgp bestpath compare-routerid" configuration. */ |
| 913 | DEFUN (bgp_bestpath_compare_router_id, |
| 914 | bgp_bestpath_compare_router_id_cmd, |
| 915 | "bgp bestpath compare-routerid", |
| 916 | "BGP specific commands\n" |
| 917 | "Change the default bestpath selection\n" |
| 918 | "Compare router-id for identical EBGP paths\n") |
| 919 | { |
| 920 | struct bgp *bgp; |
| 921 | |
| 922 | bgp = vty->index; |
| 923 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 924 | return CMD_SUCCESS; |
| 925 | } |
| 926 | |
| 927 | DEFUN (no_bgp_bestpath_compare_router_id, |
| 928 | no_bgp_bestpath_compare_router_id_cmd, |
| 929 | "no bgp bestpath compare-routerid", |
| 930 | NO_STR |
| 931 | "BGP specific commands\n" |
| 932 | "Change the default bestpath selection\n" |
| 933 | "Compare router-id for identical EBGP paths\n") |
| 934 | { |
| 935 | struct bgp *bgp; |
| 936 | |
| 937 | bgp = vty->index; |
| 938 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 939 | return CMD_SUCCESS; |
| 940 | } |
| 941 | |
| 942 | /* "bgp bestpath as-path ignore" configuration. */ |
| 943 | DEFUN (bgp_bestpath_aspath_ignore, |
| 944 | bgp_bestpath_aspath_ignore_cmd, |
| 945 | "bgp bestpath as-path ignore", |
| 946 | "BGP specific commands\n" |
| 947 | "Change the default bestpath selection\n" |
| 948 | "AS-path attribute\n" |
| 949 | "Ignore as-path length in selecting a route\n") |
| 950 | { |
| 951 | struct bgp *bgp; |
| 952 | |
| 953 | bgp = vty->index; |
| 954 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 955 | return CMD_SUCCESS; |
| 956 | } |
| 957 | |
| 958 | DEFUN (no_bgp_bestpath_aspath_ignore, |
| 959 | no_bgp_bestpath_aspath_ignore_cmd, |
| 960 | "no bgp bestpath as-path ignore", |
| 961 | NO_STR |
| 962 | "BGP specific commands\n" |
| 963 | "Change the default bestpath selection\n" |
| 964 | "AS-path attribute\n" |
| 965 | "Ignore as-path length in selecting a route\n") |
| 966 | { |
| 967 | struct bgp *bgp; |
| 968 | |
| 969 | bgp = vty->index; |
| 970 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 971 | return CMD_SUCCESS; |
| 972 | } |
| 973 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 974 | /* "bgp bestpath as-path confed" configuration. */ |
| 975 | DEFUN (bgp_bestpath_aspath_confed, |
| 976 | bgp_bestpath_aspath_confed_cmd, |
| 977 | "bgp bestpath as-path confed", |
| 978 | "BGP specific commands\n" |
| 979 | "Change the default bestpath selection\n" |
| 980 | "AS-path attribute\n" |
| 981 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 982 | { |
| 983 | struct bgp *bgp; |
| 984 | |
| 985 | bgp = vty->index; |
| 986 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); |
| 987 | return CMD_SUCCESS; |
| 988 | } |
| 989 | |
| 990 | DEFUN (no_bgp_bestpath_aspath_confed, |
| 991 | no_bgp_bestpath_aspath_confed_cmd, |
| 992 | "no bgp bestpath as-path confed", |
| 993 | NO_STR |
| 994 | "BGP specific commands\n" |
| 995 | "Change the default bestpath selection\n" |
| 996 | "AS-path attribute\n" |
| 997 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 998 | { |
| 999 | struct bgp *bgp; |
| 1000 | |
| 1001 | bgp = vty->index; |
| 1002 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); |
| 1003 | return CMD_SUCCESS; |
| 1004 | } |
| 1005 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 1006 | /* "bgp log-neighbor-changes" configuration. */ |
| 1007 | DEFUN (bgp_log_neighbor_changes, |
| 1008 | bgp_log_neighbor_changes_cmd, |
| 1009 | "bgp log-neighbor-changes", |
| 1010 | "BGP specific commands\n" |
| 1011 | "Log neighbor up/down and reset reason\n") |
| 1012 | { |
| 1013 | struct bgp *bgp; |
| 1014 | |
| 1015 | bgp = vty->index; |
| 1016 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1017 | return CMD_SUCCESS; |
| 1018 | } |
| 1019 | |
| 1020 | DEFUN (no_bgp_log_neighbor_changes, |
| 1021 | no_bgp_log_neighbor_changes_cmd, |
| 1022 | "no bgp log-neighbor-changes", |
| 1023 | NO_STR |
| 1024 | "BGP specific commands\n" |
| 1025 | "Log neighbor up/down and reset reason\n") |
| 1026 | { |
| 1027 | struct bgp *bgp; |
| 1028 | |
| 1029 | bgp = vty->index; |
| 1030 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1031 | return CMD_SUCCESS; |
| 1032 | } |
| 1033 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1034 | /* "bgp bestpath med" configuration. */ |
| 1035 | DEFUN (bgp_bestpath_med, |
| 1036 | bgp_bestpath_med_cmd, |
| 1037 | "bgp bestpath med (confed|missing-as-worst)", |
| 1038 | "BGP specific commands\n" |
| 1039 | "Change the default bestpath selection\n" |
| 1040 | "MED attribute\n" |
| 1041 | "Compare MED among confederation paths\n" |
| 1042 | "Treat missing MED as the least preferred one\n") |
| 1043 | { |
| 1044 | struct bgp *bgp; |
| 1045 | |
| 1046 | bgp = vty->index; |
| 1047 | |
| 1048 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1049 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1050 | else |
| 1051 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1052 | |
| 1053 | return CMD_SUCCESS; |
| 1054 | } |
| 1055 | |
| 1056 | DEFUN (bgp_bestpath_med2, |
| 1057 | bgp_bestpath_med2_cmd, |
| 1058 | "bgp bestpath med confed missing-as-worst", |
| 1059 | "BGP specific commands\n" |
| 1060 | "Change the default bestpath selection\n" |
| 1061 | "MED attribute\n" |
| 1062 | "Compare MED among confederation paths\n" |
| 1063 | "Treat missing MED as the least preferred one\n") |
| 1064 | { |
| 1065 | struct bgp *bgp; |
| 1066 | |
| 1067 | bgp = vty->index; |
| 1068 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1069 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1070 | return CMD_SUCCESS; |
| 1071 | } |
| 1072 | |
| 1073 | ALIAS (bgp_bestpath_med2, |
| 1074 | bgp_bestpath_med3_cmd, |
| 1075 | "bgp bestpath med missing-as-worst confed", |
| 1076 | "BGP specific commands\n" |
| 1077 | "Change the default bestpath selection\n" |
| 1078 | "MED attribute\n" |
| 1079 | "Treat missing MED as the least preferred one\n" |
| 1080 | "Compare MED among confederation paths\n") |
| 1081 | |
| 1082 | DEFUN (no_bgp_bestpath_med, |
| 1083 | no_bgp_bestpath_med_cmd, |
| 1084 | "no bgp bestpath med (confed|missing-as-worst)", |
| 1085 | NO_STR |
| 1086 | "BGP specific commands\n" |
| 1087 | "Change the default bestpath selection\n" |
| 1088 | "MED attribute\n" |
| 1089 | "Compare MED among confederation paths\n" |
| 1090 | "Treat missing MED as the least preferred one\n") |
| 1091 | { |
| 1092 | struct bgp *bgp; |
| 1093 | |
| 1094 | bgp = vty->index; |
| 1095 | |
| 1096 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1097 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1098 | else |
| 1099 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1100 | |
| 1101 | return CMD_SUCCESS; |
| 1102 | } |
| 1103 | |
| 1104 | DEFUN (no_bgp_bestpath_med2, |
| 1105 | no_bgp_bestpath_med2_cmd, |
| 1106 | "no bgp bestpath med confed missing-as-worst", |
| 1107 | NO_STR |
| 1108 | "BGP specific commands\n" |
| 1109 | "Change the default bestpath selection\n" |
| 1110 | "MED attribute\n" |
| 1111 | "Compare MED among confederation paths\n" |
| 1112 | "Treat missing MED as the least preferred one\n") |
| 1113 | { |
| 1114 | struct bgp *bgp; |
| 1115 | |
| 1116 | bgp = vty->index; |
| 1117 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1118 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1119 | return CMD_SUCCESS; |
| 1120 | } |
| 1121 | |
| 1122 | ALIAS (no_bgp_bestpath_med2, |
| 1123 | no_bgp_bestpath_med3_cmd, |
| 1124 | "no bgp bestpath med missing-as-worst confed", |
| 1125 | NO_STR |
| 1126 | "BGP specific commands\n" |
| 1127 | "Change the default bestpath selection\n" |
| 1128 | "MED attribute\n" |
| 1129 | "Treat missing MED as the least preferred one\n" |
| 1130 | "Compare MED among confederation paths\n") |
| 1131 | |
| 1132 | /* "no bgp default ipv4-unicast". */ |
| 1133 | DEFUN (no_bgp_default_ipv4_unicast, |
| 1134 | no_bgp_default_ipv4_unicast_cmd, |
| 1135 | "no bgp default ipv4-unicast", |
| 1136 | NO_STR |
| 1137 | "BGP specific commands\n" |
| 1138 | "Configure BGP defaults\n" |
| 1139 | "Activate ipv4-unicast for a peer by default\n") |
| 1140 | { |
| 1141 | struct bgp *bgp; |
| 1142 | |
| 1143 | bgp = vty->index; |
| 1144 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1145 | return CMD_SUCCESS; |
| 1146 | } |
| 1147 | |
| 1148 | DEFUN (bgp_default_ipv4_unicast, |
| 1149 | bgp_default_ipv4_unicast_cmd, |
| 1150 | "bgp default ipv4-unicast", |
| 1151 | "BGP specific commands\n" |
| 1152 | "Configure BGP defaults\n" |
| 1153 | "Activate ipv4-unicast for a peer by default\n") |
| 1154 | { |
| 1155 | struct bgp *bgp; |
| 1156 | |
| 1157 | bgp = vty->index; |
| 1158 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1159 | return CMD_SUCCESS; |
| 1160 | } |
| 1161 | |
| 1162 | /* "bgp import-check" configuration. */ |
| 1163 | DEFUN (bgp_network_import_check, |
| 1164 | bgp_network_import_check_cmd, |
| 1165 | "bgp network import-check", |
| 1166 | "BGP specific commands\n" |
| 1167 | "BGP network command\n" |
| 1168 | "Check BGP network route exists in IGP\n") |
| 1169 | { |
| 1170 | struct bgp *bgp; |
| 1171 | |
| 1172 | bgp = vty->index; |
| 1173 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1174 | return CMD_SUCCESS; |
| 1175 | } |
| 1176 | |
| 1177 | DEFUN (no_bgp_network_import_check, |
| 1178 | no_bgp_network_import_check_cmd, |
| 1179 | "no bgp network import-check", |
| 1180 | NO_STR |
| 1181 | "BGP specific commands\n" |
| 1182 | "BGP network command\n" |
| 1183 | "Check BGP network route exists in IGP\n") |
| 1184 | { |
| 1185 | struct bgp *bgp; |
| 1186 | |
| 1187 | bgp = vty->index; |
| 1188 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1189 | return CMD_SUCCESS; |
| 1190 | } |
| 1191 | |
| 1192 | DEFUN (bgp_default_local_preference, |
| 1193 | bgp_default_local_preference_cmd, |
| 1194 | "bgp default local-preference <0-4294967295>", |
| 1195 | "BGP specific commands\n" |
| 1196 | "Configure BGP defaults\n" |
| 1197 | "local preference (higher=more preferred)\n" |
| 1198 | "Configure default local preference value\n") |
| 1199 | { |
| 1200 | struct bgp *bgp; |
| 1201 | u_int32_t local_pref; |
| 1202 | |
| 1203 | bgp = vty->index; |
| 1204 | |
| 1205 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); |
| 1206 | |
| 1207 | bgp_default_local_preference_set (bgp, local_pref); |
| 1208 | |
| 1209 | return CMD_SUCCESS; |
| 1210 | } |
| 1211 | |
| 1212 | DEFUN (no_bgp_default_local_preference, |
| 1213 | no_bgp_default_local_preference_cmd, |
| 1214 | "no bgp default local-preference", |
| 1215 | NO_STR |
| 1216 | "BGP specific commands\n" |
| 1217 | "Configure BGP defaults\n" |
| 1218 | "local preference (higher=more preferred)\n") |
| 1219 | { |
| 1220 | struct bgp *bgp; |
| 1221 | |
| 1222 | bgp = vty->index; |
| 1223 | bgp_default_local_preference_unset (bgp); |
| 1224 | return CMD_SUCCESS; |
| 1225 | } |
| 1226 | |
| 1227 | ALIAS (no_bgp_default_local_preference, |
| 1228 | no_bgp_default_local_preference_val_cmd, |
| 1229 | "no bgp default local-preference <0-4294967295>", |
| 1230 | NO_STR |
| 1231 | "BGP specific commands\n" |
| 1232 | "Configure BGP defaults\n" |
| 1233 | "local preference (higher=more preferred)\n" |
| 1234 | "Configure default local preference value\n") |
| 1235 | |
| 1236 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1237 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
| 1238 | const char *as_str, afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1239 | { |
| 1240 | int ret; |
| 1241 | struct bgp *bgp; |
| 1242 | as_t as; |
| 1243 | union sockunion su; |
| 1244 | |
| 1245 | bgp = vty->index; |
| 1246 | |
| 1247 | /* Get AS number. */ |
| 1248 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, 65535); |
| 1249 | |
| 1250 | /* If peer is peer group, call proper function. */ |
| 1251 | ret = str2sockunion (peer_str, &su); |
| 1252 | if (ret < 0) |
| 1253 | { |
| 1254 | ret = peer_group_remote_as (bgp, peer_str, &as); |
| 1255 | if (ret < 0) |
| 1256 | { |
| 1257 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1258 | return CMD_WARNING; |
| 1259 | } |
| 1260 | return CMD_SUCCESS; |
| 1261 | } |
| 1262 | |
| 1263 | if (peer_address_self_check (&su)) |
| 1264 | { |
| 1265 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1266 | VTY_NEWLINE); |
| 1267 | return CMD_WARNING; |
| 1268 | } |
| 1269 | |
| 1270 | ret = peer_remote_as (bgp, &su, &as, afi, safi); |
| 1271 | |
| 1272 | /* This peer belongs to peer group. */ |
| 1273 | switch (ret) |
| 1274 | { |
| 1275 | case BGP_ERR_PEER_GROUP_MEMBER: |
| 1276 | vty_out (vty, "%% Peer-group AS %d. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
| 1277 | return CMD_WARNING; |
| 1278 | break; |
| 1279 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
| 1280 | 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); |
| 1281 | return CMD_WARNING; |
| 1282 | break; |
| 1283 | } |
| 1284 | return bgp_vty_return (vty, ret); |
| 1285 | } |
| 1286 | |
| 1287 | DEFUN (neighbor_remote_as, |
| 1288 | neighbor_remote_as_cmd, |
| 1289 | NEIGHBOR_CMD2 "remote-as <1-65535>", |
| 1290 | NEIGHBOR_STR |
| 1291 | NEIGHBOR_ADDR_STR2 |
| 1292 | "Specify a BGP neighbor\n" |
| 1293 | AS_STR) |
| 1294 | { |
| 1295 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); |
| 1296 | } |
| 1297 | |
| 1298 | DEFUN (neighbor_peer_group, |
| 1299 | neighbor_peer_group_cmd, |
| 1300 | "neighbor WORD peer-group", |
| 1301 | NEIGHBOR_STR |
| 1302 | "Neighbor tag\n" |
| 1303 | "Configure peer-group\n") |
| 1304 | { |
| 1305 | struct bgp *bgp; |
| 1306 | struct peer_group *group; |
| 1307 | |
| 1308 | bgp = vty->index; |
| 1309 | |
| 1310 | group = peer_group_get (bgp, argv[0]); |
| 1311 | if (! group) |
| 1312 | return CMD_WARNING; |
| 1313 | |
| 1314 | return CMD_SUCCESS; |
| 1315 | } |
| 1316 | |
| 1317 | DEFUN (no_neighbor, |
| 1318 | no_neighbor_cmd, |
| 1319 | NO_NEIGHBOR_CMD2, |
| 1320 | NO_STR |
| 1321 | NEIGHBOR_STR |
| 1322 | NEIGHBOR_ADDR_STR2) |
| 1323 | { |
| 1324 | int ret; |
| 1325 | union sockunion su; |
| 1326 | struct peer_group *group; |
| 1327 | struct peer *peer; |
| 1328 | |
| 1329 | ret = str2sockunion (argv[0], &su); |
| 1330 | if (ret < 0) |
| 1331 | { |
| 1332 | group = peer_group_lookup (vty->index, argv[0]); |
| 1333 | if (group) |
| 1334 | peer_group_delete (group); |
| 1335 | else |
| 1336 | { |
| 1337 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1338 | return CMD_WARNING; |
| 1339 | } |
| 1340 | } |
| 1341 | else |
| 1342 | { |
| 1343 | peer = peer_lookup (vty->index, &su); |
| 1344 | if (peer) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 1345 | peer_delete (peer); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1346 | } |
| 1347 | |
| 1348 | return CMD_SUCCESS; |
| 1349 | } |
| 1350 | |
| 1351 | ALIAS (no_neighbor, |
| 1352 | no_neighbor_remote_as_cmd, |
| 1353 | NO_NEIGHBOR_CMD "remote-as <1-65535>", |
| 1354 | NO_STR |
| 1355 | NEIGHBOR_STR |
| 1356 | NEIGHBOR_ADDR_STR |
| 1357 | "Specify a BGP neighbor\n" |
| 1358 | AS_STR) |
| 1359 | |
| 1360 | DEFUN (no_neighbor_peer_group, |
| 1361 | no_neighbor_peer_group_cmd, |
| 1362 | "no neighbor WORD peer-group", |
| 1363 | NO_STR |
| 1364 | NEIGHBOR_STR |
| 1365 | "Neighbor tag\n" |
| 1366 | "Configure peer-group\n") |
| 1367 | { |
| 1368 | struct peer_group *group; |
| 1369 | |
| 1370 | group = peer_group_lookup (vty->index, argv[0]); |
| 1371 | if (group) |
| 1372 | peer_group_delete (group); |
| 1373 | else |
| 1374 | { |
| 1375 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1376 | return CMD_WARNING; |
| 1377 | } |
| 1378 | return CMD_SUCCESS; |
| 1379 | } |
| 1380 | |
| 1381 | DEFUN (no_neighbor_peer_group_remote_as, |
| 1382 | no_neighbor_peer_group_remote_as_cmd, |
| 1383 | "no neighbor WORD remote-as <1-65535>", |
| 1384 | NO_STR |
| 1385 | NEIGHBOR_STR |
| 1386 | "Neighbor tag\n" |
| 1387 | "Specify a BGP neighbor\n" |
| 1388 | AS_STR) |
| 1389 | { |
| 1390 | struct peer_group *group; |
| 1391 | |
| 1392 | group = peer_group_lookup (vty->index, argv[0]); |
| 1393 | if (group) |
| 1394 | peer_group_remote_as_delete (group); |
| 1395 | else |
| 1396 | { |
| 1397 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1398 | return CMD_WARNING; |
| 1399 | } |
| 1400 | return CMD_SUCCESS; |
| 1401 | } |
| 1402 | |
| 1403 | DEFUN (neighbor_local_as, |
| 1404 | neighbor_local_as_cmd, |
| 1405 | NEIGHBOR_CMD2 "local-as <1-65535>", |
| 1406 | NEIGHBOR_STR |
| 1407 | NEIGHBOR_ADDR_STR2 |
| 1408 | "Specify a local-as number\n" |
| 1409 | "AS number used as local AS\n") |
| 1410 | { |
| 1411 | struct peer *peer; |
| 1412 | int ret; |
| 1413 | |
| 1414 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1415 | if (! peer) |
| 1416 | return CMD_WARNING; |
| 1417 | |
| 1418 | ret = peer_local_as_set (peer, atoi (argv[1]), 0); |
| 1419 | return bgp_vty_return (vty, ret); |
| 1420 | } |
| 1421 | |
| 1422 | DEFUN (neighbor_local_as_no_prepend, |
| 1423 | neighbor_local_as_no_prepend_cmd, |
| 1424 | NEIGHBOR_CMD2 "local-as <1-65535> no-prepend", |
| 1425 | NEIGHBOR_STR |
| 1426 | NEIGHBOR_ADDR_STR2 |
| 1427 | "Specify a local-as number\n" |
| 1428 | "AS number used as local AS\n" |
| 1429 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1430 | { |
| 1431 | struct peer *peer; |
| 1432 | int ret; |
| 1433 | |
| 1434 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1435 | if (! peer) |
| 1436 | return CMD_WARNING; |
| 1437 | |
| 1438 | ret = peer_local_as_set (peer, atoi (argv[1]), 1); |
| 1439 | return bgp_vty_return (vty, ret); |
| 1440 | } |
| 1441 | |
| 1442 | DEFUN (no_neighbor_local_as, |
| 1443 | no_neighbor_local_as_cmd, |
| 1444 | NO_NEIGHBOR_CMD2 "local-as", |
| 1445 | NO_STR |
| 1446 | NEIGHBOR_STR |
| 1447 | NEIGHBOR_ADDR_STR2 |
| 1448 | "Specify a local-as number\n") |
| 1449 | { |
| 1450 | struct peer *peer; |
| 1451 | int ret; |
| 1452 | |
| 1453 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1454 | if (! peer) |
| 1455 | return CMD_WARNING; |
| 1456 | |
| 1457 | ret = peer_local_as_unset (peer); |
| 1458 | return bgp_vty_return (vty, ret); |
| 1459 | } |
| 1460 | |
| 1461 | ALIAS (no_neighbor_local_as, |
| 1462 | no_neighbor_local_as_val_cmd, |
| 1463 | NO_NEIGHBOR_CMD2 "local-as <1-65535>", |
| 1464 | NO_STR |
| 1465 | NEIGHBOR_STR |
| 1466 | NEIGHBOR_ADDR_STR2 |
| 1467 | "Specify a local-as number\n" |
| 1468 | "AS number used as local AS\n") |
| 1469 | |
| 1470 | ALIAS (no_neighbor_local_as, |
| 1471 | no_neighbor_local_as_val2_cmd, |
| 1472 | NO_NEIGHBOR_CMD2 "local-as <1-65535> no-prepend", |
| 1473 | NO_STR |
| 1474 | NEIGHBOR_STR |
| 1475 | NEIGHBOR_ADDR_STR2 |
| 1476 | "Specify a local-as number\n" |
| 1477 | "AS number used as local AS\n" |
| 1478 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1479 | |
| 1480 | DEFUN (neighbor_activate, |
| 1481 | neighbor_activate_cmd, |
| 1482 | NEIGHBOR_CMD2 "activate", |
| 1483 | NEIGHBOR_STR |
| 1484 | NEIGHBOR_ADDR_STR2 |
| 1485 | "Enable the Address Family for this Neighbor\n") |
| 1486 | { |
| 1487 | struct peer *peer; |
| 1488 | |
| 1489 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1490 | if (! peer) |
| 1491 | return CMD_WARNING; |
| 1492 | |
| 1493 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1494 | |
| 1495 | return CMD_SUCCESS; |
| 1496 | } |
| 1497 | |
| 1498 | DEFUN (no_neighbor_activate, |
| 1499 | no_neighbor_activate_cmd, |
| 1500 | NO_NEIGHBOR_CMD2 "activate", |
| 1501 | NO_STR |
| 1502 | NEIGHBOR_STR |
| 1503 | NEIGHBOR_ADDR_STR2 |
| 1504 | "Enable the Address Family for this Neighbor\n") |
| 1505 | { |
| 1506 | int ret; |
| 1507 | struct peer *peer; |
| 1508 | |
| 1509 | /* Lookup peer. */ |
| 1510 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1511 | if (! peer) |
| 1512 | return CMD_WARNING; |
| 1513 | |
| 1514 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1515 | |
| 1516 | return bgp_vty_return (vty, ret); |
| 1517 | } |
| 1518 | |
| 1519 | DEFUN (neighbor_set_peer_group, |
| 1520 | neighbor_set_peer_group_cmd, |
| 1521 | NEIGHBOR_CMD "peer-group WORD", |
| 1522 | NEIGHBOR_STR |
| 1523 | NEIGHBOR_ADDR_STR |
| 1524 | "Member of the peer-group\n" |
| 1525 | "peer-group name\n") |
| 1526 | { |
| 1527 | int ret; |
| 1528 | as_t as; |
| 1529 | union sockunion su; |
| 1530 | struct bgp *bgp; |
| 1531 | struct peer_group *group; |
| 1532 | |
| 1533 | bgp = vty->index; |
| 1534 | |
| 1535 | ret = str2sockunion (argv[0], &su); |
| 1536 | if (ret < 0) |
| 1537 | { |
| 1538 | vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); |
| 1539 | return CMD_WARNING; |
| 1540 | } |
| 1541 | |
| 1542 | group = peer_group_lookup (bgp, argv[1]); |
| 1543 | if (! group) |
| 1544 | { |
| 1545 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1546 | return CMD_WARNING; |
| 1547 | } |
| 1548 | |
| 1549 | if (peer_address_self_check (&su)) |
| 1550 | { |
| 1551 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1552 | VTY_NEWLINE); |
| 1553 | return CMD_WARNING; |
| 1554 | } |
| 1555 | |
| 1556 | ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty), |
| 1557 | bgp_node_safi (vty), &as); |
| 1558 | |
| 1559 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) |
| 1560 | { |
| 1561 | 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); |
| 1562 | return CMD_WARNING; |
| 1563 | } |
| 1564 | |
| 1565 | return bgp_vty_return (vty, ret); |
| 1566 | } |
| 1567 | |
| 1568 | DEFUN (no_neighbor_set_peer_group, |
| 1569 | no_neighbor_set_peer_group_cmd, |
| 1570 | NO_NEIGHBOR_CMD "peer-group WORD", |
| 1571 | NO_STR |
| 1572 | NEIGHBOR_STR |
| 1573 | NEIGHBOR_ADDR_STR |
| 1574 | "Member of the peer-group\n" |
| 1575 | "peer-group name\n") |
| 1576 | { |
| 1577 | int ret; |
| 1578 | struct bgp *bgp; |
| 1579 | struct peer *peer; |
| 1580 | struct peer_group *group; |
| 1581 | |
| 1582 | bgp = vty->index; |
| 1583 | |
| 1584 | peer = peer_lookup_vty (vty, argv[0]); |
| 1585 | if (! peer) |
| 1586 | return CMD_WARNING; |
| 1587 | |
| 1588 | group = peer_group_lookup (bgp, argv[1]); |
| 1589 | if (! group) |
| 1590 | { |
| 1591 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1592 | return CMD_WARNING; |
| 1593 | } |
| 1594 | |
| 1595 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), |
| 1596 | bgp_node_safi (vty)); |
| 1597 | |
| 1598 | return bgp_vty_return (vty, ret); |
| 1599 | } |
| 1600 | |
| 1601 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1602 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
| 1603 | u_int16_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1604 | { |
| 1605 | int ret; |
| 1606 | struct peer *peer; |
| 1607 | |
| 1608 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 1609 | if (! peer) |
| 1610 | return CMD_WARNING; |
| 1611 | |
| 1612 | if (set) |
| 1613 | ret = peer_flag_set (peer, flag); |
| 1614 | else |
| 1615 | ret = peer_flag_unset (peer, flag); |
| 1616 | |
| 1617 | return bgp_vty_return (vty, ret); |
| 1618 | } |
| 1619 | |
| 1620 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1621 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1622 | { |
| 1623 | return peer_flag_modify_vty (vty, ip_str, flag, 1); |
| 1624 | } |
| 1625 | |
| 1626 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1627 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1628 | { |
| 1629 | return peer_flag_modify_vty (vty, ip_str, flag, 0); |
| 1630 | } |
| 1631 | |
| 1632 | /* neighbor passive. */ |
| 1633 | DEFUN (neighbor_passive, |
| 1634 | neighbor_passive_cmd, |
| 1635 | NEIGHBOR_CMD2 "passive", |
| 1636 | NEIGHBOR_STR |
| 1637 | NEIGHBOR_ADDR_STR2 |
| 1638 | "Don't send open messages to this neighbor\n") |
| 1639 | { |
| 1640 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1641 | } |
| 1642 | |
| 1643 | DEFUN (no_neighbor_passive, |
| 1644 | no_neighbor_passive_cmd, |
| 1645 | NO_NEIGHBOR_CMD2 "passive", |
| 1646 | NO_STR |
| 1647 | NEIGHBOR_STR |
| 1648 | NEIGHBOR_ADDR_STR2 |
| 1649 | "Don't send open messages to this neighbor\n") |
| 1650 | { |
| 1651 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1652 | } |
| 1653 | |
| 1654 | /* neighbor shutdown. */ |
| 1655 | DEFUN (neighbor_shutdown, |
| 1656 | neighbor_shutdown_cmd, |
| 1657 | NEIGHBOR_CMD2 "shutdown", |
| 1658 | NEIGHBOR_STR |
| 1659 | NEIGHBOR_ADDR_STR2 |
| 1660 | "Administratively shut down this neighbor\n") |
| 1661 | { |
| 1662 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1663 | } |
| 1664 | |
| 1665 | DEFUN (no_neighbor_shutdown, |
| 1666 | no_neighbor_shutdown_cmd, |
| 1667 | NO_NEIGHBOR_CMD2 "shutdown", |
| 1668 | NO_STR |
| 1669 | NEIGHBOR_STR |
| 1670 | NEIGHBOR_ADDR_STR2 |
| 1671 | "Administratively shut down this neighbor\n") |
| 1672 | { |
| 1673 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1674 | } |
| 1675 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1676 | /* Deprecated neighbor capability route-refresh. */ |
| 1677 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, |
| 1678 | neighbor_capability_route_refresh_cmd, |
| 1679 | NEIGHBOR_CMD2 "capability route-refresh", |
| 1680 | NEIGHBOR_STR |
| 1681 | NEIGHBOR_ADDR_STR2 |
| 1682 | "Advertise capability to the peer\n" |
| 1683 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1684 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1685 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1686 | } |
| 1687 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1688 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
| 1689 | no_neighbor_capability_route_refresh_cmd, |
| 1690 | NO_NEIGHBOR_CMD2 "capability route-refresh", |
| 1691 | NO_STR |
| 1692 | NEIGHBOR_STR |
| 1693 | NEIGHBOR_ADDR_STR2 |
| 1694 | "Advertise capability to the peer\n" |
| 1695 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1696 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1697 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1698 | } |
| 1699 | |
| 1700 | /* neighbor capability dynamic. */ |
| 1701 | DEFUN (neighbor_capability_dynamic, |
| 1702 | neighbor_capability_dynamic_cmd, |
| 1703 | NEIGHBOR_CMD2 "capability dynamic", |
| 1704 | NEIGHBOR_STR |
| 1705 | NEIGHBOR_ADDR_STR2 |
| 1706 | "Advertise capability to the peer\n" |
| 1707 | "Advertise dynamic capability to this neighbor\n") |
| 1708 | { |
| 1709 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1710 | } |
| 1711 | |
| 1712 | DEFUN (no_neighbor_capability_dynamic, |
| 1713 | no_neighbor_capability_dynamic_cmd, |
| 1714 | NO_NEIGHBOR_CMD2 "capability dynamic", |
| 1715 | NO_STR |
| 1716 | NEIGHBOR_STR |
| 1717 | NEIGHBOR_ADDR_STR2 |
| 1718 | "Advertise capability to the peer\n" |
| 1719 | "Advertise dynamic capability to this neighbor\n") |
| 1720 | { |
| 1721 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1722 | } |
| 1723 | |
| 1724 | /* neighbor dont-capability-negotiate */ |
| 1725 | DEFUN (neighbor_dont_capability_negotiate, |
| 1726 | neighbor_dont_capability_negotiate_cmd, |
| 1727 | NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1728 | NEIGHBOR_STR |
| 1729 | NEIGHBOR_ADDR_STR2 |
| 1730 | "Do not perform capability negotiation\n") |
| 1731 | { |
| 1732 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1733 | } |
| 1734 | |
| 1735 | DEFUN (no_neighbor_dont_capability_negotiate, |
| 1736 | no_neighbor_dont_capability_negotiate_cmd, |
| 1737 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1738 | NO_STR |
| 1739 | NEIGHBOR_STR |
| 1740 | NEIGHBOR_ADDR_STR2 |
| 1741 | "Do not perform capability negotiation\n") |
| 1742 | { |
| 1743 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1744 | } |
| 1745 | |
| 1746 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1747 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 1748 | safi_t safi, u_int32_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1749 | { |
| 1750 | int ret; |
| 1751 | struct peer *peer; |
| 1752 | |
| 1753 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 1754 | if (! peer) |
| 1755 | return CMD_WARNING; |
| 1756 | |
| 1757 | if (set) |
| 1758 | ret = peer_af_flag_set (peer, afi, safi, flag); |
| 1759 | else |
| 1760 | ret = peer_af_flag_unset (peer, afi, safi, flag); |
| 1761 | |
| 1762 | return bgp_vty_return (vty, ret); |
| 1763 | } |
| 1764 | |
| 1765 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1766 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 1767 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1768 | { |
| 1769 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); |
| 1770 | } |
| 1771 | |
| 1772 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1773 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 1774 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1775 | { |
| 1776 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); |
| 1777 | } |
| 1778 | |
| 1779 | /* neighbor capability orf prefix-list. */ |
| 1780 | DEFUN (neighbor_capability_orf_prefix, |
| 1781 | neighbor_capability_orf_prefix_cmd, |
| 1782 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 1783 | NEIGHBOR_STR |
| 1784 | NEIGHBOR_ADDR_STR2 |
| 1785 | "Advertise capability to the peer\n" |
| 1786 | "Advertise ORF capability to the peer\n" |
| 1787 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 1788 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 1789 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 1790 | "Capability to SEND the ORF to this neighbor\n") |
| 1791 | { |
| 1792 | u_int16_t flag = 0; |
| 1793 | |
| 1794 | if (strncmp (argv[1], "s", 1) == 0) |
| 1795 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 1796 | else if (strncmp (argv[1], "r", 1) == 0) |
| 1797 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 1798 | else if (strncmp (argv[1], "b", 1) == 0) |
| 1799 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 1800 | else |
| 1801 | return CMD_WARNING; |
| 1802 | |
| 1803 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1804 | bgp_node_safi (vty), flag); |
| 1805 | } |
| 1806 | |
| 1807 | DEFUN (no_neighbor_capability_orf_prefix, |
| 1808 | no_neighbor_capability_orf_prefix_cmd, |
| 1809 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 1810 | NO_STR |
| 1811 | NEIGHBOR_STR |
| 1812 | NEIGHBOR_ADDR_STR2 |
| 1813 | "Advertise capability to the peer\n" |
| 1814 | "Advertise ORF capability to the peer\n" |
| 1815 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 1816 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 1817 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 1818 | "Capability to SEND the ORF to this neighbor\n") |
| 1819 | { |
| 1820 | u_int16_t flag = 0; |
| 1821 | |
| 1822 | if (strncmp (argv[1], "s", 1) == 0) |
| 1823 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 1824 | else if (strncmp (argv[1], "r", 1) == 0) |
| 1825 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 1826 | else if (strncmp (argv[1], "b", 1) == 0) |
| 1827 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 1828 | else |
| 1829 | return CMD_WARNING; |
| 1830 | |
| 1831 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1832 | bgp_node_safi (vty), flag); |
| 1833 | } |
| 1834 | |
| 1835 | /* neighbor next-hop-self. */ |
| 1836 | DEFUN (neighbor_nexthop_self, |
| 1837 | neighbor_nexthop_self_cmd, |
| 1838 | NEIGHBOR_CMD2 "next-hop-self", |
| 1839 | NEIGHBOR_STR |
| 1840 | NEIGHBOR_ADDR_STR2 |
| 1841 | "Disable the next hop calculation for this neighbor\n") |
| 1842 | { |
| 1843 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1844 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 1845 | } |
| 1846 | |
| 1847 | DEFUN (no_neighbor_nexthop_self, |
| 1848 | no_neighbor_nexthop_self_cmd, |
| 1849 | NO_NEIGHBOR_CMD2 "next-hop-self", |
| 1850 | NO_STR |
| 1851 | NEIGHBOR_STR |
| 1852 | NEIGHBOR_ADDR_STR2 |
| 1853 | "Disable the next hop calculation for this neighbor\n") |
| 1854 | { |
| 1855 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1856 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 1857 | } |
| 1858 | |
| 1859 | /* neighbor remove-private-AS. */ |
| 1860 | DEFUN (neighbor_remove_private_as, |
| 1861 | neighbor_remove_private_as_cmd, |
| 1862 | NEIGHBOR_CMD2 "remove-private-AS", |
| 1863 | NEIGHBOR_STR |
| 1864 | NEIGHBOR_ADDR_STR2 |
| 1865 | "Remove private AS number from outbound updates\n") |
| 1866 | { |
| 1867 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1868 | bgp_node_safi (vty), |
| 1869 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 1870 | } |
| 1871 | |
| 1872 | DEFUN (no_neighbor_remove_private_as, |
| 1873 | no_neighbor_remove_private_as_cmd, |
| 1874 | NO_NEIGHBOR_CMD2 "remove-private-AS", |
| 1875 | NO_STR |
| 1876 | NEIGHBOR_STR |
| 1877 | NEIGHBOR_ADDR_STR2 |
| 1878 | "Remove private AS number from outbound updates\n") |
| 1879 | { |
| 1880 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1881 | bgp_node_safi (vty), |
| 1882 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 1883 | } |
| 1884 | |
| 1885 | /* neighbor send-community. */ |
| 1886 | DEFUN (neighbor_send_community, |
| 1887 | neighbor_send_community_cmd, |
| 1888 | NEIGHBOR_CMD2 "send-community", |
| 1889 | NEIGHBOR_STR |
| 1890 | NEIGHBOR_ADDR_STR2 |
| 1891 | "Send Community attribute to this neighbor\n") |
| 1892 | { |
| 1893 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1894 | bgp_node_safi (vty), |
| 1895 | PEER_FLAG_SEND_COMMUNITY); |
| 1896 | } |
| 1897 | |
| 1898 | DEFUN (no_neighbor_send_community, |
| 1899 | no_neighbor_send_community_cmd, |
| 1900 | NO_NEIGHBOR_CMD2 "send-community", |
| 1901 | NO_STR |
| 1902 | NEIGHBOR_STR |
| 1903 | NEIGHBOR_ADDR_STR2 |
| 1904 | "Send Community attribute to this neighbor\n") |
| 1905 | { |
| 1906 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1907 | bgp_node_safi (vty), |
| 1908 | PEER_FLAG_SEND_COMMUNITY); |
| 1909 | } |
| 1910 | |
| 1911 | /* neighbor send-community extended. */ |
| 1912 | DEFUN (neighbor_send_community_type, |
| 1913 | neighbor_send_community_type_cmd, |
| 1914 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 1915 | NEIGHBOR_STR |
| 1916 | NEIGHBOR_ADDR_STR2 |
| 1917 | "Send Community attribute to this neighbor\n" |
| 1918 | "Send Standard and Extended Community attributes\n" |
| 1919 | "Send Extended Community attributes\n" |
| 1920 | "Send Standard Community attributes\n") |
| 1921 | { |
| 1922 | if (strncmp (argv[1], "s", 1) == 0) |
| 1923 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1924 | bgp_node_safi (vty), |
| 1925 | PEER_FLAG_SEND_COMMUNITY); |
| 1926 | if (strncmp (argv[1], "e", 1) == 0) |
| 1927 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1928 | bgp_node_safi (vty), |
| 1929 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 1930 | |
| 1931 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1932 | bgp_node_safi (vty), |
| 1933 | (PEER_FLAG_SEND_COMMUNITY| |
| 1934 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 1935 | } |
| 1936 | |
| 1937 | DEFUN (no_neighbor_send_community_type, |
| 1938 | no_neighbor_send_community_type_cmd, |
| 1939 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 1940 | NO_STR |
| 1941 | NEIGHBOR_STR |
| 1942 | NEIGHBOR_ADDR_STR2 |
| 1943 | "Send Community attribute to this neighbor\n" |
| 1944 | "Send Standard and Extended Community attributes\n" |
| 1945 | "Send Extended Community attributes\n" |
| 1946 | "Send Standard Community attributes\n") |
| 1947 | { |
| 1948 | if (strncmp (argv[1], "s", 1) == 0) |
| 1949 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1950 | bgp_node_safi (vty), |
| 1951 | PEER_FLAG_SEND_COMMUNITY); |
| 1952 | if (strncmp (argv[1], "e", 1) == 0) |
| 1953 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1954 | bgp_node_safi (vty), |
| 1955 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 1956 | |
| 1957 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1958 | bgp_node_safi (vty), |
| 1959 | (PEER_FLAG_SEND_COMMUNITY | |
| 1960 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 1961 | } |
| 1962 | |
| 1963 | /* neighbor soft-reconfig. */ |
| 1964 | DEFUN (neighbor_soft_reconfiguration, |
| 1965 | neighbor_soft_reconfiguration_cmd, |
| 1966 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 1967 | NEIGHBOR_STR |
| 1968 | NEIGHBOR_ADDR_STR2 |
| 1969 | "Per neighbor soft reconfiguration\n" |
| 1970 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 1971 | { |
| 1972 | return peer_af_flag_set_vty (vty, argv[0], |
| 1973 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 1974 | PEER_FLAG_SOFT_RECONFIG); |
| 1975 | } |
| 1976 | |
| 1977 | DEFUN (no_neighbor_soft_reconfiguration, |
| 1978 | no_neighbor_soft_reconfiguration_cmd, |
| 1979 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 1980 | NO_STR |
| 1981 | NEIGHBOR_STR |
| 1982 | NEIGHBOR_ADDR_STR2 |
| 1983 | "Per neighbor soft reconfiguration\n" |
| 1984 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 1985 | { |
| 1986 | return peer_af_flag_unset_vty (vty, argv[0], |
| 1987 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 1988 | PEER_FLAG_SOFT_RECONFIG); |
| 1989 | } |
| 1990 | |
| 1991 | DEFUN (neighbor_route_reflector_client, |
| 1992 | neighbor_route_reflector_client_cmd, |
| 1993 | NEIGHBOR_CMD2 "route-reflector-client", |
| 1994 | NEIGHBOR_STR |
| 1995 | NEIGHBOR_ADDR_STR2 |
| 1996 | "Configure a neighbor as Route Reflector client\n") |
| 1997 | { |
| 1998 | struct peer *peer; |
| 1999 | |
| 2000 | |
| 2001 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2002 | if (! peer) |
| 2003 | return CMD_WARNING; |
| 2004 | |
| 2005 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2006 | bgp_node_safi (vty), |
| 2007 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2008 | } |
| 2009 | |
| 2010 | DEFUN (no_neighbor_route_reflector_client, |
| 2011 | no_neighbor_route_reflector_client_cmd, |
| 2012 | NO_NEIGHBOR_CMD2 "route-reflector-client", |
| 2013 | NO_STR |
| 2014 | NEIGHBOR_STR |
| 2015 | NEIGHBOR_ADDR_STR2 |
| 2016 | "Configure a neighbor as Route Reflector client\n") |
| 2017 | { |
| 2018 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2019 | bgp_node_safi (vty), |
| 2020 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2021 | } |
| 2022 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2023 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2024 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
| 2025 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2026 | { |
| 2027 | int ret; |
| 2028 | struct bgp *bgp; |
| 2029 | struct peer *peer; |
| 2030 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2031 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2032 | struct bgp_filter *pfilter; |
| 2033 | struct bgp_filter *gfilter; |
| 2034 | |
| 2035 | bgp = vty->index; |
| 2036 | |
| 2037 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2038 | if ( ! peer ) |
| 2039 | return CMD_WARNING; |
| 2040 | |
| 2041 | /* If it is already a RS-Client, don't do anything. */ |
| 2042 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2043 | return CMD_SUCCESS; |
| 2044 | |
| 2045 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2046 | { |
| 2047 | peer = peer_lock (peer); /* rsclient peer list reference */ |
| 2048 | listnode_add_sort (bgp->rsclient, peer); |
| 2049 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2050 | |
| 2051 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2052 | if (ret < 0) |
| 2053 | return bgp_vty_return (vty, ret); |
| 2054 | |
| 2055 | peer->rib[afi][safi] = bgp_table_init (); |
| 2056 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
| 2057 | peer->rib[afi][safi]->owner = peer; |
| 2058 | |
| 2059 | /* Check for existing 'network' and 'redistribute' routes. */ |
| 2060 | bgp_check_local_routes_rsclient (peer, afi, safi); |
| 2061 | |
| 2062 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ |
| 2063 | bgp_soft_reconfig_rsclient (peer, afi, safi); |
| 2064 | |
| 2065 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2066 | { |
| 2067 | group = peer->group; |
| 2068 | gfilter = &peer->filter[afi][safi]; |
| 2069 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2070 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2071 | { |
| 2072 | pfilter = &peer->filter[afi][safi]; |
| 2073 | |
| 2074 | /* Members of a non-RS-Client group should not be RS-Clients, as that |
| 2075 | is checked when the become part of the peer-group */ |
| 2076 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2077 | if (ret < 0) |
| 2078 | return bgp_vty_return (vty, ret); |
| 2079 | |
| 2080 | /* Make peer's RIB point to group's RIB. */ |
| 2081 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; |
| 2082 | |
| 2083 | /* Import policy. */ |
| 2084 | if (pfilter->map[RMAP_IMPORT].name) |
| 2085 | free (pfilter->map[RMAP_IMPORT].name); |
| 2086 | if (gfilter->map[RMAP_IMPORT].name) |
| 2087 | { |
| 2088 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); |
| 2089 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; |
| 2090 | } |
| 2091 | else |
| 2092 | { |
| 2093 | pfilter->map[RMAP_IMPORT].name = NULL; |
| 2094 | pfilter->map[RMAP_IMPORT].map =NULL; |
| 2095 | } |
| 2096 | |
| 2097 | /* Export policy. */ |
| 2098 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) |
| 2099 | { |
| 2100 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); |
| 2101 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; |
| 2102 | } |
| 2103 | } |
| 2104 | } |
| 2105 | return CMD_SUCCESS; |
| 2106 | } |
| 2107 | |
| 2108 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2109 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
| 2110 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2111 | { |
| 2112 | int ret; |
| 2113 | struct bgp *bgp; |
| 2114 | struct peer *peer; |
| 2115 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2116 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2117 | |
| 2118 | bgp = vty->index; |
| 2119 | |
| 2120 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2121 | if ( ! peer ) |
| 2122 | return CMD_WARNING; |
| 2123 | |
| 2124 | /* If it is not a RS-Client, don't do anything. */ |
| 2125 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2126 | return CMD_SUCCESS; |
| 2127 | |
| 2128 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2129 | { |
| 2130 | group = peer->group; |
| 2131 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2132 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2133 | { |
| 2134 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2135 | if (ret < 0) |
| 2136 | return bgp_vty_return (vty, ret); |
| 2137 | |
| 2138 | peer->rib[afi][safi] = NULL; |
| 2139 | } |
| 2140 | |
| 2141 | peer = group->conf; |
| 2142 | } |
| 2143 | |
| 2144 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2145 | if (ret < 0) |
| 2146 | return bgp_vty_return (vty, ret); |
| 2147 | |
| 2148 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2149 | { |
| 2150 | peer_unlock (peer); /* peer bgp rsclient reference */ |
| 2151 | listnode_delete (bgp->rsclient, peer); |
| 2152 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2153 | |
| 2154 | bgp_table_finish (peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
| 2155 | |
| 2156 | return CMD_SUCCESS; |
| 2157 | } |
| 2158 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2159 | /* neighbor route-server-client. */ |
| 2160 | DEFUN (neighbor_route_server_client, |
| 2161 | neighbor_route_server_client_cmd, |
| 2162 | NEIGHBOR_CMD2 "route-server-client", |
| 2163 | NEIGHBOR_STR |
| 2164 | NEIGHBOR_ADDR_STR2 |
| 2165 | "Configure a neighbor as Route Server client\n") |
| 2166 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2167 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
| 2168 | bgp_node_safi(vty)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2169 | } |
| 2170 | |
| 2171 | DEFUN (no_neighbor_route_server_client, |
| 2172 | no_neighbor_route_server_client_cmd, |
| 2173 | NO_NEIGHBOR_CMD2 "route-server-client", |
| 2174 | NO_STR |
| 2175 | NEIGHBOR_STR |
| 2176 | NEIGHBOR_ADDR_STR2 |
| 2177 | "Configure a neighbor as Route Server client\n") |
| 2178 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2179 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), |
| 2180 | bgp_node_safi(vty)); |
| 2181 | } |
| 2182 | |
| 2183 | DEFUN (neighbor_nexthop_local_unchanged, |
| 2184 | neighbor_nexthop_local_unchanged_cmd, |
| 2185 | NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2186 | NEIGHBOR_STR |
| 2187 | NEIGHBOR_ADDR_STR2 |
| 2188 | "Configure treatment of outgoing link-local nexthop attribute\n" |
| 2189 | "Leave link-local nexthop unchanged for this peer\n") |
| 2190 | { |
| 2191 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2192 | bgp_node_safi (vty), |
| 2193 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
| 2194 | } |
| 2195 | |
| 2196 | DEFUN (no_neighbor_nexthop_local_unchanged, |
| 2197 | no_neighbor_nexthop_local_unchanged_cmd, |
| 2198 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2199 | NO_STR |
| 2200 | NEIGHBOR_STR |
| 2201 | NEIGHBOR_ADDR_STR2 |
| 2202 | "Configure treatment of outgoing link-local-nexthop attribute\n" |
| 2203 | "Leave link-local nexthop unchanged for this peer\n") |
| 2204 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2205 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2206 | bgp_node_safi (vty), |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2207 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2208 | } |
| 2209 | |
| 2210 | DEFUN (neighbor_attr_unchanged, |
| 2211 | neighbor_attr_unchanged_cmd, |
| 2212 | NEIGHBOR_CMD2 "attribute-unchanged", |
| 2213 | NEIGHBOR_STR |
| 2214 | NEIGHBOR_ADDR_STR2 |
| 2215 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2216 | { |
| 2217 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2218 | bgp_node_safi (vty), |
| 2219 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2220 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2221 | PEER_FLAG_MED_UNCHANGED)); |
| 2222 | } |
| 2223 | |
| 2224 | DEFUN (neighbor_attr_unchanged1, |
| 2225 | neighbor_attr_unchanged1_cmd, |
| 2226 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2227 | NEIGHBOR_STR |
| 2228 | NEIGHBOR_ADDR_STR2 |
| 2229 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2230 | "As-path attribute\n" |
| 2231 | "Nexthop attribute\n" |
| 2232 | "Med attribute\n") |
| 2233 | { |
| 2234 | u_int16_t flags = 0; |
| 2235 | |
| 2236 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2237 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2238 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2239 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2240 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2241 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2242 | |
| 2243 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2244 | bgp_node_safi (vty), flags); |
| 2245 | } |
| 2246 | |
| 2247 | DEFUN (neighbor_attr_unchanged2, |
| 2248 | neighbor_attr_unchanged2_cmd, |
| 2249 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2250 | NEIGHBOR_STR |
| 2251 | NEIGHBOR_ADDR_STR2 |
| 2252 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2253 | "As-path attribute\n" |
| 2254 | "Nexthop attribute\n" |
| 2255 | "Med attribute\n") |
| 2256 | { |
| 2257 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2258 | |
| 2259 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2260 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2261 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2262 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2263 | |
| 2264 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2265 | bgp_node_safi (vty), flags); |
| 2266 | |
| 2267 | } |
| 2268 | |
| 2269 | DEFUN (neighbor_attr_unchanged3, |
| 2270 | neighbor_attr_unchanged3_cmd, |
| 2271 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2272 | NEIGHBOR_STR |
| 2273 | NEIGHBOR_ADDR_STR2 |
| 2274 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2275 | "Nexthop attribute\n" |
| 2276 | "As-path attribute\n" |
| 2277 | "Med attribute\n") |
| 2278 | { |
| 2279 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2280 | |
| 2281 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2282 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2283 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2284 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2285 | |
| 2286 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2287 | bgp_node_safi (vty), flags); |
| 2288 | } |
| 2289 | |
| 2290 | DEFUN (neighbor_attr_unchanged4, |
| 2291 | neighbor_attr_unchanged4_cmd, |
| 2292 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2293 | NEIGHBOR_STR |
| 2294 | NEIGHBOR_ADDR_STR2 |
| 2295 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2296 | "Med attribute\n" |
| 2297 | "As-path attribute\n" |
| 2298 | "Nexthop attribute\n") |
| 2299 | { |
| 2300 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2301 | |
| 2302 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2303 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2304 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2305 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2306 | |
| 2307 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2308 | bgp_node_safi (vty), flags); |
| 2309 | } |
| 2310 | |
| 2311 | ALIAS (neighbor_attr_unchanged, |
| 2312 | neighbor_attr_unchanged5_cmd, |
| 2313 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2314 | NEIGHBOR_STR |
| 2315 | NEIGHBOR_ADDR_STR2 |
| 2316 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2317 | "As-path attribute\n" |
| 2318 | "Nexthop attribute\n" |
| 2319 | "Med attribute\n") |
| 2320 | |
| 2321 | ALIAS (neighbor_attr_unchanged, |
| 2322 | neighbor_attr_unchanged6_cmd, |
| 2323 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2324 | NEIGHBOR_STR |
| 2325 | NEIGHBOR_ADDR_STR2 |
| 2326 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2327 | "As-path attribute\n" |
| 2328 | "Med attribute\n" |
| 2329 | "Nexthop attribute\n") |
| 2330 | |
| 2331 | ALIAS (neighbor_attr_unchanged, |
| 2332 | neighbor_attr_unchanged7_cmd, |
| 2333 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2334 | NEIGHBOR_STR |
| 2335 | NEIGHBOR_ADDR_STR2 |
| 2336 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2337 | "Nexthop attribute\n" |
| 2338 | "Med attribute\n" |
| 2339 | "As-path attribute\n") |
| 2340 | |
| 2341 | ALIAS (neighbor_attr_unchanged, |
| 2342 | neighbor_attr_unchanged8_cmd, |
| 2343 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2344 | NEIGHBOR_STR |
| 2345 | NEIGHBOR_ADDR_STR2 |
| 2346 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2347 | "Nexthop attribute\n" |
| 2348 | "As-path attribute\n" |
| 2349 | "Med attribute\n") |
| 2350 | |
| 2351 | ALIAS (neighbor_attr_unchanged, |
| 2352 | neighbor_attr_unchanged9_cmd, |
| 2353 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2354 | NEIGHBOR_STR |
| 2355 | NEIGHBOR_ADDR_STR2 |
| 2356 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2357 | "Med attribute\n" |
| 2358 | "Nexthop attribute\n" |
| 2359 | "As-path attribute\n") |
| 2360 | |
| 2361 | ALIAS (neighbor_attr_unchanged, |
| 2362 | neighbor_attr_unchanged10_cmd, |
| 2363 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2364 | NEIGHBOR_STR |
| 2365 | NEIGHBOR_ADDR_STR2 |
| 2366 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2367 | "Med attribute\n" |
| 2368 | "As-path attribute\n" |
| 2369 | "Nexthop attribute\n") |
| 2370 | |
| 2371 | DEFUN (no_neighbor_attr_unchanged, |
| 2372 | no_neighbor_attr_unchanged_cmd, |
| 2373 | NO_NEIGHBOR_CMD2 "attribute-unchanged", |
| 2374 | NO_STR |
| 2375 | NEIGHBOR_STR |
| 2376 | NEIGHBOR_ADDR_STR2 |
| 2377 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2378 | { |
| 2379 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2380 | bgp_node_safi (vty), |
| 2381 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2382 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2383 | PEER_FLAG_MED_UNCHANGED)); |
| 2384 | } |
| 2385 | |
| 2386 | DEFUN (no_neighbor_attr_unchanged1, |
| 2387 | no_neighbor_attr_unchanged1_cmd, |
| 2388 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2389 | NO_STR |
| 2390 | NEIGHBOR_STR |
| 2391 | NEIGHBOR_ADDR_STR2 |
| 2392 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2393 | "As-path attribute\n" |
| 2394 | "Nexthop attribute\n" |
| 2395 | "Med attribute\n") |
| 2396 | { |
| 2397 | u_int16_t flags = 0; |
| 2398 | |
| 2399 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2400 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2401 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2402 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2403 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2404 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2405 | |
| 2406 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2407 | bgp_node_safi (vty), flags); |
| 2408 | } |
| 2409 | |
| 2410 | DEFUN (no_neighbor_attr_unchanged2, |
| 2411 | no_neighbor_attr_unchanged2_cmd, |
| 2412 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2413 | NO_STR |
| 2414 | NEIGHBOR_STR |
| 2415 | NEIGHBOR_ADDR_STR2 |
| 2416 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2417 | "As-path attribute\n" |
| 2418 | "Nexthop attribute\n" |
| 2419 | "Med attribute\n") |
| 2420 | { |
| 2421 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2422 | |
| 2423 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2424 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2425 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2426 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2427 | |
| 2428 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2429 | bgp_node_safi (vty), flags); |
| 2430 | } |
| 2431 | |
| 2432 | DEFUN (no_neighbor_attr_unchanged3, |
| 2433 | no_neighbor_attr_unchanged3_cmd, |
| 2434 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2435 | NO_STR |
| 2436 | NEIGHBOR_STR |
| 2437 | NEIGHBOR_ADDR_STR2 |
| 2438 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2439 | "Nexthop attribute\n" |
| 2440 | "As-path attribute\n" |
| 2441 | "Med attribute\n") |
| 2442 | { |
| 2443 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2444 | |
| 2445 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2446 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2447 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2448 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2449 | |
| 2450 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2451 | bgp_node_safi (vty), flags); |
| 2452 | } |
| 2453 | |
| 2454 | DEFUN (no_neighbor_attr_unchanged4, |
| 2455 | no_neighbor_attr_unchanged4_cmd, |
| 2456 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2457 | NO_STR |
| 2458 | NEIGHBOR_STR |
| 2459 | NEIGHBOR_ADDR_STR2 |
| 2460 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2461 | "Med attribute\n" |
| 2462 | "As-path attribute\n" |
| 2463 | "Nexthop attribute\n") |
| 2464 | { |
| 2465 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2466 | |
| 2467 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2468 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2469 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2470 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2471 | |
| 2472 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2473 | bgp_node_safi (vty), flags); |
| 2474 | } |
| 2475 | |
| 2476 | ALIAS (no_neighbor_attr_unchanged, |
| 2477 | no_neighbor_attr_unchanged5_cmd, |
| 2478 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2479 | NO_STR |
| 2480 | NEIGHBOR_STR |
| 2481 | NEIGHBOR_ADDR_STR2 |
| 2482 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2483 | "As-path attribute\n" |
| 2484 | "Nexthop attribute\n" |
| 2485 | "Med attribute\n") |
| 2486 | |
| 2487 | ALIAS (no_neighbor_attr_unchanged, |
| 2488 | no_neighbor_attr_unchanged6_cmd, |
| 2489 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2490 | NO_STR |
| 2491 | NEIGHBOR_STR |
| 2492 | NEIGHBOR_ADDR_STR2 |
| 2493 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2494 | "As-path attribute\n" |
| 2495 | "Med attribute\n" |
| 2496 | "Nexthop attribute\n") |
| 2497 | |
| 2498 | ALIAS (no_neighbor_attr_unchanged, |
| 2499 | no_neighbor_attr_unchanged7_cmd, |
| 2500 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2501 | NO_STR |
| 2502 | NEIGHBOR_STR |
| 2503 | NEIGHBOR_ADDR_STR2 |
| 2504 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2505 | "Nexthop attribute\n" |
| 2506 | "Med attribute\n" |
| 2507 | "As-path attribute\n") |
| 2508 | |
| 2509 | ALIAS (no_neighbor_attr_unchanged, |
| 2510 | no_neighbor_attr_unchanged8_cmd, |
| 2511 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2512 | NO_STR |
| 2513 | NEIGHBOR_STR |
| 2514 | NEIGHBOR_ADDR_STR2 |
| 2515 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2516 | "Nexthop attribute\n" |
| 2517 | "As-path attribute\n" |
| 2518 | "Med attribute\n") |
| 2519 | |
| 2520 | ALIAS (no_neighbor_attr_unchanged, |
| 2521 | no_neighbor_attr_unchanged9_cmd, |
| 2522 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2523 | NO_STR |
| 2524 | NEIGHBOR_STR |
| 2525 | NEIGHBOR_ADDR_STR2 |
| 2526 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2527 | "Med attribute\n" |
| 2528 | "Nexthop attribute\n" |
| 2529 | "As-path attribute\n") |
| 2530 | |
| 2531 | ALIAS (no_neighbor_attr_unchanged, |
| 2532 | no_neighbor_attr_unchanged10_cmd, |
| 2533 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2534 | NO_STR |
| 2535 | NEIGHBOR_STR |
| 2536 | NEIGHBOR_ADDR_STR2 |
| 2537 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2538 | "Med attribute\n" |
| 2539 | "As-path attribute\n" |
| 2540 | "Nexthop attribute\n") |
| 2541 | |
| 2542 | /* For old version Zebra compatibility. */ |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2543 | DEFUN_DEPRECATED (neighbor_transparent_as, |
| 2544 | neighbor_transparent_as_cmd, |
| 2545 | NEIGHBOR_CMD "transparent-as", |
| 2546 | NEIGHBOR_STR |
| 2547 | NEIGHBOR_ADDR_STR |
| 2548 | "Do not append my AS number even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2549 | { |
| 2550 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2551 | bgp_node_safi (vty), |
| 2552 | PEER_FLAG_AS_PATH_UNCHANGED); |
| 2553 | } |
| 2554 | |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2555 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
| 2556 | neighbor_transparent_nexthop_cmd, |
| 2557 | NEIGHBOR_CMD "transparent-nexthop", |
| 2558 | NEIGHBOR_STR |
| 2559 | NEIGHBOR_ADDR_STR |
| 2560 | "Do not change nexthop even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2561 | { |
| 2562 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2563 | bgp_node_safi (vty), |
| 2564 | PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2565 | } |
| 2566 | |
| 2567 | /* EBGP multihop configuration. */ |
| 2568 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2569 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
| 2570 | const char *ttl_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2571 | { |
| 2572 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2573 | unsigned int ttl; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2574 | |
| 2575 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2576 | if (! peer) |
| 2577 | return CMD_WARNING; |
| 2578 | |
| 2579 | if (! ttl_str) |
| 2580 | ttl = TTL_MAX; |
| 2581 | else |
| 2582 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); |
| 2583 | |
| 2584 | peer_ebgp_multihop_set (peer, ttl); |
| 2585 | |
| 2586 | return CMD_SUCCESS; |
| 2587 | } |
| 2588 | |
| 2589 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2590 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2591 | { |
| 2592 | struct peer *peer; |
| 2593 | |
| 2594 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2595 | if (! peer) |
| 2596 | return CMD_WARNING; |
| 2597 | |
| 2598 | peer_ebgp_multihop_unset (peer); |
| 2599 | |
| 2600 | return CMD_SUCCESS; |
| 2601 | } |
| 2602 | |
| 2603 | /* neighbor ebgp-multihop. */ |
| 2604 | DEFUN (neighbor_ebgp_multihop, |
| 2605 | neighbor_ebgp_multihop_cmd, |
| 2606 | NEIGHBOR_CMD2 "ebgp-multihop", |
| 2607 | NEIGHBOR_STR |
| 2608 | NEIGHBOR_ADDR_STR2 |
| 2609 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2610 | { |
| 2611 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); |
| 2612 | } |
| 2613 | |
| 2614 | DEFUN (neighbor_ebgp_multihop_ttl, |
| 2615 | neighbor_ebgp_multihop_ttl_cmd, |
| 2616 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2617 | NEIGHBOR_STR |
| 2618 | NEIGHBOR_ADDR_STR2 |
| 2619 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2620 | "maximum hop count\n") |
| 2621 | { |
| 2622 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); |
| 2623 | } |
| 2624 | |
| 2625 | DEFUN (no_neighbor_ebgp_multihop, |
| 2626 | no_neighbor_ebgp_multihop_cmd, |
| 2627 | NO_NEIGHBOR_CMD2 "ebgp-multihop", |
| 2628 | NO_STR |
| 2629 | NEIGHBOR_STR |
| 2630 | NEIGHBOR_ADDR_STR2 |
| 2631 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2632 | { |
| 2633 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); |
| 2634 | } |
| 2635 | |
| 2636 | ALIAS (no_neighbor_ebgp_multihop, |
| 2637 | no_neighbor_ebgp_multihop_ttl_cmd, |
| 2638 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2639 | NO_STR |
| 2640 | NEIGHBOR_STR |
| 2641 | NEIGHBOR_ADDR_STR2 |
| 2642 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2643 | "maximum hop count\n") |
| 2644 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2645 | /* disable-connected-check */ |
| 2646 | DEFUN (neighbor_disable_connected_check, |
| 2647 | neighbor_disable_connected_check_cmd, |
| 2648 | NEIGHBOR_CMD2 "disable-connected-check", |
| 2649 | NEIGHBOR_STR |
| 2650 | NEIGHBOR_ADDR_STR2 |
| 2651 | "one-hop away EBGP peer using loopback address\n") |
| 2652 | { |
| 2653 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2654 | } |
| 2655 | |
| 2656 | DEFUN (no_neighbor_disable_connected_check, |
| 2657 | no_neighbor_disable_connected_check_cmd, |
| 2658 | NO_NEIGHBOR_CMD2 "disable-connected-check", |
| 2659 | NO_STR |
| 2660 | NEIGHBOR_STR |
| 2661 | NEIGHBOR_ADDR_STR2 |
| 2662 | "one-hop away EBGP peer using loopback address\n") |
| 2663 | { |
| 2664 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2665 | } |
| 2666 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2667 | /* Enforce multihop. */ |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2668 | ALIAS (neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2669 | neighbor_enforce_multihop_cmd, |
| 2670 | NEIGHBOR_CMD2 "enforce-multihop", |
| 2671 | NEIGHBOR_STR |
| 2672 | NEIGHBOR_ADDR_STR2 |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2673 | "Enforce EBGP neighbors perform multihop\n"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2674 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2675 | /* Enforce multihop. */ |
| 2676 | ALIAS (no_neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2677 | no_neighbor_enforce_multihop_cmd, |
| 2678 | NO_NEIGHBOR_CMD2 "enforce-multihop", |
| 2679 | NO_STR |
| 2680 | NEIGHBOR_STR |
| 2681 | NEIGHBOR_ADDR_STR2 |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2682 | "Enforce EBGP neighbors perform multihop\n"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2683 | |
| 2684 | DEFUN (neighbor_description, |
| 2685 | neighbor_description_cmd, |
| 2686 | NEIGHBOR_CMD2 "description .LINE", |
| 2687 | NEIGHBOR_STR |
| 2688 | NEIGHBOR_ADDR_STR2 |
| 2689 | "Neighbor specific description\n" |
| 2690 | "Up to 80 characters describing this neighbor\n") |
| 2691 | { |
| 2692 | struct peer *peer; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2693 | char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2694 | |
| 2695 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2696 | if (! peer) |
| 2697 | return CMD_WARNING; |
| 2698 | |
| 2699 | if (argc == 1) |
| 2700 | return CMD_SUCCESS; |
| 2701 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2702 | str = argv_concat(argv, argc, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2703 | |
| 2704 | peer_description_set (peer, str); |
| 2705 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2706 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2707 | |
| 2708 | return CMD_SUCCESS; |
| 2709 | } |
| 2710 | |
| 2711 | DEFUN (no_neighbor_description, |
| 2712 | no_neighbor_description_cmd, |
| 2713 | NO_NEIGHBOR_CMD2 "description", |
| 2714 | NO_STR |
| 2715 | NEIGHBOR_STR |
| 2716 | NEIGHBOR_ADDR_STR2 |
| 2717 | "Neighbor specific description\n") |
| 2718 | { |
| 2719 | struct peer *peer; |
| 2720 | |
| 2721 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2722 | if (! peer) |
| 2723 | return CMD_WARNING; |
| 2724 | |
| 2725 | peer_description_unset (peer); |
| 2726 | |
| 2727 | return CMD_SUCCESS; |
| 2728 | } |
| 2729 | |
| 2730 | ALIAS (no_neighbor_description, |
| 2731 | no_neighbor_description_val_cmd, |
| 2732 | NO_NEIGHBOR_CMD2 "description .LINE", |
| 2733 | NO_STR |
| 2734 | NEIGHBOR_STR |
| 2735 | NEIGHBOR_ADDR_STR2 |
| 2736 | "Neighbor specific description\n" |
| 2737 | "Up to 80 characters describing this neighbor\n") |
| 2738 | |
| 2739 | /* Neighbor update-source. */ |
| 2740 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2741 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
| 2742 | const char *source_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2743 | { |
| 2744 | struct peer *peer; |
| 2745 | union sockunion *su; |
| 2746 | |
| 2747 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2748 | if (! peer) |
| 2749 | return CMD_WARNING; |
| 2750 | |
| 2751 | if (source_str) |
| 2752 | { |
| 2753 | su = sockunion_str2su (source_str); |
| 2754 | if (su) |
| 2755 | { |
| 2756 | peer_update_source_addr_set (peer, su); |
| 2757 | sockunion_free (su); |
| 2758 | } |
| 2759 | else |
| 2760 | peer_update_source_if_set (peer, source_str); |
| 2761 | } |
| 2762 | else |
| 2763 | peer_update_source_unset (peer); |
| 2764 | |
| 2765 | return CMD_SUCCESS; |
| 2766 | } |
| 2767 | |
| 2768 | DEFUN (neighbor_update_source, |
| 2769 | neighbor_update_source_cmd, |
| 2770 | NEIGHBOR_CMD2 "update-source WORD", |
| 2771 | NEIGHBOR_STR |
| 2772 | NEIGHBOR_ADDR_STR2 |
| 2773 | "Source of routing updates\n" |
| 2774 | "Interface name\n") |
| 2775 | { |
| 2776 | return peer_update_source_vty (vty, argv[0], argv[1]); |
| 2777 | } |
| 2778 | |
| 2779 | DEFUN (no_neighbor_update_source, |
| 2780 | no_neighbor_update_source_cmd, |
| 2781 | NO_NEIGHBOR_CMD2 "update-source", |
| 2782 | NO_STR |
| 2783 | NEIGHBOR_STR |
| 2784 | NEIGHBOR_ADDR_STR2 |
| 2785 | "Source of routing updates\n" |
| 2786 | "Interface name\n") |
| 2787 | { |
| 2788 | return peer_update_source_vty (vty, argv[0], NULL); |
| 2789 | } |
| 2790 | |
| 2791 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2792 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
| 2793 | afi_t afi, safi_t safi, |
| 2794 | const char *rmap, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2795 | { |
| 2796 | int ret; |
| 2797 | struct peer *peer; |
| 2798 | |
| 2799 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2800 | if (! peer) |
| 2801 | return CMD_WARNING; |
| 2802 | |
| 2803 | if (set) |
| 2804 | ret = peer_default_originate_set (peer, afi, safi, rmap); |
| 2805 | else |
| 2806 | ret = peer_default_originate_unset (peer, afi, safi); |
| 2807 | |
| 2808 | return bgp_vty_return (vty, ret); |
| 2809 | } |
| 2810 | |
| 2811 | /* neighbor default-originate. */ |
| 2812 | DEFUN (neighbor_default_originate, |
| 2813 | neighbor_default_originate_cmd, |
| 2814 | NEIGHBOR_CMD2 "default-originate", |
| 2815 | NEIGHBOR_STR |
| 2816 | NEIGHBOR_ADDR_STR2 |
| 2817 | "Originate default route to this neighbor\n") |
| 2818 | { |
| 2819 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2820 | bgp_node_safi (vty), NULL, 1); |
| 2821 | } |
| 2822 | |
| 2823 | DEFUN (neighbor_default_originate_rmap, |
| 2824 | neighbor_default_originate_rmap_cmd, |
| 2825 | NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 2826 | NEIGHBOR_STR |
| 2827 | NEIGHBOR_ADDR_STR2 |
| 2828 | "Originate default route to this neighbor\n" |
| 2829 | "Route-map to specify criteria to originate default\n" |
| 2830 | "route-map name\n") |
| 2831 | { |
| 2832 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2833 | bgp_node_safi (vty), argv[1], 1); |
| 2834 | } |
| 2835 | |
| 2836 | DEFUN (no_neighbor_default_originate, |
| 2837 | no_neighbor_default_originate_cmd, |
| 2838 | NO_NEIGHBOR_CMD2 "default-originate", |
| 2839 | NO_STR |
| 2840 | NEIGHBOR_STR |
| 2841 | NEIGHBOR_ADDR_STR2 |
| 2842 | "Originate default route to this neighbor\n") |
| 2843 | { |
| 2844 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2845 | bgp_node_safi (vty), NULL, 0); |
| 2846 | } |
| 2847 | |
| 2848 | ALIAS (no_neighbor_default_originate, |
| 2849 | no_neighbor_default_originate_rmap_cmd, |
| 2850 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 2851 | NO_STR |
| 2852 | NEIGHBOR_STR |
| 2853 | NEIGHBOR_ADDR_STR2 |
| 2854 | "Originate default route to this neighbor\n" |
| 2855 | "Route-map to specify criteria to originate default\n" |
| 2856 | "route-map name\n") |
| 2857 | |
| 2858 | /* Set neighbor's BGP port. */ |
| 2859 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2860 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
| 2861 | const char *port_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2862 | { |
| 2863 | struct peer *peer; |
| 2864 | u_int16_t port; |
| 2865 | struct servent *sp; |
| 2866 | |
| 2867 | peer = peer_lookup_vty (vty, ip_str); |
| 2868 | if (! peer) |
| 2869 | return CMD_WARNING; |
| 2870 | |
| 2871 | if (! port_str) |
| 2872 | { |
| 2873 | sp = getservbyname ("bgp", "tcp"); |
| 2874 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); |
| 2875 | } |
| 2876 | else |
| 2877 | { |
| 2878 | VTY_GET_INTEGER("port", port, port_str); |
| 2879 | } |
| 2880 | |
| 2881 | peer_port_set (peer, port); |
| 2882 | |
| 2883 | return CMD_SUCCESS; |
| 2884 | } |
| 2885 | |
hasso | f418446 | 2005-02-01 20:13:16 +0000 | [diff] [blame] | 2886 | /* Set specified peer's BGP port. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2887 | DEFUN (neighbor_port, |
| 2888 | neighbor_port_cmd, |
| 2889 | NEIGHBOR_CMD "port <0-65535>", |
| 2890 | NEIGHBOR_STR |
| 2891 | NEIGHBOR_ADDR_STR |
| 2892 | "Neighbor's BGP port\n" |
| 2893 | "TCP port number\n") |
| 2894 | { |
| 2895 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); |
| 2896 | } |
| 2897 | |
| 2898 | DEFUN (no_neighbor_port, |
| 2899 | no_neighbor_port_cmd, |
| 2900 | NO_NEIGHBOR_CMD "port", |
| 2901 | NO_STR |
| 2902 | NEIGHBOR_STR |
| 2903 | NEIGHBOR_ADDR_STR |
| 2904 | "Neighbor's BGP port\n") |
| 2905 | { |
| 2906 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); |
| 2907 | } |
| 2908 | |
| 2909 | ALIAS (no_neighbor_port, |
| 2910 | no_neighbor_port_val_cmd, |
| 2911 | NO_NEIGHBOR_CMD "port <0-65535>", |
| 2912 | NO_STR |
| 2913 | NEIGHBOR_STR |
| 2914 | NEIGHBOR_ADDR_STR |
| 2915 | "Neighbor's BGP port\n" |
| 2916 | "TCP port number\n") |
| 2917 | |
| 2918 | /* neighbor weight. */ |
| 2919 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2920 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
| 2921 | const char *weight_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2922 | { |
| 2923 | int ret; |
| 2924 | struct peer *peer; |
| 2925 | unsigned long weight; |
| 2926 | |
| 2927 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2928 | if (! peer) |
| 2929 | return CMD_WARNING; |
| 2930 | |
| 2931 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); |
| 2932 | |
| 2933 | ret = peer_weight_set (peer, weight); |
| 2934 | |
| 2935 | return CMD_SUCCESS; |
| 2936 | } |
| 2937 | |
| 2938 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2939 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2940 | { |
| 2941 | struct peer *peer; |
| 2942 | |
| 2943 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2944 | if (! peer) |
| 2945 | return CMD_WARNING; |
| 2946 | |
| 2947 | peer_weight_unset (peer); |
| 2948 | |
| 2949 | return CMD_SUCCESS; |
| 2950 | } |
| 2951 | |
| 2952 | DEFUN (neighbor_weight, |
| 2953 | neighbor_weight_cmd, |
| 2954 | NEIGHBOR_CMD2 "weight <0-65535>", |
| 2955 | NEIGHBOR_STR |
| 2956 | NEIGHBOR_ADDR_STR2 |
| 2957 | "Set default weight for routes from this neighbor\n" |
| 2958 | "default weight\n") |
| 2959 | { |
| 2960 | return peer_weight_set_vty (vty, argv[0], argv[1]); |
| 2961 | } |
| 2962 | |
| 2963 | DEFUN (no_neighbor_weight, |
| 2964 | no_neighbor_weight_cmd, |
| 2965 | NO_NEIGHBOR_CMD2 "weight", |
| 2966 | NO_STR |
| 2967 | NEIGHBOR_STR |
| 2968 | NEIGHBOR_ADDR_STR2 |
| 2969 | "Set default weight for routes from this neighbor\n") |
| 2970 | { |
| 2971 | return peer_weight_unset_vty (vty, argv[0]); |
| 2972 | } |
| 2973 | |
| 2974 | ALIAS (no_neighbor_weight, |
| 2975 | no_neighbor_weight_val_cmd, |
| 2976 | NO_NEIGHBOR_CMD2 "weight <0-65535>", |
| 2977 | NO_STR |
| 2978 | NEIGHBOR_STR |
| 2979 | NEIGHBOR_ADDR_STR2 |
| 2980 | "Set default weight for routes from this neighbor\n" |
| 2981 | "default weight\n") |
| 2982 | |
| 2983 | /* Override capability negotiation. */ |
| 2984 | DEFUN (neighbor_override_capability, |
| 2985 | neighbor_override_capability_cmd, |
| 2986 | NEIGHBOR_CMD2 "override-capability", |
| 2987 | NEIGHBOR_STR |
| 2988 | NEIGHBOR_ADDR_STR2 |
| 2989 | "Override capability negotiation result\n") |
| 2990 | { |
| 2991 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 2992 | } |
| 2993 | |
| 2994 | DEFUN (no_neighbor_override_capability, |
| 2995 | no_neighbor_override_capability_cmd, |
| 2996 | NO_NEIGHBOR_CMD2 "override-capability", |
| 2997 | NO_STR |
| 2998 | NEIGHBOR_STR |
| 2999 | NEIGHBOR_ADDR_STR2 |
| 3000 | "Override capability negotiation result\n") |
| 3001 | { |
| 3002 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 3003 | } |
| 3004 | |
| 3005 | DEFUN (neighbor_strict_capability, |
| 3006 | neighbor_strict_capability_cmd, |
| 3007 | NEIGHBOR_CMD "strict-capability-match", |
| 3008 | NEIGHBOR_STR |
| 3009 | NEIGHBOR_ADDR_STR |
| 3010 | "Strict capability negotiation match\n") |
| 3011 | { |
| 3012 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3013 | } |
| 3014 | |
| 3015 | DEFUN (no_neighbor_strict_capability, |
| 3016 | no_neighbor_strict_capability_cmd, |
| 3017 | NO_NEIGHBOR_CMD "strict-capability-match", |
| 3018 | NO_STR |
| 3019 | NEIGHBOR_STR |
| 3020 | NEIGHBOR_ADDR_STR |
| 3021 | "Strict capability negotiation match\n") |
| 3022 | { |
| 3023 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3024 | } |
| 3025 | |
| 3026 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3027 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
| 3028 | const char *keep_str, const char *hold_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3029 | { |
| 3030 | int ret; |
| 3031 | struct peer *peer; |
| 3032 | u_int32_t keepalive; |
| 3033 | u_int32_t holdtime; |
| 3034 | |
| 3035 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3036 | if (! peer) |
| 3037 | return CMD_WARNING; |
| 3038 | |
| 3039 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); |
| 3040 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); |
| 3041 | |
| 3042 | ret = peer_timers_set (peer, keepalive, holdtime); |
| 3043 | |
| 3044 | return bgp_vty_return (vty, ret); |
| 3045 | } |
| 3046 | |
| 3047 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3048 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3049 | { |
| 3050 | int ret; |
| 3051 | struct peer *peer; |
| 3052 | |
| 3053 | peer = peer_lookup_vty (vty, ip_str); |
| 3054 | if (! peer) |
| 3055 | return CMD_WARNING; |
| 3056 | |
| 3057 | ret = peer_timers_unset (peer); |
| 3058 | |
| 3059 | return bgp_vty_return (vty, ret); |
| 3060 | } |
| 3061 | |
| 3062 | DEFUN (neighbor_timers, |
| 3063 | neighbor_timers_cmd, |
| 3064 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", |
| 3065 | NEIGHBOR_STR |
| 3066 | NEIGHBOR_ADDR_STR2 |
| 3067 | "BGP per neighbor timers\n" |
| 3068 | "Keepalive interval\n" |
| 3069 | "Holdtime\n") |
| 3070 | { |
| 3071 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); |
| 3072 | } |
| 3073 | |
| 3074 | DEFUN (no_neighbor_timers, |
| 3075 | no_neighbor_timers_cmd, |
| 3076 | NO_NEIGHBOR_CMD2 "timers", |
| 3077 | NO_STR |
| 3078 | NEIGHBOR_STR |
| 3079 | NEIGHBOR_ADDR_STR2 |
| 3080 | "BGP per neighbor timers\n") |
| 3081 | { |
| 3082 | return peer_timers_unset_vty (vty, argv[0]); |
| 3083 | } |
| 3084 | |
| 3085 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3086 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
| 3087 | const char *time_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3088 | { |
| 3089 | int ret; |
| 3090 | struct peer *peer; |
| 3091 | u_int32_t connect; |
| 3092 | |
| 3093 | peer = peer_lookup_vty (vty, ip_str); |
| 3094 | if (! peer) |
| 3095 | return CMD_WARNING; |
| 3096 | |
| 3097 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); |
| 3098 | |
| 3099 | ret = peer_timers_connect_set (peer, connect); |
| 3100 | |
| 3101 | return CMD_SUCCESS; |
| 3102 | } |
| 3103 | |
| 3104 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3105 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3106 | { |
| 3107 | int ret; |
| 3108 | struct peer *peer; |
| 3109 | |
| 3110 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3111 | if (! peer) |
| 3112 | return CMD_WARNING; |
| 3113 | |
| 3114 | ret = peer_timers_connect_unset (peer); |
| 3115 | |
| 3116 | return CMD_SUCCESS; |
| 3117 | } |
| 3118 | |
| 3119 | DEFUN (neighbor_timers_connect, |
| 3120 | neighbor_timers_connect_cmd, |
| 3121 | NEIGHBOR_CMD "timers connect <0-65535>", |
| 3122 | NEIGHBOR_STR |
| 3123 | NEIGHBOR_ADDR_STR |
| 3124 | "BGP per neighbor timers\n" |
| 3125 | "BGP connect timer\n" |
| 3126 | "Connect timer\n") |
| 3127 | { |
| 3128 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); |
| 3129 | } |
| 3130 | |
| 3131 | DEFUN (no_neighbor_timers_connect, |
| 3132 | no_neighbor_timers_connect_cmd, |
| 3133 | NO_NEIGHBOR_CMD "timers connect", |
| 3134 | NO_STR |
| 3135 | NEIGHBOR_STR |
| 3136 | NEIGHBOR_ADDR_STR |
| 3137 | "BGP per neighbor timers\n" |
| 3138 | "BGP connect timer\n") |
| 3139 | { |
| 3140 | return peer_timers_connect_unset_vty (vty, argv[0]); |
| 3141 | } |
| 3142 | |
| 3143 | ALIAS (no_neighbor_timers_connect, |
| 3144 | no_neighbor_timers_connect_val_cmd, |
| 3145 | NO_NEIGHBOR_CMD "timers connect <0-65535>", |
| 3146 | NO_STR |
| 3147 | NEIGHBOR_STR |
| 3148 | NEIGHBOR_ADDR_STR |
| 3149 | "BGP per neighbor timers\n" |
| 3150 | "BGP connect timer\n" |
| 3151 | "Connect timer\n") |
| 3152 | |
| 3153 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3154 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
| 3155 | const char *time_str, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3156 | { |
| 3157 | int ret; |
| 3158 | struct peer *peer; |
| 3159 | u_int32_t routeadv = 0; |
| 3160 | |
| 3161 | peer = peer_lookup_vty (vty, ip_str); |
| 3162 | if (! peer) |
| 3163 | return CMD_WARNING; |
| 3164 | |
| 3165 | if (time_str) |
| 3166 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); |
| 3167 | |
| 3168 | if (set) |
| 3169 | ret = peer_advertise_interval_set (peer, routeadv); |
| 3170 | else |
| 3171 | ret = peer_advertise_interval_unset (peer); |
| 3172 | |
| 3173 | return CMD_SUCCESS; |
| 3174 | } |
| 3175 | |
| 3176 | DEFUN (neighbor_advertise_interval, |
| 3177 | neighbor_advertise_interval_cmd, |
| 3178 | NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3179 | NEIGHBOR_STR |
| 3180 | NEIGHBOR_ADDR_STR |
| 3181 | "Minimum interval between sending BGP routing updates\n" |
| 3182 | "time in seconds\n") |
| 3183 | { |
| 3184 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); |
| 3185 | } |
| 3186 | |
| 3187 | DEFUN (no_neighbor_advertise_interval, |
| 3188 | no_neighbor_advertise_interval_cmd, |
| 3189 | NO_NEIGHBOR_CMD "advertisement-interval", |
| 3190 | NO_STR |
| 3191 | NEIGHBOR_STR |
| 3192 | NEIGHBOR_ADDR_STR |
| 3193 | "Minimum interval between sending BGP routing updates\n") |
| 3194 | { |
| 3195 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); |
| 3196 | } |
| 3197 | |
| 3198 | ALIAS (no_neighbor_advertise_interval, |
| 3199 | no_neighbor_advertise_interval_val_cmd, |
| 3200 | NO_NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3201 | NO_STR |
| 3202 | NEIGHBOR_STR |
| 3203 | NEIGHBOR_ADDR_STR |
| 3204 | "Minimum interval between sending BGP routing updates\n" |
| 3205 | "time in seconds\n") |
| 3206 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3207 | /* neighbor interface */ |
| 3208 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3209 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3210 | { |
| 3211 | int ret; |
| 3212 | struct peer *peer; |
| 3213 | |
| 3214 | peer = peer_lookup_vty (vty, ip_str); |
| 3215 | if (! peer) |
| 3216 | return CMD_WARNING; |
| 3217 | |
| 3218 | if (str) |
| 3219 | ret = peer_interface_set (peer, str); |
| 3220 | else |
| 3221 | ret = peer_interface_unset (peer); |
| 3222 | |
| 3223 | return CMD_SUCCESS; |
| 3224 | } |
| 3225 | |
| 3226 | DEFUN (neighbor_interface, |
| 3227 | neighbor_interface_cmd, |
| 3228 | NEIGHBOR_CMD "interface WORD", |
| 3229 | NEIGHBOR_STR |
| 3230 | NEIGHBOR_ADDR_STR |
| 3231 | "Interface\n" |
| 3232 | "Interface name\n") |
| 3233 | { |
| 3234 | return peer_interface_vty (vty, argv[0], argv[1]); |
| 3235 | } |
| 3236 | |
| 3237 | DEFUN (no_neighbor_interface, |
| 3238 | no_neighbor_interface_cmd, |
| 3239 | NO_NEIGHBOR_CMD "interface WORD", |
| 3240 | NO_STR |
| 3241 | NEIGHBOR_STR |
| 3242 | NEIGHBOR_ADDR_STR |
| 3243 | "Interface\n" |
| 3244 | "Interface name\n") |
| 3245 | { |
| 3246 | return peer_interface_vty (vty, argv[0], NULL); |
| 3247 | } |
| 3248 | |
| 3249 | /* Set distribute list to the peer. */ |
| 3250 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3251 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
| 3252 | afi_t afi, safi_t safi, |
| 3253 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3254 | { |
| 3255 | int ret; |
| 3256 | struct peer *peer; |
| 3257 | int direct = FILTER_IN; |
| 3258 | |
| 3259 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3260 | if (! peer) |
| 3261 | return CMD_WARNING; |
| 3262 | |
| 3263 | /* Check filter direction. */ |
| 3264 | if (strncmp (direct_str, "i", 1) == 0) |
| 3265 | direct = FILTER_IN; |
| 3266 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3267 | direct = FILTER_OUT; |
| 3268 | |
| 3269 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); |
| 3270 | |
| 3271 | return bgp_vty_return (vty, ret); |
| 3272 | } |
| 3273 | |
| 3274 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3275 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3276 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3277 | { |
| 3278 | int ret; |
| 3279 | struct peer *peer; |
| 3280 | int direct = FILTER_IN; |
| 3281 | |
| 3282 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3283 | if (! peer) |
| 3284 | return CMD_WARNING; |
| 3285 | |
| 3286 | /* Check filter direction. */ |
| 3287 | if (strncmp (direct_str, "i", 1) == 0) |
| 3288 | direct = FILTER_IN; |
| 3289 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3290 | direct = FILTER_OUT; |
| 3291 | |
| 3292 | ret = peer_distribute_unset (peer, afi, safi, direct); |
| 3293 | |
| 3294 | return bgp_vty_return (vty, ret); |
| 3295 | } |
| 3296 | |
| 3297 | DEFUN (neighbor_distribute_list, |
| 3298 | neighbor_distribute_list_cmd, |
| 3299 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3300 | NEIGHBOR_STR |
| 3301 | NEIGHBOR_ADDR_STR2 |
| 3302 | "Filter updates to/from this neighbor\n" |
| 3303 | "IP access-list number\n" |
| 3304 | "IP access-list number (expanded range)\n" |
| 3305 | "IP Access-list name\n" |
| 3306 | "Filter incoming updates\n" |
| 3307 | "Filter outgoing updates\n") |
| 3308 | { |
| 3309 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3310 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3311 | } |
| 3312 | |
| 3313 | DEFUN (no_neighbor_distribute_list, |
| 3314 | no_neighbor_distribute_list_cmd, |
| 3315 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3316 | NO_STR |
| 3317 | NEIGHBOR_STR |
| 3318 | NEIGHBOR_ADDR_STR2 |
| 3319 | "Filter updates to/from this neighbor\n" |
| 3320 | "IP access-list number\n" |
| 3321 | "IP access-list number (expanded range)\n" |
| 3322 | "IP Access-list name\n" |
| 3323 | "Filter incoming updates\n" |
| 3324 | "Filter outgoing updates\n") |
| 3325 | { |
| 3326 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3327 | bgp_node_safi (vty), argv[2]); |
| 3328 | } |
| 3329 | |
| 3330 | /* Set prefix list to the peer. */ |
| 3331 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3332 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3333 | safi_t safi, const char *name_str, |
| 3334 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3335 | { |
| 3336 | int ret; |
| 3337 | struct peer *peer; |
| 3338 | int direct = FILTER_IN; |
| 3339 | |
| 3340 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3341 | if (! peer) |
| 3342 | return CMD_WARNING; |
| 3343 | |
| 3344 | /* Check filter direction. */ |
| 3345 | if (strncmp (direct_str, "i", 1) == 0) |
| 3346 | direct = FILTER_IN; |
| 3347 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3348 | direct = FILTER_OUT; |
| 3349 | |
| 3350 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); |
| 3351 | |
| 3352 | return bgp_vty_return (vty, ret); |
| 3353 | } |
| 3354 | |
| 3355 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3356 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3357 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3358 | { |
| 3359 | int ret; |
| 3360 | struct peer *peer; |
| 3361 | int direct = FILTER_IN; |
| 3362 | |
| 3363 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3364 | if (! peer) |
| 3365 | return CMD_WARNING; |
| 3366 | |
| 3367 | /* Check filter direction. */ |
| 3368 | if (strncmp (direct_str, "i", 1) == 0) |
| 3369 | direct = FILTER_IN; |
| 3370 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3371 | direct = FILTER_OUT; |
| 3372 | |
| 3373 | ret = peer_prefix_list_unset (peer, afi, safi, direct); |
| 3374 | |
| 3375 | return bgp_vty_return (vty, ret); |
| 3376 | } |
| 3377 | |
| 3378 | DEFUN (neighbor_prefix_list, |
| 3379 | neighbor_prefix_list_cmd, |
| 3380 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3381 | NEIGHBOR_STR |
| 3382 | NEIGHBOR_ADDR_STR2 |
| 3383 | "Filter updates to/from this neighbor\n" |
| 3384 | "Name of a prefix list\n" |
| 3385 | "Filter incoming updates\n" |
| 3386 | "Filter outgoing updates\n") |
| 3387 | { |
| 3388 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3389 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3390 | } |
| 3391 | |
| 3392 | DEFUN (no_neighbor_prefix_list, |
| 3393 | no_neighbor_prefix_list_cmd, |
| 3394 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3395 | NO_STR |
| 3396 | NEIGHBOR_STR |
| 3397 | NEIGHBOR_ADDR_STR2 |
| 3398 | "Filter updates to/from this neighbor\n" |
| 3399 | "Name of a prefix list\n" |
| 3400 | "Filter incoming updates\n" |
| 3401 | "Filter outgoing updates\n") |
| 3402 | { |
| 3403 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3404 | bgp_node_safi (vty), argv[2]); |
| 3405 | } |
| 3406 | |
| 3407 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3408 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
| 3409 | afi_t afi, safi_t safi, |
| 3410 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3411 | { |
| 3412 | int ret; |
| 3413 | struct peer *peer; |
| 3414 | int direct = FILTER_IN; |
| 3415 | |
| 3416 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3417 | if (! peer) |
| 3418 | return CMD_WARNING; |
| 3419 | |
| 3420 | /* Check filter direction. */ |
| 3421 | if (strncmp (direct_str, "i", 1) == 0) |
| 3422 | direct = FILTER_IN; |
| 3423 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3424 | direct = FILTER_OUT; |
| 3425 | |
| 3426 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); |
| 3427 | |
| 3428 | return bgp_vty_return (vty, ret); |
| 3429 | } |
| 3430 | |
| 3431 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3432 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
| 3433 | afi_t afi, safi_t safi, |
| 3434 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3435 | { |
| 3436 | int ret; |
| 3437 | struct peer *peer; |
| 3438 | int direct = FILTER_IN; |
| 3439 | |
| 3440 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3441 | if (! peer) |
| 3442 | return CMD_WARNING; |
| 3443 | |
| 3444 | /* Check filter direction. */ |
| 3445 | if (strncmp (direct_str, "i", 1) == 0) |
| 3446 | direct = FILTER_IN; |
| 3447 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3448 | direct = FILTER_OUT; |
| 3449 | |
| 3450 | ret = peer_aslist_unset (peer, afi, safi, direct); |
| 3451 | |
| 3452 | return bgp_vty_return (vty, ret); |
| 3453 | } |
| 3454 | |
| 3455 | DEFUN (neighbor_filter_list, |
| 3456 | neighbor_filter_list_cmd, |
| 3457 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3458 | NEIGHBOR_STR |
| 3459 | NEIGHBOR_ADDR_STR2 |
| 3460 | "Establish BGP filters\n" |
| 3461 | "AS path access-list name\n" |
| 3462 | "Filter incoming routes\n" |
| 3463 | "Filter outgoing routes\n") |
| 3464 | { |
| 3465 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3466 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3467 | } |
| 3468 | |
| 3469 | DEFUN (no_neighbor_filter_list, |
| 3470 | no_neighbor_filter_list_cmd, |
| 3471 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3472 | NO_STR |
| 3473 | NEIGHBOR_STR |
| 3474 | NEIGHBOR_ADDR_STR2 |
| 3475 | "Establish BGP filters\n" |
| 3476 | "AS path access-list name\n" |
| 3477 | "Filter incoming routes\n" |
| 3478 | "Filter outgoing routes\n") |
| 3479 | { |
| 3480 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3481 | bgp_node_safi (vty), argv[2]); |
| 3482 | } |
| 3483 | |
| 3484 | /* Set route-map to the peer. */ |
| 3485 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3486 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
| 3487 | afi_t afi, safi_t safi, |
| 3488 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3489 | { |
| 3490 | int ret; |
| 3491 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3492 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3493 | |
| 3494 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3495 | if (! peer) |
| 3496 | return CMD_WARNING; |
| 3497 | |
| 3498 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3499 | if (strncmp (direct_str, "in", 2) == 0) |
| 3500 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3501 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3502 | direct = RMAP_OUT; |
| 3503 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3504 | direct = RMAP_IMPORT; |
| 3505 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3506 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3507 | |
| 3508 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); |
| 3509 | |
| 3510 | return bgp_vty_return (vty, ret); |
| 3511 | } |
| 3512 | |
| 3513 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3514 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3515 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3516 | { |
| 3517 | int ret; |
| 3518 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3519 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3520 | |
| 3521 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3522 | if (! peer) |
| 3523 | return CMD_WARNING; |
| 3524 | |
| 3525 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3526 | if (strncmp (direct_str, "in", 2) == 0) |
| 3527 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3528 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3529 | direct = RMAP_OUT; |
| 3530 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3531 | direct = RMAP_IMPORT; |
| 3532 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3533 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3534 | |
| 3535 | ret = peer_route_map_unset (peer, afi, safi, direct); |
| 3536 | |
| 3537 | return bgp_vty_return (vty, ret); |
| 3538 | } |
| 3539 | |
| 3540 | DEFUN (neighbor_route_map, |
| 3541 | neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3542 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3543 | NEIGHBOR_STR |
| 3544 | NEIGHBOR_ADDR_STR2 |
| 3545 | "Apply route map to neighbor\n" |
| 3546 | "Name of route map\n" |
| 3547 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3548 | "Apply map to outbound routes\n" |
| 3549 | "Apply map to routes going into a Route-Server client's table\n" |
| 3550 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3551 | { |
| 3552 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3553 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3554 | } |
| 3555 | |
| 3556 | DEFUN (no_neighbor_route_map, |
| 3557 | no_neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3558 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3559 | NO_STR |
| 3560 | NEIGHBOR_STR |
| 3561 | NEIGHBOR_ADDR_STR2 |
| 3562 | "Apply route map to neighbor\n" |
| 3563 | "Name of route map\n" |
| 3564 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3565 | "Apply map to outbound routes\n" |
| 3566 | "Apply map to routes going into a Route-Server client's table\n" |
| 3567 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3568 | { |
| 3569 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3570 | bgp_node_safi (vty), argv[2]); |
| 3571 | } |
| 3572 | |
| 3573 | /* Set unsuppress-map to the peer. */ |
| 3574 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3575 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3576 | safi_t safi, const char *name_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3577 | { |
| 3578 | int ret; |
| 3579 | struct peer *peer; |
| 3580 | |
| 3581 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3582 | if (! peer) |
| 3583 | return CMD_WARNING; |
| 3584 | |
| 3585 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); |
| 3586 | |
| 3587 | return bgp_vty_return (vty, ret); |
| 3588 | } |
| 3589 | |
| 3590 | /* Unset route-map from the peer. */ |
| 3591 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3592 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3593 | safi_t safi) |
| 3594 | { |
| 3595 | int ret; |
| 3596 | struct peer *peer; |
| 3597 | |
| 3598 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3599 | if (! peer) |
| 3600 | return CMD_WARNING; |
| 3601 | |
| 3602 | ret = peer_unsuppress_map_unset (peer, afi, safi); |
| 3603 | |
| 3604 | return bgp_vty_return (vty, ret); |
| 3605 | } |
| 3606 | |
| 3607 | DEFUN (neighbor_unsuppress_map, |
| 3608 | neighbor_unsuppress_map_cmd, |
| 3609 | NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3610 | NEIGHBOR_STR |
| 3611 | NEIGHBOR_ADDR_STR2 |
| 3612 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3613 | "Name of route map\n") |
| 3614 | { |
| 3615 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3616 | bgp_node_safi (vty), argv[1]); |
| 3617 | } |
| 3618 | |
| 3619 | DEFUN (no_neighbor_unsuppress_map, |
| 3620 | no_neighbor_unsuppress_map_cmd, |
| 3621 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3622 | NO_STR |
| 3623 | NEIGHBOR_STR |
| 3624 | NEIGHBOR_ADDR_STR2 |
| 3625 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3626 | "Name of route map\n") |
| 3627 | { |
| 3628 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3629 | bgp_node_safi (vty)); |
| 3630 | } |
| 3631 | |
| 3632 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3633 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3634 | safi_t safi, const char *num_str, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3635 | const char *threshold_str, int warning, |
| 3636 | const char *restart_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3637 | { |
| 3638 | int ret; |
| 3639 | struct peer *peer; |
| 3640 | u_int32_t max; |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3641 | u_char threshold; |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3642 | u_int16_t restart; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3643 | |
| 3644 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3645 | if (! peer) |
| 3646 | return CMD_WARNING; |
| 3647 | |
| 3648 | VTY_GET_INTEGER ("maxmum number", max, num_str); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3649 | if (threshold_str) |
| 3650 | threshold = atoi (threshold_str); |
| 3651 | else |
| 3652 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3653 | |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3654 | if (restart_str) |
| 3655 | restart = atoi (restart_str); |
| 3656 | else |
| 3657 | restart = 0; |
| 3658 | |
| 3659 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3660 | |
| 3661 | return bgp_vty_return (vty, ret); |
| 3662 | } |
| 3663 | |
| 3664 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3665 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3666 | safi_t safi) |
| 3667 | { |
| 3668 | int ret; |
| 3669 | struct peer *peer; |
| 3670 | |
| 3671 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3672 | if (! peer) |
| 3673 | return CMD_WARNING; |
| 3674 | |
| 3675 | ret = peer_maximum_prefix_unset (peer, afi, safi); |
| 3676 | |
| 3677 | return bgp_vty_return (vty, ret); |
| 3678 | } |
| 3679 | |
| 3680 | /* Maximum number of prefix configuration. prefix count is different |
| 3681 | for each peer configuration. So this configuration can be set for |
| 3682 | each peer configuration. */ |
| 3683 | DEFUN (neighbor_maximum_prefix, |
| 3684 | neighbor_maximum_prefix_cmd, |
| 3685 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3686 | NEIGHBOR_STR |
| 3687 | NEIGHBOR_ADDR_STR2 |
| 3688 | "Maximum number of prefix accept from this peer\n" |
| 3689 | "maximum no. of prefix limit\n") |
| 3690 | { |
| 3691 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3692 | bgp_node_safi (vty), argv[1], NULL, 0, |
| 3693 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3694 | } |
| 3695 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3696 | DEFUN (neighbor_maximum_prefix_threshold, |
| 3697 | neighbor_maximum_prefix_threshold_cmd, |
| 3698 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", |
| 3699 | NEIGHBOR_STR |
| 3700 | NEIGHBOR_ADDR_STR2 |
| 3701 | "Maximum number of prefix accept from this peer\n" |
| 3702 | "maximum no. of prefix limit\n" |
| 3703 | "Threshold value (%) at which to generate a warning msg\n") |
| 3704 | { |
| 3705 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3706 | bgp_node_safi (vty), argv[1], argv[2], 0, |
| 3707 | NULL); |
| 3708 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3709 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3710 | DEFUN (neighbor_maximum_prefix_warning, |
| 3711 | neighbor_maximum_prefix_warning_cmd, |
| 3712 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3713 | NEIGHBOR_STR |
| 3714 | NEIGHBOR_ADDR_STR2 |
| 3715 | "Maximum number of prefix accept from this peer\n" |
| 3716 | "maximum no. of prefix limit\n" |
| 3717 | "Only give warning message when limit is exceeded\n") |
| 3718 | { |
| 3719 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3720 | bgp_node_safi (vty), argv[1], NULL, 1, |
| 3721 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3722 | } |
| 3723 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3724 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
| 3725 | neighbor_maximum_prefix_threshold_warning_cmd, |
| 3726 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 3727 | NEIGHBOR_STR |
| 3728 | NEIGHBOR_ADDR_STR2 |
| 3729 | "Maximum number of prefix accept from this peer\n" |
| 3730 | "maximum no. of prefix limit\n" |
| 3731 | "Threshold value (%) at which to generate a warning msg\n" |
| 3732 | "Only give warning message when limit is exceeded\n") |
| 3733 | { |
| 3734 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3735 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
| 3736 | } |
| 3737 | |
| 3738 | DEFUN (neighbor_maximum_prefix_restart, |
| 3739 | neighbor_maximum_prefix_restart_cmd, |
| 3740 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
| 3741 | NEIGHBOR_STR |
| 3742 | NEIGHBOR_ADDR_STR2 |
| 3743 | "Maximum number of prefix accept from this peer\n" |
| 3744 | "maximum no. of prefix limit\n" |
| 3745 | "Restart bgp connection after limit is exceeded\n" |
| 3746 | "Restart interval in minutes") |
| 3747 | { |
| 3748 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3749 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); |
| 3750 | } |
| 3751 | |
| 3752 | DEFUN (neighbor_maximum_prefix_threshold_restart, |
| 3753 | neighbor_maximum_prefix_threshold_restart_cmd, |
| 3754 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 3755 | NEIGHBOR_STR |
| 3756 | NEIGHBOR_ADDR_STR2 |
| 3757 | "Maximum number of prefix accept from this peer\n" |
| 3758 | "maximum no. of prefix limit\n" |
| 3759 | "Threshold value (%) at which to generate a warning msg\n" |
| 3760 | "Restart bgp connection after limit is exceeded\n" |
| 3761 | "Restart interval in minutes") |
| 3762 | { |
| 3763 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3764 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); |
| 3765 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3766 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3767 | DEFUN (no_neighbor_maximum_prefix, |
| 3768 | no_neighbor_maximum_prefix_cmd, |
| 3769 | NO_NEIGHBOR_CMD2 "maximum-prefix", |
| 3770 | NO_STR |
| 3771 | NEIGHBOR_STR |
| 3772 | NEIGHBOR_ADDR_STR2 |
| 3773 | "Maximum number of prefix accept from this peer\n") |
| 3774 | { |
| 3775 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3776 | bgp_node_safi (vty)); |
| 3777 | } |
| 3778 | |
| 3779 | ALIAS (no_neighbor_maximum_prefix, |
| 3780 | no_neighbor_maximum_prefix_val_cmd, |
| 3781 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3782 | NO_STR |
| 3783 | NEIGHBOR_STR |
| 3784 | NEIGHBOR_ADDR_STR2 |
| 3785 | "Maximum number of prefix accept from this peer\n" |
| 3786 | "maximum no. of prefix limit\n") |
| 3787 | |
| 3788 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3789 | no_neighbor_maximum_prefix_threshold_cmd, |
| 3790 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3791 | NO_STR |
| 3792 | NEIGHBOR_STR |
| 3793 | NEIGHBOR_ADDR_STR2 |
| 3794 | "Maximum number of prefix accept from this peer\n" |
| 3795 | "maximum no. of prefix limit\n" |
| 3796 | "Threshold value (%) at which to generate a warning msg\n") |
| 3797 | |
| 3798 | ALIAS (no_neighbor_maximum_prefix, |
| 3799 | no_neighbor_maximum_prefix_warning_cmd, |
| 3800 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3801 | NO_STR |
| 3802 | NEIGHBOR_STR |
| 3803 | NEIGHBOR_ADDR_STR2 |
| 3804 | "Maximum number of prefix accept from this peer\n" |
| 3805 | "maximum no. of prefix limit\n" |
| 3806 | "Only give warning message when limit is exceeded\n"); |
| 3807 | |
| 3808 | ALIAS (no_neighbor_maximum_prefix, |
| 3809 | no_neighbor_maximum_prefix_threshold_warning_cmd, |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3810 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 3811 | NO_STR |
| 3812 | NEIGHBOR_STR |
| 3813 | NEIGHBOR_ADDR_STR2 |
| 3814 | "Maximum number of prefix accept from this peer\n" |
| 3815 | "maximum no. of prefix limit\n" |
| 3816 | "Threshold value (%) at which to generate a warning msg\n" |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3817 | "Only give warning message when limit is exceeded\n"); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3818 | |
| 3819 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3820 | no_neighbor_maximum_prefix_restart_cmd, |
| 3821 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3822 | NO_STR |
| 3823 | NEIGHBOR_STR |
| 3824 | NEIGHBOR_ADDR_STR2 |
| 3825 | "Maximum number of prefix accept from this peer\n" |
| 3826 | "maximum no. of prefix limit\n" |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3827 | "Restart bgp connection after limit is exceeded\n" |
| 3828 | "Restart interval in minutes") |
| 3829 | |
| 3830 | ALIAS (no_neighbor_maximum_prefix, |
| 3831 | no_neighbor_maximum_prefix_threshold_restart_cmd, |
| 3832 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 3833 | NO_STR |
| 3834 | NEIGHBOR_STR |
| 3835 | NEIGHBOR_ADDR_STR2 |
| 3836 | "Maximum number of prefix accept from this peer\n" |
| 3837 | "maximum no. of prefix limit\n" |
| 3838 | "Threshold value (%) at which to generate a warning msg\n" |
| 3839 | "Restart bgp connection after limit is exceeded\n" |
| 3840 | "Restart interval in minutes") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3841 | |
| 3842 | /* "neighbor allowas-in" */ |
| 3843 | DEFUN (neighbor_allowas_in, |
| 3844 | neighbor_allowas_in_cmd, |
| 3845 | NEIGHBOR_CMD2 "allowas-in", |
| 3846 | NEIGHBOR_STR |
| 3847 | NEIGHBOR_ADDR_STR2 |
| 3848 | "Accept as-path with my AS present in it\n") |
| 3849 | { |
| 3850 | int ret; |
| 3851 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3852 | unsigned int allow_num; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3853 | |
| 3854 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3855 | if (! peer) |
| 3856 | return CMD_WARNING; |
| 3857 | |
| 3858 | if (argc == 1) |
| 3859 | allow_num = 3; |
| 3860 | else |
| 3861 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); |
| 3862 | |
| 3863 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), |
| 3864 | allow_num); |
| 3865 | |
| 3866 | return bgp_vty_return (vty, ret); |
| 3867 | } |
| 3868 | |
| 3869 | ALIAS (neighbor_allowas_in, |
| 3870 | neighbor_allowas_in_arg_cmd, |
| 3871 | NEIGHBOR_CMD2 "allowas-in <1-10>", |
| 3872 | NEIGHBOR_STR |
| 3873 | NEIGHBOR_ADDR_STR2 |
| 3874 | "Accept as-path with my AS present in it\n" |
| 3875 | "Number of occurances of AS number\n") |
| 3876 | |
| 3877 | DEFUN (no_neighbor_allowas_in, |
| 3878 | no_neighbor_allowas_in_cmd, |
| 3879 | NO_NEIGHBOR_CMD2 "allowas-in", |
| 3880 | NO_STR |
| 3881 | NEIGHBOR_STR |
| 3882 | NEIGHBOR_ADDR_STR2 |
| 3883 | "allow local ASN appears in aspath attribute\n") |
| 3884 | { |
| 3885 | int ret; |
| 3886 | struct peer *peer; |
| 3887 | |
| 3888 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3889 | if (! peer) |
| 3890 | return CMD_WARNING; |
| 3891 | |
| 3892 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 3893 | |
| 3894 | return bgp_vty_return (vty, ret); |
| 3895 | } |
| 3896 | |
| 3897 | /* Address family configuration. */ |
| 3898 | DEFUN (address_family_ipv4, |
| 3899 | address_family_ipv4_cmd, |
| 3900 | "address-family ipv4", |
| 3901 | "Enter Address Family command mode\n" |
| 3902 | "Address family\n") |
| 3903 | { |
| 3904 | vty->node = BGP_IPV4_NODE; |
| 3905 | return CMD_SUCCESS; |
| 3906 | } |
| 3907 | |
| 3908 | DEFUN (address_family_ipv4_safi, |
| 3909 | address_family_ipv4_safi_cmd, |
| 3910 | "address-family ipv4 (unicast|multicast)", |
| 3911 | "Enter Address Family command mode\n" |
| 3912 | "Address family\n" |
| 3913 | "Address Family modifier\n" |
| 3914 | "Address Family modifier\n") |
| 3915 | { |
| 3916 | if (strncmp (argv[0], "m", 1) == 0) |
| 3917 | vty->node = BGP_IPV4M_NODE; |
| 3918 | else |
| 3919 | vty->node = BGP_IPV4_NODE; |
| 3920 | |
| 3921 | return CMD_SUCCESS; |
| 3922 | } |
| 3923 | |
| 3924 | DEFUN (address_family_ipv6_unicast, |
| 3925 | address_family_ipv6_unicast_cmd, |
| 3926 | "address-family ipv6 unicast", |
| 3927 | "Enter Address Family command mode\n" |
| 3928 | "Address family\n" |
| 3929 | "unicast\n") |
| 3930 | { |
| 3931 | vty->node = BGP_IPV6_NODE; |
| 3932 | return CMD_SUCCESS; |
| 3933 | } |
| 3934 | |
| 3935 | ALIAS (address_family_ipv6_unicast, |
| 3936 | address_family_ipv6_cmd, |
| 3937 | "address-family ipv6", |
| 3938 | "Enter Address Family command mode\n" |
| 3939 | "Address family\n") |
| 3940 | |
| 3941 | DEFUN (address_family_vpnv4, |
| 3942 | address_family_vpnv4_cmd, |
| 3943 | "address-family vpnv4", |
| 3944 | "Enter Address Family command mode\n" |
| 3945 | "Address family\n") |
| 3946 | { |
| 3947 | vty->node = BGP_VPNV4_NODE; |
| 3948 | return CMD_SUCCESS; |
| 3949 | } |
| 3950 | |
| 3951 | ALIAS (address_family_vpnv4, |
| 3952 | address_family_vpnv4_unicast_cmd, |
| 3953 | "address-family vpnv4 unicast", |
| 3954 | "Enter Address Family command mode\n" |
| 3955 | "Address family\n" |
| 3956 | "Address Family Modifier\n") |
| 3957 | |
| 3958 | DEFUN (exit_address_family, |
| 3959 | exit_address_family_cmd, |
| 3960 | "exit-address-family", |
| 3961 | "Exit from Address Family configuration mode\n") |
| 3962 | { |
hasso | a8a80d5 | 2005-04-09 13:07:47 +0000 | [diff] [blame] | 3963 | if (vty->node == BGP_IPV4_NODE |
| 3964 | || vty->node == BGP_IPV4M_NODE |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3965 | || vty->node == BGP_VPNV4_NODE |
| 3966 | || vty->node == BGP_IPV6_NODE) |
| 3967 | vty->node = BGP_NODE; |
| 3968 | return CMD_SUCCESS; |
| 3969 | } |
| 3970 | |
| 3971 | /* BGP clear sort. */ |
| 3972 | enum clear_sort |
| 3973 | { |
| 3974 | clear_all, |
| 3975 | clear_peer, |
| 3976 | clear_group, |
| 3977 | clear_external, |
| 3978 | clear_as |
| 3979 | }; |
| 3980 | |
| 3981 | void |
| 3982 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
| 3983 | safi_t safi, int error) |
| 3984 | { |
| 3985 | switch (error) |
| 3986 | { |
| 3987 | case BGP_ERR_AF_UNCONFIGURED: |
| 3988 | vty_out (vty, |
| 3989 | "%%BGP: Enable %s %s address family for the neighbor %s%s", |
| 3990 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", |
| 3991 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", |
| 3992 | peer->host, VTY_NEWLINE); |
| 3993 | break; |
| 3994 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: |
| 3995 | 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); |
| 3996 | break; |
| 3997 | default: |
| 3998 | break; |
| 3999 | } |
| 4000 | } |
| 4001 | |
| 4002 | /* `clear ip bgp' functions. */ |
| 4003 | int |
| 4004 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4005 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4006 | { |
| 4007 | int ret; |
| 4008 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4009 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4010 | |
| 4011 | /* Clear all neighbors. */ |
| 4012 | if (sort == clear_all) |
| 4013 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4014 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4015 | { |
| 4016 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4017 | ret = peer_clear (peer); |
| 4018 | else |
| 4019 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4020 | |
| 4021 | if (ret < 0) |
| 4022 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4023 | } |
| 4024 | return 0; |
| 4025 | } |
| 4026 | |
| 4027 | /* Clear specified neighbors. */ |
| 4028 | if (sort == clear_peer) |
| 4029 | { |
| 4030 | union sockunion su; |
| 4031 | int ret; |
| 4032 | |
| 4033 | /* Make sockunion for lookup. */ |
| 4034 | ret = str2sockunion (arg, &su); |
| 4035 | if (ret < 0) |
| 4036 | { |
| 4037 | vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE); |
| 4038 | return -1; |
| 4039 | } |
| 4040 | peer = peer_lookup (bgp, &su); |
| 4041 | if (! peer) |
| 4042 | { |
| 4043 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); |
| 4044 | return -1; |
| 4045 | } |
| 4046 | |
| 4047 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4048 | ret = peer_clear (peer); |
| 4049 | else |
| 4050 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4051 | |
| 4052 | if (ret < 0) |
| 4053 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4054 | |
| 4055 | return 0; |
| 4056 | } |
| 4057 | |
| 4058 | /* Clear all peer-group members. */ |
| 4059 | if (sort == clear_group) |
| 4060 | { |
| 4061 | struct peer_group *group; |
| 4062 | |
| 4063 | group = peer_group_lookup (bgp, arg); |
| 4064 | if (! group) |
| 4065 | { |
| 4066 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); |
| 4067 | return -1; |
| 4068 | } |
| 4069 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4070 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4071 | { |
| 4072 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4073 | { |
| 4074 | ret = peer_clear (peer); |
| 4075 | continue; |
| 4076 | } |
| 4077 | |
| 4078 | if (! peer->af_group[afi][safi]) |
| 4079 | continue; |
| 4080 | |
| 4081 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4082 | |
| 4083 | if (ret < 0) |
| 4084 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4085 | } |
| 4086 | return 0; |
| 4087 | } |
| 4088 | |
| 4089 | if (sort == clear_external) |
| 4090 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4091 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4092 | { |
| 4093 | if (peer_sort (peer) == BGP_PEER_IBGP) |
| 4094 | continue; |
| 4095 | |
| 4096 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4097 | ret = peer_clear (peer); |
| 4098 | else |
| 4099 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4100 | |
| 4101 | if (ret < 0) |
| 4102 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4103 | } |
| 4104 | return 0; |
| 4105 | } |
| 4106 | |
| 4107 | if (sort == clear_as) |
| 4108 | { |
| 4109 | as_t as; |
| 4110 | unsigned long as_ul; |
| 4111 | char *endptr = NULL; |
| 4112 | int find = 0; |
| 4113 | |
| 4114 | as_ul = strtoul(arg, &endptr, 10); |
| 4115 | |
| 4116 | if ((as_ul == ULONG_MAX) || (*endptr != '\0') || (as_ul > USHRT_MAX)) |
| 4117 | { |
| 4118 | vty_out (vty, "Invalid AS number%s", VTY_NEWLINE); |
| 4119 | return -1; |
| 4120 | } |
| 4121 | as = (as_t) as_ul; |
| 4122 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4123 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4124 | { |
| 4125 | if (peer->as != as) |
| 4126 | continue; |
| 4127 | |
| 4128 | find = 1; |
| 4129 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4130 | ret = peer_clear (peer); |
| 4131 | else |
| 4132 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4133 | |
| 4134 | if (ret < 0) |
| 4135 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4136 | } |
| 4137 | if (! find) |
| 4138 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, |
| 4139 | VTY_NEWLINE); |
| 4140 | return 0; |
| 4141 | } |
| 4142 | |
| 4143 | return 0; |
| 4144 | } |
| 4145 | |
| 4146 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4147 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
| 4148 | enum clear_sort sort, enum bgp_clear_type stype, |
| 4149 | const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4150 | { |
| 4151 | int ret; |
| 4152 | struct bgp *bgp; |
| 4153 | |
| 4154 | /* BGP structure lookup. */ |
| 4155 | if (name) |
| 4156 | { |
| 4157 | bgp = bgp_lookup_by_name (name); |
| 4158 | if (bgp == NULL) |
| 4159 | { |
| 4160 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); |
| 4161 | return CMD_WARNING; |
| 4162 | } |
| 4163 | } |
| 4164 | else |
| 4165 | { |
| 4166 | bgp = bgp_get_default (); |
| 4167 | if (bgp == NULL) |
| 4168 | { |
| 4169 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); |
| 4170 | return CMD_WARNING; |
| 4171 | } |
| 4172 | } |
| 4173 | |
| 4174 | ret = bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
| 4175 | if (ret < 0) |
| 4176 | return CMD_WARNING; |
| 4177 | |
| 4178 | return CMD_SUCCESS; |
| 4179 | } |
| 4180 | |
| 4181 | DEFUN (clear_ip_bgp_all, |
| 4182 | clear_ip_bgp_all_cmd, |
| 4183 | "clear ip bgp *", |
| 4184 | CLEAR_STR |
| 4185 | IP_STR |
| 4186 | BGP_STR |
| 4187 | "Clear all peers\n") |
| 4188 | { |
| 4189 | if (argc == 1) |
| 4190 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4191 | |
| 4192 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4193 | } |
| 4194 | |
| 4195 | ALIAS (clear_ip_bgp_all, |
| 4196 | clear_bgp_all_cmd, |
| 4197 | "clear bgp *", |
| 4198 | CLEAR_STR |
| 4199 | BGP_STR |
| 4200 | "Clear all peers\n") |
| 4201 | |
| 4202 | ALIAS (clear_ip_bgp_all, |
| 4203 | clear_bgp_ipv6_all_cmd, |
| 4204 | "clear bgp ipv6 *", |
| 4205 | CLEAR_STR |
| 4206 | BGP_STR |
| 4207 | "Address family\n" |
| 4208 | "Clear all peers\n") |
| 4209 | |
| 4210 | ALIAS (clear_ip_bgp_all, |
| 4211 | clear_ip_bgp_instance_all_cmd, |
| 4212 | "clear ip bgp view WORD *", |
| 4213 | CLEAR_STR |
| 4214 | IP_STR |
| 4215 | BGP_STR |
| 4216 | "BGP view\n" |
| 4217 | "view name\n" |
| 4218 | "Clear all peers\n") |
| 4219 | |
| 4220 | ALIAS (clear_ip_bgp_all, |
| 4221 | clear_bgp_instance_all_cmd, |
| 4222 | "clear bgp view WORD *", |
| 4223 | CLEAR_STR |
| 4224 | BGP_STR |
| 4225 | "BGP view\n" |
| 4226 | "view name\n" |
| 4227 | "Clear all peers\n") |
| 4228 | |
| 4229 | DEFUN (clear_ip_bgp_peer, |
| 4230 | clear_ip_bgp_peer_cmd, |
| 4231 | "clear ip bgp (A.B.C.D|X:X::X:X)", |
| 4232 | CLEAR_STR |
| 4233 | IP_STR |
| 4234 | BGP_STR |
| 4235 | "BGP neighbor IP address to clear\n" |
| 4236 | "BGP IPv6 neighbor to clear\n") |
| 4237 | { |
| 4238 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4239 | } |
| 4240 | |
| 4241 | ALIAS (clear_ip_bgp_peer, |
| 4242 | clear_bgp_peer_cmd, |
| 4243 | "clear bgp (A.B.C.D|X:X::X:X)", |
| 4244 | CLEAR_STR |
| 4245 | BGP_STR |
| 4246 | "BGP neighbor address to clear\n" |
| 4247 | "BGP IPv6 neighbor to clear\n") |
| 4248 | |
| 4249 | ALIAS (clear_ip_bgp_peer, |
| 4250 | clear_bgp_ipv6_peer_cmd, |
| 4251 | "clear bgp ipv6 (A.B.C.D|X:X::X:X)", |
| 4252 | CLEAR_STR |
| 4253 | BGP_STR |
| 4254 | "Address family\n" |
| 4255 | "BGP neighbor address to clear\n" |
| 4256 | "BGP IPv6 neighbor to clear\n") |
| 4257 | |
| 4258 | DEFUN (clear_ip_bgp_peer_group, |
| 4259 | clear_ip_bgp_peer_group_cmd, |
| 4260 | "clear ip bgp peer-group WORD", |
| 4261 | CLEAR_STR |
| 4262 | IP_STR |
| 4263 | BGP_STR |
| 4264 | "Clear all members of peer-group\n" |
| 4265 | "BGP peer-group name\n") |
| 4266 | { |
| 4267 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4268 | } |
| 4269 | |
| 4270 | ALIAS (clear_ip_bgp_peer_group, |
| 4271 | clear_bgp_peer_group_cmd, |
| 4272 | "clear bgp peer-group WORD", |
| 4273 | CLEAR_STR |
| 4274 | BGP_STR |
| 4275 | "Clear all members of peer-group\n" |
| 4276 | "BGP peer-group name\n") |
| 4277 | |
| 4278 | ALIAS (clear_ip_bgp_peer_group, |
| 4279 | clear_bgp_ipv6_peer_group_cmd, |
| 4280 | "clear bgp ipv6 peer-group WORD", |
| 4281 | CLEAR_STR |
| 4282 | BGP_STR |
| 4283 | "Address family\n" |
| 4284 | "Clear all members of peer-group\n" |
| 4285 | "BGP peer-group name\n") |
| 4286 | |
| 4287 | DEFUN (clear_ip_bgp_external, |
| 4288 | clear_ip_bgp_external_cmd, |
| 4289 | "clear ip bgp external", |
| 4290 | CLEAR_STR |
| 4291 | IP_STR |
| 4292 | BGP_STR |
| 4293 | "Clear all external peers\n") |
| 4294 | { |
| 4295 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
| 4296 | } |
| 4297 | |
| 4298 | ALIAS (clear_ip_bgp_external, |
| 4299 | clear_bgp_external_cmd, |
| 4300 | "clear bgp external", |
| 4301 | CLEAR_STR |
| 4302 | BGP_STR |
| 4303 | "Clear all external peers\n") |
| 4304 | |
| 4305 | ALIAS (clear_ip_bgp_external, |
| 4306 | clear_bgp_ipv6_external_cmd, |
| 4307 | "clear bgp ipv6 external", |
| 4308 | CLEAR_STR |
| 4309 | BGP_STR |
| 4310 | "Address family\n" |
| 4311 | "Clear all external peers\n") |
| 4312 | |
| 4313 | DEFUN (clear_ip_bgp_as, |
| 4314 | clear_ip_bgp_as_cmd, |
| 4315 | "clear ip bgp <1-65535>", |
| 4316 | CLEAR_STR |
| 4317 | IP_STR |
| 4318 | BGP_STR |
| 4319 | "Clear peers with the AS number\n") |
| 4320 | { |
| 4321 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4322 | } |
| 4323 | |
| 4324 | ALIAS (clear_ip_bgp_as, |
| 4325 | clear_bgp_as_cmd, |
| 4326 | "clear bgp <1-65535>", |
| 4327 | CLEAR_STR |
| 4328 | BGP_STR |
| 4329 | "Clear peers with the AS number\n") |
| 4330 | |
| 4331 | ALIAS (clear_ip_bgp_as, |
| 4332 | clear_bgp_ipv6_as_cmd, |
| 4333 | "clear bgp ipv6 <1-65535>", |
| 4334 | CLEAR_STR |
| 4335 | BGP_STR |
| 4336 | "Address family\n" |
| 4337 | "Clear peers with the AS number\n") |
| 4338 | |
| 4339 | /* Outbound soft-reconfiguration */ |
| 4340 | DEFUN (clear_ip_bgp_all_soft_out, |
| 4341 | clear_ip_bgp_all_soft_out_cmd, |
| 4342 | "clear ip bgp * soft out", |
| 4343 | CLEAR_STR |
| 4344 | IP_STR |
| 4345 | BGP_STR |
| 4346 | "Clear all peers\n" |
| 4347 | "Soft reconfig\n" |
| 4348 | "Soft reconfig outbound update\n") |
| 4349 | { |
| 4350 | if (argc == 1) |
| 4351 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4352 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4353 | |
| 4354 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4355 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4356 | } |
| 4357 | |
| 4358 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4359 | clear_ip_bgp_all_out_cmd, |
| 4360 | "clear ip bgp * out", |
| 4361 | CLEAR_STR |
| 4362 | IP_STR |
| 4363 | BGP_STR |
| 4364 | "Clear all peers\n" |
| 4365 | "Soft reconfig outbound update\n") |
| 4366 | |
| 4367 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4368 | clear_ip_bgp_instance_all_soft_out_cmd, |
| 4369 | "clear ip bgp view WORD * soft out", |
| 4370 | CLEAR_STR |
| 4371 | IP_STR |
| 4372 | BGP_STR |
| 4373 | "BGP view\n" |
| 4374 | "view name\n" |
| 4375 | "Clear all peers\n" |
| 4376 | "Soft reconfig\n" |
| 4377 | "Soft reconfig outbound update\n") |
| 4378 | |
| 4379 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, |
| 4380 | clear_ip_bgp_all_ipv4_soft_out_cmd, |
| 4381 | "clear ip bgp * ipv4 (unicast|multicast) soft out", |
| 4382 | CLEAR_STR |
| 4383 | IP_STR |
| 4384 | BGP_STR |
| 4385 | "Clear all peers\n" |
| 4386 | "Address family\n" |
| 4387 | "Address Family modifier\n" |
| 4388 | "Address Family modifier\n" |
| 4389 | "Soft reconfig\n" |
| 4390 | "Soft reconfig outbound update\n") |
| 4391 | { |
| 4392 | if (strncmp (argv[0], "m", 1) == 0) |
| 4393 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 4394 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4395 | |
| 4396 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4397 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4398 | } |
| 4399 | |
| 4400 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, |
| 4401 | clear_ip_bgp_all_ipv4_out_cmd, |
| 4402 | "clear ip bgp * ipv4 (unicast|multicast) out", |
| 4403 | CLEAR_STR |
| 4404 | IP_STR |
| 4405 | BGP_STR |
| 4406 | "Clear all peers\n" |
| 4407 | "Address family\n" |
| 4408 | "Address Family modifier\n" |
| 4409 | "Address Family modifier\n" |
| 4410 | "Soft reconfig outbound update\n") |
| 4411 | |
| 4412 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
| 4413 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, |
| 4414 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", |
| 4415 | CLEAR_STR |
| 4416 | IP_STR |
| 4417 | BGP_STR |
| 4418 | "BGP view\n" |
| 4419 | "view name\n" |
| 4420 | "Clear all peers\n" |
| 4421 | "Address family\n" |
| 4422 | "Address Family modifier\n" |
| 4423 | "Address Family modifier\n" |
| 4424 | "Soft reconfig outbound update\n") |
| 4425 | { |
| 4426 | if (strncmp (argv[1], "m", 1) == 0) |
| 4427 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 4428 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4429 | |
| 4430 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4431 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4432 | } |
| 4433 | |
| 4434 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, |
| 4435 | clear_ip_bgp_all_vpnv4_soft_out_cmd, |
| 4436 | "clear ip bgp * vpnv4 unicast soft out", |
| 4437 | CLEAR_STR |
| 4438 | IP_STR |
| 4439 | BGP_STR |
| 4440 | "Clear all peers\n" |
| 4441 | "Address family\n" |
| 4442 | "Address Family Modifier\n" |
| 4443 | "Soft reconfig\n" |
| 4444 | "Soft reconfig outbound update\n") |
| 4445 | { |
| 4446 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 4447 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4448 | } |
| 4449 | |
| 4450 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, |
| 4451 | clear_ip_bgp_all_vpnv4_out_cmd, |
| 4452 | "clear ip bgp * vpnv4 unicast out", |
| 4453 | CLEAR_STR |
| 4454 | IP_STR |
| 4455 | BGP_STR |
| 4456 | "Clear all peers\n" |
| 4457 | "Address family\n" |
| 4458 | "Address Family Modifier\n" |
| 4459 | "Soft reconfig outbound update\n") |
| 4460 | |
| 4461 | DEFUN (clear_bgp_all_soft_out, |
| 4462 | clear_bgp_all_soft_out_cmd, |
| 4463 | "clear bgp * soft out", |
| 4464 | CLEAR_STR |
| 4465 | BGP_STR |
| 4466 | "Clear all peers\n" |
| 4467 | "Soft reconfig\n" |
| 4468 | "Soft reconfig outbound update\n") |
| 4469 | { |
| 4470 | if (argc == 1) |
| 4471 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 4472 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4473 | |
| 4474 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 4475 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4476 | } |
| 4477 | |
| 4478 | ALIAS (clear_bgp_all_soft_out, |
| 4479 | clear_bgp_instance_all_soft_out_cmd, |
| 4480 | "clear bgp view WORD * soft out", |
| 4481 | CLEAR_STR |
| 4482 | BGP_STR |
| 4483 | "BGP view\n" |
| 4484 | "view name\n" |
| 4485 | "Clear all peers\n" |
| 4486 | "Soft reconfig\n" |
| 4487 | "Soft reconfig outbound update\n") |
| 4488 | |
| 4489 | ALIAS (clear_bgp_all_soft_out, |
| 4490 | clear_bgp_all_out_cmd, |
| 4491 | "clear bgp * out", |
| 4492 | CLEAR_STR |
| 4493 | BGP_STR |
| 4494 | "Clear all peers\n" |
| 4495 | "Soft reconfig outbound update\n") |
| 4496 | |
| 4497 | ALIAS (clear_bgp_all_soft_out, |
| 4498 | clear_bgp_ipv6_all_soft_out_cmd, |
| 4499 | "clear bgp ipv6 * soft out", |
| 4500 | CLEAR_STR |
| 4501 | BGP_STR |
| 4502 | "Address family\n" |
| 4503 | "Clear all peers\n" |
| 4504 | "Soft reconfig\n" |
| 4505 | "Soft reconfig outbound update\n") |
| 4506 | |
| 4507 | ALIAS (clear_bgp_all_soft_out, |
| 4508 | clear_bgp_ipv6_all_out_cmd, |
| 4509 | "clear bgp ipv6 * out", |
| 4510 | CLEAR_STR |
| 4511 | BGP_STR |
| 4512 | "Address family\n" |
| 4513 | "Clear all peers\n" |
| 4514 | "Soft reconfig outbound update\n") |
| 4515 | |
| 4516 | DEFUN (clear_ip_bgp_peer_soft_out, |
| 4517 | clear_ip_bgp_peer_soft_out_cmd, |
| 4518 | "clear ip bgp A.B.C.D soft out", |
| 4519 | CLEAR_STR |
| 4520 | IP_STR |
| 4521 | BGP_STR |
| 4522 | "BGP neighbor address to clear\n" |
| 4523 | "Soft reconfig\n" |
| 4524 | "Soft reconfig outbound update\n") |
| 4525 | { |
| 4526 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4527 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4528 | } |
| 4529 | |
| 4530 | ALIAS (clear_ip_bgp_peer_soft_out, |
| 4531 | clear_ip_bgp_peer_out_cmd, |
| 4532 | "clear ip bgp A.B.C.D out", |
| 4533 | CLEAR_STR |
| 4534 | IP_STR |
| 4535 | BGP_STR |
| 4536 | "BGP neighbor address to clear\n" |
| 4537 | "Soft reconfig outbound update\n") |
| 4538 | |
| 4539 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
| 4540 | clear_ip_bgp_peer_ipv4_soft_out_cmd, |
| 4541 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", |
| 4542 | CLEAR_STR |
| 4543 | IP_STR |
| 4544 | BGP_STR |
| 4545 | "BGP neighbor address to clear\n" |
| 4546 | "Address family\n" |
| 4547 | "Address Family modifier\n" |
| 4548 | "Address Family modifier\n" |
| 4549 | "Soft reconfig\n" |
| 4550 | "Soft reconfig outbound update\n") |
| 4551 | { |
| 4552 | if (strncmp (argv[1], "m", 1) == 0) |
| 4553 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 4554 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4555 | |
| 4556 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4557 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4558 | } |
| 4559 | |
| 4560 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, |
| 4561 | clear_ip_bgp_peer_ipv4_out_cmd, |
| 4562 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", |
| 4563 | CLEAR_STR |
| 4564 | IP_STR |
| 4565 | BGP_STR |
| 4566 | "BGP neighbor address to clear\n" |
| 4567 | "Address family\n" |
| 4568 | "Address Family modifier\n" |
| 4569 | "Address Family modifier\n" |
| 4570 | "Soft reconfig outbound update\n") |
| 4571 | |
| 4572 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4573 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, |
| 4574 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", |
| 4575 | CLEAR_STR |
| 4576 | IP_STR |
| 4577 | BGP_STR |
| 4578 | "BGP neighbor address to clear\n" |
| 4579 | "Address family\n" |
| 4580 | "Address Family Modifier\n" |
| 4581 | "Soft reconfig\n" |
| 4582 | "Soft reconfig outbound update\n") |
| 4583 | { |
| 4584 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 4585 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4586 | } |
| 4587 | |
| 4588 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4589 | clear_ip_bgp_peer_vpnv4_out_cmd, |
| 4590 | "clear ip bgp A.B.C.D vpnv4 unicast out", |
| 4591 | CLEAR_STR |
| 4592 | IP_STR |
| 4593 | BGP_STR |
| 4594 | "BGP neighbor address to clear\n" |
| 4595 | "Address family\n" |
| 4596 | "Address Family Modifier\n" |
| 4597 | "Soft reconfig outbound update\n") |
| 4598 | |
| 4599 | DEFUN (clear_bgp_peer_soft_out, |
| 4600 | clear_bgp_peer_soft_out_cmd, |
| 4601 | "clear bgp (A.B.C.D|X:X::X:X) soft out", |
| 4602 | CLEAR_STR |
| 4603 | BGP_STR |
| 4604 | "BGP neighbor address to clear\n" |
| 4605 | "BGP IPv6 neighbor to clear\n" |
| 4606 | "Soft reconfig\n" |
| 4607 | "Soft reconfig outbound update\n") |
| 4608 | { |
| 4609 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 4610 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4611 | } |
| 4612 | |
| 4613 | ALIAS (clear_bgp_peer_soft_out, |
| 4614 | clear_bgp_ipv6_peer_soft_out_cmd, |
| 4615 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out", |
| 4616 | CLEAR_STR |
| 4617 | BGP_STR |
| 4618 | "Address family\n" |
| 4619 | "BGP neighbor address to clear\n" |
| 4620 | "BGP IPv6 neighbor to clear\n" |
| 4621 | "Soft reconfig\n" |
| 4622 | "Soft reconfig outbound update\n") |
| 4623 | |
| 4624 | ALIAS (clear_bgp_peer_soft_out, |
| 4625 | clear_bgp_peer_out_cmd, |
| 4626 | "clear bgp (A.B.C.D|X:X::X:X) out", |
| 4627 | CLEAR_STR |
| 4628 | BGP_STR |
| 4629 | "BGP neighbor address to clear\n" |
| 4630 | "BGP IPv6 neighbor to clear\n" |
| 4631 | "Soft reconfig outbound update\n") |
| 4632 | |
| 4633 | ALIAS (clear_bgp_peer_soft_out, |
| 4634 | clear_bgp_ipv6_peer_out_cmd, |
| 4635 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) out", |
| 4636 | CLEAR_STR |
| 4637 | BGP_STR |
| 4638 | "Address family\n" |
| 4639 | "BGP neighbor address to clear\n" |
| 4640 | "BGP IPv6 neighbor to clear\n" |
| 4641 | "Soft reconfig outbound update\n") |
| 4642 | |
| 4643 | DEFUN (clear_ip_bgp_peer_group_soft_out, |
| 4644 | clear_ip_bgp_peer_group_soft_out_cmd, |
| 4645 | "clear ip bgp peer-group WORD soft out", |
| 4646 | CLEAR_STR |
| 4647 | IP_STR |
| 4648 | BGP_STR |
| 4649 | "Clear all members of peer-group\n" |
| 4650 | "BGP peer-group name\n" |
| 4651 | "Soft reconfig\n" |
| 4652 | "Soft reconfig outbound update\n") |
| 4653 | { |
| 4654 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4655 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4656 | } |
| 4657 | |
| 4658 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
| 4659 | clear_ip_bgp_peer_group_out_cmd, |
| 4660 | "clear ip bgp peer-group WORD out", |
| 4661 | CLEAR_STR |
| 4662 | IP_STR |
| 4663 | BGP_STR |
| 4664 | "Clear all members of peer-group\n" |
| 4665 | "BGP peer-group name\n" |
| 4666 | "Soft reconfig outbound update\n") |
| 4667 | |
| 4668 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4669 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, |
| 4670 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", |
| 4671 | CLEAR_STR |
| 4672 | IP_STR |
| 4673 | BGP_STR |
| 4674 | "Clear all members of peer-group\n" |
| 4675 | "BGP peer-group name\n" |
| 4676 | "Address family\n" |
| 4677 | "Address Family modifier\n" |
| 4678 | "Address Family modifier\n" |
| 4679 | "Soft reconfig\n" |
| 4680 | "Soft reconfig outbound update\n") |
| 4681 | { |
| 4682 | if (strncmp (argv[1], "m", 1) == 0) |
| 4683 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 4684 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4685 | |
| 4686 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4687 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4688 | } |
| 4689 | |
| 4690 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4691 | clear_ip_bgp_peer_group_ipv4_out_cmd, |
| 4692 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", |
| 4693 | CLEAR_STR |
| 4694 | IP_STR |
| 4695 | BGP_STR |
| 4696 | "Clear all members of peer-group\n" |
| 4697 | "BGP peer-group name\n" |
| 4698 | "Address family\n" |
| 4699 | "Address Family modifier\n" |
| 4700 | "Address Family modifier\n" |
| 4701 | "Soft reconfig outbound update\n") |
| 4702 | |
| 4703 | DEFUN (clear_bgp_peer_group_soft_out, |
| 4704 | clear_bgp_peer_group_soft_out_cmd, |
| 4705 | "clear bgp peer-group WORD soft out", |
| 4706 | CLEAR_STR |
| 4707 | BGP_STR |
| 4708 | "Clear all members of peer-group\n" |
| 4709 | "BGP peer-group name\n" |
| 4710 | "Soft reconfig\n" |
| 4711 | "Soft reconfig outbound update\n") |
| 4712 | { |
| 4713 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 4714 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4715 | } |
| 4716 | |
| 4717 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4718 | clear_bgp_ipv6_peer_group_soft_out_cmd, |
| 4719 | "clear bgp ipv6 peer-group WORD soft out", |
| 4720 | CLEAR_STR |
| 4721 | BGP_STR |
| 4722 | "Address family\n" |
| 4723 | "Clear all members of peer-group\n" |
| 4724 | "BGP peer-group name\n" |
| 4725 | "Soft reconfig\n" |
| 4726 | "Soft reconfig outbound update\n") |
| 4727 | |
| 4728 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4729 | clear_bgp_peer_group_out_cmd, |
| 4730 | "clear bgp peer-group WORD out", |
| 4731 | CLEAR_STR |
| 4732 | BGP_STR |
| 4733 | "Clear all members of peer-group\n" |
| 4734 | "BGP peer-group name\n" |
| 4735 | "Soft reconfig outbound update\n") |
| 4736 | |
| 4737 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4738 | clear_bgp_ipv6_peer_group_out_cmd, |
| 4739 | "clear bgp ipv6 peer-group WORD out", |
| 4740 | CLEAR_STR |
| 4741 | BGP_STR |
| 4742 | "Address family\n" |
| 4743 | "Clear all members of peer-group\n" |
| 4744 | "BGP peer-group name\n" |
| 4745 | "Soft reconfig outbound update\n") |
| 4746 | |
| 4747 | DEFUN (clear_ip_bgp_external_soft_out, |
| 4748 | clear_ip_bgp_external_soft_out_cmd, |
| 4749 | "clear ip bgp external soft out", |
| 4750 | CLEAR_STR |
| 4751 | IP_STR |
| 4752 | BGP_STR |
| 4753 | "Clear all external peers\n" |
| 4754 | "Soft reconfig\n" |
| 4755 | "Soft reconfig outbound update\n") |
| 4756 | { |
| 4757 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 4758 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4759 | } |
| 4760 | |
| 4761 | ALIAS (clear_ip_bgp_external_soft_out, |
| 4762 | clear_ip_bgp_external_out_cmd, |
| 4763 | "clear ip bgp external out", |
| 4764 | CLEAR_STR |
| 4765 | IP_STR |
| 4766 | BGP_STR |
| 4767 | "Clear all external peers\n" |
| 4768 | "Soft reconfig outbound update\n") |
| 4769 | |
| 4770 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, |
| 4771 | clear_ip_bgp_external_ipv4_soft_out_cmd, |
| 4772 | "clear ip bgp external ipv4 (unicast|multicast) soft out", |
| 4773 | CLEAR_STR |
| 4774 | IP_STR |
| 4775 | BGP_STR |
| 4776 | "Clear all external peers\n" |
| 4777 | "Address family\n" |
| 4778 | "Address Family modifier\n" |
| 4779 | "Address Family modifier\n" |
| 4780 | "Soft reconfig\n" |
| 4781 | "Soft reconfig outbound update\n") |
| 4782 | { |
| 4783 | if (strncmp (argv[0], "m", 1) == 0) |
| 4784 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 4785 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4786 | |
| 4787 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 4788 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4789 | } |
| 4790 | |
| 4791 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, |
| 4792 | clear_ip_bgp_external_ipv4_out_cmd, |
| 4793 | "clear ip bgp external ipv4 (unicast|multicast) out", |
| 4794 | CLEAR_STR |
| 4795 | IP_STR |
| 4796 | BGP_STR |
| 4797 | "Clear all external peers\n" |
| 4798 | "Address family\n" |
| 4799 | "Address Family modifier\n" |
| 4800 | "Address Family modifier\n" |
| 4801 | "Soft reconfig outbound update\n") |
| 4802 | |
| 4803 | DEFUN (clear_bgp_external_soft_out, |
| 4804 | clear_bgp_external_soft_out_cmd, |
| 4805 | "clear bgp external soft out", |
| 4806 | CLEAR_STR |
| 4807 | BGP_STR |
| 4808 | "Clear all external peers\n" |
| 4809 | "Soft reconfig\n" |
| 4810 | "Soft reconfig outbound update\n") |
| 4811 | { |
| 4812 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 4813 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4814 | } |
| 4815 | |
| 4816 | ALIAS (clear_bgp_external_soft_out, |
| 4817 | clear_bgp_ipv6_external_soft_out_cmd, |
| 4818 | "clear bgp ipv6 external soft out", |
| 4819 | CLEAR_STR |
| 4820 | BGP_STR |
| 4821 | "Address family\n" |
| 4822 | "Clear all external peers\n" |
| 4823 | "Soft reconfig\n" |
| 4824 | "Soft reconfig outbound update\n") |
| 4825 | |
| 4826 | ALIAS (clear_bgp_external_soft_out, |
| 4827 | clear_bgp_external_out_cmd, |
| 4828 | "clear bgp external out", |
| 4829 | CLEAR_STR |
| 4830 | BGP_STR |
| 4831 | "Clear all external peers\n" |
| 4832 | "Soft reconfig outbound update\n") |
| 4833 | |
| 4834 | ALIAS (clear_bgp_external_soft_out, |
| 4835 | clear_bgp_ipv6_external_out_cmd, |
| 4836 | "clear bgp ipv6 external WORD out", |
| 4837 | CLEAR_STR |
| 4838 | BGP_STR |
| 4839 | "Address family\n" |
| 4840 | "Clear all external peers\n" |
| 4841 | "Soft reconfig outbound update\n") |
| 4842 | |
| 4843 | DEFUN (clear_ip_bgp_as_soft_out, |
| 4844 | clear_ip_bgp_as_soft_out_cmd, |
| 4845 | "clear ip bgp <1-65535> soft out", |
| 4846 | CLEAR_STR |
| 4847 | IP_STR |
| 4848 | BGP_STR |
| 4849 | "Clear peers with the AS number\n" |
| 4850 | "Soft reconfig\n" |
| 4851 | "Soft reconfig outbound update\n") |
| 4852 | { |
| 4853 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 4854 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4855 | } |
| 4856 | |
| 4857 | ALIAS (clear_ip_bgp_as_soft_out, |
| 4858 | clear_ip_bgp_as_out_cmd, |
| 4859 | "clear ip bgp <1-65535> out", |
| 4860 | CLEAR_STR |
| 4861 | IP_STR |
| 4862 | BGP_STR |
| 4863 | "Clear peers with the AS number\n" |
| 4864 | "Soft reconfig outbound update\n") |
| 4865 | |
| 4866 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
| 4867 | clear_ip_bgp_as_ipv4_soft_out_cmd, |
| 4868 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft out", |
| 4869 | CLEAR_STR |
| 4870 | IP_STR |
| 4871 | BGP_STR |
| 4872 | "Clear peers with the AS number\n" |
| 4873 | "Address family\n" |
| 4874 | "Address Family modifier\n" |
| 4875 | "Address Family modifier\n" |
| 4876 | "Soft reconfig\n" |
| 4877 | "Soft reconfig outbound update\n") |
| 4878 | { |
| 4879 | if (strncmp (argv[1], "m", 1) == 0) |
| 4880 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 4881 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4882 | |
| 4883 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 4884 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4885 | } |
| 4886 | |
| 4887 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, |
| 4888 | clear_ip_bgp_as_ipv4_out_cmd, |
| 4889 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) out", |
| 4890 | CLEAR_STR |
| 4891 | IP_STR |
| 4892 | BGP_STR |
| 4893 | "Clear peers with the AS number\n" |
| 4894 | "Address family\n" |
| 4895 | "Address Family modifier\n" |
| 4896 | "Address Family modifier\n" |
| 4897 | "Soft reconfig outbound update\n") |
| 4898 | |
| 4899 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
| 4900 | clear_ip_bgp_as_vpnv4_soft_out_cmd, |
| 4901 | "clear ip bgp <1-65535> vpnv4 unicast soft out", |
| 4902 | CLEAR_STR |
| 4903 | IP_STR |
| 4904 | BGP_STR |
| 4905 | "Clear peers with the AS number\n" |
| 4906 | "Address family\n" |
| 4907 | "Address Family modifier\n" |
| 4908 | "Soft reconfig\n" |
| 4909 | "Soft reconfig outbound update\n") |
| 4910 | { |
| 4911 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 4912 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4913 | } |
| 4914 | |
| 4915 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, |
| 4916 | clear_ip_bgp_as_vpnv4_out_cmd, |
| 4917 | "clear ip bgp <1-65535> vpnv4 unicast out", |
| 4918 | CLEAR_STR |
| 4919 | IP_STR |
| 4920 | BGP_STR |
| 4921 | "Clear peers with the AS number\n" |
| 4922 | "Address family\n" |
| 4923 | "Address Family modifier\n" |
| 4924 | "Soft reconfig outbound update\n") |
| 4925 | |
| 4926 | DEFUN (clear_bgp_as_soft_out, |
| 4927 | clear_bgp_as_soft_out_cmd, |
| 4928 | "clear bgp <1-65535> soft out", |
| 4929 | CLEAR_STR |
| 4930 | BGP_STR |
| 4931 | "Clear peers with the AS number\n" |
| 4932 | "Soft reconfig\n" |
| 4933 | "Soft reconfig outbound update\n") |
| 4934 | { |
| 4935 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 4936 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4937 | } |
| 4938 | |
| 4939 | ALIAS (clear_bgp_as_soft_out, |
| 4940 | clear_bgp_ipv6_as_soft_out_cmd, |
| 4941 | "clear bgp ipv6 <1-65535> soft out", |
| 4942 | CLEAR_STR |
| 4943 | BGP_STR |
| 4944 | "Address family\n" |
| 4945 | "Clear peers with the AS number\n" |
| 4946 | "Soft reconfig\n" |
| 4947 | "Soft reconfig outbound update\n") |
| 4948 | |
| 4949 | ALIAS (clear_bgp_as_soft_out, |
| 4950 | clear_bgp_as_out_cmd, |
| 4951 | "clear bgp <1-65535> out", |
| 4952 | CLEAR_STR |
| 4953 | BGP_STR |
| 4954 | "Clear peers with the AS number\n" |
| 4955 | "Soft reconfig outbound update\n") |
| 4956 | |
| 4957 | ALIAS (clear_bgp_as_soft_out, |
| 4958 | clear_bgp_ipv6_as_out_cmd, |
| 4959 | "clear bgp ipv6 <1-65535> out", |
| 4960 | CLEAR_STR |
| 4961 | BGP_STR |
| 4962 | "Address family\n" |
| 4963 | "Clear peers with the AS number\n" |
| 4964 | "Soft reconfig outbound update\n") |
| 4965 | |
| 4966 | /* Inbound soft-reconfiguration */ |
| 4967 | DEFUN (clear_ip_bgp_all_soft_in, |
| 4968 | clear_ip_bgp_all_soft_in_cmd, |
| 4969 | "clear ip bgp * soft in", |
| 4970 | CLEAR_STR |
| 4971 | IP_STR |
| 4972 | BGP_STR |
| 4973 | "Clear all peers\n" |
| 4974 | "Soft reconfig\n" |
| 4975 | "Soft reconfig inbound update\n") |
| 4976 | { |
| 4977 | if (argc == 1) |
| 4978 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4979 | BGP_CLEAR_SOFT_IN, NULL); |
| 4980 | |
| 4981 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4982 | BGP_CLEAR_SOFT_IN, NULL); |
| 4983 | } |
| 4984 | |
| 4985 | ALIAS (clear_ip_bgp_all_soft_in, |
| 4986 | clear_ip_bgp_instance_all_soft_in_cmd, |
| 4987 | "clear ip bgp view WORD * soft in", |
| 4988 | CLEAR_STR |
| 4989 | IP_STR |
| 4990 | BGP_STR |
| 4991 | "BGP view\n" |
| 4992 | "view name\n" |
| 4993 | "Clear all peers\n" |
| 4994 | "Soft reconfig\n" |
| 4995 | "Soft reconfig inbound update\n") |
| 4996 | |
| 4997 | ALIAS (clear_ip_bgp_all_soft_in, |
| 4998 | clear_ip_bgp_all_in_cmd, |
| 4999 | "clear ip bgp * in", |
| 5000 | CLEAR_STR |
| 5001 | IP_STR |
| 5002 | BGP_STR |
| 5003 | "Clear all peers\n" |
| 5004 | "Soft reconfig inbound update\n") |
| 5005 | |
| 5006 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
| 5007 | clear_ip_bgp_all_in_prefix_filter_cmd, |
| 5008 | "clear ip bgp * in prefix-filter", |
| 5009 | CLEAR_STR |
| 5010 | IP_STR |
| 5011 | BGP_STR |
| 5012 | "Clear all peers\n" |
| 5013 | "Soft reconfig inbound update\n" |
| 5014 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5015 | { |
| 5016 | if (argc== 1) |
| 5017 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5018 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5019 | |
| 5020 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5021 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5022 | } |
| 5023 | |
| 5024 | ALIAS (clear_ip_bgp_all_in_prefix_filter, |
| 5025 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, |
| 5026 | "clear ip bgp view WORD * in prefix-filter", |
| 5027 | CLEAR_STR |
| 5028 | IP_STR |
| 5029 | BGP_STR |
| 5030 | "BGP view\n" |
| 5031 | "view name\n" |
| 5032 | "Clear all peers\n" |
| 5033 | "Soft reconfig inbound update\n" |
| 5034 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5035 | |
| 5036 | |
| 5037 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
| 5038 | clear_ip_bgp_all_ipv4_soft_in_cmd, |
| 5039 | "clear ip bgp * ipv4 (unicast|multicast) soft in", |
| 5040 | CLEAR_STR |
| 5041 | IP_STR |
| 5042 | BGP_STR |
| 5043 | "Clear all peers\n" |
| 5044 | "Address family\n" |
| 5045 | "Address Family modifier\n" |
| 5046 | "Address Family modifier\n" |
| 5047 | "Soft reconfig\n" |
| 5048 | "Soft reconfig inbound update\n") |
| 5049 | { |
| 5050 | if (strncmp (argv[0], "m", 1) == 0) |
| 5051 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5052 | BGP_CLEAR_SOFT_IN, NULL); |
| 5053 | |
| 5054 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5055 | BGP_CLEAR_SOFT_IN, NULL); |
| 5056 | } |
| 5057 | |
| 5058 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, |
| 5059 | clear_ip_bgp_all_ipv4_in_cmd, |
| 5060 | "clear ip bgp * ipv4 (unicast|multicast) in", |
| 5061 | CLEAR_STR |
| 5062 | IP_STR |
| 5063 | BGP_STR |
| 5064 | "Clear all peers\n" |
| 5065 | "Address family\n" |
| 5066 | "Address Family modifier\n" |
| 5067 | "Address Family modifier\n" |
| 5068 | "Soft reconfig inbound update\n") |
| 5069 | |
| 5070 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
| 5071 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, |
| 5072 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", |
| 5073 | CLEAR_STR |
| 5074 | IP_STR |
| 5075 | BGP_STR |
| 5076 | "BGP view\n" |
| 5077 | "view name\n" |
| 5078 | "Clear all peers\n" |
| 5079 | "Address family\n" |
| 5080 | "Address Family modifier\n" |
| 5081 | "Address Family modifier\n" |
| 5082 | "Soft reconfig\n" |
| 5083 | "Soft reconfig inbound update\n") |
| 5084 | { |
| 5085 | if (strncmp (argv[1], "m", 1) == 0) |
| 5086 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5087 | BGP_CLEAR_SOFT_IN, NULL); |
| 5088 | |
| 5089 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5090 | BGP_CLEAR_SOFT_IN, NULL); |
| 5091 | } |
| 5092 | |
| 5093 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
| 5094 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, |
| 5095 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", |
| 5096 | CLEAR_STR |
| 5097 | IP_STR |
| 5098 | BGP_STR |
| 5099 | "Clear all peers\n" |
| 5100 | "Address family\n" |
| 5101 | "Address Family modifier\n" |
| 5102 | "Address Family modifier\n" |
| 5103 | "Soft reconfig inbound update\n" |
| 5104 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5105 | { |
| 5106 | if (strncmp (argv[0], "m", 1) == 0) |
| 5107 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5108 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5109 | |
| 5110 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5111 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5112 | } |
| 5113 | |
| 5114 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, |
| 5115 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, |
| 5116 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", |
| 5117 | CLEAR_STR |
| 5118 | IP_STR |
| 5119 | BGP_STR |
| 5120 | "Clear all peers\n" |
| 5121 | "Address family\n" |
| 5122 | "Address Family modifier\n" |
| 5123 | "Address Family modifier\n" |
| 5124 | "Soft reconfig inbound update\n" |
| 5125 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5126 | { |
| 5127 | if (strncmp (argv[1], "m", 1) == 0) |
| 5128 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5129 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5130 | |
| 5131 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5132 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5133 | } |
| 5134 | |
| 5135 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, |
| 5136 | clear_ip_bgp_all_vpnv4_soft_in_cmd, |
| 5137 | "clear ip bgp * vpnv4 unicast soft in", |
| 5138 | CLEAR_STR |
| 5139 | IP_STR |
| 5140 | BGP_STR |
| 5141 | "Clear all peers\n" |
| 5142 | "Address family\n" |
| 5143 | "Address Family Modifier\n" |
| 5144 | "Soft reconfig\n" |
| 5145 | "Soft reconfig inbound update\n") |
| 5146 | { |
| 5147 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 5148 | BGP_CLEAR_SOFT_IN, NULL); |
| 5149 | } |
| 5150 | |
| 5151 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, |
| 5152 | clear_ip_bgp_all_vpnv4_in_cmd, |
| 5153 | "clear ip bgp * vpnv4 unicast in", |
| 5154 | CLEAR_STR |
| 5155 | IP_STR |
| 5156 | BGP_STR |
| 5157 | "Clear all peers\n" |
| 5158 | "Address family\n" |
| 5159 | "Address Family Modifier\n" |
| 5160 | "Soft reconfig inbound update\n") |
| 5161 | |
| 5162 | DEFUN (clear_bgp_all_soft_in, |
| 5163 | clear_bgp_all_soft_in_cmd, |
| 5164 | "clear bgp * soft in", |
| 5165 | CLEAR_STR |
| 5166 | BGP_STR |
| 5167 | "Clear all peers\n" |
| 5168 | "Soft reconfig\n" |
| 5169 | "Soft reconfig inbound update\n") |
| 5170 | { |
| 5171 | if (argc == 1) |
| 5172 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 5173 | BGP_CLEAR_SOFT_IN, NULL); |
| 5174 | |
| 5175 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5176 | BGP_CLEAR_SOFT_IN, NULL); |
| 5177 | } |
| 5178 | |
| 5179 | ALIAS (clear_bgp_all_soft_in, |
| 5180 | clear_bgp_instance_all_soft_in_cmd, |
| 5181 | "clear bgp view WORD * soft in", |
| 5182 | CLEAR_STR |
| 5183 | BGP_STR |
| 5184 | "BGP view\n" |
| 5185 | "view name\n" |
| 5186 | "Clear all peers\n" |
| 5187 | "Soft reconfig\n" |
| 5188 | "Soft reconfig inbound update\n") |
| 5189 | |
| 5190 | ALIAS (clear_bgp_all_soft_in, |
| 5191 | clear_bgp_ipv6_all_soft_in_cmd, |
| 5192 | "clear bgp ipv6 * soft in", |
| 5193 | CLEAR_STR |
| 5194 | BGP_STR |
| 5195 | "Address family\n" |
| 5196 | "Clear all peers\n" |
| 5197 | "Soft reconfig\n" |
| 5198 | "Soft reconfig inbound update\n") |
| 5199 | |
| 5200 | ALIAS (clear_bgp_all_soft_in, |
| 5201 | clear_bgp_all_in_cmd, |
| 5202 | "clear bgp * in", |
| 5203 | CLEAR_STR |
| 5204 | BGP_STR |
| 5205 | "Clear all peers\n" |
| 5206 | "Soft reconfig inbound update\n") |
| 5207 | |
| 5208 | ALIAS (clear_bgp_all_soft_in, |
| 5209 | clear_bgp_ipv6_all_in_cmd, |
| 5210 | "clear bgp ipv6 * in", |
| 5211 | CLEAR_STR |
| 5212 | BGP_STR |
| 5213 | "Address family\n" |
| 5214 | "Clear all peers\n" |
| 5215 | "Soft reconfig inbound update\n") |
| 5216 | |
| 5217 | DEFUN (clear_bgp_all_in_prefix_filter, |
| 5218 | clear_bgp_all_in_prefix_filter_cmd, |
| 5219 | "clear bgp * in prefix-filter", |
| 5220 | CLEAR_STR |
| 5221 | BGP_STR |
| 5222 | "Clear all peers\n" |
| 5223 | "Soft reconfig inbound update\n" |
| 5224 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5225 | { |
| 5226 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5227 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5228 | } |
| 5229 | |
| 5230 | ALIAS (clear_bgp_all_in_prefix_filter, |
| 5231 | clear_bgp_ipv6_all_in_prefix_filter_cmd, |
| 5232 | "clear bgp ipv6 * in prefix-filter", |
| 5233 | CLEAR_STR |
| 5234 | BGP_STR |
| 5235 | "Address family\n" |
| 5236 | "Clear all peers\n" |
| 5237 | "Soft reconfig inbound update\n" |
| 5238 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5239 | |
| 5240 | DEFUN (clear_ip_bgp_peer_soft_in, |
| 5241 | clear_ip_bgp_peer_soft_in_cmd, |
| 5242 | "clear ip bgp A.B.C.D soft in", |
| 5243 | CLEAR_STR |
| 5244 | IP_STR |
| 5245 | BGP_STR |
| 5246 | "BGP neighbor address to clear\n" |
| 5247 | "Soft reconfig\n" |
| 5248 | "Soft reconfig inbound update\n") |
| 5249 | { |
| 5250 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5251 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5252 | } |
| 5253 | |
| 5254 | ALIAS (clear_ip_bgp_peer_soft_in, |
| 5255 | clear_ip_bgp_peer_in_cmd, |
| 5256 | "clear ip bgp A.B.C.D in", |
| 5257 | CLEAR_STR |
| 5258 | IP_STR |
| 5259 | BGP_STR |
| 5260 | "BGP neighbor address to clear\n" |
| 5261 | "Soft reconfig inbound update\n") |
| 5262 | |
| 5263 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
| 5264 | clear_ip_bgp_peer_in_prefix_filter_cmd, |
| 5265 | "clear ip bgp A.B.C.D in prefix-filter", |
| 5266 | CLEAR_STR |
| 5267 | IP_STR |
| 5268 | BGP_STR |
| 5269 | "BGP neighbor address to clear\n" |
| 5270 | "Soft reconfig inbound update\n" |
| 5271 | "Push out the existing ORF prefix-list\n") |
| 5272 | { |
| 5273 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5274 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5275 | } |
| 5276 | |
| 5277 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, |
| 5278 | clear_ip_bgp_peer_ipv4_soft_in_cmd, |
| 5279 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", |
| 5280 | CLEAR_STR |
| 5281 | IP_STR |
| 5282 | BGP_STR |
| 5283 | "BGP neighbor address to clear\n" |
| 5284 | "Address family\n" |
| 5285 | "Address Family modifier\n" |
| 5286 | "Address Family modifier\n" |
| 5287 | "Soft reconfig\n" |
| 5288 | "Soft reconfig inbound update\n") |
| 5289 | { |
| 5290 | if (strncmp (argv[1], "m", 1) == 0) |
| 5291 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5292 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5293 | |
| 5294 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5295 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5296 | } |
| 5297 | |
| 5298 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, |
| 5299 | clear_ip_bgp_peer_ipv4_in_cmd, |
| 5300 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", |
| 5301 | CLEAR_STR |
| 5302 | IP_STR |
| 5303 | BGP_STR |
| 5304 | "BGP neighbor address to clear\n" |
| 5305 | "Address family\n" |
| 5306 | "Address Family modifier\n" |
| 5307 | "Address Family modifier\n" |
| 5308 | "Soft reconfig inbound update\n") |
| 5309 | |
| 5310 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
| 5311 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, |
| 5312 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", |
| 5313 | CLEAR_STR |
| 5314 | IP_STR |
| 5315 | BGP_STR |
| 5316 | "BGP neighbor address to clear\n" |
| 5317 | "Address family\n" |
| 5318 | "Address Family modifier\n" |
| 5319 | "Address Family modifier\n" |
| 5320 | "Soft reconfig inbound update\n" |
| 5321 | "Push out the existing ORF prefix-list\n") |
| 5322 | { |
| 5323 | if (strncmp (argv[1], "m", 1) == 0) |
| 5324 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5325 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5326 | |
| 5327 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5328 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5329 | } |
| 5330 | |
| 5331 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5332 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, |
| 5333 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", |
| 5334 | CLEAR_STR |
| 5335 | IP_STR |
| 5336 | BGP_STR |
| 5337 | "BGP neighbor address to clear\n" |
| 5338 | "Address family\n" |
| 5339 | "Address Family Modifier\n" |
| 5340 | "Soft reconfig\n" |
| 5341 | "Soft reconfig inbound update\n") |
| 5342 | { |
| 5343 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 5344 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5345 | } |
| 5346 | |
| 5347 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5348 | clear_ip_bgp_peer_vpnv4_in_cmd, |
| 5349 | "clear ip bgp A.B.C.D vpnv4 unicast in", |
| 5350 | CLEAR_STR |
| 5351 | IP_STR |
| 5352 | BGP_STR |
| 5353 | "BGP neighbor address to clear\n" |
| 5354 | "Address family\n" |
| 5355 | "Address Family Modifier\n" |
| 5356 | "Soft reconfig inbound update\n") |
| 5357 | |
| 5358 | DEFUN (clear_bgp_peer_soft_in, |
| 5359 | clear_bgp_peer_soft_in_cmd, |
| 5360 | "clear bgp (A.B.C.D|X:X::X:X) soft in", |
| 5361 | CLEAR_STR |
| 5362 | BGP_STR |
| 5363 | "BGP neighbor address to clear\n" |
| 5364 | "BGP IPv6 neighbor to clear\n" |
| 5365 | "Soft reconfig\n" |
| 5366 | "Soft reconfig inbound update\n") |
| 5367 | { |
| 5368 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5369 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5370 | } |
| 5371 | |
| 5372 | ALIAS (clear_bgp_peer_soft_in, |
| 5373 | clear_bgp_ipv6_peer_soft_in_cmd, |
| 5374 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in", |
| 5375 | CLEAR_STR |
| 5376 | BGP_STR |
| 5377 | "Address family\n" |
| 5378 | "BGP neighbor address to clear\n" |
| 5379 | "BGP IPv6 neighbor to clear\n" |
| 5380 | "Soft reconfig\n" |
| 5381 | "Soft reconfig inbound update\n") |
| 5382 | |
| 5383 | ALIAS (clear_bgp_peer_soft_in, |
| 5384 | clear_bgp_peer_in_cmd, |
| 5385 | "clear bgp (A.B.C.D|X:X::X:X) in", |
| 5386 | CLEAR_STR |
| 5387 | BGP_STR |
| 5388 | "BGP neighbor address to clear\n" |
| 5389 | "BGP IPv6 neighbor to clear\n" |
| 5390 | "Soft reconfig inbound update\n") |
| 5391 | |
| 5392 | ALIAS (clear_bgp_peer_soft_in, |
| 5393 | clear_bgp_ipv6_peer_in_cmd, |
| 5394 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in", |
| 5395 | CLEAR_STR |
| 5396 | BGP_STR |
| 5397 | "Address family\n" |
| 5398 | "BGP neighbor address to clear\n" |
| 5399 | "BGP IPv6 neighbor to clear\n" |
| 5400 | "Soft reconfig inbound update\n") |
| 5401 | |
| 5402 | DEFUN (clear_bgp_peer_in_prefix_filter, |
| 5403 | clear_bgp_peer_in_prefix_filter_cmd, |
| 5404 | "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5405 | CLEAR_STR |
| 5406 | BGP_STR |
| 5407 | "BGP neighbor address to clear\n" |
| 5408 | "BGP IPv6 neighbor to clear\n" |
| 5409 | "Soft reconfig inbound update\n" |
| 5410 | "Push out the existing ORF prefix-list\n") |
| 5411 | { |
| 5412 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5413 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5414 | } |
| 5415 | |
| 5416 | ALIAS (clear_bgp_peer_in_prefix_filter, |
| 5417 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, |
| 5418 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5419 | CLEAR_STR |
| 5420 | BGP_STR |
| 5421 | "Address family\n" |
| 5422 | "BGP neighbor address to clear\n" |
| 5423 | "BGP IPv6 neighbor to clear\n" |
| 5424 | "Soft reconfig inbound update\n" |
| 5425 | "Push out the existing ORF prefix-list\n") |
| 5426 | |
| 5427 | DEFUN (clear_ip_bgp_peer_group_soft_in, |
| 5428 | clear_ip_bgp_peer_group_soft_in_cmd, |
| 5429 | "clear ip bgp peer-group WORD soft in", |
| 5430 | CLEAR_STR |
| 5431 | IP_STR |
| 5432 | BGP_STR |
| 5433 | "Clear all members of peer-group\n" |
| 5434 | "BGP peer-group name\n" |
| 5435 | "Soft reconfig\n" |
| 5436 | "Soft reconfig inbound update\n") |
| 5437 | { |
| 5438 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5439 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5440 | } |
| 5441 | |
| 5442 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
| 5443 | clear_ip_bgp_peer_group_in_cmd, |
| 5444 | "clear ip bgp peer-group WORD in", |
| 5445 | CLEAR_STR |
| 5446 | IP_STR |
| 5447 | BGP_STR |
| 5448 | "Clear all members of peer-group\n" |
| 5449 | "BGP peer-group name\n" |
| 5450 | "Soft reconfig inbound update\n") |
| 5451 | |
| 5452 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
| 5453 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, |
| 5454 | "clear ip bgp peer-group WORD in prefix-filter", |
| 5455 | CLEAR_STR |
| 5456 | IP_STR |
| 5457 | BGP_STR |
| 5458 | "Clear all members of peer-group\n" |
| 5459 | "BGP peer-group name\n" |
| 5460 | "Soft reconfig inbound update\n" |
| 5461 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5462 | { |
| 5463 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5464 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5465 | } |
| 5466 | |
| 5467 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5468 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, |
| 5469 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", |
| 5470 | CLEAR_STR |
| 5471 | IP_STR |
| 5472 | BGP_STR |
| 5473 | "Clear all members of peer-group\n" |
| 5474 | "BGP peer-group name\n" |
| 5475 | "Address family\n" |
| 5476 | "Address Family modifier\n" |
| 5477 | "Address Family modifier\n" |
| 5478 | "Soft reconfig\n" |
| 5479 | "Soft reconfig inbound update\n") |
| 5480 | { |
| 5481 | if (strncmp (argv[1], "m", 1) == 0) |
| 5482 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5483 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5484 | |
| 5485 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5486 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5487 | } |
| 5488 | |
| 5489 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5490 | clear_ip_bgp_peer_group_ipv4_in_cmd, |
| 5491 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", |
| 5492 | CLEAR_STR |
| 5493 | IP_STR |
| 5494 | BGP_STR |
| 5495 | "Clear all members of peer-group\n" |
| 5496 | "BGP peer-group name\n" |
| 5497 | "Address family\n" |
| 5498 | "Address Family modifier\n" |
| 5499 | "Address Family modifier\n" |
| 5500 | "Soft reconfig inbound update\n") |
| 5501 | |
| 5502 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
| 5503 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, |
| 5504 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", |
| 5505 | CLEAR_STR |
| 5506 | IP_STR |
| 5507 | BGP_STR |
| 5508 | "Clear all members of peer-group\n" |
| 5509 | "BGP peer-group name\n" |
| 5510 | "Address family\n" |
| 5511 | "Address Family modifier\n" |
| 5512 | "Address Family modifier\n" |
| 5513 | "Soft reconfig inbound update\n" |
| 5514 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5515 | { |
| 5516 | if (strncmp (argv[1], "m", 1) == 0) |
| 5517 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5518 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5519 | |
| 5520 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5521 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5522 | } |
| 5523 | |
| 5524 | DEFUN (clear_bgp_peer_group_soft_in, |
| 5525 | clear_bgp_peer_group_soft_in_cmd, |
| 5526 | "clear bgp peer-group WORD soft in", |
| 5527 | CLEAR_STR |
| 5528 | BGP_STR |
| 5529 | "Clear all members of peer-group\n" |
| 5530 | "BGP peer-group name\n" |
| 5531 | "Soft reconfig\n" |
| 5532 | "Soft reconfig inbound update\n") |
| 5533 | { |
| 5534 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5535 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5536 | } |
| 5537 | |
| 5538 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5539 | clear_bgp_ipv6_peer_group_soft_in_cmd, |
| 5540 | "clear bgp ipv6 peer-group WORD soft in", |
| 5541 | CLEAR_STR |
| 5542 | BGP_STR |
| 5543 | "Address family\n" |
| 5544 | "Clear all members of peer-group\n" |
| 5545 | "BGP peer-group name\n" |
| 5546 | "Soft reconfig\n" |
| 5547 | "Soft reconfig inbound update\n") |
| 5548 | |
| 5549 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5550 | clear_bgp_peer_group_in_cmd, |
| 5551 | "clear bgp peer-group WORD in", |
| 5552 | CLEAR_STR |
| 5553 | BGP_STR |
| 5554 | "Clear all members of peer-group\n" |
| 5555 | "BGP peer-group name\n" |
| 5556 | "Soft reconfig inbound update\n") |
| 5557 | |
| 5558 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5559 | clear_bgp_ipv6_peer_group_in_cmd, |
| 5560 | "clear bgp ipv6 peer-group WORD in", |
| 5561 | CLEAR_STR |
| 5562 | BGP_STR |
| 5563 | "Address family\n" |
| 5564 | "Clear all members of peer-group\n" |
| 5565 | "BGP peer-group name\n" |
| 5566 | "Soft reconfig inbound update\n") |
| 5567 | |
| 5568 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
| 5569 | clear_bgp_peer_group_in_prefix_filter_cmd, |
| 5570 | "clear bgp peer-group WORD in prefix-filter", |
| 5571 | CLEAR_STR |
| 5572 | BGP_STR |
| 5573 | "Clear all members of peer-group\n" |
| 5574 | "BGP peer-group name\n" |
| 5575 | "Soft reconfig inbound update\n" |
| 5576 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5577 | { |
| 5578 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5579 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5580 | } |
| 5581 | |
| 5582 | ALIAS (clear_bgp_peer_group_in_prefix_filter, |
| 5583 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, |
| 5584 | "clear bgp ipv6 peer-group WORD in prefix-filter", |
| 5585 | CLEAR_STR |
| 5586 | BGP_STR |
| 5587 | "Address family\n" |
| 5588 | "Clear all members of peer-group\n" |
| 5589 | "BGP peer-group name\n" |
| 5590 | "Soft reconfig inbound update\n" |
| 5591 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5592 | |
| 5593 | DEFUN (clear_ip_bgp_external_soft_in, |
| 5594 | clear_ip_bgp_external_soft_in_cmd, |
| 5595 | "clear ip bgp external soft in", |
| 5596 | CLEAR_STR |
| 5597 | IP_STR |
| 5598 | BGP_STR |
| 5599 | "Clear all external peers\n" |
| 5600 | "Soft reconfig\n" |
| 5601 | "Soft reconfig inbound update\n") |
| 5602 | { |
| 5603 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5604 | BGP_CLEAR_SOFT_IN, NULL); |
| 5605 | } |
| 5606 | |
| 5607 | ALIAS (clear_ip_bgp_external_soft_in, |
| 5608 | clear_ip_bgp_external_in_cmd, |
| 5609 | "clear ip bgp external in", |
| 5610 | CLEAR_STR |
| 5611 | IP_STR |
| 5612 | BGP_STR |
| 5613 | "Clear all external peers\n" |
| 5614 | "Soft reconfig inbound update\n") |
| 5615 | |
| 5616 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
| 5617 | clear_ip_bgp_external_in_prefix_filter_cmd, |
| 5618 | "clear ip bgp external in prefix-filter", |
| 5619 | CLEAR_STR |
| 5620 | IP_STR |
| 5621 | BGP_STR |
| 5622 | "Clear all external peers\n" |
| 5623 | "Soft reconfig inbound update\n" |
| 5624 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5625 | { |
| 5626 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5627 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5628 | } |
| 5629 | |
| 5630 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, |
| 5631 | clear_ip_bgp_external_ipv4_soft_in_cmd, |
| 5632 | "clear ip bgp external ipv4 (unicast|multicast) soft in", |
| 5633 | CLEAR_STR |
| 5634 | IP_STR |
| 5635 | BGP_STR |
| 5636 | "Clear all external peers\n" |
| 5637 | "Address family\n" |
| 5638 | "Address Family modifier\n" |
| 5639 | "Address Family modifier\n" |
| 5640 | "Soft reconfig\n" |
| 5641 | "Soft reconfig inbound update\n") |
| 5642 | { |
| 5643 | if (strncmp (argv[0], "m", 1) == 0) |
| 5644 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5645 | BGP_CLEAR_SOFT_IN, NULL); |
| 5646 | |
| 5647 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5648 | BGP_CLEAR_SOFT_IN, NULL); |
| 5649 | } |
| 5650 | |
| 5651 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, |
| 5652 | clear_ip_bgp_external_ipv4_in_cmd, |
| 5653 | "clear ip bgp external ipv4 (unicast|multicast) in", |
| 5654 | CLEAR_STR |
| 5655 | IP_STR |
| 5656 | BGP_STR |
| 5657 | "Clear all external peers\n" |
| 5658 | "Address family\n" |
| 5659 | "Address Family modifier\n" |
| 5660 | "Address Family modifier\n" |
| 5661 | "Soft reconfig inbound update\n") |
| 5662 | |
| 5663 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
| 5664 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, |
| 5665 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", |
| 5666 | CLEAR_STR |
| 5667 | IP_STR |
| 5668 | BGP_STR |
| 5669 | "Clear all external peers\n" |
| 5670 | "Address family\n" |
| 5671 | "Address Family modifier\n" |
| 5672 | "Address Family modifier\n" |
| 5673 | "Soft reconfig inbound update\n" |
| 5674 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5675 | { |
| 5676 | if (strncmp (argv[0], "m", 1) == 0) |
| 5677 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5678 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5679 | |
| 5680 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5681 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5682 | } |
| 5683 | |
| 5684 | DEFUN (clear_bgp_external_soft_in, |
| 5685 | clear_bgp_external_soft_in_cmd, |
| 5686 | "clear bgp external soft in", |
| 5687 | CLEAR_STR |
| 5688 | BGP_STR |
| 5689 | "Clear all external peers\n" |
| 5690 | "Soft reconfig\n" |
| 5691 | "Soft reconfig inbound update\n") |
| 5692 | { |
| 5693 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5694 | BGP_CLEAR_SOFT_IN, NULL); |
| 5695 | } |
| 5696 | |
| 5697 | ALIAS (clear_bgp_external_soft_in, |
| 5698 | clear_bgp_ipv6_external_soft_in_cmd, |
| 5699 | "clear bgp ipv6 external soft in", |
| 5700 | CLEAR_STR |
| 5701 | BGP_STR |
| 5702 | "Address family\n" |
| 5703 | "Clear all external peers\n" |
| 5704 | "Soft reconfig\n" |
| 5705 | "Soft reconfig inbound update\n") |
| 5706 | |
| 5707 | ALIAS (clear_bgp_external_soft_in, |
| 5708 | clear_bgp_external_in_cmd, |
| 5709 | "clear bgp external in", |
| 5710 | CLEAR_STR |
| 5711 | BGP_STR |
| 5712 | "Clear all external peers\n" |
| 5713 | "Soft reconfig inbound update\n") |
| 5714 | |
| 5715 | ALIAS (clear_bgp_external_soft_in, |
| 5716 | clear_bgp_ipv6_external_in_cmd, |
| 5717 | "clear bgp ipv6 external WORD in", |
| 5718 | CLEAR_STR |
| 5719 | BGP_STR |
| 5720 | "Address family\n" |
| 5721 | "Clear all external peers\n" |
| 5722 | "Soft reconfig inbound update\n") |
| 5723 | |
| 5724 | DEFUN (clear_bgp_external_in_prefix_filter, |
| 5725 | clear_bgp_external_in_prefix_filter_cmd, |
| 5726 | "clear bgp external in prefix-filter", |
| 5727 | CLEAR_STR |
| 5728 | BGP_STR |
| 5729 | "Clear all external peers\n" |
| 5730 | "Soft reconfig inbound update\n" |
| 5731 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5732 | { |
| 5733 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5734 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5735 | } |
| 5736 | |
| 5737 | ALIAS (clear_bgp_external_in_prefix_filter, |
| 5738 | clear_bgp_ipv6_external_in_prefix_filter_cmd, |
| 5739 | "clear bgp ipv6 external in prefix-filter", |
| 5740 | CLEAR_STR |
| 5741 | BGP_STR |
| 5742 | "Address family\n" |
| 5743 | "Clear all external peers\n" |
| 5744 | "Soft reconfig inbound update\n" |
| 5745 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5746 | |
| 5747 | DEFUN (clear_ip_bgp_as_soft_in, |
| 5748 | clear_ip_bgp_as_soft_in_cmd, |
| 5749 | "clear ip bgp <1-65535> soft in", |
| 5750 | CLEAR_STR |
| 5751 | IP_STR |
| 5752 | BGP_STR |
| 5753 | "Clear peers with the AS number\n" |
| 5754 | "Soft reconfig\n" |
| 5755 | "Soft reconfig inbound update\n") |
| 5756 | { |
| 5757 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5758 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5759 | } |
| 5760 | |
| 5761 | ALIAS (clear_ip_bgp_as_soft_in, |
| 5762 | clear_ip_bgp_as_in_cmd, |
| 5763 | "clear ip bgp <1-65535> in", |
| 5764 | CLEAR_STR |
| 5765 | IP_STR |
| 5766 | BGP_STR |
| 5767 | "Clear peers with the AS number\n" |
| 5768 | "Soft reconfig inbound update\n") |
| 5769 | |
| 5770 | DEFUN (clear_ip_bgp_as_in_prefix_filter, |
| 5771 | clear_ip_bgp_as_in_prefix_filter_cmd, |
| 5772 | "clear ip bgp <1-65535> in prefix-filter", |
| 5773 | CLEAR_STR |
| 5774 | IP_STR |
| 5775 | BGP_STR |
| 5776 | "Clear peers with the AS number\n" |
| 5777 | "Soft reconfig inbound update\n" |
| 5778 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5779 | { |
| 5780 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5781 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5782 | } |
| 5783 | |
| 5784 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, |
| 5785 | clear_ip_bgp_as_ipv4_soft_in_cmd, |
| 5786 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft in", |
| 5787 | CLEAR_STR |
| 5788 | IP_STR |
| 5789 | BGP_STR |
| 5790 | "Clear peers with the AS number\n" |
| 5791 | "Address family\n" |
| 5792 | "Address Family modifier\n" |
| 5793 | "Address Family modifier\n" |
| 5794 | "Soft reconfig\n" |
| 5795 | "Soft reconfig inbound update\n") |
| 5796 | { |
| 5797 | if (strncmp (argv[1], "m", 1) == 0) |
| 5798 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5799 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5800 | |
| 5801 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5802 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5803 | } |
| 5804 | |
| 5805 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, |
| 5806 | clear_ip_bgp_as_ipv4_in_cmd, |
| 5807 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) in", |
| 5808 | CLEAR_STR |
| 5809 | IP_STR |
| 5810 | BGP_STR |
| 5811 | "Clear peers with the AS number\n" |
| 5812 | "Address family\n" |
| 5813 | "Address Family modifier\n" |
| 5814 | "Address Family modifier\n" |
| 5815 | "Soft reconfig inbound update\n") |
| 5816 | |
| 5817 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
| 5818 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, |
| 5819 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) in prefix-filter", |
| 5820 | CLEAR_STR |
| 5821 | IP_STR |
| 5822 | BGP_STR |
| 5823 | "Clear peers with the AS number\n" |
| 5824 | "Address family\n" |
| 5825 | "Address Family modifier\n" |
| 5826 | "Address Family modifier\n" |
| 5827 | "Soft reconfig inbound update\n" |
| 5828 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5829 | { |
| 5830 | if (strncmp (argv[1], "m", 1) == 0) |
| 5831 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5832 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5833 | |
| 5834 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5835 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5836 | } |
| 5837 | |
| 5838 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, |
| 5839 | clear_ip_bgp_as_vpnv4_soft_in_cmd, |
| 5840 | "clear ip bgp <1-65535> vpnv4 unicast soft in", |
| 5841 | CLEAR_STR |
| 5842 | IP_STR |
| 5843 | BGP_STR |
| 5844 | "Clear peers with the AS number\n" |
| 5845 | "Address family\n" |
| 5846 | "Address Family modifier\n" |
| 5847 | "Soft reconfig\n" |
| 5848 | "Soft reconfig inbound update\n") |
| 5849 | { |
| 5850 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 5851 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5852 | } |
| 5853 | |
| 5854 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, |
| 5855 | clear_ip_bgp_as_vpnv4_in_cmd, |
| 5856 | "clear ip bgp <1-65535> vpnv4 unicast in", |
| 5857 | CLEAR_STR |
| 5858 | IP_STR |
| 5859 | BGP_STR |
| 5860 | "Clear peers with the AS number\n" |
| 5861 | "Address family\n" |
| 5862 | "Address Family modifier\n" |
| 5863 | "Soft reconfig inbound update\n") |
| 5864 | |
| 5865 | DEFUN (clear_bgp_as_soft_in, |
| 5866 | clear_bgp_as_soft_in_cmd, |
| 5867 | "clear bgp <1-65535> soft in", |
| 5868 | CLEAR_STR |
| 5869 | BGP_STR |
| 5870 | "Clear peers with the AS number\n" |
| 5871 | "Soft reconfig\n" |
| 5872 | "Soft reconfig inbound update\n") |
| 5873 | { |
| 5874 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5875 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5876 | } |
| 5877 | |
| 5878 | ALIAS (clear_bgp_as_soft_in, |
| 5879 | clear_bgp_ipv6_as_soft_in_cmd, |
| 5880 | "clear bgp ipv6 <1-65535> soft in", |
| 5881 | CLEAR_STR |
| 5882 | BGP_STR |
| 5883 | "Address family\n" |
| 5884 | "Clear peers with the AS number\n" |
| 5885 | "Soft reconfig\n" |
| 5886 | "Soft reconfig inbound update\n") |
| 5887 | |
| 5888 | ALIAS (clear_bgp_as_soft_in, |
| 5889 | clear_bgp_as_in_cmd, |
| 5890 | "clear bgp <1-65535> in", |
| 5891 | CLEAR_STR |
| 5892 | BGP_STR |
| 5893 | "Clear peers with the AS number\n" |
| 5894 | "Soft reconfig inbound update\n") |
| 5895 | |
| 5896 | ALIAS (clear_bgp_as_soft_in, |
| 5897 | clear_bgp_ipv6_as_in_cmd, |
| 5898 | "clear bgp ipv6 <1-65535> in", |
| 5899 | CLEAR_STR |
| 5900 | BGP_STR |
| 5901 | "Address family\n" |
| 5902 | "Clear peers with the AS number\n" |
| 5903 | "Soft reconfig inbound update\n") |
| 5904 | |
| 5905 | DEFUN (clear_bgp_as_in_prefix_filter, |
| 5906 | clear_bgp_as_in_prefix_filter_cmd, |
| 5907 | "clear bgp <1-65535> in prefix-filter", |
| 5908 | CLEAR_STR |
| 5909 | BGP_STR |
| 5910 | "Clear peers with the AS number\n" |
| 5911 | "Soft reconfig inbound update\n" |
| 5912 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5913 | { |
| 5914 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5915 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5916 | } |
| 5917 | |
| 5918 | ALIAS (clear_bgp_as_in_prefix_filter, |
| 5919 | clear_bgp_ipv6_as_in_prefix_filter_cmd, |
| 5920 | "clear bgp ipv6 <1-65535> in prefix-filter", |
| 5921 | CLEAR_STR |
| 5922 | BGP_STR |
| 5923 | "Address family\n" |
| 5924 | "Clear peers with the AS number\n" |
| 5925 | "Soft reconfig inbound update\n" |
| 5926 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5927 | |
| 5928 | /* Both soft-reconfiguration */ |
| 5929 | DEFUN (clear_ip_bgp_all_soft, |
| 5930 | clear_ip_bgp_all_soft_cmd, |
| 5931 | "clear ip bgp * soft", |
| 5932 | CLEAR_STR |
| 5933 | IP_STR |
| 5934 | BGP_STR |
| 5935 | "Clear all peers\n" |
| 5936 | "Soft reconfig\n") |
| 5937 | { |
| 5938 | if (argc == 1) |
| 5939 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5940 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5941 | |
| 5942 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5943 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5944 | } |
| 5945 | |
| 5946 | ALIAS (clear_ip_bgp_all_soft, |
| 5947 | clear_ip_bgp_instance_all_soft_cmd, |
| 5948 | "clear ip bgp view WORD * soft", |
| 5949 | CLEAR_STR |
| 5950 | IP_STR |
| 5951 | BGP_STR |
| 5952 | "BGP view\n" |
| 5953 | "view name\n" |
| 5954 | "Clear all peers\n" |
| 5955 | "Soft reconfig\n") |
| 5956 | |
| 5957 | |
| 5958 | DEFUN (clear_ip_bgp_all_ipv4_soft, |
| 5959 | clear_ip_bgp_all_ipv4_soft_cmd, |
| 5960 | "clear ip bgp * ipv4 (unicast|multicast) soft", |
| 5961 | CLEAR_STR |
| 5962 | IP_STR |
| 5963 | BGP_STR |
| 5964 | "Clear all peers\n" |
| 5965 | "Address family\n" |
| 5966 | "Address Family Modifier\n" |
| 5967 | "Address Family Modifier\n" |
| 5968 | "Soft reconfig\n") |
| 5969 | { |
| 5970 | if (strncmp (argv[0], "m", 1) == 0) |
| 5971 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5972 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5973 | |
| 5974 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5975 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5976 | } |
| 5977 | |
| 5978 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, |
| 5979 | clear_ip_bgp_instance_all_ipv4_soft_cmd, |
| 5980 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", |
| 5981 | CLEAR_STR |
| 5982 | IP_STR |
| 5983 | BGP_STR |
| 5984 | "BGP view\n" |
| 5985 | "view name\n" |
| 5986 | "Clear all peers\n" |
| 5987 | "Address family\n" |
| 5988 | "Address Family Modifier\n" |
| 5989 | "Address Family Modifier\n" |
| 5990 | "Soft reconfig\n") |
| 5991 | { |
| 5992 | if (strncmp (argv[1], "m", 1) == 0) |
| 5993 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5994 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5995 | |
| 5996 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5997 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5998 | } |
| 5999 | |
| 6000 | DEFUN (clear_ip_bgp_all_vpnv4_soft, |
| 6001 | clear_ip_bgp_all_vpnv4_soft_cmd, |
| 6002 | "clear ip bgp * vpnv4 unicast soft", |
| 6003 | CLEAR_STR |
| 6004 | IP_STR |
| 6005 | BGP_STR |
| 6006 | "Clear all peers\n" |
| 6007 | "Address family\n" |
| 6008 | "Address Family Modifier\n" |
| 6009 | "Soft reconfig\n") |
| 6010 | { |
| 6011 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 6012 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6013 | } |
| 6014 | |
| 6015 | DEFUN (clear_bgp_all_soft, |
| 6016 | clear_bgp_all_soft_cmd, |
| 6017 | "clear bgp * soft", |
| 6018 | CLEAR_STR |
| 6019 | BGP_STR |
| 6020 | "Clear all peers\n" |
| 6021 | "Soft reconfig\n") |
| 6022 | { |
| 6023 | if (argc == 1) |
| 6024 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6025 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6026 | |
| 6027 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6028 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6029 | } |
| 6030 | |
| 6031 | ALIAS (clear_bgp_all_soft, |
| 6032 | clear_bgp_instance_all_soft_cmd, |
| 6033 | "clear bgp view WORD * soft", |
| 6034 | CLEAR_STR |
| 6035 | BGP_STR |
| 6036 | "BGP view\n" |
| 6037 | "view name\n" |
| 6038 | "Clear all peers\n" |
| 6039 | "Soft reconfig\n") |
| 6040 | |
| 6041 | ALIAS (clear_bgp_all_soft, |
| 6042 | clear_bgp_ipv6_all_soft_cmd, |
| 6043 | "clear bgp ipv6 * soft", |
| 6044 | CLEAR_STR |
| 6045 | BGP_STR |
| 6046 | "Address family\n" |
| 6047 | "Clear all peers\n" |
| 6048 | "Soft reconfig\n") |
| 6049 | |
| 6050 | DEFUN (clear_ip_bgp_peer_soft, |
| 6051 | clear_ip_bgp_peer_soft_cmd, |
| 6052 | "clear ip bgp A.B.C.D soft", |
| 6053 | CLEAR_STR |
| 6054 | IP_STR |
| 6055 | BGP_STR |
| 6056 | "BGP neighbor address to clear\n" |
| 6057 | "Soft reconfig\n") |
| 6058 | { |
| 6059 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6060 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6061 | } |
| 6062 | |
| 6063 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
| 6064 | clear_ip_bgp_peer_ipv4_soft_cmd, |
| 6065 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", |
| 6066 | CLEAR_STR |
| 6067 | IP_STR |
| 6068 | BGP_STR |
| 6069 | "BGP neighbor address to clear\n" |
| 6070 | "Address family\n" |
| 6071 | "Address Family Modifier\n" |
| 6072 | "Address Family Modifier\n" |
| 6073 | "Soft reconfig\n") |
| 6074 | { |
| 6075 | if (strncmp (argv[1], "m", 1) == 0) |
| 6076 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 6077 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6078 | |
| 6079 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6080 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6081 | } |
| 6082 | |
| 6083 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
| 6084 | clear_ip_bgp_peer_vpnv4_soft_cmd, |
| 6085 | "clear ip bgp A.B.C.D vpnv4 unicast soft", |
| 6086 | CLEAR_STR |
| 6087 | IP_STR |
| 6088 | BGP_STR |
| 6089 | "BGP neighbor address to clear\n" |
| 6090 | "Address family\n" |
| 6091 | "Address Family Modifier\n" |
| 6092 | "Soft reconfig\n") |
| 6093 | { |
| 6094 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 6095 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6096 | } |
| 6097 | |
| 6098 | DEFUN (clear_bgp_peer_soft, |
| 6099 | clear_bgp_peer_soft_cmd, |
| 6100 | "clear bgp (A.B.C.D|X:X::X:X) soft", |
| 6101 | CLEAR_STR |
| 6102 | BGP_STR |
| 6103 | "BGP neighbor address to clear\n" |
| 6104 | "BGP IPv6 neighbor to clear\n" |
| 6105 | "Soft reconfig\n") |
| 6106 | { |
| 6107 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6108 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6109 | } |
| 6110 | |
| 6111 | ALIAS (clear_bgp_peer_soft, |
| 6112 | clear_bgp_ipv6_peer_soft_cmd, |
| 6113 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft", |
| 6114 | CLEAR_STR |
| 6115 | BGP_STR |
| 6116 | "Address family\n" |
| 6117 | "BGP neighbor address to clear\n" |
| 6118 | "BGP IPv6 neighbor to clear\n" |
| 6119 | "Soft reconfig\n") |
| 6120 | |
| 6121 | DEFUN (clear_ip_bgp_peer_group_soft, |
| 6122 | clear_ip_bgp_peer_group_soft_cmd, |
| 6123 | "clear ip bgp peer-group WORD soft", |
| 6124 | CLEAR_STR |
| 6125 | IP_STR |
| 6126 | BGP_STR |
| 6127 | "Clear all members of peer-group\n" |
| 6128 | "BGP peer-group name\n" |
| 6129 | "Soft reconfig\n") |
| 6130 | { |
| 6131 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6132 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6133 | } |
| 6134 | |
| 6135 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
| 6136 | clear_ip_bgp_peer_group_ipv4_soft_cmd, |
| 6137 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", |
| 6138 | CLEAR_STR |
| 6139 | IP_STR |
| 6140 | BGP_STR |
| 6141 | "Clear all members of peer-group\n" |
| 6142 | "BGP peer-group name\n" |
| 6143 | "Address family\n" |
| 6144 | "Address Family modifier\n" |
| 6145 | "Address Family modifier\n" |
| 6146 | "Soft reconfig\n") |
| 6147 | { |
| 6148 | if (strncmp (argv[1], "m", 1) == 0) |
| 6149 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 6150 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6151 | |
| 6152 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6153 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6154 | } |
| 6155 | |
| 6156 | DEFUN (clear_bgp_peer_group_soft, |
| 6157 | clear_bgp_peer_group_soft_cmd, |
| 6158 | "clear bgp peer-group WORD soft", |
| 6159 | CLEAR_STR |
| 6160 | BGP_STR |
| 6161 | "Clear all members of peer-group\n" |
| 6162 | "BGP peer-group name\n" |
| 6163 | "Soft reconfig\n") |
| 6164 | { |
| 6165 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 6166 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6167 | } |
| 6168 | |
| 6169 | ALIAS (clear_bgp_peer_group_soft, |
| 6170 | clear_bgp_ipv6_peer_group_soft_cmd, |
| 6171 | "clear bgp ipv6 peer-group WORD soft", |
| 6172 | CLEAR_STR |
| 6173 | BGP_STR |
| 6174 | "Address family\n" |
| 6175 | "Clear all members of peer-group\n" |
| 6176 | "BGP peer-group name\n" |
| 6177 | "Soft reconfig\n") |
| 6178 | |
| 6179 | DEFUN (clear_ip_bgp_external_soft, |
| 6180 | clear_ip_bgp_external_soft_cmd, |
| 6181 | "clear ip bgp external soft", |
| 6182 | CLEAR_STR |
| 6183 | IP_STR |
| 6184 | BGP_STR |
| 6185 | "Clear all external peers\n" |
| 6186 | "Soft reconfig\n") |
| 6187 | { |
| 6188 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6189 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6190 | } |
| 6191 | |
| 6192 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
| 6193 | clear_ip_bgp_external_ipv4_soft_cmd, |
| 6194 | "clear ip bgp external ipv4 (unicast|multicast) soft", |
| 6195 | CLEAR_STR |
| 6196 | IP_STR |
| 6197 | BGP_STR |
| 6198 | "Clear all external peers\n" |
| 6199 | "Address family\n" |
| 6200 | "Address Family modifier\n" |
| 6201 | "Address Family modifier\n" |
| 6202 | "Soft reconfig\n") |
| 6203 | { |
| 6204 | if (strncmp (argv[0], "m", 1) == 0) |
| 6205 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 6206 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6207 | |
| 6208 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6209 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6210 | } |
| 6211 | |
| 6212 | DEFUN (clear_bgp_external_soft, |
| 6213 | clear_bgp_external_soft_cmd, |
| 6214 | "clear bgp external soft", |
| 6215 | CLEAR_STR |
| 6216 | BGP_STR |
| 6217 | "Clear all external peers\n" |
| 6218 | "Soft reconfig\n") |
| 6219 | { |
| 6220 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 6221 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6222 | } |
| 6223 | |
| 6224 | ALIAS (clear_bgp_external_soft, |
| 6225 | clear_bgp_ipv6_external_soft_cmd, |
| 6226 | "clear bgp ipv6 external soft", |
| 6227 | CLEAR_STR |
| 6228 | BGP_STR |
| 6229 | "Address family\n" |
| 6230 | "Clear all external peers\n" |
| 6231 | "Soft reconfig\n") |
| 6232 | |
| 6233 | DEFUN (clear_ip_bgp_as_soft, |
| 6234 | clear_ip_bgp_as_soft_cmd, |
| 6235 | "clear ip bgp <1-65535> soft", |
| 6236 | CLEAR_STR |
| 6237 | IP_STR |
| 6238 | BGP_STR |
| 6239 | "Clear peers with the AS number\n" |
| 6240 | "Soft reconfig\n") |
| 6241 | { |
| 6242 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6243 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6244 | } |
| 6245 | |
| 6246 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
| 6247 | clear_ip_bgp_as_ipv4_soft_cmd, |
| 6248 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft", |
| 6249 | CLEAR_STR |
| 6250 | IP_STR |
| 6251 | BGP_STR |
| 6252 | "Clear peers with the AS number\n" |
| 6253 | "Address family\n" |
| 6254 | "Address Family Modifier\n" |
| 6255 | "Address Family Modifier\n" |
| 6256 | "Soft reconfig\n") |
| 6257 | { |
| 6258 | if (strncmp (argv[1], "m", 1) == 0) |
| 6259 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6260 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6261 | |
| 6262 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, |
| 6263 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6264 | } |
| 6265 | |
| 6266 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
| 6267 | clear_ip_bgp_as_vpnv4_soft_cmd, |
| 6268 | "clear ip bgp <1-65535> vpnv4 unicast soft", |
| 6269 | CLEAR_STR |
| 6270 | IP_STR |
| 6271 | BGP_STR |
| 6272 | "Clear peers with the AS number\n" |
| 6273 | "Address family\n" |
| 6274 | "Address Family Modifier\n" |
| 6275 | "Soft reconfig\n") |
| 6276 | { |
| 6277 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 6278 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6279 | } |
| 6280 | |
| 6281 | DEFUN (clear_bgp_as_soft, |
| 6282 | clear_bgp_as_soft_cmd, |
| 6283 | "clear bgp <1-65535> soft", |
| 6284 | CLEAR_STR |
| 6285 | BGP_STR |
| 6286 | "Clear peers with the AS number\n" |
| 6287 | "Soft reconfig\n") |
| 6288 | { |
| 6289 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6290 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6291 | } |
| 6292 | |
| 6293 | ALIAS (clear_bgp_as_soft, |
| 6294 | clear_bgp_ipv6_as_soft_cmd, |
| 6295 | "clear bgp ipv6 <1-65535> soft", |
| 6296 | CLEAR_STR |
| 6297 | BGP_STR |
| 6298 | "Address family\n" |
| 6299 | "Clear peers with the AS number\n" |
| 6300 | "Soft reconfig\n") |
| 6301 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6302 | /* RS-client soft reconfiguration. */ |
| 6303 | #ifdef HAVE_IPV6 |
| 6304 | DEFUN (clear_bgp_all_rsclient, |
| 6305 | clear_bgp_all_rsclient_cmd, |
| 6306 | "clear bgp * rsclient", |
| 6307 | CLEAR_STR |
| 6308 | BGP_STR |
| 6309 | "Clear all peers\n" |
| 6310 | "Soft reconfig for rsclient RIB\n") |
| 6311 | { |
| 6312 | if (argc == 1) |
| 6313 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6314 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6315 | |
| 6316 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6317 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6318 | } |
| 6319 | |
| 6320 | ALIAS (clear_bgp_all_rsclient, |
| 6321 | clear_bgp_ipv6_all_rsclient_cmd, |
| 6322 | "clear bgp ipv6 * rsclient", |
| 6323 | CLEAR_STR |
| 6324 | BGP_STR |
| 6325 | "Address family\n" |
| 6326 | "Clear all peers\n" |
| 6327 | "Soft reconfig for rsclient RIB\n") |
| 6328 | |
| 6329 | ALIAS (clear_bgp_all_rsclient, |
| 6330 | clear_bgp_instance_all_rsclient_cmd, |
| 6331 | "clear bgp view WORD * rsclient", |
| 6332 | CLEAR_STR |
| 6333 | BGP_STR |
| 6334 | "BGP view\n" |
| 6335 | "view name\n" |
| 6336 | "Clear all peers\n" |
| 6337 | "Soft reconfig for rsclient RIB\n") |
| 6338 | |
| 6339 | ALIAS (clear_bgp_all_rsclient, |
| 6340 | clear_bgp_ipv6_instance_all_rsclient_cmd, |
| 6341 | "clear bgp ipv6 view WORD * rsclient", |
| 6342 | CLEAR_STR |
| 6343 | BGP_STR |
| 6344 | "Address family\n" |
| 6345 | "BGP view\n" |
| 6346 | "view name\n" |
| 6347 | "Clear all peers\n" |
| 6348 | "Soft reconfig for rsclient RIB\n") |
| 6349 | #endif /* HAVE_IPV6 */ |
| 6350 | |
| 6351 | DEFUN (clear_ip_bgp_all_rsclient, |
| 6352 | clear_ip_bgp_all_rsclient_cmd, |
| 6353 | "clear ip bgp * rsclient", |
| 6354 | CLEAR_STR |
| 6355 | IP_STR |
| 6356 | BGP_STR |
| 6357 | "Clear all peers\n" |
| 6358 | "Soft reconfig for rsclient RIB\n") |
| 6359 | { |
| 6360 | if (argc == 1) |
| 6361 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6362 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6363 | |
| 6364 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6365 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6366 | } |
| 6367 | |
| 6368 | ALIAS (clear_ip_bgp_all_rsclient, |
| 6369 | clear_ip_bgp_instance_all_rsclient_cmd, |
| 6370 | "clear ip bgp view WORD * rsclient", |
| 6371 | CLEAR_STR |
| 6372 | IP_STR |
| 6373 | BGP_STR |
| 6374 | "BGP view\n" |
| 6375 | "view name\n" |
| 6376 | "Clear all peers\n" |
| 6377 | "Soft reconfig for rsclient RIB\n") |
| 6378 | |
| 6379 | #ifdef HAVE_IPV6 |
| 6380 | DEFUN (clear_bgp_peer_rsclient, |
| 6381 | clear_bgp_peer_rsclient_cmd, |
| 6382 | "clear bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6383 | CLEAR_STR |
| 6384 | BGP_STR |
| 6385 | "BGP neighbor IP address to clear\n" |
| 6386 | "BGP IPv6 neighbor to clear\n" |
| 6387 | "Soft reconfig for rsclient RIB\n") |
| 6388 | { |
| 6389 | if (argc == 2) |
| 6390 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6391 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6392 | |
| 6393 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6394 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6395 | } |
| 6396 | |
| 6397 | ALIAS (clear_bgp_peer_rsclient, |
| 6398 | clear_bgp_ipv6_peer_rsclient_cmd, |
| 6399 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient", |
| 6400 | CLEAR_STR |
| 6401 | BGP_STR |
| 6402 | "Address family\n" |
| 6403 | "BGP neighbor IP address to clear\n" |
| 6404 | "BGP IPv6 neighbor to clear\n" |
| 6405 | "Soft reconfig for rsclient RIB\n") |
| 6406 | |
| 6407 | ALIAS (clear_bgp_peer_rsclient, |
| 6408 | clear_bgp_instance_peer_rsclient_cmd, |
| 6409 | "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6410 | CLEAR_STR |
| 6411 | BGP_STR |
| 6412 | "BGP view\n" |
| 6413 | "view name\n" |
| 6414 | "BGP neighbor IP address to clear\n" |
| 6415 | "BGP IPv6 neighbor to clear\n" |
| 6416 | "Soft reconfig for rsclient RIB\n") |
| 6417 | |
| 6418 | ALIAS (clear_bgp_peer_rsclient, |
| 6419 | clear_bgp_ipv6_instance_peer_rsclient_cmd, |
| 6420 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6421 | CLEAR_STR |
| 6422 | BGP_STR |
| 6423 | "Address family\n" |
| 6424 | "BGP view\n" |
| 6425 | "view name\n" |
| 6426 | "BGP neighbor IP address to clear\n" |
| 6427 | "BGP IPv6 neighbor to clear\n" |
| 6428 | "Soft reconfig for rsclient RIB\n") |
| 6429 | #endif /* HAVE_IPV6 */ |
| 6430 | |
| 6431 | DEFUN (clear_ip_bgp_peer_rsclient, |
| 6432 | clear_ip_bgp_peer_rsclient_cmd, |
| 6433 | "clear ip bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6434 | CLEAR_STR |
| 6435 | IP_STR |
| 6436 | BGP_STR |
| 6437 | "BGP neighbor IP address to clear\n" |
| 6438 | "BGP IPv6 neighbor to clear\n" |
| 6439 | "Soft reconfig for rsclient RIB\n") |
| 6440 | { |
| 6441 | if (argc == 2) |
| 6442 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, |
| 6443 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6444 | |
| 6445 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6446 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6447 | } |
| 6448 | |
| 6449 | ALIAS (clear_ip_bgp_peer_rsclient, |
| 6450 | clear_ip_bgp_instance_peer_rsclient_cmd, |
| 6451 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6452 | CLEAR_STR |
| 6453 | IP_STR |
| 6454 | BGP_STR |
| 6455 | "BGP view\n" |
| 6456 | "view name\n" |
| 6457 | "BGP neighbor IP address to clear\n" |
| 6458 | "BGP IPv6 neighbor to clear\n" |
| 6459 | "Soft reconfig for rsclient RIB\n") |
| 6460 | |
| 6461 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6462 | /* Show BGP peer's summary information. */ |
| 6463 | int |
| 6464 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) |
| 6465 | { |
| 6466 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6467 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6468 | int count = 0; |
| 6469 | char timebuf[BGP_UPTIME_LEN]; |
| 6470 | int len; |
| 6471 | |
| 6472 | /* Header string for each address family. */ |
| 6473 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; |
| 6474 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6475 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6476 | { |
| 6477 | if (peer->afc[afi][safi]) |
| 6478 | { |
| 6479 | if (! count) |
| 6480 | { |
| 6481 | vty_out (vty, |
| 6482 | "BGP router identifier %s, local AS number %d%s", |
| 6483 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); |
| 6484 | vty_out (vty, |
| 6485 | "%ld BGP AS-PATH entries%s", aspath_count (), |
| 6486 | VTY_NEWLINE); |
| 6487 | vty_out (vty, |
| 6488 | "%ld BGP community entries%s", community_count (), |
| 6489 | VTY_NEWLINE); |
| 6490 | |
| 6491 | if (CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
| 6492 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); |
| 6493 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6494 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 6495 | } |
| 6496 | count++; |
| 6497 | |
| 6498 | len = vty_out (vty, "%s", peer->host); |
| 6499 | len = 16 - len; |
| 6500 | if (len < 1) |
| 6501 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 6502 | else |
| 6503 | vty_out (vty, "%*s", len, " "); |
| 6504 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 6505 | vty_out (vty, "4 "); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6506 | |
| 6507 | vty_out (vty, "%5d %7d %7d %8d %4d %4ld ", |
| 6508 | peer->as, |
| 6509 | peer->open_in + peer->update_in + peer->keepalive_in |
| 6510 | + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in, |
| 6511 | peer->open_out + peer->update_out + peer->keepalive_out |
| 6512 | + peer->notify_out + peer->refresh_out |
| 6513 | + peer->dynamic_cap_out, |
| 6514 | 0, 0, peer->obuf->count); |
| 6515 | |
| 6516 | vty_out (vty, "%8s", |
| 6517 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); |
| 6518 | |
| 6519 | if (peer->status == Established) |
| 6520 | { |
| 6521 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); |
| 6522 | } |
| 6523 | else |
| 6524 | { |
| 6525 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) |
| 6526 | vty_out (vty, " Idle (Admin)"); |
| 6527 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 6528 | vty_out (vty, " Idle (PfxCt)"); |
| 6529 | else |
| 6530 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); |
| 6531 | } |
| 6532 | |
| 6533 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6534 | } |
| 6535 | } |
| 6536 | |
| 6537 | if (count) |
| 6538 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, |
| 6539 | count, VTY_NEWLINE); |
| 6540 | else |
| 6541 | vty_out (vty, "No %s neighbor is configured%s", |
| 6542 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 6543 | return CMD_SUCCESS; |
| 6544 | } |
| 6545 | |
| 6546 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 6547 | bgp_show_summary_vty (struct vty *vty, const char *name, |
| 6548 | afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6549 | { |
| 6550 | struct bgp *bgp; |
| 6551 | |
| 6552 | if (name) |
| 6553 | { |
| 6554 | bgp = bgp_lookup_by_name (name); |
| 6555 | |
| 6556 | if (! bgp) |
| 6557 | { |
| 6558 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 6559 | return CMD_WARNING; |
| 6560 | } |
| 6561 | |
| 6562 | bgp_show_summary (vty, bgp, afi, safi); |
| 6563 | return CMD_SUCCESS; |
| 6564 | } |
| 6565 | |
| 6566 | bgp = bgp_get_default (); |
| 6567 | |
| 6568 | if (bgp) |
| 6569 | bgp_show_summary (vty, bgp, afi, safi); |
| 6570 | |
| 6571 | return CMD_SUCCESS; |
| 6572 | } |
| 6573 | |
| 6574 | /* `show ip bgp summary' commands. */ |
| 6575 | DEFUN (show_ip_bgp_summary, |
| 6576 | show_ip_bgp_summary_cmd, |
| 6577 | "show ip bgp summary", |
| 6578 | SHOW_STR |
| 6579 | IP_STR |
| 6580 | BGP_STR |
| 6581 | "Summary of BGP neighbor status\n") |
| 6582 | { |
| 6583 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 6584 | } |
| 6585 | |
| 6586 | DEFUN (show_ip_bgp_instance_summary, |
| 6587 | show_ip_bgp_instance_summary_cmd, |
| 6588 | "show ip bgp view WORD summary", |
| 6589 | SHOW_STR |
| 6590 | IP_STR |
| 6591 | BGP_STR |
| 6592 | "BGP view\n" |
| 6593 | "View name\n" |
| 6594 | "Summary of BGP neighbor status\n") |
| 6595 | { |
| 6596 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 6597 | } |
| 6598 | |
| 6599 | DEFUN (show_ip_bgp_ipv4_summary, |
| 6600 | show_ip_bgp_ipv4_summary_cmd, |
| 6601 | "show ip bgp ipv4 (unicast|multicast) summary", |
| 6602 | SHOW_STR |
| 6603 | IP_STR |
| 6604 | BGP_STR |
| 6605 | "Address family\n" |
| 6606 | "Address Family modifier\n" |
| 6607 | "Address Family modifier\n" |
| 6608 | "Summary of BGP neighbor status\n") |
| 6609 | { |
| 6610 | if (strncmp (argv[0], "m", 1) == 0) |
| 6611 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 6612 | |
| 6613 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 6614 | } |
| 6615 | |
| 6616 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
| 6617 | show_ip_bgp_instance_ipv4_summary_cmd, |
| 6618 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", |
| 6619 | SHOW_STR |
| 6620 | IP_STR |
| 6621 | BGP_STR |
| 6622 | "BGP view\n" |
| 6623 | "View name\n" |
| 6624 | "Address family\n" |
| 6625 | "Address Family modifier\n" |
| 6626 | "Address Family modifier\n" |
| 6627 | "Summary of BGP neighbor status\n") |
| 6628 | { |
| 6629 | if (strncmp (argv[1], "m", 1) == 0) |
| 6630 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 6631 | else |
| 6632 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 6633 | } |
| 6634 | |
| 6635 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
| 6636 | show_ip_bgp_vpnv4_all_summary_cmd, |
| 6637 | "show ip bgp vpnv4 all summary", |
| 6638 | SHOW_STR |
| 6639 | IP_STR |
| 6640 | BGP_STR |
| 6641 | "Display VPNv4 NLRI specific information\n" |
| 6642 | "Display information about all VPNv4 NLRIs\n" |
| 6643 | "Summary of BGP neighbor status\n") |
| 6644 | { |
| 6645 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 6646 | } |
| 6647 | |
| 6648 | DEFUN (show_ip_bgp_vpnv4_rd_summary, |
| 6649 | show_ip_bgp_vpnv4_rd_summary_cmd, |
| 6650 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", |
| 6651 | SHOW_STR |
| 6652 | IP_STR |
| 6653 | BGP_STR |
| 6654 | "Display VPNv4 NLRI specific information\n" |
| 6655 | "Display information for a route distinguisher\n" |
| 6656 | "VPN Route Distinguisher\n" |
| 6657 | "Summary of BGP neighbor status\n") |
| 6658 | { |
| 6659 | int ret; |
| 6660 | struct prefix_rd prd; |
| 6661 | |
| 6662 | ret = str2prefix_rd (argv[0], &prd); |
| 6663 | if (! ret) |
| 6664 | { |
| 6665 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); |
| 6666 | return CMD_WARNING; |
| 6667 | } |
| 6668 | |
| 6669 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 6670 | } |
| 6671 | |
| 6672 | #ifdef HAVE_IPV6 |
| 6673 | DEFUN (show_bgp_summary, |
| 6674 | show_bgp_summary_cmd, |
| 6675 | "show bgp summary", |
| 6676 | SHOW_STR |
| 6677 | BGP_STR |
| 6678 | "Summary of BGP neighbor status\n") |
| 6679 | { |
| 6680 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 6681 | } |
| 6682 | |
| 6683 | DEFUN (show_bgp_instance_summary, |
| 6684 | show_bgp_instance_summary_cmd, |
| 6685 | "show bgp view WORD summary", |
| 6686 | SHOW_STR |
| 6687 | BGP_STR |
| 6688 | "BGP view\n" |
| 6689 | "View name\n" |
| 6690 | "Summary of BGP neighbor status\n") |
| 6691 | { |
| 6692 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 6693 | } |
| 6694 | |
| 6695 | ALIAS (show_bgp_summary, |
| 6696 | show_bgp_ipv6_summary_cmd, |
| 6697 | "show bgp ipv6 summary", |
| 6698 | SHOW_STR |
| 6699 | BGP_STR |
| 6700 | "Address family\n" |
| 6701 | "Summary of BGP neighbor status\n") |
| 6702 | |
| 6703 | ALIAS (show_bgp_instance_summary, |
| 6704 | show_bgp_instance_ipv6_summary_cmd, |
| 6705 | "show bgp view WORD ipv6 summary", |
| 6706 | SHOW_STR |
| 6707 | BGP_STR |
| 6708 | "BGP view\n" |
| 6709 | "View name\n" |
| 6710 | "Address family\n" |
| 6711 | "Summary of BGP neighbor status\n") |
| 6712 | |
| 6713 | /* old command */ |
| 6714 | DEFUN (show_ipv6_bgp_summary, |
| 6715 | show_ipv6_bgp_summary_cmd, |
| 6716 | "show ipv6 bgp summary", |
| 6717 | SHOW_STR |
| 6718 | IPV6_STR |
| 6719 | BGP_STR |
| 6720 | "Summary of BGP neighbor status\n") |
| 6721 | { |
| 6722 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 6723 | } |
| 6724 | |
| 6725 | /* old command */ |
| 6726 | DEFUN (show_ipv6_mbgp_summary, |
| 6727 | show_ipv6_mbgp_summary_cmd, |
| 6728 | "show ipv6 mbgp summary", |
| 6729 | SHOW_STR |
| 6730 | IPV6_STR |
| 6731 | MBGP_STR |
| 6732 | "Summary of BGP neighbor status\n") |
| 6733 | { |
| 6734 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 6735 | } |
| 6736 | #endif /* HAVE_IPV6 */ |
| 6737 | |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 6738 | const char * |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6739 | afi_safi_print (afi_t afi, safi_t safi) |
| 6740 | { |
| 6741 | if (afi == AFI_IP && safi == SAFI_UNICAST) |
| 6742 | return "IPv4 Unicast"; |
| 6743 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) |
| 6744 | return "IPv4 Multicast"; |
| 6745 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) |
| 6746 | return "VPNv4 Unicast"; |
| 6747 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) |
| 6748 | return "IPv6 Unicast"; |
| 6749 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) |
| 6750 | return "IPv6 Multicast"; |
| 6751 | else |
| 6752 | return "Unknown"; |
| 6753 | } |
| 6754 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6755 | /* Show BGP peer's information. */ |
| 6756 | enum show_type |
| 6757 | { |
| 6758 | show_all, |
| 6759 | show_peer |
| 6760 | }; |
| 6761 | |
| 6762 | void |
| 6763 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
| 6764 | afi_t afi, safi_t safi, |
| 6765 | u_int16_t adv_smcap, u_int16_t adv_rmcap, |
| 6766 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) |
| 6767 | { |
| 6768 | /* Send-Mode */ |
| 6769 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) |
| 6770 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 6771 | { |
| 6772 | vty_out (vty, " Send-mode: "); |
| 6773 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) |
| 6774 | vty_out (vty, "advertised"); |
| 6775 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 6776 | vty_out (vty, "%sreceived", |
| 6777 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? |
| 6778 | ", " : ""); |
| 6779 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6780 | } |
| 6781 | |
| 6782 | /* Receive-Mode */ |
| 6783 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) |
| 6784 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 6785 | { |
| 6786 | vty_out (vty, " Receive-mode: "); |
| 6787 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) |
| 6788 | vty_out (vty, "advertised"); |
| 6789 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 6790 | vty_out (vty, "%sreceived", |
| 6791 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? |
| 6792 | ", " : ""); |
| 6793 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6794 | } |
| 6795 | } |
| 6796 | |
| 6797 | void |
| 6798 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
| 6799 | { |
| 6800 | struct bgp_filter *filter; |
| 6801 | char orf_pfx_name[BUFSIZ]; |
| 6802 | int orf_pfx_count; |
| 6803 | |
| 6804 | filter = &p->filter[afi][safi]; |
| 6805 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6806 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6807 | VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6808 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6809 | if (p->af_group[afi][safi]) |
| 6810 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
| 6811 | |
| 6812 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 6813 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 6814 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 6815 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 6816 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) |
| 6817 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 6818 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); |
| 6819 | |
| 6820 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 6821 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 6822 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 6823 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) |
| 6824 | { |
| 6825 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 6826 | ORF_TYPE_PREFIX, VTY_NEWLINE); |
| 6827 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 6828 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 6829 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 6830 | PEER_CAP_ORF_PREFIX_SM_RCV, |
| 6831 | PEER_CAP_ORF_PREFIX_RM_RCV); |
| 6832 | } |
| 6833 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 6834 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 6835 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 6836 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 6837 | { |
| 6838 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 6839 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); |
| 6840 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 6841 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 6842 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 6843 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, |
| 6844 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); |
| 6845 | } |
| 6846 | |
| 6847 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
| 6848 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); |
| 6849 | |
| 6850 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
| 6851 | || orf_pfx_count) |
| 6852 | { |
| 6853 | vty_out (vty, " Outbound Route Filter (ORF):"); |
| 6854 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) |
| 6855 | vty_out (vty, " sent;"); |
| 6856 | if (orf_pfx_count) |
| 6857 | vty_out (vty, " received (%d entries)", orf_pfx_count); |
| 6858 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6859 | } |
| 6860 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) |
| 6861 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); |
| 6862 | |
| 6863 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) |
| 6864 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); |
| 6865 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 6866 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); |
| 6867 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) |
| 6868 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); |
| 6869 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
| 6870 | vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE); |
| 6871 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) |
| 6872 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); |
| 6873 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) |
| 6874 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 6875 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) |
| 6876 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 6877 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) |
| 6878 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 6879 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 6880 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
| 6881 | { |
| 6882 | vty_out (vty, " Community attribute sent to this neighbor"); |
| 6883 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 6884 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6885 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6886 | 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] | 6887 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6888 | else |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6889 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6890 | } |
| 6891 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) |
| 6892 | { |
| 6893 | vty_out (vty, " Default information originate,"); |
| 6894 | |
| 6895 | if (p->default_rmap[afi][safi].name) |
| 6896 | vty_out (vty, " default route-map %s%s,", |
| 6897 | p->default_rmap[afi][safi].map ? "*" : "", |
| 6898 | p->default_rmap[afi][safi].name); |
| 6899 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) |
| 6900 | vty_out (vty, " default sent%s", VTY_NEWLINE); |
| 6901 | else |
| 6902 | vty_out (vty, " default not sent%s", VTY_NEWLINE); |
| 6903 | } |
| 6904 | |
| 6905 | if (filter->plist[FILTER_IN].name |
| 6906 | || filter->dlist[FILTER_IN].name |
| 6907 | || filter->aslist[FILTER_IN].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6908 | || filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6909 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
| 6910 | if (filter->plist[FILTER_OUT].name |
| 6911 | || filter->dlist[FILTER_OUT].name |
| 6912 | || filter->aslist[FILTER_OUT].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6913 | || filter->map[RMAP_OUT].name |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6914 | || filter->usmap.name) |
| 6915 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6916 | if (filter->map[RMAP_IMPORT].name) |
| 6917 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); |
| 6918 | if (filter->map[RMAP_EXPORT].name) |
| 6919 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6920 | |
| 6921 | /* prefix-list */ |
| 6922 | if (filter->plist[FILTER_IN].name) |
| 6923 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", |
| 6924 | filter->plist[FILTER_IN].plist ? "*" : "", |
| 6925 | filter->plist[FILTER_IN].name, |
| 6926 | VTY_NEWLINE); |
| 6927 | if (filter->plist[FILTER_OUT].name) |
| 6928 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", |
| 6929 | filter->plist[FILTER_OUT].plist ? "*" : "", |
| 6930 | filter->plist[FILTER_OUT].name, |
| 6931 | VTY_NEWLINE); |
| 6932 | |
| 6933 | /* distribute-list */ |
| 6934 | if (filter->dlist[FILTER_IN].name) |
| 6935 | vty_out (vty, " Incoming update network filter list is %s%s%s", |
| 6936 | filter->dlist[FILTER_IN].alist ? "*" : "", |
| 6937 | filter->dlist[FILTER_IN].name, |
| 6938 | VTY_NEWLINE); |
| 6939 | if (filter->dlist[FILTER_OUT].name) |
| 6940 | vty_out (vty, " Outgoing update network filter list is %s%s%s", |
| 6941 | filter->dlist[FILTER_OUT].alist ? "*" : "", |
| 6942 | filter->dlist[FILTER_OUT].name, |
| 6943 | VTY_NEWLINE); |
| 6944 | |
| 6945 | /* filter-list. */ |
| 6946 | if (filter->aslist[FILTER_IN].name) |
| 6947 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", |
| 6948 | filter->aslist[FILTER_IN].aslist ? "*" : "", |
| 6949 | filter->aslist[FILTER_IN].name, |
| 6950 | VTY_NEWLINE); |
| 6951 | if (filter->aslist[FILTER_OUT].name) |
| 6952 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", |
| 6953 | filter->aslist[FILTER_OUT].aslist ? "*" : "", |
| 6954 | filter->aslist[FILTER_OUT].name, |
| 6955 | VTY_NEWLINE); |
| 6956 | |
| 6957 | /* route-map. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6958 | if (filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6959 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6960 | filter->map[RMAP_IN].map ? "*" : "", |
| 6961 | filter->map[RMAP_IN].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6962 | VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6963 | if (filter->map[RMAP_OUT].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6964 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6965 | filter->map[RMAP_OUT].map ? "*" : "", |
| 6966 | filter->map[RMAP_OUT].name, |
| 6967 | VTY_NEWLINE); |
| 6968 | if (filter->map[RMAP_IMPORT].name) |
| 6969 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", |
| 6970 | filter->map[RMAP_IMPORT].map ? "*" : "", |
| 6971 | filter->map[RMAP_IMPORT].name, |
| 6972 | VTY_NEWLINE); |
| 6973 | if (filter->map[RMAP_EXPORT].name) |
| 6974 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", |
| 6975 | filter->map[RMAP_EXPORT].map ? "*" : "", |
| 6976 | filter->map[RMAP_EXPORT].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6977 | VTY_NEWLINE); |
| 6978 | |
| 6979 | /* unsuppress-map */ |
| 6980 | if (filter->usmap.name) |
| 6981 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", |
| 6982 | filter->usmap.map ? "*" : "", |
| 6983 | filter->usmap.name, VTY_NEWLINE); |
| 6984 | |
| 6985 | /* Receive prefix count */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 6986 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
| 6987 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6988 | /* Maximum prefix */ |
| 6989 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) |
| 6990 | { |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 6991 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6992 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 6993 | ? " (warning-only)" : "", VTY_NEWLINE); |
| 6994 | vty_out (vty, " Threshold for warning message %d%%", |
| 6995 | p->pmax_threshold[afi][safi]); |
| 6996 | if (p->pmax_restart[afi][safi]) |
| 6997 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); |
| 6998 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6999 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7000 | |
| 7001 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7002 | } |
| 7003 | |
| 7004 | void |
| 7005 | bgp_show_peer (struct vty *vty, struct peer *p) |
| 7006 | { |
| 7007 | struct bgp *bgp; |
| 7008 | char buf1[BUFSIZ]; |
| 7009 | char timebuf[BGP_UPTIME_LEN]; |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7010 | afi_t afi; |
| 7011 | safi_t safi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7012 | |
| 7013 | bgp = p->bgp; |
| 7014 | |
| 7015 | /* Configured IP address. */ |
| 7016 | vty_out (vty, "BGP neighbor is %s, ", p->host); |
| 7017 | vty_out (vty, "remote AS %d, ", p->as); |
| 7018 | vty_out (vty, "local AS %d%s, ", |
| 7019 | p->change_local_as ? p->change_local_as : p->local_as, |
| 7020 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? |
| 7021 | " no-prepend" : ""); |
| 7022 | vty_out (vty, "%s link%s", |
| 7023 | p->as == p->local_as ? "internal" : "external", |
| 7024 | VTY_NEWLINE); |
| 7025 | |
| 7026 | /* Description. */ |
| 7027 | if (p->desc) |
| 7028 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); |
| 7029 | |
| 7030 | /* Peer-group */ |
| 7031 | if (p->group) |
| 7032 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
| 7033 | p->group->name, VTY_NEWLINE); |
| 7034 | |
| 7035 | /* Administrative shutdown. */ |
| 7036 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) |
| 7037 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); |
| 7038 | |
| 7039 | /* BGP Version. */ |
| 7040 | vty_out (vty, " BGP version 4"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7041 | vty_out (vty, ", remote router ID %s%s", |
| 7042 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), |
| 7043 | VTY_NEWLINE); |
| 7044 | |
| 7045 | /* Confederation */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7046 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
| 7047 | && bgp_confederation_peers_check (bgp, p->as)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7048 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
| 7049 | |
| 7050 | /* Status. */ |
| 7051 | vty_out (vty, " BGP state = %s", |
| 7052 | LOOKUP (bgp_status_msg, p->status)); |
| 7053 | if (p->status == Established) |
| 7054 | vty_out (vty, ", up for %8s", |
| 7055 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7056 | else if (p->status == Active) |
| 7057 | { |
| 7058 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) |
| 7059 | vty_out (vty, " (passive)"); |
| 7060 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) |
| 7061 | vty_out (vty, " (NSF passive)"); |
| 7062 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7063 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7064 | |
| 7065 | /* read timer */ |
| 7066 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); |
| 7067 | |
| 7068 | /* Configured timer values. */ |
| 7069 | vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s", |
| 7070 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); |
| 7071 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) |
| 7072 | { |
| 7073 | vty_out (vty, " Configured hold time is %d", p->holdtime); |
| 7074 | vty_out (vty, ", keepalive interval is %d seconds%s", |
| 7075 | p->keepalive, VTY_NEWLINE); |
| 7076 | } |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7077 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7078 | /* Capability. */ |
| 7079 | if (p->status == Established) |
| 7080 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7081 | if (p->cap |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7082 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
| 7083 | || p->afc_recv[AFI_IP][SAFI_UNICAST] |
| 7084 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] |
| 7085 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] |
| 7086 | #ifdef HAVE_IPV6 |
| 7087 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] |
| 7088 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] |
| 7089 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] |
| 7090 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] |
| 7091 | #endif /* HAVE_IPV6 */ |
| 7092 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] |
| 7093 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) |
| 7094 | { |
| 7095 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); |
| 7096 | |
| 7097 | /* Dynamic */ |
| 7098 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) |
| 7099 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7100 | { |
| 7101 | vty_out (vty, " Dynamic:"); |
| 7102 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7103 | vty_out (vty, " advertised"); |
| 7104 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7105 | vty_out (vty, " %sreceived", |
| 7106 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7107 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7108 | } |
| 7109 | |
| 7110 | /* Route Refresh */ |
| 7111 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) |
| 7112 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7113 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
| 7114 | { |
| 7115 | vty_out (vty, " Route refresh:"); |
| 7116 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) |
| 7117 | vty_out (vty, " advertised"); |
| 7118 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7119 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7120 | vty_out (vty, " %sreceived(%s)", |
| 7121 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", |
| 7122 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) |
| 7123 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? |
| 7124 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); |
| 7125 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7126 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7127 | } |
| 7128 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7129 | /* Multiprotocol Extensions */ |
| 7130 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7131 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7132 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7133 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7134 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
| 7135 | if (p->afc_adv[afi][safi]) |
| 7136 | vty_out (vty, " advertised"); |
| 7137 | if (p->afc_recv[afi][safi]) |
| 7138 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); |
| 7139 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7140 | } |
| 7141 | |
| 7142 | /* Gracefull Restart */ |
| 7143 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7144 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7145 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7146 | vty_out (vty, " Graceful Restart Capabilty:"); |
| 7147 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7148 | vty_out (vty, " advertised"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7149 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
| 7150 | vty_out (vty, " %sreceived", |
| 7151 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7152 | vty_out (vty, "%s", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7153 | |
| 7154 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7155 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7156 | int restart_af_count = 0; |
| 7157 | |
| 7158 | vty_out (vty, " Remote Restart timer is %d seconds%s", |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7159 | p->v_gr_restart, VTY_NEWLINE); |
| 7160 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7161 | |
| 7162 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7163 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7164 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) |
| 7165 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7166 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
| 7167 | afi_safi_print (afi, safi), |
| 7168 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? |
| 7169 | "preserved" : "not preserved"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7170 | restart_af_count++; |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7171 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7172 | if (! restart_af_count) |
| 7173 | vty_out (vty, "none"); |
| 7174 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7175 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7176 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7177 | } |
| 7178 | } |
| 7179 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7180 | /* graceful restart information */ |
| 7181 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7182 | || p->t_gr_restart |
| 7183 | || p->t_gr_stale) |
| 7184 | { |
| 7185 | int eor_send_af_count = 0; |
| 7186 | int eor_receive_af_count = 0; |
| 7187 | |
| 7188 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); |
| 7189 | if (p->status == Established) |
| 7190 | { |
| 7191 | vty_out (vty, " End-of-RIB send: "); |
| 7192 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7193 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7194 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) |
| 7195 | { |
| 7196 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", |
| 7197 | afi_safi_print (afi, safi)); |
| 7198 | eor_send_af_count++; |
| 7199 | } |
| 7200 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7201 | |
| 7202 | vty_out (vty, " End-of-RIB received: "); |
| 7203 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7204 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7205 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) |
| 7206 | { |
| 7207 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", |
| 7208 | afi_safi_print (afi, safi)); |
| 7209 | eor_receive_af_count++; |
| 7210 | } |
| 7211 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7212 | } |
| 7213 | |
| 7214 | if (p->t_gr_restart) |
| 7215 | { |
| 7216 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
| 7217 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); |
| 7218 | } |
| 7219 | if (p->t_gr_stale) |
| 7220 | { |
| 7221 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
| 7222 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); |
| 7223 | } |
| 7224 | } |
| 7225 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7226 | /* Packet counts. */ |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7227 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
| 7228 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); |
| 7229 | vty_out (vty, " Outq depth is %ld%s", p->obuf->count, VTY_NEWLINE); |
| 7230 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
| 7231 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); |
| 7232 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); |
| 7233 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); |
| 7234 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); |
| 7235 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); |
| 7236 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); |
| 7237 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + |
| 7238 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, |
| 7239 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + |
| 7240 | p->dynamic_cap_in, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7241 | |
| 7242 | /* advertisement-interval */ |
| 7243 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", |
| 7244 | p->v_routeadv, VTY_NEWLINE); |
| 7245 | |
| 7246 | /* Update-source. */ |
| 7247 | if (p->update_if || p->update_source) |
| 7248 | { |
| 7249 | vty_out (vty, " Update source is "); |
| 7250 | if (p->update_if) |
| 7251 | vty_out (vty, "%s", p->update_if); |
| 7252 | else if (p->update_source) |
| 7253 | vty_out (vty, "%s", |
| 7254 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); |
| 7255 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7256 | } |
| 7257 | |
| 7258 | /* Default weight */ |
| 7259 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) |
| 7260 | vty_out (vty, " Default weight %d%s", p->weight, |
| 7261 | VTY_NEWLINE); |
| 7262 | |
| 7263 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7264 | |
| 7265 | /* Address Family Information */ |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7266 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7267 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7268 | if (p->afc[afi][safi]) |
| 7269 | bgp_show_peer_afi (vty, p, afi, safi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7270 | |
| 7271 | vty_out (vty, " Connections established %d; dropped %d%s", |
| 7272 | p->established, p->dropped, |
| 7273 | VTY_NEWLINE); |
| 7274 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7275 | if (! p->dropped) |
| 7276 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); |
| 7277 | else |
| 7278 | vty_out (vty, " Last reset %s, due to %s%s", |
| 7279 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), |
| 7280 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 7281 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7282 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7283 | { |
| 7284 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7285 | |
| 7286 | if (p->t_pmax_restart) |
| 7287 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", |
| 7288 | p->host, thread_timer_remain_second (p->t_pmax_restart), |
| 7289 | VTY_NEWLINE); |
| 7290 | else |
| 7291 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", |
| 7292 | p->host, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7293 | } |
| 7294 | |
| 7295 | /* EBGP Multihop */ |
| 7296 | if (peer_sort (p) != BGP_PEER_IBGP && p->ttl > 1) |
| 7297 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 7298 | p->ttl, VTY_NEWLINE); |
| 7299 | |
| 7300 | /* Local address. */ |
| 7301 | if (p->su_local) |
| 7302 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7303 | vty_out (vty, "Local host: %s, Local port: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7304 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
| 7305 | ntohs (p->su_local->sin.sin_port), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7306 | VTY_NEWLINE); |
| 7307 | } |
| 7308 | |
| 7309 | /* Remote address. */ |
| 7310 | if (p->su_remote) |
| 7311 | { |
| 7312 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", |
| 7313 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
| 7314 | ntohs (p->su_remote->sin.sin_port), |
| 7315 | VTY_NEWLINE); |
| 7316 | } |
| 7317 | |
| 7318 | /* Nexthop display. */ |
| 7319 | if (p->su_local) |
| 7320 | { |
| 7321 | vty_out (vty, "Nexthop: %s%s", |
| 7322 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), |
| 7323 | VTY_NEWLINE); |
| 7324 | #ifdef HAVE_IPV6 |
| 7325 | vty_out (vty, "Nexthop global: %s%s", |
| 7326 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), |
| 7327 | VTY_NEWLINE); |
| 7328 | vty_out (vty, "Nexthop local: %s%s", |
| 7329 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), |
| 7330 | VTY_NEWLINE); |
| 7331 | vty_out (vty, "BGP connection: %s%s", |
| 7332 | p->shared_network ? "shared network" : "non shared network", |
| 7333 | VTY_NEWLINE); |
| 7334 | #endif /* HAVE_IPV6 */ |
| 7335 | } |
| 7336 | |
| 7337 | /* Timer information. */ |
| 7338 | if (p->t_start) |
| 7339 | vty_out (vty, "Next start timer due in %ld seconds%s", |
| 7340 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); |
| 7341 | if (p->t_connect) |
| 7342 | vty_out (vty, "Next connect timer due in %ld seconds%s", |
| 7343 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); |
| 7344 | |
| 7345 | vty_out (vty, "Read thread: %s Write thread: %s%s", |
| 7346 | p->t_read ? "on" : "off", |
| 7347 | p->t_write ? "on" : "off", |
| 7348 | VTY_NEWLINE); |
| 7349 | |
| 7350 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR |
| 7351 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) |
| 7352 | bgp_capability_vty_out (vty, p); |
| 7353 | |
| 7354 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7355 | } |
| 7356 | |
| 7357 | int |
| 7358 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
| 7359 | enum show_type type, union sockunion *su) |
| 7360 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7361 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7362 | struct peer *peer; |
| 7363 | int find = 0; |
| 7364 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7365 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7366 | { |
| 7367 | switch (type) |
| 7368 | { |
| 7369 | case show_all: |
| 7370 | bgp_show_peer (vty, peer); |
| 7371 | break; |
| 7372 | case show_peer: |
| 7373 | if (sockunion_same (&peer->su, su)) |
| 7374 | { |
| 7375 | find = 1; |
| 7376 | bgp_show_peer (vty, peer); |
| 7377 | } |
| 7378 | break; |
| 7379 | } |
| 7380 | } |
| 7381 | |
| 7382 | if (type == show_peer && ! find) |
| 7383 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); |
| 7384 | |
| 7385 | return CMD_SUCCESS; |
| 7386 | } |
| 7387 | |
| 7388 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7389 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
| 7390 | enum show_type type, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7391 | { |
| 7392 | int ret; |
| 7393 | struct bgp *bgp; |
| 7394 | union sockunion su; |
| 7395 | |
| 7396 | if (ip_str) |
| 7397 | { |
| 7398 | ret = str2sockunion (ip_str, &su); |
| 7399 | if (ret < 0) |
| 7400 | { |
| 7401 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 7402 | return CMD_WARNING; |
| 7403 | } |
| 7404 | } |
| 7405 | |
| 7406 | if (name) |
| 7407 | { |
| 7408 | bgp = bgp_lookup_by_name (name); |
| 7409 | |
| 7410 | if (! bgp) |
| 7411 | { |
| 7412 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7413 | return CMD_WARNING; |
| 7414 | } |
| 7415 | |
| 7416 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7417 | |
| 7418 | return CMD_SUCCESS; |
| 7419 | } |
| 7420 | |
| 7421 | bgp = bgp_get_default (); |
| 7422 | |
| 7423 | if (bgp) |
| 7424 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7425 | |
| 7426 | return CMD_SUCCESS; |
| 7427 | } |
| 7428 | |
| 7429 | /* "show ip bgp neighbors" commands. */ |
| 7430 | DEFUN (show_ip_bgp_neighbors, |
| 7431 | show_ip_bgp_neighbors_cmd, |
| 7432 | "show ip bgp neighbors", |
| 7433 | SHOW_STR |
| 7434 | IP_STR |
| 7435 | BGP_STR |
| 7436 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7437 | { |
| 7438 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); |
| 7439 | } |
| 7440 | |
| 7441 | ALIAS (show_ip_bgp_neighbors, |
| 7442 | show_ip_bgp_ipv4_neighbors_cmd, |
| 7443 | "show ip bgp ipv4 (unicast|multicast) neighbors", |
| 7444 | SHOW_STR |
| 7445 | IP_STR |
| 7446 | BGP_STR |
| 7447 | "Address family\n" |
| 7448 | "Address Family modifier\n" |
| 7449 | "Address Family modifier\n" |
| 7450 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7451 | |
| 7452 | ALIAS (show_ip_bgp_neighbors, |
| 7453 | show_ip_bgp_vpnv4_all_neighbors_cmd, |
| 7454 | "show ip bgp vpnv4 all neighbors", |
| 7455 | SHOW_STR |
| 7456 | IP_STR |
| 7457 | BGP_STR |
| 7458 | "Display VPNv4 NLRI specific information\n" |
| 7459 | "Display information about all VPNv4 NLRIs\n" |
| 7460 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7461 | |
| 7462 | ALIAS (show_ip_bgp_neighbors, |
| 7463 | show_ip_bgp_vpnv4_rd_neighbors_cmd, |
| 7464 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", |
| 7465 | SHOW_STR |
| 7466 | IP_STR |
| 7467 | BGP_STR |
| 7468 | "Display VPNv4 NLRI specific information\n" |
| 7469 | "Display information for a route distinguisher\n" |
| 7470 | "VPN Route Distinguisher\n" |
| 7471 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7472 | |
| 7473 | ALIAS (show_ip_bgp_neighbors, |
| 7474 | show_bgp_neighbors_cmd, |
| 7475 | "show bgp neighbors", |
| 7476 | SHOW_STR |
| 7477 | BGP_STR |
| 7478 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7479 | |
| 7480 | ALIAS (show_ip_bgp_neighbors, |
| 7481 | show_bgp_ipv6_neighbors_cmd, |
| 7482 | "show bgp ipv6 neighbors", |
| 7483 | SHOW_STR |
| 7484 | BGP_STR |
| 7485 | "Address family\n" |
| 7486 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7487 | |
| 7488 | DEFUN (show_ip_bgp_neighbors_peer, |
| 7489 | show_ip_bgp_neighbors_peer_cmd, |
| 7490 | "show ip bgp neighbors (A.B.C.D|X:X::X:X)", |
| 7491 | SHOW_STR |
| 7492 | IP_STR |
| 7493 | BGP_STR |
| 7494 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7495 | "Neighbor to display information about\n" |
| 7496 | "Neighbor to display information about\n") |
| 7497 | { |
| 7498 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); |
| 7499 | } |
| 7500 | |
| 7501 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7502 | show_ip_bgp_ipv4_neighbors_peer_cmd, |
| 7503 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)", |
| 7504 | SHOW_STR |
| 7505 | IP_STR |
| 7506 | BGP_STR |
| 7507 | "Address family\n" |
| 7508 | "Address Family modifier\n" |
| 7509 | "Address Family modifier\n" |
| 7510 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7511 | "Neighbor to display information about\n" |
| 7512 | "Neighbor to display information about\n") |
| 7513 | |
| 7514 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7515 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, |
| 7516 | "show ip bgp vpnv4 all neighbors A.B.C.D", |
| 7517 | SHOW_STR |
| 7518 | IP_STR |
| 7519 | BGP_STR |
| 7520 | "Display VPNv4 NLRI specific information\n" |
| 7521 | "Display information about all VPNv4 NLRIs\n" |
| 7522 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7523 | "Neighbor to display information about\n") |
| 7524 | |
| 7525 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7526 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, |
| 7527 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", |
| 7528 | SHOW_STR |
| 7529 | IP_STR |
| 7530 | BGP_STR |
| 7531 | "Display VPNv4 NLRI specific information\n" |
| 7532 | "Display information about all VPNv4 NLRIs\n" |
| 7533 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7534 | "Neighbor to display information about\n") |
| 7535 | |
| 7536 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7537 | show_bgp_neighbors_peer_cmd, |
| 7538 | "show bgp neighbors (A.B.C.D|X:X::X:X)", |
| 7539 | SHOW_STR |
| 7540 | BGP_STR |
| 7541 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7542 | "Neighbor to display information about\n" |
| 7543 | "Neighbor to display information about\n") |
| 7544 | |
| 7545 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7546 | show_bgp_ipv6_neighbors_peer_cmd, |
| 7547 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 7548 | SHOW_STR |
| 7549 | BGP_STR |
| 7550 | "Address family\n" |
| 7551 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7552 | "Neighbor to display information about\n" |
| 7553 | "Neighbor to display information about\n") |
| 7554 | |
| 7555 | DEFUN (show_ip_bgp_instance_neighbors, |
| 7556 | show_ip_bgp_instance_neighbors_cmd, |
| 7557 | "show ip bgp view WORD neighbors", |
| 7558 | SHOW_STR |
| 7559 | IP_STR |
| 7560 | BGP_STR |
| 7561 | "BGP view\n" |
| 7562 | "View name\n" |
| 7563 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7564 | { |
| 7565 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); |
| 7566 | } |
| 7567 | |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 7568 | ALIAS (show_ip_bgp_instance_neighbors, |
| 7569 | show_bgp_instance_neighbors_cmd, |
| 7570 | "show bgp view WORD neighbors", |
| 7571 | SHOW_STR |
| 7572 | BGP_STR |
| 7573 | "BGP view\n" |
| 7574 | "View name\n" |
| 7575 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7576 | |
| 7577 | ALIAS (show_ip_bgp_instance_neighbors, |
| 7578 | show_bgp_instance_ipv6_neighbors_cmd, |
| 7579 | "show bgp view WORD ipv6 neighbors", |
| 7580 | SHOW_STR |
| 7581 | BGP_STR |
| 7582 | "BGP view\n" |
| 7583 | "View name\n" |
| 7584 | "Address family\n" |
| 7585 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7586 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7587 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
| 7588 | show_ip_bgp_instance_neighbors_peer_cmd, |
| 7589 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 7590 | SHOW_STR |
| 7591 | IP_STR |
| 7592 | BGP_STR |
| 7593 | "BGP view\n" |
| 7594 | "View name\n" |
| 7595 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7596 | "Neighbor to display information about\n" |
| 7597 | "Neighbor to display information about\n") |
| 7598 | { |
| 7599 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); |
| 7600 | } |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 7601 | |
| 7602 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 7603 | show_bgp_instance_neighbors_peer_cmd, |
| 7604 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 7605 | SHOW_STR |
| 7606 | BGP_STR |
| 7607 | "BGP view\n" |
| 7608 | "View name\n" |
| 7609 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7610 | "Neighbor to display information about\n" |
| 7611 | "Neighbor to display information about\n") |
| 7612 | |
| 7613 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 7614 | show_bgp_instance_ipv6_neighbors_peer_cmd, |
| 7615 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 7616 | SHOW_STR |
| 7617 | BGP_STR |
| 7618 | "BGP view\n" |
| 7619 | "View name\n" |
| 7620 | "Address family\n" |
| 7621 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7622 | "Neighbor to display information about\n" |
| 7623 | "Neighbor to display information about\n") |
| 7624 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7625 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
| 7626 | paths' and `show ip mbgp paths'. Those functions results are the |
| 7627 | same.*/ |
| 7628 | DEFUN (show_ip_bgp_paths, |
| 7629 | show_ip_bgp_paths_cmd, |
| 7630 | "show ip bgp paths", |
| 7631 | SHOW_STR |
| 7632 | IP_STR |
| 7633 | BGP_STR |
| 7634 | "Path information\n") |
| 7635 | { |
| 7636 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); |
| 7637 | aspath_print_all_vty (vty); |
| 7638 | return CMD_SUCCESS; |
| 7639 | } |
| 7640 | |
| 7641 | DEFUN (show_ip_bgp_ipv4_paths, |
| 7642 | show_ip_bgp_ipv4_paths_cmd, |
| 7643 | "show ip bgp ipv4 (unicast|multicast) paths", |
| 7644 | SHOW_STR |
| 7645 | IP_STR |
| 7646 | BGP_STR |
| 7647 | "Address family\n" |
| 7648 | "Address Family modifier\n" |
| 7649 | "Address Family modifier\n" |
| 7650 | "Path information\n") |
| 7651 | { |
| 7652 | vty_out (vty, "Address Refcnt Path\r\n"); |
| 7653 | aspath_print_all_vty (vty); |
| 7654 | |
| 7655 | return CMD_SUCCESS; |
| 7656 | } |
| 7657 | |
| 7658 | #include "hash.h" |
| 7659 | |
| 7660 | void |
| 7661 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
| 7662 | { |
| 7663 | struct community *com; |
| 7664 | |
| 7665 | com = (struct community *) backet->data; |
| 7666 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, |
| 7667 | community_str (com), VTY_NEWLINE); |
| 7668 | } |
| 7669 | |
| 7670 | /* Show BGP's community internal data. */ |
| 7671 | DEFUN (show_ip_bgp_community_info, |
| 7672 | show_ip_bgp_community_info_cmd, |
| 7673 | "show ip bgp community-info", |
| 7674 | SHOW_STR |
| 7675 | IP_STR |
| 7676 | BGP_STR |
| 7677 | "List all bgp community information\n") |
| 7678 | { |
| 7679 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); |
| 7680 | |
| 7681 | hash_iterate (community_hash (), |
| 7682 | (void (*) (struct hash_backet *, void *)) |
| 7683 | community_show_all_iterator, |
| 7684 | vty); |
| 7685 | |
| 7686 | return CMD_SUCCESS; |
| 7687 | } |
| 7688 | |
| 7689 | DEFUN (show_ip_bgp_attr_info, |
| 7690 | show_ip_bgp_attr_info_cmd, |
| 7691 | "show ip bgp attribute-info", |
| 7692 | SHOW_STR |
| 7693 | IP_STR |
| 7694 | BGP_STR |
| 7695 | "List all bgp attribute information\n") |
| 7696 | { |
| 7697 | attr_show_all (vty); |
| 7698 | return CMD_SUCCESS; |
| 7699 | } |
| 7700 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7701 | int |
| 7702 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
| 7703 | afi_t afi, safi_t safi) |
| 7704 | { |
| 7705 | char timebuf[BGP_UPTIME_LEN]; |
| 7706 | char rmbuf[14]; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7707 | const char *rmname; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7708 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7709 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7710 | int len; |
| 7711 | int count = 0; |
| 7712 | |
| 7713 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) |
| 7714 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7715 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7716 | { |
| 7717 | count++; |
| 7718 | bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 7719 | } |
| 7720 | return count; |
| 7721 | } |
| 7722 | |
| 7723 | len = vty_out (vty, "%s", rsclient->host); |
| 7724 | len = 16 - len; |
| 7725 | |
| 7726 | if (len < 1) |
| 7727 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 7728 | else |
| 7729 | vty_out (vty, "%*s", len, " "); |
| 7730 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 7731 | vty_out (vty, "4 "); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7732 | |
| 7733 | vty_out (vty, "%5d ", rsclient->as); |
| 7734 | |
| 7735 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); |
| 7736 | if ( rmname && strlen (rmname) > 13 ) |
| 7737 | { |
| 7738 | sprintf (rmbuf, "%13s", "..."); |
| 7739 | rmname = strncpy (rmbuf, rmname, 10); |
| 7740 | } |
| 7741 | else if (! rmname) |
| 7742 | rmname = "<none>"; |
| 7743 | vty_out (vty, " %13s ", rmname); |
| 7744 | |
| 7745 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); |
| 7746 | if ( rmname && strlen (rmname) > 13 ) |
| 7747 | { |
| 7748 | sprintf (rmbuf, "%13s", "..."); |
| 7749 | rmname = strncpy (rmbuf, rmname, 10); |
| 7750 | } |
| 7751 | else if (! rmname) |
| 7752 | rmname = "<none>"; |
| 7753 | vty_out (vty, " %13s ", rmname); |
| 7754 | |
| 7755 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); |
| 7756 | |
| 7757 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) |
| 7758 | vty_out (vty, " Idle (Admin)"); |
| 7759 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7760 | vty_out (vty, " Idle (PfxCt)"); |
| 7761 | else |
| 7762 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); |
| 7763 | |
| 7764 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7765 | |
| 7766 | return 1; |
| 7767 | } |
| 7768 | |
| 7769 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7770 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
| 7771 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7772 | { |
| 7773 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7774 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7775 | int count = 0; |
| 7776 | |
| 7777 | /* Header string for each address family. */ |
| 7778 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; |
| 7779 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7780 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7781 | { |
| 7782 | if (peer->afc[afi][safi] && |
| 7783 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 7784 | { |
| 7785 | if (! count) |
| 7786 | { |
| 7787 | vty_out (vty, |
| 7788 | "Route Server's BGP router identifier %s%s", |
| 7789 | inet_ntoa (bgp->router_id), VTY_NEWLINE); |
| 7790 | vty_out (vty, |
| 7791 | "Route Server's local AS number %d%s", bgp->as, |
| 7792 | VTY_NEWLINE); |
| 7793 | |
| 7794 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7795 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 7796 | } |
| 7797 | |
| 7798 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 7799 | } |
| 7800 | } |
| 7801 | |
| 7802 | if (count) |
| 7803 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, |
| 7804 | count, VTY_NEWLINE); |
| 7805 | else |
| 7806 | vty_out (vty, "No %s Route Server Client is configured%s", |
| 7807 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 7808 | |
| 7809 | return CMD_SUCCESS; |
| 7810 | } |
| 7811 | |
| 7812 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7813 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
| 7814 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7815 | { |
| 7816 | struct bgp *bgp; |
| 7817 | |
| 7818 | if (name) |
| 7819 | { |
| 7820 | bgp = bgp_lookup_by_name (name); |
| 7821 | |
| 7822 | if (! bgp) |
| 7823 | { |
| 7824 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7825 | return CMD_WARNING; |
| 7826 | } |
| 7827 | |
| 7828 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 7829 | return CMD_SUCCESS; |
| 7830 | } |
| 7831 | |
| 7832 | bgp = bgp_get_default (); |
| 7833 | |
| 7834 | if (bgp) |
| 7835 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 7836 | |
| 7837 | return CMD_SUCCESS; |
| 7838 | } |
| 7839 | |
| 7840 | /* 'show bgp rsclient' commands. */ |
| 7841 | DEFUN (show_ip_bgp_rsclient_summary, |
| 7842 | show_ip_bgp_rsclient_summary_cmd, |
| 7843 | "show ip bgp rsclient summary", |
| 7844 | SHOW_STR |
| 7845 | IP_STR |
| 7846 | BGP_STR |
| 7847 | "Information about Route Server Clients\n" |
| 7848 | "Summary of all Route Server Clients\n") |
| 7849 | { |
| 7850 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 7851 | } |
| 7852 | |
| 7853 | DEFUN (show_ip_bgp_instance_rsclient_summary, |
| 7854 | show_ip_bgp_instance_rsclient_summary_cmd, |
| 7855 | "show ip bgp view WORD rsclient summary", |
| 7856 | SHOW_STR |
| 7857 | IP_STR |
| 7858 | BGP_STR |
| 7859 | "BGP view\n" |
| 7860 | "View name\n" |
| 7861 | "Information about Route Server Clients\n" |
| 7862 | "Summary of all Route Server Clients\n") |
| 7863 | { |
| 7864 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 7865 | } |
| 7866 | |
| 7867 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, |
| 7868 | show_ip_bgp_ipv4_rsclient_summary_cmd, |
| 7869 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", |
| 7870 | SHOW_STR |
| 7871 | IP_STR |
| 7872 | BGP_STR |
| 7873 | "Address family\n" |
| 7874 | "Address Family modifier\n" |
| 7875 | "Address Family modifier\n" |
| 7876 | "Information about Route Server Clients\n" |
| 7877 | "Summary of all Route Server Clients\n") |
| 7878 | { |
| 7879 | if (strncmp (argv[0], "m", 1) == 0) |
| 7880 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 7881 | |
| 7882 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 7883 | } |
| 7884 | |
| 7885 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, |
| 7886 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, |
| 7887 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 7888 | SHOW_STR |
| 7889 | IP_STR |
| 7890 | BGP_STR |
| 7891 | "BGP view\n" |
| 7892 | "View name\n" |
| 7893 | "Address family\n" |
| 7894 | "Address Family modifier\n" |
| 7895 | "Address Family modifier\n" |
| 7896 | "Information about Route Server Clients\n" |
| 7897 | "Summary of all Route Server Clients\n") |
| 7898 | { |
| 7899 | if (strncmp (argv[1], "m", 1) == 0) |
| 7900 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 7901 | |
| 7902 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 7903 | } |
| 7904 | |
| 7905 | #ifdef HAVE_IPV6 |
| 7906 | DEFUN (show_bgp_rsclient_summary, |
| 7907 | show_bgp_rsclient_summary_cmd, |
| 7908 | "show bgp rsclient summary", |
| 7909 | SHOW_STR |
| 7910 | BGP_STR |
| 7911 | "Information about Route Server Clients\n" |
| 7912 | "Summary of all Route Server Clients\n") |
| 7913 | { |
| 7914 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7915 | } |
| 7916 | |
| 7917 | DEFUN (show_bgp_instance_rsclient_summary, |
| 7918 | show_bgp_instance_rsclient_summary_cmd, |
| 7919 | "show bgp view WORD rsclient summary", |
| 7920 | SHOW_STR |
| 7921 | BGP_STR |
| 7922 | "BGP view\n" |
| 7923 | "View name\n" |
| 7924 | "Information about Route Server Clients\n" |
| 7925 | "Summary of all Route Server Clients\n") |
| 7926 | { |
| 7927 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 7928 | } |
| 7929 | |
| 7930 | ALIAS (show_bgp_rsclient_summary, |
| 7931 | show_bgp_ipv6_rsclient_summary_cmd, |
| 7932 | "show bgp ipv6 rsclient summary", |
| 7933 | SHOW_STR |
| 7934 | BGP_STR |
| 7935 | "Address family\n" |
| 7936 | "Information about Route Server Clients\n" |
| 7937 | "Summary of all Route Server Clients\n") |
| 7938 | |
| 7939 | ALIAS (show_bgp_instance_rsclient_summary, |
| 7940 | show_bgp_instance_ipv6_rsclient_summary_cmd, |
| 7941 | "show bgp view WORD ipv6 rsclient summary", |
| 7942 | SHOW_STR |
| 7943 | BGP_STR |
| 7944 | "BGP view\n" |
| 7945 | "View name\n" |
| 7946 | "Address family\n" |
| 7947 | "Information about Route Server Clients\n" |
| 7948 | "Summary of all Route Server Clients\n") |
| 7949 | #endif /* HAVE IPV6 */ |
| 7950 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7951 | /* Redistribute VTY commands. */ |
| 7952 | |
| 7953 | /* Utility function to convert user input route type string to route |
| 7954 | type. */ |
| 7955 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7956 | bgp_str2route_type (int afi, const char *str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7957 | { |
| 7958 | if (! str) |
| 7959 | return 0; |
| 7960 | |
| 7961 | if (afi == AFI_IP) |
| 7962 | { |
| 7963 | if (strncmp (str, "k", 1) == 0) |
| 7964 | return ZEBRA_ROUTE_KERNEL; |
| 7965 | else if (strncmp (str, "c", 1) == 0) |
| 7966 | return ZEBRA_ROUTE_CONNECT; |
| 7967 | else if (strncmp (str, "s", 1) == 0) |
| 7968 | return ZEBRA_ROUTE_STATIC; |
| 7969 | else if (strncmp (str, "r", 1) == 0) |
| 7970 | return ZEBRA_ROUTE_RIP; |
| 7971 | else if (strncmp (str, "o", 1) == 0) |
| 7972 | return ZEBRA_ROUTE_OSPF; |
| 7973 | } |
| 7974 | if (afi == AFI_IP6) |
| 7975 | { |
| 7976 | if (strncmp (str, "k", 1) == 0) |
| 7977 | return ZEBRA_ROUTE_KERNEL; |
| 7978 | else if (strncmp (str, "c", 1) == 0) |
| 7979 | return ZEBRA_ROUTE_CONNECT; |
| 7980 | else if (strncmp (str, "s", 1) == 0) |
| 7981 | return ZEBRA_ROUTE_STATIC; |
| 7982 | else if (strncmp (str, "r", 1) == 0) |
| 7983 | return ZEBRA_ROUTE_RIPNG; |
| 7984 | else if (strncmp (str, "o", 1) == 0) |
| 7985 | return ZEBRA_ROUTE_OSPF6; |
| 7986 | } |
| 7987 | return 0; |
| 7988 | } |
| 7989 | |
| 7990 | DEFUN (bgp_redistribute_ipv4, |
| 7991 | bgp_redistribute_ipv4_cmd, |
| 7992 | "redistribute (connected|kernel|ospf|rip|static)", |
| 7993 | "Redistribute information from another routing protocol\n" |
| 7994 | "Connected\n" |
| 7995 | "Kernel routes\n" |
| 7996 | "Open Shurtest Path First (OSPF)\n" |
| 7997 | "Routing Information Protocol (RIP)\n" |
| 7998 | "Static routes\n") |
| 7999 | { |
| 8000 | int type; |
| 8001 | |
| 8002 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8003 | if (! type) |
| 8004 | { |
| 8005 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8006 | return CMD_WARNING; |
| 8007 | } |
| 8008 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8009 | } |
| 8010 | |
| 8011 | DEFUN (bgp_redistribute_ipv4_rmap, |
| 8012 | bgp_redistribute_ipv4_rmap_cmd, |
| 8013 | "redistribute (connected|kernel|ospf|rip|static) route-map WORD", |
| 8014 | "Redistribute information from another routing protocol\n" |
| 8015 | "Connected\n" |
| 8016 | "Kernel routes\n" |
| 8017 | "Open Shurtest Path First (OSPF)\n" |
| 8018 | "Routing Information Protocol (RIP)\n" |
| 8019 | "Static routes\n" |
| 8020 | "Route map reference\n" |
| 8021 | "Pointer to route-map entries\n") |
| 8022 | { |
| 8023 | int type; |
| 8024 | |
| 8025 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8026 | if (! type) |
| 8027 | { |
| 8028 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8029 | return CMD_WARNING; |
| 8030 | } |
| 8031 | |
| 8032 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8033 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8034 | } |
| 8035 | |
| 8036 | DEFUN (bgp_redistribute_ipv4_metric, |
| 8037 | bgp_redistribute_ipv4_metric_cmd, |
| 8038 | "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", |
| 8039 | "Redistribute information from another routing protocol\n" |
| 8040 | "Connected\n" |
| 8041 | "Kernel routes\n" |
| 8042 | "Open Shurtest Path First (OSPF)\n" |
| 8043 | "Routing Information Protocol (RIP)\n" |
| 8044 | "Static routes\n" |
| 8045 | "Metric for redistributed routes\n" |
| 8046 | "Default metric\n") |
| 8047 | { |
| 8048 | int type; |
| 8049 | u_int32_t metric; |
| 8050 | |
| 8051 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8052 | if (! type) |
| 8053 | { |
| 8054 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8055 | return CMD_WARNING; |
| 8056 | } |
| 8057 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8058 | |
| 8059 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8060 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8061 | } |
| 8062 | |
| 8063 | DEFUN (bgp_redistribute_ipv4_rmap_metric, |
| 8064 | bgp_redistribute_ipv4_rmap_metric_cmd, |
| 8065 | "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", |
| 8066 | "Redistribute information from another routing protocol\n" |
| 8067 | "Connected\n" |
| 8068 | "Kernel routes\n" |
| 8069 | "Open Shurtest Path First (OSPF)\n" |
| 8070 | "Routing Information Protocol (RIP)\n" |
| 8071 | "Static routes\n" |
| 8072 | "Route map reference\n" |
| 8073 | "Pointer to route-map entries\n" |
| 8074 | "Metric for redistributed routes\n" |
| 8075 | "Default metric\n") |
| 8076 | { |
| 8077 | int type; |
| 8078 | u_int32_t metric; |
| 8079 | |
| 8080 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8081 | if (! type) |
| 8082 | { |
| 8083 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8084 | return CMD_WARNING; |
| 8085 | } |
| 8086 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8087 | |
| 8088 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8089 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8090 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8091 | } |
| 8092 | |
| 8093 | DEFUN (bgp_redistribute_ipv4_metric_rmap, |
| 8094 | bgp_redistribute_ipv4_metric_rmap_cmd, |
| 8095 | "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", |
| 8096 | "Redistribute information from another routing protocol\n" |
| 8097 | "Connected\n" |
| 8098 | "Kernel routes\n" |
| 8099 | "Open Shurtest Path First (OSPF)\n" |
| 8100 | "Routing Information Protocol (RIP)\n" |
| 8101 | "Static routes\n" |
| 8102 | "Metric for redistributed routes\n" |
| 8103 | "Default metric\n" |
| 8104 | "Route map reference\n" |
| 8105 | "Pointer to route-map entries\n") |
| 8106 | { |
| 8107 | int type; |
| 8108 | u_int32_t metric; |
| 8109 | |
| 8110 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8111 | if (! type) |
| 8112 | { |
| 8113 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8114 | return CMD_WARNING; |
| 8115 | } |
| 8116 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8117 | |
| 8118 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8119 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); |
| 8120 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8121 | } |
| 8122 | |
| 8123 | DEFUN (no_bgp_redistribute_ipv4, |
| 8124 | no_bgp_redistribute_ipv4_cmd, |
| 8125 | "no redistribute (connected|kernel|ospf|rip|static)", |
| 8126 | NO_STR |
| 8127 | "Redistribute information from another routing protocol\n" |
| 8128 | "Connected\n" |
| 8129 | "Kernel routes\n" |
| 8130 | "Open Shurtest Path First (OSPF)\n" |
| 8131 | "Routing Information Protocol (RIP)\n" |
| 8132 | "Static routes\n") |
| 8133 | { |
| 8134 | int type; |
| 8135 | |
| 8136 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8137 | if (! type) |
| 8138 | { |
| 8139 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8140 | return CMD_WARNING; |
| 8141 | } |
| 8142 | |
| 8143 | return bgp_redistribute_unset (vty->index, AFI_IP, type); |
| 8144 | } |
| 8145 | |
| 8146 | DEFUN (no_bgp_redistribute_ipv4_rmap, |
| 8147 | no_bgp_redistribute_ipv4_rmap_cmd, |
| 8148 | "no redistribute (connected|kernel|ospf|rip|static) route-map WORD", |
| 8149 | NO_STR |
| 8150 | "Redistribute information from another routing protocol\n" |
| 8151 | "Connected\n" |
| 8152 | "Kernel routes\n" |
| 8153 | "Open Shurtest Path First (OSPF)\n" |
| 8154 | "Routing Information Protocol (RIP)\n" |
| 8155 | "Static routes\n" |
| 8156 | "Route map reference\n" |
| 8157 | "Pointer to route-map entries\n") |
| 8158 | { |
| 8159 | int type; |
| 8160 | |
| 8161 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8162 | if (! type) |
| 8163 | { |
| 8164 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8165 | return CMD_WARNING; |
| 8166 | } |
| 8167 | |
| 8168 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8169 | return CMD_SUCCESS; |
| 8170 | } |
| 8171 | |
| 8172 | DEFUN (no_bgp_redistribute_ipv4_metric, |
| 8173 | no_bgp_redistribute_ipv4_metric_cmd, |
| 8174 | "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", |
| 8175 | NO_STR |
| 8176 | "Redistribute information from another routing protocol\n" |
| 8177 | "Connected\n" |
| 8178 | "Kernel routes\n" |
| 8179 | "Open Shurtest Path First (OSPF)\n" |
| 8180 | "Routing Information Protocol (RIP)\n" |
| 8181 | "Static routes\n" |
| 8182 | "Metric for redistributed routes\n" |
| 8183 | "Default metric\n") |
| 8184 | { |
| 8185 | int type; |
| 8186 | |
| 8187 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8188 | if (! type) |
| 8189 | { |
| 8190 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8191 | return CMD_WARNING; |
| 8192 | } |
| 8193 | |
| 8194 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8195 | return CMD_SUCCESS; |
| 8196 | } |
| 8197 | |
| 8198 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, |
| 8199 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
| 8200 | "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", |
| 8201 | NO_STR |
| 8202 | "Redistribute information from another routing protocol\n" |
| 8203 | "Connected\n" |
| 8204 | "Kernel routes\n" |
| 8205 | "Open Shurtest Path First (OSPF)\n" |
| 8206 | "Routing Information Protocol (RIP)\n" |
| 8207 | "Static routes\n" |
| 8208 | "Route map reference\n" |
| 8209 | "Pointer to route-map entries\n" |
| 8210 | "Metric for redistributed routes\n" |
| 8211 | "Default metric\n") |
| 8212 | { |
| 8213 | int type; |
| 8214 | |
| 8215 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8216 | if (! type) |
| 8217 | { |
| 8218 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8219 | return CMD_WARNING; |
| 8220 | } |
| 8221 | |
| 8222 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8223 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8224 | return CMD_SUCCESS; |
| 8225 | } |
| 8226 | |
| 8227 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, |
| 8228 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
| 8229 | "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", |
| 8230 | NO_STR |
| 8231 | "Redistribute information from another routing protocol\n" |
| 8232 | "Connected\n" |
| 8233 | "Kernel routes\n" |
| 8234 | "Open Shurtest Path First (OSPF)\n" |
| 8235 | "Routing Information Protocol (RIP)\n" |
| 8236 | "Static routes\n" |
| 8237 | "Metric for redistributed routes\n" |
| 8238 | "Default metric\n" |
| 8239 | "Route map reference\n" |
| 8240 | "Pointer to route-map entries\n") |
| 8241 | |
| 8242 | #ifdef HAVE_IPV6 |
| 8243 | DEFUN (bgp_redistribute_ipv6, |
| 8244 | bgp_redistribute_ipv6_cmd, |
| 8245 | "redistribute (connected|kernel|ospf6|ripng|static)", |
| 8246 | "Redistribute information from another routing protocol\n" |
| 8247 | "Connected\n" |
| 8248 | "Kernel routes\n" |
| 8249 | "Open Shurtest Path First (OSPFv3)\n" |
| 8250 | "Routing Information Protocol (RIPng)\n" |
| 8251 | "Static routes\n") |
| 8252 | { |
| 8253 | int type; |
| 8254 | |
| 8255 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8256 | if (! type) |
| 8257 | { |
| 8258 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8259 | return CMD_WARNING; |
| 8260 | } |
| 8261 | |
| 8262 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8263 | } |
| 8264 | |
| 8265 | DEFUN (bgp_redistribute_ipv6_rmap, |
| 8266 | bgp_redistribute_ipv6_rmap_cmd, |
| 8267 | "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", |
| 8268 | "Redistribute information from another routing protocol\n" |
| 8269 | "Connected\n" |
| 8270 | "Kernel routes\n" |
| 8271 | "Open Shurtest Path First (OSPFv3)\n" |
| 8272 | "Routing Information Protocol (RIPng)\n" |
| 8273 | "Static routes\n" |
| 8274 | "Route map reference\n" |
| 8275 | "Pointer to route-map entries\n") |
| 8276 | { |
| 8277 | int type; |
| 8278 | |
| 8279 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8280 | if (! type) |
| 8281 | { |
| 8282 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8283 | return CMD_WARNING; |
| 8284 | } |
| 8285 | |
| 8286 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8287 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8288 | } |
| 8289 | |
| 8290 | DEFUN (bgp_redistribute_ipv6_metric, |
| 8291 | bgp_redistribute_ipv6_metric_cmd, |
| 8292 | "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", |
| 8293 | "Redistribute information from another routing protocol\n" |
| 8294 | "Connected\n" |
| 8295 | "Kernel routes\n" |
| 8296 | "Open Shurtest Path First (OSPFv3)\n" |
| 8297 | "Routing Information Protocol (RIPng)\n" |
| 8298 | "Static routes\n" |
| 8299 | "Metric for redistributed routes\n" |
| 8300 | "Default metric\n") |
| 8301 | { |
| 8302 | int type; |
| 8303 | u_int32_t metric; |
| 8304 | |
| 8305 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8306 | if (! type) |
| 8307 | { |
| 8308 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8309 | return CMD_WARNING; |
| 8310 | } |
| 8311 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8312 | |
| 8313 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8314 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8315 | } |
| 8316 | |
| 8317 | DEFUN (bgp_redistribute_ipv6_rmap_metric, |
| 8318 | bgp_redistribute_ipv6_rmap_metric_cmd, |
| 8319 | "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", |
| 8320 | "Redistribute information from another routing protocol\n" |
| 8321 | "Connected\n" |
| 8322 | "Kernel routes\n" |
| 8323 | "Open Shurtest Path First (OSPFv3)\n" |
| 8324 | "Routing Information Protocol (RIPng)\n" |
| 8325 | "Static routes\n" |
| 8326 | "Route map reference\n" |
| 8327 | "Pointer to route-map entries\n" |
| 8328 | "Metric for redistributed routes\n" |
| 8329 | "Default metric\n") |
| 8330 | { |
| 8331 | int type; |
| 8332 | u_int32_t metric; |
| 8333 | |
| 8334 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8335 | if (! type) |
| 8336 | { |
| 8337 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8338 | return CMD_WARNING; |
| 8339 | } |
| 8340 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8341 | |
| 8342 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8343 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8344 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8345 | } |
| 8346 | |
| 8347 | DEFUN (bgp_redistribute_ipv6_metric_rmap, |
| 8348 | bgp_redistribute_ipv6_metric_rmap_cmd, |
| 8349 | "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", |
| 8350 | "Redistribute information from another routing protocol\n" |
| 8351 | "Connected\n" |
| 8352 | "Kernel routes\n" |
| 8353 | "Open Shurtest Path First (OSPFv3)\n" |
| 8354 | "Routing Information Protocol (RIPng)\n" |
| 8355 | "Static routes\n" |
| 8356 | "Metric for redistributed routes\n" |
| 8357 | "Default metric\n" |
| 8358 | "Route map reference\n" |
| 8359 | "Pointer to route-map entries\n") |
| 8360 | { |
| 8361 | int type; |
| 8362 | u_int32_t metric; |
| 8363 | |
| 8364 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8365 | if (! type) |
| 8366 | { |
| 8367 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8368 | return CMD_WARNING; |
| 8369 | } |
| 8370 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8371 | |
| 8372 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8373 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); |
| 8374 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8375 | } |
| 8376 | |
| 8377 | DEFUN (no_bgp_redistribute_ipv6, |
| 8378 | no_bgp_redistribute_ipv6_cmd, |
| 8379 | "no redistribute (connected|kernel|ospf6|ripng|static)", |
| 8380 | NO_STR |
| 8381 | "Redistribute information from another routing protocol\n" |
| 8382 | "Connected\n" |
| 8383 | "Kernel routes\n" |
| 8384 | "Open Shurtest Path First (OSPFv3)\n" |
| 8385 | "Routing Information Protocol (RIPng)\n" |
| 8386 | "Static routes\n") |
| 8387 | { |
| 8388 | int type; |
| 8389 | |
| 8390 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8391 | if (! type) |
| 8392 | { |
| 8393 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8394 | return CMD_WARNING; |
| 8395 | } |
| 8396 | |
| 8397 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); |
| 8398 | } |
| 8399 | |
| 8400 | DEFUN (no_bgp_redistribute_ipv6_rmap, |
| 8401 | no_bgp_redistribute_ipv6_rmap_cmd, |
| 8402 | "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", |
| 8403 | NO_STR |
| 8404 | "Redistribute information from another routing protocol\n" |
| 8405 | "Connected\n" |
| 8406 | "Kernel routes\n" |
| 8407 | "Open Shurtest Path First (OSPFv3)\n" |
| 8408 | "Routing Information Protocol (RIPng)\n" |
| 8409 | "Static routes\n" |
| 8410 | "Route map reference\n" |
| 8411 | "Pointer to route-map entries\n") |
| 8412 | { |
| 8413 | int type; |
| 8414 | |
| 8415 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8416 | if (! type) |
| 8417 | { |
| 8418 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8419 | return CMD_WARNING; |
| 8420 | } |
| 8421 | |
| 8422 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8423 | return CMD_SUCCESS; |
| 8424 | } |
| 8425 | |
| 8426 | DEFUN (no_bgp_redistribute_ipv6_metric, |
| 8427 | no_bgp_redistribute_ipv6_metric_cmd, |
| 8428 | "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", |
| 8429 | NO_STR |
| 8430 | "Redistribute information from another routing protocol\n" |
| 8431 | "Connected\n" |
| 8432 | "Kernel routes\n" |
| 8433 | "Open Shurtest Path First (OSPFv3)\n" |
| 8434 | "Routing Information Protocol (RIPng)\n" |
| 8435 | "Static routes\n" |
| 8436 | "Metric for redistributed routes\n" |
| 8437 | "Default metric\n") |
| 8438 | { |
| 8439 | int type; |
| 8440 | |
| 8441 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8442 | if (! type) |
| 8443 | { |
| 8444 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8445 | return CMD_WARNING; |
| 8446 | } |
| 8447 | |
| 8448 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8449 | return CMD_SUCCESS; |
| 8450 | } |
| 8451 | |
| 8452 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, |
| 8453 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
| 8454 | "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", |
| 8455 | NO_STR |
| 8456 | "Redistribute information from another routing protocol\n" |
| 8457 | "Connected\n" |
| 8458 | "Kernel routes\n" |
| 8459 | "Open Shurtest Path First (OSPFv3)\n" |
| 8460 | "Routing Information Protocol (RIPng)\n" |
| 8461 | "Static routes\n" |
| 8462 | "Route map reference\n" |
| 8463 | "Pointer to route-map entries\n" |
| 8464 | "Metric for redistributed routes\n" |
| 8465 | "Default metric\n") |
| 8466 | { |
| 8467 | int type; |
| 8468 | |
| 8469 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8470 | if (! type) |
| 8471 | { |
| 8472 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8473 | return CMD_WARNING; |
| 8474 | } |
| 8475 | |
| 8476 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8477 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8478 | return CMD_SUCCESS; |
| 8479 | } |
| 8480 | |
| 8481 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, |
| 8482 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
| 8483 | "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", |
| 8484 | NO_STR |
| 8485 | "Redistribute information from another routing protocol\n" |
| 8486 | "Connected\n" |
| 8487 | "Kernel routes\n" |
| 8488 | "Open Shurtest Path First (OSPFv3)\n" |
| 8489 | "Routing Information Protocol (RIPng)\n" |
| 8490 | "Static routes\n" |
| 8491 | "Metric for redistributed routes\n" |
| 8492 | "Default metric\n" |
| 8493 | "Route map reference\n" |
| 8494 | "Pointer to route-map entries\n") |
| 8495 | #endif /* HAVE_IPV6 */ |
| 8496 | |
| 8497 | int |
| 8498 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 8499 | safi_t safi, int *write) |
| 8500 | { |
| 8501 | int i; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8502 | const char *str[] = { "system", "kernel", "connected", "static", "rip", |
hasso | 66e3169 | 2004-03-20 19:33:06 +0000 | [diff] [blame] | 8503 | "ripng", "ospf", "ospf6", "isis", "bgp"}; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8504 | |
| 8505 | /* Unicast redistribution only. */ |
| 8506 | if (safi != SAFI_UNICAST) |
| 8507 | return 0; |
| 8508 | |
| 8509 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 8510 | { |
| 8511 | /* Redistribute BGP does not make sense. */ |
| 8512 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) |
| 8513 | { |
| 8514 | /* Display "address-family" when it is not yet diplayed. */ |
| 8515 | bgp_config_write_family_header (vty, afi, safi, write); |
| 8516 | |
| 8517 | /* "redistribute" configuration. */ |
| 8518 | vty_out (vty, " redistribute %s", str[i]); |
| 8519 | |
| 8520 | if (bgp->redist_metric_flag[afi][i]) |
| 8521 | vty_out (vty, " metric %d", bgp->redist_metric[afi][i]); |
| 8522 | |
| 8523 | if (bgp->rmap[afi][i].name) |
| 8524 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); |
| 8525 | |
| 8526 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8527 | } |
| 8528 | } |
| 8529 | return *write; |
| 8530 | } |
| 8531 | |
| 8532 | /* BGP node structure. */ |
| 8533 | struct cmd_node bgp_node = |
| 8534 | { |
| 8535 | BGP_NODE, |
| 8536 | "%s(config-router)# ", |
| 8537 | 1, |
| 8538 | }; |
| 8539 | |
| 8540 | struct cmd_node bgp_ipv4_unicast_node = |
| 8541 | { |
| 8542 | BGP_IPV4_NODE, |
| 8543 | "%s(config-router-af)# ", |
| 8544 | 1, |
| 8545 | }; |
| 8546 | |
| 8547 | struct cmd_node bgp_ipv4_multicast_node = |
| 8548 | { |
| 8549 | BGP_IPV4M_NODE, |
| 8550 | "%s(config-router-af)# ", |
| 8551 | 1, |
| 8552 | }; |
| 8553 | |
| 8554 | struct cmd_node bgp_ipv6_unicast_node = |
| 8555 | { |
| 8556 | BGP_IPV6_NODE, |
| 8557 | "%s(config-router-af)# ", |
| 8558 | 1, |
| 8559 | }; |
| 8560 | |
| 8561 | struct cmd_node bgp_vpnv4_node = |
| 8562 | { |
| 8563 | BGP_VPNV4_NODE, |
| 8564 | "%s(config-router-af)# ", |
| 8565 | 1 |
| 8566 | }; |
| 8567 | |
| 8568 | void |
| 8569 | bgp_vty_init () |
| 8570 | { |
| 8571 | int bgp_config_write (struct vty *); |
| 8572 | void community_list_vty (); |
| 8573 | |
| 8574 | /* Install bgp top node. */ |
| 8575 | install_node (&bgp_node, bgp_config_write); |
| 8576 | install_node (&bgp_ipv4_unicast_node, NULL); |
| 8577 | install_node (&bgp_ipv4_multicast_node, NULL); |
| 8578 | install_node (&bgp_ipv6_unicast_node, NULL); |
| 8579 | install_node (&bgp_vpnv4_node, NULL); |
| 8580 | |
| 8581 | /* Install default VTY commands to new nodes. */ |
| 8582 | install_default (BGP_NODE); |
| 8583 | install_default (BGP_IPV4_NODE); |
| 8584 | install_default (BGP_IPV4M_NODE); |
| 8585 | install_default (BGP_IPV6_NODE); |
| 8586 | install_default (BGP_VPNV4_NODE); |
| 8587 | |
| 8588 | /* "bgp multiple-instance" commands. */ |
| 8589 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); |
| 8590 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); |
| 8591 | |
| 8592 | /* "bgp config-type" commands. */ |
| 8593 | install_element (CONFIG_NODE, &bgp_config_type_cmd); |
| 8594 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); |
| 8595 | |
| 8596 | /* Dummy commands (Currently not supported) */ |
| 8597 | install_element (BGP_NODE, &no_synchronization_cmd); |
| 8598 | install_element (BGP_NODE, &no_auto_summary_cmd); |
| 8599 | |
| 8600 | /* "router bgp" commands. */ |
| 8601 | install_element (CONFIG_NODE, &router_bgp_cmd); |
| 8602 | install_element (CONFIG_NODE, &router_bgp_view_cmd); |
| 8603 | |
| 8604 | /* "no router bgp" commands. */ |
| 8605 | install_element (CONFIG_NODE, &no_router_bgp_cmd); |
| 8606 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); |
| 8607 | |
| 8608 | /* "bgp router-id" commands. */ |
| 8609 | install_element (BGP_NODE, &bgp_router_id_cmd); |
| 8610 | install_element (BGP_NODE, &no_bgp_router_id_cmd); |
| 8611 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); |
| 8612 | |
| 8613 | /* "bgp cluster-id" commands. */ |
| 8614 | install_element (BGP_NODE, &bgp_cluster_id_cmd); |
| 8615 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); |
| 8616 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); |
| 8617 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); |
| 8618 | |
| 8619 | /* "bgp confederation" commands. */ |
| 8620 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); |
| 8621 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); |
| 8622 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); |
| 8623 | |
| 8624 | /* "bgp confederation peers" commands. */ |
| 8625 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); |
| 8626 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); |
| 8627 | |
| 8628 | /* "timers bgp" commands. */ |
| 8629 | install_element (BGP_NODE, &bgp_timers_cmd); |
| 8630 | install_element (BGP_NODE, &no_bgp_timers_cmd); |
| 8631 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); |
| 8632 | |
| 8633 | /* "bgp client-to-client reflection" commands */ |
| 8634 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); |
| 8635 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); |
| 8636 | |
| 8637 | /* "bgp always-compare-med" commands */ |
| 8638 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); |
| 8639 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); |
| 8640 | |
| 8641 | /* "bgp deterministic-med" commands */ |
| 8642 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); |
| 8643 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 8644 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 8645 | /* "bgp graceful-restart" commands */ |
| 8646 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); |
| 8647 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 8648 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
| 8649 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); |
| 8650 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8651 | |
| 8652 | /* "bgp fast-external-failover" commands */ |
| 8653 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); |
| 8654 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); |
| 8655 | |
| 8656 | /* "bgp enforce-first-as" commands */ |
| 8657 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); |
| 8658 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); |
| 8659 | |
| 8660 | /* "bgp bestpath compare-routerid" commands */ |
| 8661 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); |
| 8662 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); |
| 8663 | |
| 8664 | /* "bgp bestpath as-path ignore" commands */ |
| 8665 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); |
| 8666 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); |
| 8667 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 8668 | /* "bgp bestpath as-path confed" commands */ |
| 8669 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); |
| 8670 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); |
| 8671 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 8672 | /* "bgp log-neighbor-changes" commands */ |
| 8673 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); |
| 8674 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); |
| 8675 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8676 | /* "bgp bestpath med" commands */ |
| 8677 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); |
| 8678 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); |
| 8679 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); |
| 8680 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); |
| 8681 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); |
| 8682 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); |
| 8683 | |
| 8684 | /* "no bgp default ipv4-unicast" commands. */ |
| 8685 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); |
| 8686 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); |
| 8687 | |
| 8688 | /* "bgp network import-check" commands. */ |
| 8689 | install_element (BGP_NODE, &bgp_network_import_check_cmd); |
| 8690 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
| 8691 | |
| 8692 | /* "bgp default local-preference" commands. */ |
| 8693 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); |
| 8694 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); |
| 8695 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); |
| 8696 | |
| 8697 | /* "neighbor remote-as" commands. */ |
| 8698 | install_element (BGP_NODE, &neighbor_remote_as_cmd); |
| 8699 | install_element (BGP_NODE, &no_neighbor_cmd); |
| 8700 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); |
| 8701 | |
| 8702 | /* "neighbor peer-group" commands. */ |
| 8703 | install_element (BGP_NODE, &neighbor_peer_group_cmd); |
| 8704 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); |
| 8705 | install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd); |
| 8706 | |
| 8707 | /* "neighbor local-as" commands. */ |
| 8708 | install_element (BGP_NODE, &neighbor_local_as_cmd); |
| 8709 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); |
| 8710 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
| 8711 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); |
| 8712 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); |
| 8713 | |
| 8714 | /* "neighbor activate" commands. */ |
| 8715 | install_element (BGP_NODE, &neighbor_activate_cmd); |
| 8716 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); |
| 8717 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); |
| 8718 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); |
| 8719 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
| 8720 | |
| 8721 | /* "no neighbor activate" commands. */ |
| 8722 | install_element (BGP_NODE, &no_neighbor_activate_cmd); |
| 8723 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); |
| 8724 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); |
| 8725 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); |
| 8726 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
| 8727 | |
| 8728 | /* "neighbor peer-group set" commands. */ |
| 8729 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
| 8730 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); |
| 8731 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); |
| 8732 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 8733 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
| 8734 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8735 | /* "no neighbor peer-group unset" commands. */ |
| 8736 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); |
| 8737 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 8738 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); |
| 8739 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 8740 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 8741 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8742 | /* "neighbor softreconfiguration inbound" commands.*/ |
| 8743 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8744 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 8745 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8746 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 8747 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8748 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 8749 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8750 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 8751 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8752 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8753 | |
| 8754 | /* "neighbor attribute-unchanged" commands. */ |
| 8755 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); |
| 8756 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); |
| 8757 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); |
| 8758 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); |
| 8759 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); |
| 8760 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); |
| 8761 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); |
| 8762 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); |
| 8763 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); |
| 8764 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); |
| 8765 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); |
| 8766 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8767 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8768 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8769 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8770 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8771 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8772 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8773 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8774 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8775 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8776 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 8777 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); |
| 8778 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 8779 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 8780 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 8781 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 8782 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 8783 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 8784 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 8785 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 8786 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 8787 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 8788 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8789 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8790 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8791 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8792 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8793 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8794 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8795 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8796 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8797 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8798 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 8799 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); |
| 8800 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); |
| 8801 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); |
| 8802 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); |
| 8803 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); |
| 8804 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); |
| 8805 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); |
| 8806 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); |
| 8807 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); |
| 8808 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); |
| 8809 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); |
| 8810 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8811 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8812 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8813 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8814 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8815 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8816 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8817 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8818 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8819 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8820 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 8821 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); |
| 8822 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); |
| 8823 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); |
| 8824 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); |
| 8825 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); |
| 8826 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); |
| 8827 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); |
| 8828 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); |
| 8829 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); |
| 8830 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); |
| 8831 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); |
| 8832 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8833 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8834 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8835 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8836 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8837 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8838 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8839 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8840 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8841 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8842 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 8843 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
| 8844 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 8845 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 8846 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 8847 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 8848 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 8849 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 8850 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 8851 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 8852 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 8853 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 8854 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8855 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8856 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8857 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8858 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8859 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8860 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8861 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8862 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8863 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8864 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 8865 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8866 | /* "nexthop-local unchanged" commands */ |
| 8867 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); |
| 8868 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); |
| 8869 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8870 | /* "transparent-as" and "transparent-nexthop" for old version |
| 8871 | compatibility. */ |
| 8872 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); |
| 8873 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); |
| 8874 | |
| 8875 | /* "neighbor next-hop-self" commands. */ |
| 8876 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); |
| 8877 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); |
| 8878 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); |
| 8879 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 8880 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); |
| 8881 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); |
| 8882 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); |
| 8883 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); |
| 8884 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
| 8885 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 8886 | |
| 8887 | /* "neighbor remove-private-AS" commands. */ |
| 8888 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); |
| 8889 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); |
| 8890 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
| 8891 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 8892 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
| 8893 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); |
| 8894 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
| 8895 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); |
| 8896 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
| 8897 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 8898 | |
| 8899 | /* "neighbor send-community" commands.*/ |
| 8900 | install_element (BGP_NODE, &neighbor_send_community_cmd); |
| 8901 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); |
| 8902 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); |
| 8903 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); |
| 8904 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); |
| 8905 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); |
| 8906 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); |
| 8907 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); |
| 8908 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); |
| 8909 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); |
| 8910 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); |
| 8911 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); |
| 8912 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); |
| 8913 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); |
| 8914 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); |
| 8915 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); |
| 8916 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
| 8917 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); |
| 8918 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); |
| 8919 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); |
| 8920 | |
| 8921 | /* "neighbor route-reflector" commands.*/ |
| 8922 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); |
| 8923 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8924 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); |
| 8925 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8926 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); |
| 8927 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8928 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); |
| 8929 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8930 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
| 8931 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8932 | |
| 8933 | /* "neighbor route-server" commands.*/ |
| 8934 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); |
| 8935 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); |
| 8936 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); |
| 8937 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); |
| 8938 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); |
| 8939 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); |
| 8940 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); |
| 8941 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); |
| 8942 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
| 8943 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); |
| 8944 | |
| 8945 | /* "neighbor passive" commands. */ |
| 8946 | install_element (BGP_NODE, &neighbor_passive_cmd); |
| 8947 | install_element (BGP_NODE, &no_neighbor_passive_cmd); |
| 8948 | |
| 8949 | /* "neighbor shutdown" commands. */ |
| 8950 | install_element (BGP_NODE, &neighbor_shutdown_cmd); |
| 8951 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); |
| 8952 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 8953 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8954 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
| 8955 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); |
| 8956 | |
| 8957 | /* "neighbor capability orf prefix-list" commands.*/ |
| 8958 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); |
| 8959 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 8960 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); |
| 8961 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 8962 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 8963 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 8964 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); |
| 8965 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 8966 | |
| 8967 | /* "neighbor capability dynamic" commands.*/ |
| 8968 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); |
| 8969 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); |
| 8970 | |
| 8971 | /* "neighbor dont-capability-negotiate" commands. */ |
| 8972 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); |
| 8973 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); |
| 8974 | |
| 8975 | /* "neighbor ebgp-multihop" commands. */ |
| 8976 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); |
| 8977 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); |
| 8978 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); |
| 8979 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); |
| 8980 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 8981 | /* "neighbor disable-connected-check" commands. */ |
| 8982 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); |
| 8983 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8984 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
| 8985 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); |
| 8986 | |
| 8987 | /* "neighbor description" commands. */ |
| 8988 | install_element (BGP_NODE, &neighbor_description_cmd); |
| 8989 | install_element (BGP_NODE, &no_neighbor_description_cmd); |
| 8990 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); |
| 8991 | |
| 8992 | /* "neighbor update-source" commands. "*/ |
| 8993 | install_element (BGP_NODE, &neighbor_update_source_cmd); |
| 8994 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); |
| 8995 | |
| 8996 | /* "neighbor default-originate" commands. */ |
| 8997 | install_element (BGP_NODE, &neighbor_default_originate_cmd); |
| 8998 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); |
| 8999 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); |
| 9000 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9001 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); |
| 9002 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); |
| 9003 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); |
| 9004 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9005 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); |
| 9006 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9007 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); |
| 9008 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9009 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); |
| 9010 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); |
| 9011 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); |
| 9012 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9013 | |
| 9014 | /* "neighbor port" commands. */ |
| 9015 | install_element (BGP_NODE, &neighbor_port_cmd); |
| 9016 | install_element (BGP_NODE, &no_neighbor_port_cmd); |
| 9017 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); |
| 9018 | |
| 9019 | /* "neighbor weight" commands. */ |
| 9020 | install_element (BGP_NODE, &neighbor_weight_cmd); |
| 9021 | install_element (BGP_NODE, &no_neighbor_weight_cmd); |
| 9022 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); |
| 9023 | |
| 9024 | /* "neighbor override-capability" commands. */ |
| 9025 | install_element (BGP_NODE, &neighbor_override_capability_cmd); |
| 9026 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); |
| 9027 | |
| 9028 | /* "neighbor strict-capability-match" commands. */ |
| 9029 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); |
| 9030 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); |
| 9031 | |
| 9032 | /* "neighbor timers" commands. */ |
| 9033 | install_element (BGP_NODE, &neighbor_timers_cmd); |
| 9034 | install_element (BGP_NODE, &no_neighbor_timers_cmd); |
| 9035 | |
| 9036 | /* "neighbor timers connect" commands. */ |
| 9037 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); |
| 9038 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); |
| 9039 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); |
| 9040 | |
| 9041 | /* "neighbor advertisement-interval" commands. */ |
| 9042 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); |
| 9043 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); |
| 9044 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); |
| 9045 | |
| 9046 | /* "neighbor version" commands. */ |
| 9047 | install_element (BGP_NODE, &neighbor_version_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9048 | |
| 9049 | /* "neighbor interface" commands. */ |
| 9050 | install_element (BGP_NODE, &neighbor_interface_cmd); |
| 9051 | install_element (BGP_NODE, &no_neighbor_interface_cmd); |
| 9052 | |
| 9053 | /* "neighbor distribute" commands. */ |
| 9054 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); |
| 9055 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); |
| 9056 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); |
| 9057 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9058 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); |
| 9059 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); |
| 9060 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); |
| 9061 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); |
| 9062 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
| 9063 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9064 | |
| 9065 | /* "neighbor prefix-list" commands. */ |
| 9066 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); |
| 9067 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); |
| 9068 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); |
| 9069 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9070 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); |
| 9071 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); |
| 9072 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); |
| 9073 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); |
| 9074 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
| 9075 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9076 | |
| 9077 | /* "neighbor filter-list" commands. */ |
| 9078 | install_element (BGP_NODE, &neighbor_filter_list_cmd); |
| 9079 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); |
| 9080 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); |
| 9081 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); |
| 9082 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); |
| 9083 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); |
| 9084 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); |
| 9085 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); |
| 9086 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
| 9087 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); |
| 9088 | |
| 9089 | /* "neighbor route-map" commands. */ |
| 9090 | install_element (BGP_NODE, &neighbor_route_map_cmd); |
| 9091 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); |
| 9092 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); |
| 9093 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); |
| 9094 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); |
| 9095 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); |
| 9096 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); |
| 9097 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); |
| 9098 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
| 9099 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); |
| 9100 | |
| 9101 | /* "neighbor unsuppress-map" commands. */ |
| 9102 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); |
| 9103 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9104 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9105 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9106 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); |
| 9107 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9108 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); |
| 9109 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9110 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9111 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9112 | |
| 9113 | /* "neighbor maximum-prefix" commands. */ |
| 9114 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9115 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9116 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9117 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9118 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9119 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9120 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9121 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9122 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9123 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9124 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9125 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9126 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9127 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9128 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9129 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9130 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9131 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9132 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9133 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9134 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9135 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9136 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9137 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9138 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9139 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9140 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9141 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9142 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9143 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9144 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9145 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9146 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9147 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9148 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9149 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9150 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9151 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9152 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9153 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9154 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9155 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9156 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9157 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9158 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9159 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9160 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9161 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9162 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9163 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9164 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9165 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9166 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9167 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9168 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9169 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9170 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9171 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9172 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9173 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9174 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9175 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9176 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9177 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9178 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9179 | |
| 9180 | /* "neighbor allowas-in" */ |
| 9181 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); |
| 9182 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); |
| 9183 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); |
| 9184 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
| 9185 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9186 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9187 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
| 9188 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9189 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); |
| 9190 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
| 9191 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); |
| 9192 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); |
| 9193 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
| 9194 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9195 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9196 | |
| 9197 | /* address-family commands. */ |
| 9198 | install_element (BGP_NODE, &address_family_ipv4_cmd); |
| 9199 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); |
| 9200 | #ifdef HAVE_IPV6 |
| 9201 | install_element (BGP_NODE, &address_family_ipv6_cmd); |
| 9202 | install_element (BGP_NODE, &address_family_ipv6_unicast_cmd); |
| 9203 | #endif /* HAVE_IPV6 */ |
| 9204 | install_element (BGP_NODE, &address_family_vpnv4_cmd); |
| 9205 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); |
| 9206 | |
| 9207 | /* "exit-address-family" command. */ |
| 9208 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); |
| 9209 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); |
| 9210 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); |
| 9211 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
| 9212 | |
| 9213 | /* "clear ip bgp commands" */ |
| 9214 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); |
| 9215 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); |
| 9216 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); |
| 9217 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
| 9218 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
| 9219 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
| 9220 | #ifdef HAVE_IPV6 |
| 9221 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
| 9222 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); |
| 9223 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); |
| 9224 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
| 9225 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
| 9226 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
| 9227 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
| 9228 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
| 9229 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
| 9230 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
| 9231 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
| 9232 | #endif /* HAVE_IPV6 */ |
| 9233 | |
| 9234 | /* "clear ip bgp neighbor soft in" */ |
| 9235 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); |
| 9236 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); |
| 9237 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); |
| 9238 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
| 9239 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); |
| 9240 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
| 9241 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
| 9242 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
| 9243 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); |
| 9244 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
| 9245 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
| 9246 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); |
| 9247 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
| 9248 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
| 9249 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); |
| 9250 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
| 9251 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
| 9252 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); |
| 9253 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); |
| 9254 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); |
| 9255 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
| 9256 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); |
| 9257 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
| 9258 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
| 9259 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
| 9260 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); |
| 9261 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
| 9262 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
| 9263 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); |
| 9264 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
| 9265 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
| 9266 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); |
| 9267 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
| 9268 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
| 9269 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); |
| 9270 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); |
| 9271 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); |
| 9272 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); |
| 9273 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); |
| 9274 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); |
| 9275 | #ifdef HAVE_IPV6 |
| 9276 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
| 9277 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); |
| 9278 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); |
| 9279 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
| 9280 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); |
| 9281 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
| 9282 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
| 9283 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); |
| 9284 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
| 9285 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
| 9286 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); |
| 9287 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
| 9288 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
| 9289 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); |
| 9290 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
| 9291 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
| 9292 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); |
| 9293 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
| 9294 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
| 9295 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); |
| 9296 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
| 9297 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
| 9298 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); |
| 9299 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
| 9300 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
| 9301 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); |
| 9302 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
| 9303 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
| 9304 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); |
| 9305 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
| 9306 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
| 9307 | #endif /* HAVE_IPV6 */ |
| 9308 | |
| 9309 | /* "clear ip bgp neighbor soft out" */ |
| 9310 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); |
| 9311 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); |
| 9312 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); |
| 9313 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
| 9314 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
| 9315 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
| 9316 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
| 9317 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
| 9318 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
| 9319 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
| 9320 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
| 9321 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
| 9322 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); |
| 9323 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); |
| 9324 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
| 9325 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
| 9326 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
| 9327 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
| 9328 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
| 9329 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
| 9330 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
| 9331 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
| 9332 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
| 9333 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); |
| 9334 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); |
| 9335 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); |
| 9336 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); |
| 9337 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); |
| 9338 | #ifdef HAVE_IPV6 |
| 9339 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
| 9340 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); |
| 9341 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); |
| 9342 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
| 9343 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
| 9344 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
| 9345 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
| 9346 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
| 9347 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
| 9348 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
| 9349 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
| 9350 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
| 9351 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
| 9352 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
| 9353 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
| 9354 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
| 9355 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
| 9356 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
| 9357 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
| 9358 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
| 9359 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
| 9360 | #endif /* HAVE_IPV6 */ |
| 9361 | |
| 9362 | /* "clear ip bgp neighbor soft" */ |
| 9363 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); |
| 9364 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); |
| 9365 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); |
| 9366 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
| 9367 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
| 9368 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
| 9369 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
| 9370 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); |
| 9371 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); |
| 9372 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
| 9373 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
| 9374 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
| 9375 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
| 9376 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); |
| 9377 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); |
| 9378 | #ifdef HAVE_IPV6 |
| 9379 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
| 9380 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); |
| 9381 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); |
| 9382 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
| 9383 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
| 9384 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
| 9385 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
| 9386 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
| 9387 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
| 9388 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
| 9389 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
| 9390 | #endif /* HAVE_IPV6 */ |
| 9391 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9392 | /* "clear ip bgp neighbor rsclient" */ |
| 9393 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); |
| 9394 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); |
| 9395 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); |
| 9396 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); |
| 9397 | #ifdef HAVE_IPV6 |
| 9398 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); |
| 9399 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); |
| 9400 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); |
| 9401 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); |
| 9402 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); |
| 9403 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); |
| 9404 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); |
| 9405 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); |
| 9406 | #endif /* HAVE_IPV6 */ |
| 9407 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9408 | /* "show ip bgp summary" commands. */ |
| 9409 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); |
| 9410 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9411 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
| 9412 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
| 9413 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9414 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9415 | #ifdef HAVE_IPV6 |
| 9416 | install_element (VIEW_NODE, &show_bgp_summary_cmd); |
| 9417 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); |
| 9418 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
| 9419 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
| 9420 | #endif /* HAVE_IPV6 */ |
| 9421 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); |
| 9422 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9423 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
| 9424 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
| 9425 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9426 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9427 | #ifdef HAVE_IPV6 |
| 9428 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); |
| 9429 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); |
| 9430 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
| 9431 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
| 9432 | #endif /* HAVE_IPV6 */ |
| 9433 | |
| 9434 | /* "show ip bgp neighbors" commands. */ |
| 9435 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); |
| 9436 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 9437 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 9438 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 9439 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 9440 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 9441 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 9442 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 9443 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 9444 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 9445 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
| 9446 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 9447 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 9448 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 9449 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 9450 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 9451 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 9452 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 9453 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 9454 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 9455 | |
| 9456 | #ifdef HAVE_IPV6 |
| 9457 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); |
| 9458 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 9459 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); |
| 9460 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 9461 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
| 9462 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 9463 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 9464 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9465 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
| 9466 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 9467 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); |
| 9468 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 9469 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
| 9470 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 9471 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 9472 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9473 | |
| 9474 | /* Old commands. */ |
| 9475 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); |
| 9476 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); |
| 9477 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); |
| 9478 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); |
| 9479 | #endif /* HAVE_IPV6 */ |
| 9480 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9481 | /* "show ip bgp rsclient" commands. */ |
| 9482 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 9483 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 9484 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 9485 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
| 9486 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 9487 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 9488 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 9489 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
| 9490 | |
| 9491 | #ifdef HAVE_IPV6 |
| 9492 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); |
| 9493 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 9494 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 9495 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
| 9496 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
| 9497 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 9498 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 9499 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
| 9500 | #endif /* HAVE_IPV6 */ |
| 9501 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9502 | /* "show ip bgp paths" commands. */ |
| 9503 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); |
| 9504 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 9505 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); |
| 9506 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 9507 | |
| 9508 | /* "show ip bgp community" commands. */ |
| 9509 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); |
| 9510 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); |
| 9511 | |
| 9512 | /* "show ip bgp attribute-info" commands. */ |
| 9513 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); |
| 9514 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); |
| 9515 | |
| 9516 | /* "redistribute" commands. */ |
| 9517 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); |
| 9518 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); |
| 9519 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); |
| 9520 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); |
| 9521 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); |
| 9522 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); |
| 9523 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); |
| 9524 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); |
| 9525 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); |
| 9526 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); |
| 9527 | #ifdef HAVE_IPV6 |
| 9528 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); |
| 9529 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); |
| 9530 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); |
| 9531 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); |
| 9532 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); |
| 9533 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); |
| 9534 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); |
| 9535 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); |
| 9536 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); |
| 9537 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); |
| 9538 | #endif /* HAVE_IPV6 */ |
| 9539 | |
| 9540 | /* Community-list. */ |
| 9541 | community_list_vty (); |
| 9542 | } |
| 9543 | |
| 9544 | #include "memory.h" |
| 9545 | #include "bgp_regex.h" |
| 9546 | #include "bgp_clist.h" |
| 9547 | #include "bgp_ecommunity.h" |
| 9548 | |
| 9549 | /* VTY functions. */ |
| 9550 | |
| 9551 | /* Direction value to string conversion. */ |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 9552 | const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9553 | community_direct_str (int direct) |
| 9554 | { |
| 9555 | switch (direct) |
| 9556 | { |
| 9557 | case COMMUNITY_DENY: |
| 9558 | return "deny"; |
| 9559 | break; |
| 9560 | case COMMUNITY_PERMIT: |
| 9561 | return "permit"; |
| 9562 | break; |
| 9563 | default: |
| 9564 | return "unknown"; |
| 9565 | break; |
| 9566 | } |
| 9567 | } |
| 9568 | |
| 9569 | /* Display error string. */ |
| 9570 | void |
| 9571 | community_list_perror (struct vty *vty, int ret) |
| 9572 | { |
| 9573 | switch (ret) |
| 9574 | { |
| 9575 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: |
| 9576 | vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE); |
| 9577 | break; |
| 9578 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: |
| 9579 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); |
| 9580 | break; |
| 9581 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: |
| 9582 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); |
| 9583 | break; |
| 9584 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: |
| 9585 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); |
| 9586 | break; |
| 9587 | } |
| 9588 | } |
| 9589 | |
| 9590 | /* VTY interface for community_set() function. */ |
| 9591 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 9592 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 9593 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9594 | { |
| 9595 | int ret; |
| 9596 | int direct; |
| 9597 | char *str; |
| 9598 | |
| 9599 | /* Check the list type. */ |
| 9600 | if (strncmp (argv[1], "p", 1) == 0) |
| 9601 | direct = COMMUNITY_PERMIT; |
| 9602 | else if (strncmp (argv[1], "d", 1) == 0) |
| 9603 | direct = COMMUNITY_DENY; |
| 9604 | else |
| 9605 | { |
| 9606 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 9607 | VTY_NEWLINE); |
| 9608 | return CMD_WARNING; |
| 9609 | } |
| 9610 | |
| 9611 | /* All digit name check. */ |
| 9612 | if (reject_all_digit_name && all_digit (argv[0])) |
| 9613 | { |
| 9614 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 9615 | return CMD_WARNING; |
| 9616 | } |
| 9617 | |
| 9618 | /* Concat community string argument. */ |
| 9619 | if (argc > 1) |
| 9620 | str = argv_concat (argv, argc, 2); |
| 9621 | else |
| 9622 | str = NULL; |
| 9623 | |
| 9624 | /* When community_list_set() return nevetive value, it means |
| 9625 | malformed community string. */ |
| 9626 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); |
| 9627 | |
| 9628 | /* Free temporary community list string allocated by |
| 9629 | argv_concat(). */ |
| 9630 | if (str) |
| 9631 | XFREE (MTYPE_TMP, str); |
| 9632 | |
| 9633 | if (ret < 0) |
| 9634 | { |
| 9635 | /* Display error string. */ |
| 9636 | community_list_perror (vty, ret); |
| 9637 | return CMD_WARNING; |
| 9638 | } |
| 9639 | |
| 9640 | return CMD_SUCCESS; |
| 9641 | } |
| 9642 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9643 | /* Communiyt-list entry delete. */ |
| 9644 | int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9645 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 9646 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9647 | { |
| 9648 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9649 | int direct = 0; |
| 9650 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9651 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9652 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9653 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9654 | /* Check the list direct. */ |
| 9655 | if (strncmp (argv[1], "p", 1) == 0) |
| 9656 | direct = COMMUNITY_PERMIT; |
| 9657 | else if (strncmp (argv[1], "d", 1) == 0) |
| 9658 | direct = COMMUNITY_DENY; |
| 9659 | else |
| 9660 | { |
| 9661 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 9662 | VTY_NEWLINE); |
| 9663 | return CMD_WARNING; |
| 9664 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9665 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9666 | /* Concat community string argument. */ |
| 9667 | str = argv_concat (argv, argc, 2); |
| 9668 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9669 | |
| 9670 | /* Unset community list. */ |
| 9671 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); |
| 9672 | |
| 9673 | /* Free temporary community list string allocated by |
| 9674 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9675 | if (str) |
| 9676 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9677 | |
| 9678 | if (ret < 0) |
| 9679 | { |
| 9680 | community_list_perror (vty, ret); |
| 9681 | return CMD_WARNING; |
| 9682 | } |
| 9683 | |
| 9684 | return CMD_SUCCESS; |
| 9685 | } |
| 9686 | |
| 9687 | /* "community-list" keyword help string. */ |
| 9688 | #define COMMUNITY_LIST_STR "Add a community list entry\n" |
| 9689 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" |
| 9690 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9691 | DEFUN (ip_community_list_standard, |
| 9692 | ip_community_list_standard_cmd, |
| 9693 | "ip community-list <1-99> (deny|permit) .AA:NN", |
| 9694 | IP_STR |
| 9695 | COMMUNITY_LIST_STR |
| 9696 | "Community list number (standard)\n" |
| 9697 | "Specify community to reject\n" |
| 9698 | "Specify community to accept\n" |
| 9699 | COMMUNITY_VAL_STR) |
| 9700 | { |
| 9701 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
| 9702 | } |
| 9703 | |
| 9704 | ALIAS (ip_community_list_standard, |
| 9705 | ip_community_list_standard2_cmd, |
| 9706 | "ip community-list <1-99> (deny|permit)", |
| 9707 | IP_STR |
| 9708 | COMMUNITY_LIST_STR |
| 9709 | "Community list number (standard)\n" |
| 9710 | "Specify community to reject\n" |
| 9711 | "Specify community to accept\n") |
| 9712 | |
| 9713 | DEFUN (ip_community_list_expanded, |
| 9714 | ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9715 | "ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9716 | IP_STR |
| 9717 | COMMUNITY_LIST_STR |
| 9718 | "Community list number (expanded)\n" |
| 9719 | "Specify community to reject\n" |
| 9720 | "Specify community to accept\n" |
| 9721 | "An ordered list as a regular-expression\n") |
| 9722 | { |
| 9723 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
| 9724 | } |
| 9725 | |
| 9726 | DEFUN (ip_community_list_name_standard, |
| 9727 | ip_community_list_name_standard_cmd, |
| 9728 | "ip community-list standard WORD (deny|permit) .AA:NN", |
| 9729 | IP_STR |
| 9730 | COMMUNITY_LIST_STR |
| 9731 | "Add a standard community-list entry\n" |
| 9732 | "Community list name\n" |
| 9733 | "Specify community to reject\n" |
| 9734 | "Specify community to accept\n" |
| 9735 | COMMUNITY_VAL_STR) |
| 9736 | { |
| 9737 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
| 9738 | } |
| 9739 | |
| 9740 | ALIAS (ip_community_list_name_standard, |
| 9741 | ip_community_list_name_standard2_cmd, |
| 9742 | "ip community-list standard WORD (deny|permit)", |
| 9743 | IP_STR |
| 9744 | COMMUNITY_LIST_STR |
| 9745 | "Add a standard community-list entry\n" |
| 9746 | "Community list name\n" |
| 9747 | "Specify community to reject\n" |
| 9748 | "Specify community to accept\n") |
| 9749 | |
| 9750 | DEFUN (ip_community_list_name_expanded, |
| 9751 | ip_community_list_name_expanded_cmd, |
| 9752 | "ip community-list expanded WORD (deny|permit) .LINE", |
| 9753 | IP_STR |
| 9754 | COMMUNITY_LIST_STR |
| 9755 | "Add an expanded community-list entry\n" |
| 9756 | "Community list name\n" |
| 9757 | "Specify community to reject\n" |
| 9758 | "Specify community to accept\n" |
| 9759 | "An ordered list as a regular-expression\n") |
| 9760 | { |
| 9761 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
| 9762 | } |
| 9763 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9764 | DEFUN (no_ip_community_list_standard_all, |
| 9765 | no_ip_community_list_standard_all_cmd, |
| 9766 | "no ip community-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9767 | NO_STR |
| 9768 | IP_STR |
| 9769 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9770 | "Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9771 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9772 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9773 | } |
| 9774 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9775 | DEFUN (no_ip_community_list_expanded_all, |
| 9776 | no_ip_community_list_expanded_all_cmd, |
| 9777 | "no ip community-list <100-500>", |
| 9778 | NO_STR |
| 9779 | IP_STR |
| 9780 | COMMUNITY_LIST_STR |
| 9781 | "Community list number (expanded)\n") |
| 9782 | { |
| 9783 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 9784 | } |
| 9785 | |
| 9786 | DEFUN (no_ip_community_list_name_standard_all, |
| 9787 | no_ip_community_list_name_standard_all_cmd, |
| 9788 | "no ip community-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9789 | NO_STR |
| 9790 | IP_STR |
| 9791 | COMMUNITY_LIST_STR |
| 9792 | "Add a standard community-list entry\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9793 | "Community list name\n") |
| 9794 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9795 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9796 | } |
| 9797 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9798 | DEFUN (no_ip_community_list_name_expanded_all, |
| 9799 | no_ip_community_list_name_expanded_all_cmd, |
| 9800 | "no ip community-list expanded WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9801 | NO_STR |
| 9802 | IP_STR |
| 9803 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9804 | "Add an expanded community-list entry\n" |
| 9805 | "Community list name\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9806 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9807 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9808 | } |
| 9809 | |
| 9810 | DEFUN (no_ip_community_list_standard, |
| 9811 | no_ip_community_list_standard_cmd, |
| 9812 | "no ip community-list <1-99> (deny|permit) .AA:NN", |
| 9813 | NO_STR |
| 9814 | IP_STR |
| 9815 | COMMUNITY_LIST_STR |
| 9816 | "Community list number (standard)\n" |
| 9817 | "Specify community to reject\n" |
| 9818 | "Specify community to accept\n" |
| 9819 | COMMUNITY_VAL_STR) |
| 9820 | { |
| 9821 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 9822 | } |
| 9823 | |
| 9824 | DEFUN (no_ip_community_list_expanded, |
| 9825 | no_ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9826 | "no ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9827 | NO_STR |
| 9828 | IP_STR |
| 9829 | COMMUNITY_LIST_STR |
| 9830 | "Community list number (expanded)\n" |
| 9831 | "Specify community to reject\n" |
| 9832 | "Specify community to accept\n" |
| 9833 | "An ordered list as a regular-expression\n") |
| 9834 | { |
| 9835 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 9836 | } |
| 9837 | |
| 9838 | DEFUN (no_ip_community_list_name_standard, |
| 9839 | no_ip_community_list_name_standard_cmd, |
| 9840 | "no ip community-list standard WORD (deny|permit) .AA:NN", |
| 9841 | NO_STR |
| 9842 | IP_STR |
| 9843 | COMMUNITY_LIST_STR |
| 9844 | "Specify a standard community-list\n" |
| 9845 | "Community list name\n" |
| 9846 | "Specify community to reject\n" |
| 9847 | "Specify community to accept\n" |
| 9848 | COMMUNITY_VAL_STR) |
| 9849 | { |
| 9850 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 9851 | } |
| 9852 | |
| 9853 | DEFUN (no_ip_community_list_name_expanded, |
| 9854 | no_ip_community_list_name_expanded_cmd, |
| 9855 | "no ip community-list expanded WORD (deny|permit) .LINE", |
| 9856 | NO_STR |
| 9857 | IP_STR |
| 9858 | COMMUNITY_LIST_STR |
| 9859 | "Specify an expanded community-list\n" |
| 9860 | "Community list name\n" |
| 9861 | "Specify community to reject\n" |
| 9862 | "Specify community to accept\n" |
| 9863 | "An ordered list as a regular-expression\n") |
| 9864 | { |
| 9865 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 9866 | } |
| 9867 | |
| 9868 | void |
| 9869 | community_list_show (struct vty *vty, struct community_list *list) |
| 9870 | { |
| 9871 | struct community_entry *entry; |
| 9872 | |
| 9873 | for (entry = list->head; entry; entry = entry->next) |
| 9874 | { |
| 9875 | if (entry == list->head) |
| 9876 | { |
| 9877 | if (all_digit (list->name)) |
| 9878 | vty_out (vty, "Community %s list %s%s", |
| 9879 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 9880 | "standard" : "(expanded) access", |
| 9881 | list->name, VTY_NEWLINE); |
| 9882 | else |
| 9883 | vty_out (vty, "Named Community %s list %s%s", |
| 9884 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 9885 | "standard" : "expanded", |
| 9886 | list->name, VTY_NEWLINE); |
| 9887 | } |
| 9888 | if (entry->any) |
| 9889 | vty_out (vty, " %s%s", |
| 9890 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 9891 | else |
| 9892 | vty_out (vty, " %s %s%s", |
| 9893 | community_direct_str (entry->direct), |
| 9894 | entry->style == COMMUNITY_LIST_STANDARD |
| 9895 | ? community_str (entry->u.com) : entry->config, |
| 9896 | VTY_NEWLINE); |
| 9897 | } |
| 9898 | } |
| 9899 | |
| 9900 | DEFUN (show_ip_community_list, |
| 9901 | show_ip_community_list_cmd, |
| 9902 | "show ip community-list", |
| 9903 | SHOW_STR |
| 9904 | IP_STR |
| 9905 | "List community-list\n") |
| 9906 | { |
| 9907 | struct community_list *list; |
| 9908 | struct community_list_master *cm; |
| 9909 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9910 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9911 | if (! cm) |
| 9912 | return CMD_SUCCESS; |
| 9913 | |
| 9914 | for (list = cm->num.head; list; list = list->next) |
| 9915 | community_list_show (vty, list); |
| 9916 | |
| 9917 | for (list = cm->str.head; list; list = list->next) |
| 9918 | community_list_show (vty, list); |
| 9919 | |
| 9920 | return CMD_SUCCESS; |
| 9921 | } |
| 9922 | |
| 9923 | DEFUN (show_ip_community_list_arg, |
| 9924 | show_ip_community_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9925 | "show ip community-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9926 | SHOW_STR |
| 9927 | IP_STR |
| 9928 | "List community-list\n" |
| 9929 | "Community-list number\n" |
| 9930 | "Community-list name\n") |
| 9931 | { |
| 9932 | struct community_list *list; |
| 9933 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9934 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9935 | if (! list) |
| 9936 | { |
| 9937 | vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE); |
| 9938 | return CMD_WARNING; |
| 9939 | } |
| 9940 | |
| 9941 | community_list_show (vty, list); |
| 9942 | |
| 9943 | return CMD_SUCCESS; |
| 9944 | } |
| 9945 | |
| 9946 | int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 9947 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 9948 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9949 | { |
| 9950 | int ret; |
| 9951 | int direct; |
| 9952 | char *str; |
| 9953 | |
| 9954 | /* Check the list type. */ |
| 9955 | if (strncmp (argv[1], "p", 1) == 0) |
| 9956 | direct = COMMUNITY_PERMIT; |
| 9957 | else if (strncmp (argv[1], "d", 1) == 0) |
| 9958 | direct = COMMUNITY_DENY; |
| 9959 | else |
| 9960 | { |
| 9961 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 9962 | VTY_NEWLINE); |
| 9963 | return CMD_WARNING; |
| 9964 | } |
| 9965 | |
| 9966 | /* All digit name check. */ |
| 9967 | if (reject_all_digit_name && all_digit (argv[0])) |
| 9968 | { |
| 9969 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 9970 | return CMD_WARNING; |
| 9971 | } |
| 9972 | |
| 9973 | /* Concat community string argument. */ |
| 9974 | if (argc > 1) |
| 9975 | str = argv_concat (argv, argc, 2); |
| 9976 | else |
| 9977 | str = NULL; |
| 9978 | |
| 9979 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); |
| 9980 | |
| 9981 | /* Free temporary community list string allocated by |
| 9982 | argv_concat(). */ |
| 9983 | if (str) |
| 9984 | XFREE (MTYPE_TMP, str); |
| 9985 | |
| 9986 | if (ret < 0) |
| 9987 | { |
| 9988 | community_list_perror (vty, ret); |
| 9989 | return CMD_WARNING; |
| 9990 | } |
| 9991 | return CMD_SUCCESS; |
| 9992 | } |
| 9993 | |
| 9994 | int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9995 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 9996 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9997 | { |
| 9998 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9999 | int direct = 0; |
| 10000 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10001 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10002 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10003 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10004 | /* Check the list direct. */ |
| 10005 | if (strncmp (argv[1], "p", 1) == 0) |
| 10006 | direct = COMMUNITY_PERMIT; |
| 10007 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10008 | direct = COMMUNITY_DENY; |
| 10009 | else |
| 10010 | { |
| 10011 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10012 | VTY_NEWLINE); |
| 10013 | return CMD_WARNING; |
| 10014 | } |
| 10015 | |
| 10016 | /* Concat community string argument. */ |
| 10017 | str = argv_concat (argv, argc, 2); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10018 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10019 | |
| 10020 | /* Unset community list. */ |
| 10021 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10022 | |
| 10023 | /* Free temporary community list string allocated by |
| 10024 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10025 | if (str) |
| 10026 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10027 | |
| 10028 | if (ret < 0) |
| 10029 | { |
| 10030 | community_list_perror (vty, ret); |
| 10031 | return CMD_WARNING; |
| 10032 | } |
| 10033 | |
| 10034 | return CMD_SUCCESS; |
| 10035 | } |
| 10036 | |
| 10037 | /* "extcommunity-list" keyword help string. */ |
| 10038 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" |
| 10039 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" |
| 10040 | |
| 10041 | DEFUN (ip_extcommunity_list_standard, |
| 10042 | ip_extcommunity_list_standard_cmd, |
| 10043 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10044 | IP_STR |
| 10045 | EXTCOMMUNITY_LIST_STR |
| 10046 | "Extended Community list number (standard)\n" |
| 10047 | "Specify community to reject\n" |
| 10048 | "Specify community to accept\n" |
| 10049 | EXTCOMMUNITY_VAL_STR) |
| 10050 | { |
| 10051 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
| 10052 | } |
| 10053 | |
| 10054 | ALIAS (ip_extcommunity_list_standard, |
| 10055 | ip_extcommunity_list_standard2_cmd, |
| 10056 | "ip extcommunity-list <1-99> (deny|permit)", |
| 10057 | IP_STR |
| 10058 | EXTCOMMUNITY_LIST_STR |
| 10059 | "Extended Community list number (standard)\n" |
| 10060 | "Specify community to reject\n" |
| 10061 | "Specify community to accept\n") |
| 10062 | |
| 10063 | DEFUN (ip_extcommunity_list_expanded, |
| 10064 | ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10065 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10066 | IP_STR |
| 10067 | EXTCOMMUNITY_LIST_STR |
| 10068 | "Extended Community list number (expanded)\n" |
| 10069 | "Specify community to reject\n" |
| 10070 | "Specify community to accept\n" |
| 10071 | "An ordered list as a regular-expression\n") |
| 10072 | { |
| 10073 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
| 10074 | } |
| 10075 | |
| 10076 | DEFUN (ip_extcommunity_list_name_standard, |
| 10077 | ip_extcommunity_list_name_standard_cmd, |
| 10078 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10079 | IP_STR |
| 10080 | EXTCOMMUNITY_LIST_STR |
| 10081 | "Specify standard extcommunity-list\n" |
| 10082 | "Extended Community list name\n" |
| 10083 | "Specify community to reject\n" |
| 10084 | "Specify community to accept\n" |
| 10085 | EXTCOMMUNITY_VAL_STR) |
| 10086 | { |
| 10087 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
| 10088 | } |
| 10089 | |
| 10090 | ALIAS (ip_extcommunity_list_name_standard, |
| 10091 | ip_extcommunity_list_name_standard2_cmd, |
| 10092 | "ip extcommunity-list standard WORD (deny|permit)", |
| 10093 | IP_STR |
| 10094 | EXTCOMMUNITY_LIST_STR |
| 10095 | "Specify standard extcommunity-list\n" |
| 10096 | "Extended Community list name\n" |
| 10097 | "Specify community to reject\n" |
| 10098 | "Specify community to accept\n") |
| 10099 | |
| 10100 | DEFUN (ip_extcommunity_list_name_expanded, |
| 10101 | ip_extcommunity_list_name_expanded_cmd, |
| 10102 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10103 | IP_STR |
| 10104 | EXTCOMMUNITY_LIST_STR |
| 10105 | "Specify expanded extcommunity-list\n" |
| 10106 | "Extended Community list name\n" |
| 10107 | "Specify community to reject\n" |
| 10108 | "Specify community to accept\n" |
| 10109 | "An ordered list as a regular-expression\n") |
| 10110 | { |
| 10111 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
| 10112 | } |
| 10113 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10114 | DEFUN (no_ip_extcommunity_list_standard_all, |
| 10115 | no_ip_extcommunity_list_standard_all_cmd, |
| 10116 | "no ip extcommunity-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10117 | NO_STR |
| 10118 | IP_STR |
| 10119 | EXTCOMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10120 | "Extended Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10121 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10122 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10123 | } |
| 10124 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10125 | DEFUN (no_ip_extcommunity_list_expanded_all, |
| 10126 | no_ip_extcommunity_list_expanded_all_cmd, |
| 10127 | "no ip extcommunity-list <100-500>", |
| 10128 | NO_STR |
| 10129 | IP_STR |
| 10130 | EXTCOMMUNITY_LIST_STR |
| 10131 | "Extended Community list number (expanded)\n") |
| 10132 | { |
| 10133 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10134 | } |
| 10135 | |
| 10136 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
| 10137 | no_ip_extcommunity_list_name_standard_all_cmd, |
| 10138 | "no ip extcommunity-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10139 | NO_STR |
| 10140 | IP_STR |
| 10141 | EXTCOMMUNITY_LIST_STR |
| 10142 | "Specify standard extcommunity-list\n" |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10143 | "Extended Community list name\n") |
| 10144 | { |
| 10145 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10146 | } |
| 10147 | |
| 10148 | DEFUN (no_ip_extcommunity_list_name_expanded_all, |
| 10149 | no_ip_extcommunity_list_name_expanded_all_cmd, |
| 10150 | "no ip extcommunity-list expanded WORD", |
| 10151 | NO_STR |
| 10152 | IP_STR |
| 10153 | EXTCOMMUNITY_LIST_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10154 | "Specify expanded extcommunity-list\n" |
| 10155 | "Extended Community list name\n") |
| 10156 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10157 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10158 | } |
| 10159 | |
| 10160 | DEFUN (no_ip_extcommunity_list_standard, |
| 10161 | no_ip_extcommunity_list_standard_cmd, |
| 10162 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10163 | NO_STR |
| 10164 | IP_STR |
| 10165 | EXTCOMMUNITY_LIST_STR |
| 10166 | "Extended Community list number (standard)\n" |
| 10167 | "Specify community to reject\n" |
| 10168 | "Specify community to accept\n" |
| 10169 | EXTCOMMUNITY_VAL_STR) |
| 10170 | { |
| 10171 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10172 | } |
| 10173 | |
| 10174 | DEFUN (no_ip_extcommunity_list_expanded, |
| 10175 | no_ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10176 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10177 | NO_STR |
| 10178 | IP_STR |
| 10179 | EXTCOMMUNITY_LIST_STR |
| 10180 | "Extended Community list number (expanded)\n" |
| 10181 | "Specify community to reject\n" |
| 10182 | "Specify community to accept\n" |
| 10183 | "An ordered list as a regular-expression\n") |
| 10184 | { |
| 10185 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10186 | } |
| 10187 | |
| 10188 | DEFUN (no_ip_extcommunity_list_name_standard, |
| 10189 | no_ip_extcommunity_list_name_standard_cmd, |
| 10190 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10191 | NO_STR |
| 10192 | IP_STR |
| 10193 | EXTCOMMUNITY_LIST_STR |
| 10194 | "Specify standard extcommunity-list\n" |
| 10195 | "Extended Community list name\n" |
| 10196 | "Specify community to reject\n" |
| 10197 | "Specify community to accept\n" |
| 10198 | EXTCOMMUNITY_VAL_STR) |
| 10199 | { |
| 10200 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10201 | } |
| 10202 | |
| 10203 | DEFUN (no_ip_extcommunity_list_name_expanded, |
| 10204 | no_ip_extcommunity_list_name_expanded_cmd, |
| 10205 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10206 | NO_STR |
| 10207 | IP_STR |
| 10208 | EXTCOMMUNITY_LIST_STR |
| 10209 | "Specify expanded extcommunity-list\n" |
| 10210 | "Community list name\n" |
| 10211 | "Specify community to reject\n" |
| 10212 | "Specify community to accept\n" |
| 10213 | "An ordered list as a regular-expression\n") |
| 10214 | { |
| 10215 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10216 | } |
| 10217 | |
| 10218 | void |
| 10219 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
| 10220 | { |
| 10221 | struct community_entry *entry; |
| 10222 | |
| 10223 | for (entry = list->head; entry; entry = entry->next) |
| 10224 | { |
| 10225 | if (entry == list->head) |
| 10226 | { |
| 10227 | if (all_digit (list->name)) |
| 10228 | vty_out (vty, "Extended community %s list %s%s", |
| 10229 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10230 | "standard" : "(expanded) access", |
| 10231 | list->name, VTY_NEWLINE); |
| 10232 | else |
| 10233 | vty_out (vty, "Named extended community %s list %s%s", |
| 10234 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10235 | "standard" : "expanded", |
| 10236 | list->name, VTY_NEWLINE); |
| 10237 | } |
| 10238 | if (entry->any) |
| 10239 | vty_out (vty, " %s%s", |
| 10240 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10241 | else |
| 10242 | vty_out (vty, " %s %s%s", |
| 10243 | community_direct_str (entry->direct), |
| 10244 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10245 | entry->u.ecom->str : entry->config, |
| 10246 | VTY_NEWLINE); |
| 10247 | } |
| 10248 | } |
| 10249 | |
| 10250 | DEFUN (show_ip_extcommunity_list, |
| 10251 | show_ip_extcommunity_list_cmd, |
| 10252 | "show ip extcommunity-list", |
| 10253 | SHOW_STR |
| 10254 | IP_STR |
| 10255 | "List extended-community list\n") |
| 10256 | { |
| 10257 | struct community_list *list; |
| 10258 | struct community_list_master *cm; |
| 10259 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10260 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10261 | if (! cm) |
| 10262 | return CMD_SUCCESS; |
| 10263 | |
| 10264 | for (list = cm->num.head; list; list = list->next) |
| 10265 | extcommunity_list_show (vty, list); |
| 10266 | |
| 10267 | for (list = cm->str.head; list; list = list->next) |
| 10268 | extcommunity_list_show (vty, list); |
| 10269 | |
| 10270 | return CMD_SUCCESS; |
| 10271 | } |
| 10272 | |
| 10273 | DEFUN (show_ip_extcommunity_list_arg, |
| 10274 | show_ip_extcommunity_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10275 | "show ip extcommunity-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10276 | SHOW_STR |
| 10277 | IP_STR |
| 10278 | "List extended-community list\n" |
| 10279 | "Extcommunity-list number\n" |
| 10280 | "Extcommunity-list name\n") |
| 10281 | { |
| 10282 | struct community_list *list; |
| 10283 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10284 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10285 | if (! list) |
| 10286 | { |
| 10287 | vty_out (vty, "%% Can't find extcommunit-list%s", VTY_NEWLINE); |
| 10288 | return CMD_WARNING; |
| 10289 | } |
| 10290 | |
| 10291 | extcommunity_list_show (vty, list); |
| 10292 | |
| 10293 | return CMD_SUCCESS; |
| 10294 | } |
| 10295 | |
| 10296 | /* Return configuration string of community-list entry. */ |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10297 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10298 | community_list_config_str (struct community_entry *entry) |
| 10299 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10300 | const char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10301 | |
| 10302 | if (entry->any) |
| 10303 | str = ""; |
| 10304 | else |
| 10305 | { |
| 10306 | if (entry->style == COMMUNITY_LIST_STANDARD) |
| 10307 | str = community_str (entry->u.com); |
| 10308 | else |
| 10309 | str = entry->config; |
| 10310 | } |
| 10311 | return str; |
| 10312 | } |
| 10313 | |
| 10314 | /* Display community-list and extcommunity-list configuration. */ |
| 10315 | int |
| 10316 | community_list_config_write (struct vty *vty) |
| 10317 | { |
| 10318 | struct community_list *list; |
| 10319 | struct community_entry *entry; |
| 10320 | struct community_list_master *cm; |
| 10321 | int write = 0; |
| 10322 | |
| 10323 | /* Community-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10324 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10325 | |
| 10326 | for (list = cm->num.head; list; list = list->next) |
| 10327 | for (entry = list->head; entry; entry = entry->next) |
| 10328 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10329 | vty_out (vty, "ip community-list %s %s %s%s", |
| 10330 | list->name, community_direct_str (entry->direct), |
| 10331 | community_list_config_str (entry), |
| 10332 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10333 | write++; |
| 10334 | } |
| 10335 | for (list = cm->str.head; list; list = list->next) |
| 10336 | for (entry = list->head; entry; entry = entry->next) |
| 10337 | { |
| 10338 | vty_out (vty, "ip community-list %s %s %s %s%s", |
| 10339 | entry->style == COMMUNITY_LIST_STANDARD |
| 10340 | ? "standard" : "expanded", |
| 10341 | list->name, community_direct_str (entry->direct), |
| 10342 | community_list_config_str (entry), |
| 10343 | VTY_NEWLINE); |
| 10344 | write++; |
| 10345 | } |
| 10346 | |
| 10347 | /* Extcommunity-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10348 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10349 | |
| 10350 | for (list = cm->num.head; list; list = list->next) |
| 10351 | for (entry = list->head; entry; entry = entry->next) |
| 10352 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10353 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
| 10354 | list->name, community_direct_str (entry->direct), |
| 10355 | community_list_config_str (entry), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10356 | write++; |
| 10357 | } |
| 10358 | for (list = cm->str.head; list; list = list->next) |
| 10359 | for (entry = list->head; entry; entry = entry->next) |
| 10360 | { |
| 10361 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", |
| 10362 | entry->style == EXTCOMMUNITY_LIST_STANDARD |
| 10363 | ? "standard" : "expanded", |
| 10364 | list->name, community_direct_str (entry->direct), |
| 10365 | community_list_config_str (entry), VTY_NEWLINE); |
| 10366 | write++; |
| 10367 | } |
| 10368 | return write; |
| 10369 | } |
| 10370 | |
| 10371 | struct cmd_node community_list_node = |
| 10372 | { |
| 10373 | COMMUNITY_LIST_NODE, |
| 10374 | "", |
| 10375 | 1 /* Export to vtysh. */ |
| 10376 | }; |
| 10377 | |
| 10378 | void |
| 10379 | community_list_vty () |
| 10380 | { |
| 10381 | install_node (&community_list_node, community_list_config_write); |
| 10382 | |
| 10383 | /* Community-list. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10384 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
| 10385 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); |
| 10386 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); |
| 10387 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); |
| 10388 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); |
| 10389 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10390 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
| 10391 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
| 10392 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); |
| 10393 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10394 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
| 10395 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); |
| 10396 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); |
| 10397 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
| 10398 | install_element (VIEW_NODE, &show_ip_community_list_cmd); |
| 10399 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); |
| 10400 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); |
| 10401 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); |
| 10402 | |
| 10403 | /* Extcommunity-list. */ |
| 10404 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); |
| 10405 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); |
| 10406 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); |
| 10407 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); |
| 10408 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); |
| 10409 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10410 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
| 10411 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
| 10412 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); |
| 10413 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10414 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
| 10415 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); |
| 10416 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); |
| 10417 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
| 10418 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); |
| 10419 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 10420 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); |
| 10421 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 10422 | } |