paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* BGP VTY interface. |
| 2 | Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro |
| 3 | |
| 4 | This file is part of GNU Zebra. |
| 5 | |
| 6 | GNU Zebra is free software; you can redistribute it and/or modify it |
| 7 | under the terms of the GNU General Public License as published by the |
| 8 | Free Software Foundation; either version 2, or (at your option) any |
| 9 | later version. |
| 10 | |
| 11 | GNU Zebra is distributed in the hope that it will be useful, but |
| 12 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with GNU Zebra; see the file COPYING. If not, write to the Free |
| 18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 19 | 02111-1307, USA. */ |
| 20 | |
| 21 | #include <zebra.h> |
| 22 | |
| 23 | #include "command.h" |
| 24 | #include "prefix.h" |
| 25 | #include "plist.h" |
| 26 | #include "buffer.h" |
| 27 | #include "linklist.h" |
| 28 | #include "stream.h" |
| 29 | #include "thread.h" |
| 30 | #include "log.h" |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 31 | #include "memory.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 32 | #include "hash.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 33 | |
| 34 | #include "bgpd/bgpd.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 35 | #include "bgpd/bgp_advertise.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 36 | #include "bgpd/bgp_attr.h" |
| 37 | #include "bgpd/bgp_aspath.h" |
| 38 | #include "bgpd/bgp_community.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 39 | #include "bgpd/bgp_ecommunity.h" |
| 40 | #include "bgpd/bgp_damp.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 41 | #include "bgpd/bgp_debug.h" |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 42 | #include "bgpd/bgp_fsm.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 43 | #include "bgpd/bgp_mplsvpn.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 44 | #include "bgpd/bgp_nexthop.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 45 | #include "bgpd/bgp_open.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 46 | #include "bgpd/bgp_regex.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 47 | #include "bgpd/bgp_route.h" |
| 48 | #include "bgpd/bgp_zebra.h" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 49 | #include "bgpd/bgp_table.h" |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 50 | #include "bgpd/bgp_vty.h" |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 51 | #include "bgpd/bgp_mpath.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 52 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 53 | extern struct in_addr router_id_zebra; |
| 54 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 55 | /* Utility function to get address family from current node. */ |
| 56 | afi_t |
| 57 | bgp_node_afi (struct vty *vty) |
| 58 | { |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 59 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 60 | return AFI_IP6; |
| 61 | return AFI_IP; |
| 62 | } |
| 63 | |
| 64 | /* Utility function to get subsequent address family from current |
| 65 | node. */ |
| 66 | safi_t |
| 67 | bgp_node_safi (struct vty *vty) |
| 68 | { |
| 69 | if (vty->node == BGP_VPNV4_NODE) |
| 70 | return SAFI_MPLS_VPN; |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 71 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 72 | return SAFI_MULTICAST; |
| 73 | return SAFI_UNICAST; |
| 74 | } |
| 75 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 76 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 77 | peer_address_self_check (union sockunion *su) |
| 78 | { |
| 79 | struct interface *ifp = NULL; |
| 80 | |
| 81 | if (su->sa.sa_family == AF_INET) |
| 82 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); |
| 83 | #ifdef HAVE_IPV6 |
| 84 | else if (su->sa.sa_family == AF_INET6) |
| 85 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); |
| 86 | #endif /* HAVE IPV6 */ |
| 87 | |
| 88 | if (ifp) |
| 89 | return 1; |
| 90 | |
| 91 | return 0; |
| 92 | } |
| 93 | |
| 94 | /* Utility function for looking up peer from VTY. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 95 | static struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 96 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 97 | { |
| 98 | int ret; |
| 99 | struct bgp *bgp; |
| 100 | union sockunion su; |
| 101 | struct peer *peer; |
| 102 | |
| 103 | bgp = vty->index; |
| 104 | |
| 105 | ret = str2sockunion (ip_str, &su); |
| 106 | if (ret < 0) |
| 107 | { |
| 108 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 109 | return NULL; |
| 110 | } |
| 111 | |
| 112 | peer = peer_lookup (bgp, &su); |
| 113 | if (! peer) |
| 114 | { |
| 115 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE); |
| 116 | return NULL; |
| 117 | } |
| 118 | return peer; |
| 119 | } |
| 120 | |
| 121 | /* Utility function for looking up peer or peer group. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 122 | static struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 123 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 124 | { |
| 125 | int ret; |
| 126 | struct bgp *bgp; |
| 127 | union sockunion su; |
| 128 | struct peer *peer; |
| 129 | struct peer_group *group; |
| 130 | |
| 131 | bgp = vty->index; |
| 132 | |
| 133 | ret = str2sockunion (peer_str, &su); |
| 134 | if (ret == 0) |
| 135 | { |
| 136 | peer = peer_lookup (bgp, &su); |
| 137 | if (peer) |
| 138 | return peer; |
| 139 | } |
| 140 | else |
| 141 | { |
| 142 | group = peer_group_lookup (bgp, peer_str); |
| 143 | if (group) |
| 144 | return group->conf; |
| 145 | } |
| 146 | |
| 147 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
| 148 | VTY_NEWLINE); |
| 149 | |
| 150 | return NULL; |
| 151 | } |
| 152 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 153 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 154 | bgp_vty_return (struct vty *vty, int ret) |
| 155 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 156 | const char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 157 | |
| 158 | switch (ret) |
| 159 | { |
| 160 | case BGP_ERR_INVALID_VALUE: |
| 161 | str = "Invalid value"; |
| 162 | break; |
| 163 | case BGP_ERR_INVALID_FLAG: |
| 164 | str = "Invalid flag"; |
| 165 | break; |
| 166 | case BGP_ERR_PEER_INACTIVE: |
| 167 | str = "Activate the neighbor for the address family first"; |
| 168 | break; |
| 169 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: |
| 170 | str = "Invalid command for a peer-group member"; |
| 171 | break; |
| 172 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
| 173 | str = "Peer-group has been shutdown. Activate the peer-group first"; |
| 174 | break; |
| 175 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: |
| 176 | str = "This peer is a peer-group member. Please change peer-group configuration"; |
| 177 | break; |
| 178 | case BGP_ERR_PEER_FLAG_CONFLICT: |
| 179 | str = "Can't set override-capability and strict-capability-match at the same time"; |
| 180 | break; |
| 181 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: |
| 182 | str = "No activate for peergroup can be given only if peer-group has no members"; |
| 183 | break; |
| 184 | case BGP_ERR_PEER_BELONGS_TO_GROUP: |
| 185 | str = "No activate for an individual peer-group member is invalid"; |
| 186 | break; |
| 187 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: |
| 188 | str = "Activate the peer-group for the address family first"; |
| 189 | break; |
| 190 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
| 191 | str = "Specify remote-as or peer-group remote AS first"; |
| 192 | break; |
| 193 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: |
| 194 | str = "Cannot change the peer-group. Deconfigure first"; |
| 195 | break; |
| 196 | case BGP_ERR_PEER_GROUP_MISMATCH: |
| 197 | str = "Cannot have different peer-group for the neighbor"; |
| 198 | break; |
| 199 | case BGP_ERR_PEER_FILTER_CONFLICT: |
| 200 | str = "Prefix/distribute list can not co-exist"; |
| 201 | break; |
| 202 | case BGP_ERR_NOT_INTERNAL_PEER: |
| 203 | str = "Invalid command. Not an internal neighbor"; |
| 204 | break; |
| 205 | case BGP_ERR_REMOVE_PRIVATE_AS: |
| 206 | str = "Private AS cannot be removed for IBGP peers"; |
| 207 | break; |
| 208 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: |
| 209 | str = "Local-AS allowed only for EBGP peers"; |
| 210 | break; |
| 211 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: |
| 212 | str = "Cannot have local-as same as BGP AS number"; |
| 213 | break; |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 214 | case BGP_ERR_TCPSIG_FAILED: |
| 215 | str = "Error while applying TCP-Sig to session(s)"; |
| 216 | break; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 217 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
| 218 | str = "ebgp-multihop and ttl-security cannot be configured together"; |
| 219 | break; |
Stephen Hemminger | f5a4827 | 2011-03-24 17:30:21 +0000 | [diff] [blame] | 220 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
| 221 | str = "ttl-security only allowed for EBGP peers"; |
| 222 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 223 | } |
| 224 | if (str) |
| 225 | { |
| 226 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); |
| 227 | return CMD_WARNING; |
| 228 | } |
| 229 | return CMD_SUCCESS; |
| 230 | } |
| 231 | |
| 232 | /* BGP global configuration. */ |
| 233 | |
| 234 | DEFUN (bgp_multiple_instance_func, |
| 235 | bgp_multiple_instance_cmd, |
| 236 | "bgp multiple-instance", |
| 237 | BGP_STR |
| 238 | "Enable bgp multiple instance\n") |
| 239 | { |
| 240 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); |
| 241 | return CMD_SUCCESS; |
| 242 | } |
| 243 | |
| 244 | DEFUN (no_bgp_multiple_instance, |
| 245 | no_bgp_multiple_instance_cmd, |
| 246 | "no bgp multiple-instance", |
| 247 | NO_STR |
| 248 | BGP_STR |
| 249 | "BGP multiple instance\n") |
| 250 | { |
| 251 | int ret; |
| 252 | |
| 253 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); |
| 254 | if (ret < 0) |
| 255 | { |
| 256 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); |
| 257 | return CMD_WARNING; |
| 258 | } |
| 259 | return CMD_SUCCESS; |
| 260 | } |
| 261 | |
| 262 | DEFUN (bgp_config_type, |
| 263 | bgp_config_type_cmd, |
| 264 | "bgp config-type (cisco|zebra)", |
| 265 | BGP_STR |
| 266 | "Configuration type\n" |
| 267 | "cisco\n" |
| 268 | "zebra\n") |
| 269 | { |
| 270 | if (strncmp (argv[0], "c", 1) == 0) |
| 271 | bgp_option_set (BGP_OPT_CONFIG_CISCO); |
| 272 | else |
| 273 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 274 | |
| 275 | return CMD_SUCCESS; |
| 276 | } |
| 277 | |
| 278 | DEFUN (no_bgp_config_type, |
| 279 | no_bgp_config_type_cmd, |
| 280 | "no bgp config-type", |
| 281 | NO_STR |
| 282 | BGP_STR |
| 283 | "Display configuration type\n") |
| 284 | { |
| 285 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 286 | return CMD_SUCCESS; |
| 287 | } |
| 288 | |
| 289 | DEFUN (no_synchronization, |
| 290 | no_synchronization_cmd, |
| 291 | "no synchronization", |
| 292 | NO_STR |
| 293 | "Perform IGP synchronization\n") |
| 294 | { |
| 295 | return CMD_SUCCESS; |
| 296 | } |
| 297 | |
| 298 | DEFUN (no_auto_summary, |
| 299 | no_auto_summary_cmd, |
| 300 | "no auto-summary", |
| 301 | NO_STR |
| 302 | "Enable automatic network number summarization\n") |
| 303 | { |
| 304 | return CMD_SUCCESS; |
| 305 | } |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 306 | |
| 307 | DEFUN_DEPRECATED (neighbor_version, |
| 308 | neighbor_version_cmd, |
| 309 | NEIGHBOR_CMD "version (4|4-)", |
| 310 | NEIGHBOR_STR |
| 311 | NEIGHBOR_ADDR_STR |
| 312 | "Set the BGP version to match a neighbor\n" |
| 313 | "Neighbor's BGP version\n") |
| 314 | { |
| 315 | return CMD_SUCCESS; |
| 316 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 317 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 318 | /* "router bgp" commands. */ |
| 319 | DEFUN (router_bgp, |
| 320 | router_bgp_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 321 | "router bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 322 | ROUTER_STR |
| 323 | BGP_STR |
| 324 | AS_STR) |
| 325 | { |
| 326 | int ret; |
| 327 | as_t as; |
| 328 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 329 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 330 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 331 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 332 | |
| 333 | if (argc == 2) |
| 334 | name = argv[1]; |
| 335 | |
| 336 | ret = bgp_get (&bgp, &as, name); |
| 337 | switch (ret) |
| 338 | { |
| 339 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: |
| 340 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", |
| 341 | VTY_NEWLINE); |
| 342 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 343 | case BGP_ERR_AS_MISMATCH: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 344 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 345 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 346 | case BGP_ERR_INSTANCE_MISMATCH: |
| 347 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 348 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 349 | as, VTY_NEWLINE); |
| 350 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 351 | } |
| 352 | |
| 353 | vty->node = BGP_NODE; |
| 354 | vty->index = bgp; |
| 355 | |
| 356 | return CMD_SUCCESS; |
| 357 | } |
| 358 | |
| 359 | ALIAS (router_bgp, |
| 360 | router_bgp_view_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 361 | "router bgp " CMD_AS_RANGE " view WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 362 | ROUTER_STR |
| 363 | BGP_STR |
| 364 | AS_STR |
| 365 | "BGP view\n" |
| 366 | "view name\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 367 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 368 | /* "no router bgp" commands. */ |
| 369 | DEFUN (no_router_bgp, |
| 370 | no_router_bgp_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 371 | "no router bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 372 | NO_STR |
| 373 | ROUTER_STR |
| 374 | BGP_STR |
| 375 | AS_STR) |
| 376 | { |
| 377 | as_t as; |
| 378 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 379 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 380 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 381 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 382 | |
| 383 | if (argc == 2) |
| 384 | name = argv[1]; |
| 385 | |
| 386 | /* Lookup bgp structure. */ |
| 387 | bgp = bgp_lookup (as, name); |
| 388 | if (! bgp) |
| 389 | { |
| 390 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); |
| 391 | return CMD_WARNING; |
| 392 | } |
| 393 | |
| 394 | bgp_delete (bgp); |
| 395 | |
| 396 | return CMD_SUCCESS; |
| 397 | } |
| 398 | |
| 399 | ALIAS (no_router_bgp, |
| 400 | no_router_bgp_view_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 401 | "no router bgp " CMD_AS_RANGE " view WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 402 | NO_STR |
| 403 | ROUTER_STR |
| 404 | BGP_STR |
| 405 | AS_STR |
| 406 | "BGP view\n" |
| 407 | "view name\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 408 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 409 | /* BGP router-id. */ |
| 410 | |
| 411 | DEFUN (bgp_router_id, |
| 412 | bgp_router_id_cmd, |
| 413 | "bgp router-id A.B.C.D", |
| 414 | BGP_STR |
| 415 | "Override configured router identifier\n" |
| 416 | "Manually configured router identifier\n") |
| 417 | { |
| 418 | int ret; |
| 419 | struct in_addr id; |
| 420 | struct bgp *bgp; |
| 421 | |
| 422 | bgp = vty->index; |
| 423 | |
| 424 | ret = inet_aton (argv[0], &id); |
| 425 | if (! ret) |
| 426 | { |
| 427 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); |
| 428 | return CMD_WARNING; |
| 429 | } |
| 430 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 431 | bgp->router_id_static = id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 432 | bgp_router_id_set (bgp, &id); |
| 433 | |
| 434 | return CMD_SUCCESS; |
| 435 | } |
| 436 | |
| 437 | DEFUN (no_bgp_router_id, |
| 438 | no_bgp_router_id_cmd, |
| 439 | "no bgp router-id", |
| 440 | NO_STR |
| 441 | BGP_STR |
| 442 | "Override configured router identifier\n") |
| 443 | { |
| 444 | int ret; |
| 445 | struct in_addr id; |
| 446 | struct bgp *bgp; |
| 447 | |
| 448 | bgp = vty->index; |
| 449 | |
| 450 | if (argc == 1) |
| 451 | { |
| 452 | ret = inet_aton (argv[0], &id); |
| 453 | if (! ret) |
| 454 | { |
| 455 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); |
| 456 | return CMD_WARNING; |
| 457 | } |
| 458 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 459 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 460 | { |
| 461 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); |
| 462 | return CMD_WARNING; |
| 463 | } |
| 464 | } |
| 465 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 466 | bgp->router_id_static.s_addr = 0; |
| 467 | bgp_router_id_set (bgp, &router_id_zebra); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 468 | |
| 469 | return CMD_SUCCESS; |
| 470 | } |
| 471 | |
| 472 | ALIAS (no_bgp_router_id, |
| 473 | no_bgp_router_id_val_cmd, |
| 474 | "no bgp router-id A.B.C.D", |
| 475 | NO_STR |
| 476 | BGP_STR |
| 477 | "Override configured router identifier\n" |
| 478 | "Manually configured router identifier\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 479 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 480 | /* BGP Cluster ID. */ |
| 481 | |
| 482 | DEFUN (bgp_cluster_id, |
| 483 | bgp_cluster_id_cmd, |
| 484 | "bgp cluster-id A.B.C.D", |
| 485 | BGP_STR |
| 486 | "Configure Route-Reflector Cluster-id\n" |
| 487 | "Route-Reflector Cluster-id in IP address format\n") |
| 488 | { |
| 489 | int ret; |
| 490 | struct bgp *bgp; |
| 491 | struct in_addr cluster; |
| 492 | |
| 493 | bgp = vty->index; |
| 494 | |
| 495 | ret = inet_aton (argv[0], &cluster); |
| 496 | if (! ret) |
| 497 | { |
| 498 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 499 | return CMD_WARNING; |
| 500 | } |
| 501 | |
| 502 | bgp_cluster_id_set (bgp, &cluster); |
| 503 | |
| 504 | return CMD_SUCCESS; |
| 505 | } |
| 506 | |
| 507 | ALIAS (bgp_cluster_id, |
| 508 | bgp_cluster_id32_cmd, |
| 509 | "bgp cluster-id <1-4294967295>", |
| 510 | BGP_STR |
| 511 | "Configure Route-Reflector Cluster-id\n" |
| 512 | "Route-Reflector Cluster-id as 32 bit quantity\n") |
| 513 | |
| 514 | DEFUN (no_bgp_cluster_id, |
| 515 | no_bgp_cluster_id_cmd, |
| 516 | "no bgp cluster-id", |
| 517 | NO_STR |
| 518 | BGP_STR |
| 519 | "Configure Route-Reflector Cluster-id\n") |
| 520 | { |
| 521 | int ret; |
| 522 | struct bgp *bgp; |
| 523 | struct in_addr cluster; |
| 524 | |
| 525 | bgp = vty->index; |
| 526 | |
| 527 | if (argc == 1) |
| 528 | { |
| 529 | ret = inet_aton (argv[0], &cluster); |
| 530 | if (! ret) |
| 531 | { |
| 532 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 533 | return CMD_WARNING; |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | bgp_cluster_id_unset (bgp); |
| 538 | |
| 539 | return CMD_SUCCESS; |
| 540 | } |
| 541 | |
| 542 | ALIAS (no_bgp_cluster_id, |
| 543 | no_bgp_cluster_id_arg_cmd, |
| 544 | "no bgp cluster-id A.B.C.D", |
| 545 | NO_STR |
| 546 | BGP_STR |
| 547 | "Configure Route-Reflector Cluster-id\n" |
| 548 | "Route-Reflector Cluster-id in IP address format\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 549 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 550 | DEFUN (bgp_confederation_identifier, |
| 551 | bgp_confederation_identifier_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 552 | "bgp confederation identifier " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 553 | "BGP specific commands\n" |
| 554 | "AS confederation parameters\n" |
| 555 | "AS number\n" |
| 556 | "Set routing domain confederation AS\n") |
| 557 | { |
| 558 | struct bgp *bgp; |
| 559 | as_t as; |
| 560 | |
| 561 | bgp = vty->index; |
| 562 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 563 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 564 | |
| 565 | bgp_confederation_id_set (bgp, as); |
| 566 | |
| 567 | return CMD_SUCCESS; |
| 568 | } |
| 569 | |
| 570 | DEFUN (no_bgp_confederation_identifier, |
| 571 | no_bgp_confederation_identifier_cmd, |
| 572 | "no bgp confederation identifier", |
| 573 | NO_STR |
| 574 | "BGP specific commands\n" |
| 575 | "AS confederation parameters\n" |
| 576 | "AS number\n") |
| 577 | { |
| 578 | struct bgp *bgp; |
Paul Jakma | 7aa9dce | 2014-09-19 14:42:23 +0100 | [diff] [blame] | 579 | as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 580 | |
| 581 | bgp = vty->index; |
| 582 | |
| 583 | if (argc == 1) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 584 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 585 | |
| 586 | bgp_confederation_id_unset (bgp); |
| 587 | |
| 588 | return CMD_SUCCESS; |
| 589 | } |
| 590 | |
| 591 | ALIAS (no_bgp_confederation_identifier, |
| 592 | no_bgp_confederation_identifier_arg_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 593 | "no bgp confederation identifier " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 594 | NO_STR |
| 595 | "BGP specific commands\n" |
| 596 | "AS confederation parameters\n" |
| 597 | "AS number\n" |
| 598 | "Set routing domain confederation AS\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 599 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 600 | DEFUN (bgp_confederation_peers, |
| 601 | bgp_confederation_peers_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 602 | "bgp confederation peers ." CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 603 | "BGP specific commands\n" |
| 604 | "AS confederation parameters\n" |
| 605 | "Peer ASs in BGP confederation\n" |
| 606 | AS_STR) |
| 607 | { |
| 608 | struct bgp *bgp; |
| 609 | as_t as; |
| 610 | int i; |
| 611 | |
| 612 | bgp = vty->index; |
| 613 | |
| 614 | for (i = 0; i < argc; i++) |
| 615 | { |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 616 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 617 | |
| 618 | if (bgp->as == as) |
| 619 | { |
| 620 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", |
| 621 | VTY_NEWLINE); |
| 622 | continue; |
| 623 | } |
| 624 | |
| 625 | bgp_confederation_peers_add (bgp, as); |
| 626 | } |
| 627 | return CMD_SUCCESS; |
| 628 | } |
| 629 | |
| 630 | DEFUN (no_bgp_confederation_peers, |
| 631 | no_bgp_confederation_peers_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 632 | "no bgp confederation peers ." CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 633 | NO_STR |
| 634 | "BGP specific commands\n" |
| 635 | "AS confederation parameters\n" |
| 636 | "Peer ASs in BGP confederation\n" |
| 637 | AS_STR) |
| 638 | { |
| 639 | struct bgp *bgp; |
| 640 | as_t as; |
| 641 | int i; |
| 642 | |
| 643 | bgp = vty->index; |
| 644 | |
| 645 | for (i = 0; i < argc; i++) |
| 646 | { |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 647 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
| 648 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 649 | bgp_confederation_peers_remove (bgp, as); |
| 650 | } |
| 651 | return CMD_SUCCESS; |
| 652 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 653 | |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 654 | /* Maximum-paths configuration */ |
| 655 | DEFUN (bgp_maxpaths, |
| 656 | bgp_maxpaths_cmd, |
| 657 | "maximum-paths <1-255>", |
| 658 | "Forward packets over multiple paths\n" |
| 659 | "Number of paths\n") |
| 660 | { |
| 661 | struct bgp *bgp; |
| 662 | u_int16_t maxpaths; |
| 663 | int ret; |
| 664 | |
| 665 | bgp = vty->index; |
| 666 | |
| 667 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255); |
| 668 | |
| 669 | ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 670 | BGP_PEER_EBGP, maxpaths); |
| 671 | if (ret < 0) |
| 672 | { |
| 673 | vty_out (vty, |
| 674 | "%% Failed to set maximum-paths %u for afi %u, safi %u%s", |
| 675 | maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 676 | return CMD_WARNING; |
| 677 | } |
| 678 | |
| 679 | return CMD_SUCCESS; |
| 680 | } |
| 681 | |
| 682 | DEFUN (bgp_maxpaths_ibgp, |
| 683 | bgp_maxpaths_ibgp_cmd, |
| 684 | "maximum-paths ibgp <1-255>", |
| 685 | "Forward packets over multiple paths\n" |
| 686 | "iBGP-multipath\n" |
| 687 | "Number of paths\n") |
| 688 | { |
| 689 | struct bgp *bgp; |
| 690 | u_int16_t maxpaths; |
| 691 | int ret; |
| 692 | |
| 693 | bgp = vty->index; |
| 694 | |
| 695 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255); |
| 696 | |
| 697 | ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 698 | BGP_PEER_IBGP, maxpaths); |
| 699 | if (ret < 0) |
| 700 | { |
| 701 | vty_out (vty, |
| 702 | "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s", |
| 703 | maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 704 | return CMD_WARNING; |
| 705 | } |
| 706 | |
| 707 | return CMD_SUCCESS; |
| 708 | } |
| 709 | |
| 710 | DEFUN (no_bgp_maxpaths, |
| 711 | no_bgp_maxpaths_cmd, |
| 712 | "no maximum-paths", |
| 713 | NO_STR |
| 714 | "Forward packets over multiple paths\n" |
| 715 | "Number of paths\n") |
| 716 | { |
| 717 | struct bgp *bgp; |
| 718 | int ret; |
| 719 | |
| 720 | bgp = vty->index; |
| 721 | |
| 722 | ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 723 | BGP_PEER_EBGP); |
| 724 | if (ret < 0) |
| 725 | { |
| 726 | vty_out (vty, |
| 727 | "%% Failed to unset maximum-paths for afi %u, safi %u%s", |
| 728 | bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 729 | return CMD_WARNING; |
| 730 | } |
| 731 | |
| 732 | return CMD_SUCCESS; |
| 733 | } |
| 734 | |
| 735 | ALIAS (no_bgp_maxpaths, |
| 736 | no_bgp_maxpaths_arg_cmd, |
| 737 | "no maximum-paths <1-255>", |
| 738 | NO_STR |
| 739 | "Forward packets over multiple paths\n" |
| 740 | "Number of paths\n") |
| 741 | |
| 742 | DEFUN (no_bgp_maxpaths_ibgp, |
| 743 | no_bgp_maxpaths_ibgp_cmd, |
| 744 | "no maximum-paths ibgp", |
| 745 | NO_STR |
| 746 | "Forward packets over multiple paths\n" |
| 747 | "iBGP-multipath\n" |
| 748 | "Number of paths\n") |
| 749 | { |
| 750 | struct bgp *bgp; |
| 751 | int ret; |
| 752 | |
| 753 | bgp = vty->index; |
| 754 | |
| 755 | ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 756 | BGP_PEER_IBGP); |
| 757 | if (ret < 0) |
| 758 | { |
| 759 | vty_out (vty, |
| 760 | "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s", |
| 761 | bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 762 | return CMD_WARNING; |
| 763 | } |
| 764 | |
| 765 | return CMD_SUCCESS; |
| 766 | } |
| 767 | |
| 768 | ALIAS (no_bgp_maxpaths_ibgp, |
| 769 | no_bgp_maxpaths_ibgp_arg_cmd, |
| 770 | "no maximum-paths ibgp <1-255>", |
| 771 | NO_STR |
| 772 | "Forward packets over multiple paths\n" |
| 773 | "iBGP-multipath\n" |
| 774 | "Number of paths\n") |
| 775 | |
| 776 | int |
| 777 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 778 | safi_t safi, int *write) |
| 779 | { |
| 780 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS) |
| 781 | { |
| 782 | bgp_config_write_family_header (vty, afi, safi, write); |
| 783 | vty_out (vty, " maximum-paths %d%s", |
| 784 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); |
| 785 | } |
| 786 | |
| 787 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS) |
| 788 | { |
| 789 | bgp_config_write_family_header (vty, afi, safi, write); |
| 790 | vty_out (vty, " maximum-paths ibgp %d%s", |
| 791 | bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE); |
| 792 | } |
| 793 | |
| 794 | return 0; |
| 795 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 796 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 797 | /* BGP timers. */ |
| 798 | |
| 799 | DEFUN (bgp_timers, |
| 800 | bgp_timers_cmd, |
| 801 | "timers bgp <0-65535> <0-65535>", |
| 802 | "Adjust routing timers\n" |
| 803 | "BGP timers\n" |
| 804 | "Keepalive interval\n" |
| 805 | "Holdtime\n") |
| 806 | { |
| 807 | struct bgp *bgp; |
| 808 | unsigned long keepalive = 0; |
| 809 | unsigned long holdtime = 0; |
| 810 | |
| 811 | bgp = vty->index; |
| 812 | |
| 813 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); |
| 814 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); |
| 815 | |
| 816 | /* Holdtime value check. */ |
| 817 | if (holdtime < 3 && holdtime != 0) |
| 818 | { |
| 819 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", |
| 820 | VTY_NEWLINE); |
| 821 | return CMD_WARNING; |
| 822 | } |
| 823 | |
| 824 | bgp_timers_set (bgp, keepalive, holdtime); |
| 825 | |
| 826 | return CMD_SUCCESS; |
| 827 | } |
| 828 | |
| 829 | DEFUN (no_bgp_timers, |
| 830 | no_bgp_timers_cmd, |
| 831 | "no timers bgp", |
| 832 | NO_STR |
| 833 | "Adjust routing timers\n" |
| 834 | "BGP timers\n") |
| 835 | { |
| 836 | struct bgp *bgp; |
| 837 | |
| 838 | bgp = vty->index; |
| 839 | bgp_timers_unset (bgp); |
| 840 | |
| 841 | return CMD_SUCCESS; |
| 842 | } |
| 843 | |
| 844 | ALIAS (no_bgp_timers, |
| 845 | no_bgp_timers_arg_cmd, |
| 846 | "no timers bgp <0-65535> <0-65535>", |
| 847 | NO_STR |
| 848 | "Adjust routing timers\n" |
| 849 | "BGP timers\n" |
| 850 | "Keepalive interval\n" |
| 851 | "Holdtime\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 852 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 853 | DEFUN (bgp_client_to_client_reflection, |
| 854 | bgp_client_to_client_reflection_cmd, |
| 855 | "bgp client-to-client reflection", |
| 856 | "BGP specific commands\n" |
| 857 | "Configure client to client route reflection\n" |
| 858 | "reflection of routes allowed\n") |
| 859 | { |
| 860 | struct bgp *bgp; |
| 861 | |
| 862 | bgp = vty->index; |
| 863 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 864 | return CMD_SUCCESS; |
| 865 | } |
| 866 | |
| 867 | DEFUN (no_bgp_client_to_client_reflection, |
| 868 | no_bgp_client_to_client_reflection_cmd, |
| 869 | "no bgp client-to-client reflection", |
| 870 | NO_STR |
| 871 | "BGP specific commands\n" |
| 872 | "Configure client to client route reflection\n" |
| 873 | "reflection of routes allowed\n") |
| 874 | { |
| 875 | struct bgp *bgp; |
| 876 | |
| 877 | bgp = vty->index; |
| 878 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 879 | return CMD_SUCCESS; |
| 880 | } |
| 881 | |
| 882 | /* "bgp always-compare-med" configuration. */ |
| 883 | DEFUN (bgp_always_compare_med, |
| 884 | bgp_always_compare_med_cmd, |
| 885 | "bgp always-compare-med", |
| 886 | "BGP specific commands\n" |
| 887 | "Allow comparing MED from different neighbors\n") |
| 888 | { |
| 889 | struct bgp *bgp; |
| 890 | |
| 891 | bgp = vty->index; |
| 892 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 893 | return CMD_SUCCESS; |
| 894 | } |
| 895 | |
| 896 | DEFUN (no_bgp_always_compare_med, |
| 897 | no_bgp_always_compare_med_cmd, |
| 898 | "no bgp always-compare-med", |
| 899 | NO_STR |
| 900 | "BGP specific commands\n" |
| 901 | "Allow comparing MED from different neighbors\n") |
| 902 | { |
| 903 | struct bgp *bgp; |
| 904 | |
| 905 | bgp = vty->index; |
| 906 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 907 | return CMD_SUCCESS; |
| 908 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 909 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 910 | /* "bgp deterministic-med" configuration. */ |
| 911 | DEFUN (bgp_deterministic_med, |
| 912 | bgp_deterministic_med_cmd, |
| 913 | "bgp deterministic-med", |
| 914 | "BGP specific commands\n" |
| 915 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 916 | { |
| 917 | struct bgp *bgp; |
| 918 | |
| 919 | bgp = vty->index; |
| 920 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 921 | return CMD_SUCCESS; |
| 922 | } |
| 923 | |
| 924 | DEFUN (no_bgp_deterministic_med, |
| 925 | no_bgp_deterministic_med_cmd, |
| 926 | "no bgp deterministic-med", |
| 927 | NO_STR |
| 928 | "BGP specific commands\n" |
| 929 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 930 | { |
| 931 | struct bgp *bgp; |
| 932 | |
| 933 | bgp = vty->index; |
| 934 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 935 | return CMD_SUCCESS; |
| 936 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 937 | |
| 938 | /* "bgp graceful-restart" configuration. */ |
| 939 | DEFUN (bgp_graceful_restart, |
| 940 | bgp_graceful_restart_cmd, |
| 941 | "bgp graceful-restart", |
| 942 | "BGP specific commands\n" |
| 943 | "Graceful restart capability parameters\n") |
| 944 | { |
| 945 | struct bgp *bgp; |
| 946 | |
| 947 | bgp = vty->index; |
| 948 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 949 | return CMD_SUCCESS; |
| 950 | } |
| 951 | |
| 952 | DEFUN (no_bgp_graceful_restart, |
| 953 | no_bgp_graceful_restart_cmd, |
| 954 | "no bgp graceful-restart", |
| 955 | NO_STR |
| 956 | "BGP specific commands\n" |
| 957 | "Graceful restart capability parameters\n") |
| 958 | { |
| 959 | struct bgp *bgp; |
| 960 | |
| 961 | bgp = vty->index; |
| 962 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 963 | return CMD_SUCCESS; |
| 964 | } |
| 965 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 966 | DEFUN (bgp_graceful_restart_stalepath_time, |
| 967 | bgp_graceful_restart_stalepath_time_cmd, |
| 968 | "bgp graceful-restart stalepath-time <1-3600>", |
| 969 | "BGP specific commands\n" |
| 970 | "Graceful restart capability parameters\n" |
| 971 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 972 | "Delay value (seconds)\n") |
| 973 | { |
| 974 | struct bgp *bgp; |
| 975 | u_int32_t stalepath; |
| 976 | |
| 977 | bgp = vty->index; |
| 978 | if (! bgp) |
| 979 | return CMD_WARNING; |
| 980 | |
| 981 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); |
| 982 | bgp->stalepath_time = stalepath; |
| 983 | return CMD_SUCCESS; |
| 984 | } |
| 985 | |
| 986 | DEFUN (no_bgp_graceful_restart_stalepath_time, |
| 987 | no_bgp_graceful_restart_stalepath_time_cmd, |
| 988 | "no bgp graceful-restart stalepath-time", |
| 989 | NO_STR |
| 990 | "BGP specific commands\n" |
| 991 | "Graceful restart capability parameters\n" |
| 992 | "Set the max time to hold onto restarting peer's stale paths\n") |
| 993 | { |
| 994 | struct bgp *bgp; |
| 995 | |
| 996 | bgp = vty->index; |
| 997 | if (! bgp) |
| 998 | return CMD_WARNING; |
| 999 | |
| 1000 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; |
| 1001 | return CMD_SUCCESS; |
| 1002 | } |
| 1003 | |
| 1004 | ALIAS (no_bgp_graceful_restart_stalepath_time, |
| 1005 | no_bgp_graceful_restart_stalepath_time_val_cmd, |
| 1006 | "no bgp graceful-restart stalepath-time <1-3600>", |
| 1007 | NO_STR |
| 1008 | "BGP specific commands\n" |
| 1009 | "Graceful restart capability parameters\n" |
| 1010 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 1011 | "Delay value (seconds)\n") |
| 1012 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1013 | /* "bgp fast-external-failover" configuration. */ |
| 1014 | DEFUN (bgp_fast_external_failover, |
| 1015 | bgp_fast_external_failover_cmd, |
| 1016 | "bgp fast-external-failover", |
| 1017 | BGP_STR |
| 1018 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 1019 | { |
| 1020 | struct bgp *bgp; |
| 1021 | |
| 1022 | bgp = vty->index; |
| 1023 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 1024 | return CMD_SUCCESS; |
| 1025 | } |
| 1026 | |
| 1027 | DEFUN (no_bgp_fast_external_failover, |
| 1028 | no_bgp_fast_external_failover_cmd, |
| 1029 | "no bgp fast-external-failover", |
| 1030 | NO_STR |
| 1031 | BGP_STR |
| 1032 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 1033 | { |
| 1034 | struct bgp *bgp; |
| 1035 | |
| 1036 | bgp = vty->index; |
| 1037 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 1038 | return CMD_SUCCESS; |
| 1039 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1040 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1041 | /* "bgp enforce-first-as" configuration. */ |
| 1042 | DEFUN (bgp_enforce_first_as, |
| 1043 | bgp_enforce_first_as_cmd, |
| 1044 | "bgp enforce-first-as", |
| 1045 | BGP_STR |
| 1046 | "Enforce the first AS for EBGP routes\n") |
| 1047 | { |
| 1048 | struct bgp *bgp; |
| 1049 | |
| 1050 | bgp = vty->index; |
| 1051 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 1052 | return CMD_SUCCESS; |
| 1053 | } |
| 1054 | |
| 1055 | DEFUN (no_bgp_enforce_first_as, |
| 1056 | no_bgp_enforce_first_as_cmd, |
| 1057 | "no bgp enforce-first-as", |
| 1058 | NO_STR |
| 1059 | BGP_STR |
| 1060 | "Enforce the first AS for EBGP routes\n") |
| 1061 | { |
| 1062 | struct bgp *bgp; |
| 1063 | |
| 1064 | bgp = vty->index; |
| 1065 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 1066 | return CMD_SUCCESS; |
| 1067 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1068 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1069 | /* "bgp bestpath compare-routerid" configuration. */ |
| 1070 | DEFUN (bgp_bestpath_compare_router_id, |
| 1071 | bgp_bestpath_compare_router_id_cmd, |
| 1072 | "bgp bestpath compare-routerid", |
| 1073 | "BGP specific commands\n" |
| 1074 | "Change the default bestpath selection\n" |
| 1075 | "Compare router-id for identical EBGP paths\n") |
| 1076 | { |
| 1077 | struct bgp *bgp; |
| 1078 | |
| 1079 | bgp = vty->index; |
| 1080 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 1081 | return CMD_SUCCESS; |
| 1082 | } |
| 1083 | |
| 1084 | DEFUN (no_bgp_bestpath_compare_router_id, |
| 1085 | no_bgp_bestpath_compare_router_id_cmd, |
| 1086 | "no bgp bestpath compare-routerid", |
| 1087 | NO_STR |
| 1088 | "BGP specific commands\n" |
| 1089 | "Change the default bestpath selection\n" |
| 1090 | "Compare router-id for identical EBGP paths\n") |
| 1091 | { |
| 1092 | struct bgp *bgp; |
| 1093 | |
| 1094 | bgp = vty->index; |
| 1095 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 1096 | return CMD_SUCCESS; |
| 1097 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1098 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1099 | /* "bgp bestpath as-path ignore" configuration. */ |
| 1100 | DEFUN (bgp_bestpath_aspath_ignore, |
| 1101 | bgp_bestpath_aspath_ignore_cmd, |
| 1102 | "bgp bestpath as-path ignore", |
| 1103 | "BGP specific commands\n" |
| 1104 | "Change the default bestpath selection\n" |
| 1105 | "AS-path attribute\n" |
| 1106 | "Ignore as-path length in selecting a route\n") |
| 1107 | { |
| 1108 | struct bgp *bgp; |
| 1109 | |
| 1110 | bgp = vty->index; |
| 1111 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 1112 | return CMD_SUCCESS; |
| 1113 | } |
| 1114 | |
| 1115 | DEFUN (no_bgp_bestpath_aspath_ignore, |
| 1116 | no_bgp_bestpath_aspath_ignore_cmd, |
| 1117 | "no bgp bestpath as-path ignore", |
| 1118 | NO_STR |
| 1119 | "BGP specific commands\n" |
| 1120 | "Change the default bestpath selection\n" |
| 1121 | "AS-path attribute\n" |
| 1122 | "Ignore as-path length in selecting a route\n") |
| 1123 | { |
| 1124 | struct bgp *bgp; |
| 1125 | |
| 1126 | bgp = vty->index; |
| 1127 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 1128 | return CMD_SUCCESS; |
| 1129 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1130 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 1131 | /* "bgp bestpath as-path confed" configuration. */ |
| 1132 | DEFUN (bgp_bestpath_aspath_confed, |
| 1133 | bgp_bestpath_aspath_confed_cmd, |
| 1134 | "bgp bestpath as-path confed", |
| 1135 | "BGP specific commands\n" |
| 1136 | "Change the default bestpath selection\n" |
| 1137 | "AS-path attribute\n" |
| 1138 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 1139 | { |
| 1140 | struct bgp *bgp; |
| 1141 | |
| 1142 | bgp = vty->index; |
| 1143 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); |
| 1144 | return CMD_SUCCESS; |
| 1145 | } |
| 1146 | |
| 1147 | DEFUN (no_bgp_bestpath_aspath_confed, |
| 1148 | no_bgp_bestpath_aspath_confed_cmd, |
| 1149 | "no bgp bestpath as-path confed", |
| 1150 | NO_STR |
| 1151 | "BGP specific commands\n" |
| 1152 | "Change the default bestpath selection\n" |
| 1153 | "AS-path attribute\n" |
| 1154 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 1155 | { |
| 1156 | struct bgp *bgp; |
| 1157 | |
| 1158 | bgp = vty->index; |
| 1159 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); |
| 1160 | return CMD_SUCCESS; |
| 1161 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1162 | |
Pradosh Mohapatra | 2fdd455 | 2013-09-07 07:02:36 +0000 | [diff] [blame] | 1163 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
| 1164 | DEFUN (bgp_bestpath_aspath_multipath_relax, |
| 1165 | bgp_bestpath_aspath_multipath_relax_cmd, |
| 1166 | "bgp bestpath as-path multipath-relax", |
| 1167 | "BGP specific commands\n" |
| 1168 | "Change the default bestpath selection\n" |
| 1169 | "AS-path attribute\n" |
| 1170 | "Allow load sharing across routes that have different AS paths (but same length)\n") |
| 1171 | { |
| 1172 | struct bgp *bgp; |
| 1173 | |
| 1174 | bgp = vty->index; |
| 1175 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); |
| 1176 | return CMD_SUCCESS; |
| 1177 | } |
| 1178 | |
| 1179 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, |
| 1180 | no_bgp_bestpath_aspath_multipath_relax_cmd, |
| 1181 | "no bgp bestpath as-path multipath-relax", |
| 1182 | NO_STR |
| 1183 | "BGP specific commands\n" |
| 1184 | "Change the default bestpath selection\n" |
| 1185 | "AS-path attribute\n" |
| 1186 | "Allow load sharing across routes that have different AS paths (but same length)\n") |
| 1187 | { |
| 1188 | struct bgp *bgp; |
| 1189 | |
| 1190 | bgp = vty->index; |
| 1191 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); |
| 1192 | return CMD_SUCCESS; |
| 1193 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1194 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 1195 | /* "bgp log-neighbor-changes" configuration. */ |
| 1196 | DEFUN (bgp_log_neighbor_changes, |
| 1197 | bgp_log_neighbor_changes_cmd, |
| 1198 | "bgp log-neighbor-changes", |
| 1199 | "BGP specific commands\n" |
| 1200 | "Log neighbor up/down and reset reason\n") |
| 1201 | { |
| 1202 | struct bgp *bgp; |
| 1203 | |
| 1204 | bgp = vty->index; |
| 1205 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1206 | return CMD_SUCCESS; |
| 1207 | } |
| 1208 | |
| 1209 | DEFUN (no_bgp_log_neighbor_changes, |
| 1210 | no_bgp_log_neighbor_changes_cmd, |
| 1211 | "no bgp log-neighbor-changes", |
| 1212 | NO_STR |
| 1213 | "BGP specific commands\n" |
| 1214 | "Log neighbor up/down and reset reason\n") |
| 1215 | { |
| 1216 | struct bgp *bgp; |
| 1217 | |
| 1218 | bgp = vty->index; |
| 1219 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1220 | return CMD_SUCCESS; |
| 1221 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1222 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1223 | /* "bgp bestpath med" configuration. */ |
| 1224 | DEFUN (bgp_bestpath_med, |
| 1225 | bgp_bestpath_med_cmd, |
| 1226 | "bgp bestpath med (confed|missing-as-worst)", |
| 1227 | "BGP specific commands\n" |
| 1228 | "Change the default bestpath selection\n" |
| 1229 | "MED attribute\n" |
| 1230 | "Compare MED among confederation paths\n" |
| 1231 | "Treat missing MED as the least preferred one\n") |
| 1232 | { |
| 1233 | struct bgp *bgp; |
| 1234 | |
| 1235 | bgp = vty->index; |
| 1236 | |
| 1237 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1238 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1239 | else |
| 1240 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1241 | |
| 1242 | return CMD_SUCCESS; |
| 1243 | } |
| 1244 | |
| 1245 | DEFUN (bgp_bestpath_med2, |
| 1246 | bgp_bestpath_med2_cmd, |
| 1247 | "bgp bestpath med confed missing-as-worst", |
| 1248 | "BGP specific commands\n" |
| 1249 | "Change the default bestpath selection\n" |
| 1250 | "MED attribute\n" |
| 1251 | "Compare MED among confederation paths\n" |
| 1252 | "Treat missing MED as the least preferred one\n") |
| 1253 | { |
| 1254 | struct bgp *bgp; |
| 1255 | |
| 1256 | bgp = vty->index; |
| 1257 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1258 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1259 | return CMD_SUCCESS; |
| 1260 | } |
| 1261 | |
| 1262 | ALIAS (bgp_bestpath_med2, |
| 1263 | bgp_bestpath_med3_cmd, |
| 1264 | "bgp bestpath med missing-as-worst confed", |
| 1265 | "BGP specific commands\n" |
| 1266 | "Change the default bestpath selection\n" |
| 1267 | "MED attribute\n" |
| 1268 | "Treat missing MED as the least preferred one\n" |
| 1269 | "Compare MED among confederation paths\n") |
| 1270 | |
| 1271 | DEFUN (no_bgp_bestpath_med, |
| 1272 | no_bgp_bestpath_med_cmd, |
| 1273 | "no bgp bestpath med (confed|missing-as-worst)", |
| 1274 | NO_STR |
| 1275 | "BGP specific commands\n" |
| 1276 | "Change the default bestpath selection\n" |
| 1277 | "MED attribute\n" |
| 1278 | "Compare MED among confederation paths\n" |
| 1279 | "Treat missing MED as the least preferred one\n") |
| 1280 | { |
| 1281 | struct bgp *bgp; |
| 1282 | |
| 1283 | bgp = vty->index; |
| 1284 | |
| 1285 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1286 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1287 | else |
| 1288 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1289 | |
| 1290 | return CMD_SUCCESS; |
| 1291 | } |
| 1292 | |
| 1293 | DEFUN (no_bgp_bestpath_med2, |
| 1294 | no_bgp_bestpath_med2_cmd, |
| 1295 | "no bgp bestpath med confed missing-as-worst", |
| 1296 | NO_STR |
| 1297 | "BGP specific commands\n" |
| 1298 | "Change the default bestpath selection\n" |
| 1299 | "MED attribute\n" |
| 1300 | "Compare MED among confederation paths\n" |
| 1301 | "Treat missing MED as the least preferred one\n") |
| 1302 | { |
| 1303 | struct bgp *bgp; |
| 1304 | |
| 1305 | bgp = vty->index; |
| 1306 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1307 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1308 | return CMD_SUCCESS; |
| 1309 | } |
| 1310 | |
| 1311 | ALIAS (no_bgp_bestpath_med2, |
| 1312 | no_bgp_bestpath_med3_cmd, |
| 1313 | "no bgp bestpath med missing-as-worst confed", |
| 1314 | NO_STR |
| 1315 | "BGP specific commands\n" |
| 1316 | "Change the default bestpath selection\n" |
| 1317 | "MED attribute\n" |
| 1318 | "Treat missing MED as the least preferred one\n" |
| 1319 | "Compare MED among confederation paths\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1320 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1321 | /* "no bgp default ipv4-unicast". */ |
| 1322 | DEFUN (no_bgp_default_ipv4_unicast, |
| 1323 | no_bgp_default_ipv4_unicast_cmd, |
| 1324 | "no bgp default ipv4-unicast", |
| 1325 | NO_STR |
| 1326 | "BGP specific commands\n" |
| 1327 | "Configure BGP defaults\n" |
| 1328 | "Activate ipv4-unicast for a peer by default\n") |
| 1329 | { |
| 1330 | struct bgp *bgp; |
| 1331 | |
| 1332 | bgp = vty->index; |
| 1333 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1334 | return CMD_SUCCESS; |
| 1335 | } |
| 1336 | |
| 1337 | DEFUN (bgp_default_ipv4_unicast, |
| 1338 | bgp_default_ipv4_unicast_cmd, |
| 1339 | "bgp default ipv4-unicast", |
| 1340 | "BGP specific commands\n" |
| 1341 | "Configure BGP defaults\n" |
| 1342 | "Activate ipv4-unicast for a peer by default\n") |
| 1343 | { |
| 1344 | struct bgp *bgp; |
| 1345 | |
| 1346 | bgp = vty->index; |
| 1347 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1348 | return CMD_SUCCESS; |
| 1349 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1350 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1351 | /* "bgp import-check" configuration. */ |
| 1352 | DEFUN (bgp_network_import_check, |
| 1353 | bgp_network_import_check_cmd, |
| 1354 | "bgp network import-check", |
| 1355 | "BGP specific commands\n" |
| 1356 | "BGP network command\n" |
| 1357 | "Check BGP network route exists in IGP\n") |
| 1358 | { |
| 1359 | struct bgp *bgp; |
| 1360 | |
| 1361 | bgp = vty->index; |
| 1362 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1363 | return CMD_SUCCESS; |
| 1364 | } |
| 1365 | |
| 1366 | DEFUN (no_bgp_network_import_check, |
| 1367 | no_bgp_network_import_check_cmd, |
| 1368 | "no bgp network import-check", |
| 1369 | NO_STR |
| 1370 | "BGP specific commands\n" |
| 1371 | "BGP network command\n" |
| 1372 | "Check BGP network route exists in IGP\n") |
| 1373 | { |
| 1374 | struct bgp *bgp; |
| 1375 | |
| 1376 | bgp = vty->index; |
| 1377 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1378 | return CMD_SUCCESS; |
| 1379 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1380 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1381 | DEFUN (bgp_default_local_preference, |
| 1382 | bgp_default_local_preference_cmd, |
| 1383 | "bgp default local-preference <0-4294967295>", |
| 1384 | "BGP specific commands\n" |
| 1385 | "Configure BGP defaults\n" |
| 1386 | "local preference (higher=more preferred)\n" |
| 1387 | "Configure default local preference value\n") |
| 1388 | { |
| 1389 | struct bgp *bgp; |
| 1390 | u_int32_t local_pref; |
| 1391 | |
| 1392 | bgp = vty->index; |
| 1393 | |
| 1394 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); |
| 1395 | |
| 1396 | bgp_default_local_preference_set (bgp, local_pref); |
| 1397 | |
| 1398 | return CMD_SUCCESS; |
| 1399 | } |
| 1400 | |
| 1401 | DEFUN (no_bgp_default_local_preference, |
| 1402 | no_bgp_default_local_preference_cmd, |
| 1403 | "no bgp default local-preference", |
| 1404 | NO_STR |
| 1405 | "BGP specific commands\n" |
| 1406 | "Configure BGP defaults\n" |
| 1407 | "local preference (higher=more preferred)\n") |
| 1408 | { |
| 1409 | struct bgp *bgp; |
| 1410 | |
| 1411 | bgp = vty->index; |
| 1412 | bgp_default_local_preference_unset (bgp); |
| 1413 | return CMD_SUCCESS; |
| 1414 | } |
| 1415 | |
| 1416 | ALIAS (no_bgp_default_local_preference, |
| 1417 | no_bgp_default_local_preference_val_cmd, |
| 1418 | "no bgp default local-preference <0-4294967295>", |
| 1419 | NO_STR |
| 1420 | "BGP specific commands\n" |
| 1421 | "Configure BGP defaults\n" |
| 1422 | "local preference (higher=more preferred)\n" |
| 1423 | "Configure default local preference value\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1424 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1425 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1426 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
| 1427 | const char *as_str, afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1428 | { |
| 1429 | int ret; |
| 1430 | struct bgp *bgp; |
| 1431 | as_t as; |
| 1432 | union sockunion su; |
| 1433 | |
| 1434 | bgp = vty->index; |
| 1435 | |
| 1436 | /* Get AS number. */ |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 1437 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1438 | |
| 1439 | /* If peer is peer group, call proper function. */ |
| 1440 | ret = str2sockunion (peer_str, &su); |
| 1441 | if (ret < 0) |
| 1442 | { |
| 1443 | ret = peer_group_remote_as (bgp, peer_str, &as); |
| 1444 | if (ret < 0) |
| 1445 | { |
| 1446 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1447 | return CMD_WARNING; |
| 1448 | } |
| 1449 | return CMD_SUCCESS; |
| 1450 | } |
| 1451 | |
| 1452 | if (peer_address_self_check (&su)) |
| 1453 | { |
| 1454 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1455 | VTY_NEWLINE); |
| 1456 | return CMD_WARNING; |
| 1457 | } |
| 1458 | |
| 1459 | ret = peer_remote_as (bgp, &su, &as, afi, safi); |
| 1460 | |
| 1461 | /* This peer belongs to peer group. */ |
| 1462 | switch (ret) |
| 1463 | { |
| 1464 | case BGP_ERR_PEER_GROUP_MEMBER: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1465 | 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] | 1466 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1467 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1468 | 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] | 1469 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1470 | } |
| 1471 | return bgp_vty_return (vty, ret); |
| 1472 | } |
| 1473 | |
| 1474 | DEFUN (neighbor_remote_as, |
| 1475 | neighbor_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1476 | NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1477 | NEIGHBOR_STR |
| 1478 | NEIGHBOR_ADDR_STR2 |
| 1479 | "Specify a BGP neighbor\n" |
| 1480 | AS_STR) |
| 1481 | { |
| 1482 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); |
| 1483 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1484 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1485 | DEFUN (neighbor_peer_group, |
| 1486 | neighbor_peer_group_cmd, |
| 1487 | "neighbor WORD peer-group", |
| 1488 | NEIGHBOR_STR |
| 1489 | "Neighbor tag\n" |
| 1490 | "Configure peer-group\n") |
| 1491 | { |
| 1492 | struct bgp *bgp; |
| 1493 | struct peer_group *group; |
| 1494 | |
| 1495 | bgp = vty->index; |
| 1496 | |
| 1497 | group = peer_group_get (bgp, argv[0]); |
| 1498 | if (! group) |
| 1499 | return CMD_WARNING; |
| 1500 | |
| 1501 | return CMD_SUCCESS; |
| 1502 | } |
| 1503 | |
| 1504 | DEFUN (no_neighbor, |
| 1505 | no_neighbor_cmd, |
| 1506 | NO_NEIGHBOR_CMD2, |
| 1507 | NO_STR |
| 1508 | NEIGHBOR_STR |
| 1509 | NEIGHBOR_ADDR_STR2) |
| 1510 | { |
| 1511 | int ret; |
| 1512 | union sockunion su; |
| 1513 | struct peer_group *group; |
| 1514 | struct peer *peer; |
| 1515 | |
| 1516 | ret = str2sockunion (argv[0], &su); |
| 1517 | if (ret < 0) |
| 1518 | { |
| 1519 | group = peer_group_lookup (vty->index, argv[0]); |
| 1520 | if (group) |
| 1521 | peer_group_delete (group); |
| 1522 | else |
| 1523 | { |
| 1524 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1525 | return CMD_WARNING; |
| 1526 | } |
| 1527 | } |
| 1528 | else |
| 1529 | { |
| 1530 | peer = peer_lookup (vty->index, &su); |
| 1531 | if (peer) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 1532 | peer_delete (peer); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1533 | } |
| 1534 | |
| 1535 | return CMD_SUCCESS; |
| 1536 | } |
| 1537 | |
| 1538 | ALIAS (no_neighbor, |
| 1539 | no_neighbor_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1540 | NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1541 | NO_STR |
| 1542 | NEIGHBOR_STR |
| 1543 | NEIGHBOR_ADDR_STR |
| 1544 | "Specify a BGP neighbor\n" |
| 1545 | AS_STR) |
| 1546 | |
| 1547 | DEFUN (no_neighbor_peer_group, |
| 1548 | no_neighbor_peer_group_cmd, |
| 1549 | "no neighbor WORD peer-group", |
| 1550 | NO_STR |
| 1551 | NEIGHBOR_STR |
| 1552 | "Neighbor tag\n" |
| 1553 | "Configure peer-group\n") |
| 1554 | { |
| 1555 | struct peer_group *group; |
| 1556 | |
| 1557 | group = peer_group_lookup (vty->index, argv[0]); |
| 1558 | if (group) |
| 1559 | peer_group_delete (group); |
| 1560 | else |
| 1561 | { |
| 1562 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1563 | return CMD_WARNING; |
| 1564 | } |
| 1565 | return CMD_SUCCESS; |
| 1566 | } |
| 1567 | |
| 1568 | DEFUN (no_neighbor_peer_group_remote_as, |
| 1569 | no_neighbor_peer_group_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1570 | "no neighbor WORD remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1571 | NO_STR |
| 1572 | NEIGHBOR_STR |
| 1573 | "Neighbor tag\n" |
| 1574 | "Specify a BGP neighbor\n" |
| 1575 | AS_STR) |
| 1576 | { |
| 1577 | struct peer_group *group; |
| 1578 | |
| 1579 | group = peer_group_lookup (vty->index, argv[0]); |
| 1580 | if (group) |
| 1581 | peer_group_remote_as_delete (group); |
| 1582 | else |
| 1583 | { |
| 1584 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1585 | return CMD_WARNING; |
| 1586 | } |
| 1587 | return CMD_SUCCESS; |
| 1588 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1589 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1590 | DEFUN (neighbor_local_as, |
| 1591 | neighbor_local_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1592 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1593 | NEIGHBOR_STR |
| 1594 | NEIGHBOR_ADDR_STR2 |
| 1595 | "Specify a local-as number\n" |
| 1596 | "AS number used as local AS\n") |
| 1597 | { |
| 1598 | struct peer *peer; |
| 1599 | int ret; |
| 1600 | |
| 1601 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1602 | if (! peer) |
| 1603 | return CMD_WARNING; |
| 1604 | |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 1605 | ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1606 | return bgp_vty_return (vty, ret); |
| 1607 | } |
| 1608 | |
| 1609 | DEFUN (neighbor_local_as_no_prepend, |
| 1610 | neighbor_local_as_no_prepend_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1611 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1612 | NEIGHBOR_STR |
| 1613 | NEIGHBOR_ADDR_STR2 |
| 1614 | "Specify a local-as number\n" |
| 1615 | "AS number used as local AS\n" |
| 1616 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1617 | { |
| 1618 | struct peer *peer; |
| 1619 | int ret; |
| 1620 | |
| 1621 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1622 | if (! peer) |
| 1623 | return CMD_WARNING; |
| 1624 | |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 1625 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1626 | return bgp_vty_return (vty, ret); |
| 1627 | } |
| 1628 | |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 1629 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
| 1630 | neighbor_local_as_no_prepend_replace_as_cmd, |
| 1631 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", |
| 1632 | NEIGHBOR_STR |
| 1633 | NEIGHBOR_ADDR_STR2 |
| 1634 | "Specify a local-as number\n" |
| 1635 | "AS number used as local AS\n" |
| 1636 | "Do not prepend local-as to updates from ebgp peers\n" |
| 1637 | "Do not prepend local-as to updates from ibgp peers\n") |
| 1638 | { |
| 1639 | struct peer *peer; |
| 1640 | int ret; |
| 1641 | |
| 1642 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1643 | if (! peer) |
| 1644 | return CMD_WARNING; |
| 1645 | |
| 1646 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); |
| 1647 | return bgp_vty_return (vty, ret); |
| 1648 | } |
| 1649 | |
| 1650 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1651 | DEFUN (no_neighbor_local_as, |
| 1652 | no_neighbor_local_as_cmd, |
| 1653 | NO_NEIGHBOR_CMD2 "local-as", |
| 1654 | NO_STR |
| 1655 | NEIGHBOR_STR |
| 1656 | NEIGHBOR_ADDR_STR2 |
| 1657 | "Specify a local-as number\n") |
| 1658 | { |
| 1659 | struct peer *peer; |
| 1660 | int ret; |
| 1661 | |
| 1662 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1663 | if (! peer) |
| 1664 | return CMD_WARNING; |
| 1665 | |
| 1666 | ret = peer_local_as_unset (peer); |
| 1667 | return bgp_vty_return (vty, ret); |
| 1668 | } |
| 1669 | |
| 1670 | ALIAS (no_neighbor_local_as, |
| 1671 | no_neighbor_local_as_val_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1672 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1673 | NO_STR |
| 1674 | NEIGHBOR_STR |
| 1675 | NEIGHBOR_ADDR_STR2 |
| 1676 | "Specify a local-as number\n" |
| 1677 | "AS number used as local AS\n") |
| 1678 | |
| 1679 | ALIAS (no_neighbor_local_as, |
| 1680 | no_neighbor_local_as_val2_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1681 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1682 | NO_STR |
| 1683 | NEIGHBOR_STR |
| 1684 | NEIGHBOR_ADDR_STR2 |
| 1685 | "Specify a local-as number\n" |
| 1686 | "AS number used as local AS\n" |
| 1687 | "Do not prepend local-as to updates from ebgp peers\n") |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 1688 | |
| 1689 | ALIAS (no_neighbor_local_as, |
| 1690 | no_neighbor_local_as_val3_cmd, |
| 1691 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", |
| 1692 | NO_STR |
| 1693 | NEIGHBOR_STR |
| 1694 | NEIGHBOR_ADDR_STR2 |
| 1695 | "Specify a local-as number\n" |
| 1696 | "AS number used as local AS\n" |
| 1697 | "Do not prepend local-as to updates from ebgp peers\n" |
| 1698 | "Do not prepend local-as to updates from ibgp peers\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1699 | |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 1700 | DEFUN (neighbor_password, |
| 1701 | neighbor_password_cmd, |
| 1702 | NEIGHBOR_CMD2 "password LINE", |
| 1703 | NEIGHBOR_STR |
| 1704 | NEIGHBOR_ADDR_STR2 |
| 1705 | "Set a password\n" |
| 1706 | "The password\n") |
| 1707 | { |
| 1708 | struct peer *peer; |
| 1709 | int ret; |
| 1710 | |
| 1711 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1712 | if (! peer) |
| 1713 | return CMD_WARNING; |
| 1714 | |
| 1715 | ret = peer_password_set (peer, argv[1]); |
| 1716 | return bgp_vty_return (vty, ret); |
| 1717 | } |
| 1718 | |
| 1719 | DEFUN (no_neighbor_password, |
| 1720 | no_neighbor_password_cmd, |
| 1721 | NO_NEIGHBOR_CMD2 "password", |
| 1722 | NO_STR |
| 1723 | NEIGHBOR_STR |
| 1724 | NEIGHBOR_ADDR_STR2 |
| 1725 | "Set a password\n") |
| 1726 | { |
| 1727 | struct peer *peer; |
| 1728 | int ret; |
| 1729 | |
| 1730 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1731 | if (! peer) |
| 1732 | return CMD_WARNING; |
| 1733 | |
| 1734 | ret = peer_password_unset (peer); |
| 1735 | return bgp_vty_return (vty, ret); |
| 1736 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1737 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1738 | DEFUN (neighbor_activate, |
| 1739 | neighbor_activate_cmd, |
| 1740 | NEIGHBOR_CMD2 "activate", |
| 1741 | NEIGHBOR_STR |
| 1742 | NEIGHBOR_ADDR_STR2 |
| 1743 | "Enable the Address Family for this Neighbor\n") |
| 1744 | { |
| 1745 | struct peer *peer; |
| 1746 | |
| 1747 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1748 | if (! peer) |
| 1749 | return CMD_WARNING; |
| 1750 | |
| 1751 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1752 | |
| 1753 | return CMD_SUCCESS; |
| 1754 | } |
| 1755 | |
| 1756 | DEFUN (no_neighbor_activate, |
| 1757 | no_neighbor_activate_cmd, |
| 1758 | NO_NEIGHBOR_CMD2 "activate", |
| 1759 | NO_STR |
| 1760 | NEIGHBOR_STR |
| 1761 | NEIGHBOR_ADDR_STR2 |
| 1762 | "Enable the Address Family for this Neighbor\n") |
| 1763 | { |
| 1764 | int ret; |
| 1765 | struct peer *peer; |
| 1766 | |
| 1767 | /* Lookup peer. */ |
| 1768 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1769 | if (! peer) |
| 1770 | return CMD_WARNING; |
| 1771 | |
| 1772 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1773 | |
| 1774 | return bgp_vty_return (vty, ret); |
| 1775 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1776 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1777 | DEFUN (neighbor_set_peer_group, |
| 1778 | neighbor_set_peer_group_cmd, |
| 1779 | NEIGHBOR_CMD "peer-group WORD", |
| 1780 | NEIGHBOR_STR |
| 1781 | NEIGHBOR_ADDR_STR |
| 1782 | "Member of the peer-group\n" |
| 1783 | "peer-group name\n") |
| 1784 | { |
| 1785 | int ret; |
| 1786 | as_t as; |
| 1787 | union sockunion su; |
| 1788 | struct bgp *bgp; |
| 1789 | struct peer_group *group; |
| 1790 | |
| 1791 | bgp = vty->index; |
| 1792 | |
| 1793 | ret = str2sockunion (argv[0], &su); |
| 1794 | if (ret < 0) |
| 1795 | { |
| 1796 | vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); |
| 1797 | return CMD_WARNING; |
| 1798 | } |
| 1799 | |
| 1800 | group = peer_group_lookup (bgp, argv[1]); |
| 1801 | if (! group) |
| 1802 | { |
| 1803 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1804 | return CMD_WARNING; |
| 1805 | } |
| 1806 | |
| 1807 | if (peer_address_self_check (&su)) |
| 1808 | { |
| 1809 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1810 | VTY_NEWLINE); |
| 1811 | return CMD_WARNING; |
| 1812 | } |
| 1813 | |
| 1814 | ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty), |
| 1815 | bgp_node_safi (vty), &as); |
| 1816 | |
| 1817 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) |
| 1818 | { |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1819 | 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] | 1820 | return CMD_WARNING; |
| 1821 | } |
| 1822 | |
| 1823 | return bgp_vty_return (vty, ret); |
| 1824 | } |
| 1825 | |
| 1826 | DEFUN (no_neighbor_set_peer_group, |
| 1827 | no_neighbor_set_peer_group_cmd, |
| 1828 | NO_NEIGHBOR_CMD "peer-group WORD", |
| 1829 | NO_STR |
| 1830 | NEIGHBOR_STR |
| 1831 | NEIGHBOR_ADDR_STR |
| 1832 | "Member of the peer-group\n" |
| 1833 | "peer-group name\n") |
| 1834 | { |
| 1835 | int ret; |
| 1836 | struct bgp *bgp; |
| 1837 | struct peer *peer; |
| 1838 | struct peer_group *group; |
| 1839 | |
| 1840 | bgp = vty->index; |
| 1841 | |
| 1842 | peer = peer_lookup_vty (vty, argv[0]); |
| 1843 | if (! peer) |
| 1844 | return CMD_WARNING; |
| 1845 | |
| 1846 | group = peer_group_lookup (bgp, argv[1]); |
| 1847 | if (! group) |
| 1848 | { |
| 1849 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1850 | return CMD_WARNING; |
| 1851 | } |
| 1852 | |
| 1853 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), |
| 1854 | bgp_node_safi (vty)); |
| 1855 | |
| 1856 | return bgp_vty_return (vty, ret); |
| 1857 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1858 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1859 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1860 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
| 1861 | u_int16_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1862 | { |
| 1863 | int ret; |
| 1864 | struct peer *peer; |
| 1865 | |
| 1866 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 1867 | if (! peer) |
| 1868 | return CMD_WARNING; |
| 1869 | |
| 1870 | if (set) |
| 1871 | ret = peer_flag_set (peer, flag); |
| 1872 | else |
| 1873 | ret = peer_flag_unset (peer, flag); |
| 1874 | |
| 1875 | return bgp_vty_return (vty, ret); |
| 1876 | } |
| 1877 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1878 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1879 | 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] | 1880 | { |
| 1881 | return peer_flag_modify_vty (vty, ip_str, flag, 1); |
| 1882 | } |
| 1883 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1884 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1885 | 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] | 1886 | { |
| 1887 | return peer_flag_modify_vty (vty, ip_str, flag, 0); |
| 1888 | } |
| 1889 | |
| 1890 | /* neighbor passive. */ |
| 1891 | DEFUN (neighbor_passive, |
| 1892 | neighbor_passive_cmd, |
| 1893 | NEIGHBOR_CMD2 "passive", |
| 1894 | NEIGHBOR_STR |
| 1895 | NEIGHBOR_ADDR_STR2 |
| 1896 | "Don't send open messages to this neighbor\n") |
| 1897 | { |
| 1898 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1899 | } |
| 1900 | |
| 1901 | DEFUN (no_neighbor_passive, |
| 1902 | no_neighbor_passive_cmd, |
| 1903 | NO_NEIGHBOR_CMD2 "passive", |
| 1904 | NO_STR |
| 1905 | NEIGHBOR_STR |
| 1906 | NEIGHBOR_ADDR_STR2 |
| 1907 | "Don't send open messages to this neighbor\n") |
| 1908 | { |
| 1909 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1910 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1911 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1912 | /* neighbor shutdown. */ |
| 1913 | DEFUN (neighbor_shutdown, |
| 1914 | neighbor_shutdown_cmd, |
| 1915 | NEIGHBOR_CMD2 "shutdown", |
| 1916 | NEIGHBOR_STR |
| 1917 | NEIGHBOR_ADDR_STR2 |
| 1918 | "Administratively shut down this neighbor\n") |
| 1919 | { |
| 1920 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1921 | } |
| 1922 | |
| 1923 | DEFUN (no_neighbor_shutdown, |
| 1924 | no_neighbor_shutdown_cmd, |
| 1925 | NO_NEIGHBOR_CMD2 "shutdown", |
| 1926 | NO_STR |
| 1927 | NEIGHBOR_STR |
| 1928 | NEIGHBOR_ADDR_STR2 |
| 1929 | "Administratively shut down this neighbor\n") |
| 1930 | { |
| 1931 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1932 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1933 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1934 | /* Deprecated neighbor capability route-refresh. */ |
| 1935 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, |
| 1936 | neighbor_capability_route_refresh_cmd, |
| 1937 | NEIGHBOR_CMD2 "capability route-refresh", |
| 1938 | NEIGHBOR_STR |
| 1939 | NEIGHBOR_ADDR_STR2 |
| 1940 | "Advertise capability to the peer\n" |
| 1941 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1942 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1943 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1944 | } |
| 1945 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1946 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
| 1947 | no_neighbor_capability_route_refresh_cmd, |
| 1948 | NO_NEIGHBOR_CMD2 "capability route-refresh", |
| 1949 | NO_STR |
| 1950 | NEIGHBOR_STR |
| 1951 | NEIGHBOR_ADDR_STR2 |
| 1952 | "Advertise capability to the peer\n" |
| 1953 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1954 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1955 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1956 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1957 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1958 | /* neighbor capability dynamic. */ |
| 1959 | DEFUN (neighbor_capability_dynamic, |
| 1960 | neighbor_capability_dynamic_cmd, |
| 1961 | NEIGHBOR_CMD2 "capability dynamic", |
| 1962 | NEIGHBOR_STR |
| 1963 | NEIGHBOR_ADDR_STR2 |
| 1964 | "Advertise capability to the peer\n" |
| 1965 | "Advertise dynamic capability to this neighbor\n") |
| 1966 | { |
| 1967 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1968 | } |
| 1969 | |
| 1970 | DEFUN (no_neighbor_capability_dynamic, |
| 1971 | no_neighbor_capability_dynamic_cmd, |
| 1972 | NO_NEIGHBOR_CMD2 "capability dynamic", |
| 1973 | NO_STR |
| 1974 | NEIGHBOR_STR |
| 1975 | NEIGHBOR_ADDR_STR2 |
| 1976 | "Advertise capability to the peer\n" |
| 1977 | "Advertise dynamic capability to this neighbor\n") |
| 1978 | { |
| 1979 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1980 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1981 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1982 | /* neighbor dont-capability-negotiate */ |
| 1983 | DEFUN (neighbor_dont_capability_negotiate, |
| 1984 | neighbor_dont_capability_negotiate_cmd, |
| 1985 | NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1986 | NEIGHBOR_STR |
| 1987 | NEIGHBOR_ADDR_STR2 |
| 1988 | "Do not perform capability negotiation\n") |
| 1989 | { |
| 1990 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1991 | } |
| 1992 | |
| 1993 | DEFUN (no_neighbor_dont_capability_negotiate, |
| 1994 | no_neighbor_dont_capability_negotiate_cmd, |
| 1995 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1996 | NO_STR |
| 1997 | NEIGHBOR_STR |
| 1998 | NEIGHBOR_ADDR_STR2 |
| 1999 | "Do not perform capability negotiation\n") |
| 2000 | { |
| 2001 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 2002 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2003 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2004 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2005 | 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] | 2006 | safi_t safi, u_int32_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2007 | { |
| 2008 | int ret; |
| 2009 | struct peer *peer; |
| 2010 | |
| 2011 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2012 | if (! peer) |
| 2013 | return CMD_WARNING; |
| 2014 | |
| 2015 | if (set) |
| 2016 | ret = peer_af_flag_set (peer, afi, safi, flag); |
| 2017 | else |
| 2018 | ret = peer_af_flag_unset (peer, afi, safi, flag); |
| 2019 | |
| 2020 | return bgp_vty_return (vty, ret); |
| 2021 | } |
| 2022 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2023 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2024 | 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] | 2025 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2026 | { |
| 2027 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); |
| 2028 | } |
| 2029 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2030 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2031 | 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] | 2032 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2033 | { |
| 2034 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); |
| 2035 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2036 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2037 | /* neighbor capability orf prefix-list. */ |
| 2038 | DEFUN (neighbor_capability_orf_prefix, |
| 2039 | neighbor_capability_orf_prefix_cmd, |
| 2040 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 2041 | NEIGHBOR_STR |
| 2042 | NEIGHBOR_ADDR_STR2 |
| 2043 | "Advertise capability to the peer\n" |
| 2044 | "Advertise ORF capability to the peer\n" |
| 2045 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 2046 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 2047 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 2048 | "Capability to SEND the ORF to this neighbor\n") |
| 2049 | { |
| 2050 | u_int16_t flag = 0; |
| 2051 | |
| 2052 | if (strncmp (argv[1], "s", 1) == 0) |
| 2053 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 2054 | else if (strncmp (argv[1], "r", 1) == 0) |
| 2055 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 2056 | else if (strncmp (argv[1], "b", 1) == 0) |
| 2057 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 2058 | else |
| 2059 | return CMD_WARNING; |
| 2060 | |
| 2061 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2062 | bgp_node_safi (vty), flag); |
| 2063 | } |
| 2064 | |
| 2065 | DEFUN (no_neighbor_capability_orf_prefix, |
| 2066 | no_neighbor_capability_orf_prefix_cmd, |
| 2067 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 2068 | NO_STR |
| 2069 | NEIGHBOR_STR |
| 2070 | NEIGHBOR_ADDR_STR2 |
| 2071 | "Advertise capability to the peer\n" |
| 2072 | "Advertise ORF capability to the peer\n" |
| 2073 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 2074 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 2075 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 2076 | "Capability to SEND the ORF to this neighbor\n") |
| 2077 | { |
| 2078 | u_int16_t flag = 0; |
| 2079 | |
| 2080 | if (strncmp (argv[1], "s", 1) == 0) |
| 2081 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 2082 | else if (strncmp (argv[1], "r", 1) == 0) |
| 2083 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 2084 | else if (strncmp (argv[1], "b", 1) == 0) |
| 2085 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 2086 | else |
| 2087 | return CMD_WARNING; |
| 2088 | |
| 2089 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2090 | bgp_node_safi (vty), flag); |
| 2091 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2092 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2093 | /* neighbor next-hop-self. */ |
| 2094 | DEFUN (neighbor_nexthop_self, |
| 2095 | neighbor_nexthop_self_cmd, |
Timo Teräs | 9e7a53c | 2014-04-24 10:22:37 +0300 | [diff] [blame] | 2096 | NEIGHBOR_CMD2 "next-hop-self {all}", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2097 | NEIGHBOR_STR |
| 2098 | NEIGHBOR_ADDR_STR2 |
Timo Teräs | 9e7a53c | 2014-04-24 10:22:37 +0300 | [diff] [blame] | 2099 | "Disable the next hop calculation for this neighbor\n" |
| 2100 | "Apply also to ibgp-learned routes when acting as a route reflector\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2101 | { |
Timo Teräs | 9e7a53c | 2014-04-24 10:22:37 +0300 | [diff] [blame] | 2102 | u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0; |
| 2103 | int rc; |
| 2104 | |
| 2105 | /* Check if "all" is specified */ |
| 2106 | if (argv[1] != NULL) |
| 2107 | flags |= PEER_FLAG_NEXTHOP_SELF_ALL; |
| 2108 | else |
| 2109 | unset |= PEER_FLAG_NEXTHOP_SELF_ALL; |
| 2110 | |
| 2111 | rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2112 | bgp_node_safi (vty), flags); |
| 2113 | if ( rc == CMD_SUCCESS && unset ) |
| 2114 | rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2115 | bgp_node_safi (vty), unset); |
| 2116 | return rc; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2117 | } |
| 2118 | |
| 2119 | DEFUN (no_neighbor_nexthop_self, |
| 2120 | no_neighbor_nexthop_self_cmd, |
Timo Teräs | 9e7a53c | 2014-04-24 10:22:37 +0300 | [diff] [blame] | 2121 | NO_NEIGHBOR_CMD2 "next-hop-self {all}", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2122 | NO_STR |
| 2123 | NEIGHBOR_STR |
| 2124 | NEIGHBOR_ADDR_STR2 |
Timo Teräs | 9e7a53c | 2014-04-24 10:22:37 +0300 | [diff] [blame] | 2125 | "Disable the next hop calculation for this neighbor\n" |
| 2126 | "Apply also to ibgp-learned routes when acting as a route reflector\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2127 | { |
| 2128 | 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] | 2129 | bgp_node_safi (vty), |
| 2130 | PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2131 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2132 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2133 | /* neighbor remove-private-AS. */ |
| 2134 | DEFUN (neighbor_remove_private_as, |
| 2135 | neighbor_remove_private_as_cmd, |
| 2136 | NEIGHBOR_CMD2 "remove-private-AS", |
| 2137 | NEIGHBOR_STR |
| 2138 | NEIGHBOR_ADDR_STR2 |
| 2139 | "Remove private AS number from outbound updates\n") |
| 2140 | { |
| 2141 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2142 | bgp_node_safi (vty), |
| 2143 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 2144 | } |
| 2145 | |
| 2146 | DEFUN (no_neighbor_remove_private_as, |
| 2147 | no_neighbor_remove_private_as_cmd, |
| 2148 | NO_NEIGHBOR_CMD2 "remove-private-AS", |
| 2149 | NO_STR |
| 2150 | NEIGHBOR_STR |
| 2151 | NEIGHBOR_ADDR_STR2 |
| 2152 | "Remove private AS number from outbound updates\n") |
| 2153 | { |
| 2154 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2155 | bgp_node_safi (vty), |
| 2156 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 2157 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2158 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2159 | /* neighbor send-community. */ |
| 2160 | DEFUN (neighbor_send_community, |
| 2161 | neighbor_send_community_cmd, |
| 2162 | NEIGHBOR_CMD2 "send-community", |
| 2163 | NEIGHBOR_STR |
| 2164 | NEIGHBOR_ADDR_STR2 |
| 2165 | "Send Community attribute to this neighbor\n") |
| 2166 | { |
| 2167 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2168 | bgp_node_safi (vty), |
| 2169 | PEER_FLAG_SEND_COMMUNITY); |
| 2170 | } |
| 2171 | |
| 2172 | DEFUN (no_neighbor_send_community, |
| 2173 | no_neighbor_send_community_cmd, |
| 2174 | NO_NEIGHBOR_CMD2 "send-community", |
| 2175 | NO_STR |
| 2176 | NEIGHBOR_STR |
| 2177 | NEIGHBOR_ADDR_STR2 |
| 2178 | "Send Community attribute to this neighbor\n") |
| 2179 | { |
| 2180 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2181 | bgp_node_safi (vty), |
| 2182 | PEER_FLAG_SEND_COMMUNITY); |
| 2183 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2184 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2185 | /* neighbor send-community extended. */ |
| 2186 | DEFUN (neighbor_send_community_type, |
| 2187 | neighbor_send_community_type_cmd, |
| 2188 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 2189 | NEIGHBOR_STR |
| 2190 | NEIGHBOR_ADDR_STR2 |
| 2191 | "Send Community attribute to this neighbor\n" |
| 2192 | "Send Standard and Extended Community attributes\n" |
| 2193 | "Send Extended Community attributes\n" |
| 2194 | "Send Standard Community attributes\n") |
| 2195 | { |
| 2196 | if (strncmp (argv[1], "s", 1) == 0) |
| 2197 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2198 | bgp_node_safi (vty), |
| 2199 | PEER_FLAG_SEND_COMMUNITY); |
| 2200 | if (strncmp (argv[1], "e", 1) == 0) |
| 2201 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2202 | bgp_node_safi (vty), |
| 2203 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 2204 | |
| 2205 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2206 | bgp_node_safi (vty), |
| 2207 | (PEER_FLAG_SEND_COMMUNITY| |
| 2208 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 2209 | } |
| 2210 | |
| 2211 | DEFUN (no_neighbor_send_community_type, |
| 2212 | no_neighbor_send_community_type_cmd, |
| 2213 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 2214 | NO_STR |
| 2215 | NEIGHBOR_STR |
| 2216 | NEIGHBOR_ADDR_STR2 |
| 2217 | "Send Community attribute to this neighbor\n" |
| 2218 | "Send Standard and Extended Community attributes\n" |
| 2219 | "Send Extended Community attributes\n" |
| 2220 | "Send Standard Community attributes\n") |
| 2221 | { |
| 2222 | if (strncmp (argv[1], "s", 1) == 0) |
| 2223 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2224 | bgp_node_safi (vty), |
| 2225 | PEER_FLAG_SEND_COMMUNITY); |
| 2226 | if (strncmp (argv[1], "e", 1) == 0) |
| 2227 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2228 | bgp_node_safi (vty), |
| 2229 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 2230 | |
| 2231 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2232 | bgp_node_safi (vty), |
| 2233 | (PEER_FLAG_SEND_COMMUNITY | |
| 2234 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 2235 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2236 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2237 | /* neighbor soft-reconfig. */ |
| 2238 | DEFUN (neighbor_soft_reconfiguration, |
| 2239 | neighbor_soft_reconfiguration_cmd, |
| 2240 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 2241 | NEIGHBOR_STR |
| 2242 | NEIGHBOR_ADDR_STR2 |
| 2243 | "Per neighbor soft reconfiguration\n" |
| 2244 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 2245 | { |
| 2246 | return peer_af_flag_set_vty (vty, argv[0], |
| 2247 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 2248 | PEER_FLAG_SOFT_RECONFIG); |
| 2249 | } |
| 2250 | |
| 2251 | DEFUN (no_neighbor_soft_reconfiguration, |
| 2252 | no_neighbor_soft_reconfiguration_cmd, |
| 2253 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 2254 | NO_STR |
| 2255 | NEIGHBOR_STR |
| 2256 | NEIGHBOR_ADDR_STR2 |
| 2257 | "Per neighbor soft reconfiguration\n" |
| 2258 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 2259 | { |
| 2260 | return peer_af_flag_unset_vty (vty, argv[0], |
| 2261 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 2262 | PEER_FLAG_SOFT_RECONFIG); |
| 2263 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2264 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2265 | DEFUN (neighbor_route_reflector_client, |
| 2266 | neighbor_route_reflector_client_cmd, |
| 2267 | NEIGHBOR_CMD2 "route-reflector-client", |
| 2268 | NEIGHBOR_STR |
| 2269 | NEIGHBOR_ADDR_STR2 |
| 2270 | "Configure a neighbor as Route Reflector client\n") |
| 2271 | { |
| 2272 | struct peer *peer; |
| 2273 | |
| 2274 | |
| 2275 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2276 | if (! peer) |
| 2277 | return CMD_WARNING; |
| 2278 | |
| 2279 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2280 | bgp_node_safi (vty), |
| 2281 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2282 | } |
| 2283 | |
| 2284 | DEFUN (no_neighbor_route_reflector_client, |
| 2285 | no_neighbor_route_reflector_client_cmd, |
| 2286 | NO_NEIGHBOR_CMD2 "route-reflector-client", |
| 2287 | NO_STR |
| 2288 | NEIGHBOR_STR |
| 2289 | NEIGHBOR_ADDR_STR2 |
| 2290 | "Configure a neighbor as Route Reflector client\n") |
| 2291 | { |
| 2292 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2293 | bgp_node_safi (vty), |
| 2294 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2295 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2296 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2297 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2298 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
| 2299 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2300 | { |
| 2301 | int ret; |
| 2302 | struct bgp *bgp; |
| 2303 | struct peer *peer; |
| 2304 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2305 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2306 | struct bgp_filter *pfilter; |
| 2307 | struct bgp_filter *gfilter; |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2308 | int locked_and_added = 0; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2309 | |
| 2310 | bgp = vty->index; |
| 2311 | |
| 2312 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2313 | if ( ! peer ) |
| 2314 | return CMD_WARNING; |
| 2315 | |
| 2316 | /* If it is already a RS-Client, don't do anything. */ |
| 2317 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2318 | return CMD_SUCCESS; |
| 2319 | |
| 2320 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2321 | { |
| 2322 | peer = peer_lock (peer); /* rsclient peer list reference */ |
| 2323 | listnode_add_sort (bgp->rsclient, peer); |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2324 | locked_and_added = 1; |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2325 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2326 | |
| 2327 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2328 | if (ret < 0) |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2329 | { |
| 2330 | if (locked_and_added) |
| 2331 | { |
| 2332 | listnode_delete (bgp->rsclient, peer); |
| 2333 | peer_unlock (peer); /* rsclient peer list reference */ |
| 2334 | } |
| 2335 | |
| 2336 | return bgp_vty_return (vty, ret); |
| 2337 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2338 | |
Paul Jakma | 64e580a | 2006-02-21 01:09:01 +0000 | [diff] [blame] | 2339 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2340 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2341 | /* RIB peer reference. Released when table is free'd in bgp_table_free. */ |
| 2342 | peer->rib[afi][safi]->owner = peer_lock (peer); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2343 | |
| 2344 | /* Check for existing 'network' and 'redistribute' routes. */ |
| 2345 | bgp_check_local_routes_rsclient (peer, afi, safi); |
| 2346 | |
| 2347 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ |
| 2348 | bgp_soft_reconfig_rsclient (peer, afi, safi); |
| 2349 | |
| 2350 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2351 | { |
| 2352 | group = peer->group; |
| 2353 | gfilter = &peer->filter[afi][safi]; |
| 2354 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2355 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2356 | { |
| 2357 | pfilter = &peer->filter[afi][safi]; |
| 2358 | |
| 2359 | /* Members of a non-RS-Client group should not be RS-Clients, as that |
| 2360 | is checked when the become part of the peer-group */ |
| 2361 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2362 | if (ret < 0) |
| 2363 | return bgp_vty_return (vty, ret); |
| 2364 | |
| 2365 | /* Make peer's RIB point to group's RIB. */ |
| 2366 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; |
| 2367 | |
| 2368 | /* Import policy. */ |
| 2369 | if (pfilter->map[RMAP_IMPORT].name) |
| 2370 | free (pfilter->map[RMAP_IMPORT].name); |
| 2371 | if (gfilter->map[RMAP_IMPORT].name) |
| 2372 | { |
| 2373 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); |
| 2374 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; |
| 2375 | } |
| 2376 | else |
| 2377 | { |
| 2378 | pfilter->map[RMAP_IMPORT].name = NULL; |
| 2379 | pfilter->map[RMAP_IMPORT].map =NULL; |
| 2380 | } |
| 2381 | |
| 2382 | /* Export policy. */ |
| 2383 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) |
| 2384 | { |
| 2385 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); |
| 2386 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; |
| 2387 | } |
| 2388 | } |
| 2389 | } |
| 2390 | return CMD_SUCCESS; |
| 2391 | } |
| 2392 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2393 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2394 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
| 2395 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2396 | { |
| 2397 | int ret; |
| 2398 | struct bgp *bgp; |
| 2399 | struct peer *peer; |
| 2400 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2401 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2402 | |
| 2403 | bgp = vty->index; |
| 2404 | |
| 2405 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2406 | if ( ! peer ) |
| 2407 | return CMD_WARNING; |
| 2408 | |
| 2409 | /* If it is not a RS-Client, don't do anything. */ |
| 2410 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2411 | return CMD_SUCCESS; |
| 2412 | |
| 2413 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2414 | { |
| 2415 | group = peer->group; |
| 2416 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2417 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2418 | { |
| 2419 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2420 | if (ret < 0) |
| 2421 | return bgp_vty_return (vty, ret); |
| 2422 | |
| 2423 | peer->rib[afi][safi] = NULL; |
| 2424 | } |
| 2425 | |
| 2426 | peer = group->conf; |
| 2427 | } |
| 2428 | |
| 2429 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2430 | if (ret < 0) |
| 2431 | return bgp_vty_return (vty, ret); |
| 2432 | |
| 2433 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2434 | { |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2435 | bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2436 | listnode_delete (bgp->rsclient, peer); |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2437 | peer_unlock (peer); /* peer bgp rsclient reference */ |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2438 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2439 | |
Paul Jakma | b608d5b | 2008-07-02 02:12:07 +0000 | [diff] [blame] | 2440 | bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2441 | |
| 2442 | return CMD_SUCCESS; |
| 2443 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2444 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2445 | /* neighbor route-server-client. */ |
| 2446 | DEFUN (neighbor_route_server_client, |
| 2447 | neighbor_route_server_client_cmd, |
| 2448 | NEIGHBOR_CMD2 "route-server-client", |
| 2449 | NEIGHBOR_STR |
| 2450 | NEIGHBOR_ADDR_STR2 |
| 2451 | "Configure a neighbor as Route Server client\n") |
| 2452 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2453 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
| 2454 | bgp_node_safi(vty)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2455 | } |
| 2456 | |
| 2457 | DEFUN (no_neighbor_route_server_client, |
| 2458 | no_neighbor_route_server_client_cmd, |
| 2459 | NO_NEIGHBOR_CMD2 "route-server-client", |
| 2460 | NO_STR |
| 2461 | NEIGHBOR_STR |
| 2462 | NEIGHBOR_ADDR_STR2 |
| 2463 | "Configure a neighbor as Route Server client\n") |
| 2464 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2465 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), |
| 2466 | bgp_node_safi(vty)); |
| 2467 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2468 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2469 | DEFUN (neighbor_nexthop_local_unchanged, |
| 2470 | neighbor_nexthop_local_unchanged_cmd, |
| 2471 | NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2472 | NEIGHBOR_STR |
| 2473 | NEIGHBOR_ADDR_STR2 |
| 2474 | "Configure treatment of outgoing link-local nexthop attribute\n" |
| 2475 | "Leave link-local nexthop unchanged for this peer\n") |
| 2476 | { |
| 2477 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2478 | bgp_node_safi (vty), |
| 2479 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
| 2480 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2481 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2482 | DEFUN (no_neighbor_nexthop_local_unchanged, |
| 2483 | no_neighbor_nexthop_local_unchanged_cmd, |
| 2484 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2485 | NO_STR |
| 2486 | NEIGHBOR_STR |
| 2487 | NEIGHBOR_ADDR_STR2 |
| 2488 | "Configure treatment of outgoing link-local-nexthop attribute\n" |
| 2489 | "Leave link-local nexthop unchanged for this peer\n") |
| 2490 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2491 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2492 | bgp_node_safi (vty), |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2493 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2494 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2495 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2496 | DEFUN (neighbor_attr_unchanged, |
| 2497 | neighbor_attr_unchanged_cmd, |
| 2498 | NEIGHBOR_CMD2 "attribute-unchanged", |
| 2499 | NEIGHBOR_STR |
| 2500 | NEIGHBOR_ADDR_STR2 |
| 2501 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2502 | { |
| 2503 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2504 | bgp_node_safi (vty), |
| 2505 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2506 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2507 | PEER_FLAG_MED_UNCHANGED)); |
| 2508 | } |
| 2509 | |
| 2510 | DEFUN (neighbor_attr_unchanged1, |
| 2511 | neighbor_attr_unchanged1_cmd, |
| 2512 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2513 | NEIGHBOR_STR |
| 2514 | NEIGHBOR_ADDR_STR2 |
| 2515 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2516 | "As-path attribute\n" |
| 2517 | "Nexthop attribute\n" |
| 2518 | "Med attribute\n") |
| 2519 | { |
| 2520 | u_int16_t flags = 0; |
| 2521 | |
| 2522 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2523 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2524 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2525 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2526 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2527 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2528 | |
| 2529 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2530 | bgp_node_safi (vty), flags); |
| 2531 | } |
| 2532 | |
| 2533 | DEFUN (neighbor_attr_unchanged2, |
| 2534 | neighbor_attr_unchanged2_cmd, |
| 2535 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2536 | NEIGHBOR_STR |
| 2537 | NEIGHBOR_ADDR_STR2 |
| 2538 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2539 | "As-path attribute\n" |
| 2540 | "Nexthop attribute\n" |
| 2541 | "Med attribute\n") |
| 2542 | { |
| 2543 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2544 | |
| 2545 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2546 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2547 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2548 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2549 | |
| 2550 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2551 | bgp_node_safi (vty), flags); |
| 2552 | |
| 2553 | } |
| 2554 | |
| 2555 | DEFUN (neighbor_attr_unchanged3, |
| 2556 | neighbor_attr_unchanged3_cmd, |
| 2557 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2558 | NEIGHBOR_STR |
| 2559 | NEIGHBOR_ADDR_STR2 |
| 2560 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2561 | "Nexthop attribute\n" |
| 2562 | "As-path attribute\n" |
| 2563 | "Med attribute\n") |
| 2564 | { |
| 2565 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2566 | |
| 2567 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2568 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2569 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2570 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2571 | |
| 2572 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2573 | bgp_node_safi (vty), flags); |
| 2574 | } |
| 2575 | |
| 2576 | DEFUN (neighbor_attr_unchanged4, |
| 2577 | neighbor_attr_unchanged4_cmd, |
| 2578 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2579 | NEIGHBOR_STR |
| 2580 | NEIGHBOR_ADDR_STR2 |
| 2581 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2582 | "Med attribute\n" |
| 2583 | "As-path attribute\n" |
| 2584 | "Nexthop attribute\n") |
| 2585 | { |
| 2586 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2587 | |
| 2588 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2589 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2590 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2591 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2592 | |
| 2593 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2594 | bgp_node_safi (vty), flags); |
| 2595 | } |
| 2596 | |
| 2597 | ALIAS (neighbor_attr_unchanged, |
| 2598 | neighbor_attr_unchanged5_cmd, |
| 2599 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2600 | NEIGHBOR_STR |
| 2601 | NEIGHBOR_ADDR_STR2 |
| 2602 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2603 | "As-path attribute\n" |
| 2604 | "Nexthop attribute\n" |
| 2605 | "Med attribute\n") |
| 2606 | |
| 2607 | ALIAS (neighbor_attr_unchanged, |
| 2608 | neighbor_attr_unchanged6_cmd, |
| 2609 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2610 | NEIGHBOR_STR |
| 2611 | NEIGHBOR_ADDR_STR2 |
| 2612 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2613 | "As-path attribute\n" |
| 2614 | "Med attribute\n" |
| 2615 | "Nexthop attribute\n") |
| 2616 | |
| 2617 | ALIAS (neighbor_attr_unchanged, |
| 2618 | neighbor_attr_unchanged7_cmd, |
| 2619 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2620 | NEIGHBOR_STR |
| 2621 | NEIGHBOR_ADDR_STR2 |
| 2622 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2623 | "Nexthop attribute\n" |
| 2624 | "Med attribute\n" |
| 2625 | "As-path attribute\n") |
| 2626 | |
| 2627 | ALIAS (neighbor_attr_unchanged, |
| 2628 | neighbor_attr_unchanged8_cmd, |
| 2629 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2630 | NEIGHBOR_STR |
| 2631 | NEIGHBOR_ADDR_STR2 |
| 2632 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2633 | "Nexthop attribute\n" |
| 2634 | "As-path attribute\n" |
| 2635 | "Med attribute\n") |
| 2636 | |
| 2637 | ALIAS (neighbor_attr_unchanged, |
| 2638 | neighbor_attr_unchanged9_cmd, |
| 2639 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2640 | NEIGHBOR_STR |
| 2641 | NEIGHBOR_ADDR_STR2 |
| 2642 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2643 | "Med attribute\n" |
| 2644 | "Nexthop attribute\n" |
| 2645 | "As-path attribute\n") |
| 2646 | |
| 2647 | ALIAS (neighbor_attr_unchanged, |
| 2648 | neighbor_attr_unchanged10_cmd, |
| 2649 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2650 | NEIGHBOR_STR |
| 2651 | NEIGHBOR_ADDR_STR2 |
| 2652 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2653 | "Med attribute\n" |
| 2654 | "As-path attribute\n" |
| 2655 | "Nexthop attribute\n") |
| 2656 | |
| 2657 | DEFUN (no_neighbor_attr_unchanged, |
| 2658 | no_neighbor_attr_unchanged_cmd, |
| 2659 | NO_NEIGHBOR_CMD2 "attribute-unchanged", |
| 2660 | NO_STR |
| 2661 | NEIGHBOR_STR |
| 2662 | NEIGHBOR_ADDR_STR2 |
| 2663 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2664 | { |
| 2665 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2666 | bgp_node_safi (vty), |
| 2667 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2668 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2669 | PEER_FLAG_MED_UNCHANGED)); |
| 2670 | } |
| 2671 | |
| 2672 | DEFUN (no_neighbor_attr_unchanged1, |
| 2673 | no_neighbor_attr_unchanged1_cmd, |
| 2674 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2675 | NO_STR |
| 2676 | NEIGHBOR_STR |
| 2677 | NEIGHBOR_ADDR_STR2 |
| 2678 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2679 | "As-path attribute\n" |
| 2680 | "Nexthop attribute\n" |
| 2681 | "Med attribute\n") |
| 2682 | { |
| 2683 | u_int16_t flags = 0; |
| 2684 | |
| 2685 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2686 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2687 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2688 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2689 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2690 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2691 | |
| 2692 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2693 | bgp_node_safi (vty), flags); |
| 2694 | } |
| 2695 | |
| 2696 | DEFUN (no_neighbor_attr_unchanged2, |
| 2697 | no_neighbor_attr_unchanged2_cmd, |
| 2698 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2699 | NO_STR |
| 2700 | NEIGHBOR_STR |
| 2701 | NEIGHBOR_ADDR_STR2 |
| 2702 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2703 | "As-path attribute\n" |
| 2704 | "Nexthop attribute\n" |
| 2705 | "Med attribute\n") |
| 2706 | { |
| 2707 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2708 | |
| 2709 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2710 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2711 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2712 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2713 | |
| 2714 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2715 | bgp_node_safi (vty), flags); |
| 2716 | } |
| 2717 | |
| 2718 | DEFUN (no_neighbor_attr_unchanged3, |
| 2719 | no_neighbor_attr_unchanged3_cmd, |
| 2720 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2721 | NO_STR |
| 2722 | NEIGHBOR_STR |
| 2723 | NEIGHBOR_ADDR_STR2 |
| 2724 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2725 | "Nexthop attribute\n" |
| 2726 | "As-path attribute\n" |
| 2727 | "Med attribute\n") |
| 2728 | { |
| 2729 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2730 | |
| 2731 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2732 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2733 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2734 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2735 | |
| 2736 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2737 | bgp_node_safi (vty), flags); |
| 2738 | } |
| 2739 | |
| 2740 | DEFUN (no_neighbor_attr_unchanged4, |
| 2741 | no_neighbor_attr_unchanged4_cmd, |
| 2742 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2743 | NO_STR |
| 2744 | NEIGHBOR_STR |
| 2745 | NEIGHBOR_ADDR_STR2 |
| 2746 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2747 | "Med attribute\n" |
| 2748 | "As-path attribute\n" |
| 2749 | "Nexthop attribute\n") |
| 2750 | { |
| 2751 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2752 | |
| 2753 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2754 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2755 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2756 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2757 | |
| 2758 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2759 | bgp_node_safi (vty), flags); |
| 2760 | } |
| 2761 | |
| 2762 | ALIAS (no_neighbor_attr_unchanged, |
| 2763 | no_neighbor_attr_unchanged5_cmd, |
| 2764 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2765 | NO_STR |
| 2766 | NEIGHBOR_STR |
| 2767 | NEIGHBOR_ADDR_STR2 |
| 2768 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2769 | "As-path attribute\n" |
| 2770 | "Nexthop attribute\n" |
| 2771 | "Med attribute\n") |
| 2772 | |
| 2773 | ALIAS (no_neighbor_attr_unchanged, |
| 2774 | no_neighbor_attr_unchanged6_cmd, |
| 2775 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 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 | "Med attribute\n" |
| 2782 | "Nexthop attribute\n") |
| 2783 | |
| 2784 | ALIAS (no_neighbor_attr_unchanged, |
| 2785 | no_neighbor_attr_unchanged7_cmd, |
| 2786 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2787 | NO_STR |
| 2788 | NEIGHBOR_STR |
| 2789 | NEIGHBOR_ADDR_STR2 |
| 2790 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2791 | "Nexthop attribute\n" |
| 2792 | "Med attribute\n" |
| 2793 | "As-path attribute\n") |
| 2794 | |
| 2795 | ALIAS (no_neighbor_attr_unchanged, |
| 2796 | no_neighbor_attr_unchanged8_cmd, |
| 2797 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 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 | "As-path attribute\n" |
| 2804 | "Med attribute\n") |
| 2805 | |
| 2806 | ALIAS (no_neighbor_attr_unchanged, |
| 2807 | no_neighbor_attr_unchanged9_cmd, |
| 2808 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2809 | NO_STR |
| 2810 | NEIGHBOR_STR |
| 2811 | NEIGHBOR_ADDR_STR2 |
| 2812 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2813 | "Med attribute\n" |
| 2814 | "Nexthop attribute\n" |
| 2815 | "As-path attribute\n") |
| 2816 | |
| 2817 | ALIAS (no_neighbor_attr_unchanged, |
| 2818 | no_neighbor_attr_unchanged10_cmd, |
| 2819 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 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 | "As-path attribute\n" |
| 2826 | "Nexthop attribute\n") |
| 2827 | |
| 2828 | /* For old version Zebra compatibility. */ |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2829 | DEFUN_DEPRECATED (neighbor_transparent_as, |
| 2830 | neighbor_transparent_as_cmd, |
| 2831 | NEIGHBOR_CMD "transparent-as", |
| 2832 | NEIGHBOR_STR |
| 2833 | NEIGHBOR_ADDR_STR |
| 2834 | "Do not append my AS number even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2835 | { |
| 2836 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2837 | bgp_node_safi (vty), |
| 2838 | PEER_FLAG_AS_PATH_UNCHANGED); |
| 2839 | } |
| 2840 | |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2841 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
| 2842 | neighbor_transparent_nexthop_cmd, |
| 2843 | NEIGHBOR_CMD "transparent-nexthop", |
| 2844 | NEIGHBOR_STR |
| 2845 | NEIGHBOR_ADDR_STR |
| 2846 | "Do not change nexthop even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2847 | { |
| 2848 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2849 | bgp_node_safi (vty), |
| 2850 | PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2851 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2852 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2853 | /* EBGP multihop configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2854 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2855 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
| 2856 | const char *ttl_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2857 | { |
| 2858 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2859 | unsigned int ttl; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2860 | |
| 2861 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2862 | if (! peer) |
| 2863 | return CMD_WARNING; |
| 2864 | |
| 2865 | if (! ttl_str) |
| 2866 | ttl = TTL_MAX; |
| 2867 | else |
| 2868 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); |
| 2869 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 2870 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2871 | } |
| 2872 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2873 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2874 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2875 | { |
| 2876 | struct peer *peer; |
| 2877 | |
| 2878 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2879 | if (! peer) |
| 2880 | return CMD_WARNING; |
| 2881 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 2882 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2883 | } |
| 2884 | |
| 2885 | /* neighbor ebgp-multihop. */ |
| 2886 | DEFUN (neighbor_ebgp_multihop, |
| 2887 | neighbor_ebgp_multihop_cmd, |
| 2888 | NEIGHBOR_CMD2 "ebgp-multihop", |
| 2889 | NEIGHBOR_STR |
| 2890 | NEIGHBOR_ADDR_STR2 |
| 2891 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2892 | { |
| 2893 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); |
| 2894 | } |
| 2895 | |
| 2896 | DEFUN (neighbor_ebgp_multihop_ttl, |
| 2897 | neighbor_ebgp_multihop_ttl_cmd, |
| 2898 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2899 | NEIGHBOR_STR |
| 2900 | NEIGHBOR_ADDR_STR2 |
| 2901 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2902 | "maximum hop count\n") |
| 2903 | { |
| 2904 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); |
| 2905 | } |
| 2906 | |
| 2907 | DEFUN (no_neighbor_ebgp_multihop, |
| 2908 | no_neighbor_ebgp_multihop_cmd, |
| 2909 | NO_NEIGHBOR_CMD2 "ebgp-multihop", |
| 2910 | NO_STR |
| 2911 | NEIGHBOR_STR |
| 2912 | NEIGHBOR_ADDR_STR2 |
| 2913 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2914 | { |
| 2915 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); |
| 2916 | } |
| 2917 | |
| 2918 | ALIAS (no_neighbor_ebgp_multihop, |
| 2919 | no_neighbor_ebgp_multihop_ttl_cmd, |
| 2920 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2921 | NO_STR |
| 2922 | NEIGHBOR_STR |
| 2923 | NEIGHBOR_ADDR_STR2 |
| 2924 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2925 | "maximum hop count\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2926 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2927 | /* disable-connected-check */ |
| 2928 | DEFUN (neighbor_disable_connected_check, |
| 2929 | neighbor_disable_connected_check_cmd, |
| 2930 | NEIGHBOR_CMD2 "disable-connected-check", |
| 2931 | NEIGHBOR_STR |
| 2932 | NEIGHBOR_ADDR_STR2 |
| 2933 | "one-hop away EBGP peer using loopback address\n") |
| 2934 | { |
| 2935 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2936 | } |
| 2937 | |
| 2938 | DEFUN (no_neighbor_disable_connected_check, |
| 2939 | no_neighbor_disable_connected_check_cmd, |
| 2940 | NO_NEIGHBOR_CMD2 "disable-connected-check", |
| 2941 | NO_STR |
| 2942 | NEIGHBOR_STR |
| 2943 | NEIGHBOR_ADDR_STR2 |
| 2944 | "one-hop away EBGP peer using loopback address\n") |
| 2945 | { |
| 2946 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2947 | } |
| 2948 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2949 | /* Enforce multihop. */ |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2950 | ALIAS (neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2951 | neighbor_enforce_multihop_cmd, |
| 2952 | NEIGHBOR_CMD2 "enforce-multihop", |
| 2953 | NEIGHBOR_STR |
| 2954 | NEIGHBOR_ADDR_STR2 |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 2955 | "Enforce EBGP neighbors perform multihop\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2956 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2957 | /* Enforce multihop. */ |
| 2958 | ALIAS (no_neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2959 | no_neighbor_enforce_multihop_cmd, |
| 2960 | NO_NEIGHBOR_CMD2 "enforce-multihop", |
| 2961 | NO_STR |
| 2962 | NEIGHBOR_STR |
| 2963 | NEIGHBOR_ADDR_STR2 |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 2964 | "Enforce EBGP neighbors perform multihop\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 2965 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2966 | DEFUN (neighbor_description, |
| 2967 | neighbor_description_cmd, |
| 2968 | NEIGHBOR_CMD2 "description .LINE", |
| 2969 | NEIGHBOR_STR |
| 2970 | NEIGHBOR_ADDR_STR2 |
| 2971 | "Neighbor specific description\n" |
| 2972 | "Up to 80 characters describing this neighbor\n") |
| 2973 | { |
| 2974 | struct peer *peer; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2975 | char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2976 | |
| 2977 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2978 | if (! peer) |
| 2979 | return CMD_WARNING; |
| 2980 | |
| 2981 | if (argc == 1) |
| 2982 | return CMD_SUCCESS; |
| 2983 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2984 | str = argv_concat(argv, argc, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2985 | |
| 2986 | peer_description_set (peer, str); |
| 2987 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2988 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2989 | |
| 2990 | return CMD_SUCCESS; |
| 2991 | } |
| 2992 | |
| 2993 | DEFUN (no_neighbor_description, |
| 2994 | no_neighbor_description_cmd, |
| 2995 | NO_NEIGHBOR_CMD2 "description", |
| 2996 | NO_STR |
| 2997 | NEIGHBOR_STR |
| 2998 | NEIGHBOR_ADDR_STR2 |
| 2999 | "Neighbor specific description\n") |
| 3000 | { |
| 3001 | struct peer *peer; |
| 3002 | |
| 3003 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3004 | if (! peer) |
| 3005 | return CMD_WARNING; |
| 3006 | |
| 3007 | peer_description_unset (peer); |
| 3008 | |
| 3009 | return CMD_SUCCESS; |
| 3010 | } |
| 3011 | |
| 3012 | ALIAS (no_neighbor_description, |
| 3013 | no_neighbor_description_val_cmd, |
| 3014 | NO_NEIGHBOR_CMD2 "description .LINE", |
| 3015 | NO_STR |
| 3016 | NEIGHBOR_STR |
| 3017 | NEIGHBOR_ADDR_STR2 |
| 3018 | "Neighbor specific description\n" |
| 3019 | "Up to 80 characters describing this neighbor\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3020 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3021 | /* Neighbor update-source. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3022 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3023 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
| 3024 | const char *source_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3025 | { |
| 3026 | struct peer *peer; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3027 | |
| 3028 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 3029 | if (! peer) |
| 3030 | return CMD_WARNING; |
| 3031 | |
| 3032 | if (source_str) |
| 3033 | { |
Jorge Boncompte [DTI2] | c63b83f | 2012-04-10 16:57:24 +0200 | [diff] [blame] | 3034 | union sockunion su; |
| 3035 | int ret = str2sockunion (source_str, &su); |
| 3036 | |
| 3037 | if (ret == 0) |
| 3038 | peer_update_source_addr_set (peer, &su); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3039 | else |
| 3040 | peer_update_source_if_set (peer, source_str); |
| 3041 | } |
| 3042 | else |
| 3043 | peer_update_source_unset (peer); |
| 3044 | |
| 3045 | return CMD_SUCCESS; |
| 3046 | } |
| 3047 | |
Paul Jakma | 9a1a331 | 2009-07-27 12:27:55 +0100 | [diff] [blame] | 3048 | #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] | 3049 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
| 3050 | "IPv4 address\n" \ |
Paul Jakma | 9a1a331 | 2009-07-27 12:27:55 +0100 | [diff] [blame] | 3051 | "IPv6 address\n" \ |
| 3052 | "Interface name (requires zebra to be running)\n" |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 3053 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3054 | DEFUN (neighbor_update_source, |
| 3055 | neighbor_update_source_cmd, |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 3056 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3057 | NEIGHBOR_STR |
| 3058 | NEIGHBOR_ADDR_STR2 |
| 3059 | "Source of routing updates\n" |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 3060 | BGP_UPDATE_SOURCE_HELP_STR) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3061 | { |
| 3062 | return peer_update_source_vty (vty, argv[0], argv[1]); |
| 3063 | } |
| 3064 | |
| 3065 | DEFUN (no_neighbor_update_source, |
| 3066 | no_neighbor_update_source_cmd, |
| 3067 | NO_NEIGHBOR_CMD2 "update-source", |
| 3068 | NO_STR |
| 3069 | NEIGHBOR_STR |
| 3070 | NEIGHBOR_ADDR_STR2 |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 3071 | "Source of routing updates\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3072 | { |
| 3073 | return peer_update_source_vty (vty, argv[0], NULL); |
| 3074 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3075 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3076 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3077 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
| 3078 | afi_t afi, safi_t safi, |
| 3079 | const char *rmap, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3080 | { |
| 3081 | int ret; |
| 3082 | struct peer *peer; |
| 3083 | |
| 3084 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 3085 | if (! peer) |
| 3086 | return CMD_WARNING; |
| 3087 | |
| 3088 | if (set) |
| 3089 | ret = peer_default_originate_set (peer, afi, safi, rmap); |
| 3090 | else |
| 3091 | ret = peer_default_originate_unset (peer, afi, safi); |
| 3092 | |
| 3093 | return bgp_vty_return (vty, ret); |
| 3094 | } |
| 3095 | |
| 3096 | /* neighbor default-originate. */ |
| 3097 | DEFUN (neighbor_default_originate, |
| 3098 | neighbor_default_originate_cmd, |
| 3099 | NEIGHBOR_CMD2 "default-originate", |
| 3100 | NEIGHBOR_STR |
| 3101 | NEIGHBOR_ADDR_STR2 |
| 3102 | "Originate default route to this neighbor\n") |
| 3103 | { |
| 3104 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3105 | bgp_node_safi (vty), NULL, 1); |
| 3106 | } |
| 3107 | |
| 3108 | DEFUN (neighbor_default_originate_rmap, |
| 3109 | neighbor_default_originate_rmap_cmd, |
| 3110 | NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 3111 | NEIGHBOR_STR |
| 3112 | NEIGHBOR_ADDR_STR2 |
| 3113 | "Originate default route to this neighbor\n" |
| 3114 | "Route-map to specify criteria to originate default\n" |
| 3115 | "route-map name\n") |
| 3116 | { |
| 3117 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3118 | bgp_node_safi (vty), argv[1], 1); |
| 3119 | } |
| 3120 | |
| 3121 | DEFUN (no_neighbor_default_originate, |
| 3122 | no_neighbor_default_originate_cmd, |
| 3123 | NO_NEIGHBOR_CMD2 "default-originate", |
| 3124 | NO_STR |
| 3125 | NEIGHBOR_STR |
| 3126 | NEIGHBOR_ADDR_STR2 |
| 3127 | "Originate default route to this neighbor\n") |
| 3128 | { |
| 3129 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3130 | bgp_node_safi (vty), NULL, 0); |
| 3131 | } |
| 3132 | |
| 3133 | ALIAS (no_neighbor_default_originate, |
| 3134 | no_neighbor_default_originate_rmap_cmd, |
| 3135 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 3136 | NO_STR |
| 3137 | NEIGHBOR_STR |
| 3138 | NEIGHBOR_ADDR_STR2 |
| 3139 | "Originate default route to this neighbor\n" |
| 3140 | "Route-map to specify criteria to originate default\n" |
| 3141 | "route-map name\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3142 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3143 | /* Set neighbor's BGP port. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3144 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3145 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
| 3146 | const char *port_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3147 | { |
| 3148 | struct peer *peer; |
| 3149 | u_int16_t port; |
| 3150 | struct servent *sp; |
| 3151 | |
| 3152 | peer = peer_lookup_vty (vty, ip_str); |
| 3153 | if (! peer) |
| 3154 | return CMD_WARNING; |
| 3155 | |
| 3156 | if (! port_str) |
| 3157 | { |
| 3158 | sp = getservbyname ("bgp", "tcp"); |
| 3159 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); |
| 3160 | } |
| 3161 | else |
| 3162 | { |
| 3163 | VTY_GET_INTEGER("port", port, port_str); |
| 3164 | } |
| 3165 | |
| 3166 | peer_port_set (peer, port); |
| 3167 | |
| 3168 | return CMD_SUCCESS; |
| 3169 | } |
| 3170 | |
hasso | f418446 | 2005-02-01 20:13:16 +0000 | [diff] [blame] | 3171 | /* Set specified peer's BGP port. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3172 | DEFUN (neighbor_port, |
| 3173 | neighbor_port_cmd, |
| 3174 | NEIGHBOR_CMD "port <0-65535>", |
| 3175 | NEIGHBOR_STR |
| 3176 | NEIGHBOR_ADDR_STR |
| 3177 | "Neighbor's BGP port\n" |
| 3178 | "TCP port number\n") |
| 3179 | { |
| 3180 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); |
| 3181 | } |
| 3182 | |
| 3183 | DEFUN (no_neighbor_port, |
| 3184 | no_neighbor_port_cmd, |
| 3185 | NO_NEIGHBOR_CMD "port", |
| 3186 | NO_STR |
| 3187 | NEIGHBOR_STR |
| 3188 | NEIGHBOR_ADDR_STR |
| 3189 | "Neighbor's BGP port\n") |
| 3190 | { |
| 3191 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); |
| 3192 | } |
| 3193 | |
| 3194 | ALIAS (no_neighbor_port, |
| 3195 | no_neighbor_port_val_cmd, |
| 3196 | NO_NEIGHBOR_CMD "port <0-65535>", |
| 3197 | NO_STR |
| 3198 | NEIGHBOR_STR |
| 3199 | NEIGHBOR_ADDR_STR |
| 3200 | "Neighbor's BGP port\n" |
| 3201 | "TCP port number\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3202 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3203 | /* neighbor weight. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3204 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3205 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
| 3206 | const char *weight_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3207 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3208 | struct peer *peer; |
| 3209 | unsigned long weight; |
| 3210 | |
| 3211 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3212 | if (! peer) |
| 3213 | return CMD_WARNING; |
| 3214 | |
| 3215 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); |
| 3216 | |
Paul Jakma | 7aa9dce | 2014-09-19 14:42:23 +0100 | [diff] [blame] | 3217 | return bgp_vty_return (vty, peer_weight_set (peer, weight)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3218 | } |
| 3219 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3220 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3221 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3222 | { |
| 3223 | struct peer *peer; |
| 3224 | |
| 3225 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3226 | if (! peer) |
| 3227 | return CMD_WARNING; |
| 3228 | |
Paul Jakma | 7aa9dce | 2014-09-19 14:42:23 +0100 | [diff] [blame] | 3229 | return bgp_vty_return (vty, peer_weight_unset (peer)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3230 | } |
| 3231 | |
| 3232 | DEFUN (neighbor_weight, |
| 3233 | neighbor_weight_cmd, |
| 3234 | NEIGHBOR_CMD2 "weight <0-65535>", |
| 3235 | NEIGHBOR_STR |
| 3236 | NEIGHBOR_ADDR_STR2 |
| 3237 | "Set default weight for routes from this neighbor\n" |
| 3238 | "default weight\n") |
| 3239 | { |
| 3240 | return peer_weight_set_vty (vty, argv[0], argv[1]); |
| 3241 | } |
| 3242 | |
| 3243 | DEFUN (no_neighbor_weight, |
| 3244 | no_neighbor_weight_cmd, |
| 3245 | NO_NEIGHBOR_CMD2 "weight", |
| 3246 | NO_STR |
| 3247 | NEIGHBOR_STR |
| 3248 | NEIGHBOR_ADDR_STR2 |
| 3249 | "Set default weight for routes from this neighbor\n") |
| 3250 | { |
| 3251 | return peer_weight_unset_vty (vty, argv[0]); |
| 3252 | } |
| 3253 | |
| 3254 | ALIAS (no_neighbor_weight, |
| 3255 | no_neighbor_weight_val_cmd, |
| 3256 | NO_NEIGHBOR_CMD2 "weight <0-65535>", |
| 3257 | NO_STR |
| 3258 | NEIGHBOR_STR |
| 3259 | NEIGHBOR_ADDR_STR2 |
| 3260 | "Set default weight for routes from this neighbor\n" |
| 3261 | "default weight\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3262 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3263 | /* Override capability negotiation. */ |
| 3264 | DEFUN (neighbor_override_capability, |
| 3265 | neighbor_override_capability_cmd, |
| 3266 | NEIGHBOR_CMD2 "override-capability", |
| 3267 | NEIGHBOR_STR |
| 3268 | NEIGHBOR_ADDR_STR2 |
| 3269 | "Override capability negotiation result\n") |
| 3270 | { |
| 3271 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 3272 | } |
| 3273 | |
| 3274 | DEFUN (no_neighbor_override_capability, |
| 3275 | no_neighbor_override_capability_cmd, |
| 3276 | NO_NEIGHBOR_CMD2 "override-capability", |
| 3277 | NO_STR |
| 3278 | NEIGHBOR_STR |
| 3279 | NEIGHBOR_ADDR_STR2 |
| 3280 | "Override capability negotiation result\n") |
| 3281 | { |
| 3282 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 3283 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3284 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3285 | DEFUN (neighbor_strict_capability, |
| 3286 | neighbor_strict_capability_cmd, |
| 3287 | NEIGHBOR_CMD "strict-capability-match", |
| 3288 | NEIGHBOR_STR |
| 3289 | NEIGHBOR_ADDR_STR |
| 3290 | "Strict capability negotiation match\n") |
| 3291 | { |
| 3292 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3293 | } |
| 3294 | |
| 3295 | DEFUN (no_neighbor_strict_capability, |
| 3296 | no_neighbor_strict_capability_cmd, |
| 3297 | NO_NEIGHBOR_CMD "strict-capability-match", |
| 3298 | NO_STR |
| 3299 | NEIGHBOR_STR |
| 3300 | NEIGHBOR_ADDR_STR |
| 3301 | "Strict capability negotiation match\n") |
| 3302 | { |
| 3303 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3304 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3305 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3306 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3307 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
| 3308 | const char *keep_str, const char *hold_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3309 | { |
| 3310 | int ret; |
| 3311 | struct peer *peer; |
| 3312 | u_int32_t keepalive; |
| 3313 | u_int32_t holdtime; |
| 3314 | |
| 3315 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3316 | if (! peer) |
| 3317 | return CMD_WARNING; |
| 3318 | |
| 3319 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); |
| 3320 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); |
| 3321 | |
| 3322 | ret = peer_timers_set (peer, keepalive, holdtime); |
| 3323 | |
| 3324 | return bgp_vty_return (vty, ret); |
| 3325 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3326 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3327 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3328 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3329 | { |
| 3330 | int ret; |
| 3331 | struct peer *peer; |
| 3332 | |
| 3333 | peer = peer_lookup_vty (vty, ip_str); |
| 3334 | if (! peer) |
| 3335 | return CMD_WARNING; |
| 3336 | |
| 3337 | ret = peer_timers_unset (peer); |
| 3338 | |
| 3339 | return bgp_vty_return (vty, ret); |
| 3340 | } |
| 3341 | |
| 3342 | DEFUN (neighbor_timers, |
| 3343 | neighbor_timers_cmd, |
| 3344 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", |
| 3345 | NEIGHBOR_STR |
| 3346 | NEIGHBOR_ADDR_STR2 |
| 3347 | "BGP per neighbor timers\n" |
| 3348 | "Keepalive interval\n" |
| 3349 | "Holdtime\n") |
| 3350 | { |
| 3351 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); |
| 3352 | } |
| 3353 | |
| 3354 | DEFUN (no_neighbor_timers, |
| 3355 | no_neighbor_timers_cmd, |
| 3356 | NO_NEIGHBOR_CMD2 "timers", |
| 3357 | NO_STR |
| 3358 | NEIGHBOR_STR |
| 3359 | NEIGHBOR_ADDR_STR2 |
| 3360 | "BGP per neighbor timers\n") |
| 3361 | { |
| 3362 | return peer_timers_unset_vty (vty, argv[0]); |
| 3363 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3364 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3365 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3366 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
| 3367 | const char *time_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3368 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3369 | struct peer *peer; |
| 3370 | u_int32_t connect; |
| 3371 | |
| 3372 | peer = peer_lookup_vty (vty, ip_str); |
| 3373 | if (! peer) |
| 3374 | return CMD_WARNING; |
| 3375 | |
| 3376 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); |
| 3377 | |
Paul Jakma | 7aa9dce | 2014-09-19 14:42:23 +0100 | [diff] [blame] | 3378 | return bgp_vty_return (vty, peer_timers_connect_set (peer, connect)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3379 | } |
| 3380 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3381 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3382 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3383 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3384 | struct peer *peer; |
| 3385 | |
| 3386 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3387 | if (! peer) |
| 3388 | return CMD_WARNING; |
| 3389 | |
Paul Jakma | 7aa9dce | 2014-09-19 14:42:23 +0100 | [diff] [blame] | 3390 | return bgp_vty_return (vty, peer_timers_connect_unset (peer)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3391 | } |
| 3392 | |
| 3393 | DEFUN (neighbor_timers_connect, |
| 3394 | neighbor_timers_connect_cmd, |
| 3395 | NEIGHBOR_CMD "timers connect <0-65535>", |
| 3396 | NEIGHBOR_STR |
| 3397 | NEIGHBOR_ADDR_STR |
| 3398 | "BGP per neighbor timers\n" |
| 3399 | "BGP connect timer\n" |
| 3400 | "Connect timer\n") |
| 3401 | { |
| 3402 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); |
| 3403 | } |
| 3404 | |
| 3405 | DEFUN (no_neighbor_timers_connect, |
| 3406 | no_neighbor_timers_connect_cmd, |
| 3407 | NO_NEIGHBOR_CMD "timers connect", |
| 3408 | NO_STR |
| 3409 | NEIGHBOR_STR |
| 3410 | NEIGHBOR_ADDR_STR |
| 3411 | "BGP per neighbor timers\n" |
| 3412 | "BGP connect timer\n") |
| 3413 | { |
| 3414 | return peer_timers_connect_unset_vty (vty, argv[0]); |
| 3415 | } |
| 3416 | |
| 3417 | ALIAS (no_neighbor_timers_connect, |
| 3418 | no_neighbor_timers_connect_val_cmd, |
| 3419 | NO_NEIGHBOR_CMD "timers connect <0-65535>", |
| 3420 | NO_STR |
| 3421 | NEIGHBOR_STR |
| 3422 | NEIGHBOR_ADDR_STR |
| 3423 | "BGP per neighbor timers\n" |
| 3424 | "BGP connect timer\n" |
| 3425 | "Connect timer\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3426 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3427 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3428 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
| 3429 | const char *time_str, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3430 | { |
| 3431 | int ret; |
| 3432 | struct peer *peer; |
| 3433 | u_int32_t routeadv = 0; |
| 3434 | |
| 3435 | peer = peer_lookup_vty (vty, ip_str); |
| 3436 | if (! peer) |
| 3437 | return CMD_WARNING; |
| 3438 | |
| 3439 | if (time_str) |
| 3440 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); |
| 3441 | |
| 3442 | if (set) |
| 3443 | ret = peer_advertise_interval_set (peer, routeadv); |
| 3444 | else |
| 3445 | ret = peer_advertise_interval_unset (peer); |
| 3446 | |
Paul Jakma | 7aa9dce | 2014-09-19 14:42:23 +0100 | [diff] [blame] | 3447 | return bgp_vty_return (vty, ret); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3448 | } |
| 3449 | |
| 3450 | DEFUN (neighbor_advertise_interval, |
| 3451 | neighbor_advertise_interval_cmd, |
| 3452 | NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3453 | NEIGHBOR_STR |
| 3454 | NEIGHBOR_ADDR_STR |
| 3455 | "Minimum interval between sending BGP routing updates\n" |
| 3456 | "time in seconds\n") |
| 3457 | { |
| 3458 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); |
| 3459 | } |
| 3460 | |
| 3461 | DEFUN (no_neighbor_advertise_interval, |
| 3462 | no_neighbor_advertise_interval_cmd, |
| 3463 | NO_NEIGHBOR_CMD "advertisement-interval", |
| 3464 | NO_STR |
| 3465 | NEIGHBOR_STR |
| 3466 | NEIGHBOR_ADDR_STR |
| 3467 | "Minimum interval between sending BGP routing updates\n") |
| 3468 | { |
| 3469 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); |
| 3470 | } |
| 3471 | |
| 3472 | ALIAS (no_neighbor_advertise_interval, |
| 3473 | no_neighbor_advertise_interval_val_cmd, |
| 3474 | NO_NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3475 | NO_STR |
| 3476 | NEIGHBOR_STR |
| 3477 | NEIGHBOR_ADDR_STR |
| 3478 | "Minimum interval between sending BGP routing updates\n" |
| 3479 | "time in seconds\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3480 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3481 | /* neighbor interface */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3482 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3483 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3484 | { |
| 3485 | int ret; |
| 3486 | struct peer *peer; |
| 3487 | |
| 3488 | peer = peer_lookup_vty (vty, ip_str); |
| 3489 | if (! peer) |
| 3490 | return CMD_WARNING; |
| 3491 | |
| 3492 | if (str) |
| 3493 | ret = peer_interface_set (peer, str); |
| 3494 | else |
| 3495 | ret = peer_interface_unset (peer); |
| 3496 | |
Paul Jakma | 7aa9dce | 2014-09-19 14:42:23 +0100 | [diff] [blame] | 3497 | return bgp_vty_return (vty, ret); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3498 | } |
| 3499 | |
| 3500 | DEFUN (neighbor_interface, |
| 3501 | neighbor_interface_cmd, |
| 3502 | NEIGHBOR_CMD "interface WORD", |
| 3503 | NEIGHBOR_STR |
| 3504 | NEIGHBOR_ADDR_STR |
| 3505 | "Interface\n" |
| 3506 | "Interface name\n") |
| 3507 | { |
| 3508 | return peer_interface_vty (vty, argv[0], argv[1]); |
| 3509 | } |
| 3510 | |
| 3511 | DEFUN (no_neighbor_interface, |
| 3512 | no_neighbor_interface_cmd, |
| 3513 | NO_NEIGHBOR_CMD "interface WORD", |
| 3514 | NO_STR |
| 3515 | NEIGHBOR_STR |
| 3516 | NEIGHBOR_ADDR_STR |
| 3517 | "Interface\n" |
| 3518 | "Interface name\n") |
| 3519 | { |
| 3520 | return peer_interface_vty (vty, argv[0], NULL); |
| 3521 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3522 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3523 | /* Set distribute list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3524 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3525 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
| 3526 | afi_t afi, safi_t safi, |
| 3527 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3528 | { |
| 3529 | int ret; |
| 3530 | struct peer *peer; |
| 3531 | int direct = FILTER_IN; |
| 3532 | |
| 3533 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3534 | if (! peer) |
| 3535 | return CMD_WARNING; |
| 3536 | |
| 3537 | /* Check filter direction. */ |
| 3538 | if (strncmp (direct_str, "i", 1) == 0) |
| 3539 | direct = FILTER_IN; |
| 3540 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3541 | direct = FILTER_OUT; |
| 3542 | |
| 3543 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); |
| 3544 | |
| 3545 | return bgp_vty_return (vty, ret); |
| 3546 | } |
| 3547 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3548 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3549 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3550 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3551 | { |
| 3552 | int ret; |
| 3553 | struct peer *peer; |
| 3554 | int direct = FILTER_IN; |
| 3555 | |
| 3556 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3557 | if (! peer) |
| 3558 | return CMD_WARNING; |
| 3559 | |
| 3560 | /* Check filter direction. */ |
| 3561 | if (strncmp (direct_str, "i", 1) == 0) |
| 3562 | direct = FILTER_IN; |
| 3563 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3564 | direct = FILTER_OUT; |
| 3565 | |
| 3566 | ret = peer_distribute_unset (peer, afi, safi, direct); |
| 3567 | |
| 3568 | return bgp_vty_return (vty, ret); |
| 3569 | } |
| 3570 | |
| 3571 | DEFUN (neighbor_distribute_list, |
| 3572 | neighbor_distribute_list_cmd, |
| 3573 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3574 | NEIGHBOR_STR |
| 3575 | NEIGHBOR_ADDR_STR2 |
| 3576 | "Filter updates to/from this neighbor\n" |
| 3577 | "IP access-list number\n" |
| 3578 | "IP access-list number (expanded range)\n" |
| 3579 | "IP Access-list name\n" |
| 3580 | "Filter incoming updates\n" |
| 3581 | "Filter outgoing updates\n") |
| 3582 | { |
| 3583 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3584 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3585 | } |
| 3586 | |
| 3587 | DEFUN (no_neighbor_distribute_list, |
| 3588 | no_neighbor_distribute_list_cmd, |
| 3589 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3590 | NO_STR |
| 3591 | NEIGHBOR_STR |
| 3592 | NEIGHBOR_ADDR_STR2 |
| 3593 | "Filter updates to/from this neighbor\n" |
| 3594 | "IP access-list number\n" |
| 3595 | "IP access-list number (expanded range)\n" |
| 3596 | "IP Access-list name\n" |
| 3597 | "Filter incoming updates\n" |
| 3598 | "Filter outgoing updates\n") |
| 3599 | { |
| 3600 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3601 | bgp_node_safi (vty), argv[2]); |
| 3602 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3603 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3604 | /* Set prefix list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3605 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3606 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3607 | safi_t safi, const char *name_str, |
| 3608 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3609 | { |
| 3610 | int ret; |
| 3611 | struct peer *peer; |
| 3612 | int direct = FILTER_IN; |
| 3613 | |
| 3614 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3615 | if (! peer) |
| 3616 | return CMD_WARNING; |
| 3617 | |
| 3618 | /* Check filter direction. */ |
| 3619 | if (strncmp (direct_str, "i", 1) == 0) |
| 3620 | direct = FILTER_IN; |
| 3621 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3622 | direct = FILTER_OUT; |
| 3623 | |
| 3624 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); |
| 3625 | |
| 3626 | return bgp_vty_return (vty, ret); |
| 3627 | } |
| 3628 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3629 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3630 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3631 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3632 | { |
| 3633 | int ret; |
| 3634 | struct peer *peer; |
| 3635 | int direct = FILTER_IN; |
| 3636 | |
| 3637 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3638 | if (! peer) |
| 3639 | return CMD_WARNING; |
| 3640 | |
| 3641 | /* Check filter direction. */ |
| 3642 | if (strncmp (direct_str, "i", 1) == 0) |
| 3643 | direct = FILTER_IN; |
| 3644 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3645 | direct = FILTER_OUT; |
| 3646 | |
| 3647 | ret = peer_prefix_list_unset (peer, afi, safi, direct); |
| 3648 | |
| 3649 | return bgp_vty_return (vty, ret); |
| 3650 | } |
| 3651 | |
| 3652 | DEFUN (neighbor_prefix_list, |
| 3653 | neighbor_prefix_list_cmd, |
| 3654 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3655 | NEIGHBOR_STR |
| 3656 | NEIGHBOR_ADDR_STR2 |
| 3657 | "Filter updates to/from this neighbor\n" |
| 3658 | "Name of a prefix list\n" |
| 3659 | "Filter incoming updates\n" |
| 3660 | "Filter outgoing updates\n") |
| 3661 | { |
| 3662 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3663 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3664 | } |
| 3665 | |
| 3666 | DEFUN (no_neighbor_prefix_list, |
| 3667 | no_neighbor_prefix_list_cmd, |
| 3668 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3669 | NO_STR |
| 3670 | NEIGHBOR_STR |
| 3671 | NEIGHBOR_ADDR_STR2 |
| 3672 | "Filter updates to/from this neighbor\n" |
| 3673 | "Name of a prefix list\n" |
| 3674 | "Filter incoming updates\n" |
| 3675 | "Filter outgoing updates\n") |
| 3676 | { |
| 3677 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3678 | bgp_node_safi (vty), argv[2]); |
| 3679 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3680 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3681 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3682 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
| 3683 | afi_t afi, safi_t safi, |
| 3684 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3685 | { |
| 3686 | int ret; |
| 3687 | struct peer *peer; |
| 3688 | int direct = FILTER_IN; |
| 3689 | |
| 3690 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3691 | if (! peer) |
| 3692 | return CMD_WARNING; |
| 3693 | |
| 3694 | /* Check filter direction. */ |
| 3695 | if (strncmp (direct_str, "i", 1) == 0) |
| 3696 | direct = FILTER_IN; |
| 3697 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3698 | direct = FILTER_OUT; |
| 3699 | |
| 3700 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); |
| 3701 | |
| 3702 | return bgp_vty_return (vty, ret); |
| 3703 | } |
| 3704 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3705 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3706 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
| 3707 | afi_t afi, safi_t safi, |
| 3708 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3709 | { |
| 3710 | int ret; |
| 3711 | struct peer *peer; |
| 3712 | int direct = FILTER_IN; |
| 3713 | |
| 3714 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3715 | if (! peer) |
| 3716 | return CMD_WARNING; |
| 3717 | |
| 3718 | /* Check filter direction. */ |
| 3719 | if (strncmp (direct_str, "i", 1) == 0) |
| 3720 | direct = FILTER_IN; |
| 3721 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3722 | direct = FILTER_OUT; |
| 3723 | |
| 3724 | ret = peer_aslist_unset (peer, afi, safi, direct); |
| 3725 | |
| 3726 | return bgp_vty_return (vty, ret); |
| 3727 | } |
| 3728 | |
| 3729 | DEFUN (neighbor_filter_list, |
| 3730 | neighbor_filter_list_cmd, |
| 3731 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3732 | NEIGHBOR_STR |
| 3733 | NEIGHBOR_ADDR_STR2 |
| 3734 | "Establish BGP filters\n" |
| 3735 | "AS path access-list name\n" |
| 3736 | "Filter incoming routes\n" |
| 3737 | "Filter outgoing routes\n") |
| 3738 | { |
| 3739 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3740 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3741 | } |
| 3742 | |
| 3743 | DEFUN (no_neighbor_filter_list, |
| 3744 | no_neighbor_filter_list_cmd, |
| 3745 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3746 | NO_STR |
| 3747 | NEIGHBOR_STR |
| 3748 | NEIGHBOR_ADDR_STR2 |
| 3749 | "Establish BGP filters\n" |
| 3750 | "AS path access-list name\n" |
| 3751 | "Filter incoming routes\n" |
| 3752 | "Filter outgoing routes\n") |
| 3753 | { |
| 3754 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3755 | bgp_node_safi (vty), argv[2]); |
| 3756 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3757 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3758 | /* Set route-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3759 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3760 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
| 3761 | afi_t afi, safi_t safi, |
| 3762 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3763 | { |
| 3764 | int ret; |
| 3765 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3766 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3767 | |
| 3768 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3769 | if (! peer) |
| 3770 | return CMD_WARNING; |
| 3771 | |
| 3772 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3773 | if (strncmp (direct_str, "in", 2) == 0) |
| 3774 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3775 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3776 | direct = RMAP_OUT; |
| 3777 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3778 | direct = RMAP_IMPORT; |
| 3779 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3780 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3781 | |
| 3782 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); |
| 3783 | |
| 3784 | return bgp_vty_return (vty, ret); |
| 3785 | } |
| 3786 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3787 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3788 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3789 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3790 | { |
| 3791 | int ret; |
| 3792 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3793 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3794 | |
| 3795 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3796 | if (! peer) |
| 3797 | return CMD_WARNING; |
| 3798 | |
| 3799 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3800 | if (strncmp (direct_str, "in", 2) == 0) |
| 3801 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3802 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3803 | direct = RMAP_OUT; |
| 3804 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3805 | direct = RMAP_IMPORT; |
| 3806 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3807 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3808 | |
| 3809 | ret = peer_route_map_unset (peer, afi, safi, direct); |
| 3810 | |
| 3811 | return bgp_vty_return (vty, ret); |
| 3812 | } |
| 3813 | |
| 3814 | DEFUN (neighbor_route_map, |
| 3815 | neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3816 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3817 | NEIGHBOR_STR |
| 3818 | NEIGHBOR_ADDR_STR2 |
| 3819 | "Apply route map to neighbor\n" |
| 3820 | "Name of route map\n" |
| 3821 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3822 | "Apply map to outbound routes\n" |
| 3823 | "Apply map to routes going into a Route-Server client's table\n" |
| 3824 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3825 | { |
| 3826 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3827 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3828 | } |
| 3829 | |
| 3830 | DEFUN (no_neighbor_route_map, |
| 3831 | no_neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3832 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3833 | NO_STR |
| 3834 | NEIGHBOR_STR |
| 3835 | NEIGHBOR_ADDR_STR2 |
| 3836 | "Apply route map to neighbor\n" |
| 3837 | "Name of route map\n" |
| 3838 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3839 | "Apply map to outbound routes\n" |
| 3840 | "Apply map to routes going into a Route-Server client's table\n" |
| 3841 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3842 | { |
| 3843 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3844 | bgp_node_safi (vty), argv[2]); |
| 3845 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3846 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3847 | /* Set unsuppress-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3848 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3849 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3850 | safi_t safi, const char *name_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3851 | { |
| 3852 | int ret; |
| 3853 | struct peer *peer; |
| 3854 | |
| 3855 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3856 | if (! peer) |
| 3857 | return CMD_WARNING; |
| 3858 | |
| 3859 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); |
| 3860 | |
| 3861 | return bgp_vty_return (vty, ret); |
| 3862 | } |
| 3863 | |
| 3864 | /* Unset route-map from the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3865 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3866 | 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] | 3867 | safi_t safi) |
| 3868 | { |
| 3869 | int ret; |
| 3870 | struct peer *peer; |
| 3871 | |
| 3872 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3873 | if (! peer) |
| 3874 | return CMD_WARNING; |
| 3875 | |
| 3876 | ret = peer_unsuppress_map_unset (peer, afi, safi); |
| 3877 | |
| 3878 | return bgp_vty_return (vty, ret); |
| 3879 | } |
| 3880 | |
| 3881 | DEFUN (neighbor_unsuppress_map, |
| 3882 | neighbor_unsuppress_map_cmd, |
| 3883 | NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3884 | NEIGHBOR_STR |
| 3885 | NEIGHBOR_ADDR_STR2 |
| 3886 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3887 | "Name of route map\n") |
| 3888 | { |
| 3889 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3890 | bgp_node_safi (vty), argv[1]); |
| 3891 | } |
| 3892 | |
| 3893 | DEFUN (no_neighbor_unsuppress_map, |
| 3894 | no_neighbor_unsuppress_map_cmd, |
| 3895 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3896 | NO_STR |
| 3897 | NEIGHBOR_STR |
| 3898 | NEIGHBOR_ADDR_STR2 |
| 3899 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3900 | "Name of route map\n") |
| 3901 | { |
| 3902 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3903 | bgp_node_safi (vty)); |
| 3904 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 3905 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3906 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3907 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3908 | safi_t safi, const char *num_str, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3909 | const char *threshold_str, int warning, |
| 3910 | const char *restart_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3911 | { |
| 3912 | int ret; |
| 3913 | struct peer *peer; |
| 3914 | u_int32_t max; |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3915 | u_char threshold; |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3916 | u_int16_t restart; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3917 | |
| 3918 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3919 | if (! peer) |
| 3920 | return CMD_WARNING; |
| 3921 | |
Denis Ovsienko | e6ec1c3 | 2011-09-10 21:50:53 +0400 | [diff] [blame] | 3922 | VTY_GET_INTEGER ("maximum number", max, num_str); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3923 | if (threshold_str) |
| 3924 | threshold = atoi (threshold_str); |
| 3925 | else |
| 3926 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3927 | |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3928 | if (restart_str) |
| 3929 | restart = atoi (restart_str); |
| 3930 | else |
| 3931 | restart = 0; |
| 3932 | |
| 3933 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3934 | |
| 3935 | return bgp_vty_return (vty, ret); |
| 3936 | } |
| 3937 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3938 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3939 | 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] | 3940 | safi_t safi) |
| 3941 | { |
| 3942 | int ret; |
| 3943 | struct peer *peer; |
| 3944 | |
| 3945 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3946 | if (! peer) |
| 3947 | return CMD_WARNING; |
| 3948 | |
| 3949 | ret = peer_maximum_prefix_unset (peer, afi, safi); |
| 3950 | |
| 3951 | return bgp_vty_return (vty, ret); |
| 3952 | } |
| 3953 | |
| 3954 | /* Maximum number of prefix configuration. prefix count is different |
| 3955 | for each peer configuration. So this configuration can be set for |
| 3956 | each peer configuration. */ |
| 3957 | DEFUN (neighbor_maximum_prefix, |
| 3958 | neighbor_maximum_prefix_cmd, |
| 3959 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3960 | NEIGHBOR_STR |
| 3961 | NEIGHBOR_ADDR_STR2 |
| 3962 | "Maximum number of prefix accept from this peer\n" |
| 3963 | "maximum no. of prefix limit\n") |
| 3964 | { |
| 3965 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3966 | bgp_node_safi (vty), argv[1], NULL, 0, |
| 3967 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3968 | } |
| 3969 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3970 | DEFUN (neighbor_maximum_prefix_threshold, |
| 3971 | neighbor_maximum_prefix_threshold_cmd, |
| 3972 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", |
| 3973 | NEIGHBOR_STR |
| 3974 | NEIGHBOR_ADDR_STR2 |
| 3975 | "Maximum number of prefix accept from this peer\n" |
| 3976 | "maximum no. of prefix limit\n" |
| 3977 | "Threshold value (%) at which to generate a warning msg\n") |
| 3978 | { |
| 3979 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3980 | bgp_node_safi (vty), argv[1], argv[2], 0, |
| 3981 | NULL); |
| 3982 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3983 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3984 | DEFUN (neighbor_maximum_prefix_warning, |
| 3985 | neighbor_maximum_prefix_warning_cmd, |
| 3986 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3987 | NEIGHBOR_STR |
| 3988 | NEIGHBOR_ADDR_STR2 |
| 3989 | "Maximum number of prefix accept from this peer\n" |
| 3990 | "maximum no. of prefix limit\n" |
| 3991 | "Only give warning message when limit is exceeded\n") |
| 3992 | { |
| 3993 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3994 | bgp_node_safi (vty), argv[1], NULL, 1, |
| 3995 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3996 | } |
| 3997 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3998 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
| 3999 | neighbor_maximum_prefix_threshold_warning_cmd, |
| 4000 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 4001 | NEIGHBOR_STR |
| 4002 | NEIGHBOR_ADDR_STR2 |
| 4003 | "Maximum number of prefix accept from this peer\n" |
| 4004 | "maximum no. of prefix limit\n" |
| 4005 | "Threshold value (%) at which to generate a warning msg\n" |
| 4006 | "Only give warning message when limit is exceeded\n") |
| 4007 | { |
| 4008 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4009 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
| 4010 | } |
| 4011 | |
| 4012 | DEFUN (neighbor_maximum_prefix_restart, |
| 4013 | neighbor_maximum_prefix_restart_cmd, |
| 4014 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
| 4015 | NEIGHBOR_STR |
| 4016 | NEIGHBOR_ADDR_STR2 |
| 4017 | "Maximum number of prefix accept from this peer\n" |
| 4018 | "maximum no. of prefix limit\n" |
| 4019 | "Restart bgp connection after limit is exceeded\n" |
| 4020 | "Restart interval in minutes") |
| 4021 | { |
| 4022 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 4023 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); |
| 4024 | } |
| 4025 | |
| 4026 | DEFUN (neighbor_maximum_prefix_threshold_restart, |
| 4027 | neighbor_maximum_prefix_threshold_restart_cmd, |
| 4028 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 4029 | NEIGHBOR_STR |
| 4030 | NEIGHBOR_ADDR_STR2 |
| 4031 | "Maximum number of prefix accept from this peer\n" |
| 4032 | "maximum no. of prefix limit\n" |
| 4033 | "Threshold value (%) at which to generate a warning msg\n" |
| 4034 | "Restart bgp connection after limit is exceeded\n" |
| 4035 | "Restart interval in minutes") |
| 4036 | { |
| 4037 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 4038 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); |
| 4039 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 4040 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4041 | DEFUN (no_neighbor_maximum_prefix, |
| 4042 | no_neighbor_maximum_prefix_cmd, |
| 4043 | NO_NEIGHBOR_CMD2 "maximum-prefix", |
| 4044 | NO_STR |
| 4045 | NEIGHBOR_STR |
| 4046 | NEIGHBOR_ADDR_STR2 |
| 4047 | "Maximum number of prefix accept from this peer\n") |
| 4048 | { |
| 4049 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 4050 | bgp_node_safi (vty)); |
| 4051 | } |
| 4052 | |
| 4053 | ALIAS (no_neighbor_maximum_prefix, |
| 4054 | no_neighbor_maximum_prefix_val_cmd, |
| 4055 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 4056 | NO_STR |
| 4057 | NEIGHBOR_STR |
| 4058 | NEIGHBOR_ADDR_STR2 |
| 4059 | "Maximum number of prefix accept from this peer\n" |
| 4060 | "maximum no. of prefix limit\n") |
| 4061 | |
| 4062 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4063 | no_neighbor_maximum_prefix_threshold_cmd, |
| 4064 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 4065 | NO_STR |
| 4066 | NEIGHBOR_STR |
| 4067 | NEIGHBOR_ADDR_STR2 |
| 4068 | "Maximum number of prefix accept from this peer\n" |
| 4069 | "maximum no. of prefix limit\n" |
| 4070 | "Threshold value (%) at which to generate a warning msg\n") |
| 4071 | |
| 4072 | ALIAS (no_neighbor_maximum_prefix, |
| 4073 | no_neighbor_maximum_prefix_warning_cmd, |
| 4074 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 4075 | NO_STR |
| 4076 | NEIGHBOR_STR |
| 4077 | NEIGHBOR_ADDR_STR2 |
| 4078 | "Maximum number of prefix accept from this peer\n" |
| 4079 | "maximum no. of prefix limit\n" |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 4080 | "Only give warning message when limit is exceeded\n") |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4081 | |
| 4082 | ALIAS (no_neighbor_maximum_prefix, |
| 4083 | no_neighbor_maximum_prefix_threshold_warning_cmd, |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 4084 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 4085 | NO_STR |
| 4086 | NEIGHBOR_STR |
| 4087 | NEIGHBOR_ADDR_STR2 |
| 4088 | "Maximum number of prefix accept from this peer\n" |
| 4089 | "maximum no. of prefix limit\n" |
| 4090 | "Threshold value (%) at which to generate a warning msg\n" |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 4091 | "Only give warning message when limit is exceeded\n") |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 4092 | |
| 4093 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4094 | no_neighbor_maximum_prefix_restart_cmd, |
| 4095 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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" |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4101 | "Restart bgp connection after limit is exceeded\n" |
| 4102 | "Restart interval in minutes") |
| 4103 | |
| 4104 | ALIAS (no_neighbor_maximum_prefix, |
| 4105 | no_neighbor_maximum_prefix_threshold_restart_cmd, |
| 4106 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 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" |
| 4112 | "Threshold value (%) at which to generate a warning msg\n" |
| 4113 | "Restart bgp connection after limit is exceeded\n" |
| 4114 | "Restart interval in minutes") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 4115 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4116 | /* "neighbor allowas-in" */ |
| 4117 | DEFUN (neighbor_allowas_in, |
| 4118 | neighbor_allowas_in_cmd, |
| 4119 | NEIGHBOR_CMD2 "allowas-in", |
| 4120 | NEIGHBOR_STR |
| 4121 | NEIGHBOR_ADDR_STR2 |
| 4122 | "Accept as-path with my AS present in it\n") |
| 4123 | { |
| 4124 | int ret; |
| 4125 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4126 | unsigned int allow_num; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4127 | |
| 4128 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4129 | if (! peer) |
| 4130 | return CMD_WARNING; |
| 4131 | |
| 4132 | if (argc == 1) |
| 4133 | allow_num = 3; |
| 4134 | else |
| 4135 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); |
| 4136 | |
| 4137 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), |
| 4138 | allow_num); |
| 4139 | |
| 4140 | return bgp_vty_return (vty, ret); |
| 4141 | } |
| 4142 | |
| 4143 | ALIAS (neighbor_allowas_in, |
| 4144 | neighbor_allowas_in_arg_cmd, |
| 4145 | NEIGHBOR_CMD2 "allowas-in <1-10>", |
| 4146 | NEIGHBOR_STR |
| 4147 | NEIGHBOR_ADDR_STR2 |
| 4148 | "Accept as-path with my AS present in it\n" |
| 4149 | "Number of occurances of AS number\n") |
| 4150 | |
| 4151 | DEFUN (no_neighbor_allowas_in, |
| 4152 | no_neighbor_allowas_in_cmd, |
| 4153 | NO_NEIGHBOR_CMD2 "allowas-in", |
| 4154 | NO_STR |
| 4155 | NEIGHBOR_STR |
| 4156 | NEIGHBOR_ADDR_STR2 |
| 4157 | "allow local ASN appears in aspath attribute\n") |
| 4158 | { |
| 4159 | int ret; |
| 4160 | struct peer *peer; |
| 4161 | |
| 4162 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4163 | if (! peer) |
| 4164 | return CMD_WARNING; |
| 4165 | |
| 4166 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 4167 | |
| 4168 | return bgp_vty_return (vty, ret); |
| 4169 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 4170 | |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4171 | DEFUN (neighbor_ttl_security, |
| 4172 | neighbor_ttl_security_cmd, |
| 4173 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", |
| 4174 | NEIGHBOR_STR |
| 4175 | NEIGHBOR_ADDR_STR2 |
| 4176 | "Specify the maximum number of hops to the BGP peer\n") |
| 4177 | { |
| 4178 | struct peer *peer; |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 4179 | int gtsm_hops; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4180 | |
| 4181 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4182 | if (! peer) |
| 4183 | return CMD_WARNING; |
| 4184 | |
| 4185 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); |
| 4186 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 4187 | 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] | 4188 | } |
| 4189 | |
| 4190 | DEFUN (no_neighbor_ttl_security, |
| 4191 | no_neighbor_ttl_security_cmd, |
| 4192 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", |
| 4193 | NO_STR |
| 4194 | NEIGHBOR_STR |
| 4195 | NEIGHBOR_ADDR_STR2 |
| 4196 | "Specify the maximum number of hops to the BGP peer\n") |
| 4197 | { |
| 4198 | struct peer *peer; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4199 | |
| 4200 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4201 | if (! peer) |
| 4202 | return CMD_WARNING; |
| 4203 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 4204 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4205 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 4206 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4207 | /* Address family configuration. */ |
| 4208 | DEFUN (address_family_ipv4, |
| 4209 | address_family_ipv4_cmd, |
| 4210 | "address-family ipv4", |
| 4211 | "Enter Address Family command mode\n" |
| 4212 | "Address family\n") |
| 4213 | { |
| 4214 | vty->node = BGP_IPV4_NODE; |
| 4215 | return CMD_SUCCESS; |
| 4216 | } |
| 4217 | |
| 4218 | DEFUN (address_family_ipv4_safi, |
| 4219 | address_family_ipv4_safi_cmd, |
| 4220 | "address-family ipv4 (unicast|multicast)", |
| 4221 | "Enter Address Family command mode\n" |
| 4222 | "Address family\n" |
| 4223 | "Address Family modifier\n" |
| 4224 | "Address Family modifier\n") |
| 4225 | { |
| 4226 | if (strncmp (argv[0], "m", 1) == 0) |
| 4227 | vty->node = BGP_IPV4M_NODE; |
| 4228 | else |
| 4229 | vty->node = BGP_IPV4_NODE; |
| 4230 | |
| 4231 | return CMD_SUCCESS; |
| 4232 | } |
| 4233 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4234 | DEFUN (address_family_ipv6, |
| 4235 | address_family_ipv6_cmd, |
| 4236 | "address-family ipv6", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4237 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4238 | "Address family\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4239 | { |
| 4240 | vty->node = BGP_IPV6_NODE; |
| 4241 | return CMD_SUCCESS; |
| 4242 | } |
| 4243 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4244 | DEFUN (address_family_ipv6_safi, |
| 4245 | address_family_ipv6_safi_cmd, |
| 4246 | "address-family ipv6 (unicast|multicast)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4247 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4248 | "Address family\n" |
| 4249 | "Address Family modifier\n" |
| 4250 | "Address Family modifier\n") |
| 4251 | { |
| 4252 | if (strncmp (argv[0], "m", 1) == 0) |
| 4253 | vty->node = BGP_IPV6M_NODE; |
| 4254 | else |
| 4255 | vty->node = BGP_IPV6_NODE; |
| 4256 | |
| 4257 | return CMD_SUCCESS; |
| 4258 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4259 | |
| 4260 | DEFUN (address_family_vpnv4, |
| 4261 | address_family_vpnv4_cmd, |
| 4262 | "address-family vpnv4", |
| 4263 | "Enter Address Family command mode\n" |
| 4264 | "Address family\n") |
| 4265 | { |
| 4266 | vty->node = BGP_VPNV4_NODE; |
| 4267 | return CMD_SUCCESS; |
| 4268 | } |
| 4269 | |
| 4270 | ALIAS (address_family_vpnv4, |
| 4271 | address_family_vpnv4_unicast_cmd, |
| 4272 | "address-family vpnv4 unicast", |
| 4273 | "Enter Address Family command mode\n" |
| 4274 | "Address family\n" |
| 4275 | "Address Family Modifier\n") |
| 4276 | |
| 4277 | DEFUN (exit_address_family, |
| 4278 | exit_address_family_cmd, |
| 4279 | "exit-address-family", |
| 4280 | "Exit from Address Family configuration mode\n") |
| 4281 | { |
hasso | a8a80d5 | 2005-04-09 13:07:47 +0000 | [diff] [blame] | 4282 | if (vty->node == BGP_IPV4_NODE |
| 4283 | || vty->node == BGP_IPV4M_NODE |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4284 | || vty->node == BGP_VPNV4_NODE |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4285 | || vty->node == BGP_IPV6_NODE |
| 4286 | || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4287 | vty->node = BGP_NODE; |
| 4288 | return CMD_SUCCESS; |
| 4289 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 4290 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4291 | /* BGP clear sort. */ |
| 4292 | enum clear_sort |
| 4293 | { |
| 4294 | clear_all, |
| 4295 | clear_peer, |
| 4296 | clear_group, |
| 4297 | clear_external, |
| 4298 | clear_as |
| 4299 | }; |
| 4300 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4301 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4302 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
| 4303 | safi_t safi, int error) |
| 4304 | { |
| 4305 | switch (error) |
| 4306 | { |
| 4307 | case BGP_ERR_AF_UNCONFIGURED: |
| 4308 | vty_out (vty, |
| 4309 | "%%BGP: Enable %s %s address family for the neighbor %s%s", |
| 4310 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", |
| 4311 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", |
| 4312 | peer->host, VTY_NEWLINE); |
| 4313 | break; |
| 4314 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: |
| 4315 | 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); |
| 4316 | break; |
| 4317 | default: |
| 4318 | break; |
| 4319 | } |
| 4320 | } |
| 4321 | |
| 4322 | /* `clear ip bgp' functions. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4323 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4324 | 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] | 4325 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4326 | { |
| 4327 | int ret; |
| 4328 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4329 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4330 | |
| 4331 | /* Clear all neighbors. */ |
| 4332 | if (sort == clear_all) |
| 4333 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4334 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4335 | { |
| 4336 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4337 | ret = peer_clear (peer); |
| 4338 | else |
| 4339 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4340 | |
| 4341 | if (ret < 0) |
| 4342 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4343 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4344 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4345 | } |
| 4346 | |
| 4347 | /* Clear specified neighbors. */ |
| 4348 | if (sort == clear_peer) |
| 4349 | { |
| 4350 | union sockunion su; |
| 4351 | int ret; |
| 4352 | |
| 4353 | /* Make sockunion for lookup. */ |
| 4354 | ret = str2sockunion (arg, &su); |
| 4355 | if (ret < 0) |
| 4356 | { |
| 4357 | vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4358 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4359 | } |
| 4360 | peer = peer_lookup (bgp, &su); |
| 4361 | if (! peer) |
| 4362 | { |
| 4363 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4364 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4365 | } |
| 4366 | |
| 4367 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4368 | ret = peer_clear (peer); |
| 4369 | else |
| 4370 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4371 | |
| 4372 | if (ret < 0) |
| 4373 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4374 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4375 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4376 | } |
| 4377 | |
| 4378 | /* Clear all peer-group members. */ |
| 4379 | if (sort == clear_group) |
| 4380 | { |
| 4381 | struct peer_group *group; |
| 4382 | |
| 4383 | group = peer_group_lookup (bgp, arg); |
| 4384 | if (! group) |
| 4385 | { |
| 4386 | 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] | 4387 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4388 | } |
| 4389 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4390 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4391 | { |
| 4392 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4393 | { |
| 4394 | ret = peer_clear (peer); |
| 4395 | continue; |
| 4396 | } |
| 4397 | |
| 4398 | if (! peer->af_group[afi][safi]) |
| 4399 | continue; |
| 4400 | |
| 4401 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4402 | |
| 4403 | if (ret < 0) |
| 4404 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4405 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4406 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4407 | } |
| 4408 | |
| 4409 | if (sort == clear_external) |
| 4410 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4411 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4412 | { |
Jorge Boncompte [DTI2] | 6d85b15 | 2012-05-07 16:52:54 +0000 | [diff] [blame] | 4413 | if (peer->sort == BGP_PEER_IBGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4414 | continue; |
| 4415 | |
| 4416 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4417 | ret = peer_clear (peer); |
| 4418 | else |
| 4419 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4420 | |
| 4421 | if (ret < 0) |
| 4422 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4423 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4424 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4425 | } |
| 4426 | |
| 4427 | if (sort == clear_as) |
| 4428 | { |
| 4429 | as_t as; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4430 | int find = 0; |
| 4431 | |
Ulrich Weber | bde12e3 | 2011-11-16 19:32:12 +0400 | [diff] [blame] | 4432 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4433 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4434 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4435 | { |
| 4436 | if (peer->as != as) |
| 4437 | continue; |
| 4438 | |
| 4439 | find = 1; |
| 4440 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4441 | ret = peer_clear (peer); |
| 4442 | else |
| 4443 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4444 | |
| 4445 | if (ret < 0) |
| 4446 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4447 | } |
| 4448 | if (! find) |
| 4449 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, |
| 4450 | VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4451 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4452 | } |
| 4453 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4454 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4455 | } |
| 4456 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4457 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4458 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
| 4459 | enum clear_sort sort, enum bgp_clear_type stype, |
| 4460 | const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4461 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4462 | struct bgp *bgp; |
| 4463 | |
| 4464 | /* BGP structure lookup. */ |
| 4465 | if (name) |
| 4466 | { |
| 4467 | bgp = bgp_lookup_by_name (name); |
| 4468 | if (bgp == NULL) |
| 4469 | { |
| 4470 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); |
| 4471 | return CMD_WARNING; |
| 4472 | } |
| 4473 | } |
| 4474 | else |
| 4475 | { |
| 4476 | bgp = bgp_get_default (); |
| 4477 | if (bgp == NULL) |
| 4478 | { |
| 4479 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); |
| 4480 | return CMD_WARNING; |
| 4481 | } |
| 4482 | } |
| 4483 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4484 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4485 | } |
| 4486 | |
| 4487 | DEFUN (clear_ip_bgp_all, |
| 4488 | clear_ip_bgp_all_cmd, |
| 4489 | "clear ip bgp *", |
| 4490 | CLEAR_STR |
| 4491 | IP_STR |
| 4492 | BGP_STR |
| 4493 | "Clear all peers\n") |
| 4494 | { |
| 4495 | if (argc == 1) |
| 4496 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4497 | |
| 4498 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4499 | } |
| 4500 | |
| 4501 | ALIAS (clear_ip_bgp_all, |
| 4502 | clear_bgp_all_cmd, |
| 4503 | "clear bgp *", |
| 4504 | CLEAR_STR |
| 4505 | BGP_STR |
| 4506 | "Clear all peers\n") |
| 4507 | |
| 4508 | ALIAS (clear_ip_bgp_all, |
| 4509 | clear_bgp_ipv6_all_cmd, |
| 4510 | "clear bgp ipv6 *", |
| 4511 | CLEAR_STR |
| 4512 | BGP_STR |
| 4513 | "Address family\n" |
| 4514 | "Clear all peers\n") |
| 4515 | |
| 4516 | ALIAS (clear_ip_bgp_all, |
| 4517 | clear_ip_bgp_instance_all_cmd, |
| 4518 | "clear ip bgp view WORD *", |
| 4519 | CLEAR_STR |
| 4520 | IP_STR |
| 4521 | BGP_STR |
| 4522 | "BGP view\n" |
| 4523 | "view name\n" |
| 4524 | "Clear all peers\n") |
| 4525 | |
| 4526 | ALIAS (clear_ip_bgp_all, |
| 4527 | clear_bgp_instance_all_cmd, |
| 4528 | "clear bgp view WORD *", |
| 4529 | CLEAR_STR |
| 4530 | BGP_STR |
| 4531 | "BGP view\n" |
| 4532 | "view name\n" |
| 4533 | "Clear all peers\n") |
| 4534 | |
| 4535 | DEFUN (clear_ip_bgp_peer, |
| 4536 | clear_ip_bgp_peer_cmd, |
| 4537 | "clear ip bgp (A.B.C.D|X:X::X:X)", |
| 4538 | CLEAR_STR |
| 4539 | IP_STR |
| 4540 | BGP_STR |
| 4541 | "BGP neighbor IP address to clear\n" |
| 4542 | "BGP IPv6 neighbor to clear\n") |
| 4543 | { |
| 4544 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4545 | } |
| 4546 | |
| 4547 | ALIAS (clear_ip_bgp_peer, |
| 4548 | clear_bgp_peer_cmd, |
| 4549 | "clear bgp (A.B.C.D|X:X::X:X)", |
| 4550 | CLEAR_STR |
| 4551 | BGP_STR |
| 4552 | "BGP neighbor address to clear\n" |
| 4553 | "BGP IPv6 neighbor to clear\n") |
| 4554 | |
| 4555 | ALIAS (clear_ip_bgp_peer, |
| 4556 | clear_bgp_ipv6_peer_cmd, |
| 4557 | "clear bgp ipv6 (A.B.C.D|X:X::X:X)", |
| 4558 | CLEAR_STR |
| 4559 | BGP_STR |
| 4560 | "Address family\n" |
| 4561 | "BGP neighbor address to clear\n" |
| 4562 | "BGP IPv6 neighbor to clear\n") |
| 4563 | |
| 4564 | DEFUN (clear_ip_bgp_peer_group, |
| 4565 | clear_ip_bgp_peer_group_cmd, |
| 4566 | "clear ip bgp peer-group WORD", |
| 4567 | CLEAR_STR |
| 4568 | IP_STR |
| 4569 | BGP_STR |
| 4570 | "Clear all members of peer-group\n" |
| 4571 | "BGP peer-group name\n") |
| 4572 | { |
| 4573 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4574 | } |
| 4575 | |
| 4576 | ALIAS (clear_ip_bgp_peer_group, |
| 4577 | clear_bgp_peer_group_cmd, |
| 4578 | "clear bgp peer-group WORD", |
| 4579 | CLEAR_STR |
| 4580 | BGP_STR |
| 4581 | "Clear all members of peer-group\n" |
| 4582 | "BGP peer-group name\n") |
| 4583 | |
| 4584 | ALIAS (clear_ip_bgp_peer_group, |
| 4585 | clear_bgp_ipv6_peer_group_cmd, |
| 4586 | "clear bgp ipv6 peer-group WORD", |
| 4587 | CLEAR_STR |
| 4588 | BGP_STR |
| 4589 | "Address family\n" |
| 4590 | "Clear all members of peer-group\n" |
| 4591 | "BGP peer-group name\n") |
| 4592 | |
| 4593 | DEFUN (clear_ip_bgp_external, |
| 4594 | clear_ip_bgp_external_cmd, |
| 4595 | "clear ip bgp external", |
| 4596 | CLEAR_STR |
| 4597 | IP_STR |
| 4598 | BGP_STR |
| 4599 | "Clear all external peers\n") |
| 4600 | { |
| 4601 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
| 4602 | } |
| 4603 | |
| 4604 | ALIAS (clear_ip_bgp_external, |
| 4605 | clear_bgp_external_cmd, |
| 4606 | "clear bgp external", |
| 4607 | CLEAR_STR |
| 4608 | BGP_STR |
| 4609 | "Clear all external peers\n") |
| 4610 | |
| 4611 | ALIAS (clear_ip_bgp_external, |
| 4612 | clear_bgp_ipv6_external_cmd, |
| 4613 | "clear bgp ipv6 external", |
| 4614 | CLEAR_STR |
| 4615 | BGP_STR |
| 4616 | "Address family\n" |
| 4617 | "Clear all external peers\n") |
| 4618 | |
| 4619 | DEFUN (clear_ip_bgp_as, |
| 4620 | clear_ip_bgp_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4621 | "clear ip bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4622 | CLEAR_STR |
| 4623 | IP_STR |
| 4624 | BGP_STR |
| 4625 | "Clear peers with the AS number\n") |
| 4626 | { |
| 4627 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4628 | } |
| 4629 | |
| 4630 | ALIAS (clear_ip_bgp_as, |
| 4631 | clear_bgp_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4632 | "clear bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4633 | CLEAR_STR |
| 4634 | BGP_STR |
| 4635 | "Clear peers with the AS number\n") |
| 4636 | |
| 4637 | ALIAS (clear_ip_bgp_as, |
| 4638 | clear_bgp_ipv6_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4639 | "clear bgp ipv6 " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4640 | CLEAR_STR |
| 4641 | BGP_STR |
| 4642 | "Address family\n" |
| 4643 | "Clear peers with the AS number\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 4644 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4645 | /* Outbound soft-reconfiguration */ |
| 4646 | DEFUN (clear_ip_bgp_all_soft_out, |
| 4647 | clear_ip_bgp_all_soft_out_cmd, |
| 4648 | "clear ip bgp * soft out", |
| 4649 | CLEAR_STR |
| 4650 | IP_STR |
| 4651 | BGP_STR |
| 4652 | "Clear all peers\n" |
| 4653 | "Soft reconfig\n" |
| 4654 | "Soft reconfig outbound update\n") |
| 4655 | { |
| 4656 | if (argc == 1) |
| 4657 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4658 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4659 | |
| 4660 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4661 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4662 | } |
| 4663 | |
| 4664 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4665 | clear_ip_bgp_all_out_cmd, |
| 4666 | "clear ip bgp * out", |
| 4667 | CLEAR_STR |
| 4668 | IP_STR |
| 4669 | BGP_STR |
| 4670 | "Clear all peers\n" |
| 4671 | "Soft reconfig outbound update\n") |
| 4672 | |
| 4673 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4674 | clear_ip_bgp_instance_all_soft_out_cmd, |
| 4675 | "clear ip bgp view WORD * soft out", |
| 4676 | CLEAR_STR |
| 4677 | IP_STR |
| 4678 | BGP_STR |
| 4679 | "BGP view\n" |
| 4680 | "view name\n" |
| 4681 | "Clear all peers\n" |
| 4682 | "Soft reconfig\n" |
| 4683 | "Soft reconfig outbound update\n") |
| 4684 | |
| 4685 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, |
| 4686 | clear_ip_bgp_all_ipv4_soft_out_cmd, |
| 4687 | "clear ip bgp * ipv4 (unicast|multicast) soft out", |
| 4688 | CLEAR_STR |
| 4689 | IP_STR |
| 4690 | BGP_STR |
| 4691 | "Clear all peers\n" |
| 4692 | "Address family\n" |
| 4693 | "Address Family modifier\n" |
| 4694 | "Address Family modifier\n" |
| 4695 | "Soft reconfig\n" |
| 4696 | "Soft reconfig outbound update\n") |
| 4697 | { |
| 4698 | if (strncmp (argv[0], "m", 1) == 0) |
| 4699 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 4700 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4701 | |
| 4702 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4703 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4704 | } |
| 4705 | |
| 4706 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, |
| 4707 | clear_ip_bgp_all_ipv4_out_cmd, |
| 4708 | "clear ip bgp * ipv4 (unicast|multicast) out", |
| 4709 | CLEAR_STR |
| 4710 | IP_STR |
| 4711 | BGP_STR |
| 4712 | "Clear all peers\n" |
| 4713 | "Address family\n" |
| 4714 | "Address Family modifier\n" |
| 4715 | "Address Family modifier\n" |
| 4716 | "Soft reconfig outbound update\n") |
| 4717 | |
| 4718 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
| 4719 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, |
| 4720 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", |
| 4721 | CLEAR_STR |
| 4722 | IP_STR |
| 4723 | BGP_STR |
| 4724 | "BGP view\n" |
| 4725 | "view name\n" |
| 4726 | "Clear all peers\n" |
| 4727 | "Address family\n" |
| 4728 | "Address Family modifier\n" |
| 4729 | "Address Family modifier\n" |
| 4730 | "Soft reconfig outbound update\n") |
| 4731 | { |
| 4732 | if (strncmp (argv[1], "m", 1) == 0) |
| 4733 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 4734 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4735 | |
| 4736 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4737 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4738 | } |
| 4739 | |
| 4740 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, |
| 4741 | clear_ip_bgp_all_vpnv4_soft_out_cmd, |
| 4742 | "clear ip bgp * vpnv4 unicast soft out", |
| 4743 | CLEAR_STR |
| 4744 | IP_STR |
| 4745 | BGP_STR |
| 4746 | "Clear all peers\n" |
| 4747 | "Address family\n" |
| 4748 | "Address Family Modifier\n" |
| 4749 | "Soft reconfig\n" |
| 4750 | "Soft reconfig outbound update\n") |
| 4751 | { |
| 4752 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 4753 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4754 | } |
| 4755 | |
| 4756 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, |
| 4757 | clear_ip_bgp_all_vpnv4_out_cmd, |
| 4758 | "clear ip bgp * vpnv4 unicast out", |
| 4759 | CLEAR_STR |
| 4760 | IP_STR |
| 4761 | BGP_STR |
| 4762 | "Clear all peers\n" |
| 4763 | "Address family\n" |
| 4764 | "Address Family Modifier\n" |
| 4765 | "Soft reconfig outbound update\n") |
| 4766 | |
| 4767 | DEFUN (clear_bgp_all_soft_out, |
| 4768 | clear_bgp_all_soft_out_cmd, |
| 4769 | "clear bgp * soft out", |
| 4770 | CLEAR_STR |
| 4771 | BGP_STR |
| 4772 | "Clear all peers\n" |
| 4773 | "Soft reconfig\n" |
| 4774 | "Soft reconfig outbound update\n") |
| 4775 | { |
| 4776 | if (argc == 1) |
| 4777 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 4778 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4779 | |
| 4780 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 4781 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4782 | } |
| 4783 | |
| 4784 | ALIAS (clear_bgp_all_soft_out, |
| 4785 | clear_bgp_instance_all_soft_out_cmd, |
| 4786 | "clear bgp view WORD * soft out", |
| 4787 | CLEAR_STR |
| 4788 | BGP_STR |
| 4789 | "BGP view\n" |
| 4790 | "view name\n" |
| 4791 | "Clear all peers\n" |
| 4792 | "Soft reconfig\n" |
| 4793 | "Soft reconfig outbound update\n") |
| 4794 | |
| 4795 | ALIAS (clear_bgp_all_soft_out, |
| 4796 | clear_bgp_all_out_cmd, |
| 4797 | "clear bgp * out", |
| 4798 | CLEAR_STR |
| 4799 | BGP_STR |
| 4800 | "Clear all peers\n" |
| 4801 | "Soft reconfig outbound update\n") |
| 4802 | |
| 4803 | ALIAS (clear_bgp_all_soft_out, |
| 4804 | clear_bgp_ipv6_all_soft_out_cmd, |
| 4805 | "clear bgp ipv6 * soft out", |
| 4806 | CLEAR_STR |
| 4807 | BGP_STR |
| 4808 | "Address family\n" |
| 4809 | "Clear all peers\n" |
| 4810 | "Soft reconfig\n" |
| 4811 | "Soft reconfig outbound update\n") |
| 4812 | |
| 4813 | ALIAS (clear_bgp_all_soft_out, |
| 4814 | clear_bgp_ipv6_all_out_cmd, |
| 4815 | "clear bgp ipv6 * out", |
| 4816 | CLEAR_STR |
| 4817 | BGP_STR |
| 4818 | "Address family\n" |
| 4819 | "Clear all peers\n" |
| 4820 | "Soft reconfig outbound update\n") |
| 4821 | |
| 4822 | DEFUN (clear_ip_bgp_peer_soft_out, |
| 4823 | clear_ip_bgp_peer_soft_out_cmd, |
| 4824 | "clear ip bgp A.B.C.D soft out", |
| 4825 | CLEAR_STR |
| 4826 | IP_STR |
| 4827 | BGP_STR |
| 4828 | "BGP neighbor address to clear\n" |
| 4829 | "Soft reconfig\n" |
| 4830 | "Soft reconfig outbound update\n") |
| 4831 | { |
| 4832 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4833 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4834 | } |
| 4835 | |
| 4836 | ALIAS (clear_ip_bgp_peer_soft_out, |
| 4837 | clear_ip_bgp_peer_out_cmd, |
| 4838 | "clear ip bgp A.B.C.D out", |
| 4839 | CLEAR_STR |
| 4840 | IP_STR |
| 4841 | BGP_STR |
| 4842 | "BGP neighbor address to clear\n" |
| 4843 | "Soft reconfig outbound update\n") |
| 4844 | |
| 4845 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
| 4846 | clear_ip_bgp_peer_ipv4_soft_out_cmd, |
| 4847 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", |
| 4848 | CLEAR_STR |
| 4849 | IP_STR |
| 4850 | BGP_STR |
| 4851 | "BGP neighbor address to clear\n" |
| 4852 | "Address family\n" |
| 4853 | "Address Family modifier\n" |
| 4854 | "Address Family modifier\n" |
| 4855 | "Soft reconfig\n" |
| 4856 | "Soft reconfig outbound update\n") |
| 4857 | { |
| 4858 | if (strncmp (argv[1], "m", 1) == 0) |
| 4859 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 4860 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4861 | |
| 4862 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4863 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4864 | } |
| 4865 | |
| 4866 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, |
| 4867 | clear_ip_bgp_peer_ipv4_out_cmd, |
| 4868 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", |
| 4869 | CLEAR_STR |
| 4870 | IP_STR |
| 4871 | BGP_STR |
| 4872 | "BGP neighbor address to clear\n" |
| 4873 | "Address family\n" |
| 4874 | "Address Family modifier\n" |
| 4875 | "Address Family modifier\n" |
| 4876 | "Soft reconfig outbound update\n") |
| 4877 | |
| 4878 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4879 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, |
| 4880 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", |
| 4881 | CLEAR_STR |
| 4882 | IP_STR |
| 4883 | BGP_STR |
| 4884 | "BGP neighbor address to clear\n" |
| 4885 | "Address family\n" |
| 4886 | "Address Family Modifier\n" |
| 4887 | "Soft reconfig\n" |
| 4888 | "Soft reconfig outbound update\n") |
| 4889 | { |
| 4890 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 4891 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4892 | } |
| 4893 | |
| 4894 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4895 | clear_ip_bgp_peer_vpnv4_out_cmd, |
| 4896 | "clear ip bgp A.B.C.D vpnv4 unicast out", |
| 4897 | CLEAR_STR |
| 4898 | IP_STR |
| 4899 | BGP_STR |
| 4900 | "BGP neighbor address to clear\n" |
| 4901 | "Address family\n" |
| 4902 | "Address Family Modifier\n" |
| 4903 | "Soft reconfig outbound update\n") |
| 4904 | |
| 4905 | DEFUN (clear_bgp_peer_soft_out, |
| 4906 | clear_bgp_peer_soft_out_cmd, |
| 4907 | "clear bgp (A.B.C.D|X:X::X:X) soft out", |
| 4908 | CLEAR_STR |
| 4909 | BGP_STR |
| 4910 | "BGP neighbor address to clear\n" |
| 4911 | "BGP IPv6 neighbor to clear\n" |
| 4912 | "Soft reconfig\n" |
| 4913 | "Soft reconfig outbound update\n") |
| 4914 | { |
| 4915 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 4916 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4917 | } |
| 4918 | |
| 4919 | ALIAS (clear_bgp_peer_soft_out, |
| 4920 | clear_bgp_ipv6_peer_soft_out_cmd, |
| 4921 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out", |
| 4922 | CLEAR_STR |
| 4923 | BGP_STR |
| 4924 | "Address family\n" |
| 4925 | "BGP neighbor address to clear\n" |
| 4926 | "BGP IPv6 neighbor to clear\n" |
| 4927 | "Soft reconfig\n" |
| 4928 | "Soft reconfig outbound update\n") |
| 4929 | |
| 4930 | ALIAS (clear_bgp_peer_soft_out, |
| 4931 | clear_bgp_peer_out_cmd, |
| 4932 | "clear bgp (A.B.C.D|X:X::X:X) out", |
| 4933 | CLEAR_STR |
| 4934 | BGP_STR |
| 4935 | "BGP neighbor address to clear\n" |
| 4936 | "BGP IPv6 neighbor to clear\n" |
| 4937 | "Soft reconfig outbound update\n") |
| 4938 | |
| 4939 | ALIAS (clear_bgp_peer_soft_out, |
| 4940 | clear_bgp_ipv6_peer_out_cmd, |
| 4941 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) out", |
| 4942 | CLEAR_STR |
| 4943 | BGP_STR |
| 4944 | "Address family\n" |
| 4945 | "BGP neighbor address to clear\n" |
| 4946 | "BGP IPv6 neighbor to clear\n" |
| 4947 | "Soft reconfig outbound update\n") |
| 4948 | |
| 4949 | DEFUN (clear_ip_bgp_peer_group_soft_out, |
| 4950 | clear_ip_bgp_peer_group_soft_out_cmd, |
| 4951 | "clear ip bgp peer-group WORD soft out", |
| 4952 | CLEAR_STR |
| 4953 | IP_STR |
| 4954 | BGP_STR |
| 4955 | "Clear all members of peer-group\n" |
| 4956 | "BGP peer-group name\n" |
| 4957 | "Soft reconfig\n" |
| 4958 | "Soft reconfig outbound update\n") |
| 4959 | { |
| 4960 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4961 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4962 | } |
| 4963 | |
| 4964 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
| 4965 | clear_ip_bgp_peer_group_out_cmd, |
| 4966 | "clear ip bgp peer-group WORD out", |
| 4967 | CLEAR_STR |
| 4968 | IP_STR |
| 4969 | BGP_STR |
| 4970 | "Clear all members of peer-group\n" |
| 4971 | "BGP peer-group name\n" |
| 4972 | "Soft reconfig outbound update\n") |
| 4973 | |
| 4974 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4975 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, |
| 4976 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", |
| 4977 | CLEAR_STR |
| 4978 | IP_STR |
| 4979 | BGP_STR |
| 4980 | "Clear all members of peer-group\n" |
| 4981 | "BGP peer-group name\n" |
| 4982 | "Address family\n" |
| 4983 | "Address Family modifier\n" |
| 4984 | "Address Family modifier\n" |
| 4985 | "Soft reconfig\n" |
| 4986 | "Soft reconfig outbound update\n") |
| 4987 | { |
| 4988 | if (strncmp (argv[1], "m", 1) == 0) |
| 4989 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 4990 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4991 | |
| 4992 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4993 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4994 | } |
| 4995 | |
| 4996 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4997 | clear_ip_bgp_peer_group_ipv4_out_cmd, |
| 4998 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", |
| 4999 | CLEAR_STR |
| 5000 | IP_STR |
| 5001 | BGP_STR |
| 5002 | "Clear all members of peer-group\n" |
| 5003 | "BGP peer-group name\n" |
| 5004 | "Address family\n" |
| 5005 | "Address Family modifier\n" |
| 5006 | "Address Family modifier\n" |
| 5007 | "Soft reconfig outbound update\n") |
| 5008 | |
| 5009 | DEFUN (clear_bgp_peer_group_soft_out, |
| 5010 | clear_bgp_peer_group_soft_out_cmd, |
| 5011 | "clear bgp peer-group WORD soft out", |
| 5012 | CLEAR_STR |
| 5013 | BGP_STR |
| 5014 | "Clear all members of peer-group\n" |
| 5015 | "BGP peer-group name\n" |
| 5016 | "Soft reconfig\n" |
| 5017 | "Soft reconfig outbound update\n") |
| 5018 | { |
| 5019 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5020 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5021 | } |
| 5022 | |
| 5023 | ALIAS (clear_bgp_peer_group_soft_out, |
| 5024 | clear_bgp_ipv6_peer_group_soft_out_cmd, |
| 5025 | "clear bgp ipv6 peer-group WORD soft out", |
| 5026 | CLEAR_STR |
| 5027 | BGP_STR |
| 5028 | "Address family\n" |
| 5029 | "Clear all members of peer-group\n" |
| 5030 | "BGP peer-group name\n" |
| 5031 | "Soft reconfig\n" |
| 5032 | "Soft reconfig outbound update\n") |
| 5033 | |
| 5034 | ALIAS (clear_bgp_peer_group_soft_out, |
| 5035 | clear_bgp_peer_group_out_cmd, |
| 5036 | "clear bgp peer-group WORD out", |
| 5037 | CLEAR_STR |
| 5038 | BGP_STR |
| 5039 | "Clear all members of peer-group\n" |
| 5040 | "BGP peer-group name\n" |
| 5041 | "Soft reconfig outbound update\n") |
| 5042 | |
| 5043 | ALIAS (clear_bgp_peer_group_soft_out, |
| 5044 | clear_bgp_ipv6_peer_group_out_cmd, |
| 5045 | "clear bgp ipv6 peer-group WORD out", |
| 5046 | CLEAR_STR |
| 5047 | BGP_STR |
| 5048 | "Address family\n" |
| 5049 | "Clear all members of peer-group\n" |
| 5050 | "BGP peer-group name\n" |
| 5051 | "Soft reconfig outbound update\n") |
| 5052 | |
| 5053 | DEFUN (clear_ip_bgp_external_soft_out, |
| 5054 | clear_ip_bgp_external_soft_out_cmd, |
| 5055 | "clear ip bgp external soft out", |
| 5056 | CLEAR_STR |
| 5057 | IP_STR |
| 5058 | BGP_STR |
| 5059 | "Clear all external peers\n" |
| 5060 | "Soft reconfig\n" |
| 5061 | "Soft reconfig outbound update\n") |
| 5062 | { |
| 5063 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5064 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5065 | } |
| 5066 | |
| 5067 | ALIAS (clear_ip_bgp_external_soft_out, |
| 5068 | clear_ip_bgp_external_out_cmd, |
| 5069 | "clear ip bgp external out", |
| 5070 | CLEAR_STR |
| 5071 | IP_STR |
| 5072 | BGP_STR |
| 5073 | "Clear all external peers\n" |
| 5074 | "Soft reconfig outbound update\n") |
| 5075 | |
| 5076 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, |
| 5077 | clear_ip_bgp_external_ipv4_soft_out_cmd, |
| 5078 | "clear ip bgp external ipv4 (unicast|multicast) soft out", |
| 5079 | CLEAR_STR |
| 5080 | IP_STR |
| 5081 | BGP_STR |
| 5082 | "Clear all external peers\n" |
| 5083 | "Address family\n" |
| 5084 | "Address Family modifier\n" |
| 5085 | "Address Family modifier\n" |
| 5086 | "Soft reconfig\n" |
| 5087 | "Soft reconfig outbound update\n") |
| 5088 | { |
| 5089 | if (strncmp (argv[0], "m", 1) == 0) |
| 5090 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5091 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5092 | |
| 5093 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5094 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5095 | } |
| 5096 | |
| 5097 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, |
| 5098 | clear_ip_bgp_external_ipv4_out_cmd, |
| 5099 | "clear ip bgp external ipv4 (unicast|multicast) out", |
| 5100 | CLEAR_STR |
| 5101 | IP_STR |
| 5102 | BGP_STR |
| 5103 | "Clear all external peers\n" |
| 5104 | "Address family\n" |
| 5105 | "Address Family modifier\n" |
| 5106 | "Address Family modifier\n" |
| 5107 | "Soft reconfig outbound update\n") |
| 5108 | |
| 5109 | DEFUN (clear_bgp_external_soft_out, |
| 5110 | clear_bgp_external_soft_out_cmd, |
| 5111 | "clear bgp external soft out", |
| 5112 | CLEAR_STR |
| 5113 | BGP_STR |
| 5114 | "Clear all external peers\n" |
| 5115 | "Soft reconfig\n" |
| 5116 | "Soft reconfig outbound update\n") |
| 5117 | { |
| 5118 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5119 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5120 | } |
| 5121 | |
| 5122 | ALIAS (clear_bgp_external_soft_out, |
| 5123 | clear_bgp_ipv6_external_soft_out_cmd, |
| 5124 | "clear bgp ipv6 external soft out", |
| 5125 | CLEAR_STR |
| 5126 | BGP_STR |
| 5127 | "Address family\n" |
| 5128 | "Clear all external peers\n" |
| 5129 | "Soft reconfig\n" |
| 5130 | "Soft reconfig outbound update\n") |
| 5131 | |
| 5132 | ALIAS (clear_bgp_external_soft_out, |
| 5133 | clear_bgp_external_out_cmd, |
| 5134 | "clear bgp external out", |
| 5135 | CLEAR_STR |
| 5136 | BGP_STR |
| 5137 | "Clear all external peers\n" |
| 5138 | "Soft reconfig outbound update\n") |
| 5139 | |
| 5140 | ALIAS (clear_bgp_external_soft_out, |
| 5141 | clear_bgp_ipv6_external_out_cmd, |
| 5142 | "clear bgp ipv6 external WORD out", |
| 5143 | CLEAR_STR |
| 5144 | BGP_STR |
| 5145 | "Address family\n" |
| 5146 | "Clear all external peers\n" |
| 5147 | "Soft reconfig outbound update\n") |
| 5148 | |
| 5149 | DEFUN (clear_ip_bgp_as_soft_out, |
| 5150 | clear_ip_bgp_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5151 | "clear ip bgp " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5152 | CLEAR_STR |
| 5153 | IP_STR |
| 5154 | BGP_STR |
| 5155 | "Clear peers with the AS number\n" |
| 5156 | "Soft reconfig\n" |
| 5157 | "Soft reconfig outbound update\n") |
| 5158 | { |
| 5159 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5160 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5161 | } |
| 5162 | |
| 5163 | ALIAS (clear_ip_bgp_as_soft_out, |
| 5164 | clear_ip_bgp_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5165 | "clear ip bgp " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5166 | CLEAR_STR |
| 5167 | IP_STR |
| 5168 | BGP_STR |
| 5169 | "Clear peers with the AS number\n" |
| 5170 | "Soft reconfig outbound update\n") |
| 5171 | |
| 5172 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
| 5173 | clear_ip_bgp_as_ipv4_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5174 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5175 | CLEAR_STR |
| 5176 | IP_STR |
| 5177 | BGP_STR |
| 5178 | "Clear peers with the AS number\n" |
| 5179 | "Address family\n" |
| 5180 | "Address Family modifier\n" |
| 5181 | "Address Family modifier\n" |
| 5182 | "Soft reconfig\n" |
| 5183 | "Soft reconfig outbound update\n") |
| 5184 | { |
| 5185 | if (strncmp (argv[1], "m", 1) == 0) |
| 5186 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5187 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5188 | |
| 5189 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5190 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5191 | } |
| 5192 | |
| 5193 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, |
| 5194 | clear_ip_bgp_as_ipv4_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5195 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5196 | CLEAR_STR |
| 5197 | IP_STR |
| 5198 | BGP_STR |
| 5199 | "Clear peers with the AS number\n" |
| 5200 | "Address family\n" |
| 5201 | "Address Family modifier\n" |
| 5202 | "Address Family modifier\n" |
| 5203 | "Soft reconfig outbound update\n") |
| 5204 | |
| 5205 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
| 5206 | clear_ip_bgp_as_vpnv4_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5207 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5208 | CLEAR_STR |
| 5209 | IP_STR |
| 5210 | BGP_STR |
| 5211 | "Clear peers with the AS number\n" |
| 5212 | "Address family\n" |
| 5213 | "Address Family modifier\n" |
| 5214 | "Soft reconfig\n" |
| 5215 | "Soft reconfig outbound update\n") |
| 5216 | { |
| 5217 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 5218 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5219 | } |
| 5220 | |
| 5221 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, |
| 5222 | clear_ip_bgp_as_vpnv4_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5223 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5224 | CLEAR_STR |
| 5225 | IP_STR |
| 5226 | BGP_STR |
| 5227 | "Clear peers with the AS number\n" |
| 5228 | "Address family\n" |
| 5229 | "Address Family modifier\n" |
| 5230 | "Soft reconfig outbound update\n") |
| 5231 | |
| 5232 | DEFUN (clear_bgp_as_soft_out, |
| 5233 | clear_bgp_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5234 | "clear bgp " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5235 | CLEAR_STR |
| 5236 | BGP_STR |
| 5237 | "Clear peers with the AS number\n" |
| 5238 | "Soft reconfig\n" |
| 5239 | "Soft reconfig outbound update\n") |
| 5240 | { |
| 5241 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5242 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5243 | } |
| 5244 | |
| 5245 | ALIAS (clear_bgp_as_soft_out, |
| 5246 | clear_bgp_ipv6_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5247 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5248 | CLEAR_STR |
| 5249 | BGP_STR |
| 5250 | "Address family\n" |
| 5251 | "Clear peers with the AS number\n" |
| 5252 | "Soft reconfig\n" |
| 5253 | "Soft reconfig outbound update\n") |
| 5254 | |
| 5255 | ALIAS (clear_bgp_as_soft_out, |
| 5256 | clear_bgp_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5257 | "clear bgp " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5258 | CLEAR_STR |
| 5259 | BGP_STR |
| 5260 | "Clear peers with the AS number\n" |
| 5261 | "Soft reconfig outbound update\n") |
| 5262 | |
| 5263 | ALIAS (clear_bgp_as_soft_out, |
| 5264 | clear_bgp_ipv6_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5265 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5266 | CLEAR_STR |
| 5267 | BGP_STR |
| 5268 | "Address family\n" |
| 5269 | "Clear peers with the AS number\n" |
| 5270 | "Soft reconfig outbound update\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 5271 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5272 | /* Inbound soft-reconfiguration */ |
| 5273 | DEFUN (clear_ip_bgp_all_soft_in, |
| 5274 | clear_ip_bgp_all_soft_in_cmd, |
| 5275 | "clear ip bgp * soft in", |
| 5276 | CLEAR_STR |
| 5277 | IP_STR |
| 5278 | BGP_STR |
| 5279 | "Clear all peers\n" |
| 5280 | "Soft reconfig\n" |
| 5281 | "Soft reconfig inbound update\n") |
| 5282 | { |
| 5283 | if (argc == 1) |
| 5284 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5285 | BGP_CLEAR_SOFT_IN, NULL); |
| 5286 | |
| 5287 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5288 | BGP_CLEAR_SOFT_IN, NULL); |
| 5289 | } |
| 5290 | |
| 5291 | ALIAS (clear_ip_bgp_all_soft_in, |
| 5292 | clear_ip_bgp_instance_all_soft_in_cmd, |
| 5293 | "clear ip bgp view WORD * soft in", |
| 5294 | CLEAR_STR |
| 5295 | IP_STR |
| 5296 | BGP_STR |
| 5297 | "BGP view\n" |
| 5298 | "view name\n" |
| 5299 | "Clear all peers\n" |
| 5300 | "Soft reconfig\n" |
| 5301 | "Soft reconfig inbound update\n") |
| 5302 | |
| 5303 | ALIAS (clear_ip_bgp_all_soft_in, |
| 5304 | clear_ip_bgp_all_in_cmd, |
| 5305 | "clear ip bgp * in", |
| 5306 | CLEAR_STR |
| 5307 | IP_STR |
| 5308 | BGP_STR |
| 5309 | "Clear all peers\n" |
| 5310 | "Soft reconfig inbound update\n") |
| 5311 | |
| 5312 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
| 5313 | clear_ip_bgp_all_in_prefix_filter_cmd, |
| 5314 | "clear ip bgp * in prefix-filter", |
| 5315 | CLEAR_STR |
| 5316 | IP_STR |
| 5317 | BGP_STR |
| 5318 | "Clear all peers\n" |
| 5319 | "Soft reconfig inbound update\n" |
| 5320 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5321 | { |
| 5322 | if (argc== 1) |
| 5323 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5324 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5325 | |
| 5326 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5327 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5328 | } |
| 5329 | |
| 5330 | ALIAS (clear_ip_bgp_all_in_prefix_filter, |
| 5331 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, |
| 5332 | "clear ip bgp view WORD * in prefix-filter", |
| 5333 | CLEAR_STR |
| 5334 | IP_STR |
| 5335 | BGP_STR |
| 5336 | "BGP view\n" |
| 5337 | "view name\n" |
| 5338 | "Clear all peers\n" |
| 5339 | "Soft reconfig inbound update\n" |
| 5340 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5341 | |
| 5342 | |
| 5343 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
| 5344 | clear_ip_bgp_all_ipv4_soft_in_cmd, |
| 5345 | "clear ip bgp * ipv4 (unicast|multicast) soft in", |
| 5346 | CLEAR_STR |
| 5347 | IP_STR |
| 5348 | BGP_STR |
| 5349 | "Clear all peers\n" |
| 5350 | "Address family\n" |
| 5351 | "Address Family modifier\n" |
| 5352 | "Address Family modifier\n" |
| 5353 | "Soft reconfig\n" |
| 5354 | "Soft reconfig inbound update\n") |
| 5355 | { |
| 5356 | if (strncmp (argv[0], "m", 1) == 0) |
| 5357 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5358 | BGP_CLEAR_SOFT_IN, NULL); |
| 5359 | |
| 5360 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5361 | BGP_CLEAR_SOFT_IN, NULL); |
| 5362 | } |
| 5363 | |
| 5364 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, |
| 5365 | clear_ip_bgp_all_ipv4_in_cmd, |
| 5366 | "clear ip bgp * ipv4 (unicast|multicast) in", |
| 5367 | CLEAR_STR |
| 5368 | IP_STR |
| 5369 | BGP_STR |
| 5370 | "Clear all peers\n" |
| 5371 | "Address family\n" |
| 5372 | "Address Family modifier\n" |
| 5373 | "Address Family modifier\n" |
| 5374 | "Soft reconfig inbound update\n") |
| 5375 | |
| 5376 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
| 5377 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, |
| 5378 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", |
| 5379 | CLEAR_STR |
| 5380 | IP_STR |
| 5381 | BGP_STR |
| 5382 | "BGP view\n" |
| 5383 | "view name\n" |
| 5384 | "Clear all peers\n" |
| 5385 | "Address family\n" |
| 5386 | "Address Family modifier\n" |
| 5387 | "Address Family modifier\n" |
| 5388 | "Soft reconfig\n" |
| 5389 | "Soft reconfig inbound update\n") |
| 5390 | { |
| 5391 | if (strncmp (argv[1], "m", 1) == 0) |
| 5392 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5393 | BGP_CLEAR_SOFT_IN, NULL); |
| 5394 | |
| 5395 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5396 | BGP_CLEAR_SOFT_IN, NULL); |
| 5397 | } |
| 5398 | |
| 5399 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
| 5400 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, |
| 5401 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", |
| 5402 | CLEAR_STR |
| 5403 | IP_STR |
| 5404 | BGP_STR |
| 5405 | "Clear all peers\n" |
| 5406 | "Address family\n" |
| 5407 | "Address Family modifier\n" |
| 5408 | "Address Family modifier\n" |
| 5409 | "Soft reconfig inbound update\n" |
| 5410 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5411 | { |
| 5412 | if (strncmp (argv[0], "m", 1) == 0) |
| 5413 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5414 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5415 | |
| 5416 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5417 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5418 | } |
| 5419 | |
| 5420 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, |
| 5421 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, |
| 5422 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", |
| 5423 | CLEAR_STR |
| 5424 | IP_STR |
| 5425 | BGP_STR |
| 5426 | "Clear all peers\n" |
| 5427 | "Address family\n" |
| 5428 | "Address Family modifier\n" |
| 5429 | "Address Family modifier\n" |
| 5430 | "Soft reconfig inbound update\n" |
| 5431 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5432 | { |
| 5433 | if (strncmp (argv[1], "m", 1) == 0) |
| 5434 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5435 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5436 | |
| 5437 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5438 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5439 | } |
| 5440 | |
| 5441 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, |
| 5442 | clear_ip_bgp_all_vpnv4_soft_in_cmd, |
| 5443 | "clear ip bgp * vpnv4 unicast soft in", |
| 5444 | CLEAR_STR |
| 5445 | IP_STR |
| 5446 | BGP_STR |
| 5447 | "Clear all peers\n" |
| 5448 | "Address family\n" |
| 5449 | "Address Family Modifier\n" |
| 5450 | "Soft reconfig\n" |
| 5451 | "Soft reconfig inbound update\n") |
| 5452 | { |
| 5453 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 5454 | BGP_CLEAR_SOFT_IN, NULL); |
| 5455 | } |
| 5456 | |
| 5457 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, |
| 5458 | clear_ip_bgp_all_vpnv4_in_cmd, |
| 5459 | "clear ip bgp * vpnv4 unicast in", |
| 5460 | CLEAR_STR |
| 5461 | IP_STR |
| 5462 | BGP_STR |
| 5463 | "Clear all peers\n" |
| 5464 | "Address family\n" |
| 5465 | "Address Family Modifier\n" |
| 5466 | "Soft reconfig inbound update\n") |
| 5467 | |
| 5468 | DEFUN (clear_bgp_all_soft_in, |
| 5469 | clear_bgp_all_soft_in_cmd, |
| 5470 | "clear bgp * soft in", |
| 5471 | CLEAR_STR |
| 5472 | BGP_STR |
| 5473 | "Clear all peers\n" |
| 5474 | "Soft reconfig\n" |
| 5475 | "Soft reconfig inbound update\n") |
| 5476 | { |
| 5477 | if (argc == 1) |
| 5478 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 5479 | BGP_CLEAR_SOFT_IN, NULL); |
| 5480 | |
| 5481 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5482 | BGP_CLEAR_SOFT_IN, NULL); |
| 5483 | } |
| 5484 | |
| 5485 | ALIAS (clear_bgp_all_soft_in, |
| 5486 | clear_bgp_instance_all_soft_in_cmd, |
| 5487 | "clear bgp view WORD * soft in", |
| 5488 | CLEAR_STR |
| 5489 | BGP_STR |
| 5490 | "BGP view\n" |
| 5491 | "view name\n" |
| 5492 | "Clear all peers\n" |
| 5493 | "Soft reconfig\n" |
| 5494 | "Soft reconfig inbound update\n") |
| 5495 | |
| 5496 | ALIAS (clear_bgp_all_soft_in, |
| 5497 | clear_bgp_ipv6_all_soft_in_cmd, |
| 5498 | "clear bgp ipv6 * soft in", |
| 5499 | CLEAR_STR |
| 5500 | BGP_STR |
| 5501 | "Address family\n" |
| 5502 | "Clear all peers\n" |
| 5503 | "Soft reconfig\n" |
| 5504 | "Soft reconfig inbound update\n") |
| 5505 | |
| 5506 | ALIAS (clear_bgp_all_soft_in, |
| 5507 | clear_bgp_all_in_cmd, |
| 5508 | "clear bgp * in", |
| 5509 | CLEAR_STR |
| 5510 | BGP_STR |
| 5511 | "Clear all peers\n" |
| 5512 | "Soft reconfig inbound update\n") |
| 5513 | |
| 5514 | ALIAS (clear_bgp_all_soft_in, |
| 5515 | clear_bgp_ipv6_all_in_cmd, |
| 5516 | "clear bgp ipv6 * in", |
| 5517 | CLEAR_STR |
| 5518 | BGP_STR |
| 5519 | "Address family\n" |
| 5520 | "Clear all peers\n" |
| 5521 | "Soft reconfig inbound update\n") |
| 5522 | |
| 5523 | DEFUN (clear_bgp_all_in_prefix_filter, |
| 5524 | clear_bgp_all_in_prefix_filter_cmd, |
| 5525 | "clear bgp * in prefix-filter", |
| 5526 | CLEAR_STR |
| 5527 | BGP_STR |
| 5528 | "Clear all peers\n" |
| 5529 | "Soft reconfig inbound update\n" |
| 5530 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5531 | { |
| 5532 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5533 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5534 | } |
| 5535 | |
| 5536 | ALIAS (clear_bgp_all_in_prefix_filter, |
| 5537 | clear_bgp_ipv6_all_in_prefix_filter_cmd, |
| 5538 | "clear bgp ipv6 * in prefix-filter", |
| 5539 | CLEAR_STR |
| 5540 | BGP_STR |
| 5541 | "Address family\n" |
| 5542 | "Clear all peers\n" |
| 5543 | "Soft reconfig inbound update\n" |
| 5544 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5545 | |
| 5546 | DEFUN (clear_ip_bgp_peer_soft_in, |
| 5547 | clear_ip_bgp_peer_soft_in_cmd, |
| 5548 | "clear ip bgp A.B.C.D soft in", |
| 5549 | CLEAR_STR |
| 5550 | IP_STR |
| 5551 | BGP_STR |
| 5552 | "BGP neighbor address to clear\n" |
| 5553 | "Soft reconfig\n" |
| 5554 | "Soft reconfig inbound update\n") |
| 5555 | { |
| 5556 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5557 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5558 | } |
| 5559 | |
| 5560 | ALIAS (clear_ip_bgp_peer_soft_in, |
| 5561 | clear_ip_bgp_peer_in_cmd, |
| 5562 | "clear ip bgp A.B.C.D in", |
| 5563 | CLEAR_STR |
| 5564 | IP_STR |
| 5565 | BGP_STR |
| 5566 | "BGP neighbor address to clear\n" |
| 5567 | "Soft reconfig inbound update\n") |
| 5568 | |
| 5569 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
| 5570 | clear_ip_bgp_peer_in_prefix_filter_cmd, |
| 5571 | "clear ip bgp A.B.C.D in prefix-filter", |
| 5572 | CLEAR_STR |
| 5573 | IP_STR |
| 5574 | BGP_STR |
| 5575 | "BGP neighbor address to clear\n" |
| 5576 | "Soft reconfig inbound update\n" |
| 5577 | "Push out the existing ORF prefix-list\n") |
| 5578 | { |
| 5579 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5580 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5581 | } |
| 5582 | |
| 5583 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, |
| 5584 | clear_ip_bgp_peer_ipv4_soft_in_cmd, |
| 5585 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", |
| 5586 | CLEAR_STR |
| 5587 | IP_STR |
| 5588 | BGP_STR |
| 5589 | "BGP neighbor address to clear\n" |
| 5590 | "Address family\n" |
| 5591 | "Address Family modifier\n" |
| 5592 | "Address Family modifier\n" |
| 5593 | "Soft reconfig\n" |
| 5594 | "Soft reconfig inbound update\n") |
| 5595 | { |
| 5596 | if (strncmp (argv[1], "m", 1) == 0) |
| 5597 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5598 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5599 | |
| 5600 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5601 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5602 | } |
| 5603 | |
| 5604 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, |
| 5605 | clear_ip_bgp_peer_ipv4_in_cmd, |
| 5606 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", |
| 5607 | CLEAR_STR |
| 5608 | IP_STR |
| 5609 | BGP_STR |
| 5610 | "BGP neighbor address to clear\n" |
| 5611 | "Address family\n" |
| 5612 | "Address Family modifier\n" |
| 5613 | "Address Family modifier\n" |
| 5614 | "Soft reconfig inbound update\n") |
| 5615 | |
| 5616 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
| 5617 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, |
| 5618 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", |
| 5619 | CLEAR_STR |
| 5620 | IP_STR |
| 5621 | BGP_STR |
| 5622 | "BGP neighbor address to clear\n" |
| 5623 | "Address family\n" |
| 5624 | "Address Family modifier\n" |
| 5625 | "Address Family modifier\n" |
| 5626 | "Soft reconfig inbound update\n" |
| 5627 | "Push out the existing ORF prefix-list\n") |
| 5628 | { |
| 5629 | if (strncmp (argv[1], "m", 1) == 0) |
| 5630 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5631 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5632 | |
| 5633 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5634 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5635 | } |
| 5636 | |
| 5637 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5638 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, |
| 5639 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", |
| 5640 | CLEAR_STR |
| 5641 | IP_STR |
| 5642 | BGP_STR |
| 5643 | "BGP neighbor address to clear\n" |
| 5644 | "Address family\n" |
| 5645 | "Address Family Modifier\n" |
| 5646 | "Soft reconfig\n" |
| 5647 | "Soft reconfig inbound update\n") |
| 5648 | { |
| 5649 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 5650 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5651 | } |
| 5652 | |
| 5653 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5654 | clear_ip_bgp_peer_vpnv4_in_cmd, |
| 5655 | "clear ip bgp A.B.C.D vpnv4 unicast in", |
| 5656 | CLEAR_STR |
| 5657 | IP_STR |
| 5658 | BGP_STR |
| 5659 | "BGP neighbor address to clear\n" |
| 5660 | "Address family\n" |
| 5661 | "Address Family Modifier\n" |
| 5662 | "Soft reconfig inbound update\n") |
| 5663 | |
| 5664 | DEFUN (clear_bgp_peer_soft_in, |
| 5665 | clear_bgp_peer_soft_in_cmd, |
| 5666 | "clear bgp (A.B.C.D|X:X::X:X) soft in", |
| 5667 | CLEAR_STR |
| 5668 | BGP_STR |
| 5669 | "BGP neighbor address to clear\n" |
| 5670 | "BGP IPv6 neighbor to clear\n" |
| 5671 | "Soft reconfig\n" |
| 5672 | "Soft reconfig inbound update\n") |
| 5673 | { |
| 5674 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5675 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5676 | } |
| 5677 | |
| 5678 | ALIAS (clear_bgp_peer_soft_in, |
| 5679 | clear_bgp_ipv6_peer_soft_in_cmd, |
| 5680 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in", |
| 5681 | CLEAR_STR |
| 5682 | BGP_STR |
| 5683 | "Address family\n" |
| 5684 | "BGP neighbor address to clear\n" |
| 5685 | "BGP IPv6 neighbor to clear\n" |
| 5686 | "Soft reconfig\n" |
| 5687 | "Soft reconfig inbound update\n") |
| 5688 | |
| 5689 | ALIAS (clear_bgp_peer_soft_in, |
| 5690 | clear_bgp_peer_in_cmd, |
| 5691 | "clear bgp (A.B.C.D|X:X::X:X) in", |
| 5692 | CLEAR_STR |
| 5693 | BGP_STR |
| 5694 | "BGP neighbor address to clear\n" |
| 5695 | "BGP IPv6 neighbor to clear\n" |
| 5696 | "Soft reconfig inbound update\n") |
| 5697 | |
| 5698 | ALIAS (clear_bgp_peer_soft_in, |
| 5699 | clear_bgp_ipv6_peer_in_cmd, |
| 5700 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in", |
| 5701 | CLEAR_STR |
| 5702 | BGP_STR |
| 5703 | "Address family\n" |
| 5704 | "BGP neighbor address to clear\n" |
| 5705 | "BGP IPv6 neighbor to clear\n" |
| 5706 | "Soft reconfig inbound update\n") |
| 5707 | |
| 5708 | DEFUN (clear_bgp_peer_in_prefix_filter, |
| 5709 | clear_bgp_peer_in_prefix_filter_cmd, |
| 5710 | "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5711 | CLEAR_STR |
| 5712 | BGP_STR |
| 5713 | "BGP neighbor address to clear\n" |
| 5714 | "BGP IPv6 neighbor to clear\n" |
| 5715 | "Soft reconfig inbound update\n" |
| 5716 | "Push out the existing ORF prefix-list\n") |
| 5717 | { |
| 5718 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5719 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5720 | } |
| 5721 | |
| 5722 | ALIAS (clear_bgp_peer_in_prefix_filter, |
| 5723 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, |
| 5724 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5725 | CLEAR_STR |
| 5726 | BGP_STR |
| 5727 | "Address family\n" |
| 5728 | "BGP neighbor address to clear\n" |
| 5729 | "BGP IPv6 neighbor to clear\n" |
| 5730 | "Soft reconfig inbound update\n" |
| 5731 | "Push out the existing ORF prefix-list\n") |
| 5732 | |
| 5733 | DEFUN (clear_ip_bgp_peer_group_soft_in, |
| 5734 | clear_ip_bgp_peer_group_soft_in_cmd, |
| 5735 | "clear ip bgp peer-group WORD soft in", |
| 5736 | CLEAR_STR |
| 5737 | IP_STR |
| 5738 | BGP_STR |
| 5739 | "Clear all members of peer-group\n" |
| 5740 | "BGP peer-group name\n" |
| 5741 | "Soft reconfig\n" |
| 5742 | "Soft reconfig inbound update\n") |
| 5743 | { |
| 5744 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5745 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5746 | } |
| 5747 | |
| 5748 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
| 5749 | clear_ip_bgp_peer_group_in_cmd, |
| 5750 | "clear ip bgp peer-group WORD in", |
| 5751 | CLEAR_STR |
| 5752 | IP_STR |
| 5753 | BGP_STR |
| 5754 | "Clear all members of peer-group\n" |
| 5755 | "BGP peer-group name\n" |
| 5756 | "Soft reconfig inbound update\n") |
| 5757 | |
| 5758 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
| 5759 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, |
| 5760 | "clear ip bgp peer-group WORD in prefix-filter", |
| 5761 | CLEAR_STR |
| 5762 | IP_STR |
| 5763 | BGP_STR |
| 5764 | "Clear all members of peer-group\n" |
| 5765 | "BGP peer-group name\n" |
| 5766 | "Soft reconfig inbound update\n" |
| 5767 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5768 | { |
| 5769 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5770 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5771 | } |
| 5772 | |
| 5773 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5774 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, |
| 5775 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", |
| 5776 | CLEAR_STR |
| 5777 | IP_STR |
| 5778 | BGP_STR |
| 5779 | "Clear all members of peer-group\n" |
| 5780 | "BGP peer-group name\n" |
| 5781 | "Address family\n" |
| 5782 | "Address Family modifier\n" |
| 5783 | "Address Family modifier\n" |
| 5784 | "Soft reconfig\n" |
| 5785 | "Soft reconfig inbound update\n") |
| 5786 | { |
| 5787 | if (strncmp (argv[1], "m", 1) == 0) |
| 5788 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5789 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5790 | |
| 5791 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5792 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5793 | } |
| 5794 | |
| 5795 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5796 | clear_ip_bgp_peer_group_ipv4_in_cmd, |
| 5797 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", |
| 5798 | CLEAR_STR |
| 5799 | IP_STR |
| 5800 | BGP_STR |
| 5801 | "Clear all members of peer-group\n" |
| 5802 | "BGP peer-group name\n" |
| 5803 | "Address family\n" |
| 5804 | "Address Family modifier\n" |
| 5805 | "Address Family modifier\n" |
| 5806 | "Soft reconfig inbound update\n") |
| 5807 | |
| 5808 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
| 5809 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, |
| 5810 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", |
| 5811 | CLEAR_STR |
| 5812 | IP_STR |
| 5813 | BGP_STR |
| 5814 | "Clear all members of peer-group\n" |
| 5815 | "BGP peer-group name\n" |
| 5816 | "Address family\n" |
| 5817 | "Address Family modifier\n" |
| 5818 | "Address Family modifier\n" |
| 5819 | "Soft reconfig inbound update\n" |
| 5820 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5821 | { |
| 5822 | if (strncmp (argv[1], "m", 1) == 0) |
| 5823 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5824 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5825 | |
| 5826 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5827 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5828 | } |
| 5829 | |
| 5830 | DEFUN (clear_bgp_peer_group_soft_in, |
| 5831 | clear_bgp_peer_group_soft_in_cmd, |
| 5832 | "clear bgp peer-group WORD soft in", |
| 5833 | CLEAR_STR |
| 5834 | BGP_STR |
| 5835 | "Clear all members of peer-group\n" |
| 5836 | "BGP peer-group name\n" |
| 5837 | "Soft reconfig\n" |
| 5838 | "Soft reconfig inbound update\n") |
| 5839 | { |
| 5840 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5841 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5842 | } |
| 5843 | |
| 5844 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5845 | clear_bgp_ipv6_peer_group_soft_in_cmd, |
| 5846 | "clear bgp ipv6 peer-group WORD soft in", |
| 5847 | CLEAR_STR |
| 5848 | BGP_STR |
| 5849 | "Address family\n" |
| 5850 | "Clear all members of peer-group\n" |
| 5851 | "BGP peer-group name\n" |
| 5852 | "Soft reconfig\n" |
| 5853 | "Soft reconfig inbound update\n") |
| 5854 | |
| 5855 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5856 | clear_bgp_peer_group_in_cmd, |
| 5857 | "clear bgp peer-group WORD in", |
| 5858 | CLEAR_STR |
| 5859 | BGP_STR |
| 5860 | "Clear all members of peer-group\n" |
| 5861 | "BGP peer-group name\n" |
| 5862 | "Soft reconfig inbound update\n") |
| 5863 | |
| 5864 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5865 | clear_bgp_ipv6_peer_group_in_cmd, |
| 5866 | "clear bgp ipv6 peer-group WORD in", |
| 5867 | CLEAR_STR |
| 5868 | BGP_STR |
| 5869 | "Address family\n" |
| 5870 | "Clear all members of peer-group\n" |
| 5871 | "BGP peer-group name\n" |
| 5872 | "Soft reconfig inbound update\n") |
| 5873 | |
| 5874 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
| 5875 | clear_bgp_peer_group_in_prefix_filter_cmd, |
| 5876 | "clear bgp peer-group WORD in prefix-filter", |
| 5877 | CLEAR_STR |
| 5878 | BGP_STR |
| 5879 | "Clear all members of peer-group\n" |
| 5880 | "BGP peer-group name\n" |
| 5881 | "Soft reconfig inbound update\n" |
| 5882 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5883 | { |
| 5884 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5885 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5886 | } |
| 5887 | |
| 5888 | ALIAS (clear_bgp_peer_group_in_prefix_filter, |
| 5889 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, |
| 5890 | "clear bgp ipv6 peer-group WORD in prefix-filter", |
| 5891 | CLEAR_STR |
| 5892 | BGP_STR |
| 5893 | "Address family\n" |
| 5894 | "Clear all members of peer-group\n" |
| 5895 | "BGP peer-group name\n" |
| 5896 | "Soft reconfig inbound update\n" |
| 5897 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5898 | |
| 5899 | DEFUN (clear_ip_bgp_external_soft_in, |
| 5900 | clear_ip_bgp_external_soft_in_cmd, |
| 5901 | "clear ip bgp external soft in", |
| 5902 | CLEAR_STR |
| 5903 | IP_STR |
| 5904 | BGP_STR |
| 5905 | "Clear all external peers\n" |
| 5906 | "Soft reconfig\n" |
| 5907 | "Soft reconfig inbound update\n") |
| 5908 | { |
| 5909 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5910 | BGP_CLEAR_SOFT_IN, NULL); |
| 5911 | } |
| 5912 | |
| 5913 | ALIAS (clear_ip_bgp_external_soft_in, |
| 5914 | clear_ip_bgp_external_in_cmd, |
| 5915 | "clear ip bgp external in", |
| 5916 | CLEAR_STR |
| 5917 | IP_STR |
| 5918 | BGP_STR |
| 5919 | "Clear all external peers\n" |
| 5920 | "Soft reconfig inbound update\n") |
| 5921 | |
| 5922 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
| 5923 | clear_ip_bgp_external_in_prefix_filter_cmd, |
| 5924 | "clear ip bgp external in prefix-filter", |
| 5925 | CLEAR_STR |
| 5926 | IP_STR |
| 5927 | BGP_STR |
| 5928 | "Clear all external peers\n" |
| 5929 | "Soft reconfig inbound update\n" |
| 5930 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5931 | { |
| 5932 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5933 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5934 | } |
| 5935 | |
| 5936 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, |
| 5937 | clear_ip_bgp_external_ipv4_soft_in_cmd, |
| 5938 | "clear ip bgp external ipv4 (unicast|multicast) soft in", |
| 5939 | CLEAR_STR |
| 5940 | IP_STR |
| 5941 | BGP_STR |
| 5942 | "Clear all external peers\n" |
| 5943 | "Address family\n" |
| 5944 | "Address Family modifier\n" |
| 5945 | "Address Family modifier\n" |
| 5946 | "Soft reconfig\n" |
| 5947 | "Soft reconfig inbound update\n") |
| 5948 | { |
| 5949 | if (strncmp (argv[0], "m", 1) == 0) |
| 5950 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5951 | BGP_CLEAR_SOFT_IN, NULL); |
| 5952 | |
| 5953 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5954 | BGP_CLEAR_SOFT_IN, NULL); |
| 5955 | } |
| 5956 | |
| 5957 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, |
| 5958 | clear_ip_bgp_external_ipv4_in_cmd, |
| 5959 | "clear ip bgp external ipv4 (unicast|multicast) in", |
| 5960 | CLEAR_STR |
| 5961 | IP_STR |
| 5962 | BGP_STR |
| 5963 | "Clear all external peers\n" |
| 5964 | "Address family\n" |
| 5965 | "Address Family modifier\n" |
| 5966 | "Address Family modifier\n" |
| 5967 | "Soft reconfig inbound update\n") |
| 5968 | |
| 5969 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
| 5970 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, |
| 5971 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", |
| 5972 | CLEAR_STR |
| 5973 | IP_STR |
| 5974 | BGP_STR |
| 5975 | "Clear all external peers\n" |
| 5976 | "Address family\n" |
| 5977 | "Address Family modifier\n" |
| 5978 | "Address Family modifier\n" |
| 5979 | "Soft reconfig inbound update\n" |
| 5980 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5981 | { |
| 5982 | if (strncmp (argv[0], "m", 1) == 0) |
| 5983 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5984 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5985 | |
| 5986 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5987 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5988 | } |
| 5989 | |
| 5990 | DEFUN (clear_bgp_external_soft_in, |
| 5991 | clear_bgp_external_soft_in_cmd, |
| 5992 | "clear bgp external soft in", |
| 5993 | CLEAR_STR |
| 5994 | BGP_STR |
| 5995 | "Clear all external peers\n" |
| 5996 | "Soft reconfig\n" |
| 5997 | "Soft reconfig inbound update\n") |
| 5998 | { |
| 5999 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 6000 | BGP_CLEAR_SOFT_IN, NULL); |
| 6001 | } |
| 6002 | |
| 6003 | ALIAS (clear_bgp_external_soft_in, |
| 6004 | clear_bgp_ipv6_external_soft_in_cmd, |
| 6005 | "clear bgp ipv6 external soft in", |
| 6006 | CLEAR_STR |
| 6007 | BGP_STR |
| 6008 | "Address family\n" |
| 6009 | "Clear all external peers\n" |
| 6010 | "Soft reconfig\n" |
| 6011 | "Soft reconfig inbound update\n") |
| 6012 | |
| 6013 | ALIAS (clear_bgp_external_soft_in, |
| 6014 | clear_bgp_external_in_cmd, |
| 6015 | "clear bgp external in", |
| 6016 | CLEAR_STR |
| 6017 | BGP_STR |
| 6018 | "Clear all external peers\n" |
| 6019 | "Soft reconfig inbound update\n") |
| 6020 | |
| 6021 | ALIAS (clear_bgp_external_soft_in, |
| 6022 | clear_bgp_ipv6_external_in_cmd, |
| 6023 | "clear bgp ipv6 external WORD in", |
| 6024 | CLEAR_STR |
| 6025 | BGP_STR |
| 6026 | "Address family\n" |
| 6027 | "Clear all external peers\n" |
| 6028 | "Soft reconfig inbound update\n") |
| 6029 | |
| 6030 | DEFUN (clear_bgp_external_in_prefix_filter, |
| 6031 | clear_bgp_external_in_prefix_filter_cmd, |
| 6032 | "clear bgp external in prefix-filter", |
| 6033 | CLEAR_STR |
| 6034 | BGP_STR |
| 6035 | "Clear all external peers\n" |
| 6036 | "Soft reconfig inbound update\n" |
| 6037 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6038 | { |
| 6039 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 6040 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 6041 | } |
| 6042 | |
| 6043 | ALIAS (clear_bgp_external_in_prefix_filter, |
| 6044 | clear_bgp_ipv6_external_in_prefix_filter_cmd, |
| 6045 | "clear bgp ipv6 external in prefix-filter", |
| 6046 | CLEAR_STR |
| 6047 | BGP_STR |
| 6048 | "Address family\n" |
| 6049 | "Clear all external peers\n" |
| 6050 | "Soft reconfig inbound update\n" |
| 6051 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6052 | |
| 6053 | DEFUN (clear_ip_bgp_as_soft_in, |
| 6054 | clear_ip_bgp_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6055 | "clear ip bgp " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6056 | CLEAR_STR |
| 6057 | IP_STR |
| 6058 | BGP_STR |
| 6059 | "Clear peers with the AS number\n" |
| 6060 | "Soft reconfig\n" |
| 6061 | "Soft reconfig inbound update\n") |
| 6062 | { |
| 6063 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6064 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6065 | } |
| 6066 | |
| 6067 | ALIAS (clear_ip_bgp_as_soft_in, |
| 6068 | clear_ip_bgp_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6069 | "clear ip bgp " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6070 | CLEAR_STR |
| 6071 | IP_STR |
| 6072 | BGP_STR |
| 6073 | "Clear peers with the AS number\n" |
| 6074 | "Soft reconfig inbound update\n") |
| 6075 | |
| 6076 | DEFUN (clear_ip_bgp_as_in_prefix_filter, |
| 6077 | clear_ip_bgp_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6078 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6079 | CLEAR_STR |
| 6080 | IP_STR |
| 6081 | BGP_STR |
| 6082 | "Clear peers with the AS number\n" |
| 6083 | "Soft reconfig inbound update\n" |
| 6084 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6085 | { |
| 6086 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6087 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6088 | } |
| 6089 | |
| 6090 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, |
| 6091 | clear_ip_bgp_as_ipv4_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6092 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6093 | CLEAR_STR |
| 6094 | IP_STR |
| 6095 | BGP_STR |
| 6096 | "Clear peers with the AS number\n" |
| 6097 | "Address family\n" |
| 6098 | "Address Family modifier\n" |
| 6099 | "Address Family modifier\n" |
| 6100 | "Soft reconfig\n" |
| 6101 | "Soft reconfig inbound update\n") |
| 6102 | { |
| 6103 | if (strncmp (argv[1], "m", 1) == 0) |
| 6104 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6105 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6106 | |
| 6107 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6108 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6109 | } |
| 6110 | |
| 6111 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, |
| 6112 | clear_ip_bgp_as_ipv4_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6113 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6114 | CLEAR_STR |
| 6115 | IP_STR |
| 6116 | BGP_STR |
| 6117 | "Clear peers with the AS number\n" |
| 6118 | "Address family\n" |
| 6119 | "Address Family modifier\n" |
| 6120 | "Address Family modifier\n" |
| 6121 | "Soft reconfig inbound update\n") |
| 6122 | |
| 6123 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
| 6124 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6125 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6126 | CLEAR_STR |
| 6127 | IP_STR |
| 6128 | BGP_STR |
| 6129 | "Clear peers with the AS number\n" |
| 6130 | "Address family\n" |
| 6131 | "Address Family modifier\n" |
| 6132 | "Address Family modifier\n" |
| 6133 | "Soft reconfig inbound update\n" |
| 6134 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6135 | { |
| 6136 | if (strncmp (argv[1], "m", 1) == 0) |
| 6137 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6138 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6139 | |
| 6140 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6141 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6142 | } |
| 6143 | |
| 6144 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, |
| 6145 | clear_ip_bgp_as_vpnv4_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6146 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6147 | CLEAR_STR |
| 6148 | IP_STR |
| 6149 | BGP_STR |
| 6150 | "Clear peers with the AS number\n" |
| 6151 | "Address family\n" |
| 6152 | "Address Family modifier\n" |
| 6153 | "Soft reconfig\n" |
| 6154 | "Soft reconfig inbound update\n") |
| 6155 | { |
| 6156 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 6157 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6158 | } |
| 6159 | |
| 6160 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, |
| 6161 | clear_ip_bgp_as_vpnv4_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6162 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6163 | CLEAR_STR |
| 6164 | IP_STR |
| 6165 | BGP_STR |
| 6166 | "Clear peers with the AS number\n" |
| 6167 | "Address family\n" |
| 6168 | "Address Family modifier\n" |
| 6169 | "Soft reconfig inbound update\n") |
| 6170 | |
| 6171 | DEFUN (clear_bgp_as_soft_in, |
| 6172 | clear_bgp_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6173 | "clear bgp " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6174 | CLEAR_STR |
| 6175 | BGP_STR |
| 6176 | "Clear peers with the AS number\n" |
| 6177 | "Soft reconfig\n" |
| 6178 | "Soft reconfig inbound update\n") |
| 6179 | { |
| 6180 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6181 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6182 | } |
| 6183 | |
| 6184 | ALIAS (clear_bgp_as_soft_in, |
| 6185 | clear_bgp_ipv6_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6186 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6187 | CLEAR_STR |
| 6188 | BGP_STR |
| 6189 | "Address family\n" |
| 6190 | "Clear peers with the AS number\n" |
| 6191 | "Soft reconfig\n" |
| 6192 | "Soft reconfig inbound update\n") |
| 6193 | |
| 6194 | ALIAS (clear_bgp_as_soft_in, |
| 6195 | clear_bgp_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6196 | "clear bgp " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6197 | CLEAR_STR |
| 6198 | BGP_STR |
| 6199 | "Clear peers with the AS number\n" |
| 6200 | "Soft reconfig inbound update\n") |
| 6201 | |
| 6202 | ALIAS (clear_bgp_as_soft_in, |
| 6203 | clear_bgp_ipv6_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6204 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6205 | CLEAR_STR |
| 6206 | BGP_STR |
| 6207 | "Address family\n" |
| 6208 | "Clear peers with the AS number\n" |
| 6209 | "Soft reconfig inbound update\n") |
| 6210 | |
| 6211 | DEFUN (clear_bgp_as_in_prefix_filter, |
| 6212 | clear_bgp_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6213 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6214 | CLEAR_STR |
| 6215 | BGP_STR |
| 6216 | "Clear peers with the AS number\n" |
| 6217 | "Soft reconfig inbound update\n" |
| 6218 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6219 | { |
| 6220 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6221 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6222 | } |
| 6223 | |
| 6224 | ALIAS (clear_bgp_as_in_prefix_filter, |
| 6225 | clear_bgp_ipv6_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6226 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6227 | CLEAR_STR |
| 6228 | BGP_STR |
| 6229 | "Address family\n" |
| 6230 | "Clear peers with the AS number\n" |
| 6231 | "Soft reconfig inbound update\n" |
| 6232 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 6233 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6234 | /* Both soft-reconfiguration */ |
| 6235 | DEFUN (clear_ip_bgp_all_soft, |
| 6236 | clear_ip_bgp_all_soft_cmd, |
| 6237 | "clear ip bgp * soft", |
| 6238 | CLEAR_STR |
| 6239 | IP_STR |
| 6240 | BGP_STR |
| 6241 | "Clear all peers\n" |
| 6242 | "Soft reconfig\n") |
| 6243 | { |
| 6244 | if (argc == 1) |
| 6245 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6246 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6247 | |
| 6248 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6249 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6250 | } |
| 6251 | |
| 6252 | ALIAS (clear_ip_bgp_all_soft, |
| 6253 | clear_ip_bgp_instance_all_soft_cmd, |
| 6254 | "clear ip bgp view WORD * soft", |
| 6255 | CLEAR_STR |
| 6256 | IP_STR |
| 6257 | BGP_STR |
| 6258 | "BGP view\n" |
| 6259 | "view name\n" |
| 6260 | "Clear all peers\n" |
| 6261 | "Soft reconfig\n") |
| 6262 | |
| 6263 | |
| 6264 | DEFUN (clear_ip_bgp_all_ipv4_soft, |
| 6265 | clear_ip_bgp_all_ipv4_soft_cmd, |
| 6266 | "clear ip bgp * ipv4 (unicast|multicast) soft", |
| 6267 | CLEAR_STR |
| 6268 | IP_STR |
| 6269 | BGP_STR |
| 6270 | "Clear all peers\n" |
| 6271 | "Address family\n" |
| 6272 | "Address Family Modifier\n" |
| 6273 | "Address Family Modifier\n" |
| 6274 | "Soft reconfig\n") |
| 6275 | { |
| 6276 | if (strncmp (argv[0], "m", 1) == 0) |
| 6277 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 6278 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6279 | |
| 6280 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6281 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6282 | } |
| 6283 | |
| 6284 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, |
| 6285 | clear_ip_bgp_instance_all_ipv4_soft_cmd, |
| 6286 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", |
| 6287 | CLEAR_STR |
| 6288 | IP_STR |
| 6289 | BGP_STR |
| 6290 | "BGP view\n" |
| 6291 | "view name\n" |
| 6292 | "Clear all peers\n" |
| 6293 | "Address family\n" |
| 6294 | "Address Family Modifier\n" |
| 6295 | "Address Family Modifier\n" |
| 6296 | "Soft reconfig\n") |
| 6297 | { |
| 6298 | if (strncmp (argv[1], "m", 1) == 0) |
| 6299 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 6300 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6301 | |
| 6302 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6303 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6304 | } |
| 6305 | |
| 6306 | DEFUN (clear_ip_bgp_all_vpnv4_soft, |
| 6307 | clear_ip_bgp_all_vpnv4_soft_cmd, |
| 6308 | "clear ip bgp * vpnv4 unicast soft", |
| 6309 | CLEAR_STR |
| 6310 | IP_STR |
| 6311 | BGP_STR |
| 6312 | "Clear all peers\n" |
| 6313 | "Address family\n" |
| 6314 | "Address Family Modifier\n" |
| 6315 | "Soft reconfig\n") |
| 6316 | { |
| 6317 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 6318 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6319 | } |
| 6320 | |
| 6321 | DEFUN (clear_bgp_all_soft, |
| 6322 | clear_bgp_all_soft_cmd, |
| 6323 | "clear bgp * soft", |
| 6324 | CLEAR_STR |
| 6325 | BGP_STR |
| 6326 | "Clear all peers\n" |
| 6327 | "Soft reconfig\n") |
| 6328 | { |
| 6329 | if (argc == 1) |
| 6330 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6331 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6332 | |
| 6333 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6334 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6335 | } |
| 6336 | |
| 6337 | ALIAS (clear_bgp_all_soft, |
| 6338 | clear_bgp_instance_all_soft_cmd, |
| 6339 | "clear bgp view WORD * soft", |
| 6340 | CLEAR_STR |
| 6341 | BGP_STR |
| 6342 | "BGP view\n" |
| 6343 | "view name\n" |
| 6344 | "Clear all peers\n" |
| 6345 | "Soft reconfig\n") |
| 6346 | |
| 6347 | ALIAS (clear_bgp_all_soft, |
| 6348 | clear_bgp_ipv6_all_soft_cmd, |
| 6349 | "clear bgp ipv6 * soft", |
| 6350 | CLEAR_STR |
| 6351 | BGP_STR |
| 6352 | "Address family\n" |
| 6353 | "Clear all peers\n" |
| 6354 | "Soft reconfig\n") |
| 6355 | |
| 6356 | DEFUN (clear_ip_bgp_peer_soft, |
| 6357 | clear_ip_bgp_peer_soft_cmd, |
| 6358 | "clear ip bgp A.B.C.D soft", |
| 6359 | CLEAR_STR |
| 6360 | IP_STR |
| 6361 | BGP_STR |
| 6362 | "BGP neighbor address to clear\n" |
| 6363 | "Soft reconfig\n") |
| 6364 | { |
| 6365 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6366 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6367 | } |
| 6368 | |
| 6369 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
| 6370 | clear_ip_bgp_peer_ipv4_soft_cmd, |
| 6371 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", |
| 6372 | CLEAR_STR |
| 6373 | IP_STR |
| 6374 | BGP_STR |
| 6375 | "BGP neighbor address to clear\n" |
| 6376 | "Address family\n" |
| 6377 | "Address Family Modifier\n" |
| 6378 | "Address Family Modifier\n" |
| 6379 | "Soft reconfig\n") |
| 6380 | { |
| 6381 | if (strncmp (argv[1], "m", 1) == 0) |
| 6382 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 6383 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6384 | |
| 6385 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6386 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6387 | } |
| 6388 | |
| 6389 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
| 6390 | clear_ip_bgp_peer_vpnv4_soft_cmd, |
| 6391 | "clear ip bgp A.B.C.D vpnv4 unicast soft", |
| 6392 | CLEAR_STR |
| 6393 | IP_STR |
| 6394 | BGP_STR |
| 6395 | "BGP neighbor address to clear\n" |
| 6396 | "Address family\n" |
| 6397 | "Address Family Modifier\n" |
| 6398 | "Soft reconfig\n") |
| 6399 | { |
| 6400 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 6401 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6402 | } |
| 6403 | |
| 6404 | DEFUN (clear_bgp_peer_soft, |
| 6405 | clear_bgp_peer_soft_cmd, |
| 6406 | "clear bgp (A.B.C.D|X:X::X:X) soft", |
| 6407 | CLEAR_STR |
| 6408 | BGP_STR |
| 6409 | "BGP neighbor address to clear\n" |
| 6410 | "BGP IPv6 neighbor to clear\n" |
| 6411 | "Soft reconfig\n") |
| 6412 | { |
| 6413 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6414 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6415 | } |
| 6416 | |
| 6417 | ALIAS (clear_bgp_peer_soft, |
| 6418 | clear_bgp_ipv6_peer_soft_cmd, |
| 6419 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft", |
| 6420 | CLEAR_STR |
| 6421 | BGP_STR |
| 6422 | "Address family\n" |
| 6423 | "BGP neighbor address to clear\n" |
| 6424 | "BGP IPv6 neighbor to clear\n" |
| 6425 | "Soft reconfig\n") |
| 6426 | |
| 6427 | DEFUN (clear_ip_bgp_peer_group_soft, |
| 6428 | clear_ip_bgp_peer_group_soft_cmd, |
| 6429 | "clear ip bgp peer-group WORD soft", |
| 6430 | CLEAR_STR |
| 6431 | IP_STR |
| 6432 | BGP_STR |
| 6433 | "Clear all members of peer-group\n" |
| 6434 | "BGP peer-group name\n" |
| 6435 | "Soft reconfig\n") |
| 6436 | { |
| 6437 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6438 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6439 | } |
| 6440 | |
| 6441 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
| 6442 | clear_ip_bgp_peer_group_ipv4_soft_cmd, |
| 6443 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", |
| 6444 | CLEAR_STR |
| 6445 | IP_STR |
| 6446 | BGP_STR |
| 6447 | "Clear all members of peer-group\n" |
| 6448 | "BGP peer-group name\n" |
| 6449 | "Address family\n" |
| 6450 | "Address Family modifier\n" |
| 6451 | "Address Family modifier\n" |
| 6452 | "Soft reconfig\n") |
| 6453 | { |
| 6454 | if (strncmp (argv[1], "m", 1) == 0) |
| 6455 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 6456 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6457 | |
| 6458 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6459 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6460 | } |
| 6461 | |
| 6462 | DEFUN (clear_bgp_peer_group_soft, |
| 6463 | clear_bgp_peer_group_soft_cmd, |
| 6464 | "clear bgp peer-group WORD soft", |
| 6465 | CLEAR_STR |
| 6466 | BGP_STR |
| 6467 | "Clear all members of peer-group\n" |
| 6468 | "BGP peer-group name\n" |
| 6469 | "Soft reconfig\n") |
| 6470 | { |
| 6471 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 6472 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6473 | } |
| 6474 | |
| 6475 | ALIAS (clear_bgp_peer_group_soft, |
| 6476 | clear_bgp_ipv6_peer_group_soft_cmd, |
| 6477 | "clear bgp ipv6 peer-group WORD soft", |
| 6478 | CLEAR_STR |
| 6479 | BGP_STR |
| 6480 | "Address family\n" |
| 6481 | "Clear all members of peer-group\n" |
| 6482 | "BGP peer-group name\n" |
| 6483 | "Soft reconfig\n") |
| 6484 | |
| 6485 | DEFUN (clear_ip_bgp_external_soft, |
| 6486 | clear_ip_bgp_external_soft_cmd, |
| 6487 | "clear ip bgp external soft", |
| 6488 | CLEAR_STR |
| 6489 | IP_STR |
| 6490 | BGP_STR |
| 6491 | "Clear all external peers\n" |
| 6492 | "Soft reconfig\n") |
| 6493 | { |
| 6494 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6495 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6496 | } |
| 6497 | |
| 6498 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
| 6499 | clear_ip_bgp_external_ipv4_soft_cmd, |
| 6500 | "clear ip bgp external ipv4 (unicast|multicast) soft", |
| 6501 | CLEAR_STR |
| 6502 | IP_STR |
| 6503 | BGP_STR |
| 6504 | "Clear all external peers\n" |
| 6505 | "Address family\n" |
| 6506 | "Address Family modifier\n" |
| 6507 | "Address Family modifier\n" |
| 6508 | "Soft reconfig\n") |
| 6509 | { |
| 6510 | if (strncmp (argv[0], "m", 1) == 0) |
| 6511 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 6512 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6513 | |
| 6514 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6515 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6516 | } |
| 6517 | |
| 6518 | DEFUN (clear_bgp_external_soft, |
| 6519 | clear_bgp_external_soft_cmd, |
| 6520 | "clear bgp external soft", |
| 6521 | CLEAR_STR |
| 6522 | BGP_STR |
| 6523 | "Clear all external peers\n" |
| 6524 | "Soft reconfig\n") |
| 6525 | { |
| 6526 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 6527 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6528 | } |
| 6529 | |
| 6530 | ALIAS (clear_bgp_external_soft, |
| 6531 | clear_bgp_ipv6_external_soft_cmd, |
| 6532 | "clear bgp ipv6 external soft", |
| 6533 | CLEAR_STR |
| 6534 | BGP_STR |
| 6535 | "Address family\n" |
| 6536 | "Clear all external peers\n" |
| 6537 | "Soft reconfig\n") |
| 6538 | |
| 6539 | DEFUN (clear_ip_bgp_as_soft, |
| 6540 | clear_ip_bgp_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6541 | "clear ip bgp " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6542 | CLEAR_STR |
| 6543 | IP_STR |
| 6544 | BGP_STR |
| 6545 | "Clear peers with the AS number\n" |
| 6546 | "Soft reconfig\n") |
| 6547 | { |
| 6548 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6549 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6550 | } |
| 6551 | |
| 6552 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
| 6553 | clear_ip_bgp_as_ipv4_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6554 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6555 | CLEAR_STR |
| 6556 | IP_STR |
| 6557 | BGP_STR |
| 6558 | "Clear peers with the AS number\n" |
| 6559 | "Address family\n" |
| 6560 | "Address Family Modifier\n" |
| 6561 | "Address Family Modifier\n" |
| 6562 | "Soft reconfig\n") |
| 6563 | { |
| 6564 | if (strncmp (argv[1], "m", 1) == 0) |
| 6565 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6566 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6567 | |
| 6568 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, |
| 6569 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6570 | } |
| 6571 | |
| 6572 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
| 6573 | clear_ip_bgp_as_vpnv4_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6574 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6575 | CLEAR_STR |
| 6576 | IP_STR |
| 6577 | BGP_STR |
| 6578 | "Clear peers with the AS number\n" |
| 6579 | "Address family\n" |
| 6580 | "Address Family Modifier\n" |
| 6581 | "Soft reconfig\n") |
| 6582 | { |
| 6583 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 6584 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6585 | } |
| 6586 | |
| 6587 | DEFUN (clear_bgp_as_soft, |
| 6588 | clear_bgp_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6589 | "clear bgp " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6590 | CLEAR_STR |
| 6591 | BGP_STR |
| 6592 | "Clear peers with the AS number\n" |
| 6593 | "Soft reconfig\n") |
| 6594 | { |
| 6595 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6596 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6597 | } |
| 6598 | |
| 6599 | ALIAS (clear_bgp_as_soft, |
| 6600 | clear_bgp_ipv6_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6601 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6602 | CLEAR_STR |
| 6603 | BGP_STR |
| 6604 | "Address family\n" |
| 6605 | "Clear peers with the AS number\n" |
| 6606 | "Soft reconfig\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 6607 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6608 | /* RS-client soft reconfiguration. */ |
| 6609 | #ifdef HAVE_IPV6 |
| 6610 | DEFUN (clear_bgp_all_rsclient, |
| 6611 | clear_bgp_all_rsclient_cmd, |
| 6612 | "clear bgp * rsclient", |
| 6613 | CLEAR_STR |
| 6614 | BGP_STR |
| 6615 | "Clear all peers\n" |
| 6616 | "Soft reconfig for rsclient RIB\n") |
| 6617 | { |
| 6618 | if (argc == 1) |
| 6619 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6620 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6621 | |
| 6622 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6623 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6624 | } |
| 6625 | |
| 6626 | ALIAS (clear_bgp_all_rsclient, |
| 6627 | clear_bgp_ipv6_all_rsclient_cmd, |
| 6628 | "clear bgp ipv6 * rsclient", |
| 6629 | CLEAR_STR |
| 6630 | BGP_STR |
| 6631 | "Address family\n" |
| 6632 | "Clear all peers\n" |
| 6633 | "Soft reconfig for rsclient RIB\n") |
| 6634 | |
| 6635 | ALIAS (clear_bgp_all_rsclient, |
| 6636 | clear_bgp_instance_all_rsclient_cmd, |
| 6637 | "clear bgp view WORD * rsclient", |
| 6638 | CLEAR_STR |
| 6639 | BGP_STR |
| 6640 | "BGP view\n" |
| 6641 | "view name\n" |
| 6642 | "Clear all peers\n" |
| 6643 | "Soft reconfig for rsclient RIB\n") |
| 6644 | |
| 6645 | ALIAS (clear_bgp_all_rsclient, |
| 6646 | clear_bgp_ipv6_instance_all_rsclient_cmd, |
| 6647 | "clear bgp ipv6 view WORD * rsclient", |
| 6648 | CLEAR_STR |
| 6649 | BGP_STR |
| 6650 | "Address family\n" |
| 6651 | "BGP view\n" |
| 6652 | "view name\n" |
| 6653 | "Clear all peers\n" |
| 6654 | "Soft reconfig for rsclient RIB\n") |
| 6655 | #endif /* HAVE_IPV6 */ |
| 6656 | |
| 6657 | DEFUN (clear_ip_bgp_all_rsclient, |
| 6658 | clear_ip_bgp_all_rsclient_cmd, |
| 6659 | "clear ip bgp * rsclient", |
| 6660 | CLEAR_STR |
| 6661 | IP_STR |
| 6662 | BGP_STR |
| 6663 | "Clear all peers\n" |
| 6664 | "Soft reconfig for rsclient RIB\n") |
| 6665 | { |
| 6666 | if (argc == 1) |
| 6667 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6668 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6669 | |
| 6670 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6671 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6672 | } |
| 6673 | |
| 6674 | ALIAS (clear_ip_bgp_all_rsclient, |
| 6675 | clear_ip_bgp_instance_all_rsclient_cmd, |
| 6676 | "clear ip bgp view WORD * rsclient", |
| 6677 | CLEAR_STR |
| 6678 | IP_STR |
| 6679 | BGP_STR |
| 6680 | "BGP view\n" |
| 6681 | "view name\n" |
| 6682 | "Clear all peers\n" |
| 6683 | "Soft reconfig for rsclient RIB\n") |
| 6684 | |
| 6685 | #ifdef HAVE_IPV6 |
| 6686 | DEFUN (clear_bgp_peer_rsclient, |
| 6687 | clear_bgp_peer_rsclient_cmd, |
| 6688 | "clear bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6689 | CLEAR_STR |
| 6690 | BGP_STR |
| 6691 | "BGP neighbor IP address to clear\n" |
| 6692 | "BGP IPv6 neighbor to clear\n" |
| 6693 | "Soft reconfig for rsclient RIB\n") |
| 6694 | { |
| 6695 | if (argc == 2) |
| 6696 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6697 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6698 | |
| 6699 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6700 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6701 | } |
| 6702 | |
| 6703 | ALIAS (clear_bgp_peer_rsclient, |
| 6704 | clear_bgp_ipv6_peer_rsclient_cmd, |
| 6705 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient", |
| 6706 | CLEAR_STR |
| 6707 | BGP_STR |
| 6708 | "Address family\n" |
| 6709 | "BGP neighbor IP address to clear\n" |
| 6710 | "BGP IPv6 neighbor to clear\n" |
| 6711 | "Soft reconfig for rsclient RIB\n") |
| 6712 | |
| 6713 | ALIAS (clear_bgp_peer_rsclient, |
| 6714 | clear_bgp_instance_peer_rsclient_cmd, |
| 6715 | "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6716 | CLEAR_STR |
| 6717 | BGP_STR |
| 6718 | "BGP view\n" |
| 6719 | "view name\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_ipv6_instance_peer_rsclient_cmd, |
| 6726 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6727 | CLEAR_STR |
| 6728 | BGP_STR |
| 6729 | "Address family\n" |
| 6730 | "BGP view\n" |
| 6731 | "view name\n" |
| 6732 | "BGP neighbor IP address to clear\n" |
| 6733 | "BGP IPv6 neighbor to clear\n" |
| 6734 | "Soft reconfig for rsclient RIB\n") |
| 6735 | #endif /* HAVE_IPV6 */ |
| 6736 | |
| 6737 | DEFUN (clear_ip_bgp_peer_rsclient, |
| 6738 | clear_ip_bgp_peer_rsclient_cmd, |
| 6739 | "clear ip bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6740 | CLEAR_STR |
| 6741 | IP_STR |
| 6742 | BGP_STR |
| 6743 | "BGP neighbor IP address to clear\n" |
| 6744 | "BGP IPv6 neighbor to clear\n" |
| 6745 | "Soft reconfig for rsclient RIB\n") |
| 6746 | { |
| 6747 | if (argc == 2) |
| 6748 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, |
| 6749 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6750 | |
| 6751 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6752 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6753 | } |
| 6754 | |
| 6755 | ALIAS (clear_ip_bgp_peer_rsclient, |
| 6756 | clear_ip_bgp_instance_peer_rsclient_cmd, |
| 6757 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6758 | CLEAR_STR |
| 6759 | IP_STR |
| 6760 | BGP_STR |
| 6761 | "BGP view\n" |
| 6762 | "view name\n" |
| 6763 | "BGP neighbor IP address to clear\n" |
| 6764 | "BGP IPv6 neighbor to clear\n" |
| 6765 | "Soft reconfig for rsclient RIB\n") |
| 6766 | |
Michael Lambert | e0081f7 | 2008-11-16 20:12:04 +0000 | [diff] [blame] | 6767 | DEFUN (show_bgp_views, |
| 6768 | show_bgp_views_cmd, |
| 6769 | "show bgp views", |
| 6770 | SHOW_STR |
| 6771 | BGP_STR |
| 6772 | "Show the defined BGP views\n") |
| 6773 | { |
| 6774 | struct list *inst = bm->bgp; |
| 6775 | struct listnode *node; |
| 6776 | struct bgp *bgp; |
| 6777 | |
| 6778 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) |
| 6779 | { |
| 6780 | vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE); |
| 6781 | return CMD_WARNING; |
| 6782 | } |
| 6783 | |
| 6784 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); |
| 6785 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) |
| 6786 | vty_out (vty, "\t%s (AS%u)%s", |
| 6787 | bgp->name ? bgp->name : "(null)", |
| 6788 | bgp->as, VTY_NEWLINE); |
| 6789 | |
| 6790 | return CMD_SUCCESS; |
| 6791 | } |
| 6792 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6793 | DEFUN (show_bgp_memory, |
| 6794 | show_bgp_memory_cmd, |
| 6795 | "show bgp memory", |
| 6796 | SHOW_STR |
| 6797 | BGP_STR |
| 6798 | "Global BGP memory statistics\n") |
| 6799 | { |
| 6800 | char memstrbuf[MTYPE_MEMSTR_LEN]; |
| 6801 | unsigned long count; |
| 6802 | |
| 6803 | /* RIB related usage stats */ |
| 6804 | count = mtype_stats_alloc (MTYPE_BGP_NODE); |
| 6805 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, |
| 6806 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6807 | count * sizeof (struct bgp_node)), |
| 6808 | VTY_NEWLINE); |
| 6809 | |
| 6810 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); |
| 6811 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, |
| 6812 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6813 | count * sizeof (struct bgp_info)), |
| 6814 | VTY_NEWLINE); |
Paul Jakma | fb982c2 | 2007-05-04 20:15:47 +0000 | [diff] [blame] | 6815 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
| 6816 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, |
| 6817 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6818 | count * sizeof (struct bgp_info_extra)), |
| 6819 | VTY_NEWLINE); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6820 | |
| 6821 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) |
| 6822 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, |
| 6823 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6824 | count * sizeof (struct bgp_static)), |
| 6825 | VTY_NEWLINE); |
| 6826 | |
| 6827 | /* Adj-In/Out */ |
| 6828 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) |
| 6829 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, |
| 6830 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6831 | count * sizeof (struct bgp_adj_in)), |
| 6832 | VTY_NEWLINE); |
| 6833 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) |
| 6834 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, |
| 6835 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6836 | count * sizeof (struct bgp_adj_out)), |
| 6837 | VTY_NEWLINE); |
| 6838 | |
| 6839 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) |
| 6840 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, |
| 6841 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6842 | count * sizeof (struct bgp_nexthop_cache)), |
| 6843 | VTY_NEWLINE); |
| 6844 | |
| 6845 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) |
| 6846 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, |
| 6847 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6848 | count * sizeof (struct bgp_damp_info)), |
| 6849 | VTY_NEWLINE); |
| 6850 | |
| 6851 | /* Attributes */ |
| 6852 | count = attr_count(); |
| 6853 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, |
| 6854 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6855 | count * sizeof(struct attr)), |
| 6856 | VTY_NEWLINE); |
Paul Jakma | fb982c2 | 2007-05-04 20:15:47 +0000 | [diff] [blame] | 6857 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
| 6858 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, |
| 6859 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6860 | count * sizeof(struct attr_extra)), |
| 6861 | VTY_NEWLINE); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6862 | |
| 6863 | if ((count = attr_unknown_count())) |
| 6864 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); |
| 6865 | |
| 6866 | /* AS_PATH attributes */ |
| 6867 | count = aspath_count (); |
| 6868 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, |
| 6869 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6870 | count * sizeof (struct aspath)), |
| 6871 | VTY_NEWLINE); |
| 6872 | |
| 6873 | count = mtype_stats_alloc (MTYPE_AS_SEG); |
| 6874 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, |
| 6875 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6876 | count * sizeof (struct assegment)), |
| 6877 | VTY_NEWLINE); |
| 6878 | |
| 6879 | /* Other attributes */ |
| 6880 | if ((count = community_count ())) |
| 6881 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, |
| 6882 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6883 | count * sizeof (struct community)), |
| 6884 | VTY_NEWLINE); |
| 6885 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) |
| 6886 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, |
| 6887 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6888 | count * sizeof (struct ecommunity)), |
| 6889 | VTY_NEWLINE); |
| 6890 | |
| 6891 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) |
| 6892 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, |
| 6893 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6894 | count * sizeof (struct cluster_list)), |
| 6895 | VTY_NEWLINE); |
| 6896 | |
| 6897 | /* Peer related usage */ |
| 6898 | count = mtype_stats_alloc (MTYPE_BGP_PEER); |
| 6899 | vty_out (vty, "%ld peers, using %s of memory%s", count, |
| 6900 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6901 | count * sizeof (struct peer)), |
| 6902 | VTY_NEWLINE); |
| 6903 | |
| 6904 | if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP))) |
| 6905 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, |
| 6906 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6907 | count * sizeof (struct peer_group)), |
| 6908 | VTY_NEWLINE); |
| 6909 | |
| 6910 | /* Other */ |
| 6911 | if ((count = mtype_stats_alloc (MTYPE_HASH))) |
| 6912 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, |
| 6913 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6914 | count * sizeof (struct hash)), |
| 6915 | VTY_NEWLINE); |
| 6916 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) |
| 6917 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, |
| 6918 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6919 | count * sizeof (struct hash_backet)), |
| 6920 | VTY_NEWLINE); |
| 6921 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) |
| 6922 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, |
| 6923 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6924 | count * sizeof (regex_t)), |
| 6925 | VTY_NEWLINE); |
| 6926 | return CMD_SUCCESS; |
| 6927 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6928 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6929 | /* Show BGP peer's summary information. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6930 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6931 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) |
| 6932 | { |
| 6933 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6934 | struct listnode *node, *nnode; |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6935 | unsigned int count = 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6936 | char timebuf[BGP_UPTIME_LEN]; |
| 6937 | int len; |
| 6938 | |
| 6939 | /* Header string for each address family. */ |
Milan Kocian | cb4fc59 | 2014-12-01 12:48:25 +0000 | [diff] [blame] | 6940 | 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] | 6941 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6942 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6943 | { |
| 6944 | if (peer->afc[afi][safi]) |
| 6945 | { |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6946 | if (!count) |
| 6947 | { |
| 6948 | unsigned long ents; |
| 6949 | char memstrbuf[MTYPE_MEMSTR_LEN]; |
| 6950 | |
| 6951 | /* Usage summary and header */ |
| 6952 | vty_out (vty, |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 6953 | "BGP router identifier %s, local AS number %u%s", |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6954 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6955 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6956 | ents = bgp_table_count (bgp->rib[afi][safi]); |
| 6957 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, |
| 6958 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6959 | ents * sizeof (struct bgp_node)), |
| 6960 | VTY_NEWLINE); |
| 6961 | |
| 6962 | /* Peer related usage */ |
| 6963 | ents = listcount (bgp->peer); |
| 6964 | vty_out (vty, "Peers %ld, using %s of memory%s", |
| 6965 | ents, |
| 6966 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6967 | ents * sizeof (struct peer)), |
| 6968 | VTY_NEWLINE); |
| 6969 | |
| 6970 | if ((ents = listcount (bgp->rsclient))) |
| 6971 | vty_out (vty, "RS-Client peers %ld, using %s of memory%s", |
| 6972 | ents, |
| 6973 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6974 | ents * sizeof (struct peer)), |
| 6975 | VTY_NEWLINE); |
| 6976 | |
| 6977 | if ((ents = listcount (bgp->group))) |
| 6978 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, |
| 6979 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6980 | ents * sizeof (struct peer_group)), |
| 6981 | VTY_NEWLINE); |
| 6982 | |
| 6983 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
| 6984 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); |
| 6985 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6986 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 6987 | } |
| 6988 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6989 | count++; |
| 6990 | |
| 6991 | len = vty_out (vty, "%s", peer->host); |
| 6992 | len = 16 - len; |
| 6993 | if (len < 1) |
| 6994 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 6995 | else |
| 6996 | vty_out (vty, "%*s", len, " "); |
| 6997 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 6998 | vty_out (vty, "4 "); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6999 | |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 7000 | vty_out (vty, "%5u %7d %7d %8d %4d %4lu ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7001 | peer->as, |
| 7002 | peer->open_in + peer->update_in + peer->keepalive_in |
| 7003 | + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in, |
| 7004 | peer->open_out + peer->update_out + peer->keepalive_out |
| 7005 | + peer->notify_out + peer->refresh_out |
| 7006 | + peer->dynamic_cap_out, |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7007 | 0, 0, (unsigned long) peer->obuf->count); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7008 | |
| 7009 | vty_out (vty, "%8s", |
| 7010 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); |
| 7011 | |
| 7012 | if (peer->status == Established) |
| 7013 | { |
| 7014 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); |
| 7015 | } |
| 7016 | else |
| 7017 | { |
| 7018 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) |
| 7019 | vty_out (vty, " Idle (Admin)"); |
| 7020 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7021 | vty_out (vty, " Idle (PfxCt)"); |
| 7022 | else |
| 7023 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); |
| 7024 | } |
| 7025 | |
| 7026 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7027 | } |
| 7028 | } |
| 7029 | |
| 7030 | if (count) |
| 7031 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, |
| 7032 | count, VTY_NEWLINE); |
| 7033 | else |
| 7034 | vty_out (vty, "No %s neighbor is configured%s", |
| 7035 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 7036 | return CMD_SUCCESS; |
| 7037 | } |
| 7038 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7039 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7040 | bgp_show_summary_vty (struct vty *vty, const char *name, |
| 7041 | afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7042 | { |
| 7043 | struct bgp *bgp; |
| 7044 | |
| 7045 | if (name) |
| 7046 | { |
| 7047 | bgp = bgp_lookup_by_name (name); |
| 7048 | |
| 7049 | if (! bgp) |
| 7050 | { |
| 7051 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7052 | return CMD_WARNING; |
| 7053 | } |
| 7054 | |
| 7055 | bgp_show_summary (vty, bgp, afi, safi); |
| 7056 | return CMD_SUCCESS; |
| 7057 | } |
| 7058 | |
| 7059 | bgp = bgp_get_default (); |
| 7060 | |
| 7061 | if (bgp) |
| 7062 | bgp_show_summary (vty, bgp, afi, safi); |
| 7063 | |
| 7064 | return CMD_SUCCESS; |
| 7065 | } |
| 7066 | |
| 7067 | /* `show ip bgp summary' commands. */ |
| 7068 | DEFUN (show_ip_bgp_summary, |
| 7069 | show_ip_bgp_summary_cmd, |
| 7070 | "show ip bgp summary", |
| 7071 | SHOW_STR |
| 7072 | IP_STR |
| 7073 | BGP_STR |
| 7074 | "Summary of BGP neighbor status\n") |
| 7075 | { |
| 7076 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 7077 | } |
| 7078 | |
| 7079 | DEFUN (show_ip_bgp_instance_summary, |
| 7080 | show_ip_bgp_instance_summary_cmd, |
| 7081 | "show ip bgp view WORD summary", |
| 7082 | SHOW_STR |
| 7083 | IP_STR |
| 7084 | BGP_STR |
| 7085 | "BGP view\n" |
| 7086 | "View name\n" |
| 7087 | "Summary of BGP neighbor status\n") |
| 7088 | { |
| 7089 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 7090 | } |
| 7091 | |
| 7092 | DEFUN (show_ip_bgp_ipv4_summary, |
| 7093 | show_ip_bgp_ipv4_summary_cmd, |
| 7094 | "show ip bgp ipv4 (unicast|multicast) summary", |
| 7095 | SHOW_STR |
| 7096 | IP_STR |
| 7097 | BGP_STR |
| 7098 | "Address family\n" |
| 7099 | "Address Family modifier\n" |
| 7100 | "Address Family modifier\n" |
| 7101 | "Summary of BGP neighbor status\n") |
| 7102 | { |
| 7103 | if (strncmp (argv[0], "m", 1) == 0) |
| 7104 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 7105 | |
| 7106 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 7107 | } |
| 7108 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 7109 | ALIAS (show_ip_bgp_ipv4_summary, |
| 7110 | show_bgp_ipv4_safi_summary_cmd, |
| 7111 | "show bgp ipv4 (unicast|multicast) summary", |
| 7112 | SHOW_STR |
| 7113 | BGP_STR |
| 7114 | "Address family\n" |
| 7115 | "Address Family modifier\n" |
| 7116 | "Address Family modifier\n" |
| 7117 | "Summary of BGP neighbor status\n") |
| 7118 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7119 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
| 7120 | show_ip_bgp_instance_ipv4_summary_cmd, |
| 7121 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", |
| 7122 | SHOW_STR |
| 7123 | IP_STR |
| 7124 | BGP_STR |
| 7125 | "BGP view\n" |
| 7126 | "View name\n" |
| 7127 | "Address family\n" |
| 7128 | "Address Family modifier\n" |
| 7129 | "Address Family modifier\n" |
| 7130 | "Summary of BGP neighbor status\n") |
| 7131 | { |
| 7132 | if (strncmp (argv[1], "m", 1) == 0) |
| 7133 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 7134 | else |
| 7135 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 7136 | } |
| 7137 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 7138 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
| 7139 | show_bgp_instance_ipv4_safi_summary_cmd, |
| 7140 | "show bgp view WORD ipv4 (unicast|multicast) summary", |
| 7141 | SHOW_STR |
| 7142 | BGP_STR |
| 7143 | "BGP view\n" |
| 7144 | "View name\n" |
| 7145 | "Address family\n" |
| 7146 | "Address Family modifier\n" |
| 7147 | "Address Family modifier\n" |
| 7148 | "Summary of BGP neighbor status\n") |
| 7149 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7150 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
| 7151 | show_ip_bgp_vpnv4_all_summary_cmd, |
| 7152 | "show ip bgp vpnv4 all summary", |
| 7153 | SHOW_STR |
| 7154 | IP_STR |
| 7155 | BGP_STR |
| 7156 | "Display VPNv4 NLRI specific information\n" |
| 7157 | "Display information about all VPNv4 NLRIs\n" |
| 7158 | "Summary of BGP neighbor status\n") |
| 7159 | { |
| 7160 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 7161 | } |
| 7162 | |
| 7163 | DEFUN (show_ip_bgp_vpnv4_rd_summary, |
| 7164 | show_ip_bgp_vpnv4_rd_summary_cmd, |
| 7165 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", |
| 7166 | SHOW_STR |
| 7167 | IP_STR |
| 7168 | BGP_STR |
| 7169 | "Display VPNv4 NLRI specific information\n" |
| 7170 | "Display information for a route distinguisher\n" |
| 7171 | "VPN Route Distinguisher\n" |
| 7172 | "Summary of BGP neighbor status\n") |
| 7173 | { |
| 7174 | int ret; |
| 7175 | struct prefix_rd prd; |
| 7176 | |
| 7177 | ret = str2prefix_rd (argv[0], &prd); |
| 7178 | if (! ret) |
| 7179 | { |
| 7180 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); |
| 7181 | return CMD_WARNING; |
| 7182 | } |
| 7183 | |
| 7184 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 7185 | } |
| 7186 | |
| 7187 | #ifdef HAVE_IPV6 |
| 7188 | DEFUN (show_bgp_summary, |
| 7189 | show_bgp_summary_cmd, |
| 7190 | "show bgp summary", |
| 7191 | SHOW_STR |
| 7192 | BGP_STR |
| 7193 | "Summary of BGP neighbor status\n") |
| 7194 | { |
| 7195 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7196 | } |
| 7197 | |
| 7198 | DEFUN (show_bgp_instance_summary, |
| 7199 | show_bgp_instance_summary_cmd, |
| 7200 | "show bgp view WORD summary", |
| 7201 | SHOW_STR |
| 7202 | BGP_STR |
| 7203 | "BGP view\n" |
| 7204 | "View name\n" |
| 7205 | "Summary of BGP neighbor status\n") |
| 7206 | { |
| 7207 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 7208 | } |
| 7209 | |
| 7210 | ALIAS (show_bgp_summary, |
| 7211 | show_bgp_ipv6_summary_cmd, |
| 7212 | "show bgp ipv6 summary", |
| 7213 | SHOW_STR |
| 7214 | BGP_STR |
| 7215 | "Address family\n" |
| 7216 | "Summary of BGP neighbor status\n") |
| 7217 | |
| 7218 | ALIAS (show_bgp_instance_summary, |
| 7219 | show_bgp_instance_ipv6_summary_cmd, |
| 7220 | "show bgp view WORD ipv6 summary", |
| 7221 | SHOW_STR |
| 7222 | BGP_STR |
| 7223 | "BGP view\n" |
| 7224 | "View name\n" |
| 7225 | "Address family\n" |
| 7226 | "Summary of BGP neighbor status\n") |
| 7227 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 7228 | DEFUN (show_bgp_ipv6_safi_summary, |
| 7229 | show_bgp_ipv6_safi_summary_cmd, |
| 7230 | "show bgp ipv6 (unicast|multicast) summary", |
| 7231 | SHOW_STR |
| 7232 | BGP_STR |
| 7233 | "Address family\n" |
| 7234 | "Address Family modifier\n" |
| 7235 | "Address Family modifier\n" |
| 7236 | "Summary of BGP neighbor status\n") |
| 7237 | { |
| 7238 | if (strncmp (argv[0], "m", 1) == 0) |
| 7239 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 7240 | |
| 7241 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7242 | } |
| 7243 | |
| 7244 | DEFUN (show_bgp_instance_ipv6_safi_summary, |
| 7245 | show_bgp_instance_ipv6_safi_summary_cmd, |
| 7246 | "show bgp view WORD ipv6 (unicast|multicast) summary", |
| 7247 | SHOW_STR |
| 7248 | BGP_STR |
| 7249 | "BGP view\n" |
| 7250 | "View name\n" |
| 7251 | "Address family\n" |
| 7252 | "Address Family modifier\n" |
| 7253 | "Address Family modifier\n" |
| 7254 | "Summary of BGP neighbor status\n") |
| 7255 | { |
| 7256 | if (strncmp (argv[1], "m", 1) == 0) |
| 7257 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST); |
| 7258 | |
| 7259 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 7260 | } |
| 7261 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7262 | /* old command */ |
| 7263 | DEFUN (show_ipv6_bgp_summary, |
| 7264 | show_ipv6_bgp_summary_cmd, |
| 7265 | "show ipv6 bgp summary", |
| 7266 | SHOW_STR |
| 7267 | IPV6_STR |
| 7268 | BGP_STR |
| 7269 | "Summary of BGP neighbor status\n") |
| 7270 | { |
| 7271 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7272 | } |
| 7273 | |
| 7274 | /* old command */ |
| 7275 | DEFUN (show_ipv6_mbgp_summary, |
| 7276 | show_ipv6_mbgp_summary_cmd, |
| 7277 | "show ipv6 mbgp summary", |
| 7278 | SHOW_STR |
| 7279 | IPV6_STR |
| 7280 | MBGP_STR |
| 7281 | "Summary of BGP neighbor status\n") |
| 7282 | { |
| 7283 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 7284 | } |
| 7285 | #endif /* HAVE_IPV6 */ |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 7286 | |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7287 | const char * |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7288 | afi_safi_print (afi_t afi, safi_t safi) |
| 7289 | { |
| 7290 | if (afi == AFI_IP && safi == SAFI_UNICAST) |
| 7291 | return "IPv4 Unicast"; |
| 7292 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) |
| 7293 | return "IPv4 Multicast"; |
| 7294 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) |
| 7295 | return "VPNv4 Unicast"; |
| 7296 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) |
| 7297 | return "IPv6 Unicast"; |
| 7298 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) |
| 7299 | return "IPv6 Multicast"; |
| 7300 | else |
| 7301 | return "Unknown"; |
| 7302 | } |
| 7303 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7304 | /* Show BGP peer's information. */ |
| 7305 | enum show_type |
| 7306 | { |
| 7307 | show_all, |
| 7308 | show_peer |
| 7309 | }; |
| 7310 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7311 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7312 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
| 7313 | afi_t afi, safi_t safi, |
| 7314 | u_int16_t adv_smcap, u_int16_t adv_rmcap, |
| 7315 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) |
| 7316 | { |
| 7317 | /* Send-Mode */ |
| 7318 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) |
| 7319 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 7320 | { |
| 7321 | vty_out (vty, " Send-mode: "); |
| 7322 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) |
| 7323 | vty_out (vty, "advertised"); |
| 7324 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 7325 | vty_out (vty, "%sreceived", |
| 7326 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? |
| 7327 | ", " : ""); |
| 7328 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7329 | } |
| 7330 | |
| 7331 | /* Receive-Mode */ |
| 7332 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) |
| 7333 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 7334 | { |
| 7335 | vty_out (vty, " Receive-mode: "); |
| 7336 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) |
| 7337 | vty_out (vty, "advertised"); |
| 7338 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 7339 | vty_out (vty, "%sreceived", |
| 7340 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? |
| 7341 | ", " : ""); |
| 7342 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7343 | } |
| 7344 | } |
| 7345 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7346 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7347 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
| 7348 | { |
| 7349 | struct bgp_filter *filter; |
| 7350 | char orf_pfx_name[BUFSIZ]; |
| 7351 | int orf_pfx_count; |
| 7352 | |
| 7353 | filter = &p->filter[afi][safi]; |
| 7354 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7355 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7356 | VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7357 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7358 | if (p->af_group[afi][safi]) |
| 7359 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
| 7360 | |
| 7361 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7362 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 7363 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 7364 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7365 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) |
| 7366 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 7367 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); |
| 7368 | |
| 7369 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7370 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 7371 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7372 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) |
| 7373 | { |
| 7374 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 7375 | ORF_TYPE_PREFIX, VTY_NEWLINE); |
| 7376 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 7377 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 7378 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 7379 | PEER_CAP_ORF_PREFIX_SM_RCV, |
| 7380 | PEER_CAP_ORF_PREFIX_RM_RCV); |
| 7381 | } |
| 7382 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7383 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 7384 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7385 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 7386 | { |
| 7387 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 7388 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); |
| 7389 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 7390 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 7391 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 7392 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, |
| 7393 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); |
| 7394 | } |
| 7395 | |
| 7396 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
| 7397 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); |
| 7398 | |
| 7399 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
| 7400 | || orf_pfx_count) |
| 7401 | { |
| 7402 | vty_out (vty, " Outbound Route Filter (ORF):"); |
| 7403 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) |
| 7404 | vty_out (vty, " sent;"); |
| 7405 | if (orf_pfx_count) |
| 7406 | vty_out (vty, " received (%d entries)", orf_pfx_count); |
| 7407 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7408 | } |
| 7409 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) |
| 7410 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); |
| 7411 | |
| 7412 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) |
| 7413 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); |
| 7414 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 7415 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); |
| 7416 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) |
| 7417 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); |
| 7418 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
| 7419 | vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE); |
| 7420 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) |
| 7421 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); |
| 7422 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) |
| 7423 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7424 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) |
| 7425 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7426 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) |
| 7427 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7428 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 7429 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
| 7430 | { |
| 7431 | vty_out (vty, " Community attribute sent to this neighbor"); |
| 7432 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 7433 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7434 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7435 | 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] | 7436 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7437 | else |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7438 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7439 | } |
| 7440 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) |
| 7441 | { |
| 7442 | vty_out (vty, " Default information originate,"); |
| 7443 | |
| 7444 | if (p->default_rmap[afi][safi].name) |
| 7445 | vty_out (vty, " default route-map %s%s,", |
| 7446 | p->default_rmap[afi][safi].map ? "*" : "", |
| 7447 | p->default_rmap[afi][safi].name); |
| 7448 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) |
| 7449 | vty_out (vty, " default sent%s", VTY_NEWLINE); |
| 7450 | else |
| 7451 | vty_out (vty, " default not sent%s", VTY_NEWLINE); |
| 7452 | } |
| 7453 | |
| 7454 | if (filter->plist[FILTER_IN].name |
| 7455 | || filter->dlist[FILTER_IN].name |
| 7456 | || filter->aslist[FILTER_IN].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7457 | || filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7458 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
| 7459 | if (filter->plist[FILTER_OUT].name |
| 7460 | || filter->dlist[FILTER_OUT].name |
| 7461 | || filter->aslist[FILTER_OUT].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7462 | || filter->map[RMAP_OUT].name |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7463 | || filter->usmap.name) |
| 7464 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7465 | if (filter->map[RMAP_IMPORT].name) |
| 7466 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); |
| 7467 | if (filter->map[RMAP_EXPORT].name) |
| 7468 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7469 | |
| 7470 | /* prefix-list */ |
| 7471 | if (filter->plist[FILTER_IN].name) |
| 7472 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", |
| 7473 | filter->plist[FILTER_IN].plist ? "*" : "", |
| 7474 | filter->plist[FILTER_IN].name, |
| 7475 | VTY_NEWLINE); |
| 7476 | if (filter->plist[FILTER_OUT].name) |
| 7477 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", |
| 7478 | filter->plist[FILTER_OUT].plist ? "*" : "", |
| 7479 | filter->plist[FILTER_OUT].name, |
| 7480 | VTY_NEWLINE); |
| 7481 | |
| 7482 | /* distribute-list */ |
| 7483 | if (filter->dlist[FILTER_IN].name) |
| 7484 | vty_out (vty, " Incoming update network filter list is %s%s%s", |
| 7485 | filter->dlist[FILTER_IN].alist ? "*" : "", |
| 7486 | filter->dlist[FILTER_IN].name, |
| 7487 | VTY_NEWLINE); |
| 7488 | if (filter->dlist[FILTER_OUT].name) |
| 7489 | vty_out (vty, " Outgoing update network filter list is %s%s%s", |
| 7490 | filter->dlist[FILTER_OUT].alist ? "*" : "", |
| 7491 | filter->dlist[FILTER_OUT].name, |
| 7492 | VTY_NEWLINE); |
| 7493 | |
| 7494 | /* filter-list. */ |
| 7495 | if (filter->aslist[FILTER_IN].name) |
| 7496 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", |
| 7497 | filter->aslist[FILTER_IN].aslist ? "*" : "", |
| 7498 | filter->aslist[FILTER_IN].name, |
| 7499 | VTY_NEWLINE); |
| 7500 | if (filter->aslist[FILTER_OUT].name) |
| 7501 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", |
| 7502 | filter->aslist[FILTER_OUT].aslist ? "*" : "", |
| 7503 | filter->aslist[FILTER_OUT].name, |
| 7504 | VTY_NEWLINE); |
| 7505 | |
| 7506 | /* route-map. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7507 | if (filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7508 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7509 | filter->map[RMAP_IN].map ? "*" : "", |
| 7510 | filter->map[RMAP_IN].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7511 | VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7512 | if (filter->map[RMAP_OUT].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7513 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7514 | filter->map[RMAP_OUT].map ? "*" : "", |
| 7515 | filter->map[RMAP_OUT].name, |
| 7516 | VTY_NEWLINE); |
| 7517 | if (filter->map[RMAP_IMPORT].name) |
| 7518 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", |
| 7519 | filter->map[RMAP_IMPORT].map ? "*" : "", |
| 7520 | filter->map[RMAP_IMPORT].name, |
| 7521 | VTY_NEWLINE); |
| 7522 | if (filter->map[RMAP_EXPORT].name) |
| 7523 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", |
| 7524 | filter->map[RMAP_EXPORT].map ? "*" : "", |
| 7525 | filter->map[RMAP_EXPORT].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7526 | VTY_NEWLINE); |
| 7527 | |
| 7528 | /* unsuppress-map */ |
| 7529 | if (filter->usmap.name) |
| 7530 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", |
| 7531 | filter->usmap.map ? "*" : "", |
| 7532 | filter->usmap.name, VTY_NEWLINE); |
| 7533 | |
| 7534 | /* Receive prefix count */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7535 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
| 7536 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7537 | /* Maximum prefix */ |
| 7538 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) |
| 7539 | { |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7540 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7541 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7542 | ? " (warning-only)" : "", VTY_NEWLINE); |
| 7543 | vty_out (vty, " Threshold for warning message %d%%", |
| 7544 | p->pmax_threshold[afi][safi]); |
| 7545 | if (p->pmax_restart[afi][safi]) |
| 7546 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); |
| 7547 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7548 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7549 | |
| 7550 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7551 | } |
| 7552 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7553 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7554 | bgp_show_peer (struct vty *vty, struct peer *p) |
| 7555 | { |
| 7556 | struct bgp *bgp; |
| 7557 | char buf1[BUFSIZ]; |
| 7558 | char timebuf[BGP_UPTIME_LEN]; |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7559 | afi_t afi; |
| 7560 | safi_t safi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7561 | |
| 7562 | bgp = p->bgp; |
| 7563 | |
| 7564 | /* Configured IP address. */ |
| 7565 | vty_out (vty, "BGP neighbor is %s, ", p->host); |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 7566 | vty_out (vty, "remote AS %u, ", p->as); |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 7567 | vty_out (vty, "local AS %u%s%s, ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7568 | p->change_local_as ? p->change_local_as : p->local_as, |
| 7569 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 7570 | " no-prepend" : "", |
| 7571 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? |
| 7572 | " replace-as" : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7573 | vty_out (vty, "%s link%s", |
| 7574 | p->as == p->local_as ? "internal" : "external", |
| 7575 | VTY_NEWLINE); |
| 7576 | |
| 7577 | /* Description. */ |
| 7578 | if (p->desc) |
| 7579 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); |
| 7580 | |
| 7581 | /* Peer-group */ |
| 7582 | if (p->group) |
| 7583 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
| 7584 | p->group->name, VTY_NEWLINE); |
| 7585 | |
| 7586 | /* Administrative shutdown. */ |
| 7587 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) |
| 7588 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); |
| 7589 | |
| 7590 | /* BGP Version. */ |
| 7591 | vty_out (vty, " BGP version 4"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7592 | vty_out (vty, ", remote router ID %s%s", |
| 7593 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), |
| 7594 | VTY_NEWLINE); |
| 7595 | |
| 7596 | /* Confederation */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7597 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
| 7598 | && bgp_confederation_peers_check (bgp, p->as)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7599 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
| 7600 | |
| 7601 | /* Status. */ |
| 7602 | vty_out (vty, " BGP state = %s", |
| 7603 | LOOKUP (bgp_status_msg, p->status)); |
| 7604 | if (p->status == Established) |
| 7605 | vty_out (vty, ", up for %8s", |
| 7606 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7607 | else if (p->status == Active) |
| 7608 | { |
| 7609 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) |
| 7610 | vty_out (vty, " (passive)"); |
| 7611 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) |
| 7612 | vty_out (vty, " (NSF passive)"); |
| 7613 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7614 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7615 | |
| 7616 | /* read timer */ |
| 7617 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); |
| 7618 | |
| 7619 | /* Configured timer values. */ |
| 7620 | vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s", |
| 7621 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); |
| 7622 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) |
| 7623 | { |
| 7624 | vty_out (vty, " Configured hold time is %d", p->holdtime); |
| 7625 | vty_out (vty, ", keepalive interval is %d seconds%s", |
| 7626 | p->keepalive, VTY_NEWLINE); |
| 7627 | } |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7628 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7629 | /* Capability. */ |
| 7630 | if (p->status == Established) |
| 7631 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7632 | if (p->cap |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7633 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
| 7634 | || p->afc_recv[AFI_IP][SAFI_UNICAST] |
| 7635 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] |
| 7636 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] |
| 7637 | #ifdef HAVE_IPV6 |
| 7638 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] |
| 7639 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] |
| 7640 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] |
| 7641 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] |
| 7642 | #endif /* HAVE_IPV6 */ |
| 7643 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] |
| 7644 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) |
| 7645 | { |
| 7646 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); |
| 7647 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7648 | /* AS4 */ |
| 7649 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) |
| 7650 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) |
| 7651 | { |
| 7652 | vty_out (vty, " 4 Byte AS:"); |
| 7653 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) |
| 7654 | vty_out (vty, " advertised"); |
| 7655 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) |
| 7656 | vty_out (vty, " %sreceived", |
| 7657 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); |
| 7658 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7659 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7660 | /* Dynamic */ |
| 7661 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) |
| 7662 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7663 | { |
| 7664 | vty_out (vty, " Dynamic:"); |
| 7665 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7666 | vty_out (vty, " advertised"); |
| 7667 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7668 | vty_out (vty, " %sreceived", |
| 7669 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7670 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7671 | } |
| 7672 | |
| 7673 | /* Route Refresh */ |
| 7674 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) |
| 7675 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7676 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
| 7677 | { |
| 7678 | vty_out (vty, " Route refresh:"); |
| 7679 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) |
| 7680 | vty_out (vty, " advertised"); |
| 7681 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7682 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7683 | vty_out (vty, " %sreceived(%s)", |
| 7684 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", |
| 7685 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) |
| 7686 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? |
| 7687 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); |
| 7688 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7689 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7690 | } |
| 7691 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7692 | /* Multiprotocol Extensions */ |
| 7693 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7694 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7695 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7696 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7697 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
| 7698 | if (p->afc_adv[afi][safi]) |
| 7699 | vty_out (vty, " advertised"); |
| 7700 | if (p->afc_recv[afi][safi]) |
| 7701 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); |
| 7702 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7703 | } |
| 7704 | |
| 7705 | /* Gracefull Restart */ |
| 7706 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7707 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7708 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7709 | vty_out (vty, " Graceful Restart Capabilty:"); |
| 7710 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7711 | vty_out (vty, " advertised"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7712 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
| 7713 | vty_out (vty, " %sreceived", |
| 7714 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7715 | vty_out (vty, "%s", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7716 | |
| 7717 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7718 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7719 | int restart_af_count = 0; |
| 7720 | |
| 7721 | vty_out (vty, " Remote Restart timer is %d seconds%s", |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7722 | p->v_gr_restart, VTY_NEWLINE); |
| 7723 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7724 | |
| 7725 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7726 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7727 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) |
| 7728 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7729 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
| 7730 | afi_safi_print (afi, safi), |
| 7731 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? |
| 7732 | "preserved" : "not preserved"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7733 | restart_af_count++; |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7734 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7735 | if (! restart_af_count) |
| 7736 | vty_out (vty, "none"); |
| 7737 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7738 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7739 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7740 | } |
| 7741 | } |
| 7742 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7743 | /* graceful restart information */ |
| 7744 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7745 | || p->t_gr_restart |
| 7746 | || p->t_gr_stale) |
| 7747 | { |
| 7748 | int eor_send_af_count = 0; |
| 7749 | int eor_receive_af_count = 0; |
| 7750 | |
| 7751 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); |
| 7752 | if (p->status == Established) |
| 7753 | { |
| 7754 | vty_out (vty, " End-of-RIB send: "); |
| 7755 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7756 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7757 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) |
| 7758 | { |
| 7759 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", |
| 7760 | afi_safi_print (afi, safi)); |
| 7761 | eor_send_af_count++; |
| 7762 | } |
| 7763 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7764 | |
| 7765 | vty_out (vty, " End-of-RIB received: "); |
| 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_RECEIVED)) |
| 7769 | { |
| 7770 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", |
| 7771 | afi_safi_print (afi, safi)); |
| 7772 | eor_receive_af_count++; |
| 7773 | } |
| 7774 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7775 | } |
| 7776 | |
| 7777 | if (p->t_gr_restart) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7778 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
| 7779 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); |
| 7780 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7781 | if (p->t_gr_stale) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7782 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
| 7783 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7784 | } |
| 7785 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7786 | /* Packet counts. */ |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7787 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
| 7788 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7789 | 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] | 7790 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
| 7791 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); |
| 7792 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); |
| 7793 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); |
| 7794 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); |
| 7795 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); |
| 7796 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); |
| 7797 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + |
| 7798 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, |
| 7799 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + |
| 7800 | p->dynamic_cap_in, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7801 | |
| 7802 | /* advertisement-interval */ |
| 7803 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", |
| 7804 | p->v_routeadv, VTY_NEWLINE); |
| 7805 | |
| 7806 | /* Update-source. */ |
| 7807 | if (p->update_if || p->update_source) |
| 7808 | { |
| 7809 | vty_out (vty, " Update source is "); |
| 7810 | if (p->update_if) |
| 7811 | vty_out (vty, "%s", p->update_if); |
| 7812 | else if (p->update_source) |
| 7813 | vty_out (vty, "%s", |
| 7814 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); |
| 7815 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7816 | } |
| 7817 | |
| 7818 | /* Default weight */ |
| 7819 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) |
| 7820 | vty_out (vty, " Default weight %d%s", p->weight, |
| 7821 | VTY_NEWLINE); |
| 7822 | |
| 7823 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7824 | |
| 7825 | /* Address Family Information */ |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7826 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7827 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7828 | if (p->afc[afi][safi]) |
| 7829 | bgp_show_peer_afi (vty, p, afi, safi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7830 | |
| 7831 | vty_out (vty, " Connections established %d; dropped %d%s", |
| 7832 | p->established, p->dropped, |
| 7833 | VTY_NEWLINE); |
| 7834 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7835 | if (! p->dropped) |
| 7836 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); |
| 7837 | else |
| 7838 | vty_out (vty, " Last reset %s, due to %s%s", |
| 7839 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), |
| 7840 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 7841 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7842 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7843 | { |
| 7844 | 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] | 7845 | |
| 7846 | if (p->t_pmax_restart) |
| 7847 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", |
| 7848 | p->host, thread_timer_remain_second (p->t_pmax_restart), |
| 7849 | VTY_NEWLINE); |
| 7850 | else |
| 7851 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", |
| 7852 | p->host, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7853 | } |
| 7854 | |
Stephen Hemminger | f5a4827 | 2011-03-24 17:30:21 +0000 | [diff] [blame] | 7855 | /* EBGP Multihop and GTSM */ |
Jorge Boncompte [DTI2] | 6d85b15 | 2012-05-07 16:52:54 +0000 | [diff] [blame] | 7856 | if (p->sort != BGP_PEER_IBGP) |
Stephen Hemminger | f5a4827 | 2011-03-24 17:30:21 +0000 | [diff] [blame] | 7857 | { |
| 7858 | if (p->gtsm_hops > 0) |
| 7859 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 7860 | p->gtsm_hops, VTY_NEWLINE); |
| 7861 | else if (p->ttl > 1) |
| 7862 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 7863 | p->ttl, VTY_NEWLINE); |
| 7864 | } |
Pradosh Mohapatra | 5d804b4 | 2013-09-12 03:37:07 +0000 | [diff] [blame] | 7865 | else |
| 7866 | { |
| 7867 | if (p->gtsm_hops > 0) |
| 7868 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", |
| 7869 | p->gtsm_hops, VTY_NEWLINE); |
| 7870 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7871 | |
| 7872 | /* Local address. */ |
| 7873 | if (p->su_local) |
| 7874 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7875 | vty_out (vty, "Local host: %s, Local port: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7876 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
| 7877 | ntohs (p->su_local->sin.sin_port), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7878 | VTY_NEWLINE); |
| 7879 | } |
| 7880 | |
| 7881 | /* Remote address. */ |
| 7882 | if (p->su_remote) |
| 7883 | { |
| 7884 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", |
| 7885 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
| 7886 | ntohs (p->su_remote->sin.sin_port), |
| 7887 | VTY_NEWLINE); |
| 7888 | } |
| 7889 | |
| 7890 | /* Nexthop display. */ |
| 7891 | if (p->su_local) |
| 7892 | { |
| 7893 | vty_out (vty, "Nexthop: %s%s", |
| 7894 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), |
| 7895 | VTY_NEWLINE); |
| 7896 | #ifdef HAVE_IPV6 |
| 7897 | vty_out (vty, "Nexthop global: %s%s", |
| 7898 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), |
| 7899 | VTY_NEWLINE); |
| 7900 | vty_out (vty, "Nexthop local: %s%s", |
| 7901 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), |
| 7902 | VTY_NEWLINE); |
| 7903 | vty_out (vty, "BGP connection: %s%s", |
| 7904 | p->shared_network ? "shared network" : "non shared network", |
| 7905 | VTY_NEWLINE); |
| 7906 | #endif /* HAVE_IPV6 */ |
| 7907 | } |
| 7908 | |
Timo Teräs | ef75770 | 2015-04-29 09:43:04 +0300 | [diff] [blame] | 7909 | /* TCP metrics. */ |
| 7910 | if (p->status == Established && p->rtt) |
| 7911 | vty_out (vty, "Estimated round trip time: %d ms%s", |
| 7912 | p->rtt, VTY_NEWLINE); |
| 7913 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7914 | /* Timer information. */ |
| 7915 | if (p->t_start) |
| 7916 | vty_out (vty, "Next start timer due in %ld seconds%s", |
| 7917 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); |
| 7918 | if (p->t_connect) |
| 7919 | vty_out (vty, "Next connect timer due in %ld seconds%s", |
| 7920 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); |
| 7921 | |
| 7922 | vty_out (vty, "Read thread: %s Write thread: %s%s", |
| 7923 | p->t_read ? "on" : "off", |
| 7924 | p->t_write ? "on" : "off", |
| 7925 | VTY_NEWLINE); |
| 7926 | |
| 7927 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR |
| 7928 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) |
| 7929 | bgp_capability_vty_out (vty, p); |
| 7930 | |
| 7931 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7932 | } |
| 7933 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7934 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7935 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
| 7936 | enum show_type type, union sockunion *su) |
| 7937 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7938 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7939 | struct peer *peer; |
| 7940 | int find = 0; |
| 7941 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7942 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7943 | { |
| 7944 | switch (type) |
| 7945 | { |
| 7946 | case show_all: |
| 7947 | bgp_show_peer (vty, peer); |
| 7948 | break; |
| 7949 | case show_peer: |
| 7950 | if (sockunion_same (&peer->su, su)) |
| 7951 | { |
| 7952 | find = 1; |
| 7953 | bgp_show_peer (vty, peer); |
| 7954 | } |
| 7955 | break; |
| 7956 | } |
| 7957 | } |
| 7958 | |
| 7959 | if (type == show_peer && ! find) |
| 7960 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); |
| 7961 | |
| 7962 | return CMD_SUCCESS; |
| 7963 | } |
| 7964 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7965 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7966 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
| 7967 | enum show_type type, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7968 | { |
| 7969 | int ret; |
| 7970 | struct bgp *bgp; |
| 7971 | union sockunion su; |
| 7972 | |
| 7973 | if (ip_str) |
| 7974 | { |
| 7975 | ret = str2sockunion (ip_str, &su); |
| 7976 | if (ret < 0) |
| 7977 | { |
| 7978 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 7979 | return CMD_WARNING; |
| 7980 | } |
| 7981 | } |
| 7982 | |
| 7983 | if (name) |
| 7984 | { |
| 7985 | bgp = bgp_lookup_by_name (name); |
| 7986 | |
| 7987 | if (! bgp) |
| 7988 | { |
| 7989 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7990 | return CMD_WARNING; |
| 7991 | } |
| 7992 | |
| 7993 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7994 | |
| 7995 | return CMD_SUCCESS; |
| 7996 | } |
| 7997 | |
| 7998 | bgp = bgp_get_default (); |
| 7999 | |
| 8000 | if (bgp) |
| 8001 | bgp_show_neighbor (vty, bgp, type, &su); |
| 8002 | |
| 8003 | return CMD_SUCCESS; |
| 8004 | } |
| 8005 | |
| 8006 | /* "show ip bgp neighbors" commands. */ |
| 8007 | DEFUN (show_ip_bgp_neighbors, |
| 8008 | show_ip_bgp_neighbors_cmd, |
| 8009 | "show ip bgp neighbors", |
| 8010 | SHOW_STR |
| 8011 | IP_STR |
| 8012 | BGP_STR |
| 8013 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8014 | { |
| 8015 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); |
| 8016 | } |
| 8017 | |
| 8018 | ALIAS (show_ip_bgp_neighbors, |
| 8019 | show_ip_bgp_ipv4_neighbors_cmd, |
| 8020 | "show ip bgp ipv4 (unicast|multicast) neighbors", |
| 8021 | SHOW_STR |
| 8022 | IP_STR |
| 8023 | BGP_STR |
| 8024 | "Address family\n" |
| 8025 | "Address Family modifier\n" |
| 8026 | "Address Family modifier\n" |
| 8027 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8028 | |
| 8029 | ALIAS (show_ip_bgp_neighbors, |
| 8030 | show_ip_bgp_vpnv4_all_neighbors_cmd, |
| 8031 | "show ip bgp vpnv4 all neighbors", |
| 8032 | SHOW_STR |
| 8033 | IP_STR |
| 8034 | BGP_STR |
| 8035 | "Display VPNv4 NLRI specific information\n" |
| 8036 | "Display information about all VPNv4 NLRIs\n" |
| 8037 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8038 | |
| 8039 | ALIAS (show_ip_bgp_neighbors, |
| 8040 | show_ip_bgp_vpnv4_rd_neighbors_cmd, |
| 8041 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", |
| 8042 | SHOW_STR |
| 8043 | IP_STR |
| 8044 | BGP_STR |
| 8045 | "Display VPNv4 NLRI specific information\n" |
| 8046 | "Display information for a route distinguisher\n" |
| 8047 | "VPN Route Distinguisher\n" |
| 8048 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8049 | |
| 8050 | ALIAS (show_ip_bgp_neighbors, |
| 8051 | show_bgp_neighbors_cmd, |
| 8052 | "show bgp neighbors", |
| 8053 | SHOW_STR |
| 8054 | BGP_STR |
| 8055 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8056 | |
| 8057 | ALIAS (show_ip_bgp_neighbors, |
| 8058 | show_bgp_ipv6_neighbors_cmd, |
| 8059 | "show bgp ipv6 neighbors", |
| 8060 | SHOW_STR |
| 8061 | BGP_STR |
| 8062 | "Address family\n" |
| 8063 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8064 | |
| 8065 | DEFUN (show_ip_bgp_neighbors_peer, |
| 8066 | show_ip_bgp_neighbors_peer_cmd, |
| 8067 | "show ip bgp neighbors (A.B.C.D|X:X::X:X)", |
| 8068 | SHOW_STR |
| 8069 | IP_STR |
| 8070 | BGP_STR |
| 8071 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8072 | "Neighbor to display information about\n" |
| 8073 | "Neighbor to display information about\n") |
| 8074 | { |
| 8075 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); |
| 8076 | } |
| 8077 | |
| 8078 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8079 | show_ip_bgp_ipv4_neighbors_peer_cmd, |
| 8080 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)", |
| 8081 | SHOW_STR |
| 8082 | IP_STR |
| 8083 | BGP_STR |
| 8084 | "Address family\n" |
| 8085 | "Address Family modifier\n" |
| 8086 | "Address Family modifier\n" |
| 8087 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8088 | "Neighbor to display information about\n" |
| 8089 | "Neighbor to display information about\n") |
| 8090 | |
| 8091 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8092 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, |
| 8093 | "show ip bgp vpnv4 all neighbors A.B.C.D", |
| 8094 | SHOW_STR |
| 8095 | IP_STR |
| 8096 | BGP_STR |
| 8097 | "Display VPNv4 NLRI specific information\n" |
| 8098 | "Display information about all VPNv4 NLRIs\n" |
| 8099 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8100 | "Neighbor to display information about\n") |
| 8101 | |
| 8102 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8103 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, |
| 8104 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn 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_bgp_neighbors_peer_cmd, |
| 8115 | "show bgp neighbors (A.B.C.D|X:X::X:X)", |
| 8116 | SHOW_STR |
| 8117 | BGP_STR |
| 8118 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8119 | "Neighbor to display information about\n" |
| 8120 | "Neighbor to display information about\n") |
| 8121 | |
| 8122 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8123 | show_bgp_ipv6_neighbors_peer_cmd, |
| 8124 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 8125 | SHOW_STR |
| 8126 | BGP_STR |
| 8127 | "Address family\n" |
| 8128 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8129 | "Neighbor to display information about\n" |
| 8130 | "Neighbor to display information about\n") |
| 8131 | |
| 8132 | DEFUN (show_ip_bgp_instance_neighbors, |
| 8133 | show_ip_bgp_instance_neighbors_cmd, |
| 8134 | "show ip bgp view WORD neighbors", |
| 8135 | SHOW_STR |
| 8136 | IP_STR |
| 8137 | BGP_STR |
| 8138 | "BGP view\n" |
| 8139 | "View name\n" |
| 8140 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8141 | { |
| 8142 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); |
| 8143 | } |
| 8144 | |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 8145 | ALIAS (show_ip_bgp_instance_neighbors, |
| 8146 | show_bgp_instance_neighbors_cmd, |
| 8147 | "show bgp view WORD neighbors", |
| 8148 | SHOW_STR |
| 8149 | BGP_STR |
| 8150 | "BGP view\n" |
| 8151 | "View name\n" |
| 8152 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8153 | |
| 8154 | ALIAS (show_ip_bgp_instance_neighbors, |
| 8155 | show_bgp_instance_ipv6_neighbors_cmd, |
| 8156 | "show bgp view WORD ipv6 neighbors", |
| 8157 | SHOW_STR |
| 8158 | BGP_STR |
| 8159 | "BGP view\n" |
| 8160 | "View name\n" |
| 8161 | "Address family\n" |
| 8162 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8163 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8164 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
| 8165 | show_ip_bgp_instance_neighbors_peer_cmd, |
| 8166 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 8167 | SHOW_STR |
| 8168 | IP_STR |
| 8169 | BGP_STR |
| 8170 | "BGP view\n" |
| 8171 | "View name\n" |
| 8172 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8173 | "Neighbor to display information about\n" |
| 8174 | "Neighbor to display information about\n") |
| 8175 | { |
| 8176 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); |
| 8177 | } |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 8178 | |
| 8179 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 8180 | show_bgp_instance_neighbors_peer_cmd, |
| 8181 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 8182 | SHOW_STR |
| 8183 | BGP_STR |
| 8184 | "BGP view\n" |
| 8185 | "View name\n" |
| 8186 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8187 | "Neighbor to display information about\n" |
| 8188 | "Neighbor to display information about\n") |
| 8189 | |
| 8190 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 8191 | show_bgp_instance_ipv6_neighbors_peer_cmd, |
| 8192 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 8193 | SHOW_STR |
| 8194 | BGP_STR |
| 8195 | "BGP view\n" |
| 8196 | "View name\n" |
| 8197 | "Address family\n" |
| 8198 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8199 | "Neighbor to display information about\n" |
| 8200 | "Neighbor to display information about\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 8201 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8202 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
| 8203 | paths' and `show ip mbgp paths'. Those functions results are the |
| 8204 | same.*/ |
| 8205 | DEFUN (show_ip_bgp_paths, |
| 8206 | show_ip_bgp_paths_cmd, |
| 8207 | "show ip bgp paths", |
| 8208 | SHOW_STR |
| 8209 | IP_STR |
| 8210 | BGP_STR |
| 8211 | "Path information\n") |
| 8212 | { |
| 8213 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); |
| 8214 | aspath_print_all_vty (vty); |
| 8215 | return CMD_SUCCESS; |
| 8216 | } |
| 8217 | |
| 8218 | DEFUN (show_ip_bgp_ipv4_paths, |
| 8219 | show_ip_bgp_ipv4_paths_cmd, |
| 8220 | "show ip bgp ipv4 (unicast|multicast) paths", |
| 8221 | SHOW_STR |
| 8222 | IP_STR |
| 8223 | BGP_STR |
| 8224 | "Address family\n" |
| 8225 | "Address Family modifier\n" |
| 8226 | "Address Family modifier\n" |
| 8227 | "Path information\n") |
| 8228 | { |
| 8229 | vty_out (vty, "Address Refcnt Path\r\n"); |
| 8230 | aspath_print_all_vty (vty); |
| 8231 | |
| 8232 | return CMD_SUCCESS; |
| 8233 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 8234 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8235 | #include "hash.h" |
| 8236 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8237 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8238 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
| 8239 | { |
| 8240 | struct community *com; |
| 8241 | |
| 8242 | com = (struct community *) backet->data; |
David Lamparter | eed3c48 | 2015-03-03 08:51:53 +0100 | [diff] [blame] | 8243 | vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8244 | community_str (com), VTY_NEWLINE); |
| 8245 | } |
| 8246 | |
| 8247 | /* Show BGP's community internal data. */ |
| 8248 | DEFUN (show_ip_bgp_community_info, |
| 8249 | show_ip_bgp_community_info_cmd, |
| 8250 | "show ip bgp community-info", |
| 8251 | SHOW_STR |
| 8252 | IP_STR |
| 8253 | BGP_STR |
| 8254 | "List all bgp community information\n") |
| 8255 | { |
| 8256 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); |
| 8257 | |
| 8258 | hash_iterate (community_hash (), |
| 8259 | (void (*) (struct hash_backet *, void *)) |
| 8260 | community_show_all_iterator, |
| 8261 | vty); |
| 8262 | |
| 8263 | return CMD_SUCCESS; |
| 8264 | } |
| 8265 | |
| 8266 | DEFUN (show_ip_bgp_attr_info, |
| 8267 | show_ip_bgp_attr_info_cmd, |
| 8268 | "show ip bgp attribute-info", |
| 8269 | SHOW_STR |
| 8270 | IP_STR |
| 8271 | BGP_STR |
| 8272 | "List all bgp attribute information\n") |
| 8273 | { |
| 8274 | attr_show_all (vty); |
| 8275 | return CMD_SUCCESS; |
| 8276 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 8277 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8278 | static int |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8279 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
| 8280 | afi_t afi, safi_t safi) |
| 8281 | { |
| 8282 | char timebuf[BGP_UPTIME_LEN]; |
| 8283 | char rmbuf[14]; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8284 | const char *rmname; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8285 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8286 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8287 | int len; |
| 8288 | int count = 0; |
| 8289 | |
| 8290 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) |
| 8291 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8292 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8293 | { |
| 8294 | count++; |
| 8295 | bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 8296 | } |
| 8297 | return count; |
| 8298 | } |
| 8299 | |
| 8300 | len = vty_out (vty, "%s", rsclient->host); |
| 8301 | len = 16 - len; |
| 8302 | |
| 8303 | if (len < 1) |
| 8304 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 8305 | else |
| 8306 | vty_out (vty, "%*s", len, " "); |
| 8307 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 8308 | vty_out (vty, "4 "); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8309 | |
Milan Kocian | cb4fc59 | 2014-12-01 12:48:25 +0000 | [diff] [blame] | 8310 | vty_out (vty, "%10u ", rsclient->as); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8311 | |
| 8312 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); |
| 8313 | if ( rmname && strlen (rmname) > 13 ) |
| 8314 | { |
| 8315 | sprintf (rmbuf, "%13s", "..."); |
| 8316 | rmname = strncpy (rmbuf, rmname, 10); |
| 8317 | } |
| 8318 | else if (! rmname) |
| 8319 | rmname = "<none>"; |
| 8320 | vty_out (vty, " %13s ", rmname); |
| 8321 | |
| 8322 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); |
| 8323 | if ( rmname && strlen (rmname) > 13 ) |
| 8324 | { |
| 8325 | sprintf (rmbuf, "%13s", "..."); |
| 8326 | rmname = strncpy (rmbuf, rmname, 10); |
| 8327 | } |
| 8328 | else if (! rmname) |
| 8329 | rmname = "<none>"; |
| 8330 | vty_out (vty, " %13s ", rmname); |
| 8331 | |
| 8332 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); |
| 8333 | |
| 8334 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) |
| 8335 | vty_out (vty, " Idle (Admin)"); |
| 8336 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 8337 | vty_out (vty, " Idle (PfxCt)"); |
| 8338 | else |
| 8339 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); |
| 8340 | |
| 8341 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8342 | |
| 8343 | return 1; |
| 8344 | } |
| 8345 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8346 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8347 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
| 8348 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8349 | { |
| 8350 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8351 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8352 | int count = 0; |
| 8353 | |
| 8354 | /* Header string for each address family. */ |
Milan Kocian | cb4fc59 | 2014-12-01 12:48:25 +0000 | [diff] [blame] | 8355 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8356 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8357 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8358 | { |
| 8359 | if (peer->afc[afi][safi] && |
| 8360 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 8361 | { |
| 8362 | if (! count) |
| 8363 | { |
| 8364 | vty_out (vty, |
| 8365 | "Route Server's BGP router identifier %s%s", |
| 8366 | inet_ntoa (bgp->router_id), VTY_NEWLINE); |
| 8367 | vty_out (vty, |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 8368 | "Route Server's local AS number %u%s", bgp->as, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8369 | VTY_NEWLINE); |
| 8370 | |
| 8371 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8372 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 8373 | } |
| 8374 | |
| 8375 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 8376 | } |
| 8377 | } |
| 8378 | |
| 8379 | if (count) |
| 8380 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, |
| 8381 | count, VTY_NEWLINE); |
| 8382 | else |
| 8383 | vty_out (vty, "No %s Route Server Client is configured%s", |
| 8384 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 8385 | |
| 8386 | return CMD_SUCCESS; |
| 8387 | } |
| 8388 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8389 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8390 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
| 8391 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8392 | { |
| 8393 | struct bgp *bgp; |
| 8394 | |
| 8395 | if (name) |
| 8396 | { |
| 8397 | bgp = bgp_lookup_by_name (name); |
| 8398 | |
| 8399 | if (! bgp) |
| 8400 | { |
| 8401 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 8402 | return CMD_WARNING; |
| 8403 | } |
| 8404 | |
| 8405 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 8406 | return CMD_SUCCESS; |
| 8407 | } |
| 8408 | |
| 8409 | bgp = bgp_get_default (); |
| 8410 | |
| 8411 | if (bgp) |
| 8412 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 8413 | |
| 8414 | return CMD_SUCCESS; |
| 8415 | } |
| 8416 | |
| 8417 | /* 'show bgp rsclient' commands. */ |
| 8418 | DEFUN (show_ip_bgp_rsclient_summary, |
| 8419 | show_ip_bgp_rsclient_summary_cmd, |
| 8420 | "show ip bgp rsclient summary", |
| 8421 | SHOW_STR |
| 8422 | IP_STR |
| 8423 | BGP_STR |
| 8424 | "Information about Route Server Clients\n" |
| 8425 | "Summary of all Route Server Clients\n") |
| 8426 | { |
| 8427 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 8428 | } |
| 8429 | |
| 8430 | DEFUN (show_ip_bgp_instance_rsclient_summary, |
| 8431 | show_ip_bgp_instance_rsclient_summary_cmd, |
| 8432 | "show ip bgp view WORD rsclient summary", |
| 8433 | SHOW_STR |
| 8434 | IP_STR |
| 8435 | BGP_STR |
| 8436 | "BGP view\n" |
| 8437 | "View name\n" |
| 8438 | "Information about Route Server Clients\n" |
| 8439 | "Summary of all Route Server Clients\n") |
| 8440 | { |
| 8441 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 8442 | } |
| 8443 | |
| 8444 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, |
| 8445 | show_ip_bgp_ipv4_rsclient_summary_cmd, |
| 8446 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", |
| 8447 | SHOW_STR |
| 8448 | IP_STR |
| 8449 | BGP_STR |
| 8450 | "Address family\n" |
| 8451 | "Address Family modifier\n" |
| 8452 | "Address Family modifier\n" |
| 8453 | "Information about Route Server Clients\n" |
| 8454 | "Summary of all Route Server Clients\n") |
| 8455 | { |
| 8456 | if (strncmp (argv[0], "m", 1) == 0) |
| 8457 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 8458 | |
| 8459 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 8460 | } |
| 8461 | |
| 8462 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, |
| 8463 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, |
| 8464 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 8465 | SHOW_STR |
| 8466 | IP_STR |
| 8467 | BGP_STR |
| 8468 | "BGP view\n" |
| 8469 | "View name\n" |
| 8470 | "Address family\n" |
| 8471 | "Address Family modifier\n" |
| 8472 | "Address Family modifier\n" |
| 8473 | "Information about Route Server Clients\n" |
| 8474 | "Summary of all Route Server Clients\n") |
| 8475 | { |
| 8476 | if (strncmp (argv[1], "m", 1) == 0) |
| 8477 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 8478 | |
| 8479 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 8480 | } |
| 8481 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 8482 | DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary, |
| 8483 | show_bgp_instance_ipv4_safi_rsclient_summary_cmd, |
| 8484 | "show bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 8485 | SHOW_STR |
| 8486 | BGP_STR |
| 8487 | "BGP view\n" |
| 8488 | "View name\n" |
| 8489 | "Address family\n" |
| 8490 | "Address Family modifier\n" |
| 8491 | "Address Family modifier\n" |
| 8492 | "Information about Route Server Clients\n" |
| 8493 | "Summary of all Route Server Clients\n") |
| 8494 | { |
| 8495 | safi_t safi; |
| 8496 | |
| 8497 | if (argc == 2) { |
| 8498 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8499 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi); |
| 8500 | } else { |
| 8501 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8502 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi); |
| 8503 | } |
| 8504 | } |
| 8505 | |
| 8506 | ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary, |
| 8507 | show_bgp_ipv4_safi_rsclient_summary_cmd, |
| 8508 | "show bgp ipv4 (unicast|multicast) rsclient summary", |
| 8509 | SHOW_STR |
| 8510 | BGP_STR |
| 8511 | "Address family\n" |
| 8512 | "Address Family modifier\n" |
| 8513 | "Address Family modifier\n" |
| 8514 | "Information about Route Server Clients\n" |
| 8515 | "Summary of all Route Server Clients\n") |
| 8516 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8517 | #ifdef HAVE_IPV6 |
| 8518 | DEFUN (show_bgp_rsclient_summary, |
| 8519 | show_bgp_rsclient_summary_cmd, |
| 8520 | "show bgp rsclient summary", |
| 8521 | SHOW_STR |
| 8522 | BGP_STR |
| 8523 | "Information about Route Server Clients\n" |
| 8524 | "Summary of all Route Server Clients\n") |
| 8525 | { |
| 8526 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 8527 | } |
| 8528 | |
| 8529 | DEFUN (show_bgp_instance_rsclient_summary, |
| 8530 | show_bgp_instance_rsclient_summary_cmd, |
| 8531 | "show bgp view WORD rsclient summary", |
| 8532 | SHOW_STR |
| 8533 | BGP_STR |
| 8534 | "BGP view\n" |
| 8535 | "View name\n" |
| 8536 | "Information about Route Server Clients\n" |
| 8537 | "Summary of all Route Server Clients\n") |
| 8538 | { |
| 8539 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 8540 | } |
| 8541 | |
| 8542 | ALIAS (show_bgp_rsclient_summary, |
| 8543 | show_bgp_ipv6_rsclient_summary_cmd, |
| 8544 | "show bgp ipv6 rsclient summary", |
| 8545 | SHOW_STR |
| 8546 | BGP_STR |
| 8547 | "Address family\n" |
| 8548 | "Information about Route Server Clients\n" |
| 8549 | "Summary of all Route Server Clients\n") |
| 8550 | |
| 8551 | ALIAS (show_bgp_instance_rsclient_summary, |
| 8552 | show_bgp_instance_ipv6_rsclient_summary_cmd, |
| 8553 | "show bgp view WORD ipv6 rsclient summary", |
| 8554 | SHOW_STR |
| 8555 | BGP_STR |
| 8556 | "BGP view\n" |
| 8557 | "View name\n" |
| 8558 | "Address family\n" |
| 8559 | "Information about Route Server Clients\n" |
| 8560 | "Summary of all Route Server Clients\n") |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 8561 | |
| 8562 | DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary, |
| 8563 | show_bgp_instance_ipv6_safi_rsclient_summary_cmd, |
| 8564 | "show bgp view WORD ipv6 (unicast|multicast) rsclient summary", |
| 8565 | SHOW_STR |
| 8566 | BGP_STR |
| 8567 | "BGP view\n" |
| 8568 | "View name\n" |
| 8569 | "Address family\n" |
| 8570 | "Address Family modifier\n" |
| 8571 | "Address Family modifier\n" |
| 8572 | "Information about Route Server Clients\n" |
| 8573 | "Summary of all Route Server Clients\n") |
| 8574 | { |
| 8575 | safi_t safi; |
| 8576 | |
| 8577 | if (argc == 2) { |
| 8578 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8579 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi); |
| 8580 | } else { |
| 8581 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8582 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi); |
| 8583 | } |
| 8584 | } |
| 8585 | |
| 8586 | ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary, |
| 8587 | show_bgp_ipv6_safi_rsclient_summary_cmd, |
| 8588 | "show bgp ipv6 (unicast|multicast) rsclient summary", |
| 8589 | SHOW_STR |
| 8590 | BGP_STR |
| 8591 | "Address family\n" |
| 8592 | "Address Family modifier\n" |
| 8593 | "Address Family modifier\n" |
| 8594 | "Information about Route Server Clients\n" |
| 8595 | "Summary of all Route Server Clients\n") |
| 8596 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8597 | #endif /* HAVE IPV6 */ |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 8598 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8599 | /* Redistribute VTY commands. */ |
| 8600 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8601 | DEFUN (bgp_redistribute_ipv4, |
| 8602 | bgp_redistribute_ipv4_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8603 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8604 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8605 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8606 | { |
| 8607 | int type; |
| 8608 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8609 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8610 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8611 | { |
| 8612 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8613 | return CMD_WARNING; |
| 8614 | } |
| 8615 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8616 | } |
| 8617 | |
| 8618 | DEFUN (bgp_redistribute_ipv4_rmap, |
| 8619 | bgp_redistribute_ipv4_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8620 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8621 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8622 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8623 | "Route map reference\n" |
| 8624 | "Pointer to route-map entries\n") |
| 8625 | { |
| 8626 | int type; |
| 8627 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8628 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8629 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8630 | { |
| 8631 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8632 | return CMD_WARNING; |
| 8633 | } |
| 8634 | |
| 8635 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8636 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8637 | } |
| 8638 | |
| 8639 | DEFUN (bgp_redistribute_ipv4_metric, |
| 8640 | bgp_redistribute_ipv4_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8641 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8642 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8643 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8644 | "Metric for redistributed routes\n" |
| 8645 | "Default metric\n") |
| 8646 | { |
| 8647 | int type; |
| 8648 | u_int32_t metric; |
| 8649 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8650 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8651 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8652 | { |
| 8653 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8654 | return CMD_WARNING; |
| 8655 | } |
| 8656 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8657 | |
| 8658 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8659 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8660 | } |
| 8661 | |
| 8662 | DEFUN (bgp_redistribute_ipv4_rmap_metric, |
| 8663 | bgp_redistribute_ipv4_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8664 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8665 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8666 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8667 | "Route map reference\n" |
| 8668 | "Pointer to route-map entries\n" |
| 8669 | "Metric for redistributed routes\n" |
| 8670 | "Default metric\n") |
| 8671 | { |
| 8672 | int type; |
| 8673 | u_int32_t metric; |
| 8674 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8675 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8676 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8677 | { |
| 8678 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8679 | return CMD_WARNING; |
| 8680 | } |
| 8681 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8682 | |
| 8683 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8684 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8685 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8686 | } |
| 8687 | |
| 8688 | DEFUN (bgp_redistribute_ipv4_metric_rmap, |
| 8689 | bgp_redistribute_ipv4_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8690 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8691 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8692 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8693 | "Metric for redistributed routes\n" |
| 8694 | "Default metric\n" |
| 8695 | "Route map reference\n" |
| 8696 | "Pointer to route-map entries\n") |
| 8697 | { |
| 8698 | int type; |
| 8699 | u_int32_t metric; |
| 8700 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8701 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8702 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8703 | { |
| 8704 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8705 | return CMD_WARNING; |
| 8706 | } |
| 8707 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8708 | |
| 8709 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8710 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); |
| 8711 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8712 | } |
| 8713 | |
| 8714 | DEFUN (no_bgp_redistribute_ipv4, |
| 8715 | no_bgp_redistribute_ipv4_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8716 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8717 | NO_STR |
| 8718 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8719 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8720 | { |
| 8721 | int type; |
| 8722 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8723 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8724 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8725 | { |
| 8726 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8727 | return CMD_WARNING; |
| 8728 | } |
| 8729 | |
| 8730 | return bgp_redistribute_unset (vty->index, AFI_IP, type); |
| 8731 | } |
| 8732 | |
| 8733 | DEFUN (no_bgp_redistribute_ipv4_rmap, |
| 8734 | no_bgp_redistribute_ipv4_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8735 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8736 | NO_STR |
| 8737 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8738 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8739 | "Route map reference\n" |
| 8740 | "Pointer to route-map entries\n") |
| 8741 | { |
| 8742 | int type; |
| 8743 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8744 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8745 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8746 | { |
| 8747 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8748 | return CMD_WARNING; |
| 8749 | } |
| 8750 | |
| 8751 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8752 | return CMD_SUCCESS; |
| 8753 | } |
| 8754 | |
| 8755 | DEFUN (no_bgp_redistribute_ipv4_metric, |
| 8756 | no_bgp_redistribute_ipv4_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8757 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8758 | NO_STR |
| 8759 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8760 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8761 | "Metric for redistributed routes\n" |
| 8762 | "Default metric\n") |
| 8763 | { |
| 8764 | int type; |
| 8765 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8766 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8767 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8768 | { |
| 8769 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8770 | return CMD_WARNING; |
| 8771 | } |
| 8772 | |
| 8773 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8774 | return CMD_SUCCESS; |
| 8775 | } |
| 8776 | |
| 8777 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, |
| 8778 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8779 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8780 | NO_STR |
| 8781 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8782 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8783 | "Route map reference\n" |
| 8784 | "Pointer to route-map entries\n" |
| 8785 | "Metric for redistributed routes\n" |
| 8786 | "Default metric\n") |
| 8787 | { |
| 8788 | int type; |
| 8789 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8790 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8791 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8792 | { |
| 8793 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8794 | return CMD_WARNING; |
| 8795 | } |
| 8796 | |
| 8797 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8798 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8799 | return CMD_SUCCESS; |
| 8800 | } |
| 8801 | |
| 8802 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, |
| 8803 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8804 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8805 | NO_STR |
| 8806 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8807 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8808 | "Metric for redistributed routes\n" |
| 8809 | "Default metric\n" |
| 8810 | "Route map reference\n" |
| 8811 | "Pointer to route-map entries\n") |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 8812 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8813 | #ifdef HAVE_IPV6 |
| 8814 | DEFUN (bgp_redistribute_ipv6, |
| 8815 | bgp_redistribute_ipv6_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8816 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8817 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8818 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8819 | { |
| 8820 | int type; |
| 8821 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8822 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8823 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8824 | { |
| 8825 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8826 | return CMD_WARNING; |
| 8827 | } |
| 8828 | |
| 8829 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8830 | } |
| 8831 | |
| 8832 | DEFUN (bgp_redistribute_ipv6_rmap, |
| 8833 | bgp_redistribute_ipv6_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8834 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8835 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8836 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8837 | "Route map reference\n" |
| 8838 | "Pointer to route-map entries\n") |
| 8839 | { |
| 8840 | int type; |
| 8841 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8842 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8843 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8844 | { |
| 8845 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8846 | return CMD_WARNING; |
| 8847 | } |
| 8848 | |
| 8849 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8850 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8851 | } |
| 8852 | |
| 8853 | DEFUN (bgp_redistribute_ipv6_metric, |
| 8854 | bgp_redistribute_ipv6_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8855 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8856 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8857 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8858 | "Metric for redistributed routes\n" |
| 8859 | "Default metric\n") |
| 8860 | { |
| 8861 | int type; |
| 8862 | u_int32_t metric; |
| 8863 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8864 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8865 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8866 | { |
| 8867 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8868 | return CMD_WARNING; |
| 8869 | } |
| 8870 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8871 | |
| 8872 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8873 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8874 | } |
| 8875 | |
| 8876 | DEFUN (bgp_redistribute_ipv6_rmap_metric, |
| 8877 | bgp_redistribute_ipv6_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8878 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8879 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8880 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8881 | "Route map reference\n" |
| 8882 | "Pointer to route-map entries\n" |
| 8883 | "Metric for redistributed routes\n" |
| 8884 | "Default metric\n") |
| 8885 | { |
| 8886 | int type; |
| 8887 | u_int32_t metric; |
| 8888 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8889 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8890 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8891 | { |
| 8892 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8893 | return CMD_WARNING; |
| 8894 | } |
| 8895 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8896 | |
| 8897 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8898 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8899 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8900 | } |
| 8901 | |
| 8902 | DEFUN (bgp_redistribute_ipv6_metric_rmap, |
| 8903 | bgp_redistribute_ipv6_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8904 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8905 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8906 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8907 | "Metric for redistributed routes\n" |
| 8908 | "Default metric\n" |
| 8909 | "Route map reference\n" |
| 8910 | "Pointer to route-map entries\n") |
| 8911 | { |
| 8912 | int type; |
| 8913 | u_int32_t metric; |
| 8914 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8915 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8916 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8917 | { |
| 8918 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8919 | return CMD_WARNING; |
| 8920 | } |
| 8921 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8922 | |
| 8923 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8924 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); |
| 8925 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8926 | } |
| 8927 | |
| 8928 | DEFUN (no_bgp_redistribute_ipv6, |
| 8929 | no_bgp_redistribute_ipv6_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8930 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8931 | NO_STR |
| 8932 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8933 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8934 | { |
| 8935 | int type; |
| 8936 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8937 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8938 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8939 | { |
| 8940 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8941 | return CMD_WARNING; |
| 8942 | } |
| 8943 | |
| 8944 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); |
| 8945 | } |
| 8946 | |
| 8947 | DEFUN (no_bgp_redistribute_ipv6_rmap, |
| 8948 | no_bgp_redistribute_ipv6_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8949 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8950 | NO_STR |
| 8951 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8952 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8953 | "Route map reference\n" |
| 8954 | "Pointer to route-map entries\n") |
| 8955 | { |
| 8956 | int type; |
| 8957 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8958 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8959 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8960 | { |
| 8961 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8962 | return CMD_WARNING; |
| 8963 | } |
| 8964 | |
| 8965 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8966 | return CMD_SUCCESS; |
| 8967 | } |
| 8968 | |
| 8969 | DEFUN (no_bgp_redistribute_ipv6_metric, |
| 8970 | no_bgp_redistribute_ipv6_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8971 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8972 | NO_STR |
| 8973 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8974 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8975 | "Metric for redistributed routes\n" |
| 8976 | "Default metric\n") |
| 8977 | { |
| 8978 | int type; |
| 8979 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8980 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8981 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8982 | { |
| 8983 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8984 | return CMD_WARNING; |
| 8985 | } |
| 8986 | |
| 8987 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8988 | return CMD_SUCCESS; |
| 8989 | } |
| 8990 | |
| 8991 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, |
| 8992 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8993 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8994 | NO_STR |
| 8995 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8996 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8997 | "Route map reference\n" |
| 8998 | "Pointer to route-map entries\n" |
| 8999 | "Metric for redistributed routes\n" |
| 9000 | "Default metric\n") |
| 9001 | { |
| 9002 | int type; |
| 9003 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 9004 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 9005 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9006 | { |
| 9007 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 9008 | return CMD_WARNING; |
| 9009 | } |
| 9010 | |
| 9011 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 9012 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 9013 | return CMD_SUCCESS; |
| 9014 | } |
| 9015 | |
| 9016 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, |
| 9017 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 9018 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9019 | NO_STR |
| 9020 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 9021 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9022 | "Metric for redistributed routes\n" |
| 9023 | "Default metric\n" |
| 9024 | "Route map reference\n" |
| 9025 | "Pointer to route-map entries\n") |
| 9026 | #endif /* HAVE_IPV6 */ |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 9027 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9028 | int |
| 9029 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 9030 | safi_t safi, int *write) |
| 9031 | { |
| 9032 | int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9033 | |
| 9034 | /* Unicast redistribution only. */ |
| 9035 | if (safi != SAFI_UNICAST) |
| 9036 | return 0; |
| 9037 | |
| 9038 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 9039 | { |
| 9040 | /* Redistribute BGP does not make sense. */ |
| 9041 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) |
| 9042 | { |
| 9043 | /* Display "address-family" when it is not yet diplayed. */ |
| 9044 | bgp_config_write_family_header (vty, afi, safi, write); |
| 9045 | |
| 9046 | /* "redistribute" configuration. */ |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 9047 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9048 | |
| 9049 | if (bgp->redist_metric_flag[afi][i]) |
Jorge Boncompte [DTI2] | ddc943d | 2012-04-13 13:46:07 +0200 | [diff] [blame] | 9050 | vty_out (vty, " metric %u", bgp->redist_metric[afi][i]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9051 | |
| 9052 | if (bgp->rmap[afi][i].name) |
| 9053 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); |
| 9054 | |
| 9055 | vty_out (vty, "%s", VTY_NEWLINE); |
| 9056 | } |
| 9057 | } |
| 9058 | return *write; |
| 9059 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 9060 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9061 | /* BGP node structure. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9062 | static struct cmd_node bgp_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9063 | { |
| 9064 | BGP_NODE, |
| 9065 | "%s(config-router)# ", |
| 9066 | 1, |
| 9067 | }; |
| 9068 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9069 | static struct cmd_node bgp_ipv4_unicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9070 | { |
| 9071 | BGP_IPV4_NODE, |
| 9072 | "%s(config-router-af)# ", |
| 9073 | 1, |
| 9074 | }; |
| 9075 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9076 | static struct cmd_node bgp_ipv4_multicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9077 | { |
| 9078 | BGP_IPV4M_NODE, |
| 9079 | "%s(config-router-af)# ", |
| 9080 | 1, |
| 9081 | }; |
| 9082 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9083 | static struct cmd_node bgp_ipv6_unicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9084 | { |
| 9085 | BGP_IPV6_NODE, |
| 9086 | "%s(config-router-af)# ", |
| 9087 | 1, |
| 9088 | }; |
| 9089 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9090 | static struct cmd_node bgp_ipv6_multicast_node = |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9091 | { |
| 9092 | BGP_IPV6M_NODE, |
| 9093 | "%s(config-router-af)# ", |
| 9094 | 1, |
| 9095 | }; |
| 9096 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9097 | static struct cmd_node bgp_vpnv4_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9098 | { |
| 9099 | BGP_VPNV4_NODE, |
| 9100 | "%s(config-router-af)# ", |
| 9101 | 1 |
| 9102 | }; |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 9103 | |
paul | 1f8ae70 | 2005-09-09 23:49:49 +0000 | [diff] [blame] | 9104 | static void community_list_vty (void); |
| 9105 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9106 | void |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9107 | bgp_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9108 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9109 | /* Install bgp top node. */ |
| 9110 | install_node (&bgp_node, bgp_config_write); |
| 9111 | install_node (&bgp_ipv4_unicast_node, NULL); |
| 9112 | install_node (&bgp_ipv4_multicast_node, NULL); |
| 9113 | install_node (&bgp_ipv6_unicast_node, NULL); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9114 | install_node (&bgp_ipv6_multicast_node, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9115 | install_node (&bgp_vpnv4_node, NULL); |
| 9116 | |
| 9117 | /* Install default VTY commands to new nodes. */ |
| 9118 | install_default (BGP_NODE); |
| 9119 | install_default (BGP_IPV4_NODE); |
| 9120 | install_default (BGP_IPV4M_NODE); |
| 9121 | install_default (BGP_IPV6_NODE); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9122 | install_default (BGP_IPV6M_NODE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9123 | install_default (BGP_VPNV4_NODE); |
| 9124 | |
| 9125 | /* "bgp multiple-instance" commands. */ |
| 9126 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); |
| 9127 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); |
| 9128 | |
| 9129 | /* "bgp config-type" commands. */ |
| 9130 | install_element (CONFIG_NODE, &bgp_config_type_cmd); |
| 9131 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); |
| 9132 | |
| 9133 | /* Dummy commands (Currently not supported) */ |
| 9134 | install_element (BGP_NODE, &no_synchronization_cmd); |
| 9135 | install_element (BGP_NODE, &no_auto_summary_cmd); |
| 9136 | |
| 9137 | /* "router bgp" commands. */ |
| 9138 | install_element (CONFIG_NODE, &router_bgp_cmd); |
| 9139 | install_element (CONFIG_NODE, &router_bgp_view_cmd); |
| 9140 | |
| 9141 | /* "no router bgp" commands. */ |
| 9142 | install_element (CONFIG_NODE, &no_router_bgp_cmd); |
| 9143 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); |
| 9144 | |
| 9145 | /* "bgp router-id" commands. */ |
| 9146 | install_element (BGP_NODE, &bgp_router_id_cmd); |
| 9147 | install_element (BGP_NODE, &no_bgp_router_id_cmd); |
| 9148 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); |
| 9149 | |
| 9150 | /* "bgp cluster-id" commands. */ |
| 9151 | install_element (BGP_NODE, &bgp_cluster_id_cmd); |
| 9152 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); |
| 9153 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); |
| 9154 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); |
| 9155 | |
| 9156 | /* "bgp confederation" commands. */ |
| 9157 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); |
| 9158 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); |
| 9159 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); |
| 9160 | |
| 9161 | /* "bgp confederation peers" commands. */ |
| 9162 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); |
| 9163 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); |
| 9164 | |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 9165 | /* "maximum-paths" commands. */ |
| 9166 | install_element (BGP_NODE, &bgp_maxpaths_cmd); |
| 9167 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); |
| 9168 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); |
| 9169 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); |
| 9170 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); |
| 9171 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); |
| 9172 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
| 9173 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
| 9174 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
| 9175 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
| 9176 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
| 9177 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
| 9178 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9179 | /* "timers bgp" commands. */ |
| 9180 | install_element (BGP_NODE, &bgp_timers_cmd); |
| 9181 | install_element (BGP_NODE, &no_bgp_timers_cmd); |
| 9182 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); |
| 9183 | |
| 9184 | /* "bgp client-to-client reflection" commands */ |
| 9185 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); |
| 9186 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); |
| 9187 | |
| 9188 | /* "bgp always-compare-med" commands */ |
| 9189 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); |
| 9190 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); |
| 9191 | |
| 9192 | /* "bgp deterministic-med" commands */ |
| 9193 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); |
| 9194 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 9195 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 9196 | /* "bgp graceful-restart" commands */ |
| 9197 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); |
| 9198 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 9199 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
| 9200 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); |
| 9201 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9202 | |
| 9203 | /* "bgp fast-external-failover" commands */ |
| 9204 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); |
| 9205 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); |
| 9206 | |
| 9207 | /* "bgp enforce-first-as" commands */ |
| 9208 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); |
| 9209 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); |
| 9210 | |
| 9211 | /* "bgp bestpath compare-routerid" commands */ |
| 9212 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); |
| 9213 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); |
| 9214 | |
| 9215 | /* "bgp bestpath as-path ignore" commands */ |
| 9216 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); |
| 9217 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); |
| 9218 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 9219 | /* "bgp bestpath as-path confed" commands */ |
| 9220 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); |
| 9221 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); |
| 9222 | |
Pradosh Mohapatra | 2fdd455 | 2013-09-07 07:02:36 +0000 | [diff] [blame] | 9223 | /* "bgp bestpath as-path multipath-relax" commands */ |
| 9224 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); |
| 9225 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); |
| 9226 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 9227 | /* "bgp log-neighbor-changes" commands */ |
| 9228 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); |
| 9229 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); |
| 9230 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9231 | /* "bgp bestpath med" commands */ |
| 9232 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); |
| 9233 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); |
| 9234 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); |
| 9235 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); |
| 9236 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); |
| 9237 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); |
| 9238 | |
| 9239 | /* "no bgp default ipv4-unicast" commands. */ |
| 9240 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); |
| 9241 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); |
| 9242 | |
| 9243 | /* "bgp network import-check" commands. */ |
| 9244 | install_element (BGP_NODE, &bgp_network_import_check_cmd); |
| 9245 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
| 9246 | |
| 9247 | /* "bgp default local-preference" commands. */ |
| 9248 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); |
| 9249 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); |
| 9250 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); |
| 9251 | |
| 9252 | /* "neighbor remote-as" commands. */ |
| 9253 | install_element (BGP_NODE, &neighbor_remote_as_cmd); |
| 9254 | install_element (BGP_NODE, &no_neighbor_cmd); |
| 9255 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); |
| 9256 | |
| 9257 | /* "neighbor peer-group" commands. */ |
| 9258 | install_element (BGP_NODE, &neighbor_peer_group_cmd); |
| 9259 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); |
| 9260 | install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd); |
| 9261 | |
| 9262 | /* "neighbor local-as" commands. */ |
| 9263 | install_element (BGP_NODE, &neighbor_local_as_cmd); |
| 9264 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 9265 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9266 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
| 9267 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); |
| 9268 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 9269 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9270 | |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 9271 | /* "neighbor password" commands. */ |
| 9272 | install_element (BGP_NODE, &neighbor_password_cmd); |
| 9273 | install_element (BGP_NODE, &no_neighbor_password_cmd); |
| 9274 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9275 | /* "neighbor activate" commands. */ |
| 9276 | install_element (BGP_NODE, &neighbor_activate_cmd); |
| 9277 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); |
| 9278 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); |
| 9279 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9280 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9281 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
| 9282 | |
| 9283 | /* "no neighbor activate" commands. */ |
| 9284 | install_element (BGP_NODE, &no_neighbor_activate_cmd); |
| 9285 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); |
| 9286 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); |
| 9287 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9288 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9289 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
| 9290 | |
| 9291 | /* "neighbor peer-group set" commands. */ |
| 9292 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
| 9293 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); |
| 9294 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); |
| 9295 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9296 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9297 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
| 9298 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9299 | /* "no neighbor peer-group unset" commands. */ |
| 9300 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); |
| 9301 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 9302 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); |
| 9303 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9304 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9305 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 9306 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9307 | /* "neighbor softreconfiguration inbound" commands.*/ |
| 9308 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9309 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9310 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9311 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9312 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9313 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9314 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9315 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9316 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9317 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9318 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9319 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9320 | |
| 9321 | /* "neighbor attribute-unchanged" commands. */ |
| 9322 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); |
| 9323 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); |
| 9324 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); |
| 9325 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); |
| 9326 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); |
| 9327 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); |
| 9328 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); |
| 9329 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); |
| 9330 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); |
| 9331 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); |
| 9332 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); |
| 9333 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9334 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9335 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9336 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9337 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9338 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9339 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9340 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9341 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9342 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9343 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9344 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); |
| 9345 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 9346 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 9347 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 9348 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 9349 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 9350 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 9351 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 9352 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 9353 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 9354 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 9355 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9356 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9357 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9358 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9359 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9360 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9361 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9362 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9363 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9364 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9365 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9366 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); |
| 9367 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); |
| 9368 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); |
| 9369 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); |
| 9370 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); |
| 9371 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); |
| 9372 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); |
| 9373 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); |
| 9374 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); |
| 9375 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); |
| 9376 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); |
| 9377 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9378 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9379 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9380 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9381 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9382 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9383 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9384 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9385 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9386 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9387 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9388 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); |
| 9389 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); |
| 9390 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); |
| 9391 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); |
| 9392 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); |
| 9393 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); |
| 9394 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); |
| 9395 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); |
| 9396 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); |
| 9397 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); |
| 9398 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); |
| 9399 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9400 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9401 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9402 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9403 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9404 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9405 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9406 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9407 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9408 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9409 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9410 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
| 9411 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); |
| 9412 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); |
| 9413 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); |
| 9414 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); |
| 9415 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); |
| 9416 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); |
| 9417 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); |
| 9418 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); |
| 9419 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); |
| 9420 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); |
| 9421 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9422 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9423 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9424 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9425 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9426 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9427 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9428 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9429 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9430 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9431 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9432 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
| 9433 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 9434 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 9435 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 9436 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 9437 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 9438 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 9439 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 9440 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 9441 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 9442 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 9443 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9444 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9445 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9446 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9447 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9448 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9449 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9450 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9451 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9452 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9453 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9454 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9455 | /* "nexthop-local unchanged" commands */ |
| 9456 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); |
| 9457 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); |
| 9458 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9459 | /* "transparent-as" and "transparent-nexthop" for old version |
| 9460 | compatibility. */ |
| 9461 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); |
| 9462 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); |
| 9463 | |
| 9464 | /* "neighbor next-hop-self" commands. */ |
| 9465 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); |
| 9466 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); |
| 9467 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); |
| 9468 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 9469 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); |
| 9470 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); |
| 9471 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); |
| 9472 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9473 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
| 9474 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9475 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
| 9476 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 9477 | |
| 9478 | /* "neighbor remove-private-AS" commands. */ |
| 9479 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); |
| 9480 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); |
| 9481 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
| 9482 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 9483 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
| 9484 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); |
| 9485 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
| 9486 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9487 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
| 9488 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9489 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
| 9490 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 9491 | |
| 9492 | /* "neighbor send-community" commands.*/ |
| 9493 | install_element (BGP_NODE, &neighbor_send_community_cmd); |
| 9494 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); |
| 9495 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); |
| 9496 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); |
| 9497 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); |
| 9498 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); |
| 9499 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); |
| 9500 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); |
| 9501 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); |
| 9502 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); |
| 9503 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); |
| 9504 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); |
| 9505 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); |
| 9506 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); |
| 9507 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); |
| 9508 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9509 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
| 9510 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); |
| 9511 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); |
| 9512 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9513 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
| 9514 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); |
| 9515 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); |
| 9516 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); |
| 9517 | |
| 9518 | /* "neighbor route-reflector" commands.*/ |
| 9519 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); |
| 9520 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9521 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); |
| 9522 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9523 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); |
| 9524 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9525 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); |
| 9526 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9527 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
| 9528 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9529 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
| 9530 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9531 | |
| 9532 | /* "neighbor route-server" commands.*/ |
| 9533 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); |
| 9534 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); |
| 9535 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); |
| 9536 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9537 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); |
| 9538 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); |
| 9539 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); |
| 9540 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9541 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
| 9542 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9543 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
| 9544 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9545 | |
| 9546 | /* "neighbor passive" commands. */ |
| 9547 | install_element (BGP_NODE, &neighbor_passive_cmd); |
| 9548 | install_element (BGP_NODE, &no_neighbor_passive_cmd); |
| 9549 | |
| 9550 | /* "neighbor shutdown" commands. */ |
| 9551 | install_element (BGP_NODE, &neighbor_shutdown_cmd); |
| 9552 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); |
| 9553 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 9554 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9555 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
| 9556 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); |
| 9557 | |
| 9558 | /* "neighbor capability orf prefix-list" commands.*/ |
| 9559 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9560 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9561 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9562 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9563 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9564 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9565 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9566 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9567 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9568 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9569 | |
| 9570 | /* "neighbor capability dynamic" commands.*/ |
| 9571 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); |
| 9572 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); |
| 9573 | |
| 9574 | /* "neighbor dont-capability-negotiate" commands. */ |
| 9575 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); |
| 9576 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); |
| 9577 | |
| 9578 | /* "neighbor ebgp-multihop" commands. */ |
| 9579 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); |
| 9580 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); |
| 9581 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); |
| 9582 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); |
| 9583 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 9584 | /* "neighbor disable-connected-check" commands. */ |
| 9585 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); |
| 9586 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9587 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
| 9588 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); |
| 9589 | |
| 9590 | /* "neighbor description" commands. */ |
| 9591 | install_element (BGP_NODE, &neighbor_description_cmd); |
| 9592 | install_element (BGP_NODE, &no_neighbor_description_cmd); |
| 9593 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); |
| 9594 | |
| 9595 | /* "neighbor update-source" commands. "*/ |
| 9596 | install_element (BGP_NODE, &neighbor_update_source_cmd); |
| 9597 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); |
| 9598 | |
| 9599 | /* "neighbor default-originate" commands. */ |
| 9600 | install_element (BGP_NODE, &neighbor_default_originate_cmd); |
| 9601 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); |
| 9602 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); |
| 9603 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9604 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); |
| 9605 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); |
| 9606 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); |
| 9607 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9608 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); |
| 9609 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9610 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); |
| 9611 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9612 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); |
| 9613 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); |
| 9614 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); |
| 9615 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9616 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
| 9617 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9618 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); |
| 9619 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9620 | |
| 9621 | /* "neighbor port" commands. */ |
| 9622 | install_element (BGP_NODE, &neighbor_port_cmd); |
| 9623 | install_element (BGP_NODE, &no_neighbor_port_cmd); |
| 9624 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); |
| 9625 | |
| 9626 | /* "neighbor weight" commands. */ |
| 9627 | install_element (BGP_NODE, &neighbor_weight_cmd); |
| 9628 | install_element (BGP_NODE, &no_neighbor_weight_cmd); |
| 9629 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); |
| 9630 | |
| 9631 | /* "neighbor override-capability" commands. */ |
| 9632 | install_element (BGP_NODE, &neighbor_override_capability_cmd); |
| 9633 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); |
| 9634 | |
| 9635 | /* "neighbor strict-capability-match" commands. */ |
| 9636 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); |
| 9637 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); |
| 9638 | |
| 9639 | /* "neighbor timers" commands. */ |
| 9640 | install_element (BGP_NODE, &neighbor_timers_cmd); |
| 9641 | install_element (BGP_NODE, &no_neighbor_timers_cmd); |
| 9642 | |
| 9643 | /* "neighbor timers connect" commands. */ |
| 9644 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); |
| 9645 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); |
| 9646 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); |
| 9647 | |
| 9648 | /* "neighbor advertisement-interval" commands. */ |
| 9649 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); |
| 9650 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); |
| 9651 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); |
| 9652 | |
| 9653 | /* "neighbor version" commands. */ |
| 9654 | install_element (BGP_NODE, &neighbor_version_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9655 | |
| 9656 | /* "neighbor interface" commands. */ |
| 9657 | install_element (BGP_NODE, &neighbor_interface_cmd); |
| 9658 | install_element (BGP_NODE, &no_neighbor_interface_cmd); |
| 9659 | |
| 9660 | /* "neighbor distribute" commands. */ |
| 9661 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); |
| 9662 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); |
| 9663 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); |
| 9664 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9665 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); |
| 9666 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); |
| 9667 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); |
| 9668 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9669 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
| 9670 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9671 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
| 9672 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9673 | |
| 9674 | /* "neighbor prefix-list" commands. */ |
| 9675 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); |
| 9676 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); |
| 9677 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); |
| 9678 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9679 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); |
| 9680 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); |
| 9681 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); |
| 9682 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9683 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
| 9684 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9685 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
| 9686 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9687 | |
| 9688 | /* "neighbor filter-list" commands. */ |
| 9689 | install_element (BGP_NODE, &neighbor_filter_list_cmd); |
| 9690 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); |
| 9691 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); |
| 9692 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); |
| 9693 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); |
| 9694 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); |
| 9695 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); |
| 9696 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9697 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
| 9698 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9699 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
| 9700 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); |
| 9701 | |
| 9702 | /* "neighbor route-map" commands. */ |
| 9703 | install_element (BGP_NODE, &neighbor_route_map_cmd); |
| 9704 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); |
| 9705 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); |
| 9706 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); |
| 9707 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); |
| 9708 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); |
| 9709 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); |
| 9710 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9711 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
| 9712 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9713 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
| 9714 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); |
| 9715 | |
| 9716 | /* "neighbor unsuppress-map" commands. */ |
| 9717 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); |
| 9718 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9719 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9720 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9721 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); |
| 9722 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9723 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); |
| 9724 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9725 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
| 9726 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9727 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9728 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9729 | |
| 9730 | /* "neighbor maximum-prefix" commands. */ |
| 9731 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9732 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9733 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9734 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9735 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9736 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9737 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9738 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9739 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9740 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9741 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9742 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9743 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9744 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9745 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9746 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9747 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9748 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9749 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9750 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9751 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9752 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9753 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9754 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9755 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9756 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9757 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9758 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9759 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9760 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9761 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9762 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9763 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9764 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9765 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9766 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9767 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9768 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9769 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9770 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9771 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9772 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9773 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9774 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9775 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9776 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9777 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9778 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9779 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9780 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9781 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9782 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9783 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
| 9784 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
| 9785 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); |
| 9786 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
| 9787 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9788 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
| 9789 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9790 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
| 9791 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9792 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9793 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9794 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9795 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9796 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9797 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9798 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9799 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9800 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9801 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9802 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9803 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9804 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9805 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9806 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9807 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9808 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9809 | |
| 9810 | /* "neighbor allowas-in" */ |
| 9811 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); |
| 9812 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); |
| 9813 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); |
| 9814 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
| 9815 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9816 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9817 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
| 9818 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9819 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); |
| 9820 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
| 9821 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); |
| 9822 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9823 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
| 9824 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9825 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9826 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
| 9827 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9828 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9829 | |
| 9830 | /* address-family commands. */ |
| 9831 | install_element (BGP_NODE, &address_family_ipv4_cmd); |
| 9832 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); |
| 9833 | #ifdef HAVE_IPV6 |
| 9834 | install_element (BGP_NODE, &address_family_ipv6_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9835 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9836 | #endif /* HAVE_IPV6 */ |
| 9837 | install_element (BGP_NODE, &address_family_vpnv4_cmd); |
| 9838 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); |
| 9839 | |
| 9840 | /* "exit-address-family" command. */ |
| 9841 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); |
| 9842 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); |
| 9843 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9844 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9845 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
| 9846 | |
| 9847 | /* "clear ip bgp commands" */ |
| 9848 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); |
| 9849 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); |
| 9850 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); |
| 9851 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
| 9852 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
| 9853 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
| 9854 | #ifdef HAVE_IPV6 |
| 9855 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
| 9856 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); |
| 9857 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); |
| 9858 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
| 9859 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
| 9860 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
| 9861 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
| 9862 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
| 9863 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
| 9864 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
| 9865 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
| 9866 | #endif /* HAVE_IPV6 */ |
| 9867 | |
| 9868 | /* "clear ip bgp neighbor soft in" */ |
| 9869 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); |
| 9870 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); |
| 9871 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); |
| 9872 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
| 9873 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); |
| 9874 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
| 9875 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
| 9876 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
| 9877 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); |
| 9878 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
| 9879 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
| 9880 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); |
| 9881 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
| 9882 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
| 9883 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); |
| 9884 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
| 9885 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
| 9886 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); |
| 9887 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); |
| 9888 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); |
| 9889 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
| 9890 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); |
| 9891 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
| 9892 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
| 9893 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
| 9894 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); |
| 9895 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
| 9896 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
| 9897 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); |
| 9898 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
| 9899 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
| 9900 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); |
| 9901 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
| 9902 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
| 9903 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); |
| 9904 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); |
| 9905 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); |
| 9906 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); |
| 9907 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); |
| 9908 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); |
| 9909 | #ifdef HAVE_IPV6 |
| 9910 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
| 9911 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); |
| 9912 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); |
| 9913 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
| 9914 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); |
| 9915 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
| 9916 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
| 9917 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); |
| 9918 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
| 9919 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
| 9920 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); |
| 9921 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
| 9922 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
| 9923 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); |
| 9924 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
| 9925 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
| 9926 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); |
| 9927 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
| 9928 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
| 9929 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); |
| 9930 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
| 9931 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
| 9932 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); |
| 9933 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
| 9934 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
| 9935 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); |
| 9936 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
| 9937 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
| 9938 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); |
| 9939 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
| 9940 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
| 9941 | #endif /* HAVE_IPV6 */ |
| 9942 | |
| 9943 | /* "clear ip bgp neighbor soft out" */ |
| 9944 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); |
| 9945 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); |
| 9946 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); |
| 9947 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
| 9948 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
| 9949 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
| 9950 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
| 9951 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
| 9952 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
| 9953 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
| 9954 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
| 9955 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
| 9956 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); |
| 9957 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); |
| 9958 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
| 9959 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
| 9960 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
| 9961 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
| 9962 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
| 9963 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
| 9964 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
| 9965 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
| 9966 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
| 9967 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); |
| 9968 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); |
| 9969 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); |
| 9970 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); |
| 9971 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); |
| 9972 | #ifdef HAVE_IPV6 |
| 9973 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
| 9974 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); |
| 9975 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); |
| 9976 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
| 9977 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
| 9978 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
| 9979 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
| 9980 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
| 9981 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
| 9982 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
| 9983 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
| 9984 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
| 9985 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
| 9986 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
| 9987 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
| 9988 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
| 9989 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
| 9990 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
| 9991 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
| 9992 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
| 9993 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
| 9994 | #endif /* HAVE_IPV6 */ |
| 9995 | |
| 9996 | /* "clear ip bgp neighbor soft" */ |
| 9997 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); |
| 9998 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); |
| 9999 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); |
| 10000 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
| 10001 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
| 10002 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
| 10003 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
| 10004 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); |
| 10005 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); |
| 10006 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
| 10007 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
| 10008 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
| 10009 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
| 10010 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); |
| 10011 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); |
| 10012 | #ifdef HAVE_IPV6 |
| 10013 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
| 10014 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); |
| 10015 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); |
| 10016 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
| 10017 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
| 10018 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
| 10019 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
| 10020 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
| 10021 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
| 10022 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
| 10023 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
| 10024 | #endif /* HAVE_IPV6 */ |
| 10025 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10026 | /* "clear ip bgp neighbor rsclient" */ |
| 10027 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); |
| 10028 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); |
| 10029 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); |
| 10030 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); |
| 10031 | #ifdef HAVE_IPV6 |
| 10032 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); |
| 10033 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); |
| 10034 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); |
| 10035 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); |
| 10036 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); |
| 10037 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); |
| 10038 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); |
| 10039 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); |
| 10040 | #endif /* HAVE_IPV6 */ |
| 10041 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10042 | /* "show ip bgp summary" commands. */ |
| 10043 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); |
| 10044 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
| 10045 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10046 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10047 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10048 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10049 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 10050 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 10051 | #ifdef HAVE_IPV6 |
| 10052 | install_element (VIEW_NODE, &show_bgp_summary_cmd); |
| 10053 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); |
| 10054 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10055 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10056 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10057 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10058 | #endif /* HAVE_IPV6 */ |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10059 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); |
| 10060 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
| 10061 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10062 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10063 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10064 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10065 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 10066 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 10067 | #ifdef HAVE_IPV6 |
| 10068 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); |
| 10069 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); |
| 10070 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10071 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10072 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10073 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10074 | #endif /* HAVE_IPV6 */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10075 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); |
| 10076 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
| 10077 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10078 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10079 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10080 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10081 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 10082 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 10083 | #ifdef HAVE_IPV6 |
| 10084 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); |
| 10085 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); |
| 10086 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10087 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10088 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10089 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10090 | #endif /* HAVE_IPV6 */ |
| 10091 | |
| 10092 | /* "show ip bgp neighbors" commands. */ |
| 10093 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); |
| 10094 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 10095 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10096 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10097 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 10098 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 10099 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10100 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10101 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 10102 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10103 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10104 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10105 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10106 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10107 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10108 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
| 10109 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 10110 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10111 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10112 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 10113 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 10114 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10115 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10116 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 10117 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 10118 | |
| 10119 | #ifdef HAVE_IPV6 |
| 10120 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); |
| 10121 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 10122 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); |
| 10123 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 10124 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
| 10125 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 10126 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10127 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10128 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
| 10129 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
| 10130 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10131 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10132 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
| 10133 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 10134 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); |
| 10135 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 10136 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
| 10137 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 10138 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10139 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10140 | |
| 10141 | /* Old commands. */ |
| 10142 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); |
| 10143 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); |
| 10144 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); |
| 10145 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); |
| 10146 | #endif /* HAVE_IPV6 */ |
| 10147 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10148 | /* "show ip bgp rsclient" commands. */ |
| 10149 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10150 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10151 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10152 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10153 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10154 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10155 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10156 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10157 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10158 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10159 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10160 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10161 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10162 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10163 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10164 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10165 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10166 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10167 | |
| 10168 | #ifdef HAVE_IPV6 |
| 10169 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); |
| 10170 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10171 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10172 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10173 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10174 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10175 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
| 10176 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10177 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10178 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10179 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10180 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10181 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
| 10182 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10183 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10184 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10185 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10186 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10187 | #endif /* HAVE_IPV6 */ |
| 10188 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10189 | /* "show ip bgp paths" commands. */ |
| 10190 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); |
| 10191 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 10192 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); |
| 10193 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 10194 | |
| 10195 | /* "show ip bgp community" commands. */ |
| 10196 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); |
| 10197 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); |
| 10198 | |
| 10199 | /* "show ip bgp attribute-info" commands. */ |
| 10200 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); |
| 10201 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); |
| 10202 | |
| 10203 | /* "redistribute" commands. */ |
| 10204 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); |
| 10205 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); |
| 10206 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); |
| 10207 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); |
| 10208 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); |
| 10209 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); |
| 10210 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); |
| 10211 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); |
| 10212 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); |
| 10213 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); |
| 10214 | #ifdef HAVE_IPV6 |
| 10215 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); |
| 10216 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); |
| 10217 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); |
| 10218 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); |
| 10219 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); |
| 10220 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); |
| 10221 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); |
| 10222 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); |
| 10223 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); |
| 10224 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); |
| 10225 | #endif /* HAVE_IPV6 */ |
| 10226 | |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 10227 | /* ttl_security commands */ |
| 10228 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); |
| 10229 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); |
| 10230 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 10231 | /* "show bgp memory" commands. */ |
| 10232 | install_element (VIEW_NODE, &show_bgp_memory_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10233 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 10234 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
| 10235 | |
Michael Lambert | e0081f7 | 2008-11-16 20:12:04 +0000 | [diff] [blame] | 10236 | /* "show bgp views" commands. */ |
| 10237 | install_element (VIEW_NODE, &show_bgp_views_cmd); |
| 10238 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); |
| 10239 | install_element (ENABLE_NODE, &show_bgp_views_cmd); |
| 10240 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10241 | /* Community-list. */ |
| 10242 | community_list_vty (); |
| 10243 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 10244 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10245 | #include "memory.h" |
| 10246 | #include "bgp_regex.h" |
| 10247 | #include "bgp_clist.h" |
| 10248 | #include "bgp_ecommunity.h" |
| 10249 | |
| 10250 | /* VTY functions. */ |
| 10251 | |
| 10252 | /* Direction value to string conversion. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10253 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10254 | community_direct_str (int direct) |
| 10255 | { |
| 10256 | switch (direct) |
| 10257 | { |
| 10258 | case COMMUNITY_DENY: |
| 10259 | return "deny"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10260 | case COMMUNITY_PERMIT: |
| 10261 | return "permit"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10262 | default: |
| 10263 | return "unknown"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10264 | } |
| 10265 | } |
| 10266 | |
| 10267 | /* Display error string. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10268 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10269 | community_list_perror (struct vty *vty, int ret) |
| 10270 | { |
| 10271 | switch (ret) |
| 10272 | { |
| 10273 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10274 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10275 | break; |
| 10276 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: |
| 10277 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); |
| 10278 | break; |
| 10279 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: |
| 10280 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); |
| 10281 | break; |
| 10282 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: |
| 10283 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); |
| 10284 | break; |
| 10285 | } |
| 10286 | } |
| 10287 | |
| 10288 | /* VTY interface for community_set() function. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10289 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10290 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10291 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10292 | { |
| 10293 | int ret; |
| 10294 | int direct; |
| 10295 | char *str; |
| 10296 | |
| 10297 | /* Check the list type. */ |
| 10298 | if (strncmp (argv[1], "p", 1) == 0) |
| 10299 | direct = COMMUNITY_PERMIT; |
| 10300 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10301 | direct = COMMUNITY_DENY; |
| 10302 | else |
| 10303 | { |
| 10304 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10305 | VTY_NEWLINE); |
| 10306 | return CMD_WARNING; |
| 10307 | } |
| 10308 | |
| 10309 | /* All digit name check. */ |
| 10310 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10311 | { |
| 10312 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10313 | return CMD_WARNING; |
| 10314 | } |
| 10315 | |
| 10316 | /* Concat community string argument. */ |
| 10317 | if (argc > 1) |
| 10318 | str = argv_concat (argv, argc, 2); |
| 10319 | else |
| 10320 | str = NULL; |
| 10321 | |
| 10322 | /* When community_list_set() return nevetive value, it means |
| 10323 | malformed community string. */ |
| 10324 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); |
| 10325 | |
| 10326 | /* Free temporary community list string allocated by |
| 10327 | argv_concat(). */ |
| 10328 | if (str) |
| 10329 | XFREE (MTYPE_TMP, str); |
| 10330 | |
| 10331 | if (ret < 0) |
| 10332 | { |
| 10333 | /* Display error string. */ |
| 10334 | community_list_perror (vty, ret); |
| 10335 | return CMD_WARNING; |
| 10336 | } |
| 10337 | |
| 10338 | return CMD_SUCCESS; |
| 10339 | } |
| 10340 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10341 | /* Communiyt-list entry delete. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10342 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10343 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10344 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10345 | { |
| 10346 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10347 | int direct = 0; |
| 10348 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10349 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10350 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10351 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10352 | /* Check the list direct. */ |
| 10353 | if (strncmp (argv[1], "p", 1) == 0) |
| 10354 | direct = COMMUNITY_PERMIT; |
| 10355 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10356 | direct = COMMUNITY_DENY; |
| 10357 | else |
| 10358 | { |
| 10359 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10360 | VTY_NEWLINE); |
| 10361 | return CMD_WARNING; |
| 10362 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10363 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10364 | /* Concat community string argument. */ |
| 10365 | str = argv_concat (argv, argc, 2); |
| 10366 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10367 | |
| 10368 | /* Unset community list. */ |
| 10369 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10370 | |
| 10371 | /* Free temporary community list string allocated by |
| 10372 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10373 | if (str) |
| 10374 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10375 | |
| 10376 | if (ret < 0) |
| 10377 | { |
| 10378 | community_list_perror (vty, ret); |
| 10379 | return CMD_WARNING; |
| 10380 | } |
| 10381 | |
| 10382 | return CMD_SUCCESS; |
| 10383 | } |
| 10384 | |
| 10385 | /* "community-list" keyword help string. */ |
| 10386 | #define COMMUNITY_LIST_STR "Add a community list entry\n" |
| 10387 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" |
| 10388 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10389 | DEFUN (ip_community_list_standard, |
| 10390 | ip_community_list_standard_cmd, |
| 10391 | "ip community-list <1-99> (deny|permit) .AA:NN", |
| 10392 | IP_STR |
| 10393 | COMMUNITY_LIST_STR |
| 10394 | "Community list number (standard)\n" |
| 10395 | "Specify community to reject\n" |
| 10396 | "Specify community to accept\n" |
| 10397 | COMMUNITY_VAL_STR) |
| 10398 | { |
| 10399 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
| 10400 | } |
| 10401 | |
| 10402 | ALIAS (ip_community_list_standard, |
| 10403 | ip_community_list_standard2_cmd, |
| 10404 | "ip community-list <1-99> (deny|permit)", |
| 10405 | IP_STR |
| 10406 | COMMUNITY_LIST_STR |
| 10407 | "Community list number (standard)\n" |
| 10408 | "Specify community to reject\n" |
| 10409 | "Specify community to accept\n") |
| 10410 | |
| 10411 | DEFUN (ip_community_list_expanded, |
| 10412 | ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10413 | "ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10414 | IP_STR |
| 10415 | COMMUNITY_LIST_STR |
| 10416 | "Community list number (expanded)\n" |
| 10417 | "Specify community to reject\n" |
| 10418 | "Specify community to accept\n" |
| 10419 | "An ordered list as a regular-expression\n") |
| 10420 | { |
| 10421 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
| 10422 | } |
| 10423 | |
| 10424 | DEFUN (ip_community_list_name_standard, |
| 10425 | ip_community_list_name_standard_cmd, |
| 10426 | "ip community-list standard WORD (deny|permit) .AA:NN", |
| 10427 | IP_STR |
| 10428 | COMMUNITY_LIST_STR |
| 10429 | "Add a standard community-list entry\n" |
| 10430 | "Community list name\n" |
| 10431 | "Specify community to reject\n" |
| 10432 | "Specify community to accept\n" |
| 10433 | COMMUNITY_VAL_STR) |
| 10434 | { |
| 10435 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
| 10436 | } |
| 10437 | |
| 10438 | ALIAS (ip_community_list_name_standard, |
| 10439 | ip_community_list_name_standard2_cmd, |
| 10440 | "ip community-list standard WORD (deny|permit)", |
| 10441 | IP_STR |
| 10442 | COMMUNITY_LIST_STR |
| 10443 | "Add a standard community-list entry\n" |
| 10444 | "Community list name\n" |
| 10445 | "Specify community to reject\n" |
| 10446 | "Specify community to accept\n") |
| 10447 | |
| 10448 | DEFUN (ip_community_list_name_expanded, |
| 10449 | ip_community_list_name_expanded_cmd, |
| 10450 | "ip community-list expanded WORD (deny|permit) .LINE", |
| 10451 | IP_STR |
| 10452 | COMMUNITY_LIST_STR |
| 10453 | "Add an expanded community-list entry\n" |
| 10454 | "Community list name\n" |
| 10455 | "Specify community to reject\n" |
| 10456 | "Specify community to accept\n" |
| 10457 | "An ordered list as a regular-expression\n") |
| 10458 | { |
| 10459 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
| 10460 | } |
| 10461 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10462 | DEFUN (no_ip_community_list_standard_all, |
| 10463 | no_ip_community_list_standard_all_cmd, |
| 10464 | "no ip community-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10465 | NO_STR |
| 10466 | IP_STR |
| 10467 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10468 | "Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10469 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10470 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10471 | } |
| 10472 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10473 | DEFUN (no_ip_community_list_expanded_all, |
| 10474 | no_ip_community_list_expanded_all_cmd, |
| 10475 | "no ip community-list <100-500>", |
| 10476 | NO_STR |
| 10477 | IP_STR |
| 10478 | COMMUNITY_LIST_STR |
| 10479 | "Community list number (expanded)\n") |
| 10480 | { |
| 10481 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10482 | } |
| 10483 | |
| 10484 | DEFUN (no_ip_community_list_name_standard_all, |
| 10485 | no_ip_community_list_name_standard_all_cmd, |
| 10486 | "no ip community-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10487 | NO_STR |
| 10488 | IP_STR |
| 10489 | COMMUNITY_LIST_STR |
| 10490 | "Add a standard community-list entry\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10491 | "Community list name\n") |
| 10492 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10493 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10494 | } |
| 10495 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10496 | DEFUN (no_ip_community_list_name_expanded_all, |
| 10497 | no_ip_community_list_name_expanded_all_cmd, |
| 10498 | "no ip community-list expanded WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10499 | NO_STR |
| 10500 | IP_STR |
| 10501 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10502 | "Add an expanded community-list entry\n" |
| 10503 | "Community list name\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10504 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10505 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10506 | } |
| 10507 | |
| 10508 | DEFUN (no_ip_community_list_standard, |
| 10509 | no_ip_community_list_standard_cmd, |
| 10510 | "no ip community-list <1-99> (deny|permit) .AA:NN", |
| 10511 | NO_STR |
| 10512 | IP_STR |
| 10513 | COMMUNITY_LIST_STR |
| 10514 | "Community list number (standard)\n" |
| 10515 | "Specify community to reject\n" |
| 10516 | "Specify community to accept\n" |
| 10517 | COMMUNITY_VAL_STR) |
| 10518 | { |
| 10519 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 10520 | } |
| 10521 | |
| 10522 | DEFUN (no_ip_community_list_expanded, |
| 10523 | no_ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10524 | "no ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10525 | NO_STR |
| 10526 | IP_STR |
| 10527 | COMMUNITY_LIST_STR |
| 10528 | "Community list number (expanded)\n" |
| 10529 | "Specify community to reject\n" |
| 10530 | "Specify community to accept\n" |
| 10531 | "An ordered list as a regular-expression\n") |
| 10532 | { |
| 10533 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10534 | } |
| 10535 | |
| 10536 | DEFUN (no_ip_community_list_name_standard, |
| 10537 | no_ip_community_list_name_standard_cmd, |
| 10538 | "no ip community-list standard WORD (deny|permit) .AA:NN", |
| 10539 | NO_STR |
| 10540 | IP_STR |
| 10541 | COMMUNITY_LIST_STR |
| 10542 | "Specify a standard community-list\n" |
| 10543 | "Community list name\n" |
| 10544 | "Specify community to reject\n" |
| 10545 | "Specify community to accept\n" |
| 10546 | COMMUNITY_VAL_STR) |
| 10547 | { |
| 10548 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 10549 | } |
| 10550 | |
| 10551 | DEFUN (no_ip_community_list_name_expanded, |
| 10552 | no_ip_community_list_name_expanded_cmd, |
| 10553 | "no ip community-list expanded WORD (deny|permit) .LINE", |
| 10554 | NO_STR |
| 10555 | IP_STR |
| 10556 | COMMUNITY_LIST_STR |
| 10557 | "Specify an expanded community-list\n" |
| 10558 | "Community list name\n" |
| 10559 | "Specify community to reject\n" |
| 10560 | "Specify community to accept\n" |
| 10561 | "An ordered list as a regular-expression\n") |
| 10562 | { |
| 10563 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10564 | } |
| 10565 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10566 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10567 | community_list_show (struct vty *vty, struct community_list *list) |
| 10568 | { |
| 10569 | struct community_entry *entry; |
| 10570 | |
| 10571 | for (entry = list->head; entry; entry = entry->next) |
| 10572 | { |
| 10573 | if (entry == list->head) |
| 10574 | { |
| 10575 | if (all_digit (list->name)) |
| 10576 | vty_out (vty, "Community %s list %s%s", |
| 10577 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 10578 | "standard" : "(expanded) access", |
| 10579 | list->name, VTY_NEWLINE); |
| 10580 | else |
| 10581 | vty_out (vty, "Named Community %s list %s%s", |
| 10582 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 10583 | "standard" : "expanded", |
| 10584 | list->name, VTY_NEWLINE); |
| 10585 | } |
| 10586 | if (entry->any) |
| 10587 | vty_out (vty, " %s%s", |
| 10588 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10589 | else |
| 10590 | vty_out (vty, " %s %s%s", |
| 10591 | community_direct_str (entry->direct), |
| 10592 | entry->style == COMMUNITY_LIST_STANDARD |
| 10593 | ? community_str (entry->u.com) : entry->config, |
| 10594 | VTY_NEWLINE); |
| 10595 | } |
| 10596 | } |
| 10597 | |
| 10598 | DEFUN (show_ip_community_list, |
| 10599 | show_ip_community_list_cmd, |
| 10600 | "show ip community-list", |
| 10601 | SHOW_STR |
| 10602 | IP_STR |
| 10603 | "List community-list\n") |
| 10604 | { |
| 10605 | struct community_list *list; |
| 10606 | struct community_list_master *cm; |
| 10607 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10608 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10609 | if (! cm) |
| 10610 | return CMD_SUCCESS; |
| 10611 | |
| 10612 | for (list = cm->num.head; list; list = list->next) |
| 10613 | community_list_show (vty, list); |
| 10614 | |
| 10615 | for (list = cm->str.head; list; list = list->next) |
| 10616 | community_list_show (vty, list); |
| 10617 | |
| 10618 | return CMD_SUCCESS; |
| 10619 | } |
| 10620 | |
| 10621 | DEFUN (show_ip_community_list_arg, |
| 10622 | show_ip_community_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10623 | "show ip community-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10624 | SHOW_STR |
| 10625 | IP_STR |
| 10626 | "List community-list\n" |
| 10627 | "Community-list number\n" |
| 10628 | "Community-list name\n") |
| 10629 | { |
| 10630 | struct community_list *list; |
| 10631 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10632 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10633 | if (! list) |
| 10634 | { |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10635 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10636 | return CMD_WARNING; |
| 10637 | } |
| 10638 | |
| 10639 | community_list_show (vty, list); |
| 10640 | |
| 10641 | return CMD_SUCCESS; |
| 10642 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 10643 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10644 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10645 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10646 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10647 | { |
| 10648 | int ret; |
| 10649 | int direct; |
| 10650 | char *str; |
| 10651 | |
| 10652 | /* Check the list type. */ |
| 10653 | if (strncmp (argv[1], "p", 1) == 0) |
| 10654 | direct = COMMUNITY_PERMIT; |
| 10655 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10656 | direct = COMMUNITY_DENY; |
| 10657 | else |
| 10658 | { |
| 10659 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10660 | VTY_NEWLINE); |
| 10661 | return CMD_WARNING; |
| 10662 | } |
| 10663 | |
| 10664 | /* All digit name check. */ |
| 10665 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10666 | { |
| 10667 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10668 | return CMD_WARNING; |
| 10669 | } |
| 10670 | |
| 10671 | /* Concat community string argument. */ |
| 10672 | if (argc > 1) |
| 10673 | str = argv_concat (argv, argc, 2); |
| 10674 | else |
| 10675 | str = NULL; |
| 10676 | |
| 10677 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); |
| 10678 | |
| 10679 | /* Free temporary community list string allocated by |
| 10680 | argv_concat(). */ |
| 10681 | if (str) |
| 10682 | XFREE (MTYPE_TMP, str); |
| 10683 | |
| 10684 | if (ret < 0) |
| 10685 | { |
| 10686 | community_list_perror (vty, ret); |
| 10687 | return CMD_WARNING; |
| 10688 | } |
| 10689 | return CMD_SUCCESS; |
| 10690 | } |
| 10691 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10692 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10693 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10694 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10695 | { |
| 10696 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10697 | int direct = 0; |
| 10698 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10699 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10700 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10701 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10702 | /* Check the list direct. */ |
| 10703 | if (strncmp (argv[1], "p", 1) == 0) |
| 10704 | direct = COMMUNITY_PERMIT; |
| 10705 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10706 | direct = COMMUNITY_DENY; |
| 10707 | else |
| 10708 | { |
| 10709 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10710 | VTY_NEWLINE); |
| 10711 | return CMD_WARNING; |
| 10712 | } |
| 10713 | |
| 10714 | /* Concat community string argument. */ |
| 10715 | str = argv_concat (argv, argc, 2); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10716 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10717 | |
| 10718 | /* Unset community list. */ |
| 10719 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10720 | |
| 10721 | /* Free temporary community list string allocated by |
| 10722 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10723 | if (str) |
| 10724 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10725 | |
| 10726 | if (ret < 0) |
| 10727 | { |
| 10728 | community_list_perror (vty, ret); |
| 10729 | return CMD_WARNING; |
| 10730 | } |
| 10731 | |
| 10732 | return CMD_SUCCESS; |
| 10733 | } |
| 10734 | |
| 10735 | /* "extcommunity-list" keyword help string. */ |
| 10736 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" |
| 10737 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" |
| 10738 | |
| 10739 | DEFUN (ip_extcommunity_list_standard, |
| 10740 | ip_extcommunity_list_standard_cmd, |
| 10741 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10742 | IP_STR |
| 10743 | EXTCOMMUNITY_LIST_STR |
| 10744 | "Extended Community list number (standard)\n" |
| 10745 | "Specify community to reject\n" |
| 10746 | "Specify community to accept\n" |
| 10747 | EXTCOMMUNITY_VAL_STR) |
| 10748 | { |
| 10749 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
| 10750 | } |
| 10751 | |
| 10752 | ALIAS (ip_extcommunity_list_standard, |
| 10753 | ip_extcommunity_list_standard2_cmd, |
| 10754 | "ip extcommunity-list <1-99> (deny|permit)", |
| 10755 | IP_STR |
| 10756 | EXTCOMMUNITY_LIST_STR |
| 10757 | "Extended Community list number (standard)\n" |
| 10758 | "Specify community to reject\n" |
| 10759 | "Specify community to accept\n") |
| 10760 | |
| 10761 | DEFUN (ip_extcommunity_list_expanded, |
| 10762 | ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10763 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10764 | IP_STR |
| 10765 | EXTCOMMUNITY_LIST_STR |
| 10766 | "Extended Community list number (expanded)\n" |
| 10767 | "Specify community to reject\n" |
| 10768 | "Specify community to accept\n" |
| 10769 | "An ordered list as a regular-expression\n") |
| 10770 | { |
| 10771 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
| 10772 | } |
| 10773 | |
| 10774 | DEFUN (ip_extcommunity_list_name_standard, |
| 10775 | ip_extcommunity_list_name_standard_cmd, |
| 10776 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10777 | IP_STR |
| 10778 | EXTCOMMUNITY_LIST_STR |
| 10779 | "Specify standard extcommunity-list\n" |
| 10780 | "Extended Community list name\n" |
| 10781 | "Specify community to reject\n" |
| 10782 | "Specify community to accept\n" |
| 10783 | EXTCOMMUNITY_VAL_STR) |
| 10784 | { |
| 10785 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
| 10786 | } |
| 10787 | |
| 10788 | ALIAS (ip_extcommunity_list_name_standard, |
| 10789 | ip_extcommunity_list_name_standard2_cmd, |
| 10790 | "ip extcommunity-list standard WORD (deny|permit)", |
| 10791 | IP_STR |
| 10792 | EXTCOMMUNITY_LIST_STR |
| 10793 | "Specify standard extcommunity-list\n" |
| 10794 | "Extended Community list name\n" |
| 10795 | "Specify community to reject\n" |
| 10796 | "Specify community to accept\n") |
| 10797 | |
| 10798 | DEFUN (ip_extcommunity_list_name_expanded, |
| 10799 | ip_extcommunity_list_name_expanded_cmd, |
| 10800 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10801 | IP_STR |
| 10802 | EXTCOMMUNITY_LIST_STR |
| 10803 | "Specify expanded extcommunity-list\n" |
| 10804 | "Extended Community list name\n" |
| 10805 | "Specify community to reject\n" |
| 10806 | "Specify community to accept\n" |
| 10807 | "An ordered list as a regular-expression\n") |
| 10808 | { |
| 10809 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
| 10810 | } |
| 10811 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10812 | DEFUN (no_ip_extcommunity_list_standard_all, |
| 10813 | no_ip_extcommunity_list_standard_all_cmd, |
| 10814 | "no ip extcommunity-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10815 | NO_STR |
| 10816 | IP_STR |
| 10817 | EXTCOMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10818 | "Extended Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10819 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10820 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10821 | } |
| 10822 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10823 | DEFUN (no_ip_extcommunity_list_expanded_all, |
| 10824 | no_ip_extcommunity_list_expanded_all_cmd, |
| 10825 | "no ip extcommunity-list <100-500>", |
| 10826 | NO_STR |
| 10827 | IP_STR |
| 10828 | EXTCOMMUNITY_LIST_STR |
| 10829 | "Extended Community list number (expanded)\n") |
| 10830 | { |
| 10831 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10832 | } |
| 10833 | |
| 10834 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
| 10835 | no_ip_extcommunity_list_name_standard_all_cmd, |
| 10836 | "no ip extcommunity-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10837 | NO_STR |
| 10838 | IP_STR |
| 10839 | EXTCOMMUNITY_LIST_STR |
| 10840 | "Specify standard extcommunity-list\n" |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10841 | "Extended Community list name\n") |
| 10842 | { |
| 10843 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10844 | } |
| 10845 | |
| 10846 | DEFUN (no_ip_extcommunity_list_name_expanded_all, |
| 10847 | no_ip_extcommunity_list_name_expanded_all_cmd, |
| 10848 | "no ip extcommunity-list expanded WORD", |
| 10849 | NO_STR |
| 10850 | IP_STR |
| 10851 | EXTCOMMUNITY_LIST_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10852 | "Specify expanded extcommunity-list\n" |
| 10853 | "Extended Community list name\n") |
| 10854 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10855 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10856 | } |
| 10857 | |
| 10858 | DEFUN (no_ip_extcommunity_list_standard, |
| 10859 | no_ip_extcommunity_list_standard_cmd, |
| 10860 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10861 | NO_STR |
| 10862 | IP_STR |
| 10863 | EXTCOMMUNITY_LIST_STR |
| 10864 | "Extended Community list number (standard)\n" |
| 10865 | "Specify community to reject\n" |
| 10866 | "Specify community to accept\n" |
| 10867 | EXTCOMMUNITY_VAL_STR) |
| 10868 | { |
| 10869 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10870 | } |
| 10871 | |
| 10872 | DEFUN (no_ip_extcommunity_list_expanded, |
| 10873 | no_ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10874 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10875 | NO_STR |
| 10876 | IP_STR |
| 10877 | EXTCOMMUNITY_LIST_STR |
| 10878 | "Extended Community list number (expanded)\n" |
| 10879 | "Specify community to reject\n" |
| 10880 | "Specify community to accept\n" |
| 10881 | "An ordered list as a regular-expression\n") |
| 10882 | { |
| 10883 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10884 | } |
| 10885 | |
| 10886 | DEFUN (no_ip_extcommunity_list_name_standard, |
| 10887 | no_ip_extcommunity_list_name_standard_cmd, |
| 10888 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10889 | NO_STR |
| 10890 | IP_STR |
| 10891 | EXTCOMMUNITY_LIST_STR |
| 10892 | "Specify standard extcommunity-list\n" |
| 10893 | "Extended Community list name\n" |
| 10894 | "Specify community to reject\n" |
| 10895 | "Specify community to accept\n" |
| 10896 | EXTCOMMUNITY_VAL_STR) |
| 10897 | { |
| 10898 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10899 | } |
| 10900 | |
| 10901 | DEFUN (no_ip_extcommunity_list_name_expanded, |
| 10902 | no_ip_extcommunity_list_name_expanded_cmd, |
| 10903 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10904 | NO_STR |
| 10905 | IP_STR |
| 10906 | EXTCOMMUNITY_LIST_STR |
| 10907 | "Specify expanded extcommunity-list\n" |
| 10908 | "Community list name\n" |
| 10909 | "Specify community to reject\n" |
| 10910 | "Specify community to accept\n" |
| 10911 | "An ordered list as a regular-expression\n") |
| 10912 | { |
| 10913 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10914 | } |
| 10915 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10916 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10917 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
| 10918 | { |
| 10919 | struct community_entry *entry; |
| 10920 | |
| 10921 | for (entry = list->head; entry; entry = entry->next) |
| 10922 | { |
| 10923 | if (entry == list->head) |
| 10924 | { |
| 10925 | if (all_digit (list->name)) |
| 10926 | vty_out (vty, "Extended community %s list %s%s", |
| 10927 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10928 | "standard" : "(expanded) access", |
| 10929 | list->name, VTY_NEWLINE); |
| 10930 | else |
| 10931 | vty_out (vty, "Named extended community %s list %s%s", |
| 10932 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10933 | "standard" : "expanded", |
| 10934 | list->name, VTY_NEWLINE); |
| 10935 | } |
| 10936 | if (entry->any) |
| 10937 | vty_out (vty, " %s%s", |
| 10938 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10939 | else |
| 10940 | vty_out (vty, " %s %s%s", |
| 10941 | community_direct_str (entry->direct), |
| 10942 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10943 | entry->u.ecom->str : entry->config, |
| 10944 | VTY_NEWLINE); |
| 10945 | } |
| 10946 | } |
| 10947 | |
| 10948 | DEFUN (show_ip_extcommunity_list, |
| 10949 | show_ip_extcommunity_list_cmd, |
| 10950 | "show ip extcommunity-list", |
| 10951 | SHOW_STR |
| 10952 | IP_STR |
| 10953 | "List extended-community list\n") |
| 10954 | { |
| 10955 | struct community_list *list; |
| 10956 | struct community_list_master *cm; |
| 10957 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10958 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10959 | if (! cm) |
| 10960 | return CMD_SUCCESS; |
| 10961 | |
| 10962 | for (list = cm->num.head; list; list = list->next) |
| 10963 | extcommunity_list_show (vty, list); |
| 10964 | |
| 10965 | for (list = cm->str.head; list; list = list->next) |
| 10966 | extcommunity_list_show (vty, list); |
| 10967 | |
| 10968 | return CMD_SUCCESS; |
| 10969 | } |
| 10970 | |
| 10971 | DEFUN (show_ip_extcommunity_list_arg, |
| 10972 | show_ip_extcommunity_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10973 | "show ip extcommunity-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10974 | SHOW_STR |
| 10975 | IP_STR |
| 10976 | "List extended-community list\n" |
| 10977 | "Extcommunity-list number\n" |
| 10978 | "Extcommunity-list name\n") |
| 10979 | { |
| 10980 | struct community_list *list; |
| 10981 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10982 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10983 | if (! list) |
| 10984 | { |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10985 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10986 | return CMD_WARNING; |
| 10987 | } |
| 10988 | |
| 10989 | extcommunity_list_show (vty, list); |
| 10990 | |
| 10991 | return CMD_SUCCESS; |
| 10992 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 10993 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10994 | /* Return configuration string of community-list entry. */ |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10995 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10996 | community_list_config_str (struct community_entry *entry) |
| 10997 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10998 | const char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10999 | |
| 11000 | if (entry->any) |
| 11001 | str = ""; |
| 11002 | else |
| 11003 | { |
| 11004 | if (entry->style == COMMUNITY_LIST_STANDARD) |
| 11005 | str = community_str (entry->u.com); |
| 11006 | else |
| 11007 | str = entry->config; |
| 11008 | } |
| 11009 | return str; |
| 11010 | } |
| 11011 | |
| 11012 | /* Display community-list and extcommunity-list configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 11013 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11014 | community_list_config_write (struct vty *vty) |
| 11015 | { |
| 11016 | struct community_list *list; |
| 11017 | struct community_entry *entry; |
| 11018 | struct community_list_master *cm; |
| 11019 | int write = 0; |
| 11020 | |
| 11021 | /* Community-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11022 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11023 | |
| 11024 | for (list = cm->num.head; list; list = list->next) |
| 11025 | for (entry = list->head; entry; entry = entry->next) |
| 11026 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11027 | vty_out (vty, "ip community-list %s %s %s%s", |
| 11028 | list->name, community_direct_str (entry->direct), |
| 11029 | community_list_config_str (entry), |
| 11030 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11031 | write++; |
| 11032 | } |
| 11033 | for (list = cm->str.head; list; list = list->next) |
| 11034 | for (entry = list->head; entry; entry = entry->next) |
| 11035 | { |
| 11036 | vty_out (vty, "ip community-list %s %s %s %s%s", |
| 11037 | entry->style == COMMUNITY_LIST_STANDARD |
| 11038 | ? "standard" : "expanded", |
| 11039 | list->name, community_direct_str (entry->direct), |
| 11040 | community_list_config_str (entry), |
| 11041 | VTY_NEWLINE); |
| 11042 | write++; |
| 11043 | } |
| 11044 | |
| 11045 | /* Extcommunity-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11046 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11047 | |
| 11048 | for (list = cm->num.head; list; list = list->next) |
| 11049 | for (entry = list->head; entry; entry = entry->next) |
| 11050 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11051 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
| 11052 | list->name, community_direct_str (entry->direct), |
| 11053 | community_list_config_str (entry), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11054 | write++; |
| 11055 | } |
| 11056 | for (list = cm->str.head; list; list = list->next) |
| 11057 | for (entry = list->head; entry; entry = entry->next) |
| 11058 | { |
| 11059 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", |
| 11060 | entry->style == EXTCOMMUNITY_LIST_STANDARD |
| 11061 | ? "standard" : "expanded", |
| 11062 | list->name, community_direct_str (entry->direct), |
| 11063 | community_list_config_str (entry), VTY_NEWLINE); |
| 11064 | write++; |
| 11065 | } |
| 11066 | return write; |
| 11067 | } |
| 11068 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 11069 | static struct cmd_node community_list_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11070 | { |
| 11071 | COMMUNITY_LIST_NODE, |
| 11072 | "", |
| 11073 | 1 /* Export to vtysh. */ |
| 11074 | }; |
| 11075 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 11076 | static void |
| 11077 | community_list_vty (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11078 | { |
| 11079 | install_node (&community_list_node, community_list_config_write); |
| 11080 | |
| 11081 | /* Community-list. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11082 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
| 11083 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); |
| 11084 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); |
| 11085 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); |
| 11086 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); |
| 11087 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11088 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
| 11089 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
| 11090 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); |
| 11091 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11092 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
| 11093 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); |
| 11094 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); |
| 11095 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
| 11096 | install_element (VIEW_NODE, &show_ip_community_list_cmd); |
| 11097 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); |
| 11098 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); |
| 11099 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); |
| 11100 | |
| 11101 | /* Extcommunity-list. */ |
| 11102 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); |
| 11103 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); |
| 11104 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); |
| 11105 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); |
| 11106 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); |
| 11107 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11108 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
| 11109 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
| 11110 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); |
| 11111 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11112 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
| 11113 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); |
| 11114 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); |
| 11115 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
| 11116 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); |
| 11117 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 11118 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); |
| 11119 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 11120 | } |