paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* BGP VTY interface. |
| 2 | Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro |
| 3 | |
| 4 | This file is part of GNU Zebra. |
| 5 | |
| 6 | GNU Zebra is free software; you can redistribute it and/or modify it |
| 7 | under the terms of the GNU General Public License as published by the |
| 8 | Free Software Foundation; either version 2, or (at your option) any |
| 9 | later version. |
| 10 | |
| 11 | GNU Zebra is distributed in the hope that it will be useful, but |
| 12 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with GNU Zebra; see the file COPYING. If not, write to the Free |
| 18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 19 | 02111-1307, USA. */ |
| 20 | |
| 21 | #include <zebra.h> |
| 22 | |
| 23 | #include "command.h" |
| 24 | #include "prefix.h" |
| 25 | #include "plist.h" |
| 26 | #include "buffer.h" |
| 27 | #include "linklist.h" |
| 28 | #include "stream.h" |
| 29 | #include "thread.h" |
| 30 | #include "log.h" |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 31 | #include "memory.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 32 | |
| 33 | #include "bgpd/bgpd.h" |
| 34 | #include "bgpd/bgp_attr.h" |
| 35 | #include "bgpd/bgp_aspath.h" |
| 36 | #include "bgpd/bgp_community.h" |
| 37 | #include "bgpd/bgp_debug.h" |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 38 | #include "bgpd/bgp_fsm.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 39 | #include "bgpd/bgp_mplsvpn.h" |
| 40 | #include "bgpd/bgp_open.h" |
| 41 | #include "bgpd/bgp_route.h" |
| 42 | #include "bgpd/bgp_zebra.h" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 43 | #include "bgpd/bgp_table.h" |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 44 | #include "bgpd/bgp_vty.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 45 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 46 | extern struct in_addr router_id_zebra; |
| 47 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 48 | /* Utility function to get address family from current node. */ |
| 49 | afi_t |
| 50 | bgp_node_afi (struct vty *vty) |
| 51 | { |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 52 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 53 | return AFI_IP6; |
| 54 | return AFI_IP; |
| 55 | } |
| 56 | |
| 57 | /* Utility function to get subsequent address family from current |
| 58 | node. */ |
| 59 | safi_t |
| 60 | bgp_node_safi (struct vty *vty) |
| 61 | { |
| 62 | if (vty->node == BGP_VPNV4_NODE) |
| 63 | return SAFI_MPLS_VPN; |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 64 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 65 | return SAFI_MULTICAST; |
| 66 | return SAFI_UNICAST; |
| 67 | } |
| 68 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 69 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 70 | peer_address_self_check (union sockunion *su) |
| 71 | { |
| 72 | struct interface *ifp = NULL; |
| 73 | |
| 74 | if (su->sa.sa_family == AF_INET) |
| 75 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); |
| 76 | #ifdef HAVE_IPV6 |
| 77 | else if (su->sa.sa_family == AF_INET6) |
| 78 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); |
| 79 | #endif /* HAVE IPV6 */ |
| 80 | |
| 81 | if (ifp) |
| 82 | return 1; |
| 83 | |
| 84 | return 0; |
| 85 | } |
| 86 | |
| 87 | /* Utility function for looking up peer from VTY. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 88 | static struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 89 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 90 | { |
| 91 | int ret; |
| 92 | struct bgp *bgp; |
| 93 | union sockunion su; |
| 94 | struct peer *peer; |
| 95 | |
| 96 | bgp = vty->index; |
| 97 | |
| 98 | ret = str2sockunion (ip_str, &su); |
| 99 | if (ret < 0) |
| 100 | { |
| 101 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 102 | return NULL; |
| 103 | } |
| 104 | |
| 105 | peer = peer_lookup (bgp, &su); |
| 106 | if (! peer) |
| 107 | { |
| 108 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE); |
| 109 | return NULL; |
| 110 | } |
| 111 | return peer; |
| 112 | } |
| 113 | |
| 114 | /* Utility function for looking up peer or peer group. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 115 | static struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 116 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 117 | { |
| 118 | int ret; |
| 119 | struct bgp *bgp; |
| 120 | union sockunion su; |
| 121 | struct peer *peer; |
| 122 | struct peer_group *group; |
| 123 | |
| 124 | bgp = vty->index; |
| 125 | |
| 126 | ret = str2sockunion (peer_str, &su); |
| 127 | if (ret == 0) |
| 128 | { |
| 129 | peer = peer_lookup (bgp, &su); |
| 130 | if (peer) |
| 131 | return peer; |
| 132 | } |
| 133 | else |
| 134 | { |
| 135 | group = peer_group_lookup (bgp, peer_str); |
| 136 | if (group) |
| 137 | return group->conf; |
| 138 | } |
| 139 | |
| 140 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
| 141 | VTY_NEWLINE); |
| 142 | |
| 143 | return NULL; |
| 144 | } |
| 145 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 146 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 147 | bgp_vty_return (struct vty *vty, int ret) |
| 148 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 149 | const char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 150 | |
| 151 | switch (ret) |
| 152 | { |
| 153 | case BGP_ERR_INVALID_VALUE: |
| 154 | str = "Invalid value"; |
| 155 | break; |
| 156 | case BGP_ERR_INVALID_FLAG: |
| 157 | str = "Invalid flag"; |
| 158 | break; |
| 159 | case BGP_ERR_PEER_INACTIVE: |
| 160 | str = "Activate the neighbor for the address family first"; |
| 161 | break; |
| 162 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: |
| 163 | str = "Invalid command for a peer-group member"; |
| 164 | break; |
| 165 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
| 166 | str = "Peer-group has been shutdown. Activate the peer-group first"; |
| 167 | break; |
| 168 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: |
| 169 | str = "This peer is a peer-group member. Please change peer-group configuration"; |
| 170 | break; |
| 171 | case BGP_ERR_PEER_FLAG_CONFLICT: |
| 172 | str = "Can't set override-capability and strict-capability-match at the same time"; |
| 173 | break; |
| 174 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: |
| 175 | str = "No activate for peergroup can be given only if peer-group has no members"; |
| 176 | break; |
| 177 | case BGP_ERR_PEER_BELONGS_TO_GROUP: |
| 178 | str = "No activate for an individual peer-group member is invalid"; |
| 179 | break; |
| 180 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: |
| 181 | str = "Activate the peer-group for the address family first"; |
| 182 | break; |
| 183 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
| 184 | str = "Specify remote-as or peer-group remote AS first"; |
| 185 | break; |
| 186 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: |
| 187 | str = "Cannot change the peer-group. Deconfigure first"; |
| 188 | break; |
| 189 | case BGP_ERR_PEER_GROUP_MISMATCH: |
| 190 | str = "Cannot have different peer-group for the neighbor"; |
| 191 | break; |
| 192 | case BGP_ERR_PEER_FILTER_CONFLICT: |
| 193 | str = "Prefix/distribute list can not co-exist"; |
| 194 | break; |
| 195 | case BGP_ERR_NOT_INTERNAL_PEER: |
| 196 | str = "Invalid command. Not an internal neighbor"; |
| 197 | break; |
| 198 | case BGP_ERR_REMOVE_PRIVATE_AS: |
| 199 | str = "Private AS cannot be removed for IBGP peers"; |
| 200 | break; |
| 201 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: |
| 202 | str = "Local-AS allowed only for EBGP peers"; |
| 203 | break; |
| 204 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: |
| 205 | str = "Cannot have local-as same as BGP AS number"; |
| 206 | break; |
| 207 | } |
| 208 | if (str) |
| 209 | { |
| 210 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); |
| 211 | return CMD_WARNING; |
| 212 | } |
| 213 | return CMD_SUCCESS; |
| 214 | } |
| 215 | |
| 216 | /* BGP global configuration. */ |
| 217 | |
| 218 | DEFUN (bgp_multiple_instance_func, |
| 219 | bgp_multiple_instance_cmd, |
| 220 | "bgp multiple-instance", |
| 221 | BGP_STR |
| 222 | "Enable bgp multiple instance\n") |
| 223 | { |
| 224 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); |
| 225 | return CMD_SUCCESS; |
| 226 | } |
| 227 | |
| 228 | DEFUN (no_bgp_multiple_instance, |
| 229 | no_bgp_multiple_instance_cmd, |
| 230 | "no bgp multiple-instance", |
| 231 | NO_STR |
| 232 | BGP_STR |
| 233 | "BGP multiple instance\n") |
| 234 | { |
| 235 | int ret; |
| 236 | |
| 237 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); |
| 238 | if (ret < 0) |
| 239 | { |
| 240 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); |
| 241 | return CMD_WARNING; |
| 242 | } |
| 243 | return CMD_SUCCESS; |
| 244 | } |
| 245 | |
| 246 | DEFUN (bgp_config_type, |
| 247 | bgp_config_type_cmd, |
| 248 | "bgp config-type (cisco|zebra)", |
| 249 | BGP_STR |
| 250 | "Configuration type\n" |
| 251 | "cisco\n" |
| 252 | "zebra\n") |
| 253 | { |
| 254 | if (strncmp (argv[0], "c", 1) == 0) |
| 255 | bgp_option_set (BGP_OPT_CONFIG_CISCO); |
| 256 | else |
| 257 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 258 | |
| 259 | return CMD_SUCCESS; |
| 260 | } |
| 261 | |
| 262 | DEFUN (no_bgp_config_type, |
| 263 | no_bgp_config_type_cmd, |
| 264 | "no bgp config-type", |
| 265 | NO_STR |
| 266 | BGP_STR |
| 267 | "Display configuration type\n") |
| 268 | { |
| 269 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 270 | return CMD_SUCCESS; |
| 271 | } |
| 272 | |
| 273 | DEFUN (no_synchronization, |
| 274 | no_synchronization_cmd, |
| 275 | "no synchronization", |
| 276 | NO_STR |
| 277 | "Perform IGP synchronization\n") |
| 278 | { |
| 279 | return CMD_SUCCESS; |
| 280 | } |
| 281 | |
| 282 | DEFUN (no_auto_summary, |
| 283 | no_auto_summary_cmd, |
| 284 | "no auto-summary", |
| 285 | NO_STR |
| 286 | "Enable automatic network number summarization\n") |
| 287 | { |
| 288 | return CMD_SUCCESS; |
| 289 | } |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 290 | |
| 291 | DEFUN_DEPRECATED (neighbor_version, |
| 292 | neighbor_version_cmd, |
| 293 | NEIGHBOR_CMD "version (4|4-)", |
| 294 | NEIGHBOR_STR |
| 295 | NEIGHBOR_ADDR_STR |
| 296 | "Set the BGP version to match a neighbor\n" |
| 297 | "Neighbor's BGP version\n") |
| 298 | { |
| 299 | return CMD_SUCCESS; |
| 300 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 301 | |
| 302 | /* "router bgp" commands. */ |
| 303 | DEFUN (router_bgp, |
| 304 | router_bgp_cmd, |
| 305 | "router bgp <1-65535>", |
| 306 | ROUTER_STR |
| 307 | BGP_STR |
| 308 | AS_STR) |
| 309 | { |
| 310 | int ret; |
| 311 | as_t as; |
| 312 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 313 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 314 | |
| 315 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535); |
| 316 | |
| 317 | if (argc == 2) |
| 318 | name = argv[1]; |
| 319 | |
| 320 | ret = bgp_get (&bgp, &as, name); |
| 321 | switch (ret) |
| 322 | { |
| 323 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: |
| 324 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", |
| 325 | VTY_NEWLINE); |
| 326 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 330 | case BGP_ERR_INSTANCE_MISMATCH: |
| 331 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); |
| 332 | vty_out (vty, "BGP instance is already running; AS is %d%s", |
| 333 | as, VTY_NEWLINE); |
| 334 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 335 | } |
| 336 | |
| 337 | vty->node = BGP_NODE; |
| 338 | vty->index = bgp; |
| 339 | |
| 340 | return CMD_SUCCESS; |
| 341 | } |
| 342 | |
| 343 | ALIAS (router_bgp, |
| 344 | router_bgp_view_cmd, |
| 345 | "router bgp <1-65535> view WORD", |
| 346 | ROUTER_STR |
| 347 | BGP_STR |
| 348 | AS_STR |
| 349 | "BGP view\n" |
| 350 | "view name\n") |
| 351 | |
| 352 | /* "no router bgp" commands. */ |
| 353 | DEFUN (no_router_bgp, |
| 354 | no_router_bgp_cmd, |
| 355 | "no router bgp <1-65535>", |
| 356 | NO_STR |
| 357 | ROUTER_STR |
| 358 | BGP_STR |
| 359 | AS_STR) |
| 360 | { |
| 361 | as_t as; |
| 362 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 363 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 364 | |
| 365 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535); |
| 366 | |
| 367 | if (argc == 2) |
| 368 | name = argv[1]; |
| 369 | |
| 370 | /* Lookup bgp structure. */ |
| 371 | bgp = bgp_lookup (as, name); |
| 372 | if (! bgp) |
| 373 | { |
| 374 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); |
| 375 | return CMD_WARNING; |
| 376 | } |
| 377 | |
| 378 | bgp_delete (bgp); |
| 379 | |
| 380 | return CMD_SUCCESS; |
| 381 | } |
| 382 | |
| 383 | ALIAS (no_router_bgp, |
| 384 | no_router_bgp_view_cmd, |
| 385 | "no router bgp <1-65535> view WORD", |
| 386 | NO_STR |
| 387 | ROUTER_STR |
| 388 | BGP_STR |
| 389 | AS_STR |
| 390 | "BGP view\n" |
| 391 | "view name\n") |
| 392 | |
| 393 | /* BGP router-id. */ |
| 394 | |
| 395 | DEFUN (bgp_router_id, |
| 396 | bgp_router_id_cmd, |
| 397 | "bgp router-id A.B.C.D", |
| 398 | BGP_STR |
| 399 | "Override configured router identifier\n" |
| 400 | "Manually configured router identifier\n") |
| 401 | { |
| 402 | int ret; |
| 403 | struct in_addr id; |
| 404 | struct bgp *bgp; |
| 405 | |
| 406 | bgp = vty->index; |
| 407 | |
| 408 | ret = inet_aton (argv[0], &id); |
| 409 | if (! ret) |
| 410 | { |
| 411 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); |
| 412 | return CMD_WARNING; |
| 413 | } |
| 414 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 415 | bgp->router_id_static = id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 416 | bgp_router_id_set (bgp, &id); |
| 417 | |
| 418 | return CMD_SUCCESS; |
| 419 | } |
| 420 | |
| 421 | DEFUN (no_bgp_router_id, |
| 422 | no_bgp_router_id_cmd, |
| 423 | "no bgp router-id", |
| 424 | NO_STR |
| 425 | BGP_STR |
| 426 | "Override configured router identifier\n") |
| 427 | { |
| 428 | int ret; |
| 429 | struct in_addr id; |
| 430 | struct bgp *bgp; |
| 431 | |
| 432 | bgp = vty->index; |
| 433 | |
| 434 | if (argc == 1) |
| 435 | { |
| 436 | ret = inet_aton (argv[0], &id); |
| 437 | if (! ret) |
| 438 | { |
| 439 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); |
| 440 | return CMD_WARNING; |
| 441 | } |
| 442 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 443 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 444 | { |
| 445 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); |
| 446 | return CMD_WARNING; |
| 447 | } |
| 448 | } |
| 449 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 450 | bgp->router_id_static.s_addr = 0; |
| 451 | bgp_router_id_set (bgp, &router_id_zebra); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 452 | |
| 453 | return CMD_SUCCESS; |
| 454 | } |
| 455 | |
| 456 | ALIAS (no_bgp_router_id, |
| 457 | no_bgp_router_id_val_cmd, |
| 458 | "no bgp router-id A.B.C.D", |
| 459 | NO_STR |
| 460 | BGP_STR |
| 461 | "Override configured router identifier\n" |
| 462 | "Manually configured router identifier\n") |
| 463 | |
| 464 | /* BGP Cluster ID. */ |
| 465 | |
| 466 | DEFUN (bgp_cluster_id, |
| 467 | bgp_cluster_id_cmd, |
| 468 | "bgp cluster-id A.B.C.D", |
| 469 | BGP_STR |
| 470 | "Configure Route-Reflector Cluster-id\n" |
| 471 | "Route-Reflector Cluster-id in IP address format\n") |
| 472 | { |
| 473 | int ret; |
| 474 | struct bgp *bgp; |
| 475 | struct in_addr cluster; |
| 476 | |
| 477 | bgp = vty->index; |
| 478 | |
| 479 | ret = inet_aton (argv[0], &cluster); |
| 480 | if (! ret) |
| 481 | { |
| 482 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 483 | return CMD_WARNING; |
| 484 | } |
| 485 | |
| 486 | bgp_cluster_id_set (bgp, &cluster); |
| 487 | |
| 488 | return CMD_SUCCESS; |
| 489 | } |
| 490 | |
| 491 | ALIAS (bgp_cluster_id, |
| 492 | bgp_cluster_id32_cmd, |
| 493 | "bgp cluster-id <1-4294967295>", |
| 494 | BGP_STR |
| 495 | "Configure Route-Reflector Cluster-id\n" |
| 496 | "Route-Reflector Cluster-id as 32 bit quantity\n") |
| 497 | |
| 498 | DEFUN (no_bgp_cluster_id, |
| 499 | no_bgp_cluster_id_cmd, |
| 500 | "no bgp cluster-id", |
| 501 | NO_STR |
| 502 | BGP_STR |
| 503 | "Configure Route-Reflector Cluster-id\n") |
| 504 | { |
| 505 | int ret; |
| 506 | struct bgp *bgp; |
| 507 | struct in_addr cluster; |
| 508 | |
| 509 | bgp = vty->index; |
| 510 | |
| 511 | if (argc == 1) |
| 512 | { |
| 513 | ret = inet_aton (argv[0], &cluster); |
| 514 | if (! ret) |
| 515 | { |
| 516 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 517 | return CMD_WARNING; |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | bgp_cluster_id_unset (bgp); |
| 522 | |
| 523 | return CMD_SUCCESS; |
| 524 | } |
| 525 | |
| 526 | ALIAS (no_bgp_cluster_id, |
| 527 | no_bgp_cluster_id_arg_cmd, |
| 528 | "no bgp cluster-id A.B.C.D", |
| 529 | NO_STR |
| 530 | BGP_STR |
| 531 | "Configure Route-Reflector Cluster-id\n" |
| 532 | "Route-Reflector Cluster-id in IP address format\n") |
| 533 | |
| 534 | DEFUN (bgp_confederation_identifier, |
| 535 | bgp_confederation_identifier_cmd, |
| 536 | "bgp confederation identifier <1-65535>", |
| 537 | "BGP specific commands\n" |
| 538 | "AS confederation parameters\n" |
| 539 | "AS number\n" |
| 540 | "Set routing domain confederation AS\n") |
| 541 | { |
| 542 | struct bgp *bgp; |
| 543 | as_t as; |
| 544 | |
| 545 | bgp = vty->index; |
| 546 | |
| 547 | VTY_GET_INTEGER ("AS", as, argv[0]); |
| 548 | |
| 549 | bgp_confederation_id_set (bgp, as); |
| 550 | |
| 551 | return CMD_SUCCESS; |
| 552 | } |
| 553 | |
| 554 | DEFUN (no_bgp_confederation_identifier, |
| 555 | no_bgp_confederation_identifier_cmd, |
| 556 | "no bgp confederation identifier", |
| 557 | NO_STR |
| 558 | "BGP specific commands\n" |
| 559 | "AS confederation parameters\n" |
| 560 | "AS number\n") |
| 561 | { |
| 562 | struct bgp *bgp; |
| 563 | as_t as; |
| 564 | |
| 565 | bgp = vty->index; |
| 566 | |
| 567 | if (argc == 1) |
| 568 | VTY_GET_INTEGER ("AS", as, argv[0]); |
| 569 | |
| 570 | bgp_confederation_id_unset (bgp); |
| 571 | |
| 572 | return CMD_SUCCESS; |
| 573 | } |
| 574 | |
| 575 | ALIAS (no_bgp_confederation_identifier, |
| 576 | no_bgp_confederation_identifier_arg_cmd, |
| 577 | "no bgp confederation identifier <1-65535>", |
| 578 | NO_STR |
| 579 | "BGP specific commands\n" |
| 580 | "AS confederation parameters\n" |
| 581 | "AS number\n" |
| 582 | "Set routing domain confederation AS\n") |
| 583 | |
| 584 | DEFUN (bgp_confederation_peers, |
| 585 | bgp_confederation_peers_cmd, |
| 586 | "bgp confederation peers .<1-65535>", |
| 587 | "BGP specific commands\n" |
| 588 | "AS confederation parameters\n" |
| 589 | "Peer ASs in BGP confederation\n" |
| 590 | AS_STR) |
| 591 | { |
| 592 | struct bgp *bgp; |
| 593 | as_t as; |
| 594 | int i; |
| 595 | |
| 596 | bgp = vty->index; |
| 597 | |
| 598 | for (i = 0; i < argc; i++) |
| 599 | { |
| 600 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, 65535); |
| 601 | |
| 602 | if (bgp->as == as) |
| 603 | { |
| 604 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", |
| 605 | VTY_NEWLINE); |
| 606 | continue; |
| 607 | } |
| 608 | |
| 609 | bgp_confederation_peers_add (bgp, as); |
| 610 | } |
| 611 | return CMD_SUCCESS; |
| 612 | } |
| 613 | |
| 614 | DEFUN (no_bgp_confederation_peers, |
| 615 | no_bgp_confederation_peers_cmd, |
| 616 | "no bgp confederation peers .<1-65535>", |
| 617 | NO_STR |
| 618 | "BGP specific commands\n" |
| 619 | "AS confederation parameters\n" |
| 620 | "Peer ASs in BGP confederation\n" |
| 621 | AS_STR) |
| 622 | { |
| 623 | struct bgp *bgp; |
| 624 | as_t as; |
| 625 | int i; |
| 626 | |
| 627 | bgp = vty->index; |
| 628 | |
| 629 | for (i = 0; i < argc; i++) |
| 630 | { |
| 631 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, 65535); |
| 632 | |
| 633 | bgp_confederation_peers_remove (bgp, as); |
| 634 | } |
| 635 | return CMD_SUCCESS; |
| 636 | } |
| 637 | |
| 638 | /* BGP timers. */ |
| 639 | |
| 640 | DEFUN (bgp_timers, |
| 641 | bgp_timers_cmd, |
| 642 | "timers bgp <0-65535> <0-65535>", |
| 643 | "Adjust routing timers\n" |
| 644 | "BGP timers\n" |
| 645 | "Keepalive interval\n" |
| 646 | "Holdtime\n") |
| 647 | { |
| 648 | struct bgp *bgp; |
| 649 | unsigned long keepalive = 0; |
| 650 | unsigned long holdtime = 0; |
| 651 | |
| 652 | bgp = vty->index; |
| 653 | |
| 654 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); |
| 655 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); |
| 656 | |
| 657 | /* Holdtime value check. */ |
| 658 | if (holdtime < 3 && holdtime != 0) |
| 659 | { |
| 660 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", |
| 661 | VTY_NEWLINE); |
| 662 | return CMD_WARNING; |
| 663 | } |
| 664 | |
| 665 | bgp_timers_set (bgp, keepalive, holdtime); |
| 666 | |
| 667 | return CMD_SUCCESS; |
| 668 | } |
| 669 | |
| 670 | DEFUN (no_bgp_timers, |
| 671 | no_bgp_timers_cmd, |
| 672 | "no timers bgp", |
| 673 | NO_STR |
| 674 | "Adjust routing timers\n" |
| 675 | "BGP timers\n") |
| 676 | { |
| 677 | struct bgp *bgp; |
| 678 | |
| 679 | bgp = vty->index; |
| 680 | bgp_timers_unset (bgp); |
| 681 | |
| 682 | return CMD_SUCCESS; |
| 683 | } |
| 684 | |
| 685 | ALIAS (no_bgp_timers, |
| 686 | no_bgp_timers_arg_cmd, |
| 687 | "no timers bgp <0-65535> <0-65535>", |
| 688 | NO_STR |
| 689 | "Adjust routing timers\n" |
| 690 | "BGP timers\n" |
| 691 | "Keepalive interval\n" |
| 692 | "Holdtime\n") |
| 693 | |
| 694 | DEFUN (bgp_client_to_client_reflection, |
| 695 | bgp_client_to_client_reflection_cmd, |
| 696 | "bgp client-to-client reflection", |
| 697 | "BGP specific commands\n" |
| 698 | "Configure client to client route reflection\n" |
| 699 | "reflection of routes allowed\n") |
| 700 | { |
| 701 | struct bgp *bgp; |
| 702 | |
| 703 | bgp = vty->index; |
| 704 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 705 | return CMD_SUCCESS; |
| 706 | } |
| 707 | |
| 708 | DEFUN (no_bgp_client_to_client_reflection, |
| 709 | no_bgp_client_to_client_reflection_cmd, |
| 710 | "no bgp client-to-client reflection", |
| 711 | NO_STR |
| 712 | "BGP specific commands\n" |
| 713 | "Configure client to client route reflection\n" |
| 714 | "reflection of routes allowed\n") |
| 715 | { |
| 716 | struct bgp *bgp; |
| 717 | |
| 718 | bgp = vty->index; |
| 719 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 720 | return CMD_SUCCESS; |
| 721 | } |
| 722 | |
| 723 | /* "bgp always-compare-med" configuration. */ |
| 724 | DEFUN (bgp_always_compare_med, |
| 725 | bgp_always_compare_med_cmd, |
| 726 | "bgp always-compare-med", |
| 727 | "BGP specific commands\n" |
| 728 | "Allow comparing MED from different neighbors\n") |
| 729 | { |
| 730 | struct bgp *bgp; |
| 731 | |
| 732 | bgp = vty->index; |
| 733 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 734 | return CMD_SUCCESS; |
| 735 | } |
| 736 | |
| 737 | DEFUN (no_bgp_always_compare_med, |
| 738 | no_bgp_always_compare_med_cmd, |
| 739 | "no bgp always-compare-med", |
| 740 | NO_STR |
| 741 | "BGP specific commands\n" |
| 742 | "Allow comparing MED from different neighbors\n") |
| 743 | { |
| 744 | struct bgp *bgp; |
| 745 | |
| 746 | bgp = vty->index; |
| 747 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 748 | return CMD_SUCCESS; |
| 749 | } |
| 750 | |
| 751 | /* "bgp deterministic-med" configuration. */ |
| 752 | DEFUN (bgp_deterministic_med, |
| 753 | bgp_deterministic_med_cmd, |
| 754 | "bgp deterministic-med", |
| 755 | "BGP specific commands\n" |
| 756 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 757 | { |
| 758 | struct bgp *bgp; |
| 759 | |
| 760 | bgp = vty->index; |
| 761 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 762 | return CMD_SUCCESS; |
| 763 | } |
| 764 | |
| 765 | DEFUN (no_bgp_deterministic_med, |
| 766 | no_bgp_deterministic_med_cmd, |
| 767 | "no bgp deterministic-med", |
| 768 | NO_STR |
| 769 | "BGP specific commands\n" |
| 770 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 771 | { |
| 772 | struct bgp *bgp; |
| 773 | |
| 774 | bgp = vty->index; |
| 775 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 776 | return CMD_SUCCESS; |
| 777 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 778 | |
| 779 | /* "bgp graceful-restart" configuration. */ |
| 780 | DEFUN (bgp_graceful_restart, |
| 781 | bgp_graceful_restart_cmd, |
| 782 | "bgp graceful-restart", |
| 783 | "BGP specific commands\n" |
| 784 | "Graceful restart capability parameters\n") |
| 785 | { |
| 786 | struct bgp *bgp; |
| 787 | |
| 788 | bgp = vty->index; |
| 789 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 790 | return CMD_SUCCESS; |
| 791 | } |
| 792 | |
| 793 | DEFUN (no_bgp_graceful_restart, |
| 794 | no_bgp_graceful_restart_cmd, |
| 795 | "no bgp graceful-restart", |
| 796 | NO_STR |
| 797 | "BGP specific commands\n" |
| 798 | "Graceful restart capability parameters\n") |
| 799 | { |
| 800 | struct bgp *bgp; |
| 801 | |
| 802 | bgp = vty->index; |
| 803 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 804 | return CMD_SUCCESS; |
| 805 | } |
| 806 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 807 | DEFUN (bgp_graceful_restart_stalepath_time, |
| 808 | bgp_graceful_restart_stalepath_time_cmd, |
| 809 | "bgp graceful-restart stalepath-time <1-3600>", |
| 810 | "BGP specific commands\n" |
| 811 | "Graceful restart capability parameters\n" |
| 812 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 813 | "Delay value (seconds)\n") |
| 814 | { |
| 815 | struct bgp *bgp; |
| 816 | u_int32_t stalepath; |
| 817 | |
| 818 | bgp = vty->index; |
| 819 | if (! bgp) |
| 820 | return CMD_WARNING; |
| 821 | |
| 822 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); |
| 823 | bgp->stalepath_time = stalepath; |
| 824 | return CMD_SUCCESS; |
| 825 | } |
| 826 | |
| 827 | DEFUN (no_bgp_graceful_restart_stalepath_time, |
| 828 | no_bgp_graceful_restart_stalepath_time_cmd, |
| 829 | "no bgp graceful-restart stalepath-time", |
| 830 | NO_STR |
| 831 | "BGP specific commands\n" |
| 832 | "Graceful restart capability parameters\n" |
| 833 | "Set the max time to hold onto restarting peer's stale paths\n") |
| 834 | { |
| 835 | struct bgp *bgp; |
| 836 | |
| 837 | bgp = vty->index; |
| 838 | if (! bgp) |
| 839 | return CMD_WARNING; |
| 840 | |
| 841 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; |
| 842 | return CMD_SUCCESS; |
| 843 | } |
| 844 | |
| 845 | ALIAS (no_bgp_graceful_restart_stalepath_time, |
| 846 | no_bgp_graceful_restart_stalepath_time_val_cmd, |
| 847 | "no bgp graceful-restart stalepath-time <1-3600>", |
| 848 | NO_STR |
| 849 | "BGP specific commands\n" |
| 850 | "Graceful restart capability parameters\n" |
| 851 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 852 | "Delay value (seconds)\n") |
| 853 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 854 | /* "bgp fast-external-failover" configuration. */ |
| 855 | DEFUN (bgp_fast_external_failover, |
| 856 | bgp_fast_external_failover_cmd, |
| 857 | "bgp fast-external-failover", |
| 858 | BGP_STR |
| 859 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 860 | { |
| 861 | struct bgp *bgp; |
| 862 | |
| 863 | bgp = vty->index; |
| 864 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 865 | return CMD_SUCCESS; |
| 866 | } |
| 867 | |
| 868 | DEFUN (no_bgp_fast_external_failover, |
| 869 | no_bgp_fast_external_failover_cmd, |
| 870 | "no bgp fast-external-failover", |
| 871 | NO_STR |
| 872 | BGP_STR |
| 873 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 874 | { |
| 875 | struct bgp *bgp; |
| 876 | |
| 877 | bgp = vty->index; |
| 878 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 879 | return CMD_SUCCESS; |
| 880 | } |
| 881 | |
| 882 | /* "bgp enforce-first-as" configuration. */ |
| 883 | DEFUN (bgp_enforce_first_as, |
| 884 | bgp_enforce_first_as_cmd, |
| 885 | "bgp enforce-first-as", |
| 886 | BGP_STR |
| 887 | "Enforce the first AS for EBGP routes\n") |
| 888 | { |
| 889 | struct bgp *bgp; |
| 890 | |
| 891 | bgp = vty->index; |
| 892 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 893 | return CMD_SUCCESS; |
| 894 | } |
| 895 | |
| 896 | DEFUN (no_bgp_enforce_first_as, |
| 897 | no_bgp_enforce_first_as_cmd, |
| 898 | "no bgp enforce-first-as", |
| 899 | NO_STR |
| 900 | BGP_STR |
| 901 | "Enforce the first AS for EBGP routes\n") |
| 902 | { |
| 903 | struct bgp *bgp; |
| 904 | |
| 905 | bgp = vty->index; |
| 906 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 907 | return CMD_SUCCESS; |
| 908 | } |
| 909 | |
| 910 | /* "bgp bestpath compare-routerid" configuration. */ |
| 911 | DEFUN (bgp_bestpath_compare_router_id, |
| 912 | bgp_bestpath_compare_router_id_cmd, |
| 913 | "bgp bestpath compare-routerid", |
| 914 | "BGP specific commands\n" |
| 915 | "Change the default bestpath selection\n" |
| 916 | "Compare router-id for identical EBGP paths\n") |
| 917 | { |
| 918 | struct bgp *bgp; |
| 919 | |
| 920 | bgp = vty->index; |
| 921 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 922 | return CMD_SUCCESS; |
| 923 | } |
| 924 | |
| 925 | DEFUN (no_bgp_bestpath_compare_router_id, |
| 926 | no_bgp_bestpath_compare_router_id_cmd, |
| 927 | "no bgp bestpath compare-routerid", |
| 928 | NO_STR |
| 929 | "BGP specific commands\n" |
| 930 | "Change the default bestpath selection\n" |
| 931 | "Compare router-id for identical EBGP paths\n") |
| 932 | { |
| 933 | struct bgp *bgp; |
| 934 | |
| 935 | bgp = vty->index; |
| 936 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 937 | return CMD_SUCCESS; |
| 938 | } |
| 939 | |
| 940 | /* "bgp bestpath as-path ignore" configuration. */ |
| 941 | DEFUN (bgp_bestpath_aspath_ignore, |
| 942 | bgp_bestpath_aspath_ignore_cmd, |
| 943 | "bgp bestpath as-path ignore", |
| 944 | "BGP specific commands\n" |
| 945 | "Change the default bestpath selection\n" |
| 946 | "AS-path attribute\n" |
| 947 | "Ignore as-path length in selecting a route\n") |
| 948 | { |
| 949 | struct bgp *bgp; |
| 950 | |
| 951 | bgp = vty->index; |
| 952 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 953 | return CMD_SUCCESS; |
| 954 | } |
| 955 | |
| 956 | DEFUN (no_bgp_bestpath_aspath_ignore, |
| 957 | no_bgp_bestpath_aspath_ignore_cmd, |
| 958 | "no bgp bestpath as-path ignore", |
| 959 | NO_STR |
| 960 | "BGP specific commands\n" |
| 961 | "Change the default bestpath selection\n" |
| 962 | "AS-path attribute\n" |
| 963 | "Ignore as-path length in selecting a route\n") |
| 964 | { |
| 965 | struct bgp *bgp; |
| 966 | |
| 967 | bgp = vty->index; |
| 968 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 969 | return CMD_SUCCESS; |
| 970 | } |
| 971 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 972 | /* "bgp bestpath as-path confed" configuration. */ |
| 973 | DEFUN (bgp_bestpath_aspath_confed, |
| 974 | bgp_bestpath_aspath_confed_cmd, |
| 975 | "bgp bestpath as-path confed", |
| 976 | "BGP specific commands\n" |
| 977 | "Change the default bestpath selection\n" |
| 978 | "AS-path attribute\n" |
| 979 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 980 | { |
| 981 | struct bgp *bgp; |
| 982 | |
| 983 | bgp = vty->index; |
| 984 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); |
| 985 | return CMD_SUCCESS; |
| 986 | } |
| 987 | |
| 988 | DEFUN (no_bgp_bestpath_aspath_confed, |
| 989 | no_bgp_bestpath_aspath_confed_cmd, |
| 990 | "no bgp bestpath as-path confed", |
| 991 | NO_STR |
| 992 | "BGP specific commands\n" |
| 993 | "Change the default bestpath selection\n" |
| 994 | "AS-path attribute\n" |
| 995 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 996 | { |
| 997 | struct bgp *bgp; |
| 998 | |
| 999 | bgp = vty->index; |
| 1000 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); |
| 1001 | return CMD_SUCCESS; |
| 1002 | } |
| 1003 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 1004 | /* "bgp log-neighbor-changes" configuration. */ |
| 1005 | DEFUN (bgp_log_neighbor_changes, |
| 1006 | bgp_log_neighbor_changes_cmd, |
| 1007 | "bgp log-neighbor-changes", |
| 1008 | "BGP specific commands\n" |
| 1009 | "Log neighbor up/down and reset reason\n") |
| 1010 | { |
| 1011 | struct bgp *bgp; |
| 1012 | |
| 1013 | bgp = vty->index; |
| 1014 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1015 | return CMD_SUCCESS; |
| 1016 | } |
| 1017 | |
| 1018 | DEFUN (no_bgp_log_neighbor_changes, |
| 1019 | no_bgp_log_neighbor_changes_cmd, |
| 1020 | "no bgp log-neighbor-changes", |
| 1021 | NO_STR |
| 1022 | "BGP specific commands\n" |
| 1023 | "Log neighbor up/down and reset reason\n") |
| 1024 | { |
| 1025 | struct bgp *bgp; |
| 1026 | |
| 1027 | bgp = vty->index; |
| 1028 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1029 | return CMD_SUCCESS; |
| 1030 | } |
| 1031 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1032 | /* "bgp bestpath med" configuration. */ |
| 1033 | DEFUN (bgp_bestpath_med, |
| 1034 | bgp_bestpath_med_cmd, |
| 1035 | "bgp bestpath med (confed|missing-as-worst)", |
| 1036 | "BGP specific commands\n" |
| 1037 | "Change the default bestpath selection\n" |
| 1038 | "MED attribute\n" |
| 1039 | "Compare MED among confederation paths\n" |
| 1040 | "Treat missing MED as the least preferred one\n") |
| 1041 | { |
| 1042 | struct bgp *bgp; |
| 1043 | |
| 1044 | bgp = vty->index; |
| 1045 | |
| 1046 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1047 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1048 | else |
| 1049 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1050 | |
| 1051 | return CMD_SUCCESS; |
| 1052 | } |
| 1053 | |
| 1054 | DEFUN (bgp_bestpath_med2, |
| 1055 | bgp_bestpath_med2_cmd, |
| 1056 | "bgp bestpath med confed missing-as-worst", |
| 1057 | "BGP specific commands\n" |
| 1058 | "Change the default bestpath selection\n" |
| 1059 | "MED attribute\n" |
| 1060 | "Compare MED among confederation paths\n" |
| 1061 | "Treat missing MED as the least preferred one\n") |
| 1062 | { |
| 1063 | struct bgp *bgp; |
| 1064 | |
| 1065 | bgp = vty->index; |
| 1066 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1067 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1068 | return CMD_SUCCESS; |
| 1069 | } |
| 1070 | |
| 1071 | ALIAS (bgp_bestpath_med2, |
| 1072 | bgp_bestpath_med3_cmd, |
| 1073 | "bgp bestpath med missing-as-worst confed", |
| 1074 | "BGP specific commands\n" |
| 1075 | "Change the default bestpath selection\n" |
| 1076 | "MED attribute\n" |
| 1077 | "Treat missing MED as the least preferred one\n" |
| 1078 | "Compare MED among confederation paths\n") |
| 1079 | |
| 1080 | DEFUN (no_bgp_bestpath_med, |
| 1081 | no_bgp_bestpath_med_cmd, |
| 1082 | "no bgp bestpath med (confed|missing-as-worst)", |
| 1083 | NO_STR |
| 1084 | "BGP specific commands\n" |
| 1085 | "Change the default bestpath selection\n" |
| 1086 | "MED attribute\n" |
| 1087 | "Compare MED among confederation paths\n" |
| 1088 | "Treat missing MED as the least preferred one\n") |
| 1089 | { |
| 1090 | struct bgp *bgp; |
| 1091 | |
| 1092 | bgp = vty->index; |
| 1093 | |
| 1094 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1095 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1096 | else |
| 1097 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1098 | |
| 1099 | return CMD_SUCCESS; |
| 1100 | } |
| 1101 | |
| 1102 | DEFUN (no_bgp_bestpath_med2, |
| 1103 | no_bgp_bestpath_med2_cmd, |
| 1104 | "no bgp bestpath med confed missing-as-worst", |
| 1105 | NO_STR |
| 1106 | "BGP specific commands\n" |
| 1107 | "Change the default bestpath selection\n" |
| 1108 | "MED attribute\n" |
| 1109 | "Compare MED among confederation paths\n" |
| 1110 | "Treat missing MED as the least preferred one\n") |
| 1111 | { |
| 1112 | struct bgp *bgp; |
| 1113 | |
| 1114 | bgp = vty->index; |
| 1115 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1116 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1117 | return CMD_SUCCESS; |
| 1118 | } |
| 1119 | |
| 1120 | ALIAS (no_bgp_bestpath_med2, |
| 1121 | no_bgp_bestpath_med3_cmd, |
| 1122 | "no bgp bestpath med missing-as-worst confed", |
| 1123 | NO_STR |
| 1124 | "BGP specific commands\n" |
| 1125 | "Change the default bestpath selection\n" |
| 1126 | "MED attribute\n" |
| 1127 | "Treat missing MED as the least preferred one\n" |
| 1128 | "Compare MED among confederation paths\n") |
| 1129 | |
| 1130 | /* "no bgp default ipv4-unicast". */ |
| 1131 | DEFUN (no_bgp_default_ipv4_unicast, |
| 1132 | no_bgp_default_ipv4_unicast_cmd, |
| 1133 | "no bgp default ipv4-unicast", |
| 1134 | NO_STR |
| 1135 | "BGP specific commands\n" |
| 1136 | "Configure BGP defaults\n" |
| 1137 | "Activate ipv4-unicast for a peer by default\n") |
| 1138 | { |
| 1139 | struct bgp *bgp; |
| 1140 | |
| 1141 | bgp = vty->index; |
| 1142 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1143 | return CMD_SUCCESS; |
| 1144 | } |
| 1145 | |
| 1146 | DEFUN (bgp_default_ipv4_unicast, |
| 1147 | bgp_default_ipv4_unicast_cmd, |
| 1148 | "bgp default ipv4-unicast", |
| 1149 | "BGP specific commands\n" |
| 1150 | "Configure BGP defaults\n" |
| 1151 | "Activate ipv4-unicast for a peer by default\n") |
| 1152 | { |
| 1153 | struct bgp *bgp; |
| 1154 | |
| 1155 | bgp = vty->index; |
| 1156 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1157 | return CMD_SUCCESS; |
| 1158 | } |
| 1159 | |
| 1160 | /* "bgp import-check" configuration. */ |
| 1161 | DEFUN (bgp_network_import_check, |
| 1162 | bgp_network_import_check_cmd, |
| 1163 | "bgp network import-check", |
| 1164 | "BGP specific commands\n" |
| 1165 | "BGP network command\n" |
| 1166 | "Check BGP network route exists in IGP\n") |
| 1167 | { |
| 1168 | struct bgp *bgp; |
| 1169 | |
| 1170 | bgp = vty->index; |
| 1171 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1172 | return CMD_SUCCESS; |
| 1173 | } |
| 1174 | |
| 1175 | DEFUN (no_bgp_network_import_check, |
| 1176 | no_bgp_network_import_check_cmd, |
| 1177 | "no bgp network import-check", |
| 1178 | NO_STR |
| 1179 | "BGP specific commands\n" |
| 1180 | "BGP network command\n" |
| 1181 | "Check BGP network route exists in IGP\n") |
| 1182 | { |
| 1183 | struct bgp *bgp; |
| 1184 | |
| 1185 | bgp = vty->index; |
| 1186 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1187 | return CMD_SUCCESS; |
| 1188 | } |
| 1189 | |
| 1190 | DEFUN (bgp_default_local_preference, |
| 1191 | bgp_default_local_preference_cmd, |
| 1192 | "bgp default local-preference <0-4294967295>", |
| 1193 | "BGP specific commands\n" |
| 1194 | "Configure BGP defaults\n" |
| 1195 | "local preference (higher=more preferred)\n" |
| 1196 | "Configure default local preference value\n") |
| 1197 | { |
| 1198 | struct bgp *bgp; |
| 1199 | u_int32_t local_pref; |
| 1200 | |
| 1201 | bgp = vty->index; |
| 1202 | |
| 1203 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); |
| 1204 | |
| 1205 | bgp_default_local_preference_set (bgp, local_pref); |
| 1206 | |
| 1207 | return CMD_SUCCESS; |
| 1208 | } |
| 1209 | |
| 1210 | DEFUN (no_bgp_default_local_preference, |
| 1211 | no_bgp_default_local_preference_cmd, |
| 1212 | "no bgp default local-preference", |
| 1213 | NO_STR |
| 1214 | "BGP specific commands\n" |
| 1215 | "Configure BGP defaults\n" |
| 1216 | "local preference (higher=more preferred)\n") |
| 1217 | { |
| 1218 | struct bgp *bgp; |
| 1219 | |
| 1220 | bgp = vty->index; |
| 1221 | bgp_default_local_preference_unset (bgp); |
| 1222 | return CMD_SUCCESS; |
| 1223 | } |
| 1224 | |
| 1225 | ALIAS (no_bgp_default_local_preference, |
| 1226 | no_bgp_default_local_preference_val_cmd, |
| 1227 | "no bgp default local-preference <0-4294967295>", |
| 1228 | NO_STR |
| 1229 | "BGP specific commands\n" |
| 1230 | "Configure BGP defaults\n" |
| 1231 | "local preference (higher=more preferred)\n" |
| 1232 | "Configure default local preference value\n") |
| 1233 | |
| 1234 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1235 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
| 1236 | const char *as_str, afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1237 | { |
| 1238 | int ret; |
| 1239 | struct bgp *bgp; |
| 1240 | as_t as; |
| 1241 | union sockunion su; |
| 1242 | |
| 1243 | bgp = vty->index; |
| 1244 | |
| 1245 | /* Get AS number. */ |
| 1246 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, 65535); |
| 1247 | |
| 1248 | /* If peer is peer group, call proper function. */ |
| 1249 | ret = str2sockunion (peer_str, &su); |
| 1250 | if (ret < 0) |
| 1251 | { |
| 1252 | ret = peer_group_remote_as (bgp, peer_str, &as); |
| 1253 | if (ret < 0) |
| 1254 | { |
| 1255 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1256 | return CMD_WARNING; |
| 1257 | } |
| 1258 | return CMD_SUCCESS; |
| 1259 | } |
| 1260 | |
| 1261 | if (peer_address_self_check (&su)) |
| 1262 | { |
| 1263 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1264 | VTY_NEWLINE); |
| 1265 | return CMD_WARNING; |
| 1266 | } |
| 1267 | |
| 1268 | ret = peer_remote_as (bgp, &su, &as, afi, safi); |
| 1269 | |
| 1270 | /* This peer belongs to peer group. */ |
| 1271 | switch (ret) |
| 1272 | { |
| 1273 | case BGP_ERR_PEER_GROUP_MEMBER: |
| 1274 | vty_out (vty, "%% Peer-group AS %d. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
| 1275 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1276 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
| 1277 | 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); |
| 1278 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1279 | } |
| 1280 | return bgp_vty_return (vty, ret); |
| 1281 | } |
| 1282 | |
| 1283 | DEFUN (neighbor_remote_as, |
| 1284 | neighbor_remote_as_cmd, |
| 1285 | NEIGHBOR_CMD2 "remote-as <1-65535>", |
| 1286 | NEIGHBOR_STR |
| 1287 | NEIGHBOR_ADDR_STR2 |
| 1288 | "Specify a BGP neighbor\n" |
| 1289 | AS_STR) |
| 1290 | { |
| 1291 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); |
| 1292 | } |
| 1293 | |
| 1294 | DEFUN (neighbor_peer_group, |
| 1295 | neighbor_peer_group_cmd, |
| 1296 | "neighbor WORD peer-group", |
| 1297 | NEIGHBOR_STR |
| 1298 | "Neighbor tag\n" |
| 1299 | "Configure peer-group\n") |
| 1300 | { |
| 1301 | struct bgp *bgp; |
| 1302 | struct peer_group *group; |
| 1303 | |
| 1304 | bgp = vty->index; |
| 1305 | |
| 1306 | group = peer_group_get (bgp, argv[0]); |
| 1307 | if (! group) |
| 1308 | return CMD_WARNING; |
| 1309 | |
| 1310 | return CMD_SUCCESS; |
| 1311 | } |
| 1312 | |
| 1313 | DEFUN (no_neighbor, |
| 1314 | no_neighbor_cmd, |
| 1315 | NO_NEIGHBOR_CMD2, |
| 1316 | NO_STR |
| 1317 | NEIGHBOR_STR |
| 1318 | NEIGHBOR_ADDR_STR2) |
| 1319 | { |
| 1320 | int ret; |
| 1321 | union sockunion su; |
| 1322 | struct peer_group *group; |
| 1323 | struct peer *peer; |
| 1324 | |
| 1325 | ret = str2sockunion (argv[0], &su); |
| 1326 | if (ret < 0) |
| 1327 | { |
| 1328 | group = peer_group_lookup (vty->index, argv[0]); |
| 1329 | if (group) |
| 1330 | peer_group_delete (group); |
| 1331 | else |
| 1332 | { |
| 1333 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1334 | return CMD_WARNING; |
| 1335 | } |
| 1336 | } |
| 1337 | else |
| 1338 | { |
| 1339 | peer = peer_lookup (vty->index, &su); |
| 1340 | if (peer) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 1341 | peer_delete (peer); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1342 | } |
| 1343 | |
| 1344 | return CMD_SUCCESS; |
| 1345 | } |
| 1346 | |
| 1347 | ALIAS (no_neighbor, |
| 1348 | no_neighbor_remote_as_cmd, |
| 1349 | NO_NEIGHBOR_CMD "remote-as <1-65535>", |
| 1350 | NO_STR |
| 1351 | NEIGHBOR_STR |
| 1352 | NEIGHBOR_ADDR_STR |
| 1353 | "Specify a BGP neighbor\n" |
| 1354 | AS_STR) |
| 1355 | |
| 1356 | DEFUN (no_neighbor_peer_group, |
| 1357 | no_neighbor_peer_group_cmd, |
| 1358 | "no neighbor WORD peer-group", |
| 1359 | NO_STR |
| 1360 | NEIGHBOR_STR |
| 1361 | "Neighbor tag\n" |
| 1362 | "Configure peer-group\n") |
| 1363 | { |
| 1364 | struct peer_group *group; |
| 1365 | |
| 1366 | group = peer_group_lookup (vty->index, argv[0]); |
| 1367 | if (group) |
| 1368 | peer_group_delete (group); |
| 1369 | else |
| 1370 | { |
| 1371 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1372 | return CMD_WARNING; |
| 1373 | } |
| 1374 | return CMD_SUCCESS; |
| 1375 | } |
| 1376 | |
| 1377 | DEFUN (no_neighbor_peer_group_remote_as, |
| 1378 | no_neighbor_peer_group_remote_as_cmd, |
| 1379 | "no neighbor WORD remote-as <1-65535>", |
| 1380 | NO_STR |
| 1381 | NEIGHBOR_STR |
| 1382 | "Neighbor tag\n" |
| 1383 | "Specify a BGP neighbor\n" |
| 1384 | AS_STR) |
| 1385 | { |
| 1386 | struct peer_group *group; |
| 1387 | |
| 1388 | group = peer_group_lookup (vty->index, argv[0]); |
| 1389 | if (group) |
| 1390 | peer_group_remote_as_delete (group); |
| 1391 | else |
| 1392 | { |
| 1393 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1394 | return CMD_WARNING; |
| 1395 | } |
| 1396 | return CMD_SUCCESS; |
| 1397 | } |
| 1398 | |
| 1399 | DEFUN (neighbor_local_as, |
| 1400 | neighbor_local_as_cmd, |
| 1401 | NEIGHBOR_CMD2 "local-as <1-65535>", |
| 1402 | NEIGHBOR_STR |
| 1403 | NEIGHBOR_ADDR_STR2 |
| 1404 | "Specify a local-as number\n" |
| 1405 | "AS number used as local AS\n") |
| 1406 | { |
| 1407 | struct peer *peer; |
| 1408 | int ret; |
| 1409 | |
| 1410 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1411 | if (! peer) |
| 1412 | return CMD_WARNING; |
| 1413 | |
| 1414 | ret = peer_local_as_set (peer, atoi (argv[1]), 0); |
| 1415 | return bgp_vty_return (vty, ret); |
| 1416 | } |
| 1417 | |
| 1418 | DEFUN (neighbor_local_as_no_prepend, |
| 1419 | neighbor_local_as_no_prepend_cmd, |
| 1420 | NEIGHBOR_CMD2 "local-as <1-65535> no-prepend", |
| 1421 | NEIGHBOR_STR |
| 1422 | NEIGHBOR_ADDR_STR2 |
| 1423 | "Specify a local-as number\n" |
| 1424 | "AS number used as local AS\n" |
| 1425 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1426 | { |
| 1427 | struct peer *peer; |
| 1428 | int ret; |
| 1429 | |
| 1430 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1431 | if (! peer) |
| 1432 | return CMD_WARNING; |
| 1433 | |
| 1434 | ret = peer_local_as_set (peer, atoi (argv[1]), 1); |
| 1435 | return bgp_vty_return (vty, ret); |
| 1436 | } |
| 1437 | |
| 1438 | DEFUN (no_neighbor_local_as, |
| 1439 | no_neighbor_local_as_cmd, |
| 1440 | NO_NEIGHBOR_CMD2 "local-as", |
| 1441 | NO_STR |
| 1442 | NEIGHBOR_STR |
| 1443 | NEIGHBOR_ADDR_STR2 |
| 1444 | "Specify a local-as number\n") |
| 1445 | { |
| 1446 | struct peer *peer; |
| 1447 | int ret; |
| 1448 | |
| 1449 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1450 | if (! peer) |
| 1451 | return CMD_WARNING; |
| 1452 | |
| 1453 | ret = peer_local_as_unset (peer); |
| 1454 | return bgp_vty_return (vty, ret); |
| 1455 | } |
| 1456 | |
| 1457 | ALIAS (no_neighbor_local_as, |
| 1458 | no_neighbor_local_as_val_cmd, |
| 1459 | NO_NEIGHBOR_CMD2 "local-as <1-65535>", |
| 1460 | NO_STR |
| 1461 | NEIGHBOR_STR |
| 1462 | NEIGHBOR_ADDR_STR2 |
| 1463 | "Specify a local-as number\n" |
| 1464 | "AS number used as local AS\n") |
| 1465 | |
| 1466 | ALIAS (no_neighbor_local_as, |
| 1467 | no_neighbor_local_as_val2_cmd, |
| 1468 | NO_NEIGHBOR_CMD2 "local-as <1-65535> no-prepend", |
| 1469 | NO_STR |
| 1470 | NEIGHBOR_STR |
| 1471 | NEIGHBOR_ADDR_STR2 |
| 1472 | "Specify a local-as number\n" |
| 1473 | "AS number used as local AS\n" |
| 1474 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1475 | |
| 1476 | DEFUN (neighbor_activate, |
| 1477 | neighbor_activate_cmd, |
| 1478 | NEIGHBOR_CMD2 "activate", |
| 1479 | NEIGHBOR_STR |
| 1480 | NEIGHBOR_ADDR_STR2 |
| 1481 | "Enable the Address Family for this Neighbor\n") |
| 1482 | { |
| 1483 | struct peer *peer; |
| 1484 | |
| 1485 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1486 | if (! peer) |
| 1487 | return CMD_WARNING; |
| 1488 | |
| 1489 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1490 | |
| 1491 | return CMD_SUCCESS; |
| 1492 | } |
| 1493 | |
| 1494 | DEFUN (no_neighbor_activate, |
| 1495 | no_neighbor_activate_cmd, |
| 1496 | NO_NEIGHBOR_CMD2 "activate", |
| 1497 | NO_STR |
| 1498 | NEIGHBOR_STR |
| 1499 | NEIGHBOR_ADDR_STR2 |
| 1500 | "Enable the Address Family for this Neighbor\n") |
| 1501 | { |
| 1502 | int ret; |
| 1503 | struct peer *peer; |
| 1504 | |
| 1505 | /* Lookup peer. */ |
| 1506 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1507 | if (! peer) |
| 1508 | return CMD_WARNING; |
| 1509 | |
| 1510 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1511 | |
| 1512 | return bgp_vty_return (vty, ret); |
| 1513 | } |
| 1514 | |
| 1515 | DEFUN (neighbor_set_peer_group, |
| 1516 | neighbor_set_peer_group_cmd, |
| 1517 | NEIGHBOR_CMD "peer-group WORD", |
| 1518 | NEIGHBOR_STR |
| 1519 | NEIGHBOR_ADDR_STR |
| 1520 | "Member of the peer-group\n" |
| 1521 | "peer-group name\n") |
| 1522 | { |
| 1523 | int ret; |
| 1524 | as_t as; |
| 1525 | union sockunion su; |
| 1526 | struct bgp *bgp; |
| 1527 | struct peer_group *group; |
| 1528 | |
| 1529 | bgp = vty->index; |
| 1530 | |
| 1531 | ret = str2sockunion (argv[0], &su); |
| 1532 | if (ret < 0) |
| 1533 | { |
| 1534 | vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); |
| 1535 | return CMD_WARNING; |
| 1536 | } |
| 1537 | |
| 1538 | group = peer_group_lookup (bgp, argv[1]); |
| 1539 | if (! group) |
| 1540 | { |
| 1541 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1542 | return CMD_WARNING; |
| 1543 | } |
| 1544 | |
| 1545 | if (peer_address_self_check (&su)) |
| 1546 | { |
| 1547 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1548 | VTY_NEWLINE); |
| 1549 | return CMD_WARNING; |
| 1550 | } |
| 1551 | |
| 1552 | ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty), |
| 1553 | bgp_node_safi (vty), &as); |
| 1554 | |
| 1555 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) |
| 1556 | { |
| 1557 | 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); |
| 1558 | return CMD_WARNING; |
| 1559 | } |
| 1560 | |
| 1561 | return bgp_vty_return (vty, ret); |
| 1562 | } |
| 1563 | |
| 1564 | DEFUN (no_neighbor_set_peer_group, |
| 1565 | no_neighbor_set_peer_group_cmd, |
| 1566 | NO_NEIGHBOR_CMD "peer-group WORD", |
| 1567 | NO_STR |
| 1568 | NEIGHBOR_STR |
| 1569 | NEIGHBOR_ADDR_STR |
| 1570 | "Member of the peer-group\n" |
| 1571 | "peer-group name\n") |
| 1572 | { |
| 1573 | int ret; |
| 1574 | struct bgp *bgp; |
| 1575 | struct peer *peer; |
| 1576 | struct peer_group *group; |
| 1577 | |
| 1578 | bgp = vty->index; |
| 1579 | |
| 1580 | peer = peer_lookup_vty (vty, argv[0]); |
| 1581 | if (! peer) |
| 1582 | return CMD_WARNING; |
| 1583 | |
| 1584 | group = peer_group_lookup (bgp, argv[1]); |
| 1585 | if (! group) |
| 1586 | { |
| 1587 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1588 | return CMD_WARNING; |
| 1589 | } |
| 1590 | |
| 1591 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), |
| 1592 | bgp_node_safi (vty)); |
| 1593 | |
| 1594 | return bgp_vty_return (vty, ret); |
| 1595 | } |
| 1596 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1597 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1598 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
| 1599 | u_int16_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1600 | { |
| 1601 | int ret; |
| 1602 | struct peer *peer; |
| 1603 | |
| 1604 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 1605 | if (! peer) |
| 1606 | return CMD_WARNING; |
| 1607 | |
| 1608 | if (set) |
| 1609 | ret = peer_flag_set (peer, flag); |
| 1610 | else |
| 1611 | ret = peer_flag_unset (peer, flag); |
| 1612 | |
| 1613 | return bgp_vty_return (vty, ret); |
| 1614 | } |
| 1615 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1616 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1617 | 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] | 1618 | { |
| 1619 | return peer_flag_modify_vty (vty, ip_str, flag, 1); |
| 1620 | } |
| 1621 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1622 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1623 | 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] | 1624 | { |
| 1625 | return peer_flag_modify_vty (vty, ip_str, flag, 0); |
| 1626 | } |
| 1627 | |
| 1628 | /* neighbor passive. */ |
| 1629 | DEFUN (neighbor_passive, |
| 1630 | neighbor_passive_cmd, |
| 1631 | NEIGHBOR_CMD2 "passive", |
| 1632 | NEIGHBOR_STR |
| 1633 | NEIGHBOR_ADDR_STR2 |
| 1634 | "Don't send open messages to this neighbor\n") |
| 1635 | { |
| 1636 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1637 | } |
| 1638 | |
| 1639 | DEFUN (no_neighbor_passive, |
| 1640 | no_neighbor_passive_cmd, |
| 1641 | NO_NEIGHBOR_CMD2 "passive", |
| 1642 | NO_STR |
| 1643 | NEIGHBOR_STR |
| 1644 | NEIGHBOR_ADDR_STR2 |
| 1645 | "Don't send open messages to this neighbor\n") |
| 1646 | { |
| 1647 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1648 | } |
| 1649 | |
| 1650 | /* neighbor shutdown. */ |
| 1651 | DEFUN (neighbor_shutdown, |
| 1652 | neighbor_shutdown_cmd, |
| 1653 | NEIGHBOR_CMD2 "shutdown", |
| 1654 | NEIGHBOR_STR |
| 1655 | NEIGHBOR_ADDR_STR2 |
| 1656 | "Administratively shut down this neighbor\n") |
| 1657 | { |
| 1658 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1659 | } |
| 1660 | |
| 1661 | DEFUN (no_neighbor_shutdown, |
| 1662 | no_neighbor_shutdown_cmd, |
| 1663 | NO_NEIGHBOR_CMD2 "shutdown", |
| 1664 | NO_STR |
| 1665 | NEIGHBOR_STR |
| 1666 | NEIGHBOR_ADDR_STR2 |
| 1667 | "Administratively shut down this neighbor\n") |
| 1668 | { |
| 1669 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1670 | } |
| 1671 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1672 | /* Deprecated neighbor capability route-refresh. */ |
| 1673 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, |
| 1674 | neighbor_capability_route_refresh_cmd, |
| 1675 | NEIGHBOR_CMD2 "capability route-refresh", |
| 1676 | NEIGHBOR_STR |
| 1677 | NEIGHBOR_ADDR_STR2 |
| 1678 | "Advertise capability to the peer\n" |
| 1679 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1680 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1681 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1682 | } |
| 1683 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1684 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
| 1685 | no_neighbor_capability_route_refresh_cmd, |
| 1686 | NO_NEIGHBOR_CMD2 "capability route-refresh", |
| 1687 | NO_STR |
| 1688 | NEIGHBOR_STR |
| 1689 | NEIGHBOR_ADDR_STR2 |
| 1690 | "Advertise capability to the peer\n" |
| 1691 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1692 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1693 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1694 | } |
| 1695 | |
| 1696 | /* neighbor capability dynamic. */ |
| 1697 | DEFUN (neighbor_capability_dynamic, |
| 1698 | neighbor_capability_dynamic_cmd, |
| 1699 | NEIGHBOR_CMD2 "capability dynamic", |
| 1700 | NEIGHBOR_STR |
| 1701 | NEIGHBOR_ADDR_STR2 |
| 1702 | "Advertise capability to the peer\n" |
| 1703 | "Advertise dynamic capability to this neighbor\n") |
| 1704 | { |
| 1705 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1706 | } |
| 1707 | |
| 1708 | DEFUN (no_neighbor_capability_dynamic, |
| 1709 | no_neighbor_capability_dynamic_cmd, |
| 1710 | NO_NEIGHBOR_CMD2 "capability dynamic", |
| 1711 | NO_STR |
| 1712 | NEIGHBOR_STR |
| 1713 | NEIGHBOR_ADDR_STR2 |
| 1714 | "Advertise capability to the peer\n" |
| 1715 | "Advertise dynamic capability to this neighbor\n") |
| 1716 | { |
| 1717 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1718 | } |
| 1719 | |
| 1720 | /* neighbor dont-capability-negotiate */ |
| 1721 | DEFUN (neighbor_dont_capability_negotiate, |
| 1722 | neighbor_dont_capability_negotiate_cmd, |
| 1723 | NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1724 | NEIGHBOR_STR |
| 1725 | NEIGHBOR_ADDR_STR2 |
| 1726 | "Do not perform capability negotiation\n") |
| 1727 | { |
| 1728 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1729 | } |
| 1730 | |
| 1731 | DEFUN (no_neighbor_dont_capability_negotiate, |
| 1732 | no_neighbor_dont_capability_negotiate_cmd, |
| 1733 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1734 | NO_STR |
| 1735 | NEIGHBOR_STR |
| 1736 | NEIGHBOR_ADDR_STR2 |
| 1737 | "Do not perform capability negotiation\n") |
| 1738 | { |
| 1739 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1740 | } |
| 1741 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1742 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1743 | 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] | 1744 | safi_t safi, u_int32_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1745 | { |
| 1746 | int ret; |
| 1747 | struct peer *peer; |
| 1748 | |
| 1749 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 1750 | if (! peer) |
| 1751 | return CMD_WARNING; |
| 1752 | |
| 1753 | if (set) |
| 1754 | ret = peer_af_flag_set (peer, afi, safi, flag); |
| 1755 | else |
| 1756 | ret = peer_af_flag_unset (peer, afi, safi, flag); |
| 1757 | |
| 1758 | return bgp_vty_return (vty, ret); |
| 1759 | } |
| 1760 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1761 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1762 | 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] | 1763 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1764 | { |
| 1765 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); |
| 1766 | } |
| 1767 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1768 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1769 | 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] | 1770 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1771 | { |
| 1772 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); |
| 1773 | } |
| 1774 | |
| 1775 | /* neighbor capability orf prefix-list. */ |
| 1776 | DEFUN (neighbor_capability_orf_prefix, |
| 1777 | neighbor_capability_orf_prefix_cmd, |
| 1778 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 1779 | NEIGHBOR_STR |
| 1780 | NEIGHBOR_ADDR_STR2 |
| 1781 | "Advertise capability to the peer\n" |
| 1782 | "Advertise ORF capability to the peer\n" |
| 1783 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 1784 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 1785 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 1786 | "Capability to SEND the ORF to this neighbor\n") |
| 1787 | { |
| 1788 | u_int16_t flag = 0; |
| 1789 | |
| 1790 | if (strncmp (argv[1], "s", 1) == 0) |
| 1791 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 1792 | else if (strncmp (argv[1], "r", 1) == 0) |
| 1793 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 1794 | else if (strncmp (argv[1], "b", 1) == 0) |
| 1795 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 1796 | else |
| 1797 | return CMD_WARNING; |
| 1798 | |
| 1799 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1800 | bgp_node_safi (vty), flag); |
| 1801 | } |
| 1802 | |
| 1803 | DEFUN (no_neighbor_capability_orf_prefix, |
| 1804 | no_neighbor_capability_orf_prefix_cmd, |
| 1805 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 1806 | NO_STR |
| 1807 | NEIGHBOR_STR |
| 1808 | NEIGHBOR_ADDR_STR2 |
| 1809 | "Advertise capability to the peer\n" |
| 1810 | "Advertise ORF capability to the peer\n" |
| 1811 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 1812 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 1813 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 1814 | "Capability to SEND the ORF to this neighbor\n") |
| 1815 | { |
| 1816 | u_int16_t flag = 0; |
| 1817 | |
| 1818 | if (strncmp (argv[1], "s", 1) == 0) |
| 1819 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 1820 | else if (strncmp (argv[1], "r", 1) == 0) |
| 1821 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 1822 | else if (strncmp (argv[1], "b", 1) == 0) |
| 1823 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 1824 | else |
| 1825 | return CMD_WARNING; |
| 1826 | |
| 1827 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1828 | bgp_node_safi (vty), flag); |
| 1829 | } |
| 1830 | |
| 1831 | /* neighbor next-hop-self. */ |
| 1832 | DEFUN (neighbor_nexthop_self, |
| 1833 | neighbor_nexthop_self_cmd, |
| 1834 | NEIGHBOR_CMD2 "next-hop-self", |
| 1835 | NEIGHBOR_STR |
| 1836 | NEIGHBOR_ADDR_STR2 |
| 1837 | "Disable the next hop calculation for this neighbor\n") |
| 1838 | { |
| 1839 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1840 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 1841 | } |
| 1842 | |
| 1843 | DEFUN (no_neighbor_nexthop_self, |
| 1844 | no_neighbor_nexthop_self_cmd, |
| 1845 | NO_NEIGHBOR_CMD2 "next-hop-self", |
| 1846 | NO_STR |
| 1847 | NEIGHBOR_STR |
| 1848 | NEIGHBOR_ADDR_STR2 |
| 1849 | "Disable the next hop calculation for this neighbor\n") |
| 1850 | { |
| 1851 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1852 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 1853 | } |
| 1854 | |
| 1855 | /* neighbor remove-private-AS. */ |
| 1856 | DEFUN (neighbor_remove_private_as, |
| 1857 | neighbor_remove_private_as_cmd, |
| 1858 | NEIGHBOR_CMD2 "remove-private-AS", |
| 1859 | NEIGHBOR_STR |
| 1860 | NEIGHBOR_ADDR_STR2 |
| 1861 | "Remove private AS number from outbound updates\n") |
| 1862 | { |
| 1863 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1864 | bgp_node_safi (vty), |
| 1865 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 1866 | } |
| 1867 | |
| 1868 | DEFUN (no_neighbor_remove_private_as, |
| 1869 | no_neighbor_remove_private_as_cmd, |
| 1870 | NO_NEIGHBOR_CMD2 "remove-private-AS", |
| 1871 | NO_STR |
| 1872 | NEIGHBOR_STR |
| 1873 | NEIGHBOR_ADDR_STR2 |
| 1874 | "Remove private AS number from outbound updates\n") |
| 1875 | { |
| 1876 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1877 | bgp_node_safi (vty), |
| 1878 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 1879 | } |
| 1880 | |
| 1881 | /* neighbor send-community. */ |
| 1882 | DEFUN (neighbor_send_community, |
| 1883 | neighbor_send_community_cmd, |
| 1884 | NEIGHBOR_CMD2 "send-community", |
| 1885 | NEIGHBOR_STR |
| 1886 | NEIGHBOR_ADDR_STR2 |
| 1887 | "Send Community attribute to this neighbor\n") |
| 1888 | { |
| 1889 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1890 | bgp_node_safi (vty), |
| 1891 | PEER_FLAG_SEND_COMMUNITY); |
| 1892 | } |
| 1893 | |
| 1894 | DEFUN (no_neighbor_send_community, |
| 1895 | no_neighbor_send_community_cmd, |
| 1896 | NO_NEIGHBOR_CMD2 "send-community", |
| 1897 | NO_STR |
| 1898 | NEIGHBOR_STR |
| 1899 | NEIGHBOR_ADDR_STR2 |
| 1900 | "Send Community attribute to this neighbor\n") |
| 1901 | { |
| 1902 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1903 | bgp_node_safi (vty), |
| 1904 | PEER_FLAG_SEND_COMMUNITY); |
| 1905 | } |
| 1906 | |
| 1907 | /* neighbor send-community extended. */ |
| 1908 | DEFUN (neighbor_send_community_type, |
| 1909 | neighbor_send_community_type_cmd, |
| 1910 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 1911 | NEIGHBOR_STR |
| 1912 | NEIGHBOR_ADDR_STR2 |
| 1913 | "Send Community attribute to this neighbor\n" |
| 1914 | "Send Standard and Extended Community attributes\n" |
| 1915 | "Send Extended Community attributes\n" |
| 1916 | "Send Standard Community attributes\n") |
| 1917 | { |
| 1918 | if (strncmp (argv[1], "s", 1) == 0) |
| 1919 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1920 | bgp_node_safi (vty), |
| 1921 | PEER_FLAG_SEND_COMMUNITY); |
| 1922 | if (strncmp (argv[1], "e", 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_EXT_COMMUNITY); |
| 1926 | |
| 1927 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1928 | bgp_node_safi (vty), |
| 1929 | (PEER_FLAG_SEND_COMMUNITY| |
| 1930 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 1931 | } |
| 1932 | |
| 1933 | DEFUN (no_neighbor_send_community_type, |
| 1934 | no_neighbor_send_community_type_cmd, |
| 1935 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 1936 | NO_STR |
| 1937 | NEIGHBOR_STR |
| 1938 | NEIGHBOR_ADDR_STR2 |
| 1939 | "Send Community attribute to this neighbor\n" |
| 1940 | "Send Standard and Extended Community attributes\n" |
| 1941 | "Send Extended Community attributes\n" |
| 1942 | "Send Standard Community attributes\n") |
| 1943 | { |
| 1944 | if (strncmp (argv[1], "s", 1) == 0) |
| 1945 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1946 | bgp_node_safi (vty), |
| 1947 | PEER_FLAG_SEND_COMMUNITY); |
| 1948 | if (strncmp (argv[1], "e", 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_EXT_COMMUNITY); |
| 1952 | |
| 1953 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1954 | bgp_node_safi (vty), |
| 1955 | (PEER_FLAG_SEND_COMMUNITY | |
| 1956 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 1957 | } |
| 1958 | |
| 1959 | /* neighbor soft-reconfig. */ |
| 1960 | DEFUN (neighbor_soft_reconfiguration, |
| 1961 | neighbor_soft_reconfiguration_cmd, |
| 1962 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 1963 | NEIGHBOR_STR |
| 1964 | NEIGHBOR_ADDR_STR2 |
| 1965 | "Per neighbor soft reconfiguration\n" |
| 1966 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 1967 | { |
| 1968 | return peer_af_flag_set_vty (vty, argv[0], |
| 1969 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 1970 | PEER_FLAG_SOFT_RECONFIG); |
| 1971 | } |
| 1972 | |
| 1973 | DEFUN (no_neighbor_soft_reconfiguration, |
| 1974 | no_neighbor_soft_reconfiguration_cmd, |
| 1975 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 1976 | NO_STR |
| 1977 | NEIGHBOR_STR |
| 1978 | NEIGHBOR_ADDR_STR2 |
| 1979 | "Per neighbor soft reconfiguration\n" |
| 1980 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 1981 | { |
| 1982 | return peer_af_flag_unset_vty (vty, argv[0], |
| 1983 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 1984 | PEER_FLAG_SOFT_RECONFIG); |
| 1985 | } |
| 1986 | |
| 1987 | DEFUN (neighbor_route_reflector_client, |
| 1988 | neighbor_route_reflector_client_cmd, |
| 1989 | NEIGHBOR_CMD2 "route-reflector-client", |
| 1990 | NEIGHBOR_STR |
| 1991 | NEIGHBOR_ADDR_STR2 |
| 1992 | "Configure a neighbor as Route Reflector client\n") |
| 1993 | { |
| 1994 | struct peer *peer; |
| 1995 | |
| 1996 | |
| 1997 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1998 | if (! peer) |
| 1999 | return CMD_WARNING; |
| 2000 | |
| 2001 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2002 | bgp_node_safi (vty), |
| 2003 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2004 | } |
| 2005 | |
| 2006 | DEFUN (no_neighbor_route_reflector_client, |
| 2007 | no_neighbor_route_reflector_client_cmd, |
| 2008 | NO_NEIGHBOR_CMD2 "route-reflector-client", |
| 2009 | NO_STR |
| 2010 | NEIGHBOR_STR |
| 2011 | NEIGHBOR_ADDR_STR2 |
| 2012 | "Configure a neighbor as Route Reflector client\n") |
| 2013 | { |
| 2014 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2015 | bgp_node_safi (vty), |
| 2016 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2017 | } |
| 2018 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2019 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2020 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
| 2021 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2022 | { |
| 2023 | int ret; |
| 2024 | struct bgp *bgp; |
| 2025 | struct peer *peer; |
| 2026 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2027 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2028 | struct bgp_filter *pfilter; |
| 2029 | struct bgp_filter *gfilter; |
| 2030 | |
| 2031 | bgp = vty->index; |
| 2032 | |
| 2033 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2034 | if ( ! peer ) |
| 2035 | return CMD_WARNING; |
| 2036 | |
| 2037 | /* If it is already a RS-Client, don't do anything. */ |
| 2038 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2039 | return CMD_SUCCESS; |
| 2040 | |
| 2041 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2042 | { |
| 2043 | peer = peer_lock (peer); /* rsclient peer list reference */ |
| 2044 | listnode_add_sort (bgp->rsclient, peer); |
| 2045 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2046 | |
| 2047 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2048 | if (ret < 0) |
| 2049 | return bgp_vty_return (vty, ret); |
| 2050 | |
Paul Jakma | 64e580a | 2006-02-21 01:09:01 +0000 | [diff] [blame] | 2051 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2052 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
| 2053 | peer->rib[afi][safi]->owner = peer; |
| 2054 | |
| 2055 | /* Check for existing 'network' and 'redistribute' routes. */ |
| 2056 | bgp_check_local_routes_rsclient (peer, afi, safi); |
| 2057 | |
| 2058 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ |
| 2059 | bgp_soft_reconfig_rsclient (peer, afi, safi); |
| 2060 | |
| 2061 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2062 | { |
| 2063 | group = peer->group; |
| 2064 | gfilter = &peer->filter[afi][safi]; |
| 2065 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2066 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2067 | { |
| 2068 | pfilter = &peer->filter[afi][safi]; |
| 2069 | |
| 2070 | /* Members of a non-RS-Client group should not be RS-Clients, as that |
| 2071 | is checked when the become part of the peer-group */ |
| 2072 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2073 | if (ret < 0) |
| 2074 | return bgp_vty_return (vty, ret); |
| 2075 | |
| 2076 | /* Make peer's RIB point to group's RIB. */ |
| 2077 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; |
| 2078 | |
| 2079 | /* Import policy. */ |
| 2080 | if (pfilter->map[RMAP_IMPORT].name) |
| 2081 | free (pfilter->map[RMAP_IMPORT].name); |
| 2082 | if (gfilter->map[RMAP_IMPORT].name) |
| 2083 | { |
| 2084 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); |
| 2085 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; |
| 2086 | } |
| 2087 | else |
| 2088 | { |
| 2089 | pfilter->map[RMAP_IMPORT].name = NULL; |
| 2090 | pfilter->map[RMAP_IMPORT].map =NULL; |
| 2091 | } |
| 2092 | |
| 2093 | /* Export policy. */ |
| 2094 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) |
| 2095 | { |
| 2096 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); |
| 2097 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; |
| 2098 | } |
| 2099 | } |
| 2100 | } |
| 2101 | return CMD_SUCCESS; |
| 2102 | } |
| 2103 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2104 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2105 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
| 2106 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2107 | { |
| 2108 | int ret; |
| 2109 | struct bgp *bgp; |
| 2110 | struct peer *peer; |
| 2111 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2112 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2113 | |
| 2114 | bgp = vty->index; |
| 2115 | |
| 2116 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2117 | if ( ! peer ) |
| 2118 | return CMD_WARNING; |
| 2119 | |
| 2120 | /* If it is not a RS-Client, don't do anything. */ |
| 2121 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2122 | return CMD_SUCCESS; |
| 2123 | |
| 2124 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2125 | { |
| 2126 | group = peer->group; |
| 2127 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2128 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2129 | { |
| 2130 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2131 | if (ret < 0) |
| 2132 | return bgp_vty_return (vty, ret); |
| 2133 | |
| 2134 | peer->rib[afi][safi] = NULL; |
| 2135 | } |
| 2136 | |
| 2137 | peer = group->conf; |
| 2138 | } |
| 2139 | |
| 2140 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2141 | if (ret < 0) |
| 2142 | return bgp_vty_return (vty, ret); |
| 2143 | |
| 2144 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2145 | { |
| 2146 | peer_unlock (peer); /* peer bgp rsclient reference */ |
| 2147 | listnode_delete (bgp->rsclient, peer); |
| 2148 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2149 | |
| 2150 | bgp_table_finish (peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
| 2151 | |
| 2152 | return CMD_SUCCESS; |
| 2153 | } |
| 2154 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2155 | /* neighbor route-server-client. */ |
| 2156 | DEFUN (neighbor_route_server_client, |
| 2157 | neighbor_route_server_client_cmd, |
| 2158 | NEIGHBOR_CMD2 "route-server-client", |
| 2159 | NEIGHBOR_STR |
| 2160 | NEIGHBOR_ADDR_STR2 |
| 2161 | "Configure a neighbor as Route Server client\n") |
| 2162 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2163 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
| 2164 | bgp_node_safi(vty)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2165 | } |
| 2166 | |
| 2167 | DEFUN (no_neighbor_route_server_client, |
| 2168 | no_neighbor_route_server_client_cmd, |
| 2169 | NO_NEIGHBOR_CMD2 "route-server-client", |
| 2170 | NO_STR |
| 2171 | NEIGHBOR_STR |
| 2172 | NEIGHBOR_ADDR_STR2 |
| 2173 | "Configure a neighbor as Route Server client\n") |
| 2174 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2175 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), |
| 2176 | bgp_node_safi(vty)); |
| 2177 | } |
| 2178 | |
| 2179 | DEFUN (neighbor_nexthop_local_unchanged, |
| 2180 | neighbor_nexthop_local_unchanged_cmd, |
| 2181 | NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2182 | NEIGHBOR_STR |
| 2183 | NEIGHBOR_ADDR_STR2 |
| 2184 | "Configure treatment of outgoing link-local nexthop attribute\n" |
| 2185 | "Leave link-local nexthop unchanged for this peer\n") |
| 2186 | { |
| 2187 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2188 | bgp_node_safi (vty), |
| 2189 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
| 2190 | } |
| 2191 | |
| 2192 | DEFUN (no_neighbor_nexthop_local_unchanged, |
| 2193 | no_neighbor_nexthop_local_unchanged_cmd, |
| 2194 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2195 | NO_STR |
| 2196 | NEIGHBOR_STR |
| 2197 | NEIGHBOR_ADDR_STR2 |
| 2198 | "Configure treatment of outgoing link-local-nexthop attribute\n" |
| 2199 | "Leave link-local nexthop unchanged for this peer\n") |
| 2200 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2201 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2202 | bgp_node_safi (vty), |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2203 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2204 | } |
| 2205 | |
| 2206 | DEFUN (neighbor_attr_unchanged, |
| 2207 | neighbor_attr_unchanged_cmd, |
| 2208 | NEIGHBOR_CMD2 "attribute-unchanged", |
| 2209 | NEIGHBOR_STR |
| 2210 | NEIGHBOR_ADDR_STR2 |
| 2211 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2212 | { |
| 2213 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2214 | bgp_node_safi (vty), |
| 2215 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2216 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2217 | PEER_FLAG_MED_UNCHANGED)); |
| 2218 | } |
| 2219 | |
| 2220 | DEFUN (neighbor_attr_unchanged1, |
| 2221 | neighbor_attr_unchanged1_cmd, |
| 2222 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2223 | NEIGHBOR_STR |
| 2224 | NEIGHBOR_ADDR_STR2 |
| 2225 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2226 | "As-path attribute\n" |
| 2227 | "Nexthop attribute\n" |
| 2228 | "Med attribute\n") |
| 2229 | { |
| 2230 | u_int16_t flags = 0; |
| 2231 | |
| 2232 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2233 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2234 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2235 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2236 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2237 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2238 | |
| 2239 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2240 | bgp_node_safi (vty), flags); |
| 2241 | } |
| 2242 | |
| 2243 | DEFUN (neighbor_attr_unchanged2, |
| 2244 | neighbor_attr_unchanged2_cmd, |
| 2245 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2246 | NEIGHBOR_STR |
| 2247 | NEIGHBOR_ADDR_STR2 |
| 2248 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2249 | "As-path attribute\n" |
| 2250 | "Nexthop attribute\n" |
| 2251 | "Med attribute\n") |
| 2252 | { |
| 2253 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2254 | |
| 2255 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2256 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2257 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2258 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2259 | |
| 2260 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2261 | bgp_node_safi (vty), flags); |
| 2262 | |
| 2263 | } |
| 2264 | |
| 2265 | DEFUN (neighbor_attr_unchanged3, |
| 2266 | neighbor_attr_unchanged3_cmd, |
| 2267 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2268 | NEIGHBOR_STR |
| 2269 | NEIGHBOR_ADDR_STR2 |
| 2270 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2271 | "Nexthop attribute\n" |
| 2272 | "As-path attribute\n" |
| 2273 | "Med attribute\n") |
| 2274 | { |
| 2275 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2276 | |
| 2277 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2278 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2279 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2280 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2281 | |
| 2282 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2283 | bgp_node_safi (vty), flags); |
| 2284 | } |
| 2285 | |
| 2286 | DEFUN (neighbor_attr_unchanged4, |
| 2287 | neighbor_attr_unchanged4_cmd, |
| 2288 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2289 | NEIGHBOR_STR |
| 2290 | NEIGHBOR_ADDR_STR2 |
| 2291 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2292 | "Med attribute\n" |
| 2293 | "As-path attribute\n" |
| 2294 | "Nexthop attribute\n") |
| 2295 | { |
| 2296 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2297 | |
| 2298 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2299 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2300 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2301 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2302 | |
| 2303 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2304 | bgp_node_safi (vty), flags); |
| 2305 | } |
| 2306 | |
| 2307 | ALIAS (neighbor_attr_unchanged, |
| 2308 | neighbor_attr_unchanged5_cmd, |
| 2309 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2310 | NEIGHBOR_STR |
| 2311 | NEIGHBOR_ADDR_STR2 |
| 2312 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2313 | "As-path attribute\n" |
| 2314 | "Nexthop attribute\n" |
| 2315 | "Med attribute\n") |
| 2316 | |
| 2317 | ALIAS (neighbor_attr_unchanged, |
| 2318 | neighbor_attr_unchanged6_cmd, |
| 2319 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2320 | NEIGHBOR_STR |
| 2321 | NEIGHBOR_ADDR_STR2 |
| 2322 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2323 | "As-path attribute\n" |
| 2324 | "Med attribute\n" |
| 2325 | "Nexthop attribute\n") |
| 2326 | |
| 2327 | ALIAS (neighbor_attr_unchanged, |
| 2328 | neighbor_attr_unchanged7_cmd, |
| 2329 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2330 | NEIGHBOR_STR |
| 2331 | NEIGHBOR_ADDR_STR2 |
| 2332 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2333 | "Nexthop attribute\n" |
| 2334 | "Med attribute\n" |
| 2335 | "As-path attribute\n") |
| 2336 | |
| 2337 | ALIAS (neighbor_attr_unchanged, |
| 2338 | neighbor_attr_unchanged8_cmd, |
| 2339 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2340 | NEIGHBOR_STR |
| 2341 | NEIGHBOR_ADDR_STR2 |
| 2342 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2343 | "Nexthop attribute\n" |
| 2344 | "As-path attribute\n" |
| 2345 | "Med attribute\n") |
| 2346 | |
| 2347 | ALIAS (neighbor_attr_unchanged, |
| 2348 | neighbor_attr_unchanged9_cmd, |
| 2349 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2350 | NEIGHBOR_STR |
| 2351 | NEIGHBOR_ADDR_STR2 |
| 2352 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2353 | "Med attribute\n" |
| 2354 | "Nexthop attribute\n" |
| 2355 | "As-path attribute\n") |
| 2356 | |
| 2357 | ALIAS (neighbor_attr_unchanged, |
| 2358 | neighbor_attr_unchanged10_cmd, |
| 2359 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2360 | NEIGHBOR_STR |
| 2361 | NEIGHBOR_ADDR_STR2 |
| 2362 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2363 | "Med attribute\n" |
| 2364 | "As-path attribute\n" |
| 2365 | "Nexthop attribute\n") |
| 2366 | |
| 2367 | DEFUN (no_neighbor_attr_unchanged, |
| 2368 | no_neighbor_attr_unchanged_cmd, |
| 2369 | NO_NEIGHBOR_CMD2 "attribute-unchanged", |
| 2370 | NO_STR |
| 2371 | NEIGHBOR_STR |
| 2372 | NEIGHBOR_ADDR_STR2 |
| 2373 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2374 | { |
| 2375 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2376 | bgp_node_safi (vty), |
| 2377 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2378 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2379 | PEER_FLAG_MED_UNCHANGED)); |
| 2380 | } |
| 2381 | |
| 2382 | DEFUN (no_neighbor_attr_unchanged1, |
| 2383 | no_neighbor_attr_unchanged1_cmd, |
| 2384 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2385 | NO_STR |
| 2386 | NEIGHBOR_STR |
| 2387 | NEIGHBOR_ADDR_STR2 |
| 2388 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2389 | "As-path attribute\n" |
| 2390 | "Nexthop attribute\n" |
| 2391 | "Med attribute\n") |
| 2392 | { |
| 2393 | u_int16_t flags = 0; |
| 2394 | |
| 2395 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2396 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2397 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2398 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2399 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2400 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2401 | |
| 2402 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2403 | bgp_node_safi (vty), flags); |
| 2404 | } |
| 2405 | |
| 2406 | DEFUN (no_neighbor_attr_unchanged2, |
| 2407 | no_neighbor_attr_unchanged2_cmd, |
| 2408 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2409 | NO_STR |
| 2410 | NEIGHBOR_STR |
| 2411 | NEIGHBOR_ADDR_STR2 |
| 2412 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2413 | "As-path attribute\n" |
| 2414 | "Nexthop attribute\n" |
| 2415 | "Med attribute\n") |
| 2416 | { |
| 2417 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2418 | |
| 2419 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2420 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2421 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2422 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2423 | |
| 2424 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2425 | bgp_node_safi (vty), flags); |
| 2426 | } |
| 2427 | |
| 2428 | DEFUN (no_neighbor_attr_unchanged3, |
| 2429 | no_neighbor_attr_unchanged3_cmd, |
| 2430 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2431 | NO_STR |
| 2432 | NEIGHBOR_STR |
| 2433 | NEIGHBOR_ADDR_STR2 |
| 2434 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2435 | "Nexthop attribute\n" |
| 2436 | "As-path attribute\n" |
| 2437 | "Med attribute\n") |
| 2438 | { |
| 2439 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2440 | |
| 2441 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2442 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2443 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2444 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2445 | |
| 2446 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2447 | bgp_node_safi (vty), flags); |
| 2448 | } |
| 2449 | |
| 2450 | DEFUN (no_neighbor_attr_unchanged4, |
| 2451 | no_neighbor_attr_unchanged4_cmd, |
| 2452 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2453 | NO_STR |
| 2454 | NEIGHBOR_STR |
| 2455 | NEIGHBOR_ADDR_STR2 |
| 2456 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2457 | "Med attribute\n" |
| 2458 | "As-path attribute\n" |
| 2459 | "Nexthop attribute\n") |
| 2460 | { |
| 2461 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2462 | |
| 2463 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2464 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2465 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2466 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2467 | |
| 2468 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2469 | bgp_node_safi (vty), flags); |
| 2470 | } |
| 2471 | |
| 2472 | ALIAS (no_neighbor_attr_unchanged, |
| 2473 | no_neighbor_attr_unchanged5_cmd, |
| 2474 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2475 | NO_STR |
| 2476 | NEIGHBOR_STR |
| 2477 | NEIGHBOR_ADDR_STR2 |
| 2478 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2479 | "As-path attribute\n" |
| 2480 | "Nexthop attribute\n" |
| 2481 | "Med attribute\n") |
| 2482 | |
| 2483 | ALIAS (no_neighbor_attr_unchanged, |
| 2484 | no_neighbor_attr_unchanged6_cmd, |
| 2485 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2486 | NO_STR |
| 2487 | NEIGHBOR_STR |
| 2488 | NEIGHBOR_ADDR_STR2 |
| 2489 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2490 | "As-path attribute\n" |
| 2491 | "Med attribute\n" |
| 2492 | "Nexthop attribute\n") |
| 2493 | |
| 2494 | ALIAS (no_neighbor_attr_unchanged, |
| 2495 | no_neighbor_attr_unchanged7_cmd, |
| 2496 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2497 | NO_STR |
| 2498 | NEIGHBOR_STR |
| 2499 | NEIGHBOR_ADDR_STR2 |
| 2500 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2501 | "Nexthop attribute\n" |
| 2502 | "Med attribute\n" |
| 2503 | "As-path attribute\n") |
| 2504 | |
| 2505 | ALIAS (no_neighbor_attr_unchanged, |
| 2506 | no_neighbor_attr_unchanged8_cmd, |
| 2507 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2508 | NO_STR |
| 2509 | NEIGHBOR_STR |
| 2510 | NEIGHBOR_ADDR_STR2 |
| 2511 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2512 | "Nexthop attribute\n" |
| 2513 | "As-path attribute\n" |
| 2514 | "Med attribute\n") |
| 2515 | |
| 2516 | ALIAS (no_neighbor_attr_unchanged, |
| 2517 | no_neighbor_attr_unchanged9_cmd, |
| 2518 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2519 | NO_STR |
| 2520 | NEIGHBOR_STR |
| 2521 | NEIGHBOR_ADDR_STR2 |
| 2522 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2523 | "Med attribute\n" |
| 2524 | "Nexthop attribute\n" |
| 2525 | "As-path attribute\n") |
| 2526 | |
| 2527 | ALIAS (no_neighbor_attr_unchanged, |
| 2528 | no_neighbor_attr_unchanged10_cmd, |
| 2529 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2530 | NO_STR |
| 2531 | NEIGHBOR_STR |
| 2532 | NEIGHBOR_ADDR_STR2 |
| 2533 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2534 | "Med attribute\n" |
| 2535 | "As-path attribute\n" |
| 2536 | "Nexthop attribute\n") |
| 2537 | |
| 2538 | /* For old version Zebra compatibility. */ |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2539 | DEFUN_DEPRECATED (neighbor_transparent_as, |
| 2540 | neighbor_transparent_as_cmd, |
| 2541 | NEIGHBOR_CMD "transparent-as", |
| 2542 | NEIGHBOR_STR |
| 2543 | NEIGHBOR_ADDR_STR |
| 2544 | "Do not append my AS number even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2545 | { |
| 2546 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2547 | bgp_node_safi (vty), |
| 2548 | PEER_FLAG_AS_PATH_UNCHANGED); |
| 2549 | } |
| 2550 | |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2551 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
| 2552 | neighbor_transparent_nexthop_cmd, |
| 2553 | NEIGHBOR_CMD "transparent-nexthop", |
| 2554 | NEIGHBOR_STR |
| 2555 | NEIGHBOR_ADDR_STR |
| 2556 | "Do not change nexthop even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2557 | { |
| 2558 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2559 | bgp_node_safi (vty), |
| 2560 | PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2561 | } |
| 2562 | |
| 2563 | /* EBGP multihop configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2564 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2565 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
| 2566 | const char *ttl_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2567 | { |
| 2568 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2569 | unsigned int ttl; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2570 | |
| 2571 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2572 | if (! peer) |
| 2573 | return CMD_WARNING; |
| 2574 | |
| 2575 | if (! ttl_str) |
| 2576 | ttl = TTL_MAX; |
| 2577 | else |
| 2578 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); |
| 2579 | |
| 2580 | peer_ebgp_multihop_set (peer, ttl); |
| 2581 | |
| 2582 | return CMD_SUCCESS; |
| 2583 | } |
| 2584 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2585 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2586 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2587 | { |
| 2588 | struct peer *peer; |
| 2589 | |
| 2590 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2591 | if (! peer) |
| 2592 | return CMD_WARNING; |
| 2593 | |
| 2594 | peer_ebgp_multihop_unset (peer); |
| 2595 | |
| 2596 | return CMD_SUCCESS; |
| 2597 | } |
| 2598 | |
| 2599 | /* neighbor ebgp-multihop. */ |
| 2600 | DEFUN (neighbor_ebgp_multihop, |
| 2601 | neighbor_ebgp_multihop_cmd, |
| 2602 | NEIGHBOR_CMD2 "ebgp-multihop", |
| 2603 | NEIGHBOR_STR |
| 2604 | NEIGHBOR_ADDR_STR2 |
| 2605 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2606 | { |
| 2607 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); |
| 2608 | } |
| 2609 | |
| 2610 | DEFUN (neighbor_ebgp_multihop_ttl, |
| 2611 | neighbor_ebgp_multihop_ttl_cmd, |
| 2612 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2613 | NEIGHBOR_STR |
| 2614 | NEIGHBOR_ADDR_STR2 |
| 2615 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2616 | "maximum hop count\n") |
| 2617 | { |
| 2618 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); |
| 2619 | } |
| 2620 | |
| 2621 | DEFUN (no_neighbor_ebgp_multihop, |
| 2622 | no_neighbor_ebgp_multihop_cmd, |
| 2623 | NO_NEIGHBOR_CMD2 "ebgp-multihop", |
| 2624 | NO_STR |
| 2625 | NEIGHBOR_STR |
| 2626 | NEIGHBOR_ADDR_STR2 |
| 2627 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2628 | { |
| 2629 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); |
| 2630 | } |
| 2631 | |
| 2632 | ALIAS (no_neighbor_ebgp_multihop, |
| 2633 | no_neighbor_ebgp_multihop_ttl_cmd, |
| 2634 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2635 | NO_STR |
| 2636 | NEIGHBOR_STR |
| 2637 | NEIGHBOR_ADDR_STR2 |
| 2638 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2639 | "maximum hop count\n") |
| 2640 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2641 | /* disable-connected-check */ |
| 2642 | DEFUN (neighbor_disable_connected_check, |
| 2643 | neighbor_disable_connected_check_cmd, |
| 2644 | NEIGHBOR_CMD2 "disable-connected-check", |
| 2645 | NEIGHBOR_STR |
| 2646 | NEIGHBOR_ADDR_STR2 |
| 2647 | "one-hop away EBGP peer using loopback address\n") |
| 2648 | { |
| 2649 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2650 | } |
| 2651 | |
| 2652 | DEFUN (no_neighbor_disable_connected_check, |
| 2653 | no_neighbor_disable_connected_check_cmd, |
| 2654 | NO_NEIGHBOR_CMD2 "disable-connected-check", |
| 2655 | NO_STR |
| 2656 | NEIGHBOR_STR |
| 2657 | NEIGHBOR_ADDR_STR2 |
| 2658 | "one-hop away EBGP peer using loopback address\n") |
| 2659 | { |
| 2660 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2661 | } |
| 2662 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2663 | /* Enforce multihop. */ |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2664 | ALIAS (neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2665 | neighbor_enforce_multihop_cmd, |
| 2666 | NEIGHBOR_CMD2 "enforce-multihop", |
| 2667 | NEIGHBOR_STR |
| 2668 | NEIGHBOR_ADDR_STR2 |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 2669 | "Enforce EBGP neighbors perform multihop\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2670 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2671 | /* Enforce multihop. */ |
| 2672 | ALIAS (no_neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2673 | no_neighbor_enforce_multihop_cmd, |
| 2674 | NO_NEIGHBOR_CMD2 "enforce-multihop", |
| 2675 | NO_STR |
| 2676 | NEIGHBOR_STR |
| 2677 | NEIGHBOR_ADDR_STR2 |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 2678 | "Enforce EBGP neighbors perform multihop\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2679 | |
| 2680 | DEFUN (neighbor_description, |
| 2681 | neighbor_description_cmd, |
| 2682 | NEIGHBOR_CMD2 "description .LINE", |
| 2683 | NEIGHBOR_STR |
| 2684 | NEIGHBOR_ADDR_STR2 |
| 2685 | "Neighbor specific description\n" |
| 2686 | "Up to 80 characters describing this neighbor\n") |
| 2687 | { |
| 2688 | struct peer *peer; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2689 | char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2690 | |
| 2691 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2692 | if (! peer) |
| 2693 | return CMD_WARNING; |
| 2694 | |
| 2695 | if (argc == 1) |
| 2696 | return CMD_SUCCESS; |
| 2697 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2698 | str = argv_concat(argv, argc, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2699 | |
| 2700 | peer_description_set (peer, str); |
| 2701 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2702 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2703 | |
| 2704 | return CMD_SUCCESS; |
| 2705 | } |
| 2706 | |
| 2707 | DEFUN (no_neighbor_description, |
| 2708 | no_neighbor_description_cmd, |
| 2709 | NO_NEIGHBOR_CMD2 "description", |
| 2710 | NO_STR |
| 2711 | NEIGHBOR_STR |
| 2712 | NEIGHBOR_ADDR_STR2 |
| 2713 | "Neighbor specific description\n") |
| 2714 | { |
| 2715 | struct peer *peer; |
| 2716 | |
| 2717 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2718 | if (! peer) |
| 2719 | return CMD_WARNING; |
| 2720 | |
| 2721 | peer_description_unset (peer); |
| 2722 | |
| 2723 | return CMD_SUCCESS; |
| 2724 | } |
| 2725 | |
| 2726 | ALIAS (no_neighbor_description, |
| 2727 | no_neighbor_description_val_cmd, |
| 2728 | NO_NEIGHBOR_CMD2 "description .LINE", |
| 2729 | NO_STR |
| 2730 | NEIGHBOR_STR |
| 2731 | NEIGHBOR_ADDR_STR2 |
| 2732 | "Neighbor specific description\n" |
| 2733 | "Up to 80 characters describing this neighbor\n") |
| 2734 | |
| 2735 | /* Neighbor update-source. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2736 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2737 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
| 2738 | const char *source_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2739 | { |
| 2740 | struct peer *peer; |
| 2741 | union sockunion *su; |
| 2742 | |
| 2743 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2744 | if (! peer) |
| 2745 | return CMD_WARNING; |
| 2746 | |
| 2747 | if (source_str) |
| 2748 | { |
| 2749 | su = sockunion_str2su (source_str); |
| 2750 | if (su) |
| 2751 | { |
| 2752 | peer_update_source_addr_set (peer, su); |
| 2753 | sockunion_free (su); |
| 2754 | } |
| 2755 | else |
| 2756 | peer_update_source_if_set (peer, source_str); |
| 2757 | } |
| 2758 | else |
| 2759 | peer_update_source_unset (peer); |
| 2760 | |
| 2761 | return CMD_SUCCESS; |
| 2762 | } |
| 2763 | |
| 2764 | DEFUN (neighbor_update_source, |
| 2765 | neighbor_update_source_cmd, |
| 2766 | NEIGHBOR_CMD2 "update-source WORD", |
| 2767 | NEIGHBOR_STR |
| 2768 | NEIGHBOR_ADDR_STR2 |
| 2769 | "Source of routing updates\n" |
| 2770 | "Interface name\n") |
| 2771 | { |
| 2772 | return peer_update_source_vty (vty, argv[0], argv[1]); |
| 2773 | } |
| 2774 | |
| 2775 | DEFUN (no_neighbor_update_source, |
| 2776 | no_neighbor_update_source_cmd, |
| 2777 | NO_NEIGHBOR_CMD2 "update-source", |
| 2778 | NO_STR |
| 2779 | NEIGHBOR_STR |
| 2780 | NEIGHBOR_ADDR_STR2 |
| 2781 | "Source of routing updates\n" |
| 2782 | "Interface name\n") |
| 2783 | { |
| 2784 | return peer_update_source_vty (vty, argv[0], NULL); |
| 2785 | } |
| 2786 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2787 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2788 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
| 2789 | afi_t afi, safi_t safi, |
| 2790 | const char *rmap, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2791 | { |
| 2792 | int ret; |
| 2793 | struct peer *peer; |
| 2794 | |
| 2795 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2796 | if (! peer) |
| 2797 | return CMD_WARNING; |
| 2798 | |
| 2799 | if (set) |
| 2800 | ret = peer_default_originate_set (peer, afi, safi, rmap); |
| 2801 | else |
| 2802 | ret = peer_default_originate_unset (peer, afi, safi); |
| 2803 | |
| 2804 | return bgp_vty_return (vty, ret); |
| 2805 | } |
| 2806 | |
| 2807 | /* neighbor default-originate. */ |
| 2808 | DEFUN (neighbor_default_originate, |
| 2809 | neighbor_default_originate_cmd, |
| 2810 | NEIGHBOR_CMD2 "default-originate", |
| 2811 | NEIGHBOR_STR |
| 2812 | NEIGHBOR_ADDR_STR2 |
| 2813 | "Originate default route to this neighbor\n") |
| 2814 | { |
| 2815 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2816 | bgp_node_safi (vty), NULL, 1); |
| 2817 | } |
| 2818 | |
| 2819 | DEFUN (neighbor_default_originate_rmap, |
| 2820 | neighbor_default_originate_rmap_cmd, |
| 2821 | NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 2822 | NEIGHBOR_STR |
| 2823 | NEIGHBOR_ADDR_STR2 |
| 2824 | "Originate default route to this neighbor\n" |
| 2825 | "Route-map to specify criteria to originate default\n" |
| 2826 | "route-map name\n") |
| 2827 | { |
| 2828 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2829 | bgp_node_safi (vty), argv[1], 1); |
| 2830 | } |
| 2831 | |
| 2832 | DEFUN (no_neighbor_default_originate, |
| 2833 | no_neighbor_default_originate_cmd, |
| 2834 | NO_NEIGHBOR_CMD2 "default-originate", |
| 2835 | NO_STR |
| 2836 | NEIGHBOR_STR |
| 2837 | NEIGHBOR_ADDR_STR2 |
| 2838 | "Originate default route to this neighbor\n") |
| 2839 | { |
| 2840 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2841 | bgp_node_safi (vty), NULL, 0); |
| 2842 | } |
| 2843 | |
| 2844 | ALIAS (no_neighbor_default_originate, |
| 2845 | no_neighbor_default_originate_rmap_cmd, |
| 2846 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 2847 | NO_STR |
| 2848 | NEIGHBOR_STR |
| 2849 | NEIGHBOR_ADDR_STR2 |
| 2850 | "Originate default route to this neighbor\n" |
| 2851 | "Route-map to specify criteria to originate default\n" |
| 2852 | "route-map name\n") |
| 2853 | |
| 2854 | /* Set neighbor's BGP port. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2855 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2856 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
| 2857 | const char *port_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2858 | { |
| 2859 | struct peer *peer; |
| 2860 | u_int16_t port; |
| 2861 | struct servent *sp; |
| 2862 | |
| 2863 | peer = peer_lookup_vty (vty, ip_str); |
| 2864 | if (! peer) |
| 2865 | return CMD_WARNING; |
| 2866 | |
| 2867 | if (! port_str) |
| 2868 | { |
| 2869 | sp = getservbyname ("bgp", "tcp"); |
| 2870 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); |
| 2871 | } |
| 2872 | else |
| 2873 | { |
| 2874 | VTY_GET_INTEGER("port", port, port_str); |
| 2875 | } |
| 2876 | |
| 2877 | peer_port_set (peer, port); |
| 2878 | |
| 2879 | return CMD_SUCCESS; |
| 2880 | } |
| 2881 | |
hasso | f418446 | 2005-02-01 20:13:16 +0000 | [diff] [blame] | 2882 | /* Set specified peer's BGP port. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2883 | DEFUN (neighbor_port, |
| 2884 | neighbor_port_cmd, |
| 2885 | NEIGHBOR_CMD "port <0-65535>", |
| 2886 | NEIGHBOR_STR |
| 2887 | NEIGHBOR_ADDR_STR |
| 2888 | "Neighbor's BGP port\n" |
| 2889 | "TCP port number\n") |
| 2890 | { |
| 2891 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); |
| 2892 | } |
| 2893 | |
| 2894 | DEFUN (no_neighbor_port, |
| 2895 | no_neighbor_port_cmd, |
| 2896 | NO_NEIGHBOR_CMD "port", |
| 2897 | NO_STR |
| 2898 | NEIGHBOR_STR |
| 2899 | NEIGHBOR_ADDR_STR |
| 2900 | "Neighbor's BGP port\n") |
| 2901 | { |
| 2902 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); |
| 2903 | } |
| 2904 | |
| 2905 | ALIAS (no_neighbor_port, |
| 2906 | no_neighbor_port_val_cmd, |
| 2907 | NO_NEIGHBOR_CMD "port <0-65535>", |
| 2908 | NO_STR |
| 2909 | NEIGHBOR_STR |
| 2910 | NEIGHBOR_ADDR_STR |
| 2911 | "Neighbor's BGP port\n" |
| 2912 | "TCP port number\n") |
| 2913 | |
| 2914 | /* neighbor weight. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2915 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2916 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
| 2917 | const char *weight_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2918 | { |
| 2919 | int ret; |
| 2920 | struct peer *peer; |
| 2921 | unsigned long weight; |
| 2922 | |
| 2923 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2924 | if (! peer) |
| 2925 | return CMD_WARNING; |
| 2926 | |
| 2927 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); |
| 2928 | |
| 2929 | ret = peer_weight_set (peer, weight); |
| 2930 | |
| 2931 | return CMD_SUCCESS; |
| 2932 | } |
| 2933 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2934 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2935 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2936 | { |
| 2937 | struct peer *peer; |
| 2938 | |
| 2939 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2940 | if (! peer) |
| 2941 | return CMD_WARNING; |
| 2942 | |
| 2943 | peer_weight_unset (peer); |
| 2944 | |
| 2945 | return CMD_SUCCESS; |
| 2946 | } |
| 2947 | |
| 2948 | DEFUN (neighbor_weight, |
| 2949 | neighbor_weight_cmd, |
| 2950 | NEIGHBOR_CMD2 "weight <0-65535>", |
| 2951 | NEIGHBOR_STR |
| 2952 | NEIGHBOR_ADDR_STR2 |
| 2953 | "Set default weight for routes from this neighbor\n" |
| 2954 | "default weight\n") |
| 2955 | { |
| 2956 | return peer_weight_set_vty (vty, argv[0], argv[1]); |
| 2957 | } |
| 2958 | |
| 2959 | DEFUN (no_neighbor_weight, |
| 2960 | no_neighbor_weight_cmd, |
| 2961 | NO_NEIGHBOR_CMD2 "weight", |
| 2962 | NO_STR |
| 2963 | NEIGHBOR_STR |
| 2964 | NEIGHBOR_ADDR_STR2 |
| 2965 | "Set default weight for routes from this neighbor\n") |
| 2966 | { |
| 2967 | return peer_weight_unset_vty (vty, argv[0]); |
| 2968 | } |
| 2969 | |
| 2970 | ALIAS (no_neighbor_weight, |
| 2971 | no_neighbor_weight_val_cmd, |
| 2972 | NO_NEIGHBOR_CMD2 "weight <0-65535>", |
| 2973 | NO_STR |
| 2974 | NEIGHBOR_STR |
| 2975 | NEIGHBOR_ADDR_STR2 |
| 2976 | "Set default weight for routes from this neighbor\n" |
| 2977 | "default weight\n") |
| 2978 | |
| 2979 | /* Override capability negotiation. */ |
| 2980 | DEFUN (neighbor_override_capability, |
| 2981 | neighbor_override_capability_cmd, |
| 2982 | NEIGHBOR_CMD2 "override-capability", |
| 2983 | NEIGHBOR_STR |
| 2984 | NEIGHBOR_ADDR_STR2 |
| 2985 | "Override capability negotiation result\n") |
| 2986 | { |
| 2987 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 2988 | } |
| 2989 | |
| 2990 | DEFUN (no_neighbor_override_capability, |
| 2991 | no_neighbor_override_capability_cmd, |
| 2992 | NO_NEIGHBOR_CMD2 "override-capability", |
| 2993 | NO_STR |
| 2994 | NEIGHBOR_STR |
| 2995 | NEIGHBOR_ADDR_STR2 |
| 2996 | "Override capability negotiation result\n") |
| 2997 | { |
| 2998 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 2999 | } |
| 3000 | |
| 3001 | DEFUN (neighbor_strict_capability, |
| 3002 | neighbor_strict_capability_cmd, |
| 3003 | NEIGHBOR_CMD "strict-capability-match", |
| 3004 | NEIGHBOR_STR |
| 3005 | NEIGHBOR_ADDR_STR |
| 3006 | "Strict capability negotiation match\n") |
| 3007 | { |
| 3008 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3009 | } |
| 3010 | |
| 3011 | DEFUN (no_neighbor_strict_capability, |
| 3012 | no_neighbor_strict_capability_cmd, |
| 3013 | NO_NEIGHBOR_CMD "strict-capability-match", |
| 3014 | NO_STR |
| 3015 | NEIGHBOR_STR |
| 3016 | NEIGHBOR_ADDR_STR |
| 3017 | "Strict capability negotiation match\n") |
| 3018 | { |
| 3019 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3020 | } |
| 3021 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3022 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3023 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
| 3024 | const char *keep_str, const char *hold_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3025 | { |
| 3026 | int ret; |
| 3027 | struct peer *peer; |
| 3028 | u_int32_t keepalive; |
| 3029 | u_int32_t holdtime; |
| 3030 | |
| 3031 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3032 | if (! peer) |
| 3033 | return CMD_WARNING; |
| 3034 | |
| 3035 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); |
| 3036 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); |
| 3037 | |
| 3038 | ret = peer_timers_set (peer, keepalive, holdtime); |
| 3039 | |
| 3040 | return bgp_vty_return (vty, ret); |
| 3041 | } |
| 3042 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3043 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3044 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3045 | { |
| 3046 | int ret; |
| 3047 | struct peer *peer; |
| 3048 | |
| 3049 | peer = peer_lookup_vty (vty, ip_str); |
| 3050 | if (! peer) |
| 3051 | return CMD_WARNING; |
| 3052 | |
| 3053 | ret = peer_timers_unset (peer); |
| 3054 | |
| 3055 | return bgp_vty_return (vty, ret); |
| 3056 | } |
| 3057 | |
| 3058 | DEFUN (neighbor_timers, |
| 3059 | neighbor_timers_cmd, |
| 3060 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", |
| 3061 | NEIGHBOR_STR |
| 3062 | NEIGHBOR_ADDR_STR2 |
| 3063 | "BGP per neighbor timers\n" |
| 3064 | "Keepalive interval\n" |
| 3065 | "Holdtime\n") |
| 3066 | { |
| 3067 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); |
| 3068 | } |
| 3069 | |
| 3070 | DEFUN (no_neighbor_timers, |
| 3071 | no_neighbor_timers_cmd, |
| 3072 | NO_NEIGHBOR_CMD2 "timers", |
| 3073 | NO_STR |
| 3074 | NEIGHBOR_STR |
| 3075 | NEIGHBOR_ADDR_STR2 |
| 3076 | "BGP per neighbor timers\n") |
| 3077 | { |
| 3078 | return peer_timers_unset_vty (vty, argv[0]); |
| 3079 | } |
| 3080 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3081 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3082 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
| 3083 | const char *time_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3084 | { |
| 3085 | int ret; |
| 3086 | struct peer *peer; |
| 3087 | u_int32_t connect; |
| 3088 | |
| 3089 | peer = peer_lookup_vty (vty, ip_str); |
| 3090 | if (! peer) |
| 3091 | return CMD_WARNING; |
| 3092 | |
| 3093 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); |
| 3094 | |
| 3095 | ret = peer_timers_connect_set (peer, connect); |
| 3096 | |
| 3097 | return CMD_SUCCESS; |
| 3098 | } |
| 3099 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3100 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3101 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3102 | { |
| 3103 | int ret; |
| 3104 | struct peer *peer; |
| 3105 | |
| 3106 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3107 | if (! peer) |
| 3108 | return CMD_WARNING; |
| 3109 | |
| 3110 | ret = peer_timers_connect_unset (peer); |
| 3111 | |
| 3112 | return CMD_SUCCESS; |
| 3113 | } |
| 3114 | |
| 3115 | DEFUN (neighbor_timers_connect, |
| 3116 | neighbor_timers_connect_cmd, |
| 3117 | NEIGHBOR_CMD "timers connect <0-65535>", |
| 3118 | NEIGHBOR_STR |
| 3119 | NEIGHBOR_ADDR_STR |
| 3120 | "BGP per neighbor timers\n" |
| 3121 | "BGP connect timer\n" |
| 3122 | "Connect timer\n") |
| 3123 | { |
| 3124 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); |
| 3125 | } |
| 3126 | |
| 3127 | DEFUN (no_neighbor_timers_connect, |
| 3128 | no_neighbor_timers_connect_cmd, |
| 3129 | NO_NEIGHBOR_CMD "timers connect", |
| 3130 | NO_STR |
| 3131 | NEIGHBOR_STR |
| 3132 | NEIGHBOR_ADDR_STR |
| 3133 | "BGP per neighbor timers\n" |
| 3134 | "BGP connect timer\n") |
| 3135 | { |
| 3136 | return peer_timers_connect_unset_vty (vty, argv[0]); |
| 3137 | } |
| 3138 | |
| 3139 | ALIAS (no_neighbor_timers_connect, |
| 3140 | no_neighbor_timers_connect_val_cmd, |
| 3141 | NO_NEIGHBOR_CMD "timers connect <0-65535>", |
| 3142 | NO_STR |
| 3143 | NEIGHBOR_STR |
| 3144 | NEIGHBOR_ADDR_STR |
| 3145 | "BGP per neighbor timers\n" |
| 3146 | "BGP connect timer\n" |
| 3147 | "Connect timer\n") |
| 3148 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3149 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3150 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
| 3151 | const char *time_str, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3152 | { |
| 3153 | int ret; |
| 3154 | struct peer *peer; |
| 3155 | u_int32_t routeadv = 0; |
| 3156 | |
| 3157 | peer = peer_lookup_vty (vty, ip_str); |
| 3158 | if (! peer) |
| 3159 | return CMD_WARNING; |
| 3160 | |
| 3161 | if (time_str) |
| 3162 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); |
| 3163 | |
| 3164 | if (set) |
| 3165 | ret = peer_advertise_interval_set (peer, routeadv); |
| 3166 | else |
| 3167 | ret = peer_advertise_interval_unset (peer); |
| 3168 | |
| 3169 | return CMD_SUCCESS; |
| 3170 | } |
| 3171 | |
| 3172 | DEFUN (neighbor_advertise_interval, |
| 3173 | neighbor_advertise_interval_cmd, |
| 3174 | NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3175 | NEIGHBOR_STR |
| 3176 | NEIGHBOR_ADDR_STR |
| 3177 | "Minimum interval between sending BGP routing updates\n" |
| 3178 | "time in seconds\n") |
| 3179 | { |
| 3180 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); |
| 3181 | } |
| 3182 | |
| 3183 | DEFUN (no_neighbor_advertise_interval, |
| 3184 | no_neighbor_advertise_interval_cmd, |
| 3185 | NO_NEIGHBOR_CMD "advertisement-interval", |
| 3186 | NO_STR |
| 3187 | NEIGHBOR_STR |
| 3188 | NEIGHBOR_ADDR_STR |
| 3189 | "Minimum interval between sending BGP routing updates\n") |
| 3190 | { |
| 3191 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); |
| 3192 | } |
| 3193 | |
| 3194 | ALIAS (no_neighbor_advertise_interval, |
| 3195 | no_neighbor_advertise_interval_val_cmd, |
| 3196 | NO_NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3197 | NO_STR |
| 3198 | NEIGHBOR_STR |
| 3199 | NEIGHBOR_ADDR_STR |
| 3200 | "Minimum interval between sending BGP routing updates\n" |
| 3201 | "time in seconds\n") |
| 3202 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3203 | /* neighbor interface */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3204 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3205 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3206 | { |
| 3207 | int ret; |
| 3208 | struct peer *peer; |
| 3209 | |
| 3210 | peer = peer_lookup_vty (vty, ip_str); |
| 3211 | if (! peer) |
| 3212 | return CMD_WARNING; |
| 3213 | |
| 3214 | if (str) |
| 3215 | ret = peer_interface_set (peer, str); |
| 3216 | else |
| 3217 | ret = peer_interface_unset (peer); |
| 3218 | |
| 3219 | return CMD_SUCCESS; |
| 3220 | } |
| 3221 | |
| 3222 | DEFUN (neighbor_interface, |
| 3223 | neighbor_interface_cmd, |
| 3224 | NEIGHBOR_CMD "interface WORD", |
| 3225 | NEIGHBOR_STR |
| 3226 | NEIGHBOR_ADDR_STR |
| 3227 | "Interface\n" |
| 3228 | "Interface name\n") |
| 3229 | { |
| 3230 | return peer_interface_vty (vty, argv[0], argv[1]); |
| 3231 | } |
| 3232 | |
| 3233 | DEFUN (no_neighbor_interface, |
| 3234 | no_neighbor_interface_cmd, |
| 3235 | NO_NEIGHBOR_CMD "interface WORD", |
| 3236 | NO_STR |
| 3237 | NEIGHBOR_STR |
| 3238 | NEIGHBOR_ADDR_STR |
| 3239 | "Interface\n" |
| 3240 | "Interface name\n") |
| 3241 | { |
| 3242 | return peer_interface_vty (vty, argv[0], NULL); |
| 3243 | } |
| 3244 | |
| 3245 | /* Set distribute list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3246 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3247 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
| 3248 | afi_t afi, safi_t safi, |
| 3249 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3250 | { |
| 3251 | int ret; |
| 3252 | struct peer *peer; |
| 3253 | int direct = FILTER_IN; |
| 3254 | |
| 3255 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3256 | if (! peer) |
| 3257 | return CMD_WARNING; |
| 3258 | |
| 3259 | /* Check filter direction. */ |
| 3260 | if (strncmp (direct_str, "i", 1) == 0) |
| 3261 | direct = FILTER_IN; |
| 3262 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3263 | direct = FILTER_OUT; |
| 3264 | |
| 3265 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); |
| 3266 | |
| 3267 | return bgp_vty_return (vty, ret); |
| 3268 | } |
| 3269 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3270 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3271 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3272 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3273 | { |
| 3274 | int ret; |
| 3275 | struct peer *peer; |
| 3276 | int direct = FILTER_IN; |
| 3277 | |
| 3278 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3279 | if (! peer) |
| 3280 | return CMD_WARNING; |
| 3281 | |
| 3282 | /* Check filter direction. */ |
| 3283 | if (strncmp (direct_str, "i", 1) == 0) |
| 3284 | direct = FILTER_IN; |
| 3285 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3286 | direct = FILTER_OUT; |
| 3287 | |
| 3288 | ret = peer_distribute_unset (peer, afi, safi, direct); |
| 3289 | |
| 3290 | return bgp_vty_return (vty, ret); |
| 3291 | } |
| 3292 | |
| 3293 | DEFUN (neighbor_distribute_list, |
| 3294 | neighbor_distribute_list_cmd, |
| 3295 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3296 | NEIGHBOR_STR |
| 3297 | NEIGHBOR_ADDR_STR2 |
| 3298 | "Filter updates to/from this neighbor\n" |
| 3299 | "IP access-list number\n" |
| 3300 | "IP access-list number (expanded range)\n" |
| 3301 | "IP Access-list name\n" |
| 3302 | "Filter incoming updates\n" |
| 3303 | "Filter outgoing updates\n") |
| 3304 | { |
| 3305 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3306 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3307 | } |
| 3308 | |
| 3309 | DEFUN (no_neighbor_distribute_list, |
| 3310 | no_neighbor_distribute_list_cmd, |
| 3311 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3312 | NO_STR |
| 3313 | NEIGHBOR_STR |
| 3314 | NEIGHBOR_ADDR_STR2 |
| 3315 | "Filter updates to/from this neighbor\n" |
| 3316 | "IP access-list number\n" |
| 3317 | "IP access-list number (expanded range)\n" |
| 3318 | "IP Access-list name\n" |
| 3319 | "Filter incoming updates\n" |
| 3320 | "Filter outgoing updates\n") |
| 3321 | { |
| 3322 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3323 | bgp_node_safi (vty), argv[2]); |
| 3324 | } |
| 3325 | |
| 3326 | /* Set prefix list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3327 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3328 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3329 | safi_t safi, const char *name_str, |
| 3330 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3331 | { |
| 3332 | int ret; |
| 3333 | struct peer *peer; |
| 3334 | int direct = FILTER_IN; |
| 3335 | |
| 3336 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3337 | if (! peer) |
| 3338 | return CMD_WARNING; |
| 3339 | |
| 3340 | /* Check filter direction. */ |
| 3341 | if (strncmp (direct_str, "i", 1) == 0) |
| 3342 | direct = FILTER_IN; |
| 3343 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3344 | direct = FILTER_OUT; |
| 3345 | |
| 3346 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); |
| 3347 | |
| 3348 | return bgp_vty_return (vty, ret); |
| 3349 | } |
| 3350 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3351 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3352 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3353 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3354 | { |
| 3355 | int ret; |
| 3356 | struct peer *peer; |
| 3357 | int direct = FILTER_IN; |
| 3358 | |
| 3359 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3360 | if (! peer) |
| 3361 | return CMD_WARNING; |
| 3362 | |
| 3363 | /* Check filter direction. */ |
| 3364 | if (strncmp (direct_str, "i", 1) == 0) |
| 3365 | direct = FILTER_IN; |
| 3366 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3367 | direct = FILTER_OUT; |
| 3368 | |
| 3369 | ret = peer_prefix_list_unset (peer, afi, safi, direct); |
| 3370 | |
| 3371 | return bgp_vty_return (vty, ret); |
| 3372 | } |
| 3373 | |
| 3374 | DEFUN (neighbor_prefix_list, |
| 3375 | neighbor_prefix_list_cmd, |
| 3376 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3377 | NEIGHBOR_STR |
| 3378 | NEIGHBOR_ADDR_STR2 |
| 3379 | "Filter updates to/from this neighbor\n" |
| 3380 | "Name of a prefix list\n" |
| 3381 | "Filter incoming updates\n" |
| 3382 | "Filter outgoing updates\n") |
| 3383 | { |
| 3384 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3385 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3386 | } |
| 3387 | |
| 3388 | DEFUN (no_neighbor_prefix_list, |
| 3389 | no_neighbor_prefix_list_cmd, |
| 3390 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3391 | NO_STR |
| 3392 | NEIGHBOR_STR |
| 3393 | NEIGHBOR_ADDR_STR2 |
| 3394 | "Filter updates to/from this neighbor\n" |
| 3395 | "Name of a prefix list\n" |
| 3396 | "Filter incoming updates\n" |
| 3397 | "Filter outgoing updates\n") |
| 3398 | { |
| 3399 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3400 | bgp_node_safi (vty), argv[2]); |
| 3401 | } |
| 3402 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3403 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3404 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
| 3405 | afi_t afi, safi_t safi, |
| 3406 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3407 | { |
| 3408 | int ret; |
| 3409 | struct peer *peer; |
| 3410 | int direct = FILTER_IN; |
| 3411 | |
| 3412 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3413 | if (! peer) |
| 3414 | return CMD_WARNING; |
| 3415 | |
| 3416 | /* Check filter direction. */ |
| 3417 | if (strncmp (direct_str, "i", 1) == 0) |
| 3418 | direct = FILTER_IN; |
| 3419 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3420 | direct = FILTER_OUT; |
| 3421 | |
| 3422 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); |
| 3423 | |
| 3424 | return bgp_vty_return (vty, ret); |
| 3425 | } |
| 3426 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3427 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3428 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
| 3429 | afi_t afi, safi_t safi, |
| 3430 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3431 | { |
| 3432 | int ret; |
| 3433 | struct peer *peer; |
| 3434 | int direct = FILTER_IN; |
| 3435 | |
| 3436 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3437 | if (! peer) |
| 3438 | return CMD_WARNING; |
| 3439 | |
| 3440 | /* Check filter direction. */ |
| 3441 | if (strncmp (direct_str, "i", 1) == 0) |
| 3442 | direct = FILTER_IN; |
| 3443 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3444 | direct = FILTER_OUT; |
| 3445 | |
| 3446 | ret = peer_aslist_unset (peer, afi, safi, direct); |
| 3447 | |
| 3448 | return bgp_vty_return (vty, ret); |
| 3449 | } |
| 3450 | |
| 3451 | DEFUN (neighbor_filter_list, |
| 3452 | neighbor_filter_list_cmd, |
| 3453 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3454 | NEIGHBOR_STR |
| 3455 | NEIGHBOR_ADDR_STR2 |
| 3456 | "Establish BGP filters\n" |
| 3457 | "AS path access-list name\n" |
| 3458 | "Filter incoming routes\n" |
| 3459 | "Filter outgoing routes\n") |
| 3460 | { |
| 3461 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3462 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3463 | } |
| 3464 | |
| 3465 | DEFUN (no_neighbor_filter_list, |
| 3466 | no_neighbor_filter_list_cmd, |
| 3467 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3468 | NO_STR |
| 3469 | NEIGHBOR_STR |
| 3470 | NEIGHBOR_ADDR_STR2 |
| 3471 | "Establish BGP filters\n" |
| 3472 | "AS path access-list name\n" |
| 3473 | "Filter incoming routes\n" |
| 3474 | "Filter outgoing routes\n") |
| 3475 | { |
| 3476 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3477 | bgp_node_safi (vty), argv[2]); |
| 3478 | } |
| 3479 | |
| 3480 | /* Set route-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3481 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3482 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
| 3483 | afi_t afi, safi_t safi, |
| 3484 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3485 | { |
| 3486 | int ret; |
| 3487 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3488 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3489 | |
| 3490 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3491 | if (! peer) |
| 3492 | return CMD_WARNING; |
| 3493 | |
| 3494 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3495 | if (strncmp (direct_str, "in", 2) == 0) |
| 3496 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3497 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3498 | direct = RMAP_OUT; |
| 3499 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3500 | direct = RMAP_IMPORT; |
| 3501 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3502 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3503 | |
| 3504 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); |
| 3505 | |
| 3506 | return bgp_vty_return (vty, ret); |
| 3507 | } |
| 3508 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3509 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3510 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3511 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3512 | { |
| 3513 | int ret; |
| 3514 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3515 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3516 | |
| 3517 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3518 | if (! peer) |
| 3519 | return CMD_WARNING; |
| 3520 | |
| 3521 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3522 | if (strncmp (direct_str, "in", 2) == 0) |
| 3523 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3524 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3525 | direct = RMAP_OUT; |
| 3526 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3527 | direct = RMAP_IMPORT; |
| 3528 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3529 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3530 | |
| 3531 | ret = peer_route_map_unset (peer, afi, safi, direct); |
| 3532 | |
| 3533 | return bgp_vty_return (vty, ret); |
| 3534 | } |
| 3535 | |
| 3536 | DEFUN (neighbor_route_map, |
| 3537 | neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3538 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3539 | NEIGHBOR_STR |
| 3540 | NEIGHBOR_ADDR_STR2 |
| 3541 | "Apply route map to neighbor\n" |
| 3542 | "Name of route map\n" |
| 3543 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3544 | "Apply map to outbound routes\n" |
| 3545 | "Apply map to routes going into a Route-Server client's table\n" |
| 3546 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3547 | { |
| 3548 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3549 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3550 | } |
| 3551 | |
| 3552 | DEFUN (no_neighbor_route_map, |
| 3553 | no_neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3554 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3555 | NO_STR |
| 3556 | NEIGHBOR_STR |
| 3557 | NEIGHBOR_ADDR_STR2 |
| 3558 | "Apply route map to neighbor\n" |
| 3559 | "Name of route map\n" |
| 3560 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3561 | "Apply map to outbound routes\n" |
| 3562 | "Apply map to routes going into a Route-Server client's table\n" |
| 3563 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3564 | { |
| 3565 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3566 | bgp_node_safi (vty), argv[2]); |
| 3567 | } |
| 3568 | |
| 3569 | /* Set unsuppress-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3570 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3571 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3572 | safi_t safi, const char *name_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3573 | { |
| 3574 | int ret; |
| 3575 | struct peer *peer; |
| 3576 | |
| 3577 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3578 | if (! peer) |
| 3579 | return CMD_WARNING; |
| 3580 | |
| 3581 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); |
| 3582 | |
| 3583 | return bgp_vty_return (vty, ret); |
| 3584 | } |
| 3585 | |
| 3586 | /* Unset route-map from the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3587 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3588 | 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] | 3589 | safi_t safi) |
| 3590 | { |
| 3591 | int ret; |
| 3592 | struct peer *peer; |
| 3593 | |
| 3594 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3595 | if (! peer) |
| 3596 | return CMD_WARNING; |
| 3597 | |
| 3598 | ret = peer_unsuppress_map_unset (peer, afi, safi); |
| 3599 | |
| 3600 | return bgp_vty_return (vty, ret); |
| 3601 | } |
| 3602 | |
| 3603 | DEFUN (neighbor_unsuppress_map, |
| 3604 | neighbor_unsuppress_map_cmd, |
| 3605 | NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3606 | NEIGHBOR_STR |
| 3607 | NEIGHBOR_ADDR_STR2 |
| 3608 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3609 | "Name of route map\n") |
| 3610 | { |
| 3611 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3612 | bgp_node_safi (vty), argv[1]); |
| 3613 | } |
| 3614 | |
| 3615 | DEFUN (no_neighbor_unsuppress_map, |
| 3616 | no_neighbor_unsuppress_map_cmd, |
| 3617 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3618 | NO_STR |
| 3619 | NEIGHBOR_STR |
| 3620 | NEIGHBOR_ADDR_STR2 |
| 3621 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3622 | "Name of route map\n") |
| 3623 | { |
| 3624 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3625 | bgp_node_safi (vty)); |
| 3626 | } |
| 3627 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3628 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3629 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3630 | safi_t safi, const char *num_str, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3631 | const char *threshold_str, int warning, |
| 3632 | const char *restart_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3633 | { |
| 3634 | int ret; |
| 3635 | struct peer *peer; |
| 3636 | u_int32_t max; |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3637 | u_char threshold; |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3638 | u_int16_t restart; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3639 | |
| 3640 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3641 | if (! peer) |
| 3642 | return CMD_WARNING; |
| 3643 | |
| 3644 | VTY_GET_INTEGER ("maxmum number", max, num_str); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3645 | if (threshold_str) |
| 3646 | threshold = atoi (threshold_str); |
| 3647 | else |
| 3648 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3649 | |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3650 | if (restart_str) |
| 3651 | restart = atoi (restart_str); |
| 3652 | else |
| 3653 | restart = 0; |
| 3654 | |
| 3655 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3656 | |
| 3657 | return bgp_vty_return (vty, ret); |
| 3658 | } |
| 3659 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3660 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3661 | 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] | 3662 | safi_t safi) |
| 3663 | { |
| 3664 | int ret; |
| 3665 | struct peer *peer; |
| 3666 | |
| 3667 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3668 | if (! peer) |
| 3669 | return CMD_WARNING; |
| 3670 | |
| 3671 | ret = peer_maximum_prefix_unset (peer, afi, safi); |
| 3672 | |
| 3673 | return bgp_vty_return (vty, ret); |
| 3674 | } |
| 3675 | |
| 3676 | /* Maximum number of prefix configuration. prefix count is different |
| 3677 | for each peer configuration. So this configuration can be set for |
| 3678 | each peer configuration. */ |
| 3679 | DEFUN (neighbor_maximum_prefix, |
| 3680 | neighbor_maximum_prefix_cmd, |
| 3681 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3682 | NEIGHBOR_STR |
| 3683 | NEIGHBOR_ADDR_STR2 |
| 3684 | "Maximum number of prefix accept from this peer\n" |
| 3685 | "maximum no. of prefix limit\n") |
| 3686 | { |
| 3687 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3688 | bgp_node_safi (vty), argv[1], NULL, 0, |
| 3689 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3690 | } |
| 3691 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3692 | DEFUN (neighbor_maximum_prefix_threshold, |
| 3693 | neighbor_maximum_prefix_threshold_cmd, |
| 3694 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", |
| 3695 | NEIGHBOR_STR |
| 3696 | NEIGHBOR_ADDR_STR2 |
| 3697 | "Maximum number of prefix accept from this peer\n" |
| 3698 | "maximum no. of prefix limit\n" |
| 3699 | "Threshold value (%) at which to generate a warning msg\n") |
| 3700 | { |
| 3701 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3702 | bgp_node_safi (vty), argv[1], argv[2], 0, |
| 3703 | NULL); |
| 3704 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3705 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3706 | DEFUN (neighbor_maximum_prefix_warning, |
| 3707 | neighbor_maximum_prefix_warning_cmd, |
| 3708 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3709 | NEIGHBOR_STR |
| 3710 | NEIGHBOR_ADDR_STR2 |
| 3711 | "Maximum number of prefix accept from this peer\n" |
| 3712 | "maximum no. of prefix limit\n" |
| 3713 | "Only give warning message when limit is exceeded\n") |
| 3714 | { |
| 3715 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3716 | bgp_node_safi (vty), argv[1], NULL, 1, |
| 3717 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3718 | } |
| 3719 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3720 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
| 3721 | neighbor_maximum_prefix_threshold_warning_cmd, |
| 3722 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 3723 | NEIGHBOR_STR |
| 3724 | NEIGHBOR_ADDR_STR2 |
| 3725 | "Maximum number of prefix accept from this peer\n" |
| 3726 | "maximum no. of prefix limit\n" |
| 3727 | "Threshold value (%) at which to generate a warning msg\n" |
| 3728 | "Only give warning message when limit is exceeded\n") |
| 3729 | { |
| 3730 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3731 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
| 3732 | } |
| 3733 | |
| 3734 | DEFUN (neighbor_maximum_prefix_restart, |
| 3735 | neighbor_maximum_prefix_restart_cmd, |
| 3736 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
| 3737 | NEIGHBOR_STR |
| 3738 | NEIGHBOR_ADDR_STR2 |
| 3739 | "Maximum number of prefix accept from this peer\n" |
| 3740 | "maximum no. of prefix limit\n" |
| 3741 | "Restart bgp connection after limit is exceeded\n" |
| 3742 | "Restart interval in minutes") |
| 3743 | { |
| 3744 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3745 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); |
| 3746 | } |
| 3747 | |
| 3748 | DEFUN (neighbor_maximum_prefix_threshold_restart, |
| 3749 | neighbor_maximum_prefix_threshold_restart_cmd, |
| 3750 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 3751 | NEIGHBOR_STR |
| 3752 | NEIGHBOR_ADDR_STR2 |
| 3753 | "Maximum number of prefix accept from this peer\n" |
| 3754 | "maximum no. of prefix limit\n" |
| 3755 | "Threshold value (%) at which to generate a warning msg\n" |
| 3756 | "Restart bgp connection after limit is exceeded\n" |
| 3757 | "Restart interval in minutes") |
| 3758 | { |
| 3759 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3760 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); |
| 3761 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3762 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3763 | DEFUN (no_neighbor_maximum_prefix, |
| 3764 | no_neighbor_maximum_prefix_cmd, |
| 3765 | NO_NEIGHBOR_CMD2 "maximum-prefix", |
| 3766 | NO_STR |
| 3767 | NEIGHBOR_STR |
| 3768 | NEIGHBOR_ADDR_STR2 |
| 3769 | "Maximum number of prefix accept from this peer\n") |
| 3770 | { |
| 3771 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3772 | bgp_node_safi (vty)); |
| 3773 | } |
| 3774 | |
| 3775 | ALIAS (no_neighbor_maximum_prefix, |
| 3776 | no_neighbor_maximum_prefix_val_cmd, |
| 3777 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3778 | NO_STR |
| 3779 | NEIGHBOR_STR |
| 3780 | NEIGHBOR_ADDR_STR2 |
| 3781 | "Maximum number of prefix accept from this peer\n" |
| 3782 | "maximum no. of prefix limit\n") |
| 3783 | |
| 3784 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3785 | no_neighbor_maximum_prefix_threshold_cmd, |
| 3786 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3787 | NO_STR |
| 3788 | NEIGHBOR_STR |
| 3789 | NEIGHBOR_ADDR_STR2 |
| 3790 | "Maximum number of prefix accept from this peer\n" |
| 3791 | "maximum no. of prefix limit\n" |
| 3792 | "Threshold value (%) at which to generate a warning msg\n") |
| 3793 | |
| 3794 | ALIAS (no_neighbor_maximum_prefix, |
| 3795 | no_neighbor_maximum_prefix_warning_cmd, |
| 3796 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3797 | NO_STR |
| 3798 | NEIGHBOR_STR |
| 3799 | NEIGHBOR_ADDR_STR2 |
| 3800 | "Maximum number of prefix accept from this peer\n" |
| 3801 | "maximum no. of prefix limit\n" |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 3802 | "Only give warning message when limit is exceeded\n") |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3803 | |
| 3804 | ALIAS (no_neighbor_maximum_prefix, |
| 3805 | no_neighbor_maximum_prefix_threshold_warning_cmd, |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3806 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 3807 | NO_STR |
| 3808 | NEIGHBOR_STR |
| 3809 | NEIGHBOR_ADDR_STR2 |
| 3810 | "Maximum number of prefix accept from this peer\n" |
| 3811 | "maximum no. of prefix limit\n" |
| 3812 | "Threshold value (%) at which to generate a warning msg\n" |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 3813 | "Only give warning message when limit is exceeded\n") |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3814 | |
| 3815 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3816 | no_neighbor_maximum_prefix_restart_cmd, |
| 3817 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3818 | NO_STR |
| 3819 | NEIGHBOR_STR |
| 3820 | NEIGHBOR_ADDR_STR2 |
| 3821 | "Maximum number of prefix accept from this peer\n" |
| 3822 | "maximum no. of prefix limit\n" |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3823 | "Restart bgp connection after limit is exceeded\n" |
| 3824 | "Restart interval in minutes") |
| 3825 | |
| 3826 | ALIAS (no_neighbor_maximum_prefix, |
| 3827 | no_neighbor_maximum_prefix_threshold_restart_cmd, |
| 3828 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 3829 | NO_STR |
| 3830 | NEIGHBOR_STR |
| 3831 | NEIGHBOR_ADDR_STR2 |
| 3832 | "Maximum number of prefix accept from this peer\n" |
| 3833 | "maximum no. of prefix limit\n" |
| 3834 | "Threshold value (%) at which to generate a warning msg\n" |
| 3835 | "Restart bgp connection after limit is exceeded\n" |
| 3836 | "Restart interval in minutes") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3837 | |
| 3838 | /* "neighbor allowas-in" */ |
| 3839 | DEFUN (neighbor_allowas_in, |
| 3840 | neighbor_allowas_in_cmd, |
| 3841 | NEIGHBOR_CMD2 "allowas-in", |
| 3842 | NEIGHBOR_STR |
| 3843 | NEIGHBOR_ADDR_STR2 |
| 3844 | "Accept as-path with my AS present in it\n") |
| 3845 | { |
| 3846 | int ret; |
| 3847 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3848 | unsigned int allow_num; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3849 | |
| 3850 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3851 | if (! peer) |
| 3852 | return CMD_WARNING; |
| 3853 | |
| 3854 | if (argc == 1) |
| 3855 | allow_num = 3; |
| 3856 | else |
| 3857 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); |
| 3858 | |
| 3859 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), |
| 3860 | allow_num); |
| 3861 | |
| 3862 | return bgp_vty_return (vty, ret); |
| 3863 | } |
| 3864 | |
| 3865 | ALIAS (neighbor_allowas_in, |
| 3866 | neighbor_allowas_in_arg_cmd, |
| 3867 | NEIGHBOR_CMD2 "allowas-in <1-10>", |
| 3868 | NEIGHBOR_STR |
| 3869 | NEIGHBOR_ADDR_STR2 |
| 3870 | "Accept as-path with my AS present in it\n" |
| 3871 | "Number of occurances of AS number\n") |
| 3872 | |
| 3873 | DEFUN (no_neighbor_allowas_in, |
| 3874 | no_neighbor_allowas_in_cmd, |
| 3875 | NO_NEIGHBOR_CMD2 "allowas-in", |
| 3876 | NO_STR |
| 3877 | NEIGHBOR_STR |
| 3878 | NEIGHBOR_ADDR_STR2 |
| 3879 | "allow local ASN appears in aspath attribute\n") |
| 3880 | { |
| 3881 | int ret; |
| 3882 | struct peer *peer; |
| 3883 | |
| 3884 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3885 | if (! peer) |
| 3886 | return CMD_WARNING; |
| 3887 | |
| 3888 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 3889 | |
| 3890 | return bgp_vty_return (vty, ret); |
| 3891 | } |
| 3892 | |
| 3893 | /* Address family configuration. */ |
| 3894 | DEFUN (address_family_ipv4, |
| 3895 | address_family_ipv4_cmd, |
| 3896 | "address-family ipv4", |
| 3897 | "Enter Address Family command mode\n" |
| 3898 | "Address family\n") |
| 3899 | { |
| 3900 | vty->node = BGP_IPV4_NODE; |
| 3901 | return CMD_SUCCESS; |
| 3902 | } |
| 3903 | |
| 3904 | DEFUN (address_family_ipv4_safi, |
| 3905 | address_family_ipv4_safi_cmd, |
| 3906 | "address-family ipv4 (unicast|multicast)", |
| 3907 | "Enter Address Family command mode\n" |
| 3908 | "Address family\n" |
| 3909 | "Address Family modifier\n" |
| 3910 | "Address Family modifier\n") |
| 3911 | { |
| 3912 | if (strncmp (argv[0], "m", 1) == 0) |
| 3913 | vty->node = BGP_IPV4M_NODE; |
| 3914 | else |
| 3915 | vty->node = BGP_IPV4_NODE; |
| 3916 | |
| 3917 | return CMD_SUCCESS; |
| 3918 | } |
| 3919 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 3920 | DEFUN (address_family_ipv6, |
| 3921 | address_family_ipv6_cmd, |
| 3922 | "address-family ipv6", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3923 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 3924 | "Address family\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3925 | { |
| 3926 | vty->node = BGP_IPV6_NODE; |
| 3927 | return CMD_SUCCESS; |
| 3928 | } |
| 3929 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 3930 | DEFUN (address_family_ipv6_safi, |
| 3931 | address_family_ipv6_safi_cmd, |
| 3932 | "address-family ipv6 (unicast|multicast)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3933 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 3934 | "Address family\n" |
| 3935 | "Address Family modifier\n" |
| 3936 | "Address Family modifier\n") |
| 3937 | { |
| 3938 | if (strncmp (argv[0], "m", 1) == 0) |
| 3939 | vty->node = BGP_IPV6M_NODE; |
| 3940 | else |
| 3941 | vty->node = BGP_IPV6_NODE; |
| 3942 | |
| 3943 | return CMD_SUCCESS; |
| 3944 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3945 | |
| 3946 | DEFUN (address_family_vpnv4, |
| 3947 | address_family_vpnv4_cmd, |
| 3948 | "address-family vpnv4", |
| 3949 | "Enter Address Family command mode\n" |
| 3950 | "Address family\n") |
| 3951 | { |
| 3952 | vty->node = BGP_VPNV4_NODE; |
| 3953 | return CMD_SUCCESS; |
| 3954 | } |
| 3955 | |
| 3956 | ALIAS (address_family_vpnv4, |
| 3957 | address_family_vpnv4_unicast_cmd, |
| 3958 | "address-family vpnv4 unicast", |
| 3959 | "Enter Address Family command mode\n" |
| 3960 | "Address family\n" |
| 3961 | "Address Family Modifier\n") |
| 3962 | |
| 3963 | DEFUN (exit_address_family, |
| 3964 | exit_address_family_cmd, |
| 3965 | "exit-address-family", |
| 3966 | "Exit from Address Family configuration mode\n") |
| 3967 | { |
hasso | a8a80d5 | 2005-04-09 13:07:47 +0000 | [diff] [blame] | 3968 | if (vty->node == BGP_IPV4_NODE |
| 3969 | || vty->node == BGP_IPV4M_NODE |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3970 | || vty->node == BGP_VPNV4_NODE |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 3971 | || vty->node == BGP_IPV6_NODE |
| 3972 | || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3973 | vty->node = BGP_NODE; |
| 3974 | return CMD_SUCCESS; |
| 3975 | } |
| 3976 | |
| 3977 | /* BGP clear sort. */ |
| 3978 | enum clear_sort |
| 3979 | { |
| 3980 | clear_all, |
| 3981 | clear_peer, |
| 3982 | clear_group, |
| 3983 | clear_external, |
| 3984 | clear_as |
| 3985 | }; |
| 3986 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3987 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3988 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
| 3989 | safi_t safi, int error) |
| 3990 | { |
| 3991 | switch (error) |
| 3992 | { |
| 3993 | case BGP_ERR_AF_UNCONFIGURED: |
| 3994 | vty_out (vty, |
| 3995 | "%%BGP: Enable %s %s address family for the neighbor %s%s", |
| 3996 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", |
| 3997 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", |
| 3998 | peer->host, VTY_NEWLINE); |
| 3999 | break; |
| 4000 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: |
| 4001 | 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); |
| 4002 | break; |
| 4003 | default: |
| 4004 | break; |
| 4005 | } |
| 4006 | } |
| 4007 | |
| 4008 | /* `clear ip bgp' functions. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4009 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4010 | 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] | 4011 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4012 | { |
| 4013 | int ret; |
| 4014 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4015 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4016 | |
| 4017 | /* Clear all neighbors. */ |
| 4018 | if (sort == clear_all) |
| 4019 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4020 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4021 | { |
| 4022 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4023 | ret = peer_clear (peer); |
| 4024 | else |
| 4025 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4026 | |
| 4027 | if (ret < 0) |
| 4028 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4029 | } |
| 4030 | return 0; |
| 4031 | } |
| 4032 | |
| 4033 | /* Clear specified neighbors. */ |
| 4034 | if (sort == clear_peer) |
| 4035 | { |
| 4036 | union sockunion su; |
| 4037 | int ret; |
| 4038 | |
| 4039 | /* Make sockunion for lookup. */ |
| 4040 | ret = str2sockunion (arg, &su); |
| 4041 | if (ret < 0) |
| 4042 | { |
| 4043 | vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE); |
| 4044 | return -1; |
| 4045 | } |
| 4046 | peer = peer_lookup (bgp, &su); |
| 4047 | if (! peer) |
| 4048 | { |
| 4049 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); |
| 4050 | return -1; |
| 4051 | } |
| 4052 | |
| 4053 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4054 | ret = peer_clear (peer); |
| 4055 | else |
| 4056 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4057 | |
| 4058 | if (ret < 0) |
| 4059 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4060 | |
| 4061 | return 0; |
| 4062 | } |
| 4063 | |
| 4064 | /* Clear all peer-group members. */ |
| 4065 | if (sort == clear_group) |
| 4066 | { |
| 4067 | struct peer_group *group; |
| 4068 | |
| 4069 | group = peer_group_lookup (bgp, arg); |
| 4070 | if (! group) |
| 4071 | { |
| 4072 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); |
| 4073 | return -1; |
| 4074 | } |
| 4075 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4076 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4077 | { |
| 4078 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4079 | { |
| 4080 | ret = peer_clear (peer); |
| 4081 | continue; |
| 4082 | } |
| 4083 | |
| 4084 | if (! peer->af_group[afi][safi]) |
| 4085 | continue; |
| 4086 | |
| 4087 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4088 | |
| 4089 | if (ret < 0) |
| 4090 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4091 | } |
| 4092 | return 0; |
| 4093 | } |
| 4094 | |
| 4095 | if (sort == clear_external) |
| 4096 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4097 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4098 | { |
| 4099 | if (peer_sort (peer) == BGP_PEER_IBGP) |
| 4100 | continue; |
| 4101 | |
| 4102 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4103 | ret = peer_clear (peer); |
| 4104 | else |
| 4105 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4106 | |
| 4107 | if (ret < 0) |
| 4108 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4109 | } |
| 4110 | return 0; |
| 4111 | } |
| 4112 | |
| 4113 | if (sort == clear_as) |
| 4114 | { |
| 4115 | as_t as; |
| 4116 | unsigned long as_ul; |
| 4117 | char *endptr = NULL; |
| 4118 | int find = 0; |
| 4119 | |
| 4120 | as_ul = strtoul(arg, &endptr, 10); |
| 4121 | |
| 4122 | if ((as_ul == ULONG_MAX) || (*endptr != '\0') || (as_ul > USHRT_MAX)) |
| 4123 | { |
| 4124 | vty_out (vty, "Invalid AS number%s", VTY_NEWLINE); |
| 4125 | return -1; |
| 4126 | } |
| 4127 | as = (as_t) as_ul; |
| 4128 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4129 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4130 | { |
| 4131 | if (peer->as != as) |
| 4132 | continue; |
| 4133 | |
| 4134 | find = 1; |
| 4135 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4136 | ret = peer_clear (peer); |
| 4137 | else |
| 4138 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4139 | |
| 4140 | if (ret < 0) |
| 4141 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4142 | } |
| 4143 | if (! find) |
| 4144 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, |
| 4145 | VTY_NEWLINE); |
| 4146 | return 0; |
| 4147 | } |
| 4148 | |
| 4149 | return 0; |
| 4150 | } |
| 4151 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4152 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4153 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
| 4154 | enum clear_sort sort, enum bgp_clear_type stype, |
| 4155 | const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4156 | { |
| 4157 | int ret; |
| 4158 | struct bgp *bgp; |
| 4159 | |
| 4160 | /* BGP structure lookup. */ |
| 4161 | if (name) |
| 4162 | { |
| 4163 | bgp = bgp_lookup_by_name (name); |
| 4164 | if (bgp == NULL) |
| 4165 | { |
| 4166 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); |
| 4167 | return CMD_WARNING; |
| 4168 | } |
| 4169 | } |
| 4170 | else |
| 4171 | { |
| 4172 | bgp = bgp_get_default (); |
| 4173 | if (bgp == NULL) |
| 4174 | { |
| 4175 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); |
| 4176 | return CMD_WARNING; |
| 4177 | } |
| 4178 | } |
| 4179 | |
| 4180 | ret = bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
| 4181 | if (ret < 0) |
| 4182 | return CMD_WARNING; |
| 4183 | |
| 4184 | return CMD_SUCCESS; |
| 4185 | } |
| 4186 | |
| 4187 | DEFUN (clear_ip_bgp_all, |
| 4188 | clear_ip_bgp_all_cmd, |
| 4189 | "clear ip bgp *", |
| 4190 | CLEAR_STR |
| 4191 | IP_STR |
| 4192 | BGP_STR |
| 4193 | "Clear all peers\n") |
| 4194 | { |
| 4195 | if (argc == 1) |
| 4196 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4197 | |
| 4198 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4199 | } |
| 4200 | |
| 4201 | ALIAS (clear_ip_bgp_all, |
| 4202 | clear_bgp_all_cmd, |
| 4203 | "clear bgp *", |
| 4204 | CLEAR_STR |
| 4205 | BGP_STR |
| 4206 | "Clear all peers\n") |
| 4207 | |
| 4208 | ALIAS (clear_ip_bgp_all, |
| 4209 | clear_bgp_ipv6_all_cmd, |
| 4210 | "clear bgp ipv6 *", |
| 4211 | CLEAR_STR |
| 4212 | BGP_STR |
| 4213 | "Address family\n" |
| 4214 | "Clear all peers\n") |
| 4215 | |
| 4216 | ALIAS (clear_ip_bgp_all, |
| 4217 | clear_ip_bgp_instance_all_cmd, |
| 4218 | "clear ip bgp view WORD *", |
| 4219 | CLEAR_STR |
| 4220 | IP_STR |
| 4221 | BGP_STR |
| 4222 | "BGP view\n" |
| 4223 | "view name\n" |
| 4224 | "Clear all peers\n") |
| 4225 | |
| 4226 | ALIAS (clear_ip_bgp_all, |
| 4227 | clear_bgp_instance_all_cmd, |
| 4228 | "clear bgp view WORD *", |
| 4229 | CLEAR_STR |
| 4230 | BGP_STR |
| 4231 | "BGP view\n" |
| 4232 | "view name\n" |
| 4233 | "Clear all peers\n") |
| 4234 | |
| 4235 | DEFUN (clear_ip_bgp_peer, |
| 4236 | clear_ip_bgp_peer_cmd, |
| 4237 | "clear ip bgp (A.B.C.D|X:X::X:X)", |
| 4238 | CLEAR_STR |
| 4239 | IP_STR |
| 4240 | BGP_STR |
| 4241 | "BGP neighbor IP address to clear\n" |
| 4242 | "BGP IPv6 neighbor to clear\n") |
| 4243 | { |
| 4244 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4245 | } |
| 4246 | |
| 4247 | ALIAS (clear_ip_bgp_peer, |
| 4248 | clear_bgp_peer_cmd, |
| 4249 | "clear bgp (A.B.C.D|X:X::X:X)", |
| 4250 | CLEAR_STR |
| 4251 | BGP_STR |
| 4252 | "BGP neighbor address to clear\n" |
| 4253 | "BGP IPv6 neighbor to clear\n") |
| 4254 | |
| 4255 | ALIAS (clear_ip_bgp_peer, |
| 4256 | clear_bgp_ipv6_peer_cmd, |
| 4257 | "clear bgp ipv6 (A.B.C.D|X:X::X:X)", |
| 4258 | CLEAR_STR |
| 4259 | BGP_STR |
| 4260 | "Address family\n" |
| 4261 | "BGP neighbor address to clear\n" |
| 4262 | "BGP IPv6 neighbor to clear\n") |
| 4263 | |
| 4264 | DEFUN (clear_ip_bgp_peer_group, |
| 4265 | clear_ip_bgp_peer_group_cmd, |
| 4266 | "clear ip bgp peer-group WORD", |
| 4267 | CLEAR_STR |
| 4268 | IP_STR |
| 4269 | BGP_STR |
| 4270 | "Clear all members of peer-group\n" |
| 4271 | "BGP peer-group name\n") |
| 4272 | { |
| 4273 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4274 | } |
| 4275 | |
| 4276 | ALIAS (clear_ip_bgp_peer_group, |
| 4277 | clear_bgp_peer_group_cmd, |
| 4278 | "clear bgp peer-group WORD", |
| 4279 | CLEAR_STR |
| 4280 | BGP_STR |
| 4281 | "Clear all members of peer-group\n" |
| 4282 | "BGP peer-group name\n") |
| 4283 | |
| 4284 | ALIAS (clear_ip_bgp_peer_group, |
| 4285 | clear_bgp_ipv6_peer_group_cmd, |
| 4286 | "clear bgp ipv6 peer-group WORD", |
| 4287 | CLEAR_STR |
| 4288 | BGP_STR |
| 4289 | "Address family\n" |
| 4290 | "Clear all members of peer-group\n" |
| 4291 | "BGP peer-group name\n") |
| 4292 | |
| 4293 | DEFUN (clear_ip_bgp_external, |
| 4294 | clear_ip_bgp_external_cmd, |
| 4295 | "clear ip bgp external", |
| 4296 | CLEAR_STR |
| 4297 | IP_STR |
| 4298 | BGP_STR |
| 4299 | "Clear all external peers\n") |
| 4300 | { |
| 4301 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
| 4302 | } |
| 4303 | |
| 4304 | ALIAS (clear_ip_bgp_external, |
| 4305 | clear_bgp_external_cmd, |
| 4306 | "clear bgp external", |
| 4307 | CLEAR_STR |
| 4308 | BGP_STR |
| 4309 | "Clear all external peers\n") |
| 4310 | |
| 4311 | ALIAS (clear_ip_bgp_external, |
| 4312 | clear_bgp_ipv6_external_cmd, |
| 4313 | "clear bgp ipv6 external", |
| 4314 | CLEAR_STR |
| 4315 | BGP_STR |
| 4316 | "Address family\n" |
| 4317 | "Clear all external peers\n") |
| 4318 | |
| 4319 | DEFUN (clear_ip_bgp_as, |
| 4320 | clear_ip_bgp_as_cmd, |
| 4321 | "clear ip bgp <1-65535>", |
| 4322 | CLEAR_STR |
| 4323 | IP_STR |
| 4324 | BGP_STR |
| 4325 | "Clear peers with the AS number\n") |
| 4326 | { |
| 4327 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4328 | } |
| 4329 | |
| 4330 | ALIAS (clear_ip_bgp_as, |
| 4331 | clear_bgp_as_cmd, |
| 4332 | "clear bgp <1-65535>", |
| 4333 | CLEAR_STR |
| 4334 | BGP_STR |
| 4335 | "Clear peers with the AS number\n") |
| 4336 | |
| 4337 | ALIAS (clear_ip_bgp_as, |
| 4338 | clear_bgp_ipv6_as_cmd, |
| 4339 | "clear bgp ipv6 <1-65535>", |
| 4340 | CLEAR_STR |
| 4341 | BGP_STR |
| 4342 | "Address family\n" |
| 4343 | "Clear peers with the AS number\n") |
| 4344 | |
| 4345 | /* Outbound soft-reconfiguration */ |
| 4346 | DEFUN (clear_ip_bgp_all_soft_out, |
| 4347 | clear_ip_bgp_all_soft_out_cmd, |
| 4348 | "clear ip bgp * soft out", |
| 4349 | CLEAR_STR |
| 4350 | IP_STR |
| 4351 | BGP_STR |
| 4352 | "Clear all peers\n" |
| 4353 | "Soft reconfig\n" |
| 4354 | "Soft reconfig outbound update\n") |
| 4355 | { |
| 4356 | if (argc == 1) |
| 4357 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4358 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4359 | |
| 4360 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4361 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4362 | } |
| 4363 | |
| 4364 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4365 | clear_ip_bgp_all_out_cmd, |
| 4366 | "clear ip bgp * out", |
| 4367 | CLEAR_STR |
| 4368 | IP_STR |
| 4369 | BGP_STR |
| 4370 | "Clear all peers\n" |
| 4371 | "Soft reconfig outbound update\n") |
| 4372 | |
| 4373 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4374 | clear_ip_bgp_instance_all_soft_out_cmd, |
| 4375 | "clear ip bgp view WORD * soft out", |
| 4376 | CLEAR_STR |
| 4377 | IP_STR |
| 4378 | BGP_STR |
| 4379 | "BGP view\n" |
| 4380 | "view name\n" |
| 4381 | "Clear all peers\n" |
| 4382 | "Soft reconfig\n" |
| 4383 | "Soft reconfig outbound update\n") |
| 4384 | |
| 4385 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, |
| 4386 | clear_ip_bgp_all_ipv4_soft_out_cmd, |
| 4387 | "clear ip bgp * ipv4 (unicast|multicast) soft out", |
| 4388 | CLEAR_STR |
| 4389 | IP_STR |
| 4390 | BGP_STR |
| 4391 | "Clear all peers\n" |
| 4392 | "Address family\n" |
| 4393 | "Address Family modifier\n" |
| 4394 | "Address Family modifier\n" |
| 4395 | "Soft reconfig\n" |
| 4396 | "Soft reconfig outbound update\n") |
| 4397 | { |
| 4398 | if (strncmp (argv[0], "m", 1) == 0) |
| 4399 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 4400 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4401 | |
| 4402 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4403 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4404 | } |
| 4405 | |
| 4406 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, |
| 4407 | clear_ip_bgp_all_ipv4_out_cmd, |
| 4408 | "clear ip bgp * ipv4 (unicast|multicast) out", |
| 4409 | CLEAR_STR |
| 4410 | IP_STR |
| 4411 | BGP_STR |
| 4412 | "Clear all peers\n" |
| 4413 | "Address family\n" |
| 4414 | "Address Family modifier\n" |
| 4415 | "Address Family modifier\n" |
| 4416 | "Soft reconfig outbound update\n") |
| 4417 | |
| 4418 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
| 4419 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, |
| 4420 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", |
| 4421 | CLEAR_STR |
| 4422 | IP_STR |
| 4423 | BGP_STR |
| 4424 | "BGP view\n" |
| 4425 | "view name\n" |
| 4426 | "Clear all peers\n" |
| 4427 | "Address family\n" |
| 4428 | "Address Family modifier\n" |
| 4429 | "Address Family modifier\n" |
| 4430 | "Soft reconfig outbound update\n") |
| 4431 | { |
| 4432 | if (strncmp (argv[1], "m", 1) == 0) |
| 4433 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 4434 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4435 | |
| 4436 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4437 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4438 | } |
| 4439 | |
| 4440 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, |
| 4441 | clear_ip_bgp_all_vpnv4_soft_out_cmd, |
| 4442 | "clear ip bgp * vpnv4 unicast soft out", |
| 4443 | CLEAR_STR |
| 4444 | IP_STR |
| 4445 | BGP_STR |
| 4446 | "Clear all peers\n" |
| 4447 | "Address family\n" |
| 4448 | "Address Family Modifier\n" |
| 4449 | "Soft reconfig\n" |
| 4450 | "Soft reconfig outbound update\n") |
| 4451 | { |
| 4452 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 4453 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4454 | } |
| 4455 | |
| 4456 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, |
| 4457 | clear_ip_bgp_all_vpnv4_out_cmd, |
| 4458 | "clear ip bgp * vpnv4 unicast out", |
| 4459 | CLEAR_STR |
| 4460 | IP_STR |
| 4461 | BGP_STR |
| 4462 | "Clear all peers\n" |
| 4463 | "Address family\n" |
| 4464 | "Address Family Modifier\n" |
| 4465 | "Soft reconfig outbound update\n") |
| 4466 | |
| 4467 | DEFUN (clear_bgp_all_soft_out, |
| 4468 | clear_bgp_all_soft_out_cmd, |
| 4469 | "clear bgp * soft out", |
| 4470 | CLEAR_STR |
| 4471 | BGP_STR |
| 4472 | "Clear all peers\n" |
| 4473 | "Soft reconfig\n" |
| 4474 | "Soft reconfig outbound update\n") |
| 4475 | { |
| 4476 | if (argc == 1) |
| 4477 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 4478 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4479 | |
| 4480 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 4481 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4482 | } |
| 4483 | |
| 4484 | ALIAS (clear_bgp_all_soft_out, |
| 4485 | clear_bgp_instance_all_soft_out_cmd, |
| 4486 | "clear bgp view WORD * soft out", |
| 4487 | CLEAR_STR |
| 4488 | BGP_STR |
| 4489 | "BGP view\n" |
| 4490 | "view name\n" |
| 4491 | "Clear all peers\n" |
| 4492 | "Soft reconfig\n" |
| 4493 | "Soft reconfig outbound update\n") |
| 4494 | |
| 4495 | ALIAS (clear_bgp_all_soft_out, |
| 4496 | clear_bgp_all_out_cmd, |
| 4497 | "clear bgp * out", |
| 4498 | CLEAR_STR |
| 4499 | BGP_STR |
| 4500 | "Clear all peers\n" |
| 4501 | "Soft reconfig outbound update\n") |
| 4502 | |
| 4503 | ALIAS (clear_bgp_all_soft_out, |
| 4504 | clear_bgp_ipv6_all_soft_out_cmd, |
| 4505 | "clear bgp ipv6 * soft out", |
| 4506 | CLEAR_STR |
| 4507 | BGP_STR |
| 4508 | "Address family\n" |
| 4509 | "Clear all peers\n" |
| 4510 | "Soft reconfig\n" |
| 4511 | "Soft reconfig outbound update\n") |
| 4512 | |
| 4513 | ALIAS (clear_bgp_all_soft_out, |
| 4514 | clear_bgp_ipv6_all_out_cmd, |
| 4515 | "clear bgp ipv6 * out", |
| 4516 | CLEAR_STR |
| 4517 | BGP_STR |
| 4518 | "Address family\n" |
| 4519 | "Clear all peers\n" |
| 4520 | "Soft reconfig outbound update\n") |
| 4521 | |
| 4522 | DEFUN (clear_ip_bgp_peer_soft_out, |
| 4523 | clear_ip_bgp_peer_soft_out_cmd, |
| 4524 | "clear ip bgp A.B.C.D soft out", |
| 4525 | CLEAR_STR |
| 4526 | IP_STR |
| 4527 | BGP_STR |
| 4528 | "BGP neighbor address to clear\n" |
| 4529 | "Soft reconfig\n" |
| 4530 | "Soft reconfig outbound update\n") |
| 4531 | { |
| 4532 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4533 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4534 | } |
| 4535 | |
| 4536 | ALIAS (clear_ip_bgp_peer_soft_out, |
| 4537 | clear_ip_bgp_peer_out_cmd, |
| 4538 | "clear ip bgp A.B.C.D out", |
| 4539 | CLEAR_STR |
| 4540 | IP_STR |
| 4541 | BGP_STR |
| 4542 | "BGP neighbor address to clear\n" |
| 4543 | "Soft reconfig outbound update\n") |
| 4544 | |
| 4545 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
| 4546 | clear_ip_bgp_peer_ipv4_soft_out_cmd, |
| 4547 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", |
| 4548 | CLEAR_STR |
| 4549 | IP_STR |
| 4550 | BGP_STR |
| 4551 | "BGP neighbor address to clear\n" |
| 4552 | "Address family\n" |
| 4553 | "Address Family modifier\n" |
| 4554 | "Address Family modifier\n" |
| 4555 | "Soft reconfig\n" |
| 4556 | "Soft reconfig outbound update\n") |
| 4557 | { |
| 4558 | if (strncmp (argv[1], "m", 1) == 0) |
| 4559 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 4560 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4561 | |
| 4562 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4563 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4564 | } |
| 4565 | |
| 4566 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, |
| 4567 | clear_ip_bgp_peer_ipv4_out_cmd, |
| 4568 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", |
| 4569 | CLEAR_STR |
| 4570 | IP_STR |
| 4571 | BGP_STR |
| 4572 | "BGP neighbor address to clear\n" |
| 4573 | "Address family\n" |
| 4574 | "Address Family modifier\n" |
| 4575 | "Address Family modifier\n" |
| 4576 | "Soft reconfig outbound update\n") |
| 4577 | |
| 4578 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4579 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, |
| 4580 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", |
| 4581 | CLEAR_STR |
| 4582 | IP_STR |
| 4583 | BGP_STR |
| 4584 | "BGP neighbor address to clear\n" |
| 4585 | "Address family\n" |
| 4586 | "Address Family Modifier\n" |
| 4587 | "Soft reconfig\n" |
| 4588 | "Soft reconfig outbound update\n") |
| 4589 | { |
| 4590 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 4591 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4592 | } |
| 4593 | |
| 4594 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4595 | clear_ip_bgp_peer_vpnv4_out_cmd, |
| 4596 | "clear ip bgp A.B.C.D vpnv4 unicast out", |
| 4597 | CLEAR_STR |
| 4598 | IP_STR |
| 4599 | BGP_STR |
| 4600 | "BGP neighbor address to clear\n" |
| 4601 | "Address family\n" |
| 4602 | "Address Family Modifier\n" |
| 4603 | "Soft reconfig outbound update\n") |
| 4604 | |
| 4605 | DEFUN (clear_bgp_peer_soft_out, |
| 4606 | clear_bgp_peer_soft_out_cmd, |
| 4607 | "clear bgp (A.B.C.D|X:X::X:X) soft out", |
| 4608 | CLEAR_STR |
| 4609 | BGP_STR |
| 4610 | "BGP neighbor address to clear\n" |
| 4611 | "BGP IPv6 neighbor to clear\n" |
| 4612 | "Soft reconfig\n" |
| 4613 | "Soft reconfig outbound update\n") |
| 4614 | { |
| 4615 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 4616 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4617 | } |
| 4618 | |
| 4619 | ALIAS (clear_bgp_peer_soft_out, |
| 4620 | clear_bgp_ipv6_peer_soft_out_cmd, |
| 4621 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out", |
| 4622 | CLEAR_STR |
| 4623 | BGP_STR |
| 4624 | "Address family\n" |
| 4625 | "BGP neighbor address to clear\n" |
| 4626 | "BGP IPv6 neighbor to clear\n" |
| 4627 | "Soft reconfig\n" |
| 4628 | "Soft reconfig outbound update\n") |
| 4629 | |
| 4630 | ALIAS (clear_bgp_peer_soft_out, |
| 4631 | clear_bgp_peer_out_cmd, |
| 4632 | "clear bgp (A.B.C.D|X:X::X:X) out", |
| 4633 | CLEAR_STR |
| 4634 | BGP_STR |
| 4635 | "BGP neighbor address to clear\n" |
| 4636 | "BGP IPv6 neighbor to clear\n" |
| 4637 | "Soft reconfig outbound update\n") |
| 4638 | |
| 4639 | ALIAS (clear_bgp_peer_soft_out, |
| 4640 | clear_bgp_ipv6_peer_out_cmd, |
| 4641 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) out", |
| 4642 | CLEAR_STR |
| 4643 | BGP_STR |
| 4644 | "Address family\n" |
| 4645 | "BGP neighbor address to clear\n" |
| 4646 | "BGP IPv6 neighbor to clear\n" |
| 4647 | "Soft reconfig outbound update\n") |
| 4648 | |
| 4649 | DEFUN (clear_ip_bgp_peer_group_soft_out, |
| 4650 | clear_ip_bgp_peer_group_soft_out_cmd, |
| 4651 | "clear ip bgp peer-group WORD soft out", |
| 4652 | CLEAR_STR |
| 4653 | IP_STR |
| 4654 | BGP_STR |
| 4655 | "Clear all members of peer-group\n" |
| 4656 | "BGP peer-group name\n" |
| 4657 | "Soft reconfig\n" |
| 4658 | "Soft reconfig outbound update\n") |
| 4659 | { |
| 4660 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4661 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4662 | } |
| 4663 | |
| 4664 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
| 4665 | clear_ip_bgp_peer_group_out_cmd, |
| 4666 | "clear ip bgp peer-group WORD out", |
| 4667 | CLEAR_STR |
| 4668 | IP_STR |
| 4669 | BGP_STR |
| 4670 | "Clear all members of peer-group\n" |
| 4671 | "BGP peer-group name\n" |
| 4672 | "Soft reconfig outbound update\n") |
| 4673 | |
| 4674 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4675 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, |
| 4676 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", |
| 4677 | CLEAR_STR |
| 4678 | IP_STR |
| 4679 | BGP_STR |
| 4680 | "Clear all members of peer-group\n" |
| 4681 | "BGP peer-group name\n" |
| 4682 | "Address family\n" |
| 4683 | "Address Family modifier\n" |
| 4684 | "Address Family modifier\n" |
| 4685 | "Soft reconfig\n" |
| 4686 | "Soft reconfig outbound update\n") |
| 4687 | { |
| 4688 | if (strncmp (argv[1], "m", 1) == 0) |
| 4689 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 4690 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4691 | |
| 4692 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4693 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4694 | } |
| 4695 | |
| 4696 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4697 | clear_ip_bgp_peer_group_ipv4_out_cmd, |
| 4698 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", |
| 4699 | CLEAR_STR |
| 4700 | IP_STR |
| 4701 | BGP_STR |
| 4702 | "Clear all members of peer-group\n" |
| 4703 | "BGP peer-group name\n" |
| 4704 | "Address family\n" |
| 4705 | "Address Family modifier\n" |
| 4706 | "Address Family modifier\n" |
| 4707 | "Soft reconfig outbound update\n") |
| 4708 | |
| 4709 | DEFUN (clear_bgp_peer_group_soft_out, |
| 4710 | clear_bgp_peer_group_soft_out_cmd, |
| 4711 | "clear bgp peer-group WORD soft out", |
| 4712 | CLEAR_STR |
| 4713 | BGP_STR |
| 4714 | "Clear all members of peer-group\n" |
| 4715 | "BGP peer-group name\n" |
| 4716 | "Soft reconfig\n" |
| 4717 | "Soft reconfig outbound update\n") |
| 4718 | { |
| 4719 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 4720 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4721 | } |
| 4722 | |
| 4723 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4724 | clear_bgp_ipv6_peer_group_soft_out_cmd, |
| 4725 | "clear bgp ipv6 peer-group WORD soft out", |
| 4726 | CLEAR_STR |
| 4727 | BGP_STR |
| 4728 | "Address family\n" |
| 4729 | "Clear all members of peer-group\n" |
| 4730 | "BGP peer-group name\n" |
| 4731 | "Soft reconfig\n" |
| 4732 | "Soft reconfig outbound update\n") |
| 4733 | |
| 4734 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4735 | clear_bgp_peer_group_out_cmd, |
| 4736 | "clear bgp peer-group WORD out", |
| 4737 | CLEAR_STR |
| 4738 | BGP_STR |
| 4739 | "Clear all members of peer-group\n" |
| 4740 | "BGP peer-group name\n" |
| 4741 | "Soft reconfig outbound update\n") |
| 4742 | |
| 4743 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4744 | clear_bgp_ipv6_peer_group_out_cmd, |
| 4745 | "clear bgp ipv6 peer-group WORD out", |
| 4746 | CLEAR_STR |
| 4747 | BGP_STR |
| 4748 | "Address family\n" |
| 4749 | "Clear all members of peer-group\n" |
| 4750 | "BGP peer-group name\n" |
| 4751 | "Soft reconfig outbound update\n") |
| 4752 | |
| 4753 | DEFUN (clear_ip_bgp_external_soft_out, |
| 4754 | clear_ip_bgp_external_soft_out_cmd, |
| 4755 | "clear ip bgp external soft out", |
| 4756 | CLEAR_STR |
| 4757 | IP_STR |
| 4758 | BGP_STR |
| 4759 | "Clear all external peers\n" |
| 4760 | "Soft reconfig\n" |
| 4761 | "Soft reconfig outbound update\n") |
| 4762 | { |
| 4763 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 4764 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4765 | } |
| 4766 | |
| 4767 | ALIAS (clear_ip_bgp_external_soft_out, |
| 4768 | clear_ip_bgp_external_out_cmd, |
| 4769 | "clear ip bgp external out", |
| 4770 | CLEAR_STR |
| 4771 | IP_STR |
| 4772 | BGP_STR |
| 4773 | "Clear all external peers\n" |
| 4774 | "Soft reconfig outbound update\n") |
| 4775 | |
| 4776 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, |
| 4777 | clear_ip_bgp_external_ipv4_soft_out_cmd, |
| 4778 | "clear ip bgp external ipv4 (unicast|multicast) soft out", |
| 4779 | CLEAR_STR |
| 4780 | IP_STR |
| 4781 | BGP_STR |
| 4782 | "Clear all external peers\n" |
| 4783 | "Address family\n" |
| 4784 | "Address Family modifier\n" |
| 4785 | "Address Family modifier\n" |
| 4786 | "Soft reconfig\n" |
| 4787 | "Soft reconfig outbound update\n") |
| 4788 | { |
| 4789 | if (strncmp (argv[0], "m", 1) == 0) |
| 4790 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 4791 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4792 | |
| 4793 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 4794 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4795 | } |
| 4796 | |
| 4797 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, |
| 4798 | clear_ip_bgp_external_ipv4_out_cmd, |
| 4799 | "clear ip bgp external ipv4 (unicast|multicast) out", |
| 4800 | CLEAR_STR |
| 4801 | IP_STR |
| 4802 | BGP_STR |
| 4803 | "Clear all external peers\n" |
| 4804 | "Address family\n" |
| 4805 | "Address Family modifier\n" |
| 4806 | "Address Family modifier\n" |
| 4807 | "Soft reconfig outbound update\n") |
| 4808 | |
| 4809 | DEFUN (clear_bgp_external_soft_out, |
| 4810 | clear_bgp_external_soft_out_cmd, |
| 4811 | "clear bgp external soft out", |
| 4812 | CLEAR_STR |
| 4813 | BGP_STR |
| 4814 | "Clear all external peers\n" |
| 4815 | "Soft reconfig\n" |
| 4816 | "Soft reconfig outbound update\n") |
| 4817 | { |
| 4818 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 4819 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4820 | } |
| 4821 | |
| 4822 | ALIAS (clear_bgp_external_soft_out, |
| 4823 | clear_bgp_ipv6_external_soft_out_cmd, |
| 4824 | "clear bgp ipv6 external soft out", |
| 4825 | CLEAR_STR |
| 4826 | BGP_STR |
| 4827 | "Address family\n" |
| 4828 | "Clear all external peers\n" |
| 4829 | "Soft reconfig\n" |
| 4830 | "Soft reconfig outbound update\n") |
| 4831 | |
| 4832 | ALIAS (clear_bgp_external_soft_out, |
| 4833 | clear_bgp_external_out_cmd, |
| 4834 | "clear bgp external out", |
| 4835 | CLEAR_STR |
| 4836 | BGP_STR |
| 4837 | "Clear all external peers\n" |
| 4838 | "Soft reconfig outbound update\n") |
| 4839 | |
| 4840 | ALIAS (clear_bgp_external_soft_out, |
| 4841 | clear_bgp_ipv6_external_out_cmd, |
| 4842 | "clear bgp ipv6 external WORD out", |
| 4843 | CLEAR_STR |
| 4844 | BGP_STR |
| 4845 | "Address family\n" |
| 4846 | "Clear all external peers\n" |
| 4847 | "Soft reconfig outbound update\n") |
| 4848 | |
| 4849 | DEFUN (clear_ip_bgp_as_soft_out, |
| 4850 | clear_ip_bgp_as_soft_out_cmd, |
| 4851 | "clear ip bgp <1-65535> soft out", |
| 4852 | CLEAR_STR |
| 4853 | IP_STR |
| 4854 | BGP_STR |
| 4855 | "Clear peers with the AS number\n" |
| 4856 | "Soft reconfig\n" |
| 4857 | "Soft reconfig outbound update\n") |
| 4858 | { |
| 4859 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 4860 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4861 | } |
| 4862 | |
| 4863 | ALIAS (clear_ip_bgp_as_soft_out, |
| 4864 | clear_ip_bgp_as_out_cmd, |
| 4865 | "clear ip bgp <1-65535> out", |
| 4866 | CLEAR_STR |
| 4867 | IP_STR |
| 4868 | BGP_STR |
| 4869 | "Clear peers with the AS number\n" |
| 4870 | "Soft reconfig outbound update\n") |
| 4871 | |
| 4872 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
| 4873 | clear_ip_bgp_as_ipv4_soft_out_cmd, |
| 4874 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft out", |
| 4875 | CLEAR_STR |
| 4876 | IP_STR |
| 4877 | BGP_STR |
| 4878 | "Clear peers with the AS number\n" |
| 4879 | "Address family\n" |
| 4880 | "Address Family modifier\n" |
| 4881 | "Address Family modifier\n" |
| 4882 | "Soft reconfig\n" |
| 4883 | "Soft reconfig outbound update\n") |
| 4884 | { |
| 4885 | if (strncmp (argv[1], "m", 1) == 0) |
| 4886 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 4887 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4888 | |
| 4889 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 4890 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4891 | } |
| 4892 | |
| 4893 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, |
| 4894 | clear_ip_bgp_as_ipv4_out_cmd, |
| 4895 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) out", |
| 4896 | CLEAR_STR |
| 4897 | IP_STR |
| 4898 | BGP_STR |
| 4899 | "Clear peers with the AS number\n" |
| 4900 | "Address family\n" |
| 4901 | "Address Family modifier\n" |
| 4902 | "Address Family modifier\n" |
| 4903 | "Soft reconfig outbound update\n") |
| 4904 | |
| 4905 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
| 4906 | clear_ip_bgp_as_vpnv4_soft_out_cmd, |
| 4907 | "clear ip bgp <1-65535> vpnv4 unicast soft out", |
| 4908 | CLEAR_STR |
| 4909 | IP_STR |
| 4910 | BGP_STR |
| 4911 | "Clear peers with the AS number\n" |
| 4912 | "Address family\n" |
| 4913 | "Address Family modifier\n" |
| 4914 | "Soft reconfig\n" |
| 4915 | "Soft reconfig outbound update\n") |
| 4916 | { |
| 4917 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 4918 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4919 | } |
| 4920 | |
| 4921 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, |
| 4922 | clear_ip_bgp_as_vpnv4_out_cmd, |
| 4923 | "clear ip bgp <1-65535> vpnv4 unicast out", |
| 4924 | CLEAR_STR |
| 4925 | IP_STR |
| 4926 | BGP_STR |
| 4927 | "Clear peers with the AS number\n" |
| 4928 | "Address family\n" |
| 4929 | "Address Family modifier\n" |
| 4930 | "Soft reconfig outbound update\n") |
| 4931 | |
| 4932 | DEFUN (clear_bgp_as_soft_out, |
| 4933 | clear_bgp_as_soft_out_cmd, |
| 4934 | "clear bgp <1-65535> soft out", |
| 4935 | CLEAR_STR |
| 4936 | BGP_STR |
| 4937 | "Clear peers with the AS number\n" |
| 4938 | "Soft reconfig\n" |
| 4939 | "Soft reconfig outbound update\n") |
| 4940 | { |
| 4941 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 4942 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4943 | } |
| 4944 | |
| 4945 | ALIAS (clear_bgp_as_soft_out, |
| 4946 | clear_bgp_ipv6_as_soft_out_cmd, |
| 4947 | "clear bgp ipv6 <1-65535> soft out", |
| 4948 | CLEAR_STR |
| 4949 | BGP_STR |
| 4950 | "Address family\n" |
| 4951 | "Clear peers with the AS number\n" |
| 4952 | "Soft reconfig\n" |
| 4953 | "Soft reconfig outbound update\n") |
| 4954 | |
| 4955 | ALIAS (clear_bgp_as_soft_out, |
| 4956 | clear_bgp_as_out_cmd, |
| 4957 | "clear bgp <1-65535> out", |
| 4958 | CLEAR_STR |
| 4959 | BGP_STR |
| 4960 | "Clear peers with the AS number\n" |
| 4961 | "Soft reconfig outbound update\n") |
| 4962 | |
| 4963 | ALIAS (clear_bgp_as_soft_out, |
| 4964 | clear_bgp_ipv6_as_out_cmd, |
| 4965 | "clear bgp ipv6 <1-65535> out", |
| 4966 | CLEAR_STR |
| 4967 | BGP_STR |
| 4968 | "Address family\n" |
| 4969 | "Clear peers with the AS number\n" |
| 4970 | "Soft reconfig outbound update\n") |
| 4971 | |
| 4972 | /* Inbound soft-reconfiguration */ |
| 4973 | DEFUN (clear_ip_bgp_all_soft_in, |
| 4974 | clear_ip_bgp_all_soft_in_cmd, |
| 4975 | "clear ip bgp * soft in", |
| 4976 | CLEAR_STR |
| 4977 | IP_STR |
| 4978 | BGP_STR |
| 4979 | "Clear all peers\n" |
| 4980 | "Soft reconfig\n" |
| 4981 | "Soft reconfig inbound update\n") |
| 4982 | { |
| 4983 | if (argc == 1) |
| 4984 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4985 | BGP_CLEAR_SOFT_IN, NULL); |
| 4986 | |
| 4987 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4988 | BGP_CLEAR_SOFT_IN, NULL); |
| 4989 | } |
| 4990 | |
| 4991 | ALIAS (clear_ip_bgp_all_soft_in, |
| 4992 | clear_ip_bgp_instance_all_soft_in_cmd, |
| 4993 | "clear ip bgp view WORD * soft in", |
| 4994 | CLEAR_STR |
| 4995 | IP_STR |
| 4996 | BGP_STR |
| 4997 | "BGP view\n" |
| 4998 | "view name\n" |
| 4999 | "Clear all peers\n" |
| 5000 | "Soft reconfig\n" |
| 5001 | "Soft reconfig inbound update\n") |
| 5002 | |
| 5003 | ALIAS (clear_ip_bgp_all_soft_in, |
| 5004 | clear_ip_bgp_all_in_cmd, |
| 5005 | "clear ip bgp * in", |
| 5006 | CLEAR_STR |
| 5007 | IP_STR |
| 5008 | BGP_STR |
| 5009 | "Clear all peers\n" |
| 5010 | "Soft reconfig inbound update\n") |
| 5011 | |
| 5012 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
| 5013 | clear_ip_bgp_all_in_prefix_filter_cmd, |
| 5014 | "clear ip bgp * in prefix-filter", |
| 5015 | CLEAR_STR |
| 5016 | IP_STR |
| 5017 | BGP_STR |
| 5018 | "Clear all peers\n" |
| 5019 | "Soft reconfig inbound update\n" |
| 5020 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5021 | { |
| 5022 | if (argc== 1) |
| 5023 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5024 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5025 | |
| 5026 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5027 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5028 | } |
| 5029 | |
| 5030 | ALIAS (clear_ip_bgp_all_in_prefix_filter, |
| 5031 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, |
| 5032 | "clear ip bgp view WORD * in prefix-filter", |
| 5033 | CLEAR_STR |
| 5034 | IP_STR |
| 5035 | BGP_STR |
| 5036 | "BGP view\n" |
| 5037 | "view name\n" |
| 5038 | "Clear all peers\n" |
| 5039 | "Soft reconfig inbound update\n" |
| 5040 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5041 | |
| 5042 | |
| 5043 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
| 5044 | clear_ip_bgp_all_ipv4_soft_in_cmd, |
| 5045 | "clear ip bgp * ipv4 (unicast|multicast) soft in", |
| 5046 | CLEAR_STR |
| 5047 | IP_STR |
| 5048 | BGP_STR |
| 5049 | "Clear all peers\n" |
| 5050 | "Address family\n" |
| 5051 | "Address Family modifier\n" |
| 5052 | "Address Family modifier\n" |
| 5053 | "Soft reconfig\n" |
| 5054 | "Soft reconfig inbound update\n") |
| 5055 | { |
| 5056 | if (strncmp (argv[0], "m", 1) == 0) |
| 5057 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5058 | BGP_CLEAR_SOFT_IN, NULL); |
| 5059 | |
| 5060 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5061 | BGP_CLEAR_SOFT_IN, NULL); |
| 5062 | } |
| 5063 | |
| 5064 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, |
| 5065 | clear_ip_bgp_all_ipv4_in_cmd, |
| 5066 | "clear ip bgp * ipv4 (unicast|multicast) in", |
| 5067 | CLEAR_STR |
| 5068 | IP_STR |
| 5069 | BGP_STR |
| 5070 | "Clear all peers\n" |
| 5071 | "Address family\n" |
| 5072 | "Address Family modifier\n" |
| 5073 | "Address Family modifier\n" |
| 5074 | "Soft reconfig inbound update\n") |
| 5075 | |
| 5076 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
| 5077 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, |
| 5078 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", |
| 5079 | CLEAR_STR |
| 5080 | IP_STR |
| 5081 | BGP_STR |
| 5082 | "BGP view\n" |
| 5083 | "view name\n" |
| 5084 | "Clear all peers\n" |
| 5085 | "Address family\n" |
| 5086 | "Address Family modifier\n" |
| 5087 | "Address Family modifier\n" |
| 5088 | "Soft reconfig\n" |
| 5089 | "Soft reconfig inbound update\n") |
| 5090 | { |
| 5091 | if (strncmp (argv[1], "m", 1) == 0) |
| 5092 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5093 | BGP_CLEAR_SOFT_IN, NULL); |
| 5094 | |
| 5095 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5096 | BGP_CLEAR_SOFT_IN, NULL); |
| 5097 | } |
| 5098 | |
| 5099 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
| 5100 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, |
| 5101 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", |
| 5102 | CLEAR_STR |
| 5103 | IP_STR |
| 5104 | BGP_STR |
| 5105 | "Clear all peers\n" |
| 5106 | "Address family\n" |
| 5107 | "Address Family modifier\n" |
| 5108 | "Address Family modifier\n" |
| 5109 | "Soft reconfig inbound update\n" |
| 5110 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5111 | { |
| 5112 | if (strncmp (argv[0], "m", 1) == 0) |
| 5113 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5114 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5115 | |
| 5116 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5117 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5118 | } |
| 5119 | |
| 5120 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, |
| 5121 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, |
| 5122 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", |
| 5123 | CLEAR_STR |
| 5124 | IP_STR |
| 5125 | BGP_STR |
| 5126 | "Clear all peers\n" |
| 5127 | "Address family\n" |
| 5128 | "Address Family modifier\n" |
| 5129 | "Address Family modifier\n" |
| 5130 | "Soft reconfig inbound update\n" |
| 5131 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5132 | { |
| 5133 | if (strncmp (argv[1], "m", 1) == 0) |
| 5134 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5135 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5136 | |
| 5137 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5138 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5139 | } |
| 5140 | |
| 5141 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, |
| 5142 | clear_ip_bgp_all_vpnv4_soft_in_cmd, |
| 5143 | "clear ip bgp * vpnv4 unicast soft in", |
| 5144 | CLEAR_STR |
| 5145 | IP_STR |
| 5146 | BGP_STR |
| 5147 | "Clear all peers\n" |
| 5148 | "Address family\n" |
| 5149 | "Address Family Modifier\n" |
| 5150 | "Soft reconfig\n" |
| 5151 | "Soft reconfig inbound update\n") |
| 5152 | { |
| 5153 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 5154 | BGP_CLEAR_SOFT_IN, NULL); |
| 5155 | } |
| 5156 | |
| 5157 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, |
| 5158 | clear_ip_bgp_all_vpnv4_in_cmd, |
| 5159 | "clear ip bgp * vpnv4 unicast in", |
| 5160 | CLEAR_STR |
| 5161 | IP_STR |
| 5162 | BGP_STR |
| 5163 | "Clear all peers\n" |
| 5164 | "Address family\n" |
| 5165 | "Address Family Modifier\n" |
| 5166 | "Soft reconfig inbound update\n") |
| 5167 | |
| 5168 | DEFUN (clear_bgp_all_soft_in, |
| 5169 | clear_bgp_all_soft_in_cmd, |
| 5170 | "clear bgp * soft in", |
| 5171 | CLEAR_STR |
| 5172 | BGP_STR |
| 5173 | "Clear all peers\n" |
| 5174 | "Soft reconfig\n" |
| 5175 | "Soft reconfig inbound update\n") |
| 5176 | { |
| 5177 | if (argc == 1) |
| 5178 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 5179 | BGP_CLEAR_SOFT_IN, NULL); |
| 5180 | |
| 5181 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5182 | BGP_CLEAR_SOFT_IN, NULL); |
| 5183 | } |
| 5184 | |
| 5185 | ALIAS (clear_bgp_all_soft_in, |
| 5186 | clear_bgp_instance_all_soft_in_cmd, |
| 5187 | "clear bgp view WORD * soft in", |
| 5188 | CLEAR_STR |
| 5189 | BGP_STR |
| 5190 | "BGP view\n" |
| 5191 | "view name\n" |
| 5192 | "Clear all peers\n" |
| 5193 | "Soft reconfig\n" |
| 5194 | "Soft reconfig inbound update\n") |
| 5195 | |
| 5196 | ALIAS (clear_bgp_all_soft_in, |
| 5197 | clear_bgp_ipv6_all_soft_in_cmd, |
| 5198 | "clear bgp ipv6 * soft in", |
| 5199 | CLEAR_STR |
| 5200 | BGP_STR |
| 5201 | "Address family\n" |
| 5202 | "Clear all peers\n" |
| 5203 | "Soft reconfig\n" |
| 5204 | "Soft reconfig inbound update\n") |
| 5205 | |
| 5206 | ALIAS (clear_bgp_all_soft_in, |
| 5207 | clear_bgp_all_in_cmd, |
| 5208 | "clear bgp * in", |
| 5209 | CLEAR_STR |
| 5210 | BGP_STR |
| 5211 | "Clear all peers\n" |
| 5212 | "Soft reconfig inbound update\n") |
| 5213 | |
| 5214 | ALIAS (clear_bgp_all_soft_in, |
| 5215 | clear_bgp_ipv6_all_in_cmd, |
| 5216 | "clear bgp ipv6 * in", |
| 5217 | CLEAR_STR |
| 5218 | BGP_STR |
| 5219 | "Address family\n" |
| 5220 | "Clear all peers\n" |
| 5221 | "Soft reconfig inbound update\n") |
| 5222 | |
| 5223 | DEFUN (clear_bgp_all_in_prefix_filter, |
| 5224 | clear_bgp_all_in_prefix_filter_cmd, |
| 5225 | "clear bgp * in prefix-filter", |
| 5226 | CLEAR_STR |
| 5227 | BGP_STR |
| 5228 | "Clear all peers\n" |
| 5229 | "Soft reconfig inbound update\n" |
| 5230 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5231 | { |
| 5232 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5233 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5234 | } |
| 5235 | |
| 5236 | ALIAS (clear_bgp_all_in_prefix_filter, |
| 5237 | clear_bgp_ipv6_all_in_prefix_filter_cmd, |
| 5238 | "clear bgp ipv6 * in prefix-filter", |
| 5239 | CLEAR_STR |
| 5240 | BGP_STR |
| 5241 | "Address family\n" |
| 5242 | "Clear all peers\n" |
| 5243 | "Soft reconfig inbound update\n" |
| 5244 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5245 | |
| 5246 | DEFUN (clear_ip_bgp_peer_soft_in, |
| 5247 | clear_ip_bgp_peer_soft_in_cmd, |
| 5248 | "clear ip bgp A.B.C.D soft in", |
| 5249 | CLEAR_STR |
| 5250 | IP_STR |
| 5251 | BGP_STR |
| 5252 | "BGP neighbor address to clear\n" |
| 5253 | "Soft reconfig\n" |
| 5254 | "Soft reconfig inbound update\n") |
| 5255 | { |
| 5256 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5257 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5258 | } |
| 5259 | |
| 5260 | ALIAS (clear_ip_bgp_peer_soft_in, |
| 5261 | clear_ip_bgp_peer_in_cmd, |
| 5262 | "clear ip bgp A.B.C.D in", |
| 5263 | CLEAR_STR |
| 5264 | IP_STR |
| 5265 | BGP_STR |
| 5266 | "BGP neighbor address to clear\n" |
| 5267 | "Soft reconfig inbound update\n") |
| 5268 | |
| 5269 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
| 5270 | clear_ip_bgp_peer_in_prefix_filter_cmd, |
| 5271 | "clear ip bgp A.B.C.D in prefix-filter", |
| 5272 | CLEAR_STR |
| 5273 | IP_STR |
| 5274 | BGP_STR |
| 5275 | "BGP neighbor address to clear\n" |
| 5276 | "Soft reconfig inbound update\n" |
| 5277 | "Push out the existing ORF prefix-list\n") |
| 5278 | { |
| 5279 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5280 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5281 | } |
| 5282 | |
| 5283 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, |
| 5284 | clear_ip_bgp_peer_ipv4_soft_in_cmd, |
| 5285 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", |
| 5286 | CLEAR_STR |
| 5287 | IP_STR |
| 5288 | BGP_STR |
| 5289 | "BGP neighbor address to clear\n" |
| 5290 | "Address family\n" |
| 5291 | "Address Family modifier\n" |
| 5292 | "Address Family modifier\n" |
| 5293 | "Soft reconfig\n" |
| 5294 | "Soft reconfig inbound update\n") |
| 5295 | { |
| 5296 | if (strncmp (argv[1], "m", 1) == 0) |
| 5297 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5298 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5299 | |
| 5300 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5301 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5302 | } |
| 5303 | |
| 5304 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, |
| 5305 | clear_ip_bgp_peer_ipv4_in_cmd, |
| 5306 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", |
| 5307 | CLEAR_STR |
| 5308 | IP_STR |
| 5309 | BGP_STR |
| 5310 | "BGP neighbor address to clear\n" |
| 5311 | "Address family\n" |
| 5312 | "Address Family modifier\n" |
| 5313 | "Address Family modifier\n" |
| 5314 | "Soft reconfig inbound update\n") |
| 5315 | |
| 5316 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
| 5317 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, |
| 5318 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", |
| 5319 | CLEAR_STR |
| 5320 | IP_STR |
| 5321 | BGP_STR |
| 5322 | "BGP neighbor address to clear\n" |
| 5323 | "Address family\n" |
| 5324 | "Address Family modifier\n" |
| 5325 | "Address Family modifier\n" |
| 5326 | "Soft reconfig inbound update\n" |
| 5327 | "Push out the existing ORF prefix-list\n") |
| 5328 | { |
| 5329 | if (strncmp (argv[1], "m", 1) == 0) |
| 5330 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5331 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5332 | |
| 5333 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5334 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5335 | } |
| 5336 | |
| 5337 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5338 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, |
| 5339 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", |
| 5340 | CLEAR_STR |
| 5341 | IP_STR |
| 5342 | BGP_STR |
| 5343 | "BGP neighbor address to clear\n" |
| 5344 | "Address family\n" |
| 5345 | "Address Family Modifier\n" |
| 5346 | "Soft reconfig\n" |
| 5347 | "Soft reconfig inbound update\n") |
| 5348 | { |
| 5349 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 5350 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5351 | } |
| 5352 | |
| 5353 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5354 | clear_ip_bgp_peer_vpnv4_in_cmd, |
| 5355 | "clear ip bgp A.B.C.D vpnv4 unicast in", |
| 5356 | CLEAR_STR |
| 5357 | IP_STR |
| 5358 | BGP_STR |
| 5359 | "BGP neighbor address to clear\n" |
| 5360 | "Address family\n" |
| 5361 | "Address Family Modifier\n" |
| 5362 | "Soft reconfig inbound update\n") |
| 5363 | |
| 5364 | DEFUN (clear_bgp_peer_soft_in, |
| 5365 | clear_bgp_peer_soft_in_cmd, |
| 5366 | "clear bgp (A.B.C.D|X:X::X:X) soft in", |
| 5367 | CLEAR_STR |
| 5368 | BGP_STR |
| 5369 | "BGP neighbor address to clear\n" |
| 5370 | "BGP IPv6 neighbor to clear\n" |
| 5371 | "Soft reconfig\n" |
| 5372 | "Soft reconfig inbound update\n") |
| 5373 | { |
| 5374 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5375 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5376 | } |
| 5377 | |
| 5378 | ALIAS (clear_bgp_peer_soft_in, |
| 5379 | clear_bgp_ipv6_peer_soft_in_cmd, |
| 5380 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in", |
| 5381 | CLEAR_STR |
| 5382 | BGP_STR |
| 5383 | "Address family\n" |
| 5384 | "BGP neighbor address to clear\n" |
| 5385 | "BGP IPv6 neighbor to clear\n" |
| 5386 | "Soft reconfig\n" |
| 5387 | "Soft reconfig inbound update\n") |
| 5388 | |
| 5389 | ALIAS (clear_bgp_peer_soft_in, |
| 5390 | clear_bgp_peer_in_cmd, |
| 5391 | "clear bgp (A.B.C.D|X:X::X:X) in", |
| 5392 | CLEAR_STR |
| 5393 | BGP_STR |
| 5394 | "BGP neighbor address to clear\n" |
| 5395 | "BGP IPv6 neighbor to clear\n" |
| 5396 | "Soft reconfig inbound update\n") |
| 5397 | |
| 5398 | ALIAS (clear_bgp_peer_soft_in, |
| 5399 | clear_bgp_ipv6_peer_in_cmd, |
| 5400 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in", |
| 5401 | CLEAR_STR |
| 5402 | BGP_STR |
| 5403 | "Address family\n" |
| 5404 | "BGP neighbor address to clear\n" |
| 5405 | "BGP IPv6 neighbor to clear\n" |
| 5406 | "Soft reconfig inbound update\n") |
| 5407 | |
| 5408 | DEFUN (clear_bgp_peer_in_prefix_filter, |
| 5409 | clear_bgp_peer_in_prefix_filter_cmd, |
| 5410 | "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5411 | CLEAR_STR |
| 5412 | BGP_STR |
| 5413 | "BGP neighbor address to clear\n" |
| 5414 | "BGP IPv6 neighbor to clear\n" |
| 5415 | "Soft reconfig inbound update\n" |
| 5416 | "Push out the existing ORF prefix-list\n") |
| 5417 | { |
| 5418 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5419 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5420 | } |
| 5421 | |
| 5422 | ALIAS (clear_bgp_peer_in_prefix_filter, |
| 5423 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, |
| 5424 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5425 | CLEAR_STR |
| 5426 | BGP_STR |
| 5427 | "Address family\n" |
| 5428 | "BGP neighbor address to clear\n" |
| 5429 | "BGP IPv6 neighbor to clear\n" |
| 5430 | "Soft reconfig inbound update\n" |
| 5431 | "Push out the existing ORF prefix-list\n") |
| 5432 | |
| 5433 | DEFUN (clear_ip_bgp_peer_group_soft_in, |
| 5434 | clear_ip_bgp_peer_group_soft_in_cmd, |
| 5435 | "clear ip bgp peer-group WORD soft in", |
| 5436 | CLEAR_STR |
| 5437 | IP_STR |
| 5438 | BGP_STR |
| 5439 | "Clear all members of peer-group\n" |
| 5440 | "BGP peer-group name\n" |
| 5441 | "Soft reconfig\n" |
| 5442 | "Soft reconfig inbound update\n") |
| 5443 | { |
| 5444 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5445 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5446 | } |
| 5447 | |
| 5448 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
| 5449 | clear_ip_bgp_peer_group_in_cmd, |
| 5450 | "clear ip bgp peer-group WORD in", |
| 5451 | CLEAR_STR |
| 5452 | IP_STR |
| 5453 | BGP_STR |
| 5454 | "Clear all members of peer-group\n" |
| 5455 | "BGP peer-group name\n" |
| 5456 | "Soft reconfig inbound update\n") |
| 5457 | |
| 5458 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
| 5459 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, |
| 5460 | "clear ip bgp peer-group WORD in prefix-filter", |
| 5461 | CLEAR_STR |
| 5462 | IP_STR |
| 5463 | BGP_STR |
| 5464 | "Clear all members of peer-group\n" |
| 5465 | "BGP peer-group name\n" |
| 5466 | "Soft reconfig inbound update\n" |
| 5467 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5468 | { |
| 5469 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5470 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5471 | } |
| 5472 | |
| 5473 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5474 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, |
| 5475 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", |
| 5476 | CLEAR_STR |
| 5477 | IP_STR |
| 5478 | BGP_STR |
| 5479 | "Clear all members of peer-group\n" |
| 5480 | "BGP peer-group name\n" |
| 5481 | "Address family\n" |
| 5482 | "Address Family modifier\n" |
| 5483 | "Address Family modifier\n" |
| 5484 | "Soft reconfig\n" |
| 5485 | "Soft reconfig inbound update\n") |
| 5486 | { |
| 5487 | if (strncmp (argv[1], "m", 1) == 0) |
| 5488 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5489 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5490 | |
| 5491 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5492 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5493 | } |
| 5494 | |
| 5495 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5496 | clear_ip_bgp_peer_group_ipv4_in_cmd, |
| 5497 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", |
| 5498 | CLEAR_STR |
| 5499 | IP_STR |
| 5500 | BGP_STR |
| 5501 | "Clear all members of peer-group\n" |
| 5502 | "BGP peer-group name\n" |
| 5503 | "Address family\n" |
| 5504 | "Address Family modifier\n" |
| 5505 | "Address Family modifier\n" |
| 5506 | "Soft reconfig inbound update\n") |
| 5507 | |
| 5508 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
| 5509 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, |
| 5510 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", |
| 5511 | CLEAR_STR |
| 5512 | IP_STR |
| 5513 | BGP_STR |
| 5514 | "Clear all members of peer-group\n" |
| 5515 | "BGP peer-group name\n" |
| 5516 | "Address family\n" |
| 5517 | "Address Family modifier\n" |
| 5518 | "Address Family modifier\n" |
| 5519 | "Soft reconfig inbound update\n" |
| 5520 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5521 | { |
| 5522 | if (strncmp (argv[1], "m", 1) == 0) |
| 5523 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5524 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5525 | |
| 5526 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5527 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5528 | } |
| 5529 | |
| 5530 | DEFUN (clear_bgp_peer_group_soft_in, |
| 5531 | clear_bgp_peer_group_soft_in_cmd, |
| 5532 | "clear bgp peer-group WORD soft in", |
| 5533 | CLEAR_STR |
| 5534 | BGP_STR |
| 5535 | "Clear all members of peer-group\n" |
| 5536 | "BGP peer-group name\n" |
| 5537 | "Soft reconfig\n" |
| 5538 | "Soft reconfig inbound update\n") |
| 5539 | { |
| 5540 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5541 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5542 | } |
| 5543 | |
| 5544 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5545 | clear_bgp_ipv6_peer_group_soft_in_cmd, |
| 5546 | "clear bgp ipv6 peer-group WORD soft in", |
| 5547 | CLEAR_STR |
| 5548 | BGP_STR |
| 5549 | "Address family\n" |
| 5550 | "Clear all members of peer-group\n" |
| 5551 | "BGP peer-group name\n" |
| 5552 | "Soft reconfig\n" |
| 5553 | "Soft reconfig inbound update\n") |
| 5554 | |
| 5555 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5556 | clear_bgp_peer_group_in_cmd, |
| 5557 | "clear bgp peer-group WORD in", |
| 5558 | CLEAR_STR |
| 5559 | BGP_STR |
| 5560 | "Clear all members of peer-group\n" |
| 5561 | "BGP peer-group name\n" |
| 5562 | "Soft reconfig inbound update\n") |
| 5563 | |
| 5564 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5565 | clear_bgp_ipv6_peer_group_in_cmd, |
| 5566 | "clear bgp ipv6 peer-group WORD in", |
| 5567 | CLEAR_STR |
| 5568 | BGP_STR |
| 5569 | "Address family\n" |
| 5570 | "Clear all members of peer-group\n" |
| 5571 | "BGP peer-group name\n" |
| 5572 | "Soft reconfig inbound update\n") |
| 5573 | |
| 5574 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
| 5575 | clear_bgp_peer_group_in_prefix_filter_cmd, |
| 5576 | "clear bgp peer-group WORD in prefix-filter", |
| 5577 | CLEAR_STR |
| 5578 | BGP_STR |
| 5579 | "Clear all members of peer-group\n" |
| 5580 | "BGP peer-group name\n" |
| 5581 | "Soft reconfig inbound update\n" |
| 5582 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5583 | { |
| 5584 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5585 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5586 | } |
| 5587 | |
| 5588 | ALIAS (clear_bgp_peer_group_in_prefix_filter, |
| 5589 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, |
| 5590 | "clear bgp ipv6 peer-group WORD in prefix-filter", |
| 5591 | CLEAR_STR |
| 5592 | BGP_STR |
| 5593 | "Address family\n" |
| 5594 | "Clear all members of peer-group\n" |
| 5595 | "BGP peer-group name\n" |
| 5596 | "Soft reconfig inbound update\n" |
| 5597 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5598 | |
| 5599 | DEFUN (clear_ip_bgp_external_soft_in, |
| 5600 | clear_ip_bgp_external_soft_in_cmd, |
| 5601 | "clear ip bgp external soft in", |
| 5602 | CLEAR_STR |
| 5603 | IP_STR |
| 5604 | BGP_STR |
| 5605 | "Clear all external peers\n" |
| 5606 | "Soft reconfig\n" |
| 5607 | "Soft reconfig inbound update\n") |
| 5608 | { |
| 5609 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5610 | BGP_CLEAR_SOFT_IN, NULL); |
| 5611 | } |
| 5612 | |
| 5613 | ALIAS (clear_ip_bgp_external_soft_in, |
| 5614 | clear_ip_bgp_external_in_cmd, |
| 5615 | "clear ip bgp external in", |
| 5616 | CLEAR_STR |
| 5617 | IP_STR |
| 5618 | BGP_STR |
| 5619 | "Clear all external peers\n" |
| 5620 | "Soft reconfig inbound update\n") |
| 5621 | |
| 5622 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
| 5623 | clear_ip_bgp_external_in_prefix_filter_cmd, |
| 5624 | "clear ip bgp external in prefix-filter", |
| 5625 | CLEAR_STR |
| 5626 | IP_STR |
| 5627 | BGP_STR |
| 5628 | "Clear all external peers\n" |
| 5629 | "Soft reconfig inbound update\n" |
| 5630 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5631 | { |
| 5632 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5633 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5634 | } |
| 5635 | |
| 5636 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, |
| 5637 | clear_ip_bgp_external_ipv4_soft_in_cmd, |
| 5638 | "clear ip bgp external ipv4 (unicast|multicast) soft in", |
| 5639 | CLEAR_STR |
| 5640 | IP_STR |
| 5641 | BGP_STR |
| 5642 | "Clear all external peers\n" |
| 5643 | "Address family\n" |
| 5644 | "Address Family modifier\n" |
| 5645 | "Address Family modifier\n" |
| 5646 | "Soft reconfig\n" |
| 5647 | "Soft reconfig inbound update\n") |
| 5648 | { |
| 5649 | if (strncmp (argv[0], "m", 1) == 0) |
| 5650 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5651 | BGP_CLEAR_SOFT_IN, NULL); |
| 5652 | |
| 5653 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5654 | BGP_CLEAR_SOFT_IN, NULL); |
| 5655 | } |
| 5656 | |
| 5657 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, |
| 5658 | clear_ip_bgp_external_ipv4_in_cmd, |
| 5659 | "clear ip bgp external ipv4 (unicast|multicast) in", |
| 5660 | CLEAR_STR |
| 5661 | IP_STR |
| 5662 | BGP_STR |
| 5663 | "Clear all external peers\n" |
| 5664 | "Address family\n" |
| 5665 | "Address Family modifier\n" |
| 5666 | "Address Family modifier\n" |
| 5667 | "Soft reconfig inbound update\n") |
| 5668 | |
| 5669 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
| 5670 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, |
| 5671 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", |
| 5672 | CLEAR_STR |
| 5673 | IP_STR |
| 5674 | BGP_STR |
| 5675 | "Clear all external peers\n" |
| 5676 | "Address family\n" |
| 5677 | "Address Family modifier\n" |
| 5678 | "Address Family modifier\n" |
| 5679 | "Soft reconfig inbound update\n" |
| 5680 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5681 | { |
| 5682 | if (strncmp (argv[0], "m", 1) == 0) |
| 5683 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5684 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5685 | |
| 5686 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5687 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5688 | } |
| 5689 | |
| 5690 | DEFUN (clear_bgp_external_soft_in, |
| 5691 | clear_bgp_external_soft_in_cmd, |
| 5692 | "clear bgp external soft in", |
| 5693 | CLEAR_STR |
| 5694 | BGP_STR |
| 5695 | "Clear all external peers\n" |
| 5696 | "Soft reconfig\n" |
| 5697 | "Soft reconfig inbound update\n") |
| 5698 | { |
| 5699 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5700 | BGP_CLEAR_SOFT_IN, NULL); |
| 5701 | } |
| 5702 | |
| 5703 | ALIAS (clear_bgp_external_soft_in, |
| 5704 | clear_bgp_ipv6_external_soft_in_cmd, |
| 5705 | "clear bgp ipv6 external soft in", |
| 5706 | CLEAR_STR |
| 5707 | BGP_STR |
| 5708 | "Address family\n" |
| 5709 | "Clear all external peers\n" |
| 5710 | "Soft reconfig\n" |
| 5711 | "Soft reconfig inbound update\n") |
| 5712 | |
| 5713 | ALIAS (clear_bgp_external_soft_in, |
| 5714 | clear_bgp_external_in_cmd, |
| 5715 | "clear bgp external in", |
| 5716 | CLEAR_STR |
| 5717 | BGP_STR |
| 5718 | "Clear all external peers\n" |
| 5719 | "Soft reconfig inbound update\n") |
| 5720 | |
| 5721 | ALIAS (clear_bgp_external_soft_in, |
| 5722 | clear_bgp_ipv6_external_in_cmd, |
| 5723 | "clear bgp ipv6 external WORD in", |
| 5724 | CLEAR_STR |
| 5725 | BGP_STR |
| 5726 | "Address family\n" |
| 5727 | "Clear all external peers\n" |
| 5728 | "Soft reconfig inbound update\n") |
| 5729 | |
| 5730 | DEFUN (clear_bgp_external_in_prefix_filter, |
| 5731 | clear_bgp_external_in_prefix_filter_cmd, |
| 5732 | "clear bgp external in prefix-filter", |
| 5733 | CLEAR_STR |
| 5734 | BGP_STR |
| 5735 | "Clear all external peers\n" |
| 5736 | "Soft reconfig inbound update\n" |
| 5737 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5738 | { |
| 5739 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5740 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5741 | } |
| 5742 | |
| 5743 | ALIAS (clear_bgp_external_in_prefix_filter, |
| 5744 | clear_bgp_ipv6_external_in_prefix_filter_cmd, |
| 5745 | "clear bgp ipv6 external in prefix-filter", |
| 5746 | CLEAR_STR |
| 5747 | BGP_STR |
| 5748 | "Address family\n" |
| 5749 | "Clear all external peers\n" |
| 5750 | "Soft reconfig inbound update\n" |
| 5751 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5752 | |
| 5753 | DEFUN (clear_ip_bgp_as_soft_in, |
| 5754 | clear_ip_bgp_as_soft_in_cmd, |
| 5755 | "clear ip bgp <1-65535> soft in", |
| 5756 | CLEAR_STR |
| 5757 | IP_STR |
| 5758 | BGP_STR |
| 5759 | "Clear peers with the AS number\n" |
| 5760 | "Soft reconfig\n" |
| 5761 | "Soft reconfig inbound update\n") |
| 5762 | { |
| 5763 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5764 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5765 | } |
| 5766 | |
| 5767 | ALIAS (clear_ip_bgp_as_soft_in, |
| 5768 | clear_ip_bgp_as_in_cmd, |
| 5769 | "clear ip bgp <1-65535> in", |
| 5770 | CLEAR_STR |
| 5771 | IP_STR |
| 5772 | BGP_STR |
| 5773 | "Clear peers with the AS number\n" |
| 5774 | "Soft reconfig inbound update\n") |
| 5775 | |
| 5776 | DEFUN (clear_ip_bgp_as_in_prefix_filter, |
| 5777 | clear_ip_bgp_as_in_prefix_filter_cmd, |
| 5778 | "clear ip bgp <1-65535> in prefix-filter", |
| 5779 | CLEAR_STR |
| 5780 | IP_STR |
| 5781 | BGP_STR |
| 5782 | "Clear peers with the AS number\n" |
| 5783 | "Soft reconfig inbound update\n" |
| 5784 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5785 | { |
| 5786 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5787 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5788 | } |
| 5789 | |
| 5790 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, |
| 5791 | clear_ip_bgp_as_ipv4_soft_in_cmd, |
| 5792 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft in", |
| 5793 | CLEAR_STR |
| 5794 | IP_STR |
| 5795 | BGP_STR |
| 5796 | "Clear peers with the AS number\n" |
| 5797 | "Address family\n" |
| 5798 | "Address Family modifier\n" |
| 5799 | "Address Family modifier\n" |
| 5800 | "Soft reconfig\n" |
| 5801 | "Soft reconfig inbound update\n") |
| 5802 | { |
| 5803 | if (strncmp (argv[1], "m", 1) == 0) |
| 5804 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5805 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5806 | |
| 5807 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5808 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5809 | } |
| 5810 | |
| 5811 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, |
| 5812 | clear_ip_bgp_as_ipv4_in_cmd, |
| 5813 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) in", |
| 5814 | CLEAR_STR |
| 5815 | IP_STR |
| 5816 | BGP_STR |
| 5817 | "Clear peers with the AS number\n" |
| 5818 | "Address family\n" |
| 5819 | "Address Family modifier\n" |
| 5820 | "Address Family modifier\n" |
| 5821 | "Soft reconfig inbound update\n") |
| 5822 | |
| 5823 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
| 5824 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, |
| 5825 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) in prefix-filter", |
| 5826 | CLEAR_STR |
| 5827 | IP_STR |
| 5828 | BGP_STR |
| 5829 | "Clear peers with the AS number\n" |
| 5830 | "Address family\n" |
| 5831 | "Address Family modifier\n" |
| 5832 | "Address Family modifier\n" |
| 5833 | "Soft reconfig inbound update\n" |
| 5834 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5835 | { |
| 5836 | if (strncmp (argv[1], "m", 1) == 0) |
| 5837 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5838 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5839 | |
| 5840 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5841 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5842 | } |
| 5843 | |
| 5844 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, |
| 5845 | clear_ip_bgp_as_vpnv4_soft_in_cmd, |
| 5846 | "clear ip bgp <1-65535> vpnv4 unicast soft in", |
| 5847 | CLEAR_STR |
| 5848 | IP_STR |
| 5849 | BGP_STR |
| 5850 | "Clear peers with the AS number\n" |
| 5851 | "Address family\n" |
| 5852 | "Address Family modifier\n" |
| 5853 | "Soft reconfig\n" |
| 5854 | "Soft reconfig inbound update\n") |
| 5855 | { |
| 5856 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 5857 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5858 | } |
| 5859 | |
| 5860 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, |
| 5861 | clear_ip_bgp_as_vpnv4_in_cmd, |
| 5862 | "clear ip bgp <1-65535> vpnv4 unicast in", |
| 5863 | CLEAR_STR |
| 5864 | IP_STR |
| 5865 | BGP_STR |
| 5866 | "Clear peers with the AS number\n" |
| 5867 | "Address family\n" |
| 5868 | "Address Family modifier\n" |
| 5869 | "Soft reconfig inbound update\n") |
| 5870 | |
| 5871 | DEFUN (clear_bgp_as_soft_in, |
| 5872 | clear_bgp_as_soft_in_cmd, |
| 5873 | "clear bgp <1-65535> soft in", |
| 5874 | CLEAR_STR |
| 5875 | BGP_STR |
| 5876 | "Clear peers with the AS number\n" |
| 5877 | "Soft reconfig\n" |
| 5878 | "Soft reconfig inbound update\n") |
| 5879 | { |
| 5880 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5881 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5882 | } |
| 5883 | |
| 5884 | ALIAS (clear_bgp_as_soft_in, |
| 5885 | clear_bgp_ipv6_as_soft_in_cmd, |
| 5886 | "clear bgp ipv6 <1-65535> soft in", |
| 5887 | CLEAR_STR |
| 5888 | BGP_STR |
| 5889 | "Address family\n" |
| 5890 | "Clear peers with the AS number\n" |
| 5891 | "Soft reconfig\n" |
| 5892 | "Soft reconfig inbound update\n") |
| 5893 | |
| 5894 | ALIAS (clear_bgp_as_soft_in, |
| 5895 | clear_bgp_as_in_cmd, |
| 5896 | "clear bgp <1-65535> in", |
| 5897 | CLEAR_STR |
| 5898 | BGP_STR |
| 5899 | "Clear peers with the AS number\n" |
| 5900 | "Soft reconfig inbound update\n") |
| 5901 | |
| 5902 | ALIAS (clear_bgp_as_soft_in, |
| 5903 | clear_bgp_ipv6_as_in_cmd, |
| 5904 | "clear bgp ipv6 <1-65535> in", |
| 5905 | CLEAR_STR |
| 5906 | BGP_STR |
| 5907 | "Address family\n" |
| 5908 | "Clear peers with the AS number\n" |
| 5909 | "Soft reconfig inbound update\n") |
| 5910 | |
| 5911 | DEFUN (clear_bgp_as_in_prefix_filter, |
| 5912 | clear_bgp_as_in_prefix_filter_cmd, |
| 5913 | "clear bgp <1-65535> in prefix-filter", |
| 5914 | CLEAR_STR |
| 5915 | BGP_STR |
| 5916 | "Clear peers with the AS number\n" |
| 5917 | "Soft reconfig inbound update\n" |
| 5918 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5919 | { |
| 5920 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5921 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5922 | } |
| 5923 | |
| 5924 | ALIAS (clear_bgp_as_in_prefix_filter, |
| 5925 | clear_bgp_ipv6_as_in_prefix_filter_cmd, |
| 5926 | "clear bgp ipv6 <1-65535> in prefix-filter", |
| 5927 | CLEAR_STR |
| 5928 | BGP_STR |
| 5929 | "Address family\n" |
| 5930 | "Clear peers with the AS number\n" |
| 5931 | "Soft reconfig inbound update\n" |
| 5932 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5933 | |
| 5934 | /* Both soft-reconfiguration */ |
| 5935 | DEFUN (clear_ip_bgp_all_soft, |
| 5936 | clear_ip_bgp_all_soft_cmd, |
| 5937 | "clear ip bgp * soft", |
| 5938 | CLEAR_STR |
| 5939 | IP_STR |
| 5940 | BGP_STR |
| 5941 | "Clear all peers\n" |
| 5942 | "Soft reconfig\n") |
| 5943 | { |
| 5944 | if (argc == 1) |
| 5945 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5946 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5947 | |
| 5948 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5949 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5950 | } |
| 5951 | |
| 5952 | ALIAS (clear_ip_bgp_all_soft, |
| 5953 | clear_ip_bgp_instance_all_soft_cmd, |
| 5954 | "clear ip bgp view WORD * soft", |
| 5955 | CLEAR_STR |
| 5956 | IP_STR |
| 5957 | BGP_STR |
| 5958 | "BGP view\n" |
| 5959 | "view name\n" |
| 5960 | "Clear all peers\n" |
| 5961 | "Soft reconfig\n") |
| 5962 | |
| 5963 | |
| 5964 | DEFUN (clear_ip_bgp_all_ipv4_soft, |
| 5965 | clear_ip_bgp_all_ipv4_soft_cmd, |
| 5966 | "clear ip bgp * ipv4 (unicast|multicast) soft", |
| 5967 | CLEAR_STR |
| 5968 | IP_STR |
| 5969 | BGP_STR |
| 5970 | "Clear all peers\n" |
| 5971 | "Address family\n" |
| 5972 | "Address Family Modifier\n" |
| 5973 | "Address Family Modifier\n" |
| 5974 | "Soft reconfig\n") |
| 5975 | { |
| 5976 | if (strncmp (argv[0], "m", 1) == 0) |
| 5977 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5978 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5979 | |
| 5980 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5981 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 5982 | } |
| 5983 | |
| 5984 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, |
| 5985 | clear_ip_bgp_instance_all_ipv4_soft_cmd, |
| 5986 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", |
| 5987 | CLEAR_STR |
| 5988 | IP_STR |
| 5989 | BGP_STR |
| 5990 | "BGP view\n" |
| 5991 | "view name\n" |
| 5992 | "Clear all peers\n" |
| 5993 | "Address family\n" |
| 5994 | "Address Family Modifier\n" |
| 5995 | "Address Family Modifier\n" |
| 5996 | "Soft reconfig\n") |
| 5997 | { |
| 5998 | if (strncmp (argv[1], "m", 1) == 0) |
| 5999 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 6000 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6001 | |
| 6002 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6003 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6004 | } |
| 6005 | |
| 6006 | DEFUN (clear_ip_bgp_all_vpnv4_soft, |
| 6007 | clear_ip_bgp_all_vpnv4_soft_cmd, |
| 6008 | "clear ip bgp * vpnv4 unicast soft", |
| 6009 | CLEAR_STR |
| 6010 | IP_STR |
| 6011 | BGP_STR |
| 6012 | "Clear all peers\n" |
| 6013 | "Address family\n" |
| 6014 | "Address Family Modifier\n" |
| 6015 | "Soft reconfig\n") |
| 6016 | { |
| 6017 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 6018 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6019 | } |
| 6020 | |
| 6021 | DEFUN (clear_bgp_all_soft, |
| 6022 | clear_bgp_all_soft_cmd, |
| 6023 | "clear bgp * soft", |
| 6024 | CLEAR_STR |
| 6025 | BGP_STR |
| 6026 | "Clear all peers\n" |
| 6027 | "Soft reconfig\n") |
| 6028 | { |
| 6029 | if (argc == 1) |
| 6030 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6031 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6032 | |
| 6033 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6034 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6035 | } |
| 6036 | |
| 6037 | ALIAS (clear_bgp_all_soft, |
| 6038 | clear_bgp_instance_all_soft_cmd, |
| 6039 | "clear bgp view WORD * soft", |
| 6040 | CLEAR_STR |
| 6041 | BGP_STR |
| 6042 | "BGP view\n" |
| 6043 | "view name\n" |
| 6044 | "Clear all peers\n" |
| 6045 | "Soft reconfig\n") |
| 6046 | |
| 6047 | ALIAS (clear_bgp_all_soft, |
| 6048 | clear_bgp_ipv6_all_soft_cmd, |
| 6049 | "clear bgp ipv6 * soft", |
| 6050 | CLEAR_STR |
| 6051 | BGP_STR |
| 6052 | "Address family\n" |
| 6053 | "Clear all peers\n" |
| 6054 | "Soft reconfig\n") |
| 6055 | |
| 6056 | DEFUN (clear_ip_bgp_peer_soft, |
| 6057 | clear_ip_bgp_peer_soft_cmd, |
| 6058 | "clear ip bgp A.B.C.D soft", |
| 6059 | CLEAR_STR |
| 6060 | IP_STR |
| 6061 | BGP_STR |
| 6062 | "BGP neighbor address to clear\n" |
| 6063 | "Soft reconfig\n") |
| 6064 | { |
| 6065 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6066 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6067 | } |
| 6068 | |
| 6069 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
| 6070 | clear_ip_bgp_peer_ipv4_soft_cmd, |
| 6071 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", |
| 6072 | CLEAR_STR |
| 6073 | IP_STR |
| 6074 | BGP_STR |
| 6075 | "BGP neighbor address to clear\n" |
| 6076 | "Address family\n" |
| 6077 | "Address Family Modifier\n" |
| 6078 | "Address Family Modifier\n" |
| 6079 | "Soft reconfig\n") |
| 6080 | { |
| 6081 | if (strncmp (argv[1], "m", 1) == 0) |
| 6082 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 6083 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6084 | |
| 6085 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6086 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6087 | } |
| 6088 | |
| 6089 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
| 6090 | clear_ip_bgp_peer_vpnv4_soft_cmd, |
| 6091 | "clear ip bgp A.B.C.D vpnv4 unicast soft", |
| 6092 | CLEAR_STR |
| 6093 | IP_STR |
| 6094 | BGP_STR |
| 6095 | "BGP neighbor address to clear\n" |
| 6096 | "Address family\n" |
| 6097 | "Address Family Modifier\n" |
| 6098 | "Soft reconfig\n") |
| 6099 | { |
| 6100 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 6101 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6102 | } |
| 6103 | |
| 6104 | DEFUN (clear_bgp_peer_soft, |
| 6105 | clear_bgp_peer_soft_cmd, |
| 6106 | "clear bgp (A.B.C.D|X:X::X:X) soft", |
| 6107 | CLEAR_STR |
| 6108 | BGP_STR |
| 6109 | "BGP neighbor address to clear\n" |
| 6110 | "BGP IPv6 neighbor to clear\n" |
| 6111 | "Soft reconfig\n") |
| 6112 | { |
| 6113 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6114 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6115 | } |
| 6116 | |
| 6117 | ALIAS (clear_bgp_peer_soft, |
| 6118 | clear_bgp_ipv6_peer_soft_cmd, |
| 6119 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft", |
| 6120 | CLEAR_STR |
| 6121 | BGP_STR |
| 6122 | "Address family\n" |
| 6123 | "BGP neighbor address to clear\n" |
| 6124 | "BGP IPv6 neighbor to clear\n" |
| 6125 | "Soft reconfig\n") |
| 6126 | |
| 6127 | DEFUN (clear_ip_bgp_peer_group_soft, |
| 6128 | clear_ip_bgp_peer_group_soft_cmd, |
| 6129 | "clear ip bgp peer-group WORD soft", |
| 6130 | CLEAR_STR |
| 6131 | IP_STR |
| 6132 | BGP_STR |
| 6133 | "Clear all members of peer-group\n" |
| 6134 | "BGP peer-group name\n" |
| 6135 | "Soft reconfig\n") |
| 6136 | { |
| 6137 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6138 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6139 | } |
| 6140 | |
| 6141 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
| 6142 | clear_ip_bgp_peer_group_ipv4_soft_cmd, |
| 6143 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", |
| 6144 | CLEAR_STR |
| 6145 | IP_STR |
| 6146 | BGP_STR |
| 6147 | "Clear all members of peer-group\n" |
| 6148 | "BGP peer-group name\n" |
| 6149 | "Address family\n" |
| 6150 | "Address Family modifier\n" |
| 6151 | "Address Family modifier\n" |
| 6152 | "Soft reconfig\n") |
| 6153 | { |
| 6154 | if (strncmp (argv[1], "m", 1) == 0) |
| 6155 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 6156 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6157 | |
| 6158 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6159 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6160 | } |
| 6161 | |
| 6162 | DEFUN (clear_bgp_peer_group_soft, |
| 6163 | clear_bgp_peer_group_soft_cmd, |
| 6164 | "clear bgp peer-group WORD soft", |
| 6165 | CLEAR_STR |
| 6166 | BGP_STR |
| 6167 | "Clear all members of peer-group\n" |
| 6168 | "BGP peer-group name\n" |
| 6169 | "Soft reconfig\n") |
| 6170 | { |
| 6171 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 6172 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6173 | } |
| 6174 | |
| 6175 | ALIAS (clear_bgp_peer_group_soft, |
| 6176 | clear_bgp_ipv6_peer_group_soft_cmd, |
| 6177 | "clear bgp ipv6 peer-group WORD soft", |
| 6178 | CLEAR_STR |
| 6179 | BGP_STR |
| 6180 | "Address family\n" |
| 6181 | "Clear all members of peer-group\n" |
| 6182 | "BGP peer-group name\n" |
| 6183 | "Soft reconfig\n") |
| 6184 | |
| 6185 | DEFUN (clear_ip_bgp_external_soft, |
| 6186 | clear_ip_bgp_external_soft_cmd, |
| 6187 | "clear ip bgp external soft", |
| 6188 | CLEAR_STR |
| 6189 | IP_STR |
| 6190 | BGP_STR |
| 6191 | "Clear all external peers\n" |
| 6192 | "Soft reconfig\n") |
| 6193 | { |
| 6194 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6195 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6196 | } |
| 6197 | |
| 6198 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
| 6199 | clear_ip_bgp_external_ipv4_soft_cmd, |
| 6200 | "clear ip bgp external ipv4 (unicast|multicast) soft", |
| 6201 | CLEAR_STR |
| 6202 | IP_STR |
| 6203 | BGP_STR |
| 6204 | "Clear all external peers\n" |
| 6205 | "Address family\n" |
| 6206 | "Address Family modifier\n" |
| 6207 | "Address Family modifier\n" |
| 6208 | "Soft reconfig\n") |
| 6209 | { |
| 6210 | if (strncmp (argv[0], "m", 1) == 0) |
| 6211 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 6212 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6213 | |
| 6214 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6215 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6216 | } |
| 6217 | |
| 6218 | DEFUN (clear_bgp_external_soft, |
| 6219 | clear_bgp_external_soft_cmd, |
| 6220 | "clear bgp external soft", |
| 6221 | CLEAR_STR |
| 6222 | BGP_STR |
| 6223 | "Clear all external peers\n" |
| 6224 | "Soft reconfig\n") |
| 6225 | { |
| 6226 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 6227 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6228 | } |
| 6229 | |
| 6230 | ALIAS (clear_bgp_external_soft, |
| 6231 | clear_bgp_ipv6_external_soft_cmd, |
| 6232 | "clear bgp ipv6 external soft", |
| 6233 | CLEAR_STR |
| 6234 | BGP_STR |
| 6235 | "Address family\n" |
| 6236 | "Clear all external peers\n" |
| 6237 | "Soft reconfig\n") |
| 6238 | |
| 6239 | DEFUN (clear_ip_bgp_as_soft, |
| 6240 | clear_ip_bgp_as_soft_cmd, |
| 6241 | "clear ip bgp <1-65535> soft", |
| 6242 | CLEAR_STR |
| 6243 | IP_STR |
| 6244 | BGP_STR |
| 6245 | "Clear peers with the AS number\n" |
| 6246 | "Soft reconfig\n") |
| 6247 | { |
| 6248 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6249 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6250 | } |
| 6251 | |
| 6252 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
| 6253 | clear_ip_bgp_as_ipv4_soft_cmd, |
| 6254 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft", |
| 6255 | CLEAR_STR |
| 6256 | IP_STR |
| 6257 | BGP_STR |
| 6258 | "Clear peers with the AS number\n" |
| 6259 | "Address family\n" |
| 6260 | "Address Family Modifier\n" |
| 6261 | "Address Family Modifier\n" |
| 6262 | "Soft reconfig\n") |
| 6263 | { |
| 6264 | if (strncmp (argv[1], "m", 1) == 0) |
| 6265 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6266 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6267 | |
| 6268 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, |
| 6269 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6270 | } |
| 6271 | |
| 6272 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
| 6273 | clear_ip_bgp_as_vpnv4_soft_cmd, |
| 6274 | "clear ip bgp <1-65535> vpnv4 unicast soft", |
| 6275 | CLEAR_STR |
| 6276 | IP_STR |
| 6277 | BGP_STR |
| 6278 | "Clear peers with the AS number\n" |
| 6279 | "Address family\n" |
| 6280 | "Address Family Modifier\n" |
| 6281 | "Soft reconfig\n") |
| 6282 | { |
| 6283 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 6284 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6285 | } |
| 6286 | |
| 6287 | DEFUN (clear_bgp_as_soft, |
| 6288 | clear_bgp_as_soft_cmd, |
| 6289 | "clear bgp <1-65535> soft", |
| 6290 | CLEAR_STR |
| 6291 | BGP_STR |
| 6292 | "Clear peers with the AS number\n" |
| 6293 | "Soft reconfig\n") |
| 6294 | { |
| 6295 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6296 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6297 | } |
| 6298 | |
| 6299 | ALIAS (clear_bgp_as_soft, |
| 6300 | clear_bgp_ipv6_as_soft_cmd, |
| 6301 | "clear bgp ipv6 <1-65535> soft", |
| 6302 | CLEAR_STR |
| 6303 | BGP_STR |
| 6304 | "Address family\n" |
| 6305 | "Clear peers with the AS number\n" |
| 6306 | "Soft reconfig\n") |
| 6307 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6308 | /* RS-client soft reconfiguration. */ |
| 6309 | #ifdef HAVE_IPV6 |
| 6310 | DEFUN (clear_bgp_all_rsclient, |
| 6311 | clear_bgp_all_rsclient_cmd, |
| 6312 | "clear bgp * rsclient", |
| 6313 | CLEAR_STR |
| 6314 | BGP_STR |
| 6315 | "Clear all peers\n" |
| 6316 | "Soft reconfig for rsclient RIB\n") |
| 6317 | { |
| 6318 | if (argc == 1) |
| 6319 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6320 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6321 | |
| 6322 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6323 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6324 | } |
| 6325 | |
| 6326 | ALIAS (clear_bgp_all_rsclient, |
| 6327 | clear_bgp_ipv6_all_rsclient_cmd, |
| 6328 | "clear bgp ipv6 * rsclient", |
| 6329 | CLEAR_STR |
| 6330 | BGP_STR |
| 6331 | "Address family\n" |
| 6332 | "Clear all peers\n" |
| 6333 | "Soft reconfig for rsclient RIB\n") |
| 6334 | |
| 6335 | ALIAS (clear_bgp_all_rsclient, |
| 6336 | clear_bgp_instance_all_rsclient_cmd, |
| 6337 | "clear bgp view WORD * rsclient", |
| 6338 | CLEAR_STR |
| 6339 | BGP_STR |
| 6340 | "BGP view\n" |
| 6341 | "view name\n" |
| 6342 | "Clear all peers\n" |
| 6343 | "Soft reconfig for rsclient RIB\n") |
| 6344 | |
| 6345 | ALIAS (clear_bgp_all_rsclient, |
| 6346 | clear_bgp_ipv6_instance_all_rsclient_cmd, |
| 6347 | "clear bgp ipv6 view WORD * rsclient", |
| 6348 | CLEAR_STR |
| 6349 | BGP_STR |
| 6350 | "Address family\n" |
| 6351 | "BGP view\n" |
| 6352 | "view name\n" |
| 6353 | "Clear all peers\n" |
| 6354 | "Soft reconfig for rsclient RIB\n") |
| 6355 | #endif /* HAVE_IPV6 */ |
| 6356 | |
| 6357 | DEFUN (clear_ip_bgp_all_rsclient, |
| 6358 | clear_ip_bgp_all_rsclient_cmd, |
| 6359 | "clear ip bgp * rsclient", |
| 6360 | CLEAR_STR |
| 6361 | IP_STR |
| 6362 | BGP_STR |
| 6363 | "Clear all peers\n" |
| 6364 | "Soft reconfig for rsclient RIB\n") |
| 6365 | { |
| 6366 | if (argc == 1) |
| 6367 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6368 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6369 | |
| 6370 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6371 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6372 | } |
| 6373 | |
| 6374 | ALIAS (clear_ip_bgp_all_rsclient, |
| 6375 | clear_ip_bgp_instance_all_rsclient_cmd, |
| 6376 | "clear ip bgp view WORD * rsclient", |
| 6377 | CLEAR_STR |
| 6378 | IP_STR |
| 6379 | BGP_STR |
| 6380 | "BGP view\n" |
| 6381 | "view name\n" |
| 6382 | "Clear all peers\n" |
| 6383 | "Soft reconfig for rsclient RIB\n") |
| 6384 | |
| 6385 | #ifdef HAVE_IPV6 |
| 6386 | DEFUN (clear_bgp_peer_rsclient, |
| 6387 | clear_bgp_peer_rsclient_cmd, |
| 6388 | "clear bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6389 | CLEAR_STR |
| 6390 | BGP_STR |
| 6391 | "BGP neighbor IP address to clear\n" |
| 6392 | "BGP IPv6 neighbor to clear\n" |
| 6393 | "Soft reconfig for rsclient RIB\n") |
| 6394 | { |
| 6395 | if (argc == 2) |
| 6396 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6397 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6398 | |
| 6399 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6400 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6401 | } |
| 6402 | |
| 6403 | ALIAS (clear_bgp_peer_rsclient, |
| 6404 | clear_bgp_ipv6_peer_rsclient_cmd, |
| 6405 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient", |
| 6406 | CLEAR_STR |
| 6407 | BGP_STR |
| 6408 | "Address family\n" |
| 6409 | "BGP neighbor IP address to clear\n" |
| 6410 | "BGP IPv6 neighbor to clear\n" |
| 6411 | "Soft reconfig for rsclient RIB\n") |
| 6412 | |
| 6413 | ALIAS (clear_bgp_peer_rsclient, |
| 6414 | clear_bgp_instance_peer_rsclient_cmd, |
| 6415 | "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6416 | CLEAR_STR |
| 6417 | BGP_STR |
| 6418 | "BGP view\n" |
| 6419 | "view name\n" |
| 6420 | "BGP neighbor IP address to clear\n" |
| 6421 | "BGP IPv6 neighbor to clear\n" |
| 6422 | "Soft reconfig for rsclient RIB\n") |
| 6423 | |
| 6424 | ALIAS (clear_bgp_peer_rsclient, |
| 6425 | clear_bgp_ipv6_instance_peer_rsclient_cmd, |
| 6426 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6427 | CLEAR_STR |
| 6428 | BGP_STR |
| 6429 | "Address family\n" |
| 6430 | "BGP view\n" |
| 6431 | "view name\n" |
| 6432 | "BGP neighbor IP address to clear\n" |
| 6433 | "BGP IPv6 neighbor to clear\n" |
| 6434 | "Soft reconfig for rsclient RIB\n") |
| 6435 | #endif /* HAVE_IPV6 */ |
| 6436 | |
| 6437 | DEFUN (clear_ip_bgp_peer_rsclient, |
| 6438 | clear_ip_bgp_peer_rsclient_cmd, |
| 6439 | "clear ip bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6440 | CLEAR_STR |
| 6441 | IP_STR |
| 6442 | BGP_STR |
| 6443 | "BGP neighbor IP address to clear\n" |
| 6444 | "BGP IPv6 neighbor to clear\n" |
| 6445 | "Soft reconfig for rsclient RIB\n") |
| 6446 | { |
| 6447 | if (argc == 2) |
| 6448 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, |
| 6449 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6450 | |
| 6451 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6452 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6453 | } |
| 6454 | |
| 6455 | ALIAS (clear_ip_bgp_peer_rsclient, |
| 6456 | clear_ip_bgp_instance_peer_rsclient_cmd, |
| 6457 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6458 | CLEAR_STR |
| 6459 | IP_STR |
| 6460 | BGP_STR |
| 6461 | "BGP view\n" |
| 6462 | "view name\n" |
| 6463 | "BGP neighbor IP address to clear\n" |
| 6464 | "BGP IPv6 neighbor to clear\n" |
| 6465 | "Soft reconfig for rsclient RIB\n") |
| 6466 | |
| 6467 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6468 | /* Show BGP peer's summary information. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6469 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6470 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) |
| 6471 | { |
| 6472 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6473 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6474 | int count = 0; |
| 6475 | char timebuf[BGP_UPTIME_LEN]; |
| 6476 | int len; |
| 6477 | |
| 6478 | /* Header string for each address family. */ |
| 6479 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; |
| 6480 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6481 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6482 | { |
| 6483 | if (peer->afc[afi][safi]) |
| 6484 | { |
| 6485 | if (! count) |
| 6486 | { |
| 6487 | vty_out (vty, |
| 6488 | "BGP router identifier %s, local AS number %d%s", |
| 6489 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); |
| 6490 | vty_out (vty, |
| 6491 | "%ld BGP AS-PATH entries%s", aspath_count (), |
| 6492 | VTY_NEWLINE); |
| 6493 | vty_out (vty, |
| 6494 | "%ld BGP community entries%s", community_count (), |
| 6495 | VTY_NEWLINE); |
| 6496 | |
| 6497 | if (CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
| 6498 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); |
| 6499 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6500 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 6501 | } |
| 6502 | count++; |
| 6503 | |
| 6504 | len = vty_out (vty, "%s", peer->host); |
| 6505 | len = 16 - len; |
| 6506 | if (len < 1) |
| 6507 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 6508 | else |
| 6509 | vty_out (vty, "%*s", len, " "); |
| 6510 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 6511 | vty_out (vty, "4 "); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6512 | |
| 6513 | vty_out (vty, "%5d %7d %7d %8d %4d %4ld ", |
| 6514 | peer->as, |
| 6515 | peer->open_in + peer->update_in + peer->keepalive_in |
| 6516 | + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in, |
| 6517 | peer->open_out + peer->update_out + peer->keepalive_out |
| 6518 | + peer->notify_out + peer->refresh_out |
| 6519 | + peer->dynamic_cap_out, |
| 6520 | 0, 0, peer->obuf->count); |
| 6521 | |
| 6522 | vty_out (vty, "%8s", |
| 6523 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); |
| 6524 | |
| 6525 | if (peer->status == Established) |
| 6526 | { |
| 6527 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); |
| 6528 | } |
| 6529 | else |
| 6530 | { |
| 6531 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) |
| 6532 | vty_out (vty, " Idle (Admin)"); |
| 6533 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 6534 | vty_out (vty, " Idle (PfxCt)"); |
Paul Jakma | 6a41973 | 2006-02-21 01:14:13 +0000 | [diff] [blame^] | 6535 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_CLEARING)) |
| 6536 | vty_out (vty, " Idle (Clrng)"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6537 | else |
| 6538 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); |
| 6539 | } |
| 6540 | |
| 6541 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6542 | } |
| 6543 | } |
| 6544 | |
| 6545 | if (count) |
| 6546 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, |
| 6547 | count, VTY_NEWLINE); |
| 6548 | else |
| 6549 | vty_out (vty, "No %s neighbor is configured%s", |
| 6550 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 6551 | return CMD_SUCCESS; |
| 6552 | } |
| 6553 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6554 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 6555 | bgp_show_summary_vty (struct vty *vty, const char *name, |
| 6556 | afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6557 | { |
| 6558 | struct bgp *bgp; |
| 6559 | |
| 6560 | if (name) |
| 6561 | { |
| 6562 | bgp = bgp_lookup_by_name (name); |
| 6563 | |
| 6564 | if (! bgp) |
| 6565 | { |
| 6566 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 6567 | return CMD_WARNING; |
| 6568 | } |
| 6569 | |
| 6570 | bgp_show_summary (vty, bgp, afi, safi); |
| 6571 | return CMD_SUCCESS; |
| 6572 | } |
| 6573 | |
| 6574 | bgp = bgp_get_default (); |
| 6575 | |
| 6576 | if (bgp) |
| 6577 | bgp_show_summary (vty, bgp, afi, safi); |
| 6578 | |
| 6579 | return CMD_SUCCESS; |
| 6580 | } |
| 6581 | |
| 6582 | /* `show ip bgp summary' commands. */ |
| 6583 | DEFUN (show_ip_bgp_summary, |
| 6584 | show_ip_bgp_summary_cmd, |
| 6585 | "show ip bgp summary", |
| 6586 | SHOW_STR |
| 6587 | IP_STR |
| 6588 | BGP_STR |
| 6589 | "Summary of BGP neighbor status\n") |
| 6590 | { |
| 6591 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 6592 | } |
| 6593 | |
| 6594 | DEFUN (show_ip_bgp_instance_summary, |
| 6595 | show_ip_bgp_instance_summary_cmd, |
| 6596 | "show ip bgp view WORD summary", |
| 6597 | SHOW_STR |
| 6598 | IP_STR |
| 6599 | BGP_STR |
| 6600 | "BGP view\n" |
| 6601 | "View name\n" |
| 6602 | "Summary of BGP neighbor status\n") |
| 6603 | { |
| 6604 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 6605 | } |
| 6606 | |
| 6607 | DEFUN (show_ip_bgp_ipv4_summary, |
| 6608 | show_ip_bgp_ipv4_summary_cmd, |
| 6609 | "show ip bgp ipv4 (unicast|multicast) summary", |
| 6610 | SHOW_STR |
| 6611 | IP_STR |
| 6612 | BGP_STR |
| 6613 | "Address family\n" |
| 6614 | "Address Family modifier\n" |
| 6615 | "Address Family modifier\n" |
| 6616 | "Summary of BGP neighbor status\n") |
| 6617 | { |
| 6618 | if (strncmp (argv[0], "m", 1) == 0) |
| 6619 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 6620 | |
| 6621 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 6622 | } |
| 6623 | |
| 6624 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
| 6625 | show_ip_bgp_instance_ipv4_summary_cmd, |
| 6626 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", |
| 6627 | SHOW_STR |
| 6628 | IP_STR |
| 6629 | BGP_STR |
| 6630 | "BGP view\n" |
| 6631 | "View name\n" |
| 6632 | "Address family\n" |
| 6633 | "Address Family modifier\n" |
| 6634 | "Address Family modifier\n" |
| 6635 | "Summary of BGP neighbor status\n") |
| 6636 | { |
| 6637 | if (strncmp (argv[1], "m", 1) == 0) |
| 6638 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 6639 | else |
| 6640 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 6641 | } |
| 6642 | |
| 6643 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
| 6644 | show_ip_bgp_vpnv4_all_summary_cmd, |
| 6645 | "show ip bgp vpnv4 all summary", |
| 6646 | SHOW_STR |
| 6647 | IP_STR |
| 6648 | BGP_STR |
| 6649 | "Display VPNv4 NLRI specific information\n" |
| 6650 | "Display information about all VPNv4 NLRIs\n" |
| 6651 | "Summary of BGP neighbor status\n") |
| 6652 | { |
| 6653 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 6654 | } |
| 6655 | |
| 6656 | DEFUN (show_ip_bgp_vpnv4_rd_summary, |
| 6657 | show_ip_bgp_vpnv4_rd_summary_cmd, |
| 6658 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", |
| 6659 | SHOW_STR |
| 6660 | IP_STR |
| 6661 | BGP_STR |
| 6662 | "Display VPNv4 NLRI specific information\n" |
| 6663 | "Display information for a route distinguisher\n" |
| 6664 | "VPN Route Distinguisher\n" |
| 6665 | "Summary of BGP neighbor status\n") |
| 6666 | { |
| 6667 | int ret; |
| 6668 | struct prefix_rd prd; |
| 6669 | |
| 6670 | ret = str2prefix_rd (argv[0], &prd); |
| 6671 | if (! ret) |
| 6672 | { |
| 6673 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); |
| 6674 | return CMD_WARNING; |
| 6675 | } |
| 6676 | |
| 6677 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 6678 | } |
| 6679 | |
| 6680 | #ifdef HAVE_IPV6 |
| 6681 | DEFUN (show_bgp_summary, |
| 6682 | show_bgp_summary_cmd, |
| 6683 | "show bgp summary", |
| 6684 | SHOW_STR |
| 6685 | BGP_STR |
| 6686 | "Summary of BGP neighbor status\n") |
| 6687 | { |
| 6688 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 6689 | } |
| 6690 | |
| 6691 | DEFUN (show_bgp_instance_summary, |
| 6692 | show_bgp_instance_summary_cmd, |
| 6693 | "show bgp view WORD summary", |
| 6694 | SHOW_STR |
| 6695 | BGP_STR |
| 6696 | "BGP view\n" |
| 6697 | "View name\n" |
| 6698 | "Summary of BGP neighbor status\n") |
| 6699 | { |
| 6700 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 6701 | } |
| 6702 | |
| 6703 | ALIAS (show_bgp_summary, |
| 6704 | show_bgp_ipv6_summary_cmd, |
| 6705 | "show bgp ipv6 summary", |
| 6706 | SHOW_STR |
| 6707 | BGP_STR |
| 6708 | "Address family\n" |
| 6709 | "Summary of BGP neighbor status\n") |
| 6710 | |
| 6711 | ALIAS (show_bgp_instance_summary, |
| 6712 | show_bgp_instance_ipv6_summary_cmd, |
| 6713 | "show bgp view WORD ipv6 summary", |
| 6714 | SHOW_STR |
| 6715 | BGP_STR |
| 6716 | "BGP view\n" |
| 6717 | "View name\n" |
| 6718 | "Address family\n" |
| 6719 | "Summary of BGP neighbor status\n") |
| 6720 | |
| 6721 | /* old command */ |
| 6722 | DEFUN (show_ipv6_bgp_summary, |
| 6723 | show_ipv6_bgp_summary_cmd, |
| 6724 | "show ipv6 bgp summary", |
| 6725 | SHOW_STR |
| 6726 | IPV6_STR |
| 6727 | BGP_STR |
| 6728 | "Summary of BGP neighbor status\n") |
| 6729 | { |
| 6730 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 6731 | } |
| 6732 | |
| 6733 | /* old command */ |
| 6734 | DEFUN (show_ipv6_mbgp_summary, |
| 6735 | show_ipv6_mbgp_summary_cmd, |
| 6736 | "show ipv6 mbgp summary", |
| 6737 | SHOW_STR |
| 6738 | IPV6_STR |
| 6739 | MBGP_STR |
| 6740 | "Summary of BGP neighbor status\n") |
| 6741 | { |
| 6742 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 6743 | } |
| 6744 | #endif /* HAVE_IPV6 */ |
| 6745 | |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 6746 | const char * |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6747 | afi_safi_print (afi_t afi, safi_t safi) |
| 6748 | { |
| 6749 | if (afi == AFI_IP && safi == SAFI_UNICAST) |
| 6750 | return "IPv4 Unicast"; |
| 6751 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) |
| 6752 | return "IPv4 Multicast"; |
| 6753 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) |
| 6754 | return "VPNv4 Unicast"; |
| 6755 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) |
| 6756 | return "IPv6 Unicast"; |
| 6757 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) |
| 6758 | return "IPv6 Multicast"; |
| 6759 | else |
| 6760 | return "Unknown"; |
| 6761 | } |
| 6762 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6763 | /* Show BGP peer's information. */ |
| 6764 | enum show_type |
| 6765 | { |
| 6766 | show_all, |
| 6767 | show_peer |
| 6768 | }; |
| 6769 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6770 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6771 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
| 6772 | afi_t afi, safi_t safi, |
| 6773 | u_int16_t adv_smcap, u_int16_t adv_rmcap, |
| 6774 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) |
| 6775 | { |
| 6776 | /* Send-Mode */ |
| 6777 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) |
| 6778 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 6779 | { |
| 6780 | vty_out (vty, " Send-mode: "); |
| 6781 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) |
| 6782 | vty_out (vty, "advertised"); |
| 6783 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 6784 | vty_out (vty, "%sreceived", |
| 6785 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? |
| 6786 | ", " : ""); |
| 6787 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6788 | } |
| 6789 | |
| 6790 | /* Receive-Mode */ |
| 6791 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) |
| 6792 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 6793 | { |
| 6794 | vty_out (vty, " Receive-mode: "); |
| 6795 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) |
| 6796 | vty_out (vty, "advertised"); |
| 6797 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 6798 | vty_out (vty, "%sreceived", |
| 6799 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? |
| 6800 | ", " : ""); |
| 6801 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6802 | } |
| 6803 | } |
| 6804 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6805 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6806 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
| 6807 | { |
| 6808 | struct bgp_filter *filter; |
| 6809 | char orf_pfx_name[BUFSIZ]; |
| 6810 | int orf_pfx_count; |
| 6811 | |
| 6812 | filter = &p->filter[afi][safi]; |
| 6813 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6814 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6815 | VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6816 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6817 | if (p->af_group[afi][safi]) |
| 6818 | vty_out (vty, " %s peer-group member%s", p->group->name, 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_SM_OLD_RCV) |
| 6823 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 6824 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) |
| 6825 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 6826 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); |
| 6827 | |
| 6828 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 6829 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 6830 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 6831 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) |
| 6832 | { |
| 6833 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 6834 | ORF_TYPE_PREFIX, VTY_NEWLINE); |
| 6835 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 6836 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 6837 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 6838 | PEER_CAP_ORF_PREFIX_SM_RCV, |
| 6839 | PEER_CAP_ORF_PREFIX_RM_RCV); |
| 6840 | } |
| 6841 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 6842 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 6843 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 6844 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 6845 | { |
| 6846 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 6847 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); |
| 6848 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 6849 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 6850 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 6851 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, |
| 6852 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); |
| 6853 | } |
| 6854 | |
| 6855 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
| 6856 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); |
| 6857 | |
| 6858 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
| 6859 | || orf_pfx_count) |
| 6860 | { |
| 6861 | vty_out (vty, " Outbound Route Filter (ORF):"); |
| 6862 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) |
| 6863 | vty_out (vty, " sent;"); |
| 6864 | if (orf_pfx_count) |
| 6865 | vty_out (vty, " received (%d entries)", orf_pfx_count); |
| 6866 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6867 | } |
| 6868 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) |
| 6869 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); |
| 6870 | |
| 6871 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) |
| 6872 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); |
| 6873 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 6874 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); |
| 6875 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) |
| 6876 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); |
| 6877 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
| 6878 | vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE); |
| 6879 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) |
| 6880 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); |
| 6881 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) |
| 6882 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 6883 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) |
| 6884 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 6885 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) |
| 6886 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 6887 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 6888 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
| 6889 | { |
| 6890 | vty_out (vty, " Community attribute sent to this neighbor"); |
| 6891 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 6892 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6893 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6894 | 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] | 6895 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6896 | else |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6897 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6898 | } |
| 6899 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) |
| 6900 | { |
| 6901 | vty_out (vty, " Default information originate,"); |
| 6902 | |
| 6903 | if (p->default_rmap[afi][safi].name) |
| 6904 | vty_out (vty, " default route-map %s%s,", |
| 6905 | p->default_rmap[afi][safi].map ? "*" : "", |
| 6906 | p->default_rmap[afi][safi].name); |
| 6907 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) |
| 6908 | vty_out (vty, " default sent%s", VTY_NEWLINE); |
| 6909 | else |
| 6910 | vty_out (vty, " default not sent%s", VTY_NEWLINE); |
| 6911 | } |
| 6912 | |
| 6913 | if (filter->plist[FILTER_IN].name |
| 6914 | || filter->dlist[FILTER_IN].name |
| 6915 | || filter->aslist[FILTER_IN].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6916 | || filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6917 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
| 6918 | if (filter->plist[FILTER_OUT].name |
| 6919 | || filter->dlist[FILTER_OUT].name |
| 6920 | || filter->aslist[FILTER_OUT].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6921 | || filter->map[RMAP_OUT].name |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6922 | || filter->usmap.name) |
| 6923 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6924 | if (filter->map[RMAP_IMPORT].name) |
| 6925 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); |
| 6926 | if (filter->map[RMAP_EXPORT].name) |
| 6927 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6928 | |
| 6929 | /* prefix-list */ |
| 6930 | if (filter->plist[FILTER_IN].name) |
| 6931 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", |
| 6932 | filter->plist[FILTER_IN].plist ? "*" : "", |
| 6933 | filter->plist[FILTER_IN].name, |
| 6934 | VTY_NEWLINE); |
| 6935 | if (filter->plist[FILTER_OUT].name) |
| 6936 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", |
| 6937 | filter->plist[FILTER_OUT].plist ? "*" : "", |
| 6938 | filter->plist[FILTER_OUT].name, |
| 6939 | VTY_NEWLINE); |
| 6940 | |
| 6941 | /* distribute-list */ |
| 6942 | if (filter->dlist[FILTER_IN].name) |
| 6943 | vty_out (vty, " Incoming update network filter list is %s%s%s", |
| 6944 | filter->dlist[FILTER_IN].alist ? "*" : "", |
| 6945 | filter->dlist[FILTER_IN].name, |
| 6946 | VTY_NEWLINE); |
| 6947 | if (filter->dlist[FILTER_OUT].name) |
| 6948 | vty_out (vty, " Outgoing update network filter list is %s%s%s", |
| 6949 | filter->dlist[FILTER_OUT].alist ? "*" : "", |
| 6950 | filter->dlist[FILTER_OUT].name, |
| 6951 | VTY_NEWLINE); |
| 6952 | |
| 6953 | /* filter-list. */ |
| 6954 | if (filter->aslist[FILTER_IN].name) |
| 6955 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", |
| 6956 | filter->aslist[FILTER_IN].aslist ? "*" : "", |
| 6957 | filter->aslist[FILTER_IN].name, |
| 6958 | VTY_NEWLINE); |
| 6959 | if (filter->aslist[FILTER_OUT].name) |
| 6960 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", |
| 6961 | filter->aslist[FILTER_OUT].aslist ? "*" : "", |
| 6962 | filter->aslist[FILTER_OUT].name, |
| 6963 | VTY_NEWLINE); |
| 6964 | |
| 6965 | /* route-map. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6966 | if (filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6967 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6968 | filter->map[RMAP_IN].map ? "*" : "", |
| 6969 | filter->map[RMAP_IN].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6970 | VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6971 | if (filter->map[RMAP_OUT].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6972 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6973 | filter->map[RMAP_OUT].map ? "*" : "", |
| 6974 | filter->map[RMAP_OUT].name, |
| 6975 | VTY_NEWLINE); |
| 6976 | if (filter->map[RMAP_IMPORT].name) |
| 6977 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", |
| 6978 | filter->map[RMAP_IMPORT].map ? "*" : "", |
| 6979 | filter->map[RMAP_IMPORT].name, |
| 6980 | VTY_NEWLINE); |
| 6981 | if (filter->map[RMAP_EXPORT].name) |
| 6982 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", |
| 6983 | filter->map[RMAP_EXPORT].map ? "*" : "", |
| 6984 | filter->map[RMAP_EXPORT].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6985 | VTY_NEWLINE); |
| 6986 | |
| 6987 | /* unsuppress-map */ |
| 6988 | if (filter->usmap.name) |
| 6989 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", |
| 6990 | filter->usmap.map ? "*" : "", |
| 6991 | filter->usmap.name, VTY_NEWLINE); |
| 6992 | |
| 6993 | /* Receive prefix count */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 6994 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
| 6995 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6996 | /* Maximum prefix */ |
| 6997 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) |
| 6998 | { |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 6999 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7000 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7001 | ? " (warning-only)" : "", VTY_NEWLINE); |
| 7002 | vty_out (vty, " Threshold for warning message %d%%", |
| 7003 | p->pmax_threshold[afi][safi]); |
| 7004 | if (p->pmax_restart[afi][safi]) |
| 7005 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); |
| 7006 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7007 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7008 | |
| 7009 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7010 | } |
| 7011 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7012 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7013 | bgp_show_peer (struct vty *vty, struct peer *p) |
| 7014 | { |
| 7015 | struct bgp *bgp; |
| 7016 | char buf1[BUFSIZ]; |
| 7017 | char timebuf[BGP_UPTIME_LEN]; |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7018 | afi_t afi; |
| 7019 | safi_t safi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7020 | |
| 7021 | bgp = p->bgp; |
| 7022 | |
| 7023 | /* Configured IP address. */ |
| 7024 | vty_out (vty, "BGP neighbor is %s, ", p->host); |
| 7025 | vty_out (vty, "remote AS %d, ", p->as); |
| 7026 | vty_out (vty, "local AS %d%s, ", |
| 7027 | p->change_local_as ? p->change_local_as : p->local_as, |
| 7028 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? |
| 7029 | " no-prepend" : ""); |
| 7030 | vty_out (vty, "%s link%s", |
| 7031 | p->as == p->local_as ? "internal" : "external", |
| 7032 | VTY_NEWLINE); |
| 7033 | |
| 7034 | /* Description. */ |
| 7035 | if (p->desc) |
| 7036 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); |
| 7037 | |
| 7038 | /* Peer-group */ |
| 7039 | if (p->group) |
| 7040 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
| 7041 | p->group->name, VTY_NEWLINE); |
| 7042 | |
| 7043 | /* Administrative shutdown. */ |
| 7044 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) |
| 7045 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); |
| 7046 | |
| 7047 | /* BGP Version. */ |
| 7048 | vty_out (vty, " BGP version 4"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7049 | vty_out (vty, ", remote router ID %s%s", |
| 7050 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), |
| 7051 | VTY_NEWLINE); |
| 7052 | |
| 7053 | /* Confederation */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7054 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
| 7055 | && bgp_confederation_peers_check (bgp, p->as)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7056 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
| 7057 | |
| 7058 | /* Status. */ |
| 7059 | vty_out (vty, " BGP state = %s", |
| 7060 | LOOKUP (bgp_status_msg, p->status)); |
| 7061 | if (p->status == Established) |
| 7062 | vty_out (vty, ", up for %8s", |
| 7063 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7064 | else if (p->status == Active) |
| 7065 | { |
| 7066 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) |
| 7067 | vty_out (vty, " (passive)"); |
| 7068 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) |
| 7069 | vty_out (vty, " (NSF passive)"); |
| 7070 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7071 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7072 | |
| 7073 | /* read timer */ |
| 7074 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); |
| 7075 | |
| 7076 | /* Configured timer values. */ |
| 7077 | vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s", |
| 7078 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); |
| 7079 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) |
| 7080 | { |
| 7081 | vty_out (vty, " Configured hold time is %d", p->holdtime); |
| 7082 | vty_out (vty, ", keepalive interval is %d seconds%s", |
| 7083 | p->keepalive, VTY_NEWLINE); |
| 7084 | } |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7085 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7086 | /* Capability. */ |
| 7087 | if (p->status == Established) |
| 7088 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7089 | if (p->cap |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7090 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
| 7091 | || p->afc_recv[AFI_IP][SAFI_UNICAST] |
| 7092 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] |
| 7093 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] |
| 7094 | #ifdef HAVE_IPV6 |
| 7095 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] |
| 7096 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] |
| 7097 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] |
| 7098 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] |
| 7099 | #endif /* HAVE_IPV6 */ |
| 7100 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] |
| 7101 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) |
| 7102 | { |
| 7103 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); |
| 7104 | |
| 7105 | /* Dynamic */ |
| 7106 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) |
| 7107 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7108 | { |
| 7109 | vty_out (vty, " Dynamic:"); |
| 7110 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7111 | vty_out (vty, " advertised"); |
| 7112 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7113 | vty_out (vty, " %sreceived", |
| 7114 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7115 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7116 | } |
| 7117 | |
| 7118 | /* Route Refresh */ |
| 7119 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) |
| 7120 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7121 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
| 7122 | { |
| 7123 | vty_out (vty, " Route refresh:"); |
| 7124 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) |
| 7125 | vty_out (vty, " advertised"); |
| 7126 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7127 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7128 | vty_out (vty, " %sreceived(%s)", |
| 7129 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", |
| 7130 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) |
| 7131 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? |
| 7132 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); |
| 7133 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7134 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7135 | } |
| 7136 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7137 | /* Multiprotocol Extensions */ |
| 7138 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7139 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7140 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7141 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7142 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
| 7143 | if (p->afc_adv[afi][safi]) |
| 7144 | vty_out (vty, " advertised"); |
| 7145 | if (p->afc_recv[afi][safi]) |
| 7146 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); |
| 7147 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7148 | } |
| 7149 | |
| 7150 | /* Gracefull Restart */ |
| 7151 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7152 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7153 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7154 | vty_out (vty, " Graceful Restart Capabilty:"); |
| 7155 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7156 | vty_out (vty, " advertised"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7157 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
| 7158 | vty_out (vty, " %sreceived", |
| 7159 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7160 | vty_out (vty, "%s", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7161 | |
| 7162 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7163 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7164 | int restart_af_count = 0; |
| 7165 | |
| 7166 | vty_out (vty, " Remote Restart timer is %d seconds%s", |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7167 | p->v_gr_restart, VTY_NEWLINE); |
| 7168 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7169 | |
| 7170 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7171 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7172 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) |
| 7173 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7174 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
| 7175 | afi_safi_print (afi, safi), |
| 7176 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? |
| 7177 | "preserved" : "not preserved"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7178 | restart_af_count++; |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7179 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7180 | if (! restart_af_count) |
| 7181 | vty_out (vty, "none"); |
| 7182 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7183 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7184 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7185 | } |
| 7186 | } |
| 7187 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7188 | /* graceful restart information */ |
| 7189 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7190 | || p->t_gr_restart |
| 7191 | || p->t_gr_stale) |
| 7192 | { |
| 7193 | int eor_send_af_count = 0; |
| 7194 | int eor_receive_af_count = 0; |
| 7195 | |
| 7196 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); |
| 7197 | if (p->status == Established) |
| 7198 | { |
| 7199 | vty_out (vty, " End-of-RIB send: "); |
| 7200 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7201 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7202 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) |
| 7203 | { |
| 7204 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", |
| 7205 | afi_safi_print (afi, safi)); |
| 7206 | eor_send_af_count++; |
| 7207 | } |
| 7208 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7209 | |
| 7210 | vty_out (vty, " End-of-RIB received: "); |
| 7211 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7212 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7213 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) |
| 7214 | { |
| 7215 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", |
| 7216 | afi_safi_print (afi, safi)); |
| 7217 | eor_receive_af_count++; |
| 7218 | } |
| 7219 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7220 | } |
| 7221 | |
| 7222 | if (p->t_gr_restart) |
| 7223 | { |
| 7224 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
| 7225 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); |
| 7226 | } |
| 7227 | if (p->t_gr_stale) |
| 7228 | { |
| 7229 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
| 7230 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); |
| 7231 | } |
| 7232 | } |
| 7233 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7234 | /* Packet counts. */ |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7235 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
| 7236 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); |
| 7237 | vty_out (vty, " Outq depth is %ld%s", p->obuf->count, VTY_NEWLINE); |
| 7238 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
| 7239 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); |
| 7240 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); |
| 7241 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); |
| 7242 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); |
| 7243 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); |
| 7244 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); |
| 7245 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + |
| 7246 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, |
| 7247 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + |
| 7248 | p->dynamic_cap_in, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7249 | |
| 7250 | /* advertisement-interval */ |
| 7251 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", |
| 7252 | p->v_routeadv, VTY_NEWLINE); |
| 7253 | |
| 7254 | /* Update-source. */ |
| 7255 | if (p->update_if || p->update_source) |
| 7256 | { |
| 7257 | vty_out (vty, " Update source is "); |
| 7258 | if (p->update_if) |
| 7259 | vty_out (vty, "%s", p->update_if); |
| 7260 | else if (p->update_source) |
| 7261 | vty_out (vty, "%s", |
| 7262 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); |
| 7263 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7264 | } |
| 7265 | |
| 7266 | /* Default weight */ |
| 7267 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) |
| 7268 | vty_out (vty, " Default weight %d%s", p->weight, |
| 7269 | VTY_NEWLINE); |
| 7270 | |
| 7271 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7272 | |
| 7273 | /* Address Family Information */ |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7274 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7275 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7276 | if (p->afc[afi][safi]) |
| 7277 | bgp_show_peer_afi (vty, p, afi, safi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7278 | |
| 7279 | vty_out (vty, " Connections established %d; dropped %d%s", |
| 7280 | p->established, p->dropped, |
| 7281 | VTY_NEWLINE); |
| 7282 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7283 | if (! p->dropped) |
| 7284 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); |
| 7285 | else |
| 7286 | vty_out (vty, " Last reset %s, due to %s%s", |
| 7287 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), |
| 7288 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 7289 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7290 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7291 | { |
| 7292 | 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] | 7293 | |
| 7294 | if (p->t_pmax_restart) |
| 7295 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", |
| 7296 | p->host, thread_timer_remain_second (p->t_pmax_restart), |
| 7297 | VTY_NEWLINE); |
| 7298 | else |
| 7299 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", |
| 7300 | p->host, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7301 | } |
| 7302 | |
| 7303 | /* EBGP Multihop */ |
| 7304 | if (peer_sort (p) != BGP_PEER_IBGP && p->ttl > 1) |
| 7305 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 7306 | p->ttl, VTY_NEWLINE); |
| 7307 | |
| 7308 | /* Local address. */ |
| 7309 | if (p->su_local) |
| 7310 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7311 | vty_out (vty, "Local host: %s, Local port: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7312 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
| 7313 | ntohs (p->su_local->sin.sin_port), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7314 | VTY_NEWLINE); |
| 7315 | } |
| 7316 | |
| 7317 | /* Remote address. */ |
| 7318 | if (p->su_remote) |
| 7319 | { |
| 7320 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", |
| 7321 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
| 7322 | ntohs (p->su_remote->sin.sin_port), |
| 7323 | VTY_NEWLINE); |
| 7324 | } |
| 7325 | |
| 7326 | /* Nexthop display. */ |
| 7327 | if (p->su_local) |
| 7328 | { |
| 7329 | vty_out (vty, "Nexthop: %s%s", |
| 7330 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), |
| 7331 | VTY_NEWLINE); |
| 7332 | #ifdef HAVE_IPV6 |
| 7333 | vty_out (vty, "Nexthop global: %s%s", |
| 7334 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), |
| 7335 | VTY_NEWLINE); |
| 7336 | vty_out (vty, "Nexthop local: %s%s", |
| 7337 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), |
| 7338 | VTY_NEWLINE); |
| 7339 | vty_out (vty, "BGP connection: %s%s", |
| 7340 | p->shared_network ? "shared network" : "non shared network", |
| 7341 | VTY_NEWLINE); |
| 7342 | #endif /* HAVE_IPV6 */ |
| 7343 | } |
| 7344 | |
| 7345 | /* Timer information. */ |
| 7346 | if (p->t_start) |
| 7347 | vty_out (vty, "Next start timer due in %ld seconds%s", |
| 7348 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); |
| 7349 | if (p->t_connect) |
| 7350 | vty_out (vty, "Next connect timer due in %ld seconds%s", |
| 7351 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); |
| 7352 | |
| 7353 | vty_out (vty, "Read thread: %s Write thread: %s%s", |
| 7354 | p->t_read ? "on" : "off", |
| 7355 | p->t_write ? "on" : "off", |
| 7356 | VTY_NEWLINE); |
| 7357 | |
| 7358 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR |
| 7359 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) |
| 7360 | bgp_capability_vty_out (vty, p); |
| 7361 | |
| 7362 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7363 | } |
| 7364 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7365 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7366 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
| 7367 | enum show_type type, union sockunion *su) |
| 7368 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7369 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7370 | struct peer *peer; |
| 7371 | int find = 0; |
| 7372 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7373 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7374 | { |
| 7375 | switch (type) |
| 7376 | { |
| 7377 | case show_all: |
| 7378 | bgp_show_peer (vty, peer); |
| 7379 | break; |
| 7380 | case show_peer: |
| 7381 | if (sockunion_same (&peer->su, su)) |
| 7382 | { |
| 7383 | find = 1; |
| 7384 | bgp_show_peer (vty, peer); |
| 7385 | } |
| 7386 | break; |
| 7387 | } |
| 7388 | } |
| 7389 | |
| 7390 | if (type == show_peer && ! find) |
| 7391 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); |
| 7392 | |
| 7393 | return CMD_SUCCESS; |
| 7394 | } |
| 7395 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7396 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7397 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
| 7398 | enum show_type type, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7399 | { |
| 7400 | int ret; |
| 7401 | struct bgp *bgp; |
| 7402 | union sockunion su; |
| 7403 | |
| 7404 | if (ip_str) |
| 7405 | { |
| 7406 | ret = str2sockunion (ip_str, &su); |
| 7407 | if (ret < 0) |
| 7408 | { |
| 7409 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 7410 | return CMD_WARNING; |
| 7411 | } |
| 7412 | } |
| 7413 | |
| 7414 | if (name) |
| 7415 | { |
| 7416 | bgp = bgp_lookup_by_name (name); |
| 7417 | |
| 7418 | if (! bgp) |
| 7419 | { |
| 7420 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7421 | return CMD_WARNING; |
| 7422 | } |
| 7423 | |
| 7424 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7425 | |
| 7426 | return CMD_SUCCESS; |
| 7427 | } |
| 7428 | |
| 7429 | bgp = bgp_get_default (); |
| 7430 | |
| 7431 | if (bgp) |
| 7432 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7433 | |
| 7434 | return CMD_SUCCESS; |
| 7435 | } |
| 7436 | |
| 7437 | /* "show ip bgp neighbors" commands. */ |
| 7438 | DEFUN (show_ip_bgp_neighbors, |
| 7439 | show_ip_bgp_neighbors_cmd, |
| 7440 | "show ip bgp neighbors", |
| 7441 | SHOW_STR |
| 7442 | IP_STR |
| 7443 | BGP_STR |
| 7444 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7445 | { |
| 7446 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); |
| 7447 | } |
| 7448 | |
| 7449 | ALIAS (show_ip_bgp_neighbors, |
| 7450 | show_ip_bgp_ipv4_neighbors_cmd, |
| 7451 | "show ip bgp ipv4 (unicast|multicast) neighbors", |
| 7452 | SHOW_STR |
| 7453 | IP_STR |
| 7454 | BGP_STR |
| 7455 | "Address family\n" |
| 7456 | "Address Family modifier\n" |
| 7457 | "Address Family modifier\n" |
| 7458 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7459 | |
| 7460 | ALIAS (show_ip_bgp_neighbors, |
| 7461 | show_ip_bgp_vpnv4_all_neighbors_cmd, |
| 7462 | "show ip bgp vpnv4 all neighbors", |
| 7463 | SHOW_STR |
| 7464 | IP_STR |
| 7465 | BGP_STR |
| 7466 | "Display VPNv4 NLRI specific information\n" |
| 7467 | "Display information about all VPNv4 NLRIs\n" |
| 7468 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7469 | |
| 7470 | ALIAS (show_ip_bgp_neighbors, |
| 7471 | show_ip_bgp_vpnv4_rd_neighbors_cmd, |
| 7472 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", |
| 7473 | SHOW_STR |
| 7474 | IP_STR |
| 7475 | BGP_STR |
| 7476 | "Display VPNv4 NLRI specific information\n" |
| 7477 | "Display information for a route distinguisher\n" |
| 7478 | "VPN Route Distinguisher\n" |
| 7479 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7480 | |
| 7481 | ALIAS (show_ip_bgp_neighbors, |
| 7482 | show_bgp_neighbors_cmd, |
| 7483 | "show bgp neighbors", |
| 7484 | SHOW_STR |
| 7485 | BGP_STR |
| 7486 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7487 | |
| 7488 | ALIAS (show_ip_bgp_neighbors, |
| 7489 | show_bgp_ipv6_neighbors_cmd, |
| 7490 | "show bgp ipv6 neighbors", |
| 7491 | SHOW_STR |
| 7492 | BGP_STR |
| 7493 | "Address family\n" |
| 7494 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7495 | |
| 7496 | DEFUN (show_ip_bgp_neighbors_peer, |
| 7497 | show_ip_bgp_neighbors_peer_cmd, |
| 7498 | "show ip bgp neighbors (A.B.C.D|X:X::X:X)", |
| 7499 | SHOW_STR |
| 7500 | IP_STR |
| 7501 | BGP_STR |
| 7502 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7503 | "Neighbor to display information about\n" |
| 7504 | "Neighbor to display information about\n") |
| 7505 | { |
| 7506 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); |
| 7507 | } |
| 7508 | |
| 7509 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7510 | show_ip_bgp_ipv4_neighbors_peer_cmd, |
| 7511 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)", |
| 7512 | SHOW_STR |
| 7513 | IP_STR |
| 7514 | BGP_STR |
| 7515 | "Address family\n" |
| 7516 | "Address Family modifier\n" |
| 7517 | "Address Family modifier\n" |
| 7518 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7519 | "Neighbor to display information about\n" |
| 7520 | "Neighbor to display information about\n") |
| 7521 | |
| 7522 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7523 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, |
| 7524 | "show ip bgp vpnv4 all neighbors A.B.C.D", |
| 7525 | SHOW_STR |
| 7526 | IP_STR |
| 7527 | BGP_STR |
| 7528 | "Display VPNv4 NLRI specific information\n" |
| 7529 | "Display information about all VPNv4 NLRIs\n" |
| 7530 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7531 | "Neighbor to display information about\n") |
| 7532 | |
| 7533 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7534 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, |
| 7535 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", |
| 7536 | SHOW_STR |
| 7537 | IP_STR |
| 7538 | BGP_STR |
| 7539 | "Display VPNv4 NLRI specific information\n" |
| 7540 | "Display information about all VPNv4 NLRIs\n" |
| 7541 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7542 | "Neighbor to display information about\n") |
| 7543 | |
| 7544 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7545 | show_bgp_neighbors_peer_cmd, |
| 7546 | "show bgp neighbors (A.B.C.D|X:X::X:X)", |
| 7547 | SHOW_STR |
| 7548 | BGP_STR |
| 7549 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7550 | "Neighbor to display information about\n" |
| 7551 | "Neighbor to display information about\n") |
| 7552 | |
| 7553 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7554 | show_bgp_ipv6_neighbors_peer_cmd, |
| 7555 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 7556 | SHOW_STR |
| 7557 | BGP_STR |
| 7558 | "Address family\n" |
| 7559 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7560 | "Neighbor to display information about\n" |
| 7561 | "Neighbor to display information about\n") |
| 7562 | |
| 7563 | DEFUN (show_ip_bgp_instance_neighbors, |
| 7564 | show_ip_bgp_instance_neighbors_cmd, |
| 7565 | "show ip bgp view WORD neighbors", |
| 7566 | SHOW_STR |
| 7567 | IP_STR |
| 7568 | BGP_STR |
| 7569 | "BGP view\n" |
| 7570 | "View name\n" |
| 7571 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7572 | { |
| 7573 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); |
| 7574 | } |
| 7575 | |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 7576 | ALIAS (show_ip_bgp_instance_neighbors, |
| 7577 | show_bgp_instance_neighbors_cmd, |
| 7578 | "show bgp view WORD neighbors", |
| 7579 | SHOW_STR |
| 7580 | BGP_STR |
| 7581 | "BGP view\n" |
| 7582 | "View name\n" |
| 7583 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7584 | |
| 7585 | ALIAS (show_ip_bgp_instance_neighbors, |
| 7586 | show_bgp_instance_ipv6_neighbors_cmd, |
| 7587 | "show bgp view WORD ipv6 neighbors", |
| 7588 | SHOW_STR |
| 7589 | BGP_STR |
| 7590 | "BGP view\n" |
| 7591 | "View name\n" |
| 7592 | "Address family\n" |
| 7593 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7594 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7595 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
| 7596 | show_ip_bgp_instance_neighbors_peer_cmd, |
| 7597 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 7598 | SHOW_STR |
| 7599 | IP_STR |
| 7600 | BGP_STR |
| 7601 | "BGP view\n" |
| 7602 | "View name\n" |
| 7603 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7604 | "Neighbor to display information about\n" |
| 7605 | "Neighbor to display information about\n") |
| 7606 | { |
| 7607 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); |
| 7608 | } |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 7609 | |
| 7610 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 7611 | show_bgp_instance_neighbors_peer_cmd, |
| 7612 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 7613 | SHOW_STR |
| 7614 | BGP_STR |
| 7615 | "BGP view\n" |
| 7616 | "View name\n" |
| 7617 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7618 | "Neighbor to display information about\n" |
| 7619 | "Neighbor to display information about\n") |
| 7620 | |
| 7621 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 7622 | show_bgp_instance_ipv6_neighbors_peer_cmd, |
| 7623 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 7624 | SHOW_STR |
| 7625 | BGP_STR |
| 7626 | "BGP view\n" |
| 7627 | "View name\n" |
| 7628 | "Address family\n" |
| 7629 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7630 | "Neighbor to display information about\n" |
| 7631 | "Neighbor to display information about\n") |
| 7632 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7633 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
| 7634 | paths' and `show ip mbgp paths'. Those functions results are the |
| 7635 | same.*/ |
| 7636 | DEFUN (show_ip_bgp_paths, |
| 7637 | show_ip_bgp_paths_cmd, |
| 7638 | "show ip bgp paths", |
| 7639 | SHOW_STR |
| 7640 | IP_STR |
| 7641 | BGP_STR |
| 7642 | "Path information\n") |
| 7643 | { |
| 7644 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); |
| 7645 | aspath_print_all_vty (vty); |
| 7646 | return CMD_SUCCESS; |
| 7647 | } |
| 7648 | |
| 7649 | DEFUN (show_ip_bgp_ipv4_paths, |
| 7650 | show_ip_bgp_ipv4_paths_cmd, |
| 7651 | "show ip bgp ipv4 (unicast|multicast) paths", |
| 7652 | SHOW_STR |
| 7653 | IP_STR |
| 7654 | BGP_STR |
| 7655 | "Address family\n" |
| 7656 | "Address Family modifier\n" |
| 7657 | "Address Family modifier\n" |
| 7658 | "Path information\n") |
| 7659 | { |
| 7660 | vty_out (vty, "Address Refcnt Path\r\n"); |
| 7661 | aspath_print_all_vty (vty); |
| 7662 | |
| 7663 | return CMD_SUCCESS; |
| 7664 | } |
| 7665 | |
| 7666 | #include "hash.h" |
| 7667 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7668 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7669 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
| 7670 | { |
| 7671 | struct community *com; |
| 7672 | |
| 7673 | com = (struct community *) backet->data; |
| 7674 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, |
| 7675 | community_str (com), VTY_NEWLINE); |
| 7676 | } |
| 7677 | |
| 7678 | /* Show BGP's community internal data. */ |
| 7679 | DEFUN (show_ip_bgp_community_info, |
| 7680 | show_ip_bgp_community_info_cmd, |
| 7681 | "show ip bgp community-info", |
| 7682 | SHOW_STR |
| 7683 | IP_STR |
| 7684 | BGP_STR |
| 7685 | "List all bgp community information\n") |
| 7686 | { |
| 7687 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); |
| 7688 | |
| 7689 | hash_iterate (community_hash (), |
| 7690 | (void (*) (struct hash_backet *, void *)) |
| 7691 | community_show_all_iterator, |
| 7692 | vty); |
| 7693 | |
| 7694 | return CMD_SUCCESS; |
| 7695 | } |
| 7696 | |
| 7697 | DEFUN (show_ip_bgp_attr_info, |
| 7698 | show_ip_bgp_attr_info_cmd, |
| 7699 | "show ip bgp attribute-info", |
| 7700 | SHOW_STR |
| 7701 | IP_STR |
| 7702 | BGP_STR |
| 7703 | "List all bgp attribute information\n") |
| 7704 | { |
| 7705 | attr_show_all (vty); |
| 7706 | return CMD_SUCCESS; |
| 7707 | } |
| 7708 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7709 | static int |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7710 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
| 7711 | afi_t afi, safi_t safi) |
| 7712 | { |
| 7713 | char timebuf[BGP_UPTIME_LEN]; |
| 7714 | char rmbuf[14]; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7715 | const char *rmname; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7716 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7717 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7718 | int len; |
| 7719 | int count = 0; |
| 7720 | |
| 7721 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) |
| 7722 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7723 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7724 | { |
| 7725 | count++; |
| 7726 | bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 7727 | } |
| 7728 | return count; |
| 7729 | } |
| 7730 | |
| 7731 | len = vty_out (vty, "%s", rsclient->host); |
| 7732 | len = 16 - len; |
| 7733 | |
| 7734 | if (len < 1) |
| 7735 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 7736 | else |
| 7737 | vty_out (vty, "%*s", len, " "); |
| 7738 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 7739 | vty_out (vty, "4 "); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7740 | |
| 7741 | vty_out (vty, "%5d ", rsclient->as); |
| 7742 | |
| 7743 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); |
| 7744 | if ( rmname && strlen (rmname) > 13 ) |
| 7745 | { |
| 7746 | sprintf (rmbuf, "%13s", "..."); |
| 7747 | rmname = strncpy (rmbuf, rmname, 10); |
| 7748 | } |
| 7749 | else if (! rmname) |
| 7750 | rmname = "<none>"; |
| 7751 | vty_out (vty, " %13s ", rmname); |
| 7752 | |
| 7753 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); |
| 7754 | if ( rmname && strlen (rmname) > 13 ) |
| 7755 | { |
| 7756 | sprintf (rmbuf, "%13s", "..."); |
| 7757 | rmname = strncpy (rmbuf, rmname, 10); |
| 7758 | } |
| 7759 | else if (! rmname) |
| 7760 | rmname = "<none>"; |
| 7761 | vty_out (vty, " %13s ", rmname); |
| 7762 | |
| 7763 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); |
| 7764 | |
| 7765 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) |
| 7766 | vty_out (vty, " Idle (Admin)"); |
| 7767 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7768 | vty_out (vty, " Idle (PfxCt)"); |
| 7769 | else |
| 7770 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); |
| 7771 | |
| 7772 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7773 | |
| 7774 | return 1; |
| 7775 | } |
| 7776 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7777 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7778 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
| 7779 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7780 | { |
| 7781 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7782 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7783 | int count = 0; |
| 7784 | |
| 7785 | /* Header string for each address family. */ |
| 7786 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; |
| 7787 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7788 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7789 | { |
| 7790 | if (peer->afc[afi][safi] && |
| 7791 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 7792 | { |
| 7793 | if (! count) |
| 7794 | { |
| 7795 | vty_out (vty, |
| 7796 | "Route Server's BGP router identifier %s%s", |
| 7797 | inet_ntoa (bgp->router_id), VTY_NEWLINE); |
| 7798 | vty_out (vty, |
| 7799 | "Route Server's local AS number %d%s", bgp->as, |
| 7800 | VTY_NEWLINE); |
| 7801 | |
| 7802 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7803 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 7804 | } |
| 7805 | |
| 7806 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 7807 | } |
| 7808 | } |
| 7809 | |
| 7810 | if (count) |
| 7811 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, |
| 7812 | count, VTY_NEWLINE); |
| 7813 | else |
| 7814 | vty_out (vty, "No %s Route Server Client is configured%s", |
| 7815 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 7816 | |
| 7817 | return CMD_SUCCESS; |
| 7818 | } |
| 7819 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7820 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7821 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
| 7822 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7823 | { |
| 7824 | struct bgp *bgp; |
| 7825 | |
| 7826 | if (name) |
| 7827 | { |
| 7828 | bgp = bgp_lookup_by_name (name); |
| 7829 | |
| 7830 | if (! bgp) |
| 7831 | { |
| 7832 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7833 | return CMD_WARNING; |
| 7834 | } |
| 7835 | |
| 7836 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 7837 | return CMD_SUCCESS; |
| 7838 | } |
| 7839 | |
| 7840 | bgp = bgp_get_default (); |
| 7841 | |
| 7842 | if (bgp) |
| 7843 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 7844 | |
| 7845 | return CMD_SUCCESS; |
| 7846 | } |
| 7847 | |
| 7848 | /* 'show bgp rsclient' commands. */ |
| 7849 | DEFUN (show_ip_bgp_rsclient_summary, |
| 7850 | show_ip_bgp_rsclient_summary_cmd, |
| 7851 | "show ip bgp rsclient summary", |
| 7852 | SHOW_STR |
| 7853 | IP_STR |
| 7854 | BGP_STR |
| 7855 | "Information about Route Server Clients\n" |
| 7856 | "Summary of all Route Server Clients\n") |
| 7857 | { |
| 7858 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 7859 | } |
| 7860 | |
| 7861 | DEFUN (show_ip_bgp_instance_rsclient_summary, |
| 7862 | show_ip_bgp_instance_rsclient_summary_cmd, |
| 7863 | "show ip bgp view WORD rsclient summary", |
| 7864 | SHOW_STR |
| 7865 | IP_STR |
| 7866 | BGP_STR |
| 7867 | "BGP view\n" |
| 7868 | "View name\n" |
| 7869 | "Information about Route Server Clients\n" |
| 7870 | "Summary of all Route Server Clients\n") |
| 7871 | { |
| 7872 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 7873 | } |
| 7874 | |
| 7875 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, |
| 7876 | show_ip_bgp_ipv4_rsclient_summary_cmd, |
| 7877 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", |
| 7878 | SHOW_STR |
| 7879 | IP_STR |
| 7880 | BGP_STR |
| 7881 | "Address family\n" |
| 7882 | "Address Family modifier\n" |
| 7883 | "Address Family modifier\n" |
| 7884 | "Information about Route Server Clients\n" |
| 7885 | "Summary of all Route Server Clients\n") |
| 7886 | { |
| 7887 | if (strncmp (argv[0], "m", 1) == 0) |
| 7888 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 7889 | |
| 7890 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 7891 | } |
| 7892 | |
| 7893 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, |
| 7894 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, |
| 7895 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 7896 | SHOW_STR |
| 7897 | IP_STR |
| 7898 | BGP_STR |
| 7899 | "BGP view\n" |
| 7900 | "View name\n" |
| 7901 | "Address family\n" |
| 7902 | "Address Family modifier\n" |
| 7903 | "Address Family modifier\n" |
| 7904 | "Information about Route Server Clients\n" |
| 7905 | "Summary of all Route Server Clients\n") |
| 7906 | { |
| 7907 | if (strncmp (argv[1], "m", 1) == 0) |
| 7908 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 7909 | |
| 7910 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 7911 | } |
| 7912 | |
| 7913 | #ifdef HAVE_IPV6 |
| 7914 | DEFUN (show_bgp_rsclient_summary, |
| 7915 | show_bgp_rsclient_summary_cmd, |
| 7916 | "show bgp rsclient summary", |
| 7917 | SHOW_STR |
| 7918 | BGP_STR |
| 7919 | "Information about Route Server Clients\n" |
| 7920 | "Summary of all Route Server Clients\n") |
| 7921 | { |
| 7922 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7923 | } |
| 7924 | |
| 7925 | DEFUN (show_bgp_instance_rsclient_summary, |
| 7926 | show_bgp_instance_rsclient_summary_cmd, |
| 7927 | "show bgp view WORD rsclient summary", |
| 7928 | SHOW_STR |
| 7929 | BGP_STR |
| 7930 | "BGP view\n" |
| 7931 | "View name\n" |
| 7932 | "Information about Route Server Clients\n" |
| 7933 | "Summary of all Route Server Clients\n") |
| 7934 | { |
| 7935 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 7936 | } |
| 7937 | |
| 7938 | ALIAS (show_bgp_rsclient_summary, |
| 7939 | show_bgp_ipv6_rsclient_summary_cmd, |
| 7940 | "show bgp ipv6 rsclient summary", |
| 7941 | SHOW_STR |
| 7942 | BGP_STR |
| 7943 | "Address family\n" |
| 7944 | "Information about Route Server Clients\n" |
| 7945 | "Summary of all Route Server Clients\n") |
| 7946 | |
| 7947 | ALIAS (show_bgp_instance_rsclient_summary, |
| 7948 | show_bgp_instance_ipv6_rsclient_summary_cmd, |
| 7949 | "show bgp view WORD ipv6 rsclient summary", |
| 7950 | SHOW_STR |
| 7951 | BGP_STR |
| 7952 | "BGP view\n" |
| 7953 | "View name\n" |
| 7954 | "Address family\n" |
| 7955 | "Information about Route Server Clients\n" |
| 7956 | "Summary of all Route Server Clients\n") |
| 7957 | #endif /* HAVE IPV6 */ |
| 7958 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7959 | /* Redistribute VTY commands. */ |
| 7960 | |
| 7961 | /* Utility function to convert user input route type string to route |
| 7962 | type. */ |
| 7963 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7964 | bgp_str2route_type (int afi, const char *str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7965 | { |
| 7966 | if (! str) |
| 7967 | return 0; |
| 7968 | |
| 7969 | if (afi == AFI_IP) |
| 7970 | { |
| 7971 | if (strncmp (str, "k", 1) == 0) |
| 7972 | return ZEBRA_ROUTE_KERNEL; |
| 7973 | else if (strncmp (str, "c", 1) == 0) |
| 7974 | return ZEBRA_ROUTE_CONNECT; |
| 7975 | else if (strncmp (str, "s", 1) == 0) |
| 7976 | return ZEBRA_ROUTE_STATIC; |
| 7977 | else if (strncmp (str, "r", 1) == 0) |
| 7978 | return ZEBRA_ROUTE_RIP; |
| 7979 | else if (strncmp (str, "o", 1) == 0) |
| 7980 | return ZEBRA_ROUTE_OSPF; |
| 7981 | } |
| 7982 | if (afi == AFI_IP6) |
| 7983 | { |
| 7984 | if (strncmp (str, "k", 1) == 0) |
| 7985 | return ZEBRA_ROUTE_KERNEL; |
| 7986 | else if (strncmp (str, "c", 1) == 0) |
| 7987 | return ZEBRA_ROUTE_CONNECT; |
| 7988 | else if (strncmp (str, "s", 1) == 0) |
| 7989 | return ZEBRA_ROUTE_STATIC; |
| 7990 | else if (strncmp (str, "r", 1) == 0) |
| 7991 | return ZEBRA_ROUTE_RIPNG; |
| 7992 | else if (strncmp (str, "o", 1) == 0) |
| 7993 | return ZEBRA_ROUTE_OSPF6; |
| 7994 | } |
| 7995 | return 0; |
| 7996 | } |
| 7997 | |
| 7998 | DEFUN (bgp_redistribute_ipv4, |
| 7999 | bgp_redistribute_ipv4_cmd, |
| 8000 | "redistribute (connected|kernel|ospf|rip|static)", |
| 8001 | "Redistribute information from another routing protocol\n" |
| 8002 | "Connected\n" |
| 8003 | "Kernel routes\n" |
| 8004 | "Open Shurtest Path First (OSPF)\n" |
| 8005 | "Routing Information Protocol (RIP)\n" |
| 8006 | "Static routes\n") |
| 8007 | { |
| 8008 | int type; |
| 8009 | |
| 8010 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8011 | if (! type) |
| 8012 | { |
| 8013 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8014 | return CMD_WARNING; |
| 8015 | } |
| 8016 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8017 | } |
| 8018 | |
| 8019 | DEFUN (bgp_redistribute_ipv4_rmap, |
| 8020 | bgp_redistribute_ipv4_rmap_cmd, |
| 8021 | "redistribute (connected|kernel|ospf|rip|static) route-map WORD", |
| 8022 | "Redistribute information from another routing protocol\n" |
| 8023 | "Connected\n" |
| 8024 | "Kernel routes\n" |
| 8025 | "Open Shurtest Path First (OSPF)\n" |
| 8026 | "Routing Information Protocol (RIP)\n" |
| 8027 | "Static routes\n" |
| 8028 | "Route map reference\n" |
| 8029 | "Pointer to route-map entries\n") |
| 8030 | { |
| 8031 | int type; |
| 8032 | |
| 8033 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8034 | if (! type) |
| 8035 | { |
| 8036 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8037 | return CMD_WARNING; |
| 8038 | } |
| 8039 | |
| 8040 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8041 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8042 | } |
| 8043 | |
| 8044 | DEFUN (bgp_redistribute_ipv4_metric, |
| 8045 | bgp_redistribute_ipv4_metric_cmd, |
| 8046 | "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", |
| 8047 | "Redistribute information from another routing protocol\n" |
| 8048 | "Connected\n" |
| 8049 | "Kernel routes\n" |
| 8050 | "Open Shurtest Path First (OSPF)\n" |
| 8051 | "Routing Information Protocol (RIP)\n" |
| 8052 | "Static routes\n" |
| 8053 | "Metric for redistributed routes\n" |
| 8054 | "Default metric\n") |
| 8055 | { |
| 8056 | int type; |
| 8057 | u_int32_t metric; |
| 8058 | |
| 8059 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8060 | if (! type) |
| 8061 | { |
| 8062 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8063 | return CMD_WARNING; |
| 8064 | } |
| 8065 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8066 | |
| 8067 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8068 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8069 | } |
| 8070 | |
| 8071 | DEFUN (bgp_redistribute_ipv4_rmap_metric, |
| 8072 | bgp_redistribute_ipv4_rmap_metric_cmd, |
| 8073 | "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", |
| 8074 | "Redistribute information from another routing protocol\n" |
| 8075 | "Connected\n" |
| 8076 | "Kernel routes\n" |
| 8077 | "Open Shurtest Path First (OSPF)\n" |
| 8078 | "Routing Information Protocol (RIP)\n" |
| 8079 | "Static routes\n" |
| 8080 | "Route map reference\n" |
| 8081 | "Pointer to route-map entries\n" |
| 8082 | "Metric for redistributed routes\n" |
| 8083 | "Default metric\n") |
| 8084 | { |
| 8085 | int type; |
| 8086 | u_int32_t metric; |
| 8087 | |
| 8088 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8089 | if (! type) |
| 8090 | { |
| 8091 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8092 | return CMD_WARNING; |
| 8093 | } |
| 8094 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8095 | |
| 8096 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8097 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8098 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8099 | } |
| 8100 | |
| 8101 | DEFUN (bgp_redistribute_ipv4_metric_rmap, |
| 8102 | bgp_redistribute_ipv4_metric_rmap_cmd, |
| 8103 | "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", |
| 8104 | "Redistribute information from another routing protocol\n" |
| 8105 | "Connected\n" |
| 8106 | "Kernel routes\n" |
| 8107 | "Open Shurtest Path First (OSPF)\n" |
| 8108 | "Routing Information Protocol (RIP)\n" |
| 8109 | "Static routes\n" |
| 8110 | "Metric for redistributed routes\n" |
| 8111 | "Default metric\n" |
| 8112 | "Route map reference\n" |
| 8113 | "Pointer to route-map entries\n") |
| 8114 | { |
| 8115 | int type; |
| 8116 | u_int32_t metric; |
| 8117 | |
| 8118 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8119 | if (! type) |
| 8120 | { |
| 8121 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8122 | return CMD_WARNING; |
| 8123 | } |
| 8124 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8125 | |
| 8126 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8127 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); |
| 8128 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8129 | } |
| 8130 | |
| 8131 | DEFUN (no_bgp_redistribute_ipv4, |
| 8132 | no_bgp_redistribute_ipv4_cmd, |
| 8133 | "no redistribute (connected|kernel|ospf|rip|static)", |
| 8134 | NO_STR |
| 8135 | "Redistribute information from another routing protocol\n" |
| 8136 | "Connected\n" |
| 8137 | "Kernel routes\n" |
| 8138 | "Open Shurtest Path First (OSPF)\n" |
| 8139 | "Routing Information Protocol (RIP)\n" |
| 8140 | "Static routes\n") |
| 8141 | { |
| 8142 | int type; |
| 8143 | |
| 8144 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8145 | if (! type) |
| 8146 | { |
| 8147 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8148 | return CMD_WARNING; |
| 8149 | } |
| 8150 | |
| 8151 | return bgp_redistribute_unset (vty->index, AFI_IP, type); |
| 8152 | } |
| 8153 | |
| 8154 | DEFUN (no_bgp_redistribute_ipv4_rmap, |
| 8155 | no_bgp_redistribute_ipv4_rmap_cmd, |
| 8156 | "no redistribute (connected|kernel|ospf|rip|static) route-map WORD", |
| 8157 | NO_STR |
| 8158 | "Redistribute information from another routing protocol\n" |
| 8159 | "Connected\n" |
| 8160 | "Kernel routes\n" |
| 8161 | "Open Shurtest Path First (OSPF)\n" |
| 8162 | "Routing Information Protocol (RIP)\n" |
| 8163 | "Static routes\n" |
| 8164 | "Route map reference\n" |
| 8165 | "Pointer to route-map entries\n") |
| 8166 | { |
| 8167 | int type; |
| 8168 | |
| 8169 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8170 | if (! type) |
| 8171 | { |
| 8172 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8173 | return CMD_WARNING; |
| 8174 | } |
| 8175 | |
| 8176 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8177 | return CMD_SUCCESS; |
| 8178 | } |
| 8179 | |
| 8180 | DEFUN (no_bgp_redistribute_ipv4_metric, |
| 8181 | no_bgp_redistribute_ipv4_metric_cmd, |
| 8182 | "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", |
| 8183 | NO_STR |
| 8184 | "Redistribute information from another routing protocol\n" |
| 8185 | "Connected\n" |
| 8186 | "Kernel routes\n" |
| 8187 | "Open Shurtest Path First (OSPF)\n" |
| 8188 | "Routing Information Protocol (RIP)\n" |
| 8189 | "Static routes\n" |
| 8190 | "Metric for redistributed routes\n" |
| 8191 | "Default metric\n") |
| 8192 | { |
| 8193 | int type; |
| 8194 | |
| 8195 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8196 | if (! type) |
| 8197 | { |
| 8198 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8199 | return CMD_WARNING; |
| 8200 | } |
| 8201 | |
| 8202 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8203 | return CMD_SUCCESS; |
| 8204 | } |
| 8205 | |
| 8206 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, |
| 8207 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
| 8208 | "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", |
| 8209 | NO_STR |
| 8210 | "Redistribute information from another routing protocol\n" |
| 8211 | "Connected\n" |
| 8212 | "Kernel routes\n" |
| 8213 | "Open Shurtest Path First (OSPF)\n" |
| 8214 | "Routing Information Protocol (RIP)\n" |
| 8215 | "Static routes\n" |
| 8216 | "Route map reference\n" |
| 8217 | "Pointer to route-map entries\n" |
| 8218 | "Metric for redistributed routes\n" |
| 8219 | "Default metric\n") |
| 8220 | { |
| 8221 | int type; |
| 8222 | |
| 8223 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8224 | if (! type) |
| 8225 | { |
| 8226 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8227 | return CMD_WARNING; |
| 8228 | } |
| 8229 | |
| 8230 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8231 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8232 | return CMD_SUCCESS; |
| 8233 | } |
| 8234 | |
| 8235 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, |
| 8236 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
| 8237 | "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", |
| 8238 | NO_STR |
| 8239 | "Redistribute information from another routing protocol\n" |
| 8240 | "Connected\n" |
| 8241 | "Kernel routes\n" |
| 8242 | "Open Shurtest Path First (OSPF)\n" |
| 8243 | "Routing Information Protocol (RIP)\n" |
| 8244 | "Static routes\n" |
| 8245 | "Metric for redistributed routes\n" |
| 8246 | "Default metric\n" |
| 8247 | "Route map reference\n" |
| 8248 | "Pointer to route-map entries\n") |
| 8249 | |
| 8250 | #ifdef HAVE_IPV6 |
| 8251 | DEFUN (bgp_redistribute_ipv6, |
| 8252 | bgp_redistribute_ipv6_cmd, |
| 8253 | "redistribute (connected|kernel|ospf6|ripng|static)", |
| 8254 | "Redistribute information from another routing protocol\n" |
| 8255 | "Connected\n" |
| 8256 | "Kernel routes\n" |
| 8257 | "Open Shurtest Path First (OSPFv3)\n" |
| 8258 | "Routing Information Protocol (RIPng)\n" |
| 8259 | "Static routes\n") |
| 8260 | { |
| 8261 | int type; |
| 8262 | |
| 8263 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8264 | if (! type) |
| 8265 | { |
| 8266 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8267 | return CMD_WARNING; |
| 8268 | } |
| 8269 | |
| 8270 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8271 | } |
| 8272 | |
| 8273 | DEFUN (bgp_redistribute_ipv6_rmap, |
| 8274 | bgp_redistribute_ipv6_rmap_cmd, |
| 8275 | "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", |
| 8276 | "Redistribute information from another routing protocol\n" |
| 8277 | "Connected\n" |
| 8278 | "Kernel routes\n" |
| 8279 | "Open Shurtest Path First (OSPFv3)\n" |
| 8280 | "Routing Information Protocol (RIPng)\n" |
| 8281 | "Static routes\n" |
| 8282 | "Route map reference\n" |
| 8283 | "Pointer to route-map entries\n") |
| 8284 | { |
| 8285 | int type; |
| 8286 | |
| 8287 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8288 | if (! type) |
| 8289 | { |
| 8290 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8291 | return CMD_WARNING; |
| 8292 | } |
| 8293 | |
| 8294 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8295 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8296 | } |
| 8297 | |
| 8298 | DEFUN (bgp_redistribute_ipv6_metric, |
| 8299 | bgp_redistribute_ipv6_metric_cmd, |
| 8300 | "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", |
| 8301 | "Redistribute information from another routing protocol\n" |
| 8302 | "Connected\n" |
| 8303 | "Kernel routes\n" |
| 8304 | "Open Shurtest Path First (OSPFv3)\n" |
| 8305 | "Routing Information Protocol (RIPng)\n" |
| 8306 | "Static routes\n" |
| 8307 | "Metric for redistributed routes\n" |
| 8308 | "Default metric\n") |
| 8309 | { |
| 8310 | int type; |
| 8311 | u_int32_t metric; |
| 8312 | |
| 8313 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8314 | if (! type) |
| 8315 | { |
| 8316 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8317 | return CMD_WARNING; |
| 8318 | } |
| 8319 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8320 | |
| 8321 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8322 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8323 | } |
| 8324 | |
| 8325 | DEFUN (bgp_redistribute_ipv6_rmap_metric, |
| 8326 | bgp_redistribute_ipv6_rmap_metric_cmd, |
| 8327 | "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", |
| 8328 | "Redistribute information from another routing protocol\n" |
| 8329 | "Connected\n" |
| 8330 | "Kernel routes\n" |
| 8331 | "Open Shurtest Path First (OSPFv3)\n" |
| 8332 | "Routing Information Protocol (RIPng)\n" |
| 8333 | "Static routes\n" |
| 8334 | "Route map reference\n" |
| 8335 | "Pointer to route-map entries\n" |
| 8336 | "Metric for redistributed routes\n" |
| 8337 | "Default metric\n") |
| 8338 | { |
| 8339 | int type; |
| 8340 | u_int32_t metric; |
| 8341 | |
| 8342 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8343 | if (! type) |
| 8344 | { |
| 8345 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8346 | return CMD_WARNING; |
| 8347 | } |
| 8348 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8349 | |
| 8350 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8351 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8352 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8353 | } |
| 8354 | |
| 8355 | DEFUN (bgp_redistribute_ipv6_metric_rmap, |
| 8356 | bgp_redistribute_ipv6_metric_rmap_cmd, |
| 8357 | "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", |
| 8358 | "Redistribute information from another routing protocol\n" |
| 8359 | "Connected\n" |
| 8360 | "Kernel routes\n" |
| 8361 | "Open Shurtest Path First (OSPFv3)\n" |
| 8362 | "Routing Information Protocol (RIPng)\n" |
| 8363 | "Static routes\n" |
| 8364 | "Metric for redistributed routes\n" |
| 8365 | "Default metric\n" |
| 8366 | "Route map reference\n" |
| 8367 | "Pointer to route-map entries\n") |
| 8368 | { |
| 8369 | int type; |
| 8370 | u_int32_t metric; |
| 8371 | |
| 8372 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8373 | if (! type) |
| 8374 | { |
| 8375 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8376 | return CMD_WARNING; |
| 8377 | } |
| 8378 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8379 | |
| 8380 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8381 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); |
| 8382 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8383 | } |
| 8384 | |
| 8385 | DEFUN (no_bgp_redistribute_ipv6, |
| 8386 | no_bgp_redistribute_ipv6_cmd, |
| 8387 | "no redistribute (connected|kernel|ospf6|ripng|static)", |
| 8388 | NO_STR |
| 8389 | "Redistribute information from another routing protocol\n" |
| 8390 | "Connected\n" |
| 8391 | "Kernel routes\n" |
| 8392 | "Open Shurtest Path First (OSPFv3)\n" |
| 8393 | "Routing Information Protocol (RIPng)\n" |
| 8394 | "Static routes\n") |
| 8395 | { |
| 8396 | int type; |
| 8397 | |
| 8398 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8399 | if (! type) |
| 8400 | { |
| 8401 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8402 | return CMD_WARNING; |
| 8403 | } |
| 8404 | |
| 8405 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); |
| 8406 | } |
| 8407 | |
| 8408 | DEFUN (no_bgp_redistribute_ipv6_rmap, |
| 8409 | no_bgp_redistribute_ipv6_rmap_cmd, |
| 8410 | "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", |
| 8411 | NO_STR |
| 8412 | "Redistribute information from another routing protocol\n" |
| 8413 | "Connected\n" |
| 8414 | "Kernel routes\n" |
| 8415 | "Open Shurtest Path First (OSPFv3)\n" |
| 8416 | "Routing Information Protocol (RIPng)\n" |
| 8417 | "Static routes\n" |
| 8418 | "Route map reference\n" |
| 8419 | "Pointer to route-map entries\n") |
| 8420 | { |
| 8421 | int type; |
| 8422 | |
| 8423 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8424 | if (! type) |
| 8425 | { |
| 8426 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8427 | return CMD_WARNING; |
| 8428 | } |
| 8429 | |
| 8430 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8431 | return CMD_SUCCESS; |
| 8432 | } |
| 8433 | |
| 8434 | DEFUN (no_bgp_redistribute_ipv6_metric, |
| 8435 | no_bgp_redistribute_ipv6_metric_cmd, |
| 8436 | "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", |
| 8437 | NO_STR |
| 8438 | "Redistribute information from another routing protocol\n" |
| 8439 | "Connected\n" |
| 8440 | "Kernel routes\n" |
| 8441 | "Open Shurtest Path First (OSPFv3)\n" |
| 8442 | "Routing Information Protocol (RIPng)\n" |
| 8443 | "Static routes\n" |
| 8444 | "Metric for redistributed routes\n" |
| 8445 | "Default metric\n") |
| 8446 | { |
| 8447 | int type; |
| 8448 | |
| 8449 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8450 | if (! type) |
| 8451 | { |
| 8452 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8453 | return CMD_WARNING; |
| 8454 | } |
| 8455 | |
| 8456 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8457 | return CMD_SUCCESS; |
| 8458 | } |
| 8459 | |
| 8460 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, |
| 8461 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
| 8462 | "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", |
| 8463 | NO_STR |
| 8464 | "Redistribute information from another routing protocol\n" |
| 8465 | "Connected\n" |
| 8466 | "Kernel routes\n" |
| 8467 | "Open Shurtest Path First (OSPFv3)\n" |
| 8468 | "Routing Information Protocol (RIPng)\n" |
| 8469 | "Static routes\n" |
| 8470 | "Route map reference\n" |
| 8471 | "Pointer to route-map entries\n" |
| 8472 | "Metric for redistributed routes\n" |
| 8473 | "Default metric\n") |
| 8474 | { |
| 8475 | int type; |
| 8476 | |
| 8477 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8478 | if (! type) |
| 8479 | { |
| 8480 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8481 | return CMD_WARNING; |
| 8482 | } |
| 8483 | |
| 8484 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8485 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8486 | return CMD_SUCCESS; |
| 8487 | } |
| 8488 | |
| 8489 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, |
| 8490 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
| 8491 | "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", |
| 8492 | NO_STR |
| 8493 | "Redistribute information from another routing protocol\n" |
| 8494 | "Connected\n" |
| 8495 | "Kernel routes\n" |
| 8496 | "Open Shurtest Path First (OSPFv3)\n" |
| 8497 | "Routing Information Protocol (RIPng)\n" |
| 8498 | "Static routes\n" |
| 8499 | "Metric for redistributed routes\n" |
| 8500 | "Default metric\n" |
| 8501 | "Route map reference\n" |
| 8502 | "Pointer to route-map entries\n") |
| 8503 | #endif /* HAVE_IPV6 */ |
| 8504 | |
| 8505 | int |
| 8506 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 8507 | safi_t safi, int *write) |
| 8508 | { |
| 8509 | int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8510 | |
| 8511 | /* Unicast redistribution only. */ |
| 8512 | if (safi != SAFI_UNICAST) |
| 8513 | return 0; |
| 8514 | |
| 8515 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 8516 | { |
| 8517 | /* Redistribute BGP does not make sense. */ |
| 8518 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) |
| 8519 | { |
| 8520 | /* Display "address-family" when it is not yet diplayed. */ |
| 8521 | bgp_config_write_family_header (vty, afi, safi, write); |
| 8522 | |
| 8523 | /* "redistribute" configuration. */ |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 8524 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8525 | |
| 8526 | if (bgp->redist_metric_flag[afi][i]) |
| 8527 | vty_out (vty, " metric %d", bgp->redist_metric[afi][i]); |
| 8528 | |
| 8529 | if (bgp->rmap[afi][i].name) |
| 8530 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); |
| 8531 | |
| 8532 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8533 | } |
| 8534 | } |
| 8535 | return *write; |
| 8536 | } |
| 8537 | |
| 8538 | /* BGP node structure. */ |
| 8539 | struct cmd_node bgp_node = |
| 8540 | { |
| 8541 | BGP_NODE, |
| 8542 | "%s(config-router)# ", |
| 8543 | 1, |
| 8544 | }; |
| 8545 | |
| 8546 | struct cmd_node bgp_ipv4_unicast_node = |
| 8547 | { |
| 8548 | BGP_IPV4_NODE, |
| 8549 | "%s(config-router-af)# ", |
| 8550 | 1, |
| 8551 | }; |
| 8552 | |
| 8553 | struct cmd_node bgp_ipv4_multicast_node = |
| 8554 | { |
| 8555 | BGP_IPV4M_NODE, |
| 8556 | "%s(config-router-af)# ", |
| 8557 | 1, |
| 8558 | }; |
| 8559 | |
| 8560 | struct cmd_node bgp_ipv6_unicast_node = |
| 8561 | { |
| 8562 | BGP_IPV6_NODE, |
| 8563 | "%s(config-router-af)# ", |
| 8564 | 1, |
| 8565 | }; |
| 8566 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8567 | struct cmd_node bgp_ipv6_multicast_node = |
| 8568 | { |
| 8569 | BGP_IPV6M_NODE, |
| 8570 | "%s(config-router-af)# ", |
| 8571 | 1, |
| 8572 | }; |
| 8573 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8574 | struct cmd_node bgp_vpnv4_node = |
| 8575 | { |
| 8576 | BGP_VPNV4_NODE, |
| 8577 | "%s(config-router-af)# ", |
| 8578 | 1 |
| 8579 | }; |
| 8580 | |
paul | 1f8ae70 | 2005-09-09 23:49:49 +0000 | [diff] [blame] | 8581 | static void community_list_vty (void); |
| 8582 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8583 | void |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8584 | bgp_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8585 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8586 | /* Install bgp top node. */ |
| 8587 | install_node (&bgp_node, bgp_config_write); |
| 8588 | install_node (&bgp_ipv4_unicast_node, NULL); |
| 8589 | install_node (&bgp_ipv4_multicast_node, NULL); |
| 8590 | install_node (&bgp_ipv6_unicast_node, NULL); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8591 | install_node (&bgp_ipv6_multicast_node, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8592 | install_node (&bgp_vpnv4_node, NULL); |
| 8593 | |
| 8594 | /* Install default VTY commands to new nodes. */ |
| 8595 | install_default (BGP_NODE); |
| 8596 | install_default (BGP_IPV4_NODE); |
| 8597 | install_default (BGP_IPV4M_NODE); |
| 8598 | install_default (BGP_IPV6_NODE); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8599 | install_default (BGP_IPV6M_NODE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8600 | install_default (BGP_VPNV4_NODE); |
| 8601 | |
| 8602 | /* "bgp multiple-instance" commands. */ |
| 8603 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); |
| 8604 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); |
| 8605 | |
| 8606 | /* "bgp config-type" commands. */ |
| 8607 | install_element (CONFIG_NODE, &bgp_config_type_cmd); |
| 8608 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); |
| 8609 | |
| 8610 | /* Dummy commands (Currently not supported) */ |
| 8611 | install_element (BGP_NODE, &no_synchronization_cmd); |
| 8612 | install_element (BGP_NODE, &no_auto_summary_cmd); |
| 8613 | |
| 8614 | /* "router bgp" commands. */ |
| 8615 | install_element (CONFIG_NODE, &router_bgp_cmd); |
| 8616 | install_element (CONFIG_NODE, &router_bgp_view_cmd); |
| 8617 | |
| 8618 | /* "no router bgp" commands. */ |
| 8619 | install_element (CONFIG_NODE, &no_router_bgp_cmd); |
| 8620 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); |
| 8621 | |
| 8622 | /* "bgp router-id" commands. */ |
| 8623 | install_element (BGP_NODE, &bgp_router_id_cmd); |
| 8624 | install_element (BGP_NODE, &no_bgp_router_id_cmd); |
| 8625 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); |
| 8626 | |
| 8627 | /* "bgp cluster-id" commands. */ |
| 8628 | install_element (BGP_NODE, &bgp_cluster_id_cmd); |
| 8629 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); |
| 8630 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); |
| 8631 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); |
| 8632 | |
| 8633 | /* "bgp confederation" commands. */ |
| 8634 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); |
| 8635 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); |
| 8636 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); |
| 8637 | |
| 8638 | /* "bgp confederation peers" commands. */ |
| 8639 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); |
| 8640 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); |
| 8641 | |
| 8642 | /* "timers bgp" commands. */ |
| 8643 | install_element (BGP_NODE, &bgp_timers_cmd); |
| 8644 | install_element (BGP_NODE, &no_bgp_timers_cmd); |
| 8645 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); |
| 8646 | |
| 8647 | /* "bgp client-to-client reflection" commands */ |
| 8648 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); |
| 8649 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); |
| 8650 | |
| 8651 | /* "bgp always-compare-med" commands */ |
| 8652 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); |
| 8653 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); |
| 8654 | |
| 8655 | /* "bgp deterministic-med" commands */ |
| 8656 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); |
| 8657 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 8658 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 8659 | /* "bgp graceful-restart" commands */ |
| 8660 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); |
| 8661 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 8662 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
| 8663 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); |
| 8664 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8665 | |
| 8666 | /* "bgp fast-external-failover" commands */ |
| 8667 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); |
| 8668 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); |
| 8669 | |
| 8670 | /* "bgp enforce-first-as" commands */ |
| 8671 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); |
| 8672 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); |
| 8673 | |
| 8674 | /* "bgp bestpath compare-routerid" commands */ |
| 8675 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); |
| 8676 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); |
| 8677 | |
| 8678 | /* "bgp bestpath as-path ignore" commands */ |
| 8679 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); |
| 8680 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); |
| 8681 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 8682 | /* "bgp bestpath as-path confed" commands */ |
| 8683 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); |
| 8684 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); |
| 8685 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 8686 | /* "bgp log-neighbor-changes" commands */ |
| 8687 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); |
| 8688 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); |
| 8689 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8690 | /* "bgp bestpath med" commands */ |
| 8691 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); |
| 8692 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); |
| 8693 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); |
| 8694 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); |
| 8695 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); |
| 8696 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); |
| 8697 | |
| 8698 | /* "no bgp default ipv4-unicast" commands. */ |
| 8699 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); |
| 8700 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); |
| 8701 | |
| 8702 | /* "bgp network import-check" commands. */ |
| 8703 | install_element (BGP_NODE, &bgp_network_import_check_cmd); |
| 8704 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
| 8705 | |
| 8706 | /* "bgp default local-preference" commands. */ |
| 8707 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); |
| 8708 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); |
| 8709 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); |
| 8710 | |
| 8711 | /* "neighbor remote-as" commands. */ |
| 8712 | install_element (BGP_NODE, &neighbor_remote_as_cmd); |
| 8713 | install_element (BGP_NODE, &no_neighbor_cmd); |
| 8714 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); |
| 8715 | |
| 8716 | /* "neighbor peer-group" commands. */ |
| 8717 | install_element (BGP_NODE, &neighbor_peer_group_cmd); |
| 8718 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); |
| 8719 | install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd); |
| 8720 | |
| 8721 | /* "neighbor local-as" commands. */ |
| 8722 | install_element (BGP_NODE, &neighbor_local_as_cmd); |
| 8723 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); |
| 8724 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
| 8725 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); |
| 8726 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); |
| 8727 | |
| 8728 | /* "neighbor activate" commands. */ |
| 8729 | install_element (BGP_NODE, &neighbor_activate_cmd); |
| 8730 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); |
| 8731 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); |
| 8732 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8733 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8734 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
| 8735 | |
| 8736 | /* "no neighbor activate" commands. */ |
| 8737 | install_element (BGP_NODE, &no_neighbor_activate_cmd); |
| 8738 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); |
| 8739 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); |
| 8740 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8741 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8742 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
| 8743 | |
| 8744 | /* "neighbor peer-group set" commands. */ |
| 8745 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
| 8746 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); |
| 8747 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); |
| 8748 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8749 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 8750 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
| 8751 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8752 | /* "no neighbor peer-group unset" commands. */ |
| 8753 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); |
| 8754 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 8755 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); |
| 8756 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8757 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 8758 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 8759 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8760 | /* "neighbor softreconfiguration inbound" commands.*/ |
| 8761 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8762 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 8763 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8764 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 8765 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8766 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 8767 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8768 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8769 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8770 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 8771 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 8772 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8773 | |
| 8774 | /* "neighbor attribute-unchanged" commands. */ |
| 8775 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); |
| 8776 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); |
| 8777 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); |
| 8778 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); |
| 8779 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); |
| 8780 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); |
| 8781 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); |
| 8782 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); |
| 8783 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); |
| 8784 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); |
| 8785 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); |
| 8786 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8787 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8788 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8789 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8790 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8791 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8792 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8793 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8794 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8795 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8796 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 8797 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); |
| 8798 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 8799 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 8800 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 8801 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 8802 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 8803 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 8804 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 8805 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 8806 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 8807 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 8808 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8809 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8810 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8811 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8812 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8813 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8814 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8815 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8816 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8817 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8818 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 8819 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); |
| 8820 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); |
| 8821 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); |
| 8822 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); |
| 8823 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); |
| 8824 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); |
| 8825 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); |
| 8826 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); |
| 8827 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); |
| 8828 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); |
| 8829 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); |
| 8830 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8831 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8832 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8833 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8834 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8835 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8836 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8837 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8838 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8839 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8840 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 8841 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); |
| 8842 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); |
| 8843 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); |
| 8844 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); |
| 8845 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); |
| 8846 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); |
| 8847 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); |
| 8848 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); |
| 8849 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); |
| 8850 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); |
| 8851 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); |
| 8852 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8853 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8854 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8855 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8856 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8857 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8858 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8859 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8860 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8861 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8862 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8863 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
| 8864 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); |
| 8865 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); |
| 8866 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); |
| 8867 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); |
| 8868 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); |
| 8869 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); |
| 8870 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); |
| 8871 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); |
| 8872 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); |
| 8873 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); |
| 8874 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8875 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8876 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8877 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8878 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8879 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8880 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8881 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8882 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8883 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8884 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8885 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
| 8886 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 8887 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 8888 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 8889 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 8890 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 8891 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 8892 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 8893 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 8894 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 8895 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 8896 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 8897 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 8898 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 8899 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 8900 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 8901 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 8902 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 8903 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 8904 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 8905 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 8906 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 8907 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8908 | /* "nexthop-local unchanged" commands */ |
| 8909 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); |
| 8910 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); |
| 8911 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8912 | /* "transparent-as" and "transparent-nexthop" for old version |
| 8913 | compatibility. */ |
| 8914 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); |
| 8915 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); |
| 8916 | |
| 8917 | /* "neighbor next-hop-self" commands. */ |
| 8918 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); |
| 8919 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); |
| 8920 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); |
| 8921 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 8922 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); |
| 8923 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); |
| 8924 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); |
| 8925 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8926 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
| 8927 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8928 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
| 8929 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 8930 | |
| 8931 | /* "neighbor remove-private-AS" commands. */ |
| 8932 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); |
| 8933 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); |
| 8934 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
| 8935 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 8936 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
| 8937 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); |
| 8938 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
| 8939 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8940 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
| 8941 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8942 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
| 8943 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 8944 | |
| 8945 | /* "neighbor send-community" commands.*/ |
| 8946 | install_element (BGP_NODE, &neighbor_send_community_cmd); |
| 8947 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); |
| 8948 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); |
| 8949 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); |
| 8950 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); |
| 8951 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); |
| 8952 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); |
| 8953 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); |
| 8954 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); |
| 8955 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); |
| 8956 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); |
| 8957 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); |
| 8958 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); |
| 8959 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); |
| 8960 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); |
| 8961 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8962 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
| 8963 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); |
| 8964 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); |
| 8965 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8966 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
| 8967 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); |
| 8968 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); |
| 8969 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); |
| 8970 | |
| 8971 | /* "neighbor route-reflector" commands.*/ |
| 8972 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); |
| 8973 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8974 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); |
| 8975 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8976 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); |
| 8977 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8978 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); |
| 8979 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8980 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
| 8981 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8982 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
| 8983 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 8984 | |
| 8985 | /* "neighbor route-server" commands.*/ |
| 8986 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); |
| 8987 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); |
| 8988 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); |
| 8989 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); |
| 8990 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); |
| 8991 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); |
| 8992 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); |
| 8993 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8994 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
| 8995 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8996 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
| 8997 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); |
| 8998 | |
| 8999 | /* "neighbor passive" commands. */ |
| 9000 | install_element (BGP_NODE, &neighbor_passive_cmd); |
| 9001 | install_element (BGP_NODE, &no_neighbor_passive_cmd); |
| 9002 | |
| 9003 | /* "neighbor shutdown" commands. */ |
| 9004 | install_element (BGP_NODE, &neighbor_shutdown_cmd); |
| 9005 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); |
| 9006 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 9007 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9008 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
| 9009 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); |
| 9010 | |
| 9011 | /* "neighbor capability orf prefix-list" commands.*/ |
| 9012 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9013 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9014 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9015 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9016 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9017 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9018 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9019 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9020 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9021 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9022 | |
| 9023 | /* "neighbor capability dynamic" commands.*/ |
| 9024 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); |
| 9025 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); |
| 9026 | |
| 9027 | /* "neighbor dont-capability-negotiate" commands. */ |
| 9028 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); |
| 9029 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); |
| 9030 | |
| 9031 | /* "neighbor ebgp-multihop" commands. */ |
| 9032 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); |
| 9033 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); |
| 9034 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); |
| 9035 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); |
| 9036 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 9037 | /* "neighbor disable-connected-check" commands. */ |
| 9038 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); |
| 9039 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9040 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
| 9041 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); |
| 9042 | |
| 9043 | /* "neighbor description" commands. */ |
| 9044 | install_element (BGP_NODE, &neighbor_description_cmd); |
| 9045 | install_element (BGP_NODE, &no_neighbor_description_cmd); |
| 9046 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); |
| 9047 | |
| 9048 | /* "neighbor update-source" commands. "*/ |
| 9049 | install_element (BGP_NODE, &neighbor_update_source_cmd); |
| 9050 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); |
| 9051 | |
| 9052 | /* "neighbor default-originate" commands. */ |
| 9053 | install_element (BGP_NODE, &neighbor_default_originate_cmd); |
| 9054 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); |
| 9055 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); |
| 9056 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9057 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); |
| 9058 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); |
| 9059 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); |
| 9060 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9061 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); |
| 9062 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9063 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); |
| 9064 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9065 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); |
| 9066 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); |
| 9067 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); |
| 9068 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9069 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
| 9070 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9071 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); |
| 9072 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9073 | |
| 9074 | /* "neighbor port" commands. */ |
| 9075 | install_element (BGP_NODE, &neighbor_port_cmd); |
| 9076 | install_element (BGP_NODE, &no_neighbor_port_cmd); |
| 9077 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); |
| 9078 | |
| 9079 | /* "neighbor weight" commands. */ |
| 9080 | install_element (BGP_NODE, &neighbor_weight_cmd); |
| 9081 | install_element (BGP_NODE, &no_neighbor_weight_cmd); |
| 9082 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); |
| 9083 | |
| 9084 | /* "neighbor override-capability" commands. */ |
| 9085 | install_element (BGP_NODE, &neighbor_override_capability_cmd); |
| 9086 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); |
| 9087 | |
| 9088 | /* "neighbor strict-capability-match" commands. */ |
| 9089 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); |
| 9090 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); |
| 9091 | |
| 9092 | /* "neighbor timers" commands. */ |
| 9093 | install_element (BGP_NODE, &neighbor_timers_cmd); |
| 9094 | install_element (BGP_NODE, &no_neighbor_timers_cmd); |
| 9095 | |
| 9096 | /* "neighbor timers connect" commands. */ |
| 9097 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); |
| 9098 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); |
| 9099 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); |
| 9100 | |
| 9101 | /* "neighbor advertisement-interval" commands. */ |
| 9102 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); |
| 9103 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); |
| 9104 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); |
| 9105 | |
| 9106 | /* "neighbor version" commands. */ |
| 9107 | install_element (BGP_NODE, &neighbor_version_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9108 | |
| 9109 | /* "neighbor interface" commands. */ |
| 9110 | install_element (BGP_NODE, &neighbor_interface_cmd); |
| 9111 | install_element (BGP_NODE, &no_neighbor_interface_cmd); |
| 9112 | |
| 9113 | /* "neighbor distribute" commands. */ |
| 9114 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); |
| 9115 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); |
| 9116 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); |
| 9117 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9118 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); |
| 9119 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); |
| 9120 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); |
| 9121 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9122 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
| 9123 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9124 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
| 9125 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9126 | |
| 9127 | /* "neighbor prefix-list" commands. */ |
| 9128 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); |
| 9129 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); |
| 9130 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); |
| 9131 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9132 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); |
| 9133 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); |
| 9134 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); |
| 9135 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9136 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
| 9137 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9138 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
| 9139 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9140 | |
| 9141 | /* "neighbor filter-list" commands. */ |
| 9142 | install_element (BGP_NODE, &neighbor_filter_list_cmd); |
| 9143 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); |
| 9144 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); |
| 9145 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); |
| 9146 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); |
| 9147 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); |
| 9148 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); |
| 9149 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9150 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
| 9151 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9152 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
| 9153 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); |
| 9154 | |
| 9155 | /* "neighbor route-map" commands. */ |
| 9156 | install_element (BGP_NODE, &neighbor_route_map_cmd); |
| 9157 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); |
| 9158 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); |
| 9159 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); |
| 9160 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); |
| 9161 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); |
| 9162 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); |
| 9163 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9164 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
| 9165 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9166 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
| 9167 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); |
| 9168 | |
| 9169 | /* "neighbor unsuppress-map" commands. */ |
| 9170 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); |
| 9171 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9172 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9173 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9174 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); |
| 9175 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9176 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); |
| 9177 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9178 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
| 9179 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9180 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9181 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9182 | |
| 9183 | /* "neighbor maximum-prefix" commands. */ |
| 9184 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9185 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9186 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9187 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9188 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9189 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9190 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9191 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9192 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9193 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9194 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9195 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9196 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9197 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9198 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9199 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9200 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9201 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9202 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9203 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9204 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9205 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9206 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9207 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9208 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9209 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9210 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9211 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9212 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9213 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9214 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9215 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9216 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9217 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9218 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9219 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9220 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9221 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9222 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9223 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9224 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9225 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9226 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9227 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9228 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9229 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9230 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9231 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9232 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9233 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9234 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9235 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9236 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
| 9237 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
| 9238 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); |
| 9239 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
| 9240 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9241 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
| 9242 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9243 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
| 9244 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9245 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9246 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9247 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9248 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9249 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9250 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9251 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9252 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9253 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9254 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9255 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9256 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9257 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9258 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9259 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9260 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9261 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9262 | |
| 9263 | /* "neighbor allowas-in" */ |
| 9264 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); |
| 9265 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); |
| 9266 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); |
| 9267 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
| 9268 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9269 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9270 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
| 9271 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9272 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); |
| 9273 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
| 9274 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); |
| 9275 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9276 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
| 9277 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9278 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9279 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
| 9280 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9281 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9282 | |
| 9283 | /* address-family commands. */ |
| 9284 | install_element (BGP_NODE, &address_family_ipv4_cmd); |
| 9285 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); |
| 9286 | #ifdef HAVE_IPV6 |
| 9287 | install_element (BGP_NODE, &address_family_ipv6_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9288 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9289 | #endif /* HAVE_IPV6 */ |
| 9290 | install_element (BGP_NODE, &address_family_vpnv4_cmd); |
| 9291 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); |
| 9292 | |
| 9293 | /* "exit-address-family" command. */ |
| 9294 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); |
| 9295 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); |
| 9296 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9297 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9298 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
| 9299 | |
| 9300 | /* "clear ip bgp commands" */ |
| 9301 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); |
| 9302 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); |
| 9303 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); |
| 9304 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
| 9305 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
| 9306 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
| 9307 | #ifdef HAVE_IPV6 |
| 9308 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
| 9309 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); |
| 9310 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); |
| 9311 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
| 9312 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
| 9313 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
| 9314 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
| 9315 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
| 9316 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
| 9317 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
| 9318 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
| 9319 | #endif /* HAVE_IPV6 */ |
| 9320 | |
| 9321 | /* "clear ip bgp neighbor soft in" */ |
| 9322 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); |
| 9323 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); |
| 9324 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); |
| 9325 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
| 9326 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); |
| 9327 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
| 9328 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
| 9329 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
| 9330 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); |
| 9331 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
| 9332 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
| 9333 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); |
| 9334 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
| 9335 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
| 9336 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); |
| 9337 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
| 9338 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
| 9339 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); |
| 9340 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); |
| 9341 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); |
| 9342 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
| 9343 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); |
| 9344 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
| 9345 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
| 9346 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
| 9347 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); |
| 9348 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
| 9349 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
| 9350 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); |
| 9351 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
| 9352 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
| 9353 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); |
| 9354 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
| 9355 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
| 9356 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); |
| 9357 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); |
| 9358 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); |
| 9359 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); |
| 9360 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); |
| 9361 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); |
| 9362 | #ifdef HAVE_IPV6 |
| 9363 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
| 9364 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); |
| 9365 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); |
| 9366 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
| 9367 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); |
| 9368 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
| 9369 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
| 9370 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); |
| 9371 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
| 9372 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
| 9373 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); |
| 9374 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
| 9375 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
| 9376 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); |
| 9377 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
| 9378 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
| 9379 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); |
| 9380 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
| 9381 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
| 9382 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); |
| 9383 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
| 9384 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
| 9385 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); |
| 9386 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
| 9387 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
| 9388 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); |
| 9389 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
| 9390 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
| 9391 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); |
| 9392 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
| 9393 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
| 9394 | #endif /* HAVE_IPV6 */ |
| 9395 | |
| 9396 | /* "clear ip bgp neighbor soft out" */ |
| 9397 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); |
| 9398 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); |
| 9399 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); |
| 9400 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
| 9401 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
| 9402 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
| 9403 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
| 9404 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
| 9405 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
| 9406 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
| 9407 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
| 9408 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
| 9409 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); |
| 9410 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); |
| 9411 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
| 9412 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
| 9413 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
| 9414 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
| 9415 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
| 9416 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
| 9417 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
| 9418 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
| 9419 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
| 9420 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); |
| 9421 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); |
| 9422 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); |
| 9423 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); |
| 9424 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); |
| 9425 | #ifdef HAVE_IPV6 |
| 9426 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
| 9427 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); |
| 9428 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); |
| 9429 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
| 9430 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
| 9431 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
| 9432 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
| 9433 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
| 9434 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
| 9435 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
| 9436 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
| 9437 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
| 9438 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
| 9439 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
| 9440 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
| 9441 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
| 9442 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
| 9443 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
| 9444 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
| 9445 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
| 9446 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
| 9447 | #endif /* HAVE_IPV6 */ |
| 9448 | |
| 9449 | /* "clear ip bgp neighbor soft" */ |
| 9450 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); |
| 9451 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); |
| 9452 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); |
| 9453 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
| 9454 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
| 9455 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
| 9456 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
| 9457 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); |
| 9458 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); |
| 9459 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
| 9460 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
| 9461 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
| 9462 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
| 9463 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); |
| 9464 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); |
| 9465 | #ifdef HAVE_IPV6 |
| 9466 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
| 9467 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); |
| 9468 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); |
| 9469 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
| 9470 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
| 9471 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
| 9472 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
| 9473 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
| 9474 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
| 9475 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
| 9476 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
| 9477 | #endif /* HAVE_IPV6 */ |
| 9478 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9479 | /* "clear ip bgp neighbor rsclient" */ |
| 9480 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); |
| 9481 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); |
| 9482 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); |
| 9483 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); |
| 9484 | #ifdef HAVE_IPV6 |
| 9485 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); |
| 9486 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); |
| 9487 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); |
| 9488 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); |
| 9489 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); |
| 9490 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); |
| 9491 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); |
| 9492 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); |
| 9493 | #endif /* HAVE_IPV6 */ |
| 9494 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9495 | /* "show ip bgp summary" commands. */ |
| 9496 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); |
| 9497 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9498 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
| 9499 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
| 9500 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9501 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9502 | #ifdef HAVE_IPV6 |
| 9503 | install_element (VIEW_NODE, &show_bgp_summary_cmd); |
| 9504 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); |
| 9505 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
| 9506 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
| 9507 | #endif /* HAVE_IPV6 */ |
| 9508 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); |
| 9509 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9510 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
| 9511 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
| 9512 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9513 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9514 | #ifdef HAVE_IPV6 |
| 9515 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); |
| 9516 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); |
| 9517 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
| 9518 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
| 9519 | #endif /* HAVE_IPV6 */ |
| 9520 | |
| 9521 | /* "show ip bgp neighbors" commands. */ |
| 9522 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); |
| 9523 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 9524 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 9525 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 9526 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 9527 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 9528 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 9529 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 9530 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 9531 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 9532 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
| 9533 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 9534 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 9535 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 9536 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 9537 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 9538 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 9539 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 9540 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 9541 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 9542 | |
| 9543 | #ifdef HAVE_IPV6 |
| 9544 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); |
| 9545 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 9546 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); |
| 9547 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 9548 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
| 9549 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 9550 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 9551 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9552 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
| 9553 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 9554 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); |
| 9555 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 9556 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
| 9557 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 9558 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 9559 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9560 | |
| 9561 | /* Old commands. */ |
| 9562 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); |
| 9563 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); |
| 9564 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); |
| 9565 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); |
| 9566 | #endif /* HAVE_IPV6 */ |
| 9567 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9568 | /* "show ip bgp rsclient" commands. */ |
| 9569 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 9570 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 9571 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 9572 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
| 9573 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 9574 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 9575 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 9576 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
| 9577 | |
| 9578 | #ifdef HAVE_IPV6 |
| 9579 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); |
| 9580 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 9581 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 9582 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
| 9583 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
| 9584 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 9585 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 9586 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
| 9587 | #endif /* HAVE_IPV6 */ |
| 9588 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9589 | /* "show ip bgp paths" commands. */ |
| 9590 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); |
| 9591 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 9592 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); |
| 9593 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 9594 | |
| 9595 | /* "show ip bgp community" commands. */ |
| 9596 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); |
| 9597 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); |
| 9598 | |
| 9599 | /* "show ip bgp attribute-info" commands. */ |
| 9600 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); |
| 9601 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); |
| 9602 | |
| 9603 | /* "redistribute" commands. */ |
| 9604 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); |
| 9605 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); |
| 9606 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); |
| 9607 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); |
| 9608 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); |
| 9609 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); |
| 9610 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); |
| 9611 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); |
| 9612 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); |
| 9613 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); |
| 9614 | #ifdef HAVE_IPV6 |
| 9615 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); |
| 9616 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); |
| 9617 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); |
| 9618 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); |
| 9619 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); |
| 9620 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); |
| 9621 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); |
| 9622 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); |
| 9623 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); |
| 9624 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); |
| 9625 | #endif /* HAVE_IPV6 */ |
| 9626 | |
| 9627 | /* Community-list. */ |
| 9628 | community_list_vty (); |
| 9629 | } |
| 9630 | |
| 9631 | #include "memory.h" |
| 9632 | #include "bgp_regex.h" |
| 9633 | #include "bgp_clist.h" |
| 9634 | #include "bgp_ecommunity.h" |
| 9635 | |
| 9636 | /* VTY functions. */ |
| 9637 | |
| 9638 | /* Direction value to string conversion. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9639 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9640 | community_direct_str (int direct) |
| 9641 | { |
| 9642 | switch (direct) |
| 9643 | { |
| 9644 | case COMMUNITY_DENY: |
| 9645 | return "deny"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9646 | case COMMUNITY_PERMIT: |
| 9647 | return "permit"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9648 | default: |
| 9649 | return "unknown"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9650 | } |
| 9651 | } |
| 9652 | |
| 9653 | /* Display error string. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9654 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9655 | community_list_perror (struct vty *vty, int ret) |
| 9656 | { |
| 9657 | switch (ret) |
| 9658 | { |
| 9659 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: |
| 9660 | vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE); |
| 9661 | break; |
| 9662 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: |
| 9663 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); |
| 9664 | break; |
| 9665 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: |
| 9666 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); |
| 9667 | break; |
| 9668 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: |
| 9669 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); |
| 9670 | break; |
| 9671 | } |
| 9672 | } |
| 9673 | |
| 9674 | /* VTY interface for community_set() function. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9675 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 9676 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 9677 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9678 | { |
| 9679 | int ret; |
| 9680 | int direct; |
| 9681 | char *str; |
| 9682 | |
| 9683 | /* Check the list type. */ |
| 9684 | if (strncmp (argv[1], "p", 1) == 0) |
| 9685 | direct = COMMUNITY_PERMIT; |
| 9686 | else if (strncmp (argv[1], "d", 1) == 0) |
| 9687 | direct = COMMUNITY_DENY; |
| 9688 | else |
| 9689 | { |
| 9690 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 9691 | VTY_NEWLINE); |
| 9692 | return CMD_WARNING; |
| 9693 | } |
| 9694 | |
| 9695 | /* All digit name check. */ |
| 9696 | if (reject_all_digit_name && all_digit (argv[0])) |
| 9697 | { |
| 9698 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 9699 | return CMD_WARNING; |
| 9700 | } |
| 9701 | |
| 9702 | /* Concat community string argument. */ |
| 9703 | if (argc > 1) |
| 9704 | str = argv_concat (argv, argc, 2); |
| 9705 | else |
| 9706 | str = NULL; |
| 9707 | |
| 9708 | /* When community_list_set() return nevetive value, it means |
| 9709 | malformed community string. */ |
| 9710 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); |
| 9711 | |
| 9712 | /* Free temporary community list string allocated by |
| 9713 | argv_concat(). */ |
| 9714 | if (str) |
| 9715 | XFREE (MTYPE_TMP, str); |
| 9716 | |
| 9717 | if (ret < 0) |
| 9718 | { |
| 9719 | /* Display error string. */ |
| 9720 | community_list_perror (vty, ret); |
| 9721 | return CMD_WARNING; |
| 9722 | } |
| 9723 | |
| 9724 | return CMD_SUCCESS; |
| 9725 | } |
| 9726 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9727 | /* Communiyt-list entry delete. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9728 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9729 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 9730 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9731 | { |
| 9732 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9733 | int direct = 0; |
| 9734 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9735 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9736 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9737 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9738 | /* Check the list direct. */ |
| 9739 | if (strncmp (argv[1], "p", 1) == 0) |
| 9740 | direct = COMMUNITY_PERMIT; |
| 9741 | else if (strncmp (argv[1], "d", 1) == 0) |
| 9742 | direct = COMMUNITY_DENY; |
| 9743 | else |
| 9744 | { |
| 9745 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 9746 | VTY_NEWLINE); |
| 9747 | return CMD_WARNING; |
| 9748 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9749 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9750 | /* Concat community string argument. */ |
| 9751 | str = argv_concat (argv, argc, 2); |
| 9752 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9753 | |
| 9754 | /* Unset community list. */ |
| 9755 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); |
| 9756 | |
| 9757 | /* Free temporary community list string allocated by |
| 9758 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9759 | if (str) |
| 9760 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9761 | |
| 9762 | if (ret < 0) |
| 9763 | { |
| 9764 | community_list_perror (vty, ret); |
| 9765 | return CMD_WARNING; |
| 9766 | } |
| 9767 | |
| 9768 | return CMD_SUCCESS; |
| 9769 | } |
| 9770 | |
| 9771 | /* "community-list" keyword help string. */ |
| 9772 | #define COMMUNITY_LIST_STR "Add a community list entry\n" |
| 9773 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" |
| 9774 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9775 | DEFUN (ip_community_list_standard, |
| 9776 | ip_community_list_standard_cmd, |
| 9777 | "ip community-list <1-99> (deny|permit) .AA:NN", |
| 9778 | IP_STR |
| 9779 | COMMUNITY_LIST_STR |
| 9780 | "Community list number (standard)\n" |
| 9781 | "Specify community to reject\n" |
| 9782 | "Specify community to accept\n" |
| 9783 | COMMUNITY_VAL_STR) |
| 9784 | { |
| 9785 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
| 9786 | } |
| 9787 | |
| 9788 | ALIAS (ip_community_list_standard, |
| 9789 | ip_community_list_standard2_cmd, |
| 9790 | "ip community-list <1-99> (deny|permit)", |
| 9791 | IP_STR |
| 9792 | COMMUNITY_LIST_STR |
| 9793 | "Community list number (standard)\n" |
| 9794 | "Specify community to reject\n" |
| 9795 | "Specify community to accept\n") |
| 9796 | |
| 9797 | DEFUN (ip_community_list_expanded, |
| 9798 | ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9799 | "ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9800 | IP_STR |
| 9801 | COMMUNITY_LIST_STR |
| 9802 | "Community list number (expanded)\n" |
| 9803 | "Specify community to reject\n" |
| 9804 | "Specify community to accept\n" |
| 9805 | "An ordered list as a regular-expression\n") |
| 9806 | { |
| 9807 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
| 9808 | } |
| 9809 | |
| 9810 | DEFUN (ip_community_list_name_standard, |
| 9811 | ip_community_list_name_standard_cmd, |
| 9812 | "ip community-list standard WORD (deny|permit) .AA:NN", |
| 9813 | IP_STR |
| 9814 | COMMUNITY_LIST_STR |
| 9815 | "Add a standard community-list entry\n" |
| 9816 | "Community list name\n" |
| 9817 | "Specify community to reject\n" |
| 9818 | "Specify community to accept\n" |
| 9819 | COMMUNITY_VAL_STR) |
| 9820 | { |
| 9821 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
| 9822 | } |
| 9823 | |
| 9824 | ALIAS (ip_community_list_name_standard, |
| 9825 | ip_community_list_name_standard2_cmd, |
| 9826 | "ip community-list standard WORD (deny|permit)", |
| 9827 | IP_STR |
| 9828 | COMMUNITY_LIST_STR |
| 9829 | "Add a standard community-list entry\n" |
| 9830 | "Community list name\n" |
| 9831 | "Specify community to reject\n" |
| 9832 | "Specify community to accept\n") |
| 9833 | |
| 9834 | DEFUN (ip_community_list_name_expanded, |
| 9835 | ip_community_list_name_expanded_cmd, |
| 9836 | "ip community-list expanded WORD (deny|permit) .LINE", |
| 9837 | IP_STR |
| 9838 | COMMUNITY_LIST_STR |
| 9839 | "Add an expanded community-list entry\n" |
| 9840 | "Community list name\n" |
| 9841 | "Specify community to reject\n" |
| 9842 | "Specify community to accept\n" |
| 9843 | "An ordered list as a regular-expression\n") |
| 9844 | { |
| 9845 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
| 9846 | } |
| 9847 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9848 | DEFUN (no_ip_community_list_standard_all, |
| 9849 | no_ip_community_list_standard_all_cmd, |
| 9850 | "no ip community-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9851 | NO_STR |
| 9852 | IP_STR |
| 9853 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9854 | "Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9855 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9856 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9857 | } |
| 9858 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9859 | DEFUN (no_ip_community_list_expanded_all, |
| 9860 | no_ip_community_list_expanded_all_cmd, |
| 9861 | "no ip community-list <100-500>", |
| 9862 | NO_STR |
| 9863 | IP_STR |
| 9864 | COMMUNITY_LIST_STR |
| 9865 | "Community list number (expanded)\n") |
| 9866 | { |
| 9867 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 9868 | } |
| 9869 | |
| 9870 | DEFUN (no_ip_community_list_name_standard_all, |
| 9871 | no_ip_community_list_name_standard_all_cmd, |
| 9872 | "no ip community-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9873 | NO_STR |
| 9874 | IP_STR |
| 9875 | COMMUNITY_LIST_STR |
| 9876 | "Add a standard community-list entry\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9877 | "Community list name\n") |
| 9878 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9879 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9880 | } |
| 9881 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9882 | DEFUN (no_ip_community_list_name_expanded_all, |
| 9883 | no_ip_community_list_name_expanded_all_cmd, |
| 9884 | "no ip community-list expanded WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9885 | NO_STR |
| 9886 | IP_STR |
| 9887 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9888 | "Add an expanded community-list entry\n" |
| 9889 | "Community list name\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9890 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9891 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9892 | } |
| 9893 | |
| 9894 | DEFUN (no_ip_community_list_standard, |
| 9895 | no_ip_community_list_standard_cmd, |
| 9896 | "no ip community-list <1-99> (deny|permit) .AA:NN", |
| 9897 | NO_STR |
| 9898 | IP_STR |
| 9899 | COMMUNITY_LIST_STR |
| 9900 | "Community list number (standard)\n" |
| 9901 | "Specify community to reject\n" |
| 9902 | "Specify community to accept\n" |
| 9903 | COMMUNITY_VAL_STR) |
| 9904 | { |
| 9905 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 9906 | } |
| 9907 | |
| 9908 | DEFUN (no_ip_community_list_expanded, |
| 9909 | no_ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9910 | "no ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9911 | NO_STR |
| 9912 | IP_STR |
| 9913 | COMMUNITY_LIST_STR |
| 9914 | "Community list number (expanded)\n" |
| 9915 | "Specify community to reject\n" |
| 9916 | "Specify community to accept\n" |
| 9917 | "An ordered list as a regular-expression\n") |
| 9918 | { |
| 9919 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 9920 | } |
| 9921 | |
| 9922 | DEFUN (no_ip_community_list_name_standard, |
| 9923 | no_ip_community_list_name_standard_cmd, |
| 9924 | "no ip community-list standard WORD (deny|permit) .AA:NN", |
| 9925 | NO_STR |
| 9926 | IP_STR |
| 9927 | COMMUNITY_LIST_STR |
| 9928 | "Specify a standard community-list\n" |
| 9929 | "Community list name\n" |
| 9930 | "Specify community to reject\n" |
| 9931 | "Specify community to accept\n" |
| 9932 | COMMUNITY_VAL_STR) |
| 9933 | { |
| 9934 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 9935 | } |
| 9936 | |
| 9937 | DEFUN (no_ip_community_list_name_expanded, |
| 9938 | no_ip_community_list_name_expanded_cmd, |
| 9939 | "no ip community-list expanded WORD (deny|permit) .LINE", |
| 9940 | NO_STR |
| 9941 | IP_STR |
| 9942 | COMMUNITY_LIST_STR |
| 9943 | "Specify an expanded community-list\n" |
| 9944 | "Community list name\n" |
| 9945 | "Specify community to reject\n" |
| 9946 | "Specify community to accept\n" |
| 9947 | "An ordered list as a regular-expression\n") |
| 9948 | { |
| 9949 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 9950 | } |
| 9951 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9952 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9953 | community_list_show (struct vty *vty, struct community_list *list) |
| 9954 | { |
| 9955 | struct community_entry *entry; |
| 9956 | |
| 9957 | for (entry = list->head; entry; entry = entry->next) |
| 9958 | { |
| 9959 | if (entry == list->head) |
| 9960 | { |
| 9961 | if (all_digit (list->name)) |
| 9962 | vty_out (vty, "Community %s list %s%s", |
| 9963 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 9964 | "standard" : "(expanded) access", |
| 9965 | list->name, VTY_NEWLINE); |
| 9966 | else |
| 9967 | vty_out (vty, "Named Community %s list %s%s", |
| 9968 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 9969 | "standard" : "expanded", |
| 9970 | list->name, VTY_NEWLINE); |
| 9971 | } |
| 9972 | if (entry->any) |
| 9973 | vty_out (vty, " %s%s", |
| 9974 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 9975 | else |
| 9976 | vty_out (vty, " %s %s%s", |
| 9977 | community_direct_str (entry->direct), |
| 9978 | entry->style == COMMUNITY_LIST_STANDARD |
| 9979 | ? community_str (entry->u.com) : entry->config, |
| 9980 | VTY_NEWLINE); |
| 9981 | } |
| 9982 | } |
| 9983 | |
| 9984 | DEFUN (show_ip_community_list, |
| 9985 | show_ip_community_list_cmd, |
| 9986 | "show ip community-list", |
| 9987 | SHOW_STR |
| 9988 | IP_STR |
| 9989 | "List community-list\n") |
| 9990 | { |
| 9991 | struct community_list *list; |
| 9992 | struct community_list_master *cm; |
| 9993 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 9994 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9995 | if (! cm) |
| 9996 | return CMD_SUCCESS; |
| 9997 | |
| 9998 | for (list = cm->num.head; list; list = list->next) |
| 9999 | community_list_show (vty, list); |
| 10000 | |
| 10001 | for (list = cm->str.head; list; list = list->next) |
| 10002 | community_list_show (vty, list); |
| 10003 | |
| 10004 | return CMD_SUCCESS; |
| 10005 | } |
| 10006 | |
| 10007 | DEFUN (show_ip_community_list_arg, |
| 10008 | show_ip_community_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10009 | "show ip community-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10010 | SHOW_STR |
| 10011 | IP_STR |
| 10012 | "List community-list\n" |
| 10013 | "Community-list number\n" |
| 10014 | "Community-list name\n") |
| 10015 | { |
| 10016 | struct community_list *list; |
| 10017 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10018 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10019 | if (! list) |
| 10020 | { |
| 10021 | vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE); |
| 10022 | return CMD_WARNING; |
| 10023 | } |
| 10024 | |
| 10025 | community_list_show (vty, list); |
| 10026 | |
| 10027 | return CMD_SUCCESS; |
| 10028 | } |
| 10029 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10030 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10031 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10032 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10033 | { |
| 10034 | int ret; |
| 10035 | int direct; |
| 10036 | char *str; |
| 10037 | |
| 10038 | /* Check the list type. */ |
| 10039 | if (strncmp (argv[1], "p", 1) == 0) |
| 10040 | direct = COMMUNITY_PERMIT; |
| 10041 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10042 | direct = COMMUNITY_DENY; |
| 10043 | else |
| 10044 | { |
| 10045 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10046 | VTY_NEWLINE); |
| 10047 | return CMD_WARNING; |
| 10048 | } |
| 10049 | |
| 10050 | /* All digit name check. */ |
| 10051 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10052 | { |
| 10053 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10054 | return CMD_WARNING; |
| 10055 | } |
| 10056 | |
| 10057 | /* Concat community string argument. */ |
| 10058 | if (argc > 1) |
| 10059 | str = argv_concat (argv, argc, 2); |
| 10060 | else |
| 10061 | str = NULL; |
| 10062 | |
| 10063 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); |
| 10064 | |
| 10065 | /* Free temporary community list string allocated by |
| 10066 | argv_concat(). */ |
| 10067 | if (str) |
| 10068 | XFREE (MTYPE_TMP, str); |
| 10069 | |
| 10070 | if (ret < 0) |
| 10071 | { |
| 10072 | community_list_perror (vty, ret); |
| 10073 | return CMD_WARNING; |
| 10074 | } |
| 10075 | return CMD_SUCCESS; |
| 10076 | } |
| 10077 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10078 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10079 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10080 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10081 | { |
| 10082 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10083 | int direct = 0; |
| 10084 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10085 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10086 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10087 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10088 | /* Check the list direct. */ |
| 10089 | if (strncmp (argv[1], "p", 1) == 0) |
| 10090 | direct = COMMUNITY_PERMIT; |
| 10091 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10092 | direct = COMMUNITY_DENY; |
| 10093 | else |
| 10094 | { |
| 10095 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10096 | VTY_NEWLINE); |
| 10097 | return CMD_WARNING; |
| 10098 | } |
| 10099 | |
| 10100 | /* Concat community string argument. */ |
| 10101 | str = argv_concat (argv, argc, 2); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10102 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10103 | |
| 10104 | /* Unset community list. */ |
| 10105 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10106 | |
| 10107 | /* Free temporary community list string allocated by |
| 10108 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10109 | if (str) |
| 10110 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10111 | |
| 10112 | if (ret < 0) |
| 10113 | { |
| 10114 | community_list_perror (vty, ret); |
| 10115 | return CMD_WARNING; |
| 10116 | } |
| 10117 | |
| 10118 | return CMD_SUCCESS; |
| 10119 | } |
| 10120 | |
| 10121 | /* "extcommunity-list" keyword help string. */ |
| 10122 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" |
| 10123 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" |
| 10124 | |
| 10125 | DEFUN (ip_extcommunity_list_standard, |
| 10126 | ip_extcommunity_list_standard_cmd, |
| 10127 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10128 | IP_STR |
| 10129 | EXTCOMMUNITY_LIST_STR |
| 10130 | "Extended Community list number (standard)\n" |
| 10131 | "Specify community to reject\n" |
| 10132 | "Specify community to accept\n" |
| 10133 | EXTCOMMUNITY_VAL_STR) |
| 10134 | { |
| 10135 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
| 10136 | } |
| 10137 | |
| 10138 | ALIAS (ip_extcommunity_list_standard, |
| 10139 | ip_extcommunity_list_standard2_cmd, |
| 10140 | "ip extcommunity-list <1-99> (deny|permit)", |
| 10141 | IP_STR |
| 10142 | EXTCOMMUNITY_LIST_STR |
| 10143 | "Extended Community list number (standard)\n" |
| 10144 | "Specify community to reject\n" |
| 10145 | "Specify community to accept\n") |
| 10146 | |
| 10147 | DEFUN (ip_extcommunity_list_expanded, |
| 10148 | ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10149 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10150 | IP_STR |
| 10151 | EXTCOMMUNITY_LIST_STR |
| 10152 | "Extended Community list number (expanded)\n" |
| 10153 | "Specify community to reject\n" |
| 10154 | "Specify community to accept\n" |
| 10155 | "An ordered list as a regular-expression\n") |
| 10156 | { |
| 10157 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
| 10158 | } |
| 10159 | |
| 10160 | DEFUN (ip_extcommunity_list_name_standard, |
| 10161 | ip_extcommunity_list_name_standard_cmd, |
| 10162 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10163 | IP_STR |
| 10164 | EXTCOMMUNITY_LIST_STR |
| 10165 | "Specify standard extcommunity-list\n" |
| 10166 | "Extended Community list name\n" |
| 10167 | "Specify community to reject\n" |
| 10168 | "Specify community to accept\n" |
| 10169 | EXTCOMMUNITY_VAL_STR) |
| 10170 | { |
| 10171 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
| 10172 | } |
| 10173 | |
| 10174 | ALIAS (ip_extcommunity_list_name_standard, |
| 10175 | ip_extcommunity_list_name_standard2_cmd, |
| 10176 | "ip extcommunity-list standard WORD (deny|permit)", |
| 10177 | IP_STR |
| 10178 | EXTCOMMUNITY_LIST_STR |
| 10179 | "Specify standard extcommunity-list\n" |
| 10180 | "Extended Community list name\n" |
| 10181 | "Specify community to reject\n" |
| 10182 | "Specify community to accept\n") |
| 10183 | |
| 10184 | DEFUN (ip_extcommunity_list_name_expanded, |
| 10185 | ip_extcommunity_list_name_expanded_cmd, |
| 10186 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10187 | IP_STR |
| 10188 | EXTCOMMUNITY_LIST_STR |
| 10189 | "Specify expanded extcommunity-list\n" |
| 10190 | "Extended Community list name\n" |
| 10191 | "Specify community to reject\n" |
| 10192 | "Specify community to accept\n" |
| 10193 | "An ordered list as a regular-expression\n") |
| 10194 | { |
| 10195 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
| 10196 | } |
| 10197 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10198 | DEFUN (no_ip_extcommunity_list_standard_all, |
| 10199 | no_ip_extcommunity_list_standard_all_cmd, |
| 10200 | "no ip extcommunity-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10201 | NO_STR |
| 10202 | IP_STR |
| 10203 | EXTCOMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10204 | "Extended Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10205 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10206 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10207 | } |
| 10208 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10209 | DEFUN (no_ip_extcommunity_list_expanded_all, |
| 10210 | no_ip_extcommunity_list_expanded_all_cmd, |
| 10211 | "no ip extcommunity-list <100-500>", |
| 10212 | NO_STR |
| 10213 | IP_STR |
| 10214 | EXTCOMMUNITY_LIST_STR |
| 10215 | "Extended Community list number (expanded)\n") |
| 10216 | { |
| 10217 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10218 | } |
| 10219 | |
| 10220 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
| 10221 | no_ip_extcommunity_list_name_standard_all_cmd, |
| 10222 | "no ip extcommunity-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10223 | NO_STR |
| 10224 | IP_STR |
| 10225 | EXTCOMMUNITY_LIST_STR |
| 10226 | "Specify standard extcommunity-list\n" |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10227 | "Extended Community list name\n") |
| 10228 | { |
| 10229 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10230 | } |
| 10231 | |
| 10232 | DEFUN (no_ip_extcommunity_list_name_expanded_all, |
| 10233 | no_ip_extcommunity_list_name_expanded_all_cmd, |
| 10234 | "no ip extcommunity-list expanded WORD", |
| 10235 | NO_STR |
| 10236 | IP_STR |
| 10237 | EXTCOMMUNITY_LIST_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10238 | "Specify expanded extcommunity-list\n" |
| 10239 | "Extended Community list name\n") |
| 10240 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10241 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10242 | } |
| 10243 | |
| 10244 | DEFUN (no_ip_extcommunity_list_standard, |
| 10245 | no_ip_extcommunity_list_standard_cmd, |
| 10246 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10247 | NO_STR |
| 10248 | IP_STR |
| 10249 | EXTCOMMUNITY_LIST_STR |
| 10250 | "Extended Community list number (standard)\n" |
| 10251 | "Specify community to reject\n" |
| 10252 | "Specify community to accept\n" |
| 10253 | EXTCOMMUNITY_VAL_STR) |
| 10254 | { |
| 10255 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10256 | } |
| 10257 | |
| 10258 | DEFUN (no_ip_extcommunity_list_expanded, |
| 10259 | no_ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10260 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10261 | NO_STR |
| 10262 | IP_STR |
| 10263 | EXTCOMMUNITY_LIST_STR |
| 10264 | "Extended Community list number (expanded)\n" |
| 10265 | "Specify community to reject\n" |
| 10266 | "Specify community to accept\n" |
| 10267 | "An ordered list as a regular-expression\n") |
| 10268 | { |
| 10269 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10270 | } |
| 10271 | |
| 10272 | DEFUN (no_ip_extcommunity_list_name_standard, |
| 10273 | no_ip_extcommunity_list_name_standard_cmd, |
| 10274 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10275 | NO_STR |
| 10276 | IP_STR |
| 10277 | EXTCOMMUNITY_LIST_STR |
| 10278 | "Specify standard extcommunity-list\n" |
| 10279 | "Extended Community list name\n" |
| 10280 | "Specify community to reject\n" |
| 10281 | "Specify community to accept\n" |
| 10282 | EXTCOMMUNITY_VAL_STR) |
| 10283 | { |
| 10284 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10285 | } |
| 10286 | |
| 10287 | DEFUN (no_ip_extcommunity_list_name_expanded, |
| 10288 | no_ip_extcommunity_list_name_expanded_cmd, |
| 10289 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10290 | NO_STR |
| 10291 | IP_STR |
| 10292 | EXTCOMMUNITY_LIST_STR |
| 10293 | "Specify expanded extcommunity-list\n" |
| 10294 | "Community list name\n" |
| 10295 | "Specify community to reject\n" |
| 10296 | "Specify community to accept\n" |
| 10297 | "An ordered list as a regular-expression\n") |
| 10298 | { |
| 10299 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10300 | } |
| 10301 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10302 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10303 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
| 10304 | { |
| 10305 | struct community_entry *entry; |
| 10306 | |
| 10307 | for (entry = list->head; entry; entry = entry->next) |
| 10308 | { |
| 10309 | if (entry == list->head) |
| 10310 | { |
| 10311 | if (all_digit (list->name)) |
| 10312 | vty_out (vty, "Extended community %s list %s%s", |
| 10313 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10314 | "standard" : "(expanded) access", |
| 10315 | list->name, VTY_NEWLINE); |
| 10316 | else |
| 10317 | vty_out (vty, "Named extended community %s list %s%s", |
| 10318 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10319 | "standard" : "expanded", |
| 10320 | list->name, VTY_NEWLINE); |
| 10321 | } |
| 10322 | if (entry->any) |
| 10323 | vty_out (vty, " %s%s", |
| 10324 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10325 | else |
| 10326 | vty_out (vty, " %s %s%s", |
| 10327 | community_direct_str (entry->direct), |
| 10328 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10329 | entry->u.ecom->str : entry->config, |
| 10330 | VTY_NEWLINE); |
| 10331 | } |
| 10332 | } |
| 10333 | |
| 10334 | DEFUN (show_ip_extcommunity_list, |
| 10335 | show_ip_extcommunity_list_cmd, |
| 10336 | "show ip extcommunity-list", |
| 10337 | SHOW_STR |
| 10338 | IP_STR |
| 10339 | "List extended-community list\n") |
| 10340 | { |
| 10341 | struct community_list *list; |
| 10342 | struct community_list_master *cm; |
| 10343 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10344 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10345 | if (! cm) |
| 10346 | return CMD_SUCCESS; |
| 10347 | |
| 10348 | for (list = cm->num.head; list; list = list->next) |
| 10349 | extcommunity_list_show (vty, list); |
| 10350 | |
| 10351 | for (list = cm->str.head; list; list = list->next) |
| 10352 | extcommunity_list_show (vty, list); |
| 10353 | |
| 10354 | return CMD_SUCCESS; |
| 10355 | } |
| 10356 | |
| 10357 | DEFUN (show_ip_extcommunity_list_arg, |
| 10358 | show_ip_extcommunity_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10359 | "show ip extcommunity-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10360 | SHOW_STR |
| 10361 | IP_STR |
| 10362 | "List extended-community list\n" |
| 10363 | "Extcommunity-list number\n" |
| 10364 | "Extcommunity-list name\n") |
| 10365 | { |
| 10366 | struct community_list *list; |
| 10367 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10368 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10369 | if (! list) |
| 10370 | { |
| 10371 | vty_out (vty, "%% Can't find extcommunit-list%s", VTY_NEWLINE); |
| 10372 | return CMD_WARNING; |
| 10373 | } |
| 10374 | |
| 10375 | extcommunity_list_show (vty, list); |
| 10376 | |
| 10377 | return CMD_SUCCESS; |
| 10378 | } |
| 10379 | |
| 10380 | /* Return configuration string of community-list entry. */ |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10381 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10382 | community_list_config_str (struct community_entry *entry) |
| 10383 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10384 | const char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10385 | |
| 10386 | if (entry->any) |
| 10387 | str = ""; |
| 10388 | else |
| 10389 | { |
| 10390 | if (entry->style == COMMUNITY_LIST_STANDARD) |
| 10391 | str = community_str (entry->u.com); |
| 10392 | else |
| 10393 | str = entry->config; |
| 10394 | } |
| 10395 | return str; |
| 10396 | } |
| 10397 | |
| 10398 | /* Display community-list and extcommunity-list configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10399 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10400 | community_list_config_write (struct vty *vty) |
| 10401 | { |
| 10402 | struct community_list *list; |
| 10403 | struct community_entry *entry; |
| 10404 | struct community_list_master *cm; |
| 10405 | int write = 0; |
| 10406 | |
| 10407 | /* Community-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10408 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10409 | |
| 10410 | for (list = cm->num.head; list; list = list->next) |
| 10411 | for (entry = list->head; entry; entry = entry->next) |
| 10412 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10413 | vty_out (vty, "ip community-list %s %s %s%s", |
| 10414 | list->name, community_direct_str (entry->direct), |
| 10415 | community_list_config_str (entry), |
| 10416 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10417 | write++; |
| 10418 | } |
| 10419 | for (list = cm->str.head; list; list = list->next) |
| 10420 | for (entry = list->head; entry; entry = entry->next) |
| 10421 | { |
| 10422 | vty_out (vty, "ip community-list %s %s %s %s%s", |
| 10423 | entry->style == COMMUNITY_LIST_STANDARD |
| 10424 | ? "standard" : "expanded", |
| 10425 | list->name, community_direct_str (entry->direct), |
| 10426 | community_list_config_str (entry), |
| 10427 | VTY_NEWLINE); |
| 10428 | write++; |
| 10429 | } |
| 10430 | |
| 10431 | /* Extcommunity-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10432 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10433 | |
| 10434 | for (list = cm->num.head; list; list = list->next) |
| 10435 | for (entry = list->head; entry; entry = entry->next) |
| 10436 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10437 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
| 10438 | list->name, community_direct_str (entry->direct), |
| 10439 | community_list_config_str (entry), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10440 | write++; |
| 10441 | } |
| 10442 | for (list = cm->str.head; list; list = list->next) |
| 10443 | for (entry = list->head; entry; entry = entry->next) |
| 10444 | { |
| 10445 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", |
| 10446 | entry->style == EXTCOMMUNITY_LIST_STANDARD |
| 10447 | ? "standard" : "expanded", |
| 10448 | list->name, community_direct_str (entry->direct), |
| 10449 | community_list_config_str (entry), VTY_NEWLINE); |
| 10450 | write++; |
| 10451 | } |
| 10452 | return write; |
| 10453 | } |
| 10454 | |
| 10455 | struct cmd_node community_list_node = |
| 10456 | { |
| 10457 | COMMUNITY_LIST_NODE, |
| 10458 | "", |
| 10459 | 1 /* Export to vtysh. */ |
| 10460 | }; |
| 10461 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10462 | static void |
| 10463 | community_list_vty (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10464 | { |
| 10465 | install_node (&community_list_node, community_list_config_write); |
| 10466 | |
| 10467 | /* Community-list. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10468 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
| 10469 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); |
| 10470 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); |
| 10471 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); |
| 10472 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); |
| 10473 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10474 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
| 10475 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
| 10476 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); |
| 10477 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10478 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
| 10479 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); |
| 10480 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); |
| 10481 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
| 10482 | install_element (VIEW_NODE, &show_ip_community_list_cmd); |
| 10483 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); |
| 10484 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); |
| 10485 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); |
| 10486 | |
| 10487 | /* Extcommunity-list. */ |
| 10488 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); |
| 10489 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); |
| 10490 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); |
| 10491 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); |
| 10492 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); |
| 10493 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10494 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
| 10495 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
| 10496 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); |
| 10497 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10498 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
| 10499 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); |
| 10500 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); |
| 10501 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
| 10502 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); |
| 10503 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 10504 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); |
| 10505 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 10506 | } |