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" |
Donald Sharp | 0490729 | 2016-01-07 10:03:01 -0500 | [diff] [blame] | 33 | #include "filter.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 34 | |
| 35 | #include "bgpd/bgpd.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 36 | #include "bgpd/bgp_advertise.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 37 | #include "bgpd/bgp_attr.h" |
| 38 | #include "bgpd/bgp_aspath.h" |
| 39 | #include "bgpd/bgp_community.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 40 | #include "bgpd/bgp_ecommunity.h" |
| 41 | #include "bgpd/bgp_damp.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 42 | #include "bgpd/bgp_debug.h" |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 43 | #include "bgpd/bgp_fsm.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 44 | #include "bgpd/bgp_mplsvpn.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 45 | #include "bgpd/bgp_nexthop.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 46 | #include "bgpd/bgp_open.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 47 | #include "bgpd/bgp_regex.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 48 | #include "bgpd/bgp_route.h" |
| 49 | #include "bgpd/bgp_zebra.h" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 50 | #include "bgpd/bgp_table.h" |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 51 | #include "bgpd/bgp_vty.h" |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 52 | #include "bgpd/bgp_mpath.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 53 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 54 | extern struct in_addr router_id_zebra; |
| 55 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 56 | /* Utility function to get address family from current node. */ |
| 57 | afi_t |
| 58 | bgp_node_afi (struct vty *vty) |
| 59 | { |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 60 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 61 | return AFI_IP6; |
| 62 | return AFI_IP; |
| 63 | } |
| 64 | |
| 65 | /* Utility function to get subsequent address family from current |
| 66 | node. */ |
| 67 | safi_t |
| 68 | bgp_node_safi (struct vty *vty) |
| 69 | { |
| 70 | if (vty->node == BGP_VPNV4_NODE) |
| 71 | return SAFI_MPLS_VPN; |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 72 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 73 | return SAFI_MULTICAST; |
| 74 | return SAFI_UNICAST; |
| 75 | } |
| 76 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 77 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 78 | peer_address_self_check (union sockunion *su) |
| 79 | { |
| 80 | struct interface *ifp = NULL; |
| 81 | |
| 82 | if (su->sa.sa_family == AF_INET) |
| 83 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); |
| 84 | #ifdef HAVE_IPV6 |
| 85 | else if (su->sa.sa_family == AF_INET6) |
| 86 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); |
| 87 | #endif /* HAVE IPV6 */ |
| 88 | |
| 89 | if (ifp) |
| 90 | return 1; |
| 91 | |
| 92 | return 0; |
| 93 | } |
| 94 | |
| 95 | /* Utility function for looking up peer from VTY. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 96 | static struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 97 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 98 | { |
| 99 | int ret; |
| 100 | struct bgp *bgp; |
| 101 | union sockunion su; |
| 102 | struct peer *peer; |
| 103 | |
| 104 | bgp = vty->index; |
| 105 | |
| 106 | ret = str2sockunion (ip_str, &su); |
| 107 | if (ret < 0) |
| 108 | { |
| 109 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 110 | return NULL; |
| 111 | } |
| 112 | |
| 113 | peer = peer_lookup (bgp, &su); |
| 114 | if (! peer) |
| 115 | { |
| 116 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE); |
| 117 | return NULL; |
| 118 | } |
| 119 | return peer; |
| 120 | } |
| 121 | |
| 122 | /* Utility function for looking up peer or peer group. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 123 | static struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 124 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 125 | { |
| 126 | int ret; |
| 127 | struct bgp *bgp; |
| 128 | union sockunion su; |
| 129 | struct peer *peer; |
| 130 | struct peer_group *group; |
| 131 | |
| 132 | bgp = vty->index; |
| 133 | |
| 134 | ret = str2sockunion (peer_str, &su); |
| 135 | if (ret == 0) |
| 136 | { |
| 137 | peer = peer_lookup (bgp, &su); |
| 138 | if (peer) |
| 139 | return peer; |
| 140 | } |
| 141 | else |
| 142 | { |
| 143 | group = peer_group_lookup (bgp, peer_str); |
| 144 | if (group) |
| 145 | return group->conf; |
| 146 | } |
| 147 | |
| 148 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
| 149 | VTY_NEWLINE); |
| 150 | |
| 151 | return NULL; |
| 152 | } |
| 153 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 154 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 155 | bgp_vty_return (struct vty *vty, int ret) |
| 156 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 157 | const char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 158 | |
| 159 | switch (ret) |
| 160 | { |
| 161 | case BGP_ERR_INVALID_VALUE: |
| 162 | str = "Invalid value"; |
| 163 | break; |
| 164 | case BGP_ERR_INVALID_FLAG: |
| 165 | str = "Invalid flag"; |
| 166 | break; |
| 167 | case BGP_ERR_PEER_INACTIVE: |
| 168 | str = "Activate the neighbor for the address family first"; |
| 169 | break; |
| 170 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: |
| 171 | str = "Invalid command for a peer-group member"; |
| 172 | break; |
| 173 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
| 174 | str = "Peer-group has been shutdown. Activate the peer-group first"; |
| 175 | break; |
| 176 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: |
| 177 | str = "This peer is a peer-group member. Please change peer-group configuration"; |
| 178 | break; |
| 179 | case BGP_ERR_PEER_FLAG_CONFLICT: |
| 180 | str = "Can't set override-capability and strict-capability-match at the same time"; |
| 181 | break; |
| 182 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: |
| 183 | str = "No activate for peergroup can be given only if peer-group has no members"; |
| 184 | break; |
| 185 | case BGP_ERR_PEER_BELONGS_TO_GROUP: |
| 186 | str = "No activate for an individual peer-group member is invalid"; |
| 187 | break; |
| 188 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: |
| 189 | str = "Activate the peer-group for the address family first"; |
| 190 | break; |
| 191 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
| 192 | str = "Specify remote-as or peer-group remote AS first"; |
| 193 | break; |
| 194 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: |
| 195 | str = "Cannot change the peer-group. Deconfigure first"; |
| 196 | break; |
| 197 | case BGP_ERR_PEER_GROUP_MISMATCH: |
| 198 | str = "Cannot have different peer-group for the neighbor"; |
| 199 | break; |
| 200 | case BGP_ERR_PEER_FILTER_CONFLICT: |
| 201 | str = "Prefix/distribute list can not co-exist"; |
| 202 | break; |
| 203 | case BGP_ERR_NOT_INTERNAL_PEER: |
| 204 | str = "Invalid command. Not an internal neighbor"; |
| 205 | break; |
| 206 | case BGP_ERR_REMOVE_PRIVATE_AS: |
| 207 | str = "Private AS cannot be removed for IBGP peers"; |
| 208 | break; |
| 209 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: |
| 210 | str = "Local-AS allowed only for EBGP peers"; |
| 211 | break; |
| 212 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: |
| 213 | str = "Cannot have local-as same as BGP AS number"; |
| 214 | break; |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 215 | case BGP_ERR_TCPSIG_FAILED: |
| 216 | str = "Error while applying TCP-Sig to session(s)"; |
| 217 | break; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 218 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
| 219 | str = "ebgp-multihop and ttl-security cannot be configured together"; |
| 220 | break; |
Stephen Hemminger | f5a4827 | 2011-03-24 17:30:21 +0000 | [diff] [blame] | 221 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
| 222 | str = "ttl-security only allowed for EBGP peers"; |
| 223 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 224 | } |
| 225 | if (str) |
| 226 | { |
| 227 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); |
| 228 | return CMD_WARNING; |
| 229 | } |
| 230 | return CMD_SUCCESS; |
| 231 | } |
| 232 | |
| 233 | /* BGP global configuration. */ |
| 234 | |
| 235 | DEFUN (bgp_multiple_instance_func, |
| 236 | bgp_multiple_instance_cmd, |
| 237 | "bgp multiple-instance", |
| 238 | BGP_STR |
| 239 | "Enable bgp multiple instance\n") |
| 240 | { |
| 241 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); |
| 242 | return CMD_SUCCESS; |
| 243 | } |
| 244 | |
| 245 | DEFUN (no_bgp_multiple_instance, |
| 246 | no_bgp_multiple_instance_cmd, |
| 247 | "no bgp multiple-instance", |
| 248 | NO_STR |
| 249 | BGP_STR |
| 250 | "BGP multiple instance\n") |
| 251 | { |
| 252 | int ret; |
| 253 | |
| 254 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); |
| 255 | if (ret < 0) |
| 256 | { |
| 257 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); |
| 258 | return CMD_WARNING; |
| 259 | } |
| 260 | return CMD_SUCCESS; |
| 261 | } |
| 262 | |
| 263 | DEFUN (bgp_config_type, |
| 264 | bgp_config_type_cmd, |
| 265 | "bgp config-type (cisco|zebra)", |
| 266 | BGP_STR |
| 267 | "Configuration type\n" |
| 268 | "cisco\n" |
| 269 | "zebra\n") |
| 270 | { |
| 271 | if (strncmp (argv[0], "c", 1) == 0) |
| 272 | bgp_option_set (BGP_OPT_CONFIG_CISCO); |
| 273 | else |
| 274 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 275 | |
| 276 | return CMD_SUCCESS; |
| 277 | } |
| 278 | |
| 279 | DEFUN (no_bgp_config_type, |
| 280 | no_bgp_config_type_cmd, |
| 281 | "no bgp config-type", |
| 282 | NO_STR |
| 283 | BGP_STR |
| 284 | "Display configuration type\n") |
| 285 | { |
| 286 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 287 | return CMD_SUCCESS; |
| 288 | } |
| 289 | |
| 290 | DEFUN (no_synchronization, |
| 291 | no_synchronization_cmd, |
| 292 | "no synchronization", |
| 293 | NO_STR |
| 294 | "Perform IGP synchronization\n") |
| 295 | { |
| 296 | return CMD_SUCCESS; |
| 297 | } |
| 298 | |
| 299 | DEFUN (no_auto_summary, |
| 300 | no_auto_summary_cmd, |
| 301 | "no auto-summary", |
| 302 | NO_STR |
| 303 | "Enable automatic network number summarization\n") |
| 304 | { |
| 305 | return CMD_SUCCESS; |
| 306 | } |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 307 | |
| 308 | DEFUN_DEPRECATED (neighbor_version, |
| 309 | neighbor_version_cmd, |
| 310 | NEIGHBOR_CMD "version (4|4-)", |
| 311 | NEIGHBOR_STR |
| 312 | NEIGHBOR_ADDR_STR |
| 313 | "Set the BGP version to match a neighbor\n" |
| 314 | "Neighbor's BGP version\n") |
| 315 | { |
| 316 | return CMD_SUCCESS; |
| 317 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 318 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 319 | /* "router bgp" commands. */ |
| 320 | DEFUN (router_bgp, |
| 321 | router_bgp_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 322 | "router bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 323 | ROUTER_STR |
| 324 | BGP_STR |
| 325 | AS_STR) |
| 326 | { |
| 327 | int ret; |
| 328 | as_t as; |
| 329 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 330 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 331 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 332 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 333 | |
| 334 | if (argc == 2) |
| 335 | name = argv[1]; |
| 336 | |
| 337 | ret = bgp_get (&bgp, &as, name); |
| 338 | switch (ret) |
| 339 | { |
| 340 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: |
| 341 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", |
| 342 | VTY_NEWLINE); |
| 343 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 344 | case BGP_ERR_AS_MISMATCH: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 345 | 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] | 346 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 347 | case BGP_ERR_INSTANCE_MISMATCH: |
| 348 | 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] | 349 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 350 | as, VTY_NEWLINE); |
| 351 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 352 | } |
| 353 | |
| 354 | vty->node = BGP_NODE; |
| 355 | vty->index = bgp; |
| 356 | |
| 357 | return CMD_SUCCESS; |
| 358 | } |
| 359 | |
| 360 | ALIAS (router_bgp, |
| 361 | router_bgp_view_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 362 | "router bgp " CMD_AS_RANGE " view WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 363 | ROUTER_STR |
| 364 | BGP_STR |
| 365 | AS_STR |
| 366 | "BGP view\n" |
| 367 | "view name\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 368 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 369 | /* "no router bgp" commands. */ |
| 370 | DEFUN (no_router_bgp, |
| 371 | no_router_bgp_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 372 | "no router bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 373 | NO_STR |
| 374 | ROUTER_STR |
| 375 | BGP_STR |
| 376 | AS_STR) |
| 377 | { |
| 378 | as_t as; |
| 379 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 380 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 381 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 382 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 383 | |
| 384 | if (argc == 2) |
| 385 | name = argv[1]; |
| 386 | |
| 387 | /* Lookup bgp structure. */ |
| 388 | bgp = bgp_lookup (as, name); |
| 389 | if (! bgp) |
| 390 | { |
| 391 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); |
| 392 | return CMD_WARNING; |
| 393 | } |
| 394 | |
| 395 | bgp_delete (bgp); |
| 396 | |
| 397 | return CMD_SUCCESS; |
| 398 | } |
| 399 | |
| 400 | ALIAS (no_router_bgp, |
| 401 | no_router_bgp_view_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 402 | "no router bgp " CMD_AS_RANGE " view WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 403 | NO_STR |
| 404 | ROUTER_STR |
| 405 | BGP_STR |
| 406 | AS_STR |
| 407 | "BGP view\n" |
| 408 | "view name\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 409 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 410 | /* BGP router-id. */ |
| 411 | |
| 412 | DEFUN (bgp_router_id, |
| 413 | bgp_router_id_cmd, |
| 414 | "bgp router-id A.B.C.D", |
| 415 | BGP_STR |
| 416 | "Override configured router identifier\n" |
| 417 | "Manually configured router identifier\n") |
| 418 | { |
| 419 | int ret; |
| 420 | struct in_addr id; |
| 421 | struct bgp *bgp; |
| 422 | |
| 423 | bgp = vty->index; |
| 424 | |
| 425 | ret = inet_aton (argv[0], &id); |
| 426 | if (! ret) |
| 427 | { |
| 428 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); |
| 429 | return CMD_WARNING; |
| 430 | } |
| 431 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 432 | bgp->router_id_static = id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 433 | bgp_router_id_set (bgp, &id); |
| 434 | |
| 435 | return CMD_SUCCESS; |
| 436 | } |
| 437 | |
| 438 | DEFUN (no_bgp_router_id, |
| 439 | no_bgp_router_id_cmd, |
| 440 | "no bgp router-id", |
| 441 | NO_STR |
| 442 | BGP_STR |
| 443 | "Override configured router identifier\n") |
| 444 | { |
| 445 | int ret; |
| 446 | struct in_addr id; |
| 447 | struct bgp *bgp; |
| 448 | |
| 449 | bgp = vty->index; |
| 450 | |
| 451 | if (argc == 1) |
| 452 | { |
| 453 | ret = inet_aton (argv[0], &id); |
| 454 | if (! ret) |
| 455 | { |
| 456 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); |
| 457 | return CMD_WARNING; |
| 458 | } |
| 459 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 460 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 461 | { |
| 462 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); |
| 463 | return CMD_WARNING; |
| 464 | } |
| 465 | } |
| 466 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 467 | bgp->router_id_static.s_addr = 0; |
| 468 | bgp_router_id_set (bgp, &router_id_zebra); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 469 | |
| 470 | return CMD_SUCCESS; |
| 471 | } |
| 472 | |
| 473 | ALIAS (no_bgp_router_id, |
| 474 | no_bgp_router_id_val_cmd, |
| 475 | "no bgp router-id A.B.C.D", |
| 476 | NO_STR |
| 477 | BGP_STR |
| 478 | "Override configured router identifier\n" |
| 479 | "Manually configured router identifier\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 480 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 481 | /* BGP Cluster ID. */ |
| 482 | |
| 483 | DEFUN (bgp_cluster_id, |
| 484 | bgp_cluster_id_cmd, |
| 485 | "bgp cluster-id A.B.C.D", |
| 486 | BGP_STR |
| 487 | "Configure Route-Reflector Cluster-id\n" |
| 488 | "Route-Reflector Cluster-id in IP address format\n") |
| 489 | { |
| 490 | int ret; |
| 491 | struct bgp *bgp; |
| 492 | struct in_addr cluster; |
| 493 | |
| 494 | bgp = vty->index; |
| 495 | |
| 496 | ret = inet_aton (argv[0], &cluster); |
| 497 | if (! ret) |
| 498 | { |
| 499 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 500 | return CMD_WARNING; |
| 501 | } |
| 502 | |
| 503 | bgp_cluster_id_set (bgp, &cluster); |
| 504 | |
| 505 | return CMD_SUCCESS; |
| 506 | } |
| 507 | |
| 508 | ALIAS (bgp_cluster_id, |
| 509 | bgp_cluster_id32_cmd, |
| 510 | "bgp cluster-id <1-4294967295>", |
| 511 | BGP_STR |
| 512 | "Configure Route-Reflector Cluster-id\n" |
| 513 | "Route-Reflector Cluster-id as 32 bit quantity\n") |
| 514 | |
| 515 | DEFUN (no_bgp_cluster_id, |
| 516 | no_bgp_cluster_id_cmd, |
| 517 | "no bgp cluster-id", |
| 518 | NO_STR |
| 519 | BGP_STR |
| 520 | "Configure Route-Reflector Cluster-id\n") |
| 521 | { |
| 522 | int ret; |
| 523 | struct bgp *bgp; |
| 524 | struct in_addr cluster; |
| 525 | |
| 526 | bgp = vty->index; |
| 527 | |
| 528 | if (argc == 1) |
| 529 | { |
| 530 | ret = inet_aton (argv[0], &cluster); |
| 531 | if (! ret) |
| 532 | { |
| 533 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 534 | return CMD_WARNING; |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | bgp_cluster_id_unset (bgp); |
| 539 | |
| 540 | return CMD_SUCCESS; |
| 541 | } |
| 542 | |
| 543 | ALIAS (no_bgp_cluster_id, |
| 544 | no_bgp_cluster_id_arg_cmd, |
| 545 | "no bgp cluster-id A.B.C.D", |
| 546 | NO_STR |
| 547 | BGP_STR |
| 548 | "Configure Route-Reflector Cluster-id\n" |
| 549 | "Route-Reflector Cluster-id in IP address format\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 550 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 551 | DEFUN (bgp_confederation_identifier, |
| 552 | bgp_confederation_identifier_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 553 | "bgp confederation identifier " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 554 | "BGP specific commands\n" |
| 555 | "AS confederation parameters\n" |
| 556 | "AS number\n" |
| 557 | "Set routing domain confederation AS\n") |
| 558 | { |
| 559 | struct bgp *bgp; |
| 560 | as_t as; |
| 561 | |
| 562 | bgp = vty->index; |
| 563 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 564 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 565 | |
| 566 | bgp_confederation_id_set (bgp, as); |
| 567 | |
| 568 | return CMD_SUCCESS; |
| 569 | } |
| 570 | |
| 571 | DEFUN (no_bgp_confederation_identifier, |
| 572 | no_bgp_confederation_identifier_cmd, |
| 573 | "no bgp confederation identifier", |
| 574 | NO_STR |
| 575 | "BGP specific commands\n" |
| 576 | "AS confederation parameters\n" |
| 577 | "AS number\n") |
| 578 | { |
| 579 | struct bgp *bgp; |
Paul Jakma | 7aa9dce | 2014-09-19 14:42:23 +0100 | [diff] [blame] | 580 | as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 581 | |
| 582 | bgp = vty->index; |
| 583 | |
| 584 | if (argc == 1) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 585 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 586 | |
| 587 | bgp_confederation_id_unset (bgp); |
| 588 | |
| 589 | return CMD_SUCCESS; |
| 590 | } |
| 591 | |
| 592 | ALIAS (no_bgp_confederation_identifier, |
| 593 | no_bgp_confederation_identifier_arg_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 594 | "no bgp confederation identifier " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 595 | NO_STR |
| 596 | "BGP specific commands\n" |
| 597 | "AS confederation parameters\n" |
| 598 | "AS number\n" |
| 599 | "Set routing domain confederation AS\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 600 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 601 | DEFUN (bgp_confederation_peers, |
| 602 | bgp_confederation_peers_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 603 | "bgp confederation peers ." CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 604 | "BGP specific commands\n" |
| 605 | "AS confederation parameters\n" |
| 606 | "Peer ASs in BGP confederation\n" |
| 607 | AS_STR) |
| 608 | { |
| 609 | struct bgp *bgp; |
| 610 | as_t as; |
| 611 | int i; |
| 612 | |
| 613 | bgp = vty->index; |
| 614 | |
| 615 | for (i = 0; i < argc; i++) |
| 616 | { |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 617 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 618 | |
| 619 | if (bgp->as == as) |
| 620 | { |
| 621 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", |
| 622 | VTY_NEWLINE); |
| 623 | continue; |
| 624 | } |
| 625 | |
| 626 | bgp_confederation_peers_add (bgp, as); |
| 627 | } |
| 628 | return CMD_SUCCESS; |
| 629 | } |
| 630 | |
| 631 | DEFUN (no_bgp_confederation_peers, |
| 632 | no_bgp_confederation_peers_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 633 | "no bgp confederation peers ." CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 634 | NO_STR |
| 635 | "BGP specific commands\n" |
| 636 | "AS confederation parameters\n" |
| 637 | "Peer ASs in BGP confederation\n" |
| 638 | AS_STR) |
| 639 | { |
| 640 | struct bgp *bgp; |
| 641 | as_t as; |
| 642 | int i; |
| 643 | |
| 644 | bgp = vty->index; |
| 645 | |
| 646 | for (i = 0; i < argc; i++) |
| 647 | { |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 648 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
| 649 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 650 | bgp_confederation_peers_remove (bgp, as); |
| 651 | } |
| 652 | return CMD_SUCCESS; |
| 653 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 654 | |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 655 | /* Maximum-paths configuration */ |
| 656 | DEFUN (bgp_maxpaths, |
| 657 | bgp_maxpaths_cmd, |
| 658 | "maximum-paths <1-255>", |
| 659 | "Forward packets over multiple paths\n" |
| 660 | "Number of paths\n") |
| 661 | { |
| 662 | struct bgp *bgp; |
| 663 | u_int16_t maxpaths; |
| 664 | int ret; |
| 665 | |
| 666 | bgp = vty->index; |
| 667 | |
| 668 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255); |
| 669 | |
| 670 | ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 671 | BGP_PEER_EBGP, maxpaths); |
| 672 | if (ret < 0) |
| 673 | { |
| 674 | vty_out (vty, |
| 675 | "%% Failed to set maximum-paths %u for afi %u, safi %u%s", |
| 676 | maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 677 | return CMD_WARNING; |
| 678 | } |
| 679 | |
Donald Sharp | 58a83f2 | 2015-09-11 10:11:42 -0400 | [diff] [blame] | 680 | if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM)) |
| 681 | vty_out (vty, |
| 682 | "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s", |
| 683 | maxpaths, MULTIPATH_NUM, VTY_NEWLINE); |
| 684 | |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 685 | return CMD_SUCCESS; |
| 686 | } |
| 687 | |
| 688 | DEFUN (bgp_maxpaths_ibgp, |
| 689 | bgp_maxpaths_ibgp_cmd, |
| 690 | "maximum-paths ibgp <1-255>", |
| 691 | "Forward packets over multiple paths\n" |
| 692 | "iBGP-multipath\n" |
| 693 | "Number of paths\n") |
| 694 | { |
| 695 | struct bgp *bgp; |
| 696 | u_int16_t maxpaths; |
| 697 | int ret; |
| 698 | |
| 699 | bgp = vty->index; |
| 700 | |
| 701 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255); |
| 702 | |
| 703 | ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 704 | BGP_PEER_IBGP, maxpaths); |
| 705 | if (ret < 0) |
| 706 | { |
| 707 | vty_out (vty, |
| 708 | "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s", |
| 709 | maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 710 | return CMD_WARNING; |
| 711 | } |
| 712 | |
Donald Sharp | 58a83f2 | 2015-09-11 10:11:42 -0400 | [diff] [blame] | 713 | if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM)) |
| 714 | vty_out (vty, |
| 715 | "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s", |
| 716 | maxpaths, MULTIPATH_NUM, VTY_NEWLINE); |
| 717 | |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 718 | return CMD_SUCCESS; |
| 719 | } |
| 720 | |
| 721 | DEFUN (no_bgp_maxpaths, |
| 722 | no_bgp_maxpaths_cmd, |
| 723 | "no maximum-paths", |
| 724 | NO_STR |
| 725 | "Forward packets over multiple paths\n" |
| 726 | "Number of paths\n") |
| 727 | { |
| 728 | struct bgp *bgp; |
| 729 | int ret; |
| 730 | |
| 731 | bgp = vty->index; |
| 732 | |
| 733 | ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 734 | BGP_PEER_EBGP); |
| 735 | if (ret < 0) |
| 736 | { |
| 737 | vty_out (vty, |
| 738 | "%% Failed to unset maximum-paths for afi %u, safi %u%s", |
| 739 | bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 740 | return CMD_WARNING; |
| 741 | } |
| 742 | |
| 743 | return CMD_SUCCESS; |
| 744 | } |
| 745 | |
| 746 | ALIAS (no_bgp_maxpaths, |
| 747 | no_bgp_maxpaths_arg_cmd, |
| 748 | "no maximum-paths <1-255>", |
| 749 | NO_STR |
| 750 | "Forward packets over multiple paths\n" |
| 751 | "Number of paths\n") |
| 752 | |
| 753 | DEFUN (no_bgp_maxpaths_ibgp, |
| 754 | no_bgp_maxpaths_ibgp_cmd, |
| 755 | "no maximum-paths ibgp", |
| 756 | NO_STR |
| 757 | "Forward packets over multiple paths\n" |
| 758 | "iBGP-multipath\n" |
| 759 | "Number of paths\n") |
| 760 | { |
| 761 | struct bgp *bgp; |
| 762 | int ret; |
| 763 | |
| 764 | bgp = vty->index; |
| 765 | |
| 766 | ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 767 | BGP_PEER_IBGP); |
| 768 | if (ret < 0) |
| 769 | { |
| 770 | vty_out (vty, |
| 771 | "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s", |
| 772 | bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 773 | return CMD_WARNING; |
| 774 | } |
| 775 | |
| 776 | return CMD_SUCCESS; |
| 777 | } |
| 778 | |
| 779 | ALIAS (no_bgp_maxpaths_ibgp, |
| 780 | no_bgp_maxpaths_ibgp_arg_cmd, |
| 781 | "no maximum-paths ibgp <1-255>", |
| 782 | NO_STR |
| 783 | "Forward packets over multiple paths\n" |
| 784 | "iBGP-multipath\n" |
| 785 | "Number of paths\n") |
| 786 | |
| 787 | int |
| 788 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 789 | safi_t safi, int *write) |
| 790 | { |
| 791 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS) |
| 792 | { |
| 793 | bgp_config_write_family_header (vty, afi, safi, write); |
| 794 | vty_out (vty, " maximum-paths %d%s", |
| 795 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); |
| 796 | } |
| 797 | |
| 798 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS) |
| 799 | { |
| 800 | bgp_config_write_family_header (vty, afi, safi, write); |
| 801 | vty_out (vty, " maximum-paths ibgp %d%s", |
| 802 | bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE); |
| 803 | } |
| 804 | |
| 805 | return 0; |
| 806 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 807 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 808 | /* BGP timers. */ |
| 809 | |
| 810 | DEFUN (bgp_timers, |
| 811 | bgp_timers_cmd, |
| 812 | "timers bgp <0-65535> <0-65535>", |
| 813 | "Adjust routing timers\n" |
| 814 | "BGP timers\n" |
| 815 | "Keepalive interval\n" |
| 816 | "Holdtime\n") |
| 817 | { |
| 818 | struct bgp *bgp; |
| 819 | unsigned long keepalive = 0; |
| 820 | unsigned long holdtime = 0; |
| 821 | |
| 822 | bgp = vty->index; |
| 823 | |
| 824 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); |
| 825 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); |
| 826 | |
| 827 | /* Holdtime value check. */ |
| 828 | if (holdtime < 3 && holdtime != 0) |
| 829 | { |
| 830 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", |
| 831 | VTY_NEWLINE); |
| 832 | return CMD_WARNING; |
| 833 | } |
| 834 | |
| 835 | bgp_timers_set (bgp, keepalive, holdtime); |
| 836 | |
| 837 | return CMD_SUCCESS; |
| 838 | } |
| 839 | |
| 840 | DEFUN (no_bgp_timers, |
| 841 | no_bgp_timers_cmd, |
| 842 | "no timers bgp", |
| 843 | NO_STR |
| 844 | "Adjust routing timers\n" |
| 845 | "BGP timers\n") |
| 846 | { |
| 847 | struct bgp *bgp; |
| 848 | |
| 849 | bgp = vty->index; |
| 850 | bgp_timers_unset (bgp); |
| 851 | |
| 852 | return CMD_SUCCESS; |
| 853 | } |
| 854 | |
| 855 | ALIAS (no_bgp_timers, |
| 856 | no_bgp_timers_arg_cmd, |
| 857 | "no timers bgp <0-65535> <0-65535>", |
| 858 | NO_STR |
| 859 | "Adjust routing timers\n" |
| 860 | "BGP timers\n" |
| 861 | "Keepalive interval\n" |
| 862 | "Holdtime\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 863 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 864 | DEFUN (bgp_client_to_client_reflection, |
| 865 | bgp_client_to_client_reflection_cmd, |
| 866 | "bgp client-to-client reflection", |
| 867 | "BGP specific commands\n" |
| 868 | "Configure client to client route reflection\n" |
| 869 | "reflection of routes allowed\n") |
| 870 | { |
| 871 | struct bgp *bgp; |
| 872 | |
| 873 | bgp = vty->index; |
| 874 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 875 | return CMD_SUCCESS; |
| 876 | } |
| 877 | |
| 878 | DEFUN (no_bgp_client_to_client_reflection, |
| 879 | no_bgp_client_to_client_reflection_cmd, |
| 880 | "no bgp client-to-client reflection", |
| 881 | NO_STR |
| 882 | "BGP specific commands\n" |
| 883 | "Configure client to client route reflection\n" |
| 884 | "reflection of routes allowed\n") |
| 885 | { |
| 886 | struct bgp *bgp; |
| 887 | |
| 888 | bgp = vty->index; |
| 889 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 890 | return CMD_SUCCESS; |
| 891 | } |
| 892 | |
| 893 | /* "bgp always-compare-med" configuration. */ |
| 894 | DEFUN (bgp_always_compare_med, |
| 895 | bgp_always_compare_med_cmd, |
| 896 | "bgp always-compare-med", |
| 897 | "BGP specific commands\n" |
| 898 | "Allow comparing MED from different neighbors\n") |
| 899 | { |
| 900 | struct bgp *bgp; |
| 901 | |
| 902 | bgp = vty->index; |
| 903 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 904 | return CMD_SUCCESS; |
| 905 | } |
| 906 | |
| 907 | DEFUN (no_bgp_always_compare_med, |
| 908 | no_bgp_always_compare_med_cmd, |
| 909 | "no bgp always-compare-med", |
| 910 | NO_STR |
| 911 | "BGP specific commands\n" |
| 912 | "Allow comparing MED from different neighbors\n") |
| 913 | { |
| 914 | struct bgp *bgp; |
| 915 | |
| 916 | bgp = vty->index; |
| 917 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 918 | return CMD_SUCCESS; |
| 919 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 920 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 921 | /* "bgp deterministic-med" configuration. */ |
| 922 | DEFUN (bgp_deterministic_med, |
| 923 | bgp_deterministic_med_cmd, |
| 924 | "bgp deterministic-med", |
| 925 | "BGP specific commands\n" |
| 926 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 927 | { |
| 928 | struct bgp *bgp; |
| 929 | |
| 930 | bgp = vty->index; |
| 931 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 932 | return CMD_SUCCESS; |
| 933 | } |
| 934 | |
| 935 | DEFUN (no_bgp_deterministic_med, |
| 936 | no_bgp_deterministic_med_cmd, |
| 937 | "no bgp deterministic-med", |
| 938 | NO_STR |
| 939 | "BGP specific commands\n" |
| 940 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 941 | { |
| 942 | struct bgp *bgp; |
| 943 | |
| 944 | bgp = vty->index; |
| 945 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 946 | return CMD_SUCCESS; |
| 947 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 948 | |
| 949 | /* "bgp graceful-restart" configuration. */ |
| 950 | DEFUN (bgp_graceful_restart, |
| 951 | bgp_graceful_restart_cmd, |
| 952 | "bgp graceful-restart", |
| 953 | "BGP specific commands\n" |
| 954 | "Graceful restart capability parameters\n") |
| 955 | { |
| 956 | struct bgp *bgp; |
| 957 | |
| 958 | bgp = vty->index; |
| 959 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 960 | return CMD_SUCCESS; |
| 961 | } |
| 962 | |
| 963 | DEFUN (no_bgp_graceful_restart, |
| 964 | no_bgp_graceful_restart_cmd, |
| 965 | "no bgp graceful-restart", |
| 966 | NO_STR |
| 967 | "BGP specific commands\n" |
| 968 | "Graceful restart capability parameters\n") |
| 969 | { |
| 970 | struct bgp *bgp; |
| 971 | |
| 972 | bgp = vty->index; |
| 973 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 974 | return CMD_SUCCESS; |
| 975 | } |
| 976 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 977 | DEFUN (bgp_graceful_restart_stalepath_time, |
| 978 | bgp_graceful_restart_stalepath_time_cmd, |
| 979 | "bgp graceful-restart stalepath-time <1-3600>", |
| 980 | "BGP specific commands\n" |
| 981 | "Graceful restart capability parameters\n" |
| 982 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 983 | "Delay value (seconds)\n") |
| 984 | { |
| 985 | struct bgp *bgp; |
| 986 | u_int32_t stalepath; |
| 987 | |
| 988 | bgp = vty->index; |
| 989 | if (! bgp) |
| 990 | return CMD_WARNING; |
| 991 | |
| 992 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); |
| 993 | bgp->stalepath_time = stalepath; |
| 994 | return CMD_SUCCESS; |
| 995 | } |
| 996 | |
| 997 | DEFUN (no_bgp_graceful_restart_stalepath_time, |
| 998 | no_bgp_graceful_restart_stalepath_time_cmd, |
| 999 | "no bgp graceful-restart stalepath-time", |
| 1000 | NO_STR |
| 1001 | "BGP specific commands\n" |
| 1002 | "Graceful restart capability parameters\n" |
| 1003 | "Set the max time to hold onto restarting peer's stale paths\n") |
| 1004 | { |
| 1005 | struct bgp *bgp; |
| 1006 | |
| 1007 | bgp = vty->index; |
| 1008 | if (! bgp) |
| 1009 | return CMD_WARNING; |
| 1010 | |
| 1011 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; |
| 1012 | return CMD_SUCCESS; |
| 1013 | } |
| 1014 | |
| 1015 | ALIAS (no_bgp_graceful_restart_stalepath_time, |
| 1016 | no_bgp_graceful_restart_stalepath_time_val_cmd, |
| 1017 | "no bgp graceful-restart stalepath-time <1-3600>", |
| 1018 | NO_STR |
| 1019 | "BGP specific commands\n" |
| 1020 | "Graceful restart capability parameters\n" |
| 1021 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 1022 | "Delay value (seconds)\n") |
| 1023 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1024 | /* "bgp fast-external-failover" configuration. */ |
| 1025 | DEFUN (bgp_fast_external_failover, |
| 1026 | bgp_fast_external_failover_cmd, |
| 1027 | "bgp fast-external-failover", |
| 1028 | BGP_STR |
| 1029 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 1030 | { |
| 1031 | struct bgp *bgp; |
| 1032 | |
| 1033 | bgp = vty->index; |
| 1034 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 1035 | return CMD_SUCCESS; |
| 1036 | } |
| 1037 | |
| 1038 | DEFUN (no_bgp_fast_external_failover, |
| 1039 | no_bgp_fast_external_failover_cmd, |
| 1040 | "no bgp fast-external-failover", |
| 1041 | NO_STR |
| 1042 | BGP_STR |
| 1043 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 1044 | { |
| 1045 | struct bgp *bgp; |
| 1046 | |
| 1047 | bgp = vty->index; |
| 1048 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 1049 | return CMD_SUCCESS; |
| 1050 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1051 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1052 | /* "bgp enforce-first-as" configuration. */ |
| 1053 | DEFUN (bgp_enforce_first_as, |
| 1054 | bgp_enforce_first_as_cmd, |
| 1055 | "bgp enforce-first-as", |
| 1056 | BGP_STR |
| 1057 | "Enforce the first AS for EBGP routes\n") |
| 1058 | { |
| 1059 | struct bgp *bgp; |
| 1060 | |
| 1061 | bgp = vty->index; |
| 1062 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 1063 | return CMD_SUCCESS; |
| 1064 | } |
| 1065 | |
| 1066 | DEFUN (no_bgp_enforce_first_as, |
| 1067 | no_bgp_enforce_first_as_cmd, |
| 1068 | "no bgp enforce-first-as", |
| 1069 | NO_STR |
| 1070 | BGP_STR |
| 1071 | "Enforce the first AS for EBGP routes\n") |
| 1072 | { |
| 1073 | struct bgp *bgp; |
| 1074 | |
| 1075 | bgp = vty->index; |
| 1076 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 1077 | return CMD_SUCCESS; |
| 1078 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1079 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1080 | /* "bgp bestpath compare-routerid" configuration. */ |
| 1081 | DEFUN (bgp_bestpath_compare_router_id, |
| 1082 | bgp_bestpath_compare_router_id_cmd, |
| 1083 | "bgp bestpath compare-routerid", |
| 1084 | "BGP specific commands\n" |
| 1085 | "Change the default bestpath selection\n" |
| 1086 | "Compare router-id for identical EBGP paths\n") |
| 1087 | { |
| 1088 | struct bgp *bgp; |
| 1089 | |
| 1090 | bgp = vty->index; |
| 1091 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 1092 | return CMD_SUCCESS; |
| 1093 | } |
| 1094 | |
| 1095 | DEFUN (no_bgp_bestpath_compare_router_id, |
| 1096 | no_bgp_bestpath_compare_router_id_cmd, |
| 1097 | "no bgp bestpath compare-routerid", |
| 1098 | NO_STR |
| 1099 | "BGP specific commands\n" |
| 1100 | "Change the default bestpath selection\n" |
| 1101 | "Compare router-id for identical EBGP paths\n") |
| 1102 | { |
| 1103 | struct bgp *bgp; |
| 1104 | |
| 1105 | bgp = vty->index; |
| 1106 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 1107 | return CMD_SUCCESS; |
| 1108 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1109 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1110 | /* "bgp bestpath as-path ignore" configuration. */ |
| 1111 | DEFUN (bgp_bestpath_aspath_ignore, |
| 1112 | bgp_bestpath_aspath_ignore_cmd, |
| 1113 | "bgp bestpath as-path ignore", |
| 1114 | "BGP specific commands\n" |
| 1115 | "Change the default bestpath selection\n" |
| 1116 | "AS-path attribute\n" |
| 1117 | "Ignore as-path length in selecting a route\n") |
| 1118 | { |
| 1119 | struct bgp *bgp; |
| 1120 | |
| 1121 | bgp = vty->index; |
| 1122 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 1123 | return CMD_SUCCESS; |
| 1124 | } |
| 1125 | |
| 1126 | DEFUN (no_bgp_bestpath_aspath_ignore, |
| 1127 | no_bgp_bestpath_aspath_ignore_cmd, |
| 1128 | "no bgp bestpath as-path ignore", |
| 1129 | NO_STR |
| 1130 | "BGP specific commands\n" |
| 1131 | "Change the default bestpath selection\n" |
| 1132 | "AS-path attribute\n" |
| 1133 | "Ignore as-path length in selecting a route\n") |
| 1134 | { |
| 1135 | struct bgp *bgp; |
| 1136 | |
| 1137 | bgp = vty->index; |
| 1138 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 1139 | return CMD_SUCCESS; |
| 1140 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1141 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 1142 | /* "bgp bestpath as-path confed" configuration. */ |
| 1143 | DEFUN (bgp_bestpath_aspath_confed, |
| 1144 | bgp_bestpath_aspath_confed_cmd, |
| 1145 | "bgp bestpath as-path confed", |
| 1146 | "BGP specific commands\n" |
| 1147 | "Change the default bestpath selection\n" |
| 1148 | "AS-path attribute\n" |
| 1149 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 1150 | { |
| 1151 | struct bgp *bgp; |
| 1152 | |
| 1153 | bgp = vty->index; |
| 1154 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); |
| 1155 | return CMD_SUCCESS; |
| 1156 | } |
| 1157 | |
| 1158 | DEFUN (no_bgp_bestpath_aspath_confed, |
| 1159 | no_bgp_bestpath_aspath_confed_cmd, |
| 1160 | "no bgp bestpath as-path confed", |
| 1161 | NO_STR |
| 1162 | "BGP specific commands\n" |
| 1163 | "Change the default bestpath selection\n" |
| 1164 | "AS-path attribute\n" |
| 1165 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 1166 | { |
| 1167 | struct bgp *bgp; |
| 1168 | |
| 1169 | bgp = vty->index; |
| 1170 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); |
| 1171 | return CMD_SUCCESS; |
| 1172 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1173 | |
Pradosh Mohapatra | 2fdd455 | 2013-09-07 07:02:36 +0000 | [diff] [blame] | 1174 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
| 1175 | DEFUN (bgp_bestpath_aspath_multipath_relax, |
| 1176 | bgp_bestpath_aspath_multipath_relax_cmd, |
| 1177 | "bgp bestpath as-path multipath-relax", |
| 1178 | "BGP specific commands\n" |
| 1179 | "Change the default bestpath selection\n" |
| 1180 | "AS-path attribute\n" |
| 1181 | "Allow load sharing across routes that have different AS paths (but same length)\n") |
| 1182 | { |
| 1183 | struct bgp *bgp; |
| 1184 | |
| 1185 | bgp = vty->index; |
| 1186 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); |
| 1187 | return CMD_SUCCESS; |
| 1188 | } |
| 1189 | |
| 1190 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, |
| 1191 | no_bgp_bestpath_aspath_multipath_relax_cmd, |
| 1192 | "no bgp bestpath as-path multipath-relax", |
| 1193 | NO_STR |
| 1194 | "BGP specific commands\n" |
| 1195 | "Change the default bestpath selection\n" |
| 1196 | "AS-path attribute\n" |
| 1197 | "Allow load sharing across routes that have different AS paths (but same length)\n") |
| 1198 | { |
| 1199 | struct bgp *bgp; |
| 1200 | |
| 1201 | bgp = vty->index; |
| 1202 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); |
| 1203 | return CMD_SUCCESS; |
| 1204 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1205 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 1206 | /* "bgp log-neighbor-changes" configuration. */ |
| 1207 | DEFUN (bgp_log_neighbor_changes, |
| 1208 | bgp_log_neighbor_changes_cmd, |
| 1209 | "bgp log-neighbor-changes", |
| 1210 | "BGP specific commands\n" |
| 1211 | "Log neighbor up/down and reset reason\n") |
| 1212 | { |
| 1213 | struct bgp *bgp; |
| 1214 | |
| 1215 | bgp = vty->index; |
| 1216 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1217 | return CMD_SUCCESS; |
| 1218 | } |
| 1219 | |
| 1220 | DEFUN (no_bgp_log_neighbor_changes, |
| 1221 | no_bgp_log_neighbor_changes_cmd, |
| 1222 | "no bgp log-neighbor-changes", |
| 1223 | NO_STR |
| 1224 | "BGP specific commands\n" |
| 1225 | "Log neighbor up/down and reset reason\n") |
| 1226 | { |
| 1227 | struct bgp *bgp; |
| 1228 | |
| 1229 | bgp = vty->index; |
| 1230 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1231 | return CMD_SUCCESS; |
| 1232 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1233 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1234 | /* "bgp bestpath med" configuration. */ |
| 1235 | DEFUN (bgp_bestpath_med, |
| 1236 | bgp_bestpath_med_cmd, |
| 1237 | "bgp bestpath med (confed|missing-as-worst)", |
| 1238 | "BGP specific commands\n" |
| 1239 | "Change the default bestpath selection\n" |
| 1240 | "MED attribute\n" |
| 1241 | "Compare MED among confederation paths\n" |
| 1242 | "Treat missing MED as the least preferred one\n") |
| 1243 | { |
| 1244 | struct bgp *bgp; |
| 1245 | |
| 1246 | bgp = vty->index; |
| 1247 | |
| 1248 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1249 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1250 | else |
| 1251 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1252 | |
| 1253 | return CMD_SUCCESS; |
| 1254 | } |
| 1255 | |
| 1256 | DEFUN (bgp_bestpath_med2, |
| 1257 | bgp_bestpath_med2_cmd, |
| 1258 | "bgp bestpath med confed missing-as-worst", |
| 1259 | "BGP specific commands\n" |
| 1260 | "Change the default bestpath selection\n" |
| 1261 | "MED attribute\n" |
| 1262 | "Compare MED among confederation paths\n" |
| 1263 | "Treat missing MED as the least preferred one\n") |
| 1264 | { |
| 1265 | struct bgp *bgp; |
| 1266 | |
| 1267 | bgp = vty->index; |
| 1268 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1269 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1270 | return CMD_SUCCESS; |
| 1271 | } |
| 1272 | |
| 1273 | ALIAS (bgp_bestpath_med2, |
| 1274 | bgp_bestpath_med3_cmd, |
| 1275 | "bgp bestpath med missing-as-worst confed", |
| 1276 | "BGP specific commands\n" |
| 1277 | "Change the default bestpath selection\n" |
| 1278 | "MED attribute\n" |
| 1279 | "Treat missing MED as the least preferred one\n" |
| 1280 | "Compare MED among confederation paths\n") |
| 1281 | |
| 1282 | DEFUN (no_bgp_bestpath_med, |
| 1283 | no_bgp_bestpath_med_cmd, |
| 1284 | "no bgp bestpath med (confed|missing-as-worst)", |
| 1285 | NO_STR |
| 1286 | "BGP specific commands\n" |
| 1287 | "Change the default bestpath selection\n" |
| 1288 | "MED attribute\n" |
| 1289 | "Compare MED among confederation paths\n" |
| 1290 | "Treat missing MED as the least preferred one\n") |
| 1291 | { |
| 1292 | struct bgp *bgp; |
| 1293 | |
| 1294 | bgp = vty->index; |
| 1295 | |
| 1296 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1297 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1298 | else |
| 1299 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1300 | |
| 1301 | return CMD_SUCCESS; |
| 1302 | } |
| 1303 | |
| 1304 | DEFUN (no_bgp_bestpath_med2, |
| 1305 | no_bgp_bestpath_med2_cmd, |
| 1306 | "no bgp bestpath med confed missing-as-worst", |
| 1307 | NO_STR |
| 1308 | "BGP specific commands\n" |
| 1309 | "Change the default bestpath selection\n" |
| 1310 | "MED attribute\n" |
| 1311 | "Compare MED among confederation paths\n" |
| 1312 | "Treat missing MED as the least preferred one\n") |
| 1313 | { |
| 1314 | struct bgp *bgp; |
| 1315 | |
| 1316 | bgp = vty->index; |
| 1317 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1318 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1319 | return CMD_SUCCESS; |
| 1320 | } |
| 1321 | |
| 1322 | ALIAS (no_bgp_bestpath_med2, |
| 1323 | no_bgp_bestpath_med3_cmd, |
| 1324 | "no bgp bestpath med missing-as-worst confed", |
| 1325 | NO_STR |
| 1326 | "BGP specific commands\n" |
| 1327 | "Change the default bestpath selection\n" |
| 1328 | "MED attribute\n" |
| 1329 | "Treat missing MED as the least preferred one\n" |
| 1330 | "Compare MED among confederation paths\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1331 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1332 | /* "no bgp default ipv4-unicast". */ |
| 1333 | DEFUN (no_bgp_default_ipv4_unicast, |
| 1334 | no_bgp_default_ipv4_unicast_cmd, |
| 1335 | "no bgp default ipv4-unicast", |
| 1336 | NO_STR |
| 1337 | "BGP specific commands\n" |
| 1338 | "Configure BGP defaults\n" |
| 1339 | "Activate ipv4-unicast for a peer by default\n") |
| 1340 | { |
| 1341 | struct bgp *bgp; |
| 1342 | |
| 1343 | bgp = vty->index; |
| 1344 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1345 | return CMD_SUCCESS; |
| 1346 | } |
| 1347 | |
| 1348 | DEFUN (bgp_default_ipv4_unicast, |
| 1349 | bgp_default_ipv4_unicast_cmd, |
| 1350 | "bgp default ipv4-unicast", |
| 1351 | "BGP specific commands\n" |
| 1352 | "Configure BGP defaults\n" |
| 1353 | "Activate ipv4-unicast for a peer by default\n") |
| 1354 | { |
| 1355 | struct bgp *bgp; |
| 1356 | |
| 1357 | bgp = vty->index; |
| 1358 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1359 | return CMD_SUCCESS; |
| 1360 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1361 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1362 | /* "bgp import-check" configuration. */ |
| 1363 | DEFUN (bgp_network_import_check, |
| 1364 | bgp_network_import_check_cmd, |
| 1365 | "bgp network import-check", |
| 1366 | "BGP specific commands\n" |
| 1367 | "BGP network command\n" |
| 1368 | "Check BGP network route exists in IGP\n") |
| 1369 | { |
| 1370 | struct bgp *bgp; |
| 1371 | |
| 1372 | bgp = vty->index; |
| 1373 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1374 | return CMD_SUCCESS; |
| 1375 | } |
| 1376 | |
| 1377 | DEFUN (no_bgp_network_import_check, |
| 1378 | no_bgp_network_import_check_cmd, |
| 1379 | "no bgp network import-check", |
| 1380 | NO_STR |
| 1381 | "BGP specific commands\n" |
| 1382 | "BGP network command\n" |
| 1383 | "Check BGP network route exists in IGP\n") |
| 1384 | { |
| 1385 | struct bgp *bgp; |
| 1386 | |
| 1387 | bgp = vty->index; |
| 1388 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1389 | return CMD_SUCCESS; |
| 1390 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1391 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1392 | DEFUN (bgp_default_local_preference, |
| 1393 | bgp_default_local_preference_cmd, |
| 1394 | "bgp default local-preference <0-4294967295>", |
| 1395 | "BGP specific commands\n" |
| 1396 | "Configure BGP defaults\n" |
| 1397 | "local preference (higher=more preferred)\n" |
| 1398 | "Configure default local preference value\n") |
| 1399 | { |
| 1400 | struct bgp *bgp; |
| 1401 | u_int32_t local_pref; |
| 1402 | |
| 1403 | bgp = vty->index; |
| 1404 | |
| 1405 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); |
| 1406 | |
| 1407 | bgp_default_local_preference_set (bgp, local_pref); |
| 1408 | |
| 1409 | return CMD_SUCCESS; |
| 1410 | } |
| 1411 | |
| 1412 | DEFUN (no_bgp_default_local_preference, |
| 1413 | no_bgp_default_local_preference_cmd, |
| 1414 | "no bgp default local-preference", |
| 1415 | NO_STR |
| 1416 | "BGP specific commands\n" |
| 1417 | "Configure BGP defaults\n" |
| 1418 | "local preference (higher=more preferred)\n") |
| 1419 | { |
| 1420 | struct bgp *bgp; |
| 1421 | |
| 1422 | bgp = vty->index; |
| 1423 | bgp_default_local_preference_unset (bgp); |
| 1424 | return CMD_SUCCESS; |
| 1425 | } |
| 1426 | |
| 1427 | ALIAS (no_bgp_default_local_preference, |
| 1428 | no_bgp_default_local_preference_val_cmd, |
| 1429 | "no bgp default local-preference <0-4294967295>", |
| 1430 | NO_STR |
| 1431 | "BGP specific commands\n" |
| 1432 | "Configure BGP defaults\n" |
| 1433 | "local preference (higher=more preferred)\n" |
| 1434 | "Configure default local preference value\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1435 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1436 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1437 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
| 1438 | const char *as_str, afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1439 | { |
| 1440 | int ret; |
| 1441 | struct bgp *bgp; |
| 1442 | as_t as; |
| 1443 | union sockunion su; |
| 1444 | |
| 1445 | bgp = vty->index; |
| 1446 | |
| 1447 | /* Get AS number. */ |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 1448 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1449 | |
| 1450 | /* If peer is peer group, call proper function. */ |
| 1451 | ret = str2sockunion (peer_str, &su); |
| 1452 | if (ret < 0) |
| 1453 | { |
| 1454 | ret = peer_group_remote_as (bgp, peer_str, &as); |
| 1455 | if (ret < 0) |
| 1456 | { |
| 1457 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1458 | return CMD_WARNING; |
| 1459 | } |
| 1460 | return CMD_SUCCESS; |
| 1461 | } |
| 1462 | |
| 1463 | if (peer_address_self_check (&su)) |
| 1464 | { |
| 1465 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1466 | VTY_NEWLINE); |
| 1467 | return CMD_WARNING; |
| 1468 | } |
| 1469 | |
| 1470 | ret = peer_remote_as (bgp, &su, &as, afi, safi); |
| 1471 | |
| 1472 | /* This peer belongs to peer group. */ |
| 1473 | switch (ret) |
| 1474 | { |
| 1475 | case BGP_ERR_PEER_GROUP_MEMBER: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1476 | 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] | 1477 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1478 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1479 | 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] | 1480 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1481 | } |
| 1482 | return bgp_vty_return (vty, ret); |
| 1483 | } |
| 1484 | |
| 1485 | DEFUN (neighbor_remote_as, |
| 1486 | neighbor_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1487 | NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1488 | NEIGHBOR_STR |
| 1489 | NEIGHBOR_ADDR_STR2 |
| 1490 | "Specify a BGP neighbor\n" |
| 1491 | AS_STR) |
| 1492 | { |
| 1493 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); |
| 1494 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1495 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1496 | DEFUN (neighbor_peer_group, |
| 1497 | neighbor_peer_group_cmd, |
| 1498 | "neighbor WORD peer-group", |
| 1499 | NEIGHBOR_STR |
| 1500 | "Neighbor tag\n" |
| 1501 | "Configure peer-group\n") |
| 1502 | { |
| 1503 | struct bgp *bgp; |
| 1504 | struct peer_group *group; |
| 1505 | |
| 1506 | bgp = vty->index; |
| 1507 | |
| 1508 | group = peer_group_get (bgp, argv[0]); |
| 1509 | if (! group) |
| 1510 | return CMD_WARNING; |
| 1511 | |
| 1512 | return CMD_SUCCESS; |
| 1513 | } |
| 1514 | |
| 1515 | DEFUN (no_neighbor, |
| 1516 | no_neighbor_cmd, |
| 1517 | NO_NEIGHBOR_CMD2, |
| 1518 | NO_STR |
| 1519 | NEIGHBOR_STR |
| 1520 | NEIGHBOR_ADDR_STR2) |
| 1521 | { |
| 1522 | int ret; |
| 1523 | union sockunion su; |
| 1524 | struct peer_group *group; |
| 1525 | struct peer *peer; |
| 1526 | |
| 1527 | ret = str2sockunion (argv[0], &su); |
| 1528 | if (ret < 0) |
| 1529 | { |
| 1530 | group = peer_group_lookup (vty->index, argv[0]); |
| 1531 | if (group) |
| 1532 | peer_group_delete (group); |
| 1533 | else |
| 1534 | { |
| 1535 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1536 | return CMD_WARNING; |
| 1537 | } |
| 1538 | } |
| 1539 | else |
| 1540 | { |
| 1541 | peer = peer_lookup (vty->index, &su); |
| 1542 | if (peer) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 1543 | peer_delete (peer); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1544 | } |
| 1545 | |
| 1546 | return CMD_SUCCESS; |
| 1547 | } |
| 1548 | |
| 1549 | ALIAS (no_neighbor, |
| 1550 | no_neighbor_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1551 | NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1552 | NO_STR |
| 1553 | NEIGHBOR_STR |
| 1554 | NEIGHBOR_ADDR_STR |
| 1555 | "Specify a BGP neighbor\n" |
| 1556 | AS_STR) |
| 1557 | |
| 1558 | DEFUN (no_neighbor_peer_group, |
| 1559 | no_neighbor_peer_group_cmd, |
| 1560 | "no neighbor WORD peer-group", |
| 1561 | NO_STR |
| 1562 | NEIGHBOR_STR |
| 1563 | "Neighbor tag\n" |
| 1564 | "Configure peer-group\n") |
| 1565 | { |
| 1566 | struct peer_group *group; |
| 1567 | |
| 1568 | group = peer_group_lookup (vty->index, argv[0]); |
| 1569 | if (group) |
| 1570 | peer_group_delete (group); |
| 1571 | else |
| 1572 | { |
| 1573 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1574 | return CMD_WARNING; |
| 1575 | } |
| 1576 | return CMD_SUCCESS; |
| 1577 | } |
| 1578 | |
| 1579 | DEFUN (no_neighbor_peer_group_remote_as, |
| 1580 | no_neighbor_peer_group_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1581 | "no neighbor WORD remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1582 | NO_STR |
| 1583 | NEIGHBOR_STR |
| 1584 | "Neighbor tag\n" |
| 1585 | "Specify a BGP neighbor\n" |
| 1586 | AS_STR) |
| 1587 | { |
| 1588 | struct peer_group *group; |
| 1589 | |
| 1590 | group = peer_group_lookup (vty->index, argv[0]); |
| 1591 | if (group) |
| 1592 | peer_group_remote_as_delete (group); |
| 1593 | else |
| 1594 | { |
| 1595 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1596 | return CMD_WARNING; |
| 1597 | } |
| 1598 | return CMD_SUCCESS; |
| 1599 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1600 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1601 | DEFUN (neighbor_local_as, |
| 1602 | neighbor_local_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1603 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1604 | NEIGHBOR_STR |
| 1605 | NEIGHBOR_ADDR_STR2 |
| 1606 | "Specify a local-as number\n" |
| 1607 | "AS number used as local AS\n") |
| 1608 | { |
| 1609 | struct peer *peer; |
| 1610 | int ret; |
| 1611 | |
| 1612 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1613 | if (! peer) |
| 1614 | return CMD_WARNING; |
| 1615 | |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 1616 | ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1617 | return bgp_vty_return (vty, ret); |
| 1618 | } |
| 1619 | |
| 1620 | DEFUN (neighbor_local_as_no_prepend, |
| 1621 | neighbor_local_as_no_prepend_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1622 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1623 | NEIGHBOR_STR |
| 1624 | NEIGHBOR_ADDR_STR2 |
| 1625 | "Specify a local-as number\n" |
| 1626 | "AS number used as local AS\n" |
| 1627 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1628 | { |
| 1629 | struct peer *peer; |
| 1630 | int ret; |
| 1631 | |
| 1632 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1633 | if (! peer) |
| 1634 | return CMD_WARNING; |
| 1635 | |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 1636 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1637 | return bgp_vty_return (vty, ret); |
| 1638 | } |
| 1639 | |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 1640 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
| 1641 | neighbor_local_as_no_prepend_replace_as_cmd, |
| 1642 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", |
| 1643 | NEIGHBOR_STR |
| 1644 | NEIGHBOR_ADDR_STR2 |
| 1645 | "Specify a local-as number\n" |
| 1646 | "AS number used as local AS\n" |
| 1647 | "Do not prepend local-as to updates from ebgp peers\n" |
| 1648 | "Do not prepend local-as to updates from ibgp peers\n") |
| 1649 | { |
| 1650 | struct peer *peer; |
| 1651 | int ret; |
| 1652 | |
| 1653 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1654 | if (! peer) |
| 1655 | return CMD_WARNING; |
| 1656 | |
| 1657 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); |
| 1658 | return bgp_vty_return (vty, ret); |
| 1659 | } |
| 1660 | |
| 1661 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1662 | DEFUN (no_neighbor_local_as, |
| 1663 | no_neighbor_local_as_cmd, |
| 1664 | NO_NEIGHBOR_CMD2 "local-as", |
| 1665 | NO_STR |
| 1666 | NEIGHBOR_STR |
| 1667 | NEIGHBOR_ADDR_STR2 |
| 1668 | "Specify a local-as number\n") |
| 1669 | { |
| 1670 | struct peer *peer; |
| 1671 | int ret; |
| 1672 | |
| 1673 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1674 | if (! peer) |
| 1675 | return CMD_WARNING; |
| 1676 | |
| 1677 | ret = peer_local_as_unset (peer); |
| 1678 | return bgp_vty_return (vty, ret); |
| 1679 | } |
| 1680 | |
| 1681 | ALIAS (no_neighbor_local_as, |
| 1682 | no_neighbor_local_as_val_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1683 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1684 | NO_STR |
| 1685 | NEIGHBOR_STR |
| 1686 | NEIGHBOR_ADDR_STR2 |
| 1687 | "Specify a local-as number\n" |
| 1688 | "AS number used as local AS\n") |
| 1689 | |
| 1690 | ALIAS (no_neighbor_local_as, |
| 1691 | no_neighbor_local_as_val2_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1692 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1693 | NO_STR |
| 1694 | NEIGHBOR_STR |
| 1695 | NEIGHBOR_ADDR_STR2 |
| 1696 | "Specify a local-as number\n" |
| 1697 | "AS number used as local AS\n" |
| 1698 | "Do not prepend local-as to updates from ebgp peers\n") |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 1699 | |
| 1700 | ALIAS (no_neighbor_local_as, |
| 1701 | no_neighbor_local_as_val3_cmd, |
| 1702 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", |
| 1703 | NO_STR |
| 1704 | NEIGHBOR_STR |
| 1705 | NEIGHBOR_ADDR_STR2 |
| 1706 | "Specify a local-as number\n" |
| 1707 | "AS number used as local AS\n" |
| 1708 | "Do not prepend local-as to updates from ebgp peers\n" |
| 1709 | "Do not prepend local-as to updates from ibgp peers\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1710 | |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 1711 | DEFUN (neighbor_password, |
| 1712 | neighbor_password_cmd, |
| 1713 | NEIGHBOR_CMD2 "password LINE", |
| 1714 | NEIGHBOR_STR |
| 1715 | NEIGHBOR_ADDR_STR2 |
| 1716 | "Set a password\n" |
| 1717 | "The password\n") |
| 1718 | { |
| 1719 | struct peer *peer; |
| 1720 | int ret; |
| 1721 | |
| 1722 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1723 | if (! peer) |
| 1724 | return CMD_WARNING; |
| 1725 | |
| 1726 | ret = peer_password_set (peer, argv[1]); |
| 1727 | return bgp_vty_return (vty, ret); |
| 1728 | } |
| 1729 | |
| 1730 | DEFUN (no_neighbor_password, |
| 1731 | no_neighbor_password_cmd, |
| 1732 | NO_NEIGHBOR_CMD2 "password", |
| 1733 | NO_STR |
| 1734 | NEIGHBOR_STR |
| 1735 | NEIGHBOR_ADDR_STR2 |
| 1736 | "Set a password\n") |
| 1737 | { |
| 1738 | struct peer *peer; |
| 1739 | int ret; |
| 1740 | |
| 1741 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1742 | if (! peer) |
| 1743 | return CMD_WARNING; |
| 1744 | |
| 1745 | ret = peer_password_unset (peer); |
| 1746 | return bgp_vty_return (vty, ret); |
| 1747 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1748 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1749 | DEFUN (neighbor_activate, |
| 1750 | neighbor_activate_cmd, |
| 1751 | NEIGHBOR_CMD2 "activate", |
| 1752 | NEIGHBOR_STR |
| 1753 | NEIGHBOR_ADDR_STR2 |
| 1754 | "Enable the Address Family for this Neighbor\n") |
| 1755 | { |
| 1756 | struct peer *peer; |
| 1757 | |
| 1758 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1759 | if (! peer) |
| 1760 | return CMD_WARNING; |
| 1761 | |
| 1762 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1763 | |
| 1764 | return CMD_SUCCESS; |
| 1765 | } |
| 1766 | |
| 1767 | DEFUN (no_neighbor_activate, |
| 1768 | no_neighbor_activate_cmd, |
| 1769 | NO_NEIGHBOR_CMD2 "activate", |
| 1770 | NO_STR |
| 1771 | NEIGHBOR_STR |
| 1772 | NEIGHBOR_ADDR_STR2 |
| 1773 | "Enable the Address Family for this Neighbor\n") |
| 1774 | { |
| 1775 | int ret; |
| 1776 | struct peer *peer; |
| 1777 | |
| 1778 | /* Lookup peer. */ |
| 1779 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1780 | if (! peer) |
| 1781 | return CMD_WARNING; |
| 1782 | |
| 1783 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1784 | |
| 1785 | return bgp_vty_return (vty, ret); |
| 1786 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1787 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1788 | DEFUN (neighbor_set_peer_group, |
| 1789 | neighbor_set_peer_group_cmd, |
| 1790 | NEIGHBOR_CMD "peer-group WORD", |
| 1791 | NEIGHBOR_STR |
| 1792 | NEIGHBOR_ADDR_STR |
| 1793 | "Member of the peer-group\n" |
| 1794 | "peer-group name\n") |
| 1795 | { |
| 1796 | int ret; |
| 1797 | as_t as; |
| 1798 | union sockunion su; |
| 1799 | struct bgp *bgp; |
| 1800 | struct peer_group *group; |
| 1801 | |
| 1802 | bgp = vty->index; |
| 1803 | |
| 1804 | ret = str2sockunion (argv[0], &su); |
| 1805 | if (ret < 0) |
| 1806 | { |
| 1807 | vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); |
| 1808 | return CMD_WARNING; |
| 1809 | } |
| 1810 | |
| 1811 | group = peer_group_lookup (bgp, argv[1]); |
| 1812 | if (! group) |
| 1813 | { |
| 1814 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1815 | return CMD_WARNING; |
| 1816 | } |
| 1817 | |
| 1818 | if (peer_address_self_check (&su)) |
| 1819 | { |
| 1820 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1821 | VTY_NEWLINE); |
| 1822 | return CMD_WARNING; |
| 1823 | } |
| 1824 | |
| 1825 | ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty), |
| 1826 | bgp_node_safi (vty), &as); |
| 1827 | |
| 1828 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) |
| 1829 | { |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1830 | 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] | 1831 | return CMD_WARNING; |
| 1832 | } |
| 1833 | |
| 1834 | return bgp_vty_return (vty, ret); |
| 1835 | } |
| 1836 | |
| 1837 | DEFUN (no_neighbor_set_peer_group, |
| 1838 | no_neighbor_set_peer_group_cmd, |
| 1839 | NO_NEIGHBOR_CMD "peer-group WORD", |
| 1840 | NO_STR |
| 1841 | NEIGHBOR_STR |
| 1842 | NEIGHBOR_ADDR_STR |
| 1843 | "Member of the peer-group\n" |
| 1844 | "peer-group name\n") |
| 1845 | { |
| 1846 | int ret; |
| 1847 | struct bgp *bgp; |
| 1848 | struct peer *peer; |
| 1849 | struct peer_group *group; |
| 1850 | |
| 1851 | bgp = vty->index; |
| 1852 | |
| 1853 | peer = peer_lookup_vty (vty, argv[0]); |
| 1854 | if (! peer) |
| 1855 | return CMD_WARNING; |
| 1856 | |
| 1857 | group = peer_group_lookup (bgp, argv[1]); |
| 1858 | if (! group) |
| 1859 | { |
| 1860 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1861 | return CMD_WARNING; |
| 1862 | } |
| 1863 | |
| 1864 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), |
| 1865 | bgp_node_safi (vty)); |
| 1866 | |
| 1867 | return bgp_vty_return (vty, ret); |
| 1868 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1869 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1870 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1871 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
| 1872 | u_int16_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1873 | { |
| 1874 | int ret; |
| 1875 | struct peer *peer; |
| 1876 | |
| 1877 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 1878 | if (! peer) |
| 1879 | return CMD_WARNING; |
| 1880 | |
| 1881 | if (set) |
| 1882 | ret = peer_flag_set (peer, flag); |
| 1883 | else |
| 1884 | ret = peer_flag_unset (peer, flag); |
| 1885 | |
| 1886 | return bgp_vty_return (vty, ret); |
| 1887 | } |
| 1888 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1889 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1890 | 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] | 1891 | { |
| 1892 | return peer_flag_modify_vty (vty, ip_str, flag, 1); |
| 1893 | } |
| 1894 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1895 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1896 | 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] | 1897 | { |
| 1898 | return peer_flag_modify_vty (vty, ip_str, flag, 0); |
| 1899 | } |
| 1900 | |
| 1901 | /* neighbor passive. */ |
| 1902 | DEFUN (neighbor_passive, |
| 1903 | neighbor_passive_cmd, |
| 1904 | NEIGHBOR_CMD2 "passive", |
| 1905 | NEIGHBOR_STR |
| 1906 | NEIGHBOR_ADDR_STR2 |
| 1907 | "Don't send open messages to this neighbor\n") |
| 1908 | { |
| 1909 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1910 | } |
| 1911 | |
| 1912 | DEFUN (no_neighbor_passive, |
| 1913 | no_neighbor_passive_cmd, |
| 1914 | NO_NEIGHBOR_CMD2 "passive", |
| 1915 | NO_STR |
| 1916 | NEIGHBOR_STR |
| 1917 | NEIGHBOR_ADDR_STR2 |
| 1918 | "Don't send open messages to this neighbor\n") |
| 1919 | { |
| 1920 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1921 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1922 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1923 | /* neighbor shutdown. */ |
| 1924 | DEFUN (neighbor_shutdown, |
| 1925 | neighbor_shutdown_cmd, |
| 1926 | NEIGHBOR_CMD2 "shutdown", |
| 1927 | NEIGHBOR_STR |
| 1928 | NEIGHBOR_ADDR_STR2 |
| 1929 | "Administratively shut down this neighbor\n") |
| 1930 | { |
| 1931 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1932 | } |
| 1933 | |
| 1934 | DEFUN (no_neighbor_shutdown, |
| 1935 | no_neighbor_shutdown_cmd, |
| 1936 | NO_NEIGHBOR_CMD2 "shutdown", |
| 1937 | NO_STR |
| 1938 | NEIGHBOR_STR |
| 1939 | NEIGHBOR_ADDR_STR2 |
| 1940 | "Administratively shut down this neighbor\n") |
| 1941 | { |
| 1942 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1943 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1944 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1945 | /* Deprecated neighbor capability route-refresh. */ |
| 1946 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, |
| 1947 | neighbor_capability_route_refresh_cmd, |
| 1948 | NEIGHBOR_CMD2 "capability route-refresh", |
| 1949 | NEIGHBOR_STR |
| 1950 | NEIGHBOR_ADDR_STR2 |
| 1951 | "Advertise capability to the peer\n" |
| 1952 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1953 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1954 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1955 | } |
| 1956 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1957 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
| 1958 | no_neighbor_capability_route_refresh_cmd, |
| 1959 | NO_NEIGHBOR_CMD2 "capability route-refresh", |
| 1960 | NO_STR |
| 1961 | NEIGHBOR_STR |
| 1962 | NEIGHBOR_ADDR_STR2 |
| 1963 | "Advertise capability to the peer\n" |
| 1964 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1965 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1966 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1967 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1968 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1969 | /* neighbor capability dynamic. */ |
| 1970 | DEFUN (neighbor_capability_dynamic, |
| 1971 | neighbor_capability_dynamic_cmd, |
| 1972 | NEIGHBOR_CMD2 "capability dynamic", |
| 1973 | NEIGHBOR_STR |
| 1974 | NEIGHBOR_ADDR_STR2 |
| 1975 | "Advertise capability to the peer\n" |
| 1976 | "Advertise dynamic capability to this neighbor\n") |
| 1977 | { |
| 1978 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1979 | } |
| 1980 | |
| 1981 | DEFUN (no_neighbor_capability_dynamic, |
| 1982 | no_neighbor_capability_dynamic_cmd, |
| 1983 | NO_NEIGHBOR_CMD2 "capability dynamic", |
| 1984 | NO_STR |
| 1985 | NEIGHBOR_STR |
| 1986 | NEIGHBOR_ADDR_STR2 |
| 1987 | "Advertise capability to the peer\n" |
| 1988 | "Advertise dynamic capability to this neighbor\n") |
| 1989 | { |
| 1990 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1991 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1992 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1993 | /* neighbor dont-capability-negotiate */ |
| 1994 | DEFUN (neighbor_dont_capability_negotiate, |
| 1995 | neighbor_dont_capability_negotiate_cmd, |
| 1996 | NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1997 | NEIGHBOR_STR |
| 1998 | NEIGHBOR_ADDR_STR2 |
| 1999 | "Do not perform capability negotiation\n") |
| 2000 | { |
| 2001 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 2002 | } |
| 2003 | |
| 2004 | DEFUN (no_neighbor_dont_capability_negotiate, |
| 2005 | no_neighbor_dont_capability_negotiate_cmd, |
| 2006 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 2007 | NO_STR |
| 2008 | NEIGHBOR_STR |
| 2009 | NEIGHBOR_ADDR_STR2 |
| 2010 | "Do not perform capability negotiation\n") |
| 2011 | { |
| 2012 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 2013 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2014 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2015 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2016 | 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] | 2017 | safi_t safi, u_int32_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2018 | { |
| 2019 | int ret; |
| 2020 | struct peer *peer; |
| 2021 | |
| 2022 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2023 | if (! peer) |
| 2024 | return CMD_WARNING; |
| 2025 | |
| 2026 | if (set) |
| 2027 | ret = peer_af_flag_set (peer, afi, safi, flag); |
| 2028 | else |
| 2029 | ret = peer_af_flag_unset (peer, afi, safi, flag); |
| 2030 | |
| 2031 | return bgp_vty_return (vty, ret); |
| 2032 | } |
| 2033 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2034 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2035 | 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] | 2036 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2037 | { |
| 2038 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); |
| 2039 | } |
| 2040 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2041 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2042 | 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] | 2043 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2044 | { |
| 2045 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); |
| 2046 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2047 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2048 | /* neighbor capability orf prefix-list. */ |
| 2049 | DEFUN (neighbor_capability_orf_prefix, |
| 2050 | neighbor_capability_orf_prefix_cmd, |
| 2051 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 2052 | NEIGHBOR_STR |
| 2053 | NEIGHBOR_ADDR_STR2 |
| 2054 | "Advertise capability to the peer\n" |
| 2055 | "Advertise ORF capability to the peer\n" |
| 2056 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 2057 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 2058 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 2059 | "Capability to SEND the ORF to this neighbor\n") |
| 2060 | { |
| 2061 | u_int16_t flag = 0; |
| 2062 | |
| 2063 | if (strncmp (argv[1], "s", 1) == 0) |
| 2064 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 2065 | else if (strncmp (argv[1], "r", 1) == 0) |
| 2066 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 2067 | else if (strncmp (argv[1], "b", 1) == 0) |
| 2068 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 2069 | else |
| 2070 | return CMD_WARNING; |
| 2071 | |
| 2072 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2073 | bgp_node_safi (vty), flag); |
| 2074 | } |
| 2075 | |
| 2076 | DEFUN (no_neighbor_capability_orf_prefix, |
| 2077 | no_neighbor_capability_orf_prefix_cmd, |
| 2078 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 2079 | NO_STR |
| 2080 | NEIGHBOR_STR |
| 2081 | NEIGHBOR_ADDR_STR2 |
| 2082 | "Advertise capability to the peer\n" |
| 2083 | "Advertise ORF capability to the peer\n" |
| 2084 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 2085 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 2086 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 2087 | "Capability to SEND the ORF to this neighbor\n") |
| 2088 | { |
| 2089 | u_int16_t flag = 0; |
| 2090 | |
| 2091 | if (strncmp (argv[1], "s", 1) == 0) |
| 2092 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 2093 | else if (strncmp (argv[1], "r", 1) == 0) |
| 2094 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 2095 | else if (strncmp (argv[1], "b", 1) == 0) |
| 2096 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 2097 | else |
| 2098 | return CMD_WARNING; |
| 2099 | |
| 2100 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2101 | bgp_node_safi (vty), flag); |
| 2102 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2103 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2104 | /* neighbor next-hop-self. */ |
| 2105 | DEFUN (neighbor_nexthop_self, |
| 2106 | neighbor_nexthop_self_cmd, |
Timo Teräs | 9e7a53c | 2014-04-24 10:22:37 +0300 | [diff] [blame] | 2107 | NEIGHBOR_CMD2 "next-hop-self {all}", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2108 | NEIGHBOR_STR |
| 2109 | NEIGHBOR_ADDR_STR2 |
Timo Teräs | 9e7a53c | 2014-04-24 10:22:37 +0300 | [diff] [blame] | 2110 | "Disable the next hop calculation for this neighbor\n" |
| 2111 | "Apply also to ibgp-learned routes when acting as a route reflector\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2112 | { |
Timo Teräs | 9e7a53c | 2014-04-24 10:22:37 +0300 | [diff] [blame] | 2113 | u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0; |
| 2114 | int rc; |
| 2115 | |
| 2116 | /* Check if "all" is specified */ |
| 2117 | if (argv[1] != NULL) |
| 2118 | flags |= PEER_FLAG_NEXTHOP_SELF_ALL; |
| 2119 | else |
| 2120 | unset |= PEER_FLAG_NEXTHOP_SELF_ALL; |
| 2121 | |
| 2122 | rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2123 | bgp_node_safi (vty), flags); |
| 2124 | if ( rc == CMD_SUCCESS && unset ) |
| 2125 | rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2126 | bgp_node_safi (vty), unset); |
| 2127 | return rc; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2128 | } |
| 2129 | |
| 2130 | DEFUN (no_neighbor_nexthop_self, |
| 2131 | no_neighbor_nexthop_self_cmd, |
Timo Teräs | 9e7a53c | 2014-04-24 10:22:37 +0300 | [diff] [blame] | 2132 | NO_NEIGHBOR_CMD2 "next-hop-self {all}", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2133 | NO_STR |
| 2134 | NEIGHBOR_STR |
| 2135 | NEIGHBOR_ADDR_STR2 |
Timo Teräs | 9e7a53c | 2014-04-24 10:22:37 +0300 | [diff] [blame] | 2136 | "Disable the next hop calculation for this neighbor\n" |
| 2137 | "Apply also to ibgp-learned routes when acting as a route reflector\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2138 | { |
| 2139 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
Timo Teräs | 9e7a53c | 2014-04-24 10:22:37 +0300 | [diff] [blame] | 2140 | bgp_node_safi (vty), |
| 2141 | PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2142 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2143 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2144 | /* neighbor remove-private-AS. */ |
| 2145 | DEFUN (neighbor_remove_private_as, |
| 2146 | neighbor_remove_private_as_cmd, |
| 2147 | NEIGHBOR_CMD2 "remove-private-AS", |
| 2148 | NEIGHBOR_STR |
| 2149 | NEIGHBOR_ADDR_STR2 |
| 2150 | "Remove private AS number from outbound updates\n") |
| 2151 | { |
| 2152 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2153 | bgp_node_safi (vty), |
| 2154 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 2155 | } |
| 2156 | |
| 2157 | DEFUN (no_neighbor_remove_private_as, |
| 2158 | no_neighbor_remove_private_as_cmd, |
| 2159 | NO_NEIGHBOR_CMD2 "remove-private-AS", |
| 2160 | NO_STR |
| 2161 | NEIGHBOR_STR |
| 2162 | NEIGHBOR_ADDR_STR2 |
| 2163 | "Remove private AS number from outbound updates\n") |
| 2164 | { |
| 2165 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2166 | bgp_node_safi (vty), |
| 2167 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 2168 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2169 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2170 | /* neighbor send-community. */ |
| 2171 | DEFUN (neighbor_send_community, |
| 2172 | neighbor_send_community_cmd, |
| 2173 | NEIGHBOR_CMD2 "send-community", |
| 2174 | NEIGHBOR_STR |
| 2175 | NEIGHBOR_ADDR_STR2 |
| 2176 | "Send Community attribute to this neighbor\n") |
| 2177 | { |
| 2178 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2179 | bgp_node_safi (vty), |
| 2180 | PEER_FLAG_SEND_COMMUNITY); |
| 2181 | } |
| 2182 | |
| 2183 | DEFUN (no_neighbor_send_community, |
| 2184 | no_neighbor_send_community_cmd, |
| 2185 | NO_NEIGHBOR_CMD2 "send-community", |
| 2186 | NO_STR |
| 2187 | NEIGHBOR_STR |
| 2188 | NEIGHBOR_ADDR_STR2 |
| 2189 | "Send Community attribute to this neighbor\n") |
| 2190 | { |
| 2191 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2192 | bgp_node_safi (vty), |
| 2193 | PEER_FLAG_SEND_COMMUNITY); |
| 2194 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2195 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2196 | /* neighbor send-community extended. */ |
| 2197 | DEFUN (neighbor_send_community_type, |
| 2198 | neighbor_send_community_type_cmd, |
| 2199 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 2200 | NEIGHBOR_STR |
| 2201 | NEIGHBOR_ADDR_STR2 |
| 2202 | "Send Community attribute to this neighbor\n" |
| 2203 | "Send Standard and Extended Community attributes\n" |
| 2204 | "Send Extended Community attributes\n" |
| 2205 | "Send Standard Community attributes\n") |
| 2206 | { |
| 2207 | if (strncmp (argv[1], "s", 1) == 0) |
| 2208 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2209 | bgp_node_safi (vty), |
| 2210 | PEER_FLAG_SEND_COMMUNITY); |
| 2211 | if (strncmp (argv[1], "e", 1) == 0) |
| 2212 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2213 | bgp_node_safi (vty), |
| 2214 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 2215 | |
| 2216 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2217 | bgp_node_safi (vty), |
| 2218 | (PEER_FLAG_SEND_COMMUNITY| |
| 2219 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 2220 | } |
| 2221 | |
| 2222 | DEFUN (no_neighbor_send_community_type, |
| 2223 | no_neighbor_send_community_type_cmd, |
| 2224 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 2225 | NO_STR |
| 2226 | NEIGHBOR_STR |
| 2227 | NEIGHBOR_ADDR_STR2 |
| 2228 | "Send Community attribute to this neighbor\n" |
| 2229 | "Send Standard and Extended Community attributes\n" |
| 2230 | "Send Extended Community attributes\n" |
| 2231 | "Send Standard Community attributes\n") |
| 2232 | { |
| 2233 | if (strncmp (argv[1], "s", 1) == 0) |
| 2234 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2235 | bgp_node_safi (vty), |
| 2236 | PEER_FLAG_SEND_COMMUNITY); |
| 2237 | if (strncmp (argv[1], "e", 1) == 0) |
| 2238 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2239 | bgp_node_safi (vty), |
| 2240 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 2241 | |
| 2242 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2243 | bgp_node_safi (vty), |
| 2244 | (PEER_FLAG_SEND_COMMUNITY | |
| 2245 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 2246 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2247 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2248 | /* neighbor soft-reconfig. */ |
| 2249 | DEFUN (neighbor_soft_reconfiguration, |
| 2250 | neighbor_soft_reconfiguration_cmd, |
| 2251 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 2252 | NEIGHBOR_STR |
| 2253 | NEIGHBOR_ADDR_STR2 |
| 2254 | "Per neighbor soft reconfiguration\n" |
| 2255 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 2256 | { |
| 2257 | return peer_af_flag_set_vty (vty, argv[0], |
| 2258 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 2259 | PEER_FLAG_SOFT_RECONFIG); |
| 2260 | } |
| 2261 | |
| 2262 | DEFUN (no_neighbor_soft_reconfiguration, |
| 2263 | no_neighbor_soft_reconfiguration_cmd, |
| 2264 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 2265 | NO_STR |
| 2266 | NEIGHBOR_STR |
| 2267 | NEIGHBOR_ADDR_STR2 |
| 2268 | "Per neighbor soft reconfiguration\n" |
| 2269 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 2270 | { |
| 2271 | return peer_af_flag_unset_vty (vty, argv[0], |
| 2272 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 2273 | PEER_FLAG_SOFT_RECONFIG); |
| 2274 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2275 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2276 | DEFUN (neighbor_route_reflector_client, |
| 2277 | neighbor_route_reflector_client_cmd, |
| 2278 | NEIGHBOR_CMD2 "route-reflector-client", |
| 2279 | NEIGHBOR_STR |
| 2280 | NEIGHBOR_ADDR_STR2 |
| 2281 | "Configure a neighbor as Route Reflector client\n") |
| 2282 | { |
| 2283 | struct peer *peer; |
| 2284 | |
| 2285 | |
| 2286 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2287 | if (! peer) |
| 2288 | return CMD_WARNING; |
| 2289 | |
| 2290 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2291 | bgp_node_safi (vty), |
| 2292 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2293 | } |
| 2294 | |
| 2295 | DEFUN (no_neighbor_route_reflector_client, |
| 2296 | no_neighbor_route_reflector_client_cmd, |
| 2297 | NO_NEIGHBOR_CMD2 "route-reflector-client", |
| 2298 | NO_STR |
| 2299 | NEIGHBOR_STR |
| 2300 | NEIGHBOR_ADDR_STR2 |
| 2301 | "Configure a neighbor as Route Reflector client\n") |
| 2302 | { |
| 2303 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2304 | bgp_node_safi (vty), |
| 2305 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2306 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2307 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2308 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2309 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
| 2310 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2311 | { |
| 2312 | int ret; |
| 2313 | struct bgp *bgp; |
| 2314 | struct peer *peer; |
| 2315 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2316 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2317 | struct bgp_filter *pfilter; |
| 2318 | struct bgp_filter *gfilter; |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2319 | int locked_and_added = 0; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2320 | |
| 2321 | bgp = vty->index; |
| 2322 | |
| 2323 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2324 | if ( ! peer ) |
| 2325 | return CMD_WARNING; |
| 2326 | |
| 2327 | /* If it is already a RS-Client, don't do anything. */ |
| 2328 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2329 | return CMD_SUCCESS; |
| 2330 | |
| 2331 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2332 | { |
| 2333 | peer = peer_lock (peer); /* rsclient peer list reference */ |
| 2334 | listnode_add_sort (bgp->rsclient, peer); |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2335 | locked_and_added = 1; |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2336 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2337 | |
| 2338 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2339 | if (ret < 0) |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2340 | { |
| 2341 | if (locked_and_added) |
| 2342 | { |
| 2343 | listnode_delete (bgp->rsclient, peer); |
| 2344 | peer_unlock (peer); /* rsclient peer list reference */ |
| 2345 | } |
| 2346 | |
| 2347 | return bgp_vty_return (vty, ret); |
| 2348 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2349 | |
Paul Jakma | 64e580a | 2006-02-21 01:09:01 +0000 | [diff] [blame] | 2350 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2351 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2352 | /* RIB peer reference. Released when table is free'd in bgp_table_free. */ |
| 2353 | peer->rib[afi][safi]->owner = peer_lock (peer); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2354 | |
| 2355 | /* Check for existing 'network' and 'redistribute' routes. */ |
| 2356 | bgp_check_local_routes_rsclient (peer, afi, safi); |
| 2357 | |
| 2358 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ |
| 2359 | bgp_soft_reconfig_rsclient (peer, afi, safi); |
| 2360 | |
| 2361 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2362 | { |
| 2363 | group = peer->group; |
| 2364 | gfilter = &peer->filter[afi][safi]; |
| 2365 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2366 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2367 | { |
| 2368 | pfilter = &peer->filter[afi][safi]; |
| 2369 | |
| 2370 | /* Members of a non-RS-Client group should not be RS-Clients, as that |
| 2371 | is checked when the become part of the peer-group */ |
| 2372 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2373 | if (ret < 0) |
| 2374 | return bgp_vty_return (vty, ret); |
| 2375 | |
| 2376 | /* Make peer's RIB point to group's RIB. */ |
| 2377 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; |
| 2378 | |
| 2379 | /* Import policy. */ |
| 2380 | if (pfilter->map[RMAP_IMPORT].name) |
| 2381 | free (pfilter->map[RMAP_IMPORT].name); |
| 2382 | if (gfilter->map[RMAP_IMPORT].name) |
| 2383 | { |
| 2384 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); |
| 2385 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; |
| 2386 | } |
| 2387 | else |
| 2388 | { |
| 2389 | pfilter->map[RMAP_IMPORT].name = NULL; |
| 2390 | pfilter->map[RMAP_IMPORT].map =NULL; |
| 2391 | } |
| 2392 | |
| 2393 | /* Export policy. */ |
| 2394 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) |
| 2395 | { |
| 2396 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); |
| 2397 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; |
| 2398 | } |
| 2399 | } |
| 2400 | } |
| 2401 | return CMD_SUCCESS; |
| 2402 | } |
| 2403 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2404 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2405 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
| 2406 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2407 | { |
| 2408 | int ret; |
| 2409 | struct bgp *bgp; |
| 2410 | struct peer *peer; |
| 2411 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2412 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2413 | |
| 2414 | bgp = vty->index; |
| 2415 | |
| 2416 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2417 | if ( ! peer ) |
| 2418 | return CMD_WARNING; |
| 2419 | |
| 2420 | /* If it is not a RS-Client, don't do anything. */ |
| 2421 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2422 | return CMD_SUCCESS; |
| 2423 | |
| 2424 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2425 | { |
| 2426 | group = peer->group; |
| 2427 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2428 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2429 | { |
| 2430 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2431 | if (ret < 0) |
| 2432 | return bgp_vty_return (vty, ret); |
| 2433 | |
| 2434 | peer->rib[afi][safi] = NULL; |
| 2435 | } |
| 2436 | |
| 2437 | peer = group->conf; |
| 2438 | } |
| 2439 | |
| 2440 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2441 | if (ret < 0) |
| 2442 | return bgp_vty_return (vty, ret); |
| 2443 | |
| 2444 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2445 | { |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2446 | bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2447 | listnode_delete (bgp->rsclient, peer); |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2448 | peer_unlock (peer); /* peer bgp rsclient reference */ |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2449 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2450 | |
Paul Jakma | b608d5b | 2008-07-02 02:12:07 +0000 | [diff] [blame] | 2451 | bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2452 | |
| 2453 | return CMD_SUCCESS; |
| 2454 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2455 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2456 | /* neighbor route-server-client. */ |
| 2457 | DEFUN (neighbor_route_server_client, |
| 2458 | neighbor_route_server_client_cmd, |
| 2459 | NEIGHBOR_CMD2 "route-server-client", |
| 2460 | NEIGHBOR_STR |
| 2461 | NEIGHBOR_ADDR_STR2 |
| 2462 | "Configure a neighbor as Route Server client\n") |
| 2463 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2464 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
| 2465 | bgp_node_safi(vty)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2466 | } |
| 2467 | |
| 2468 | DEFUN (no_neighbor_route_server_client, |
| 2469 | no_neighbor_route_server_client_cmd, |
| 2470 | NO_NEIGHBOR_CMD2 "route-server-client", |
| 2471 | NO_STR |
| 2472 | NEIGHBOR_STR |
| 2473 | NEIGHBOR_ADDR_STR2 |
| 2474 | "Configure a neighbor as Route Server client\n") |
| 2475 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2476 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), |
| 2477 | bgp_node_safi(vty)); |
| 2478 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2479 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2480 | DEFUN (neighbor_nexthop_local_unchanged, |
| 2481 | neighbor_nexthop_local_unchanged_cmd, |
| 2482 | NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2483 | NEIGHBOR_STR |
| 2484 | NEIGHBOR_ADDR_STR2 |
| 2485 | "Configure treatment of outgoing link-local nexthop attribute\n" |
| 2486 | "Leave link-local nexthop unchanged for this peer\n") |
| 2487 | { |
| 2488 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2489 | bgp_node_safi (vty), |
| 2490 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
| 2491 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2492 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2493 | DEFUN (no_neighbor_nexthop_local_unchanged, |
| 2494 | no_neighbor_nexthop_local_unchanged_cmd, |
| 2495 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2496 | NO_STR |
| 2497 | NEIGHBOR_STR |
| 2498 | NEIGHBOR_ADDR_STR2 |
| 2499 | "Configure treatment of outgoing link-local-nexthop attribute\n" |
| 2500 | "Leave link-local nexthop unchanged for this peer\n") |
| 2501 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2502 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2503 | bgp_node_safi (vty), |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2504 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2505 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2506 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2507 | DEFUN (neighbor_attr_unchanged, |
| 2508 | neighbor_attr_unchanged_cmd, |
| 2509 | NEIGHBOR_CMD2 "attribute-unchanged", |
| 2510 | NEIGHBOR_STR |
| 2511 | NEIGHBOR_ADDR_STR2 |
| 2512 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2513 | { |
| 2514 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2515 | bgp_node_safi (vty), |
| 2516 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2517 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2518 | PEER_FLAG_MED_UNCHANGED)); |
| 2519 | } |
| 2520 | |
| 2521 | DEFUN (neighbor_attr_unchanged1, |
| 2522 | neighbor_attr_unchanged1_cmd, |
| 2523 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2524 | NEIGHBOR_STR |
| 2525 | NEIGHBOR_ADDR_STR2 |
| 2526 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2527 | "As-path attribute\n" |
| 2528 | "Nexthop attribute\n" |
| 2529 | "Med attribute\n") |
| 2530 | { |
| 2531 | u_int16_t flags = 0; |
| 2532 | |
| 2533 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2534 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2535 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2536 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2537 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2538 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2539 | |
| 2540 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2541 | bgp_node_safi (vty), flags); |
| 2542 | } |
| 2543 | |
| 2544 | DEFUN (neighbor_attr_unchanged2, |
| 2545 | neighbor_attr_unchanged2_cmd, |
| 2546 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2547 | NEIGHBOR_STR |
| 2548 | NEIGHBOR_ADDR_STR2 |
| 2549 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2550 | "As-path attribute\n" |
| 2551 | "Nexthop attribute\n" |
| 2552 | "Med attribute\n") |
| 2553 | { |
| 2554 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2555 | |
| 2556 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2557 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2558 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2559 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2560 | |
| 2561 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2562 | bgp_node_safi (vty), flags); |
| 2563 | |
| 2564 | } |
| 2565 | |
| 2566 | DEFUN (neighbor_attr_unchanged3, |
| 2567 | neighbor_attr_unchanged3_cmd, |
| 2568 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2569 | NEIGHBOR_STR |
| 2570 | NEIGHBOR_ADDR_STR2 |
| 2571 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2572 | "Nexthop attribute\n" |
| 2573 | "As-path attribute\n" |
| 2574 | "Med attribute\n") |
| 2575 | { |
| 2576 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2577 | |
| 2578 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2579 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2580 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2581 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2582 | |
| 2583 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2584 | bgp_node_safi (vty), flags); |
| 2585 | } |
| 2586 | |
| 2587 | DEFUN (neighbor_attr_unchanged4, |
| 2588 | neighbor_attr_unchanged4_cmd, |
| 2589 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2590 | NEIGHBOR_STR |
| 2591 | NEIGHBOR_ADDR_STR2 |
| 2592 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2593 | "Med attribute\n" |
| 2594 | "As-path attribute\n" |
| 2595 | "Nexthop attribute\n") |
| 2596 | { |
| 2597 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2598 | |
| 2599 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2600 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2601 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2602 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2603 | |
| 2604 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2605 | bgp_node_safi (vty), flags); |
| 2606 | } |
| 2607 | |
| 2608 | ALIAS (neighbor_attr_unchanged, |
| 2609 | neighbor_attr_unchanged5_cmd, |
| 2610 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2611 | NEIGHBOR_STR |
| 2612 | NEIGHBOR_ADDR_STR2 |
| 2613 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2614 | "As-path attribute\n" |
| 2615 | "Nexthop attribute\n" |
| 2616 | "Med attribute\n") |
| 2617 | |
| 2618 | ALIAS (neighbor_attr_unchanged, |
| 2619 | neighbor_attr_unchanged6_cmd, |
| 2620 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2621 | NEIGHBOR_STR |
| 2622 | NEIGHBOR_ADDR_STR2 |
| 2623 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2624 | "As-path attribute\n" |
| 2625 | "Med attribute\n" |
| 2626 | "Nexthop attribute\n") |
| 2627 | |
| 2628 | ALIAS (neighbor_attr_unchanged, |
| 2629 | neighbor_attr_unchanged7_cmd, |
| 2630 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2631 | NEIGHBOR_STR |
| 2632 | NEIGHBOR_ADDR_STR2 |
| 2633 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2634 | "Nexthop attribute\n" |
| 2635 | "Med attribute\n" |
| 2636 | "As-path attribute\n") |
| 2637 | |
| 2638 | ALIAS (neighbor_attr_unchanged, |
| 2639 | neighbor_attr_unchanged8_cmd, |
| 2640 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 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 | ALIAS (neighbor_attr_unchanged, |
| 2649 | neighbor_attr_unchanged9_cmd, |
| 2650 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2651 | NEIGHBOR_STR |
| 2652 | NEIGHBOR_ADDR_STR2 |
| 2653 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2654 | "Med attribute\n" |
| 2655 | "Nexthop attribute\n" |
| 2656 | "As-path attribute\n") |
| 2657 | |
| 2658 | ALIAS (neighbor_attr_unchanged, |
| 2659 | neighbor_attr_unchanged10_cmd, |
| 2660 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2661 | NEIGHBOR_STR |
| 2662 | NEIGHBOR_ADDR_STR2 |
| 2663 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2664 | "Med attribute\n" |
| 2665 | "As-path attribute\n" |
| 2666 | "Nexthop attribute\n") |
| 2667 | |
| 2668 | DEFUN (no_neighbor_attr_unchanged, |
| 2669 | no_neighbor_attr_unchanged_cmd, |
| 2670 | NO_NEIGHBOR_CMD2 "attribute-unchanged", |
| 2671 | NO_STR |
| 2672 | NEIGHBOR_STR |
| 2673 | NEIGHBOR_ADDR_STR2 |
| 2674 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2675 | { |
| 2676 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2677 | bgp_node_safi (vty), |
| 2678 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2679 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2680 | PEER_FLAG_MED_UNCHANGED)); |
| 2681 | } |
| 2682 | |
| 2683 | DEFUN (no_neighbor_attr_unchanged1, |
| 2684 | no_neighbor_attr_unchanged1_cmd, |
| 2685 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2686 | NO_STR |
| 2687 | NEIGHBOR_STR |
| 2688 | NEIGHBOR_ADDR_STR2 |
| 2689 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2690 | "As-path attribute\n" |
| 2691 | "Nexthop attribute\n" |
| 2692 | "Med attribute\n") |
| 2693 | { |
| 2694 | u_int16_t flags = 0; |
| 2695 | |
| 2696 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2697 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2698 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2699 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2700 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2701 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2702 | |
| 2703 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2704 | bgp_node_safi (vty), flags); |
| 2705 | } |
| 2706 | |
| 2707 | DEFUN (no_neighbor_attr_unchanged2, |
| 2708 | no_neighbor_attr_unchanged2_cmd, |
| 2709 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2710 | NO_STR |
| 2711 | NEIGHBOR_STR |
| 2712 | NEIGHBOR_ADDR_STR2 |
| 2713 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2714 | "As-path attribute\n" |
| 2715 | "Nexthop attribute\n" |
| 2716 | "Med attribute\n") |
| 2717 | { |
| 2718 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2719 | |
| 2720 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2721 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2722 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2723 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2724 | |
| 2725 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2726 | bgp_node_safi (vty), flags); |
| 2727 | } |
| 2728 | |
| 2729 | DEFUN (no_neighbor_attr_unchanged3, |
| 2730 | no_neighbor_attr_unchanged3_cmd, |
| 2731 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2732 | NO_STR |
| 2733 | NEIGHBOR_STR |
| 2734 | NEIGHBOR_ADDR_STR2 |
| 2735 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2736 | "Nexthop attribute\n" |
| 2737 | "As-path attribute\n" |
| 2738 | "Med attribute\n") |
| 2739 | { |
| 2740 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2741 | |
| 2742 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2743 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2744 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2745 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2746 | |
| 2747 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2748 | bgp_node_safi (vty), flags); |
| 2749 | } |
| 2750 | |
| 2751 | DEFUN (no_neighbor_attr_unchanged4, |
| 2752 | no_neighbor_attr_unchanged4_cmd, |
| 2753 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2754 | NO_STR |
| 2755 | NEIGHBOR_STR |
| 2756 | NEIGHBOR_ADDR_STR2 |
| 2757 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2758 | "Med attribute\n" |
| 2759 | "As-path attribute\n" |
| 2760 | "Nexthop attribute\n") |
| 2761 | { |
| 2762 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2763 | |
| 2764 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2765 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2766 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2767 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2768 | |
| 2769 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2770 | bgp_node_safi (vty), flags); |
| 2771 | } |
| 2772 | |
| 2773 | ALIAS (no_neighbor_attr_unchanged, |
| 2774 | no_neighbor_attr_unchanged5_cmd, |
| 2775 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2776 | NO_STR |
| 2777 | NEIGHBOR_STR |
| 2778 | NEIGHBOR_ADDR_STR2 |
| 2779 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2780 | "As-path attribute\n" |
| 2781 | "Nexthop attribute\n" |
| 2782 | "Med attribute\n") |
| 2783 | |
| 2784 | ALIAS (no_neighbor_attr_unchanged, |
| 2785 | no_neighbor_attr_unchanged6_cmd, |
| 2786 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2787 | NO_STR |
| 2788 | NEIGHBOR_STR |
| 2789 | NEIGHBOR_ADDR_STR2 |
| 2790 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2791 | "As-path attribute\n" |
| 2792 | "Med attribute\n" |
| 2793 | "Nexthop attribute\n") |
| 2794 | |
| 2795 | ALIAS (no_neighbor_attr_unchanged, |
| 2796 | no_neighbor_attr_unchanged7_cmd, |
| 2797 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2798 | NO_STR |
| 2799 | NEIGHBOR_STR |
| 2800 | NEIGHBOR_ADDR_STR2 |
| 2801 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2802 | "Nexthop attribute\n" |
| 2803 | "Med attribute\n" |
| 2804 | "As-path attribute\n") |
| 2805 | |
| 2806 | ALIAS (no_neighbor_attr_unchanged, |
| 2807 | no_neighbor_attr_unchanged8_cmd, |
| 2808 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2809 | NO_STR |
| 2810 | NEIGHBOR_STR |
| 2811 | NEIGHBOR_ADDR_STR2 |
| 2812 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2813 | "Nexthop attribute\n" |
| 2814 | "As-path attribute\n" |
| 2815 | "Med attribute\n") |
| 2816 | |
| 2817 | ALIAS (no_neighbor_attr_unchanged, |
| 2818 | no_neighbor_attr_unchanged9_cmd, |
| 2819 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2820 | NO_STR |
| 2821 | NEIGHBOR_STR |
| 2822 | NEIGHBOR_ADDR_STR2 |
| 2823 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2824 | "Med attribute\n" |
| 2825 | "Nexthop attribute\n" |
| 2826 | "As-path attribute\n") |
| 2827 | |
| 2828 | ALIAS (no_neighbor_attr_unchanged, |
| 2829 | no_neighbor_attr_unchanged10_cmd, |
| 2830 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2831 | NO_STR |
| 2832 | NEIGHBOR_STR |
| 2833 | NEIGHBOR_ADDR_STR2 |
| 2834 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2835 | "Med attribute\n" |
| 2836 | "As-path attribute\n" |
| 2837 | "Nexthop attribute\n") |
| 2838 | |
| 2839 | /* For old version Zebra compatibility. */ |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2840 | DEFUN_DEPRECATED (neighbor_transparent_as, |
| 2841 | neighbor_transparent_as_cmd, |
| 2842 | NEIGHBOR_CMD "transparent-as", |
| 2843 | NEIGHBOR_STR |
| 2844 | NEIGHBOR_ADDR_STR |
| 2845 | "Do not append my AS number even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2846 | { |
| 2847 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2848 | bgp_node_safi (vty), |
| 2849 | PEER_FLAG_AS_PATH_UNCHANGED); |
| 2850 | } |
| 2851 | |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2852 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
| 2853 | neighbor_transparent_nexthop_cmd, |
| 2854 | NEIGHBOR_CMD "transparent-nexthop", |
| 2855 | NEIGHBOR_STR |
| 2856 | NEIGHBOR_ADDR_STR |
| 2857 | "Do not change nexthop even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2858 | { |
| 2859 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2860 | bgp_node_safi (vty), |
| 2861 | PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2862 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2863 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2864 | /* EBGP multihop configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2865 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2866 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
| 2867 | const char *ttl_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2868 | { |
| 2869 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2870 | unsigned int ttl; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2871 | |
| 2872 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2873 | if (! peer) |
| 2874 | return CMD_WARNING; |
| 2875 | |
| 2876 | if (! ttl_str) |
| 2877 | ttl = TTL_MAX; |
| 2878 | else |
| 2879 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); |
| 2880 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 2881 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2882 | } |
| 2883 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2884 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2885 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2886 | { |
| 2887 | struct peer *peer; |
| 2888 | |
| 2889 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2890 | if (! peer) |
| 2891 | return CMD_WARNING; |
| 2892 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 2893 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2894 | } |
| 2895 | |
| 2896 | /* neighbor ebgp-multihop. */ |
| 2897 | DEFUN (neighbor_ebgp_multihop, |
| 2898 | neighbor_ebgp_multihop_cmd, |
| 2899 | NEIGHBOR_CMD2 "ebgp-multihop", |
| 2900 | NEIGHBOR_STR |
| 2901 | NEIGHBOR_ADDR_STR2 |
| 2902 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2903 | { |
| 2904 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); |
| 2905 | } |
| 2906 | |
| 2907 | DEFUN (neighbor_ebgp_multihop_ttl, |
| 2908 | neighbor_ebgp_multihop_ttl_cmd, |
| 2909 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2910 | NEIGHBOR_STR |
| 2911 | NEIGHBOR_ADDR_STR2 |
| 2912 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2913 | "maximum hop count\n") |
| 2914 | { |
| 2915 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); |
| 2916 | } |
| 2917 | |
| 2918 | DEFUN (no_neighbor_ebgp_multihop, |
| 2919 | no_neighbor_ebgp_multihop_cmd, |
| 2920 | NO_NEIGHBOR_CMD2 "ebgp-multihop", |
| 2921 | NO_STR |
| 2922 | NEIGHBOR_STR |
| 2923 | NEIGHBOR_ADDR_STR2 |
| 2924 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2925 | { |
| 2926 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); |
| 2927 | } |
| 2928 | |
| 2929 | ALIAS (no_neighbor_ebgp_multihop, |
| 2930 | no_neighbor_ebgp_multihop_ttl_cmd, |
| 2931 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2932 | NO_STR |
| 2933 | NEIGHBOR_STR |
| 2934 | NEIGHBOR_ADDR_STR2 |
| 2935 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2936 | "maximum hop count\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2937 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2938 | /* disable-connected-check */ |
| 2939 | DEFUN (neighbor_disable_connected_check, |
| 2940 | neighbor_disable_connected_check_cmd, |
| 2941 | NEIGHBOR_CMD2 "disable-connected-check", |
| 2942 | NEIGHBOR_STR |
| 2943 | NEIGHBOR_ADDR_STR2 |
| 2944 | "one-hop away EBGP peer using loopback address\n") |
| 2945 | { |
| 2946 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2947 | } |
| 2948 | |
| 2949 | DEFUN (no_neighbor_disable_connected_check, |
| 2950 | no_neighbor_disable_connected_check_cmd, |
| 2951 | NO_NEIGHBOR_CMD2 "disable-connected-check", |
| 2952 | NO_STR |
| 2953 | NEIGHBOR_STR |
| 2954 | NEIGHBOR_ADDR_STR2 |
| 2955 | "one-hop away EBGP peer using loopback address\n") |
| 2956 | { |
| 2957 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2958 | } |
| 2959 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2960 | /* Enforce multihop. */ |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2961 | ALIAS (neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2962 | neighbor_enforce_multihop_cmd, |
| 2963 | NEIGHBOR_CMD2 "enforce-multihop", |
| 2964 | NEIGHBOR_STR |
| 2965 | NEIGHBOR_ADDR_STR2 |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 2966 | "Enforce EBGP neighbors perform multihop\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2967 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2968 | /* Enforce multihop. */ |
| 2969 | ALIAS (no_neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2970 | no_neighbor_enforce_multihop_cmd, |
| 2971 | NO_NEIGHBOR_CMD2 "enforce-multihop", |
| 2972 | NO_STR |
| 2973 | NEIGHBOR_STR |
| 2974 | NEIGHBOR_ADDR_STR2 |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 2975 | "Enforce EBGP neighbors perform multihop\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2976 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2977 | DEFUN (neighbor_description, |
| 2978 | neighbor_description_cmd, |
| 2979 | NEIGHBOR_CMD2 "description .LINE", |
| 2980 | NEIGHBOR_STR |
| 2981 | NEIGHBOR_ADDR_STR2 |
| 2982 | "Neighbor specific description\n" |
| 2983 | "Up to 80 characters describing this neighbor\n") |
| 2984 | { |
| 2985 | struct peer *peer; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2986 | char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2987 | |
| 2988 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2989 | if (! peer) |
| 2990 | return CMD_WARNING; |
| 2991 | |
| 2992 | if (argc == 1) |
| 2993 | return CMD_SUCCESS; |
| 2994 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2995 | str = argv_concat(argv, argc, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2996 | |
| 2997 | peer_description_set (peer, str); |
| 2998 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2999 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3000 | |
| 3001 | return CMD_SUCCESS; |
| 3002 | } |
| 3003 | |
| 3004 | DEFUN (no_neighbor_description, |
| 3005 | no_neighbor_description_cmd, |
| 3006 | NO_NEIGHBOR_CMD2 "description", |
| 3007 | NO_STR |
| 3008 | NEIGHBOR_STR |
| 3009 | NEIGHBOR_ADDR_STR2 |
| 3010 | "Neighbor specific description\n") |
| 3011 | { |
| 3012 | struct peer *peer; |
| 3013 | |
| 3014 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3015 | if (! peer) |
| 3016 | return CMD_WARNING; |
| 3017 | |
| 3018 | peer_description_unset (peer); |
| 3019 | |
| 3020 | return CMD_SUCCESS; |
| 3021 | } |
| 3022 | |
| 3023 | ALIAS (no_neighbor_description, |
| 3024 | no_neighbor_description_val_cmd, |
| 3025 | NO_NEIGHBOR_CMD2 "description .LINE", |
| 3026 | NO_STR |
| 3027 | NEIGHBOR_STR |
| 3028 | NEIGHBOR_ADDR_STR2 |
| 3029 | "Neighbor specific description\n" |
| 3030 | "Up to 80 characters describing this neighbor\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3031 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3032 | /* Neighbor update-source. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3033 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3034 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
| 3035 | const char *source_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3036 | { |
| 3037 | struct peer *peer; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3038 | |
| 3039 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 3040 | if (! peer) |
| 3041 | return CMD_WARNING; |
| 3042 | |
| 3043 | if (source_str) |
| 3044 | { |
Jorge Boncompte [DTI2] | c63b83f | 2012-04-10 16:57:24 +0200 | [diff] [blame] | 3045 | union sockunion su; |
| 3046 | int ret = str2sockunion (source_str, &su); |
| 3047 | |
| 3048 | if (ret == 0) |
| 3049 | peer_update_source_addr_set (peer, &su); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3050 | else |
| 3051 | peer_update_source_if_set (peer, source_str); |
| 3052 | } |
| 3053 | else |
| 3054 | peer_update_source_unset (peer); |
| 3055 | |
| 3056 | return CMD_SUCCESS; |
| 3057 | } |
| 3058 | |
Paul Jakma | 9a1a331 | 2009-07-27 12:27:55 +0100 | [diff] [blame] | 3059 | #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] | 3060 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
| 3061 | "IPv4 address\n" \ |
Paul Jakma | 9a1a331 | 2009-07-27 12:27:55 +0100 | [diff] [blame] | 3062 | "IPv6 address\n" \ |
| 3063 | "Interface name (requires zebra to be running)\n" |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 3064 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3065 | DEFUN (neighbor_update_source, |
| 3066 | neighbor_update_source_cmd, |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 3067 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3068 | NEIGHBOR_STR |
| 3069 | NEIGHBOR_ADDR_STR2 |
| 3070 | "Source of routing updates\n" |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 3071 | BGP_UPDATE_SOURCE_HELP_STR) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3072 | { |
| 3073 | return peer_update_source_vty (vty, argv[0], argv[1]); |
| 3074 | } |
| 3075 | |
| 3076 | DEFUN (no_neighbor_update_source, |
| 3077 | no_neighbor_update_source_cmd, |
| 3078 | NO_NEIGHBOR_CMD2 "update-source", |
| 3079 | NO_STR |
| 3080 | NEIGHBOR_STR |
| 3081 | NEIGHBOR_ADDR_STR2 |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 3082 | "Source of routing updates\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3083 | { |
| 3084 | return peer_update_source_vty (vty, argv[0], NULL); |
| 3085 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3086 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3087 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3088 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
| 3089 | afi_t afi, safi_t safi, |
| 3090 | const char *rmap, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3091 | { |
| 3092 | int ret; |
| 3093 | struct peer *peer; |
| 3094 | |
| 3095 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 3096 | if (! peer) |
| 3097 | return CMD_WARNING; |
| 3098 | |
| 3099 | if (set) |
| 3100 | ret = peer_default_originate_set (peer, afi, safi, rmap); |
| 3101 | else |
| 3102 | ret = peer_default_originate_unset (peer, afi, safi); |
| 3103 | |
| 3104 | return bgp_vty_return (vty, ret); |
| 3105 | } |
| 3106 | |
| 3107 | /* neighbor default-originate. */ |
| 3108 | DEFUN (neighbor_default_originate, |
| 3109 | neighbor_default_originate_cmd, |
| 3110 | NEIGHBOR_CMD2 "default-originate", |
| 3111 | NEIGHBOR_STR |
| 3112 | NEIGHBOR_ADDR_STR2 |
| 3113 | "Originate default route to this neighbor\n") |
| 3114 | { |
| 3115 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3116 | bgp_node_safi (vty), NULL, 1); |
| 3117 | } |
| 3118 | |
| 3119 | DEFUN (neighbor_default_originate_rmap, |
| 3120 | neighbor_default_originate_rmap_cmd, |
| 3121 | NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 3122 | NEIGHBOR_STR |
| 3123 | NEIGHBOR_ADDR_STR2 |
| 3124 | "Originate default route to this neighbor\n" |
| 3125 | "Route-map to specify criteria to originate default\n" |
| 3126 | "route-map name\n") |
| 3127 | { |
| 3128 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3129 | bgp_node_safi (vty), argv[1], 1); |
| 3130 | } |
| 3131 | |
| 3132 | DEFUN (no_neighbor_default_originate, |
| 3133 | no_neighbor_default_originate_cmd, |
| 3134 | NO_NEIGHBOR_CMD2 "default-originate", |
| 3135 | NO_STR |
| 3136 | NEIGHBOR_STR |
| 3137 | NEIGHBOR_ADDR_STR2 |
| 3138 | "Originate default route to this neighbor\n") |
| 3139 | { |
| 3140 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3141 | bgp_node_safi (vty), NULL, 0); |
| 3142 | } |
| 3143 | |
| 3144 | ALIAS (no_neighbor_default_originate, |
| 3145 | no_neighbor_default_originate_rmap_cmd, |
| 3146 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 3147 | NO_STR |
| 3148 | NEIGHBOR_STR |
| 3149 | NEIGHBOR_ADDR_STR2 |
| 3150 | "Originate default route to this neighbor\n" |
| 3151 | "Route-map to specify criteria to originate default\n" |
| 3152 | "route-map name\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3153 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3154 | /* Set neighbor's BGP port. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3155 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3156 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
| 3157 | const char *port_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3158 | { |
| 3159 | struct peer *peer; |
| 3160 | u_int16_t port; |
| 3161 | struct servent *sp; |
| 3162 | |
| 3163 | peer = peer_lookup_vty (vty, ip_str); |
| 3164 | if (! peer) |
| 3165 | return CMD_WARNING; |
| 3166 | |
| 3167 | if (! port_str) |
| 3168 | { |
| 3169 | sp = getservbyname ("bgp", "tcp"); |
| 3170 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); |
| 3171 | } |
| 3172 | else |
| 3173 | { |
| 3174 | VTY_GET_INTEGER("port", port, port_str); |
| 3175 | } |
| 3176 | |
| 3177 | peer_port_set (peer, port); |
| 3178 | |
| 3179 | return CMD_SUCCESS; |
| 3180 | } |
| 3181 | |
hasso | f418446 | 2005-02-01 20:13:16 +0000 | [diff] [blame] | 3182 | /* Set specified peer's BGP port. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3183 | DEFUN (neighbor_port, |
| 3184 | neighbor_port_cmd, |
| 3185 | NEIGHBOR_CMD "port <0-65535>", |
| 3186 | NEIGHBOR_STR |
| 3187 | NEIGHBOR_ADDR_STR |
| 3188 | "Neighbor's BGP port\n" |
| 3189 | "TCP port number\n") |
| 3190 | { |
| 3191 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); |
| 3192 | } |
| 3193 | |
| 3194 | DEFUN (no_neighbor_port, |
| 3195 | no_neighbor_port_cmd, |
| 3196 | NO_NEIGHBOR_CMD "port", |
| 3197 | NO_STR |
| 3198 | NEIGHBOR_STR |
| 3199 | NEIGHBOR_ADDR_STR |
| 3200 | "Neighbor's BGP port\n") |
| 3201 | { |
| 3202 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); |
| 3203 | } |
| 3204 | |
| 3205 | ALIAS (no_neighbor_port, |
| 3206 | no_neighbor_port_val_cmd, |
| 3207 | NO_NEIGHBOR_CMD "port <0-65535>", |
| 3208 | NO_STR |
| 3209 | NEIGHBOR_STR |
| 3210 | NEIGHBOR_ADDR_STR |
| 3211 | "Neighbor's BGP port\n" |
| 3212 | "TCP port number\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3213 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3214 | /* neighbor weight. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3215 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3216 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
| 3217 | const char *weight_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3218 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3219 | struct peer *peer; |
| 3220 | unsigned long weight; |
| 3221 | |
| 3222 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3223 | if (! peer) |
| 3224 | return CMD_WARNING; |
| 3225 | |
| 3226 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); |
| 3227 | |
Paul Jakma | 7aa9dce | 2014-09-19 14:42:23 +0100 | [diff] [blame] | 3228 | return bgp_vty_return (vty, peer_weight_set (peer, weight)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3229 | } |
| 3230 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3231 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3232 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3233 | { |
| 3234 | struct peer *peer; |
| 3235 | |
| 3236 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3237 | if (! peer) |
| 3238 | return CMD_WARNING; |
| 3239 | |
Paul Jakma | 7aa9dce | 2014-09-19 14:42:23 +0100 | [diff] [blame] | 3240 | return bgp_vty_return (vty, peer_weight_unset (peer)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3241 | } |
| 3242 | |
| 3243 | DEFUN (neighbor_weight, |
| 3244 | neighbor_weight_cmd, |
| 3245 | NEIGHBOR_CMD2 "weight <0-65535>", |
| 3246 | NEIGHBOR_STR |
| 3247 | NEIGHBOR_ADDR_STR2 |
| 3248 | "Set default weight for routes from this neighbor\n" |
| 3249 | "default weight\n") |
| 3250 | { |
| 3251 | return peer_weight_set_vty (vty, argv[0], argv[1]); |
| 3252 | } |
| 3253 | |
| 3254 | DEFUN (no_neighbor_weight, |
| 3255 | no_neighbor_weight_cmd, |
| 3256 | NO_NEIGHBOR_CMD2 "weight", |
| 3257 | NO_STR |
| 3258 | NEIGHBOR_STR |
| 3259 | NEIGHBOR_ADDR_STR2 |
| 3260 | "Set default weight for routes from this neighbor\n") |
| 3261 | { |
| 3262 | return peer_weight_unset_vty (vty, argv[0]); |
| 3263 | } |
| 3264 | |
| 3265 | ALIAS (no_neighbor_weight, |
| 3266 | no_neighbor_weight_val_cmd, |
| 3267 | NO_NEIGHBOR_CMD2 "weight <0-65535>", |
| 3268 | NO_STR |
| 3269 | NEIGHBOR_STR |
| 3270 | NEIGHBOR_ADDR_STR2 |
| 3271 | "Set default weight for routes from this neighbor\n" |
| 3272 | "default weight\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3273 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3274 | /* Override capability negotiation. */ |
| 3275 | DEFUN (neighbor_override_capability, |
| 3276 | neighbor_override_capability_cmd, |
| 3277 | NEIGHBOR_CMD2 "override-capability", |
| 3278 | NEIGHBOR_STR |
| 3279 | NEIGHBOR_ADDR_STR2 |
| 3280 | "Override capability negotiation result\n") |
| 3281 | { |
| 3282 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 3283 | } |
| 3284 | |
| 3285 | DEFUN (no_neighbor_override_capability, |
| 3286 | no_neighbor_override_capability_cmd, |
| 3287 | NO_NEIGHBOR_CMD2 "override-capability", |
| 3288 | NO_STR |
| 3289 | NEIGHBOR_STR |
| 3290 | NEIGHBOR_ADDR_STR2 |
| 3291 | "Override capability negotiation result\n") |
| 3292 | { |
| 3293 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 3294 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3295 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3296 | DEFUN (neighbor_strict_capability, |
| 3297 | neighbor_strict_capability_cmd, |
| 3298 | NEIGHBOR_CMD "strict-capability-match", |
| 3299 | NEIGHBOR_STR |
| 3300 | NEIGHBOR_ADDR_STR |
| 3301 | "Strict capability negotiation match\n") |
| 3302 | { |
| 3303 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3304 | } |
| 3305 | |
| 3306 | DEFUN (no_neighbor_strict_capability, |
| 3307 | no_neighbor_strict_capability_cmd, |
| 3308 | NO_NEIGHBOR_CMD "strict-capability-match", |
| 3309 | NO_STR |
| 3310 | NEIGHBOR_STR |
| 3311 | NEIGHBOR_ADDR_STR |
| 3312 | "Strict capability negotiation match\n") |
| 3313 | { |
| 3314 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3315 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3316 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3317 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3318 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
| 3319 | const char *keep_str, const char *hold_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3320 | { |
| 3321 | int ret; |
| 3322 | struct peer *peer; |
| 3323 | u_int32_t keepalive; |
| 3324 | u_int32_t holdtime; |
| 3325 | |
| 3326 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3327 | if (! peer) |
| 3328 | return CMD_WARNING; |
| 3329 | |
| 3330 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); |
| 3331 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); |
| 3332 | |
| 3333 | ret = peer_timers_set (peer, keepalive, holdtime); |
| 3334 | |
| 3335 | return bgp_vty_return (vty, ret); |
| 3336 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3337 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3338 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3339 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3340 | { |
| 3341 | int ret; |
| 3342 | struct peer *peer; |
| 3343 | |
| 3344 | peer = peer_lookup_vty (vty, ip_str); |
| 3345 | if (! peer) |
| 3346 | return CMD_WARNING; |
| 3347 | |
| 3348 | ret = peer_timers_unset (peer); |
| 3349 | |
| 3350 | return bgp_vty_return (vty, ret); |
| 3351 | } |
| 3352 | |
| 3353 | DEFUN (neighbor_timers, |
| 3354 | neighbor_timers_cmd, |
| 3355 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", |
| 3356 | NEIGHBOR_STR |
| 3357 | NEIGHBOR_ADDR_STR2 |
| 3358 | "BGP per neighbor timers\n" |
| 3359 | "Keepalive interval\n" |
| 3360 | "Holdtime\n") |
| 3361 | { |
| 3362 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); |
| 3363 | } |
| 3364 | |
| 3365 | DEFUN (no_neighbor_timers, |
| 3366 | no_neighbor_timers_cmd, |
| 3367 | NO_NEIGHBOR_CMD2 "timers", |
| 3368 | NO_STR |
| 3369 | NEIGHBOR_STR |
| 3370 | NEIGHBOR_ADDR_STR2 |
| 3371 | "BGP per neighbor timers\n") |
| 3372 | { |
| 3373 | return peer_timers_unset_vty (vty, argv[0]); |
| 3374 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3375 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3376 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3377 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
| 3378 | const char *time_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3379 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3380 | struct peer *peer; |
| 3381 | u_int32_t connect; |
| 3382 | |
Daniel Walton | 0d7435f | 2015-10-22 11:35:20 +0300 | [diff] [blame] | 3383 | peer = peer_and_group_lookup_vty (vty, ip_str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3384 | if (! peer) |
| 3385 | return CMD_WARNING; |
| 3386 | |
| 3387 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); |
| 3388 | |
Paul Jakma | 7aa9dce | 2014-09-19 14:42:23 +0100 | [diff] [blame] | 3389 | return bgp_vty_return (vty, peer_timers_connect_set (peer, connect)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3390 | } |
| 3391 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3392 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3393 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3394 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3395 | struct peer *peer; |
| 3396 | |
| 3397 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3398 | if (! peer) |
| 3399 | return CMD_WARNING; |
| 3400 | |
Paul Jakma | 7aa9dce | 2014-09-19 14:42:23 +0100 | [diff] [blame] | 3401 | return bgp_vty_return (vty, peer_timers_connect_unset (peer)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3402 | } |
| 3403 | |
| 3404 | DEFUN (neighbor_timers_connect, |
| 3405 | neighbor_timers_connect_cmd, |
Daniel Walton | 0d7435f | 2015-10-22 11:35:20 +0300 | [diff] [blame] | 3406 | NEIGHBOR_CMD2 "timers connect <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3407 | NEIGHBOR_STR |
Daniel Walton | 0d7435f | 2015-10-22 11:35:20 +0300 | [diff] [blame] | 3408 | NEIGHBOR_ADDR_STR2 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3409 | "BGP per neighbor timers\n" |
| 3410 | "BGP connect timer\n" |
| 3411 | "Connect timer\n") |
| 3412 | { |
| 3413 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); |
| 3414 | } |
| 3415 | |
| 3416 | DEFUN (no_neighbor_timers_connect, |
| 3417 | no_neighbor_timers_connect_cmd, |
Daniel Walton | 0d7435f | 2015-10-22 11:35:20 +0300 | [diff] [blame] | 3418 | NO_NEIGHBOR_CMD2 "timers connect", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3419 | NO_STR |
| 3420 | NEIGHBOR_STR |
Daniel Walton | 0d7435f | 2015-10-22 11:35:20 +0300 | [diff] [blame] | 3421 | NEIGHBOR_ADDR_STR2 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3422 | "BGP per neighbor timers\n" |
| 3423 | "BGP connect timer\n") |
| 3424 | { |
| 3425 | return peer_timers_connect_unset_vty (vty, argv[0]); |
| 3426 | } |
| 3427 | |
| 3428 | ALIAS (no_neighbor_timers_connect, |
| 3429 | no_neighbor_timers_connect_val_cmd, |
Daniel Walton | 0d7435f | 2015-10-22 11:35:20 +0300 | [diff] [blame] | 3430 | NO_NEIGHBOR_CMD2 "timers connect <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3431 | NO_STR |
| 3432 | NEIGHBOR_STR |
Daniel Walton | 0d7435f | 2015-10-22 11:35:20 +0300 | [diff] [blame] | 3433 | NEIGHBOR_ADDR_STR2 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3434 | "BGP per neighbor timers\n" |
| 3435 | "BGP connect timer\n" |
| 3436 | "Connect timer\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3437 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3438 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3439 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
| 3440 | const char *time_str, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3441 | { |
| 3442 | int ret; |
| 3443 | struct peer *peer; |
| 3444 | u_int32_t routeadv = 0; |
| 3445 | |
Daniel Walton | 0d7435f | 2015-10-22 11:35:20 +0300 | [diff] [blame] | 3446 | peer = peer_and_group_lookup_vty (vty, ip_str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3447 | if (! peer) |
| 3448 | return CMD_WARNING; |
| 3449 | |
| 3450 | if (time_str) |
| 3451 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); |
| 3452 | |
| 3453 | if (set) |
| 3454 | ret = peer_advertise_interval_set (peer, routeadv); |
| 3455 | else |
| 3456 | ret = peer_advertise_interval_unset (peer); |
| 3457 | |
Paul Jakma | 7aa9dce | 2014-09-19 14:42:23 +0100 | [diff] [blame] | 3458 | return bgp_vty_return (vty, ret); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3459 | } |
| 3460 | |
| 3461 | DEFUN (neighbor_advertise_interval, |
| 3462 | neighbor_advertise_interval_cmd, |
Daniel Walton | 0d7435f | 2015-10-22 11:35:20 +0300 | [diff] [blame] | 3463 | NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3464 | NEIGHBOR_STR |
Daniel Walton | 0d7435f | 2015-10-22 11:35:20 +0300 | [diff] [blame] | 3465 | NEIGHBOR_ADDR_STR2 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3466 | "Minimum interval between sending BGP routing updates\n" |
| 3467 | "time in seconds\n") |
| 3468 | { |
| 3469 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); |
| 3470 | } |
| 3471 | |
| 3472 | DEFUN (no_neighbor_advertise_interval, |
| 3473 | no_neighbor_advertise_interval_cmd, |
Daniel Walton | 0d7435f | 2015-10-22 11:35:20 +0300 | [diff] [blame] | 3474 | NO_NEIGHBOR_CMD2 "advertisement-interval", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3475 | NO_STR |
| 3476 | NEIGHBOR_STR |
Daniel Walton | 0d7435f | 2015-10-22 11:35:20 +0300 | [diff] [blame] | 3477 | NEIGHBOR_ADDR_STR2 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3478 | "Minimum interval between sending BGP routing updates\n") |
| 3479 | { |
| 3480 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); |
| 3481 | } |
| 3482 | |
| 3483 | ALIAS (no_neighbor_advertise_interval, |
| 3484 | no_neighbor_advertise_interval_val_cmd, |
Daniel Walton | 0d7435f | 2015-10-22 11:35:20 +0300 | [diff] [blame] | 3485 | NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3486 | NO_STR |
| 3487 | NEIGHBOR_STR |
Daniel Walton | 0d7435f | 2015-10-22 11:35:20 +0300 | [diff] [blame] | 3488 | NEIGHBOR_ADDR_STR2 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3489 | "Minimum interval between sending BGP routing updates\n" |
| 3490 | "time in seconds\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3491 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3492 | /* neighbor interface */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3493 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3494 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3495 | { |
| 3496 | int ret; |
| 3497 | struct peer *peer; |
| 3498 | |
| 3499 | peer = peer_lookup_vty (vty, ip_str); |
| 3500 | if (! peer) |
| 3501 | return CMD_WARNING; |
| 3502 | |
| 3503 | if (str) |
| 3504 | ret = peer_interface_set (peer, str); |
| 3505 | else |
| 3506 | ret = peer_interface_unset (peer); |
| 3507 | |
Paul Jakma | 7aa9dce | 2014-09-19 14:42:23 +0100 | [diff] [blame] | 3508 | return bgp_vty_return (vty, ret); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3509 | } |
| 3510 | |
| 3511 | DEFUN (neighbor_interface, |
| 3512 | neighbor_interface_cmd, |
| 3513 | NEIGHBOR_CMD "interface WORD", |
| 3514 | NEIGHBOR_STR |
| 3515 | NEIGHBOR_ADDR_STR |
| 3516 | "Interface\n" |
| 3517 | "Interface name\n") |
| 3518 | { |
| 3519 | return peer_interface_vty (vty, argv[0], argv[1]); |
| 3520 | } |
| 3521 | |
| 3522 | DEFUN (no_neighbor_interface, |
| 3523 | no_neighbor_interface_cmd, |
| 3524 | NO_NEIGHBOR_CMD "interface WORD", |
| 3525 | NO_STR |
| 3526 | NEIGHBOR_STR |
| 3527 | NEIGHBOR_ADDR_STR |
| 3528 | "Interface\n" |
| 3529 | "Interface name\n") |
| 3530 | { |
| 3531 | return peer_interface_vty (vty, argv[0], NULL); |
| 3532 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3533 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3534 | /* Set distribute list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3535 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3536 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
| 3537 | afi_t afi, safi_t safi, |
| 3538 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3539 | { |
| 3540 | int ret; |
| 3541 | struct peer *peer; |
| 3542 | int direct = FILTER_IN; |
| 3543 | |
| 3544 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3545 | if (! peer) |
| 3546 | return CMD_WARNING; |
| 3547 | |
| 3548 | /* Check filter direction. */ |
| 3549 | if (strncmp (direct_str, "i", 1) == 0) |
| 3550 | direct = FILTER_IN; |
| 3551 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3552 | direct = FILTER_OUT; |
| 3553 | |
| 3554 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); |
| 3555 | |
| 3556 | return bgp_vty_return (vty, ret); |
| 3557 | } |
| 3558 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3559 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3560 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3561 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3562 | { |
| 3563 | int ret; |
| 3564 | struct peer *peer; |
| 3565 | int direct = FILTER_IN; |
| 3566 | |
| 3567 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3568 | if (! peer) |
| 3569 | return CMD_WARNING; |
| 3570 | |
| 3571 | /* Check filter direction. */ |
| 3572 | if (strncmp (direct_str, "i", 1) == 0) |
| 3573 | direct = FILTER_IN; |
| 3574 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3575 | direct = FILTER_OUT; |
| 3576 | |
| 3577 | ret = peer_distribute_unset (peer, afi, safi, direct); |
| 3578 | |
| 3579 | return bgp_vty_return (vty, ret); |
| 3580 | } |
| 3581 | |
| 3582 | DEFUN (neighbor_distribute_list, |
| 3583 | neighbor_distribute_list_cmd, |
| 3584 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3585 | NEIGHBOR_STR |
| 3586 | NEIGHBOR_ADDR_STR2 |
| 3587 | "Filter updates to/from this neighbor\n" |
| 3588 | "IP access-list number\n" |
| 3589 | "IP access-list number (expanded range)\n" |
| 3590 | "IP Access-list name\n" |
| 3591 | "Filter incoming updates\n" |
| 3592 | "Filter outgoing updates\n") |
| 3593 | { |
| 3594 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3595 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3596 | } |
| 3597 | |
| 3598 | DEFUN (no_neighbor_distribute_list, |
| 3599 | no_neighbor_distribute_list_cmd, |
| 3600 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3601 | NO_STR |
| 3602 | NEIGHBOR_STR |
| 3603 | NEIGHBOR_ADDR_STR2 |
| 3604 | "Filter updates to/from this neighbor\n" |
| 3605 | "IP access-list number\n" |
| 3606 | "IP access-list number (expanded range)\n" |
| 3607 | "IP Access-list name\n" |
| 3608 | "Filter incoming updates\n" |
| 3609 | "Filter outgoing updates\n") |
| 3610 | { |
| 3611 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3612 | bgp_node_safi (vty), argv[2]); |
| 3613 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3614 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3615 | /* Set prefix list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3616 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3617 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3618 | safi_t safi, const char *name_str, |
| 3619 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3620 | { |
| 3621 | int ret; |
| 3622 | struct peer *peer; |
| 3623 | int direct = FILTER_IN; |
| 3624 | |
| 3625 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3626 | if (! peer) |
| 3627 | return CMD_WARNING; |
| 3628 | |
| 3629 | /* Check filter direction. */ |
| 3630 | if (strncmp (direct_str, "i", 1) == 0) |
| 3631 | direct = FILTER_IN; |
| 3632 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3633 | direct = FILTER_OUT; |
| 3634 | |
| 3635 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); |
| 3636 | |
| 3637 | return bgp_vty_return (vty, ret); |
| 3638 | } |
| 3639 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3640 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3641 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3642 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3643 | { |
| 3644 | int ret; |
| 3645 | struct peer *peer; |
| 3646 | int direct = FILTER_IN; |
| 3647 | |
| 3648 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3649 | if (! peer) |
| 3650 | return CMD_WARNING; |
| 3651 | |
| 3652 | /* Check filter direction. */ |
| 3653 | if (strncmp (direct_str, "i", 1) == 0) |
| 3654 | direct = FILTER_IN; |
| 3655 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3656 | direct = FILTER_OUT; |
| 3657 | |
| 3658 | ret = peer_prefix_list_unset (peer, afi, safi, direct); |
| 3659 | |
| 3660 | return bgp_vty_return (vty, ret); |
| 3661 | } |
| 3662 | |
| 3663 | DEFUN (neighbor_prefix_list, |
| 3664 | neighbor_prefix_list_cmd, |
| 3665 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3666 | NEIGHBOR_STR |
| 3667 | NEIGHBOR_ADDR_STR2 |
| 3668 | "Filter updates to/from this neighbor\n" |
| 3669 | "Name of a prefix list\n" |
| 3670 | "Filter incoming updates\n" |
| 3671 | "Filter outgoing updates\n") |
| 3672 | { |
| 3673 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3674 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3675 | } |
| 3676 | |
| 3677 | DEFUN (no_neighbor_prefix_list, |
| 3678 | no_neighbor_prefix_list_cmd, |
| 3679 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3680 | NO_STR |
| 3681 | NEIGHBOR_STR |
| 3682 | NEIGHBOR_ADDR_STR2 |
| 3683 | "Filter updates to/from this neighbor\n" |
| 3684 | "Name of a prefix list\n" |
| 3685 | "Filter incoming updates\n" |
| 3686 | "Filter outgoing updates\n") |
| 3687 | { |
| 3688 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3689 | bgp_node_safi (vty), argv[2]); |
| 3690 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3691 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3692 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3693 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
| 3694 | afi_t afi, safi_t safi, |
| 3695 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3696 | { |
| 3697 | int ret; |
| 3698 | struct peer *peer; |
| 3699 | int direct = FILTER_IN; |
| 3700 | |
| 3701 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3702 | if (! peer) |
| 3703 | return CMD_WARNING; |
| 3704 | |
| 3705 | /* Check filter direction. */ |
| 3706 | if (strncmp (direct_str, "i", 1) == 0) |
| 3707 | direct = FILTER_IN; |
| 3708 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3709 | direct = FILTER_OUT; |
| 3710 | |
| 3711 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); |
| 3712 | |
| 3713 | return bgp_vty_return (vty, ret); |
| 3714 | } |
| 3715 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3716 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3717 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
| 3718 | afi_t afi, safi_t safi, |
| 3719 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3720 | { |
| 3721 | int ret; |
| 3722 | struct peer *peer; |
| 3723 | int direct = FILTER_IN; |
| 3724 | |
| 3725 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3726 | if (! peer) |
| 3727 | return CMD_WARNING; |
| 3728 | |
| 3729 | /* Check filter direction. */ |
| 3730 | if (strncmp (direct_str, "i", 1) == 0) |
| 3731 | direct = FILTER_IN; |
| 3732 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3733 | direct = FILTER_OUT; |
| 3734 | |
| 3735 | ret = peer_aslist_unset (peer, afi, safi, direct); |
| 3736 | |
| 3737 | return bgp_vty_return (vty, ret); |
| 3738 | } |
| 3739 | |
| 3740 | DEFUN (neighbor_filter_list, |
| 3741 | neighbor_filter_list_cmd, |
| 3742 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3743 | NEIGHBOR_STR |
| 3744 | NEIGHBOR_ADDR_STR2 |
| 3745 | "Establish BGP filters\n" |
| 3746 | "AS path access-list name\n" |
| 3747 | "Filter incoming routes\n" |
| 3748 | "Filter outgoing routes\n") |
| 3749 | { |
| 3750 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3751 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3752 | } |
| 3753 | |
| 3754 | DEFUN (no_neighbor_filter_list, |
| 3755 | no_neighbor_filter_list_cmd, |
| 3756 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3757 | NO_STR |
| 3758 | NEIGHBOR_STR |
| 3759 | NEIGHBOR_ADDR_STR2 |
| 3760 | "Establish BGP filters\n" |
| 3761 | "AS path access-list name\n" |
| 3762 | "Filter incoming routes\n" |
| 3763 | "Filter outgoing routes\n") |
| 3764 | { |
| 3765 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3766 | bgp_node_safi (vty), argv[2]); |
| 3767 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3768 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3769 | /* Set route-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3770 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3771 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
| 3772 | afi_t afi, safi_t safi, |
| 3773 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3774 | { |
| 3775 | int ret; |
| 3776 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3777 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3778 | |
| 3779 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3780 | if (! peer) |
| 3781 | return CMD_WARNING; |
| 3782 | |
| 3783 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3784 | if (strncmp (direct_str, "in", 2) == 0) |
| 3785 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3786 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3787 | direct = RMAP_OUT; |
| 3788 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3789 | direct = RMAP_IMPORT; |
| 3790 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3791 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3792 | |
| 3793 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); |
| 3794 | |
| 3795 | return bgp_vty_return (vty, ret); |
| 3796 | } |
| 3797 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3798 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3799 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3800 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3801 | { |
| 3802 | int ret; |
| 3803 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3804 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3805 | |
| 3806 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3807 | if (! peer) |
| 3808 | return CMD_WARNING; |
| 3809 | |
| 3810 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3811 | if (strncmp (direct_str, "in", 2) == 0) |
| 3812 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3813 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3814 | direct = RMAP_OUT; |
| 3815 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3816 | direct = RMAP_IMPORT; |
| 3817 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3818 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3819 | |
| 3820 | ret = peer_route_map_unset (peer, afi, safi, direct); |
| 3821 | |
| 3822 | return bgp_vty_return (vty, ret); |
| 3823 | } |
| 3824 | |
| 3825 | DEFUN (neighbor_route_map, |
| 3826 | neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3827 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3828 | NEIGHBOR_STR |
| 3829 | NEIGHBOR_ADDR_STR2 |
| 3830 | "Apply route map to neighbor\n" |
| 3831 | "Name of route map\n" |
| 3832 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3833 | "Apply map to outbound routes\n" |
| 3834 | "Apply map to routes going into a Route-Server client's table\n" |
| 3835 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3836 | { |
| 3837 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3838 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3839 | } |
| 3840 | |
| 3841 | DEFUN (no_neighbor_route_map, |
| 3842 | no_neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3843 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3844 | NO_STR |
| 3845 | NEIGHBOR_STR |
| 3846 | NEIGHBOR_ADDR_STR2 |
| 3847 | "Apply route map to neighbor\n" |
| 3848 | "Name of route map\n" |
| 3849 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3850 | "Apply map to outbound routes\n" |
| 3851 | "Apply map to routes going into a Route-Server client's table\n" |
| 3852 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3853 | { |
| 3854 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3855 | bgp_node_safi (vty), argv[2]); |
| 3856 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3857 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3858 | /* Set unsuppress-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3859 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3860 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3861 | safi_t safi, const char *name_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3862 | { |
| 3863 | int ret; |
| 3864 | struct peer *peer; |
| 3865 | |
| 3866 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3867 | if (! peer) |
| 3868 | return CMD_WARNING; |
| 3869 | |
| 3870 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); |
| 3871 | |
| 3872 | return bgp_vty_return (vty, ret); |
| 3873 | } |
| 3874 | |
| 3875 | /* Unset route-map from the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3876 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3877 | 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] | 3878 | safi_t safi) |
| 3879 | { |
| 3880 | int ret; |
| 3881 | struct peer *peer; |
| 3882 | |
| 3883 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3884 | if (! peer) |
| 3885 | return CMD_WARNING; |
| 3886 | |
| 3887 | ret = peer_unsuppress_map_unset (peer, afi, safi); |
| 3888 | |
| 3889 | return bgp_vty_return (vty, ret); |
| 3890 | } |
| 3891 | |
| 3892 | DEFUN (neighbor_unsuppress_map, |
| 3893 | neighbor_unsuppress_map_cmd, |
| 3894 | NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3895 | NEIGHBOR_STR |
| 3896 | NEIGHBOR_ADDR_STR2 |
| 3897 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3898 | "Name of route map\n") |
| 3899 | { |
| 3900 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3901 | bgp_node_safi (vty), argv[1]); |
| 3902 | } |
| 3903 | |
| 3904 | DEFUN (no_neighbor_unsuppress_map, |
| 3905 | no_neighbor_unsuppress_map_cmd, |
| 3906 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3907 | NO_STR |
| 3908 | NEIGHBOR_STR |
| 3909 | NEIGHBOR_ADDR_STR2 |
| 3910 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3911 | "Name of route map\n") |
| 3912 | { |
| 3913 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3914 | bgp_node_safi (vty)); |
| 3915 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3916 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3917 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3918 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3919 | safi_t safi, const char *num_str, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3920 | const char *threshold_str, int warning, |
| 3921 | const char *restart_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3922 | { |
| 3923 | int ret; |
| 3924 | struct peer *peer; |
| 3925 | u_int32_t max; |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3926 | u_char threshold; |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3927 | u_int16_t restart; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3928 | |
| 3929 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3930 | if (! peer) |
| 3931 | return CMD_WARNING; |
| 3932 | |
Denis Ovsienko | e6ec1c3 | 2011-09-10 21:50:53 +0400 | [diff] [blame] | 3933 | VTY_GET_INTEGER ("maximum number", max, num_str); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3934 | if (threshold_str) |
| 3935 | threshold = atoi (threshold_str); |
| 3936 | else |
| 3937 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3938 | |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3939 | if (restart_str) |
| 3940 | restart = atoi (restart_str); |
| 3941 | else |
| 3942 | restart = 0; |
| 3943 | |
| 3944 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3945 | |
| 3946 | return bgp_vty_return (vty, ret); |
| 3947 | } |
| 3948 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3949 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3950 | 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] | 3951 | safi_t safi) |
| 3952 | { |
| 3953 | int ret; |
| 3954 | struct peer *peer; |
| 3955 | |
| 3956 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3957 | if (! peer) |
| 3958 | return CMD_WARNING; |
| 3959 | |
| 3960 | ret = peer_maximum_prefix_unset (peer, afi, safi); |
| 3961 | |
| 3962 | return bgp_vty_return (vty, ret); |
| 3963 | } |
| 3964 | |
| 3965 | /* Maximum number of prefix configuration. prefix count is different |
| 3966 | for each peer configuration. So this configuration can be set for |
| 3967 | each peer configuration. */ |
| 3968 | DEFUN (neighbor_maximum_prefix, |
| 3969 | neighbor_maximum_prefix_cmd, |
| 3970 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3971 | NEIGHBOR_STR |
| 3972 | NEIGHBOR_ADDR_STR2 |
| 3973 | "Maximum number of prefix accept from this peer\n" |
| 3974 | "maximum no. of prefix limit\n") |
| 3975 | { |
| 3976 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3977 | bgp_node_safi (vty), argv[1], NULL, 0, |
| 3978 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3979 | } |
| 3980 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3981 | DEFUN (neighbor_maximum_prefix_threshold, |
| 3982 | neighbor_maximum_prefix_threshold_cmd, |
| 3983 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", |
| 3984 | NEIGHBOR_STR |
| 3985 | NEIGHBOR_ADDR_STR2 |
| 3986 | "Maximum number of prefix accept from this peer\n" |
| 3987 | "maximum no. of prefix limit\n" |
| 3988 | "Threshold value (%) at which to generate a warning msg\n") |
| 3989 | { |
| 3990 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3991 | bgp_node_safi (vty), argv[1], argv[2], 0, |
| 3992 | NULL); |
| 3993 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3994 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3995 | DEFUN (neighbor_maximum_prefix_warning, |
| 3996 | neighbor_maximum_prefix_warning_cmd, |
| 3997 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 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 | "Only give warning message when limit is exceeded\n") |
| 4003 | { |
| 4004 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4005 | bgp_node_safi (vty), argv[1], NULL, 1, |
| 4006 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4007 | } |
| 4008 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 4009 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
| 4010 | neighbor_maximum_prefix_threshold_warning_cmd, |
| 4011 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 4012 | NEIGHBOR_STR |
| 4013 | NEIGHBOR_ADDR_STR2 |
| 4014 | "Maximum number of prefix accept from this peer\n" |
| 4015 | "maximum no. of prefix limit\n" |
| 4016 | "Threshold value (%) at which to generate a warning msg\n" |
| 4017 | "Only give warning message when limit is exceeded\n") |
| 4018 | { |
| 4019 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4020 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
| 4021 | } |
| 4022 | |
| 4023 | DEFUN (neighbor_maximum_prefix_restart, |
| 4024 | neighbor_maximum_prefix_restart_cmd, |
| 4025 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
| 4026 | NEIGHBOR_STR |
| 4027 | NEIGHBOR_ADDR_STR2 |
| 4028 | "Maximum number of prefix accept from this peer\n" |
| 4029 | "maximum no. of prefix limit\n" |
| 4030 | "Restart bgp connection after limit is exceeded\n" |
| 4031 | "Restart interval in minutes") |
| 4032 | { |
| 4033 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 4034 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); |
| 4035 | } |
| 4036 | |
| 4037 | DEFUN (neighbor_maximum_prefix_threshold_restart, |
| 4038 | neighbor_maximum_prefix_threshold_restart_cmd, |
| 4039 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 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") |
| 4047 | { |
| 4048 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 4049 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); |
| 4050 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 4051 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4052 | DEFUN (no_neighbor_maximum_prefix, |
| 4053 | no_neighbor_maximum_prefix_cmd, |
| 4054 | NO_NEIGHBOR_CMD2 "maximum-prefix", |
| 4055 | NO_STR |
| 4056 | NEIGHBOR_STR |
| 4057 | NEIGHBOR_ADDR_STR2 |
| 4058 | "Maximum number of prefix accept from this peer\n") |
| 4059 | { |
| 4060 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 4061 | bgp_node_safi (vty)); |
| 4062 | } |
| 4063 | |
| 4064 | ALIAS (no_neighbor_maximum_prefix, |
| 4065 | no_neighbor_maximum_prefix_val_cmd, |
| 4066 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 4067 | NO_STR |
| 4068 | NEIGHBOR_STR |
| 4069 | NEIGHBOR_ADDR_STR2 |
| 4070 | "Maximum number of prefix accept from this peer\n" |
| 4071 | "maximum no. of prefix limit\n") |
| 4072 | |
| 4073 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4074 | no_neighbor_maximum_prefix_threshold_cmd, |
| 4075 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 4076 | NO_STR |
| 4077 | NEIGHBOR_STR |
| 4078 | NEIGHBOR_ADDR_STR2 |
| 4079 | "Maximum number of prefix accept from this peer\n" |
| 4080 | "maximum no. of prefix limit\n" |
| 4081 | "Threshold value (%) at which to generate a warning msg\n") |
| 4082 | |
| 4083 | ALIAS (no_neighbor_maximum_prefix, |
| 4084 | no_neighbor_maximum_prefix_warning_cmd, |
| 4085 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 4086 | NO_STR |
| 4087 | NEIGHBOR_STR |
| 4088 | NEIGHBOR_ADDR_STR2 |
| 4089 | "Maximum number of prefix accept from this peer\n" |
| 4090 | "maximum no. of prefix limit\n" |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 4091 | "Only give warning message when limit is exceeded\n") |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4092 | |
| 4093 | ALIAS (no_neighbor_maximum_prefix, |
| 4094 | no_neighbor_maximum_prefix_threshold_warning_cmd, |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 4095 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 4096 | NO_STR |
| 4097 | NEIGHBOR_STR |
| 4098 | NEIGHBOR_ADDR_STR2 |
| 4099 | "Maximum number of prefix accept from this peer\n" |
| 4100 | "maximum no. of prefix limit\n" |
| 4101 | "Threshold value (%) at which to generate a warning msg\n" |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 4102 | "Only give warning message when limit is exceeded\n") |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 4103 | |
| 4104 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4105 | no_neighbor_maximum_prefix_restart_cmd, |
| 4106 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4107 | NO_STR |
| 4108 | NEIGHBOR_STR |
| 4109 | NEIGHBOR_ADDR_STR2 |
| 4110 | "Maximum number of prefix accept from this peer\n" |
| 4111 | "maximum no. of prefix limit\n" |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4112 | "Restart bgp connection after limit is exceeded\n" |
| 4113 | "Restart interval in minutes") |
| 4114 | |
| 4115 | ALIAS (no_neighbor_maximum_prefix, |
| 4116 | no_neighbor_maximum_prefix_threshold_restart_cmd, |
| 4117 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 4118 | NO_STR |
| 4119 | NEIGHBOR_STR |
| 4120 | NEIGHBOR_ADDR_STR2 |
| 4121 | "Maximum number of prefix accept from this peer\n" |
| 4122 | "maximum no. of prefix limit\n" |
| 4123 | "Threshold value (%) at which to generate a warning msg\n" |
| 4124 | "Restart bgp connection after limit is exceeded\n" |
| 4125 | "Restart interval in minutes") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 4126 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4127 | /* "neighbor allowas-in" */ |
| 4128 | DEFUN (neighbor_allowas_in, |
| 4129 | neighbor_allowas_in_cmd, |
| 4130 | NEIGHBOR_CMD2 "allowas-in", |
| 4131 | NEIGHBOR_STR |
| 4132 | NEIGHBOR_ADDR_STR2 |
| 4133 | "Accept as-path with my AS present in it\n") |
| 4134 | { |
| 4135 | int ret; |
| 4136 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4137 | unsigned int allow_num; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4138 | |
| 4139 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4140 | if (! peer) |
| 4141 | return CMD_WARNING; |
| 4142 | |
| 4143 | if (argc == 1) |
| 4144 | allow_num = 3; |
| 4145 | else |
| 4146 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); |
| 4147 | |
| 4148 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), |
| 4149 | allow_num); |
| 4150 | |
| 4151 | return bgp_vty_return (vty, ret); |
| 4152 | } |
| 4153 | |
| 4154 | ALIAS (neighbor_allowas_in, |
| 4155 | neighbor_allowas_in_arg_cmd, |
| 4156 | NEIGHBOR_CMD2 "allowas-in <1-10>", |
| 4157 | NEIGHBOR_STR |
| 4158 | NEIGHBOR_ADDR_STR2 |
| 4159 | "Accept as-path with my AS present in it\n" |
| 4160 | "Number of occurances of AS number\n") |
| 4161 | |
| 4162 | DEFUN (no_neighbor_allowas_in, |
| 4163 | no_neighbor_allowas_in_cmd, |
| 4164 | NO_NEIGHBOR_CMD2 "allowas-in", |
| 4165 | NO_STR |
| 4166 | NEIGHBOR_STR |
| 4167 | NEIGHBOR_ADDR_STR2 |
| 4168 | "allow local ASN appears in aspath attribute\n") |
| 4169 | { |
| 4170 | int ret; |
| 4171 | struct peer *peer; |
| 4172 | |
| 4173 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4174 | if (! peer) |
| 4175 | return CMD_WARNING; |
| 4176 | |
| 4177 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 4178 | |
| 4179 | return bgp_vty_return (vty, ret); |
| 4180 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 4181 | |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4182 | DEFUN (neighbor_ttl_security, |
| 4183 | neighbor_ttl_security_cmd, |
| 4184 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", |
| 4185 | NEIGHBOR_STR |
| 4186 | NEIGHBOR_ADDR_STR2 |
| 4187 | "Specify the maximum number of hops to the BGP peer\n") |
| 4188 | { |
| 4189 | struct peer *peer; |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 4190 | int gtsm_hops; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4191 | |
| 4192 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4193 | if (! peer) |
| 4194 | return CMD_WARNING; |
| 4195 | |
| 4196 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); |
| 4197 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 4198 | 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] | 4199 | } |
| 4200 | |
| 4201 | DEFUN (no_neighbor_ttl_security, |
| 4202 | no_neighbor_ttl_security_cmd, |
| 4203 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", |
| 4204 | NO_STR |
| 4205 | NEIGHBOR_STR |
| 4206 | NEIGHBOR_ADDR_STR2 |
| 4207 | "Specify the maximum number of hops to the BGP peer\n") |
| 4208 | { |
| 4209 | struct peer *peer; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4210 | |
| 4211 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4212 | if (! peer) |
| 4213 | return CMD_WARNING; |
| 4214 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 4215 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4216 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 4217 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4218 | /* Address family configuration. */ |
| 4219 | DEFUN (address_family_ipv4, |
| 4220 | address_family_ipv4_cmd, |
| 4221 | "address-family ipv4", |
| 4222 | "Enter Address Family command mode\n" |
| 4223 | "Address family\n") |
| 4224 | { |
| 4225 | vty->node = BGP_IPV4_NODE; |
| 4226 | return CMD_SUCCESS; |
| 4227 | } |
| 4228 | |
| 4229 | DEFUN (address_family_ipv4_safi, |
| 4230 | address_family_ipv4_safi_cmd, |
| 4231 | "address-family ipv4 (unicast|multicast)", |
| 4232 | "Enter Address Family command mode\n" |
| 4233 | "Address family\n" |
| 4234 | "Address Family modifier\n" |
| 4235 | "Address Family modifier\n") |
| 4236 | { |
| 4237 | if (strncmp (argv[0], "m", 1) == 0) |
| 4238 | vty->node = BGP_IPV4M_NODE; |
| 4239 | else |
| 4240 | vty->node = BGP_IPV4_NODE; |
| 4241 | |
| 4242 | return CMD_SUCCESS; |
| 4243 | } |
| 4244 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4245 | DEFUN (address_family_ipv6, |
| 4246 | address_family_ipv6_cmd, |
| 4247 | "address-family ipv6", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4248 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4249 | "Address family\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4250 | { |
| 4251 | vty->node = BGP_IPV6_NODE; |
| 4252 | return CMD_SUCCESS; |
| 4253 | } |
| 4254 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4255 | DEFUN (address_family_ipv6_safi, |
| 4256 | address_family_ipv6_safi_cmd, |
| 4257 | "address-family ipv6 (unicast|multicast)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4258 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4259 | "Address family\n" |
| 4260 | "Address Family modifier\n" |
| 4261 | "Address Family modifier\n") |
| 4262 | { |
| 4263 | if (strncmp (argv[0], "m", 1) == 0) |
| 4264 | vty->node = BGP_IPV6M_NODE; |
| 4265 | else |
| 4266 | vty->node = BGP_IPV6_NODE; |
| 4267 | |
| 4268 | return CMD_SUCCESS; |
| 4269 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4270 | |
| 4271 | DEFUN (address_family_vpnv4, |
| 4272 | address_family_vpnv4_cmd, |
| 4273 | "address-family vpnv4", |
| 4274 | "Enter Address Family command mode\n" |
| 4275 | "Address family\n") |
| 4276 | { |
| 4277 | vty->node = BGP_VPNV4_NODE; |
| 4278 | return CMD_SUCCESS; |
| 4279 | } |
| 4280 | |
| 4281 | ALIAS (address_family_vpnv4, |
| 4282 | address_family_vpnv4_unicast_cmd, |
| 4283 | "address-family vpnv4 unicast", |
| 4284 | "Enter Address Family command mode\n" |
| 4285 | "Address family\n" |
| 4286 | "Address Family Modifier\n") |
| 4287 | |
| 4288 | DEFUN (exit_address_family, |
| 4289 | exit_address_family_cmd, |
| 4290 | "exit-address-family", |
| 4291 | "Exit from Address Family configuration mode\n") |
| 4292 | { |
hasso | a8a80d5 | 2005-04-09 13:07:47 +0000 | [diff] [blame] | 4293 | if (vty->node == BGP_IPV4_NODE |
| 4294 | || vty->node == BGP_IPV4M_NODE |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4295 | || vty->node == BGP_VPNV4_NODE |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4296 | || vty->node == BGP_IPV6_NODE |
| 4297 | || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4298 | vty->node = BGP_NODE; |
| 4299 | return CMD_SUCCESS; |
| 4300 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 4301 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4302 | /* BGP clear sort. */ |
| 4303 | enum clear_sort |
| 4304 | { |
| 4305 | clear_all, |
| 4306 | clear_peer, |
| 4307 | clear_group, |
| 4308 | clear_external, |
| 4309 | clear_as |
| 4310 | }; |
| 4311 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4312 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4313 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
| 4314 | safi_t safi, int error) |
| 4315 | { |
| 4316 | switch (error) |
| 4317 | { |
| 4318 | case BGP_ERR_AF_UNCONFIGURED: |
| 4319 | vty_out (vty, |
| 4320 | "%%BGP: Enable %s %s address family for the neighbor %s%s", |
| 4321 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", |
| 4322 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", |
| 4323 | peer->host, VTY_NEWLINE); |
| 4324 | break; |
| 4325 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: |
| 4326 | 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); |
| 4327 | break; |
| 4328 | default: |
| 4329 | break; |
| 4330 | } |
| 4331 | } |
| 4332 | |
| 4333 | /* `clear ip bgp' functions. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4334 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4335 | 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] | 4336 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4337 | { |
| 4338 | int ret; |
| 4339 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4340 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4341 | |
| 4342 | /* Clear all neighbors. */ |
| 4343 | if (sort == clear_all) |
| 4344 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4345 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4346 | { |
| 4347 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4348 | ret = peer_clear (peer); |
| 4349 | else |
| 4350 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4351 | |
| 4352 | if (ret < 0) |
| 4353 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4354 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4355 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4356 | } |
| 4357 | |
| 4358 | /* Clear specified neighbors. */ |
| 4359 | if (sort == clear_peer) |
| 4360 | { |
| 4361 | union sockunion su; |
| 4362 | int ret; |
| 4363 | |
| 4364 | /* Make sockunion for lookup. */ |
| 4365 | ret = str2sockunion (arg, &su); |
| 4366 | if (ret < 0) |
| 4367 | { |
| 4368 | vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4369 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4370 | } |
| 4371 | peer = peer_lookup (bgp, &su); |
| 4372 | if (! peer) |
| 4373 | { |
| 4374 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4375 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4376 | } |
| 4377 | |
| 4378 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4379 | ret = peer_clear (peer); |
| 4380 | else |
| 4381 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4382 | |
| 4383 | if (ret < 0) |
| 4384 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 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 | |
| 4389 | /* Clear all peer-group members. */ |
| 4390 | if (sort == clear_group) |
| 4391 | { |
| 4392 | struct peer_group *group; |
| 4393 | |
| 4394 | group = peer_group_lookup (bgp, arg); |
| 4395 | if (! group) |
| 4396 | { |
| 4397 | 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] | 4398 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4399 | } |
| 4400 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4401 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4402 | { |
| 4403 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4404 | { |
| 4405 | ret = peer_clear (peer); |
| 4406 | continue; |
| 4407 | } |
| 4408 | |
| 4409 | if (! peer->af_group[afi][safi]) |
| 4410 | continue; |
| 4411 | |
| 4412 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4413 | |
| 4414 | if (ret < 0) |
| 4415 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4416 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4417 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4418 | } |
| 4419 | |
| 4420 | if (sort == clear_external) |
| 4421 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4422 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4423 | { |
Jorge Boncompte [DTI2] | 6d85b15 | 2012-05-07 16:52:54 +0000 | [diff] [blame] | 4424 | if (peer->sort == BGP_PEER_IBGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4425 | continue; |
| 4426 | |
| 4427 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4428 | ret = peer_clear (peer); |
| 4429 | else |
| 4430 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4431 | |
| 4432 | if (ret < 0) |
| 4433 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4434 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4435 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4436 | } |
| 4437 | |
| 4438 | if (sort == clear_as) |
| 4439 | { |
| 4440 | as_t as; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4441 | int find = 0; |
| 4442 | |
Ulrich Weber | bde12e3 | 2011-11-16 19:32:12 +0400 | [diff] [blame] | 4443 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4444 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4445 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4446 | { |
| 4447 | if (peer->as != as) |
| 4448 | continue; |
| 4449 | |
| 4450 | find = 1; |
| 4451 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4452 | ret = peer_clear (peer); |
| 4453 | else |
| 4454 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4455 | |
| 4456 | if (ret < 0) |
| 4457 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4458 | } |
| 4459 | if (! find) |
| 4460 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, |
| 4461 | VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4462 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4463 | } |
| 4464 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4465 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4466 | } |
| 4467 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4468 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4469 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
| 4470 | enum clear_sort sort, enum bgp_clear_type stype, |
| 4471 | const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4472 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4473 | struct bgp *bgp; |
| 4474 | |
| 4475 | /* BGP structure lookup. */ |
| 4476 | if (name) |
| 4477 | { |
| 4478 | bgp = bgp_lookup_by_name (name); |
| 4479 | if (bgp == NULL) |
| 4480 | { |
| 4481 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); |
| 4482 | return CMD_WARNING; |
| 4483 | } |
| 4484 | } |
| 4485 | else |
| 4486 | { |
| 4487 | bgp = bgp_get_default (); |
| 4488 | if (bgp == NULL) |
| 4489 | { |
| 4490 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); |
| 4491 | return CMD_WARNING; |
| 4492 | } |
| 4493 | } |
| 4494 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4495 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4496 | } |
| 4497 | |
| 4498 | DEFUN (clear_ip_bgp_all, |
| 4499 | clear_ip_bgp_all_cmd, |
| 4500 | "clear ip bgp *", |
| 4501 | CLEAR_STR |
| 4502 | IP_STR |
| 4503 | BGP_STR |
| 4504 | "Clear all peers\n") |
| 4505 | { |
| 4506 | if (argc == 1) |
| 4507 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4508 | |
| 4509 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4510 | } |
| 4511 | |
| 4512 | ALIAS (clear_ip_bgp_all, |
| 4513 | clear_bgp_all_cmd, |
| 4514 | "clear bgp *", |
| 4515 | CLEAR_STR |
| 4516 | BGP_STR |
| 4517 | "Clear all peers\n") |
| 4518 | |
| 4519 | ALIAS (clear_ip_bgp_all, |
| 4520 | clear_bgp_ipv6_all_cmd, |
| 4521 | "clear bgp ipv6 *", |
| 4522 | CLEAR_STR |
| 4523 | BGP_STR |
| 4524 | "Address family\n" |
| 4525 | "Clear all peers\n") |
| 4526 | |
| 4527 | ALIAS (clear_ip_bgp_all, |
| 4528 | clear_ip_bgp_instance_all_cmd, |
| 4529 | "clear ip bgp view WORD *", |
| 4530 | CLEAR_STR |
| 4531 | IP_STR |
| 4532 | BGP_STR |
| 4533 | "BGP view\n" |
| 4534 | "view name\n" |
| 4535 | "Clear all peers\n") |
| 4536 | |
| 4537 | ALIAS (clear_ip_bgp_all, |
| 4538 | clear_bgp_instance_all_cmd, |
| 4539 | "clear bgp view WORD *", |
| 4540 | CLEAR_STR |
| 4541 | BGP_STR |
| 4542 | "BGP view\n" |
| 4543 | "view name\n" |
| 4544 | "Clear all peers\n") |
| 4545 | |
| 4546 | DEFUN (clear_ip_bgp_peer, |
| 4547 | clear_ip_bgp_peer_cmd, |
| 4548 | "clear ip bgp (A.B.C.D|X:X::X:X)", |
| 4549 | CLEAR_STR |
| 4550 | IP_STR |
| 4551 | BGP_STR |
| 4552 | "BGP neighbor IP address to clear\n" |
| 4553 | "BGP IPv6 neighbor to clear\n") |
| 4554 | { |
| 4555 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4556 | } |
| 4557 | |
| 4558 | ALIAS (clear_ip_bgp_peer, |
| 4559 | clear_bgp_peer_cmd, |
| 4560 | "clear bgp (A.B.C.D|X:X::X:X)", |
| 4561 | CLEAR_STR |
| 4562 | BGP_STR |
| 4563 | "BGP neighbor address to clear\n" |
| 4564 | "BGP IPv6 neighbor to clear\n") |
| 4565 | |
| 4566 | ALIAS (clear_ip_bgp_peer, |
| 4567 | clear_bgp_ipv6_peer_cmd, |
| 4568 | "clear bgp ipv6 (A.B.C.D|X:X::X:X)", |
| 4569 | CLEAR_STR |
| 4570 | BGP_STR |
| 4571 | "Address family\n" |
| 4572 | "BGP neighbor address to clear\n" |
| 4573 | "BGP IPv6 neighbor to clear\n") |
| 4574 | |
| 4575 | DEFUN (clear_ip_bgp_peer_group, |
| 4576 | clear_ip_bgp_peer_group_cmd, |
| 4577 | "clear ip bgp peer-group WORD", |
| 4578 | CLEAR_STR |
| 4579 | IP_STR |
| 4580 | BGP_STR |
| 4581 | "Clear all members of peer-group\n" |
| 4582 | "BGP peer-group name\n") |
| 4583 | { |
| 4584 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4585 | } |
| 4586 | |
| 4587 | ALIAS (clear_ip_bgp_peer_group, |
| 4588 | clear_bgp_peer_group_cmd, |
| 4589 | "clear bgp peer-group WORD", |
| 4590 | CLEAR_STR |
| 4591 | BGP_STR |
| 4592 | "Clear all members of peer-group\n" |
| 4593 | "BGP peer-group name\n") |
| 4594 | |
| 4595 | ALIAS (clear_ip_bgp_peer_group, |
| 4596 | clear_bgp_ipv6_peer_group_cmd, |
| 4597 | "clear bgp ipv6 peer-group WORD", |
| 4598 | CLEAR_STR |
| 4599 | BGP_STR |
| 4600 | "Address family\n" |
| 4601 | "Clear all members of peer-group\n" |
| 4602 | "BGP peer-group name\n") |
| 4603 | |
| 4604 | DEFUN (clear_ip_bgp_external, |
| 4605 | clear_ip_bgp_external_cmd, |
| 4606 | "clear ip bgp external", |
| 4607 | CLEAR_STR |
| 4608 | IP_STR |
| 4609 | BGP_STR |
| 4610 | "Clear all external peers\n") |
| 4611 | { |
| 4612 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
| 4613 | } |
| 4614 | |
| 4615 | ALIAS (clear_ip_bgp_external, |
| 4616 | clear_bgp_external_cmd, |
| 4617 | "clear bgp external", |
| 4618 | CLEAR_STR |
| 4619 | BGP_STR |
| 4620 | "Clear all external peers\n") |
| 4621 | |
| 4622 | ALIAS (clear_ip_bgp_external, |
| 4623 | clear_bgp_ipv6_external_cmd, |
| 4624 | "clear bgp ipv6 external", |
| 4625 | CLEAR_STR |
| 4626 | BGP_STR |
| 4627 | "Address family\n" |
| 4628 | "Clear all external peers\n") |
| 4629 | |
| 4630 | DEFUN (clear_ip_bgp_as, |
| 4631 | clear_ip_bgp_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4632 | "clear ip bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4633 | CLEAR_STR |
| 4634 | IP_STR |
| 4635 | BGP_STR |
| 4636 | "Clear peers with the AS number\n") |
| 4637 | { |
| 4638 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4639 | } |
| 4640 | |
| 4641 | ALIAS (clear_ip_bgp_as, |
| 4642 | clear_bgp_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4643 | "clear bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4644 | CLEAR_STR |
| 4645 | BGP_STR |
| 4646 | "Clear peers with the AS number\n") |
| 4647 | |
| 4648 | ALIAS (clear_ip_bgp_as, |
| 4649 | clear_bgp_ipv6_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4650 | "clear bgp ipv6 " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4651 | CLEAR_STR |
| 4652 | BGP_STR |
| 4653 | "Address family\n" |
| 4654 | "Clear peers with the AS number\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 4655 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4656 | /* Outbound soft-reconfiguration */ |
| 4657 | DEFUN (clear_ip_bgp_all_soft_out, |
| 4658 | clear_ip_bgp_all_soft_out_cmd, |
| 4659 | "clear ip bgp * soft out", |
| 4660 | CLEAR_STR |
| 4661 | IP_STR |
| 4662 | BGP_STR |
| 4663 | "Clear all peers\n" |
| 4664 | "Soft reconfig\n" |
| 4665 | "Soft reconfig outbound update\n") |
| 4666 | { |
| 4667 | if (argc == 1) |
| 4668 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4669 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4670 | |
| 4671 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4672 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4673 | } |
| 4674 | |
| 4675 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4676 | clear_ip_bgp_all_out_cmd, |
| 4677 | "clear ip bgp * out", |
| 4678 | CLEAR_STR |
| 4679 | IP_STR |
| 4680 | BGP_STR |
| 4681 | "Clear all peers\n" |
| 4682 | "Soft reconfig outbound update\n") |
| 4683 | |
| 4684 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4685 | clear_ip_bgp_instance_all_soft_out_cmd, |
| 4686 | "clear ip bgp view WORD * soft out", |
| 4687 | CLEAR_STR |
| 4688 | IP_STR |
| 4689 | BGP_STR |
| 4690 | "BGP view\n" |
| 4691 | "view name\n" |
| 4692 | "Clear all peers\n" |
| 4693 | "Soft reconfig\n" |
| 4694 | "Soft reconfig outbound update\n") |
| 4695 | |
| 4696 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, |
| 4697 | clear_ip_bgp_all_ipv4_soft_out_cmd, |
| 4698 | "clear ip bgp * ipv4 (unicast|multicast) soft out", |
| 4699 | CLEAR_STR |
| 4700 | IP_STR |
| 4701 | BGP_STR |
| 4702 | "Clear all peers\n" |
| 4703 | "Address family\n" |
| 4704 | "Address Family modifier\n" |
| 4705 | "Address Family modifier\n" |
| 4706 | "Soft reconfig\n" |
| 4707 | "Soft reconfig outbound update\n") |
| 4708 | { |
| 4709 | if (strncmp (argv[0], "m", 1) == 0) |
| 4710 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 4711 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4712 | |
| 4713 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4714 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4715 | } |
| 4716 | |
| 4717 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, |
| 4718 | clear_ip_bgp_all_ipv4_out_cmd, |
| 4719 | "clear ip bgp * ipv4 (unicast|multicast) out", |
| 4720 | CLEAR_STR |
| 4721 | IP_STR |
| 4722 | BGP_STR |
| 4723 | "Clear all peers\n" |
| 4724 | "Address family\n" |
| 4725 | "Address Family modifier\n" |
| 4726 | "Address Family modifier\n" |
| 4727 | "Soft reconfig outbound update\n") |
| 4728 | |
| 4729 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
| 4730 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, |
| 4731 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", |
| 4732 | CLEAR_STR |
| 4733 | IP_STR |
| 4734 | BGP_STR |
| 4735 | "BGP view\n" |
| 4736 | "view name\n" |
| 4737 | "Clear all peers\n" |
| 4738 | "Address family\n" |
| 4739 | "Address Family modifier\n" |
| 4740 | "Address Family modifier\n" |
| 4741 | "Soft reconfig outbound update\n") |
| 4742 | { |
| 4743 | if (strncmp (argv[1], "m", 1) == 0) |
| 4744 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 4745 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4746 | |
| 4747 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4748 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4749 | } |
| 4750 | |
| 4751 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, |
| 4752 | clear_ip_bgp_all_vpnv4_soft_out_cmd, |
| 4753 | "clear ip bgp * vpnv4 unicast soft out", |
| 4754 | CLEAR_STR |
| 4755 | IP_STR |
| 4756 | BGP_STR |
| 4757 | "Clear all peers\n" |
| 4758 | "Address family\n" |
| 4759 | "Address Family Modifier\n" |
| 4760 | "Soft reconfig\n" |
| 4761 | "Soft reconfig outbound update\n") |
| 4762 | { |
| 4763 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 4764 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4765 | } |
| 4766 | |
| 4767 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, |
| 4768 | clear_ip_bgp_all_vpnv4_out_cmd, |
| 4769 | "clear ip bgp * vpnv4 unicast out", |
| 4770 | CLEAR_STR |
| 4771 | IP_STR |
| 4772 | BGP_STR |
| 4773 | "Clear all peers\n" |
| 4774 | "Address family\n" |
| 4775 | "Address Family Modifier\n" |
| 4776 | "Soft reconfig outbound update\n") |
| 4777 | |
| 4778 | DEFUN (clear_bgp_all_soft_out, |
| 4779 | clear_bgp_all_soft_out_cmd, |
| 4780 | "clear bgp * soft out", |
| 4781 | CLEAR_STR |
| 4782 | BGP_STR |
| 4783 | "Clear all peers\n" |
| 4784 | "Soft reconfig\n" |
| 4785 | "Soft reconfig outbound update\n") |
| 4786 | { |
| 4787 | if (argc == 1) |
| 4788 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 4789 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4790 | |
| 4791 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 4792 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4793 | } |
| 4794 | |
| 4795 | ALIAS (clear_bgp_all_soft_out, |
| 4796 | clear_bgp_instance_all_soft_out_cmd, |
| 4797 | "clear bgp view WORD * soft out", |
| 4798 | CLEAR_STR |
| 4799 | BGP_STR |
| 4800 | "BGP view\n" |
| 4801 | "view name\n" |
| 4802 | "Clear all peers\n" |
| 4803 | "Soft reconfig\n" |
| 4804 | "Soft reconfig outbound update\n") |
| 4805 | |
| 4806 | ALIAS (clear_bgp_all_soft_out, |
| 4807 | clear_bgp_all_out_cmd, |
| 4808 | "clear bgp * out", |
| 4809 | CLEAR_STR |
| 4810 | BGP_STR |
| 4811 | "Clear all peers\n" |
| 4812 | "Soft reconfig outbound update\n") |
| 4813 | |
| 4814 | ALIAS (clear_bgp_all_soft_out, |
| 4815 | clear_bgp_ipv6_all_soft_out_cmd, |
| 4816 | "clear bgp ipv6 * soft out", |
| 4817 | CLEAR_STR |
| 4818 | BGP_STR |
| 4819 | "Address family\n" |
| 4820 | "Clear all peers\n" |
| 4821 | "Soft reconfig\n" |
| 4822 | "Soft reconfig outbound update\n") |
| 4823 | |
| 4824 | ALIAS (clear_bgp_all_soft_out, |
| 4825 | clear_bgp_ipv6_all_out_cmd, |
| 4826 | "clear bgp ipv6 * out", |
| 4827 | CLEAR_STR |
| 4828 | BGP_STR |
| 4829 | "Address family\n" |
| 4830 | "Clear all peers\n" |
| 4831 | "Soft reconfig outbound update\n") |
| 4832 | |
| 4833 | DEFUN (clear_ip_bgp_peer_soft_out, |
| 4834 | clear_ip_bgp_peer_soft_out_cmd, |
| 4835 | "clear ip bgp A.B.C.D soft out", |
| 4836 | CLEAR_STR |
| 4837 | IP_STR |
| 4838 | BGP_STR |
| 4839 | "BGP neighbor address to clear\n" |
| 4840 | "Soft reconfig\n" |
| 4841 | "Soft reconfig outbound update\n") |
| 4842 | { |
| 4843 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4844 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4845 | } |
| 4846 | |
| 4847 | ALIAS (clear_ip_bgp_peer_soft_out, |
| 4848 | clear_ip_bgp_peer_out_cmd, |
| 4849 | "clear ip bgp A.B.C.D out", |
| 4850 | CLEAR_STR |
| 4851 | IP_STR |
| 4852 | BGP_STR |
| 4853 | "BGP neighbor address to clear\n" |
| 4854 | "Soft reconfig outbound update\n") |
| 4855 | |
| 4856 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
| 4857 | clear_ip_bgp_peer_ipv4_soft_out_cmd, |
| 4858 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", |
| 4859 | CLEAR_STR |
| 4860 | IP_STR |
| 4861 | BGP_STR |
| 4862 | "BGP neighbor address to clear\n" |
| 4863 | "Address family\n" |
| 4864 | "Address Family modifier\n" |
| 4865 | "Address Family modifier\n" |
| 4866 | "Soft reconfig\n" |
| 4867 | "Soft reconfig outbound update\n") |
| 4868 | { |
| 4869 | if (strncmp (argv[1], "m", 1) == 0) |
| 4870 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 4871 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4872 | |
| 4873 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4874 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4875 | } |
| 4876 | |
| 4877 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, |
| 4878 | clear_ip_bgp_peer_ipv4_out_cmd, |
| 4879 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", |
| 4880 | CLEAR_STR |
| 4881 | IP_STR |
| 4882 | BGP_STR |
| 4883 | "BGP neighbor address to clear\n" |
| 4884 | "Address family\n" |
| 4885 | "Address Family modifier\n" |
| 4886 | "Address Family modifier\n" |
| 4887 | "Soft reconfig outbound update\n") |
| 4888 | |
| 4889 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4890 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, |
| 4891 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", |
| 4892 | CLEAR_STR |
| 4893 | IP_STR |
| 4894 | BGP_STR |
| 4895 | "BGP neighbor address to clear\n" |
| 4896 | "Address family\n" |
| 4897 | "Address Family Modifier\n" |
| 4898 | "Soft reconfig\n" |
| 4899 | "Soft reconfig outbound update\n") |
| 4900 | { |
| 4901 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 4902 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4903 | } |
| 4904 | |
| 4905 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4906 | clear_ip_bgp_peer_vpnv4_out_cmd, |
| 4907 | "clear ip bgp A.B.C.D vpnv4 unicast out", |
| 4908 | CLEAR_STR |
| 4909 | IP_STR |
| 4910 | BGP_STR |
| 4911 | "BGP neighbor address to clear\n" |
| 4912 | "Address family\n" |
| 4913 | "Address Family Modifier\n" |
| 4914 | "Soft reconfig outbound update\n") |
| 4915 | |
| 4916 | DEFUN (clear_bgp_peer_soft_out, |
| 4917 | clear_bgp_peer_soft_out_cmd, |
| 4918 | "clear bgp (A.B.C.D|X:X::X:X) soft out", |
| 4919 | CLEAR_STR |
| 4920 | BGP_STR |
| 4921 | "BGP neighbor address to clear\n" |
| 4922 | "BGP IPv6 neighbor to clear\n" |
| 4923 | "Soft reconfig\n" |
| 4924 | "Soft reconfig outbound update\n") |
| 4925 | { |
| 4926 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 4927 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4928 | } |
| 4929 | |
| 4930 | ALIAS (clear_bgp_peer_soft_out, |
| 4931 | clear_bgp_ipv6_peer_soft_out_cmd, |
| 4932 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out", |
| 4933 | CLEAR_STR |
| 4934 | BGP_STR |
| 4935 | "Address family\n" |
| 4936 | "BGP neighbor address to clear\n" |
| 4937 | "BGP IPv6 neighbor to clear\n" |
| 4938 | "Soft reconfig\n" |
| 4939 | "Soft reconfig outbound update\n") |
| 4940 | |
| 4941 | ALIAS (clear_bgp_peer_soft_out, |
| 4942 | clear_bgp_peer_out_cmd, |
| 4943 | "clear bgp (A.B.C.D|X:X::X:X) out", |
| 4944 | CLEAR_STR |
| 4945 | BGP_STR |
| 4946 | "BGP neighbor address to clear\n" |
| 4947 | "BGP IPv6 neighbor to clear\n" |
| 4948 | "Soft reconfig outbound update\n") |
| 4949 | |
| 4950 | ALIAS (clear_bgp_peer_soft_out, |
| 4951 | clear_bgp_ipv6_peer_out_cmd, |
| 4952 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) out", |
| 4953 | CLEAR_STR |
| 4954 | BGP_STR |
| 4955 | "Address family\n" |
| 4956 | "BGP neighbor address to clear\n" |
| 4957 | "BGP IPv6 neighbor to clear\n" |
| 4958 | "Soft reconfig outbound update\n") |
| 4959 | |
| 4960 | DEFUN (clear_ip_bgp_peer_group_soft_out, |
| 4961 | clear_ip_bgp_peer_group_soft_out_cmd, |
| 4962 | "clear ip bgp peer-group WORD soft out", |
| 4963 | CLEAR_STR |
| 4964 | IP_STR |
| 4965 | BGP_STR |
| 4966 | "Clear all members of peer-group\n" |
| 4967 | "BGP peer-group name\n" |
| 4968 | "Soft reconfig\n" |
| 4969 | "Soft reconfig outbound update\n") |
| 4970 | { |
| 4971 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4972 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4973 | } |
| 4974 | |
| 4975 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
| 4976 | clear_ip_bgp_peer_group_out_cmd, |
| 4977 | "clear ip bgp peer-group WORD out", |
| 4978 | CLEAR_STR |
| 4979 | IP_STR |
| 4980 | BGP_STR |
| 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_peer_group_ipv4_soft_out, |
| 4986 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, |
| 4987 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", |
| 4988 | CLEAR_STR |
| 4989 | IP_STR |
| 4990 | BGP_STR |
| 4991 | "Clear all members of peer-group\n" |
| 4992 | "BGP peer-group name\n" |
| 4993 | "Address family\n" |
| 4994 | "Address Family modifier\n" |
| 4995 | "Address Family modifier\n" |
| 4996 | "Soft reconfig\n" |
| 4997 | "Soft reconfig outbound update\n") |
| 4998 | { |
| 4999 | if (strncmp (argv[1], "m", 1) == 0) |
| 5000 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5001 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5002 | |
| 5003 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5004 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5005 | } |
| 5006 | |
| 5007 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 5008 | clear_ip_bgp_peer_group_ipv4_out_cmd, |
| 5009 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", |
| 5010 | CLEAR_STR |
| 5011 | IP_STR |
| 5012 | BGP_STR |
| 5013 | "Clear all members of peer-group\n" |
| 5014 | "BGP peer-group name\n" |
| 5015 | "Address family\n" |
| 5016 | "Address Family modifier\n" |
| 5017 | "Address Family modifier\n" |
| 5018 | "Soft reconfig outbound update\n") |
| 5019 | |
| 5020 | DEFUN (clear_bgp_peer_group_soft_out, |
| 5021 | clear_bgp_peer_group_soft_out_cmd, |
| 5022 | "clear bgp peer-group WORD soft out", |
| 5023 | CLEAR_STR |
| 5024 | BGP_STR |
| 5025 | "Clear all members of peer-group\n" |
| 5026 | "BGP peer-group name\n" |
| 5027 | "Soft reconfig\n" |
| 5028 | "Soft reconfig outbound update\n") |
| 5029 | { |
| 5030 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5031 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5032 | } |
| 5033 | |
| 5034 | ALIAS (clear_bgp_peer_group_soft_out, |
| 5035 | clear_bgp_ipv6_peer_group_soft_out_cmd, |
| 5036 | "clear bgp ipv6 peer-group WORD soft out", |
| 5037 | CLEAR_STR |
| 5038 | BGP_STR |
| 5039 | "Address family\n" |
| 5040 | "Clear all members of peer-group\n" |
| 5041 | "BGP peer-group name\n" |
| 5042 | "Soft reconfig\n" |
| 5043 | "Soft reconfig outbound update\n") |
| 5044 | |
| 5045 | ALIAS (clear_bgp_peer_group_soft_out, |
| 5046 | clear_bgp_peer_group_out_cmd, |
| 5047 | "clear bgp peer-group WORD out", |
| 5048 | CLEAR_STR |
| 5049 | BGP_STR |
| 5050 | "Clear all members of peer-group\n" |
| 5051 | "BGP peer-group name\n" |
| 5052 | "Soft reconfig outbound update\n") |
| 5053 | |
| 5054 | ALIAS (clear_bgp_peer_group_soft_out, |
| 5055 | clear_bgp_ipv6_peer_group_out_cmd, |
| 5056 | "clear bgp ipv6 peer-group WORD out", |
| 5057 | CLEAR_STR |
| 5058 | BGP_STR |
| 5059 | "Address family\n" |
| 5060 | "Clear all members of peer-group\n" |
| 5061 | "BGP peer-group name\n" |
| 5062 | "Soft reconfig outbound update\n") |
| 5063 | |
| 5064 | DEFUN (clear_ip_bgp_external_soft_out, |
| 5065 | clear_ip_bgp_external_soft_out_cmd, |
| 5066 | "clear ip bgp external soft out", |
| 5067 | CLEAR_STR |
| 5068 | IP_STR |
| 5069 | BGP_STR |
| 5070 | "Clear all external peers\n" |
| 5071 | "Soft reconfig\n" |
| 5072 | "Soft reconfig outbound update\n") |
| 5073 | { |
| 5074 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5075 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5076 | } |
| 5077 | |
| 5078 | ALIAS (clear_ip_bgp_external_soft_out, |
| 5079 | clear_ip_bgp_external_out_cmd, |
| 5080 | "clear ip bgp external out", |
| 5081 | CLEAR_STR |
| 5082 | IP_STR |
| 5083 | BGP_STR |
| 5084 | "Clear all external peers\n" |
| 5085 | "Soft reconfig outbound update\n") |
| 5086 | |
| 5087 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, |
| 5088 | clear_ip_bgp_external_ipv4_soft_out_cmd, |
| 5089 | "clear ip bgp external ipv4 (unicast|multicast) soft out", |
| 5090 | CLEAR_STR |
| 5091 | IP_STR |
| 5092 | BGP_STR |
| 5093 | "Clear all external peers\n" |
| 5094 | "Address family\n" |
| 5095 | "Address Family modifier\n" |
| 5096 | "Address Family modifier\n" |
| 5097 | "Soft reconfig\n" |
| 5098 | "Soft reconfig outbound update\n") |
| 5099 | { |
| 5100 | if (strncmp (argv[0], "m", 1) == 0) |
| 5101 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5102 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5103 | |
| 5104 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5105 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5106 | } |
| 5107 | |
| 5108 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, |
| 5109 | clear_ip_bgp_external_ipv4_out_cmd, |
| 5110 | "clear ip bgp external ipv4 (unicast|multicast) out", |
| 5111 | CLEAR_STR |
| 5112 | IP_STR |
| 5113 | BGP_STR |
| 5114 | "Clear all external peers\n" |
| 5115 | "Address family\n" |
| 5116 | "Address Family modifier\n" |
| 5117 | "Address Family modifier\n" |
| 5118 | "Soft reconfig outbound update\n") |
| 5119 | |
| 5120 | DEFUN (clear_bgp_external_soft_out, |
| 5121 | clear_bgp_external_soft_out_cmd, |
| 5122 | "clear bgp external soft out", |
| 5123 | CLEAR_STR |
| 5124 | BGP_STR |
| 5125 | "Clear all external peers\n" |
| 5126 | "Soft reconfig\n" |
| 5127 | "Soft reconfig outbound update\n") |
| 5128 | { |
| 5129 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5130 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5131 | } |
| 5132 | |
| 5133 | ALIAS (clear_bgp_external_soft_out, |
| 5134 | clear_bgp_ipv6_external_soft_out_cmd, |
| 5135 | "clear bgp ipv6 external soft out", |
| 5136 | CLEAR_STR |
| 5137 | BGP_STR |
| 5138 | "Address family\n" |
| 5139 | "Clear all external peers\n" |
| 5140 | "Soft reconfig\n" |
| 5141 | "Soft reconfig outbound update\n") |
| 5142 | |
| 5143 | ALIAS (clear_bgp_external_soft_out, |
| 5144 | clear_bgp_external_out_cmd, |
| 5145 | "clear bgp external out", |
| 5146 | CLEAR_STR |
| 5147 | BGP_STR |
| 5148 | "Clear all external peers\n" |
| 5149 | "Soft reconfig outbound update\n") |
| 5150 | |
| 5151 | ALIAS (clear_bgp_external_soft_out, |
| 5152 | clear_bgp_ipv6_external_out_cmd, |
| 5153 | "clear bgp ipv6 external WORD out", |
| 5154 | CLEAR_STR |
| 5155 | BGP_STR |
| 5156 | "Address family\n" |
| 5157 | "Clear all external peers\n" |
| 5158 | "Soft reconfig outbound update\n") |
| 5159 | |
| 5160 | DEFUN (clear_ip_bgp_as_soft_out, |
| 5161 | clear_ip_bgp_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5162 | "clear ip bgp " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5163 | CLEAR_STR |
| 5164 | IP_STR |
| 5165 | BGP_STR |
| 5166 | "Clear peers with the AS number\n" |
| 5167 | "Soft reconfig\n" |
| 5168 | "Soft reconfig outbound update\n") |
| 5169 | { |
| 5170 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5171 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5172 | } |
| 5173 | |
| 5174 | ALIAS (clear_ip_bgp_as_soft_out, |
| 5175 | clear_ip_bgp_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5176 | "clear ip bgp " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5177 | CLEAR_STR |
| 5178 | IP_STR |
| 5179 | BGP_STR |
| 5180 | "Clear peers with the AS number\n" |
| 5181 | "Soft reconfig outbound update\n") |
| 5182 | |
| 5183 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
| 5184 | clear_ip_bgp_as_ipv4_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5185 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5186 | CLEAR_STR |
| 5187 | IP_STR |
| 5188 | BGP_STR |
| 5189 | "Clear peers with the AS number\n" |
| 5190 | "Address family\n" |
| 5191 | "Address Family modifier\n" |
| 5192 | "Address Family modifier\n" |
| 5193 | "Soft reconfig\n" |
| 5194 | "Soft reconfig outbound update\n") |
| 5195 | { |
| 5196 | if (strncmp (argv[1], "m", 1) == 0) |
| 5197 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5198 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5199 | |
| 5200 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5201 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5202 | } |
| 5203 | |
| 5204 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, |
| 5205 | clear_ip_bgp_as_ipv4_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5206 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5207 | CLEAR_STR |
| 5208 | IP_STR |
| 5209 | BGP_STR |
| 5210 | "Clear peers with the AS number\n" |
| 5211 | "Address family\n" |
| 5212 | "Address Family modifier\n" |
| 5213 | "Address Family modifier\n" |
| 5214 | "Soft reconfig outbound update\n") |
| 5215 | |
| 5216 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
| 5217 | clear_ip_bgp_as_vpnv4_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5218 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5219 | CLEAR_STR |
| 5220 | IP_STR |
| 5221 | BGP_STR |
| 5222 | "Clear peers with the AS number\n" |
| 5223 | "Address family\n" |
| 5224 | "Address Family modifier\n" |
| 5225 | "Soft reconfig\n" |
| 5226 | "Soft reconfig outbound update\n") |
| 5227 | { |
| 5228 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 5229 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5230 | } |
| 5231 | |
| 5232 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, |
| 5233 | clear_ip_bgp_as_vpnv4_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5234 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5235 | CLEAR_STR |
| 5236 | IP_STR |
| 5237 | BGP_STR |
| 5238 | "Clear peers with the AS number\n" |
| 5239 | "Address family\n" |
| 5240 | "Address Family modifier\n" |
| 5241 | "Soft reconfig outbound update\n") |
| 5242 | |
| 5243 | DEFUN (clear_bgp_as_soft_out, |
| 5244 | clear_bgp_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5245 | "clear bgp " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5246 | CLEAR_STR |
| 5247 | BGP_STR |
| 5248 | "Clear peers with the AS number\n" |
| 5249 | "Soft reconfig\n" |
| 5250 | "Soft reconfig outbound update\n") |
| 5251 | { |
| 5252 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5253 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5254 | } |
| 5255 | |
| 5256 | ALIAS (clear_bgp_as_soft_out, |
| 5257 | clear_bgp_ipv6_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5258 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5259 | CLEAR_STR |
| 5260 | BGP_STR |
| 5261 | "Address family\n" |
| 5262 | "Clear peers with the AS number\n" |
| 5263 | "Soft reconfig\n" |
| 5264 | "Soft reconfig outbound update\n") |
| 5265 | |
| 5266 | ALIAS (clear_bgp_as_soft_out, |
| 5267 | clear_bgp_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5268 | "clear bgp " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5269 | CLEAR_STR |
| 5270 | BGP_STR |
| 5271 | "Clear peers with the AS number\n" |
| 5272 | "Soft reconfig outbound update\n") |
| 5273 | |
| 5274 | ALIAS (clear_bgp_as_soft_out, |
| 5275 | clear_bgp_ipv6_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5276 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5277 | CLEAR_STR |
| 5278 | BGP_STR |
| 5279 | "Address family\n" |
| 5280 | "Clear peers with the AS number\n" |
| 5281 | "Soft reconfig outbound update\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 5282 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5283 | /* Inbound soft-reconfiguration */ |
| 5284 | DEFUN (clear_ip_bgp_all_soft_in, |
| 5285 | clear_ip_bgp_all_soft_in_cmd, |
| 5286 | "clear ip bgp * soft in", |
| 5287 | CLEAR_STR |
| 5288 | IP_STR |
| 5289 | BGP_STR |
| 5290 | "Clear all peers\n" |
| 5291 | "Soft reconfig\n" |
| 5292 | "Soft reconfig inbound update\n") |
| 5293 | { |
| 5294 | if (argc == 1) |
| 5295 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5296 | BGP_CLEAR_SOFT_IN, NULL); |
| 5297 | |
| 5298 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5299 | BGP_CLEAR_SOFT_IN, NULL); |
| 5300 | } |
| 5301 | |
| 5302 | ALIAS (clear_ip_bgp_all_soft_in, |
| 5303 | clear_ip_bgp_instance_all_soft_in_cmd, |
| 5304 | "clear ip bgp view WORD * soft in", |
| 5305 | CLEAR_STR |
| 5306 | IP_STR |
| 5307 | BGP_STR |
| 5308 | "BGP view\n" |
| 5309 | "view name\n" |
| 5310 | "Clear all peers\n" |
| 5311 | "Soft reconfig\n" |
| 5312 | "Soft reconfig inbound update\n") |
| 5313 | |
| 5314 | ALIAS (clear_ip_bgp_all_soft_in, |
| 5315 | clear_ip_bgp_all_in_cmd, |
| 5316 | "clear ip bgp * in", |
| 5317 | CLEAR_STR |
| 5318 | IP_STR |
| 5319 | BGP_STR |
| 5320 | "Clear all peers\n" |
| 5321 | "Soft reconfig inbound update\n") |
| 5322 | |
| 5323 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
| 5324 | clear_ip_bgp_all_in_prefix_filter_cmd, |
| 5325 | "clear ip bgp * in prefix-filter", |
| 5326 | CLEAR_STR |
| 5327 | IP_STR |
| 5328 | BGP_STR |
| 5329 | "Clear all peers\n" |
| 5330 | "Soft reconfig inbound update\n" |
| 5331 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5332 | { |
| 5333 | if (argc== 1) |
| 5334 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5335 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5336 | |
| 5337 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5338 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5339 | } |
| 5340 | |
| 5341 | ALIAS (clear_ip_bgp_all_in_prefix_filter, |
| 5342 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, |
| 5343 | "clear ip bgp view WORD * in prefix-filter", |
| 5344 | CLEAR_STR |
| 5345 | IP_STR |
| 5346 | BGP_STR |
| 5347 | "BGP view\n" |
| 5348 | "view name\n" |
| 5349 | "Clear all peers\n" |
| 5350 | "Soft reconfig inbound update\n" |
| 5351 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5352 | |
| 5353 | |
| 5354 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
| 5355 | clear_ip_bgp_all_ipv4_soft_in_cmd, |
| 5356 | "clear ip bgp * ipv4 (unicast|multicast) soft in", |
| 5357 | CLEAR_STR |
| 5358 | IP_STR |
| 5359 | BGP_STR |
| 5360 | "Clear all peers\n" |
| 5361 | "Address family\n" |
| 5362 | "Address Family modifier\n" |
| 5363 | "Address Family modifier\n" |
| 5364 | "Soft reconfig\n" |
| 5365 | "Soft reconfig inbound update\n") |
| 5366 | { |
| 5367 | if (strncmp (argv[0], "m", 1) == 0) |
| 5368 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5369 | BGP_CLEAR_SOFT_IN, NULL); |
| 5370 | |
| 5371 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5372 | BGP_CLEAR_SOFT_IN, NULL); |
| 5373 | } |
| 5374 | |
| 5375 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, |
| 5376 | clear_ip_bgp_all_ipv4_in_cmd, |
| 5377 | "clear ip bgp * ipv4 (unicast|multicast) in", |
| 5378 | CLEAR_STR |
| 5379 | IP_STR |
| 5380 | BGP_STR |
| 5381 | "Clear all peers\n" |
| 5382 | "Address family\n" |
| 5383 | "Address Family modifier\n" |
| 5384 | "Address Family modifier\n" |
| 5385 | "Soft reconfig inbound update\n") |
| 5386 | |
| 5387 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
| 5388 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, |
| 5389 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", |
| 5390 | CLEAR_STR |
| 5391 | IP_STR |
| 5392 | BGP_STR |
| 5393 | "BGP view\n" |
| 5394 | "view name\n" |
| 5395 | "Clear all peers\n" |
| 5396 | "Address family\n" |
| 5397 | "Address Family modifier\n" |
| 5398 | "Address Family modifier\n" |
| 5399 | "Soft reconfig\n" |
| 5400 | "Soft reconfig inbound update\n") |
| 5401 | { |
| 5402 | if (strncmp (argv[1], "m", 1) == 0) |
| 5403 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5404 | BGP_CLEAR_SOFT_IN, NULL); |
| 5405 | |
| 5406 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5407 | BGP_CLEAR_SOFT_IN, NULL); |
| 5408 | } |
| 5409 | |
| 5410 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
| 5411 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, |
| 5412 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", |
| 5413 | CLEAR_STR |
| 5414 | IP_STR |
| 5415 | BGP_STR |
| 5416 | "Clear all peers\n" |
| 5417 | "Address family\n" |
| 5418 | "Address Family modifier\n" |
| 5419 | "Address Family modifier\n" |
| 5420 | "Soft reconfig inbound update\n" |
| 5421 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5422 | { |
| 5423 | if (strncmp (argv[0], "m", 1) == 0) |
| 5424 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5425 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5426 | |
| 5427 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5428 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5429 | } |
| 5430 | |
| 5431 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, |
| 5432 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, |
| 5433 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", |
| 5434 | CLEAR_STR |
| 5435 | IP_STR |
| 5436 | BGP_STR |
| 5437 | "Clear all peers\n" |
| 5438 | "Address family\n" |
| 5439 | "Address Family modifier\n" |
| 5440 | "Address Family modifier\n" |
| 5441 | "Soft reconfig inbound update\n" |
| 5442 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5443 | { |
| 5444 | if (strncmp (argv[1], "m", 1) == 0) |
| 5445 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5446 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5447 | |
| 5448 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5449 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5450 | } |
| 5451 | |
| 5452 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, |
| 5453 | clear_ip_bgp_all_vpnv4_soft_in_cmd, |
| 5454 | "clear ip bgp * vpnv4 unicast soft in", |
| 5455 | CLEAR_STR |
| 5456 | IP_STR |
| 5457 | BGP_STR |
| 5458 | "Clear all peers\n" |
| 5459 | "Address family\n" |
| 5460 | "Address Family Modifier\n" |
| 5461 | "Soft reconfig\n" |
| 5462 | "Soft reconfig inbound update\n") |
| 5463 | { |
| 5464 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 5465 | BGP_CLEAR_SOFT_IN, NULL); |
| 5466 | } |
| 5467 | |
| 5468 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, |
| 5469 | clear_ip_bgp_all_vpnv4_in_cmd, |
| 5470 | "clear ip bgp * vpnv4 unicast in", |
| 5471 | CLEAR_STR |
| 5472 | IP_STR |
| 5473 | BGP_STR |
| 5474 | "Clear all peers\n" |
| 5475 | "Address family\n" |
| 5476 | "Address Family Modifier\n" |
| 5477 | "Soft reconfig inbound update\n") |
| 5478 | |
| 5479 | DEFUN (clear_bgp_all_soft_in, |
| 5480 | clear_bgp_all_soft_in_cmd, |
| 5481 | "clear bgp * soft in", |
| 5482 | CLEAR_STR |
| 5483 | BGP_STR |
| 5484 | "Clear all peers\n" |
| 5485 | "Soft reconfig\n" |
| 5486 | "Soft reconfig inbound update\n") |
| 5487 | { |
| 5488 | if (argc == 1) |
| 5489 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 5490 | BGP_CLEAR_SOFT_IN, NULL); |
| 5491 | |
| 5492 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5493 | BGP_CLEAR_SOFT_IN, NULL); |
| 5494 | } |
| 5495 | |
| 5496 | ALIAS (clear_bgp_all_soft_in, |
| 5497 | clear_bgp_instance_all_soft_in_cmd, |
| 5498 | "clear bgp view WORD * soft in", |
| 5499 | CLEAR_STR |
| 5500 | BGP_STR |
| 5501 | "BGP view\n" |
| 5502 | "view name\n" |
| 5503 | "Clear all peers\n" |
| 5504 | "Soft reconfig\n" |
| 5505 | "Soft reconfig inbound update\n") |
| 5506 | |
| 5507 | ALIAS (clear_bgp_all_soft_in, |
| 5508 | clear_bgp_ipv6_all_soft_in_cmd, |
| 5509 | "clear bgp ipv6 * soft in", |
| 5510 | CLEAR_STR |
| 5511 | BGP_STR |
| 5512 | "Address family\n" |
| 5513 | "Clear all peers\n" |
| 5514 | "Soft reconfig\n" |
| 5515 | "Soft reconfig inbound update\n") |
| 5516 | |
| 5517 | ALIAS (clear_bgp_all_soft_in, |
| 5518 | clear_bgp_all_in_cmd, |
| 5519 | "clear bgp * in", |
| 5520 | CLEAR_STR |
| 5521 | BGP_STR |
| 5522 | "Clear all peers\n" |
| 5523 | "Soft reconfig inbound update\n") |
| 5524 | |
| 5525 | ALIAS (clear_bgp_all_soft_in, |
| 5526 | clear_bgp_ipv6_all_in_cmd, |
| 5527 | "clear bgp ipv6 * in", |
| 5528 | CLEAR_STR |
| 5529 | BGP_STR |
| 5530 | "Address family\n" |
| 5531 | "Clear all peers\n" |
| 5532 | "Soft reconfig inbound update\n") |
| 5533 | |
| 5534 | DEFUN (clear_bgp_all_in_prefix_filter, |
| 5535 | clear_bgp_all_in_prefix_filter_cmd, |
| 5536 | "clear bgp * in prefix-filter", |
| 5537 | CLEAR_STR |
| 5538 | BGP_STR |
| 5539 | "Clear all peers\n" |
| 5540 | "Soft reconfig inbound update\n" |
| 5541 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5542 | { |
| 5543 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5544 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5545 | } |
| 5546 | |
| 5547 | ALIAS (clear_bgp_all_in_prefix_filter, |
| 5548 | clear_bgp_ipv6_all_in_prefix_filter_cmd, |
| 5549 | "clear bgp ipv6 * in prefix-filter", |
| 5550 | CLEAR_STR |
| 5551 | BGP_STR |
| 5552 | "Address family\n" |
| 5553 | "Clear all peers\n" |
| 5554 | "Soft reconfig inbound update\n" |
| 5555 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5556 | |
| 5557 | DEFUN (clear_ip_bgp_peer_soft_in, |
| 5558 | clear_ip_bgp_peer_soft_in_cmd, |
| 5559 | "clear ip bgp A.B.C.D soft in", |
| 5560 | CLEAR_STR |
| 5561 | IP_STR |
| 5562 | BGP_STR |
| 5563 | "BGP neighbor address to clear\n" |
| 5564 | "Soft reconfig\n" |
| 5565 | "Soft reconfig inbound update\n") |
| 5566 | { |
| 5567 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5568 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5569 | } |
| 5570 | |
| 5571 | ALIAS (clear_ip_bgp_peer_soft_in, |
| 5572 | clear_ip_bgp_peer_in_cmd, |
| 5573 | "clear ip bgp A.B.C.D in", |
| 5574 | CLEAR_STR |
| 5575 | IP_STR |
| 5576 | BGP_STR |
| 5577 | "BGP neighbor address to clear\n" |
| 5578 | "Soft reconfig inbound update\n") |
| 5579 | |
| 5580 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
| 5581 | clear_ip_bgp_peer_in_prefix_filter_cmd, |
| 5582 | "clear ip bgp A.B.C.D in prefix-filter", |
| 5583 | CLEAR_STR |
| 5584 | IP_STR |
| 5585 | BGP_STR |
| 5586 | "BGP neighbor address to clear\n" |
| 5587 | "Soft reconfig inbound update\n" |
| 5588 | "Push out the existing ORF prefix-list\n") |
| 5589 | { |
| 5590 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5591 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5592 | } |
| 5593 | |
| 5594 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, |
| 5595 | clear_ip_bgp_peer_ipv4_soft_in_cmd, |
| 5596 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", |
| 5597 | CLEAR_STR |
| 5598 | IP_STR |
| 5599 | BGP_STR |
| 5600 | "BGP neighbor address to clear\n" |
| 5601 | "Address family\n" |
| 5602 | "Address Family modifier\n" |
| 5603 | "Address Family modifier\n" |
| 5604 | "Soft reconfig\n" |
| 5605 | "Soft reconfig inbound update\n") |
| 5606 | { |
| 5607 | if (strncmp (argv[1], "m", 1) == 0) |
| 5608 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5609 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5610 | |
| 5611 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5612 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5613 | } |
| 5614 | |
| 5615 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, |
| 5616 | clear_ip_bgp_peer_ipv4_in_cmd, |
| 5617 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", |
| 5618 | CLEAR_STR |
| 5619 | IP_STR |
| 5620 | BGP_STR |
| 5621 | "BGP neighbor address to clear\n" |
| 5622 | "Address family\n" |
| 5623 | "Address Family modifier\n" |
| 5624 | "Address Family modifier\n" |
| 5625 | "Soft reconfig inbound update\n") |
| 5626 | |
| 5627 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
| 5628 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, |
| 5629 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", |
| 5630 | CLEAR_STR |
| 5631 | IP_STR |
| 5632 | BGP_STR |
| 5633 | "BGP neighbor address to clear\n" |
| 5634 | "Address family\n" |
| 5635 | "Address Family modifier\n" |
| 5636 | "Address Family modifier\n" |
| 5637 | "Soft reconfig inbound update\n" |
| 5638 | "Push out the existing ORF prefix-list\n") |
| 5639 | { |
| 5640 | if (strncmp (argv[1], "m", 1) == 0) |
| 5641 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5642 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5643 | |
| 5644 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5645 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5646 | } |
| 5647 | |
| 5648 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5649 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, |
| 5650 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", |
| 5651 | CLEAR_STR |
| 5652 | IP_STR |
| 5653 | BGP_STR |
| 5654 | "BGP neighbor address to clear\n" |
| 5655 | "Address family\n" |
| 5656 | "Address Family Modifier\n" |
| 5657 | "Soft reconfig\n" |
| 5658 | "Soft reconfig inbound update\n") |
| 5659 | { |
| 5660 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 5661 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5662 | } |
| 5663 | |
| 5664 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5665 | clear_ip_bgp_peer_vpnv4_in_cmd, |
| 5666 | "clear ip bgp A.B.C.D vpnv4 unicast in", |
| 5667 | CLEAR_STR |
| 5668 | IP_STR |
| 5669 | BGP_STR |
| 5670 | "BGP neighbor address to clear\n" |
| 5671 | "Address family\n" |
| 5672 | "Address Family Modifier\n" |
| 5673 | "Soft reconfig inbound update\n") |
| 5674 | |
| 5675 | DEFUN (clear_bgp_peer_soft_in, |
| 5676 | clear_bgp_peer_soft_in_cmd, |
| 5677 | "clear bgp (A.B.C.D|X:X::X:X) soft in", |
| 5678 | CLEAR_STR |
| 5679 | BGP_STR |
| 5680 | "BGP neighbor address to clear\n" |
| 5681 | "BGP IPv6 neighbor to clear\n" |
| 5682 | "Soft reconfig\n" |
| 5683 | "Soft reconfig inbound update\n") |
| 5684 | { |
| 5685 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5686 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5687 | } |
| 5688 | |
| 5689 | ALIAS (clear_bgp_peer_soft_in, |
| 5690 | clear_bgp_ipv6_peer_soft_in_cmd, |
| 5691 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in", |
| 5692 | CLEAR_STR |
| 5693 | BGP_STR |
| 5694 | "Address family\n" |
| 5695 | "BGP neighbor address to clear\n" |
| 5696 | "BGP IPv6 neighbor to clear\n" |
| 5697 | "Soft reconfig\n" |
| 5698 | "Soft reconfig inbound update\n") |
| 5699 | |
| 5700 | ALIAS (clear_bgp_peer_soft_in, |
| 5701 | clear_bgp_peer_in_cmd, |
| 5702 | "clear bgp (A.B.C.D|X:X::X:X) in", |
| 5703 | CLEAR_STR |
| 5704 | BGP_STR |
| 5705 | "BGP neighbor address to clear\n" |
| 5706 | "BGP IPv6 neighbor to clear\n" |
| 5707 | "Soft reconfig inbound update\n") |
| 5708 | |
| 5709 | ALIAS (clear_bgp_peer_soft_in, |
| 5710 | clear_bgp_ipv6_peer_in_cmd, |
| 5711 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in", |
| 5712 | CLEAR_STR |
| 5713 | BGP_STR |
| 5714 | "Address family\n" |
| 5715 | "BGP neighbor address to clear\n" |
| 5716 | "BGP IPv6 neighbor to clear\n" |
| 5717 | "Soft reconfig inbound update\n") |
| 5718 | |
| 5719 | DEFUN (clear_bgp_peer_in_prefix_filter, |
| 5720 | clear_bgp_peer_in_prefix_filter_cmd, |
| 5721 | "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5722 | CLEAR_STR |
| 5723 | BGP_STR |
| 5724 | "BGP neighbor address to clear\n" |
| 5725 | "BGP IPv6 neighbor to clear\n" |
| 5726 | "Soft reconfig inbound update\n" |
| 5727 | "Push out the existing ORF prefix-list\n") |
| 5728 | { |
| 5729 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5730 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5731 | } |
| 5732 | |
| 5733 | ALIAS (clear_bgp_peer_in_prefix_filter, |
| 5734 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, |
| 5735 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5736 | CLEAR_STR |
| 5737 | BGP_STR |
| 5738 | "Address family\n" |
| 5739 | "BGP neighbor address to clear\n" |
| 5740 | "BGP IPv6 neighbor to clear\n" |
| 5741 | "Soft reconfig inbound update\n" |
| 5742 | "Push out the existing ORF prefix-list\n") |
| 5743 | |
| 5744 | DEFUN (clear_ip_bgp_peer_group_soft_in, |
| 5745 | clear_ip_bgp_peer_group_soft_in_cmd, |
| 5746 | "clear ip bgp peer-group WORD soft in", |
| 5747 | CLEAR_STR |
| 5748 | IP_STR |
| 5749 | BGP_STR |
| 5750 | "Clear all members of peer-group\n" |
| 5751 | "BGP peer-group name\n" |
| 5752 | "Soft reconfig\n" |
| 5753 | "Soft reconfig inbound update\n") |
| 5754 | { |
| 5755 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5756 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5757 | } |
| 5758 | |
| 5759 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
| 5760 | clear_ip_bgp_peer_group_in_cmd, |
| 5761 | "clear ip bgp peer-group WORD in", |
| 5762 | CLEAR_STR |
| 5763 | IP_STR |
| 5764 | BGP_STR |
| 5765 | "Clear all members of peer-group\n" |
| 5766 | "BGP peer-group name\n" |
| 5767 | "Soft reconfig inbound update\n") |
| 5768 | |
| 5769 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
| 5770 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, |
| 5771 | "clear ip bgp peer-group WORD in prefix-filter", |
| 5772 | CLEAR_STR |
| 5773 | IP_STR |
| 5774 | BGP_STR |
| 5775 | "Clear all members of peer-group\n" |
| 5776 | "BGP peer-group name\n" |
| 5777 | "Soft reconfig inbound update\n" |
| 5778 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5779 | { |
| 5780 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5781 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5782 | } |
| 5783 | |
| 5784 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5785 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, |
| 5786 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", |
| 5787 | CLEAR_STR |
| 5788 | IP_STR |
| 5789 | BGP_STR |
| 5790 | "Clear all members of peer-group\n" |
| 5791 | "BGP peer-group name\n" |
| 5792 | "Address family\n" |
| 5793 | "Address Family modifier\n" |
| 5794 | "Address Family modifier\n" |
| 5795 | "Soft reconfig\n" |
| 5796 | "Soft reconfig inbound update\n") |
| 5797 | { |
| 5798 | if (strncmp (argv[1], "m", 1) == 0) |
| 5799 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5800 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5801 | |
| 5802 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5803 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5804 | } |
| 5805 | |
| 5806 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5807 | clear_ip_bgp_peer_group_ipv4_in_cmd, |
| 5808 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", |
| 5809 | CLEAR_STR |
| 5810 | IP_STR |
| 5811 | BGP_STR |
| 5812 | "Clear all members of peer-group\n" |
| 5813 | "BGP peer-group name\n" |
| 5814 | "Address family\n" |
| 5815 | "Address Family modifier\n" |
| 5816 | "Address Family modifier\n" |
| 5817 | "Soft reconfig inbound update\n") |
| 5818 | |
| 5819 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
| 5820 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, |
| 5821 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", |
| 5822 | CLEAR_STR |
| 5823 | IP_STR |
| 5824 | BGP_STR |
| 5825 | "Clear all members of peer-group\n" |
| 5826 | "BGP peer-group name\n" |
| 5827 | "Address family\n" |
| 5828 | "Address Family modifier\n" |
| 5829 | "Address Family modifier\n" |
| 5830 | "Soft reconfig inbound update\n" |
| 5831 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5832 | { |
| 5833 | if (strncmp (argv[1], "m", 1) == 0) |
| 5834 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5835 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5836 | |
| 5837 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5838 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5839 | } |
| 5840 | |
| 5841 | DEFUN (clear_bgp_peer_group_soft_in, |
| 5842 | clear_bgp_peer_group_soft_in_cmd, |
| 5843 | "clear bgp peer-group WORD soft in", |
| 5844 | CLEAR_STR |
| 5845 | BGP_STR |
| 5846 | "Clear all members of peer-group\n" |
| 5847 | "BGP peer-group name\n" |
| 5848 | "Soft reconfig\n" |
| 5849 | "Soft reconfig inbound update\n") |
| 5850 | { |
| 5851 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5852 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5853 | } |
| 5854 | |
| 5855 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5856 | clear_bgp_ipv6_peer_group_soft_in_cmd, |
| 5857 | "clear bgp ipv6 peer-group WORD soft in", |
| 5858 | CLEAR_STR |
| 5859 | BGP_STR |
| 5860 | "Address family\n" |
| 5861 | "Clear all members of peer-group\n" |
| 5862 | "BGP peer-group name\n" |
| 5863 | "Soft reconfig\n" |
| 5864 | "Soft reconfig inbound update\n") |
| 5865 | |
| 5866 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5867 | clear_bgp_peer_group_in_cmd, |
| 5868 | "clear bgp peer-group WORD in", |
| 5869 | CLEAR_STR |
| 5870 | BGP_STR |
| 5871 | "Clear all members of peer-group\n" |
| 5872 | "BGP peer-group name\n" |
| 5873 | "Soft reconfig inbound update\n") |
| 5874 | |
| 5875 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5876 | clear_bgp_ipv6_peer_group_in_cmd, |
| 5877 | "clear bgp ipv6 peer-group WORD in", |
| 5878 | CLEAR_STR |
| 5879 | BGP_STR |
| 5880 | "Address family\n" |
| 5881 | "Clear all members of peer-group\n" |
| 5882 | "BGP peer-group name\n" |
| 5883 | "Soft reconfig inbound update\n") |
| 5884 | |
| 5885 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
| 5886 | clear_bgp_peer_group_in_prefix_filter_cmd, |
| 5887 | "clear bgp peer-group WORD in prefix-filter", |
| 5888 | CLEAR_STR |
| 5889 | BGP_STR |
| 5890 | "Clear all members of peer-group\n" |
| 5891 | "BGP peer-group name\n" |
| 5892 | "Soft reconfig inbound update\n" |
| 5893 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5894 | { |
| 5895 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5896 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5897 | } |
| 5898 | |
| 5899 | ALIAS (clear_bgp_peer_group_in_prefix_filter, |
| 5900 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, |
| 5901 | "clear bgp ipv6 peer-group WORD in prefix-filter", |
| 5902 | CLEAR_STR |
| 5903 | BGP_STR |
| 5904 | "Address family\n" |
| 5905 | "Clear all members of peer-group\n" |
| 5906 | "BGP peer-group name\n" |
| 5907 | "Soft reconfig inbound update\n" |
| 5908 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5909 | |
| 5910 | DEFUN (clear_ip_bgp_external_soft_in, |
| 5911 | clear_ip_bgp_external_soft_in_cmd, |
| 5912 | "clear ip bgp external soft in", |
| 5913 | CLEAR_STR |
| 5914 | IP_STR |
| 5915 | BGP_STR |
| 5916 | "Clear all external peers\n" |
| 5917 | "Soft reconfig\n" |
| 5918 | "Soft reconfig inbound update\n") |
| 5919 | { |
| 5920 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5921 | BGP_CLEAR_SOFT_IN, NULL); |
| 5922 | } |
| 5923 | |
| 5924 | ALIAS (clear_ip_bgp_external_soft_in, |
| 5925 | clear_ip_bgp_external_in_cmd, |
| 5926 | "clear ip bgp external in", |
| 5927 | CLEAR_STR |
| 5928 | IP_STR |
| 5929 | BGP_STR |
| 5930 | "Clear all external peers\n" |
| 5931 | "Soft reconfig inbound update\n") |
| 5932 | |
| 5933 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
| 5934 | clear_ip_bgp_external_in_prefix_filter_cmd, |
| 5935 | "clear ip bgp external in prefix-filter", |
| 5936 | CLEAR_STR |
| 5937 | IP_STR |
| 5938 | BGP_STR |
| 5939 | "Clear all external peers\n" |
| 5940 | "Soft reconfig inbound update\n" |
| 5941 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5942 | { |
| 5943 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5944 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5945 | } |
| 5946 | |
| 5947 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, |
| 5948 | clear_ip_bgp_external_ipv4_soft_in_cmd, |
| 5949 | "clear ip bgp external ipv4 (unicast|multicast) soft in", |
| 5950 | CLEAR_STR |
| 5951 | IP_STR |
| 5952 | BGP_STR |
| 5953 | "Clear all external peers\n" |
| 5954 | "Address family\n" |
| 5955 | "Address Family modifier\n" |
| 5956 | "Address Family modifier\n" |
| 5957 | "Soft reconfig\n" |
| 5958 | "Soft reconfig inbound update\n") |
| 5959 | { |
| 5960 | if (strncmp (argv[0], "m", 1) == 0) |
| 5961 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5962 | BGP_CLEAR_SOFT_IN, NULL); |
| 5963 | |
| 5964 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5965 | BGP_CLEAR_SOFT_IN, NULL); |
| 5966 | } |
| 5967 | |
| 5968 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, |
| 5969 | clear_ip_bgp_external_ipv4_in_cmd, |
| 5970 | "clear ip bgp external ipv4 (unicast|multicast) in", |
| 5971 | CLEAR_STR |
| 5972 | IP_STR |
| 5973 | BGP_STR |
| 5974 | "Clear all external peers\n" |
| 5975 | "Address family\n" |
| 5976 | "Address Family modifier\n" |
| 5977 | "Address Family modifier\n" |
| 5978 | "Soft reconfig inbound update\n") |
| 5979 | |
| 5980 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
| 5981 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, |
| 5982 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", |
| 5983 | CLEAR_STR |
| 5984 | IP_STR |
| 5985 | BGP_STR |
| 5986 | "Clear all external peers\n" |
| 5987 | "Address family\n" |
| 5988 | "Address Family modifier\n" |
| 5989 | "Address Family modifier\n" |
| 5990 | "Soft reconfig inbound update\n" |
| 5991 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5992 | { |
| 5993 | if (strncmp (argv[0], "m", 1) == 0) |
| 5994 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5995 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5996 | |
| 5997 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5998 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5999 | } |
| 6000 | |
| 6001 | DEFUN (clear_bgp_external_soft_in, |
| 6002 | clear_bgp_external_soft_in_cmd, |
| 6003 | "clear bgp external soft in", |
| 6004 | CLEAR_STR |
| 6005 | BGP_STR |
| 6006 | "Clear all external peers\n" |
| 6007 | "Soft reconfig\n" |
| 6008 | "Soft reconfig inbound update\n") |
| 6009 | { |
| 6010 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 6011 | BGP_CLEAR_SOFT_IN, NULL); |
| 6012 | } |
| 6013 | |
| 6014 | ALIAS (clear_bgp_external_soft_in, |
| 6015 | clear_bgp_ipv6_external_soft_in_cmd, |
| 6016 | "clear bgp ipv6 external soft in", |
| 6017 | CLEAR_STR |
| 6018 | BGP_STR |
| 6019 | "Address family\n" |
| 6020 | "Clear all external peers\n" |
| 6021 | "Soft reconfig\n" |
| 6022 | "Soft reconfig inbound update\n") |
| 6023 | |
| 6024 | ALIAS (clear_bgp_external_soft_in, |
| 6025 | clear_bgp_external_in_cmd, |
| 6026 | "clear bgp external in", |
| 6027 | CLEAR_STR |
| 6028 | BGP_STR |
| 6029 | "Clear all external peers\n" |
| 6030 | "Soft reconfig inbound update\n") |
| 6031 | |
| 6032 | ALIAS (clear_bgp_external_soft_in, |
| 6033 | clear_bgp_ipv6_external_in_cmd, |
| 6034 | "clear bgp ipv6 external WORD in", |
| 6035 | CLEAR_STR |
| 6036 | BGP_STR |
| 6037 | "Address family\n" |
| 6038 | "Clear all external peers\n" |
| 6039 | "Soft reconfig inbound update\n") |
| 6040 | |
| 6041 | DEFUN (clear_bgp_external_in_prefix_filter, |
| 6042 | clear_bgp_external_in_prefix_filter_cmd, |
| 6043 | "clear bgp external in prefix-filter", |
| 6044 | CLEAR_STR |
| 6045 | BGP_STR |
| 6046 | "Clear all external peers\n" |
| 6047 | "Soft reconfig inbound update\n" |
| 6048 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6049 | { |
| 6050 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 6051 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 6052 | } |
| 6053 | |
| 6054 | ALIAS (clear_bgp_external_in_prefix_filter, |
| 6055 | clear_bgp_ipv6_external_in_prefix_filter_cmd, |
| 6056 | "clear bgp ipv6 external in prefix-filter", |
| 6057 | CLEAR_STR |
| 6058 | BGP_STR |
| 6059 | "Address family\n" |
| 6060 | "Clear all external peers\n" |
| 6061 | "Soft reconfig inbound update\n" |
| 6062 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6063 | |
| 6064 | DEFUN (clear_ip_bgp_as_soft_in, |
| 6065 | clear_ip_bgp_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6066 | "clear ip bgp " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6067 | CLEAR_STR |
| 6068 | IP_STR |
| 6069 | BGP_STR |
| 6070 | "Clear peers with the AS number\n" |
| 6071 | "Soft reconfig\n" |
| 6072 | "Soft reconfig inbound update\n") |
| 6073 | { |
| 6074 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6075 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6076 | } |
| 6077 | |
| 6078 | ALIAS (clear_ip_bgp_as_soft_in, |
| 6079 | clear_ip_bgp_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6080 | "clear ip bgp " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6081 | CLEAR_STR |
| 6082 | IP_STR |
| 6083 | BGP_STR |
| 6084 | "Clear peers with the AS number\n" |
| 6085 | "Soft reconfig inbound update\n") |
| 6086 | |
| 6087 | DEFUN (clear_ip_bgp_as_in_prefix_filter, |
| 6088 | clear_ip_bgp_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6089 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6090 | CLEAR_STR |
| 6091 | IP_STR |
| 6092 | BGP_STR |
| 6093 | "Clear peers with the AS number\n" |
| 6094 | "Soft reconfig inbound update\n" |
| 6095 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6096 | { |
| 6097 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6098 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6099 | } |
| 6100 | |
| 6101 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, |
| 6102 | clear_ip_bgp_as_ipv4_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6103 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6104 | CLEAR_STR |
| 6105 | IP_STR |
| 6106 | BGP_STR |
| 6107 | "Clear peers with the AS number\n" |
| 6108 | "Address family\n" |
| 6109 | "Address Family modifier\n" |
| 6110 | "Address Family modifier\n" |
| 6111 | "Soft reconfig\n" |
| 6112 | "Soft reconfig inbound update\n") |
| 6113 | { |
| 6114 | if (strncmp (argv[1], "m", 1) == 0) |
| 6115 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6116 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6117 | |
| 6118 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6119 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6120 | } |
| 6121 | |
| 6122 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, |
| 6123 | clear_ip_bgp_as_ipv4_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6124 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6125 | CLEAR_STR |
| 6126 | IP_STR |
| 6127 | BGP_STR |
| 6128 | "Clear peers with the AS number\n" |
| 6129 | "Address family\n" |
| 6130 | "Address Family modifier\n" |
| 6131 | "Address Family modifier\n" |
| 6132 | "Soft reconfig inbound update\n") |
| 6133 | |
| 6134 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
| 6135 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6136 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6137 | CLEAR_STR |
| 6138 | IP_STR |
| 6139 | BGP_STR |
| 6140 | "Clear peers with the AS number\n" |
| 6141 | "Address family\n" |
| 6142 | "Address Family modifier\n" |
| 6143 | "Address Family modifier\n" |
| 6144 | "Soft reconfig inbound update\n" |
| 6145 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6146 | { |
| 6147 | if (strncmp (argv[1], "m", 1) == 0) |
| 6148 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6149 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6150 | |
| 6151 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6152 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6153 | } |
| 6154 | |
| 6155 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, |
| 6156 | clear_ip_bgp_as_vpnv4_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6157 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6158 | CLEAR_STR |
| 6159 | IP_STR |
| 6160 | BGP_STR |
| 6161 | "Clear peers with the AS number\n" |
| 6162 | "Address family\n" |
| 6163 | "Address Family modifier\n" |
| 6164 | "Soft reconfig\n" |
| 6165 | "Soft reconfig inbound update\n") |
| 6166 | { |
| 6167 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 6168 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6169 | } |
| 6170 | |
| 6171 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, |
| 6172 | clear_ip_bgp_as_vpnv4_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6173 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6174 | CLEAR_STR |
| 6175 | IP_STR |
| 6176 | BGP_STR |
| 6177 | "Clear peers with the AS number\n" |
| 6178 | "Address family\n" |
| 6179 | "Address Family modifier\n" |
| 6180 | "Soft reconfig inbound update\n") |
| 6181 | |
| 6182 | DEFUN (clear_bgp_as_soft_in, |
| 6183 | clear_bgp_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6184 | "clear bgp " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6185 | CLEAR_STR |
| 6186 | BGP_STR |
| 6187 | "Clear peers with the AS number\n" |
| 6188 | "Soft reconfig\n" |
| 6189 | "Soft reconfig inbound update\n") |
| 6190 | { |
| 6191 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6192 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6193 | } |
| 6194 | |
| 6195 | ALIAS (clear_bgp_as_soft_in, |
| 6196 | clear_bgp_ipv6_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6197 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6198 | CLEAR_STR |
| 6199 | BGP_STR |
| 6200 | "Address family\n" |
| 6201 | "Clear peers with the AS number\n" |
| 6202 | "Soft reconfig\n" |
| 6203 | "Soft reconfig inbound update\n") |
| 6204 | |
| 6205 | ALIAS (clear_bgp_as_soft_in, |
| 6206 | clear_bgp_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6207 | "clear bgp " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6208 | CLEAR_STR |
| 6209 | BGP_STR |
| 6210 | "Clear peers with the AS number\n" |
| 6211 | "Soft reconfig inbound update\n") |
| 6212 | |
| 6213 | ALIAS (clear_bgp_as_soft_in, |
| 6214 | clear_bgp_ipv6_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6215 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6216 | CLEAR_STR |
| 6217 | BGP_STR |
| 6218 | "Address family\n" |
| 6219 | "Clear peers with the AS number\n" |
| 6220 | "Soft reconfig inbound update\n") |
| 6221 | |
| 6222 | DEFUN (clear_bgp_as_in_prefix_filter, |
| 6223 | clear_bgp_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6224 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6225 | CLEAR_STR |
| 6226 | BGP_STR |
| 6227 | "Clear peers with the AS number\n" |
| 6228 | "Soft reconfig inbound update\n" |
| 6229 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6230 | { |
| 6231 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6232 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6233 | } |
| 6234 | |
| 6235 | ALIAS (clear_bgp_as_in_prefix_filter, |
| 6236 | clear_bgp_ipv6_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6237 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6238 | CLEAR_STR |
| 6239 | BGP_STR |
| 6240 | "Address family\n" |
| 6241 | "Clear peers with the AS number\n" |
| 6242 | "Soft reconfig inbound update\n" |
| 6243 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 6244 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6245 | /* Both soft-reconfiguration */ |
| 6246 | DEFUN (clear_ip_bgp_all_soft, |
| 6247 | clear_ip_bgp_all_soft_cmd, |
| 6248 | "clear ip bgp * soft", |
| 6249 | CLEAR_STR |
| 6250 | IP_STR |
| 6251 | BGP_STR |
| 6252 | "Clear all peers\n" |
| 6253 | "Soft reconfig\n") |
| 6254 | { |
| 6255 | if (argc == 1) |
| 6256 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6257 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6258 | |
| 6259 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6260 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6261 | } |
| 6262 | |
| 6263 | ALIAS (clear_ip_bgp_all_soft, |
| 6264 | clear_ip_bgp_instance_all_soft_cmd, |
| 6265 | "clear ip bgp view WORD * soft", |
| 6266 | CLEAR_STR |
| 6267 | IP_STR |
| 6268 | BGP_STR |
| 6269 | "BGP view\n" |
| 6270 | "view name\n" |
| 6271 | "Clear all peers\n" |
| 6272 | "Soft reconfig\n") |
| 6273 | |
| 6274 | |
| 6275 | DEFUN (clear_ip_bgp_all_ipv4_soft, |
| 6276 | clear_ip_bgp_all_ipv4_soft_cmd, |
| 6277 | "clear ip bgp * ipv4 (unicast|multicast) soft", |
| 6278 | CLEAR_STR |
| 6279 | IP_STR |
| 6280 | BGP_STR |
| 6281 | "Clear all peers\n" |
| 6282 | "Address family\n" |
| 6283 | "Address Family Modifier\n" |
| 6284 | "Address Family Modifier\n" |
| 6285 | "Soft reconfig\n") |
| 6286 | { |
| 6287 | if (strncmp (argv[0], "m", 1) == 0) |
| 6288 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 6289 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6290 | |
| 6291 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6292 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6293 | } |
| 6294 | |
| 6295 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, |
| 6296 | clear_ip_bgp_instance_all_ipv4_soft_cmd, |
| 6297 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", |
| 6298 | CLEAR_STR |
| 6299 | IP_STR |
| 6300 | BGP_STR |
| 6301 | "BGP view\n" |
| 6302 | "view name\n" |
| 6303 | "Clear all peers\n" |
| 6304 | "Address family\n" |
| 6305 | "Address Family Modifier\n" |
| 6306 | "Address Family Modifier\n" |
| 6307 | "Soft reconfig\n") |
| 6308 | { |
| 6309 | if (strncmp (argv[1], "m", 1) == 0) |
| 6310 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 6311 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6312 | |
| 6313 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6314 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6315 | } |
| 6316 | |
| 6317 | DEFUN (clear_ip_bgp_all_vpnv4_soft, |
| 6318 | clear_ip_bgp_all_vpnv4_soft_cmd, |
| 6319 | "clear ip bgp * vpnv4 unicast soft", |
| 6320 | CLEAR_STR |
| 6321 | IP_STR |
| 6322 | BGP_STR |
| 6323 | "Clear all peers\n" |
| 6324 | "Address family\n" |
| 6325 | "Address Family Modifier\n" |
| 6326 | "Soft reconfig\n") |
| 6327 | { |
| 6328 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 6329 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6330 | } |
| 6331 | |
| 6332 | DEFUN (clear_bgp_all_soft, |
| 6333 | clear_bgp_all_soft_cmd, |
| 6334 | "clear bgp * soft", |
| 6335 | CLEAR_STR |
| 6336 | BGP_STR |
| 6337 | "Clear all peers\n" |
| 6338 | "Soft reconfig\n") |
| 6339 | { |
| 6340 | if (argc == 1) |
| 6341 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6342 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6343 | |
| 6344 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6345 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6346 | } |
| 6347 | |
| 6348 | ALIAS (clear_bgp_all_soft, |
| 6349 | clear_bgp_instance_all_soft_cmd, |
| 6350 | "clear bgp view WORD * soft", |
| 6351 | CLEAR_STR |
| 6352 | BGP_STR |
| 6353 | "BGP view\n" |
| 6354 | "view name\n" |
| 6355 | "Clear all peers\n" |
| 6356 | "Soft reconfig\n") |
| 6357 | |
| 6358 | ALIAS (clear_bgp_all_soft, |
| 6359 | clear_bgp_ipv6_all_soft_cmd, |
| 6360 | "clear bgp ipv6 * soft", |
| 6361 | CLEAR_STR |
| 6362 | BGP_STR |
| 6363 | "Address family\n" |
| 6364 | "Clear all peers\n" |
| 6365 | "Soft reconfig\n") |
| 6366 | |
| 6367 | DEFUN (clear_ip_bgp_peer_soft, |
| 6368 | clear_ip_bgp_peer_soft_cmd, |
| 6369 | "clear ip bgp A.B.C.D soft", |
| 6370 | CLEAR_STR |
| 6371 | IP_STR |
| 6372 | BGP_STR |
| 6373 | "BGP neighbor address to clear\n" |
| 6374 | "Soft reconfig\n") |
| 6375 | { |
| 6376 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6377 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6378 | } |
| 6379 | |
| 6380 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
| 6381 | clear_ip_bgp_peer_ipv4_soft_cmd, |
| 6382 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", |
| 6383 | CLEAR_STR |
| 6384 | IP_STR |
| 6385 | BGP_STR |
| 6386 | "BGP neighbor address to clear\n" |
| 6387 | "Address family\n" |
| 6388 | "Address Family Modifier\n" |
| 6389 | "Address Family Modifier\n" |
| 6390 | "Soft reconfig\n") |
| 6391 | { |
| 6392 | if (strncmp (argv[1], "m", 1) == 0) |
| 6393 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 6394 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6395 | |
| 6396 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6397 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6398 | } |
| 6399 | |
| 6400 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
| 6401 | clear_ip_bgp_peer_vpnv4_soft_cmd, |
| 6402 | "clear ip bgp A.B.C.D vpnv4 unicast soft", |
| 6403 | CLEAR_STR |
| 6404 | IP_STR |
| 6405 | BGP_STR |
| 6406 | "BGP neighbor address to clear\n" |
| 6407 | "Address family\n" |
| 6408 | "Address Family Modifier\n" |
| 6409 | "Soft reconfig\n") |
| 6410 | { |
| 6411 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 6412 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6413 | } |
| 6414 | |
| 6415 | DEFUN (clear_bgp_peer_soft, |
| 6416 | clear_bgp_peer_soft_cmd, |
| 6417 | "clear bgp (A.B.C.D|X:X::X:X) soft", |
| 6418 | CLEAR_STR |
| 6419 | BGP_STR |
| 6420 | "BGP neighbor address to clear\n" |
| 6421 | "BGP IPv6 neighbor to clear\n" |
| 6422 | "Soft reconfig\n") |
| 6423 | { |
| 6424 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6425 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6426 | } |
| 6427 | |
| 6428 | ALIAS (clear_bgp_peer_soft, |
| 6429 | clear_bgp_ipv6_peer_soft_cmd, |
| 6430 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft", |
| 6431 | CLEAR_STR |
| 6432 | BGP_STR |
| 6433 | "Address family\n" |
| 6434 | "BGP neighbor address to clear\n" |
| 6435 | "BGP IPv6 neighbor to clear\n" |
| 6436 | "Soft reconfig\n") |
| 6437 | |
| 6438 | DEFUN (clear_ip_bgp_peer_group_soft, |
| 6439 | clear_ip_bgp_peer_group_soft_cmd, |
| 6440 | "clear ip bgp peer-group WORD soft", |
| 6441 | CLEAR_STR |
| 6442 | IP_STR |
| 6443 | BGP_STR |
| 6444 | "Clear all members of peer-group\n" |
| 6445 | "BGP peer-group name\n" |
| 6446 | "Soft reconfig\n") |
| 6447 | { |
| 6448 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6449 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6450 | } |
| 6451 | |
| 6452 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
| 6453 | clear_ip_bgp_peer_group_ipv4_soft_cmd, |
| 6454 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", |
| 6455 | CLEAR_STR |
| 6456 | IP_STR |
| 6457 | BGP_STR |
| 6458 | "Clear all members of peer-group\n" |
| 6459 | "BGP peer-group name\n" |
| 6460 | "Address family\n" |
| 6461 | "Address Family modifier\n" |
| 6462 | "Address Family modifier\n" |
| 6463 | "Soft reconfig\n") |
| 6464 | { |
| 6465 | if (strncmp (argv[1], "m", 1) == 0) |
| 6466 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 6467 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6468 | |
| 6469 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6470 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6471 | } |
| 6472 | |
| 6473 | DEFUN (clear_bgp_peer_group_soft, |
| 6474 | clear_bgp_peer_group_soft_cmd, |
| 6475 | "clear bgp peer-group WORD soft", |
| 6476 | CLEAR_STR |
| 6477 | BGP_STR |
| 6478 | "Clear all members of peer-group\n" |
| 6479 | "BGP peer-group name\n" |
| 6480 | "Soft reconfig\n") |
| 6481 | { |
| 6482 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 6483 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6484 | } |
| 6485 | |
| 6486 | ALIAS (clear_bgp_peer_group_soft, |
| 6487 | clear_bgp_ipv6_peer_group_soft_cmd, |
| 6488 | "clear bgp ipv6 peer-group WORD soft", |
| 6489 | CLEAR_STR |
| 6490 | BGP_STR |
| 6491 | "Address family\n" |
| 6492 | "Clear all members of peer-group\n" |
| 6493 | "BGP peer-group name\n" |
| 6494 | "Soft reconfig\n") |
| 6495 | |
| 6496 | DEFUN (clear_ip_bgp_external_soft, |
| 6497 | clear_ip_bgp_external_soft_cmd, |
| 6498 | "clear ip bgp external soft", |
| 6499 | CLEAR_STR |
| 6500 | IP_STR |
| 6501 | BGP_STR |
| 6502 | "Clear all external peers\n" |
| 6503 | "Soft reconfig\n") |
| 6504 | { |
| 6505 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6506 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6507 | } |
| 6508 | |
| 6509 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
| 6510 | clear_ip_bgp_external_ipv4_soft_cmd, |
| 6511 | "clear ip bgp external ipv4 (unicast|multicast) soft", |
| 6512 | CLEAR_STR |
| 6513 | IP_STR |
| 6514 | BGP_STR |
| 6515 | "Clear all external peers\n" |
| 6516 | "Address family\n" |
| 6517 | "Address Family modifier\n" |
| 6518 | "Address Family modifier\n" |
| 6519 | "Soft reconfig\n") |
| 6520 | { |
| 6521 | if (strncmp (argv[0], "m", 1) == 0) |
| 6522 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 6523 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6524 | |
| 6525 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6526 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6527 | } |
| 6528 | |
| 6529 | DEFUN (clear_bgp_external_soft, |
| 6530 | clear_bgp_external_soft_cmd, |
| 6531 | "clear bgp external soft", |
| 6532 | CLEAR_STR |
| 6533 | BGP_STR |
| 6534 | "Clear all external peers\n" |
| 6535 | "Soft reconfig\n") |
| 6536 | { |
| 6537 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 6538 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6539 | } |
| 6540 | |
| 6541 | ALIAS (clear_bgp_external_soft, |
| 6542 | clear_bgp_ipv6_external_soft_cmd, |
| 6543 | "clear bgp ipv6 external soft", |
| 6544 | CLEAR_STR |
| 6545 | BGP_STR |
| 6546 | "Address family\n" |
| 6547 | "Clear all external peers\n" |
| 6548 | "Soft reconfig\n") |
| 6549 | |
| 6550 | DEFUN (clear_ip_bgp_as_soft, |
| 6551 | clear_ip_bgp_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6552 | "clear ip bgp " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6553 | CLEAR_STR |
| 6554 | IP_STR |
| 6555 | BGP_STR |
| 6556 | "Clear peers with the AS number\n" |
| 6557 | "Soft reconfig\n") |
| 6558 | { |
| 6559 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6560 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6561 | } |
| 6562 | |
| 6563 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
| 6564 | clear_ip_bgp_as_ipv4_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6565 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6566 | CLEAR_STR |
| 6567 | IP_STR |
| 6568 | BGP_STR |
| 6569 | "Clear peers with the AS number\n" |
| 6570 | "Address family\n" |
| 6571 | "Address Family Modifier\n" |
| 6572 | "Address Family Modifier\n" |
| 6573 | "Soft reconfig\n") |
| 6574 | { |
| 6575 | if (strncmp (argv[1], "m", 1) == 0) |
| 6576 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6577 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6578 | |
| 6579 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, |
| 6580 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6581 | } |
| 6582 | |
| 6583 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
| 6584 | clear_ip_bgp_as_vpnv4_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6585 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6586 | CLEAR_STR |
| 6587 | IP_STR |
| 6588 | BGP_STR |
| 6589 | "Clear peers with the AS number\n" |
| 6590 | "Address family\n" |
| 6591 | "Address Family Modifier\n" |
| 6592 | "Soft reconfig\n") |
| 6593 | { |
| 6594 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 6595 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6596 | } |
| 6597 | |
| 6598 | DEFUN (clear_bgp_as_soft, |
| 6599 | clear_bgp_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6600 | "clear bgp " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6601 | CLEAR_STR |
| 6602 | BGP_STR |
| 6603 | "Clear peers with the AS number\n" |
| 6604 | "Soft reconfig\n") |
| 6605 | { |
| 6606 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6607 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6608 | } |
| 6609 | |
| 6610 | ALIAS (clear_bgp_as_soft, |
| 6611 | clear_bgp_ipv6_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6612 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6613 | CLEAR_STR |
| 6614 | BGP_STR |
| 6615 | "Address family\n" |
| 6616 | "Clear peers with the AS number\n" |
| 6617 | "Soft reconfig\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 6618 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6619 | /* RS-client soft reconfiguration. */ |
| 6620 | #ifdef HAVE_IPV6 |
| 6621 | DEFUN (clear_bgp_all_rsclient, |
| 6622 | clear_bgp_all_rsclient_cmd, |
| 6623 | "clear bgp * rsclient", |
| 6624 | CLEAR_STR |
| 6625 | BGP_STR |
| 6626 | "Clear all peers\n" |
| 6627 | "Soft reconfig for rsclient RIB\n") |
| 6628 | { |
| 6629 | if (argc == 1) |
| 6630 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6631 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6632 | |
| 6633 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6634 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6635 | } |
| 6636 | |
| 6637 | ALIAS (clear_bgp_all_rsclient, |
| 6638 | clear_bgp_ipv6_all_rsclient_cmd, |
| 6639 | "clear bgp ipv6 * rsclient", |
| 6640 | CLEAR_STR |
| 6641 | BGP_STR |
| 6642 | "Address family\n" |
| 6643 | "Clear all peers\n" |
| 6644 | "Soft reconfig for rsclient RIB\n") |
| 6645 | |
| 6646 | ALIAS (clear_bgp_all_rsclient, |
| 6647 | clear_bgp_instance_all_rsclient_cmd, |
| 6648 | "clear bgp view WORD * rsclient", |
| 6649 | CLEAR_STR |
| 6650 | BGP_STR |
| 6651 | "BGP view\n" |
| 6652 | "view name\n" |
| 6653 | "Clear all peers\n" |
| 6654 | "Soft reconfig for rsclient RIB\n") |
| 6655 | |
| 6656 | ALIAS (clear_bgp_all_rsclient, |
| 6657 | clear_bgp_ipv6_instance_all_rsclient_cmd, |
| 6658 | "clear bgp ipv6 view WORD * rsclient", |
| 6659 | CLEAR_STR |
| 6660 | BGP_STR |
| 6661 | "Address family\n" |
| 6662 | "BGP view\n" |
| 6663 | "view name\n" |
| 6664 | "Clear all peers\n" |
| 6665 | "Soft reconfig for rsclient RIB\n") |
| 6666 | #endif /* HAVE_IPV6 */ |
| 6667 | |
| 6668 | DEFUN (clear_ip_bgp_all_rsclient, |
| 6669 | clear_ip_bgp_all_rsclient_cmd, |
| 6670 | "clear ip bgp * rsclient", |
| 6671 | CLEAR_STR |
| 6672 | IP_STR |
| 6673 | BGP_STR |
| 6674 | "Clear all peers\n" |
| 6675 | "Soft reconfig for rsclient RIB\n") |
| 6676 | { |
| 6677 | if (argc == 1) |
| 6678 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6679 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6680 | |
| 6681 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6682 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6683 | } |
| 6684 | |
| 6685 | ALIAS (clear_ip_bgp_all_rsclient, |
| 6686 | clear_ip_bgp_instance_all_rsclient_cmd, |
| 6687 | "clear ip bgp view WORD * rsclient", |
| 6688 | CLEAR_STR |
| 6689 | IP_STR |
| 6690 | BGP_STR |
| 6691 | "BGP view\n" |
| 6692 | "view name\n" |
| 6693 | "Clear all peers\n" |
| 6694 | "Soft reconfig for rsclient RIB\n") |
| 6695 | |
| 6696 | #ifdef HAVE_IPV6 |
| 6697 | DEFUN (clear_bgp_peer_rsclient, |
| 6698 | clear_bgp_peer_rsclient_cmd, |
| 6699 | "clear bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6700 | CLEAR_STR |
| 6701 | BGP_STR |
| 6702 | "BGP neighbor IP address to clear\n" |
| 6703 | "BGP IPv6 neighbor to clear\n" |
| 6704 | "Soft reconfig for rsclient RIB\n") |
| 6705 | { |
| 6706 | if (argc == 2) |
| 6707 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6708 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6709 | |
| 6710 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6711 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6712 | } |
| 6713 | |
| 6714 | ALIAS (clear_bgp_peer_rsclient, |
| 6715 | clear_bgp_ipv6_peer_rsclient_cmd, |
| 6716 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient", |
| 6717 | CLEAR_STR |
| 6718 | BGP_STR |
| 6719 | "Address family\n" |
| 6720 | "BGP neighbor IP address to clear\n" |
| 6721 | "BGP IPv6 neighbor to clear\n" |
| 6722 | "Soft reconfig for rsclient RIB\n") |
| 6723 | |
| 6724 | ALIAS (clear_bgp_peer_rsclient, |
| 6725 | clear_bgp_instance_peer_rsclient_cmd, |
| 6726 | "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6727 | CLEAR_STR |
| 6728 | BGP_STR |
| 6729 | "BGP view\n" |
| 6730 | "view name\n" |
| 6731 | "BGP neighbor IP address to clear\n" |
| 6732 | "BGP IPv6 neighbor to clear\n" |
| 6733 | "Soft reconfig for rsclient RIB\n") |
| 6734 | |
| 6735 | ALIAS (clear_bgp_peer_rsclient, |
| 6736 | clear_bgp_ipv6_instance_peer_rsclient_cmd, |
| 6737 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6738 | CLEAR_STR |
| 6739 | BGP_STR |
| 6740 | "Address family\n" |
| 6741 | "BGP view\n" |
| 6742 | "view name\n" |
| 6743 | "BGP neighbor IP address to clear\n" |
| 6744 | "BGP IPv6 neighbor to clear\n" |
| 6745 | "Soft reconfig for rsclient RIB\n") |
| 6746 | #endif /* HAVE_IPV6 */ |
| 6747 | |
| 6748 | DEFUN (clear_ip_bgp_peer_rsclient, |
| 6749 | clear_ip_bgp_peer_rsclient_cmd, |
| 6750 | "clear ip bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6751 | CLEAR_STR |
| 6752 | IP_STR |
| 6753 | BGP_STR |
| 6754 | "BGP neighbor IP address to clear\n" |
| 6755 | "BGP IPv6 neighbor to clear\n" |
| 6756 | "Soft reconfig for rsclient RIB\n") |
| 6757 | { |
| 6758 | if (argc == 2) |
| 6759 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, |
| 6760 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6761 | |
| 6762 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6763 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6764 | } |
| 6765 | |
| 6766 | ALIAS (clear_ip_bgp_peer_rsclient, |
| 6767 | clear_ip_bgp_instance_peer_rsclient_cmd, |
| 6768 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6769 | CLEAR_STR |
| 6770 | IP_STR |
| 6771 | BGP_STR |
| 6772 | "BGP view\n" |
| 6773 | "view name\n" |
| 6774 | "BGP neighbor IP address to clear\n" |
| 6775 | "BGP IPv6 neighbor to clear\n" |
| 6776 | "Soft reconfig for rsclient RIB\n") |
| 6777 | |
Michael Lambert | e0081f7 | 2008-11-16 20:12:04 +0000 | [diff] [blame] | 6778 | DEFUN (show_bgp_views, |
| 6779 | show_bgp_views_cmd, |
| 6780 | "show bgp views", |
| 6781 | SHOW_STR |
| 6782 | BGP_STR |
| 6783 | "Show the defined BGP views\n") |
| 6784 | { |
| 6785 | struct list *inst = bm->bgp; |
| 6786 | struct listnode *node; |
| 6787 | struct bgp *bgp; |
| 6788 | |
| 6789 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) |
| 6790 | { |
| 6791 | vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE); |
| 6792 | return CMD_WARNING; |
| 6793 | } |
| 6794 | |
| 6795 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); |
| 6796 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) |
| 6797 | vty_out (vty, "\t%s (AS%u)%s", |
| 6798 | bgp->name ? bgp->name : "(null)", |
| 6799 | bgp->as, VTY_NEWLINE); |
| 6800 | |
| 6801 | return CMD_SUCCESS; |
| 6802 | } |
| 6803 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6804 | DEFUN (show_bgp_memory, |
| 6805 | show_bgp_memory_cmd, |
| 6806 | "show bgp memory", |
| 6807 | SHOW_STR |
| 6808 | BGP_STR |
| 6809 | "Global BGP memory statistics\n") |
| 6810 | { |
| 6811 | char memstrbuf[MTYPE_MEMSTR_LEN]; |
| 6812 | unsigned long count; |
| 6813 | |
| 6814 | /* RIB related usage stats */ |
| 6815 | count = mtype_stats_alloc (MTYPE_BGP_NODE); |
| 6816 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, |
| 6817 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6818 | count * sizeof (struct bgp_node)), |
| 6819 | VTY_NEWLINE); |
| 6820 | |
| 6821 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); |
| 6822 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, |
| 6823 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6824 | count * sizeof (struct bgp_info)), |
| 6825 | VTY_NEWLINE); |
Paul Jakma | fb982c2 | 2007-05-04 20:15:47 +0000 | [diff] [blame] | 6826 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
| 6827 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, |
| 6828 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6829 | count * sizeof (struct bgp_info_extra)), |
| 6830 | VTY_NEWLINE); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6831 | |
| 6832 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) |
| 6833 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, |
| 6834 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6835 | count * sizeof (struct bgp_static)), |
| 6836 | VTY_NEWLINE); |
| 6837 | |
| 6838 | /* Adj-In/Out */ |
| 6839 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) |
| 6840 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, |
| 6841 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6842 | count * sizeof (struct bgp_adj_in)), |
| 6843 | VTY_NEWLINE); |
| 6844 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) |
| 6845 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, |
| 6846 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6847 | count * sizeof (struct bgp_adj_out)), |
| 6848 | VTY_NEWLINE); |
| 6849 | |
| 6850 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) |
| 6851 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, |
| 6852 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6853 | count * sizeof (struct bgp_nexthop_cache)), |
| 6854 | VTY_NEWLINE); |
| 6855 | |
| 6856 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) |
| 6857 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, |
| 6858 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6859 | count * sizeof (struct bgp_damp_info)), |
| 6860 | VTY_NEWLINE); |
| 6861 | |
| 6862 | /* Attributes */ |
| 6863 | count = attr_count(); |
| 6864 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, |
| 6865 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6866 | count * sizeof(struct attr)), |
| 6867 | VTY_NEWLINE); |
Paul Jakma | fb982c2 | 2007-05-04 20:15:47 +0000 | [diff] [blame] | 6868 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
| 6869 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, |
| 6870 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6871 | count * sizeof(struct attr_extra)), |
| 6872 | VTY_NEWLINE); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6873 | |
| 6874 | if ((count = attr_unknown_count())) |
| 6875 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); |
| 6876 | |
| 6877 | /* AS_PATH attributes */ |
| 6878 | count = aspath_count (); |
| 6879 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, |
| 6880 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6881 | count * sizeof (struct aspath)), |
| 6882 | VTY_NEWLINE); |
| 6883 | |
| 6884 | count = mtype_stats_alloc (MTYPE_AS_SEG); |
| 6885 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, |
| 6886 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6887 | count * sizeof (struct assegment)), |
| 6888 | VTY_NEWLINE); |
| 6889 | |
| 6890 | /* Other attributes */ |
| 6891 | if ((count = community_count ())) |
| 6892 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, |
| 6893 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6894 | count * sizeof (struct community)), |
| 6895 | VTY_NEWLINE); |
| 6896 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) |
| 6897 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, |
| 6898 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6899 | count * sizeof (struct ecommunity)), |
| 6900 | VTY_NEWLINE); |
| 6901 | |
| 6902 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) |
| 6903 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, |
| 6904 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6905 | count * sizeof (struct cluster_list)), |
| 6906 | VTY_NEWLINE); |
| 6907 | |
| 6908 | /* Peer related usage */ |
| 6909 | count = mtype_stats_alloc (MTYPE_BGP_PEER); |
| 6910 | vty_out (vty, "%ld peers, using %s of memory%s", count, |
| 6911 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6912 | count * sizeof (struct peer)), |
| 6913 | VTY_NEWLINE); |
| 6914 | |
| 6915 | if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP))) |
| 6916 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, |
| 6917 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6918 | count * sizeof (struct peer_group)), |
| 6919 | VTY_NEWLINE); |
| 6920 | |
| 6921 | /* Other */ |
| 6922 | if ((count = mtype_stats_alloc (MTYPE_HASH))) |
| 6923 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, |
| 6924 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6925 | count * sizeof (struct hash)), |
| 6926 | VTY_NEWLINE); |
| 6927 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) |
| 6928 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, |
| 6929 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6930 | count * sizeof (struct hash_backet)), |
| 6931 | VTY_NEWLINE); |
| 6932 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) |
| 6933 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, |
| 6934 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6935 | count * sizeof (regex_t)), |
| 6936 | VTY_NEWLINE); |
| 6937 | return CMD_SUCCESS; |
| 6938 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6939 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6940 | /* Show BGP peer's summary information. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6941 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6942 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) |
| 6943 | { |
| 6944 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6945 | struct listnode *node, *nnode; |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6946 | unsigned int count = 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6947 | char timebuf[BGP_UPTIME_LEN]; |
| 6948 | int len; |
| 6949 | |
| 6950 | /* Header string for each address family. */ |
Milan Kocian | cb4fc59 | 2014-12-01 12:48:25 +0000 | [diff] [blame] | 6951 | 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] | 6952 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6953 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6954 | { |
| 6955 | if (peer->afc[afi][safi]) |
| 6956 | { |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6957 | if (!count) |
| 6958 | { |
| 6959 | unsigned long ents; |
| 6960 | char memstrbuf[MTYPE_MEMSTR_LEN]; |
| 6961 | |
| 6962 | /* Usage summary and header */ |
| 6963 | vty_out (vty, |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 6964 | "BGP router identifier %s, local AS number %u%s", |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6965 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6966 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6967 | ents = bgp_table_count (bgp->rib[afi][safi]); |
| 6968 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, |
| 6969 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6970 | ents * sizeof (struct bgp_node)), |
| 6971 | VTY_NEWLINE); |
| 6972 | |
| 6973 | /* Peer related usage */ |
| 6974 | ents = listcount (bgp->peer); |
| 6975 | vty_out (vty, "Peers %ld, using %s of memory%s", |
| 6976 | ents, |
| 6977 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6978 | ents * sizeof (struct peer)), |
| 6979 | VTY_NEWLINE); |
| 6980 | |
| 6981 | if ((ents = listcount (bgp->rsclient))) |
| 6982 | vty_out (vty, "RS-Client peers %ld, using %s of memory%s", |
| 6983 | ents, |
| 6984 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6985 | ents * sizeof (struct peer)), |
| 6986 | VTY_NEWLINE); |
| 6987 | |
| 6988 | if ((ents = listcount (bgp->group))) |
| 6989 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, |
| 6990 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6991 | ents * sizeof (struct peer_group)), |
| 6992 | VTY_NEWLINE); |
| 6993 | |
| 6994 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
| 6995 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); |
| 6996 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6997 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 6998 | } |
| 6999 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7000 | count++; |
| 7001 | |
| 7002 | len = vty_out (vty, "%s", peer->host); |
| 7003 | len = 16 - len; |
| 7004 | if (len < 1) |
| 7005 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 7006 | else |
| 7007 | vty_out (vty, "%*s", len, " "); |
| 7008 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 7009 | vty_out (vty, "4 "); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7010 | |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 7011 | vty_out (vty, "%5u %7d %7d %8d %4d %4lu ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7012 | peer->as, |
| 7013 | peer->open_in + peer->update_in + peer->keepalive_in |
| 7014 | + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in, |
| 7015 | peer->open_out + peer->update_out + peer->keepalive_out |
| 7016 | + peer->notify_out + peer->refresh_out |
| 7017 | + peer->dynamic_cap_out, |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7018 | 0, 0, (unsigned long) peer->obuf->count); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7019 | |
| 7020 | vty_out (vty, "%8s", |
| 7021 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); |
| 7022 | |
| 7023 | if (peer->status == Established) |
| 7024 | { |
| 7025 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); |
| 7026 | } |
| 7027 | else |
| 7028 | { |
| 7029 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) |
| 7030 | vty_out (vty, " Idle (Admin)"); |
| 7031 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7032 | vty_out (vty, " Idle (PfxCt)"); |
| 7033 | else |
| 7034 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); |
| 7035 | } |
| 7036 | |
| 7037 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7038 | } |
| 7039 | } |
| 7040 | |
| 7041 | if (count) |
| 7042 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, |
| 7043 | count, VTY_NEWLINE); |
| 7044 | else |
| 7045 | vty_out (vty, "No %s neighbor is configured%s", |
| 7046 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 7047 | return CMD_SUCCESS; |
| 7048 | } |
| 7049 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7050 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7051 | bgp_show_summary_vty (struct vty *vty, const char *name, |
| 7052 | afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7053 | { |
| 7054 | struct bgp *bgp; |
| 7055 | |
| 7056 | if (name) |
| 7057 | { |
| 7058 | bgp = bgp_lookup_by_name (name); |
| 7059 | |
| 7060 | if (! bgp) |
| 7061 | { |
| 7062 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7063 | return CMD_WARNING; |
| 7064 | } |
| 7065 | |
| 7066 | bgp_show_summary (vty, bgp, afi, safi); |
| 7067 | return CMD_SUCCESS; |
| 7068 | } |
| 7069 | |
| 7070 | bgp = bgp_get_default (); |
| 7071 | |
| 7072 | if (bgp) |
| 7073 | bgp_show_summary (vty, bgp, afi, safi); |
| 7074 | |
| 7075 | return CMD_SUCCESS; |
| 7076 | } |
| 7077 | |
| 7078 | /* `show ip bgp summary' commands. */ |
| 7079 | DEFUN (show_ip_bgp_summary, |
| 7080 | show_ip_bgp_summary_cmd, |
| 7081 | "show ip bgp summary", |
| 7082 | SHOW_STR |
| 7083 | IP_STR |
| 7084 | BGP_STR |
| 7085 | "Summary of BGP neighbor status\n") |
| 7086 | { |
| 7087 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 7088 | } |
| 7089 | |
| 7090 | DEFUN (show_ip_bgp_instance_summary, |
| 7091 | show_ip_bgp_instance_summary_cmd, |
| 7092 | "show ip bgp view WORD summary", |
| 7093 | SHOW_STR |
| 7094 | IP_STR |
| 7095 | BGP_STR |
| 7096 | "BGP view\n" |
| 7097 | "View name\n" |
| 7098 | "Summary of BGP neighbor status\n") |
| 7099 | { |
| 7100 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 7101 | } |
| 7102 | |
| 7103 | DEFUN (show_ip_bgp_ipv4_summary, |
| 7104 | show_ip_bgp_ipv4_summary_cmd, |
| 7105 | "show ip bgp ipv4 (unicast|multicast) summary", |
| 7106 | SHOW_STR |
| 7107 | IP_STR |
| 7108 | BGP_STR |
| 7109 | "Address family\n" |
| 7110 | "Address Family modifier\n" |
| 7111 | "Address Family modifier\n" |
| 7112 | "Summary of BGP neighbor status\n") |
| 7113 | { |
| 7114 | if (strncmp (argv[0], "m", 1) == 0) |
| 7115 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 7116 | |
| 7117 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 7118 | } |
| 7119 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 7120 | ALIAS (show_ip_bgp_ipv4_summary, |
| 7121 | show_bgp_ipv4_safi_summary_cmd, |
| 7122 | "show bgp ipv4 (unicast|multicast) summary", |
| 7123 | SHOW_STR |
| 7124 | BGP_STR |
| 7125 | "Address family\n" |
| 7126 | "Address Family modifier\n" |
| 7127 | "Address Family modifier\n" |
| 7128 | "Summary of BGP neighbor status\n") |
| 7129 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7130 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
| 7131 | show_ip_bgp_instance_ipv4_summary_cmd, |
| 7132 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", |
| 7133 | SHOW_STR |
| 7134 | IP_STR |
| 7135 | BGP_STR |
| 7136 | "BGP view\n" |
| 7137 | "View name\n" |
| 7138 | "Address family\n" |
| 7139 | "Address Family modifier\n" |
| 7140 | "Address Family modifier\n" |
| 7141 | "Summary of BGP neighbor status\n") |
| 7142 | { |
| 7143 | if (strncmp (argv[1], "m", 1) == 0) |
| 7144 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 7145 | else |
| 7146 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 7147 | } |
| 7148 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 7149 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
| 7150 | show_bgp_instance_ipv4_safi_summary_cmd, |
| 7151 | "show bgp view WORD ipv4 (unicast|multicast) summary", |
| 7152 | SHOW_STR |
| 7153 | BGP_STR |
| 7154 | "BGP view\n" |
| 7155 | "View name\n" |
| 7156 | "Address family\n" |
| 7157 | "Address Family modifier\n" |
| 7158 | "Address Family modifier\n" |
| 7159 | "Summary of BGP neighbor status\n") |
| 7160 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7161 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
| 7162 | show_ip_bgp_vpnv4_all_summary_cmd, |
| 7163 | "show ip bgp vpnv4 all summary", |
| 7164 | SHOW_STR |
| 7165 | IP_STR |
| 7166 | BGP_STR |
| 7167 | "Display VPNv4 NLRI specific information\n" |
| 7168 | "Display information about all VPNv4 NLRIs\n" |
| 7169 | "Summary of BGP neighbor status\n") |
| 7170 | { |
| 7171 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 7172 | } |
| 7173 | |
| 7174 | DEFUN (show_ip_bgp_vpnv4_rd_summary, |
| 7175 | show_ip_bgp_vpnv4_rd_summary_cmd, |
| 7176 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", |
| 7177 | SHOW_STR |
| 7178 | IP_STR |
| 7179 | BGP_STR |
| 7180 | "Display VPNv4 NLRI specific information\n" |
| 7181 | "Display information for a route distinguisher\n" |
| 7182 | "VPN Route Distinguisher\n" |
| 7183 | "Summary of BGP neighbor status\n") |
| 7184 | { |
| 7185 | int ret; |
| 7186 | struct prefix_rd prd; |
| 7187 | |
| 7188 | ret = str2prefix_rd (argv[0], &prd); |
| 7189 | if (! ret) |
| 7190 | { |
| 7191 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); |
| 7192 | return CMD_WARNING; |
| 7193 | } |
| 7194 | |
| 7195 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 7196 | } |
| 7197 | |
| 7198 | #ifdef HAVE_IPV6 |
| 7199 | DEFUN (show_bgp_summary, |
| 7200 | show_bgp_summary_cmd, |
| 7201 | "show bgp summary", |
| 7202 | SHOW_STR |
| 7203 | BGP_STR |
| 7204 | "Summary of BGP neighbor status\n") |
| 7205 | { |
| 7206 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7207 | } |
| 7208 | |
| 7209 | DEFUN (show_bgp_instance_summary, |
| 7210 | show_bgp_instance_summary_cmd, |
| 7211 | "show bgp view WORD summary", |
| 7212 | SHOW_STR |
| 7213 | BGP_STR |
| 7214 | "BGP view\n" |
| 7215 | "View name\n" |
| 7216 | "Summary of BGP neighbor status\n") |
| 7217 | { |
| 7218 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 7219 | } |
| 7220 | |
| 7221 | ALIAS (show_bgp_summary, |
| 7222 | show_bgp_ipv6_summary_cmd, |
| 7223 | "show bgp ipv6 summary", |
| 7224 | SHOW_STR |
| 7225 | BGP_STR |
| 7226 | "Address family\n" |
| 7227 | "Summary of BGP neighbor status\n") |
| 7228 | |
| 7229 | ALIAS (show_bgp_instance_summary, |
| 7230 | show_bgp_instance_ipv6_summary_cmd, |
| 7231 | "show bgp view WORD ipv6 summary", |
| 7232 | SHOW_STR |
| 7233 | BGP_STR |
| 7234 | "BGP view\n" |
| 7235 | "View name\n" |
| 7236 | "Address family\n" |
| 7237 | "Summary of BGP neighbor status\n") |
| 7238 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 7239 | DEFUN (show_bgp_ipv6_safi_summary, |
| 7240 | show_bgp_ipv6_safi_summary_cmd, |
| 7241 | "show bgp ipv6 (unicast|multicast) summary", |
| 7242 | SHOW_STR |
| 7243 | BGP_STR |
| 7244 | "Address family\n" |
| 7245 | "Address Family modifier\n" |
| 7246 | "Address Family modifier\n" |
| 7247 | "Summary of BGP neighbor status\n") |
| 7248 | { |
| 7249 | if (strncmp (argv[0], "m", 1) == 0) |
| 7250 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 7251 | |
| 7252 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7253 | } |
| 7254 | |
| 7255 | DEFUN (show_bgp_instance_ipv6_safi_summary, |
| 7256 | show_bgp_instance_ipv6_safi_summary_cmd, |
| 7257 | "show bgp view WORD ipv6 (unicast|multicast) summary", |
| 7258 | SHOW_STR |
| 7259 | BGP_STR |
| 7260 | "BGP view\n" |
| 7261 | "View name\n" |
| 7262 | "Address family\n" |
| 7263 | "Address Family modifier\n" |
| 7264 | "Address Family modifier\n" |
| 7265 | "Summary of BGP neighbor status\n") |
| 7266 | { |
| 7267 | if (strncmp (argv[1], "m", 1) == 0) |
| 7268 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST); |
| 7269 | |
| 7270 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 7271 | } |
| 7272 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7273 | /* old command */ |
| 7274 | DEFUN (show_ipv6_bgp_summary, |
| 7275 | show_ipv6_bgp_summary_cmd, |
| 7276 | "show ipv6 bgp summary", |
| 7277 | SHOW_STR |
| 7278 | IPV6_STR |
| 7279 | BGP_STR |
| 7280 | "Summary of BGP neighbor status\n") |
| 7281 | { |
| 7282 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7283 | } |
| 7284 | |
| 7285 | /* old command */ |
| 7286 | DEFUN (show_ipv6_mbgp_summary, |
| 7287 | show_ipv6_mbgp_summary_cmd, |
| 7288 | "show ipv6 mbgp summary", |
| 7289 | SHOW_STR |
| 7290 | IPV6_STR |
| 7291 | MBGP_STR |
| 7292 | "Summary of BGP neighbor status\n") |
| 7293 | { |
| 7294 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 7295 | } |
| 7296 | #endif /* HAVE_IPV6 */ |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 7297 | |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7298 | const char * |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7299 | afi_safi_print (afi_t afi, safi_t safi) |
| 7300 | { |
| 7301 | if (afi == AFI_IP && safi == SAFI_UNICAST) |
| 7302 | return "IPv4 Unicast"; |
| 7303 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) |
| 7304 | return "IPv4 Multicast"; |
| 7305 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) |
| 7306 | return "VPNv4 Unicast"; |
| 7307 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) |
| 7308 | return "IPv6 Unicast"; |
| 7309 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) |
| 7310 | return "IPv6 Multicast"; |
| 7311 | else |
| 7312 | return "Unknown"; |
| 7313 | } |
| 7314 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7315 | /* Show BGP peer's information. */ |
| 7316 | enum show_type |
| 7317 | { |
| 7318 | show_all, |
| 7319 | show_peer |
| 7320 | }; |
| 7321 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7322 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7323 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
| 7324 | afi_t afi, safi_t safi, |
| 7325 | u_int16_t adv_smcap, u_int16_t adv_rmcap, |
| 7326 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) |
| 7327 | { |
| 7328 | /* Send-Mode */ |
| 7329 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) |
| 7330 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 7331 | { |
| 7332 | vty_out (vty, " Send-mode: "); |
| 7333 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) |
| 7334 | vty_out (vty, "advertised"); |
| 7335 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 7336 | vty_out (vty, "%sreceived", |
| 7337 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? |
| 7338 | ", " : ""); |
| 7339 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7340 | } |
| 7341 | |
| 7342 | /* Receive-Mode */ |
| 7343 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) |
| 7344 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 7345 | { |
| 7346 | vty_out (vty, " Receive-mode: "); |
| 7347 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) |
| 7348 | vty_out (vty, "advertised"); |
| 7349 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 7350 | vty_out (vty, "%sreceived", |
| 7351 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? |
| 7352 | ", " : ""); |
| 7353 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7354 | } |
| 7355 | } |
| 7356 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7357 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7358 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
| 7359 | { |
| 7360 | struct bgp_filter *filter; |
| 7361 | char orf_pfx_name[BUFSIZ]; |
| 7362 | int orf_pfx_count; |
| 7363 | |
| 7364 | filter = &p->filter[afi][safi]; |
| 7365 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7366 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7367 | VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7368 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7369 | if (p->af_group[afi][safi]) |
| 7370 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
| 7371 | |
| 7372 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7373 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 7374 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 7375 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7376 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) |
| 7377 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 7378 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); |
| 7379 | |
| 7380 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7381 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 7382 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7383 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) |
| 7384 | { |
| 7385 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 7386 | ORF_TYPE_PREFIX, VTY_NEWLINE); |
| 7387 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 7388 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 7389 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 7390 | PEER_CAP_ORF_PREFIX_SM_RCV, |
| 7391 | PEER_CAP_ORF_PREFIX_RM_RCV); |
| 7392 | } |
| 7393 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7394 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 7395 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7396 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 7397 | { |
| 7398 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 7399 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); |
| 7400 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 7401 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 7402 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 7403 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, |
| 7404 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); |
| 7405 | } |
| 7406 | |
| 7407 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
| 7408 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); |
| 7409 | |
| 7410 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
| 7411 | || orf_pfx_count) |
| 7412 | { |
| 7413 | vty_out (vty, " Outbound Route Filter (ORF):"); |
| 7414 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) |
| 7415 | vty_out (vty, " sent;"); |
| 7416 | if (orf_pfx_count) |
| 7417 | vty_out (vty, " received (%d entries)", orf_pfx_count); |
| 7418 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7419 | } |
| 7420 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) |
| 7421 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); |
| 7422 | |
| 7423 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) |
| 7424 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); |
| 7425 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 7426 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); |
| 7427 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) |
| 7428 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); |
| 7429 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
| 7430 | vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE); |
| 7431 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) |
| 7432 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); |
| 7433 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) |
| 7434 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7435 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) |
| 7436 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7437 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) |
| 7438 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7439 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 7440 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
| 7441 | { |
| 7442 | vty_out (vty, " Community attribute sent to this neighbor"); |
| 7443 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 7444 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7445 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7446 | 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] | 7447 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7448 | else |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7449 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7450 | } |
| 7451 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) |
| 7452 | { |
| 7453 | vty_out (vty, " Default information originate,"); |
| 7454 | |
| 7455 | if (p->default_rmap[afi][safi].name) |
| 7456 | vty_out (vty, " default route-map %s%s,", |
| 7457 | p->default_rmap[afi][safi].map ? "*" : "", |
| 7458 | p->default_rmap[afi][safi].name); |
| 7459 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) |
| 7460 | vty_out (vty, " default sent%s", VTY_NEWLINE); |
| 7461 | else |
| 7462 | vty_out (vty, " default not sent%s", VTY_NEWLINE); |
| 7463 | } |
| 7464 | |
| 7465 | if (filter->plist[FILTER_IN].name |
| 7466 | || filter->dlist[FILTER_IN].name |
| 7467 | || filter->aslist[FILTER_IN].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7468 | || filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7469 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
| 7470 | if (filter->plist[FILTER_OUT].name |
| 7471 | || filter->dlist[FILTER_OUT].name |
| 7472 | || filter->aslist[FILTER_OUT].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7473 | || filter->map[RMAP_OUT].name |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7474 | || filter->usmap.name) |
| 7475 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7476 | if (filter->map[RMAP_IMPORT].name) |
| 7477 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); |
| 7478 | if (filter->map[RMAP_EXPORT].name) |
| 7479 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7480 | |
| 7481 | /* prefix-list */ |
| 7482 | if (filter->plist[FILTER_IN].name) |
| 7483 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", |
| 7484 | filter->plist[FILTER_IN].plist ? "*" : "", |
| 7485 | filter->plist[FILTER_IN].name, |
| 7486 | VTY_NEWLINE); |
| 7487 | if (filter->plist[FILTER_OUT].name) |
| 7488 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", |
| 7489 | filter->plist[FILTER_OUT].plist ? "*" : "", |
| 7490 | filter->plist[FILTER_OUT].name, |
| 7491 | VTY_NEWLINE); |
| 7492 | |
| 7493 | /* distribute-list */ |
| 7494 | if (filter->dlist[FILTER_IN].name) |
| 7495 | vty_out (vty, " Incoming update network filter list is %s%s%s", |
| 7496 | filter->dlist[FILTER_IN].alist ? "*" : "", |
| 7497 | filter->dlist[FILTER_IN].name, |
| 7498 | VTY_NEWLINE); |
| 7499 | if (filter->dlist[FILTER_OUT].name) |
| 7500 | vty_out (vty, " Outgoing update network filter list is %s%s%s", |
| 7501 | filter->dlist[FILTER_OUT].alist ? "*" : "", |
| 7502 | filter->dlist[FILTER_OUT].name, |
| 7503 | VTY_NEWLINE); |
| 7504 | |
| 7505 | /* filter-list. */ |
| 7506 | if (filter->aslist[FILTER_IN].name) |
| 7507 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", |
| 7508 | filter->aslist[FILTER_IN].aslist ? "*" : "", |
| 7509 | filter->aslist[FILTER_IN].name, |
| 7510 | VTY_NEWLINE); |
| 7511 | if (filter->aslist[FILTER_OUT].name) |
| 7512 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", |
| 7513 | filter->aslist[FILTER_OUT].aslist ? "*" : "", |
| 7514 | filter->aslist[FILTER_OUT].name, |
| 7515 | VTY_NEWLINE); |
| 7516 | |
| 7517 | /* route-map. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7518 | if (filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7519 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7520 | filter->map[RMAP_IN].map ? "*" : "", |
| 7521 | filter->map[RMAP_IN].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7522 | VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7523 | if (filter->map[RMAP_OUT].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7524 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7525 | filter->map[RMAP_OUT].map ? "*" : "", |
| 7526 | filter->map[RMAP_OUT].name, |
| 7527 | VTY_NEWLINE); |
| 7528 | if (filter->map[RMAP_IMPORT].name) |
| 7529 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", |
| 7530 | filter->map[RMAP_IMPORT].map ? "*" : "", |
| 7531 | filter->map[RMAP_IMPORT].name, |
| 7532 | VTY_NEWLINE); |
| 7533 | if (filter->map[RMAP_EXPORT].name) |
| 7534 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", |
| 7535 | filter->map[RMAP_EXPORT].map ? "*" : "", |
| 7536 | filter->map[RMAP_EXPORT].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7537 | VTY_NEWLINE); |
| 7538 | |
| 7539 | /* unsuppress-map */ |
| 7540 | if (filter->usmap.name) |
| 7541 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", |
| 7542 | filter->usmap.map ? "*" : "", |
| 7543 | filter->usmap.name, VTY_NEWLINE); |
| 7544 | |
| 7545 | /* Receive prefix count */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7546 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
| 7547 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7548 | /* Maximum prefix */ |
| 7549 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) |
| 7550 | { |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7551 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7552 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7553 | ? " (warning-only)" : "", VTY_NEWLINE); |
| 7554 | vty_out (vty, " Threshold for warning message %d%%", |
| 7555 | p->pmax_threshold[afi][safi]); |
| 7556 | if (p->pmax_restart[afi][safi]) |
| 7557 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); |
| 7558 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7559 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7560 | |
| 7561 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7562 | } |
| 7563 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7564 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7565 | bgp_show_peer (struct vty *vty, struct peer *p) |
| 7566 | { |
| 7567 | struct bgp *bgp; |
| 7568 | char buf1[BUFSIZ]; |
| 7569 | char timebuf[BGP_UPTIME_LEN]; |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7570 | afi_t afi; |
| 7571 | safi_t safi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7572 | |
| 7573 | bgp = p->bgp; |
| 7574 | |
| 7575 | /* Configured IP address. */ |
| 7576 | vty_out (vty, "BGP neighbor is %s, ", p->host); |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 7577 | vty_out (vty, "remote AS %u, ", p->as); |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 7578 | vty_out (vty, "local AS %u%s%s, ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7579 | p->change_local_as ? p->change_local_as : p->local_as, |
| 7580 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 7581 | " no-prepend" : "", |
| 7582 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? |
| 7583 | " replace-as" : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7584 | vty_out (vty, "%s link%s", |
| 7585 | p->as == p->local_as ? "internal" : "external", |
| 7586 | VTY_NEWLINE); |
| 7587 | |
| 7588 | /* Description. */ |
| 7589 | if (p->desc) |
| 7590 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); |
| 7591 | |
| 7592 | /* Peer-group */ |
| 7593 | if (p->group) |
| 7594 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
| 7595 | p->group->name, VTY_NEWLINE); |
| 7596 | |
| 7597 | /* Administrative shutdown. */ |
| 7598 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) |
| 7599 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); |
| 7600 | |
| 7601 | /* BGP Version. */ |
| 7602 | vty_out (vty, " BGP version 4"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7603 | vty_out (vty, ", remote router ID %s%s", |
| 7604 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), |
| 7605 | VTY_NEWLINE); |
| 7606 | |
| 7607 | /* Confederation */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7608 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
| 7609 | && bgp_confederation_peers_check (bgp, p->as)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7610 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
| 7611 | |
| 7612 | /* Status. */ |
| 7613 | vty_out (vty, " BGP state = %s", |
| 7614 | LOOKUP (bgp_status_msg, p->status)); |
| 7615 | if (p->status == Established) |
| 7616 | vty_out (vty, ", up for %8s", |
| 7617 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7618 | else if (p->status == Active) |
| 7619 | { |
| 7620 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) |
| 7621 | vty_out (vty, " (passive)"); |
| 7622 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) |
| 7623 | vty_out (vty, " (NSF passive)"); |
| 7624 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7625 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7626 | |
| 7627 | /* read timer */ |
| 7628 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); |
| 7629 | |
| 7630 | /* Configured timer values. */ |
| 7631 | vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s", |
| 7632 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); |
| 7633 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) |
| 7634 | { |
| 7635 | vty_out (vty, " Configured hold time is %d", p->holdtime); |
| 7636 | vty_out (vty, ", keepalive interval is %d seconds%s", |
| 7637 | p->keepalive, VTY_NEWLINE); |
| 7638 | } |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7639 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7640 | /* Capability. */ |
| 7641 | if (p->status == Established) |
| 7642 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7643 | if (p->cap |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7644 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
| 7645 | || p->afc_recv[AFI_IP][SAFI_UNICAST] |
| 7646 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] |
| 7647 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] |
| 7648 | #ifdef HAVE_IPV6 |
| 7649 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] |
| 7650 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] |
| 7651 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] |
| 7652 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] |
| 7653 | #endif /* HAVE_IPV6 */ |
| 7654 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] |
| 7655 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) |
| 7656 | { |
| 7657 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); |
| 7658 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7659 | /* AS4 */ |
| 7660 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) |
| 7661 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) |
| 7662 | { |
| 7663 | vty_out (vty, " 4 Byte AS:"); |
| 7664 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) |
| 7665 | vty_out (vty, " advertised"); |
| 7666 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) |
| 7667 | vty_out (vty, " %sreceived", |
| 7668 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); |
| 7669 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7670 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7671 | /* Dynamic */ |
| 7672 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) |
| 7673 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7674 | { |
| 7675 | vty_out (vty, " Dynamic:"); |
| 7676 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7677 | vty_out (vty, " advertised"); |
| 7678 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7679 | vty_out (vty, " %sreceived", |
| 7680 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7681 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7682 | } |
| 7683 | |
| 7684 | /* Route Refresh */ |
| 7685 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) |
| 7686 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7687 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
| 7688 | { |
| 7689 | vty_out (vty, " Route refresh:"); |
| 7690 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) |
| 7691 | vty_out (vty, " advertised"); |
| 7692 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7693 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7694 | vty_out (vty, " %sreceived(%s)", |
| 7695 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", |
| 7696 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) |
| 7697 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? |
| 7698 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); |
| 7699 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7700 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7701 | } |
| 7702 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7703 | /* Multiprotocol Extensions */ |
| 7704 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7705 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7706 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7707 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7708 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
| 7709 | if (p->afc_adv[afi][safi]) |
| 7710 | vty_out (vty, " advertised"); |
| 7711 | if (p->afc_recv[afi][safi]) |
| 7712 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); |
| 7713 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7714 | } |
| 7715 | |
| 7716 | /* Gracefull Restart */ |
| 7717 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7718 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7719 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7720 | vty_out (vty, " Graceful Restart Capabilty:"); |
| 7721 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7722 | vty_out (vty, " advertised"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7723 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
| 7724 | vty_out (vty, " %sreceived", |
| 7725 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7726 | vty_out (vty, "%s", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7727 | |
| 7728 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7729 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7730 | int restart_af_count = 0; |
| 7731 | |
| 7732 | vty_out (vty, " Remote Restart timer is %d seconds%s", |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7733 | p->v_gr_restart, VTY_NEWLINE); |
| 7734 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7735 | |
| 7736 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7737 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7738 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) |
| 7739 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7740 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
| 7741 | afi_safi_print (afi, safi), |
| 7742 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? |
| 7743 | "preserved" : "not preserved"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7744 | restart_af_count++; |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7745 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7746 | if (! restart_af_count) |
| 7747 | vty_out (vty, "none"); |
| 7748 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7749 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7750 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7751 | } |
| 7752 | } |
| 7753 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7754 | /* graceful restart information */ |
| 7755 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7756 | || p->t_gr_restart |
| 7757 | || p->t_gr_stale) |
| 7758 | { |
| 7759 | int eor_send_af_count = 0; |
| 7760 | int eor_receive_af_count = 0; |
| 7761 | |
| 7762 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); |
| 7763 | if (p->status == Established) |
| 7764 | { |
| 7765 | vty_out (vty, " End-of-RIB send: "); |
| 7766 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7767 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7768 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) |
| 7769 | { |
| 7770 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", |
| 7771 | afi_safi_print (afi, safi)); |
| 7772 | eor_send_af_count++; |
| 7773 | } |
| 7774 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7775 | |
| 7776 | vty_out (vty, " End-of-RIB received: "); |
| 7777 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7778 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7779 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) |
| 7780 | { |
| 7781 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", |
| 7782 | afi_safi_print (afi, safi)); |
| 7783 | eor_receive_af_count++; |
| 7784 | } |
| 7785 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7786 | } |
| 7787 | |
| 7788 | if (p->t_gr_restart) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7789 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
| 7790 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); |
| 7791 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7792 | if (p->t_gr_stale) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7793 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
| 7794 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7795 | } |
| 7796 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7797 | /* Packet counts. */ |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7798 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
| 7799 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7800 | 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] | 7801 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
| 7802 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); |
| 7803 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); |
| 7804 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); |
| 7805 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); |
| 7806 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); |
| 7807 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); |
| 7808 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + |
| 7809 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, |
| 7810 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + |
| 7811 | p->dynamic_cap_in, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7812 | |
| 7813 | /* advertisement-interval */ |
| 7814 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", |
| 7815 | p->v_routeadv, VTY_NEWLINE); |
| 7816 | |
| 7817 | /* Update-source. */ |
| 7818 | if (p->update_if || p->update_source) |
| 7819 | { |
| 7820 | vty_out (vty, " Update source is "); |
| 7821 | if (p->update_if) |
| 7822 | vty_out (vty, "%s", p->update_if); |
| 7823 | else if (p->update_source) |
| 7824 | vty_out (vty, "%s", |
| 7825 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); |
| 7826 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7827 | } |
| 7828 | |
| 7829 | /* Default weight */ |
| 7830 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) |
| 7831 | vty_out (vty, " Default weight %d%s", p->weight, |
| 7832 | VTY_NEWLINE); |
| 7833 | |
| 7834 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7835 | |
| 7836 | /* Address Family Information */ |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7837 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7838 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7839 | if (p->afc[afi][safi]) |
| 7840 | bgp_show_peer_afi (vty, p, afi, safi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7841 | |
| 7842 | vty_out (vty, " Connections established %d; dropped %d%s", |
| 7843 | p->established, p->dropped, |
| 7844 | VTY_NEWLINE); |
| 7845 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7846 | if (! p->dropped) |
| 7847 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); |
| 7848 | else |
| 7849 | vty_out (vty, " Last reset %s, due to %s%s", |
| 7850 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), |
| 7851 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 7852 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7853 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7854 | { |
| 7855 | 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] | 7856 | |
| 7857 | if (p->t_pmax_restart) |
| 7858 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", |
| 7859 | p->host, thread_timer_remain_second (p->t_pmax_restart), |
| 7860 | VTY_NEWLINE); |
| 7861 | else |
| 7862 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", |
| 7863 | p->host, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7864 | } |
| 7865 | |
Stephen Hemminger | f5a4827 | 2011-03-24 17:30:21 +0000 | [diff] [blame] | 7866 | /* EBGP Multihop and GTSM */ |
Jorge Boncompte [DTI2] | 6d85b15 | 2012-05-07 16:52:54 +0000 | [diff] [blame] | 7867 | if (p->sort != BGP_PEER_IBGP) |
Stephen Hemminger | f5a4827 | 2011-03-24 17:30:21 +0000 | [diff] [blame] | 7868 | { |
| 7869 | if (p->gtsm_hops > 0) |
| 7870 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 7871 | p->gtsm_hops, VTY_NEWLINE); |
| 7872 | else if (p->ttl > 1) |
| 7873 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 7874 | p->ttl, VTY_NEWLINE); |
| 7875 | } |
Pradosh Mohapatra | 5d804b4 | 2013-09-12 03:37:07 +0000 | [diff] [blame] | 7876 | else |
| 7877 | { |
| 7878 | if (p->gtsm_hops > 0) |
| 7879 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", |
| 7880 | p->gtsm_hops, VTY_NEWLINE); |
| 7881 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7882 | |
| 7883 | /* Local address. */ |
| 7884 | if (p->su_local) |
| 7885 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7886 | vty_out (vty, "Local host: %s, Local port: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7887 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
| 7888 | ntohs (p->su_local->sin.sin_port), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7889 | VTY_NEWLINE); |
| 7890 | } |
| 7891 | |
| 7892 | /* Remote address. */ |
| 7893 | if (p->su_remote) |
| 7894 | { |
| 7895 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", |
| 7896 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
| 7897 | ntohs (p->su_remote->sin.sin_port), |
| 7898 | VTY_NEWLINE); |
| 7899 | } |
| 7900 | |
| 7901 | /* Nexthop display. */ |
| 7902 | if (p->su_local) |
| 7903 | { |
| 7904 | vty_out (vty, "Nexthop: %s%s", |
| 7905 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), |
| 7906 | VTY_NEWLINE); |
| 7907 | #ifdef HAVE_IPV6 |
| 7908 | vty_out (vty, "Nexthop global: %s%s", |
| 7909 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), |
| 7910 | VTY_NEWLINE); |
| 7911 | vty_out (vty, "Nexthop local: %s%s", |
| 7912 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), |
| 7913 | VTY_NEWLINE); |
| 7914 | vty_out (vty, "BGP connection: %s%s", |
| 7915 | p->shared_network ? "shared network" : "non shared network", |
| 7916 | VTY_NEWLINE); |
| 7917 | #endif /* HAVE_IPV6 */ |
| 7918 | } |
| 7919 | |
Timo Teräs | ef75770 | 2015-04-29 09:43:04 +0300 | [diff] [blame] | 7920 | /* TCP metrics. */ |
| 7921 | if (p->status == Established && p->rtt) |
| 7922 | vty_out (vty, "Estimated round trip time: %d ms%s", |
| 7923 | p->rtt, VTY_NEWLINE); |
| 7924 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7925 | /* Timer information. */ |
| 7926 | if (p->t_start) |
| 7927 | vty_out (vty, "Next start timer due in %ld seconds%s", |
| 7928 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); |
| 7929 | if (p->t_connect) |
| 7930 | vty_out (vty, "Next connect timer due in %ld seconds%s", |
| 7931 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); |
| 7932 | |
| 7933 | vty_out (vty, "Read thread: %s Write thread: %s%s", |
| 7934 | p->t_read ? "on" : "off", |
| 7935 | p->t_write ? "on" : "off", |
| 7936 | VTY_NEWLINE); |
| 7937 | |
| 7938 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR |
| 7939 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) |
| 7940 | bgp_capability_vty_out (vty, p); |
| 7941 | |
| 7942 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7943 | } |
| 7944 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7945 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7946 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
| 7947 | enum show_type type, union sockunion *su) |
| 7948 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7949 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7950 | struct peer *peer; |
| 7951 | int find = 0; |
| 7952 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7953 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7954 | { |
| 7955 | switch (type) |
| 7956 | { |
| 7957 | case show_all: |
| 7958 | bgp_show_peer (vty, peer); |
| 7959 | break; |
| 7960 | case show_peer: |
| 7961 | if (sockunion_same (&peer->su, su)) |
| 7962 | { |
| 7963 | find = 1; |
| 7964 | bgp_show_peer (vty, peer); |
| 7965 | } |
| 7966 | break; |
| 7967 | } |
| 7968 | } |
| 7969 | |
| 7970 | if (type == show_peer && ! find) |
| 7971 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); |
| 7972 | |
| 7973 | return CMD_SUCCESS; |
| 7974 | } |
| 7975 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7976 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7977 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
| 7978 | enum show_type type, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7979 | { |
| 7980 | int ret; |
| 7981 | struct bgp *bgp; |
| 7982 | union sockunion su; |
| 7983 | |
| 7984 | if (ip_str) |
| 7985 | { |
| 7986 | ret = str2sockunion (ip_str, &su); |
| 7987 | if (ret < 0) |
| 7988 | { |
| 7989 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 7990 | return CMD_WARNING; |
| 7991 | } |
| 7992 | } |
| 7993 | |
| 7994 | if (name) |
| 7995 | { |
| 7996 | bgp = bgp_lookup_by_name (name); |
| 7997 | |
| 7998 | if (! bgp) |
| 7999 | { |
| 8000 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 8001 | return CMD_WARNING; |
| 8002 | } |
| 8003 | |
| 8004 | bgp_show_neighbor (vty, bgp, type, &su); |
| 8005 | |
| 8006 | return CMD_SUCCESS; |
| 8007 | } |
| 8008 | |
| 8009 | bgp = bgp_get_default (); |
| 8010 | |
| 8011 | if (bgp) |
| 8012 | bgp_show_neighbor (vty, bgp, type, &su); |
| 8013 | |
| 8014 | return CMD_SUCCESS; |
| 8015 | } |
| 8016 | |
| 8017 | /* "show ip bgp neighbors" commands. */ |
| 8018 | DEFUN (show_ip_bgp_neighbors, |
| 8019 | show_ip_bgp_neighbors_cmd, |
| 8020 | "show ip bgp neighbors", |
| 8021 | SHOW_STR |
| 8022 | IP_STR |
| 8023 | BGP_STR |
| 8024 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8025 | { |
| 8026 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); |
| 8027 | } |
| 8028 | |
| 8029 | ALIAS (show_ip_bgp_neighbors, |
| 8030 | show_ip_bgp_ipv4_neighbors_cmd, |
| 8031 | "show ip bgp ipv4 (unicast|multicast) neighbors", |
| 8032 | SHOW_STR |
| 8033 | IP_STR |
| 8034 | BGP_STR |
| 8035 | "Address family\n" |
| 8036 | "Address Family modifier\n" |
| 8037 | "Address Family modifier\n" |
| 8038 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8039 | |
| 8040 | ALIAS (show_ip_bgp_neighbors, |
| 8041 | show_ip_bgp_vpnv4_all_neighbors_cmd, |
| 8042 | "show ip bgp vpnv4 all neighbors", |
| 8043 | SHOW_STR |
| 8044 | IP_STR |
| 8045 | BGP_STR |
| 8046 | "Display VPNv4 NLRI specific information\n" |
| 8047 | "Display information about all VPNv4 NLRIs\n" |
| 8048 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8049 | |
| 8050 | ALIAS (show_ip_bgp_neighbors, |
| 8051 | show_ip_bgp_vpnv4_rd_neighbors_cmd, |
| 8052 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", |
| 8053 | SHOW_STR |
| 8054 | IP_STR |
| 8055 | BGP_STR |
| 8056 | "Display VPNv4 NLRI specific information\n" |
| 8057 | "Display information for a route distinguisher\n" |
| 8058 | "VPN Route Distinguisher\n" |
| 8059 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8060 | |
| 8061 | ALIAS (show_ip_bgp_neighbors, |
| 8062 | show_bgp_neighbors_cmd, |
| 8063 | "show bgp neighbors", |
| 8064 | SHOW_STR |
| 8065 | BGP_STR |
| 8066 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8067 | |
| 8068 | ALIAS (show_ip_bgp_neighbors, |
| 8069 | show_bgp_ipv6_neighbors_cmd, |
| 8070 | "show bgp ipv6 neighbors", |
| 8071 | SHOW_STR |
| 8072 | BGP_STR |
| 8073 | "Address family\n" |
| 8074 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8075 | |
| 8076 | DEFUN (show_ip_bgp_neighbors_peer, |
| 8077 | show_ip_bgp_neighbors_peer_cmd, |
| 8078 | "show ip bgp neighbors (A.B.C.D|X:X::X:X)", |
| 8079 | SHOW_STR |
| 8080 | IP_STR |
| 8081 | BGP_STR |
| 8082 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8083 | "Neighbor to display information about\n" |
| 8084 | "Neighbor to display information about\n") |
| 8085 | { |
| 8086 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); |
| 8087 | } |
| 8088 | |
| 8089 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8090 | show_ip_bgp_ipv4_neighbors_peer_cmd, |
| 8091 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)", |
| 8092 | SHOW_STR |
| 8093 | IP_STR |
| 8094 | BGP_STR |
| 8095 | "Address family\n" |
| 8096 | "Address Family modifier\n" |
| 8097 | "Address Family modifier\n" |
| 8098 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8099 | "Neighbor to display information about\n" |
| 8100 | "Neighbor to display information about\n") |
| 8101 | |
| 8102 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8103 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, |
| 8104 | "show ip bgp vpnv4 all neighbors A.B.C.D", |
| 8105 | SHOW_STR |
| 8106 | IP_STR |
| 8107 | BGP_STR |
| 8108 | "Display VPNv4 NLRI specific information\n" |
| 8109 | "Display information about all VPNv4 NLRIs\n" |
| 8110 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8111 | "Neighbor to display information about\n") |
| 8112 | |
| 8113 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8114 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, |
| 8115 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", |
| 8116 | SHOW_STR |
| 8117 | IP_STR |
| 8118 | BGP_STR |
| 8119 | "Display VPNv4 NLRI specific information\n" |
| 8120 | "Display information about all VPNv4 NLRIs\n" |
| 8121 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8122 | "Neighbor to display information about\n") |
| 8123 | |
| 8124 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8125 | show_bgp_neighbors_peer_cmd, |
| 8126 | "show bgp neighbors (A.B.C.D|X:X::X:X)", |
| 8127 | SHOW_STR |
| 8128 | BGP_STR |
| 8129 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8130 | "Neighbor to display information about\n" |
| 8131 | "Neighbor to display information about\n") |
| 8132 | |
| 8133 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8134 | show_bgp_ipv6_neighbors_peer_cmd, |
| 8135 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 8136 | SHOW_STR |
| 8137 | BGP_STR |
| 8138 | "Address family\n" |
| 8139 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8140 | "Neighbor to display information about\n" |
| 8141 | "Neighbor to display information about\n") |
| 8142 | |
| 8143 | DEFUN (show_ip_bgp_instance_neighbors, |
| 8144 | show_ip_bgp_instance_neighbors_cmd, |
| 8145 | "show ip bgp view WORD neighbors", |
| 8146 | SHOW_STR |
| 8147 | IP_STR |
| 8148 | BGP_STR |
| 8149 | "BGP view\n" |
| 8150 | "View name\n" |
| 8151 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8152 | { |
| 8153 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); |
| 8154 | } |
| 8155 | |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 8156 | ALIAS (show_ip_bgp_instance_neighbors, |
| 8157 | show_bgp_instance_neighbors_cmd, |
| 8158 | "show bgp view WORD neighbors", |
| 8159 | SHOW_STR |
| 8160 | BGP_STR |
| 8161 | "BGP view\n" |
| 8162 | "View name\n" |
| 8163 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8164 | |
| 8165 | ALIAS (show_ip_bgp_instance_neighbors, |
| 8166 | show_bgp_instance_ipv6_neighbors_cmd, |
| 8167 | "show bgp view WORD ipv6 neighbors", |
| 8168 | SHOW_STR |
| 8169 | BGP_STR |
| 8170 | "BGP view\n" |
| 8171 | "View name\n" |
| 8172 | "Address family\n" |
| 8173 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8174 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8175 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
| 8176 | show_ip_bgp_instance_neighbors_peer_cmd, |
| 8177 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 8178 | SHOW_STR |
| 8179 | IP_STR |
| 8180 | BGP_STR |
| 8181 | "BGP view\n" |
| 8182 | "View name\n" |
| 8183 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8184 | "Neighbor to display information about\n" |
| 8185 | "Neighbor to display information about\n") |
| 8186 | { |
| 8187 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); |
| 8188 | } |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 8189 | |
| 8190 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 8191 | show_bgp_instance_neighbors_peer_cmd, |
| 8192 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 8193 | SHOW_STR |
| 8194 | BGP_STR |
| 8195 | "BGP view\n" |
| 8196 | "View name\n" |
| 8197 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8198 | "Neighbor to display information about\n" |
| 8199 | "Neighbor to display information about\n") |
| 8200 | |
| 8201 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 8202 | show_bgp_instance_ipv6_neighbors_peer_cmd, |
| 8203 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 8204 | SHOW_STR |
| 8205 | BGP_STR |
| 8206 | "BGP view\n" |
| 8207 | "View name\n" |
| 8208 | "Address family\n" |
| 8209 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8210 | "Neighbor to display information about\n" |
| 8211 | "Neighbor to display information about\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 8212 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8213 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
| 8214 | paths' and `show ip mbgp paths'. Those functions results are the |
| 8215 | same.*/ |
| 8216 | DEFUN (show_ip_bgp_paths, |
| 8217 | show_ip_bgp_paths_cmd, |
| 8218 | "show ip bgp paths", |
| 8219 | SHOW_STR |
| 8220 | IP_STR |
| 8221 | BGP_STR |
| 8222 | "Path information\n") |
| 8223 | { |
| 8224 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); |
| 8225 | aspath_print_all_vty (vty); |
| 8226 | return CMD_SUCCESS; |
| 8227 | } |
| 8228 | |
| 8229 | DEFUN (show_ip_bgp_ipv4_paths, |
| 8230 | show_ip_bgp_ipv4_paths_cmd, |
| 8231 | "show ip bgp ipv4 (unicast|multicast) paths", |
| 8232 | SHOW_STR |
| 8233 | IP_STR |
| 8234 | BGP_STR |
| 8235 | "Address family\n" |
| 8236 | "Address Family modifier\n" |
| 8237 | "Address Family modifier\n" |
| 8238 | "Path information\n") |
| 8239 | { |
| 8240 | vty_out (vty, "Address Refcnt Path\r\n"); |
| 8241 | aspath_print_all_vty (vty); |
| 8242 | |
| 8243 | return CMD_SUCCESS; |
| 8244 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 8245 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8246 | #include "hash.h" |
| 8247 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8248 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8249 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
| 8250 | { |
| 8251 | struct community *com; |
| 8252 | |
| 8253 | com = (struct community *) backet->data; |
David Lamparter | eed3c48 | 2015-03-03 08:51:53 +0100 | [diff] [blame] | 8254 | vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8255 | community_str (com), VTY_NEWLINE); |
| 8256 | } |
| 8257 | |
| 8258 | /* Show BGP's community internal data. */ |
| 8259 | DEFUN (show_ip_bgp_community_info, |
| 8260 | show_ip_bgp_community_info_cmd, |
| 8261 | "show ip bgp community-info", |
| 8262 | SHOW_STR |
| 8263 | IP_STR |
| 8264 | BGP_STR |
| 8265 | "List all bgp community information\n") |
| 8266 | { |
| 8267 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); |
| 8268 | |
| 8269 | hash_iterate (community_hash (), |
| 8270 | (void (*) (struct hash_backet *, void *)) |
| 8271 | community_show_all_iterator, |
| 8272 | vty); |
| 8273 | |
| 8274 | return CMD_SUCCESS; |
| 8275 | } |
| 8276 | |
| 8277 | DEFUN (show_ip_bgp_attr_info, |
| 8278 | show_ip_bgp_attr_info_cmd, |
| 8279 | "show ip bgp attribute-info", |
| 8280 | SHOW_STR |
| 8281 | IP_STR |
| 8282 | BGP_STR |
| 8283 | "List all bgp attribute information\n") |
| 8284 | { |
| 8285 | attr_show_all (vty); |
| 8286 | return CMD_SUCCESS; |
| 8287 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 8288 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8289 | static int |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8290 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
| 8291 | afi_t afi, safi_t safi) |
| 8292 | { |
| 8293 | char timebuf[BGP_UPTIME_LEN]; |
| 8294 | char rmbuf[14]; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8295 | const char *rmname; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8296 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8297 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8298 | int len; |
| 8299 | int count = 0; |
| 8300 | |
| 8301 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) |
| 8302 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8303 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8304 | { |
| 8305 | count++; |
| 8306 | bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 8307 | } |
| 8308 | return count; |
| 8309 | } |
| 8310 | |
| 8311 | len = vty_out (vty, "%s", rsclient->host); |
| 8312 | len = 16 - len; |
| 8313 | |
| 8314 | if (len < 1) |
| 8315 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 8316 | else |
| 8317 | vty_out (vty, "%*s", len, " "); |
| 8318 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 8319 | vty_out (vty, "4 "); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8320 | |
Milan Kocian | cb4fc59 | 2014-12-01 12:48:25 +0000 | [diff] [blame] | 8321 | vty_out (vty, "%10u ", rsclient->as); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8322 | |
| 8323 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); |
| 8324 | if ( rmname && strlen (rmname) > 13 ) |
| 8325 | { |
| 8326 | sprintf (rmbuf, "%13s", "..."); |
| 8327 | rmname = strncpy (rmbuf, rmname, 10); |
| 8328 | } |
| 8329 | else if (! rmname) |
| 8330 | rmname = "<none>"; |
| 8331 | vty_out (vty, " %13s ", rmname); |
| 8332 | |
| 8333 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); |
| 8334 | if ( rmname && strlen (rmname) > 13 ) |
| 8335 | { |
| 8336 | sprintf (rmbuf, "%13s", "..."); |
| 8337 | rmname = strncpy (rmbuf, rmname, 10); |
| 8338 | } |
| 8339 | else if (! rmname) |
| 8340 | rmname = "<none>"; |
| 8341 | vty_out (vty, " %13s ", rmname); |
| 8342 | |
| 8343 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); |
| 8344 | |
| 8345 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) |
| 8346 | vty_out (vty, " Idle (Admin)"); |
| 8347 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 8348 | vty_out (vty, " Idle (PfxCt)"); |
| 8349 | else |
| 8350 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); |
| 8351 | |
| 8352 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8353 | |
| 8354 | return 1; |
| 8355 | } |
| 8356 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8357 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8358 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
| 8359 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8360 | { |
| 8361 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8362 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8363 | int count = 0; |
| 8364 | |
| 8365 | /* Header string for each address family. */ |
Milan Kocian | cb4fc59 | 2014-12-01 12:48:25 +0000 | [diff] [blame] | 8366 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8367 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8368 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8369 | { |
| 8370 | if (peer->afc[afi][safi] && |
| 8371 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 8372 | { |
| 8373 | if (! count) |
| 8374 | { |
| 8375 | vty_out (vty, |
| 8376 | "Route Server's BGP router identifier %s%s", |
| 8377 | inet_ntoa (bgp->router_id), VTY_NEWLINE); |
| 8378 | vty_out (vty, |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 8379 | "Route Server's local AS number %u%s", bgp->as, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8380 | VTY_NEWLINE); |
| 8381 | |
| 8382 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8383 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 8384 | } |
| 8385 | |
| 8386 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 8387 | } |
| 8388 | } |
| 8389 | |
| 8390 | if (count) |
| 8391 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, |
| 8392 | count, VTY_NEWLINE); |
| 8393 | else |
| 8394 | vty_out (vty, "No %s Route Server Client is configured%s", |
| 8395 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 8396 | |
| 8397 | return CMD_SUCCESS; |
| 8398 | } |
| 8399 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8400 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8401 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
| 8402 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8403 | { |
| 8404 | struct bgp *bgp; |
| 8405 | |
| 8406 | if (name) |
| 8407 | { |
| 8408 | bgp = bgp_lookup_by_name (name); |
| 8409 | |
| 8410 | if (! bgp) |
| 8411 | { |
| 8412 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 8413 | return CMD_WARNING; |
| 8414 | } |
| 8415 | |
| 8416 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 8417 | return CMD_SUCCESS; |
| 8418 | } |
| 8419 | |
| 8420 | bgp = bgp_get_default (); |
| 8421 | |
| 8422 | if (bgp) |
| 8423 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 8424 | |
| 8425 | return CMD_SUCCESS; |
| 8426 | } |
| 8427 | |
| 8428 | /* 'show bgp rsclient' commands. */ |
| 8429 | DEFUN (show_ip_bgp_rsclient_summary, |
| 8430 | show_ip_bgp_rsclient_summary_cmd, |
| 8431 | "show ip bgp rsclient summary", |
| 8432 | SHOW_STR |
| 8433 | IP_STR |
| 8434 | BGP_STR |
| 8435 | "Information about Route Server Clients\n" |
| 8436 | "Summary of all Route Server Clients\n") |
| 8437 | { |
| 8438 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 8439 | } |
| 8440 | |
| 8441 | DEFUN (show_ip_bgp_instance_rsclient_summary, |
| 8442 | show_ip_bgp_instance_rsclient_summary_cmd, |
| 8443 | "show ip bgp view WORD rsclient summary", |
| 8444 | SHOW_STR |
| 8445 | IP_STR |
| 8446 | BGP_STR |
| 8447 | "BGP view\n" |
| 8448 | "View name\n" |
| 8449 | "Information about Route Server Clients\n" |
| 8450 | "Summary of all Route Server Clients\n") |
| 8451 | { |
| 8452 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 8453 | } |
| 8454 | |
| 8455 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, |
| 8456 | show_ip_bgp_ipv4_rsclient_summary_cmd, |
| 8457 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", |
| 8458 | SHOW_STR |
| 8459 | IP_STR |
| 8460 | BGP_STR |
| 8461 | "Address family\n" |
| 8462 | "Address Family modifier\n" |
| 8463 | "Address Family modifier\n" |
| 8464 | "Information about Route Server Clients\n" |
| 8465 | "Summary of all Route Server Clients\n") |
| 8466 | { |
| 8467 | if (strncmp (argv[0], "m", 1) == 0) |
| 8468 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 8469 | |
| 8470 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 8471 | } |
| 8472 | |
| 8473 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, |
| 8474 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, |
| 8475 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 8476 | SHOW_STR |
| 8477 | IP_STR |
| 8478 | BGP_STR |
| 8479 | "BGP view\n" |
| 8480 | "View name\n" |
| 8481 | "Address family\n" |
| 8482 | "Address Family modifier\n" |
| 8483 | "Address Family modifier\n" |
| 8484 | "Information about Route Server Clients\n" |
| 8485 | "Summary of all Route Server Clients\n") |
| 8486 | { |
| 8487 | if (strncmp (argv[1], "m", 1) == 0) |
| 8488 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 8489 | |
| 8490 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 8491 | } |
| 8492 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 8493 | DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary, |
| 8494 | show_bgp_instance_ipv4_safi_rsclient_summary_cmd, |
| 8495 | "show bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 8496 | SHOW_STR |
| 8497 | BGP_STR |
| 8498 | "BGP view\n" |
| 8499 | "View name\n" |
| 8500 | "Address family\n" |
| 8501 | "Address Family modifier\n" |
| 8502 | "Address Family modifier\n" |
| 8503 | "Information about Route Server Clients\n" |
| 8504 | "Summary of all Route Server Clients\n") |
| 8505 | { |
| 8506 | safi_t safi; |
| 8507 | |
| 8508 | if (argc == 2) { |
| 8509 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8510 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi); |
| 8511 | } else { |
| 8512 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8513 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi); |
| 8514 | } |
| 8515 | } |
| 8516 | |
| 8517 | ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary, |
| 8518 | show_bgp_ipv4_safi_rsclient_summary_cmd, |
| 8519 | "show bgp ipv4 (unicast|multicast) rsclient summary", |
| 8520 | SHOW_STR |
| 8521 | BGP_STR |
| 8522 | "Address family\n" |
| 8523 | "Address Family modifier\n" |
| 8524 | "Address Family modifier\n" |
| 8525 | "Information about Route Server Clients\n" |
| 8526 | "Summary of all Route Server Clients\n") |
| 8527 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8528 | #ifdef HAVE_IPV6 |
| 8529 | DEFUN (show_bgp_rsclient_summary, |
| 8530 | show_bgp_rsclient_summary_cmd, |
| 8531 | "show bgp rsclient summary", |
| 8532 | SHOW_STR |
| 8533 | BGP_STR |
| 8534 | "Information about Route Server Clients\n" |
| 8535 | "Summary of all Route Server Clients\n") |
| 8536 | { |
| 8537 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 8538 | } |
| 8539 | |
| 8540 | DEFUN (show_bgp_instance_rsclient_summary, |
| 8541 | show_bgp_instance_rsclient_summary_cmd, |
| 8542 | "show bgp view WORD rsclient summary", |
| 8543 | SHOW_STR |
| 8544 | BGP_STR |
| 8545 | "BGP view\n" |
| 8546 | "View name\n" |
| 8547 | "Information about Route Server Clients\n" |
| 8548 | "Summary of all Route Server Clients\n") |
| 8549 | { |
| 8550 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 8551 | } |
| 8552 | |
| 8553 | ALIAS (show_bgp_rsclient_summary, |
| 8554 | show_bgp_ipv6_rsclient_summary_cmd, |
| 8555 | "show bgp ipv6 rsclient summary", |
| 8556 | SHOW_STR |
| 8557 | BGP_STR |
| 8558 | "Address family\n" |
| 8559 | "Information about Route Server Clients\n" |
| 8560 | "Summary of all Route Server Clients\n") |
| 8561 | |
| 8562 | ALIAS (show_bgp_instance_rsclient_summary, |
| 8563 | show_bgp_instance_ipv6_rsclient_summary_cmd, |
| 8564 | "show bgp view WORD ipv6 rsclient summary", |
| 8565 | SHOW_STR |
| 8566 | BGP_STR |
| 8567 | "BGP view\n" |
| 8568 | "View name\n" |
| 8569 | "Address family\n" |
| 8570 | "Information about Route Server Clients\n" |
| 8571 | "Summary of all Route Server Clients\n") |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 8572 | |
| 8573 | DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary, |
| 8574 | show_bgp_instance_ipv6_safi_rsclient_summary_cmd, |
| 8575 | "show bgp view WORD ipv6 (unicast|multicast) rsclient summary", |
| 8576 | SHOW_STR |
| 8577 | BGP_STR |
| 8578 | "BGP view\n" |
| 8579 | "View name\n" |
| 8580 | "Address family\n" |
| 8581 | "Address Family modifier\n" |
| 8582 | "Address Family modifier\n" |
| 8583 | "Information about Route Server Clients\n" |
| 8584 | "Summary of all Route Server Clients\n") |
| 8585 | { |
| 8586 | safi_t safi; |
| 8587 | |
| 8588 | if (argc == 2) { |
| 8589 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8590 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi); |
| 8591 | } else { |
| 8592 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8593 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi); |
| 8594 | } |
| 8595 | } |
| 8596 | |
| 8597 | ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary, |
| 8598 | show_bgp_ipv6_safi_rsclient_summary_cmd, |
| 8599 | "show bgp ipv6 (unicast|multicast) rsclient summary", |
| 8600 | SHOW_STR |
| 8601 | BGP_STR |
| 8602 | "Address family\n" |
| 8603 | "Address Family modifier\n" |
| 8604 | "Address Family modifier\n" |
| 8605 | "Information about Route Server Clients\n" |
| 8606 | "Summary of all Route Server Clients\n") |
| 8607 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8608 | #endif /* HAVE IPV6 */ |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 8609 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8610 | /* Redistribute VTY commands. */ |
| 8611 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8612 | DEFUN (bgp_redistribute_ipv4, |
| 8613 | bgp_redistribute_ipv4_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8614 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8615 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8616 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8617 | { |
| 8618 | int type; |
| 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 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8627 | } |
| 8628 | |
| 8629 | DEFUN (bgp_redistribute_ipv4_rmap, |
| 8630 | bgp_redistribute_ipv4_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8631 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8632 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8633 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8634 | "Route map reference\n" |
| 8635 | "Pointer to route-map entries\n") |
| 8636 | { |
| 8637 | int type; |
| 8638 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8639 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8640 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8641 | { |
| 8642 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8643 | return CMD_WARNING; |
| 8644 | } |
| 8645 | |
| 8646 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8647 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8648 | } |
| 8649 | |
| 8650 | DEFUN (bgp_redistribute_ipv4_metric, |
| 8651 | bgp_redistribute_ipv4_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8652 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8653 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8654 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8655 | "Metric for redistributed routes\n" |
| 8656 | "Default metric\n") |
| 8657 | { |
| 8658 | int type; |
| 8659 | u_int32_t metric; |
| 8660 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8661 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8662 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8663 | { |
| 8664 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8665 | return CMD_WARNING; |
| 8666 | } |
| 8667 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8668 | |
| 8669 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8670 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8671 | } |
| 8672 | |
| 8673 | DEFUN (bgp_redistribute_ipv4_rmap_metric, |
| 8674 | bgp_redistribute_ipv4_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8675 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8676 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8677 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8678 | "Route map reference\n" |
| 8679 | "Pointer to route-map entries\n" |
| 8680 | "Metric for redistributed routes\n" |
| 8681 | "Default metric\n") |
| 8682 | { |
| 8683 | int type; |
| 8684 | u_int32_t metric; |
| 8685 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8686 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8687 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8688 | { |
| 8689 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8690 | return CMD_WARNING; |
| 8691 | } |
| 8692 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8693 | |
| 8694 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8695 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8696 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8697 | } |
| 8698 | |
| 8699 | DEFUN (bgp_redistribute_ipv4_metric_rmap, |
| 8700 | bgp_redistribute_ipv4_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8701 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8702 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8703 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8704 | "Metric for redistributed routes\n" |
| 8705 | "Default metric\n" |
| 8706 | "Route map reference\n" |
| 8707 | "Pointer to route-map entries\n") |
| 8708 | { |
| 8709 | int type; |
| 8710 | u_int32_t metric; |
| 8711 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8712 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8713 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8714 | { |
| 8715 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8716 | return CMD_WARNING; |
| 8717 | } |
| 8718 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8719 | |
| 8720 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8721 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); |
| 8722 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8723 | } |
| 8724 | |
| 8725 | DEFUN (no_bgp_redistribute_ipv4, |
| 8726 | no_bgp_redistribute_ipv4_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8727 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8728 | NO_STR |
| 8729 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8730 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8731 | { |
| 8732 | int type; |
| 8733 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8734 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8735 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8736 | { |
| 8737 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8738 | return CMD_WARNING; |
| 8739 | } |
| 8740 | |
| 8741 | return bgp_redistribute_unset (vty->index, AFI_IP, type); |
| 8742 | } |
| 8743 | |
| 8744 | DEFUN (no_bgp_redistribute_ipv4_rmap, |
| 8745 | no_bgp_redistribute_ipv4_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8746 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8747 | NO_STR |
| 8748 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8749 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8750 | "Route map reference\n" |
| 8751 | "Pointer to route-map entries\n") |
| 8752 | { |
| 8753 | int type; |
| 8754 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8755 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8756 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8757 | { |
| 8758 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8759 | return CMD_WARNING; |
| 8760 | } |
| 8761 | |
| 8762 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8763 | return CMD_SUCCESS; |
| 8764 | } |
| 8765 | |
| 8766 | DEFUN (no_bgp_redistribute_ipv4_metric, |
| 8767 | no_bgp_redistribute_ipv4_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8768 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8769 | NO_STR |
| 8770 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8771 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8772 | "Metric for redistributed routes\n" |
| 8773 | "Default metric\n") |
| 8774 | { |
| 8775 | int type; |
| 8776 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8777 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8778 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8779 | { |
| 8780 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8781 | return CMD_WARNING; |
| 8782 | } |
| 8783 | |
| 8784 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8785 | return CMD_SUCCESS; |
| 8786 | } |
| 8787 | |
| 8788 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, |
| 8789 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8790 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8791 | NO_STR |
| 8792 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8793 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8794 | "Route map reference\n" |
| 8795 | "Pointer to route-map entries\n" |
| 8796 | "Metric for redistributed routes\n" |
| 8797 | "Default metric\n") |
| 8798 | { |
| 8799 | int type; |
| 8800 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8801 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8802 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8803 | { |
| 8804 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8805 | return CMD_WARNING; |
| 8806 | } |
| 8807 | |
| 8808 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8809 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8810 | return CMD_SUCCESS; |
| 8811 | } |
| 8812 | |
| 8813 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, |
| 8814 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8815 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8816 | NO_STR |
| 8817 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8818 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8819 | "Metric for redistributed routes\n" |
| 8820 | "Default metric\n" |
| 8821 | "Route map reference\n" |
| 8822 | "Pointer to route-map entries\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 8823 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8824 | #ifdef HAVE_IPV6 |
| 8825 | DEFUN (bgp_redistribute_ipv6, |
| 8826 | bgp_redistribute_ipv6_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8827 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8828 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8829 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8830 | { |
| 8831 | int type; |
| 8832 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8833 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8834 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8835 | { |
| 8836 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8837 | return CMD_WARNING; |
| 8838 | } |
| 8839 | |
| 8840 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8841 | } |
| 8842 | |
| 8843 | DEFUN (bgp_redistribute_ipv6_rmap, |
| 8844 | bgp_redistribute_ipv6_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8845 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8846 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8847 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8848 | "Route map reference\n" |
| 8849 | "Pointer to route-map entries\n") |
| 8850 | { |
| 8851 | int type; |
| 8852 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8853 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8854 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8855 | { |
| 8856 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8857 | return CMD_WARNING; |
| 8858 | } |
| 8859 | |
| 8860 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8861 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8862 | } |
| 8863 | |
| 8864 | DEFUN (bgp_redistribute_ipv6_metric, |
| 8865 | bgp_redistribute_ipv6_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8866 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8867 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8868 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8869 | "Metric for redistributed routes\n" |
| 8870 | "Default metric\n") |
| 8871 | { |
| 8872 | int type; |
| 8873 | u_int32_t metric; |
| 8874 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8875 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8876 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8877 | { |
| 8878 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8879 | return CMD_WARNING; |
| 8880 | } |
| 8881 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8882 | |
| 8883 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8884 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8885 | } |
| 8886 | |
| 8887 | DEFUN (bgp_redistribute_ipv6_rmap_metric, |
| 8888 | bgp_redistribute_ipv6_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8889 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8890 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8891 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8892 | "Route map reference\n" |
| 8893 | "Pointer to route-map entries\n" |
| 8894 | "Metric for redistributed routes\n" |
| 8895 | "Default metric\n") |
| 8896 | { |
| 8897 | int type; |
| 8898 | u_int32_t metric; |
| 8899 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8900 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8901 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8902 | { |
| 8903 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8904 | return CMD_WARNING; |
| 8905 | } |
| 8906 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8907 | |
| 8908 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8909 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8910 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8911 | } |
| 8912 | |
| 8913 | DEFUN (bgp_redistribute_ipv6_metric_rmap, |
| 8914 | bgp_redistribute_ipv6_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8915 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8916 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8917 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8918 | "Metric for redistributed routes\n" |
| 8919 | "Default metric\n" |
| 8920 | "Route map reference\n" |
| 8921 | "Pointer to route-map entries\n") |
| 8922 | { |
| 8923 | int type; |
| 8924 | u_int32_t metric; |
| 8925 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8926 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8927 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8928 | { |
| 8929 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8930 | return CMD_WARNING; |
| 8931 | } |
| 8932 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8933 | |
| 8934 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8935 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); |
| 8936 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8937 | } |
| 8938 | |
| 8939 | DEFUN (no_bgp_redistribute_ipv6, |
| 8940 | no_bgp_redistribute_ipv6_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8941 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8942 | NO_STR |
| 8943 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8944 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8945 | { |
| 8946 | int type; |
| 8947 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8948 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8949 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8950 | { |
| 8951 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8952 | return CMD_WARNING; |
| 8953 | } |
| 8954 | |
| 8955 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); |
| 8956 | } |
| 8957 | |
| 8958 | DEFUN (no_bgp_redistribute_ipv6_rmap, |
| 8959 | no_bgp_redistribute_ipv6_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8960 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8961 | NO_STR |
| 8962 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8963 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8964 | "Route map reference\n" |
| 8965 | "Pointer to route-map entries\n") |
| 8966 | { |
| 8967 | int type; |
| 8968 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8969 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8970 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8971 | { |
| 8972 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8973 | return CMD_WARNING; |
| 8974 | } |
| 8975 | |
| 8976 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8977 | return CMD_SUCCESS; |
| 8978 | } |
| 8979 | |
| 8980 | DEFUN (no_bgp_redistribute_ipv6_metric, |
| 8981 | no_bgp_redistribute_ipv6_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8982 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8983 | NO_STR |
| 8984 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8985 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8986 | "Metric for redistributed routes\n" |
| 8987 | "Default metric\n") |
| 8988 | { |
| 8989 | int type; |
| 8990 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8991 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8992 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8993 | { |
| 8994 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8995 | return CMD_WARNING; |
| 8996 | } |
| 8997 | |
| 8998 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8999 | return CMD_SUCCESS; |
| 9000 | } |
| 9001 | |
| 9002 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, |
| 9003 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 9004 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9005 | NO_STR |
| 9006 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 9007 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9008 | "Route map reference\n" |
| 9009 | "Pointer to route-map entries\n" |
| 9010 | "Metric for redistributed routes\n" |
| 9011 | "Default metric\n") |
| 9012 | { |
| 9013 | int type; |
| 9014 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 9015 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 9016 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9017 | { |
| 9018 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 9019 | return CMD_WARNING; |
| 9020 | } |
| 9021 | |
| 9022 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 9023 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 9024 | return CMD_SUCCESS; |
| 9025 | } |
| 9026 | |
| 9027 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, |
| 9028 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 9029 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9030 | NO_STR |
| 9031 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 9032 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9033 | "Metric for redistributed routes\n" |
| 9034 | "Default metric\n" |
| 9035 | "Route map reference\n" |
| 9036 | "Pointer to route-map entries\n") |
| 9037 | #endif /* HAVE_IPV6 */ |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 9038 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9039 | int |
| 9040 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 9041 | safi_t safi, int *write) |
| 9042 | { |
| 9043 | int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9044 | |
| 9045 | /* Unicast redistribution only. */ |
| 9046 | if (safi != SAFI_UNICAST) |
| 9047 | return 0; |
| 9048 | |
| 9049 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 9050 | { |
| 9051 | /* Redistribute BGP does not make sense. */ |
| 9052 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) |
| 9053 | { |
| 9054 | /* Display "address-family" when it is not yet diplayed. */ |
| 9055 | bgp_config_write_family_header (vty, afi, safi, write); |
| 9056 | |
| 9057 | /* "redistribute" configuration. */ |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 9058 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9059 | |
| 9060 | if (bgp->redist_metric_flag[afi][i]) |
Jorge Boncompte [DTI2] | ddc943d | 2012-04-13 13:46:07 +0200 | [diff] [blame] | 9061 | vty_out (vty, " metric %u", bgp->redist_metric[afi][i]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9062 | |
| 9063 | if (bgp->rmap[afi][i].name) |
| 9064 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); |
| 9065 | |
| 9066 | vty_out (vty, "%s", VTY_NEWLINE); |
| 9067 | } |
| 9068 | } |
| 9069 | return *write; |
| 9070 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 9071 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9072 | /* BGP node structure. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9073 | static struct cmd_node bgp_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9074 | { |
| 9075 | BGP_NODE, |
| 9076 | "%s(config-router)# ", |
| 9077 | 1, |
| 9078 | }; |
| 9079 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9080 | static struct cmd_node bgp_ipv4_unicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9081 | { |
| 9082 | BGP_IPV4_NODE, |
| 9083 | "%s(config-router-af)# ", |
| 9084 | 1, |
| 9085 | }; |
| 9086 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9087 | static struct cmd_node bgp_ipv4_multicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9088 | { |
| 9089 | BGP_IPV4M_NODE, |
| 9090 | "%s(config-router-af)# ", |
| 9091 | 1, |
| 9092 | }; |
| 9093 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9094 | static struct cmd_node bgp_ipv6_unicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9095 | { |
| 9096 | BGP_IPV6_NODE, |
| 9097 | "%s(config-router-af)# ", |
| 9098 | 1, |
| 9099 | }; |
| 9100 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9101 | static struct cmd_node bgp_ipv6_multicast_node = |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9102 | { |
| 9103 | BGP_IPV6M_NODE, |
| 9104 | "%s(config-router-af)# ", |
| 9105 | 1, |
| 9106 | }; |
| 9107 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9108 | static struct cmd_node bgp_vpnv4_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9109 | { |
| 9110 | BGP_VPNV4_NODE, |
| 9111 | "%s(config-router-af)# ", |
| 9112 | 1 |
| 9113 | }; |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 9114 | |
paul | 1f8ae70 | 2005-09-09 23:49:49 +0000 | [diff] [blame] | 9115 | static void community_list_vty (void); |
| 9116 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9117 | void |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9118 | bgp_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9119 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9120 | /* Install bgp top node. */ |
| 9121 | install_node (&bgp_node, bgp_config_write); |
| 9122 | install_node (&bgp_ipv4_unicast_node, NULL); |
| 9123 | install_node (&bgp_ipv4_multicast_node, NULL); |
| 9124 | install_node (&bgp_ipv6_unicast_node, NULL); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9125 | install_node (&bgp_ipv6_multicast_node, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9126 | install_node (&bgp_vpnv4_node, NULL); |
| 9127 | |
| 9128 | /* Install default VTY commands to new nodes. */ |
| 9129 | install_default (BGP_NODE); |
| 9130 | install_default (BGP_IPV4_NODE); |
| 9131 | install_default (BGP_IPV4M_NODE); |
| 9132 | install_default (BGP_IPV6_NODE); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9133 | install_default (BGP_IPV6M_NODE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9134 | install_default (BGP_VPNV4_NODE); |
| 9135 | |
| 9136 | /* "bgp multiple-instance" commands. */ |
| 9137 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); |
| 9138 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); |
| 9139 | |
| 9140 | /* "bgp config-type" commands. */ |
| 9141 | install_element (CONFIG_NODE, &bgp_config_type_cmd); |
| 9142 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); |
| 9143 | |
| 9144 | /* Dummy commands (Currently not supported) */ |
| 9145 | install_element (BGP_NODE, &no_synchronization_cmd); |
| 9146 | install_element (BGP_NODE, &no_auto_summary_cmd); |
| 9147 | |
| 9148 | /* "router bgp" commands. */ |
| 9149 | install_element (CONFIG_NODE, &router_bgp_cmd); |
| 9150 | install_element (CONFIG_NODE, &router_bgp_view_cmd); |
| 9151 | |
| 9152 | /* "no router bgp" commands. */ |
| 9153 | install_element (CONFIG_NODE, &no_router_bgp_cmd); |
| 9154 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); |
| 9155 | |
| 9156 | /* "bgp router-id" commands. */ |
| 9157 | install_element (BGP_NODE, &bgp_router_id_cmd); |
| 9158 | install_element (BGP_NODE, &no_bgp_router_id_cmd); |
| 9159 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); |
| 9160 | |
| 9161 | /* "bgp cluster-id" commands. */ |
| 9162 | install_element (BGP_NODE, &bgp_cluster_id_cmd); |
| 9163 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); |
| 9164 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); |
| 9165 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); |
| 9166 | |
| 9167 | /* "bgp confederation" commands. */ |
| 9168 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); |
| 9169 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); |
| 9170 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); |
| 9171 | |
| 9172 | /* "bgp confederation peers" commands. */ |
| 9173 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); |
| 9174 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); |
| 9175 | |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 9176 | /* "maximum-paths" commands. */ |
| 9177 | install_element (BGP_NODE, &bgp_maxpaths_cmd); |
| 9178 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); |
| 9179 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); |
| 9180 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); |
| 9181 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); |
| 9182 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); |
| 9183 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
| 9184 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
| 9185 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
| 9186 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
| 9187 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
| 9188 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
| 9189 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9190 | /* "timers bgp" commands. */ |
| 9191 | install_element (BGP_NODE, &bgp_timers_cmd); |
| 9192 | install_element (BGP_NODE, &no_bgp_timers_cmd); |
| 9193 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); |
| 9194 | |
| 9195 | /* "bgp client-to-client reflection" commands */ |
| 9196 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); |
| 9197 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); |
| 9198 | |
| 9199 | /* "bgp always-compare-med" commands */ |
| 9200 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); |
| 9201 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); |
| 9202 | |
| 9203 | /* "bgp deterministic-med" commands */ |
| 9204 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); |
| 9205 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 9206 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 9207 | /* "bgp graceful-restart" commands */ |
| 9208 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); |
| 9209 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 9210 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
| 9211 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); |
| 9212 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9213 | |
| 9214 | /* "bgp fast-external-failover" commands */ |
| 9215 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); |
| 9216 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); |
| 9217 | |
| 9218 | /* "bgp enforce-first-as" commands */ |
| 9219 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); |
| 9220 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); |
| 9221 | |
| 9222 | /* "bgp bestpath compare-routerid" commands */ |
| 9223 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); |
| 9224 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); |
| 9225 | |
| 9226 | /* "bgp bestpath as-path ignore" commands */ |
| 9227 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); |
| 9228 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); |
| 9229 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 9230 | /* "bgp bestpath as-path confed" commands */ |
| 9231 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); |
| 9232 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); |
| 9233 | |
Pradosh Mohapatra | 2fdd455 | 2013-09-07 07:02:36 +0000 | [diff] [blame] | 9234 | /* "bgp bestpath as-path multipath-relax" commands */ |
| 9235 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); |
| 9236 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); |
| 9237 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 9238 | /* "bgp log-neighbor-changes" commands */ |
| 9239 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); |
| 9240 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); |
| 9241 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9242 | /* "bgp bestpath med" commands */ |
| 9243 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); |
| 9244 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); |
| 9245 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); |
| 9246 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); |
| 9247 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); |
| 9248 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); |
| 9249 | |
| 9250 | /* "no bgp default ipv4-unicast" commands. */ |
| 9251 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); |
| 9252 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); |
| 9253 | |
| 9254 | /* "bgp network import-check" commands. */ |
| 9255 | install_element (BGP_NODE, &bgp_network_import_check_cmd); |
| 9256 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
| 9257 | |
| 9258 | /* "bgp default local-preference" commands. */ |
| 9259 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); |
| 9260 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); |
| 9261 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); |
| 9262 | |
| 9263 | /* "neighbor remote-as" commands. */ |
| 9264 | install_element (BGP_NODE, &neighbor_remote_as_cmd); |
| 9265 | install_element (BGP_NODE, &no_neighbor_cmd); |
| 9266 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); |
| 9267 | |
| 9268 | /* "neighbor peer-group" commands. */ |
| 9269 | install_element (BGP_NODE, &neighbor_peer_group_cmd); |
| 9270 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); |
| 9271 | install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd); |
| 9272 | |
| 9273 | /* "neighbor local-as" commands. */ |
| 9274 | install_element (BGP_NODE, &neighbor_local_as_cmd); |
| 9275 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 9276 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9277 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
| 9278 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); |
| 9279 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 9280 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9281 | |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 9282 | /* "neighbor password" commands. */ |
| 9283 | install_element (BGP_NODE, &neighbor_password_cmd); |
| 9284 | install_element (BGP_NODE, &no_neighbor_password_cmd); |
| 9285 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9286 | /* "neighbor activate" commands. */ |
| 9287 | install_element (BGP_NODE, &neighbor_activate_cmd); |
| 9288 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); |
| 9289 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); |
| 9290 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9291 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9292 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
| 9293 | |
| 9294 | /* "no neighbor activate" commands. */ |
| 9295 | install_element (BGP_NODE, &no_neighbor_activate_cmd); |
| 9296 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); |
| 9297 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); |
| 9298 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9299 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9300 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
| 9301 | |
| 9302 | /* "neighbor peer-group set" commands. */ |
| 9303 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
| 9304 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); |
| 9305 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); |
| 9306 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9307 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9308 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
| 9309 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9310 | /* "no neighbor peer-group unset" commands. */ |
| 9311 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); |
| 9312 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 9313 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); |
| 9314 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9315 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9316 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 9317 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9318 | /* "neighbor softreconfiguration inbound" commands.*/ |
| 9319 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9320 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9321 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9322 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9323 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9324 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9325 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9326 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9327 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9328 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9329 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9330 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9331 | |
| 9332 | /* "neighbor attribute-unchanged" commands. */ |
| 9333 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); |
| 9334 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); |
| 9335 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); |
| 9336 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); |
| 9337 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); |
| 9338 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); |
| 9339 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); |
| 9340 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); |
| 9341 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); |
| 9342 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); |
| 9343 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); |
| 9344 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9345 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9346 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9347 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9348 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9349 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9350 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9351 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9352 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9353 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9354 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9355 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); |
| 9356 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 9357 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 9358 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 9359 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 9360 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 9361 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 9362 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 9363 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 9364 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 9365 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 9366 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9367 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9368 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9369 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9370 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9371 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9372 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9373 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9374 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9375 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9376 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9377 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); |
| 9378 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); |
| 9379 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); |
| 9380 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); |
| 9381 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); |
| 9382 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); |
| 9383 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); |
| 9384 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); |
| 9385 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); |
| 9386 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); |
| 9387 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); |
| 9388 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9389 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9390 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9391 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9392 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9393 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9394 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9395 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9396 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9397 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9398 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9399 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); |
| 9400 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); |
| 9401 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); |
| 9402 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); |
| 9403 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); |
| 9404 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); |
| 9405 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); |
| 9406 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); |
| 9407 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); |
| 9408 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); |
| 9409 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); |
| 9410 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9411 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9412 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9413 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9414 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9415 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9416 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9417 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9418 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9419 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9420 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9421 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
| 9422 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); |
| 9423 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); |
| 9424 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); |
| 9425 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); |
| 9426 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); |
| 9427 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); |
| 9428 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); |
| 9429 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); |
| 9430 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); |
| 9431 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); |
| 9432 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9433 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9434 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9435 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9436 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9437 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9438 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9439 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9440 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9441 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9442 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9443 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
| 9444 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 9445 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 9446 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 9447 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 9448 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 9449 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 9450 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 9451 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 9452 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 9453 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 9454 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9455 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9456 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9457 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9458 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9459 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9460 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9461 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9462 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9463 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9464 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9465 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9466 | /* "nexthop-local unchanged" commands */ |
| 9467 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); |
| 9468 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); |
| 9469 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9470 | /* "transparent-as" and "transparent-nexthop" for old version |
| 9471 | compatibility. */ |
| 9472 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); |
| 9473 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); |
| 9474 | |
| 9475 | /* "neighbor next-hop-self" commands. */ |
| 9476 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); |
| 9477 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); |
| 9478 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); |
| 9479 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 9480 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); |
| 9481 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); |
| 9482 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); |
| 9483 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9484 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
| 9485 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9486 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
| 9487 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 9488 | |
| 9489 | /* "neighbor remove-private-AS" commands. */ |
| 9490 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); |
| 9491 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); |
| 9492 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
| 9493 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 9494 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
| 9495 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); |
| 9496 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
| 9497 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9498 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
| 9499 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9500 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
| 9501 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 9502 | |
| 9503 | /* "neighbor send-community" commands.*/ |
| 9504 | install_element (BGP_NODE, &neighbor_send_community_cmd); |
| 9505 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); |
| 9506 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); |
| 9507 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); |
| 9508 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); |
| 9509 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); |
| 9510 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); |
| 9511 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); |
| 9512 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); |
| 9513 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); |
| 9514 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); |
| 9515 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); |
| 9516 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); |
| 9517 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); |
| 9518 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); |
| 9519 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9520 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
| 9521 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); |
| 9522 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); |
| 9523 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9524 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
| 9525 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); |
| 9526 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); |
| 9527 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); |
| 9528 | |
| 9529 | /* "neighbor route-reflector" commands.*/ |
| 9530 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); |
| 9531 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9532 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); |
| 9533 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9534 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); |
| 9535 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9536 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); |
| 9537 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9538 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
| 9539 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9540 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
| 9541 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9542 | |
| 9543 | /* "neighbor route-server" commands.*/ |
| 9544 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); |
| 9545 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); |
| 9546 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); |
| 9547 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9548 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); |
| 9549 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); |
| 9550 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); |
| 9551 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9552 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
| 9553 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9554 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
| 9555 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9556 | |
| 9557 | /* "neighbor passive" commands. */ |
| 9558 | install_element (BGP_NODE, &neighbor_passive_cmd); |
| 9559 | install_element (BGP_NODE, &no_neighbor_passive_cmd); |
| 9560 | |
| 9561 | /* "neighbor shutdown" commands. */ |
| 9562 | install_element (BGP_NODE, &neighbor_shutdown_cmd); |
| 9563 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); |
| 9564 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 9565 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9566 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
| 9567 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); |
| 9568 | |
| 9569 | /* "neighbor capability orf prefix-list" commands.*/ |
| 9570 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9571 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9572 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9573 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9574 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9575 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9576 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9577 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9578 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9579 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9580 | |
| 9581 | /* "neighbor capability dynamic" commands.*/ |
| 9582 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); |
| 9583 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); |
| 9584 | |
| 9585 | /* "neighbor dont-capability-negotiate" commands. */ |
| 9586 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); |
| 9587 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); |
| 9588 | |
| 9589 | /* "neighbor ebgp-multihop" commands. */ |
| 9590 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); |
| 9591 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); |
| 9592 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); |
| 9593 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); |
| 9594 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 9595 | /* "neighbor disable-connected-check" commands. */ |
| 9596 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); |
| 9597 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9598 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
| 9599 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); |
| 9600 | |
| 9601 | /* "neighbor description" commands. */ |
| 9602 | install_element (BGP_NODE, &neighbor_description_cmd); |
| 9603 | install_element (BGP_NODE, &no_neighbor_description_cmd); |
| 9604 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); |
| 9605 | |
| 9606 | /* "neighbor update-source" commands. "*/ |
| 9607 | install_element (BGP_NODE, &neighbor_update_source_cmd); |
| 9608 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); |
| 9609 | |
| 9610 | /* "neighbor default-originate" commands. */ |
| 9611 | install_element (BGP_NODE, &neighbor_default_originate_cmd); |
| 9612 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); |
| 9613 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); |
| 9614 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9615 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); |
| 9616 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); |
| 9617 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); |
| 9618 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9619 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); |
| 9620 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9621 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); |
| 9622 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9623 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); |
| 9624 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); |
| 9625 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); |
| 9626 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9627 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
| 9628 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9629 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); |
| 9630 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9631 | |
| 9632 | /* "neighbor port" commands. */ |
| 9633 | install_element (BGP_NODE, &neighbor_port_cmd); |
| 9634 | install_element (BGP_NODE, &no_neighbor_port_cmd); |
| 9635 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); |
| 9636 | |
| 9637 | /* "neighbor weight" commands. */ |
| 9638 | install_element (BGP_NODE, &neighbor_weight_cmd); |
| 9639 | install_element (BGP_NODE, &no_neighbor_weight_cmd); |
| 9640 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); |
| 9641 | |
| 9642 | /* "neighbor override-capability" commands. */ |
| 9643 | install_element (BGP_NODE, &neighbor_override_capability_cmd); |
| 9644 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); |
| 9645 | |
| 9646 | /* "neighbor strict-capability-match" commands. */ |
| 9647 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); |
| 9648 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); |
| 9649 | |
| 9650 | /* "neighbor timers" commands. */ |
| 9651 | install_element (BGP_NODE, &neighbor_timers_cmd); |
| 9652 | install_element (BGP_NODE, &no_neighbor_timers_cmd); |
| 9653 | |
| 9654 | /* "neighbor timers connect" commands. */ |
| 9655 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); |
| 9656 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); |
| 9657 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); |
| 9658 | |
| 9659 | /* "neighbor advertisement-interval" commands. */ |
| 9660 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); |
| 9661 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); |
| 9662 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); |
| 9663 | |
| 9664 | /* "neighbor version" commands. */ |
| 9665 | install_element (BGP_NODE, &neighbor_version_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9666 | |
| 9667 | /* "neighbor interface" commands. */ |
| 9668 | install_element (BGP_NODE, &neighbor_interface_cmd); |
| 9669 | install_element (BGP_NODE, &no_neighbor_interface_cmd); |
| 9670 | |
| 9671 | /* "neighbor distribute" commands. */ |
| 9672 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); |
| 9673 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); |
| 9674 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); |
| 9675 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9676 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); |
| 9677 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); |
| 9678 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); |
| 9679 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9680 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
| 9681 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9682 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
| 9683 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9684 | |
| 9685 | /* "neighbor prefix-list" commands. */ |
| 9686 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); |
| 9687 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); |
| 9688 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); |
| 9689 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9690 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); |
| 9691 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); |
| 9692 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); |
| 9693 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9694 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
| 9695 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9696 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
| 9697 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9698 | |
| 9699 | /* "neighbor filter-list" commands. */ |
| 9700 | install_element (BGP_NODE, &neighbor_filter_list_cmd); |
| 9701 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); |
| 9702 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); |
| 9703 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); |
| 9704 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); |
| 9705 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); |
| 9706 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); |
| 9707 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9708 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
| 9709 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9710 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
| 9711 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); |
| 9712 | |
| 9713 | /* "neighbor route-map" commands. */ |
| 9714 | install_element (BGP_NODE, &neighbor_route_map_cmd); |
| 9715 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); |
| 9716 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); |
| 9717 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); |
| 9718 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); |
| 9719 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); |
| 9720 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); |
| 9721 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9722 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
| 9723 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9724 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
| 9725 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); |
| 9726 | |
| 9727 | /* "neighbor unsuppress-map" commands. */ |
| 9728 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); |
| 9729 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9730 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9731 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9732 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); |
| 9733 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9734 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); |
| 9735 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9736 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
| 9737 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9738 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9739 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9740 | |
| 9741 | /* "neighbor maximum-prefix" commands. */ |
| 9742 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9743 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9744 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9745 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9746 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9747 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9748 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9749 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9750 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9751 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9752 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9753 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9754 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9755 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9756 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9757 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9758 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9759 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9760 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9761 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9762 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9763 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9764 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9765 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9766 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9767 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9768 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9769 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9770 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9771 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9772 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9773 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9774 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9775 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9776 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9777 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9778 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9779 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9780 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9781 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9782 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9783 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9784 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9785 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9786 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9787 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9788 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9789 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9790 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9791 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9792 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9793 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9794 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
| 9795 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
| 9796 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); |
| 9797 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
| 9798 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9799 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
| 9800 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9801 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
| 9802 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9803 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9804 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9805 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9806 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9807 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9808 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9809 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9810 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9811 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9812 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9813 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9814 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9815 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9816 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9817 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9818 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9819 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9820 | |
| 9821 | /* "neighbor allowas-in" */ |
| 9822 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); |
| 9823 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); |
| 9824 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); |
| 9825 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
| 9826 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9827 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9828 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
| 9829 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9830 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); |
| 9831 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
| 9832 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); |
| 9833 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9834 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
| 9835 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9836 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9837 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
| 9838 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9839 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9840 | |
| 9841 | /* address-family commands. */ |
| 9842 | install_element (BGP_NODE, &address_family_ipv4_cmd); |
| 9843 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); |
| 9844 | #ifdef HAVE_IPV6 |
| 9845 | install_element (BGP_NODE, &address_family_ipv6_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9846 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9847 | #endif /* HAVE_IPV6 */ |
| 9848 | install_element (BGP_NODE, &address_family_vpnv4_cmd); |
| 9849 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); |
| 9850 | |
| 9851 | /* "exit-address-family" command. */ |
| 9852 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); |
| 9853 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); |
| 9854 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9855 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9856 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
| 9857 | |
| 9858 | /* "clear ip bgp commands" */ |
| 9859 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); |
| 9860 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); |
| 9861 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); |
| 9862 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
| 9863 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
| 9864 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
| 9865 | #ifdef HAVE_IPV6 |
| 9866 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
| 9867 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); |
| 9868 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); |
| 9869 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
| 9870 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
| 9871 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
| 9872 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
| 9873 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
| 9874 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
| 9875 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
| 9876 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
| 9877 | #endif /* HAVE_IPV6 */ |
| 9878 | |
| 9879 | /* "clear ip bgp neighbor soft in" */ |
| 9880 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); |
| 9881 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); |
| 9882 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); |
| 9883 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
| 9884 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); |
| 9885 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
| 9886 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
| 9887 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
| 9888 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); |
| 9889 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
| 9890 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
| 9891 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); |
| 9892 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
| 9893 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
| 9894 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); |
| 9895 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
| 9896 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
| 9897 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); |
| 9898 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); |
| 9899 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); |
| 9900 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
| 9901 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); |
| 9902 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
| 9903 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
| 9904 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
| 9905 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); |
| 9906 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
| 9907 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
| 9908 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); |
| 9909 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
| 9910 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
| 9911 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); |
| 9912 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
| 9913 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
| 9914 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); |
| 9915 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); |
| 9916 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); |
| 9917 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); |
| 9918 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); |
| 9919 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); |
| 9920 | #ifdef HAVE_IPV6 |
| 9921 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
| 9922 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); |
| 9923 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); |
| 9924 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
| 9925 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); |
| 9926 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
| 9927 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
| 9928 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); |
| 9929 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
| 9930 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
| 9931 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); |
| 9932 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
| 9933 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
| 9934 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); |
| 9935 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
| 9936 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
| 9937 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); |
| 9938 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
| 9939 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
| 9940 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); |
| 9941 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
| 9942 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
| 9943 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); |
| 9944 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
| 9945 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
| 9946 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); |
| 9947 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
| 9948 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
| 9949 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); |
| 9950 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
| 9951 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
| 9952 | #endif /* HAVE_IPV6 */ |
| 9953 | |
| 9954 | /* "clear ip bgp neighbor soft out" */ |
| 9955 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); |
| 9956 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); |
| 9957 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); |
| 9958 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
| 9959 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
| 9960 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
| 9961 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
| 9962 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
| 9963 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
| 9964 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
| 9965 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
| 9966 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
| 9967 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); |
| 9968 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); |
| 9969 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
| 9970 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
| 9971 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
| 9972 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
| 9973 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
| 9974 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
| 9975 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
| 9976 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
| 9977 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
| 9978 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); |
| 9979 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); |
| 9980 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); |
| 9981 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); |
| 9982 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); |
| 9983 | #ifdef HAVE_IPV6 |
| 9984 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
| 9985 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); |
| 9986 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); |
| 9987 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
| 9988 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
| 9989 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
| 9990 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
| 9991 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
| 9992 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
| 9993 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
| 9994 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
| 9995 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
| 9996 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
| 9997 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
| 9998 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
| 9999 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
| 10000 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
| 10001 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
| 10002 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
| 10003 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
| 10004 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
| 10005 | #endif /* HAVE_IPV6 */ |
| 10006 | |
| 10007 | /* "clear ip bgp neighbor soft" */ |
| 10008 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); |
| 10009 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); |
| 10010 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); |
| 10011 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
| 10012 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
| 10013 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
| 10014 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
| 10015 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); |
| 10016 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); |
| 10017 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
| 10018 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
| 10019 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
| 10020 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
| 10021 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); |
| 10022 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); |
| 10023 | #ifdef HAVE_IPV6 |
| 10024 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
| 10025 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); |
| 10026 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); |
| 10027 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
| 10028 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
| 10029 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
| 10030 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
| 10031 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
| 10032 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
| 10033 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
| 10034 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
| 10035 | #endif /* HAVE_IPV6 */ |
| 10036 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10037 | /* "clear ip bgp neighbor rsclient" */ |
| 10038 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); |
| 10039 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); |
| 10040 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); |
| 10041 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); |
| 10042 | #ifdef HAVE_IPV6 |
| 10043 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); |
| 10044 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); |
| 10045 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); |
| 10046 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); |
| 10047 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); |
| 10048 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); |
| 10049 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); |
| 10050 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); |
| 10051 | #endif /* HAVE_IPV6 */ |
| 10052 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10053 | /* "show ip bgp summary" commands. */ |
| 10054 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); |
| 10055 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
| 10056 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10057 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10058 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10059 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10060 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 10061 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 10062 | #ifdef HAVE_IPV6 |
| 10063 | install_element (VIEW_NODE, &show_bgp_summary_cmd); |
| 10064 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); |
| 10065 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10066 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10067 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10068 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10069 | #endif /* HAVE_IPV6 */ |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10070 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); |
| 10071 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
| 10072 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10073 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10074 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10075 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10076 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 10077 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 10078 | #ifdef HAVE_IPV6 |
| 10079 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); |
| 10080 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); |
| 10081 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10082 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10083 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10084 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10085 | #endif /* HAVE_IPV6 */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10086 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); |
| 10087 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
| 10088 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10089 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10090 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10091 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10092 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 10093 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 10094 | #ifdef HAVE_IPV6 |
| 10095 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); |
| 10096 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); |
| 10097 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10098 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10099 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10100 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10101 | #endif /* HAVE_IPV6 */ |
| 10102 | |
| 10103 | /* "show ip bgp neighbors" commands. */ |
| 10104 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); |
| 10105 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 10106 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10107 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10108 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 10109 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 10110 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10111 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10112 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 10113 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10114 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10115 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10116 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10117 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10118 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10119 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
| 10120 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 10121 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10122 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10123 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 10124 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 10125 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10126 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10127 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 10128 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 10129 | |
| 10130 | #ifdef HAVE_IPV6 |
| 10131 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); |
| 10132 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 10133 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); |
| 10134 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 10135 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
| 10136 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 10137 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10138 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10139 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
| 10140 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
| 10141 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10142 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10143 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
| 10144 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 10145 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); |
| 10146 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 10147 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
| 10148 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 10149 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10150 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10151 | |
| 10152 | /* Old commands. */ |
| 10153 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); |
| 10154 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); |
| 10155 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); |
| 10156 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); |
| 10157 | #endif /* HAVE_IPV6 */ |
| 10158 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10159 | /* "show ip bgp rsclient" commands. */ |
| 10160 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10161 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10162 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10163 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10164 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10165 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10166 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10167 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10168 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10169 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10170 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10171 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10172 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10173 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10174 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10175 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10176 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10177 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10178 | |
| 10179 | #ifdef HAVE_IPV6 |
| 10180 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); |
| 10181 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10182 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10183 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10184 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10185 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10186 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
| 10187 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10188 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10189 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10190 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10191 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10192 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
| 10193 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10194 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10195 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10196 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10197 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10198 | #endif /* HAVE_IPV6 */ |
| 10199 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10200 | /* "show ip bgp paths" commands. */ |
| 10201 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); |
| 10202 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 10203 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); |
| 10204 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 10205 | |
| 10206 | /* "show ip bgp community" commands. */ |
| 10207 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); |
| 10208 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); |
| 10209 | |
| 10210 | /* "show ip bgp attribute-info" commands. */ |
| 10211 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); |
| 10212 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); |
| 10213 | |
| 10214 | /* "redistribute" commands. */ |
| 10215 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); |
| 10216 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); |
| 10217 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); |
| 10218 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); |
| 10219 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); |
| 10220 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); |
| 10221 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); |
| 10222 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); |
| 10223 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); |
| 10224 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); |
| 10225 | #ifdef HAVE_IPV6 |
| 10226 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); |
| 10227 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); |
| 10228 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); |
| 10229 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); |
| 10230 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); |
| 10231 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); |
| 10232 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); |
| 10233 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); |
| 10234 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); |
| 10235 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); |
| 10236 | #endif /* HAVE_IPV6 */ |
| 10237 | |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 10238 | /* ttl_security commands */ |
| 10239 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); |
| 10240 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); |
| 10241 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 10242 | /* "show bgp memory" commands. */ |
| 10243 | install_element (VIEW_NODE, &show_bgp_memory_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10244 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 10245 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
| 10246 | |
Michael Lambert | e0081f7 | 2008-11-16 20:12:04 +0000 | [diff] [blame] | 10247 | /* "show bgp views" commands. */ |
| 10248 | install_element (VIEW_NODE, &show_bgp_views_cmd); |
| 10249 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); |
| 10250 | install_element (ENABLE_NODE, &show_bgp_views_cmd); |
| 10251 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10252 | /* Community-list. */ |
| 10253 | community_list_vty (); |
| 10254 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 10255 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10256 | #include "memory.h" |
| 10257 | #include "bgp_regex.h" |
| 10258 | #include "bgp_clist.h" |
| 10259 | #include "bgp_ecommunity.h" |
| 10260 | |
| 10261 | /* VTY functions. */ |
| 10262 | |
| 10263 | /* Direction value to string conversion. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10264 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10265 | community_direct_str (int direct) |
| 10266 | { |
| 10267 | switch (direct) |
| 10268 | { |
| 10269 | case COMMUNITY_DENY: |
| 10270 | return "deny"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10271 | case COMMUNITY_PERMIT: |
| 10272 | return "permit"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10273 | default: |
| 10274 | return "unknown"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10275 | } |
| 10276 | } |
| 10277 | |
| 10278 | /* Display error string. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10279 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10280 | community_list_perror (struct vty *vty, int ret) |
| 10281 | { |
| 10282 | switch (ret) |
| 10283 | { |
| 10284 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10285 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10286 | break; |
| 10287 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: |
| 10288 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); |
| 10289 | break; |
| 10290 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: |
| 10291 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); |
| 10292 | break; |
| 10293 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: |
| 10294 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); |
| 10295 | break; |
| 10296 | } |
| 10297 | } |
| 10298 | |
| 10299 | /* VTY interface for community_set() function. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10300 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10301 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10302 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10303 | { |
| 10304 | int ret; |
| 10305 | int direct; |
| 10306 | char *str; |
| 10307 | |
| 10308 | /* Check the list type. */ |
| 10309 | if (strncmp (argv[1], "p", 1) == 0) |
| 10310 | direct = COMMUNITY_PERMIT; |
| 10311 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10312 | direct = COMMUNITY_DENY; |
| 10313 | else |
| 10314 | { |
| 10315 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10316 | VTY_NEWLINE); |
| 10317 | return CMD_WARNING; |
| 10318 | } |
| 10319 | |
| 10320 | /* All digit name check. */ |
| 10321 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10322 | { |
| 10323 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10324 | return CMD_WARNING; |
| 10325 | } |
| 10326 | |
| 10327 | /* Concat community string argument. */ |
| 10328 | if (argc > 1) |
| 10329 | str = argv_concat (argv, argc, 2); |
| 10330 | else |
| 10331 | str = NULL; |
| 10332 | |
| 10333 | /* When community_list_set() return nevetive value, it means |
| 10334 | malformed community string. */ |
| 10335 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); |
| 10336 | |
| 10337 | /* Free temporary community list string allocated by |
| 10338 | argv_concat(). */ |
| 10339 | if (str) |
| 10340 | XFREE (MTYPE_TMP, str); |
| 10341 | |
| 10342 | if (ret < 0) |
| 10343 | { |
| 10344 | /* Display error string. */ |
| 10345 | community_list_perror (vty, ret); |
| 10346 | return CMD_WARNING; |
| 10347 | } |
| 10348 | |
| 10349 | return CMD_SUCCESS; |
| 10350 | } |
| 10351 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10352 | /* Communiyt-list entry delete. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10353 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10354 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10355 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10356 | { |
| 10357 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10358 | int direct = 0; |
| 10359 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10360 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10361 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10362 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10363 | /* Check the list direct. */ |
| 10364 | if (strncmp (argv[1], "p", 1) == 0) |
| 10365 | direct = COMMUNITY_PERMIT; |
| 10366 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10367 | direct = COMMUNITY_DENY; |
| 10368 | else |
| 10369 | { |
| 10370 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10371 | VTY_NEWLINE); |
| 10372 | return CMD_WARNING; |
| 10373 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10374 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10375 | /* Concat community string argument. */ |
| 10376 | str = argv_concat (argv, argc, 2); |
| 10377 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10378 | |
| 10379 | /* Unset community list. */ |
| 10380 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10381 | |
| 10382 | /* Free temporary community list string allocated by |
| 10383 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10384 | if (str) |
| 10385 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10386 | |
| 10387 | if (ret < 0) |
| 10388 | { |
| 10389 | community_list_perror (vty, ret); |
| 10390 | return CMD_WARNING; |
| 10391 | } |
| 10392 | |
| 10393 | return CMD_SUCCESS; |
| 10394 | } |
| 10395 | |
| 10396 | /* "community-list" keyword help string. */ |
| 10397 | #define COMMUNITY_LIST_STR "Add a community list entry\n" |
| 10398 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" |
| 10399 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10400 | DEFUN (ip_community_list_standard, |
| 10401 | ip_community_list_standard_cmd, |
| 10402 | "ip community-list <1-99> (deny|permit) .AA:NN", |
| 10403 | IP_STR |
| 10404 | COMMUNITY_LIST_STR |
| 10405 | "Community list number (standard)\n" |
| 10406 | "Specify community to reject\n" |
| 10407 | "Specify community to accept\n" |
| 10408 | COMMUNITY_VAL_STR) |
| 10409 | { |
| 10410 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
| 10411 | } |
| 10412 | |
| 10413 | ALIAS (ip_community_list_standard, |
| 10414 | ip_community_list_standard2_cmd, |
| 10415 | "ip community-list <1-99> (deny|permit)", |
| 10416 | IP_STR |
| 10417 | COMMUNITY_LIST_STR |
| 10418 | "Community list number (standard)\n" |
| 10419 | "Specify community to reject\n" |
| 10420 | "Specify community to accept\n") |
| 10421 | |
| 10422 | DEFUN (ip_community_list_expanded, |
| 10423 | ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10424 | "ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10425 | IP_STR |
| 10426 | COMMUNITY_LIST_STR |
| 10427 | "Community list number (expanded)\n" |
| 10428 | "Specify community to reject\n" |
| 10429 | "Specify community to accept\n" |
| 10430 | "An ordered list as a regular-expression\n") |
| 10431 | { |
| 10432 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
| 10433 | } |
| 10434 | |
| 10435 | DEFUN (ip_community_list_name_standard, |
| 10436 | ip_community_list_name_standard_cmd, |
| 10437 | "ip community-list standard WORD (deny|permit) .AA:NN", |
| 10438 | IP_STR |
| 10439 | COMMUNITY_LIST_STR |
| 10440 | "Add a standard community-list entry\n" |
| 10441 | "Community list name\n" |
| 10442 | "Specify community to reject\n" |
| 10443 | "Specify community to accept\n" |
| 10444 | COMMUNITY_VAL_STR) |
| 10445 | { |
| 10446 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
| 10447 | } |
| 10448 | |
| 10449 | ALIAS (ip_community_list_name_standard, |
| 10450 | ip_community_list_name_standard2_cmd, |
| 10451 | "ip community-list standard WORD (deny|permit)", |
| 10452 | IP_STR |
| 10453 | COMMUNITY_LIST_STR |
| 10454 | "Add a standard community-list entry\n" |
| 10455 | "Community list name\n" |
| 10456 | "Specify community to reject\n" |
| 10457 | "Specify community to accept\n") |
| 10458 | |
| 10459 | DEFUN (ip_community_list_name_expanded, |
| 10460 | ip_community_list_name_expanded_cmd, |
| 10461 | "ip community-list expanded WORD (deny|permit) .LINE", |
| 10462 | IP_STR |
| 10463 | COMMUNITY_LIST_STR |
| 10464 | "Add an expanded community-list entry\n" |
| 10465 | "Community list name\n" |
| 10466 | "Specify community to reject\n" |
| 10467 | "Specify community to accept\n" |
| 10468 | "An ordered list as a regular-expression\n") |
| 10469 | { |
| 10470 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
| 10471 | } |
| 10472 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10473 | DEFUN (no_ip_community_list_standard_all, |
| 10474 | no_ip_community_list_standard_all_cmd, |
| 10475 | "no ip community-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10476 | NO_STR |
| 10477 | IP_STR |
| 10478 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10479 | "Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10480 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10481 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10482 | } |
| 10483 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10484 | DEFUN (no_ip_community_list_expanded_all, |
| 10485 | no_ip_community_list_expanded_all_cmd, |
| 10486 | "no ip community-list <100-500>", |
| 10487 | NO_STR |
| 10488 | IP_STR |
| 10489 | COMMUNITY_LIST_STR |
| 10490 | "Community list number (expanded)\n") |
| 10491 | { |
| 10492 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10493 | } |
| 10494 | |
| 10495 | DEFUN (no_ip_community_list_name_standard_all, |
| 10496 | no_ip_community_list_name_standard_all_cmd, |
| 10497 | "no ip community-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10498 | NO_STR |
| 10499 | IP_STR |
| 10500 | COMMUNITY_LIST_STR |
| 10501 | "Add a standard community-list entry\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10502 | "Community list name\n") |
| 10503 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10504 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10505 | } |
| 10506 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10507 | DEFUN (no_ip_community_list_name_expanded_all, |
| 10508 | no_ip_community_list_name_expanded_all_cmd, |
| 10509 | "no ip community-list expanded WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10510 | NO_STR |
| 10511 | IP_STR |
| 10512 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10513 | "Add an expanded community-list entry\n" |
| 10514 | "Community list name\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10515 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10516 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10517 | } |
| 10518 | |
| 10519 | DEFUN (no_ip_community_list_standard, |
| 10520 | no_ip_community_list_standard_cmd, |
| 10521 | "no ip community-list <1-99> (deny|permit) .AA:NN", |
| 10522 | NO_STR |
| 10523 | IP_STR |
| 10524 | COMMUNITY_LIST_STR |
| 10525 | "Community list number (standard)\n" |
| 10526 | "Specify community to reject\n" |
| 10527 | "Specify community to accept\n" |
| 10528 | COMMUNITY_VAL_STR) |
| 10529 | { |
| 10530 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 10531 | } |
| 10532 | |
| 10533 | DEFUN (no_ip_community_list_expanded, |
| 10534 | no_ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10535 | "no ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10536 | NO_STR |
| 10537 | IP_STR |
| 10538 | COMMUNITY_LIST_STR |
| 10539 | "Community list number (expanded)\n" |
| 10540 | "Specify community to reject\n" |
| 10541 | "Specify community to accept\n" |
| 10542 | "An ordered list as a regular-expression\n") |
| 10543 | { |
| 10544 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10545 | } |
| 10546 | |
| 10547 | DEFUN (no_ip_community_list_name_standard, |
| 10548 | no_ip_community_list_name_standard_cmd, |
| 10549 | "no ip community-list standard WORD (deny|permit) .AA:NN", |
| 10550 | NO_STR |
| 10551 | IP_STR |
| 10552 | COMMUNITY_LIST_STR |
| 10553 | "Specify a standard community-list\n" |
| 10554 | "Community list name\n" |
| 10555 | "Specify community to reject\n" |
| 10556 | "Specify community to accept\n" |
| 10557 | COMMUNITY_VAL_STR) |
| 10558 | { |
| 10559 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 10560 | } |
| 10561 | |
| 10562 | DEFUN (no_ip_community_list_name_expanded, |
| 10563 | no_ip_community_list_name_expanded_cmd, |
| 10564 | "no ip community-list expanded WORD (deny|permit) .LINE", |
| 10565 | NO_STR |
| 10566 | IP_STR |
| 10567 | COMMUNITY_LIST_STR |
| 10568 | "Specify an expanded community-list\n" |
| 10569 | "Community list name\n" |
| 10570 | "Specify community to reject\n" |
| 10571 | "Specify community to accept\n" |
| 10572 | "An ordered list as a regular-expression\n") |
| 10573 | { |
| 10574 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10575 | } |
| 10576 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10577 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10578 | community_list_show (struct vty *vty, struct community_list *list) |
| 10579 | { |
| 10580 | struct community_entry *entry; |
| 10581 | |
| 10582 | for (entry = list->head; entry; entry = entry->next) |
| 10583 | { |
| 10584 | if (entry == list->head) |
| 10585 | { |
| 10586 | if (all_digit (list->name)) |
| 10587 | vty_out (vty, "Community %s list %s%s", |
| 10588 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 10589 | "standard" : "(expanded) access", |
| 10590 | list->name, VTY_NEWLINE); |
| 10591 | else |
| 10592 | vty_out (vty, "Named Community %s list %s%s", |
| 10593 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 10594 | "standard" : "expanded", |
| 10595 | list->name, VTY_NEWLINE); |
| 10596 | } |
| 10597 | if (entry->any) |
| 10598 | vty_out (vty, " %s%s", |
| 10599 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10600 | else |
| 10601 | vty_out (vty, " %s %s%s", |
| 10602 | community_direct_str (entry->direct), |
| 10603 | entry->style == COMMUNITY_LIST_STANDARD |
| 10604 | ? community_str (entry->u.com) : entry->config, |
| 10605 | VTY_NEWLINE); |
| 10606 | } |
| 10607 | } |
| 10608 | |
| 10609 | DEFUN (show_ip_community_list, |
| 10610 | show_ip_community_list_cmd, |
| 10611 | "show ip community-list", |
| 10612 | SHOW_STR |
| 10613 | IP_STR |
| 10614 | "List community-list\n") |
| 10615 | { |
| 10616 | struct community_list *list; |
| 10617 | struct community_list_master *cm; |
| 10618 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10619 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10620 | if (! cm) |
| 10621 | return CMD_SUCCESS; |
| 10622 | |
| 10623 | for (list = cm->num.head; list; list = list->next) |
| 10624 | community_list_show (vty, list); |
| 10625 | |
| 10626 | for (list = cm->str.head; list; list = list->next) |
| 10627 | community_list_show (vty, list); |
| 10628 | |
| 10629 | return CMD_SUCCESS; |
| 10630 | } |
| 10631 | |
| 10632 | DEFUN (show_ip_community_list_arg, |
| 10633 | show_ip_community_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10634 | "show ip community-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10635 | SHOW_STR |
| 10636 | IP_STR |
| 10637 | "List community-list\n" |
| 10638 | "Community-list number\n" |
| 10639 | "Community-list name\n") |
| 10640 | { |
| 10641 | struct community_list *list; |
| 10642 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10643 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10644 | if (! list) |
| 10645 | { |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10646 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10647 | return CMD_WARNING; |
| 10648 | } |
| 10649 | |
| 10650 | community_list_show (vty, list); |
| 10651 | |
| 10652 | return CMD_SUCCESS; |
| 10653 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 10654 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10655 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10656 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10657 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10658 | { |
| 10659 | int ret; |
| 10660 | int direct; |
| 10661 | char *str; |
| 10662 | |
| 10663 | /* Check the list type. */ |
| 10664 | if (strncmp (argv[1], "p", 1) == 0) |
| 10665 | direct = COMMUNITY_PERMIT; |
| 10666 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10667 | direct = COMMUNITY_DENY; |
| 10668 | else |
| 10669 | { |
| 10670 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10671 | VTY_NEWLINE); |
| 10672 | return CMD_WARNING; |
| 10673 | } |
| 10674 | |
| 10675 | /* All digit name check. */ |
| 10676 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10677 | { |
| 10678 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10679 | return CMD_WARNING; |
| 10680 | } |
| 10681 | |
| 10682 | /* Concat community string argument. */ |
| 10683 | if (argc > 1) |
| 10684 | str = argv_concat (argv, argc, 2); |
| 10685 | else |
| 10686 | str = NULL; |
| 10687 | |
| 10688 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); |
| 10689 | |
| 10690 | /* Free temporary community list string allocated by |
| 10691 | argv_concat(). */ |
| 10692 | if (str) |
| 10693 | XFREE (MTYPE_TMP, str); |
| 10694 | |
| 10695 | if (ret < 0) |
| 10696 | { |
| 10697 | community_list_perror (vty, ret); |
| 10698 | return CMD_WARNING; |
| 10699 | } |
| 10700 | return CMD_SUCCESS; |
| 10701 | } |
| 10702 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10703 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10704 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10705 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10706 | { |
| 10707 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10708 | int direct = 0; |
| 10709 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10710 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10711 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10712 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10713 | /* Check the list direct. */ |
| 10714 | if (strncmp (argv[1], "p", 1) == 0) |
| 10715 | direct = COMMUNITY_PERMIT; |
| 10716 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10717 | direct = COMMUNITY_DENY; |
| 10718 | else |
| 10719 | { |
| 10720 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10721 | VTY_NEWLINE); |
| 10722 | return CMD_WARNING; |
| 10723 | } |
| 10724 | |
| 10725 | /* Concat community string argument. */ |
| 10726 | str = argv_concat (argv, argc, 2); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10727 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10728 | |
| 10729 | /* Unset community list. */ |
| 10730 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10731 | |
| 10732 | /* Free temporary community list string allocated by |
| 10733 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10734 | if (str) |
| 10735 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10736 | |
| 10737 | if (ret < 0) |
| 10738 | { |
| 10739 | community_list_perror (vty, ret); |
| 10740 | return CMD_WARNING; |
| 10741 | } |
| 10742 | |
| 10743 | return CMD_SUCCESS; |
| 10744 | } |
| 10745 | |
| 10746 | /* "extcommunity-list" keyword help string. */ |
| 10747 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" |
| 10748 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" |
| 10749 | |
| 10750 | DEFUN (ip_extcommunity_list_standard, |
| 10751 | ip_extcommunity_list_standard_cmd, |
| 10752 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10753 | IP_STR |
| 10754 | EXTCOMMUNITY_LIST_STR |
| 10755 | "Extended Community list number (standard)\n" |
| 10756 | "Specify community to reject\n" |
| 10757 | "Specify community to accept\n" |
| 10758 | EXTCOMMUNITY_VAL_STR) |
| 10759 | { |
| 10760 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
| 10761 | } |
| 10762 | |
| 10763 | ALIAS (ip_extcommunity_list_standard, |
| 10764 | ip_extcommunity_list_standard2_cmd, |
| 10765 | "ip extcommunity-list <1-99> (deny|permit)", |
| 10766 | IP_STR |
| 10767 | EXTCOMMUNITY_LIST_STR |
| 10768 | "Extended Community list number (standard)\n" |
| 10769 | "Specify community to reject\n" |
| 10770 | "Specify community to accept\n") |
| 10771 | |
| 10772 | DEFUN (ip_extcommunity_list_expanded, |
| 10773 | ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10774 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10775 | IP_STR |
| 10776 | EXTCOMMUNITY_LIST_STR |
| 10777 | "Extended Community list number (expanded)\n" |
| 10778 | "Specify community to reject\n" |
| 10779 | "Specify community to accept\n" |
| 10780 | "An ordered list as a regular-expression\n") |
| 10781 | { |
| 10782 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
| 10783 | } |
| 10784 | |
| 10785 | DEFUN (ip_extcommunity_list_name_standard, |
| 10786 | ip_extcommunity_list_name_standard_cmd, |
| 10787 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10788 | IP_STR |
| 10789 | EXTCOMMUNITY_LIST_STR |
| 10790 | "Specify standard extcommunity-list\n" |
| 10791 | "Extended Community list name\n" |
| 10792 | "Specify community to reject\n" |
| 10793 | "Specify community to accept\n" |
| 10794 | EXTCOMMUNITY_VAL_STR) |
| 10795 | { |
| 10796 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
| 10797 | } |
| 10798 | |
| 10799 | ALIAS (ip_extcommunity_list_name_standard, |
| 10800 | ip_extcommunity_list_name_standard2_cmd, |
| 10801 | "ip extcommunity-list standard WORD (deny|permit)", |
| 10802 | IP_STR |
| 10803 | EXTCOMMUNITY_LIST_STR |
| 10804 | "Specify standard extcommunity-list\n" |
| 10805 | "Extended Community list name\n" |
| 10806 | "Specify community to reject\n" |
| 10807 | "Specify community to accept\n") |
| 10808 | |
| 10809 | DEFUN (ip_extcommunity_list_name_expanded, |
| 10810 | ip_extcommunity_list_name_expanded_cmd, |
| 10811 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10812 | IP_STR |
| 10813 | EXTCOMMUNITY_LIST_STR |
| 10814 | "Specify expanded extcommunity-list\n" |
| 10815 | "Extended Community list name\n" |
| 10816 | "Specify community to reject\n" |
| 10817 | "Specify community to accept\n" |
| 10818 | "An ordered list as a regular-expression\n") |
| 10819 | { |
| 10820 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
| 10821 | } |
| 10822 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10823 | DEFUN (no_ip_extcommunity_list_standard_all, |
| 10824 | no_ip_extcommunity_list_standard_all_cmd, |
| 10825 | "no ip extcommunity-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10826 | NO_STR |
| 10827 | IP_STR |
| 10828 | EXTCOMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10829 | "Extended Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10830 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10831 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10832 | } |
| 10833 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10834 | DEFUN (no_ip_extcommunity_list_expanded_all, |
| 10835 | no_ip_extcommunity_list_expanded_all_cmd, |
| 10836 | "no ip extcommunity-list <100-500>", |
| 10837 | NO_STR |
| 10838 | IP_STR |
| 10839 | EXTCOMMUNITY_LIST_STR |
| 10840 | "Extended Community list number (expanded)\n") |
| 10841 | { |
| 10842 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10843 | } |
| 10844 | |
| 10845 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
| 10846 | no_ip_extcommunity_list_name_standard_all_cmd, |
| 10847 | "no ip extcommunity-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10848 | NO_STR |
| 10849 | IP_STR |
| 10850 | EXTCOMMUNITY_LIST_STR |
| 10851 | "Specify standard extcommunity-list\n" |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10852 | "Extended Community list name\n") |
| 10853 | { |
| 10854 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10855 | } |
| 10856 | |
| 10857 | DEFUN (no_ip_extcommunity_list_name_expanded_all, |
| 10858 | no_ip_extcommunity_list_name_expanded_all_cmd, |
| 10859 | "no ip extcommunity-list expanded WORD", |
| 10860 | NO_STR |
| 10861 | IP_STR |
| 10862 | EXTCOMMUNITY_LIST_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10863 | "Specify expanded extcommunity-list\n" |
| 10864 | "Extended Community list name\n") |
| 10865 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10866 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10867 | } |
| 10868 | |
| 10869 | DEFUN (no_ip_extcommunity_list_standard, |
| 10870 | no_ip_extcommunity_list_standard_cmd, |
| 10871 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10872 | NO_STR |
| 10873 | IP_STR |
| 10874 | EXTCOMMUNITY_LIST_STR |
| 10875 | "Extended Community list number (standard)\n" |
| 10876 | "Specify community to reject\n" |
| 10877 | "Specify community to accept\n" |
| 10878 | EXTCOMMUNITY_VAL_STR) |
| 10879 | { |
| 10880 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10881 | } |
| 10882 | |
| 10883 | DEFUN (no_ip_extcommunity_list_expanded, |
| 10884 | no_ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10885 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10886 | NO_STR |
| 10887 | IP_STR |
| 10888 | EXTCOMMUNITY_LIST_STR |
| 10889 | "Extended Community list number (expanded)\n" |
| 10890 | "Specify community to reject\n" |
| 10891 | "Specify community to accept\n" |
| 10892 | "An ordered list as a regular-expression\n") |
| 10893 | { |
| 10894 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10895 | } |
| 10896 | |
| 10897 | DEFUN (no_ip_extcommunity_list_name_standard, |
| 10898 | no_ip_extcommunity_list_name_standard_cmd, |
| 10899 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10900 | NO_STR |
| 10901 | IP_STR |
| 10902 | EXTCOMMUNITY_LIST_STR |
| 10903 | "Specify standard extcommunity-list\n" |
| 10904 | "Extended Community list name\n" |
| 10905 | "Specify community to reject\n" |
| 10906 | "Specify community to accept\n" |
| 10907 | EXTCOMMUNITY_VAL_STR) |
| 10908 | { |
| 10909 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10910 | } |
| 10911 | |
| 10912 | DEFUN (no_ip_extcommunity_list_name_expanded, |
| 10913 | no_ip_extcommunity_list_name_expanded_cmd, |
| 10914 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10915 | NO_STR |
| 10916 | IP_STR |
| 10917 | EXTCOMMUNITY_LIST_STR |
| 10918 | "Specify expanded extcommunity-list\n" |
| 10919 | "Community list name\n" |
| 10920 | "Specify community to reject\n" |
| 10921 | "Specify community to accept\n" |
| 10922 | "An ordered list as a regular-expression\n") |
| 10923 | { |
| 10924 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10925 | } |
| 10926 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10927 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10928 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
| 10929 | { |
| 10930 | struct community_entry *entry; |
| 10931 | |
| 10932 | for (entry = list->head; entry; entry = entry->next) |
| 10933 | { |
| 10934 | if (entry == list->head) |
| 10935 | { |
| 10936 | if (all_digit (list->name)) |
| 10937 | vty_out (vty, "Extended community %s list %s%s", |
| 10938 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10939 | "standard" : "(expanded) access", |
| 10940 | list->name, VTY_NEWLINE); |
| 10941 | else |
| 10942 | vty_out (vty, "Named extended community %s list %s%s", |
| 10943 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10944 | "standard" : "expanded", |
| 10945 | list->name, VTY_NEWLINE); |
| 10946 | } |
| 10947 | if (entry->any) |
| 10948 | vty_out (vty, " %s%s", |
| 10949 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10950 | else |
| 10951 | vty_out (vty, " %s %s%s", |
| 10952 | community_direct_str (entry->direct), |
| 10953 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10954 | entry->u.ecom->str : entry->config, |
| 10955 | VTY_NEWLINE); |
| 10956 | } |
| 10957 | } |
| 10958 | |
| 10959 | DEFUN (show_ip_extcommunity_list, |
| 10960 | show_ip_extcommunity_list_cmd, |
| 10961 | "show ip extcommunity-list", |
| 10962 | SHOW_STR |
| 10963 | IP_STR |
| 10964 | "List extended-community list\n") |
| 10965 | { |
| 10966 | struct community_list *list; |
| 10967 | struct community_list_master *cm; |
| 10968 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10969 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10970 | if (! cm) |
| 10971 | return CMD_SUCCESS; |
| 10972 | |
| 10973 | for (list = cm->num.head; list; list = list->next) |
| 10974 | extcommunity_list_show (vty, list); |
| 10975 | |
| 10976 | for (list = cm->str.head; list; list = list->next) |
| 10977 | extcommunity_list_show (vty, list); |
| 10978 | |
| 10979 | return CMD_SUCCESS; |
| 10980 | } |
| 10981 | |
| 10982 | DEFUN (show_ip_extcommunity_list_arg, |
| 10983 | show_ip_extcommunity_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10984 | "show ip extcommunity-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10985 | SHOW_STR |
| 10986 | IP_STR |
| 10987 | "List extended-community list\n" |
| 10988 | "Extcommunity-list number\n" |
| 10989 | "Extcommunity-list name\n") |
| 10990 | { |
| 10991 | struct community_list *list; |
| 10992 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10993 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10994 | if (! list) |
| 10995 | { |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10996 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10997 | return CMD_WARNING; |
| 10998 | } |
| 10999 | |
| 11000 | extcommunity_list_show (vty, list); |
| 11001 | |
| 11002 | return CMD_SUCCESS; |
| 11003 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 11004 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11005 | /* Return configuration string of community-list entry. */ |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 11006 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11007 | community_list_config_str (struct community_entry *entry) |
| 11008 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 11009 | const char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11010 | |
| 11011 | if (entry->any) |
| 11012 | str = ""; |
| 11013 | else |
| 11014 | { |
| 11015 | if (entry->style == COMMUNITY_LIST_STANDARD) |
| 11016 | str = community_str (entry->u.com); |
| 11017 | else |
| 11018 | str = entry->config; |
| 11019 | } |
| 11020 | return str; |
| 11021 | } |
| 11022 | |
| 11023 | /* Display community-list and extcommunity-list configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 11024 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11025 | community_list_config_write (struct vty *vty) |
| 11026 | { |
| 11027 | struct community_list *list; |
| 11028 | struct community_entry *entry; |
| 11029 | struct community_list_master *cm; |
| 11030 | int write = 0; |
| 11031 | |
| 11032 | /* Community-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11033 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11034 | |
| 11035 | for (list = cm->num.head; list; list = list->next) |
| 11036 | for (entry = list->head; entry; entry = entry->next) |
| 11037 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11038 | vty_out (vty, "ip community-list %s %s %s%s", |
| 11039 | list->name, community_direct_str (entry->direct), |
| 11040 | community_list_config_str (entry), |
| 11041 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11042 | write++; |
| 11043 | } |
| 11044 | for (list = cm->str.head; list; list = list->next) |
| 11045 | for (entry = list->head; entry; entry = entry->next) |
| 11046 | { |
| 11047 | vty_out (vty, "ip community-list %s %s %s %s%s", |
| 11048 | entry->style == COMMUNITY_LIST_STANDARD |
| 11049 | ? "standard" : "expanded", |
| 11050 | list->name, community_direct_str (entry->direct), |
| 11051 | community_list_config_str (entry), |
| 11052 | VTY_NEWLINE); |
| 11053 | write++; |
| 11054 | } |
| 11055 | |
| 11056 | /* Extcommunity-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11057 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11058 | |
| 11059 | for (list = cm->num.head; list; list = list->next) |
| 11060 | for (entry = list->head; entry; entry = entry->next) |
| 11061 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11062 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
| 11063 | list->name, community_direct_str (entry->direct), |
| 11064 | community_list_config_str (entry), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11065 | write++; |
| 11066 | } |
| 11067 | for (list = cm->str.head; list; list = list->next) |
| 11068 | for (entry = list->head; entry; entry = entry->next) |
| 11069 | { |
| 11070 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", |
| 11071 | entry->style == EXTCOMMUNITY_LIST_STANDARD |
| 11072 | ? "standard" : "expanded", |
| 11073 | list->name, community_direct_str (entry->direct), |
| 11074 | community_list_config_str (entry), VTY_NEWLINE); |
| 11075 | write++; |
| 11076 | } |
| 11077 | return write; |
| 11078 | } |
| 11079 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 11080 | static struct cmd_node community_list_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11081 | { |
| 11082 | COMMUNITY_LIST_NODE, |
| 11083 | "", |
| 11084 | 1 /* Export to vtysh. */ |
| 11085 | }; |
| 11086 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 11087 | static void |
| 11088 | community_list_vty (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11089 | { |
| 11090 | install_node (&community_list_node, community_list_config_write); |
| 11091 | |
| 11092 | /* Community-list. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11093 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
| 11094 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); |
| 11095 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); |
| 11096 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); |
| 11097 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); |
| 11098 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11099 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
| 11100 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
| 11101 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); |
| 11102 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11103 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
| 11104 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); |
| 11105 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); |
| 11106 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
| 11107 | install_element (VIEW_NODE, &show_ip_community_list_cmd); |
| 11108 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); |
| 11109 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); |
| 11110 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); |
| 11111 | |
| 11112 | /* Extcommunity-list. */ |
| 11113 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); |
| 11114 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); |
| 11115 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); |
| 11116 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); |
| 11117 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); |
| 11118 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11119 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
| 11120 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
| 11121 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); |
| 11122 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11123 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
| 11124 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); |
| 11125 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); |
| 11126 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
| 11127 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); |
| 11128 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 11129 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); |
| 11130 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 11131 | } |