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 Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 32 | #include "hash.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 33 | |
| 34 | #include "bgpd/bgpd.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 35 | #include "bgpd/bgp_advertise.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 36 | #include "bgpd/bgp_attr.h" |
| 37 | #include "bgpd/bgp_aspath.h" |
| 38 | #include "bgpd/bgp_community.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 39 | #include "bgpd/bgp_ecommunity.h" |
| 40 | #include "bgpd/bgp_damp.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 41 | #include "bgpd/bgp_debug.h" |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 42 | #include "bgpd/bgp_fsm.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 43 | #include "bgpd/bgp_mplsvpn.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 44 | #include "bgpd/bgp_nexthop.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 45 | #include "bgpd/bgp_open.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 46 | #include "bgpd/bgp_regex.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 47 | #include "bgpd/bgp_route.h" |
| 48 | #include "bgpd/bgp_zebra.h" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 49 | #include "bgpd/bgp_table.h" |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 50 | #include "bgpd/bgp_vty.h" |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 51 | #include "bgpd/bgp_mpath.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 52 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 53 | extern struct in_addr router_id_zebra; |
| 54 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 55 | /* Utility function to get address family from current node. */ |
| 56 | afi_t |
| 57 | bgp_node_afi (struct vty *vty) |
| 58 | { |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 59 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 60 | return AFI_IP6; |
| 61 | return AFI_IP; |
| 62 | } |
| 63 | |
| 64 | /* Utility function to get subsequent address family from current |
| 65 | node. */ |
| 66 | safi_t |
| 67 | bgp_node_safi (struct vty *vty) |
| 68 | { |
| 69 | if (vty->node == BGP_VPNV4_NODE) |
| 70 | return SAFI_MPLS_VPN; |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 71 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 72 | return SAFI_MULTICAST; |
| 73 | return SAFI_UNICAST; |
| 74 | } |
| 75 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 76 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 77 | peer_address_self_check (union sockunion *su) |
| 78 | { |
| 79 | struct interface *ifp = NULL; |
| 80 | |
| 81 | if (su->sa.sa_family == AF_INET) |
| 82 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); |
| 83 | #ifdef HAVE_IPV6 |
| 84 | else if (su->sa.sa_family == AF_INET6) |
| 85 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); |
| 86 | #endif /* HAVE IPV6 */ |
| 87 | |
| 88 | if (ifp) |
| 89 | return 1; |
| 90 | |
| 91 | return 0; |
| 92 | } |
| 93 | |
| 94 | /* Utility function for looking up peer from VTY. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 95 | static struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 96 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 97 | { |
| 98 | int ret; |
| 99 | struct bgp *bgp; |
| 100 | union sockunion su; |
| 101 | struct peer *peer; |
| 102 | |
| 103 | bgp = vty->index; |
| 104 | |
| 105 | ret = str2sockunion (ip_str, &su); |
| 106 | if (ret < 0) |
| 107 | { |
| 108 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 109 | return NULL; |
| 110 | } |
| 111 | |
| 112 | peer = peer_lookup (bgp, &su); |
| 113 | if (! peer) |
| 114 | { |
| 115 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE); |
| 116 | return NULL; |
| 117 | } |
| 118 | return peer; |
| 119 | } |
| 120 | |
| 121 | /* Utility function for looking up peer or peer group. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 122 | static struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 123 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 124 | { |
| 125 | int ret; |
| 126 | struct bgp *bgp; |
| 127 | union sockunion su; |
| 128 | struct peer *peer; |
| 129 | struct peer_group *group; |
| 130 | |
| 131 | bgp = vty->index; |
| 132 | |
| 133 | ret = str2sockunion (peer_str, &su); |
| 134 | if (ret == 0) |
| 135 | { |
| 136 | peer = peer_lookup (bgp, &su); |
| 137 | if (peer) |
| 138 | return peer; |
| 139 | } |
| 140 | else |
| 141 | { |
| 142 | group = peer_group_lookup (bgp, peer_str); |
| 143 | if (group) |
| 144 | return group->conf; |
| 145 | } |
| 146 | |
| 147 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
| 148 | VTY_NEWLINE); |
| 149 | |
| 150 | return NULL; |
| 151 | } |
| 152 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 153 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 154 | bgp_vty_return (struct vty *vty, int ret) |
| 155 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 156 | const char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 157 | |
| 158 | switch (ret) |
| 159 | { |
| 160 | case BGP_ERR_INVALID_VALUE: |
| 161 | str = "Invalid value"; |
| 162 | break; |
| 163 | case BGP_ERR_INVALID_FLAG: |
| 164 | str = "Invalid flag"; |
| 165 | break; |
| 166 | case BGP_ERR_PEER_INACTIVE: |
| 167 | str = "Activate the neighbor for the address family first"; |
| 168 | break; |
| 169 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: |
| 170 | str = "Invalid command for a peer-group member"; |
| 171 | break; |
| 172 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
| 173 | str = "Peer-group has been shutdown. Activate the peer-group first"; |
| 174 | break; |
| 175 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: |
| 176 | str = "This peer is a peer-group member. Please change peer-group configuration"; |
| 177 | break; |
| 178 | case BGP_ERR_PEER_FLAG_CONFLICT: |
| 179 | str = "Can't set override-capability and strict-capability-match at the same time"; |
| 180 | break; |
| 181 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: |
| 182 | str = "No activate for peergroup can be given only if peer-group has no members"; |
| 183 | break; |
| 184 | case BGP_ERR_PEER_BELONGS_TO_GROUP: |
| 185 | str = "No activate for an individual peer-group member is invalid"; |
| 186 | break; |
| 187 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: |
| 188 | str = "Activate the peer-group for the address family first"; |
| 189 | break; |
| 190 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
| 191 | str = "Specify remote-as or peer-group remote AS first"; |
| 192 | break; |
| 193 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: |
| 194 | str = "Cannot change the peer-group. Deconfigure first"; |
| 195 | break; |
| 196 | case BGP_ERR_PEER_GROUP_MISMATCH: |
| 197 | str = "Cannot have different peer-group for the neighbor"; |
| 198 | break; |
| 199 | case BGP_ERR_PEER_FILTER_CONFLICT: |
| 200 | str = "Prefix/distribute list can not co-exist"; |
| 201 | break; |
| 202 | case BGP_ERR_NOT_INTERNAL_PEER: |
| 203 | str = "Invalid command. Not an internal neighbor"; |
| 204 | break; |
| 205 | case BGP_ERR_REMOVE_PRIVATE_AS: |
| 206 | str = "Private AS cannot be removed for IBGP peers"; |
| 207 | break; |
| 208 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: |
| 209 | str = "Local-AS allowed only for EBGP peers"; |
| 210 | break; |
| 211 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: |
| 212 | str = "Cannot have local-as same as BGP AS number"; |
| 213 | break; |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 214 | case BGP_ERR_TCPSIG_FAILED: |
| 215 | str = "Error while applying TCP-Sig to session(s)"; |
| 216 | break; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 217 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
| 218 | str = "ebgp-multihop and ttl-security cannot be configured together"; |
| 219 | break; |
Stephen Hemminger | f5a4827 | 2011-03-24 17:30:21 +0000 | [diff] [blame] | 220 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
| 221 | str = "ttl-security only allowed for EBGP peers"; |
| 222 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 223 | } |
| 224 | if (str) |
| 225 | { |
| 226 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); |
| 227 | return CMD_WARNING; |
| 228 | } |
| 229 | return CMD_SUCCESS; |
| 230 | } |
| 231 | |
| 232 | /* BGP global configuration. */ |
| 233 | |
| 234 | DEFUN (bgp_multiple_instance_func, |
| 235 | bgp_multiple_instance_cmd, |
| 236 | "bgp multiple-instance", |
| 237 | BGP_STR |
| 238 | "Enable bgp multiple instance\n") |
| 239 | { |
| 240 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); |
| 241 | return CMD_SUCCESS; |
| 242 | } |
| 243 | |
| 244 | DEFUN (no_bgp_multiple_instance, |
| 245 | no_bgp_multiple_instance_cmd, |
| 246 | "no bgp multiple-instance", |
| 247 | NO_STR |
| 248 | BGP_STR |
| 249 | "BGP multiple instance\n") |
| 250 | { |
| 251 | int ret; |
| 252 | |
| 253 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); |
| 254 | if (ret < 0) |
| 255 | { |
| 256 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); |
| 257 | return CMD_WARNING; |
| 258 | } |
| 259 | return CMD_SUCCESS; |
| 260 | } |
| 261 | |
| 262 | DEFUN (bgp_config_type, |
| 263 | bgp_config_type_cmd, |
| 264 | "bgp config-type (cisco|zebra)", |
| 265 | BGP_STR |
| 266 | "Configuration type\n" |
| 267 | "cisco\n" |
| 268 | "zebra\n") |
| 269 | { |
| 270 | if (strncmp (argv[0], "c", 1) == 0) |
| 271 | bgp_option_set (BGP_OPT_CONFIG_CISCO); |
| 272 | else |
| 273 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 274 | |
| 275 | return CMD_SUCCESS; |
| 276 | } |
| 277 | |
| 278 | DEFUN (no_bgp_config_type, |
| 279 | no_bgp_config_type_cmd, |
| 280 | "no bgp config-type", |
| 281 | NO_STR |
| 282 | BGP_STR |
| 283 | "Display configuration type\n") |
| 284 | { |
| 285 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 286 | return CMD_SUCCESS; |
| 287 | } |
| 288 | |
| 289 | DEFUN (no_synchronization, |
| 290 | no_synchronization_cmd, |
| 291 | "no synchronization", |
| 292 | NO_STR |
| 293 | "Perform IGP synchronization\n") |
| 294 | { |
| 295 | return CMD_SUCCESS; |
| 296 | } |
| 297 | |
| 298 | DEFUN (no_auto_summary, |
| 299 | no_auto_summary_cmd, |
| 300 | "no auto-summary", |
| 301 | NO_STR |
| 302 | "Enable automatic network number summarization\n") |
| 303 | { |
| 304 | return CMD_SUCCESS; |
| 305 | } |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 306 | |
| 307 | DEFUN_DEPRECATED (neighbor_version, |
| 308 | neighbor_version_cmd, |
| 309 | NEIGHBOR_CMD "version (4|4-)", |
| 310 | NEIGHBOR_STR |
| 311 | NEIGHBOR_ADDR_STR |
| 312 | "Set the BGP version to match a neighbor\n" |
| 313 | "Neighbor's BGP version\n") |
| 314 | { |
| 315 | return CMD_SUCCESS; |
| 316 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 317 | |
| 318 | /* "router bgp" commands. */ |
| 319 | DEFUN (router_bgp, |
| 320 | router_bgp_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 321 | "router bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 322 | ROUTER_STR |
| 323 | BGP_STR |
| 324 | AS_STR) |
| 325 | { |
| 326 | int ret; |
| 327 | as_t as; |
| 328 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 329 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 330 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 331 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 332 | |
| 333 | if (argc == 2) |
| 334 | name = argv[1]; |
| 335 | |
| 336 | ret = bgp_get (&bgp, &as, name); |
| 337 | switch (ret) |
| 338 | { |
| 339 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: |
| 340 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", |
| 341 | VTY_NEWLINE); |
| 342 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 343 | case BGP_ERR_AS_MISMATCH: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 344 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 345 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 346 | case BGP_ERR_INSTANCE_MISMATCH: |
| 347 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 348 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 349 | as, VTY_NEWLINE); |
| 350 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 351 | } |
| 352 | |
| 353 | vty->node = BGP_NODE; |
| 354 | vty->index = bgp; |
| 355 | |
| 356 | return CMD_SUCCESS; |
| 357 | } |
| 358 | |
| 359 | ALIAS (router_bgp, |
| 360 | router_bgp_view_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 361 | "router bgp " CMD_AS_RANGE " view WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 362 | ROUTER_STR |
| 363 | BGP_STR |
| 364 | AS_STR |
| 365 | "BGP view\n" |
| 366 | "view name\n") |
| 367 | |
| 368 | /* "no router bgp" commands. */ |
| 369 | DEFUN (no_router_bgp, |
| 370 | no_router_bgp_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 371 | "no router bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 372 | NO_STR |
| 373 | ROUTER_STR |
| 374 | BGP_STR |
| 375 | AS_STR) |
| 376 | { |
| 377 | as_t as; |
| 378 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 379 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 380 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 381 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 382 | |
| 383 | if (argc == 2) |
| 384 | name = argv[1]; |
| 385 | |
| 386 | /* Lookup bgp structure. */ |
| 387 | bgp = bgp_lookup (as, name); |
| 388 | if (! bgp) |
| 389 | { |
| 390 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); |
| 391 | return CMD_WARNING; |
| 392 | } |
| 393 | |
| 394 | bgp_delete (bgp); |
| 395 | |
| 396 | return CMD_SUCCESS; |
| 397 | } |
| 398 | |
| 399 | ALIAS (no_router_bgp, |
| 400 | no_router_bgp_view_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 401 | "no router bgp " CMD_AS_RANGE " view WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 402 | NO_STR |
| 403 | ROUTER_STR |
| 404 | BGP_STR |
| 405 | AS_STR |
| 406 | "BGP view\n" |
| 407 | "view name\n") |
| 408 | |
| 409 | /* BGP router-id. */ |
| 410 | |
| 411 | DEFUN (bgp_router_id, |
| 412 | bgp_router_id_cmd, |
| 413 | "bgp router-id A.B.C.D", |
| 414 | BGP_STR |
| 415 | "Override configured router identifier\n" |
| 416 | "Manually configured router identifier\n") |
| 417 | { |
| 418 | int ret; |
| 419 | struct in_addr id; |
| 420 | struct bgp *bgp; |
| 421 | |
| 422 | bgp = vty->index; |
| 423 | |
| 424 | ret = inet_aton (argv[0], &id); |
| 425 | if (! ret) |
| 426 | { |
| 427 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); |
| 428 | return CMD_WARNING; |
| 429 | } |
| 430 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 431 | bgp->router_id_static = id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 432 | bgp_router_id_set (bgp, &id); |
| 433 | |
| 434 | return CMD_SUCCESS; |
| 435 | } |
| 436 | |
| 437 | DEFUN (no_bgp_router_id, |
| 438 | no_bgp_router_id_cmd, |
| 439 | "no bgp router-id", |
| 440 | NO_STR |
| 441 | BGP_STR |
| 442 | "Override configured router identifier\n") |
| 443 | { |
| 444 | int ret; |
| 445 | struct in_addr id; |
| 446 | struct bgp *bgp; |
| 447 | |
| 448 | bgp = vty->index; |
| 449 | |
| 450 | if (argc == 1) |
| 451 | { |
| 452 | ret = inet_aton (argv[0], &id); |
| 453 | if (! ret) |
| 454 | { |
| 455 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); |
| 456 | return CMD_WARNING; |
| 457 | } |
| 458 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 459 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 460 | { |
| 461 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); |
| 462 | return CMD_WARNING; |
| 463 | } |
| 464 | } |
| 465 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 466 | bgp->router_id_static.s_addr = 0; |
| 467 | bgp_router_id_set (bgp, &router_id_zebra); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 468 | |
| 469 | return CMD_SUCCESS; |
| 470 | } |
| 471 | |
| 472 | ALIAS (no_bgp_router_id, |
| 473 | no_bgp_router_id_val_cmd, |
| 474 | "no bgp router-id A.B.C.D", |
| 475 | NO_STR |
| 476 | BGP_STR |
| 477 | "Override configured router identifier\n" |
| 478 | "Manually configured router identifier\n") |
| 479 | |
| 480 | /* BGP Cluster ID. */ |
| 481 | |
| 482 | DEFUN (bgp_cluster_id, |
| 483 | bgp_cluster_id_cmd, |
| 484 | "bgp cluster-id A.B.C.D", |
| 485 | BGP_STR |
| 486 | "Configure Route-Reflector Cluster-id\n" |
| 487 | "Route-Reflector Cluster-id in IP address format\n") |
| 488 | { |
| 489 | int ret; |
| 490 | struct bgp *bgp; |
| 491 | struct in_addr cluster; |
| 492 | |
| 493 | bgp = vty->index; |
| 494 | |
| 495 | ret = inet_aton (argv[0], &cluster); |
| 496 | if (! ret) |
| 497 | { |
| 498 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 499 | return CMD_WARNING; |
| 500 | } |
| 501 | |
| 502 | bgp_cluster_id_set (bgp, &cluster); |
| 503 | |
| 504 | return CMD_SUCCESS; |
| 505 | } |
| 506 | |
| 507 | ALIAS (bgp_cluster_id, |
| 508 | bgp_cluster_id32_cmd, |
| 509 | "bgp cluster-id <1-4294967295>", |
| 510 | BGP_STR |
| 511 | "Configure Route-Reflector Cluster-id\n" |
| 512 | "Route-Reflector Cluster-id as 32 bit quantity\n") |
| 513 | |
| 514 | DEFUN (no_bgp_cluster_id, |
| 515 | no_bgp_cluster_id_cmd, |
| 516 | "no bgp cluster-id", |
| 517 | NO_STR |
| 518 | BGP_STR |
| 519 | "Configure Route-Reflector Cluster-id\n") |
| 520 | { |
| 521 | int ret; |
| 522 | struct bgp *bgp; |
| 523 | struct in_addr cluster; |
| 524 | |
| 525 | bgp = vty->index; |
| 526 | |
| 527 | if (argc == 1) |
| 528 | { |
| 529 | ret = inet_aton (argv[0], &cluster); |
| 530 | if (! ret) |
| 531 | { |
| 532 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 533 | return CMD_WARNING; |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | bgp_cluster_id_unset (bgp); |
| 538 | |
| 539 | return CMD_SUCCESS; |
| 540 | } |
| 541 | |
| 542 | ALIAS (no_bgp_cluster_id, |
| 543 | no_bgp_cluster_id_arg_cmd, |
| 544 | "no bgp cluster-id A.B.C.D", |
| 545 | NO_STR |
| 546 | BGP_STR |
| 547 | "Configure Route-Reflector Cluster-id\n" |
| 548 | "Route-Reflector Cluster-id in IP address format\n") |
| 549 | |
| 550 | DEFUN (bgp_confederation_identifier, |
| 551 | bgp_confederation_identifier_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 552 | "bgp confederation identifier " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 553 | "BGP specific commands\n" |
| 554 | "AS confederation parameters\n" |
| 555 | "AS number\n" |
| 556 | "Set routing domain confederation AS\n") |
| 557 | { |
| 558 | struct bgp *bgp; |
| 559 | as_t as; |
| 560 | |
| 561 | bgp = vty->index; |
| 562 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 563 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 564 | |
| 565 | bgp_confederation_id_set (bgp, as); |
| 566 | |
| 567 | return CMD_SUCCESS; |
| 568 | } |
| 569 | |
| 570 | DEFUN (no_bgp_confederation_identifier, |
| 571 | no_bgp_confederation_identifier_cmd, |
| 572 | "no bgp confederation identifier", |
| 573 | NO_STR |
| 574 | "BGP specific commands\n" |
| 575 | "AS confederation parameters\n" |
| 576 | "AS number\n") |
| 577 | { |
| 578 | struct bgp *bgp; |
| 579 | as_t as; |
| 580 | |
| 581 | bgp = vty->index; |
| 582 | |
| 583 | if (argc == 1) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 584 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 585 | |
| 586 | bgp_confederation_id_unset (bgp); |
| 587 | |
| 588 | return CMD_SUCCESS; |
| 589 | } |
| 590 | |
| 591 | ALIAS (no_bgp_confederation_identifier, |
| 592 | no_bgp_confederation_identifier_arg_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 593 | "no bgp confederation identifier " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 594 | NO_STR |
| 595 | "BGP specific commands\n" |
| 596 | "AS confederation parameters\n" |
| 597 | "AS number\n" |
| 598 | "Set routing domain confederation AS\n") |
| 599 | |
| 600 | DEFUN (bgp_confederation_peers, |
| 601 | bgp_confederation_peers_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 602 | "bgp confederation peers ." CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 603 | "BGP specific commands\n" |
| 604 | "AS confederation parameters\n" |
| 605 | "Peer ASs in BGP confederation\n" |
| 606 | AS_STR) |
| 607 | { |
| 608 | struct bgp *bgp; |
| 609 | as_t as; |
| 610 | int i; |
| 611 | |
| 612 | bgp = vty->index; |
| 613 | |
| 614 | for (i = 0; i < argc; i++) |
| 615 | { |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 616 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 617 | |
| 618 | if (bgp->as == as) |
| 619 | { |
| 620 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", |
| 621 | VTY_NEWLINE); |
| 622 | continue; |
| 623 | } |
| 624 | |
| 625 | bgp_confederation_peers_add (bgp, as); |
| 626 | } |
| 627 | return CMD_SUCCESS; |
| 628 | } |
| 629 | |
| 630 | DEFUN (no_bgp_confederation_peers, |
| 631 | no_bgp_confederation_peers_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 632 | "no bgp confederation peers ." CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 633 | NO_STR |
| 634 | "BGP specific commands\n" |
| 635 | "AS confederation parameters\n" |
| 636 | "Peer ASs in BGP confederation\n" |
| 637 | AS_STR) |
| 638 | { |
| 639 | struct bgp *bgp; |
| 640 | as_t as; |
| 641 | int i; |
| 642 | |
| 643 | bgp = vty->index; |
| 644 | |
| 645 | for (i = 0; i < argc; i++) |
| 646 | { |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 647 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
| 648 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 649 | bgp_confederation_peers_remove (bgp, as); |
| 650 | } |
| 651 | return CMD_SUCCESS; |
| 652 | } |
| 653 | |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 654 | /* Maximum-paths configuration */ |
| 655 | DEFUN (bgp_maxpaths, |
| 656 | bgp_maxpaths_cmd, |
| 657 | "maximum-paths <1-255>", |
| 658 | "Forward packets over multiple paths\n" |
| 659 | "Number of paths\n") |
| 660 | { |
| 661 | struct bgp *bgp; |
| 662 | u_int16_t maxpaths; |
| 663 | int ret; |
| 664 | |
| 665 | bgp = vty->index; |
| 666 | |
| 667 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255); |
| 668 | |
| 669 | ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 670 | BGP_PEER_EBGP, maxpaths); |
| 671 | if (ret < 0) |
| 672 | { |
| 673 | vty_out (vty, |
| 674 | "%% Failed to set maximum-paths %u for afi %u, safi %u%s", |
| 675 | maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 676 | return CMD_WARNING; |
| 677 | } |
| 678 | |
| 679 | return CMD_SUCCESS; |
| 680 | } |
| 681 | |
| 682 | DEFUN (bgp_maxpaths_ibgp, |
| 683 | bgp_maxpaths_ibgp_cmd, |
| 684 | "maximum-paths ibgp <1-255>", |
| 685 | "Forward packets over multiple paths\n" |
| 686 | "iBGP-multipath\n" |
| 687 | "Number of paths\n") |
| 688 | { |
| 689 | struct bgp *bgp; |
| 690 | u_int16_t maxpaths; |
| 691 | int ret; |
| 692 | |
| 693 | bgp = vty->index; |
| 694 | |
| 695 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255); |
| 696 | |
| 697 | ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 698 | BGP_PEER_IBGP, maxpaths); |
| 699 | if (ret < 0) |
| 700 | { |
| 701 | vty_out (vty, |
| 702 | "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s", |
| 703 | maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 704 | return CMD_WARNING; |
| 705 | } |
| 706 | |
| 707 | return CMD_SUCCESS; |
| 708 | } |
| 709 | |
| 710 | DEFUN (no_bgp_maxpaths, |
| 711 | no_bgp_maxpaths_cmd, |
| 712 | "no maximum-paths", |
| 713 | NO_STR |
| 714 | "Forward packets over multiple paths\n" |
| 715 | "Number of paths\n") |
| 716 | { |
| 717 | struct bgp *bgp; |
| 718 | int ret; |
| 719 | |
| 720 | bgp = vty->index; |
| 721 | |
| 722 | ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 723 | BGP_PEER_EBGP); |
| 724 | if (ret < 0) |
| 725 | { |
| 726 | vty_out (vty, |
| 727 | "%% Failed to unset maximum-paths for afi %u, safi %u%s", |
| 728 | bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 729 | return CMD_WARNING; |
| 730 | } |
| 731 | |
| 732 | return CMD_SUCCESS; |
| 733 | } |
| 734 | |
| 735 | ALIAS (no_bgp_maxpaths, |
| 736 | no_bgp_maxpaths_arg_cmd, |
| 737 | "no maximum-paths <1-255>", |
| 738 | NO_STR |
| 739 | "Forward packets over multiple paths\n" |
| 740 | "Number of paths\n") |
| 741 | |
| 742 | DEFUN (no_bgp_maxpaths_ibgp, |
| 743 | no_bgp_maxpaths_ibgp_cmd, |
| 744 | "no maximum-paths ibgp", |
| 745 | NO_STR |
| 746 | "Forward packets over multiple paths\n" |
| 747 | "iBGP-multipath\n" |
| 748 | "Number of paths\n") |
| 749 | { |
| 750 | struct bgp *bgp; |
| 751 | int ret; |
| 752 | |
| 753 | bgp = vty->index; |
| 754 | |
| 755 | ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 756 | BGP_PEER_IBGP); |
| 757 | if (ret < 0) |
| 758 | { |
| 759 | vty_out (vty, |
| 760 | "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s", |
| 761 | bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 762 | return CMD_WARNING; |
| 763 | } |
| 764 | |
| 765 | return CMD_SUCCESS; |
| 766 | } |
| 767 | |
| 768 | ALIAS (no_bgp_maxpaths_ibgp, |
| 769 | no_bgp_maxpaths_ibgp_arg_cmd, |
| 770 | "no maximum-paths ibgp <1-255>", |
| 771 | NO_STR |
| 772 | "Forward packets over multiple paths\n" |
| 773 | "iBGP-multipath\n" |
| 774 | "Number of paths\n") |
| 775 | |
| 776 | int |
| 777 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 778 | safi_t safi, int *write) |
| 779 | { |
| 780 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS) |
| 781 | { |
| 782 | bgp_config_write_family_header (vty, afi, safi, write); |
| 783 | vty_out (vty, " maximum-paths %d%s", |
| 784 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); |
| 785 | } |
| 786 | |
| 787 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS) |
| 788 | { |
| 789 | bgp_config_write_family_header (vty, afi, safi, write); |
| 790 | vty_out (vty, " maximum-paths ibgp %d%s", |
| 791 | bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE); |
| 792 | } |
| 793 | |
| 794 | return 0; |
| 795 | } |
| 796 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 797 | /* BGP timers. */ |
| 798 | |
| 799 | DEFUN (bgp_timers, |
| 800 | bgp_timers_cmd, |
| 801 | "timers bgp <0-65535> <0-65535>", |
| 802 | "Adjust routing timers\n" |
| 803 | "BGP timers\n" |
| 804 | "Keepalive interval\n" |
| 805 | "Holdtime\n") |
| 806 | { |
| 807 | struct bgp *bgp; |
| 808 | unsigned long keepalive = 0; |
| 809 | unsigned long holdtime = 0; |
| 810 | |
| 811 | bgp = vty->index; |
| 812 | |
| 813 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); |
| 814 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); |
| 815 | |
| 816 | /* Holdtime value check. */ |
| 817 | if (holdtime < 3 && holdtime != 0) |
| 818 | { |
| 819 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", |
| 820 | VTY_NEWLINE); |
| 821 | return CMD_WARNING; |
| 822 | } |
| 823 | |
| 824 | bgp_timers_set (bgp, keepalive, holdtime); |
| 825 | |
| 826 | return CMD_SUCCESS; |
| 827 | } |
| 828 | |
| 829 | DEFUN (no_bgp_timers, |
| 830 | no_bgp_timers_cmd, |
| 831 | "no timers bgp", |
| 832 | NO_STR |
| 833 | "Adjust routing timers\n" |
| 834 | "BGP timers\n") |
| 835 | { |
| 836 | struct bgp *bgp; |
| 837 | |
| 838 | bgp = vty->index; |
| 839 | bgp_timers_unset (bgp); |
| 840 | |
| 841 | return CMD_SUCCESS; |
| 842 | } |
| 843 | |
| 844 | ALIAS (no_bgp_timers, |
| 845 | no_bgp_timers_arg_cmd, |
| 846 | "no timers bgp <0-65535> <0-65535>", |
| 847 | NO_STR |
| 848 | "Adjust routing timers\n" |
| 849 | "BGP timers\n" |
| 850 | "Keepalive interval\n" |
| 851 | "Holdtime\n") |
| 852 | |
| 853 | DEFUN (bgp_client_to_client_reflection, |
| 854 | bgp_client_to_client_reflection_cmd, |
| 855 | "bgp client-to-client reflection", |
| 856 | "BGP specific commands\n" |
| 857 | "Configure client to client route reflection\n" |
| 858 | "reflection of routes allowed\n") |
| 859 | { |
| 860 | struct bgp *bgp; |
| 861 | |
| 862 | bgp = vty->index; |
| 863 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 864 | return CMD_SUCCESS; |
| 865 | } |
| 866 | |
| 867 | DEFUN (no_bgp_client_to_client_reflection, |
| 868 | no_bgp_client_to_client_reflection_cmd, |
| 869 | "no bgp client-to-client reflection", |
| 870 | NO_STR |
| 871 | "BGP specific commands\n" |
| 872 | "Configure client to client route reflection\n" |
| 873 | "reflection of routes allowed\n") |
| 874 | { |
| 875 | struct bgp *bgp; |
| 876 | |
| 877 | bgp = vty->index; |
| 878 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 879 | return CMD_SUCCESS; |
| 880 | } |
| 881 | |
| 882 | /* "bgp always-compare-med" configuration. */ |
| 883 | DEFUN (bgp_always_compare_med, |
| 884 | bgp_always_compare_med_cmd, |
| 885 | "bgp always-compare-med", |
| 886 | "BGP specific commands\n" |
| 887 | "Allow comparing MED from different neighbors\n") |
| 888 | { |
| 889 | struct bgp *bgp; |
| 890 | |
| 891 | bgp = vty->index; |
| 892 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 893 | return CMD_SUCCESS; |
| 894 | } |
| 895 | |
| 896 | DEFUN (no_bgp_always_compare_med, |
| 897 | no_bgp_always_compare_med_cmd, |
| 898 | "no bgp always-compare-med", |
| 899 | NO_STR |
| 900 | "BGP specific commands\n" |
| 901 | "Allow comparing MED from different neighbors\n") |
| 902 | { |
| 903 | struct bgp *bgp; |
| 904 | |
| 905 | bgp = vty->index; |
| 906 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 907 | return CMD_SUCCESS; |
| 908 | } |
| 909 | |
| 910 | /* "bgp deterministic-med" configuration. */ |
| 911 | DEFUN (bgp_deterministic_med, |
| 912 | bgp_deterministic_med_cmd, |
| 913 | "bgp deterministic-med", |
| 914 | "BGP specific commands\n" |
| 915 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 916 | { |
| 917 | struct bgp *bgp; |
| 918 | |
| 919 | bgp = vty->index; |
| 920 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 921 | return CMD_SUCCESS; |
| 922 | } |
| 923 | |
| 924 | DEFUN (no_bgp_deterministic_med, |
| 925 | no_bgp_deterministic_med_cmd, |
| 926 | "no bgp deterministic-med", |
| 927 | NO_STR |
| 928 | "BGP specific commands\n" |
| 929 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 930 | { |
| 931 | struct bgp *bgp; |
| 932 | |
| 933 | bgp = vty->index; |
| 934 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 935 | return CMD_SUCCESS; |
| 936 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 937 | |
| 938 | /* "bgp graceful-restart" configuration. */ |
| 939 | DEFUN (bgp_graceful_restart, |
| 940 | bgp_graceful_restart_cmd, |
| 941 | "bgp graceful-restart", |
| 942 | "BGP specific commands\n" |
| 943 | "Graceful restart capability parameters\n") |
| 944 | { |
| 945 | struct bgp *bgp; |
| 946 | |
| 947 | bgp = vty->index; |
| 948 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 949 | return CMD_SUCCESS; |
| 950 | } |
| 951 | |
| 952 | DEFUN (no_bgp_graceful_restart, |
| 953 | no_bgp_graceful_restart_cmd, |
| 954 | "no bgp graceful-restart", |
| 955 | NO_STR |
| 956 | "BGP specific commands\n" |
| 957 | "Graceful restart capability parameters\n") |
| 958 | { |
| 959 | struct bgp *bgp; |
| 960 | |
| 961 | bgp = vty->index; |
| 962 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 963 | return CMD_SUCCESS; |
| 964 | } |
| 965 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 966 | DEFUN (bgp_graceful_restart_stalepath_time, |
| 967 | bgp_graceful_restart_stalepath_time_cmd, |
| 968 | "bgp graceful-restart stalepath-time <1-3600>", |
| 969 | "BGP specific commands\n" |
| 970 | "Graceful restart capability parameters\n" |
| 971 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 972 | "Delay value (seconds)\n") |
| 973 | { |
| 974 | struct bgp *bgp; |
| 975 | u_int32_t stalepath; |
| 976 | |
| 977 | bgp = vty->index; |
| 978 | if (! bgp) |
| 979 | return CMD_WARNING; |
| 980 | |
| 981 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); |
| 982 | bgp->stalepath_time = stalepath; |
| 983 | return CMD_SUCCESS; |
| 984 | } |
| 985 | |
| 986 | DEFUN (no_bgp_graceful_restart_stalepath_time, |
| 987 | no_bgp_graceful_restart_stalepath_time_cmd, |
| 988 | "no bgp graceful-restart stalepath-time", |
| 989 | NO_STR |
| 990 | "BGP specific commands\n" |
| 991 | "Graceful restart capability parameters\n" |
| 992 | "Set the max time to hold onto restarting peer's stale paths\n") |
| 993 | { |
| 994 | struct bgp *bgp; |
| 995 | |
| 996 | bgp = vty->index; |
| 997 | if (! bgp) |
| 998 | return CMD_WARNING; |
| 999 | |
| 1000 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; |
| 1001 | return CMD_SUCCESS; |
| 1002 | } |
| 1003 | |
| 1004 | ALIAS (no_bgp_graceful_restart_stalepath_time, |
| 1005 | no_bgp_graceful_restart_stalepath_time_val_cmd, |
| 1006 | "no bgp graceful-restart stalepath-time <1-3600>", |
| 1007 | NO_STR |
| 1008 | "BGP specific commands\n" |
| 1009 | "Graceful restart capability parameters\n" |
| 1010 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 1011 | "Delay value (seconds)\n") |
| 1012 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1013 | /* "bgp fast-external-failover" configuration. */ |
| 1014 | DEFUN (bgp_fast_external_failover, |
| 1015 | bgp_fast_external_failover_cmd, |
| 1016 | "bgp fast-external-failover", |
| 1017 | BGP_STR |
| 1018 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 1019 | { |
| 1020 | struct bgp *bgp; |
| 1021 | |
| 1022 | bgp = vty->index; |
| 1023 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 1024 | return CMD_SUCCESS; |
| 1025 | } |
| 1026 | |
| 1027 | DEFUN (no_bgp_fast_external_failover, |
| 1028 | no_bgp_fast_external_failover_cmd, |
| 1029 | "no bgp fast-external-failover", |
| 1030 | NO_STR |
| 1031 | BGP_STR |
| 1032 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 1033 | { |
| 1034 | struct bgp *bgp; |
| 1035 | |
| 1036 | bgp = vty->index; |
| 1037 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 1038 | return CMD_SUCCESS; |
| 1039 | } |
| 1040 | |
| 1041 | /* "bgp enforce-first-as" configuration. */ |
| 1042 | DEFUN (bgp_enforce_first_as, |
| 1043 | bgp_enforce_first_as_cmd, |
| 1044 | "bgp enforce-first-as", |
| 1045 | BGP_STR |
| 1046 | "Enforce the first AS for EBGP routes\n") |
| 1047 | { |
| 1048 | struct bgp *bgp; |
| 1049 | |
| 1050 | bgp = vty->index; |
| 1051 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 1052 | return CMD_SUCCESS; |
| 1053 | } |
| 1054 | |
| 1055 | DEFUN (no_bgp_enforce_first_as, |
| 1056 | no_bgp_enforce_first_as_cmd, |
| 1057 | "no bgp enforce-first-as", |
| 1058 | NO_STR |
| 1059 | BGP_STR |
| 1060 | "Enforce the first AS for EBGP routes\n") |
| 1061 | { |
| 1062 | struct bgp *bgp; |
| 1063 | |
| 1064 | bgp = vty->index; |
| 1065 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 1066 | return CMD_SUCCESS; |
| 1067 | } |
| 1068 | |
| 1069 | /* "bgp bestpath compare-routerid" configuration. */ |
| 1070 | DEFUN (bgp_bestpath_compare_router_id, |
| 1071 | bgp_bestpath_compare_router_id_cmd, |
| 1072 | "bgp bestpath compare-routerid", |
| 1073 | "BGP specific commands\n" |
| 1074 | "Change the default bestpath selection\n" |
| 1075 | "Compare router-id for identical EBGP paths\n") |
| 1076 | { |
| 1077 | struct bgp *bgp; |
| 1078 | |
| 1079 | bgp = vty->index; |
| 1080 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 1081 | return CMD_SUCCESS; |
| 1082 | } |
| 1083 | |
| 1084 | DEFUN (no_bgp_bestpath_compare_router_id, |
| 1085 | no_bgp_bestpath_compare_router_id_cmd, |
| 1086 | "no bgp bestpath compare-routerid", |
| 1087 | NO_STR |
| 1088 | "BGP specific commands\n" |
| 1089 | "Change the default bestpath selection\n" |
| 1090 | "Compare router-id for identical EBGP paths\n") |
| 1091 | { |
| 1092 | struct bgp *bgp; |
| 1093 | |
| 1094 | bgp = vty->index; |
| 1095 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 1096 | return CMD_SUCCESS; |
| 1097 | } |
| 1098 | |
| 1099 | /* "bgp bestpath as-path ignore" configuration. */ |
| 1100 | DEFUN (bgp_bestpath_aspath_ignore, |
| 1101 | bgp_bestpath_aspath_ignore_cmd, |
| 1102 | "bgp bestpath as-path ignore", |
| 1103 | "BGP specific commands\n" |
| 1104 | "Change the default bestpath selection\n" |
| 1105 | "AS-path attribute\n" |
| 1106 | "Ignore as-path length in selecting a route\n") |
| 1107 | { |
| 1108 | struct bgp *bgp; |
| 1109 | |
| 1110 | bgp = vty->index; |
| 1111 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 1112 | return CMD_SUCCESS; |
| 1113 | } |
| 1114 | |
| 1115 | DEFUN (no_bgp_bestpath_aspath_ignore, |
| 1116 | no_bgp_bestpath_aspath_ignore_cmd, |
| 1117 | "no bgp bestpath as-path ignore", |
| 1118 | NO_STR |
| 1119 | "BGP specific commands\n" |
| 1120 | "Change the default bestpath selection\n" |
| 1121 | "AS-path attribute\n" |
| 1122 | "Ignore as-path length in selecting a route\n") |
| 1123 | { |
| 1124 | struct bgp *bgp; |
| 1125 | |
| 1126 | bgp = vty->index; |
| 1127 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 1128 | return CMD_SUCCESS; |
| 1129 | } |
| 1130 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 1131 | /* "bgp bestpath as-path confed" configuration. */ |
| 1132 | DEFUN (bgp_bestpath_aspath_confed, |
| 1133 | bgp_bestpath_aspath_confed_cmd, |
| 1134 | "bgp bestpath as-path confed", |
| 1135 | "BGP specific commands\n" |
| 1136 | "Change the default bestpath selection\n" |
| 1137 | "AS-path attribute\n" |
| 1138 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 1139 | { |
| 1140 | struct bgp *bgp; |
| 1141 | |
| 1142 | bgp = vty->index; |
| 1143 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); |
| 1144 | return CMD_SUCCESS; |
| 1145 | } |
| 1146 | |
| 1147 | DEFUN (no_bgp_bestpath_aspath_confed, |
| 1148 | no_bgp_bestpath_aspath_confed_cmd, |
| 1149 | "no bgp bestpath as-path confed", |
| 1150 | NO_STR |
| 1151 | "BGP specific commands\n" |
| 1152 | "Change the default bestpath selection\n" |
| 1153 | "AS-path attribute\n" |
| 1154 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 1155 | { |
| 1156 | struct bgp *bgp; |
| 1157 | |
| 1158 | bgp = vty->index; |
| 1159 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); |
| 1160 | return CMD_SUCCESS; |
| 1161 | } |
| 1162 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 1163 | /* "bgp log-neighbor-changes" configuration. */ |
| 1164 | DEFUN (bgp_log_neighbor_changes, |
| 1165 | bgp_log_neighbor_changes_cmd, |
| 1166 | "bgp log-neighbor-changes", |
| 1167 | "BGP specific commands\n" |
| 1168 | "Log neighbor up/down and reset reason\n") |
| 1169 | { |
| 1170 | struct bgp *bgp; |
| 1171 | |
| 1172 | bgp = vty->index; |
| 1173 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1174 | return CMD_SUCCESS; |
| 1175 | } |
| 1176 | |
| 1177 | DEFUN (no_bgp_log_neighbor_changes, |
| 1178 | no_bgp_log_neighbor_changes_cmd, |
| 1179 | "no bgp log-neighbor-changes", |
| 1180 | NO_STR |
| 1181 | "BGP specific commands\n" |
| 1182 | "Log neighbor up/down and reset reason\n") |
| 1183 | { |
| 1184 | struct bgp *bgp; |
| 1185 | |
| 1186 | bgp = vty->index; |
| 1187 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1188 | return CMD_SUCCESS; |
| 1189 | } |
| 1190 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1191 | /* "bgp bestpath med" configuration. */ |
| 1192 | DEFUN (bgp_bestpath_med, |
| 1193 | bgp_bestpath_med_cmd, |
| 1194 | "bgp bestpath med (confed|missing-as-worst)", |
| 1195 | "BGP specific commands\n" |
| 1196 | "Change the default bestpath selection\n" |
| 1197 | "MED attribute\n" |
| 1198 | "Compare MED among confederation paths\n" |
| 1199 | "Treat missing MED as the least preferred one\n") |
| 1200 | { |
| 1201 | struct bgp *bgp; |
| 1202 | |
| 1203 | bgp = vty->index; |
| 1204 | |
| 1205 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1206 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1207 | else |
| 1208 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1209 | |
| 1210 | return CMD_SUCCESS; |
| 1211 | } |
| 1212 | |
| 1213 | DEFUN (bgp_bestpath_med2, |
| 1214 | bgp_bestpath_med2_cmd, |
| 1215 | "bgp bestpath med confed missing-as-worst", |
| 1216 | "BGP specific commands\n" |
| 1217 | "Change the default bestpath selection\n" |
| 1218 | "MED attribute\n" |
| 1219 | "Compare MED among confederation paths\n" |
| 1220 | "Treat missing MED as the least preferred one\n") |
| 1221 | { |
| 1222 | struct bgp *bgp; |
| 1223 | |
| 1224 | bgp = vty->index; |
| 1225 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1226 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1227 | return CMD_SUCCESS; |
| 1228 | } |
| 1229 | |
| 1230 | ALIAS (bgp_bestpath_med2, |
| 1231 | bgp_bestpath_med3_cmd, |
| 1232 | "bgp bestpath med missing-as-worst confed", |
| 1233 | "BGP specific commands\n" |
| 1234 | "Change the default bestpath selection\n" |
| 1235 | "MED attribute\n" |
| 1236 | "Treat missing MED as the least preferred one\n" |
| 1237 | "Compare MED among confederation paths\n") |
| 1238 | |
| 1239 | DEFUN (no_bgp_bestpath_med, |
| 1240 | no_bgp_bestpath_med_cmd, |
| 1241 | "no bgp bestpath med (confed|missing-as-worst)", |
| 1242 | NO_STR |
| 1243 | "BGP specific commands\n" |
| 1244 | "Change the default bestpath selection\n" |
| 1245 | "MED attribute\n" |
| 1246 | "Compare MED among confederation paths\n" |
| 1247 | "Treat missing MED as the least preferred one\n") |
| 1248 | { |
| 1249 | struct bgp *bgp; |
| 1250 | |
| 1251 | bgp = vty->index; |
| 1252 | |
| 1253 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1254 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1255 | else |
| 1256 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1257 | |
| 1258 | return CMD_SUCCESS; |
| 1259 | } |
| 1260 | |
| 1261 | DEFUN (no_bgp_bestpath_med2, |
| 1262 | no_bgp_bestpath_med2_cmd, |
| 1263 | "no bgp bestpath med confed missing-as-worst", |
| 1264 | NO_STR |
| 1265 | "BGP specific commands\n" |
| 1266 | "Change the default bestpath selection\n" |
| 1267 | "MED attribute\n" |
| 1268 | "Compare MED among confederation paths\n" |
| 1269 | "Treat missing MED as the least preferred one\n") |
| 1270 | { |
| 1271 | struct bgp *bgp; |
| 1272 | |
| 1273 | bgp = vty->index; |
| 1274 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1275 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1276 | return CMD_SUCCESS; |
| 1277 | } |
| 1278 | |
| 1279 | ALIAS (no_bgp_bestpath_med2, |
| 1280 | no_bgp_bestpath_med3_cmd, |
| 1281 | "no bgp bestpath med missing-as-worst confed", |
| 1282 | NO_STR |
| 1283 | "BGP specific commands\n" |
| 1284 | "Change the default bestpath selection\n" |
| 1285 | "MED attribute\n" |
| 1286 | "Treat missing MED as the least preferred one\n" |
| 1287 | "Compare MED among confederation paths\n") |
| 1288 | |
| 1289 | /* "no bgp default ipv4-unicast". */ |
| 1290 | DEFUN (no_bgp_default_ipv4_unicast, |
| 1291 | no_bgp_default_ipv4_unicast_cmd, |
| 1292 | "no bgp default ipv4-unicast", |
| 1293 | NO_STR |
| 1294 | "BGP specific commands\n" |
| 1295 | "Configure BGP defaults\n" |
| 1296 | "Activate ipv4-unicast for a peer by default\n") |
| 1297 | { |
| 1298 | struct bgp *bgp; |
| 1299 | |
| 1300 | bgp = vty->index; |
| 1301 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1302 | return CMD_SUCCESS; |
| 1303 | } |
| 1304 | |
| 1305 | DEFUN (bgp_default_ipv4_unicast, |
| 1306 | bgp_default_ipv4_unicast_cmd, |
| 1307 | "bgp default ipv4-unicast", |
| 1308 | "BGP specific commands\n" |
| 1309 | "Configure BGP defaults\n" |
| 1310 | "Activate ipv4-unicast for a peer by default\n") |
| 1311 | { |
| 1312 | struct bgp *bgp; |
| 1313 | |
| 1314 | bgp = vty->index; |
| 1315 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1316 | return CMD_SUCCESS; |
| 1317 | } |
| 1318 | |
| 1319 | /* "bgp import-check" configuration. */ |
| 1320 | DEFUN (bgp_network_import_check, |
| 1321 | bgp_network_import_check_cmd, |
| 1322 | "bgp network import-check", |
| 1323 | "BGP specific commands\n" |
| 1324 | "BGP network command\n" |
| 1325 | "Check BGP network route exists in IGP\n") |
| 1326 | { |
| 1327 | struct bgp *bgp; |
| 1328 | |
| 1329 | bgp = vty->index; |
| 1330 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1331 | return CMD_SUCCESS; |
| 1332 | } |
| 1333 | |
| 1334 | DEFUN (no_bgp_network_import_check, |
| 1335 | no_bgp_network_import_check_cmd, |
| 1336 | "no bgp network import-check", |
| 1337 | NO_STR |
| 1338 | "BGP specific commands\n" |
| 1339 | "BGP network command\n" |
| 1340 | "Check BGP network route exists in IGP\n") |
| 1341 | { |
| 1342 | struct bgp *bgp; |
| 1343 | |
| 1344 | bgp = vty->index; |
| 1345 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1346 | return CMD_SUCCESS; |
| 1347 | } |
| 1348 | |
| 1349 | DEFUN (bgp_default_local_preference, |
| 1350 | bgp_default_local_preference_cmd, |
| 1351 | "bgp default local-preference <0-4294967295>", |
| 1352 | "BGP specific commands\n" |
| 1353 | "Configure BGP defaults\n" |
| 1354 | "local preference (higher=more preferred)\n" |
| 1355 | "Configure default local preference value\n") |
| 1356 | { |
| 1357 | struct bgp *bgp; |
| 1358 | u_int32_t local_pref; |
| 1359 | |
| 1360 | bgp = vty->index; |
| 1361 | |
| 1362 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); |
| 1363 | |
| 1364 | bgp_default_local_preference_set (bgp, local_pref); |
| 1365 | |
| 1366 | return CMD_SUCCESS; |
| 1367 | } |
| 1368 | |
| 1369 | DEFUN (no_bgp_default_local_preference, |
| 1370 | no_bgp_default_local_preference_cmd, |
| 1371 | "no bgp default local-preference", |
| 1372 | NO_STR |
| 1373 | "BGP specific commands\n" |
| 1374 | "Configure BGP defaults\n" |
| 1375 | "local preference (higher=more preferred)\n") |
| 1376 | { |
| 1377 | struct bgp *bgp; |
| 1378 | |
| 1379 | bgp = vty->index; |
| 1380 | bgp_default_local_preference_unset (bgp); |
| 1381 | return CMD_SUCCESS; |
| 1382 | } |
| 1383 | |
| 1384 | ALIAS (no_bgp_default_local_preference, |
| 1385 | no_bgp_default_local_preference_val_cmd, |
| 1386 | "no bgp default local-preference <0-4294967295>", |
| 1387 | NO_STR |
| 1388 | "BGP specific commands\n" |
| 1389 | "Configure BGP defaults\n" |
| 1390 | "local preference (higher=more preferred)\n" |
| 1391 | "Configure default local preference value\n") |
| 1392 | |
| 1393 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1394 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
| 1395 | const char *as_str, afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1396 | { |
| 1397 | int ret; |
| 1398 | struct bgp *bgp; |
| 1399 | as_t as; |
| 1400 | union sockunion su; |
| 1401 | |
| 1402 | bgp = vty->index; |
| 1403 | |
| 1404 | /* Get AS number. */ |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 1405 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1406 | |
| 1407 | /* If peer is peer group, call proper function. */ |
| 1408 | ret = str2sockunion (peer_str, &su); |
| 1409 | if (ret < 0) |
| 1410 | { |
| 1411 | ret = peer_group_remote_as (bgp, peer_str, &as); |
| 1412 | if (ret < 0) |
| 1413 | { |
| 1414 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1415 | return CMD_WARNING; |
| 1416 | } |
| 1417 | return CMD_SUCCESS; |
| 1418 | } |
| 1419 | |
| 1420 | if (peer_address_self_check (&su)) |
| 1421 | { |
| 1422 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1423 | VTY_NEWLINE); |
| 1424 | return CMD_WARNING; |
| 1425 | } |
| 1426 | |
| 1427 | ret = peer_remote_as (bgp, &su, &as, afi, safi); |
| 1428 | |
| 1429 | /* This peer belongs to peer group. */ |
| 1430 | switch (ret) |
| 1431 | { |
| 1432 | case BGP_ERR_PEER_GROUP_MEMBER: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1433 | vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1434 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1435 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1436 | vty_out (vty, "%% The AS# can not be changed from %u to %s, peer-group members must be all internal or all external%s", as, as_str, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1437 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1438 | } |
| 1439 | return bgp_vty_return (vty, ret); |
| 1440 | } |
| 1441 | |
| 1442 | DEFUN (neighbor_remote_as, |
| 1443 | neighbor_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1444 | NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1445 | NEIGHBOR_STR |
| 1446 | NEIGHBOR_ADDR_STR2 |
| 1447 | "Specify a BGP neighbor\n" |
| 1448 | AS_STR) |
| 1449 | { |
| 1450 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); |
| 1451 | } |
| 1452 | |
| 1453 | DEFUN (neighbor_peer_group, |
| 1454 | neighbor_peer_group_cmd, |
| 1455 | "neighbor WORD peer-group", |
| 1456 | NEIGHBOR_STR |
| 1457 | "Neighbor tag\n" |
| 1458 | "Configure peer-group\n") |
| 1459 | { |
| 1460 | struct bgp *bgp; |
| 1461 | struct peer_group *group; |
| 1462 | |
| 1463 | bgp = vty->index; |
| 1464 | |
| 1465 | group = peer_group_get (bgp, argv[0]); |
| 1466 | if (! group) |
| 1467 | return CMD_WARNING; |
| 1468 | |
| 1469 | return CMD_SUCCESS; |
| 1470 | } |
| 1471 | |
| 1472 | DEFUN (no_neighbor, |
| 1473 | no_neighbor_cmd, |
| 1474 | NO_NEIGHBOR_CMD2, |
| 1475 | NO_STR |
| 1476 | NEIGHBOR_STR |
| 1477 | NEIGHBOR_ADDR_STR2) |
| 1478 | { |
| 1479 | int ret; |
| 1480 | union sockunion su; |
| 1481 | struct peer_group *group; |
| 1482 | struct peer *peer; |
| 1483 | |
| 1484 | ret = str2sockunion (argv[0], &su); |
| 1485 | if (ret < 0) |
| 1486 | { |
| 1487 | group = peer_group_lookup (vty->index, argv[0]); |
| 1488 | if (group) |
| 1489 | peer_group_delete (group); |
| 1490 | else |
| 1491 | { |
| 1492 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1493 | return CMD_WARNING; |
| 1494 | } |
| 1495 | } |
| 1496 | else |
| 1497 | { |
| 1498 | peer = peer_lookup (vty->index, &su); |
| 1499 | if (peer) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 1500 | peer_delete (peer); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1501 | } |
| 1502 | |
| 1503 | return CMD_SUCCESS; |
| 1504 | } |
| 1505 | |
| 1506 | ALIAS (no_neighbor, |
| 1507 | no_neighbor_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1508 | NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1509 | NO_STR |
| 1510 | NEIGHBOR_STR |
| 1511 | NEIGHBOR_ADDR_STR |
| 1512 | "Specify a BGP neighbor\n" |
| 1513 | AS_STR) |
| 1514 | |
| 1515 | DEFUN (no_neighbor_peer_group, |
| 1516 | no_neighbor_peer_group_cmd, |
| 1517 | "no neighbor WORD peer-group", |
| 1518 | NO_STR |
| 1519 | NEIGHBOR_STR |
| 1520 | "Neighbor tag\n" |
| 1521 | "Configure peer-group\n") |
| 1522 | { |
| 1523 | struct peer_group *group; |
| 1524 | |
| 1525 | group = peer_group_lookup (vty->index, argv[0]); |
| 1526 | if (group) |
| 1527 | peer_group_delete (group); |
| 1528 | else |
| 1529 | { |
| 1530 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1531 | return CMD_WARNING; |
| 1532 | } |
| 1533 | return CMD_SUCCESS; |
| 1534 | } |
| 1535 | |
| 1536 | DEFUN (no_neighbor_peer_group_remote_as, |
| 1537 | no_neighbor_peer_group_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1538 | "no neighbor WORD remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1539 | NO_STR |
| 1540 | NEIGHBOR_STR |
| 1541 | "Neighbor tag\n" |
| 1542 | "Specify a BGP neighbor\n" |
| 1543 | AS_STR) |
| 1544 | { |
| 1545 | struct peer_group *group; |
| 1546 | |
| 1547 | group = peer_group_lookup (vty->index, argv[0]); |
| 1548 | if (group) |
| 1549 | peer_group_remote_as_delete (group); |
| 1550 | else |
| 1551 | { |
| 1552 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1553 | return CMD_WARNING; |
| 1554 | } |
| 1555 | return CMD_SUCCESS; |
| 1556 | } |
| 1557 | |
| 1558 | DEFUN (neighbor_local_as, |
| 1559 | neighbor_local_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1560 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1561 | NEIGHBOR_STR |
| 1562 | NEIGHBOR_ADDR_STR2 |
| 1563 | "Specify a local-as number\n" |
| 1564 | "AS number used as local AS\n") |
| 1565 | { |
| 1566 | struct peer *peer; |
| 1567 | int ret; |
| 1568 | |
| 1569 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1570 | if (! peer) |
| 1571 | return CMD_WARNING; |
| 1572 | |
| 1573 | ret = peer_local_as_set (peer, atoi (argv[1]), 0); |
| 1574 | return bgp_vty_return (vty, ret); |
| 1575 | } |
| 1576 | |
| 1577 | DEFUN (neighbor_local_as_no_prepend, |
| 1578 | neighbor_local_as_no_prepend_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1579 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1580 | NEIGHBOR_STR |
| 1581 | NEIGHBOR_ADDR_STR2 |
| 1582 | "Specify a local-as number\n" |
| 1583 | "AS number used as local AS\n" |
| 1584 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1585 | { |
| 1586 | struct peer *peer; |
| 1587 | int ret; |
| 1588 | |
| 1589 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1590 | if (! peer) |
| 1591 | return CMD_WARNING; |
| 1592 | |
| 1593 | ret = peer_local_as_set (peer, atoi (argv[1]), 1); |
| 1594 | return bgp_vty_return (vty, ret); |
| 1595 | } |
| 1596 | |
| 1597 | DEFUN (no_neighbor_local_as, |
| 1598 | no_neighbor_local_as_cmd, |
| 1599 | NO_NEIGHBOR_CMD2 "local-as", |
| 1600 | NO_STR |
| 1601 | NEIGHBOR_STR |
| 1602 | NEIGHBOR_ADDR_STR2 |
| 1603 | "Specify a local-as number\n") |
| 1604 | { |
| 1605 | struct peer *peer; |
| 1606 | int ret; |
| 1607 | |
| 1608 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1609 | if (! peer) |
| 1610 | return CMD_WARNING; |
| 1611 | |
| 1612 | ret = peer_local_as_unset (peer); |
| 1613 | return bgp_vty_return (vty, ret); |
| 1614 | } |
| 1615 | |
| 1616 | ALIAS (no_neighbor_local_as, |
| 1617 | no_neighbor_local_as_val_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1618 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1619 | NO_STR |
| 1620 | NEIGHBOR_STR |
| 1621 | NEIGHBOR_ADDR_STR2 |
| 1622 | "Specify a local-as number\n" |
| 1623 | "AS number used as local AS\n") |
| 1624 | |
| 1625 | ALIAS (no_neighbor_local_as, |
| 1626 | no_neighbor_local_as_val2_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1627 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1628 | NO_STR |
| 1629 | NEIGHBOR_STR |
| 1630 | NEIGHBOR_ADDR_STR2 |
| 1631 | "Specify a local-as number\n" |
| 1632 | "AS number used as local AS\n" |
| 1633 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1634 | |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 1635 | DEFUN (neighbor_password, |
| 1636 | neighbor_password_cmd, |
| 1637 | NEIGHBOR_CMD2 "password LINE", |
| 1638 | NEIGHBOR_STR |
| 1639 | NEIGHBOR_ADDR_STR2 |
| 1640 | "Set a password\n" |
| 1641 | "The password\n") |
| 1642 | { |
| 1643 | struct peer *peer; |
| 1644 | int ret; |
| 1645 | |
| 1646 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1647 | if (! peer) |
| 1648 | return CMD_WARNING; |
| 1649 | |
| 1650 | ret = peer_password_set (peer, argv[1]); |
| 1651 | return bgp_vty_return (vty, ret); |
| 1652 | } |
| 1653 | |
| 1654 | DEFUN (no_neighbor_password, |
| 1655 | no_neighbor_password_cmd, |
| 1656 | NO_NEIGHBOR_CMD2 "password", |
| 1657 | NO_STR |
| 1658 | NEIGHBOR_STR |
| 1659 | NEIGHBOR_ADDR_STR2 |
| 1660 | "Set a password\n") |
| 1661 | { |
| 1662 | struct peer *peer; |
| 1663 | int ret; |
| 1664 | |
| 1665 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1666 | if (! peer) |
| 1667 | return CMD_WARNING; |
| 1668 | |
| 1669 | ret = peer_password_unset (peer); |
| 1670 | return bgp_vty_return (vty, ret); |
| 1671 | } |
| 1672 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1673 | DEFUN (neighbor_activate, |
| 1674 | neighbor_activate_cmd, |
| 1675 | NEIGHBOR_CMD2 "activate", |
| 1676 | NEIGHBOR_STR |
| 1677 | NEIGHBOR_ADDR_STR2 |
| 1678 | "Enable the Address Family for this Neighbor\n") |
| 1679 | { |
| 1680 | struct peer *peer; |
| 1681 | |
| 1682 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1683 | if (! peer) |
| 1684 | return CMD_WARNING; |
| 1685 | |
| 1686 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1687 | |
| 1688 | return CMD_SUCCESS; |
| 1689 | } |
| 1690 | |
| 1691 | DEFUN (no_neighbor_activate, |
| 1692 | no_neighbor_activate_cmd, |
| 1693 | NO_NEIGHBOR_CMD2 "activate", |
| 1694 | NO_STR |
| 1695 | NEIGHBOR_STR |
| 1696 | NEIGHBOR_ADDR_STR2 |
| 1697 | "Enable the Address Family for this Neighbor\n") |
| 1698 | { |
| 1699 | int ret; |
| 1700 | struct peer *peer; |
| 1701 | |
| 1702 | /* Lookup peer. */ |
| 1703 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1704 | if (! peer) |
| 1705 | return CMD_WARNING; |
| 1706 | |
| 1707 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1708 | |
| 1709 | return bgp_vty_return (vty, ret); |
| 1710 | } |
| 1711 | |
| 1712 | DEFUN (neighbor_set_peer_group, |
| 1713 | neighbor_set_peer_group_cmd, |
| 1714 | NEIGHBOR_CMD "peer-group WORD", |
| 1715 | NEIGHBOR_STR |
| 1716 | NEIGHBOR_ADDR_STR |
| 1717 | "Member of the peer-group\n" |
| 1718 | "peer-group name\n") |
| 1719 | { |
| 1720 | int ret; |
| 1721 | as_t as; |
| 1722 | union sockunion su; |
| 1723 | struct bgp *bgp; |
| 1724 | struct peer_group *group; |
| 1725 | |
| 1726 | bgp = vty->index; |
| 1727 | |
| 1728 | ret = str2sockunion (argv[0], &su); |
| 1729 | if (ret < 0) |
| 1730 | { |
| 1731 | vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); |
| 1732 | return CMD_WARNING; |
| 1733 | } |
| 1734 | |
| 1735 | group = peer_group_lookup (bgp, argv[1]); |
| 1736 | if (! group) |
| 1737 | { |
| 1738 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1739 | return CMD_WARNING; |
| 1740 | } |
| 1741 | |
| 1742 | if (peer_address_self_check (&su)) |
| 1743 | { |
| 1744 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1745 | VTY_NEWLINE); |
| 1746 | return CMD_WARNING; |
| 1747 | } |
| 1748 | |
| 1749 | ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty), |
| 1750 | bgp_node_safi (vty), &as); |
| 1751 | |
| 1752 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) |
| 1753 | { |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1754 | vty_out (vty, "%% Peer with AS %u cannot be in this peer-group, members must be all internal or all external%s", as, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1755 | return CMD_WARNING; |
| 1756 | } |
| 1757 | |
| 1758 | return bgp_vty_return (vty, ret); |
| 1759 | } |
| 1760 | |
| 1761 | DEFUN (no_neighbor_set_peer_group, |
| 1762 | no_neighbor_set_peer_group_cmd, |
| 1763 | NO_NEIGHBOR_CMD "peer-group WORD", |
| 1764 | NO_STR |
| 1765 | NEIGHBOR_STR |
| 1766 | NEIGHBOR_ADDR_STR |
| 1767 | "Member of the peer-group\n" |
| 1768 | "peer-group name\n") |
| 1769 | { |
| 1770 | int ret; |
| 1771 | struct bgp *bgp; |
| 1772 | struct peer *peer; |
| 1773 | struct peer_group *group; |
| 1774 | |
| 1775 | bgp = vty->index; |
| 1776 | |
| 1777 | peer = peer_lookup_vty (vty, argv[0]); |
| 1778 | if (! peer) |
| 1779 | return CMD_WARNING; |
| 1780 | |
| 1781 | group = peer_group_lookup (bgp, argv[1]); |
| 1782 | if (! group) |
| 1783 | { |
| 1784 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1785 | return CMD_WARNING; |
| 1786 | } |
| 1787 | |
| 1788 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), |
| 1789 | bgp_node_safi (vty)); |
| 1790 | |
| 1791 | return bgp_vty_return (vty, ret); |
| 1792 | } |
| 1793 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1794 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1795 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
| 1796 | u_int16_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1797 | { |
| 1798 | int ret; |
| 1799 | struct peer *peer; |
| 1800 | |
| 1801 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 1802 | if (! peer) |
| 1803 | return CMD_WARNING; |
| 1804 | |
| 1805 | if (set) |
| 1806 | ret = peer_flag_set (peer, flag); |
| 1807 | else |
| 1808 | ret = peer_flag_unset (peer, flag); |
| 1809 | |
| 1810 | return bgp_vty_return (vty, ret); |
| 1811 | } |
| 1812 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1813 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1814 | 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] | 1815 | { |
| 1816 | return peer_flag_modify_vty (vty, ip_str, flag, 1); |
| 1817 | } |
| 1818 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1819 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1820 | 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] | 1821 | { |
| 1822 | return peer_flag_modify_vty (vty, ip_str, flag, 0); |
| 1823 | } |
| 1824 | |
| 1825 | /* neighbor passive. */ |
| 1826 | DEFUN (neighbor_passive, |
| 1827 | neighbor_passive_cmd, |
| 1828 | NEIGHBOR_CMD2 "passive", |
| 1829 | NEIGHBOR_STR |
| 1830 | NEIGHBOR_ADDR_STR2 |
| 1831 | "Don't send open messages to this neighbor\n") |
| 1832 | { |
| 1833 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1834 | } |
| 1835 | |
| 1836 | DEFUN (no_neighbor_passive, |
| 1837 | no_neighbor_passive_cmd, |
| 1838 | NO_NEIGHBOR_CMD2 "passive", |
| 1839 | NO_STR |
| 1840 | NEIGHBOR_STR |
| 1841 | NEIGHBOR_ADDR_STR2 |
| 1842 | "Don't send open messages to this neighbor\n") |
| 1843 | { |
| 1844 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1845 | } |
| 1846 | |
| 1847 | /* neighbor shutdown. */ |
| 1848 | DEFUN (neighbor_shutdown, |
| 1849 | neighbor_shutdown_cmd, |
| 1850 | NEIGHBOR_CMD2 "shutdown", |
| 1851 | NEIGHBOR_STR |
| 1852 | NEIGHBOR_ADDR_STR2 |
| 1853 | "Administratively shut down this neighbor\n") |
| 1854 | { |
| 1855 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1856 | } |
| 1857 | |
| 1858 | DEFUN (no_neighbor_shutdown, |
| 1859 | no_neighbor_shutdown_cmd, |
| 1860 | NO_NEIGHBOR_CMD2 "shutdown", |
| 1861 | NO_STR |
| 1862 | NEIGHBOR_STR |
| 1863 | NEIGHBOR_ADDR_STR2 |
| 1864 | "Administratively shut down this neighbor\n") |
| 1865 | { |
| 1866 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1867 | } |
| 1868 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1869 | /* Deprecated neighbor capability route-refresh. */ |
| 1870 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, |
| 1871 | neighbor_capability_route_refresh_cmd, |
| 1872 | NEIGHBOR_CMD2 "capability route-refresh", |
| 1873 | NEIGHBOR_STR |
| 1874 | NEIGHBOR_ADDR_STR2 |
| 1875 | "Advertise capability to the peer\n" |
| 1876 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1877 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1878 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1879 | } |
| 1880 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1881 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
| 1882 | no_neighbor_capability_route_refresh_cmd, |
| 1883 | NO_NEIGHBOR_CMD2 "capability route-refresh", |
| 1884 | NO_STR |
| 1885 | NEIGHBOR_STR |
| 1886 | NEIGHBOR_ADDR_STR2 |
| 1887 | "Advertise capability to the peer\n" |
| 1888 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1889 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1890 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1891 | } |
| 1892 | |
| 1893 | /* neighbor capability dynamic. */ |
| 1894 | DEFUN (neighbor_capability_dynamic, |
| 1895 | neighbor_capability_dynamic_cmd, |
| 1896 | NEIGHBOR_CMD2 "capability dynamic", |
| 1897 | NEIGHBOR_STR |
| 1898 | NEIGHBOR_ADDR_STR2 |
| 1899 | "Advertise capability to the peer\n" |
| 1900 | "Advertise dynamic capability to this neighbor\n") |
| 1901 | { |
| 1902 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1903 | } |
| 1904 | |
| 1905 | DEFUN (no_neighbor_capability_dynamic, |
| 1906 | no_neighbor_capability_dynamic_cmd, |
| 1907 | NO_NEIGHBOR_CMD2 "capability dynamic", |
| 1908 | NO_STR |
| 1909 | NEIGHBOR_STR |
| 1910 | NEIGHBOR_ADDR_STR2 |
| 1911 | "Advertise capability to the peer\n" |
| 1912 | "Advertise dynamic capability to this neighbor\n") |
| 1913 | { |
| 1914 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1915 | } |
| 1916 | |
| 1917 | /* neighbor dont-capability-negotiate */ |
| 1918 | DEFUN (neighbor_dont_capability_negotiate, |
| 1919 | neighbor_dont_capability_negotiate_cmd, |
| 1920 | NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1921 | NEIGHBOR_STR |
| 1922 | NEIGHBOR_ADDR_STR2 |
| 1923 | "Do not perform capability negotiation\n") |
| 1924 | { |
| 1925 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1926 | } |
| 1927 | |
| 1928 | DEFUN (no_neighbor_dont_capability_negotiate, |
| 1929 | no_neighbor_dont_capability_negotiate_cmd, |
| 1930 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1931 | NO_STR |
| 1932 | NEIGHBOR_STR |
| 1933 | NEIGHBOR_ADDR_STR2 |
| 1934 | "Do not perform capability negotiation\n") |
| 1935 | { |
| 1936 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1937 | } |
| 1938 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1939 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1940 | 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] | 1941 | safi_t safi, u_int32_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1942 | { |
| 1943 | int ret; |
| 1944 | struct peer *peer; |
| 1945 | |
| 1946 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 1947 | if (! peer) |
| 1948 | return CMD_WARNING; |
| 1949 | |
| 1950 | if (set) |
| 1951 | ret = peer_af_flag_set (peer, afi, safi, flag); |
| 1952 | else |
| 1953 | ret = peer_af_flag_unset (peer, afi, safi, flag); |
| 1954 | |
| 1955 | return bgp_vty_return (vty, ret); |
| 1956 | } |
| 1957 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1958 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1959 | 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] | 1960 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1961 | { |
| 1962 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); |
| 1963 | } |
| 1964 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1965 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1966 | 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] | 1967 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1968 | { |
| 1969 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); |
| 1970 | } |
| 1971 | |
| 1972 | /* neighbor capability orf prefix-list. */ |
| 1973 | DEFUN (neighbor_capability_orf_prefix, |
| 1974 | neighbor_capability_orf_prefix_cmd, |
| 1975 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 1976 | NEIGHBOR_STR |
| 1977 | NEIGHBOR_ADDR_STR2 |
| 1978 | "Advertise capability to the peer\n" |
| 1979 | "Advertise ORF capability to the peer\n" |
| 1980 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 1981 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 1982 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 1983 | "Capability to SEND the ORF to this neighbor\n") |
| 1984 | { |
| 1985 | u_int16_t flag = 0; |
| 1986 | |
| 1987 | if (strncmp (argv[1], "s", 1) == 0) |
| 1988 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 1989 | else if (strncmp (argv[1], "r", 1) == 0) |
| 1990 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 1991 | else if (strncmp (argv[1], "b", 1) == 0) |
| 1992 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 1993 | else |
| 1994 | return CMD_WARNING; |
| 1995 | |
| 1996 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1997 | bgp_node_safi (vty), flag); |
| 1998 | } |
| 1999 | |
| 2000 | DEFUN (no_neighbor_capability_orf_prefix, |
| 2001 | no_neighbor_capability_orf_prefix_cmd, |
| 2002 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 2003 | NO_STR |
| 2004 | NEIGHBOR_STR |
| 2005 | NEIGHBOR_ADDR_STR2 |
| 2006 | "Advertise capability to the peer\n" |
| 2007 | "Advertise ORF capability to the peer\n" |
| 2008 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 2009 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 2010 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 2011 | "Capability to SEND the ORF to this neighbor\n") |
| 2012 | { |
| 2013 | u_int16_t flag = 0; |
| 2014 | |
| 2015 | if (strncmp (argv[1], "s", 1) == 0) |
| 2016 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 2017 | else if (strncmp (argv[1], "r", 1) == 0) |
| 2018 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 2019 | else if (strncmp (argv[1], "b", 1) == 0) |
| 2020 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 2021 | else |
| 2022 | return CMD_WARNING; |
| 2023 | |
| 2024 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2025 | bgp_node_safi (vty), flag); |
| 2026 | } |
| 2027 | |
| 2028 | /* neighbor next-hop-self. */ |
| 2029 | DEFUN (neighbor_nexthop_self, |
| 2030 | neighbor_nexthop_self_cmd, |
| 2031 | NEIGHBOR_CMD2 "next-hop-self", |
| 2032 | NEIGHBOR_STR |
| 2033 | NEIGHBOR_ADDR_STR2 |
| 2034 | "Disable the next hop calculation for this neighbor\n") |
| 2035 | { |
| 2036 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2037 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 2038 | } |
| 2039 | |
| 2040 | DEFUN (no_neighbor_nexthop_self, |
| 2041 | no_neighbor_nexthop_self_cmd, |
| 2042 | NO_NEIGHBOR_CMD2 "next-hop-self", |
| 2043 | NO_STR |
| 2044 | NEIGHBOR_STR |
| 2045 | NEIGHBOR_ADDR_STR2 |
| 2046 | "Disable the next hop calculation for this neighbor\n") |
| 2047 | { |
| 2048 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2049 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 2050 | } |
| 2051 | |
| 2052 | /* neighbor remove-private-AS. */ |
| 2053 | DEFUN (neighbor_remove_private_as, |
| 2054 | neighbor_remove_private_as_cmd, |
| 2055 | NEIGHBOR_CMD2 "remove-private-AS", |
| 2056 | NEIGHBOR_STR |
| 2057 | NEIGHBOR_ADDR_STR2 |
| 2058 | "Remove private AS number from outbound updates\n") |
| 2059 | { |
| 2060 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2061 | bgp_node_safi (vty), |
| 2062 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 2063 | } |
| 2064 | |
| 2065 | DEFUN (no_neighbor_remove_private_as, |
| 2066 | no_neighbor_remove_private_as_cmd, |
| 2067 | NO_NEIGHBOR_CMD2 "remove-private-AS", |
| 2068 | NO_STR |
| 2069 | NEIGHBOR_STR |
| 2070 | NEIGHBOR_ADDR_STR2 |
| 2071 | "Remove private AS number from outbound updates\n") |
| 2072 | { |
| 2073 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2074 | bgp_node_safi (vty), |
| 2075 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 2076 | } |
| 2077 | |
| 2078 | /* neighbor send-community. */ |
| 2079 | DEFUN (neighbor_send_community, |
| 2080 | neighbor_send_community_cmd, |
| 2081 | NEIGHBOR_CMD2 "send-community", |
| 2082 | NEIGHBOR_STR |
| 2083 | NEIGHBOR_ADDR_STR2 |
| 2084 | "Send Community attribute to this neighbor\n") |
| 2085 | { |
| 2086 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2087 | bgp_node_safi (vty), |
| 2088 | PEER_FLAG_SEND_COMMUNITY); |
| 2089 | } |
| 2090 | |
| 2091 | DEFUN (no_neighbor_send_community, |
| 2092 | no_neighbor_send_community_cmd, |
| 2093 | NO_NEIGHBOR_CMD2 "send-community", |
| 2094 | NO_STR |
| 2095 | NEIGHBOR_STR |
| 2096 | NEIGHBOR_ADDR_STR2 |
| 2097 | "Send Community attribute to this neighbor\n") |
| 2098 | { |
| 2099 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2100 | bgp_node_safi (vty), |
| 2101 | PEER_FLAG_SEND_COMMUNITY); |
| 2102 | } |
| 2103 | |
| 2104 | /* neighbor send-community extended. */ |
| 2105 | DEFUN (neighbor_send_community_type, |
| 2106 | neighbor_send_community_type_cmd, |
| 2107 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 2108 | NEIGHBOR_STR |
| 2109 | NEIGHBOR_ADDR_STR2 |
| 2110 | "Send Community attribute to this neighbor\n" |
| 2111 | "Send Standard and Extended Community attributes\n" |
| 2112 | "Send Extended Community attributes\n" |
| 2113 | "Send Standard Community attributes\n") |
| 2114 | { |
| 2115 | if (strncmp (argv[1], "s", 1) == 0) |
| 2116 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2117 | bgp_node_safi (vty), |
| 2118 | PEER_FLAG_SEND_COMMUNITY); |
| 2119 | if (strncmp (argv[1], "e", 1) == 0) |
| 2120 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2121 | bgp_node_safi (vty), |
| 2122 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 2123 | |
| 2124 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2125 | bgp_node_safi (vty), |
| 2126 | (PEER_FLAG_SEND_COMMUNITY| |
| 2127 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 2128 | } |
| 2129 | |
| 2130 | DEFUN (no_neighbor_send_community_type, |
| 2131 | no_neighbor_send_community_type_cmd, |
| 2132 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 2133 | NO_STR |
| 2134 | NEIGHBOR_STR |
| 2135 | NEIGHBOR_ADDR_STR2 |
| 2136 | "Send Community attribute to this neighbor\n" |
| 2137 | "Send Standard and Extended Community attributes\n" |
| 2138 | "Send Extended Community attributes\n" |
| 2139 | "Send Standard Community attributes\n") |
| 2140 | { |
| 2141 | if (strncmp (argv[1], "s", 1) == 0) |
| 2142 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2143 | bgp_node_safi (vty), |
| 2144 | PEER_FLAG_SEND_COMMUNITY); |
| 2145 | if (strncmp (argv[1], "e", 1) == 0) |
| 2146 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2147 | bgp_node_safi (vty), |
| 2148 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 2149 | |
| 2150 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2151 | bgp_node_safi (vty), |
| 2152 | (PEER_FLAG_SEND_COMMUNITY | |
| 2153 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 2154 | } |
| 2155 | |
| 2156 | /* neighbor soft-reconfig. */ |
| 2157 | DEFUN (neighbor_soft_reconfiguration, |
| 2158 | neighbor_soft_reconfiguration_cmd, |
| 2159 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 2160 | NEIGHBOR_STR |
| 2161 | NEIGHBOR_ADDR_STR2 |
| 2162 | "Per neighbor soft reconfiguration\n" |
| 2163 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 2164 | { |
| 2165 | return peer_af_flag_set_vty (vty, argv[0], |
| 2166 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 2167 | PEER_FLAG_SOFT_RECONFIG); |
| 2168 | } |
| 2169 | |
| 2170 | DEFUN (no_neighbor_soft_reconfiguration, |
| 2171 | no_neighbor_soft_reconfiguration_cmd, |
| 2172 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 2173 | NO_STR |
| 2174 | NEIGHBOR_STR |
| 2175 | NEIGHBOR_ADDR_STR2 |
| 2176 | "Per neighbor soft reconfiguration\n" |
| 2177 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 2178 | { |
| 2179 | return peer_af_flag_unset_vty (vty, argv[0], |
| 2180 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 2181 | PEER_FLAG_SOFT_RECONFIG); |
| 2182 | } |
| 2183 | |
| 2184 | DEFUN (neighbor_route_reflector_client, |
| 2185 | neighbor_route_reflector_client_cmd, |
| 2186 | NEIGHBOR_CMD2 "route-reflector-client", |
| 2187 | NEIGHBOR_STR |
| 2188 | NEIGHBOR_ADDR_STR2 |
| 2189 | "Configure a neighbor as Route Reflector client\n") |
| 2190 | { |
| 2191 | struct peer *peer; |
| 2192 | |
| 2193 | |
| 2194 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2195 | if (! peer) |
| 2196 | return CMD_WARNING; |
| 2197 | |
| 2198 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2199 | bgp_node_safi (vty), |
| 2200 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2201 | } |
| 2202 | |
| 2203 | DEFUN (no_neighbor_route_reflector_client, |
| 2204 | no_neighbor_route_reflector_client_cmd, |
| 2205 | NO_NEIGHBOR_CMD2 "route-reflector-client", |
| 2206 | NO_STR |
| 2207 | NEIGHBOR_STR |
| 2208 | NEIGHBOR_ADDR_STR2 |
| 2209 | "Configure a neighbor as Route Reflector client\n") |
| 2210 | { |
| 2211 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2212 | bgp_node_safi (vty), |
| 2213 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2214 | } |
| 2215 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2216 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2217 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
| 2218 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2219 | { |
| 2220 | int ret; |
| 2221 | struct bgp *bgp; |
| 2222 | struct peer *peer; |
| 2223 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2224 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2225 | struct bgp_filter *pfilter; |
| 2226 | struct bgp_filter *gfilter; |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2227 | int locked_and_added = 0; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2228 | |
| 2229 | bgp = vty->index; |
| 2230 | |
| 2231 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2232 | if ( ! peer ) |
| 2233 | return CMD_WARNING; |
| 2234 | |
| 2235 | /* If it is already a RS-Client, don't do anything. */ |
| 2236 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2237 | return CMD_SUCCESS; |
| 2238 | |
| 2239 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2240 | { |
| 2241 | peer = peer_lock (peer); /* rsclient peer list reference */ |
| 2242 | listnode_add_sort (bgp->rsclient, peer); |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2243 | locked_and_added = 1; |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2244 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2245 | |
| 2246 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2247 | if (ret < 0) |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2248 | { |
| 2249 | if (locked_and_added) |
| 2250 | { |
| 2251 | listnode_delete (bgp->rsclient, peer); |
| 2252 | peer_unlock (peer); /* rsclient peer list reference */ |
| 2253 | } |
| 2254 | |
| 2255 | return bgp_vty_return (vty, ret); |
| 2256 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2257 | |
Paul Jakma | 64e580a | 2006-02-21 01:09:01 +0000 | [diff] [blame] | 2258 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2259 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2260 | /* RIB peer reference. Released when table is free'd in bgp_table_free. */ |
| 2261 | peer->rib[afi][safi]->owner = peer_lock (peer); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2262 | |
| 2263 | /* Check for existing 'network' and 'redistribute' routes. */ |
| 2264 | bgp_check_local_routes_rsclient (peer, afi, safi); |
| 2265 | |
| 2266 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ |
| 2267 | bgp_soft_reconfig_rsclient (peer, afi, safi); |
| 2268 | |
| 2269 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2270 | { |
| 2271 | group = peer->group; |
| 2272 | gfilter = &peer->filter[afi][safi]; |
| 2273 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2274 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2275 | { |
| 2276 | pfilter = &peer->filter[afi][safi]; |
| 2277 | |
| 2278 | /* Members of a non-RS-Client group should not be RS-Clients, as that |
| 2279 | is checked when the become part of the peer-group */ |
| 2280 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2281 | if (ret < 0) |
| 2282 | return bgp_vty_return (vty, ret); |
| 2283 | |
| 2284 | /* Make peer's RIB point to group's RIB. */ |
| 2285 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; |
| 2286 | |
| 2287 | /* Import policy. */ |
| 2288 | if (pfilter->map[RMAP_IMPORT].name) |
| 2289 | free (pfilter->map[RMAP_IMPORT].name); |
| 2290 | if (gfilter->map[RMAP_IMPORT].name) |
| 2291 | { |
| 2292 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); |
| 2293 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; |
| 2294 | } |
| 2295 | else |
| 2296 | { |
| 2297 | pfilter->map[RMAP_IMPORT].name = NULL; |
| 2298 | pfilter->map[RMAP_IMPORT].map =NULL; |
| 2299 | } |
| 2300 | |
| 2301 | /* Export policy. */ |
| 2302 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) |
| 2303 | { |
| 2304 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); |
| 2305 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; |
| 2306 | } |
| 2307 | } |
| 2308 | } |
| 2309 | return CMD_SUCCESS; |
| 2310 | } |
| 2311 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2312 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2313 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
| 2314 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2315 | { |
| 2316 | int ret; |
| 2317 | struct bgp *bgp; |
| 2318 | struct peer *peer; |
| 2319 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2320 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2321 | |
| 2322 | bgp = vty->index; |
| 2323 | |
| 2324 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2325 | if ( ! peer ) |
| 2326 | return CMD_WARNING; |
| 2327 | |
| 2328 | /* If it is not a RS-Client, don't do anything. */ |
| 2329 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2330 | return CMD_SUCCESS; |
| 2331 | |
| 2332 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2333 | { |
| 2334 | group = peer->group; |
| 2335 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2336 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2337 | { |
| 2338 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2339 | if (ret < 0) |
| 2340 | return bgp_vty_return (vty, ret); |
| 2341 | |
| 2342 | peer->rib[afi][safi] = NULL; |
| 2343 | } |
| 2344 | |
| 2345 | peer = group->conf; |
| 2346 | } |
| 2347 | |
| 2348 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2349 | if (ret < 0) |
| 2350 | return bgp_vty_return (vty, ret); |
| 2351 | |
| 2352 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2353 | { |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2354 | bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2355 | listnode_delete (bgp->rsclient, peer); |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2356 | peer_unlock (peer); /* peer bgp rsclient reference */ |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2357 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2358 | |
Paul Jakma | b608d5b | 2008-07-02 02:12:07 +0000 | [diff] [blame] | 2359 | bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2360 | |
| 2361 | return CMD_SUCCESS; |
| 2362 | } |
| 2363 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2364 | /* neighbor route-server-client. */ |
| 2365 | DEFUN (neighbor_route_server_client, |
| 2366 | neighbor_route_server_client_cmd, |
| 2367 | NEIGHBOR_CMD2 "route-server-client", |
| 2368 | NEIGHBOR_STR |
| 2369 | NEIGHBOR_ADDR_STR2 |
| 2370 | "Configure a neighbor as Route Server client\n") |
| 2371 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2372 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
| 2373 | bgp_node_safi(vty)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2374 | } |
| 2375 | |
| 2376 | DEFUN (no_neighbor_route_server_client, |
| 2377 | no_neighbor_route_server_client_cmd, |
| 2378 | NO_NEIGHBOR_CMD2 "route-server-client", |
| 2379 | NO_STR |
| 2380 | NEIGHBOR_STR |
| 2381 | NEIGHBOR_ADDR_STR2 |
| 2382 | "Configure a neighbor as Route Server client\n") |
| 2383 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2384 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), |
| 2385 | bgp_node_safi(vty)); |
| 2386 | } |
| 2387 | |
| 2388 | DEFUN (neighbor_nexthop_local_unchanged, |
| 2389 | neighbor_nexthop_local_unchanged_cmd, |
| 2390 | NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2391 | NEIGHBOR_STR |
| 2392 | NEIGHBOR_ADDR_STR2 |
| 2393 | "Configure treatment of outgoing link-local nexthop attribute\n" |
| 2394 | "Leave link-local nexthop unchanged for this peer\n") |
| 2395 | { |
| 2396 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2397 | bgp_node_safi (vty), |
| 2398 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
| 2399 | } |
| 2400 | |
| 2401 | DEFUN (no_neighbor_nexthop_local_unchanged, |
| 2402 | no_neighbor_nexthop_local_unchanged_cmd, |
| 2403 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2404 | NO_STR |
| 2405 | NEIGHBOR_STR |
| 2406 | NEIGHBOR_ADDR_STR2 |
| 2407 | "Configure treatment of outgoing link-local-nexthop attribute\n" |
| 2408 | "Leave link-local nexthop unchanged for this peer\n") |
| 2409 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2410 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2411 | bgp_node_safi (vty), |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2412 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2413 | } |
| 2414 | |
| 2415 | DEFUN (neighbor_attr_unchanged, |
| 2416 | neighbor_attr_unchanged_cmd, |
| 2417 | NEIGHBOR_CMD2 "attribute-unchanged", |
| 2418 | NEIGHBOR_STR |
| 2419 | NEIGHBOR_ADDR_STR2 |
| 2420 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2421 | { |
| 2422 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2423 | bgp_node_safi (vty), |
| 2424 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2425 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2426 | PEER_FLAG_MED_UNCHANGED)); |
| 2427 | } |
| 2428 | |
| 2429 | DEFUN (neighbor_attr_unchanged1, |
| 2430 | neighbor_attr_unchanged1_cmd, |
| 2431 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2432 | NEIGHBOR_STR |
| 2433 | NEIGHBOR_ADDR_STR2 |
| 2434 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2435 | "As-path attribute\n" |
| 2436 | "Nexthop attribute\n" |
| 2437 | "Med attribute\n") |
| 2438 | { |
| 2439 | u_int16_t flags = 0; |
| 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], "next-hop", 1) == 0) |
| 2444 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2445 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2446 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2447 | |
| 2448 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2449 | bgp_node_safi (vty), flags); |
| 2450 | } |
| 2451 | |
| 2452 | DEFUN (neighbor_attr_unchanged2, |
| 2453 | neighbor_attr_unchanged2_cmd, |
| 2454 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2455 | NEIGHBOR_STR |
| 2456 | NEIGHBOR_ADDR_STR2 |
| 2457 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2458 | "As-path attribute\n" |
| 2459 | "Nexthop attribute\n" |
| 2460 | "Med attribute\n") |
| 2461 | { |
| 2462 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2463 | |
| 2464 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2465 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2466 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2467 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2468 | |
| 2469 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2470 | bgp_node_safi (vty), flags); |
| 2471 | |
| 2472 | } |
| 2473 | |
| 2474 | DEFUN (neighbor_attr_unchanged3, |
| 2475 | neighbor_attr_unchanged3_cmd, |
| 2476 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2477 | NEIGHBOR_STR |
| 2478 | NEIGHBOR_ADDR_STR2 |
| 2479 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2480 | "Nexthop attribute\n" |
| 2481 | "As-path attribute\n" |
| 2482 | "Med attribute\n") |
| 2483 | { |
| 2484 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2485 | |
| 2486 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2487 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2488 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2489 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2490 | |
| 2491 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2492 | bgp_node_safi (vty), flags); |
| 2493 | } |
| 2494 | |
| 2495 | DEFUN (neighbor_attr_unchanged4, |
| 2496 | neighbor_attr_unchanged4_cmd, |
| 2497 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2498 | NEIGHBOR_STR |
| 2499 | NEIGHBOR_ADDR_STR2 |
| 2500 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2501 | "Med attribute\n" |
| 2502 | "As-path attribute\n" |
| 2503 | "Nexthop attribute\n") |
| 2504 | { |
| 2505 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2506 | |
| 2507 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2508 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2509 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2510 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2511 | |
| 2512 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2513 | bgp_node_safi (vty), flags); |
| 2514 | } |
| 2515 | |
| 2516 | ALIAS (neighbor_attr_unchanged, |
| 2517 | neighbor_attr_unchanged5_cmd, |
| 2518 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2519 | NEIGHBOR_STR |
| 2520 | NEIGHBOR_ADDR_STR2 |
| 2521 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2522 | "As-path attribute\n" |
| 2523 | "Nexthop attribute\n" |
| 2524 | "Med attribute\n") |
| 2525 | |
| 2526 | ALIAS (neighbor_attr_unchanged, |
| 2527 | neighbor_attr_unchanged6_cmd, |
| 2528 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2529 | NEIGHBOR_STR |
| 2530 | NEIGHBOR_ADDR_STR2 |
| 2531 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2532 | "As-path attribute\n" |
| 2533 | "Med attribute\n" |
| 2534 | "Nexthop attribute\n") |
| 2535 | |
| 2536 | ALIAS (neighbor_attr_unchanged, |
| 2537 | neighbor_attr_unchanged7_cmd, |
| 2538 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2539 | NEIGHBOR_STR |
| 2540 | NEIGHBOR_ADDR_STR2 |
| 2541 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2542 | "Nexthop attribute\n" |
| 2543 | "Med attribute\n" |
| 2544 | "As-path attribute\n") |
| 2545 | |
| 2546 | ALIAS (neighbor_attr_unchanged, |
| 2547 | neighbor_attr_unchanged8_cmd, |
| 2548 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2549 | NEIGHBOR_STR |
| 2550 | NEIGHBOR_ADDR_STR2 |
| 2551 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2552 | "Nexthop attribute\n" |
| 2553 | "As-path attribute\n" |
| 2554 | "Med attribute\n") |
| 2555 | |
| 2556 | ALIAS (neighbor_attr_unchanged, |
| 2557 | neighbor_attr_unchanged9_cmd, |
| 2558 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2559 | NEIGHBOR_STR |
| 2560 | NEIGHBOR_ADDR_STR2 |
| 2561 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2562 | "Med attribute\n" |
| 2563 | "Nexthop attribute\n" |
| 2564 | "As-path attribute\n") |
| 2565 | |
| 2566 | ALIAS (neighbor_attr_unchanged, |
| 2567 | neighbor_attr_unchanged10_cmd, |
| 2568 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2569 | NEIGHBOR_STR |
| 2570 | NEIGHBOR_ADDR_STR2 |
| 2571 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2572 | "Med attribute\n" |
| 2573 | "As-path attribute\n" |
| 2574 | "Nexthop attribute\n") |
| 2575 | |
| 2576 | DEFUN (no_neighbor_attr_unchanged, |
| 2577 | no_neighbor_attr_unchanged_cmd, |
| 2578 | NO_NEIGHBOR_CMD2 "attribute-unchanged", |
| 2579 | NO_STR |
| 2580 | NEIGHBOR_STR |
| 2581 | NEIGHBOR_ADDR_STR2 |
| 2582 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2583 | { |
| 2584 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2585 | bgp_node_safi (vty), |
| 2586 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2587 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2588 | PEER_FLAG_MED_UNCHANGED)); |
| 2589 | } |
| 2590 | |
| 2591 | DEFUN (no_neighbor_attr_unchanged1, |
| 2592 | no_neighbor_attr_unchanged1_cmd, |
| 2593 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2594 | NO_STR |
| 2595 | NEIGHBOR_STR |
| 2596 | NEIGHBOR_ADDR_STR2 |
| 2597 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2598 | "As-path attribute\n" |
| 2599 | "Nexthop attribute\n" |
| 2600 | "Med attribute\n") |
| 2601 | { |
| 2602 | u_int16_t flags = 0; |
| 2603 | |
| 2604 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2605 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2606 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2607 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2608 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2609 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2610 | |
| 2611 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2612 | bgp_node_safi (vty), flags); |
| 2613 | } |
| 2614 | |
| 2615 | DEFUN (no_neighbor_attr_unchanged2, |
| 2616 | no_neighbor_attr_unchanged2_cmd, |
| 2617 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2618 | NO_STR |
| 2619 | NEIGHBOR_STR |
| 2620 | NEIGHBOR_ADDR_STR2 |
| 2621 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2622 | "As-path attribute\n" |
| 2623 | "Nexthop attribute\n" |
| 2624 | "Med attribute\n") |
| 2625 | { |
| 2626 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2627 | |
| 2628 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2629 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2630 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2631 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2632 | |
| 2633 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2634 | bgp_node_safi (vty), flags); |
| 2635 | } |
| 2636 | |
| 2637 | DEFUN (no_neighbor_attr_unchanged3, |
| 2638 | no_neighbor_attr_unchanged3_cmd, |
| 2639 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2640 | NO_STR |
| 2641 | NEIGHBOR_STR |
| 2642 | NEIGHBOR_ADDR_STR2 |
| 2643 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2644 | "Nexthop attribute\n" |
| 2645 | "As-path attribute\n" |
| 2646 | "Med attribute\n") |
| 2647 | { |
| 2648 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2649 | |
| 2650 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2651 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2652 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2653 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2654 | |
| 2655 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2656 | bgp_node_safi (vty), flags); |
| 2657 | } |
| 2658 | |
| 2659 | DEFUN (no_neighbor_attr_unchanged4, |
| 2660 | no_neighbor_attr_unchanged4_cmd, |
| 2661 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2662 | NO_STR |
| 2663 | NEIGHBOR_STR |
| 2664 | NEIGHBOR_ADDR_STR2 |
| 2665 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2666 | "Med attribute\n" |
| 2667 | "As-path attribute\n" |
| 2668 | "Nexthop attribute\n") |
| 2669 | { |
| 2670 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2671 | |
| 2672 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2673 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2674 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2675 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2676 | |
| 2677 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2678 | bgp_node_safi (vty), flags); |
| 2679 | } |
| 2680 | |
| 2681 | ALIAS (no_neighbor_attr_unchanged, |
| 2682 | no_neighbor_attr_unchanged5_cmd, |
| 2683 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2684 | NO_STR |
| 2685 | NEIGHBOR_STR |
| 2686 | NEIGHBOR_ADDR_STR2 |
| 2687 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2688 | "As-path attribute\n" |
| 2689 | "Nexthop attribute\n" |
| 2690 | "Med attribute\n") |
| 2691 | |
| 2692 | ALIAS (no_neighbor_attr_unchanged, |
| 2693 | no_neighbor_attr_unchanged6_cmd, |
| 2694 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2695 | NO_STR |
| 2696 | NEIGHBOR_STR |
| 2697 | NEIGHBOR_ADDR_STR2 |
| 2698 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2699 | "As-path attribute\n" |
| 2700 | "Med attribute\n" |
| 2701 | "Nexthop attribute\n") |
| 2702 | |
| 2703 | ALIAS (no_neighbor_attr_unchanged, |
| 2704 | no_neighbor_attr_unchanged7_cmd, |
| 2705 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2706 | NO_STR |
| 2707 | NEIGHBOR_STR |
| 2708 | NEIGHBOR_ADDR_STR2 |
| 2709 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2710 | "Nexthop attribute\n" |
| 2711 | "Med attribute\n" |
| 2712 | "As-path attribute\n") |
| 2713 | |
| 2714 | ALIAS (no_neighbor_attr_unchanged, |
| 2715 | no_neighbor_attr_unchanged8_cmd, |
| 2716 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2717 | NO_STR |
| 2718 | NEIGHBOR_STR |
| 2719 | NEIGHBOR_ADDR_STR2 |
| 2720 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2721 | "Nexthop attribute\n" |
| 2722 | "As-path attribute\n" |
| 2723 | "Med attribute\n") |
| 2724 | |
| 2725 | ALIAS (no_neighbor_attr_unchanged, |
| 2726 | no_neighbor_attr_unchanged9_cmd, |
| 2727 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2728 | NO_STR |
| 2729 | NEIGHBOR_STR |
| 2730 | NEIGHBOR_ADDR_STR2 |
| 2731 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2732 | "Med attribute\n" |
| 2733 | "Nexthop attribute\n" |
| 2734 | "As-path attribute\n") |
| 2735 | |
| 2736 | ALIAS (no_neighbor_attr_unchanged, |
| 2737 | no_neighbor_attr_unchanged10_cmd, |
| 2738 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2739 | NO_STR |
| 2740 | NEIGHBOR_STR |
| 2741 | NEIGHBOR_ADDR_STR2 |
| 2742 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2743 | "Med attribute\n" |
| 2744 | "As-path attribute\n" |
| 2745 | "Nexthop attribute\n") |
| 2746 | |
| 2747 | /* For old version Zebra compatibility. */ |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2748 | DEFUN_DEPRECATED (neighbor_transparent_as, |
| 2749 | neighbor_transparent_as_cmd, |
| 2750 | NEIGHBOR_CMD "transparent-as", |
| 2751 | NEIGHBOR_STR |
| 2752 | NEIGHBOR_ADDR_STR |
| 2753 | "Do not append my AS number even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2754 | { |
| 2755 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2756 | bgp_node_safi (vty), |
| 2757 | PEER_FLAG_AS_PATH_UNCHANGED); |
| 2758 | } |
| 2759 | |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2760 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
| 2761 | neighbor_transparent_nexthop_cmd, |
| 2762 | NEIGHBOR_CMD "transparent-nexthop", |
| 2763 | NEIGHBOR_STR |
| 2764 | NEIGHBOR_ADDR_STR |
| 2765 | "Do not change nexthop even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2766 | { |
| 2767 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2768 | bgp_node_safi (vty), |
| 2769 | PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2770 | } |
| 2771 | |
| 2772 | /* EBGP multihop configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2773 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2774 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
| 2775 | const char *ttl_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2776 | { |
| 2777 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2778 | unsigned int ttl; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2779 | |
| 2780 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2781 | if (! peer) |
| 2782 | return CMD_WARNING; |
| 2783 | |
| 2784 | if (! ttl_str) |
| 2785 | ttl = TTL_MAX; |
| 2786 | else |
| 2787 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); |
| 2788 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 2789 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2790 | } |
| 2791 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2792 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2793 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2794 | { |
| 2795 | struct peer *peer; |
| 2796 | |
| 2797 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2798 | if (! peer) |
| 2799 | return CMD_WARNING; |
| 2800 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 2801 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2802 | } |
| 2803 | |
| 2804 | /* neighbor ebgp-multihop. */ |
| 2805 | DEFUN (neighbor_ebgp_multihop, |
| 2806 | neighbor_ebgp_multihop_cmd, |
| 2807 | NEIGHBOR_CMD2 "ebgp-multihop", |
| 2808 | NEIGHBOR_STR |
| 2809 | NEIGHBOR_ADDR_STR2 |
| 2810 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2811 | { |
| 2812 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); |
| 2813 | } |
| 2814 | |
| 2815 | DEFUN (neighbor_ebgp_multihop_ttl, |
| 2816 | neighbor_ebgp_multihop_ttl_cmd, |
| 2817 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2818 | NEIGHBOR_STR |
| 2819 | NEIGHBOR_ADDR_STR2 |
| 2820 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2821 | "maximum hop count\n") |
| 2822 | { |
| 2823 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); |
| 2824 | } |
| 2825 | |
| 2826 | DEFUN (no_neighbor_ebgp_multihop, |
| 2827 | no_neighbor_ebgp_multihop_cmd, |
| 2828 | NO_NEIGHBOR_CMD2 "ebgp-multihop", |
| 2829 | NO_STR |
| 2830 | NEIGHBOR_STR |
| 2831 | NEIGHBOR_ADDR_STR2 |
| 2832 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2833 | { |
| 2834 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); |
| 2835 | } |
| 2836 | |
| 2837 | ALIAS (no_neighbor_ebgp_multihop, |
| 2838 | no_neighbor_ebgp_multihop_ttl_cmd, |
| 2839 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2840 | NO_STR |
| 2841 | NEIGHBOR_STR |
| 2842 | NEIGHBOR_ADDR_STR2 |
| 2843 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2844 | "maximum hop count\n") |
| 2845 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2846 | /* disable-connected-check */ |
| 2847 | DEFUN (neighbor_disable_connected_check, |
| 2848 | neighbor_disable_connected_check_cmd, |
| 2849 | NEIGHBOR_CMD2 "disable-connected-check", |
| 2850 | NEIGHBOR_STR |
| 2851 | NEIGHBOR_ADDR_STR2 |
| 2852 | "one-hop away EBGP peer using loopback address\n") |
| 2853 | { |
| 2854 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2855 | } |
| 2856 | |
| 2857 | DEFUN (no_neighbor_disable_connected_check, |
| 2858 | no_neighbor_disable_connected_check_cmd, |
| 2859 | NO_NEIGHBOR_CMD2 "disable-connected-check", |
| 2860 | NO_STR |
| 2861 | NEIGHBOR_STR |
| 2862 | NEIGHBOR_ADDR_STR2 |
| 2863 | "one-hop away EBGP peer using loopback address\n") |
| 2864 | { |
| 2865 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2866 | } |
| 2867 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2868 | /* Enforce multihop. */ |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2869 | ALIAS (neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2870 | neighbor_enforce_multihop_cmd, |
| 2871 | NEIGHBOR_CMD2 "enforce-multihop", |
| 2872 | NEIGHBOR_STR |
| 2873 | NEIGHBOR_ADDR_STR2 |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 2874 | "Enforce EBGP neighbors perform multihop\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2875 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2876 | /* Enforce multihop. */ |
| 2877 | ALIAS (no_neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2878 | no_neighbor_enforce_multihop_cmd, |
| 2879 | NO_NEIGHBOR_CMD2 "enforce-multihop", |
| 2880 | NO_STR |
| 2881 | NEIGHBOR_STR |
| 2882 | NEIGHBOR_ADDR_STR2 |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 2883 | "Enforce EBGP neighbors perform multihop\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2884 | |
| 2885 | DEFUN (neighbor_description, |
| 2886 | neighbor_description_cmd, |
| 2887 | NEIGHBOR_CMD2 "description .LINE", |
| 2888 | NEIGHBOR_STR |
| 2889 | NEIGHBOR_ADDR_STR2 |
| 2890 | "Neighbor specific description\n" |
| 2891 | "Up to 80 characters describing this neighbor\n") |
| 2892 | { |
| 2893 | struct peer *peer; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2894 | char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2895 | |
| 2896 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2897 | if (! peer) |
| 2898 | return CMD_WARNING; |
| 2899 | |
| 2900 | if (argc == 1) |
| 2901 | return CMD_SUCCESS; |
| 2902 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2903 | str = argv_concat(argv, argc, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2904 | |
| 2905 | peer_description_set (peer, str); |
| 2906 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2907 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2908 | |
| 2909 | return CMD_SUCCESS; |
| 2910 | } |
| 2911 | |
| 2912 | DEFUN (no_neighbor_description, |
| 2913 | no_neighbor_description_cmd, |
| 2914 | NO_NEIGHBOR_CMD2 "description", |
| 2915 | NO_STR |
| 2916 | NEIGHBOR_STR |
| 2917 | NEIGHBOR_ADDR_STR2 |
| 2918 | "Neighbor specific description\n") |
| 2919 | { |
| 2920 | struct peer *peer; |
| 2921 | |
| 2922 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2923 | if (! peer) |
| 2924 | return CMD_WARNING; |
| 2925 | |
| 2926 | peer_description_unset (peer); |
| 2927 | |
| 2928 | return CMD_SUCCESS; |
| 2929 | } |
| 2930 | |
| 2931 | ALIAS (no_neighbor_description, |
| 2932 | no_neighbor_description_val_cmd, |
| 2933 | NO_NEIGHBOR_CMD2 "description .LINE", |
| 2934 | NO_STR |
| 2935 | NEIGHBOR_STR |
| 2936 | NEIGHBOR_ADDR_STR2 |
| 2937 | "Neighbor specific description\n" |
| 2938 | "Up to 80 characters describing this neighbor\n") |
| 2939 | |
| 2940 | /* Neighbor update-source. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2941 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2942 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
| 2943 | const char *source_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2944 | { |
| 2945 | struct peer *peer; |
| 2946 | union sockunion *su; |
| 2947 | |
| 2948 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2949 | if (! peer) |
| 2950 | return CMD_WARNING; |
| 2951 | |
| 2952 | if (source_str) |
| 2953 | { |
| 2954 | su = sockunion_str2su (source_str); |
| 2955 | if (su) |
| 2956 | { |
| 2957 | peer_update_source_addr_set (peer, su); |
| 2958 | sockunion_free (su); |
| 2959 | } |
| 2960 | else |
| 2961 | peer_update_source_if_set (peer, source_str); |
| 2962 | } |
| 2963 | else |
| 2964 | peer_update_source_unset (peer); |
| 2965 | |
| 2966 | return CMD_SUCCESS; |
| 2967 | } |
| 2968 | |
Paul Jakma | 9a1a331 | 2009-07-27 12:27:55 +0100 | [diff] [blame] | 2969 | #define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)" |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 2970 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
| 2971 | "IPv4 address\n" \ |
Paul Jakma | 9a1a331 | 2009-07-27 12:27:55 +0100 | [diff] [blame] | 2972 | "IPv6 address\n" \ |
| 2973 | "Interface name (requires zebra to be running)\n" |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 2974 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2975 | DEFUN (neighbor_update_source, |
| 2976 | neighbor_update_source_cmd, |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 2977 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2978 | NEIGHBOR_STR |
| 2979 | NEIGHBOR_ADDR_STR2 |
| 2980 | "Source of routing updates\n" |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 2981 | BGP_UPDATE_SOURCE_HELP_STR) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2982 | { |
| 2983 | return peer_update_source_vty (vty, argv[0], argv[1]); |
| 2984 | } |
| 2985 | |
| 2986 | DEFUN (no_neighbor_update_source, |
| 2987 | no_neighbor_update_source_cmd, |
| 2988 | NO_NEIGHBOR_CMD2 "update-source", |
| 2989 | NO_STR |
| 2990 | NEIGHBOR_STR |
| 2991 | NEIGHBOR_ADDR_STR2 |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 2992 | "Source of routing updates\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2993 | { |
| 2994 | return peer_update_source_vty (vty, argv[0], NULL); |
| 2995 | } |
| 2996 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2997 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2998 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
| 2999 | afi_t afi, safi_t safi, |
| 3000 | const char *rmap, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3001 | { |
| 3002 | int ret; |
| 3003 | struct peer *peer; |
| 3004 | |
| 3005 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 3006 | if (! peer) |
| 3007 | return CMD_WARNING; |
| 3008 | |
| 3009 | if (set) |
| 3010 | ret = peer_default_originate_set (peer, afi, safi, rmap); |
| 3011 | else |
| 3012 | ret = peer_default_originate_unset (peer, afi, safi); |
| 3013 | |
| 3014 | return bgp_vty_return (vty, ret); |
| 3015 | } |
| 3016 | |
| 3017 | /* neighbor default-originate. */ |
| 3018 | DEFUN (neighbor_default_originate, |
| 3019 | neighbor_default_originate_cmd, |
| 3020 | NEIGHBOR_CMD2 "default-originate", |
| 3021 | NEIGHBOR_STR |
| 3022 | NEIGHBOR_ADDR_STR2 |
| 3023 | "Originate default route to this neighbor\n") |
| 3024 | { |
| 3025 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3026 | bgp_node_safi (vty), NULL, 1); |
| 3027 | } |
| 3028 | |
| 3029 | DEFUN (neighbor_default_originate_rmap, |
| 3030 | neighbor_default_originate_rmap_cmd, |
| 3031 | NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 3032 | NEIGHBOR_STR |
| 3033 | NEIGHBOR_ADDR_STR2 |
| 3034 | "Originate default route to this neighbor\n" |
| 3035 | "Route-map to specify criteria to originate default\n" |
| 3036 | "route-map name\n") |
| 3037 | { |
| 3038 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3039 | bgp_node_safi (vty), argv[1], 1); |
| 3040 | } |
| 3041 | |
| 3042 | DEFUN (no_neighbor_default_originate, |
| 3043 | no_neighbor_default_originate_cmd, |
| 3044 | NO_NEIGHBOR_CMD2 "default-originate", |
| 3045 | NO_STR |
| 3046 | NEIGHBOR_STR |
| 3047 | NEIGHBOR_ADDR_STR2 |
| 3048 | "Originate default route to this neighbor\n") |
| 3049 | { |
| 3050 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3051 | bgp_node_safi (vty), NULL, 0); |
| 3052 | } |
| 3053 | |
| 3054 | ALIAS (no_neighbor_default_originate, |
| 3055 | no_neighbor_default_originate_rmap_cmd, |
| 3056 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 3057 | NO_STR |
| 3058 | NEIGHBOR_STR |
| 3059 | NEIGHBOR_ADDR_STR2 |
| 3060 | "Originate default route to this neighbor\n" |
| 3061 | "Route-map to specify criteria to originate default\n" |
| 3062 | "route-map name\n") |
| 3063 | |
| 3064 | /* Set neighbor's BGP port. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3065 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3066 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
| 3067 | const char *port_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3068 | { |
| 3069 | struct peer *peer; |
| 3070 | u_int16_t port; |
| 3071 | struct servent *sp; |
| 3072 | |
| 3073 | peer = peer_lookup_vty (vty, ip_str); |
| 3074 | if (! peer) |
| 3075 | return CMD_WARNING; |
| 3076 | |
| 3077 | if (! port_str) |
| 3078 | { |
| 3079 | sp = getservbyname ("bgp", "tcp"); |
| 3080 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); |
| 3081 | } |
| 3082 | else |
| 3083 | { |
| 3084 | VTY_GET_INTEGER("port", port, port_str); |
| 3085 | } |
| 3086 | |
| 3087 | peer_port_set (peer, port); |
| 3088 | |
| 3089 | return CMD_SUCCESS; |
| 3090 | } |
| 3091 | |
hasso | f418446 | 2005-02-01 20:13:16 +0000 | [diff] [blame] | 3092 | /* Set specified peer's BGP port. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3093 | DEFUN (neighbor_port, |
| 3094 | neighbor_port_cmd, |
| 3095 | NEIGHBOR_CMD "port <0-65535>", |
| 3096 | NEIGHBOR_STR |
| 3097 | NEIGHBOR_ADDR_STR |
| 3098 | "Neighbor's BGP port\n" |
| 3099 | "TCP port number\n") |
| 3100 | { |
| 3101 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); |
| 3102 | } |
| 3103 | |
| 3104 | DEFUN (no_neighbor_port, |
| 3105 | no_neighbor_port_cmd, |
| 3106 | NO_NEIGHBOR_CMD "port", |
| 3107 | NO_STR |
| 3108 | NEIGHBOR_STR |
| 3109 | NEIGHBOR_ADDR_STR |
| 3110 | "Neighbor's BGP port\n") |
| 3111 | { |
| 3112 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); |
| 3113 | } |
| 3114 | |
| 3115 | ALIAS (no_neighbor_port, |
| 3116 | no_neighbor_port_val_cmd, |
| 3117 | NO_NEIGHBOR_CMD "port <0-65535>", |
| 3118 | NO_STR |
| 3119 | NEIGHBOR_STR |
| 3120 | NEIGHBOR_ADDR_STR |
| 3121 | "Neighbor's BGP port\n" |
| 3122 | "TCP port number\n") |
| 3123 | |
| 3124 | /* neighbor weight. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3125 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3126 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
| 3127 | const char *weight_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3128 | { |
| 3129 | int ret; |
| 3130 | struct peer *peer; |
| 3131 | unsigned long weight; |
| 3132 | |
| 3133 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3134 | if (! peer) |
| 3135 | return CMD_WARNING; |
| 3136 | |
| 3137 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); |
| 3138 | |
| 3139 | ret = peer_weight_set (peer, weight); |
| 3140 | |
| 3141 | return CMD_SUCCESS; |
| 3142 | } |
| 3143 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3144 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3145 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3146 | { |
| 3147 | struct peer *peer; |
| 3148 | |
| 3149 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3150 | if (! peer) |
| 3151 | return CMD_WARNING; |
| 3152 | |
| 3153 | peer_weight_unset (peer); |
| 3154 | |
| 3155 | return CMD_SUCCESS; |
| 3156 | } |
| 3157 | |
| 3158 | DEFUN (neighbor_weight, |
| 3159 | neighbor_weight_cmd, |
| 3160 | NEIGHBOR_CMD2 "weight <0-65535>", |
| 3161 | NEIGHBOR_STR |
| 3162 | NEIGHBOR_ADDR_STR2 |
| 3163 | "Set default weight for routes from this neighbor\n" |
| 3164 | "default weight\n") |
| 3165 | { |
| 3166 | return peer_weight_set_vty (vty, argv[0], argv[1]); |
| 3167 | } |
| 3168 | |
| 3169 | DEFUN (no_neighbor_weight, |
| 3170 | no_neighbor_weight_cmd, |
| 3171 | NO_NEIGHBOR_CMD2 "weight", |
| 3172 | NO_STR |
| 3173 | NEIGHBOR_STR |
| 3174 | NEIGHBOR_ADDR_STR2 |
| 3175 | "Set default weight for routes from this neighbor\n") |
| 3176 | { |
| 3177 | return peer_weight_unset_vty (vty, argv[0]); |
| 3178 | } |
| 3179 | |
| 3180 | ALIAS (no_neighbor_weight, |
| 3181 | no_neighbor_weight_val_cmd, |
| 3182 | NO_NEIGHBOR_CMD2 "weight <0-65535>", |
| 3183 | NO_STR |
| 3184 | NEIGHBOR_STR |
| 3185 | NEIGHBOR_ADDR_STR2 |
| 3186 | "Set default weight for routes from this neighbor\n" |
| 3187 | "default weight\n") |
| 3188 | |
| 3189 | /* Override capability negotiation. */ |
| 3190 | DEFUN (neighbor_override_capability, |
| 3191 | neighbor_override_capability_cmd, |
| 3192 | NEIGHBOR_CMD2 "override-capability", |
| 3193 | NEIGHBOR_STR |
| 3194 | NEIGHBOR_ADDR_STR2 |
| 3195 | "Override capability negotiation result\n") |
| 3196 | { |
| 3197 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 3198 | } |
| 3199 | |
| 3200 | DEFUN (no_neighbor_override_capability, |
| 3201 | no_neighbor_override_capability_cmd, |
| 3202 | NO_NEIGHBOR_CMD2 "override-capability", |
| 3203 | NO_STR |
| 3204 | NEIGHBOR_STR |
| 3205 | NEIGHBOR_ADDR_STR2 |
| 3206 | "Override capability negotiation result\n") |
| 3207 | { |
| 3208 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 3209 | } |
| 3210 | |
| 3211 | DEFUN (neighbor_strict_capability, |
| 3212 | neighbor_strict_capability_cmd, |
| 3213 | NEIGHBOR_CMD "strict-capability-match", |
| 3214 | NEIGHBOR_STR |
| 3215 | NEIGHBOR_ADDR_STR |
| 3216 | "Strict capability negotiation match\n") |
| 3217 | { |
| 3218 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3219 | } |
| 3220 | |
| 3221 | DEFUN (no_neighbor_strict_capability, |
| 3222 | no_neighbor_strict_capability_cmd, |
| 3223 | NO_NEIGHBOR_CMD "strict-capability-match", |
| 3224 | NO_STR |
| 3225 | NEIGHBOR_STR |
| 3226 | NEIGHBOR_ADDR_STR |
| 3227 | "Strict capability negotiation match\n") |
| 3228 | { |
| 3229 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3230 | } |
| 3231 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3232 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3233 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
| 3234 | const char *keep_str, const char *hold_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3235 | { |
| 3236 | int ret; |
| 3237 | struct peer *peer; |
| 3238 | u_int32_t keepalive; |
| 3239 | u_int32_t holdtime; |
| 3240 | |
| 3241 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3242 | if (! peer) |
| 3243 | return CMD_WARNING; |
| 3244 | |
| 3245 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); |
| 3246 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); |
| 3247 | |
| 3248 | ret = peer_timers_set (peer, keepalive, holdtime); |
| 3249 | |
| 3250 | return bgp_vty_return (vty, ret); |
| 3251 | } |
| 3252 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3253 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3254 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3255 | { |
| 3256 | int ret; |
| 3257 | struct peer *peer; |
| 3258 | |
| 3259 | peer = peer_lookup_vty (vty, ip_str); |
| 3260 | if (! peer) |
| 3261 | return CMD_WARNING; |
| 3262 | |
| 3263 | ret = peer_timers_unset (peer); |
| 3264 | |
| 3265 | return bgp_vty_return (vty, ret); |
| 3266 | } |
| 3267 | |
| 3268 | DEFUN (neighbor_timers, |
| 3269 | neighbor_timers_cmd, |
| 3270 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", |
| 3271 | NEIGHBOR_STR |
| 3272 | NEIGHBOR_ADDR_STR2 |
| 3273 | "BGP per neighbor timers\n" |
| 3274 | "Keepalive interval\n" |
| 3275 | "Holdtime\n") |
| 3276 | { |
| 3277 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); |
| 3278 | } |
| 3279 | |
| 3280 | DEFUN (no_neighbor_timers, |
| 3281 | no_neighbor_timers_cmd, |
| 3282 | NO_NEIGHBOR_CMD2 "timers", |
| 3283 | NO_STR |
| 3284 | NEIGHBOR_STR |
| 3285 | NEIGHBOR_ADDR_STR2 |
| 3286 | "BGP per neighbor timers\n") |
| 3287 | { |
| 3288 | return peer_timers_unset_vty (vty, argv[0]); |
| 3289 | } |
| 3290 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3291 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3292 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
| 3293 | const char *time_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3294 | { |
| 3295 | int ret; |
| 3296 | struct peer *peer; |
| 3297 | u_int32_t connect; |
| 3298 | |
| 3299 | peer = peer_lookup_vty (vty, ip_str); |
| 3300 | if (! peer) |
| 3301 | return CMD_WARNING; |
| 3302 | |
| 3303 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); |
| 3304 | |
| 3305 | ret = peer_timers_connect_set (peer, connect); |
| 3306 | |
| 3307 | return CMD_SUCCESS; |
| 3308 | } |
| 3309 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3310 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3311 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3312 | { |
| 3313 | int ret; |
| 3314 | struct peer *peer; |
| 3315 | |
| 3316 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3317 | if (! peer) |
| 3318 | return CMD_WARNING; |
| 3319 | |
| 3320 | ret = peer_timers_connect_unset (peer); |
| 3321 | |
| 3322 | return CMD_SUCCESS; |
| 3323 | } |
| 3324 | |
| 3325 | DEFUN (neighbor_timers_connect, |
| 3326 | neighbor_timers_connect_cmd, |
| 3327 | NEIGHBOR_CMD "timers connect <0-65535>", |
| 3328 | NEIGHBOR_STR |
| 3329 | NEIGHBOR_ADDR_STR |
| 3330 | "BGP per neighbor timers\n" |
| 3331 | "BGP connect timer\n" |
| 3332 | "Connect timer\n") |
| 3333 | { |
| 3334 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); |
| 3335 | } |
| 3336 | |
| 3337 | DEFUN (no_neighbor_timers_connect, |
| 3338 | no_neighbor_timers_connect_cmd, |
| 3339 | NO_NEIGHBOR_CMD "timers connect", |
| 3340 | NO_STR |
| 3341 | NEIGHBOR_STR |
| 3342 | NEIGHBOR_ADDR_STR |
| 3343 | "BGP per neighbor timers\n" |
| 3344 | "BGP connect timer\n") |
| 3345 | { |
| 3346 | return peer_timers_connect_unset_vty (vty, argv[0]); |
| 3347 | } |
| 3348 | |
| 3349 | ALIAS (no_neighbor_timers_connect, |
| 3350 | no_neighbor_timers_connect_val_cmd, |
| 3351 | NO_NEIGHBOR_CMD "timers connect <0-65535>", |
| 3352 | NO_STR |
| 3353 | NEIGHBOR_STR |
| 3354 | NEIGHBOR_ADDR_STR |
| 3355 | "BGP per neighbor timers\n" |
| 3356 | "BGP connect timer\n" |
| 3357 | "Connect timer\n") |
| 3358 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3359 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3360 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
| 3361 | const char *time_str, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3362 | { |
| 3363 | int ret; |
| 3364 | struct peer *peer; |
| 3365 | u_int32_t routeadv = 0; |
| 3366 | |
| 3367 | peer = peer_lookup_vty (vty, ip_str); |
| 3368 | if (! peer) |
| 3369 | return CMD_WARNING; |
| 3370 | |
| 3371 | if (time_str) |
| 3372 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); |
| 3373 | |
| 3374 | if (set) |
| 3375 | ret = peer_advertise_interval_set (peer, routeadv); |
| 3376 | else |
| 3377 | ret = peer_advertise_interval_unset (peer); |
| 3378 | |
| 3379 | return CMD_SUCCESS; |
| 3380 | } |
| 3381 | |
| 3382 | DEFUN (neighbor_advertise_interval, |
| 3383 | neighbor_advertise_interval_cmd, |
| 3384 | NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3385 | NEIGHBOR_STR |
| 3386 | NEIGHBOR_ADDR_STR |
| 3387 | "Minimum interval between sending BGP routing updates\n" |
| 3388 | "time in seconds\n") |
| 3389 | { |
| 3390 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); |
| 3391 | } |
| 3392 | |
| 3393 | DEFUN (no_neighbor_advertise_interval, |
| 3394 | no_neighbor_advertise_interval_cmd, |
| 3395 | NO_NEIGHBOR_CMD "advertisement-interval", |
| 3396 | NO_STR |
| 3397 | NEIGHBOR_STR |
| 3398 | NEIGHBOR_ADDR_STR |
| 3399 | "Minimum interval between sending BGP routing updates\n") |
| 3400 | { |
| 3401 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); |
| 3402 | } |
| 3403 | |
| 3404 | ALIAS (no_neighbor_advertise_interval, |
| 3405 | no_neighbor_advertise_interval_val_cmd, |
| 3406 | NO_NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3407 | NO_STR |
| 3408 | NEIGHBOR_STR |
| 3409 | NEIGHBOR_ADDR_STR |
| 3410 | "Minimum interval between sending BGP routing updates\n" |
| 3411 | "time in seconds\n") |
| 3412 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3413 | /* neighbor interface */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3414 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3415 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3416 | { |
| 3417 | int ret; |
| 3418 | struct peer *peer; |
| 3419 | |
| 3420 | peer = peer_lookup_vty (vty, ip_str); |
| 3421 | if (! peer) |
| 3422 | return CMD_WARNING; |
| 3423 | |
| 3424 | if (str) |
| 3425 | ret = peer_interface_set (peer, str); |
| 3426 | else |
| 3427 | ret = peer_interface_unset (peer); |
| 3428 | |
| 3429 | return CMD_SUCCESS; |
| 3430 | } |
| 3431 | |
| 3432 | DEFUN (neighbor_interface, |
| 3433 | neighbor_interface_cmd, |
| 3434 | NEIGHBOR_CMD "interface WORD", |
| 3435 | NEIGHBOR_STR |
| 3436 | NEIGHBOR_ADDR_STR |
| 3437 | "Interface\n" |
| 3438 | "Interface name\n") |
| 3439 | { |
| 3440 | return peer_interface_vty (vty, argv[0], argv[1]); |
| 3441 | } |
| 3442 | |
| 3443 | DEFUN (no_neighbor_interface, |
| 3444 | no_neighbor_interface_cmd, |
| 3445 | NO_NEIGHBOR_CMD "interface WORD", |
| 3446 | NO_STR |
| 3447 | NEIGHBOR_STR |
| 3448 | NEIGHBOR_ADDR_STR |
| 3449 | "Interface\n" |
| 3450 | "Interface name\n") |
| 3451 | { |
| 3452 | return peer_interface_vty (vty, argv[0], NULL); |
| 3453 | } |
| 3454 | |
| 3455 | /* Set distribute list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3456 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3457 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
| 3458 | afi_t afi, safi_t safi, |
| 3459 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3460 | { |
| 3461 | int ret; |
| 3462 | struct peer *peer; |
| 3463 | int direct = FILTER_IN; |
| 3464 | |
| 3465 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3466 | if (! peer) |
| 3467 | return CMD_WARNING; |
| 3468 | |
| 3469 | /* Check filter direction. */ |
| 3470 | if (strncmp (direct_str, "i", 1) == 0) |
| 3471 | direct = FILTER_IN; |
| 3472 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3473 | direct = FILTER_OUT; |
| 3474 | |
| 3475 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); |
| 3476 | |
| 3477 | return bgp_vty_return (vty, ret); |
| 3478 | } |
| 3479 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3480 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3481 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3482 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3483 | { |
| 3484 | int ret; |
| 3485 | struct peer *peer; |
| 3486 | int direct = FILTER_IN; |
| 3487 | |
| 3488 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3489 | if (! peer) |
| 3490 | return CMD_WARNING; |
| 3491 | |
| 3492 | /* Check filter direction. */ |
| 3493 | if (strncmp (direct_str, "i", 1) == 0) |
| 3494 | direct = FILTER_IN; |
| 3495 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3496 | direct = FILTER_OUT; |
| 3497 | |
| 3498 | ret = peer_distribute_unset (peer, afi, safi, direct); |
| 3499 | |
| 3500 | return bgp_vty_return (vty, ret); |
| 3501 | } |
| 3502 | |
| 3503 | DEFUN (neighbor_distribute_list, |
| 3504 | neighbor_distribute_list_cmd, |
| 3505 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3506 | NEIGHBOR_STR |
| 3507 | NEIGHBOR_ADDR_STR2 |
| 3508 | "Filter updates to/from this neighbor\n" |
| 3509 | "IP access-list number\n" |
| 3510 | "IP access-list number (expanded range)\n" |
| 3511 | "IP Access-list name\n" |
| 3512 | "Filter incoming updates\n" |
| 3513 | "Filter outgoing updates\n") |
| 3514 | { |
| 3515 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3516 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3517 | } |
| 3518 | |
| 3519 | DEFUN (no_neighbor_distribute_list, |
| 3520 | no_neighbor_distribute_list_cmd, |
| 3521 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3522 | NO_STR |
| 3523 | NEIGHBOR_STR |
| 3524 | NEIGHBOR_ADDR_STR2 |
| 3525 | "Filter updates to/from this neighbor\n" |
| 3526 | "IP access-list number\n" |
| 3527 | "IP access-list number (expanded range)\n" |
| 3528 | "IP Access-list name\n" |
| 3529 | "Filter incoming updates\n" |
| 3530 | "Filter outgoing updates\n") |
| 3531 | { |
| 3532 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3533 | bgp_node_safi (vty), argv[2]); |
| 3534 | } |
| 3535 | |
| 3536 | /* Set prefix list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3537 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3538 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3539 | safi_t safi, const char *name_str, |
| 3540 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3541 | { |
| 3542 | int ret; |
| 3543 | struct peer *peer; |
| 3544 | int direct = FILTER_IN; |
| 3545 | |
| 3546 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3547 | if (! peer) |
| 3548 | return CMD_WARNING; |
| 3549 | |
| 3550 | /* Check filter direction. */ |
| 3551 | if (strncmp (direct_str, "i", 1) == 0) |
| 3552 | direct = FILTER_IN; |
| 3553 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3554 | direct = FILTER_OUT; |
| 3555 | |
| 3556 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); |
| 3557 | |
| 3558 | return bgp_vty_return (vty, ret); |
| 3559 | } |
| 3560 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3561 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3562 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3563 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3564 | { |
| 3565 | int ret; |
| 3566 | struct peer *peer; |
| 3567 | int direct = FILTER_IN; |
| 3568 | |
| 3569 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3570 | if (! peer) |
| 3571 | return CMD_WARNING; |
| 3572 | |
| 3573 | /* Check filter direction. */ |
| 3574 | if (strncmp (direct_str, "i", 1) == 0) |
| 3575 | direct = FILTER_IN; |
| 3576 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3577 | direct = FILTER_OUT; |
| 3578 | |
| 3579 | ret = peer_prefix_list_unset (peer, afi, safi, direct); |
| 3580 | |
| 3581 | return bgp_vty_return (vty, ret); |
| 3582 | } |
| 3583 | |
| 3584 | DEFUN (neighbor_prefix_list, |
| 3585 | neighbor_prefix_list_cmd, |
| 3586 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3587 | NEIGHBOR_STR |
| 3588 | NEIGHBOR_ADDR_STR2 |
| 3589 | "Filter updates to/from this neighbor\n" |
| 3590 | "Name of a prefix list\n" |
| 3591 | "Filter incoming updates\n" |
| 3592 | "Filter outgoing updates\n") |
| 3593 | { |
| 3594 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3595 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3596 | } |
| 3597 | |
| 3598 | DEFUN (no_neighbor_prefix_list, |
| 3599 | no_neighbor_prefix_list_cmd, |
| 3600 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3601 | NO_STR |
| 3602 | NEIGHBOR_STR |
| 3603 | NEIGHBOR_ADDR_STR2 |
| 3604 | "Filter updates to/from this neighbor\n" |
| 3605 | "Name of a prefix list\n" |
| 3606 | "Filter incoming updates\n" |
| 3607 | "Filter outgoing updates\n") |
| 3608 | { |
| 3609 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3610 | bgp_node_safi (vty), argv[2]); |
| 3611 | } |
| 3612 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3613 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3614 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
| 3615 | afi_t afi, safi_t safi, |
| 3616 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3617 | { |
| 3618 | int ret; |
| 3619 | struct peer *peer; |
| 3620 | int direct = FILTER_IN; |
| 3621 | |
| 3622 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3623 | if (! peer) |
| 3624 | return CMD_WARNING; |
| 3625 | |
| 3626 | /* Check filter direction. */ |
| 3627 | if (strncmp (direct_str, "i", 1) == 0) |
| 3628 | direct = FILTER_IN; |
| 3629 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3630 | direct = FILTER_OUT; |
| 3631 | |
| 3632 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); |
| 3633 | |
| 3634 | return bgp_vty_return (vty, ret); |
| 3635 | } |
| 3636 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3637 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3638 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
| 3639 | afi_t afi, safi_t safi, |
| 3640 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3641 | { |
| 3642 | int ret; |
| 3643 | struct peer *peer; |
| 3644 | int direct = FILTER_IN; |
| 3645 | |
| 3646 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3647 | if (! peer) |
| 3648 | return CMD_WARNING; |
| 3649 | |
| 3650 | /* Check filter direction. */ |
| 3651 | if (strncmp (direct_str, "i", 1) == 0) |
| 3652 | direct = FILTER_IN; |
| 3653 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3654 | direct = FILTER_OUT; |
| 3655 | |
| 3656 | ret = peer_aslist_unset (peer, afi, safi, direct); |
| 3657 | |
| 3658 | return bgp_vty_return (vty, ret); |
| 3659 | } |
| 3660 | |
| 3661 | DEFUN (neighbor_filter_list, |
| 3662 | neighbor_filter_list_cmd, |
| 3663 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3664 | NEIGHBOR_STR |
| 3665 | NEIGHBOR_ADDR_STR2 |
| 3666 | "Establish BGP filters\n" |
| 3667 | "AS path access-list name\n" |
| 3668 | "Filter incoming routes\n" |
| 3669 | "Filter outgoing routes\n") |
| 3670 | { |
| 3671 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3672 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3673 | } |
| 3674 | |
| 3675 | DEFUN (no_neighbor_filter_list, |
| 3676 | no_neighbor_filter_list_cmd, |
| 3677 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3678 | NO_STR |
| 3679 | NEIGHBOR_STR |
| 3680 | NEIGHBOR_ADDR_STR2 |
| 3681 | "Establish BGP filters\n" |
| 3682 | "AS path access-list name\n" |
| 3683 | "Filter incoming routes\n" |
| 3684 | "Filter outgoing routes\n") |
| 3685 | { |
| 3686 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3687 | bgp_node_safi (vty), argv[2]); |
| 3688 | } |
| 3689 | |
| 3690 | /* Set route-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3691 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3692 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
| 3693 | afi_t afi, safi_t safi, |
| 3694 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3695 | { |
| 3696 | int ret; |
| 3697 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3698 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3699 | |
| 3700 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3701 | if (! peer) |
| 3702 | return CMD_WARNING; |
| 3703 | |
| 3704 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3705 | if (strncmp (direct_str, "in", 2) == 0) |
| 3706 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3707 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3708 | direct = RMAP_OUT; |
| 3709 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3710 | direct = RMAP_IMPORT; |
| 3711 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3712 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3713 | |
| 3714 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); |
| 3715 | |
| 3716 | return bgp_vty_return (vty, ret); |
| 3717 | } |
| 3718 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3719 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3720 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3721 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3722 | { |
| 3723 | int ret; |
| 3724 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3725 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3726 | |
| 3727 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3728 | if (! peer) |
| 3729 | return CMD_WARNING; |
| 3730 | |
| 3731 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3732 | if (strncmp (direct_str, "in", 2) == 0) |
| 3733 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3734 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3735 | direct = RMAP_OUT; |
| 3736 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3737 | direct = RMAP_IMPORT; |
| 3738 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3739 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3740 | |
| 3741 | ret = peer_route_map_unset (peer, afi, safi, direct); |
| 3742 | |
| 3743 | return bgp_vty_return (vty, ret); |
| 3744 | } |
| 3745 | |
| 3746 | DEFUN (neighbor_route_map, |
| 3747 | neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3748 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3749 | NEIGHBOR_STR |
| 3750 | NEIGHBOR_ADDR_STR2 |
| 3751 | "Apply route map to neighbor\n" |
| 3752 | "Name of route map\n" |
| 3753 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3754 | "Apply map to outbound routes\n" |
| 3755 | "Apply map to routes going into a Route-Server client's table\n" |
| 3756 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3757 | { |
| 3758 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3759 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3760 | } |
| 3761 | |
| 3762 | DEFUN (no_neighbor_route_map, |
| 3763 | no_neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3764 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3765 | NO_STR |
| 3766 | NEIGHBOR_STR |
| 3767 | NEIGHBOR_ADDR_STR2 |
| 3768 | "Apply route map to neighbor\n" |
| 3769 | "Name of route map\n" |
| 3770 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3771 | "Apply map to outbound routes\n" |
| 3772 | "Apply map to routes going into a Route-Server client's table\n" |
| 3773 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3774 | { |
| 3775 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3776 | bgp_node_safi (vty), argv[2]); |
| 3777 | } |
| 3778 | |
| 3779 | /* Set unsuppress-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3780 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3781 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3782 | safi_t safi, const char *name_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3783 | { |
| 3784 | int ret; |
| 3785 | struct peer *peer; |
| 3786 | |
| 3787 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3788 | if (! peer) |
| 3789 | return CMD_WARNING; |
| 3790 | |
| 3791 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); |
| 3792 | |
| 3793 | return bgp_vty_return (vty, ret); |
| 3794 | } |
| 3795 | |
| 3796 | /* Unset route-map from the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3797 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3798 | 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] | 3799 | safi_t safi) |
| 3800 | { |
| 3801 | int ret; |
| 3802 | struct peer *peer; |
| 3803 | |
| 3804 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3805 | if (! peer) |
| 3806 | return CMD_WARNING; |
| 3807 | |
| 3808 | ret = peer_unsuppress_map_unset (peer, afi, safi); |
| 3809 | |
| 3810 | return bgp_vty_return (vty, ret); |
| 3811 | } |
| 3812 | |
| 3813 | DEFUN (neighbor_unsuppress_map, |
| 3814 | neighbor_unsuppress_map_cmd, |
| 3815 | NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3816 | NEIGHBOR_STR |
| 3817 | NEIGHBOR_ADDR_STR2 |
| 3818 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3819 | "Name of route map\n") |
| 3820 | { |
| 3821 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3822 | bgp_node_safi (vty), argv[1]); |
| 3823 | } |
| 3824 | |
| 3825 | DEFUN (no_neighbor_unsuppress_map, |
| 3826 | no_neighbor_unsuppress_map_cmd, |
| 3827 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3828 | NO_STR |
| 3829 | NEIGHBOR_STR |
| 3830 | NEIGHBOR_ADDR_STR2 |
| 3831 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3832 | "Name of route map\n") |
| 3833 | { |
| 3834 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3835 | bgp_node_safi (vty)); |
| 3836 | } |
| 3837 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3838 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3839 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3840 | safi_t safi, const char *num_str, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3841 | const char *threshold_str, int warning, |
| 3842 | const char *restart_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3843 | { |
| 3844 | int ret; |
| 3845 | struct peer *peer; |
| 3846 | u_int32_t max; |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3847 | u_char threshold; |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3848 | u_int16_t restart; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3849 | |
| 3850 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3851 | if (! peer) |
| 3852 | return CMD_WARNING; |
| 3853 | |
Denis Ovsienko | e6ec1c3 | 2011-09-10 21:50:53 +0400 | [diff] [blame] | 3854 | VTY_GET_INTEGER ("maximum number", max, num_str); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3855 | if (threshold_str) |
| 3856 | threshold = atoi (threshold_str); |
| 3857 | else |
| 3858 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3859 | |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3860 | if (restart_str) |
| 3861 | restart = atoi (restart_str); |
| 3862 | else |
| 3863 | restart = 0; |
| 3864 | |
| 3865 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3866 | |
| 3867 | return bgp_vty_return (vty, ret); |
| 3868 | } |
| 3869 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3870 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3871 | 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] | 3872 | safi_t safi) |
| 3873 | { |
| 3874 | int ret; |
| 3875 | struct peer *peer; |
| 3876 | |
| 3877 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3878 | if (! peer) |
| 3879 | return CMD_WARNING; |
| 3880 | |
| 3881 | ret = peer_maximum_prefix_unset (peer, afi, safi); |
| 3882 | |
| 3883 | return bgp_vty_return (vty, ret); |
| 3884 | } |
| 3885 | |
| 3886 | /* Maximum number of prefix configuration. prefix count is different |
| 3887 | for each peer configuration. So this configuration can be set for |
| 3888 | each peer configuration. */ |
| 3889 | DEFUN (neighbor_maximum_prefix, |
| 3890 | neighbor_maximum_prefix_cmd, |
| 3891 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3892 | NEIGHBOR_STR |
| 3893 | NEIGHBOR_ADDR_STR2 |
| 3894 | "Maximum number of prefix accept from this peer\n" |
| 3895 | "maximum no. of prefix limit\n") |
| 3896 | { |
| 3897 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3898 | bgp_node_safi (vty), argv[1], NULL, 0, |
| 3899 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3900 | } |
| 3901 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3902 | DEFUN (neighbor_maximum_prefix_threshold, |
| 3903 | neighbor_maximum_prefix_threshold_cmd, |
| 3904 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", |
| 3905 | NEIGHBOR_STR |
| 3906 | NEIGHBOR_ADDR_STR2 |
| 3907 | "Maximum number of prefix accept from this peer\n" |
| 3908 | "maximum no. of prefix limit\n" |
| 3909 | "Threshold value (%) at which to generate a warning msg\n") |
| 3910 | { |
| 3911 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3912 | bgp_node_safi (vty), argv[1], argv[2], 0, |
| 3913 | NULL); |
| 3914 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3915 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3916 | DEFUN (neighbor_maximum_prefix_warning, |
| 3917 | neighbor_maximum_prefix_warning_cmd, |
| 3918 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3919 | NEIGHBOR_STR |
| 3920 | NEIGHBOR_ADDR_STR2 |
| 3921 | "Maximum number of prefix accept from this peer\n" |
| 3922 | "maximum no. of prefix limit\n" |
| 3923 | "Only give warning message when limit is exceeded\n") |
| 3924 | { |
| 3925 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3926 | bgp_node_safi (vty), argv[1], NULL, 1, |
| 3927 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3928 | } |
| 3929 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3930 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
| 3931 | neighbor_maximum_prefix_threshold_warning_cmd, |
| 3932 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 3933 | NEIGHBOR_STR |
| 3934 | NEIGHBOR_ADDR_STR2 |
| 3935 | "Maximum number of prefix accept from this peer\n" |
| 3936 | "maximum no. of prefix limit\n" |
| 3937 | "Threshold value (%) at which to generate a warning msg\n" |
| 3938 | "Only give warning message when limit is exceeded\n") |
| 3939 | { |
| 3940 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3941 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
| 3942 | } |
| 3943 | |
| 3944 | DEFUN (neighbor_maximum_prefix_restart, |
| 3945 | neighbor_maximum_prefix_restart_cmd, |
| 3946 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
| 3947 | NEIGHBOR_STR |
| 3948 | NEIGHBOR_ADDR_STR2 |
| 3949 | "Maximum number of prefix accept from this peer\n" |
| 3950 | "maximum no. of prefix limit\n" |
| 3951 | "Restart bgp connection after limit is exceeded\n" |
| 3952 | "Restart interval in minutes") |
| 3953 | { |
| 3954 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3955 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); |
| 3956 | } |
| 3957 | |
| 3958 | DEFUN (neighbor_maximum_prefix_threshold_restart, |
| 3959 | neighbor_maximum_prefix_threshold_restart_cmd, |
| 3960 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 3961 | NEIGHBOR_STR |
| 3962 | NEIGHBOR_ADDR_STR2 |
| 3963 | "Maximum number of prefix accept from this peer\n" |
| 3964 | "maximum no. of prefix limit\n" |
| 3965 | "Threshold value (%) at which to generate a warning msg\n" |
| 3966 | "Restart bgp connection after limit is exceeded\n" |
| 3967 | "Restart interval in minutes") |
| 3968 | { |
| 3969 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3970 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); |
| 3971 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3972 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3973 | DEFUN (no_neighbor_maximum_prefix, |
| 3974 | no_neighbor_maximum_prefix_cmd, |
| 3975 | NO_NEIGHBOR_CMD2 "maximum-prefix", |
| 3976 | NO_STR |
| 3977 | NEIGHBOR_STR |
| 3978 | NEIGHBOR_ADDR_STR2 |
| 3979 | "Maximum number of prefix accept from this peer\n") |
| 3980 | { |
| 3981 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3982 | bgp_node_safi (vty)); |
| 3983 | } |
| 3984 | |
| 3985 | ALIAS (no_neighbor_maximum_prefix, |
| 3986 | no_neighbor_maximum_prefix_val_cmd, |
| 3987 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3988 | NO_STR |
| 3989 | NEIGHBOR_STR |
| 3990 | NEIGHBOR_ADDR_STR2 |
| 3991 | "Maximum number of prefix accept from this peer\n" |
| 3992 | "maximum no. of prefix limit\n") |
| 3993 | |
| 3994 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3995 | no_neighbor_maximum_prefix_threshold_cmd, |
| 3996 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3997 | NO_STR |
| 3998 | NEIGHBOR_STR |
| 3999 | NEIGHBOR_ADDR_STR2 |
| 4000 | "Maximum number of prefix accept from this peer\n" |
| 4001 | "maximum no. of prefix limit\n" |
| 4002 | "Threshold value (%) at which to generate a warning msg\n") |
| 4003 | |
| 4004 | ALIAS (no_neighbor_maximum_prefix, |
| 4005 | no_neighbor_maximum_prefix_warning_cmd, |
| 4006 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 4007 | NO_STR |
| 4008 | NEIGHBOR_STR |
| 4009 | NEIGHBOR_ADDR_STR2 |
| 4010 | "Maximum number of prefix accept from this peer\n" |
| 4011 | "maximum no. of prefix limit\n" |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 4012 | "Only give warning message when limit is exceeded\n") |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4013 | |
| 4014 | ALIAS (no_neighbor_maximum_prefix, |
| 4015 | no_neighbor_maximum_prefix_threshold_warning_cmd, |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 4016 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 4017 | NO_STR |
| 4018 | NEIGHBOR_STR |
| 4019 | NEIGHBOR_ADDR_STR2 |
| 4020 | "Maximum number of prefix accept from this peer\n" |
| 4021 | "maximum no. of prefix limit\n" |
| 4022 | "Threshold value (%) at which to generate a warning msg\n" |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 4023 | "Only give warning message when limit is exceeded\n") |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 4024 | |
| 4025 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4026 | no_neighbor_maximum_prefix_restart_cmd, |
| 4027 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4028 | NO_STR |
| 4029 | NEIGHBOR_STR |
| 4030 | NEIGHBOR_ADDR_STR2 |
| 4031 | "Maximum number of prefix accept from this peer\n" |
| 4032 | "maximum no. of prefix limit\n" |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4033 | "Restart bgp connection after limit is exceeded\n" |
| 4034 | "Restart interval in minutes") |
| 4035 | |
| 4036 | ALIAS (no_neighbor_maximum_prefix, |
| 4037 | no_neighbor_maximum_prefix_threshold_restart_cmd, |
| 4038 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 4039 | NO_STR |
| 4040 | NEIGHBOR_STR |
| 4041 | NEIGHBOR_ADDR_STR2 |
| 4042 | "Maximum number of prefix accept from this peer\n" |
| 4043 | "maximum no. of prefix limit\n" |
| 4044 | "Threshold value (%) at which to generate a warning msg\n" |
| 4045 | "Restart bgp connection after limit is exceeded\n" |
| 4046 | "Restart interval in minutes") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4047 | |
| 4048 | /* "neighbor allowas-in" */ |
| 4049 | DEFUN (neighbor_allowas_in, |
| 4050 | neighbor_allowas_in_cmd, |
| 4051 | NEIGHBOR_CMD2 "allowas-in", |
| 4052 | NEIGHBOR_STR |
| 4053 | NEIGHBOR_ADDR_STR2 |
| 4054 | "Accept as-path with my AS present in it\n") |
| 4055 | { |
| 4056 | int ret; |
| 4057 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4058 | unsigned int allow_num; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4059 | |
| 4060 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4061 | if (! peer) |
| 4062 | return CMD_WARNING; |
| 4063 | |
| 4064 | if (argc == 1) |
| 4065 | allow_num = 3; |
| 4066 | else |
| 4067 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); |
| 4068 | |
| 4069 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), |
| 4070 | allow_num); |
| 4071 | |
| 4072 | return bgp_vty_return (vty, ret); |
| 4073 | } |
| 4074 | |
| 4075 | ALIAS (neighbor_allowas_in, |
| 4076 | neighbor_allowas_in_arg_cmd, |
| 4077 | NEIGHBOR_CMD2 "allowas-in <1-10>", |
| 4078 | NEIGHBOR_STR |
| 4079 | NEIGHBOR_ADDR_STR2 |
| 4080 | "Accept as-path with my AS present in it\n" |
| 4081 | "Number of occurances of AS number\n") |
| 4082 | |
| 4083 | DEFUN (no_neighbor_allowas_in, |
| 4084 | no_neighbor_allowas_in_cmd, |
| 4085 | NO_NEIGHBOR_CMD2 "allowas-in", |
| 4086 | NO_STR |
| 4087 | NEIGHBOR_STR |
| 4088 | NEIGHBOR_ADDR_STR2 |
| 4089 | "allow local ASN appears in aspath attribute\n") |
| 4090 | { |
| 4091 | int ret; |
| 4092 | struct peer *peer; |
| 4093 | |
| 4094 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4095 | if (! peer) |
| 4096 | return CMD_WARNING; |
| 4097 | |
| 4098 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 4099 | |
| 4100 | return bgp_vty_return (vty, ret); |
| 4101 | } |
| 4102 | |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4103 | DEFUN (neighbor_ttl_security, |
| 4104 | neighbor_ttl_security_cmd, |
| 4105 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", |
| 4106 | NEIGHBOR_STR |
| 4107 | NEIGHBOR_ADDR_STR2 |
| 4108 | "Specify the maximum number of hops to the BGP peer\n") |
| 4109 | { |
| 4110 | struct peer *peer; |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 4111 | int gtsm_hops; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4112 | |
| 4113 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4114 | if (! peer) |
| 4115 | return CMD_WARNING; |
| 4116 | |
| 4117 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); |
| 4118 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 4119 | return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops)); |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4120 | } |
| 4121 | |
| 4122 | DEFUN (no_neighbor_ttl_security, |
| 4123 | no_neighbor_ttl_security_cmd, |
| 4124 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", |
| 4125 | NO_STR |
| 4126 | NEIGHBOR_STR |
| 4127 | NEIGHBOR_ADDR_STR2 |
| 4128 | "Specify the maximum number of hops to the BGP peer\n") |
| 4129 | { |
| 4130 | struct peer *peer; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4131 | |
| 4132 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4133 | if (! peer) |
| 4134 | return CMD_WARNING; |
| 4135 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 4136 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4137 | } |
| 4138 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4139 | /* Address family configuration. */ |
| 4140 | DEFUN (address_family_ipv4, |
| 4141 | address_family_ipv4_cmd, |
| 4142 | "address-family ipv4", |
| 4143 | "Enter Address Family command mode\n" |
| 4144 | "Address family\n") |
| 4145 | { |
| 4146 | vty->node = BGP_IPV4_NODE; |
| 4147 | return CMD_SUCCESS; |
| 4148 | } |
| 4149 | |
| 4150 | DEFUN (address_family_ipv4_safi, |
| 4151 | address_family_ipv4_safi_cmd, |
| 4152 | "address-family ipv4 (unicast|multicast)", |
| 4153 | "Enter Address Family command mode\n" |
| 4154 | "Address family\n" |
| 4155 | "Address Family modifier\n" |
| 4156 | "Address Family modifier\n") |
| 4157 | { |
| 4158 | if (strncmp (argv[0], "m", 1) == 0) |
| 4159 | vty->node = BGP_IPV4M_NODE; |
| 4160 | else |
| 4161 | vty->node = BGP_IPV4_NODE; |
| 4162 | |
| 4163 | return CMD_SUCCESS; |
| 4164 | } |
| 4165 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4166 | DEFUN (address_family_ipv6, |
| 4167 | address_family_ipv6_cmd, |
| 4168 | "address-family ipv6", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4169 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4170 | "Address family\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4171 | { |
| 4172 | vty->node = BGP_IPV6_NODE; |
| 4173 | return CMD_SUCCESS; |
| 4174 | } |
| 4175 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4176 | DEFUN (address_family_ipv6_safi, |
| 4177 | address_family_ipv6_safi_cmd, |
| 4178 | "address-family ipv6 (unicast|multicast)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4179 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4180 | "Address family\n" |
| 4181 | "Address Family modifier\n" |
| 4182 | "Address Family modifier\n") |
| 4183 | { |
| 4184 | if (strncmp (argv[0], "m", 1) == 0) |
| 4185 | vty->node = BGP_IPV6M_NODE; |
| 4186 | else |
| 4187 | vty->node = BGP_IPV6_NODE; |
| 4188 | |
| 4189 | return CMD_SUCCESS; |
| 4190 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4191 | |
| 4192 | DEFUN (address_family_vpnv4, |
| 4193 | address_family_vpnv4_cmd, |
| 4194 | "address-family vpnv4", |
| 4195 | "Enter Address Family command mode\n" |
| 4196 | "Address family\n") |
| 4197 | { |
| 4198 | vty->node = BGP_VPNV4_NODE; |
| 4199 | return CMD_SUCCESS; |
| 4200 | } |
| 4201 | |
| 4202 | ALIAS (address_family_vpnv4, |
| 4203 | address_family_vpnv4_unicast_cmd, |
| 4204 | "address-family vpnv4 unicast", |
| 4205 | "Enter Address Family command mode\n" |
| 4206 | "Address family\n" |
| 4207 | "Address Family Modifier\n") |
| 4208 | |
| 4209 | DEFUN (exit_address_family, |
| 4210 | exit_address_family_cmd, |
| 4211 | "exit-address-family", |
| 4212 | "Exit from Address Family configuration mode\n") |
| 4213 | { |
hasso | a8a80d5 | 2005-04-09 13:07:47 +0000 | [diff] [blame] | 4214 | if (vty->node == BGP_IPV4_NODE |
| 4215 | || vty->node == BGP_IPV4M_NODE |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4216 | || vty->node == BGP_VPNV4_NODE |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4217 | || vty->node == BGP_IPV6_NODE |
| 4218 | || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4219 | vty->node = BGP_NODE; |
| 4220 | return CMD_SUCCESS; |
| 4221 | } |
| 4222 | |
| 4223 | /* BGP clear sort. */ |
| 4224 | enum clear_sort |
| 4225 | { |
| 4226 | clear_all, |
| 4227 | clear_peer, |
| 4228 | clear_group, |
| 4229 | clear_external, |
| 4230 | clear_as |
| 4231 | }; |
| 4232 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4233 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4234 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
| 4235 | safi_t safi, int error) |
| 4236 | { |
| 4237 | switch (error) |
| 4238 | { |
| 4239 | case BGP_ERR_AF_UNCONFIGURED: |
| 4240 | vty_out (vty, |
| 4241 | "%%BGP: Enable %s %s address family for the neighbor %s%s", |
| 4242 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", |
| 4243 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", |
| 4244 | peer->host, VTY_NEWLINE); |
| 4245 | break; |
| 4246 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: |
| 4247 | 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); |
| 4248 | break; |
| 4249 | default: |
| 4250 | break; |
| 4251 | } |
| 4252 | } |
| 4253 | |
| 4254 | /* `clear ip bgp' functions. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4255 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4256 | 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] | 4257 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4258 | { |
| 4259 | int ret; |
| 4260 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4261 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4262 | |
| 4263 | /* Clear all neighbors. */ |
| 4264 | if (sort == clear_all) |
| 4265 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4266 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4267 | { |
| 4268 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4269 | ret = peer_clear (peer); |
| 4270 | else |
| 4271 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4272 | |
| 4273 | if (ret < 0) |
| 4274 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4275 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4276 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4277 | } |
| 4278 | |
| 4279 | /* Clear specified neighbors. */ |
| 4280 | if (sort == clear_peer) |
| 4281 | { |
| 4282 | union sockunion su; |
| 4283 | int ret; |
| 4284 | |
| 4285 | /* Make sockunion for lookup. */ |
| 4286 | ret = str2sockunion (arg, &su); |
| 4287 | if (ret < 0) |
| 4288 | { |
| 4289 | vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4290 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4291 | } |
| 4292 | peer = peer_lookup (bgp, &su); |
| 4293 | if (! peer) |
| 4294 | { |
| 4295 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4296 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4297 | } |
| 4298 | |
| 4299 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4300 | ret = peer_clear (peer); |
| 4301 | else |
| 4302 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4303 | |
| 4304 | if (ret < 0) |
| 4305 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4306 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4307 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4308 | } |
| 4309 | |
| 4310 | /* Clear all peer-group members. */ |
| 4311 | if (sort == clear_group) |
| 4312 | { |
| 4313 | struct peer_group *group; |
| 4314 | |
| 4315 | group = peer_group_lookup (bgp, arg); |
| 4316 | if (! group) |
| 4317 | { |
| 4318 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4319 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4320 | } |
| 4321 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4322 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4323 | { |
| 4324 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4325 | { |
| 4326 | ret = peer_clear (peer); |
| 4327 | continue; |
| 4328 | } |
| 4329 | |
| 4330 | if (! peer->af_group[afi][safi]) |
| 4331 | continue; |
| 4332 | |
| 4333 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4334 | |
| 4335 | if (ret < 0) |
| 4336 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4337 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4338 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4339 | } |
| 4340 | |
| 4341 | if (sort == clear_external) |
| 4342 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4343 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4344 | { |
| 4345 | if (peer_sort (peer) == BGP_PEER_IBGP) |
| 4346 | continue; |
| 4347 | |
| 4348 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4349 | ret = peer_clear (peer); |
| 4350 | else |
| 4351 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4352 | |
| 4353 | if (ret < 0) |
| 4354 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4355 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4356 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4357 | } |
| 4358 | |
| 4359 | if (sort == clear_as) |
| 4360 | { |
| 4361 | as_t as; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4362 | int find = 0; |
| 4363 | |
Ulrich Weber | bde12e3 | 2011-11-16 19:32:12 +0400 | [diff] [blame] | 4364 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4365 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4366 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4367 | { |
| 4368 | if (peer->as != as) |
| 4369 | continue; |
| 4370 | |
| 4371 | find = 1; |
| 4372 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4373 | ret = peer_clear (peer); |
| 4374 | else |
| 4375 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4376 | |
| 4377 | if (ret < 0) |
| 4378 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4379 | } |
| 4380 | if (! find) |
| 4381 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, |
| 4382 | VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4383 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4384 | } |
| 4385 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4386 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4387 | } |
| 4388 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4389 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4390 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
| 4391 | enum clear_sort sort, enum bgp_clear_type stype, |
| 4392 | const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4393 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4394 | struct bgp *bgp; |
| 4395 | |
| 4396 | /* BGP structure lookup. */ |
| 4397 | if (name) |
| 4398 | { |
| 4399 | bgp = bgp_lookup_by_name (name); |
| 4400 | if (bgp == NULL) |
| 4401 | { |
| 4402 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); |
| 4403 | return CMD_WARNING; |
| 4404 | } |
| 4405 | } |
| 4406 | else |
| 4407 | { |
| 4408 | bgp = bgp_get_default (); |
| 4409 | if (bgp == NULL) |
| 4410 | { |
| 4411 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); |
| 4412 | return CMD_WARNING; |
| 4413 | } |
| 4414 | } |
| 4415 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4416 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4417 | } |
| 4418 | |
| 4419 | DEFUN (clear_ip_bgp_all, |
| 4420 | clear_ip_bgp_all_cmd, |
| 4421 | "clear ip bgp *", |
| 4422 | CLEAR_STR |
| 4423 | IP_STR |
| 4424 | BGP_STR |
| 4425 | "Clear all peers\n") |
| 4426 | { |
| 4427 | if (argc == 1) |
| 4428 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4429 | |
| 4430 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4431 | } |
| 4432 | |
| 4433 | ALIAS (clear_ip_bgp_all, |
| 4434 | clear_bgp_all_cmd, |
| 4435 | "clear bgp *", |
| 4436 | CLEAR_STR |
| 4437 | BGP_STR |
| 4438 | "Clear all peers\n") |
| 4439 | |
| 4440 | ALIAS (clear_ip_bgp_all, |
| 4441 | clear_bgp_ipv6_all_cmd, |
| 4442 | "clear bgp ipv6 *", |
| 4443 | CLEAR_STR |
| 4444 | BGP_STR |
| 4445 | "Address family\n" |
| 4446 | "Clear all peers\n") |
| 4447 | |
| 4448 | ALIAS (clear_ip_bgp_all, |
| 4449 | clear_ip_bgp_instance_all_cmd, |
| 4450 | "clear ip bgp view WORD *", |
| 4451 | CLEAR_STR |
| 4452 | IP_STR |
| 4453 | BGP_STR |
| 4454 | "BGP view\n" |
| 4455 | "view name\n" |
| 4456 | "Clear all peers\n") |
| 4457 | |
| 4458 | ALIAS (clear_ip_bgp_all, |
| 4459 | clear_bgp_instance_all_cmd, |
| 4460 | "clear bgp view WORD *", |
| 4461 | CLEAR_STR |
| 4462 | BGP_STR |
| 4463 | "BGP view\n" |
| 4464 | "view name\n" |
| 4465 | "Clear all peers\n") |
| 4466 | |
| 4467 | DEFUN (clear_ip_bgp_peer, |
| 4468 | clear_ip_bgp_peer_cmd, |
| 4469 | "clear ip bgp (A.B.C.D|X:X::X:X)", |
| 4470 | CLEAR_STR |
| 4471 | IP_STR |
| 4472 | BGP_STR |
| 4473 | "BGP neighbor IP address to clear\n" |
| 4474 | "BGP IPv6 neighbor to clear\n") |
| 4475 | { |
| 4476 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4477 | } |
| 4478 | |
| 4479 | ALIAS (clear_ip_bgp_peer, |
| 4480 | clear_bgp_peer_cmd, |
| 4481 | "clear bgp (A.B.C.D|X:X::X:X)", |
| 4482 | CLEAR_STR |
| 4483 | BGP_STR |
| 4484 | "BGP neighbor address to clear\n" |
| 4485 | "BGP IPv6 neighbor to clear\n") |
| 4486 | |
| 4487 | ALIAS (clear_ip_bgp_peer, |
| 4488 | clear_bgp_ipv6_peer_cmd, |
| 4489 | "clear bgp ipv6 (A.B.C.D|X:X::X:X)", |
| 4490 | CLEAR_STR |
| 4491 | BGP_STR |
| 4492 | "Address family\n" |
| 4493 | "BGP neighbor address to clear\n" |
| 4494 | "BGP IPv6 neighbor to clear\n") |
| 4495 | |
| 4496 | DEFUN (clear_ip_bgp_peer_group, |
| 4497 | clear_ip_bgp_peer_group_cmd, |
| 4498 | "clear ip bgp peer-group WORD", |
| 4499 | CLEAR_STR |
| 4500 | IP_STR |
| 4501 | BGP_STR |
| 4502 | "Clear all members of peer-group\n" |
| 4503 | "BGP peer-group name\n") |
| 4504 | { |
| 4505 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4506 | } |
| 4507 | |
| 4508 | ALIAS (clear_ip_bgp_peer_group, |
| 4509 | clear_bgp_peer_group_cmd, |
| 4510 | "clear bgp peer-group WORD", |
| 4511 | CLEAR_STR |
| 4512 | BGP_STR |
| 4513 | "Clear all members of peer-group\n" |
| 4514 | "BGP peer-group name\n") |
| 4515 | |
| 4516 | ALIAS (clear_ip_bgp_peer_group, |
| 4517 | clear_bgp_ipv6_peer_group_cmd, |
| 4518 | "clear bgp ipv6 peer-group WORD", |
| 4519 | CLEAR_STR |
| 4520 | BGP_STR |
| 4521 | "Address family\n" |
| 4522 | "Clear all members of peer-group\n" |
| 4523 | "BGP peer-group name\n") |
| 4524 | |
| 4525 | DEFUN (clear_ip_bgp_external, |
| 4526 | clear_ip_bgp_external_cmd, |
| 4527 | "clear ip bgp external", |
| 4528 | CLEAR_STR |
| 4529 | IP_STR |
| 4530 | BGP_STR |
| 4531 | "Clear all external peers\n") |
| 4532 | { |
| 4533 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
| 4534 | } |
| 4535 | |
| 4536 | ALIAS (clear_ip_bgp_external, |
| 4537 | clear_bgp_external_cmd, |
| 4538 | "clear bgp external", |
| 4539 | CLEAR_STR |
| 4540 | BGP_STR |
| 4541 | "Clear all external peers\n") |
| 4542 | |
| 4543 | ALIAS (clear_ip_bgp_external, |
| 4544 | clear_bgp_ipv6_external_cmd, |
| 4545 | "clear bgp ipv6 external", |
| 4546 | CLEAR_STR |
| 4547 | BGP_STR |
| 4548 | "Address family\n" |
| 4549 | "Clear all external peers\n") |
| 4550 | |
| 4551 | DEFUN (clear_ip_bgp_as, |
| 4552 | clear_ip_bgp_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4553 | "clear ip bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4554 | CLEAR_STR |
| 4555 | IP_STR |
| 4556 | BGP_STR |
| 4557 | "Clear peers with the AS number\n") |
| 4558 | { |
| 4559 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4560 | } |
| 4561 | |
| 4562 | ALIAS (clear_ip_bgp_as, |
| 4563 | clear_bgp_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4564 | "clear bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4565 | CLEAR_STR |
| 4566 | BGP_STR |
| 4567 | "Clear peers with the AS number\n") |
| 4568 | |
| 4569 | ALIAS (clear_ip_bgp_as, |
| 4570 | clear_bgp_ipv6_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4571 | "clear bgp ipv6 " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4572 | CLEAR_STR |
| 4573 | BGP_STR |
| 4574 | "Address family\n" |
| 4575 | "Clear peers with the AS number\n") |
| 4576 | |
| 4577 | /* Outbound soft-reconfiguration */ |
| 4578 | DEFUN (clear_ip_bgp_all_soft_out, |
| 4579 | clear_ip_bgp_all_soft_out_cmd, |
| 4580 | "clear ip bgp * soft out", |
| 4581 | CLEAR_STR |
| 4582 | IP_STR |
| 4583 | BGP_STR |
| 4584 | "Clear all peers\n" |
| 4585 | "Soft reconfig\n" |
| 4586 | "Soft reconfig outbound update\n") |
| 4587 | { |
| 4588 | if (argc == 1) |
| 4589 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4590 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4591 | |
| 4592 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4593 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4594 | } |
| 4595 | |
| 4596 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4597 | clear_ip_bgp_all_out_cmd, |
| 4598 | "clear ip bgp * out", |
| 4599 | CLEAR_STR |
| 4600 | IP_STR |
| 4601 | BGP_STR |
| 4602 | "Clear all peers\n" |
| 4603 | "Soft reconfig outbound update\n") |
| 4604 | |
| 4605 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4606 | clear_ip_bgp_instance_all_soft_out_cmd, |
| 4607 | "clear ip bgp view WORD * soft out", |
| 4608 | CLEAR_STR |
| 4609 | IP_STR |
| 4610 | BGP_STR |
| 4611 | "BGP view\n" |
| 4612 | "view name\n" |
| 4613 | "Clear all peers\n" |
| 4614 | "Soft reconfig\n" |
| 4615 | "Soft reconfig outbound update\n") |
| 4616 | |
| 4617 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, |
| 4618 | clear_ip_bgp_all_ipv4_soft_out_cmd, |
| 4619 | "clear ip bgp * ipv4 (unicast|multicast) soft out", |
| 4620 | CLEAR_STR |
| 4621 | IP_STR |
| 4622 | BGP_STR |
| 4623 | "Clear all peers\n" |
| 4624 | "Address family\n" |
| 4625 | "Address Family modifier\n" |
| 4626 | "Address Family modifier\n" |
| 4627 | "Soft reconfig\n" |
| 4628 | "Soft reconfig outbound update\n") |
| 4629 | { |
| 4630 | if (strncmp (argv[0], "m", 1) == 0) |
| 4631 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 4632 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4633 | |
| 4634 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4635 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4636 | } |
| 4637 | |
| 4638 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, |
| 4639 | clear_ip_bgp_all_ipv4_out_cmd, |
| 4640 | "clear ip bgp * ipv4 (unicast|multicast) out", |
| 4641 | CLEAR_STR |
| 4642 | IP_STR |
| 4643 | BGP_STR |
| 4644 | "Clear all peers\n" |
| 4645 | "Address family\n" |
| 4646 | "Address Family modifier\n" |
| 4647 | "Address Family modifier\n" |
| 4648 | "Soft reconfig outbound update\n") |
| 4649 | |
| 4650 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
| 4651 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, |
| 4652 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", |
| 4653 | CLEAR_STR |
| 4654 | IP_STR |
| 4655 | BGP_STR |
| 4656 | "BGP view\n" |
| 4657 | "view name\n" |
| 4658 | "Clear all peers\n" |
| 4659 | "Address family\n" |
| 4660 | "Address Family modifier\n" |
| 4661 | "Address Family modifier\n" |
| 4662 | "Soft reconfig outbound update\n") |
| 4663 | { |
| 4664 | if (strncmp (argv[1], "m", 1) == 0) |
| 4665 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 4666 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4667 | |
| 4668 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4669 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4670 | } |
| 4671 | |
| 4672 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, |
| 4673 | clear_ip_bgp_all_vpnv4_soft_out_cmd, |
| 4674 | "clear ip bgp * vpnv4 unicast soft out", |
| 4675 | CLEAR_STR |
| 4676 | IP_STR |
| 4677 | BGP_STR |
| 4678 | "Clear all peers\n" |
| 4679 | "Address family\n" |
| 4680 | "Address Family Modifier\n" |
| 4681 | "Soft reconfig\n" |
| 4682 | "Soft reconfig outbound update\n") |
| 4683 | { |
| 4684 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 4685 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4686 | } |
| 4687 | |
| 4688 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, |
| 4689 | clear_ip_bgp_all_vpnv4_out_cmd, |
| 4690 | "clear ip bgp * vpnv4 unicast out", |
| 4691 | CLEAR_STR |
| 4692 | IP_STR |
| 4693 | BGP_STR |
| 4694 | "Clear all peers\n" |
| 4695 | "Address family\n" |
| 4696 | "Address Family Modifier\n" |
| 4697 | "Soft reconfig outbound update\n") |
| 4698 | |
| 4699 | DEFUN (clear_bgp_all_soft_out, |
| 4700 | clear_bgp_all_soft_out_cmd, |
| 4701 | "clear bgp * soft out", |
| 4702 | CLEAR_STR |
| 4703 | BGP_STR |
| 4704 | "Clear all peers\n" |
| 4705 | "Soft reconfig\n" |
| 4706 | "Soft reconfig outbound update\n") |
| 4707 | { |
| 4708 | if (argc == 1) |
| 4709 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 4710 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4711 | |
| 4712 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 4713 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4714 | } |
| 4715 | |
| 4716 | ALIAS (clear_bgp_all_soft_out, |
| 4717 | clear_bgp_instance_all_soft_out_cmd, |
| 4718 | "clear bgp view WORD * soft out", |
| 4719 | CLEAR_STR |
| 4720 | BGP_STR |
| 4721 | "BGP view\n" |
| 4722 | "view name\n" |
| 4723 | "Clear all peers\n" |
| 4724 | "Soft reconfig\n" |
| 4725 | "Soft reconfig outbound update\n") |
| 4726 | |
| 4727 | ALIAS (clear_bgp_all_soft_out, |
| 4728 | clear_bgp_all_out_cmd, |
| 4729 | "clear bgp * out", |
| 4730 | CLEAR_STR |
| 4731 | BGP_STR |
| 4732 | "Clear all peers\n" |
| 4733 | "Soft reconfig outbound update\n") |
| 4734 | |
| 4735 | ALIAS (clear_bgp_all_soft_out, |
| 4736 | clear_bgp_ipv6_all_soft_out_cmd, |
| 4737 | "clear bgp ipv6 * soft out", |
| 4738 | CLEAR_STR |
| 4739 | BGP_STR |
| 4740 | "Address family\n" |
| 4741 | "Clear all peers\n" |
| 4742 | "Soft reconfig\n" |
| 4743 | "Soft reconfig outbound update\n") |
| 4744 | |
| 4745 | ALIAS (clear_bgp_all_soft_out, |
| 4746 | clear_bgp_ipv6_all_out_cmd, |
| 4747 | "clear bgp ipv6 * out", |
| 4748 | CLEAR_STR |
| 4749 | BGP_STR |
| 4750 | "Address family\n" |
| 4751 | "Clear all peers\n" |
| 4752 | "Soft reconfig outbound update\n") |
| 4753 | |
| 4754 | DEFUN (clear_ip_bgp_peer_soft_out, |
| 4755 | clear_ip_bgp_peer_soft_out_cmd, |
| 4756 | "clear ip bgp A.B.C.D soft out", |
| 4757 | CLEAR_STR |
| 4758 | IP_STR |
| 4759 | BGP_STR |
| 4760 | "BGP neighbor address to clear\n" |
| 4761 | "Soft reconfig\n" |
| 4762 | "Soft reconfig outbound update\n") |
| 4763 | { |
| 4764 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4765 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4766 | } |
| 4767 | |
| 4768 | ALIAS (clear_ip_bgp_peer_soft_out, |
| 4769 | clear_ip_bgp_peer_out_cmd, |
| 4770 | "clear ip bgp A.B.C.D out", |
| 4771 | CLEAR_STR |
| 4772 | IP_STR |
| 4773 | BGP_STR |
| 4774 | "BGP neighbor address to clear\n" |
| 4775 | "Soft reconfig outbound update\n") |
| 4776 | |
| 4777 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
| 4778 | clear_ip_bgp_peer_ipv4_soft_out_cmd, |
| 4779 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", |
| 4780 | CLEAR_STR |
| 4781 | IP_STR |
| 4782 | BGP_STR |
| 4783 | "BGP neighbor address to clear\n" |
| 4784 | "Address family\n" |
| 4785 | "Address Family modifier\n" |
| 4786 | "Address Family modifier\n" |
| 4787 | "Soft reconfig\n" |
| 4788 | "Soft reconfig outbound update\n") |
| 4789 | { |
| 4790 | if (strncmp (argv[1], "m", 1) == 0) |
| 4791 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 4792 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4793 | |
| 4794 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4795 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4796 | } |
| 4797 | |
| 4798 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, |
| 4799 | clear_ip_bgp_peer_ipv4_out_cmd, |
| 4800 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", |
| 4801 | CLEAR_STR |
| 4802 | IP_STR |
| 4803 | BGP_STR |
| 4804 | "BGP neighbor address to clear\n" |
| 4805 | "Address family\n" |
| 4806 | "Address Family modifier\n" |
| 4807 | "Address Family modifier\n" |
| 4808 | "Soft reconfig outbound update\n") |
| 4809 | |
| 4810 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4811 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, |
| 4812 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", |
| 4813 | CLEAR_STR |
| 4814 | IP_STR |
| 4815 | BGP_STR |
| 4816 | "BGP neighbor address to clear\n" |
| 4817 | "Address family\n" |
| 4818 | "Address Family Modifier\n" |
| 4819 | "Soft reconfig\n" |
| 4820 | "Soft reconfig outbound update\n") |
| 4821 | { |
| 4822 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 4823 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4824 | } |
| 4825 | |
| 4826 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4827 | clear_ip_bgp_peer_vpnv4_out_cmd, |
| 4828 | "clear ip bgp A.B.C.D vpnv4 unicast out", |
| 4829 | CLEAR_STR |
| 4830 | IP_STR |
| 4831 | BGP_STR |
| 4832 | "BGP neighbor address to clear\n" |
| 4833 | "Address family\n" |
| 4834 | "Address Family Modifier\n" |
| 4835 | "Soft reconfig outbound update\n") |
| 4836 | |
| 4837 | DEFUN (clear_bgp_peer_soft_out, |
| 4838 | clear_bgp_peer_soft_out_cmd, |
| 4839 | "clear bgp (A.B.C.D|X:X::X:X) soft out", |
| 4840 | CLEAR_STR |
| 4841 | BGP_STR |
| 4842 | "BGP neighbor address to clear\n" |
| 4843 | "BGP IPv6 neighbor to clear\n" |
| 4844 | "Soft reconfig\n" |
| 4845 | "Soft reconfig outbound update\n") |
| 4846 | { |
| 4847 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 4848 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4849 | } |
| 4850 | |
| 4851 | ALIAS (clear_bgp_peer_soft_out, |
| 4852 | clear_bgp_ipv6_peer_soft_out_cmd, |
| 4853 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out", |
| 4854 | CLEAR_STR |
| 4855 | BGP_STR |
| 4856 | "Address family\n" |
| 4857 | "BGP neighbor address to clear\n" |
| 4858 | "BGP IPv6 neighbor to clear\n" |
| 4859 | "Soft reconfig\n" |
| 4860 | "Soft reconfig outbound update\n") |
| 4861 | |
| 4862 | ALIAS (clear_bgp_peer_soft_out, |
| 4863 | clear_bgp_peer_out_cmd, |
| 4864 | "clear bgp (A.B.C.D|X:X::X:X) out", |
| 4865 | CLEAR_STR |
| 4866 | BGP_STR |
| 4867 | "BGP neighbor address to clear\n" |
| 4868 | "BGP IPv6 neighbor to clear\n" |
| 4869 | "Soft reconfig outbound update\n") |
| 4870 | |
| 4871 | ALIAS (clear_bgp_peer_soft_out, |
| 4872 | clear_bgp_ipv6_peer_out_cmd, |
| 4873 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) out", |
| 4874 | CLEAR_STR |
| 4875 | BGP_STR |
| 4876 | "Address family\n" |
| 4877 | "BGP neighbor address to clear\n" |
| 4878 | "BGP IPv6 neighbor to clear\n" |
| 4879 | "Soft reconfig outbound update\n") |
| 4880 | |
| 4881 | DEFUN (clear_ip_bgp_peer_group_soft_out, |
| 4882 | clear_ip_bgp_peer_group_soft_out_cmd, |
| 4883 | "clear ip bgp peer-group WORD soft out", |
| 4884 | CLEAR_STR |
| 4885 | IP_STR |
| 4886 | BGP_STR |
| 4887 | "Clear all members of peer-group\n" |
| 4888 | "BGP peer-group name\n" |
| 4889 | "Soft reconfig\n" |
| 4890 | "Soft reconfig outbound update\n") |
| 4891 | { |
| 4892 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4893 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4894 | } |
| 4895 | |
| 4896 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
| 4897 | clear_ip_bgp_peer_group_out_cmd, |
| 4898 | "clear ip bgp peer-group WORD out", |
| 4899 | CLEAR_STR |
| 4900 | IP_STR |
| 4901 | BGP_STR |
| 4902 | "Clear all members of peer-group\n" |
| 4903 | "BGP peer-group name\n" |
| 4904 | "Soft reconfig outbound update\n") |
| 4905 | |
| 4906 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4907 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, |
| 4908 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", |
| 4909 | CLEAR_STR |
| 4910 | IP_STR |
| 4911 | BGP_STR |
| 4912 | "Clear all members of peer-group\n" |
| 4913 | "BGP peer-group name\n" |
| 4914 | "Address family\n" |
| 4915 | "Address Family modifier\n" |
| 4916 | "Address Family modifier\n" |
| 4917 | "Soft reconfig\n" |
| 4918 | "Soft reconfig outbound update\n") |
| 4919 | { |
| 4920 | if (strncmp (argv[1], "m", 1) == 0) |
| 4921 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 4922 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4923 | |
| 4924 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4925 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4926 | } |
| 4927 | |
| 4928 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4929 | clear_ip_bgp_peer_group_ipv4_out_cmd, |
| 4930 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", |
| 4931 | CLEAR_STR |
| 4932 | IP_STR |
| 4933 | BGP_STR |
| 4934 | "Clear all members of peer-group\n" |
| 4935 | "BGP peer-group name\n" |
| 4936 | "Address family\n" |
| 4937 | "Address Family modifier\n" |
| 4938 | "Address Family modifier\n" |
| 4939 | "Soft reconfig outbound update\n") |
| 4940 | |
| 4941 | DEFUN (clear_bgp_peer_group_soft_out, |
| 4942 | clear_bgp_peer_group_soft_out_cmd, |
| 4943 | "clear bgp peer-group WORD soft out", |
| 4944 | CLEAR_STR |
| 4945 | BGP_STR |
| 4946 | "Clear all members of peer-group\n" |
| 4947 | "BGP peer-group name\n" |
| 4948 | "Soft reconfig\n" |
| 4949 | "Soft reconfig outbound update\n") |
| 4950 | { |
| 4951 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 4952 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4953 | } |
| 4954 | |
| 4955 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4956 | clear_bgp_ipv6_peer_group_soft_out_cmd, |
| 4957 | "clear bgp ipv6 peer-group WORD soft out", |
| 4958 | CLEAR_STR |
| 4959 | BGP_STR |
| 4960 | "Address family\n" |
| 4961 | "Clear all members of peer-group\n" |
| 4962 | "BGP peer-group name\n" |
| 4963 | "Soft reconfig\n" |
| 4964 | "Soft reconfig outbound update\n") |
| 4965 | |
| 4966 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4967 | clear_bgp_peer_group_out_cmd, |
| 4968 | "clear bgp peer-group WORD out", |
| 4969 | CLEAR_STR |
| 4970 | BGP_STR |
| 4971 | "Clear all members of peer-group\n" |
| 4972 | "BGP peer-group name\n" |
| 4973 | "Soft reconfig outbound update\n") |
| 4974 | |
| 4975 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4976 | clear_bgp_ipv6_peer_group_out_cmd, |
| 4977 | "clear bgp ipv6 peer-group WORD out", |
| 4978 | CLEAR_STR |
| 4979 | BGP_STR |
| 4980 | "Address family\n" |
| 4981 | "Clear all members of peer-group\n" |
| 4982 | "BGP peer-group name\n" |
| 4983 | "Soft reconfig outbound update\n") |
| 4984 | |
| 4985 | DEFUN (clear_ip_bgp_external_soft_out, |
| 4986 | clear_ip_bgp_external_soft_out_cmd, |
| 4987 | "clear ip bgp external soft out", |
| 4988 | CLEAR_STR |
| 4989 | IP_STR |
| 4990 | BGP_STR |
| 4991 | "Clear all external peers\n" |
| 4992 | "Soft reconfig\n" |
| 4993 | "Soft reconfig outbound update\n") |
| 4994 | { |
| 4995 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 4996 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4997 | } |
| 4998 | |
| 4999 | ALIAS (clear_ip_bgp_external_soft_out, |
| 5000 | clear_ip_bgp_external_out_cmd, |
| 5001 | "clear ip bgp external out", |
| 5002 | CLEAR_STR |
| 5003 | IP_STR |
| 5004 | BGP_STR |
| 5005 | "Clear all external peers\n" |
| 5006 | "Soft reconfig outbound update\n") |
| 5007 | |
| 5008 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, |
| 5009 | clear_ip_bgp_external_ipv4_soft_out_cmd, |
| 5010 | "clear ip bgp external ipv4 (unicast|multicast) soft out", |
| 5011 | CLEAR_STR |
| 5012 | IP_STR |
| 5013 | BGP_STR |
| 5014 | "Clear all external peers\n" |
| 5015 | "Address family\n" |
| 5016 | "Address Family modifier\n" |
| 5017 | "Address Family modifier\n" |
| 5018 | "Soft reconfig\n" |
| 5019 | "Soft reconfig outbound update\n") |
| 5020 | { |
| 5021 | if (strncmp (argv[0], "m", 1) == 0) |
| 5022 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5023 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5024 | |
| 5025 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5026 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5027 | } |
| 5028 | |
| 5029 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, |
| 5030 | clear_ip_bgp_external_ipv4_out_cmd, |
| 5031 | "clear ip bgp external ipv4 (unicast|multicast) out", |
| 5032 | CLEAR_STR |
| 5033 | IP_STR |
| 5034 | BGP_STR |
| 5035 | "Clear all external peers\n" |
| 5036 | "Address family\n" |
| 5037 | "Address Family modifier\n" |
| 5038 | "Address Family modifier\n" |
| 5039 | "Soft reconfig outbound update\n") |
| 5040 | |
| 5041 | DEFUN (clear_bgp_external_soft_out, |
| 5042 | clear_bgp_external_soft_out_cmd, |
| 5043 | "clear bgp external soft out", |
| 5044 | CLEAR_STR |
| 5045 | BGP_STR |
| 5046 | "Clear all external peers\n" |
| 5047 | "Soft reconfig\n" |
| 5048 | "Soft reconfig outbound update\n") |
| 5049 | { |
| 5050 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5051 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5052 | } |
| 5053 | |
| 5054 | ALIAS (clear_bgp_external_soft_out, |
| 5055 | clear_bgp_ipv6_external_soft_out_cmd, |
| 5056 | "clear bgp ipv6 external soft out", |
| 5057 | CLEAR_STR |
| 5058 | BGP_STR |
| 5059 | "Address family\n" |
| 5060 | "Clear all external peers\n" |
| 5061 | "Soft reconfig\n" |
| 5062 | "Soft reconfig outbound update\n") |
| 5063 | |
| 5064 | ALIAS (clear_bgp_external_soft_out, |
| 5065 | clear_bgp_external_out_cmd, |
| 5066 | "clear bgp external out", |
| 5067 | CLEAR_STR |
| 5068 | BGP_STR |
| 5069 | "Clear all external peers\n" |
| 5070 | "Soft reconfig outbound update\n") |
| 5071 | |
| 5072 | ALIAS (clear_bgp_external_soft_out, |
| 5073 | clear_bgp_ipv6_external_out_cmd, |
| 5074 | "clear bgp ipv6 external WORD out", |
| 5075 | CLEAR_STR |
| 5076 | BGP_STR |
| 5077 | "Address family\n" |
| 5078 | "Clear all external peers\n" |
| 5079 | "Soft reconfig outbound update\n") |
| 5080 | |
| 5081 | DEFUN (clear_ip_bgp_as_soft_out, |
| 5082 | clear_ip_bgp_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5083 | "clear ip bgp " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5084 | CLEAR_STR |
| 5085 | IP_STR |
| 5086 | BGP_STR |
| 5087 | "Clear peers with the AS number\n" |
| 5088 | "Soft reconfig\n" |
| 5089 | "Soft reconfig outbound update\n") |
| 5090 | { |
| 5091 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5092 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5093 | } |
| 5094 | |
| 5095 | ALIAS (clear_ip_bgp_as_soft_out, |
| 5096 | clear_ip_bgp_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5097 | "clear ip bgp " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5098 | CLEAR_STR |
| 5099 | IP_STR |
| 5100 | BGP_STR |
| 5101 | "Clear peers with the AS number\n" |
| 5102 | "Soft reconfig outbound update\n") |
| 5103 | |
| 5104 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
| 5105 | clear_ip_bgp_as_ipv4_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5106 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5107 | CLEAR_STR |
| 5108 | IP_STR |
| 5109 | BGP_STR |
| 5110 | "Clear peers with the AS number\n" |
| 5111 | "Address family\n" |
| 5112 | "Address Family modifier\n" |
| 5113 | "Address Family modifier\n" |
| 5114 | "Soft reconfig\n" |
| 5115 | "Soft reconfig outbound update\n") |
| 5116 | { |
| 5117 | if (strncmp (argv[1], "m", 1) == 0) |
| 5118 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5119 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5120 | |
| 5121 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5122 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5123 | } |
| 5124 | |
| 5125 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, |
| 5126 | clear_ip_bgp_as_ipv4_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5127 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5128 | CLEAR_STR |
| 5129 | IP_STR |
| 5130 | BGP_STR |
| 5131 | "Clear peers with the AS number\n" |
| 5132 | "Address family\n" |
| 5133 | "Address Family modifier\n" |
| 5134 | "Address Family modifier\n" |
| 5135 | "Soft reconfig outbound update\n") |
| 5136 | |
| 5137 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
| 5138 | clear_ip_bgp_as_vpnv4_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5139 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5140 | CLEAR_STR |
| 5141 | IP_STR |
| 5142 | BGP_STR |
| 5143 | "Clear peers with the AS number\n" |
| 5144 | "Address family\n" |
| 5145 | "Address Family modifier\n" |
| 5146 | "Soft reconfig\n" |
| 5147 | "Soft reconfig outbound update\n") |
| 5148 | { |
| 5149 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 5150 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5151 | } |
| 5152 | |
| 5153 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, |
| 5154 | clear_ip_bgp_as_vpnv4_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5155 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5156 | CLEAR_STR |
| 5157 | IP_STR |
| 5158 | BGP_STR |
| 5159 | "Clear peers with the AS number\n" |
| 5160 | "Address family\n" |
| 5161 | "Address Family modifier\n" |
| 5162 | "Soft reconfig outbound update\n") |
| 5163 | |
| 5164 | DEFUN (clear_bgp_as_soft_out, |
| 5165 | clear_bgp_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5166 | "clear bgp " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5167 | CLEAR_STR |
| 5168 | BGP_STR |
| 5169 | "Clear peers with the AS number\n" |
| 5170 | "Soft reconfig\n" |
| 5171 | "Soft reconfig outbound update\n") |
| 5172 | { |
| 5173 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5174 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5175 | } |
| 5176 | |
| 5177 | ALIAS (clear_bgp_as_soft_out, |
| 5178 | clear_bgp_ipv6_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5179 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5180 | CLEAR_STR |
| 5181 | BGP_STR |
| 5182 | "Address family\n" |
| 5183 | "Clear peers with the AS number\n" |
| 5184 | "Soft reconfig\n" |
| 5185 | "Soft reconfig outbound update\n") |
| 5186 | |
| 5187 | ALIAS (clear_bgp_as_soft_out, |
| 5188 | clear_bgp_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5189 | "clear bgp " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5190 | CLEAR_STR |
| 5191 | BGP_STR |
| 5192 | "Clear peers with the AS number\n" |
| 5193 | "Soft reconfig outbound update\n") |
| 5194 | |
| 5195 | ALIAS (clear_bgp_as_soft_out, |
| 5196 | clear_bgp_ipv6_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5197 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5198 | CLEAR_STR |
| 5199 | BGP_STR |
| 5200 | "Address family\n" |
| 5201 | "Clear peers with the AS number\n" |
| 5202 | "Soft reconfig outbound update\n") |
| 5203 | |
| 5204 | /* Inbound soft-reconfiguration */ |
| 5205 | DEFUN (clear_ip_bgp_all_soft_in, |
| 5206 | clear_ip_bgp_all_soft_in_cmd, |
| 5207 | "clear ip bgp * soft in", |
| 5208 | CLEAR_STR |
| 5209 | IP_STR |
| 5210 | BGP_STR |
| 5211 | "Clear all peers\n" |
| 5212 | "Soft reconfig\n" |
| 5213 | "Soft reconfig inbound update\n") |
| 5214 | { |
| 5215 | if (argc == 1) |
| 5216 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5217 | BGP_CLEAR_SOFT_IN, NULL); |
| 5218 | |
| 5219 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5220 | BGP_CLEAR_SOFT_IN, NULL); |
| 5221 | } |
| 5222 | |
| 5223 | ALIAS (clear_ip_bgp_all_soft_in, |
| 5224 | clear_ip_bgp_instance_all_soft_in_cmd, |
| 5225 | "clear ip bgp view WORD * soft in", |
| 5226 | CLEAR_STR |
| 5227 | IP_STR |
| 5228 | BGP_STR |
| 5229 | "BGP view\n" |
| 5230 | "view name\n" |
| 5231 | "Clear all peers\n" |
| 5232 | "Soft reconfig\n" |
| 5233 | "Soft reconfig inbound update\n") |
| 5234 | |
| 5235 | ALIAS (clear_ip_bgp_all_soft_in, |
| 5236 | clear_ip_bgp_all_in_cmd, |
| 5237 | "clear ip bgp * in", |
| 5238 | CLEAR_STR |
| 5239 | IP_STR |
| 5240 | BGP_STR |
| 5241 | "Clear all peers\n" |
| 5242 | "Soft reconfig inbound update\n") |
| 5243 | |
| 5244 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
| 5245 | clear_ip_bgp_all_in_prefix_filter_cmd, |
| 5246 | "clear ip bgp * in prefix-filter", |
| 5247 | CLEAR_STR |
| 5248 | IP_STR |
| 5249 | BGP_STR |
| 5250 | "Clear all peers\n" |
| 5251 | "Soft reconfig inbound update\n" |
| 5252 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5253 | { |
| 5254 | if (argc== 1) |
| 5255 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5256 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5257 | |
| 5258 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5259 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5260 | } |
| 5261 | |
| 5262 | ALIAS (clear_ip_bgp_all_in_prefix_filter, |
| 5263 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, |
| 5264 | "clear ip bgp view WORD * in prefix-filter", |
| 5265 | CLEAR_STR |
| 5266 | IP_STR |
| 5267 | BGP_STR |
| 5268 | "BGP view\n" |
| 5269 | "view name\n" |
| 5270 | "Clear all peers\n" |
| 5271 | "Soft reconfig inbound update\n" |
| 5272 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5273 | |
| 5274 | |
| 5275 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
| 5276 | clear_ip_bgp_all_ipv4_soft_in_cmd, |
| 5277 | "clear ip bgp * ipv4 (unicast|multicast) soft in", |
| 5278 | CLEAR_STR |
| 5279 | IP_STR |
| 5280 | BGP_STR |
| 5281 | "Clear all peers\n" |
| 5282 | "Address family\n" |
| 5283 | "Address Family modifier\n" |
| 5284 | "Address Family modifier\n" |
| 5285 | "Soft reconfig\n" |
| 5286 | "Soft reconfig inbound update\n") |
| 5287 | { |
| 5288 | if (strncmp (argv[0], "m", 1) == 0) |
| 5289 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5290 | BGP_CLEAR_SOFT_IN, NULL); |
| 5291 | |
| 5292 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5293 | BGP_CLEAR_SOFT_IN, NULL); |
| 5294 | } |
| 5295 | |
| 5296 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, |
| 5297 | clear_ip_bgp_all_ipv4_in_cmd, |
| 5298 | "clear ip bgp * ipv4 (unicast|multicast) in", |
| 5299 | CLEAR_STR |
| 5300 | IP_STR |
| 5301 | BGP_STR |
| 5302 | "Clear all peers\n" |
| 5303 | "Address family\n" |
| 5304 | "Address Family modifier\n" |
| 5305 | "Address Family modifier\n" |
| 5306 | "Soft reconfig inbound update\n") |
| 5307 | |
| 5308 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
| 5309 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, |
| 5310 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", |
| 5311 | CLEAR_STR |
| 5312 | IP_STR |
| 5313 | BGP_STR |
| 5314 | "BGP view\n" |
| 5315 | "view name\n" |
| 5316 | "Clear all peers\n" |
| 5317 | "Address family\n" |
| 5318 | "Address Family modifier\n" |
| 5319 | "Address Family modifier\n" |
| 5320 | "Soft reconfig\n" |
| 5321 | "Soft reconfig inbound update\n") |
| 5322 | { |
| 5323 | if (strncmp (argv[1], "m", 1) == 0) |
| 5324 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5325 | BGP_CLEAR_SOFT_IN, NULL); |
| 5326 | |
| 5327 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5328 | BGP_CLEAR_SOFT_IN, NULL); |
| 5329 | } |
| 5330 | |
| 5331 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
| 5332 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, |
| 5333 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", |
| 5334 | CLEAR_STR |
| 5335 | IP_STR |
| 5336 | BGP_STR |
| 5337 | "Clear all peers\n" |
| 5338 | "Address family\n" |
| 5339 | "Address Family modifier\n" |
| 5340 | "Address Family modifier\n" |
| 5341 | "Soft reconfig inbound update\n" |
| 5342 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5343 | { |
| 5344 | if (strncmp (argv[0], "m", 1) == 0) |
| 5345 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5346 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5347 | |
| 5348 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5349 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5350 | } |
| 5351 | |
| 5352 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, |
| 5353 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, |
| 5354 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", |
| 5355 | CLEAR_STR |
| 5356 | IP_STR |
| 5357 | BGP_STR |
| 5358 | "Clear all peers\n" |
| 5359 | "Address family\n" |
| 5360 | "Address Family modifier\n" |
| 5361 | "Address Family modifier\n" |
| 5362 | "Soft reconfig inbound update\n" |
| 5363 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5364 | { |
| 5365 | if (strncmp (argv[1], "m", 1) == 0) |
| 5366 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5367 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5368 | |
| 5369 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5370 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5371 | } |
| 5372 | |
| 5373 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, |
| 5374 | clear_ip_bgp_all_vpnv4_soft_in_cmd, |
| 5375 | "clear ip bgp * vpnv4 unicast soft in", |
| 5376 | CLEAR_STR |
| 5377 | IP_STR |
| 5378 | BGP_STR |
| 5379 | "Clear all peers\n" |
| 5380 | "Address family\n" |
| 5381 | "Address Family Modifier\n" |
| 5382 | "Soft reconfig\n" |
| 5383 | "Soft reconfig inbound update\n") |
| 5384 | { |
| 5385 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 5386 | BGP_CLEAR_SOFT_IN, NULL); |
| 5387 | } |
| 5388 | |
| 5389 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, |
| 5390 | clear_ip_bgp_all_vpnv4_in_cmd, |
| 5391 | "clear ip bgp * vpnv4 unicast in", |
| 5392 | CLEAR_STR |
| 5393 | IP_STR |
| 5394 | BGP_STR |
| 5395 | "Clear all peers\n" |
| 5396 | "Address family\n" |
| 5397 | "Address Family Modifier\n" |
| 5398 | "Soft reconfig inbound update\n") |
| 5399 | |
| 5400 | DEFUN (clear_bgp_all_soft_in, |
| 5401 | clear_bgp_all_soft_in_cmd, |
| 5402 | "clear bgp * soft in", |
| 5403 | CLEAR_STR |
| 5404 | BGP_STR |
| 5405 | "Clear all peers\n" |
| 5406 | "Soft reconfig\n" |
| 5407 | "Soft reconfig inbound update\n") |
| 5408 | { |
| 5409 | if (argc == 1) |
| 5410 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 5411 | BGP_CLEAR_SOFT_IN, NULL); |
| 5412 | |
| 5413 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5414 | BGP_CLEAR_SOFT_IN, NULL); |
| 5415 | } |
| 5416 | |
| 5417 | ALIAS (clear_bgp_all_soft_in, |
| 5418 | clear_bgp_instance_all_soft_in_cmd, |
| 5419 | "clear bgp view WORD * soft in", |
| 5420 | CLEAR_STR |
| 5421 | BGP_STR |
| 5422 | "BGP view\n" |
| 5423 | "view name\n" |
| 5424 | "Clear all peers\n" |
| 5425 | "Soft reconfig\n" |
| 5426 | "Soft reconfig inbound update\n") |
| 5427 | |
| 5428 | ALIAS (clear_bgp_all_soft_in, |
| 5429 | clear_bgp_ipv6_all_soft_in_cmd, |
| 5430 | "clear bgp ipv6 * soft in", |
| 5431 | CLEAR_STR |
| 5432 | BGP_STR |
| 5433 | "Address family\n" |
| 5434 | "Clear all peers\n" |
| 5435 | "Soft reconfig\n" |
| 5436 | "Soft reconfig inbound update\n") |
| 5437 | |
| 5438 | ALIAS (clear_bgp_all_soft_in, |
| 5439 | clear_bgp_all_in_cmd, |
| 5440 | "clear bgp * in", |
| 5441 | CLEAR_STR |
| 5442 | BGP_STR |
| 5443 | "Clear all peers\n" |
| 5444 | "Soft reconfig inbound update\n") |
| 5445 | |
| 5446 | ALIAS (clear_bgp_all_soft_in, |
| 5447 | clear_bgp_ipv6_all_in_cmd, |
| 5448 | "clear bgp ipv6 * in", |
| 5449 | CLEAR_STR |
| 5450 | BGP_STR |
| 5451 | "Address family\n" |
| 5452 | "Clear all peers\n" |
| 5453 | "Soft reconfig inbound update\n") |
| 5454 | |
| 5455 | DEFUN (clear_bgp_all_in_prefix_filter, |
| 5456 | clear_bgp_all_in_prefix_filter_cmd, |
| 5457 | "clear bgp * in prefix-filter", |
| 5458 | CLEAR_STR |
| 5459 | BGP_STR |
| 5460 | "Clear all peers\n" |
| 5461 | "Soft reconfig inbound update\n" |
| 5462 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5463 | { |
| 5464 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5465 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5466 | } |
| 5467 | |
| 5468 | ALIAS (clear_bgp_all_in_prefix_filter, |
| 5469 | clear_bgp_ipv6_all_in_prefix_filter_cmd, |
| 5470 | "clear bgp ipv6 * in prefix-filter", |
| 5471 | CLEAR_STR |
| 5472 | BGP_STR |
| 5473 | "Address family\n" |
| 5474 | "Clear all peers\n" |
| 5475 | "Soft reconfig inbound update\n" |
| 5476 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5477 | |
| 5478 | DEFUN (clear_ip_bgp_peer_soft_in, |
| 5479 | clear_ip_bgp_peer_soft_in_cmd, |
| 5480 | "clear ip bgp A.B.C.D soft in", |
| 5481 | CLEAR_STR |
| 5482 | IP_STR |
| 5483 | BGP_STR |
| 5484 | "BGP neighbor address to clear\n" |
| 5485 | "Soft reconfig\n" |
| 5486 | "Soft reconfig inbound update\n") |
| 5487 | { |
| 5488 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5489 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5490 | } |
| 5491 | |
| 5492 | ALIAS (clear_ip_bgp_peer_soft_in, |
| 5493 | clear_ip_bgp_peer_in_cmd, |
| 5494 | "clear ip bgp A.B.C.D in", |
| 5495 | CLEAR_STR |
| 5496 | IP_STR |
| 5497 | BGP_STR |
| 5498 | "BGP neighbor address to clear\n" |
| 5499 | "Soft reconfig inbound update\n") |
| 5500 | |
| 5501 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
| 5502 | clear_ip_bgp_peer_in_prefix_filter_cmd, |
| 5503 | "clear ip bgp A.B.C.D in prefix-filter", |
| 5504 | CLEAR_STR |
| 5505 | IP_STR |
| 5506 | BGP_STR |
| 5507 | "BGP neighbor address to clear\n" |
| 5508 | "Soft reconfig inbound update\n" |
| 5509 | "Push out the existing ORF prefix-list\n") |
| 5510 | { |
| 5511 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5512 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5513 | } |
| 5514 | |
| 5515 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, |
| 5516 | clear_ip_bgp_peer_ipv4_soft_in_cmd, |
| 5517 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", |
| 5518 | CLEAR_STR |
| 5519 | IP_STR |
| 5520 | BGP_STR |
| 5521 | "BGP neighbor address to clear\n" |
| 5522 | "Address family\n" |
| 5523 | "Address Family modifier\n" |
| 5524 | "Address Family modifier\n" |
| 5525 | "Soft reconfig\n" |
| 5526 | "Soft reconfig inbound update\n") |
| 5527 | { |
| 5528 | if (strncmp (argv[1], "m", 1) == 0) |
| 5529 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5530 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5531 | |
| 5532 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5533 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5534 | } |
| 5535 | |
| 5536 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, |
| 5537 | clear_ip_bgp_peer_ipv4_in_cmd, |
| 5538 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", |
| 5539 | CLEAR_STR |
| 5540 | IP_STR |
| 5541 | BGP_STR |
| 5542 | "BGP neighbor address to clear\n" |
| 5543 | "Address family\n" |
| 5544 | "Address Family modifier\n" |
| 5545 | "Address Family modifier\n" |
| 5546 | "Soft reconfig inbound update\n") |
| 5547 | |
| 5548 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
| 5549 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, |
| 5550 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", |
| 5551 | CLEAR_STR |
| 5552 | IP_STR |
| 5553 | BGP_STR |
| 5554 | "BGP neighbor address to clear\n" |
| 5555 | "Address family\n" |
| 5556 | "Address Family modifier\n" |
| 5557 | "Address Family modifier\n" |
| 5558 | "Soft reconfig inbound update\n" |
| 5559 | "Push out the existing ORF prefix-list\n") |
| 5560 | { |
| 5561 | if (strncmp (argv[1], "m", 1) == 0) |
| 5562 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5563 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5564 | |
| 5565 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5566 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5567 | } |
| 5568 | |
| 5569 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5570 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, |
| 5571 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", |
| 5572 | CLEAR_STR |
| 5573 | IP_STR |
| 5574 | BGP_STR |
| 5575 | "BGP neighbor address to clear\n" |
| 5576 | "Address family\n" |
| 5577 | "Address Family Modifier\n" |
| 5578 | "Soft reconfig\n" |
| 5579 | "Soft reconfig inbound update\n") |
| 5580 | { |
| 5581 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 5582 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5583 | } |
| 5584 | |
| 5585 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5586 | clear_ip_bgp_peer_vpnv4_in_cmd, |
| 5587 | "clear ip bgp A.B.C.D vpnv4 unicast in", |
| 5588 | CLEAR_STR |
| 5589 | IP_STR |
| 5590 | BGP_STR |
| 5591 | "BGP neighbor address to clear\n" |
| 5592 | "Address family\n" |
| 5593 | "Address Family Modifier\n" |
| 5594 | "Soft reconfig inbound update\n") |
| 5595 | |
| 5596 | DEFUN (clear_bgp_peer_soft_in, |
| 5597 | clear_bgp_peer_soft_in_cmd, |
| 5598 | "clear bgp (A.B.C.D|X:X::X:X) soft in", |
| 5599 | CLEAR_STR |
| 5600 | BGP_STR |
| 5601 | "BGP neighbor address to clear\n" |
| 5602 | "BGP IPv6 neighbor to clear\n" |
| 5603 | "Soft reconfig\n" |
| 5604 | "Soft reconfig inbound update\n") |
| 5605 | { |
| 5606 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5607 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5608 | } |
| 5609 | |
| 5610 | ALIAS (clear_bgp_peer_soft_in, |
| 5611 | clear_bgp_ipv6_peer_soft_in_cmd, |
| 5612 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in", |
| 5613 | CLEAR_STR |
| 5614 | BGP_STR |
| 5615 | "Address family\n" |
| 5616 | "BGP neighbor address to clear\n" |
| 5617 | "BGP IPv6 neighbor to clear\n" |
| 5618 | "Soft reconfig\n" |
| 5619 | "Soft reconfig inbound update\n") |
| 5620 | |
| 5621 | ALIAS (clear_bgp_peer_soft_in, |
| 5622 | clear_bgp_peer_in_cmd, |
| 5623 | "clear bgp (A.B.C.D|X:X::X:X) in", |
| 5624 | CLEAR_STR |
| 5625 | BGP_STR |
| 5626 | "BGP neighbor address to clear\n" |
| 5627 | "BGP IPv6 neighbor to clear\n" |
| 5628 | "Soft reconfig inbound update\n") |
| 5629 | |
| 5630 | ALIAS (clear_bgp_peer_soft_in, |
| 5631 | clear_bgp_ipv6_peer_in_cmd, |
| 5632 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in", |
| 5633 | CLEAR_STR |
| 5634 | BGP_STR |
| 5635 | "Address family\n" |
| 5636 | "BGP neighbor address to clear\n" |
| 5637 | "BGP IPv6 neighbor to clear\n" |
| 5638 | "Soft reconfig inbound update\n") |
| 5639 | |
| 5640 | DEFUN (clear_bgp_peer_in_prefix_filter, |
| 5641 | clear_bgp_peer_in_prefix_filter_cmd, |
| 5642 | "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5643 | CLEAR_STR |
| 5644 | BGP_STR |
| 5645 | "BGP neighbor address to clear\n" |
| 5646 | "BGP IPv6 neighbor to clear\n" |
| 5647 | "Soft reconfig inbound update\n" |
| 5648 | "Push out the existing ORF prefix-list\n") |
| 5649 | { |
| 5650 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5651 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5652 | } |
| 5653 | |
| 5654 | ALIAS (clear_bgp_peer_in_prefix_filter, |
| 5655 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, |
| 5656 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5657 | CLEAR_STR |
| 5658 | BGP_STR |
| 5659 | "Address family\n" |
| 5660 | "BGP neighbor address to clear\n" |
| 5661 | "BGP IPv6 neighbor to clear\n" |
| 5662 | "Soft reconfig inbound update\n" |
| 5663 | "Push out the existing ORF prefix-list\n") |
| 5664 | |
| 5665 | DEFUN (clear_ip_bgp_peer_group_soft_in, |
| 5666 | clear_ip_bgp_peer_group_soft_in_cmd, |
| 5667 | "clear ip bgp peer-group WORD soft in", |
| 5668 | CLEAR_STR |
| 5669 | IP_STR |
| 5670 | BGP_STR |
| 5671 | "Clear all members of peer-group\n" |
| 5672 | "BGP peer-group name\n" |
| 5673 | "Soft reconfig\n" |
| 5674 | "Soft reconfig inbound update\n") |
| 5675 | { |
| 5676 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5677 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5678 | } |
| 5679 | |
| 5680 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
| 5681 | clear_ip_bgp_peer_group_in_cmd, |
| 5682 | "clear ip bgp peer-group WORD in", |
| 5683 | CLEAR_STR |
| 5684 | IP_STR |
| 5685 | BGP_STR |
| 5686 | "Clear all members of peer-group\n" |
| 5687 | "BGP peer-group name\n" |
| 5688 | "Soft reconfig inbound update\n") |
| 5689 | |
| 5690 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
| 5691 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, |
| 5692 | "clear ip bgp peer-group WORD in prefix-filter", |
| 5693 | CLEAR_STR |
| 5694 | IP_STR |
| 5695 | BGP_STR |
| 5696 | "Clear all members of peer-group\n" |
| 5697 | "BGP peer-group name\n" |
| 5698 | "Soft reconfig inbound update\n" |
| 5699 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5700 | { |
| 5701 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5702 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5703 | } |
| 5704 | |
| 5705 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5706 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, |
| 5707 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", |
| 5708 | CLEAR_STR |
| 5709 | IP_STR |
| 5710 | BGP_STR |
| 5711 | "Clear all members of peer-group\n" |
| 5712 | "BGP peer-group name\n" |
| 5713 | "Address family\n" |
| 5714 | "Address Family modifier\n" |
| 5715 | "Address Family modifier\n" |
| 5716 | "Soft reconfig\n" |
| 5717 | "Soft reconfig inbound update\n") |
| 5718 | { |
| 5719 | if (strncmp (argv[1], "m", 1) == 0) |
| 5720 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5721 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5722 | |
| 5723 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5724 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5725 | } |
| 5726 | |
| 5727 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5728 | clear_ip_bgp_peer_group_ipv4_in_cmd, |
| 5729 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", |
| 5730 | CLEAR_STR |
| 5731 | IP_STR |
| 5732 | BGP_STR |
| 5733 | "Clear all members of peer-group\n" |
| 5734 | "BGP peer-group name\n" |
| 5735 | "Address family\n" |
| 5736 | "Address Family modifier\n" |
| 5737 | "Address Family modifier\n" |
| 5738 | "Soft reconfig inbound update\n") |
| 5739 | |
| 5740 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
| 5741 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, |
| 5742 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", |
| 5743 | CLEAR_STR |
| 5744 | IP_STR |
| 5745 | BGP_STR |
| 5746 | "Clear all members of peer-group\n" |
| 5747 | "BGP peer-group name\n" |
| 5748 | "Address family\n" |
| 5749 | "Address Family modifier\n" |
| 5750 | "Address Family modifier\n" |
| 5751 | "Soft reconfig inbound update\n" |
| 5752 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5753 | { |
| 5754 | if (strncmp (argv[1], "m", 1) == 0) |
| 5755 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5756 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5757 | |
| 5758 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5759 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5760 | } |
| 5761 | |
| 5762 | DEFUN (clear_bgp_peer_group_soft_in, |
| 5763 | clear_bgp_peer_group_soft_in_cmd, |
| 5764 | "clear bgp peer-group WORD soft in", |
| 5765 | CLEAR_STR |
| 5766 | BGP_STR |
| 5767 | "Clear all members of peer-group\n" |
| 5768 | "BGP peer-group name\n" |
| 5769 | "Soft reconfig\n" |
| 5770 | "Soft reconfig inbound update\n") |
| 5771 | { |
| 5772 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5773 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5774 | } |
| 5775 | |
| 5776 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5777 | clear_bgp_ipv6_peer_group_soft_in_cmd, |
| 5778 | "clear bgp ipv6 peer-group WORD soft in", |
| 5779 | CLEAR_STR |
| 5780 | BGP_STR |
| 5781 | "Address family\n" |
| 5782 | "Clear all members of peer-group\n" |
| 5783 | "BGP peer-group name\n" |
| 5784 | "Soft reconfig\n" |
| 5785 | "Soft reconfig inbound update\n") |
| 5786 | |
| 5787 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5788 | clear_bgp_peer_group_in_cmd, |
| 5789 | "clear bgp peer-group WORD in", |
| 5790 | CLEAR_STR |
| 5791 | BGP_STR |
| 5792 | "Clear all members of peer-group\n" |
| 5793 | "BGP peer-group name\n" |
| 5794 | "Soft reconfig inbound update\n") |
| 5795 | |
| 5796 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5797 | clear_bgp_ipv6_peer_group_in_cmd, |
| 5798 | "clear bgp ipv6 peer-group WORD in", |
| 5799 | CLEAR_STR |
| 5800 | BGP_STR |
| 5801 | "Address family\n" |
| 5802 | "Clear all members of peer-group\n" |
| 5803 | "BGP peer-group name\n" |
| 5804 | "Soft reconfig inbound update\n") |
| 5805 | |
| 5806 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
| 5807 | clear_bgp_peer_group_in_prefix_filter_cmd, |
| 5808 | "clear bgp peer-group WORD in prefix-filter", |
| 5809 | CLEAR_STR |
| 5810 | BGP_STR |
| 5811 | "Clear all members of peer-group\n" |
| 5812 | "BGP peer-group name\n" |
| 5813 | "Soft reconfig inbound update\n" |
| 5814 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5815 | { |
| 5816 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5817 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5818 | } |
| 5819 | |
| 5820 | ALIAS (clear_bgp_peer_group_in_prefix_filter, |
| 5821 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, |
| 5822 | "clear bgp ipv6 peer-group WORD in prefix-filter", |
| 5823 | CLEAR_STR |
| 5824 | BGP_STR |
| 5825 | "Address family\n" |
| 5826 | "Clear all members of peer-group\n" |
| 5827 | "BGP peer-group name\n" |
| 5828 | "Soft reconfig inbound update\n" |
| 5829 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5830 | |
| 5831 | DEFUN (clear_ip_bgp_external_soft_in, |
| 5832 | clear_ip_bgp_external_soft_in_cmd, |
| 5833 | "clear ip bgp external soft in", |
| 5834 | CLEAR_STR |
| 5835 | IP_STR |
| 5836 | BGP_STR |
| 5837 | "Clear all external peers\n" |
| 5838 | "Soft reconfig\n" |
| 5839 | "Soft reconfig inbound update\n") |
| 5840 | { |
| 5841 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5842 | BGP_CLEAR_SOFT_IN, NULL); |
| 5843 | } |
| 5844 | |
| 5845 | ALIAS (clear_ip_bgp_external_soft_in, |
| 5846 | clear_ip_bgp_external_in_cmd, |
| 5847 | "clear ip bgp external in", |
| 5848 | CLEAR_STR |
| 5849 | IP_STR |
| 5850 | BGP_STR |
| 5851 | "Clear all external peers\n" |
| 5852 | "Soft reconfig inbound update\n") |
| 5853 | |
| 5854 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
| 5855 | clear_ip_bgp_external_in_prefix_filter_cmd, |
| 5856 | "clear ip bgp external in prefix-filter", |
| 5857 | CLEAR_STR |
| 5858 | IP_STR |
| 5859 | BGP_STR |
| 5860 | "Clear all external peers\n" |
| 5861 | "Soft reconfig inbound update\n" |
| 5862 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5863 | { |
| 5864 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5865 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5866 | } |
| 5867 | |
| 5868 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, |
| 5869 | clear_ip_bgp_external_ipv4_soft_in_cmd, |
| 5870 | "clear ip bgp external ipv4 (unicast|multicast) soft in", |
| 5871 | CLEAR_STR |
| 5872 | IP_STR |
| 5873 | BGP_STR |
| 5874 | "Clear all external peers\n" |
| 5875 | "Address family\n" |
| 5876 | "Address Family modifier\n" |
| 5877 | "Address Family modifier\n" |
| 5878 | "Soft reconfig\n" |
| 5879 | "Soft reconfig inbound update\n") |
| 5880 | { |
| 5881 | if (strncmp (argv[0], "m", 1) == 0) |
| 5882 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5883 | BGP_CLEAR_SOFT_IN, NULL); |
| 5884 | |
| 5885 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5886 | BGP_CLEAR_SOFT_IN, NULL); |
| 5887 | } |
| 5888 | |
| 5889 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, |
| 5890 | clear_ip_bgp_external_ipv4_in_cmd, |
| 5891 | "clear ip bgp external ipv4 (unicast|multicast) in", |
| 5892 | CLEAR_STR |
| 5893 | IP_STR |
| 5894 | BGP_STR |
| 5895 | "Clear all external peers\n" |
| 5896 | "Address family\n" |
| 5897 | "Address Family modifier\n" |
| 5898 | "Address Family modifier\n" |
| 5899 | "Soft reconfig inbound update\n") |
| 5900 | |
| 5901 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
| 5902 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, |
| 5903 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", |
| 5904 | CLEAR_STR |
| 5905 | IP_STR |
| 5906 | BGP_STR |
| 5907 | "Clear all external peers\n" |
| 5908 | "Address family\n" |
| 5909 | "Address Family modifier\n" |
| 5910 | "Address Family modifier\n" |
| 5911 | "Soft reconfig inbound update\n" |
| 5912 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5913 | { |
| 5914 | if (strncmp (argv[0], "m", 1) == 0) |
| 5915 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5916 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5917 | |
| 5918 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5919 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5920 | } |
| 5921 | |
| 5922 | DEFUN (clear_bgp_external_soft_in, |
| 5923 | clear_bgp_external_soft_in_cmd, |
| 5924 | "clear bgp external soft in", |
| 5925 | CLEAR_STR |
| 5926 | BGP_STR |
| 5927 | "Clear all external peers\n" |
| 5928 | "Soft reconfig\n" |
| 5929 | "Soft reconfig inbound update\n") |
| 5930 | { |
| 5931 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5932 | BGP_CLEAR_SOFT_IN, NULL); |
| 5933 | } |
| 5934 | |
| 5935 | ALIAS (clear_bgp_external_soft_in, |
| 5936 | clear_bgp_ipv6_external_soft_in_cmd, |
| 5937 | "clear bgp ipv6 external soft in", |
| 5938 | CLEAR_STR |
| 5939 | BGP_STR |
| 5940 | "Address family\n" |
| 5941 | "Clear all external peers\n" |
| 5942 | "Soft reconfig\n" |
| 5943 | "Soft reconfig inbound update\n") |
| 5944 | |
| 5945 | ALIAS (clear_bgp_external_soft_in, |
| 5946 | clear_bgp_external_in_cmd, |
| 5947 | "clear bgp external in", |
| 5948 | CLEAR_STR |
| 5949 | BGP_STR |
| 5950 | "Clear all external peers\n" |
| 5951 | "Soft reconfig inbound update\n") |
| 5952 | |
| 5953 | ALIAS (clear_bgp_external_soft_in, |
| 5954 | clear_bgp_ipv6_external_in_cmd, |
| 5955 | "clear bgp ipv6 external WORD in", |
| 5956 | CLEAR_STR |
| 5957 | BGP_STR |
| 5958 | "Address family\n" |
| 5959 | "Clear all external peers\n" |
| 5960 | "Soft reconfig inbound update\n") |
| 5961 | |
| 5962 | DEFUN (clear_bgp_external_in_prefix_filter, |
| 5963 | clear_bgp_external_in_prefix_filter_cmd, |
| 5964 | "clear bgp external in prefix-filter", |
| 5965 | CLEAR_STR |
| 5966 | BGP_STR |
| 5967 | "Clear all external peers\n" |
| 5968 | "Soft reconfig inbound update\n" |
| 5969 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5970 | { |
| 5971 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5972 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5973 | } |
| 5974 | |
| 5975 | ALIAS (clear_bgp_external_in_prefix_filter, |
| 5976 | clear_bgp_ipv6_external_in_prefix_filter_cmd, |
| 5977 | "clear bgp ipv6 external in prefix-filter", |
| 5978 | CLEAR_STR |
| 5979 | BGP_STR |
| 5980 | "Address family\n" |
| 5981 | "Clear all external peers\n" |
| 5982 | "Soft reconfig inbound update\n" |
| 5983 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5984 | |
| 5985 | DEFUN (clear_ip_bgp_as_soft_in, |
| 5986 | clear_ip_bgp_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5987 | "clear ip bgp " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5988 | CLEAR_STR |
| 5989 | IP_STR |
| 5990 | BGP_STR |
| 5991 | "Clear peers with the AS number\n" |
| 5992 | "Soft reconfig\n" |
| 5993 | "Soft reconfig inbound update\n") |
| 5994 | { |
| 5995 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5996 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5997 | } |
| 5998 | |
| 5999 | ALIAS (clear_ip_bgp_as_soft_in, |
| 6000 | clear_ip_bgp_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6001 | "clear ip bgp " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6002 | CLEAR_STR |
| 6003 | IP_STR |
| 6004 | BGP_STR |
| 6005 | "Clear peers with the AS number\n" |
| 6006 | "Soft reconfig inbound update\n") |
| 6007 | |
| 6008 | DEFUN (clear_ip_bgp_as_in_prefix_filter, |
| 6009 | clear_ip_bgp_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6010 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6011 | CLEAR_STR |
| 6012 | IP_STR |
| 6013 | BGP_STR |
| 6014 | "Clear peers with the AS number\n" |
| 6015 | "Soft reconfig inbound update\n" |
| 6016 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6017 | { |
| 6018 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6019 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6020 | } |
| 6021 | |
| 6022 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, |
| 6023 | clear_ip_bgp_as_ipv4_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6024 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6025 | CLEAR_STR |
| 6026 | IP_STR |
| 6027 | BGP_STR |
| 6028 | "Clear peers with the AS number\n" |
| 6029 | "Address family\n" |
| 6030 | "Address Family modifier\n" |
| 6031 | "Address Family modifier\n" |
| 6032 | "Soft reconfig\n" |
| 6033 | "Soft reconfig inbound update\n") |
| 6034 | { |
| 6035 | if (strncmp (argv[1], "m", 1) == 0) |
| 6036 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6037 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6038 | |
| 6039 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6040 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6041 | } |
| 6042 | |
| 6043 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, |
| 6044 | clear_ip_bgp_as_ipv4_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6045 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6046 | CLEAR_STR |
| 6047 | IP_STR |
| 6048 | BGP_STR |
| 6049 | "Clear peers with the AS number\n" |
| 6050 | "Address family\n" |
| 6051 | "Address Family modifier\n" |
| 6052 | "Address Family modifier\n" |
| 6053 | "Soft reconfig inbound update\n") |
| 6054 | |
| 6055 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
| 6056 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6057 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6058 | CLEAR_STR |
| 6059 | IP_STR |
| 6060 | BGP_STR |
| 6061 | "Clear peers with the AS number\n" |
| 6062 | "Address family\n" |
| 6063 | "Address Family modifier\n" |
| 6064 | "Address Family modifier\n" |
| 6065 | "Soft reconfig inbound update\n" |
| 6066 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6067 | { |
| 6068 | if (strncmp (argv[1], "m", 1) == 0) |
| 6069 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6070 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6071 | |
| 6072 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6073 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6074 | } |
| 6075 | |
| 6076 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, |
| 6077 | clear_ip_bgp_as_vpnv4_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6078 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6079 | CLEAR_STR |
| 6080 | IP_STR |
| 6081 | BGP_STR |
| 6082 | "Clear peers with the AS number\n" |
| 6083 | "Address family\n" |
| 6084 | "Address Family modifier\n" |
| 6085 | "Soft reconfig\n" |
| 6086 | "Soft reconfig inbound update\n") |
| 6087 | { |
| 6088 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 6089 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6090 | } |
| 6091 | |
| 6092 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, |
| 6093 | clear_ip_bgp_as_vpnv4_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6094 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6095 | CLEAR_STR |
| 6096 | IP_STR |
| 6097 | BGP_STR |
| 6098 | "Clear peers with the AS number\n" |
| 6099 | "Address family\n" |
| 6100 | "Address Family modifier\n" |
| 6101 | "Soft reconfig inbound update\n") |
| 6102 | |
| 6103 | DEFUN (clear_bgp_as_soft_in, |
| 6104 | clear_bgp_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6105 | "clear bgp " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6106 | CLEAR_STR |
| 6107 | BGP_STR |
| 6108 | "Clear peers with the AS number\n" |
| 6109 | "Soft reconfig\n" |
| 6110 | "Soft reconfig inbound update\n") |
| 6111 | { |
| 6112 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6113 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6114 | } |
| 6115 | |
| 6116 | ALIAS (clear_bgp_as_soft_in, |
| 6117 | clear_bgp_ipv6_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6118 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6119 | CLEAR_STR |
| 6120 | BGP_STR |
| 6121 | "Address family\n" |
| 6122 | "Clear peers with the AS number\n" |
| 6123 | "Soft reconfig\n" |
| 6124 | "Soft reconfig inbound update\n") |
| 6125 | |
| 6126 | ALIAS (clear_bgp_as_soft_in, |
| 6127 | clear_bgp_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6128 | "clear bgp " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6129 | CLEAR_STR |
| 6130 | BGP_STR |
| 6131 | "Clear peers with the AS number\n" |
| 6132 | "Soft reconfig inbound update\n") |
| 6133 | |
| 6134 | ALIAS (clear_bgp_as_soft_in, |
| 6135 | clear_bgp_ipv6_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6136 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6137 | CLEAR_STR |
| 6138 | BGP_STR |
| 6139 | "Address family\n" |
| 6140 | "Clear peers with the AS number\n" |
| 6141 | "Soft reconfig inbound update\n") |
| 6142 | |
| 6143 | DEFUN (clear_bgp_as_in_prefix_filter, |
| 6144 | clear_bgp_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6145 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6146 | CLEAR_STR |
| 6147 | BGP_STR |
| 6148 | "Clear peers with the AS number\n" |
| 6149 | "Soft reconfig inbound update\n" |
| 6150 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6151 | { |
| 6152 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6153 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6154 | } |
| 6155 | |
| 6156 | ALIAS (clear_bgp_as_in_prefix_filter, |
| 6157 | clear_bgp_ipv6_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6158 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6159 | CLEAR_STR |
| 6160 | BGP_STR |
| 6161 | "Address family\n" |
| 6162 | "Clear peers with the AS number\n" |
| 6163 | "Soft reconfig inbound update\n" |
| 6164 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6165 | |
| 6166 | /* Both soft-reconfiguration */ |
| 6167 | DEFUN (clear_ip_bgp_all_soft, |
| 6168 | clear_ip_bgp_all_soft_cmd, |
| 6169 | "clear ip bgp * soft", |
| 6170 | CLEAR_STR |
| 6171 | IP_STR |
| 6172 | BGP_STR |
| 6173 | "Clear all peers\n" |
| 6174 | "Soft reconfig\n") |
| 6175 | { |
| 6176 | if (argc == 1) |
| 6177 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6178 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6179 | |
| 6180 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6181 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6182 | } |
| 6183 | |
| 6184 | ALIAS (clear_ip_bgp_all_soft, |
| 6185 | clear_ip_bgp_instance_all_soft_cmd, |
| 6186 | "clear ip bgp view WORD * soft", |
| 6187 | CLEAR_STR |
| 6188 | IP_STR |
| 6189 | BGP_STR |
| 6190 | "BGP view\n" |
| 6191 | "view name\n" |
| 6192 | "Clear all peers\n" |
| 6193 | "Soft reconfig\n") |
| 6194 | |
| 6195 | |
| 6196 | DEFUN (clear_ip_bgp_all_ipv4_soft, |
| 6197 | clear_ip_bgp_all_ipv4_soft_cmd, |
| 6198 | "clear ip bgp * ipv4 (unicast|multicast) soft", |
| 6199 | CLEAR_STR |
| 6200 | IP_STR |
| 6201 | BGP_STR |
| 6202 | "Clear all peers\n" |
| 6203 | "Address family\n" |
| 6204 | "Address Family Modifier\n" |
| 6205 | "Address Family Modifier\n" |
| 6206 | "Soft reconfig\n") |
| 6207 | { |
| 6208 | if (strncmp (argv[0], "m", 1) == 0) |
| 6209 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 6210 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6211 | |
| 6212 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6213 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6214 | } |
| 6215 | |
| 6216 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, |
| 6217 | clear_ip_bgp_instance_all_ipv4_soft_cmd, |
| 6218 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", |
| 6219 | CLEAR_STR |
| 6220 | IP_STR |
| 6221 | BGP_STR |
| 6222 | "BGP view\n" |
| 6223 | "view name\n" |
| 6224 | "Clear all peers\n" |
| 6225 | "Address family\n" |
| 6226 | "Address Family Modifier\n" |
| 6227 | "Address Family Modifier\n" |
| 6228 | "Soft reconfig\n") |
| 6229 | { |
| 6230 | if (strncmp (argv[1], "m", 1) == 0) |
| 6231 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 6232 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6233 | |
| 6234 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6235 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6236 | } |
| 6237 | |
| 6238 | DEFUN (clear_ip_bgp_all_vpnv4_soft, |
| 6239 | clear_ip_bgp_all_vpnv4_soft_cmd, |
| 6240 | "clear ip bgp * vpnv4 unicast soft", |
| 6241 | CLEAR_STR |
| 6242 | IP_STR |
| 6243 | BGP_STR |
| 6244 | "Clear all peers\n" |
| 6245 | "Address family\n" |
| 6246 | "Address Family Modifier\n" |
| 6247 | "Soft reconfig\n") |
| 6248 | { |
| 6249 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 6250 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6251 | } |
| 6252 | |
| 6253 | DEFUN (clear_bgp_all_soft, |
| 6254 | clear_bgp_all_soft_cmd, |
| 6255 | "clear bgp * soft", |
| 6256 | CLEAR_STR |
| 6257 | BGP_STR |
| 6258 | "Clear all peers\n" |
| 6259 | "Soft reconfig\n") |
| 6260 | { |
| 6261 | if (argc == 1) |
| 6262 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6263 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6264 | |
| 6265 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6266 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6267 | } |
| 6268 | |
| 6269 | ALIAS (clear_bgp_all_soft, |
| 6270 | clear_bgp_instance_all_soft_cmd, |
| 6271 | "clear bgp view WORD * soft", |
| 6272 | CLEAR_STR |
| 6273 | BGP_STR |
| 6274 | "BGP view\n" |
| 6275 | "view name\n" |
| 6276 | "Clear all peers\n" |
| 6277 | "Soft reconfig\n") |
| 6278 | |
| 6279 | ALIAS (clear_bgp_all_soft, |
| 6280 | clear_bgp_ipv6_all_soft_cmd, |
| 6281 | "clear bgp ipv6 * soft", |
| 6282 | CLEAR_STR |
| 6283 | BGP_STR |
| 6284 | "Address family\n" |
| 6285 | "Clear all peers\n" |
| 6286 | "Soft reconfig\n") |
| 6287 | |
| 6288 | DEFUN (clear_ip_bgp_peer_soft, |
| 6289 | clear_ip_bgp_peer_soft_cmd, |
| 6290 | "clear ip bgp A.B.C.D soft", |
| 6291 | CLEAR_STR |
| 6292 | IP_STR |
| 6293 | BGP_STR |
| 6294 | "BGP neighbor address to clear\n" |
| 6295 | "Soft reconfig\n") |
| 6296 | { |
| 6297 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6298 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6299 | } |
| 6300 | |
| 6301 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
| 6302 | clear_ip_bgp_peer_ipv4_soft_cmd, |
| 6303 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", |
| 6304 | CLEAR_STR |
| 6305 | IP_STR |
| 6306 | BGP_STR |
| 6307 | "BGP neighbor address to clear\n" |
| 6308 | "Address family\n" |
| 6309 | "Address Family Modifier\n" |
| 6310 | "Address Family Modifier\n" |
| 6311 | "Soft reconfig\n") |
| 6312 | { |
| 6313 | if (strncmp (argv[1], "m", 1) == 0) |
| 6314 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 6315 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6316 | |
| 6317 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6318 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6319 | } |
| 6320 | |
| 6321 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
| 6322 | clear_ip_bgp_peer_vpnv4_soft_cmd, |
| 6323 | "clear ip bgp A.B.C.D vpnv4 unicast soft", |
| 6324 | CLEAR_STR |
| 6325 | IP_STR |
| 6326 | BGP_STR |
| 6327 | "BGP neighbor address to clear\n" |
| 6328 | "Address family\n" |
| 6329 | "Address Family Modifier\n" |
| 6330 | "Soft reconfig\n") |
| 6331 | { |
| 6332 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 6333 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6334 | } |
| 6335 | |
| 6336 | DEFUN (clear_bgp_peer_soft, |
| 6337 | clear_bgp_peer_soft_cmd, |
| 6338 | "clear bgp (A.B.C.D|X:X::X:X) soft", |
| 6339 | CLEAR_STR |
| 6340 | BGP_STR |
| 6341 | "BGP neighbor address to clear\n" |
| 6342 | "BGP IPv6 neighbor to clear\n" |
| 6343 | "Soft reconfig\n") |
| 6344 | { |
| 6345 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6346 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6347 | } |
| 6348 | |
| 6349 | ALIAS (clear_bgp_peer_soft, |
| 6350 | clear_bgp_ipv6_peer_soft_cmd, |
| 6351 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft", |
| 6352 | CLEAR_STR |
| 6353 | BGP_STR |
| 6354 | "Address family\n" |
| 6355 | "BGP neighbor address to clear\n" |
| 6356 | "BGP IPv6 neighbor to clear\n" |
| 6357 | "Soft reconfig\n") |
| 6358 | |
| 6359 | DEFUN (clear_ip_bgp_peer_group_soft, |
| 6360 | clear_ip_bgp_peer_group_soft_cmd, |
| 6361 | "clear ip bgp peer-group WORD soft", |
| 6362 | CLEAR_STR |
| 6363 | IP_STR |
| 6364 | BGP_STR |
| 6365 | "Clear all members of peer-group\n" |
| 6366 | "BGP peer-group name\n" |
| 6367 | "Soft reconfig\n") |
| 6368 | { |
| 6369 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6370 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6371 | } |
| 6372 | |
| 6373 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
| 6374 | clear_ip_bgp_peer_group_ipv4_soft_cmd, |
| 6375 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", |
| 6376 | CLEAR_STR |
| 6377 | IP_STR |
| 6378 | BGP_STR |
| 6379 | "Clear all members of peer-group\n" |
| 6380 | "BGP peer-group name\n" |
| 6381 | "Address family\n" |
| 6382 | "Address Family modifier\n" |
| 6383 | "Address Family modifier\n" |
| 6384 | "Soft reconfig\n") |
| 6385 | { |
| 6386 | if (strncmp (argv[1], "m", 1) == 0) |
| 6387 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 6388 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6389 | |
| 6390 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6391 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6392 | } |
| 6393 | |
| 6394 | DEFUN (clear_bgp_peer_group_soft, |
| 6395 | clear_bgp_peer_group_soft_cmd, |
| 6396 | "clear bgp peer-group WORD soft", |
| 6397 | CLEAR_STR |
| 6398 | BGP_STR |
| 6399 | "Clear all members of peer-group\n" |
| 6400 | "BGP peer-group name\n" |
| 6401 | "Soft reconfig\n") |
| 6402 | { |
| 6403 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 6404 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6405 | } |
| 6406 | |
| 6407 | ALIAS (clear_bgp_peer_group_soft, |
| 6408 | clear_bgp_ipv6_peer_group_soft_cmd, |
| 6409 | "clear bgp ipv6 peer-group WORD soft", |
| 6410 | CLEAR_STR |
| 6411 | BGP_STR |
| 6412 | "Address family\n" |
| 6413 | "Clear all members of peer-group\n" |
| 6414 | "BGP peer-group name\n" |
| 6415 | "Soft reconfig\n") |
| 6416 | |
| 6417 | DEFUN (clear_ip_bgp_external_soft, |
| 6418 | clear_ip_bgp_external_soft_cmd, |
| 6419 | "clear ip bgp external soft", |
| 6420 | CLEAR_STR |
| 6421 | IP_STR |
| 6422 | BGP_STR |
| 6423 | "Clear all external peers\n" |
| 6424 | "Soft reconfig\n") |
| 6425 | { |
| 6426 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6427 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6428 | } |
| 6429 | |
| 6430 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
| 6431 | clear_ip_bgp_external_ipv4_soft_cmd, |
| 6432 | "clear ip bgp external ipv4 (unicast|multicast) soft", |
| 6433 | CLEAR_STR |
| 6434 | IP_STR |
| 6435 | BGP_STR |
| 6436 | "Clear all external peers\n" |
| 6437 | "Address family\n" |
| 6438 | "Address Family modifier\n" |
| 6439 | "Address Family modifier\n" |
| 6440 | "Soft reconfig\n") |
| 6441 | { |
| 6442 | if (strncmp (argv[0], "m", 1) == 0) |
| 6443 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 6444 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6445 | |
| 6446 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6447 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6448 | } |
| 6449 | |
| 6450 | DEFUN (clear_bgp_external_soft, |
| 6451 | clear_bgp_external_soft_cmd, |
| 6452 | "clear bgp external soft", |
| 6453 | CLEAR_STR |
| 6454 | BGP_STR |
| 6455 | "Clear all external peers\n" |
| 6456 | "Soft reconfig\n") |
| 6457 | { |
| 6458 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 6459 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6460 | } |
| 6461 | |
| 6462 | ALIAS (clear_bgp_external_soft, |
| 6463 | clear_bgp_ipv6_external_soft_cmd, |
| 6464 | "clear bgp ipv6 external soft", |
| 6465 | CLEAR_STR |
| 6466 | BGP_STR |
| 6467 | "Address family\n" |
| 6468 | "Clear all external peers\n" |
| 6469 | "Soft reconfig\n") |
| 6470 | |
| 6471 | DEFUN (clear_ip_bgp_as_soft, |
| 6472 | clear_ip_bgp_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6473 | "clear ip bgp " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6474 | CLEAR_STR |
| 6475 | IP_STR |
| 6476 | BGP_STR |
| 6477 | "Clear peers with the AS number\n" |
| 6478 | "Soft reconfig\n") |
| 6479 | { |
| 6480 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6481 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6482 | } |
| 6483 | |
| 6484 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
| 6485 | clear_ip_bgp_as_ipv4_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6486 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6487 | CLEAR_STR |
| 6488 | IP_STR |
| 6489 | BGP_STR |
| 6490 | "Clear peers with the AS number\n" |
| 6491 | "Address family\n" |
| 6492 | "Address Family Modifier\n" |
| 6493 | "Address Family Modifier\n" |
| 6494 | "Soft reconfig\n") |
| 6495 | { |
| 6496 | if (strncmp (argv[1], "m", 1) == 0) |
| 6497 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6498 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6499 | |
| 6500 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, |
| 6501 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6502 | } |
| 6503 | |
| 6504 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
| 6505 | clear_ip_bgp_as_vpnv4_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6506 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6507 | CLEAR_STR |
| 6508 | IP_STR |
| 6509 | BGP_STR |
| 6510 | "Clear peers with the AS number\n" |
| 6511 | "Address family\n" |
| 6512 | "Address Family Modifier\n" |
| 6513 | "Soft reconfig\n") |
| 6514 | { |
| 6515 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 6516 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6517 | } |
| 6518 | |
| 6519 | DEFUN (clear_bgp_as_soft, |
| 6520 | clear_bgp_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6521 | "clear bgp " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6522 | CLEAR_STR |
| 6523 | BGP_STR |
| 6524 | "Clear peers with the AS number\n" |
| 6525 | "Soft reconfig\n") |
| 6526 | { |
| 6527 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6528 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6529 | } |
| 6530 | |
| 6531 | ALIAS (clear_bgp_as_soft, |
| 6532 | clear_bgp_ipv6_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6533 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6534 | CLEAR_STR |
| 6535 | BGP_STR |
| 6536 | "Address family\n" |
| 6537 | "Clear peers with the AS number\n" |
| 6538 | "Soft reconfig\n") |
| 6539 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6540 | /* RS-client soft reconfiguration. */ |
| 6541 | #ifdef HAVE_IPV6 |
| 6542 | DEFUN (clear_bgp_all_rsclient, |
| 6543 | clear_bgp_all_rsclient_cmd, |
| 6544 | "clear bgp * rsclient", |
| 6545 | CLEAR_STR |
| 6546 | BGP_STR |
| 6547 | "Clear all peers\n" |
| 6548 | "Soft reconfig for rsclient RIB\n") |
| 6549 | { |
| 6550 | if (argc == 1) |
| 6551 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6552 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6553 | |
| 6554 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6555 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6556 | } |
| 6557 | |
| 6558 | ALIAS (clear_bgp_all_rsclient, |
| 6559 | clear_bgp_ipv6_all_rsclient_cmd, |
| 6560 | "clear bgp ipv6 * rsclient", |
| 6561 | CLEAR_STR |
| 6562 | BGP_STR |
| 6563 | "Address family\n" |
| 6564 | "Clear all peers\n" |
| 6565 | "Soft reconfig for rsclient RIB\n") |
| 6566 | |
| 6567 | ALIAS (clear_bgp_all_rsclient, |
| 6568 | clear_bgp_instance_all_rsclient_cmd, |
| 6569 | "clear bgp view WORD * rsclient", |
| 6570 | CLEAR_STR |
| 6571 | BGP_STR |
| 6572 | "BGP view\n" |
| 6573 | "view name\n" |
| 6574 | "Clear all peers\n" |
| 6575 | "Soft reconfig for rsclient RIB\n") |
| 6576 | |
| 6577 | ALIAS (clear_bgp_all_rsclient, |
| 6578 | clear_bgp_ipv6_instance_all_rsclient_cmd, |
| 6579 | "clear bgp ipv6 view WORD * rsclient", |
| 6580 | CLEAR_STR |
| 6581 | BGP_STR |
| 6582 | "Address family\n" |
| 6583 | "BGP view\n" |
| 6584 | "view name\n" |
| 6585 | "Clear all peers\n" |
| 6586 | "Soft reconfig for rsclient RIB\n") |
| 6587 | #endif /* HAVE_IPV6 */ |
| 6588 | |
| 6589 | DEFUN (clear_ip_bgp_all_rsclient, |
| 6590 | clear_ip_bgp_all_rsclient_cmd, |
| 6591 | "clear ip bgp * rsclient", |
| 6592 | CLEAR_STR |
| 6593 | IP_STR |
| 6594 | BGP_STR |
| 6595 | "Clear all peers\n" |
| 6596 | "Soft reconfig for rsclient RIB\n") |
| 6597 | { |
| 6598 | if (argc == 1) |
| 6599 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6600 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6601 | |
| 6602 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6603 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6604 | } |
| 6605 | |
| 6606 | ALIAS (clear_ip_bgp_all_rsclient, |
| 6607 | clear_ip_bgp_instance_all_rsclient_cmd, |
| 6608 | "clear ip bgp view WORD * rsclient", |
| 6609 | CLEAR_STR |
| 6610 | IP_STR |
| 6611 | BGP_STR |
| 6612 | "BGP view\n" |
| 6613 | "view name\n" |
| 6614 | "Clear all peers\n" |
| 6615 | "Soft reconfig for rsclient RIB\n") |
| 6616 | |
| 6617 | #ifdef HAVE_IPV6 |
| 6618 | DEFUN (clear_bgp_peer_rsclient, |
| 6619 | clear_bgp_peer_rsclient_cmd, |
| 6620 | "clear bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6621 | CLEAR_STR |
| 6622 | BGP_STR |
| 6623 | "BGP neighbor IP address to clear\n" |
| 6624 | "BGP IPv6 neighbor to clear\n" |
| 6625 | "Soft reconfig for rsclient RIB\n") |
| 6626 | { |
| 6627 | if (argc == 2) |
| 6628 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6629 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6630 | |
| 6631 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6632 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6633 | } |
| 6634 | |
| 6635 | ALIAS (clear_bgp_peer_rsclient, |
| 6636 | clear_bgp_ipv6_peer_rsclient_cmd, |
| 6637 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient", |
| 6638 | CLEAR_STR |
| 6639 | BGP_STR |
| 6640 | "Address family\n" |
| 6641 | "BGP neighbor IP address to clear\n" |
| 6642 | "BGP IPv6 neighbor to clear\n" |
| 6643 | "Soft reconfig for rsclient RIB\n") |
| 6644 | |
| 6645 | ALIAS (clear_bgp_peer_rsclient, |
| 6646 | clear_bgp_instance_peer_rsclient_cmd, |
| 6647 | "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6648 | CLEAR_STR |
| 6649 | BGP_STR |
| 6650 | "BGP view\n" |
| 6651 | "view name\n" |
| 6652 | "BGP neighbor IP address to clear\n" |
| 6653 | "BGP IPv6 neighbor to clear\n" |
| 6654 | "Soft reconfig for rsclient RIB\n") |
| 6655 | |
| 6656 | ALIAS (clear_bgp_peer_rsclient, |
| 6657 | clear_bgp_ipv6_instance_peer_rsclient_cmd, |
| 6658 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6659 | CLEAR_STR |
| 6660 | BGP_STR |
| 6661 | "Address family\n" |
| 6662 | "BGP view\n" |
| 6663 | "view name\n" |
| 6664 | "BGP neighbor IP address to clear\n" |
| 6665 | "BGP IPv6 neighbor to clear\n" |
| 6666 | "Soft reconfig for rsclient RIB\n") |
| 6667 | #endif /* HAVE_IPV6 */ |
| 6668 | |
| 6669 | DEFUN (clear_ip_bgp_peer_rsclient, |
| 6670 | clear_ip_bgp_peer_rsclient_cmd, |
| 6671 | "clear ip bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6672 | CLEAR_STR |
| 6673 | IP_STR |
| 6674 | BGP_STR |
| 6675 | "BGP neighbor IP address to clear\n" |
| 6676 | "BGP IPv6 neighbor to clear\n" |
| 6677 | "Soft reconfig for rsclient RIB\n") |
| 6678 | { |
| 6679 | if (argc == 2) |
| 6680 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, |
| 6681 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6682 | |
| 6683 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6684 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6685 | } |
| 6686 | |
| 6687 | ALIAS (clear_ip_bgp_peer_rsclient, |
| 6688 | clear_ip_bgp_instance_peer_rsclient_cmd, |
| 6689 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6690 | CLEAR_STR |
| 6691 | IP_STR |
| 6692 | BGP_STR |
| 6693 | "BGP view\n" |
| 6694 | "view name\n" |
| 6695 | "BGP neighbor IP address to clear\n" |
| 6696 | "BGP IPv6 neighbor to clear\n" |
| 6697 | "Soft reconfig for rsclient RIB\n") |
| 6698 | |
Michael Lambert | e0081f7 | 2008-11-16 20:12:04 +0000 | [diff] [blame] | 6699 | DEFUN (show_bgp_views, |
| 6700 | show_bgp_views_cmd, |
| 6701 | "show bgp views", |
| 6702 | SHOW_STR |
| 6703 | BGP_STR |
| 6704 | "Show the defined BGP views\n") |
| 6705 | { |
| 6706 | struct list *inst = bm->bgp; |
| 6707 | struct listnode *node; |
| 6708 | struct bgp *bgp; |
| 6709 | |
| 6710 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) |
| 6711 | { |
| 6712 | vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE); |
| 6713 | return CMD_WARNING; |
| 6714 | } |
| 6715 | |
| 6716 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); |
| 6717 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) |
| 6718 | vty_out (vty, "\t%s (AS%u)%s", |
| 6719 | bgp->name ? bgp->name : "(null)", |
| 6720 | bgp->as, VTY_NEWLINE); |
| 6721 | |
| 6722 | return CMD_SUCCESS; |
| 6723 | } |
| 6724 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6725 | DEFUN (show_bgp_memory, |
| 6726 | show_bgp_memory_cmd, |
| 6727 | "show bgp memory", |
| 6728 | SHOW_STR |
| 6729 | BGP_STR |
| 6730 | "Global BGP memory statistics\n") |
| 6731 | { |
| 6732 | char memstrbuf[MTYPE_MEMSTR_LEN]; |
| 6733 | unsigned long count; |
| 6734 | |
| 6735 | /* RIB related usage stats */ |
| 6736 | count = mtype_stats_alloc (MTYPE_BGP_NODE); |
| 6737 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, |
| 6738 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6739 | count * sizeof (struct bgp_node)), |
| 6740 | VTY_NEWLINE); |
| 6741 | |
| 6742 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); |
| 6743 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, |
| 6744 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6745 | count * sizeof (struct bgp_info)), |
| 6746 | VTY_NEWLINE); |
Paul Jakma | fb982c2 | 2007-05-04 20:15:47 +0000 | [diff] [blame] | 6747 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
| 6748 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, |
| 6749 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6750 | count * sizeof (struct bgp_info_extra)), |
| 6751 | VTY_NEWLINE); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6752 | |
| 6753 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) |
| 6754 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, |
| 6755 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6756 | count * sizeof (struct bgp_static)), |
| 6757 | VTY_NEWLINE); |
| 6758 | |
| 6759 | /* Adj-In/Out */ |
| 6760 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) |
| 6761 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, |
| 6762 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6763 | count * sizeof (struct bgp_adj_in)), |
| 6764 | VTY_NEWLINE); |
| 6765 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) |
| 6766 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, |
| 6767 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6768 | count * sizeof (struct bgp_adj_out)), |
| 6769 | VTY_NEWLINE); |
| 6770 | |
| 6771 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) |
| 6772 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, |
| 6773 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6774 | count * sizeof (struct bgp_nexthop_cache)), |
| 6775 | VTY_NEWLINE); |
| 6776 | |
| 6777 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) |
| 6778 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, |
| 6779 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6780 | count * sizeof (struct bgp_damp_info)), |
| 6781 | VTY_NEWLINE); |
| 6782 | |
| 6783 | /* Attributes */ |
| 6784 | count = attr_count(); |
| 6785 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, |
| 6786 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6787 | count * sizeof(struct attr)), |
| 6788 | VTY_NEWLINE); |
Paul Jakma | fb982c2 | 2007-05-04 20:15:47 +0000 | [diff] [blame] | 6789 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
| 6790 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, |
| 6791 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6792 | count * sizeof(struct attr_extra)), |
| 6793 | VTY_NEWLINE); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6794 | |
| 6795 | if ((count = attr_unknown_count())) |
| 6796 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); |
| 6797 | |
| 6798 | /* AS_PATH attributes */ |
| 6799 | count = aspath_count (); |
| 6800 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, |
| 6801 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6802 | count * sizeof (struct aspath)), |
| 6803 | VTY_NEWLINE); |
| 6804 | |
| 6805 | count = mtype_stats_alloc (MTYPE_AS_SEG); |
| 6806 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, |
| 6807 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6808 | count * sizeof (struct assegment)), |
| 6809 | VTY_NEWLINE); |
| 6810 | |
| 6811 | /* Other attributes */ |
| 6812 | if ((count = community_count ())) |
| 6813 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, |
| 6814 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6815 | count * sizeof (struct community)), |
| 6816 | VTY_NEWLINE); |
| 6817 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) |
| 6818 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, |
| 6819 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6820 | count * sizeof (struct ecommunity)), |
| 6821 | VTY_NEWLINE); |
| 6822 | |
| 6823 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) |
| 6824 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, |
| 6825 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6826 | count * sizeof (struct cluster_list)), |
| 6827 | VTY_NEWLINE); |
| 6828 | |
| 6829 | /* Peer related usage */ |
| 6830 | count = mtype_stats_alloc (MTYPE_BGP_PEER); |
| 6831 | vty_out (vty, "%ld peers, using %s of memory%s", count, |
| 6832 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6833 | count * sizeof (struct peer)), |
| 6834 | VTY_NEWLINE); |
| 6835 | |
| 6836 | if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP))) |
| 6837 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, |
| 6838 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6839 | count * sizeof (struct peer_group)), |
| 6840 | VTY_NEWLINE); |
| 6841 | |
| 6842 | /* Other */ |
| 6843 | if ((count = mtype_stats_alloc (MTYPE_HASH))) |
| 6844 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, |
| 6845 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6846 | count * sizeof (struct hash)), |
| 6847 | VTY_NEWLINE); |
| 6848 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) |
| 6849 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, |
| 6850 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6851 | count * sizeof (struct hash_backet)), |
| 6852 | VTY_NEWLINE); |
| 6853 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) |
| 6854 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, |
| 6855 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6856 | count * sizeof (regex_t)), |
| 6857 | VTY_NEWLINE); |
| 6858 | return CMD_SUCCESS; |
| 6859 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6860 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6861 | /* Show BGP peer's summary information. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6862 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6863 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) |
| 6864 | { |
| 6865 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6866 | struct listnode *node, *nnode; |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6867 | unsigned int count = 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6868 | char timebuf[BGP_UPTIME_LEN]; |
| 6869 | int len; |
| 6870 | |
| 6871 | /* Header string for each address family. */ |
| 6872 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6873 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6874 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6875 | { |
| 6876 | if (peer->afc[afi][safi]) |
| 6877 | { |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6878 | if (!count) |
| 6879 | { |
| 6880 | unsigned long ents; |
| 6881 | char memstrbuf[MTYPE_MEMSTR_LEN]; |
| 6882 | |
| 6883 | /* Usage summary and header */ |
| 6884 | vty_out (vty, |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 6885 | "BGP router identifier %s, local AS number %u%s", |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6886 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6887 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6888 | ents = bgp_table_count (bgp->rib[afi][safi]); |
| 6889 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, |
| 6890 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6891 | ents * sizeof (struct bgp_node)), |
| 6892 | VTY_NEWLINE); |
| 6893 | |
| 6894 | /* Peer related usage */ |
| 6895 | ents = listcount (bgp->peer); |
| 6896 | vty_out (vty, "Peers %ld, using %s of memory%s", |
| 6897 | ents, |
| 6898 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6899 | ents * sizeof (struct peer)), |
| 6900 | VTY_NEWLINE); |
| 6901 | |
| 6902 | if ((ents = listcount (bgp->rsclient))) |
| 6903 | vty_out (vty, "RS-Client peers %ld, using %s of memory%s", |
| 6904 | ents, |
| 6905 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6906 | ents * sizeof (struct peer)), |
| 6907 | VTY_NEWLINE); |
| 6908 | |
| 6909 | if ((ents = listcount (bgp->group))) |
| 6910 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, |
| 6911 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6912 | ents * sizeof (struct peer_group)), |
| 6913 | VTY_NEWLINE); |
| 6914 | |
| 6915 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
| 6916 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); |
| 6917 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6918 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 6919 | } |
| 6920 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6921 | count++; |
| 6922 | |
| 6923 | len = vty_out (vty, "%s", peer->host); |
| 6924 | len = 16 - len; |
| 6925 | if (len < 1) |
| 6926 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 6927 | else |
| 6928 | vty_out (vty, "%*s", len, " "); |
| 6929 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 6930 | vty_out (vty, "4 "); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6931 | |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 6932 | vty_out (vty, "%5u %7d %7d %8d %4d %4lu ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6933 | peer->as, |
| 6934 | peer->open_in + peer->update_in + peer->keepalive_in |
| 6935 | + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in, |
| 6936 | peer->open_out + peer->update_out + peer->keepalive_out |
| 6937 | + peer->notify_out + peer->refresh_out |
| 6938 | + peer->dynamic_cap_out, |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 6939 | 0, 0, (unsigned long) peer->obuf->count); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6940 | |
| 6941 | vty_out (vty, "%8s", |
| 6942 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); |
| 6943 | |
| 6944 | if (peer->status == Established) |
| 6945 | { |
| 6946 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); |
| 6947 | } |
| 6948 | else |
| 6949 | { |
| 6950 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) |
| 6951 | vty_out (vty, " Idle (Admin)"); |
| 6952 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 6953 | vty_out (vty, " Idle (PfxCt)"); |
| 6954 | else |
| 6955 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); |
| 6956 | } |
| 6957 | |
| 6958 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6959 | } |
| 6960 | } |
| 6961 | |
| 6962 | if (count) |
| 6963 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, |
| 6964 | count, VTY_NEWLINE); |
| 6965 | else |
| 6966 | vty_out (vty, "No %s neighbor is configured%s", |
| 6967 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 6968 | return CMD_SUCCESS; |
| 6969 | } |
| 6970 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6971 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 6972 | bgp_show_summary_vty (struct vty *vty, const char *name, |
| 6973 | afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6974 | { |
| 6975 | struct bgp *bgp; |
| 6976 | |
| 6977 | if (name) |
| 6978 | { |
| 6979 | bgp = bgp_lookup_by_name (name); |
| 6980 | |
| 6981 | if (! bgp) |
| 6982 | { |
| 6983 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 6984 | return CMD_WARNING; |
| 6985 | } |
| 6986 | |
| 6987 | bgp_show_summary (vty, bgp, afi, safi); |
| 6988 | return CMD_SUCCESS; |
| 6989 | } |
| 6990 | |
| 6991 | bgp = bgp_get_default (); |
| 6992 | |
| 6993 | if (bgp) |
| 6994 | bgp_show_summary (vty, bgp, afi, safi); |
| 6995 | |
| 6996 | return CMD_SUCCESS; |
| 6997 | } |
| 6998 | |
| 6999 | /* `show ip bgp summary' commands. */ |
| 7000 | DEFUN (show_ip_bgp_summary, |
| 7001 | show_ip_bgp_summary_cmd, |
| 7002 | "show ip bgp summary", |
| 7003 | SHOW_STR |
| 7004 | IP_STR |
| 7005 | BGP_STR |
| 7006 | "Summary of BGP neighbor status\n") |
| 7007 | { |
| 7008 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 7009 | } |
| 7010 | |
| 7011 | DEFUN (show_ip_bgp_instance_summary, |
| 7012 | show_ip_bgp_instance_summary_cmd, |
| 7013 | "show ip bgp view WORD summary", |
| 7014 | SHOW_STR |
| 7015 | IP_STR |
| 7016 | BGP_STR |
| 7017 | "BGP view\n" |
| 7018 | "View name\n" |
| 7019 | "Summary of BGP neighbor status\n") |
| 7020 | { |
| 7021 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 7022 | } |
| 7023 | |
| 7024 | DEFUN (show_ip_bgp_ipv4_summary, |
| 7025 | show_ip_bgp_ipv4_summary_cmd, |
| 7026 | "show ip bgp ipv4 (unicast|multicast) summary", |
| 7027 | SHOW_STR |
| 7028 | IP_STR |
| 7029 | BGP_STR |
| 7030 | "Address family\n" |
| 7031 | "Address Family modifier\n" |
| 7032 | "Address Family modifier\n" |
| 7033 | "Summary of BGP neighbor status\n") |
| 7034 | { |
| 7035 | if (strncmp (argv[0], "m", 1) == 0) |
| 7036 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 7037 | |
| 7038 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 7039 | } |
| 7040 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 7041 | ALIAS (show_ip_bgp_ipv4_summary, |
| 7042 | show_bgp_ipv4_safi_summary_cmd, |
| 7043 | "show bgp ipv4 (unicast|multicast) summary", |
| 7044 | SHOW_STR |
| 7045 | BGP_STR |
| 7046 | "Address family\n" |
| 7047 | "Address Family modifier\n" |
| 7048 | "Address Family modifier\n" |
| 7049 | "Summary of BGP neighbor status\n") |
| 7050 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7051 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
| 7052 | show_ip_bgp_instance_ipv4_summary_cmd, |
| 7053 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", |
| 7054 | SHOW_STR |
| 7055 | IP_STR |
| 7056 | BGP_STR |
| 7057 | "BGP view\n" |
| 7058 | "View name\n" |
| 7059 | "Address family\n" |
| 7060 | "Address Family modifier\n" |
| 7061 | "Address Family modifier\n" |
| 7062 | "Summary of BGP neighbor status\n") |
| 7063 | { |
| 7064 | if (strncmp (argv[1], "m", 1) == 0) |
| 7065 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 7066 | else |
| 7067 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 7068 | } |
| 7069 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 7070 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
| 7071 | show_bgp_instance_ipv4_safi_summary_cmd, |
| 7072 | "show bgp view WORD ipv4 (unicast|multicast) summary", |
| 7073 | SHOW_STR |
| 7074 | BGP_STR |
| 7075 | "BGP view\n" |
| 7076 | "View name\n" |
| 7077 | "Address family\n" |
| 7078 | "Address Family modifier\n" |
| 7079 | "Address Family modifier\n" |
| 7080 | "Summary of BGP neighbor status\n") |
| 7081 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7082 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
| 7083 | show_ip_bgp_vpnv4_all_summary_cmd, |
| 7084 | "show ip bgp vpnv4 all summary", |
| 7085 | SHOW_STR |
| 7086 | IP_STR |
| 7087 | BGP_STR |
| 7088 | "Display VPNv4 NLRI specific information\n" |
| 7089 | "Display information about all VPNv4 NLRIs\n" |
| 7090 | "Summary of BGP neighbor status\n") |
| 7091 | { |
| 7092 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 7093 | } |
| 7094 | |
| 7095 | DEFUN (show_ip_bgp_vpnv4_rd_summary, |
| 7096 | show_ip_bgp_vpnv4_rd_summary_cmd, |
| 7097 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", |
| 7098 | SHOW_STR |
| 7099 | IP_STR |
| 7100 | BGP_STR |
| 7101 | "Display VPNv4 NLRI specific information\n" |
| 7102 | "Display information for a route distinguisher\n" |
| 7103 | "VPN Route Distinguisher\n" |
| 7104 | "Summary of BGP neighbor status\n") |
| 7105 | { |
| 7106 | int ret; |
| 7107 | struct prefix_rd prd; |
| 7108 | |
| 7109 | ret = str2prefix_rd (argv[0], &prd); |
| 7110 | if (! ret) |
| 7111 | { |
| 7112 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); |
| 7113 | return CMD_WARNING; |
| 7114 | } |
| 7115 | |
| 7116 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 7117 | } |
| 7118 | |
| 7119 | #ifdef HAVE_IPV6 |
| 7120 | DEFUN (show_bgp_summary, |
| 7121 | show_bgp_summary_cmd, |
| 7122 | "show bgp summary", |
| 7123 | SHOW_STR |
| 7124 | BGP_STR |
| 7125 | "Summary of BGP neighbor status\n") |
| 7126 | { |
| 7127 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7128 | } |
| 7129 | |
| 7130 | DEFUN (show_bgp_instance_summary, |
| 7131 | show_bgp_instance_summary_cmd, |
| 7132 | "show bgp view WORD summary", |
| 7133 | SHOW_STR |
| 7134 | BGP_STR |
| 7135 | "BGP view\n" |
| 7136 | "View name\n" |
| 7137 | "Summary of BGP neighbor status\n") |
| 7138 | { |
| 7139 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 7140 | } |
| 7141 | |
| 7142 | ALIAS (show_bgp_summary, |
| 7143 | show_bgp_ipv6_summary_cmd, |
| 7144 | "show bgp ipv6 summary", |
| 7145 | SHOW_STR |
| 7146 | BGP_STR |
| 7147 | "Address family\n" |
| 7148 | "Summary of BGP neighbor status\n") |
| 7149 | |
| 7150 | ALIAS (show_bgp_instance_summary, |
| 7151 | show_bgp_instance_ipv6_summary_cmd, |
| 7152 | "show bgp view WORD ipv6 summary", |
| 7153 | SHOW_STR |
| 7154 | BGP_STR |
| 7155 | "BGP view\n" |
| 7156 | "View name\n" |
| 7157 | "Address family\n" |
| 7158 | "Summary of BGP neighbor status\n") |
| 7159 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 7160 | DEFUN (show_bgp_ipv6_safi_summary, |
| 7161 | show_bgp_ipv6_safi_summary_cmd, |
| 7162 | "show bgp ipv6 (unicast|multicast) summary", |
| 7163 | SHOW_STR |
| 7164 | BGP_STR |
| 7165 | "Address family\n" |
| 7166 | "Address Family modifier\n" |
| 7167 | "Address Family modifier\n" |
| 7168 | "Summary of BGP neighbor status\n") |
| 7169 | { |
| 7170 | if (strncmp (argv[0], "m", 1) == 0) |
| 7171 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 7172 | |
| 7173 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7174 | } |
| 7175 | |
| 7176 | DEFUN (show_bgp_instance_ipv6_safi_summary, |
| 7177 | show_bgp_instance_ipv6_safi_summary_cmd, |
| 7178 | "show bgp view WORD ipv6 (unicast|multicast) summary", |
| 7179 | SHOW_STR |
| 7180 | BGP_STR |
| 7181 | "BGP view\n" |
| 7182 | "View name\n" |
| 7183 | "Address family\n" |
| 7184 | "Address Family modifier\n" |
| 7185 | "Address Family modifier\n" |
| 7186 | "Summary of BGP neighbor status\n") |
| 7187 | { |
| 7188 | if (strncmp (argv[1], "m", 1) == 0) |
| 7189 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST); |
| 7190 | |
| 7191 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 7192 | } |
| 7193 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7194 | /* old command */ |
| 7195 | DEFUN (show_ipv6_bgp_summary, |
| 7196 | show_ipv6_bgp_summary_cmd, |
| 7197 | "show ipv6 bgp summary", |
| 7198 | SHOW_STR |
| 7199 | IPV6_STR |
| 7200 | BGP_STR |
| 7201 | "Summary of BGP neighbor status\n") |
| 7202 | { |
| 7203 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7204 | } |
| 7205 | |
| 7206 | /* old command */ |
| 7207 | DEFUN (show_ipv6_mbgp_summary, |
| 7208 | show_ipv6_mbgp_summary_cmd, |
| 7209 | "show ipv6 mbgp summary", |
| 7210 | SHOW_STR |
| 7211 | IPV6_STR |
| 7212 | MBGP_STR |
| 7213 | "Summary of BGP neighbor status\n") |
| 7214 | { |
| 7215 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 7216 | } |
| 7217 | #endif /* HAVE_IPV6 */ |
| 7218 | |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7219 | const char * |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7220 | afi_safi_print (afi_t afi, safi_t safi) |
| 7221 | { |
| 7222 | if (afi == AFI_IP && safi == SAFI_UNICAST) |
| 7223 | return "IPv4 Unicast"; |
| 7224 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) |
| 7225 | return "IPv4 Multicast"; |
| 7226 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) |
| 7227 | return "VPNv4 Unicast"; |
| 7228 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) |
| 7229 | return "IPv6 Unicast"; |
| 7230 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) |
| 7231 | return "IPv6 Multicast"; |
| 7232 | else |
| 7233 | return "Unknown"; |
| 7234 | } |
| 7235 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7236 | /* Show BGP peer's information. */ |
| 7237 | enum show_type |
| 7238 | { |
| 7239 | show_all, |
| 7240 | show_peer |
| 7241 | }; |
| 7242 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7243 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7244 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
| 7245 | afi_t afi, safi_t safi, |
| 7246 | u_int16_t adv_smcap, u_int16_t adv_rmcap, |
| 7247 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) |
| 7248 | { |
| 7249 | /* Send-Mode */ |
| 7250 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) |
| 7251 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 7252 | { |
| 7253 | vty_out (vty, " Send-mode: "); |
| 7254 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) |
| 7255 | vty_out (vty, "advertised"); |
| 7256 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 7257 | vty_out (vty, "%sreceived", |
| 7258 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? |
| 7259 | ", " : ""); |
| 7260 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7261 | } |
| 7262 | |
| 7263 | /* Receive-Mode */ |
| 7264 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) |
| 7265 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 7266 | { |
| 7267 | vty_out (vty, " Receive-mode: "); |
| 7268 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) |
| 7269 | vty_out (vty, "advertised"); |
| 7270 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 7271 | vty_out (vty, "%sreceived", |
| 7272 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? |
| 7273 | ", " : ""); |
| 7274 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7275 | } |
| 7276 | } |
| 7277 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7278 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7279 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
| 7280 | { |
| 7281 | struct bgp_filter *filter; |
| 7282 | char orf_pfx_name[BUFSIZ]; |
| 7283 | int orf_pfx_count; |
| 7284 | |
| 7285 | filter = &p->filter[afi][safi]; |
| 7286 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7287 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7288 | VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7289 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7290 | if (p->af_group[afi][safi]) |
| 7291 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
| 7292 | |
| 7293 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7294 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 7295 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 7296 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7297 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) |
| 7298 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 7299 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); |
| 7300 | |
| 7301 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7302 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 7303 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7304 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) |
| 7305 | { |
| 7306 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 7307 | ORF_TYPE_PREFIX, VTY_NEWLINE); |
| 7308 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 7309 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 7310 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 7311 | PEER_CAP_ORF_PREFIX_SM_RCV, |
| 7312 | PEER_CAP_ORF_PREFIX_RM_RCV); |
| 7313 | } |
| 7314 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7315 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 7316 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7317 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 7318 | { |
| 7319 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 7320 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); |
| 7321 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 7322 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 7323 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 7324 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, |
| 7325 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); |
| 7326 | } |
| 7327 | |
| 7328 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
| 7329 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); |
| 7330 | |
| 7331 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
| 7332 | || orf_pfx_count) |
| 7333 | { |
| 7334 | vty_out (vty, " Outbound Route Filter (ORF):"); |
| 7335 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) |
| 7336 | vty_out (vty, " sent;"); |
| 7337 | if (orf_pfx_count) |
| 7338 | vty_out (vty, " received (%d entries)", orf_pfx_count); |
| 7339 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7340 | } |
| 7341 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) |
| 7342 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); |
| 7343 | |
| 7344 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) |
| 7345 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); |
| 7346 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 7347 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); |
| 7348 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) |
| 7349 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); |
| 7350 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
| 7351 | vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE); |
| 7352 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) |
| 7353 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); |
| 7354 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) |
| 7355 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7356 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) |
| 7357 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7358 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) |
| 7359 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7360 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 7361 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
| 7362 | { |
| 7363 | vty_out (vty, " Community attribute sent to this neighbor"); |
| 7364 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 7365 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7366 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7367 | 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] | 7368 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7369 | else |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7370 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7371 | } |
| 7372 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) |
| 7373 | { |
| 7374 | vty_out (vty, " Default information originate,"); |
| 7375 | |
| 7376 | if (p->default_rmap[afi][safi].name) |
| 7377 | vty_out (vty, " default route-map %s%s,", |
| 7378 | p->default_rmap[afi][safi].map ? "*" : "", |
| 7379 | p->default_rmap[afi][safi].name); |
| 7380 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) |
| 7381 | vty_out (vty, " default sent%s", VTY_NEWLINE); |
| 7382 | else |
| 7383 | vty_out (vty, " default not sent%s", VTY_NEWLINE); |
| 7384 | } |
| 7385 | |
| 7386 | if (filter->plist[FILTER_IN].name |
| 7387 | || filter->dlist[FILTER_IN].name |
| 7388 | || filter->aslist[FILTER_IN].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7389 | || filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7390 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
| 7391 | if (filter->plist[FILTER_OUT].name |
| 7392 | || filter->dlist[FILTER_OUT].name |
| 7393 | || filter->aslist[FILTER_OUT].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7394 | || filter->map[RMAP_OUT].name |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7395 | || filter->usmap.name) |
| 7396 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7397 | if (filter->map[RMAP_IMPORT].name) |
| 7398 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); |
| 7399 | if (filter->map[RMAP_EXPORT].name) |
| 7400 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7401 | |
| 7402 | /* prefix-list */ |
| 7403 | if (filter->plist[FILTER_IN].name) |
| 7404 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", |
| 7405 | filter->plist[FILTER_IN].plist ? "*" : "", |
| 7406 | filter->plist[FILTER_IN].name, |
| 7407 | VTY_NEWLINE); |
| 7408 | if (filter->plist[FILTER_OUT].name) |
| 7409 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", |
| 7410 | filter->plist[FILTER_OUT].plist ? "*" : "", |
| 7411 | filter->plist[FILTER_OUT].name, |
| 7412 | VTY_NEWLINE); |
| 7413 | |
| 7414 | /* distribute-list */ |
| 7415 | if (filter->dlist[FILTER_IN].name) |
| 7416 | vty_out (vty, " Incoming update network filter list is %s%s%s", |
| 7417 | filter->dlist[FILTER_IN].alist ? "*" : "", |
| 7418 | filter->dlist[FILTER_IN].name, |
| 7419 | VTY_NEWLINE); |
| 7420 | if (filter->dlist[FILTER_OUT].name) |
| 7421 | vty_out (vty, " Outgoing update network filter list is %s%s%s", |
| 7422 | filter->dlist[FILTER_OUT].alist ? "*" : "", |
| 7423 | filter->dlist[FILTER_OUT].name, |
| 7424 | VTY_NEWLINE); |
| 7425 | |
| 7426 | /* filter-list. */ |
| 7427 | if (filter->aslist[FILTER_IN].name) |
| 7428 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", |
| 7429 | filter->aslist[FILTER_IN].aslist ? "*" : "", |
| 7430 | filter->aslist[FILTER_IN].name, |
| 7431 | VTY_NEWLINE); |
| 7432 | if (filter->aslist[FILTER_OUT].name) |
| 7433 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", |
| 7434 | filter->aslist[FILTER_OUT].aslist ? "*" : "", |
| 7435 | filter->aslist[FILTER_OUT].name, |
| 7436 | VTY_NEWLINE); |
| 7437 | |
| 7438 | /* route-map. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7439 | if (filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7440 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7441 | filter->map[RMAP_IN].map ? "*" : "", |
| 7442 | filter->map[RMAP_IN].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7443 | VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7444 | if (filter->map[RMAP_OUT].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7445 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7446 | filter->map[RMAP_OUT].map ? "*" : "", |
| 7447 | filter->map[RMAP_OUT].name, |
| 7448 | VTY_NEWLINE); |
| 7449 | if (filter->map[RMAP_IMPORT].name) |
| 7450 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", |
| 7451 | filter->map[RMAP_IMPORT].map ? "*" : "", |
| 7452 | filter->map[RMAP_IMPORT].name, |
| 7453 | VTY_NEWLINE); |
| 7454 | if (filter->map[RMAP_EXPORT].name) |
| 7455 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", |
| 7456 | filter->map[RMAP_EXPORT].map ? "*" : "", |
| 7457 | filter->map[RMAP_EXPORT].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7458 | VTY_NEWLINE); |
| 7459 | |
| 7460 | /* unsuppress-map */ |
| 7461 | if (filter->usmap.name) |
| 7462 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", |
| 7463 | filter->usmap.map ? "*" : "", |
| 7464 | filter->usmap.name, VTY_NEWLINE); |
| 7465 | |
| 7466 | /* Receive prefix count */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7467 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
| 7468 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7469 | /* Maximum prefix */ |
| 7470 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) |
| 7471 | { |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7472 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7473 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7474 | ? " (warning-only)" : "", VTY_NEWLINE); |
| 7475 | vty_out (vty, " Threshold for warning message %d%%", |
| 7476 | p->pmax_threshold[afi][safi]); |
| 7477 | if (p->pmax_restart[afi][safi]) |
| 7478 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); |
| 7479 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7480 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7481 | |
| 7482 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7483 | } |
| 7484 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7485 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7486 | bgp_show_peer (struct vty *vty, struct peer *p) |
| 7487 | { |
| 7488 | struct bgp *bgp; |
| 7489 | char buf1[BUFSIZ]; |
| 7490 | char timebuf[BGP_UPTIME_LEN]; |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7491 | afi_t afi; |
| 7492 | safi_t safi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7493 | |
| 7494 | bgp = p->bgp; |
| 7495 | |
| 7496 | /* Configured IP address. */ |
| 7497 | vty_out (vty, "BGP neighbor is %s, ", p->host); |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 7498 | vty_out (vty, "remote AS %u, ", p->as); |
| 7499 | vty_out (vty, "local AS %u%s, ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7500 | p->change_local_as ? p->change_local_as : p->local_as, |
| 7501 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? |
| 7502 | " no-prepend" : ""); |
| 7503 | vty_out (vty, "%s link%s", |
| 7504 | p->as == p->local_as ? "internal" : "external", |
| 7505 | VTY_NEWLINE); |
| 7506 | |
| 7507 | /* Description. */ |
| 7508 | if (p->desc) |
| 7509 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); |
| 7510 | |
| 7511 | /* Peer-group */ |
| 7512 | if (p->group) |
| 7513 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
| 7514 | p->group->name, VTY_NEWLINE); |
| 7515 | |
| 7516 | /* Administrative shutdown. */ |
| 7517 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) |
| 7518 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); |
| 7519 | |
| 7520 | /* BGP Version. */ |
| 7521 | vty_out (vty, " BGP version 4"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7522 | vty_out (vty, ", remote router ID %s%s", |
| 7523 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), |
| 7524 | VTY_NEWLINE); |
| 7525 | |
| 7526 | /* Confederation */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7527 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
| 7528 | && bgp_confederation_peers_check (bgp, p->as)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7529 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
| 7530 | |
| 7531 | /* Status. */ |
| 7532 | vty_out (vty, " BGP state = %s", |
| 7533 | LOOKUP (bgp_status_msg, p->status)); |
| 7534 | if (p->status == Established) |
| 7535 | vty_out (vty, ", up for %8s", |
| 7536 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7537 | else if (p->status == Active) |
| 7538 | { |
| 7539 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) |
| 7540 | vty_out (vty, " (passive)"); |
| 7541 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) |
| 7542 | vty_out (vty, " (NSF passive)"); |
| 7543 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7544 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7545 | |
| 7546 | /* read timer */ |
| 7547 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); |
| 7548 | |
| 7549 | /* Configured timer values. */ |
| 7550 | vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s", |
| 7551 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); |
| 7552 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) |
| 7553 | { |
| 7554 | vty_out (vty, " Configured hold time is %d", p->holdtime); |
| 7555 | vty_out (vty, ", keepalive interval is %d seconds%s", |
| 7556 | p->keepalive, VTY_NEWLINE); |
| 7557 | } |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7558 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7559 | /* Capability. */ |
| 7560 | if (p->status == Established) |
| 7561 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7562 | if (p->cap |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7563 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
| 7564 | || p->afc_recv[AFI_IP][SAFI_UNICAST] |
| 7565 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] |
| 7566 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] |
| 7567 | #ifdef HAVE_IPV6 |
| 7568 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] |
| 7569 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] |
| 7570 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] |
| 7571 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] |
| 7572 | #endif /* HAVE_IPV6 */ |
| 7573 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] |
| 7574 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) |
| 7575 | { |
| 7576 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); |
| 7577 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7578 | /* AS4 */ |
| 7579 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) |
| 7580 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) |
| 7581 | { |
| 7582 | vty_out (vty, " 4 Byte AS:"); |
| 7583 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) |
| 7584 | vty_out (vty, " advertised"); |
| 7585 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) |
| 7586 | vty_out (vty, " %sreceived", |
| 7587 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); |
| 7588 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7589 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7590 | /* Dynamic */ |
| 7591 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) |
| 7592 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7593 | { |
| 7594 | vty_out (vty, " Dynamic:"); |
| 7595 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7596 | vty_out (vty, " advertised"); |
| 7597 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7598 | vty_out (vty, " %sreceived", |
| 7599 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7600 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7601 | } |
| 7602 | |
| 7603 | /* Route Refresh */ |
| 7604 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) |
| 7605 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7606 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
| 7607 | { |
| 7608 | vty_out (vty, " Route refresh:"); |
| 7609 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) |
| 7610 | vty_out (vty, " advertised"); |
| 7611 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7612 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7613 | vty_out (vty, " %sreceived(%s)", |
| 7614 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", |
| 7615 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) |
| 7616 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? |
| 7617 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); |
| 7618 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7619 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7620 | } |
| 7621 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7622 | /* Multiprotocol Extensions */ |
| 7623 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7624 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7625 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7626 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7627 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
| 7628 | if (p->afc_adv[afi][safi]) |
| 7629 | vty_out (vty, " advertised"); |
| 7630 | if (p->afc_recv[afi][safi]) |
| 7631 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); |
| 7632 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7633 | } |
| 7634 | |
| 7635 | /* Gracefull Restart */ |
| 7636 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7637 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7638 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7639 | vty_out (vty, " Graceful Restart Capabilty:"); |
| 7640 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7641 | vty_out (vty, " advertised"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7642 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
| 7643 | vty_out (vty, " %sreceived", |
| 7644 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7645 | vty_out (vty, "%s", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7646 | |
| 7647 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7648 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7649 | int restart_af_count = 0; |
| 7650 | |
| 7651 | vty_out (vty, " Remote Restart timer is %d seconds%s", |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7652 | p->v_gr_restart, VTY_NEWLINE); |
| 7653 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7654 | |
| 7655 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7656 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7657 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) |
| 7658 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7659 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
| 7660 | afi_safi_print (afi, safi), |
| 7661 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? |
| 7662 | "preserved" : "not preserved"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7663 | restart_af_count++; |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7664 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7665 | if (! restart_af_count) |
| 7666 | vty_out (vty, "none"); |
| 7667 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7668 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7669 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7670 | } |
| 7671 | } |
| 7672 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7673 | /* graceful restart information */ |
| 7674 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7675 | || p->t_gr_restart |
| 7676 | || p->t_gr_stale) |
| 7677 | { |
| 7678 | int eor_send_af_count = 0; |
| 7679 | int eor_receive_af_count = 0; |
| 7680 | |
| 7681 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); |
| 7682 | if (p->status == Established) |
| 7683 | { |
| 7684 | vty_out (vty, " End-of-RIB send: "); |
| 7685 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7686 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7687 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) |
| 7688 | { |
| 7689 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", |
| 7690 | afi_safi_print (afi, safi)); |
| 7691 | eor_send_af_count++; |
| 7692 | } |
| 7693 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7694 | |
| 7695 | vty_out (vty, " End-of-RIB received: "); |
| 7696 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7697 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7698 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) |
| 7699 | { |
| 7700 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", |
| 7701 | afi_safi_print (afi, safi)); |
| 7702 | eor_receive_af_count++; |
| 7703 | } |
| 7704 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7705 | } |
| 7706 | |
| 7707 | if (p->t_gr_restart) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7708 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
| 7709 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); |
| 7710 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7711 | if (p->t_gr_stale) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7712 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
| 7713 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7714 | } |
| 7715 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7716 | /* Packet counts. */ |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7717 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
| 7718 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7719 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7720 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
| 7721 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); |
| 7722 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); |
| 7723 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); |
| 7724 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); |
| 7725 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); |
| 7726 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); |
| 7727 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + |
| 7728 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, |
| 7729 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + |
| 7730 | p->dynamic_cap_in, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7731 | |
| 7732 | /* advertisement-interval */ |
| 7733 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", |
| 7734 | p->v_routeadv, VTY_NEWLINE); |
| 7735 | |
| 7736 | /* Update-source. */ |
| 7737 | if (p->update_if || p->update_source) |
| 7738 | { |
| 7739 | vty_out (vty, " Update source is "); |
| 7740 | if (p->update_if) |
| 7741 | vty_out (vty, "%s", p->update_if); |
| 7742 | else if (p->update_source) |
| 7743 | vty_out (vty, "%s", |
| 7744 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); |
| 7745 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7746 | } |
| 7747 | |
| 7748 | /* Default weight */ |
| 7749 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) |
| 7750 | vty_out (vty, " Default weight %d%s", p->weight, |
| 7751 | VTY_NEWLINE); |
| 7752 | |
| 7753 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7754 | |
| 7755 | /* Address Family Information */ |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7756 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7757 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7758 | if (p->afc[afi][safi]) |
| 7759 | bgp_show_peer_afi (vty, p, afi, safi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7760 | |
| 7761 | vty_out (vty, " Connections established %d; dropped %d%s", |
| 7762 | p->established, p->dropped, |
| 7763 | VTY_NEWLINE); |
| 7764 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7765 | if (! p->dropped) |
| 7766 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); |
| 7767 | else |
| 7768 | vty_out (vty, " Last reset %s, due to %s%s", |
| 7769 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), |
| 7770 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 7771 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7772 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7773 | { |
| 7774 | 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] | 7775 | |
| 7776 | if (p->t_pmax_restart) |
| 7777 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", |
| 7778 | p->host, thread_timer_remain_second (p->t_pmax_restart), |
| 7779 | VTY_NEWLINE); |
| 7780 | else |
| 7781 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", |
| 7782 | p->host, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7783 | } |
| 7784 | |
Stephen Hemminger | f5a4827 | 2011-03-24 17:30:21 +0000 | [diff] [blame] | 7785 | /* EBGP Multihop and GTSM */ |
| 7786 | if (peer_sort (p) != BGP_PEER_IBGP) |
| 7787 | { |
| 7788 | if (p->gtsm_hops > 0) |
| 7789 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 7790 | p->gtsm_hops, VTY_NEWLINE); |
| 7791 | else if (p->ttl > 1) |
| 7792 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 7793 | p->ttl, VTY_NEWLINE); |
| 7794 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7795 | |
| 7796 | /* Local address. */ |
| 7797 | if (p->su_local) |
| 7798 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7799 | vty_out (vty, "Local host: %s, Local port: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7800 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
| 7801 | ntohs (p->su_local->sin.sin_port), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7802 | VTY_NEWLINE); |
| 7803 | } |
| 7804 | |
| 7805 | /* Remote address. */ |
| 7806 | if (p->su_remote) |
| 7807 | { |
| 7808 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", |
| 7809 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
| 7810 | ntohs (p->su_remote->sin.sin_port), |
| 7811 | VTY_NEWLINE); |
| 7812 | } |
| 7813 | |
| 7814 | /* Nexthop display. */ |
| 7815 | if (p->su_local) |
| 7816 | { |
| 7817 | vty_out (vty, "Nexthop: %s%s", |
| 7818 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), |
| 7819 | VTY_NEWLINE); |
| 7820 | #ifdef HAVE_IPV6 |
| 7821 | vty_out (vty, "Nexthop global: %s%s", |
| 7822 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), |
| 7823 | VTY_NEWLINE); |
| 7824 | vty_out (vty, "Nexthop local: %s%s", |
| 7825 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), |
| 7826 | VTY_NEWLINE); |
| 7827 | vty_out (vty, "BGP connection: %s%s", |
| 7828 | p->shared_network ? "shared network" : "non shared network", |
| 7829 | VTY_NEWLINE); |
| 7830 | #endif /* HAVE_IPV6 */ |
| 7831 | } |
| 7832 | |
| 7833 | /* Timer information. */ |
| 7834 | if (p->t_start) |
| 7835 | vty_out (vty, "Next start timer due in %ld seconds%s", |
| 7836 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); |
| 7837 | if (p->t_connect) |
| 7838 | vty_out (vty, "Next connect timer due in %ld seconds%s", |
| 7839 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); |
| 7840 | |
| 7841 | vty_out (vty, "Read thread: %s Write thread: %s%s", |
| 7842 | p->t_read ? "on" : "off", |
| 7843 | p->t_write ? "on" : "off", |
| 7844 | VTY_NEWLINE); |
| 7845 | |
| 7846 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR |
| 7847 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) |
| 7848 | bgp_capability_vty_out (vty, p); |
| 7849 | |
| 7850 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7851 | } |
| 7852 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7853 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7854 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
| 7855 | enum show_type type, union sockunion *su) |
| 7856 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7857 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7858 | struct peer *peer; |
| 7859 | int find = 0; |
| 7860 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7861 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7862 | { |
| 7863 | switch (type) |
| 7864 | { |
| 7865 | case show_all: |
| 7866 | bgp_show_peer (vty, peer); |
| 7867 | break; |
| 7868 | case show_peer: |
| 7869 | if (sockunion_same (&peer->su, su)) |
| 7870 | { |
| 7871 | find = 1; |
| 7872 | bgp_show_peer (vty, peer); |
| 7873 | } |
| 7874 | break; |
| 7875 | } |
| 7876 | } |
| 7877 | |
| 7878 | if (type == show_peer && ! find) |
| 7879 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); |
| 7880 | |
| 7881 | return CMD_SUCCESS; |
| 7882 | } |
| 7883 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7884 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7885 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
| 7886 | enum show_type type, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7887 | { |
| 7888 | int ret; |
| 7889 | struct bgp *bgp; |
| 7890 | union sockunion su; |
| 7891 | |
| 7892 | if (ip_str) |
| 7893 | { |
| 7894 | ret = str2sockunion (ip_str, &su); |
| 7895 | if (ret < 0) |
| 7896 | { |
| 7897 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 7898 | return CMD_WARNING; |
| 7899 | } |
| 7900 | } |
| 7901 | |
| 7902 | if (name) |
| 7903 | { |
| 7904 | bgp = bgp_lookup_by_name (name); |
| 7905 | |
| 7906 | if (! bgp) |
| 7907 | { |
| 7908 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7909 | return CMD_WARNING; |
| 7910 | } |
| 7911 | |
| 7912 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7913 | |
| 7914 | return CMD_SUCCESS; |
| 7915 | } |
| 7916 | |
| 7917 | bgp = bgp_get_default (); |
| 7918 | |
| 7919 | if (bgp) |
| 7920 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7921 | |
| 7922 | return CMD_SUCCESS; |
| 7923 | } |
| 7924 | |
| 7925 | /* "show ip bgp neighbors" commands. */ |
| 7926 | DEFUN (show_ip_bgp_neighbors, |
| 7927 | show_ip_bgp_neighbors_cmd, |
| 7928 | "show ip bgp neighbors", |
| 7929 | SHOW_STR |
| 7930 | IP_STR |
| 7931 | BGP_STR |
| 7932 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7933 | { |
| 7934 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); |
| 7935 | } |
| 7936 | |
| 7937 | ALIAS (show_ip_bgp_neighbors, |
| 7938 | show_ip_bgp_ipv4_neighbors_cmd, |
| 7939 | "show ip bgp ipv4 (unicast|multicast) neighbors", |
| 7940 | SHOW_STR |
| 7941 | IP_STR |
| 7942 | BGP_STR |
| 7943 | "Address family\n" |
| 7944 | "Address Family modifier\n" |
| 7945 | "Address Family modifier\n" |
| 7946 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7947 | |
| 7948 | ALIAS (show_ip_bgp_neighbors, |
| 7949 | show_ip_bgp_vpnv4_all_neighbors_cmd, |
| 7950 | "show ip bgp vpnv4 all neighbors", |
| 7951 | SHOW_STR |
| 7952 | IP_STR |
| 7953 | BGP_STR |
| 7954 | "Display VPNv4 NLRI specific information\n" |
| 7955 | "Display information about all VPNv4 NLRIs\n" |
| 7956 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7957 | |
| 7958 | ALIAS (show_ip_bgp_neighbors, |
| 7959 | show_ip_bgp_vpnv4_rd_neighbors_cmd, |
| 7960 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", |
| 7961 | SHOW_STR |
| 7962 | IP_STR |
| 7963 | BGP_STR |
| 7964 | "Display VPNv4 NLRI specific information\n" |
| 7965 | "Display information for a route distinguisher\n" |
| 7966 | "VPN Route Distinguisher\n" |
| 7967 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7968 | |
| 7969 | ALIAS (show_ip_bgp_neighbors, |
| 7970 | show_bgp_neighbors_cmd, |
| 7971 | "show bgp neighbors", |
| 7972 | SHOW_STR |
| 7973 | BGP_STR |
| 7974 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7975 | |
| 7976 | ALIAS (show_ip_bgp_neighbors, |
| 7977 | show_bgp_ipv6_neighbors_cmd, |
| 7978 | "show bgp ipv6 neighbors", |
| 7979 | SHOW_STR |
| 7980 | BGP_STR |
| 7981 | "Address family\n" |
| 7982 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7983 | |
| 7984 | DEFUN (show_ip_bgp_neighbors_peer, |
| 7985 | show_ip_bgp_neighbors_peer_cmd, |
| 7986 | "show ip bgp neighbors (A.B.C.D|X:X::X:X)", |
| 7987 | SHOW_STR |
| 7988 | IP_STR |
| 7989 | BGP_STR |
| 7990 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7991 | "Neighbor to display information about\n" |
| 7992 | "Neighbor to display information about\n") |
| 7993 | { |
| 7994 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); |
| 7995 | } |
| 7996 | |
| 7997 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7998 | show_ip_bgp_ipv4_neighbors_peer_cmd, |
| 7999 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)", |
| 8000 | SHOW_STR |
| 8001 | IP_STR |
| 8002 | BGP_STR |
| 8003 | "Address family\n" |
| 8004 | "Address Family modifier\n" |
| 8005 | "Address Family modifier\n" |
| 8006 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8007 | "Neighbor to display information about\n" |
| 8008 | "Neighbor to display information about\n") |
| 8009 | |
| 8010 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8011 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, |
| 8012 | "show ip bgp vpnv4 all neighbors A.B.C.D", |
| 8013 | SHOW_STR |
| 8014 | IP_STR |
| 8015 | BGP_STR |
| 8016 | "Display VPNv4 NLRI specific information\n" |
| 8017 | "Display information about all VPNv4 NLRIs\n" |
| 8018 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8019 | "Neighbor to display information about\n") |
| 8020 | |
| 8021 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8022 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, |
| 8023 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", |
| 8024 | SHOW_STR |
| 8025 | IP_STR |
| 8026 | BGP_STR |
| 8027 | "Display VPNv4 NLRI specific information\n" |
| 8028 | "Display information about all VPNv4 NLRIs\n" |
| 8029 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8030 | "Neighbor to display information about\n") |
| 8031 | |
| 8032 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8033 | show_bgp_neighbors_peer_cmd, |
| 8034 | "show bgp neighbors (A.B.C.D|X:X::X:X)", |
| 8035 | SHOW_STR |
| 8036 | BGP_STR |
| 8037 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8038 | "Neighbor to display information about\n" |
| 8039 | "Neighbor to display information about\n") |
| 8040 | |
| 8041 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8042 | show_bgp_ipv6_neighbors_peer_cmd, |
| 8043 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 8044 | SHOW_STR |
| 8045 | BGP_STR |
| 8046 | "Address family\n" |
| 8047 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8048 | "Neighbor to display information about\n" |
| 8049 | "Neighbor to display information about\n") |
| 8050 | |
| 8051 | DEFUN (show_ip_bgp_instance_neighbors, |
| 8052 | show_ip_bgp_instance_neighbors_cmd, |
| 8053 | "show ip bgp view WORD neighbors", |
| 8054 | SHOW_STR |
| 8055 | IP_STR |
| 8056 | BGP_STR |
| 8057 | "BGP view\n" |
| 8058 | "View name\n" |
| 8059 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8060 | { |
| 8061 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); |
| 8062 | } |
| 8063 | |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 8064 | ALIAS (show_ip_bgp_instance_neighbors, |
| 8065 | show_bgp_instance_neighbors_cmd, |
| 8066 | "show bgp view WORD neighbors", |
| 8067 | SHOW_STR |
| 8068 | BGP_STR |
| 8069 | "BGP view\n" |
| 8070 | "View name\n" |
| 8071 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8072 | |
| 8073 | ALIAS (show_ip_bgp_instance_neighbors, |
| 8074 | show_bgp_instance_ipv6_neighbors_cmd, |
| 8075 | "show bgp view WORD ipv6 neighbors", |
| 8076 | SHOW_STR |
| 8077 | BGP_STR |
| 8078 | "BGP view\n" |
| 8079 | "View name\n" |
| 8080 | "Address family\n" |
| 8081 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8082 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8083 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
| 8084 | show_ip_bgp_instance_neighbors_peer_cmd, |
| 8085 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 8086 | SHOW_STR |
| 8087 | IP_STR |
| 8088 | BGP_STR |
| 8089 | "BGP view\n" |
| 8090 | "View name\n" |
| 8091 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8092 | "Neighbor to display information about\n" |
| 8093 | "Neighbor to display information about\n") |
| 8094 | { |
| 8095 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); |
| 8096 | } |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 8097 | |
| 8098 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 8099 | show_bgp_instance_neighbors_peer_cmd, |
| 8100 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 8101 | SHOW_STR |
| 8102 | BGP_STR |
| 8103 | "BGP view\n" |
| 8104 | "View name\n" |
| 8105 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8106 | "Neighbor to display information about\n" |
| 8107 | "Neighbor to display information about\n") |
| 8108 | |
| 8109 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 8110 | show_bgp_instance_ipv6_neighbors_peer_cmd, |
| 8111 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 8112 | SHOW_STR |
| 8113 | BGP_STR |
| 8114 | "BGP view\n" |
| 8115 | "View name\n" |
| 8116 | "Address family\n" |
| 8117 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8118 | "Neighbor to display information about\n" |
| 8119 | "Neighbor to display information about\n") |
| 8120 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8121 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
| 8122 | paths' and `show ip mbgp paths'. Those functions results are the |
| 8123 | same.*/ |
| 8124 | DEFUN (show_ip_bgp_paths, |
| 8125 | show_ip_bgp_paths_cmd, |
| 8126 | "show ip bgp paths", |
| 8127 | SHOW_STR |
| 8128 | IP_STR |
| 8129 | BGP_STR |
| 8130 | "Path information\n") |
| 8131 | { |
| 8132 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); |
| 8133 | aspath_print_all_vty (vty); |
| 8134 | return CMD_SUCCESS; |
| 8135 | } |
| 8136 | |
| 8137 | DEFUN (show_ip_bgp_ipv4_paths, |
| 8138 | show_ip_bgp_ipv4_paths_cmd, |
| 8139 | "show ip bgp ipv4 (unicast|multicast) paths", |
| 8140 | SHOW_STR |
| 8141 | IP_STR |
| 8142 | BGP_STR |
| 8143 | "Address family\n" |
| 8144 | "Address Family modifier\n" |
| 8145 | "Address Family modifier\n" |
| 8146 | "Path information\n") |
| 8147 | { |
| 8148 | vty_out (vty, "Address Refcnt Path\r\n"); |
| 8149 | aspath_print_all_vty (vty); |
| 8150 | |
| 8151 | return CMD_SUCCESS; |
| 8152 | } |
| 8153 | |
| 8154 | #include "hash.h" |
| 8155 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8156 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8157 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
| 8158 | { |
| 8159 | struct community *com; |
| 8160 | |
| 8161 | com = (struct community *) backet->data; |
| 8162 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, |
| 8163 | community_str (com), VTY_NEWLINE); |
| 8164 | } |
| 8165 | |
| 8166 | /* Show BGP's community internal data. */ |
| 8167 | DEFUN (show_ip_bgp_community_info, |
| 8168 | show_ip_bgp_community_info_cmd, |
| 8169 | "show ip bgp community-info", |
| 8170 | SHOW_STR |
| 8171 | IP_STR |
| 8172 | BGP_STR |
| 8173 | "List all bgp community information\n") |
| 8174 | { |
| 8175 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); |
| 8176 | |
| 8177 | hash_iterate (community_hash (), |
| 8178 | (void (*) (struct hash_backet *, void *)) |
| 8179 | community_show_all_iterator, |
| 8180 | vty); |
| 8181 | |
| 8182 | return CMD_SUCCESS; |
| 8183 | } |
| 8184 | |
| 8185 | DEFUN (show_ip_bgp_attr_info, |
| 8186 | show_ip_bgp_attr_info_cmd, |
| 8187 | "show ip bgp attribute-info", |
| 8188 | SHOW_STR |
| 8189 | IP_STR |
| 8190 | BGP_STR |
| 8191 | "List all bgp attribute information\n") |
| 8192 | { |
| 8193 | attr_show_all (vty); |
| 8194 | return CMD_SUCCESS; |
| 8195 | } |
| 8196 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8197 | static int |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8198 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
| 8199 | afi_t afi, safi_t safi) |
| 8200 | { |
| 8201 | char timebuf[BGP_UPTIME_LEN]; |
| 8202 | char rmbuf[14]; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8203 | const char *rmname; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8204 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8205 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8206 | int len; |
| 8207 | int count = 0; |
| 8208 | |
| 8209 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) |
| 8210 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8211 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8212 | { |
| 8213 | count++; |
| 8214 | bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 8215 | } |
| 8216 | return count; |
| 8217 | } |
| 8218 | |
| 8219 | len = vty_out (vty, "%s", rsclient->host); |
| 8220 | len = 16 - len; |
| 8221 | |
| 8222 | if (len < 1) |
| 8223 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 8224 | else |
| 8225 | vty_out (vty, "%*s", len, " "); |
| 8226 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 8227 | vty_out (vty, "4 "); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8228 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 8229 | vty_out (vty, "%11d ", rsclient->as); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8230 | |
| 8231 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); |
| 8232 | if ( rmname && strlen (rmname) > 13 ) |
| 8233 | { |
| 8234 | sprintf (rmbuf, "%13s", "..."); |
| 8235 | rmname = strncpy (rmbuf, rmname, 10); |
| 8236 | } |
| 8237 | else if (! rmname) |
| 8238 | rmname = "<none>"; |
| 8239 | vty_out (vty, " %13s ", rmname); |
| 8240 | |
| 8241 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); |
| 8242 | if ( rmname && strlen (rmname) > 13 ) |
| 8243 | { |
| 8244 | sprintf (rmbuf, "%13s", "..."); |
| 8245 | rmname = strncpy (rmbuf, rmname, 10); |
| 8246 | } |
| 8247 | else if (! rmname) |
| 8248 | rmname = "<none>"; |
| 8249 | vty_out (vty, " %13s ", rmname); |
| 8250 | |
| 8251 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); |
| 8252 | |
| 8253 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) |
| 8254 | vty_out (vty, " Idle (Admin)"); |
| 8255 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 8256 | vty_out (vty, " Idle (PfxCt)"); |
| 8257 | else |
| 8258 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); |
| 8259 | |
| 8260 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8261 | |
| 8262 | return 1; |
| 8263 | } |
| 8264 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8265 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8266 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
| 8267 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8268 | { |
| 8269 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8270 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8271 | int count = 0; |
| 8272 | |
| 8273 | /* Header string for each address family. */ |
| 8274 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; |
| 8275 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8276 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8277 | { |
| 8278 | if (peer->afc[afi][safi] && |
| 8279 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 8280 | { |
| 8281 | if (! count) |
| 8282 | { |
| 8283 | vty_out (vty, |
| 8284 | "Route Server's BGP router identifier %s%s", |
| 8285 | inet_ntoa (bgp->router_id), VTY_NEWLINE); |
| 8286 | vty_out (vty, |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 8287 | "Route Server's local AS number %u%s", bgp->as, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8288 | VTY_NEWLINE); |
| 8289 | |
| 8290 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8291 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 8292 | } |
| 8293 | |
| 8294 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 8295 | } |
| 8296 | } |
| 8297 | |
| 8298 | if (count) |
| 8299 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, |
| 8300 | count, VTY_NEWLINE); |
| 8301 | else |
| 8302 | vty_out (vty, "No %s Route Server Client is configured%s", |
| 8303 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 8304 | |
| 8305 | return CMD_SUCCESS; |
| 8306 | } |
| 8307 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8308 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8309 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
| 8310 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8311 | { |
| 8312 | struct bgp *bgp; |
| 8313 | |
| 8314 | if (name) |
| 8315 | { |
| 8316 | bgp = bgp_lookup_by_name (name); |
| 8317 | |
| 8318 | if (! bgp) |
| 8319 | { |
| 8320 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 8321 | return CMD_WARNING; |
| 8322 | } |
| 8323 | |
| 8324 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 8325 | return CMD_SUCCESS; |
| 8326 | } |
| 8327 | |
| 8328 | bgp = bgp_get_default (); |
| 8329 | |
| 8330 | if (bgp) |
| 8331 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 8332 | |
| 8333 | return CMD_SUCCESS; |
| 8334 | } |
| 8335 | |
| 8336 | /* 'show bgp rsclient' commands. */ |
| 8337 | DEFUN (show_ip_bgp_rsclient_summary, |
| 8338 | show_ip_bgp_rsclient_summary_cmd, |
| 8339 | "show ip bgp rsclient summary", |
| 8340 | SHOW_STR |
| 8341 | IP_STR |
| 8342 | BGP_STR |
| 8343 | "Information about Route Server Clients\n" |
| 8344 | "Summary of all Route Server Clients\n") |
| 8345 | { |
| 8346 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 8347 | } |
| 8348 | |
| 8349 | DEFUN (show_ip_bgp_instance_rsclient_summary, |
| 8350 | show_ip_bgp_instance_rsclient_summary_cmd, |
| 8351 | "show ip bgp view WORD rsclient summary", |
| 8352 | SHOW_STR |
| 8353 | IP_STR |
| 8354 | BGP_STR |
| 8355 | "BGP view\n" |
| 8356 | "View name\n" |
| 8357 | "Information about Route Server Clients\n" |
| 8358 | "Summary of all Route Server Clients\n") |
| 8359 | { |
| 8360 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 8361 | } |
| 8362 | |
| 8363 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, |
| 8364 | show_ip_bgp_ipv4_rsclient_summary_cmd, |
| 8365 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", |
| 8366 | SHOW_STR |
| 8367 | IP_STR |
| 8368 | BGP_STR |
| 8369 | "Address family\n" |
| 8370 | "Address Family modifier\n" |
| 8371 | "Address Family modifier\n" |
| 8372 | "Information about Route Server Clients\n" |
| 8373 | "Summary of all Route Server Clients\n") |
| 8374 | { |
| 8375 | if (strncmp (argv[0], "m", 1) == 0) |
| 8376 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 8377 | |
| 8378 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 8379 | } |
| 8380 | |
| 8381 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, |
| 8382 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, |
| 8383 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 8384 | SHOW_STR |
| 8385 | IP_STR |
| 8386 | BGP_STR |
| 8387 | "BGP view\n" |
| 8388 | "View name\n" |
| 8389 | "Address family\n" |
| 8390 | "Address Family modifier\n" |
| 8391 | "Address Family modifier\n" |
| 8392 | "Information about Route Server Clients\n" |
| 8393 | "Summary of all Route Server Clients\n") |
| 8394 | { |
| 8395 | if (strncmp (argv[1], "m", 1) == 0) |
| 8396 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 8397 | |
| 8398 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 8399 | } |
| 8400 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 8401 | DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary, |
| 8402 | show_bgp_instance_ipv4_safi_rsclient_summary_cmd, |
| 8403 | "show bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 8404 | SHOW_STR |
| 8405 | BGP_STR |
| 8406 | "BGP view\n" |
| 8407 | "View name\n" |
| 8408 | "Address family\n" |
| 8409 | "Address Family modifier\n" |
| 8410 | "Address Family modifier\n" |
| 8411 | "Information about Route Server Clients\n" |
| 8412 | "Summary of all Route Server Clients\n") |
| 8413 | { |
| 8414 | safi_t safi; |
| 8415 | |
| 8416 | if (argc == 2) { |
| 8417 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8418 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi); |
| 8419 | } else { |
| 8420 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8421 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi); |
| 8422 | } |
| 8423 | } |
| 8424 | |
| 8425 | ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary, |
| 8426 | show_bgp_ipv4_safi_rsclient_summary_cmd, |
| 8427 | "show bgp ipv4 (unicast|multicast) rsclient summary", |
| 8428 | SHOW_STR |
| 8429 | BGP_STR |
| 8430 | "Address family\n" |
| 8431 | "Address Family modifier\n" |
| 8432 | "Address Family modifier\n" |
| 8433 | "Information about Route Server Clients\n" |
| 8434 | "Summary of all Route Server Clients\n") |
| 8435 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8436 | #ifdef HAVE_IPV6 |
| 8437 | DEFUN (show_bgp_rsclient_summary, |
| 8438 | show_bgp_rsclient_summary_cmd, |
| 8439 | "show bgp rsclient summary", |
| 8440 | SHOW_STR |
| 8441 | BGP_STR |
| 8442 | "Information about Route Server Clients\n" |
| 8443 | "Summary of all Route Server Clients\n") |
| 8444 | { |
| 8445 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 8446 | } |
| 8447 | |
| 8448 | DEFUN (show_bgp_instance_rsclient_summary, |
| 8449 | show_bgp_instance_rsclient_summary_cmd, |
| 8450 | "show bgp view WORD rsclient summary", |
| 8451 | SHOW_STR |
| 8452 | BGP_STR |
| 8453 | "BGP view\n" |
| 8454 | "View name\n" |
| 8455 | "Information about Route Server Clients\n" |
| 8456 | "Summary of all Route Server Clients\n") |
| 8457 | { |
| 8458 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 8459 | } |
| 8460 | |
| 8461 | ALIAS (show_bgp_rsclient_summary, |
| 8462 | show_bgp_ipv6_rsclient_summary_cmd, |
| 8463 | "show bgp ipv6 rsclient summary", |
| 8464 | SHOW_STR |
| 8465 | BGP_STR |
| 8466 | "Address family\n" |
| 8467 | "Information about Route Server Clients\n" |
| 8468 | "Summary of all Route Server Clients\n") |
| 8469 | |
| 8470 | ALIAS (show_bgp_instance_rsclient_summary, |
| 8471 | show_bgp_instance_ipv6_rsclient_summary_cmd, |
| 8472 | "show bgp view WORD ipv6 rsclient summary", |
| 8473 | SHOW_STR |
| 8474 | BGP_STR |
| 8475 | "BGP view\n" |
| 8476 | "View name\n" |
| 8477 | "Address family\n" |
| 8478 | "Information about Route Server Clients\n" |
| 8479 | "Summary of all Route Server Clients\n") |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 8480 | |
| 8481 | DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary, |
| 8482 | show_bgp_instance_ipv6_safi_rsclient_summary_cmd, |
| 8483 | "show bgp view WORD ipv6 (unicast|multicast) rsclient summary", |
| 8484 | SHOW_STR |
| 8485 | BGP_STR |
| 8486 | "BGP view\n" |
| 8487 | "View name\n" |
| 8488 | "Address family\n" |
| 8489 | "Address Family modifier\n" |
| 8490 | "Address Family modifier\n" |
| 8491 | "Information about Route Server Clients\n" |
| 8492 | "Summary of all Route Server Clients\n") |
| 8493 | { |
| 8494 | safi_t safi; |
| 8495 | |
| 8496 | if (argc == 2) { |
| 8497 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8498 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi); |
| 8499 | } else { |
| 8500 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8501 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi); |
| 8502 | } |
| 8503 | } |
| 8504 | |
| 8505 | ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary, |
| 8506 | show_bgp_ipv6_safi_rsclient_summary_cmd, |
| 8507 | "show bgp ipv6 (unicast|multicast) rsclient summary", |
| 8508 | SHOW_STR |
| 8509 | BGP_STR |
| 8510 | "Address family\n" |
| 8511 | "Address Family modifier\n" |
| 8512 | "Address Family modifier\n" |
| 8513 | "Information about Route Server Clients\n" |
| 8514 | "Summary of all Route Server Clients\n") |
| 8515 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8516 | #endif /* HAVE IPV6 */ |
| 8517 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8518 | /* Redistribute VTY commands. */ |
| 8519 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8520 | DEFUN (bgp_redistribute_ipv4, |
| 8521 | bgp_redistribute_ipv4_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8522 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8523 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8524 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8525 | { |
| 8526 | int type; |
| 8527 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8528 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8529 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8530 | { |
| 8531 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8532 | return CMD_WARNING; |
| 8533 | } |
| 8534 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8535 | } |
| 8536 | |
| 8537 | DEFUN (bgp_redistribute_ipv4_rmap, |
| 8538 | bgp_redistribute_ipv4_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8539 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8540 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8541 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8542 | "Route map reference\n" |
| 8543 | "Pointer to route-map entries\n") |
| 8544 | { |
| 8545 | int type; |
| 8546 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8547 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8548 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8549 | { |
| 8550 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8551 | return CMD_WARNING; |
| 8552 | } |
| 8553 | |
| 8554 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8555 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8556 | } |
| 8557 | |
| 8558 | DEFUN (bgp_redistribute_ipv4_metric, |
| 8559 | bgp_redistribute_ipv4_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8560 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8561 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8562 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8563 | "Metric for redistributed routes\n" |
| 8564 | "Default metric\n") |
| 8565 | { |
| 8566 | int type; |
| 8567 | u_int32_t metric; |
| 8568 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8569 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8570 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8571 | { |
| 8572 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8573 | return CMD_WARNING; |
| 8574 | } |
| 8575 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8576 | |
| 8577 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8578 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8579 | } |
| 8580 | |
| 8581 | DEFUN (bgp_redistribute_ipv4_rmap_metric, |
| 8582 | bgp_redistribute_ipv4_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8583 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8584 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8585 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8586 | "Route map reference\n" |
| 8587 | "Pointer to route-map entries\n" |
| 8588 | "Metric for redistributed routes\n" |
| 8589 | "Default metric\n") |
| 8590 | { |
| 8591 | int type; |
| 8592 | u_int32_t metric; |
| 8593 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8594 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8595 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8596 | { |
| 8597 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8598 | return CMD_WARNING; |
| 8599 | } |
| 8600 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8601 | |
| 8602 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8603 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8604 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8605 | } |
| 8606 | |
| 8607 | DEFUN (bgp_redistribute_ipv4_metric_rmap, |
| 8608 | bgp_redistribute_ipv4_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8609 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8610 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8611 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8612 | "Metric for redistributed routes\n" |
| 8613 | "Default metric\n" |
| 8614 | "Route map reference\n" |
| 8615 | "Pointer to route-map entries\n") |
| 8616 | { |
| 8617 | int type; |
| 8618 | u_int32_t metric; |
| 8619 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8620 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8621 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8622 | { |
| 8623 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8624 | return CMD_WARNING; |
| 8625 | } |
| 8626 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8627 | |
| 8628 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8629 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); |
| 8630 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8631 | } |
| 8632 | |
| 8633 | DEFUN (no_bgp_redistribute_ipv4, |
| 8634 | no_bgp_redistribute_ipv4_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8635 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8636 | NO_STR |
| 8637 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8638 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8639 | { |
| 8640 | int type; |
| 8641 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8642 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8643 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8644 | { |
| 8645 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8646 | return CMD_WARNING; |
| 8647 | } |
| 8648 | |
| 8649 | return bgp_redistribute_unset (vty->index, AFI_IP, type); |
| 8650 | } |
| 8651 | |
| 8652 | DEFUN (no_bgp_redistribute_ipv4_rmap, |
| 8653 | no_bgp_redistribute_ipv4_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8654 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8655 | NO_STR |
| 8656 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8657 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8658 | "Route map reference\n" |
| 8659 | "Pointer to route-map entries\n") |
| 8660 | { |
| 8661 | int type; |
| 8662 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8663 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8664 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8665 | { |
| 8666 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8667 | return CMD_WARNING; |
| 8668 | } |
| 8669 | |
| 8670 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8671 | return CMD_SUCCESS; |
| 8672 | } |
| 8673 | |
| 8674 | DEFUN (no_bgp_redistribute_ipv4_metric, |
| 8675 | no_bgp_redistribute_ipv4_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8676 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8677 | NO_STR |
| 8678 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8679 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8680 | "Metric for redistributed routes\n" |
| 8681 | "Default metric\n") |
| 8682 | { |
| 8683 | int type; |
| 8684 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8685 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8686 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8687 | { |
| 8688 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8689 | return CMD_WARNING; |
| 8690 | } |
| 8691 | |
| 8692 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8693 | return CMD_SUCCESS; |
| 8694 | } |
| 8695 | |
| 8696 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, |
| 8697 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8698 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8699 | NO_STR |
| 8700 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8701 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8702 | "Route map reference\n" |
| 8703 | "Pointer to route-map entries\n" |
| 8704 | "Metric for redistributed routes\n" |
| 8705 | "Default metric\n") |
| 8706 | { |
| 8707 | int type; |
| 8708 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8709 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8710 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8711 | { |
| 8712 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8713 | return CMD_WARNING; |
| 8714 | } |
| 8715 | |
| 8716 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8717 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8718 | return CMD_SUCCESS; |
| 8719 | } |
| 8720 | |
| 8721 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, |
| 8722 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8723 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8724 | NO_STR |
| 8725 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8726 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8727 | "Metric for redistributed routes\n" |
| 8728 | "Default metric\n" |
| 8729 | "Route map reference\n" |
| 8730 | "Pointer to route-map entries\n") |
| 8731 | |
| 8732 | #ifdef HAVE_IPV6 |
| 8733 | DEFUN (bgp_redistribute_ipv6, |
| 8734 | bgp_redistribute_ipv6_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8735 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8736 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8737 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8738 | { |
| 8739 | int type; |
| 8740 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8741 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8742 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8743 | { |
| 8744 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8745 | return CMD_WARNING; |
| 8746 | } |
| 8747 | |
| 8748 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8749 | } |
| 8750 | |
| 8751 | DEFUN (bgp_redistribute_ipv6_rmap, |
| 8752 | bgp_redistribute_ipv6_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8753 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8754 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8755 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8756 | "Route map reference\n" |
| 8757 | "Pointer to route-map entries\n") |
| 8758 | { |
| 8759 | int type; |
| 8760 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8761 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8762 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8763 | { |
| 8764 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8765 | return CMD_WARNING; |
| 8766 | } |
| 8767 | |
| 8768 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8769 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8770 | } |
| 8771 | |
| 8772 | DEFUN (bgp_redistribute_ipv6_metric, |
| 8773 | bgp_redistribute_ipv6_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8774 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8775 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8776 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8777 | "Metric for redistributed routes\n" |
| 8778 | "Default metric\n") |
| 8779 | { |
| 8780 | int type; |
| 8781 | u_int32_t metric; |
| 8782 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8783 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8784 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8785 | { |
| 8786 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8787 | return CMD_WARNING; |
| 8788 | } |
| 8789 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8790 | |
| 8791 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8792 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8793 | } |
| 8794 | |
| 8795 | DEFUN (bgp_redistribute_ipv6_rmap_metric, |
| 8796 | bgp_redistribute_ipv6_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8797 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8798 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8799 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8800 | "Route map reference\n" |
| 8801 | "Pointer to route-map entries\n" |
| 8802 | "Metric for redistributed routes\n" |
| 8803 | "Default metric\n") |
| 8804 | { |
| 8805 | int type; |
| 8806 | u_int32_t metric; |
| 8807 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8808 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8809 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8810 | { |
| 8811 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8812 | return CMD_WARNING; |
| 8813 | } |
| 8814 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8815 | |
| 8816 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8817 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8818 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8819 | } |
| 8820 | |
| 8821 | DEFUN (bgp_redistribute_ipv6_metric_rmap, |
| 8822 | bgp_redistribute_ipv6_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8823 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8824 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8825 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8826 | "Metric for redistributed routes\n" |
| 8827 | "Default metric\n" |
| 8828 | "Route map reference\n" |
| 8829 | "Pointer to route-map entries\n") |
| 8830 | { |
| 8831 | int type; |
| 8832 | u_int32_t metric; |
| 8833 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8834 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8835 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8836 | { |
| 8837 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8838 | return CMD_WARNING; |
| 8839 | } |
| 8840 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8841 | |
| 8842 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8843 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); |
| 8844 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8845 | } |
| 8846 | |
| 8847 | DEFUN (no_bgp_redistribute_ipv6, |
| 8848 | no_bgp_redistribute_ipv6_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8849 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8850 | NO_STR |
| 8851 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8852 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8853 | { |
| 8854 | int type; |
| 8855 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8856 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8857 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8858 | { |
| 8859 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8860 | return CMD_WARNING; |
| 8861 | } |
| 8862 | |
| 8863 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); |
| 8864 | } |
| 8865 | |
| 8866 | DEFUN (no_bgp_redistribute_ipv6_rmap, |
| 8867 | no_bgp_redistribute_ipv6_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8868 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8869 | NO_STR |
| 8870 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8871 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8872 | "Route map reference\n" |
| 8873 | "Pointer to route-map entries\n") |
| 8874 | { |
| 8875 | int type; |
| 8876 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8877 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8878 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8879 | { |
| 8880 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8881 | return CMD_WARNING; |
| 8882 | } |
| 8883 | |
| 8884 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8885 | return CMD_SUCCESS; |
| 8886 | } |
| 8887 | |
| 8888 | DEFUN (no_bgp_redistribute_ipv6_metric, |
| 8889 | no_bgp_redistribute_ipv6_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8890 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8891 | NO_STR |
| 8892 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8893 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8894 | "Metric for redistributed routes\n" |
| 8895 | "Default metric\n") |
| 8896 | { |
| 8897 | int type; |
| 8898 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8899 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8900 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8901 | { |
| 8902 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8903 | return CMD_WARNING; |
| 8904 | } |
| 8905 | |
| 8906 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8907 | return CMD_SUCCESS; |
| 8908 | } |
| 8909 | |
| 8910 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, |
| 8911 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8912 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8913 | NO_STR |
| 8914 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8915 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8916 | "Route map reference\n" |
| 8917 | "Pointer to route-map entries\n" |
| 8918 | "Metric for redistributed routes\n" |
| 8919 | "Default metric\n") |
| 8920 | { |
| 8921 | int type; |
| 8922 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8923 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8924 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8925 | { |
| 8926 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8927 | return CMD_WARNING; |
| 8928 | } |
| 8929 | |
| 8930 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8931 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8932 | return CMD_SUCCESS; |
| 8933 | } |
| 8934 | |
| 8935 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, |
| 8936 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8937 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8938 | NO_STR |
| 8939 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8940 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8941 | "Metric for redistributed routes\n" |
| 8942 | "Default metric\n" |
| 8943 | "Route map reference\n" |
| 8944 | "Pointer to route-map entries\n") |
| 8945 | #endif /* HAVE_IPV6 */ |
| 8946 | |
| 8947 | int |
| 8948 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 8949 | safi_t safi, int *write) |
| 8950 | { |
| 8951 | int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8952 | |
| 8953 | /* Unicast redistribution only. */ |
| 8954 | if (safi != SAFI_UNICAST) |
| 8955 | return 0; |
| 8956 | |
| 8957 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 8958 | { |
| 8959 | /* Redistribute BGP does not make sense. */ |
| 8960 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) |
| 8961 | { |
| 8962 | /* Display "address-family" when it is not yet diplayed. */ |
| 8963 | bgp_config_write_family_header (vty, afi, safi, write); |
| 8964 | |
| 8965 | /* "redistribute" configuration. */ |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 8966 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8967 | |
| 8968 | if (bgp->redist_metric_flag[afi][i]) |
| 8969 | vty_out (vty, " metric %d", bgp->redist_metric[afi][i]); |
| 8970 | |
| 8971 | if (bgp->rmap[afi][i].name) |
| 8972 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); |
| 8973 | |
| 8974 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8975 | } |
| 8976 | } |
| 8977 | return *write; |
| 8978 | } |
| 8979 | |
| 8980 | /* BGP node structure. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8981 | static struct cmd_node bgp_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8982 | { |
| 8983 | BGP_NODE, |
| 8984 | "%s(config-router)# ", |
| 8985 | 1, |
| 8986 | }; |
| 8987 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8988 | static struct cmd_node bgp_ipv4_unicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8989 | { |
| 8990 | BGP_IPV4_NODE, |
| 8991 | "%s(config-router-af)# ", |
| 8992 | 1, |
| 8993 | }; |
| 8994 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8995 | static struct cmd_node bgp_ipv4_multicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8996 | { |
| 8997 | BGP_IPV4M_NODE, |
| 8998 | "%s(config-router-af)# ", |
| 8999 | 1, |
| 9000 | }; |
| 9001 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9002 | static struct cmd_node bgp_ipv6_unicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9003 | { |
| 9004 | BGP_IPV6_NODE, |
| 9005 | "%s(config-router-af)# ", |
| 9006 | 1, |
| 9007 | }; |
| 9008 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9009 | static struct cmd_node bgp_ipv6_multicast_node = |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9010 | { |
| 9011 | BGP_IPV6M_NODE, |
| 9012 | "%s(config-router-af)# ", |
| 9013 | 1, |
| 9014 | }; |
| 9015 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9016 | static struct cmd_node bgp_vpnv4_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9017 | { |
| 9018 | BGP_VPNV4_NODE, |
| 9019 | "%s(config-router-af)# ", |
| 9020 | 1 |
| 9021 | }; |
| 9022 | |
paul | 1f8ae70 | 2005-09-09 23:49:49 +0000 | [diff] [blame] | 9023 | static void community_list_vty (void); |
| 9024 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9025 | void |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9026 | bgp_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9027 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9028 | /* Install bgp top node. */ |
| 9029 | install_node (&bgp_node, bgp_config_write); |
| 9030 | install_node (&bgp_ipv4_unicast_node, NULL); |
| 9031 | install_node (&bgp_ipv4_multicast_node, NULL); |
| 9032 | install_node (&bgp_ipv6_unicast_node, NULL); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9033 | install_node (&bgp_ipv6_multicast_node, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9034 | install_node (&bgp_vpnv4_node, NULL); |
| 9035 | |
| 9036 | /* Install default VTY commands to new nodes. */ |
| 9037 | install_default (BGP_NODE); |
| 9038 | install_default (BGP_IPV4_NODE); |
| 9039 | install_default (BGP_IPV4M_NODE); |
| 9040 | install_default (BGP_IPV6_NODE); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9041 | install_default (BGP_IPV6M_NODE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9042 | install_default (BGP_VPNV4_NODE); |
| 9043 | |
| 9044 | /* "bgp multiple-instance" commands. */ |
| 9045 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); |
| 9046 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); |
| 9047 | |
| 9048 | /* "bgp config-type" commands. */ |
| 9049 | install_element (CONFIG_NODE, &bgp_config_type_cmd); |
| 9050 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); |
| 9051 | |
| 9052 | /* Dummy commands (Currently not supported) */ |
| 9053 | install_element (BGP_NODE, &no_synchronization_cmd); |
| 9054 | install_element (BGP_NODE, &no_auto_summary_cmd); |
| 9055 | |
| 9056 | /* "router bgp" commands. */ |
| 9057 | install_element (CONFIG_NODE, &router_bgp_cmd); |
| 9058 | install_element (CONFIG_NODE, &router_bgp_view_cmd); |
| 9059 | |
| 9060 | /* "no router bgp" commands. */ |
| 9061 | install_element (CONFIG_NODE, &no_router_bgp_cmd); |
| 9062 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); |
| 9063 | |
| 9064 | /* "bgp router-id" commands. */ |
| 9065 | install_element (BGP_NODE, &bgp_router_id_cmd); |
| 9066 | install_element (BGP_NODE, &no_bgp_router_id_cmd); |
| 9067 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); |
| 9068 | |
| 9069 | /* "bgp cluster-id" commands. */ |
| 9070 | install_element (BGP_NODE, &bgp_cluster_id_cmd); |
| 9071 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); |
| 9072 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); |
| 9073 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); |
| 9074 | |
| 9075 | /* "bgp confederation" commands. */ |
| 9076 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); |
| 9077 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); |
| 9078 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); |
| 9079 | |
| 9080 | /* "bgp confederation peers" commands. */ |
| 9081 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); |
| 9082 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); |
| 9083 | |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 9084 | /* "maximum-paths" commands. */ |
| 9085 | install_element (BGP_NODE, &bgp_maxpaths_cmd); |
| 9086 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); |
| 9087 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); |
| 9088 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); |
| 9089 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); |
| 9090 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); |
| 9091 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
| 9092 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
| 9093 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
| 9094 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
| 9095 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
| 9096 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
| 9097 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9098 | /* "timers bgp" commands. */ |
| 9099 | install_element (BGP_NODE, &bgp_timers_cmd); |
| 9100 | install_element (BGP_NODE, &no_bgp_timers_cmd); |
| 9101 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); |
| 9102 | |
| 9103 | /* "bgp client-to-client reflection" commands */ |
| 9104 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); |
| 9105 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); |
| 9106 | |
| 9107 | /* "bgp always-compare-med" commands */ |
| 9108 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); |
| 9109 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); |
| 9110 | |
| 9111 | /* "bgp deterministic-med" commands */ |
| 9112 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); |
| 9113 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 9114 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 9115 | /* "bgp graceful-restart" commands */ |
| 9116 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); |
| 9117 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 9118 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
| 9119 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); |
| 9120 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9121 | |
| 9122 | /* "bgp fast-external-failover" commands */ |
| 9123 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); |
| 9124 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); |
| 9125 | |
| 9126 | /* "bgp enforce-first-as" commands */ |
| 9127 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); |
| 9128 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); |
| 9129 | |
| 9130 | /* "bgp bestpath compare-routerid" commands */ |
| 9131 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); |
| 9132 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); |
| 9133 | |
| 9134 | /* "bgp bestpath as-path ignore" commands */ |
| 9135 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); |
| 9136 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); |
| 9137 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 9138 | /* "bgp bestpath as-path confed" commands */ |
| 9139 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); |
| 9140 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); |
| 9141 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 9142 | /* "bgp log-neighbor-changes" commands */ |
| 9143 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); |
| 9144 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); |
| 9145 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9146 | /* "bgp bestpath med" commands */ |
| 9147 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); |
| 9148 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); |
| 9149 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); |
| 9150 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); |
| 9151 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); |
| 9152 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); |
| 9153 | |
| 9154 | /* "no bgp default ipv4-unicast" commands. */ |
| 9155 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); |
| 9156 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); |
| 9157 | |
| 9158 | /* "bgp network import-check" commands. */ |
| 9159 | install_element (BGP_NODE, &bgp_network_import_check_cmd); |
| 9160 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
| 9161 | |
| 9162 | /* "bgp default local-preference" commands. */ |
| 9163 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); |
| 9164 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); |
| 9165 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); |
| 9166 | |
| 9167 | /* "neighbor remote-as" commands. */ |
| 9168 | install_element (BGP_NODE, &neighbor_remote_as_cmd); |
| 9169 | install_element (BGP_NODE, &no_neighbor_cmd); |
| 9170 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); |
| 9171 | |
| 9172 | /* "neighbor peer-group" commands. */ |
| 9173 | install_element (BGP_NODE, &neighbor_peer_group_cmd); |
| 9174 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); |
| 9175 | install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd); |
| 9176 | |
| 9177 | /* "neighbor local-as" commands. */ |
| 9178 | install_element (BGP_NODE, &neighbor_local_as_cmd); |
| 9179 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); |
| 9180 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
| 9181 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); |
| 9182 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); |
| 9183 | |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 9184 | /* "neighbor password" commands. */ |
| 9185 | install_element (BGP_NODE, &neighbor_password_cmd); |
| 9186 | install_element (BGP_NODE, &no_neighbor_password_cmd); |
| 9187 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9188 | /* "neighbor activate" commands. */ |
| 9189 | install_element (BGP_NODE, &neighbor_activate_cmd); |
| 9190 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); |
| 9191 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); |
| 9192 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9193 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9194 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
| 9195 | |
| 9196 | /* "no neighbor activate" commands. */ |
| 9197 | install_element (BGP_NODE, &no_neighbor_activate_cmd); |
| 9198 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); |
| 9199 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); |
| 9200 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9201 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9202 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
| 9203 | |
| 9204 | /* "neighbor peer-group set" commands. */ |
| 9205 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
| 9206 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); |
| 9207 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); |
| 9208 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9209 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9210 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
| 9211 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9212 | /* "no neighbor peer-group unset" commands. */ |
| 9213 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); |
| 9214 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 9215 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); |
| 9216 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9217 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9218 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 9219 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9220 | /* "neighbor softreconfiguration inbound" commands.*/ |
| 9221 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9222 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9223 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9224 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9225 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9226 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9227 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9228 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9229 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9230 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9231 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9232 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9233 | |
| 9234 | /* "neighbor attribute-unchanged" commands. */ |
| 9235 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); |
| 9236 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); |
| 9237 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); |
| 9238 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); |
| 9239 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); |
| 9240 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); |
| 9241 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); |
| 9242 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); |
| 9243 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); |
| 9244 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); |
| 9245 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); |
| 9246 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9247 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9248 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9249 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9250 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9251 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9252 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9253 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9254 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9255 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9256 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9257 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); |
| 9258 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 9259 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 9260 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 9261 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 9262 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 9263 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 9264 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 9265 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 9266 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 9267 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 9268 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9269 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9270 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9271 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9272 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9273 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9274 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9275 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9276 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9277 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9278 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9279 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); |
| 9280 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); |
| 9281 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); |
| 9282 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); |
| 9283 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); |
| 9284 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); |
| 9285 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); |
| 9286 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); |
| 9287 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); |
| 9288 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); |
| 9289 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); |
| 9290 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9291 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9292 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9293 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9294 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9295 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9296 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9297 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9298 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9299 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9300 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9301 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); |
| 9302 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); |
| 9303 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); |
| 9304 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); |
| 9305 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); |
| 9306 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); |
| 9307 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); |
| 9308 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); |
| 9309 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); |
| 9310 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); |
| 9311 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); |
| 9312 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9313 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9314 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9315 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9316 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9317 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9318 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9319 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9320 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9321 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9322 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9323 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
| 9324 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); |
| 9325 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); |
| 9326 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); |
| 9327 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); |
| 9328 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); |
| 9329 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); |
| 9330 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); |
| 9331 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); |
| 9332 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); |
| 9333 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); |
| 9334 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9335 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9336 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9337 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9338 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9339 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9340 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9341 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9342 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9343 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9344 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9345 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
| 9346 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 9347 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 9348 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 9349 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 9350 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 9351 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 9352 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 9353 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 9354 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 9355 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 9356 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9357 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9358 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9359 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9360 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9361 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9362 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9363 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9364 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9365 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9366 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9367 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9368 | /* "nexthop-local unchanged" commands */ |
| 9369 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); |
| 9370 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); |
| 9371 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9372 | /* "transparent-as" and "transparent-nexthop" for old version |
| 9373 | compatibility. */ |
| 9374 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); |
| 9375 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); |
| 9376 | |
| 9377 | /* "neighbor next-hop-self" commands. */ |
| 9378 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); |
| 9379 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); |
| 9380 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); |
| 9381 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 9382 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); |
| 9383 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); |
| 9384 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); |
| 9385 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9386 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
| 9387 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9388 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
| 9389 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 9390 | |
| 9391 | /* "neighbor remove-private-AS" commands. */ |
| 9392 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); |
| 9393 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); |
| 9394 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
| 9395 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 9396 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
| 9397 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); |
| 9398 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
| 9399 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9400 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
| 9401 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9402 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
| 9403 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 9404 | |
| 9405 | /* "neighbor send-community" commands.*/ |
| 9406 | install_element (BGP_NODE, &neighbor_send_community_cmd); |
| 9407 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); |
| 9408 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); |
| 9409 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); |
| 9410 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); |
| 9411 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); |
| 9412 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); |
| 9413 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); |
| 9414 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); |
| 9415 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); |
| 9416 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); |
| 9417 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); |
| 9418 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); |
| 9419 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); |
| 9420 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); |
| 9421 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9422 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
| 9423 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); |
| 9424 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); |
| 9425 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9426 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
| 9427 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); |
| 9428 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); |
| 9429 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); |
| 9430 | |
| 9431 | /* "neighbor route-reflector" commands.*/ |
| 9432 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); |
| 9433 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9434 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); |
| 9435 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9436 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); |
| 9437 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9438 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); |
| 9439 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9440 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
| 9441 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9442 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
| 9443 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9444 | |
| 9445 | /* "neighbor route-server" commands.*/ |
| 9446 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); |
| 9447 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); |
| 9448 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); |
| 9449 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9450 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); |
| 9451 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); |
| 9452 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); |
| 9453 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9454 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
| 9455 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9456 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
| 9457 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9458 | |
| 9459 | /* "neighbor passive" commands. */ |
| 9460 | install_element (BGP_NODE, &neighbor_passive_cmd); |
| 9461 | install_element (BGP_NODE, &no_neighbor_passive_cmd); |
| 9462 | |
| 9463 | /* "neighbor shutdown" commands. */ |
| 9464 | install_element (BGP_NODE, &neighbor_shutdown_cmd); |
| 9465 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); |
| 9466 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 9467 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9468 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
| 9469 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); |
| 9470 | |
| 9471 | /* "neighbor capability orf prefix-list" commands.*/ |
| 9472 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9473 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9474 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9475 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9476 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9477 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9478 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9479 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9480 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9481 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9482 | |
| 9483 | /* "neighbor capability dynamic" commands.*/ |
| 9484 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); |
| 9485 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); |
| 9486 | |
| 9487 | /* "neighbor dont-capability-negotiate" commands. */ |
| 9488 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); |
| 9489 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); |
| 9490 | |
| 9491 | /* "neighbor ebgp-multihop" commands. */ |
| 9492 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); |
| 9493 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); |
| 9494 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); |
| 9495 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); |
| 9496 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 9497 | /* "neighbor disable-connected-check" commands. */ |
| 9498 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); |
| 9499 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9500 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
| 9501 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); |
| 9502 | |
| 9503 | /* "neighbor description" commands. */ |
| 9504 | install_element (BGP_NODE, &neighbor_description_cmd); |
| 9505 | install_element (BGP_NODE, &no_neighbor_description_cmd); |
| 9506 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); |
| 9507 | |
| 9508 | /* "neighbor update-source" commands. "*/ |
| 9509 | install_element (BGP_NODE, &neighbor_update_source_cmd); |
| 9510 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); |
| 9511 | |
| 9512 | /* "neighbor default-originate" commands. */ |
| 9513 | install_element (BGP_NODE, &neighbor_default_originate_cmd); |
| 9514 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); |
| 9515 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); |
| 9516 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9517 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); |
| 9518 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); |
| 9519 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); |
| 9520 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9521 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); |
| 9522 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9523 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); |
| 9524 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9525 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); |
| 9526 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); |
| 9527 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); |
| 9528 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9529 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
| 9530 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9531 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); |
| 9532 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9533 | |
| 9534 | /* "neighbor port" commands. */ |
| 9535 | install_element (BGP_NODE, &neighbor_port_cmd); |
| 9536 | install_element (BGP_NODE, &no_neighbor_port_cmd); |
| 9537 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); |
| 9538 | |
| 9539 | /* "neighbor weight" commands. */ |
| 9540 | install_element (BGP_NODE, &neighbor_weight_cmd); |
| 9541 | install_element (BGP_NODE, &no_neighbor_weight_cmd); |
| 9542 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); |
| 9543 | |
| 9544 | /* "neighbor override-capability" commands. */ |
| 9545 | install_element (BGP_NODE, &neighbor_override_capability_cmd); |
| 9546 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); |
| 9547 | |
| 9548 | /* "neighbor strict-capability-match" commands. */ |
| 9549 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); |
| 9550 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); |
| 9551 | |
| 9552 | /* "neighbor timers" commands. */ |
| 9553 | install_element (BGP_NODE, &neighbor_timers_cmd); |
| 9554 | install_element (BGP_NODE, &no_neighbor_timers_cmd); |
| 9555 | |
| 9556 | /* "neighbor timers connect" commands. */ |
| 9557 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); |
| 9558 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); |
| 9559 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); |
| 9560 | |
| 9561 | /* "neighbor advertisement-interval" commands. */ |
| 9562 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); |
| 9563 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); |
| 9564 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); |
| 9565 | |
| 9566 | /* "neighbor version" commands. */ |
| 9567 | install_element (BGP_NODE, &neighbor_version_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9568 | |
| 9569 | /* "neighbor interface" commands. */ |
| 9570 | install_element (BGP_NODE, &neighbor_interface_cmd); |
| 9571 | install_element (BGP_NODE, &no_neighbor_interface_cmd); |
| 9572 | |
| 9573 | /* "neighbor distribute" commands. */ |
| 9574 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); |
| 9575 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); |
| 9576 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); |
| 9577 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9578 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); |
| 9579 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); |
| 9580 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); |
| 9581 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9582 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
| 9583 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9584 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
| 9585 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9586 | |
| 9587 | /* "neighbor prefix-list" commands. */ |
| 9588 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); |
| 9589 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); |
| 9590 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); |
| 9591 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9592 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); |
| 9593 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); |
| 9594 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); |
| 9595 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9596 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
| 9597 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9598 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
| 9599 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9600 | |
| 9601 | /* "neighbor filter-list" commands. */ |
| 9602 | install_element (BGP_NODE, &neighbor_filter_list_cmd); |
| 9603 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); |
| 9604 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); |
| 9605 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); |
| 9606 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); |
| 9607 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); |
| 9608 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); |
| 9609 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9610 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
| 9611 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9612 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
| 9613 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); |
| 9614 | |
| 9615 | /* "neighbor route-map" commands. */ |
| 9616 | install_element (BGP_NODE, &neighbor_route_map_cmd); |
| 9617 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); |
| 9618 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); |
| 9619 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); |
| 9620 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); |
| 9621 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); |
| 9622 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); |
| 9623 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9624 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
| 9625 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9626 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
| 9627 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); |
| 9628 | |
| 9629 | /* "neighbor unsuppress-map" commands. */ |
| 9630 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); |
| 9631 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9632 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9633 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9634 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); |
| 9635 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9636 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); |
| 9637 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9638 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
| 9639 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9640 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9641 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9642 | |
| 9643 | /* "neighbor maximum-prefix" commands. */ |
| 9644 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9645 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9646 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9647 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9648 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9649 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9650 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9651 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9652 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9653 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9654 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9655 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9656 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9657 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9658 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9659 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9660 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9661 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9662 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9663 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9664 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9665 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9666 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9667 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9668 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9669 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9670 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9671 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9672 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9673 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9674 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9675 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9676 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9677 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9678 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9679 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9680 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9681 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9682 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9683 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9684 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9685 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9686 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9687 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9688 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9689 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9690 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9691 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9692 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9693 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9694 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9695 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9696 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
| 9697 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
| 9698 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); |
| 9699 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
| 9700 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9701 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
| 9702 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9703 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
| 9704 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9705 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9706 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9707 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9708 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9709 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9710 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9711 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9712 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9713 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9714 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9715 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9716 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9717 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9718 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9719 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9720 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9721 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9722 | |
| 9723 | /* "neighbor allowas-in" */ |
| 9724 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); |
| 9725 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); |
| 9726 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); |
| 9727 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
| 9728 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9729 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9730 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
| 9731 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9732 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); |
| 9733 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
| 9734 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); |
| 9735 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9736 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
| 9737 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9738 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9739 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
| 9740 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9741 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9742 | |
| 9743 | /* address-family commands. */ |
| 9744 | install_element (BGP_NODE, &address_family_ipv4_cmd); |
| 9745 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); |
| 9746 | #ifdef HAVE_IPV6 |
| 9747 | install_element (BGP_NODE, &address_family_ipv6_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9748 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9749 | #endif /* HAVE_IPV6 */ |
| 9750 | install_element (BGP_NODE, &address_family_vpnv4_cmd); |
| 9751 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); |
| 9752 | |
| 9753 | /* "exit-address-family" command. */ |
| 9754 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); |
| 9755 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); |
| 9756 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9757 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9758 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
| 9759 | |
| 9760 | /* "clear ip bgp commands" */ |
| 9761 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); |
| 9762 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); |
| 9763 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); |
| 9764 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
| 9765 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
| 9766 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
| 9767 | #ifdef HAVE_IPV6 |
| 9768 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
| 9769 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); |
| 9770 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); |
| 9771 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
| 9772 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
| 9773 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
| 9774 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
| 9775 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
| 9776 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
| 9777 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
| 9778 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
| 9779 | #endif /* HAVE_IPV6 */ |
| 9780 | |
| 9781 | /* "clear ip bgp neighbor soft in" */ |
| 9782 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); |
| 9783 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); |
| 9784 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); |
| 9785 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
| 9786 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); |
| 9787 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
| 9788 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
| 9789 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
| 9790 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); |
| 9791 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
| 9792 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
| 9793 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); |
| 9794 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
| 9795 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
| 9796 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); |
| 9797 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
| 9798 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
| 9799 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); |
| 9800 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); |
| 9801 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); |
| 9802 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
| 9803 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); |
| 9804 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
| 9805 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
| 9806 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
| 9807 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); |
| 9808 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
| 9809 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
| 9810 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); |
| 9811 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
| 9812 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
| 9813 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); |
| 9814 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
| 9815 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
| 9816 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); |
| 9817 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); |
| 9818 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); |
| 9819 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); |
| 9820 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); |
| 9821 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); |
| 9822 | #ifdef HAVE_IPV6 |
| 9823 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
| 9824 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); |
| 9825 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); |
| 9826 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
| 9827 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); |
| 9828 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
| 9829 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
| 9830 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); |
| 9831 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
| 9832 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
| 9833 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); |
| 9834 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
| 9835 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
| 9836 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); |
| 9837 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
| 9838 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
| 9839 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); |
| 9840 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
| 9841 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
| 9842 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); |
| 9843 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
| 9844 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
| 9845 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); |
| 9846 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
| 9847 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
| 9848 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); |
| 9849 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
| 9850 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
| 9851 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); |
| 9852 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
| 9853 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
| 9854 | #endif /* HAVE_IPV6 */ |
| 9855 | |
| 9856 | /* "clear ip bgp neighbor soft out" */ |
| 9857 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); |
| 9858 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); |
| 9859 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); |
| 9860 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
| 9861 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
| 9862 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
| 9863 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
| 9864 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
| 9865 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
| 9866 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
| 9867 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
| 9868 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
| 9869 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); |
| 9870 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); |
| 9871 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
| 9872 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
| 9873 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
| 9874 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
| 9875 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
| 9876 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
| 9877 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
| 9878 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
| 9879 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
| 9880 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); |
| 9881 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); |
| 9882 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); |
| 9883 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); |
| 9884 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); |
| 9885 | #ifdef HAVE_IPV6 |
| 9886 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
| 9887 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); |
| 9888 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); |
| 9889 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
| 9890 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
| 9891 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
| 9892 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
| 9893 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
| 9894 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
| 9895 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
| 9896 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
| 9897 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
| 9898 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
| 9899 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
| 9900 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
| 9901 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
| 9902 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
| 9903 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
| 9904 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
| 9905 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
| 9906 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
| 9907 | #endif /* HAVE_IPV6 */ |
| 9908 | |
| 9909 | /* "clear ip bgp neighbor soft" */ |
| 9910 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); |
| 9911 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); |
| 9912 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); |
| 9913 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
| 9914 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
| 9915 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
| 9916 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
| 9917 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); |
| 9918 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); |
| 9919 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
| 9920 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
| 9921 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
| 9922 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
| 9923 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); |
| 9924 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); |
| 9925 | #ifdef HAVE_IPV6 |
| 9926 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
| 9927 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); |
| 9928 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); |
| 9929 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
| 9930 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
| 9931 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
| 9932 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
| 9933 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
| 9934 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
| 9935 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
| 9936 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
| 9937 | #endif /* HAVE_IPV6 */ |
| 9938 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9939 | /* "clear ip bgp neighbor rsclient" */ |
| 9940 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); |
| 9941 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); |
| 9942 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); |
| 9943 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); |
| 9944 | #ifdef HAVE_IPV6 |
| 9945 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); |
| 9946 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); |
| 9947 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); |
| 9948 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); |
| 9949 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); |
| 9950 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); |
| 9951 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); |
| 9952 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); |
| 9953 | #endif /* HAVE_IPV6 */ |
| 9954 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9955 | /* "show ip bgp summary" commands. */ |
| 9956 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); |
| 9957 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9958 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9959 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9960 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9961 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9962 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9963 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9964 | #ifdef HAVE_IPV6 |
| 9965 | install_element (VIEW_NODE, &show_bgp_summary_cmd); |
| 9966 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); |
| 9967 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9968 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9969 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9970 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9971 | #endif /* HAVE_IPV6 */ |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9972 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); |
| 9973 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9974 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9975 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9976 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9977 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9978 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9979 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9980 | #ifdef HAVE_IPV6 |
| 9981 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); |
| 9982 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); |
| 9983 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9984 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9985 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9986 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9987 | #endif /* HAVE_IPV6 */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9988 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); |
| 9989 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9990 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9991 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9992 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9993 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9994 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9995 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9996 | #ifdef HAVE_IPV6 |
| 9997 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); |
| 9998 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); |
| 9999 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10000 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10001 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10002 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10003 | #endif /* HAVE_IPV6 */ |
| 10004 | |
| 10005 | /* "show ip bgp neighbors" commands. */ |
| 10006 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); |
| 10007 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 10008 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10009 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10010 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 10011 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 10012 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10013 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10014 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 10015 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10016 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10017 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10018 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10019 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10020 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10021 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
| 10022 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 10023 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10024 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10025 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 10026 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 10027 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10028 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10029 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 10030 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 10031 | |
| 10032 | #ifdef HAVE_IPV6 |
| 10033 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); |
| 10034 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 10035 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); |
| 10036 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 10037 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
| 10038 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 10039 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10040 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10041 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
| 10042 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
| 10043 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10044 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10045 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
| 10046 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 10047 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); |
| 10048 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 10049 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
| 10050 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 10051 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10052 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10053 | |
| 10054 | /* Old commands. */ |
| 10055 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); |
| 10056 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); |
| 10057 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); |
| 10058 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); |
| 10059 | #endif /* HAVE_IPV6 */ |
| 10060 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10061 | /* "show ip bgp rsclient" commands. */ |
| 10062 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10063 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10064 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10065 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10066 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10067 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10068 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10069 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10070 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10071 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10072 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10073 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10074 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10075 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10076 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10077 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10078 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10079 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10080 | |
| 10081 | #ifdef HAVE_IPV6 |
| 10082 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); |
| 10083 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10084 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10085 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10086 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10087 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10088 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
| 10089 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10090 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10091 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10092 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10093 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10094 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
| 10095 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10096 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10097 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10098 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10099 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10100 | #endif /* HAVE_IPV6 */ |
| 10101 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10102 | /* "show ip bgp paths" commands. */ |
| 10103 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); |
| 10104 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 10105 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); |
| 10106 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 10107 | |
| 10108 | /* "show ip bgp community" commands. */ |
| 10109 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); |
| 10110 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); |
| 10111 | |
| 10112 | /* "show ip bgp attribute-info" commands. */ |
| 10113 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); |
| 10114 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); |
| 10115 | |
| 10116 | /* "redistribute" commands. */ |
| 10117 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); |
| 10118 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); |
| 10119 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); |
| 10120 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); |
| 10121 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); |
| 10122 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); |
| 10123 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); |
| 10124 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); |
| 10125 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); |
| 10126 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); |
| 10127 | #ifdef HAVE_IPV6 |
| 10128 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); |
| 10129 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); |
| 10130 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); |
| 10131 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); |
| 10132 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); |
| 10133 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); |
| 10134 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); |
| 10135 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); |
| 10136 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); |
| 10137 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); |
| 10138 | #endif /* HAVE_IPV6 */ |
| 10139 | |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 10140 | /* ttl_security commands */ |
| 10141 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); |
| 10142 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); |
| 10143 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 10144 | /* "show bgp memory" commands. */ |
| 10145 | install_element (VIEW_NODE, &show_bgp_memory_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10146 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 10147 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
| 10148 | |
Michael Lambert | e0081f7 | 2008-11-16 20:12:04 +0000 | [diff] [blame] | 10149 | /* "show bgp views" commands. */ |
| 10150 | install_element (VIEW_NODE, &show_bgp_views_cmd); |
| 10151 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); |
| 10152 | install_element (ENABLE_NODE, &show_bgp_views_cmd); |
| 10153 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10154 | /* Community-list. */ |
| 10155 | community_list_vty (); |
| 10156 | } |
| 10157 | |
| 10158 | #include "memory.h" |
| 10159 | #include "bgp_regex.h" |
| 10160 | #include "bgp_clist.h" |
| 10161 | #include "bgp_ecommunity.h" |
| 10162 | |
| 10163 | /* VTY functions. */ |
| 10164 | |
| 10165 | /* Direction value to string conversion. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10166 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10167 | community_direct_str (int direct) |
| 10168 | { |
| 10169 | switch (direct) |
| 10170 | { |
| 10171 | case COMMUNITY_DENY: |
| 10172 | return "deny"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10173 | case COMMUNITY_PERMIT: |
| 10174 | return "permit"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10175 | default: |
| 10176 | return "unknown"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10177 | } |
| 10178 | } |
| 10179 | |
| 10180 | /* Display error string. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10181 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10182 | community_list_perror (struct vty *vty, int ret) |
| 10183 | { |
| 10184 | switch (ret) |
| 10185 | { |
| 10186 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10187 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10188 | break; |
| 10189 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: |
| 10190 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); |
| 10191 | break; |
| 10192 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: |
| 10193 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); |
| 10194 | break; |
| 10195 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: |
| 10196 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); |
| 10197 | break; |
| 10198 | } |
| 10199 | } |
| 10200 | |
| 10201 | /* VTY interface for community_set() function. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10202 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10203 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10204 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10205 | { |
| 10206 | int ret; |
| 10207 | int direct; |
| 10208 | char *str; |
| 10209 | |
| 10210 | /* Check the list type. */ |
| 10211 | if (strncmp (argv[1], "p", 1) == 0) |
| 10212 | direct = COMMUNITY_PERMIT; |
| 10213 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10214 | direct = COMMUNITY_DENY; |
| 10215 | else |
| 10216 | { |
| 10217 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10218 | VTY_NEWLINE); |
| 10219 | return CMD_WARNING; |
| 10220 | } |
| 10221 | |
| 10222 | /* All digit name check. */ |
| 10223 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10224 | { |
| 10225 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10226 | return CMD_WARNING; |
| 10227 | } |
| 10228 | |
| 10229 | /* Concat community string argument. */ |
| 10230 | if (argc > 1) |
| 10231 | str = argv_concat (argv, argc, 2); |
| 10232 | else |
| 10233 | str = NULL; |
| 10234 | |
| 10235 | /* When community_list_set() return nevetive value, it means |
| 10236 | malformed community string. */ |
| 10237 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); |
| 10238 | |
| 10239 | /* Free temporary community list string allocated by |
| 10240 | argv_concat(). */ |
| 10241 | if (str) |
| 10242 | XFREE (MTYPE_TMP, str); |
| 10243 | |
| 10244 | if (ret < 0) |
| 10245 | { |
| 10246 | /* Display error string. */ |
| 10247 | community_list_perror (vty, ret); |
| 10248 | return CMD_WARNING; |
| 10249 | } |
| 10250 | |
| 10251 | return CMD_SUCCESS; |
| 10252 | } |
| 10253 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10254 | /* Communiyt-list entry delete. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10255 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10256 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10257 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10258 | { |
| 10259 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10260 | int direct = 0; |
| 10261 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10262 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10263 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10264 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10265 | /* Check the list direct. */ |
| 10266 | if (strncmp (argv[1], "p", 1) == 0) |
| 10267 | direct = COMMUNITY_PERMIT; |
| 10268 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10269 | direct = COMMUNITY_DENY; |
| 10270 | else |
| 10271 | { |
| 10272 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10273 | VTY_NEWLINE); |
| 10274 | return CMD_WARNING; |
| 10275 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10276 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10277 | /* Concat community string argument. */ |
| 10278 | str = argv_concat (argv, argc, 2); |
| 10279 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10280 | |
| 10281 | /* Unset community list. */ |
| 10282 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10283 | |
| 10284 | /* Free temporary community list string allocated by |
| 10285 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10286 | if (str) |
| 10287 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10288 | |
| 10289 | if (ret < 0) |
| 10290 | { |
| 10291 | community_list_perror (vty, ret); |
| 10292 | return CMD_WARNING; |
| 10293 | } |
| 10294 | |
| 10295 | return CMD_SUCCESS; |
| 10296 | } |
| 10297 | |
| 10298 | /* "community-list" keyword help string. */ |
| 10299 | #define COMMUNITY_LIST_STR "Add a community list entry\n" |
| 10300 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" |
| 10301 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10302 | DEFUN (ip_community_list_standard, |
| 10303 | ip_community_list_standard_cmd, |
| 10304 | "ip community-list <1-99> (deny|permit) .AA:NN", |
| 10305 | IP_STR |
| 10306 | COMMUNITY_LIST_STR |
| 10307 | "Community list number (standard)\n" |
| 10308 | "Specify community to reject\n" |
| 10309 | "Specify community to accept\n" |
| 10310 | COMMUNITY_VAL_STR) |
| 10311 | { |
| 10312 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
| 10313 | } |
| 10314 | |
| 10315 | ALIAS (ip_community_list_standard, |
| 10316 | ip_community_list_standard2_cmd, |
| 10317 | "ip community-list <1-99> (deny|permit)", |
| 10318 | IP_STR |
| 10319 | COMMUNITY_LIST_STR |
| 10320 | "Community list number (standard)\n" |
| 10321 | "Specify community to reject\n" |
| 10322 | "Specify community to accept\n") |
| 10323 | |
| 10324 | DEFUN (ip_community_list_expanded, |
| 10325 | ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10326 | "ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10327 | IP_STR |
| 10328 | COMMUNITY_LIST_STR |
| 10329 | "Community list number (expanded)\n" |
| 10330 | "Specify community to reject\n" |
| 10331 | "Specify community to accept\n" |
| 10332 | "An ordered list as a regular-expression\n") |
| 10333 | { |
| 10334 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
| 10335 | } |
| 10336 | |
| 10337 | DEFUN (ip_community_list_name_standard, |
| 10338 | ip_community_list_name_standard_cmd, |
| 10339 | "ip community-list standard WORD (deny|permit) .AA:NN", |
| 10340 | IP_STR |
| 10341 | COMMUNITY_LIST_STR |
| 10342 | "Add a standard community-list entry\n" |
| 10343 | "Community list name\n" |
| 10344 | "Specify community to reject\n" |
| 10345 | "Specify community to accept\n" |
| 10346 | COMMUNITY_VAL_STR) |
| 10347 | { |
| 10348 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
| 10349 | } |
| 10350 | |
| 10351 | ALIAS (ip_community_list_name_standard, |
| 10352 | ip_community_list_name_standard2_cmd, |
| 10353 | "ip community-list standard WORD (deny|permit)", |
| 10354 | IP_STR |
| 10355 | COMMUNITY_LIST_STR |
| 10356 | "Add a standard community-list entry\n" |
| 10357 | "Community list name\n" |
| 10358 | "Specify community to reject\n" |
| 10359 | "Specify community to accept\n") |
| 10360 | |
| 10361 | DEFUN (ip_community_list_name_expanded, |
| 10362 | ip_community_list_name_expanded_cmd, |
| 10363 | "ip community-list expanded WORD (deny|permit) .LINE", |
| 10364 | IP_STR |
| 10365 | COMMUNITY_LIST_STR |
| 10366 | "Add an expanded community-list entry\n" |
| 10367 | "Community list name\n" |
| 10368 | "Specify community to reject\n" |
| 10369 | "Specify community to accept\n" |
| 10370 | "An ordered list as a regular-expression\n") |
| 10371 | { |
| 10372 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
| 10373 | } |
| 10374 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10375 | DEFUN (no_ip_community_list_standard_all, |
| 10376 | no_ip_community_list_standard_all_cmd, |
| 10377 | "no ip community-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10378 | NO_STR |
| 10379 | IP_STR |
| 10380 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10381 | "Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10382 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10383 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10384 | } |
| 10385 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10386 | DEFUN (no_ip_community_list_expanded_all, |
| 10387 | no_ip_community_list_expanded_all_cmd, |
| 10388 | "no ip community-list <100-500>", |
| 10389 | NO_STR |
| 10390 | IP_STR |
| 10391 | COMMUNITY_LIST_STR |
| 10392 | "Community list number (expanded)\n") |
| 10393 | { |
| 10394 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10395 | } |
| 10396 | |
| 10397 | DEFUN (no_ip_community_list_name_standard_all, |
| 10398 | no_ip_community_list_name_standard_all_cmd, |
| 10399 | "no ip community-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10400 | NO_STR |
| 10401 | IP_STR |
| 10402 | COMMUNITY_LIST_STR |
| 10403 | "Add a standard community-list entry\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10404 | "Community list name\n") |
| 10405 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10406 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10407 | } |
| 10408 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10409 | DEFUN (no_ip_community_list_name_expanded_all, |
| 10410 | no_ip_community_list_name_expanded_all_cmd, |
| 10411 | "no ip community-list expanded WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10412 | NO_STR |
| 10413 | IP_STR |
| 10414 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10415 | "Add an expanded community-list entry\n" |
| 10416 | "Community list name\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10417 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10418 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10419 | } |
| 10420 | |
| 10421 | DEFUN (no_ip_community_list_standard, |
| 10422 | no_ip_community_list_standard_cmd, |
| 10423 | "no ip community-list <1-99> (deny|permit) .AA:NN", |
| 10424 | NO_STR |
| 10425 | IP_STR |
| 10426 | COMMUNITY_LIST_STR |
| 10427 | "Community list number (standard)\n" |
| 10428 | "Specify community to reject\n" |
| 10429 | "Specify community to accept\n" |
| 10430 | COMMUNITY_VAL_STR) |
| 10431 | { |
| 10432 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 10433 | } |
| 10434 | |
| 10435 | DEFUN (no_ip_community_list_expanded, |
| 10436 | no_ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10437 | "no ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10438 | NO_STR |
| 10439 | IP_STR |
| 10440 | COMMUNITY_LIST_STR |
| 10441 | "Community list number (expanded)\n" |
| 10442 | "Specify community to reject\n" |
| 10443 | "Specify community to accept\n" |
| 10444 | "An ordered list as a regular-expression\n") |
| 10445 | { |
| 10446 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10447 | } |
| 10448 | |
| 10449 | DEFUN (no_ip_community_list_name_standard, |
| 10450 | no_ip_community_list_name_standard_cmd, |
| 10451 | "no ip community-list standard WORD (deny|permit) .AA:NN", |
| 10452 | NO_STR |
| 10453 | IP_STR |
| 10454 | COMMUNITY_LIST_STR |
| 10455 | "Specify a standard community-list\n" |
| 10456 | "Community list name\n" |
| 10457 | "Specify community to reject\n" |
| 10458 | "Specify community to accept\n" |
| 10459 | COMMUNITY_VAL_STR) |
| 10460 | { |
| 10461 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 10462 | } |
| 10463 | |
| 10464 | DEFUN (no_ip_community_list_name_expanded, |
| 10465 | no_ip_community_list_name_expanded_cmd, |
| 10466 | "no ip community-list expanded WORD (deny|permit) .LINE", |
| 10467 | NO_STR |
| 10468 | IP_STR |
| 10469 | COMMUNITY_LIST_STR |
| 10470 | "Specify an expanded community-list\n" |
| 10471 | "Community list name\n" |
| 10472 | "Specify community to reject\n" |
| 10473 | "Specify community to accept\n" |
| 10474 | "An ordered list as a regular-expression\n") |
| 10475 | { |
| 10476 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10477 | } |
| 10478 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10479 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10480 | community_list_show (struct vty *vty, struct community_list *list) |
| 10481 | { |
| 10482 | struct community_entry *entry; |
| 10483 | |
| 10484 | for (entry = list->head; entry; entry = entry->next) |
| 10485 | { |
| 10486 | if (entry == list->head) |
| 10487 | { |
| 10488 | if (all_digit (list->name)) |
| 10489 | vty_out (vty, "Community %s list %s%s", |
| 10490 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 10491 | "standard" : "(expanded) access", |
| 10492 | list->name, VTY_NEWLINE); |
| 10493 | else |
| 10494 | vty_out (vty, "Named Community %s list %s%s", |
| 10495 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 10496 | "standard" : "expanded", |
| 10497 | list->name, VTY_NEWLINE); |
| 10498 | } |
| 10499 | if (entry->any) |
| 10500 | vty_out (vty, " %s%s", |
| 10501 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10502 | else |
| 10503 | vty_out (vty, " %s %s%s", |
| 10504 | community_direct_str (entry->direct), |
| 10505 | entry->style == COMMUNITY_LIST_STANDARD |
| 10506 | ? community_str (entry->u.com) : entry->config, |
| 10507 | VTY_NEWLINE); |
| 10508 | } |
| 10509 | } |
| 10510 | |
| 10511 | DEFUN (show_ip_community_list, |
| 10512 | show_ip_community_list_cmd, |
| 10513 | "show ip community-list", |
| 10514 | SHOW_STR |
| 10515 | IP_STR |
| 10516 | "List community-list\n") |
| 10517 | { |
| 10518 | struct community_list *list; |
| 10519 | struct community_list_master *cm; |
| 10520 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10521 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10522 | if (! cm) |
| 10523 | return CMD_SUCCESS; |
| 10524 | |
| 10525 | for (list = cm->num.head; list; list = list->next) |
| 10526 | community_list_show (vty, list); |
| 10527 | |
| 10528 | for (list = cm->str.head; list; list = list->next) |
| 10529 | community_list_show (vty, list); |
| 10530 | |
| 10531 | return CMD_SUCCESS; |
| 10532 | } |
| 10533 | |
| 10534 | DEFUN (show_ip_community_list_arg, |
| 10535 | show_ip_community_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10536 | "show ip community-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10537 | SHOW_STR |
| 10538 | IP_STR |
| 10539 | "List community-list\n" |
| 10540 | "Community-list number\n" |
| 10541 | "Community-list name\n") |
| 10542 | { |
| 10543 | struct community_list *list; |
| 10544 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10545 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10546 | if (! list) |
| 10547 | { |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10548 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10549 | return CMD_WARNING; |
| 10550 | } |
| 10551 | |
| 10552 | community_list_show (vty, list); |
| 10553 | |
| 10554 | return CMD_SUCCESS; |
| 10555 | } |
| 10556 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10557 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10558 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10559 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10560 | { |
| 10561 | int ret; |
| 10562 | int direct; |
| 10563 | char *str; |
| 10564 | |
| 10565 | /* Check the list type. */ |
| 10566 | if (strncmp (argv[1], "p", 1) == 0) |
| 10567 | direct = COMMUNITY_PERMIT; |
| 10568 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10569 | direct = COMMUNITY_DENY; |
| 10570 | else |
| 10571 | { |
| 10572 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10573 | VTY_NEWLINE); |
| 10574 | return CMD_WARNING; |
| 10575 | } |
| 10576 | |
| 10577 | /* All digit name check. */ |
| 10578 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10579 | { |
| 10580 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10581 | return CMD_WARNING; |
| 10582 | } |
| 10583 | |
| 10584 | /* Concat community string argument. */ |
| 10585 | if (argc > 1) |
| 10586 | str = argv_concat (argv, argc, 2); |
| 10587 | else |
| 10588 | str = NULL; |
| 10589 | |
| 10590 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); |
| 10591 | |
| 10592 | /* Free temporary community list string allocated by |
| 10593 | argv_concat(). */ |
| 10594 | if (str) |
| 10595 | XFREE (MTYPE_TMP, str); |
| 10596 | |
| 10597 | if (ret < 0) |
| 10598 | { |
| 10599 | community_list_perror (vty, ret); |
| 10600 | return CMD_WARNING; |
| 10601 | } |
| 10602 | return CMD_SUCCESS; |
| 10603 | } |
| 10604 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10605 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10606 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10607 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10608 | { |
| 10609 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10610 | int direct = 0; |
| 10611 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10612 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10613 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10614 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10615 | /* Check the list direct. */ |
| 10616 | if (strncmp (argv[1], "p", 1) == 0) |
| 10617 | direct = COMMUNITY_PERMIT; |
| 10618 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10619 | direct = COMMUNITY_DENY; |
| 10620 | else |
| 10621 | { |
| 10622 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10623 | VTY_NEWLINE); |
| 10624 | return CMD_WARNING; |
| 10625 | } |
| 10626 | |
| 10627 | /* Concat community string argument. */ |
| 10628 | str = argv_concat (argv, argc, 2); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10629 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10630 | |
| 10631 | /* Unset community list. */ |
| 10632 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10633 | |
| 10634 | /* Free temporary community list string allocated by |
| 10635 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10636 | if (str) |
| 10637 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10638 | |
| 10639 | if (ret < 0) |
| 10640 | { |
| 10641 | community_list_perror (vty, ret); |
| 10642 | return CMD_WARNING; |
| 10643 | } |
| 10644 | |
| 10645 | return CMD_SUCCESS; |
| 10646 | } |
| 10647 | |
| 10648 | /* "extcommunity-list" keyword help string. */ |
| 10649 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" |
| 10650 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" |
| 10651 | |
| 10652 | DEFUN (ip_extcommunity_list_standard, |
| 10653 | ip_extcommunity_list_standard_cmd, |
| 10654 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10655 | IP_STR |
| 10656 | EXTCOMMUNITY_LIST_STR |
| 10657 | "Extended Community list number (standard)\n" |
| 10658 | "Specify community to reject\n" |
| 10659 | "Specify community to accept\n" |
| 10660 | EXTCOMMUNITY_VAL_STR) |
| 10661 | { |
| 10662 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
| 10663 | } |
| 10664 | |
| 10665 | ALIAS (ip_extcommunity_list_standard, |
| 10666 | ip_extcommunity_list_standard2_cmd, |
| 10667 | "ip extcommunity-list <1-99> (deny|permit)", |
| 10668 | IP_STR |
| 10669 | EXTCOMMUNITY_LIST_STR |
| 10670 | "Extended Community list number (standard)\n" |
| 10671 | "Specify community to reject\n" |
| 10672 | "Specify community to accept\n") |
| 10673 | |
| 10674 | DEFUN (ip_extcommunity_list_expanded, |
| 10675 | ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10676 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10677 | IP_STR |
| 10678 | EXTCOMMUNITY_LIST_STR |
| 10679 | "Extended Community list number (expanded)\n" |
| 10680 | "Specify community to reject\n" |
| 10681 | "Specify community to accept\n" |
| 10682 | "An ordered list as a regular-expression\n") |
| 10683 | { |
| 10684 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
| 10685 | } |
| 10686 | |
| 10687 | DEFUN (ip_extcommunity_list_name_standard, |
| 10688 | ip_extcommunity_list_name_standard_cmd, |
| 10689 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10690 | IP_STR |
| 10691 | EXTCOMMUNITY_LIST_STR |
| 10692 | "Specify standard extcommunity-list\n" |
| 10693 | "Extended Community list name\n" |
| 10694 | "Specify community to reject\n" |
| 10695 | "Specify community to accept\n" |
| 10696 | EXTCOMMUNITY_VAL_STR) |
| 10697 | { |
| 10698 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
| 10699 | } |
| 10700 | |
| 10701 | ALIAS (ip_extcommunity_list_name_standard, |
| 10702 | ip_extcommunity_list_name_standard2_cmd, |
| 10703 | "ip extcommunity-list standard WORD (deny|permit)", |
| 10704 | IP_STR |
| 10705 | EXTCOMMUNITY_LIST_STR |
| 10706 | "Specify standard extcommunity-list\n" |
| 10707 | "Extended Community list name\n" |
| 10708 | "Specify community to reject\n" |
| 10709 | "Specify community to accept\n") |
| 10710 | |
| 10711 | DEFUN (ip_extcommunity_list_name_expanded, |
| 10712 | ip_extcommunity_list_name_expanded_cmd, |
| 10713 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10714 | IP_STR |
| 10715 | EXTCOMMUNITY_LIST_STR |
| 10716 | "Specify expanded extcommunity-list\n" |
| 10717 | "Extended Community list name\n" |
| 10718 | "Specify community to reject\n" |
| 10719 | "Specify community to accept\n" |
| 10720 | "An ordered list as a regular-expression\n") |
| 10721 | { |
| 10722 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
| 10723 | } |
| 10724 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10725 | DEFUN (no_ip_extcommunity_list_standard_all, |
| 10726 | no_ip_extcommunity_list_standard_all_cmd, |
| 10727 | "no ip extcommunity-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10728 | NO_STR |
| 10729 | IP_STR |
| 10730 | EXTCOMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10731 | "Extended Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10732 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10733 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10734 | } |
| 10735 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10736 | DEFUN (no_ip_extcommunity_list_expanded_all, |
| 10737 | no_ip_extcommunity_list_expanded_all_cmd, |
| 10738 | "no ip extcommunity-list <100-500>", |
| 10739 | NO_STR |
| 10740 | IP_STR |
| 10741 | EXTCOMMUNITY_LIST_STR |
| 10742 | "Extended Community list number (expanded)\n") |
| 10743 | { |
| 10744 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10745 | } |
| 10746 | |
| 10747 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
| 10748 | no_ip_extcommunity_list_name_standard_all_cmd, |
| 10749 | "no ip extcommunity-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10750 | NO_STR |
| 10751 | IP_STR |
| 10752 | EXTCOMMUNITY_LIST_STR |
| 10753 | "Specify standard extcommunity-list\n" |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10754 | "Extended Community list name\n") |
| 10755 | { |
| 10756 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10757 | } |
| 10758 | |
| 10759 | DEFUN (no_ip_extcommunity_list_name_expanded_all, |
| 10760 | no_ip_extcommunity_list_name_expanded_all_cmd, |
| 10761 | "no ip extcommunity-list expanded WORD", |
| 10762 | NO_STR |
| 10763 | IP_STR |
| 10764 | EXTCOMMUNITY_LIST_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10765 | "Specify expanded extcommunity-list\n" |
| 10766 | "Extended Community list name\n") |
| 10767 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10768 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10769 | } |
| 10770 | |
| 10771 | DEFUN (no_ip_extcommunity_list_standard, |
| 10772 | no_ip_extcommunity_list_standard_cmd, |
| 10773 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10774 | NO_STR |
| 10775 | IP_STR |
| 10776 | EXTCOMMUNITY_LIST_STR |
| 10777 | "Extended Community list number (standard)\n" |
| 10778 | "Specify community to reject\n" |
| 10779 | "Specify community to accept\n" |
| 10780 | EXTCOMMUNITY_VAL_STR) |
| 10781 | { |
| 10782 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10783 | } |
| 10784 | |
| 10785 | DEFUN (no_ip_extcommunity_list_expanded, |
| 10786 | no_ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10787 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10788 | NO_STR |
| 10789 | IP_STR |
| 10790 | EXTCOMMUNITY_LIST_STR |
| 10791 | "Extended Community list number (expanded)\n" |
| 10792 | "Specify community to reject\n" |
| 10793 | "Specify community to accept\n" |
| 10794 | "An ordered list as a regular-expression\n") |
| 10795 | { |
| 10796 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10797 | } |
| 10798 | |
| 10799 | DEFUN (no_ip_extcommunity_list_name_standard, |
| 10800 | no_ip_extcommunity_list_name_standard_cmd, |
| 10801 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10802 | NO_STR |
| 10803 | IP_STR |
| 10804 | EXTCOMMUNITY_LIST_STR |
| 10805 | "Specify standard extcommunity-list\n" |
| 10806 | "Extended Community list name\n" |
| 10807 | "Specify community to reject\n" |
| 10808 | "Specify community to accept\n" |
| 10809 | EXTCOMMUNITY_VAL_STR) |
| 10810 | { |
| 10811 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10812 | } |
| 10813 | |
| 10814 | DEFUN (no_ip_extcommunity_list_name_expanded, |
| 10815 | no_ip_extcommunity_list_name_expanded_cmd, |
| 10816 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10817 | NO_STR |
| 10818 | IP_STR |
| 10819 | EXTCOMMUNITY_LIST_STR |
| 10820 | "Specify expanded extcommunity-list\n" |
| 10821 | "Community list name\n" |
| 10822 | "Specify community to reject\n" |
| 10823 | "Specify community to accept\n" |
| 10824 | "An ordered list as a regular-expression\n") |
| 10825 | { |
| 10826 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10827 | } |
| 10828 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10829 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10830 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
| 10831 | { |
| 10832 | struct community_entry *entry; |
| 10833 | |
| 10834 | for (entry = list->head; entry; entry = entry->next) |
| 10835 | { |
| 10836 | if (entry == list->head) |
| 10837 | { |
| 10838 | if (all_digit (list->name)) |
| 10839 | vty_out (vty, "Extended community %s list %s%s", |
| 10840 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10841 | "standard" : "(expanded) access", |
| 10842 | list->name, VTY_NEWLINE); |
| 10843 | else |
| 10844 | vty_out (vty, "Named extended community %s list %s%s", |
| 10845 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10846 | "standard" : "expanded", |
| 10847 | list->name, VTY_NEWLINE); |
| 10848 | } |
| 10849 | if (entry->any) |
| 10850 | vty_out (vty, " %s%s", |
| 10851 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10852 | else |
| 10853 | vty_out (vty, " %s %s%s", |
| 10854 | community_direct_str (entry->direct), |
| 10855 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10856 | entry->u.ecom->str : entry->config, |
| 10857 | VTY_NEWLINE); |
| 10858 | } |
| 10859 | } |
| 10860 | |
| 10861 | DEFUN (show_ip_extcommunity_list, |
| 10862 | show_ip_extcommunity_list_cmd, |
| 10863 | "show ip extcommunity-list", |
| 10864 | SHOW_STR |
| 10865 | IP_STR |
| 10866 | "List extended-community list\n") |
| 10867 | { |
| 10868 | struct community_list *list; |
| 10869 | struct community_list_master *cm; |
| 10870 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10871 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10872 | if (! cm) |
| 10873 | return CMD_SUCCESS; |
| 10874 | |
| 10875 | for (list = cm->num.head; list; list = list->next) |
| 10876 | extcommunity_list_show (vty, list); |
| 10877 | |
| 10878 | for (list = cm->str.head; list; list = list->next) |
| 10879 | extcommunity_list_show (vty, list); |
| 10880 | |
| 10881 | return CMD_SUCCESS; |
| 10882 | } |
| 10883 | |
| 10884 | DEFUN (show_ip_extcommunity_list_arg, |
| 10885 | show_ip_extcommunity_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10886 | "show ip extcommunity-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10887 | SHOW_STR |
| 10888 | IP_STR |
| 10889 | "List extended-community list\n" |
| 10890 | "Extcommunity-list number\n" |
| 10891 | "Extcommunity-list name\n") |
| 10892 | { |
| 10893 | struct community_list *list; |
| 10894 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10895 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10896 | if (! list) |
| 10897 | { |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10898 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10899 | return CMD_WARNING; |
| 10900 | } |
| 10901 | |
| 10902 | extcommunity_list_show (vty, list); |
| 10903 | |
| 10904 | return CMD_SUCCESS; |
| 10905 | } |
| 10906 | |
| 10907 | /* Return configuration string of community-list entry. */ |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10908 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10909 | community_list_config_str (struct community_entry *entry) |
| 10910 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10911 | const char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10912 | |
| 10913 | if (entry->any) |
| 10914 | str = ""; |
| 10915 | else |
| 10916 | { |
| 10917 | if (entry->style == COMMUNITY_LIST_STANDARD) |
| 10918 | str = community_str (entry->u.com); |
| 10919 | else |
| 10920 | str = entry->config; |
| 10921 | } |
| 10922 | return str; |
| 10923 | } |
| 10924 | |
| 10925 | /* Display community-list and extcommunity-list configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10926 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10927 | community_list_config_write (struct vty *vty) |
| 10928 | { |
| 10929 | struct community_list *list; |
| 10930 | struct community_entry *entry; |
| 10931 | struct community_list_master *cm; |
| 10932 | int write = 0; |
| 10933 | |
| 10934 | /* Community-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10935 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10936 | |
| 10937 | for (list = cm->num.head; list; list = list->next) |
| 10938 | for (entry = list->head; entry; entry = entry->next) |
| 10939 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10940 | vty_out (vty, "ip community-list %s %s %s%s", |
| 10941 | list->name, community_direct_str (entry->direct), |
| 10942 | community_list_config_str (entry), |
| 10943 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10944 | write++; |
| 10945 | } |
| 10946 | for (list = cm->str.head; list; list = list->next) |
| 10947 | for (entry = list->head; entry; entry = entry->next) |
| 10948 | { |
| 10949 | vty_out (vty, "ip community-list %s %s %s %s%s", |
| 10950 | entry->style == COMMUNITY_LIST_STANDARD |
| 10951 | ? "standard" : "expanded", |
| 10952 | list->name, community_direct_str (entry->direct), |
| 10953 | community_list_config_str (entry), |
| 10954 | VTY_NEWLINE); |
| 10955 | write++; |
| 10956 | } |
| 10957 | |
| 10958 | /* Extcommunity-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10959 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10960 | |
| 10961 | for (list = cm->num.head; list; list = list->next) |
| 10962 | for (entry = list->head; entry; entry = entry->next) |
| 10963 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10964 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
| 10965 | list->name, community_direct_str (entry->direct), |
| 10966 | community_list_config_str (entry), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10967 | write++; |
| 10968 | } |
| 10969 | for (list = cm->str.head; list; list = list->next) |
| 10970 | for (entry = list->head; entry; entry = entry->next) |
| 10971 | { |
| 10972 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", |
| 10973 | entry->style == EXTCOMMUNITY_LIST_STANDARD |
| 10974 | ? "standard" : "expanded", |
| 10975 | list->name, community_direct_str (entry->direct), |
| 10976 | community_list_config_str (entry), VTY_NEWLINE); |
| 10977 | write++; |
| 10978 | } |
| 10979 | return write; |
| 10980 | } |
| 10981 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 10982 | static struct cmd_node community_list_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10983 | { |
| 10984 | COMMUNITY_LIST_NODE, |
| 10985 | "", |
| 10986 | 1 /* Export to vtysh. */ |
| 10987 | }; |
| 10988 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10989 | static void |
| 10990 | community_list_vty (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10991 | { |
| 10992 | install_node (&community_list_node, community_list_config_write); |
| 10993 | |
| 10994 | /* Community-list. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10995 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
| 10996 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); |
| 10997 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); |
| 10998 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); |
| 10999 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); |
| 11000 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11001 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
| 11002 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
| 11003 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); |
| 11004 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11005 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
| 11006 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); |
| 11007 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); |
| 11008 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
| 11009 | install_element (VIEW_NODE, &show_ip_community_list_cmd); |
| 11010 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); |
| 11011 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); |
| 11012 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); |
| 11013 | |
| 11014 | /* Extcommunity-list. */ |
| 11015 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); |
| 11016 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); |
| 11017 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); |
| 11018 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); |
| 11019 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); |
| 11020 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11021 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
| 11022 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
| 11023 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); |
| 11024 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11025 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
| 11026 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); |
| 11027 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); |
| 11028 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
| 11029 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); |
| 11030 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 11031 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); |
| 11032 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 11033 | } |