paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* BGP VTY interface. |
| 2 | Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro |
| 3 | |
| 4 | This file is part of GNU Zebra. |
| 5 | |
| 6 | GNU Zebra is free software; you can redistribute it and/or modify it |
| 7 | under the terms of the GNU General Public License as published by the |
| 8 | Free Software Foundation; either version 2, or (at your option) any |
| 9 | later version. |
| 10 | |
| 11 | GNU Zebra is distributed in the hope that it will be useful, but |
| 12 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with GNU Zebra; see the file COPYING. If not, write to the Free |
| 18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 19 | 02111-1307, USA. */ |
| 20 | |
| 21 | #include <zebra.h> |
| 22 | |
| 23 | #include "command.h" |
| 24 | #include "prefix.h" |
| 25 | #include "plist.h" |
| 26 | #include "buffer.h" |
| 27 | #include "linklist.h" |
| 28 | #include "stream.h" |
| 29 | #include "thread.h" |
| 30 | #include "log.h" |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 31 | #include "memory.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 32 | #include "hash.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 33 | |
| 34 | #include "bgpd/bgpd.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 35 | #include "bgpd/bgp_advertise.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 36 | #include "bgpd/bgp_attr.h" |
| 37 | #include "bgpd/bgp_aspath.h" |
| 38 | #include "bgpd/bgp_community.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 39 | #include "bgpd/bgp_ecommunity.h" |
| 40 | #include "bgpd/bgp_damp.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 41 | #include "bgpd/bgp_debug.h" |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 42 | #include "bgpd/bgp_fsm.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 43 | #include "bgpd/bgp_mplsvpn.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 44 | #include "bgpd/bgp_nexthop.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 45 | #include "bgpd/bgp_open.h" |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 46 | #include "bgpd/bgp_regex.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 47 | #include "bgpd/bgp_route.h" |
| 48 | #include "bgpd/bgp_zebra.h" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 49 | #include "bgpd/bgp_table.h" |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 50 | #include "bgpd/bgp_vty.h" |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 51 | #include "bgpd/bgp_mpath.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 52 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 53 | extern struct in_addr router_id_zebra; |
| 54 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 55 | /* Utility function to get address family from current node. */ |
| 56 | afi_t |
| 57 | bgp_node_afi (struct vty *vty) |
| 58 | { |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 59 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 60 | return AFI_IP6; |
| 61 | return AFI_IP; |
| 62 | } |
| 63 | |
| 64 | /* Utility function to get subsequent address family from current |
| 65 | node. */ |
| 66 | safi_t |
| 67 | bgp_node_safi (struct vty *vty) |
| 68 | { |
| 69 | if (vty->node == BGP_VPNV4_NODE) |
| 70 | return SAFI_MPLS_VPN; |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 71 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 72 | return SAFI_MULTICAST; |
| 73 | return SAFI_UNICAST; |
| 74 | } |
| 75 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 76 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 77 | peer_address_self_check (union sockunion *su) |
| 78 | { |
| 79 | struct interface *ifp = NULL; |
| 80 | |
| 81 | if (su->sa.sa_family == AF_INET) |
| 82 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); |
| 83 | #ifdef HAVE_IPV6 |
| 84 | else if (su->sa.sa_family == AF_INET6) |
| 85 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); |
| 86 | #endif /* HAVE IPV6 */ |
| 87 | |
| 88 | if (ifp) |
| 89 | return 1; |
| 90 | |
| 91 | return 0; |
| 92 | } |
| 93 | |
| 94 | /* Utility function for looking up peer from VTY. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 95 | static struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 96 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 97 | { |
| 98 | int ret; |
| 99 | struct bgp *bgp; |
| 100 | union sockunion su; |
| 101 | struct peer *peer; |
| 102 | |
| 103 | bgp = vty->index; |
| 104 | |
| 105 | ret = str2sockunion (ip_str, &su); |
| 106 | if (ret < 0) |
| 107 | { |
| 108 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 109 | return NULL; |
| 110 | } |
| 111 | |
| 112 | peer = peer_lookup (bgp, &su); |
| 113 | if (! peer) |
| 114 | { |
| 115 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE); |
| 116 | return NULL; |
| 117 | } |
| 118 | return peer; |
| 119 | } |
| 120 | |
| 121 | /* Utility function for looking up peer or peer group. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 122 | static struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 123 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 124 | { |
| 125 | int ret; |
| 126 | struct bgp *bgp; |
| 127 | union sockunion su; |
| 128 | struct peer *peer; |
| 129 | struct peer_group *group; |
| 130 | |
| 131 | bgp = vty->index; |
| 132 | |
| 133 | ret = str2sockunion (peer_str, &su); |
| 134 | if (ret == 0) |
| 135 | { |
| 136 | peer = peer_lookup (bgp, &su); |
| 137 | if (peer) |
| 138 | return peer; |
| 139 | } |
| 140 | else |
| 141 | { |
| 142 | group = peer_group_lookup (bgp, peer_str); |
| 143 | if (group) |
| 144 | return group->conf; |
| 145 | } |
| 146 | |
| 147 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
| 148 | VTY_NEWLINE); |
| 149 | |
| 150 | return NULL; |
| 151 | } |
| 152 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 153 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 154 | bgp_vty_return (struct vty *vty, int ret) |
| 155 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 156 | const char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 157 | |
| 158 | switch (ret) |
| 159 | { |
| 160 | case BGP_ERR_INVALID_VALUE: |
| 161 | str = "Invalid value"; |
| 162 | break; |
| 163 | case BGP_ERR_INVALID_FLAG: |
| 164 | str = "Invalid flag"; |
| 165 | break; |
| 166 | case BGP_ERR_PEER_INACTIVE: |
| 167 | str = "Activate the neighbor for the address family first"; |
| 168 | break; |
| 169 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: |
| 170 | str = "Invalid command for a peer-group member"; |
| 171 | break; |
| 172 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
| 173 | str = "Peer-group has been shutdown. Activate the peer-group first"; |
| 174 | break; |
| 175 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: |
| 176 | str = "This peer is a peer-group member. Please change peer-group configuration"; |
| 177 | break; |
| 178 | case BGP_ERR_PEER_FLAG_CONFLICT: |
| 179 | str = "Can't set override-capability and strict-capability-match at the same time"; |
| 180 | break; |
| 181 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: |
| 182 | str = "No activate for peergroup can be given only if peer-group has no members"; |
| 183 | break; |
| 184 | case BGP_ERR_PEER_BELONGS_TO_GROUP: |
| 185 | str = "No activate for an individual peer-group member is invalid"; |
| 186 | break; |
| 187 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: |
| 188 | str = "Activate the peer-group for the address family first"; |
| 189 | break; |
| 190 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
| 191 | str = "Specify remote-as or peer-group remote AS first"; |
| 192 | break; |
| 193 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: |
| 194 | str = "Cannot change the peer-group. Deconfigure first"; |
| 195 | break; |
| 196 | case BGP_ERR_PEER_GROUP_MISMATCH: |
| 197 | str = "Cannot have different peer-group for the neighbor"; |
| 198 | break; |
| 199 | case BGP_ERR_PEER_FILTER_CONFLICT: |
| 200 | str = "Prefix/distribute list can not co-exist"; |
| 201 | break; |
| 202 | case BGP_ERR_NOT_INTERNAL_PEER: |
| 203 | str = "Invalid command. Not an internal neighbor"; |
| 204 | break; |
| 205 | case BGP_ERR_REMOVE_PRIVATE_AS: |
| 206 | str = "Private AS cannot be removed for IBGP peers"; |
| 207 | break; |
| 208 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: |
| 209 | str = "Local-AS allowed only for EBGP peers"; |
| 210 | break; |
| 211 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: |
| 212 | str = "Cannot have local-as same as BGP AS number"; |
| 213 | break; |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 214 | case BGP_ERR_TCPSIG_FAILED: |
| 215 | str = "Error while applying TCP-Sig to session(s)"; |
| 216 | break; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 217 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
| 218 | str = "ebgp-multihop and ttl-security cannot be configured together"; |
| 219 | break; |
Stephen Hemminger | f5a4827 | 2011-03-24 17:30:21 +0000 | [diff] [blame] | 220 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
| 221 | str = "ttl-security only allowed for EBGP peers"; |
| 222 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 223 | } |
| 224 | if (str) |
| 225 | { |
| 226 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); |
| 227 | return CMD_WARNING; |
| 228 | } |
| 229 | return CMD_SUCCESS; |
| 230 | } |
| 231 | |
| 232 | /* BGP global configuration. */ |
| 233 | |
| 234 | DEFUN (bgp_multiple_instance_func, |
| 235 | bgp_multiple_instance_cmd, |
| 236 | "bgp multiple-instance", |
| 237 | BGP_STR |
| 238 | "Enable bgp multiple instance\n") |
| 239 | { |
| 240 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); |
| 241 | return CMD_SUCCESS; |
| 242 | } |
| 243 | |
| 244 | DEFUN (no_bgp_multiple_instance, |
| 245 | no_bgp_multiple_instance_cmd, |
| 246 | "no bgp multiple-instance", |
| 247 | NO_STR |
| 248 | BGP_STR |
| 249 | "BGP multiple instance\n") |
| 250 | { |
| 251 | int ret; |
| 252 | |
| 253 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); |
| 254 | if (ret < 0) |
| 255 | { |
| 256 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); |
| 257 | return CMD_WARNING; |
| 258 | } |
| 259 | return CMD_SUCCESS; |
| 260 | } |
| 261 | |
| 262 | DEFUN (bgp_config_type, |
| 263 | bgp_config_type_cmd, |
| 264 | "bgp config-type (cisco|zebra)", |
| 265 | BGP_STR |
| 266 | "Configuration type\n" |
| 267 | "cisco\n" |
| 268 | "zebra\n") |
| 269 | { |
| 270 | if (strncmp (argv[0], "c", 1) == 0) |
| 271 | bgp_option_set (BGP_OPT_CONFIG_CISCO); |
| 272 | else |
| 273 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 274 | |
| 275 | return CMD_SUCCESS; |
| 276 | } |
| 277 | |
| 278 | DEFUN (no_bgp_config_type, |
| 279 | no_bgp_config_type_cmd, |
| 280 | "no bgp config-type", |
| 281 | NO_STR |
| 282 | BGP_STR |
| 283 | "Display configuration type\n") |
| 284 | { |
| 285 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 286 | return CMD_SUCCESS; |
| 287 | } |
| 288 | |
| 289 | DEFUN (no_synchronization, |
| 290 | no_synchronization_cmd, |
| 291 | "no synchronization", |
| 292 | NO_STR |
| 293 | "Perform IGP synchronization\n") |
| 294 | { |
| 295 | return CMD_SUCCESS; |
| 296 | } |
| 297 | |
| 298 | DEFUN (no_auto_summary, |
| 299 | no_auto_summary_cmd, |
| 300 | "no auto-summary", |
| 301 | NO_STR |
| 302 | "Enable automatic network number summarization\n") |
| 303 | { |
| 304 | return CMD_SUCCESS; |
| 305 | } |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 306 | |
| 307 | DEFUN_DEPRECATED (neighbor_version, |
| 308 | neighbor_version_cmd, |
| 309 | NEIGHBOR_CMD "version (4|4-)", |
| 310 | NEIGHBOR_STR |
| 311 | NEIGHBOR_ADDR_STR |
| 312 | "Set the BGP version to match a neighbor\n" |
| 313 | "Neighbor's BGP version\n") |
| 314 | { |
| 315 | return CMD_SUCCESS; |
| 316 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 317 | |
| 318 | /* "router bgp" commands. */ |
| 319 | DEFUN (router_bgp, |
| 320 | router_bgp_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 321 | "router bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 322 | ROUTER_STR |
| 323 | BGP_STR |
| 324 | AS_STR) |
| 325 | { |
| 326 | int ret; |
| 327 | as_t as; |
| 328 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 329 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 330 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 331 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 332 | |
| 333 | if (argc == 2) |
| 334 | name = argv[1]; |
| 335 | |
| 336 | ret = bgp_get (&bgp, &as, name); |
| 337 | switch (ret) |
| 338 | { |
| 339 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: |
| 340 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", |
| 341 | VTY_NEWLINE); |
| 342 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 343 | case BGP_ERR_AS_MISMATCH: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 344 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 345 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 346 | case BGP_ERR_INSTANCE_MISMATCH: |
| 347 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 348 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 349 | as, VTY_NEWLINE); |
| 350 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 351 | } |
| 352 | |
| 353 | vty->node = BGP_NODE; |
| 354 | vty->index = bgp; |
| 355 | |
| 356 | return CMD_SUCCESS; |
| 357 | } |
| 358 | |
| 359 | ALIAS (router_bgp, |
| 360 | router_bgp_view_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 361 | "router bgp " CMD_AS_RANGE " view WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 362 | ROUTER_STR |
| 363 | BGP_STR |
| 364 | AS_STR |
| 365 | "BGP view\n" |
| 366 | "view name\n") |
| 367 | |
| 368 | /* "no router bgp" commands. */ |
| 369 | DEFUN (no_router_bgp, |
| 370 | no_router_bgp_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 371 | "no router bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 372 | NO_STR |
| 373 | ROUTER_STR |
| 374 | BGP_STR |
| 375 | AS_STR) |
| 376 | { |
| 377 | as_t as; |
| 378 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 379 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 380 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 381 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 382 | |
| 383 | if (argc == 2) |
| 384 | name = argv[1]; |
| 385 | |
| 386 | /* Lookup bgp structure. */ |
| 387 | bgp = bgp_lookup (as, name); |
| 388 | if (! bgp) |
| 389 | { |
| 390 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); |
| 391 | return CMD_WARNING; |
| 392 | } |
| 393 | |
| 394 | bgp_delete (bgp); |
| 395 | |
| 396 | return CMD_SUCCESS; |
| 397 | } |
| 398 | |
| 399 | ALIAS (no_router_bgp, |
| 400 | no_router_bgp_view_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 401 | "no router bgp " CMD_AS_RANGE " view WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 402 | NO_STR |
| 403 | ROUTER_STR |
| 404 | BGP_STR |
| 405 | AS_STR |
| 406 | "BGP view\n" |
| 407 | "view name\n") |
| 408 | |
| 409 | /* BGP router-id. */ |
| 410 | |
| 411 | DEFUN (bgp_router_id, |
| 412 | bgp_router_id_cmd, |
| 413 | "bgp router-id A.B.C.D", |
| 414 | BGP_STR |
| 415 | "Override configured router identifier\n" |
| 416 | "Manually configured router identifier\n") |
| 417 | { |
| 418 | int ret; |
| 419 | struct in_addr id; |
| 420 | struct bgp *bgp; |
| 421 | |
| 422 | bgp = vty->index; |
| 423 | |
| 424 | ret = inet_aton (argv[0], &id); |
| 425 | if (! ret) |
| 426 | { |
| 427 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); |
| 428 | return CMD_WARNING; |
| 429 | } |
| 430 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 431 | bgp->router_id_static = id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 432 | bgp_router_id_set (bgp, &id); |
| 433 | |
| 434 | return CMD_SUCCESS; |
| 435 | } |
| 436 | |
| 437 | DEFUN (no_bgp_router_id, |
| 438 | no_bgp_router_id_cmd, |
| 439 | "no bgp router-id", |
| 440 | NO_STR |
| 441 | BGP_STR |
| 442 | "Override configured router identifier\n") |
| 443 | { |
| 444 | int ret; |
| 445 | struct in_addr id; |
| 446 | struct bgp *bgp; |
| 447 | |
| 448 | bgp = vty->index; |
| 449 | |
| 450 | if (argc == 1) |
| 451 | { |
| 452 | ret = inet_aton (argv[0], &id); |
| 453 | if (! ret) |
| 454 | { |
| 455 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); |
| 456 | return CMD_WARNING; |
| 457 | } |
| 458 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 459 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 460 | { |
| 461 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); |
| 462 | return CMD_WARNING; |
| 463 | } |
| 464 | } |
| 465 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 466 | bgp->router_id_static.s_addr = 0; |
| 467 | bgp_router_id_set (bgp, &router_id_zebra); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 468 | |
| 469 | return CMD_SUCCESS; |
| 470 | } |
| 471 | |
| 472 | ALIAS (no_bgp_router_id, |
| 473 | no_bgp_router_id_val_cmd, |
| 474 | "no bgp router-id A.B.C.D", |
| 475 | NO_STR |
| 476 | BGP_STR |
| 477 | "Override configured router identifier\n" |
| 478 | "Manually configured router identifier\n") |
| 479 | |
| 480 | /* BGP Cluster ID. */ |
| 481 | |
| 482 | DEFUN (bgp_cluster_id, |
| 483 | bgp_cluster_id_cmd, |
| 484 | "bgp cluster-id A.B.C.D", |
| 485 | BGP_STR |
| 486 | "Configure Route-Reflector Cluster-id\n" |
| 487 | "Route-Reflector Cluster-id in IP address format\n") |
| 488 | { |
| 489 | int ret; |
| 490 | struct bgp *bgp; |
| 491 | struct in_addr cluster; |
| 492 | |
| 493 | bgp = vty->index; |
| 494 | |
| 495 | ret = inet_aton (argv[0], &cluster); |
| 496 | if (! ret) |
| 497 | { |
| 498 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 499 | return CMD_WARNING; |
| 500 | } |
| 501 | |
| 502 | bgp_cluster_id_set (bgp, &cluster); |
| 503 | |
| 504 | return CMD_SUCCESS; |
| 505 | } |
| 506 | |
| 507 | ALIAS (bgp_cluster_id, |
| 508 | bgp_cluster_id32_cmd, |
| 509 | "bgp cluster-id <1-4294967295>", |
| 510 | BGP_STR |
| 511 | "Configure Route-Reflector Cluster-id\n" |
| 512 | "Route-Reflector Cluster-id as 32 bit quantity\n") |
| 513 | |
| 514 | DEFUN (no_bgp_cluster_id, |
| 515 | no_bgp_cluster_id_cmd, |
| 516 | "no bgp cluster-id", |
| 517 | NO_STR |
| 518 | BGP_STR |
| 519 | "Configure Route-Reflector Cluster-id\n") |
| 520 | { |
| 521 | int ret; |
| 522 | struct bgp *bgp; |
| 523 | struct in_addr cluster; |
| 524 | |
| 525 | bgp = vty->index; |
| 526 | |
| 527 | if (argc == 1) |
| 528 | { |
| 529 | ret = inet_aton (argv[0], &cluster); |
| 530 | if (! ret) |
| 531 | { |
| 532 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 533 | return CMD_WARNING; |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | bgp_cluster_id_unset (bgp); |
| 538 | |
| 539 | return CMD_SUCCESS; |
| 540 | } |
| 541 | |
| 542 | ALIAS (no_bgp_cluster_id, |
| 543 | no_bgp_cluster_id_arg_cmd, |
| 544 | "no bgp cluster-id A.B.C.D", |
| 545 | NO_STR |
| 546 | BGP_STR |
| 547 | "Configure Route-Reflector Cluster-id\n" |
| 548 | "Route-Reflector Cluster-id in IP address format\n") |
| 549 | |
| 550 | DEFUN (bgp_confederation_identifier, |
| 551 | bgp_confederation_identifier_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 552 | "bgp confederation identifier " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 553 | "BGP specific commands\n" |
| 554 | "AS confederation parameters\n" |
| 555 | "AS number\n" |
| 556 | "Set routing domain confederation AS\n") |
| 557 | { |
| 558 | struct bgp *bgp; |
| 559 | as_t as; |
| 560 | |
| 561 | bgp = vty->index; |
| 562 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 563 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 564 | |
| 565 | bgp_confederation_id_set (bgp, as); |
| 566 | |
| 567 | return CMD_SUCCESS; |
| 568 | } |
| 569 | |
| 570 | DEFUN (no_bgp_confederation_identifier, |
| 571 | no_bgp_confederation_identifier_cmd, |
| 572 | "no bgp confederation identifier", |
| 573 | NO_STR |
| 574 | "BGP specific commands\n" |
| 575 | "AS confederation parameters\n" |
| 576 | "AS number\n") |
| 577 | { |
| 578 | struct bgp *bgp; |
| 579 | as_t as; |
| 580 | |
| 581 | bgp = vty->index; |
| 582 | |
| 583 | if (argc == 1) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 584 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 585 | |
| 586 | bgp_confederation_id_unset (bgp); |
| 587 | |
| 588 | return CMD_SUCCESS; |
| 589 | } |
| 590 | |
| 591 | ALIAS (no_bgp_confederation_identifier, |
| 592 | no_bgp_confederation_identifier_arg_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 593 | "no bgp confederation identifier " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 594 | NO_STR |
| 595 | "BGP specific commands\n" |
| 596 | "AS confederation parameters\n" |
| 597 | "AS number\n" |
| 598 | "Set routing domain confederation AS\n") |
| 599 | |
| 600 | DEFUN (bgp_confederation_peers, |
| 601 | bgp_confederation_peers_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 602 | "bgp confederation peers ." CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 603 | "BGP specific commands\n" |
| 604 | "AS confederation parameters\n" |
| 605 | "Peer ASs in BGP confederation\n" |
| 606 | AS_STR) |
| 607 | { |
| 608 | struct bgp *bgp; |
| 609 | as_t as; |
| 610 | int i; |
| 611 | |
| 612 | bgp = vty->index; |
| 613 | |
| 614 | for (i = 0; i < argc; i++) |
| 615 | { |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 616 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 617 | |
| 618 | if (bgp->as == as) |
| 619 | { |
| 620 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", |
| 621 | VTY_NEWLINE); |
| 622 | continue; |
| 623 | } |
| 624 | |
| 625 | bgp_confederation_peers_add (bgp, as); |
| 626 | } |
| 627 | return CMD_SUCCESS; |
| 628 | } |
| 629 | |
| 630 | DEFUN (no_bgp_confederation_peers, |
| 631 | no_bgp_confederation_peers_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 632 | "no bgp confederation peers ." CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 633 | NO_STR |
| 634 | "BGP specific commands\n" |
| 635 | "AS confederation parameters\n" |
| 636 | "Peer ASs in BGP confederation\n" |
| 637 | AS_STR) |
| 638 | { |
| 639 | struct bgp *bgp; |
| 640 | as_t as; |
| 641 | int i; |
| 642 | |
| 643 | bgp = vty->index; |
| 644 | |
| 645 | for (i = 0; i < argc; i++) |
| 646 | { |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 647 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
| 648 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 649 | bgp_confederation_peers_remove (bgp, as); |
| 650 | } |
| 651 | return CMD_SUCCESS; |
| 652 | } |
| 653 | |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 654 | /* Maximum-paths configuration */ |
| 655 | DEFUN (bgp_maxpaths, |
| 656 | bgp_maxpaths_cmd, |
| 657 | "maximum-paths <1-255>", |
| 658 | "Forward packets over multiple paths\n" |
| 659 | "Number of paths\n") |
| 660 | { |
| 661 | struct bgp *bgp; |
| 662 | u_int16_t maxpaths; |
| 663 | int ret; |
| 664 | |
| 665 | bgp = vty->index; |
| 666 | |
| 667 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255); |
| 668 | |
| 669 | ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 670 | BGP_PEER_EBGP, maxpaths); |
| 671 | if (ret < 0) |
| 672 | { |
| 673 | vty_out (vty, |
| 674 | "%% Failed to set maximum-paths %u for afi %u, safi %u%s", |
| 675 | maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 676 | return CMD_WARNING; |
| 677 | } |
| 678 | |
| 679 | return CMD_SUCCESS; |
| 680 | } |
| 681 | |
| 682 | DEFUN (bgp_maxpaths_ibgp, |
| 683 | bgp_maxpaths_ibgp_cmd, |
| 684 | "maximum-paths ibgp <1-255>", |
| 685 | "Forward packets over multiple paths\n" |
| 686 | "iBGP-multipath\n" |
| 687 | "Number of paths\n") |
| 688 | { |
| 689 | struct bgp *bgp; |
| 690 | u_int16_t maxpaths; |
| 691 | int ret; |
| 692 | |
| 693 | bgp = vty->index; |
| 694 | |
| 695 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255); |
| 696 | |
| 697 | ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 698 | BGP_PEER_IBGP, maxpaths); |
| 699 | if (ret < 0) |
| 700 | { |
| 701 | vty_out (vty, |
| 702 | "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s", |
| 703 | maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 704 | return CMD_WARNING; |
| 705 | } |
| 706 | |
| 707 | return CMD_SUCCESS; |
| 708 | } |
| 709 | |
| 710 | DEFUN (no_bgp_maxpaths, |
| 711 | no_bgp_maxpaths_cmd, |
| 712 | "no maximum-paths", |
| 713 | NO_STR |
| 714 | "Forward packets over multiple paths\n" |
| 715 | "Number of paths\n") |
| 716 | { |
| 717 | struct bgp *bgp; |
| 718 | int ret; |
| 719 | |
| 720 | bgp = vty->index; |
| 721 | |
| 722 | ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 723 | BGP_PEER_EBGP); |
| 724 | if (ret < 0) |
| 725 | { |
| 726 | vty_out (vty, |
| 727 | "%% Failed to unset maximum-paths for afi %u, safi %u%s", |
| 728 | bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 729 | return CMD_WARNING; |
| 730 | } |
| 731 | |
| 732 | return CMD_SUCCESS; |
| 733 | } |
| 734 | |
| 735 | ALIAS (no_bgp_maxpaths, |
| 736 | no_bgp_maxpaths_arg_cmd, |
| 737 | "no maximum-paths <1-255>", |
| 738 | NO_STR |
| 739 | "Forward packets over multiple paths\n" |
| 740 | "Number of paths\n") |
| 741 | |
| 742 | DEFUN (no_bgp_maxpaths_ibgp, |
| 743 | no_bgp_maxpaths_ibgp_cmd, |
| 744 | "no maximum-paths ibgp", |
| 745 | NO_STR |
| 746 | "Forward packets over multiple paths\n" |
| 747 | "iBGP-multipath\n" |
| 748 | "Number of paths\n") |
| 749 | { |
| 750 | struct bgp *bgp; |
| 751 | int ret; |
| 752 | |
| 753 | bgp = vty->index; |
| 754 | |
| 755 | ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty), |
| 756 | BGP_PEER_IBGP); |
| 757 | if (ret < 0) |
| 758 | { |
| 759 | vty_out (vty, |
| 760 | "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s", |
| 761 | bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE); |
| 762 | return CMD_WARNING; |
| 763 | } |
| 764 | |
| 765 | return CMD_SUCCESS; |
| 766 | } |
| 767 | |
| 768 | ALIAS (no_bgp_maxpaths_ibgp, |
| 769 | no_bgp_maxpaths_ibgp_arg_cmd, |
| 770 | "no maximum-paths ibgp <1-255>", |
| 771 | NO_STR |
| 772 | "Forward packets over multiple paths\n" |
| 773 | "iBGP-multipath\n" |
| 774 | "Number of paths\n") |
| 775 | |
| 776 | int |
| 777 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 778 | safi_t safi, int *write) |
| 779 | { |
| 780 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS) |
| 781 | { |
| 782 | bgp_config_write_family_header (vty, afi, safi, write); |
| 783 | vty_out (vty, " maximum-paths %d%s", |
| 784 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); |
| 785 | } |
| 786 | |
| 787 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS) |
| 788 | { |
| 789 | bgp_config_write_family_header (vty, afi, safi, write); |
| 790 | vty_out (vty, " maximum-paths ibgp %d%s", |
| 791 | bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE); |
| 792 | } |
| 793 | |
| 794 | return 0; |
| 795 | } |
| 796 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 797 | /* BGP timers. */ |
| 798 | |
| 799 | DEFUN (bgp_timers, |
| 800 | bgp_timers_cmd, |
| 801 | "timers bgp <0-65535> <0-65535>", |
| 802 | "Adjust routing timers\n" |
| 803 | "BGP timers\n" |
| 804 | "Keepalive interval\n" |
| 805 | "Holdtime\n") |
| 806 | { |
| 807 | struct bgp *bgp; |
| 808 | unsigned long keepalive = 0; |
| 809 | unsigned long holdtime = 0; |
| 810 | |
| 811 | bgp = vty->index; |
| 812 | |
| 813 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); |
| 814 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); |
| 815 | |
| 816 | /* Holdtime value check. */ |
| 817 | if (holdtime < 3 && holdtime != 0) |
| 818 | { |
| 819 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", |
| 820 | VTY_NEWLINE); |
| 821 | return CMD_WARNING; |
| 822 | } |
| 823 | |
| 824 | bgp_timers_set (bgp, keepalive, holdtime); |
| 825 | |
| 826 | return CMD_SUCCESS; |
| 827 | } |
| 828 | |
| 829 | DEFUN (no_bgp_timers, |
| 830 | no_bgp_timers_cmd, |
| 831 | "no timers bgp", |
| 832 | NO_STR |
| 833 | "Adjust routing timers\n" |
| 834 | "BGP timers\n") |
| 835 | { |
| 836 | struct bgp *bgp; |
| 837 | |
| 838 | bgp = vty->index; |
| 839 | bgp_timers_unset (bgp); |
| 840 | |
| 841 | return CMD_SUCCESS; |
| 842 | } |
| 843 | |
| 844 | ALIAS (no_bgp_timers, |
| 845 | no_bgp_timers_arg_cmd, |
| 846 | "no timers bgp <0-65535> <0-65535>", |
| 847 | NO_STR |
| 848 | "Adjust routing timers\n" |
| 849 | "BGP timers\n" |
| 850 | "Keepalive interval\n" |
| 851 | "Holdtime\n") |
| 852 | |
| 853 | DEFUN (bgp_client_to_client_reflection, |
| 854 | bgp_client_to_client_reflection_cmd, |
| 855 | "bgp client-to-client reflection", |
| 856 | "BGP specific commands\n" |
| 857 | "Configure client to client route reflection\n" |
| 858 | "reflection of routes allowed\n") |
| 859 | { |
| 860 | struct bgp *bgp; |
| 861 | |
| 862 | bgp = vty->index; |
| 863 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 864 | return CMD_SUCCESS; |
| 865 | } |
| 866 | |
| 867 | DEFUN (no_bgp_client_to_client_reflection, |
| 868 | no_bgp_client_to_client_reflection_cmd, |
| 869 | "no bgp client-to-client reflection", |
| 870 | NO_STR |
| 871 | "BGP specific commands\n" |
| 872 | "Configure client to client route reflection\n" |
| 873 | "reflection of routes allowed\n") |
| 874 | { |
| 875 | struct bgp *bgp; |
| 876 | |
| 877 | bgp = vty->index; |
| 878 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 879 | return CMD_SUCCESS; |
| 880 | } |
| 881 | |
| 882 | /* "bgp always-compare-med" configuration. */ |
| 883 | DEFUN (bgp_always_compare_med, |
| 884 | bgp_always_compare_med_cmd, |
| 885 | "bgp always-compare-med", |
| 886 | "BGP specific commands\n" |
| 887 | "Allow comparing MED from different neighbors\n") |
| 888 | { |
| 889 | struct bgp *bgp; |
| 890 | |
| 891 | bgp = vty->index; |
| 892 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 893 | return CMD_SUCCESS; |
| 894 | } |
| 895 | |
| 896 | DEFUN (no_bgp_always_compare_med, |
| 897 | no_bgp_always_compare_med_cmd, |
| 898 | "no bgp always-compare-med", |
| 899 | NO_STR |
| 900 | "BGP specific commands\n" |
| 901 | "Allow comparing MED from different neighbors\n") |
| 902 | { |
| 903 | struct bgp *bgp; |
| 904 | |
| 905 | bgp = vty->index; |
| 906 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 907 | return CMD_SUCCESS; |
| 908 | } |
| 909 | |
| 910 | /* "bgp deterministic-med" configuration. */ |
| 911 | DEFUN (bgp_deterministic_med, |
| 912 | bgp_deterministic_med_cmd, |
| 913 | "bgp deterministic-med", |
| 914 | "BGP specific commands\n" |
| 915 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 916 | { |
| 917 | struct bgp *bgp; |
| 918 | |
| 919 | bgp = vty->index; |
| 920 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 921 | return CMD_SUCCESS; |
| 922 | } |
| 923 | |
| 924 | DEFUN (no_bgp_deterministic_med, |
| 925 | no_bgp_deterministic_med_cmd, |
| 926 | "no bgp deterministic-med", |
| 927 | NO_STR |
| 928 | "BGP specific commands\n" |
| 929 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 930 | { |
| 931 | struct bgp *bgp; |
| 932 | |
| 933 | bgp = vty->index; |
| 934 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 935 | return CMD_SUCCESS; |
| 936 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 937 | |
| 938 | /* "bgp graceful-restart" configuration. */ |
| 939 | DEFUN (bgp_graceful_restart, |
| 940 | bgp_graceful_restart_cmd, |
| 941 | "bgp graceful-restart", |
| 942 | "BGP specific commands\n" |
| 943 | "Graceful restart capability parameters\n") |
| 944 | { |
| 945 | struct bgp *bgp; |
| 946 | |
| 947 | bgp = vty->index; |
| 948 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 949 | return CMD_SUCCESS; |
| 950 | } |
| 951 | |
| 952 | DEFUN (no_bgp_graceful_restart, |
| 953 | no_bgp_graceful_restart_cmd, |
| 954 | "no bgp graceful-restart", |
| 955 | NO_STR |
| 956 | "BGP specific commands\n" |
| 957 | "Graceful restart capability parameters\n") |
| 958 | { |
| 959 | struct bgp *bgp; |
| 960 | |
| 961 | bgp = vty->index; |
| 962 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 963 | return CMD_SUCCESS; |
| 964 | } |
| 965 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 966 | DEFUN (bgp_graceful_restart_stalepath_time, |
| 967 | bgp_graceful_restart_stalepath_time_cmd, |
| 968 | "bgp graceful-restart stalepath-time <1-3600>", |
| 969 | "BGP specific commands\n" |
| 970 | "Graceful restart capability parameters\n" |
| 971 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 972 | "Delay value (seconds)\n") |
| 973 | { |
| 974 | struct bgp *bgp; |
| 975 | u_int32_t stalepath; |
| 976 | |
| 977 | bgp = vty->index; |
| 978 | if (! bgp) |
| 979 | return CMD_WARNING; |
| 980 | |
| 981 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); |
| 982 | bgp->stalepath_time = stalepath; |
| 983 | return CMD_SUCCESS; |
| 984 | } |
| 985 | |
| 986 | DEFUN (no_bgp_graceful_restart_stalepath_time, |
| 987 | no_bgp_graceful_restart_stalepath_time_cmd, |
| 988 | "no bgp graceful-restart stalepath-time", |
| 989 | NO_STR |
| 990 | "BGP specific commands\n" |
| 991 | "Graceful restart capability parameters\n" |
| 992 | "Set the max time to hold onto restarting peer's stale paths\n") |
| 993 | { |
| 994 | struct bgp *bgp; |
| 995 | |
| 996 | bgp = vty->index; |
| 997 | if (! bgp) |
| 998 | return CMD_WARNING; |
| 999 | |
| 1000 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; |
| 1001 | return CMD_SUCCESS; |
| 1002 | } |
| 1003 | |
| 1004 | ALIAS (no_bgp_graceful_restart_stalepath_time, |
| 1005 | no_bgp_graceful_restart_stalepath_time_val_cmd, |
| 1006 | "no bgp graceful-restart stalepath-time <1-3600>", |
| 1007 | NO_STR |
| 1008 | "BGP specific commands\n" |
| 1009 | "Graceful restart capability parameters\n" |
| 1010 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 1011 | "Delay value (seconds)\n") |
| 1012 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1013 | /* "bgp fast-external-failover" configuration. */ |
| 1014 | DEFUN (bgp_fast_external_failover, |
| 1015 | bgp_fast_external_failover_cmd, |
| 1016 | "bgp fast-external-failover", |
| 1017 | BGP_STR |
| 1018 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 1019 | { |
| 1020 | struct bgp *bgp; |
| 1021 | |
| 1022 | bgp = vty->index; |
| 1023 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 1024 | return CMD_SUCCESS; |
| 1025 | } |
| 1026 | |
| 1027 | DEFUN (no_bgp_fast_external_failover, |
| 1028 | no_bgp_fast_external_failover_cmd, |
| 1029 | "no bgp fast-external-failover", |
| 1030 | NO_STR |
| 1031 | BGP_STR |
| 1032 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 1033 | { |
| 1034 | struct bgp *bgp; |
| 1035 | |
| 1036 | bgp = vty->index; |
| 1037 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 1038 | return CMD_SUCCESS; |
| 1039 | } |
| 1040 | |
| 1041 | /* "bgp enforce-first-as" configuration. */ |
| 1042 | DEFUN (bgp_enforce_first_as, |
| 1043 | bgp_enforce_first_as_cmd, |
| 1044 | "bgp enforce-first-as", |
| 1045 | BGP_STR |
| 1046 | "Enforce the first AS for EBGP routes\n") |
| 1047 | { |
| 1048 | struct bgp *bgp; |
| 1049 | |
| 1050 | bgp = vty->index; |
| 1051 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 1052 | return CMD_SUCCESS; |
| 1053 | } |
| 1054 | |
| 1055 | DEFUN (no_bgp_enforce_first_as, |
| 1056 | no_bgp_enforce_first_as_cmd, |
| 1057 | "no bgp enforce-first-as", |
| 1058 | NO_STR |
| 1059 | BGP_STR |
| 1060 | "Enforce the first AS for EBGP routes\n") |
| 1061 | { |
| 1062 | struct bgp *bgp; |
| 1063 | |
| 1064 | bgp = vty->index; |
| 1065 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 1066 | return CMD_SUCCESS; |
| 1067 | } |
| 1068 | |
| 1069 | /* "bgp bestpath compare-routerid" configuration. */ |
| 1070 | DEFUN (bgp_bestpath_compare_router_id, |
| 1071 | bgp_bestpath_compare_router_id_cmd, |
| 1072 | "bgp bestpath compare-routerid", |
| 1073 | "BGP specific commands\n" |
| 1074 | "Change the default bestpath selection\n" |
| 1075 | "Compare router-id for identical EBGP paths\n") |
| 1076 | { |
| 1077 | struct bgp *bgp; |
| 1078 | |
| 1079 | bgp = vty->index; |
| 1080 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 1081 | return CMD_SUCCESS; |
| 1082 | } |
| 1083 | |
| 1084 | DEFUN (no_bgp_bestpath_compare_router_id, |
| 1085 | no_bgp_bestpath_compare_router_id_cmd, |
| 1086 | "no bgp bestpath compare-routerid", |
| 1087 | NO_STR |
| 1088 | "BGP specific commands\n" |
| 1089 | "Change the default bestpath selection\n" |
| 1090 | "Compare router-id for identical EBGP paths\n") |
| 1091 | { |
| 1092 | struct bgp *bgp; |
| 1093 | |
| 1094 | bgp = vty->index; |
| 1095 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 1096 | return CMD_SUCCESS; |
| 1097 | } |
| 1098 | |
| 1099 | /* "bgp bestpath as-path ignore" configuration. */ |
| 1100 | DEFUN (bgp_bestpath_aspath_ignore, |
| 1101 | bgp_bestpath_aspath_ignore_cmd, |
| 1102 | "bgp bestpath as-path ignore", |
| 1103 | "BGP specific commands\n" |
| 1104 | "Change the default bestpath selection\n" |
| 1105 | "AS-path attribute\n" |
| 1106 | "Ignore as-path length in selecting a route\n") |
| 1107 | { |
| 1108 | struct bgp *bgp; |
| 1109 | |
| 1110 | bgp = vty->index; |
| 1111 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 1112 | return CMD_SUCCESS; |
| 1113 | } |
| 1114 | |
| 1115 | DEFUN (no_bgp_bestpath_aspath_ignore, |
| 1116 | no_bgp_bestpath_aspath_ignore_cmd, |
| 1117 | "no bgp bestpath as-path ignore", |
| 1118 | NO_STR |
| 1119 | "BGP specific commands\n" |
| 1120 | "Change the default bestpath selection\n" |
| 1121 | "AS-path attribute\n" |
| 1122 | "Ignore as-path length in selecting a route\n") |
| 1123 | { |
| 1124 | struct bgp *bgp; |
| 1125 | |
| 1126 | bgp = vty->index; |
| 1127 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 1128 | return CMD_SUCCESS; |
| 1129 | } |
| 1130 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 1131 | /* "bgp bestpath as-path confed" configuration. */ |
| 1132 | DEFUN (bgp_bestpath_aspath_confed, |
| 1133 | bgp_bestpath_aspath_confed_cmd, |
| 1134 | "bgp bestpath as-path confed", |
| 1135 | "BGP specific commands\n" |
| 1136 | "Change the default bestpath selection\n" |
| 1137 | "AS-path attribute\n" |
| 1138 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 1139 | { |
| 1140 | struct bgp *bgp; |
| 1141 | |
| 1142 | bgp = vty->index; |
| 1143 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); |
| 1144 | return CMD_SUCCESS; |
| 1145 | } |
| 1146 | |
| 1147 | DEFUN (no_bgp_bestpath_aspath_confed, |
| 1148 | no_bgp_bestpath_aspath_confed_cmd, |
| 1149 | "no bgp bestpath as-path confed", |
| 1150 | NO_STR |
| 1151 | "BGP specific commands\n" |
| 1152 | "Change the default bestpath selection\n" |
| 1153 | "AS-path attribute\n" |
| 1154 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 1155 | { |
| 1156 | struct bgp *bgp; |
| 1157 | |
| 1158 | bgp = vty->index; |
| 1159 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); |
| 1160 | return CMD_SUCCESS; |
| 1161 | } |
| 1162 | |
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 | } |
| 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 | } |
| 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") |
| 1320 | |
| 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 | } |
| 1350 | |
| 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 | } |
| 1380 | |
| 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") |
| 1424 | |
| 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 | } |
| 1484 | |
| 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 | } |
| 1589 | |
| 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") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [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 | } |
| 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 | } |
| 1776 | |
| 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 | } |
| 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 | } |
| 1911 | |
| 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 | } |
| 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 | } |
| 1957 | |
| 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 | } |
| 1981 | |
| 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 | } |
| 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 | } |
| 2036 | |
| 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 | } |
| 2092 | |
| 2093 | /* neighbor next-hop-self. */ |
| 2094 | DEFUN (neighbor_nexthop_self, |
| 2095 | neighbor_nexthop_self_cmd, |
| 2096 | NEIGHBOR_CMD2 "next-hop-self", |
| 2097 | NEIGHBOR_STR |
| 2098 | NEIGHBOR_ADDR_STR2 |
| 2099 | "Disable the next hop calculation for this neighbor\n") |
| 2100 | { |
| 2101 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2102 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 2103 | } |
| 2104 | |
| 2105 | DEFUN (no_neighbor_nexthop_self, |
| 2106 | no_neighbor_nexthop_self_cmd, |
| 2107 | NO_NEIGHBOR_CMD2 "next-hop-self", |
| 2108 | NO_STR |
| 2109 | NEIGHBOR_STR |
| 2110 | NEIGHBOR_ADDR_STR2 |
| 2111 | "Disable the next hop calculation for this neighbor\n") |
| 2112 | { |
| 2113 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2114 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 2115 | } |
| 2116 | |
| 2117 | /* neighbor remove-private-AS. */ |
| 2118 | DEFUN (neighbor_remove_private_as, |
| 2119 | neighbor_remove_private_as_cmd, |
| 2120 | NEIGHBOR_CMD2 "remove-private-AS", |
| 2121 | NEIGHBOR_STR |
| 2122 | NEIGHBOR_ADDR_STR2 |
| 2123 | "Remove private AS number from outbound updates\n") |
| 2124 | { |
| 2125 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2126 | bgp_node_safi (vty), |
| 2127 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 2128 | } |
| 2129 | |
| 2130 | DEFUN (no_neighbor_remove_private_as, |
| 2131 | no_neighbor_remove_private_as_cmd, |
| 2132 | NO_NEIGHBOR_CMD2 "remove-private-AS", |
| 2133 | NO_STR |
| 2134 | NEIGHBOR_STR |
| 2135 | NEIGHBOR_ADDR_STR2 |
| 2136 | "Remove private AS number from outbound updates\n") |
| 2137 | { |
| 2138 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2139 | bgp_node_safi (vty), |
| 2140 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 2141 | } |
| 2142 | |
| 2143 | /* neighbor send-community. */ |
| 2144 | DEFUN (neighbor_send_community, |
| 2145 | neighbor_send_community_cmd, |
| 2146 | NEIGHBOR_CMD2 "send-community", |
| 2147 | NEIGHBOR_STR |
| 2148 | NEIGHBOR_ADDR_STR2 |
| 2149 | "Send Community attribute to this neighbor\n") |
| 2150 | { |
| 2151 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2152 | bgp_node_safi (vty), |
| 2153 | PEER_FLAG_SEND_COMMUNITY); |
| 2154 | } |
| 2155 | |
| 2156 | DEFUN (no_neighbor_send_community, |
| 2157 | no_neighbor_send_community_cmd, |
| 2158 | NO_NEIGHBOR_CMD2 "send-community", |
| 2159 | NO_STR |
| 2160 | NEIGHBOR_STR |
| 2161 | NEIGHBOR_ADDR_STR2 |
| 2162 | "Send Community attribute to this neighbor\n") |
| 2163 | { |
| 2164 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2165 | bgp_node_safi (vty), |
| 2166 | PEER_FLAG_SEND_COMMUNITY); |
| 2167 | } |
| 2168 | |
| 2169 | /* neighbor send-community extended. */ |
| 2170 | DEFUN (neighbor_send_community_type, |
| 2171 | neighbor_send_community_type_cmd, |
| 2172 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 2173 | NEIGHBOR_STR |
| 2174 | NEIGHBOR_ADDR_STR2 |
| 2175 | "Send Community attribute to this neighbor\n" |
| 2176 | "Send Standard and Extended Community attributes\n" |
| 2177 | "Send Extended Community attributes\n" |
| 2178 | "Send Standard Community attributes\n") |
| 2179 | { |
| 2180 | if (strncmp (argv[1], "s", 1) == 0) |
| 2181 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2182 | bgp_node_safi (vty), |
| 2183 | PEER_FLAG_SEND_COMMUNITY); |
| 2184 | if (strncmp (argv[1], "e", 1) == 0) |
| 2185 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2186 | bgp_node_safi (vty), |
| 2187 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 2188 | |
| 2189 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2190 | bgp_node_safi (vty), |
| 2191 | (PEER_FLAG_SEND_COMMUNITY| |
| 2192 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 2193 | } |
| 2194 | |
| 2195 | DEFUN (no_neighbor_send_community_type, |
| 2196 | no_neighbor_send_community_type_cmd, |
| 2197 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 2198 | NO_STR |
| 2199 | NEIGHBOR_STR |
| 2200 | NEIGHBOR_ADDR_STR2 |
| 2201 | "Send Community attribute to this neighbor\n" |
| 2202 | "Send Standard and Extended Community attributes\n" |
| 2203 | "Send Extended Community attributes\n" |
| 2204 | "Send Standard Community attributes\n") |
| 2205 | { |
| 2206 | if (strncmp (argv[1], "s", 1) == 0) |
| 2207 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2208 | bgp_node_safi (vty), |
| 2209 | PEER_FLAG_SEND_COMMUNITY); |
| 2210 | if (strncmp (argv[1], "e", 1) == 0) |
| 2211 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2212 | bgp_node_safi (vty), |
| 2213 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 2214 | |
| 2215 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2216 | bgp_node_safi (vty), |
| 2217 | (PEER_FLAG_SEND_COMMUNITY | |
| 2218 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 2219 | } |
| 2220 | |
| 2221 | /* neighbor soft-reconfig. */ |
| 2222 | DEFUN (neighbor_soft_reconfiguration, |
| 2223 | neighbor_soft_reconfiguration_cmd, |
| 2224 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 2225 | NEIGHBOR_STR |
| 2226 | NEIGHBOR_ADDR_STR2 |
| 2227 | "Per neighbor soft reconfiguration\n" |
| 2228 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 2229 | { |
| 2230 | return peer_af_flag_set_vty (vty, argv[0], |
| 2231 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 2232 | PEER_FLAG_SOFT_RECONFIG); |
| 2233 | } |
| 2234 | |
| 2235 | DEFUN (no_neighbor_soft_reconfiguration, |
| 2236 | no_neighbor_soft_reconfiguration_cmd, |
| 2237 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 2238 | NO_STR |
| 2239 | NEIGHBOR_STR |
| 2240 | NEIGHBOR_ADDR_STR2 |
| 2241 | "Per neighbor soft reconfiguration\n" |
| 2242 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 2243 | { |
| 2244 | return peer_af_flag_unset_vty (vty, argv[0], |
| 2245 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 2246 | PEER_FLAG_SOFT_RECONFIG); |
| 2247 | } |
| 2248 | |
| 2249 | DEFUN (neighbor_route_reflector_client, |
| 2250 | neighbor_route_reflector_client_cmd, |
| 2251 | NEIGHBOR_CMD2 "route-reflector-client", |
| 2252 | NEIGHBOR_STR |
| 2253 | NEIGHBOR_ADDR_STR2 |
| 2254 | "Configure a neighbor as Route Reflector client\n") |
| 2255 | { |
| 2256 | struct peer *peer; |
| 2257 | |
| 2258 | |
| 2259 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2260 | if (! peer) |
| 2261 | return CMD_WARNING; |
| 2262 | |
| 2263 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2264 | bgp_node_safi (vty), |
| 2265 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2266 | } |
| 2267 | |
| 2268 | DEFUN (no_neighbor_route_reflector_client, |
| 2269 | no_neighbor_route_reflector_client_cmd, |
| 2270 | NO_NEIGHBOR_CMD2 "route-reflector-client", |
| 2271 | NO_STR |
| 2272 | NEIGHBOR_STR |
| 2273 | NEIGHBOR_ADDR_STR2 |
| 2274 | "Configure a neighbor as Route Reflector client\n") |
| 2275 | { |
| 2276 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2277 | bgp_node_safi (vty), |
| 2278 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2279 | } |
| 2280 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2281 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2282 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
| 2283 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2284 | { |
| 2285 | int ret; |
| 2286 | struct bgp *bgp; |
| 2287 | struct peer *peer; |
| 2288 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2289 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2290 | struct bgp_filter *pfilter; |
| 2291 | struct bgp_filter *gfilter; |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2292 | int locked_and_added = 0; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2293 | |
| 2294 | bgp = vty->index; |
| 2295 | |
| 2296 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2297 | if ( ! peer ) |
| 2298 | return CMD_WARNING; |
| 2299 | |
| 2300 | /* If it is already a RS-Client, don't do anything. */ |
| 2301 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2302 | return CMD_SUCCESS; |
| 2303 | |
| 2304 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2305 | { |
| 2306 | peer = peer_lock (peer); /* rsclient peer list reference */ |
| 2307 | listnode_add_sort (bgp->rsclient, peer); |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2308 | locked_and_added = 1; |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2309 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2310 | |
| 2311 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2312 | if (ret < 0) |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2313 | { |
| 2314 | if (locked_and_added) |
| 2315 | { |
| 2316 | listnode_delete (bgp->rsclient, peer); |
| 2317 | peer_unlock (peer); /* rsclient peer list reference */ |
| 2318 | } |
| 2319 | |
| 2320 | return bgp_vty_return (vty, ret); |
| 2321 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2322 | |
Paul Jakma | 64e580a | 2006-02-21 01:09:01 +0000 | [diff] [blame] | 2323 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2324 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2325 | /* RIB peer reference. Released when table is free'd in bgp_table_free. */ |
| 2326 | peer->rib[afi][safi]->owner = peer_lock (peer); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2327 | |
| 2328 | /* Check for existing 'network' and 'redistribute' routes. */ |
| 2329 | bgp_check_local_routes_rsclient (peer, afi, safi); |
| 2330 | |
| 2331 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ |
| 2332 | bgp_soft_reconfig_rsclient (peer, afi, safi); |
| 2333 | |
| 2334 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2335 | { |
| 2336 | group = peer->group; |
| 2337 | gfilter = &peer->filter[afi][safi]; |
| 2338 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2339 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2340 | { |
| 2341 | pfilter = &peer->filter[afi][safi]; |
| 2342 | |
| 2343 | /* Members of a non-RS-Client group should not be RS-Clients, as that |
| 2344 | is checked when the become part of the peer-group */ |
| 2345 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2346 | if (ret < 0) |
| 2347 | return bgp_vty_return (vty, ret); |
| 2348 | |
| 2349 | /* Make peer's RIB point to group's RIB. */ |
| 2350 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; |
| 2351 | |
| 2352 | /* Import policy. */ |
| 2353 | if (pfilter->map[RMAP_IMPORT].name) |
| 2354 | free (pfilter->map[RMAP_IMPORT].name); |
| 2355 | if (gfilter->map[RMAP_IMPORT].name) |
| 2356 | { |
| 2357 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); |
| 2358 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; |
| 2359 | } |
| 2360 | else |
| 2361 | { |
| 2362 | pfilter->map[RMAP_IMPORT].name = NULL; |
| 2363 | pfilter->map[RMAP_IMPORT].map =NULL; |
| 2364 | } |
| 2365 | |
| 2366 | /* Export policy. */ |
| 2367 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) |
| 2368 | { |
| 2369 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); |
| 2370 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; |
| 2371 | } |
| 2372 | } |
| 2373 | } |
| 2374 | return CMD_SUCCESS; |
| 2375 | } |
| 2376 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2377 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2378 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
| 2379 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2380 | { |
| 2381 | int ret; |
| 2382 | struct bgp *bgp; |
| 2383 | struct peer *peer; |
| 2384 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2385 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2386 | |
| 2387 | bgp = vty->index; |
| 2388 | |
| 2389 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2390 | if ( ! peer ) |
| 2391 | return CMD_WARNING; |
| 2392 | |
| 2393 | /* If it is not a RS-Client, don't do anything. */ |
| 2394 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2395 | return CMD_SUCCESS; |
| 2396 | |
| 2397 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2398 | { |
| 2399 | group = peer->group; |
| 2400 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2401 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2402 | { |
| 2403 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2404 | if (ret < 0) |
| 2405 | return bgp_vty_return (vty, ret); |
| 2406 | |
| 2407 | peer->rib[afi][safi] = NULL; |
| 2408 | } |
| 2409 | |
| 2410 | peer = group->conf; |
| 2411 | } |
| 2412 | |
| 2413 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2414 | if (ret < 0) |
| 2415 | return bgp_vty_return (vty, ret); |
| 2416 | |
| 2417 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2418 | { |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2419 | bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2420 | listnode_delete (bgp->rsclient, peer); |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2421 | peer_unlock (peer); /* peer bgp rsclient reference */ |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2422 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2423 | |
Paul Jakma | b608d5b | 2008-07-02 02:12:07 +0000 | [diff] [blame] | 2424 | bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2425 | |
| 2426 | return CMD_SUCCESS; |
| 2427 | } |
| 2428 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2429 | /* neighbor route-server-client. */ |
| 2430 | DEFUN (neighbor_route_server_client, |
| 2431 | neighbor_route_server_client_cmd, |
| 2432 | NEIGHBOR_CMD2 "route-server-client", |
| 2433 | NEIGHBOR_STR |
| 2434 | NEIGHBOR_ADDR_STR2 |
| 2435 | "Configure a neighbor as Route Server client\n") |
| 2436 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2437 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
| 2438 | bgp_node_safi(vty)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2439 | } |
| 2440 | |
| 2441 | DEFUN (no_neighbor_route_server_client, |
| 2442 | no_neighbor_route_server_client_cmd, |
| 2443 | NO_NEIGHBOR_CMD2 "route-server-client", |
| 2444 | NO_STR |
| 2445 | NEIGHBOR_STR |
| 2446 | NEIGHBOR_ADDR_STR2 |
| 2447 | "Configure a neighbor as Route Server client\n") |
| 2448 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2449 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), |
| 2450 | bgp_node_safi(vty)); |
| 2451 | } |
| 2452 | |
| 2453 | DEFUN (neighbor_nexthop_local_unchanged, |
| 2454 | neighbor_nexthop_local_unchanged_cmd, |
| 2455 | NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2456 | NEIGHBOR_STR |
| 2457 | NEIGHBOR_ADDR_STR2 |
| 2458 | "Configure treatment of outgoing link-local nexthop attribute\n" |
| 2459 | "Leave link-local nexthop unchanged for this peer\n") |
| 2460 | { |
| 2461 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2462 | bgp_node_safi (vty), |
| 2463 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
| 2464 | } |
| 2465 | |
| 2466 | DEFUN (no_neighbor_nexthop_local_unchanged, |
| 2467 | no_neighbor_nexthop_local_unchanged_cmd, |
| 2468 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2469 | NO_STR |
| 2470 | NEIGHBOR_STR |
| 2471 | NEIGHBOR_ADDR_STR2 |
| 2472 | "Configure treatment of outgoing link-local-nexthop attribute\n" |
| 2473 | "Leave link-local nexthop unchanged for this peer\n") |
| 2474 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2475 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2476 | bgp_node_safi (vty), |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2477 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2478 | } |
| 2479 | |
| 2480 | DEFUN (neighbor_attr_unchanged, |
| 2481 | neighbor_attr_unchanged_cmd, |
| 2482 | NEIGHBOR_CMD2 "attribute-unchanged", |
| 2483 | NEIGHBOR_STR |
| 2484 | NEIGHBOR_ADDR_STR2 |
| 2485 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2486 | { |
| 2487 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2488 | bgp_node_safi (vty), |
| 2489 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2490 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2491 | PEER_FLAG_MED_UNCHANGED)); |
| 2492 | } |
| 2493 | |
| 2494 | DEFUN (neighbor_attr_unchanged1, |
| 2495 | neighbor_attr_unchanged1_cmd, |
| 2496 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2497 | NEIGHBOR_STR |
| 2498 | NEIGHBOR_ADDR_STR2 |
| 2499 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2500 | "As-path attribute\n" |
| 2501 | "Nexthop attribute\n" |
| 2502 | "Med attribute\n") |
| 2503 | { |
| 2504 | u_int16_t flags = 0; |
| 2505 | |
| 2506 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2507 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2508 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2509 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2510 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2511 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2512 | |
| 2513 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2514 | bgp_node_safi (vty), flags); |
| 2515 | } |
| 2516 | |
| 2517 | DEFUN (neighbor_attr_unchanged2, |
| 2518 | neighbor_attr_unchanged2_cmd, |
| 2519 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2520 | NEIGHBOR_STR |
| 2521 | NEIGHBOR_ADDR_STR2 |
| 2522 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2523 | "As-path attribute\n" |
| 2524 | "Nexthop attribute\n" |
| 2525 | "Med attribute\n") |
| 2526 | { |
| 2527 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2528 | |
| 2529 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2530 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2531 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2532 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2533 | |
| 2534 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2535 | bgp_node_safi (vty), flags); |
| 2536 | |
| 2537 | } |
| 2538 | |
| 2539 | DEFUN (neighbor_attr_unchanged3, |
| 2540 | neighbor_attr_unchanged3_cmd, |
| 2541 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2542 | NEIGHBOR_STR |
| 2543 | NEIGHBOR_ADDR_STR2 |
| 2544 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2545 | "Nexthop attribute\n" |
| 2546 | "As-path attribute\n" |
| 2547 | "Med attribute\n") |
| 2548 | { |
| 2549 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2550 | |
| 2551 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2552 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2553 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2554 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2555 | |
| 2556 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2557 | bgp_node_safi (vty), flags); |
| 2558 | } |
| 2559 | |
| 2560 | DEFUN (neighbor_attr_unchanged4, |
| 2561 | neighbor_attr_unchanged4_cmd, |
| 2562 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2563 | NEIGHBOR_STR |
| 2564 | NEIGHBOR_ADDR_STR2 |
| 2565 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2566 | "Med attribute\n" |
| 2567 | "As-path attribute\n" |
| 2568 | "Nexthop attribute\n") |
| 2569 | { |
| 2570 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2571 | |
| 2572 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2573 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2574 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2575 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2576 | |
| 2577 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2578 | bgp_node_safi (vty), flags); |
| 2579 | } |
| 2580 | |
| 2581 | ALIAS (neighbor_attr_unchanged, |
| 2582 | neighbor_attr_unchanged5_cmd, |
| 2583 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2584 | NEIGHBOR_STR |
| 2585 | NEIGHBOR_ADDR_STR2 |
| 2586 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2587 | "As-path attribute\n" |
| 2588 | "Nexthop attribute\n" |
| 2589 | "Med attribute\n") |
| 2590 | |
| 2591 | ALIAS (neighbor_attr_unchanged, |
| 2592 | neighbor_attr_unchanged6_cmd, |
| 2593 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2594 | NEIGHBOR_STR |
| 2595 | NEIGHBOR_ADDR_STR2 |
| 2596 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2597 | "As-path attribute\n" |
| 2598 | "Med attribute\n" |
| 2599 | "Nexthop attribute\n") |
| 2600 | |
| 2601 | ALIAS (neighbor_attr_unchanged, |
| 2602 | neighbor_attr_unchanged7_cmd, |
| 2603 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2604 | NEIGHBOR_STR |
| 2605 | NEIGHBOR_ADDR_STR2 |
| 2606 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2607 | "Nexthop attribute\n" |
| 2608 | "Med attribute\n" |
| 2609 | "As-path attribute\n") |
| 2610 | |
| 2611 | ALIAS (neighbor_attr_unchanged, |
| 2612 | neighbor_attr_unchanged8_cmd, |
| 2613 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2614 | NEIGHBOR_STR |
| 2615 | NEIGHBOR_ADDR_STR2 |
| 2616 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2617 | "Nexthop attribute\n" |
| 2618 | "As-path attribute\n" |
| 2619 | "Med attribute\n") |
| 2620 | |
| 2621 | ALIAS (neighbor_attr_unchanged, |
| 2622 | neighbor_attr_unchanged9_cmd, |
| 2623 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2624 | NEIGHBOR_STR |
| 2625 | NEIGHBOR_ADDR_STR2 |
| 2626 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2627 | "Med attribute\n" |
| 2628 | "Nexthop attribute\n" |
| 2629 | "As-path attribute\n") |
| 2630 | |
| 2631 | ALIAS (neighbor_attr_unchanged, |
| 2632 | neighbor_attr_unchanged10_cmd, |
| 2633 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2634 | NEIGHBOR_STR |
| 2635 | NEIGHBOR_ADDR_STR2 |
| 2636 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2637 | "Med attribute\n" |
| 2638 | "As-path attribute\n" |
| 2639 | "Nexthop attribute\n") |
| 2640 | |
| 2641 | DEFUN (no_neighbor_attr_unchanged, |
| 2642 | no_neighbor_attr_unchanged_cmd, |
| 2643 | NO_NEIGHBOR_CMD2 "attribute-unchanged", |
| 2644 | NO_STR |
| 2645 | NEIGHBOR_STR |
| 2646 | NEIGHBOR_ADDR_STR2 |
| 2647 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2648 | { |
| 2649 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2650 | bgp_node_safi (vty), |
| 2651 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2652 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2653 | PEER_FLAG_MED_UNCHANGED)); |
| 2654 | } |
| 2655 | |
| 2656 | DEFUN (no_neighbor_attr_unchanged1, |
| 2657 | no_neighbor_attr_unchanged1_cmd, |
| 2658 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2659 | NO_STR |
| 2660 | NEIGHBOR_STR |
| 2661 | NEIGHBOR_ADDR_STR2 |
| 2662 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2663 | "As-path attribute\n" |
| 2664 | "Nexthop attribute\n" |
| 2665 | "Med attribute\n") |
| 2666 | { |
| 2667 | u_int16_t flags = 0; |
| 2668 | |
| 2669 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2670 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2671 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2672 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2673 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2674 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2675 | |
| 2676 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2677 | bgp_node_safi (vty), flags); |
| 2678 | } |
| 2679 | |
| 2680 | DEFUN (no_neighbor_attr_unchanged2, |
| 2681 | no_neighbor_attr_unchanged2_cmd, |
| 2682 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2683 | NO_STR |
| 2684 | NEIGHBOR_STR |
| 2685 | NEIGHBOR_ADDR_STR2 |
| 2686 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2687 | "As-path attribute\n" |
| 2688 | "Nexthop attribute\n" |
| 2689 | "Med attribute\n") |
| 2690 | { |
| 2691 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2692 | |
| 2693 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2694 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2695 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2696 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2697 | |
| 2698 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2699 | bgp_node_safi (vty), flags); |
| 2700 | } |
| 2701 | |
| 2702 | DEFUN (no_neighbor_attr_unchanged3, |
| 2703 | no_neighbor_attr_unchanged3_cmd, |
| 2704 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2705 | NO_STR |
| 2706 | NEIGHBOR_STR |
| 2707 | NEIGHBOR_ADDR_STR2 |
| 2708 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2709 | "Nexthop attribute\n" |
| 2710 | "As-path attribute\n" |
| 2711 | "Med attribute\n") |
| 2712 | { |
| 2713 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2714 | |
| 2715 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2716 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2717 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2718 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2719 | |
| 2720 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2721 | bgp_node_safi (vty), flags); |
| 2722 | } |
| 2723 | |
| 2724 | DEFUN (no_neighbor_attr_unchanged4, |
| 2725 | no_neighbor_attr_unchanged4_cmd, |
| 2726 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2727 | NO_STR |
| 2728 | NEIGHBOR_STR |
| 2729 | NEIGHBOR_ADDR_STR2 |
| 2730 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2731 | "Med attribute\n" |
| 2732 | "As-path attribute\n" |
| 2733 | "Nexthop attribute\n") |
| 2734 | { |
| 2735 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2736 | |
| 2737 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2738 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2739 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2740 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2741 | |
| 2742 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2743 | bgp_node_safi (vty), flags); |
| 2744 | } |
| 2745 | |
| 2746 | ALIAS (no_neighbor_attr_unchanged, |
| 2747 | no_neighbor_attr_unchanged5_cmd, |
| 2748 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2749 | NO_STR |
| 2750 | NEIGHBOR_STR |
| 2751 | NEIGHBOR_ADDR_STR2 |
| 2752 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2753 | "As-path attribute\n" |
| 2754 | "Nexthop attribute\n" |
| 2755 | "Med attribute\n") |
| 2756 | |
| 2757 | ALIAS (no_neighbor_attr_unchanged, |
| 2758 | no_neighbor_attr_unchanged6_cmd, |
| 2759 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2760 | NO_STR |
| 2761 | NEIGHBOR_STR |
| 2762 | NEIGHBOR_ADDR_STR2 |
| 2763 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2764 | "As-path attribute\n" |
| 2765 | "Med attribute\n" |
| 2766 | "Nexthop attribute\n") |
| 2767 | |
| 2768 | ALIAS (no_neighbor_attr_unchanged, |
| 2769 | no_neighbor_attr_unchanged7_cmd, |
| 2770 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2771 | NO_STR |
| 2772 | NEIGHBOR_STR |
| 2773 | NEIGHBOR_ADDR_STR2 |
| 2774 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2775 | "Nexthop attribute\n" |
| 2776 | "Med attribute\n" |
| 2777 | "As-path attribute\n") |
| 2778 | |
| 2779 | ALIAS (no_neighbor_attr_unchanged, |
| 2780 | no_neighbor_attr_unchanged8_cmd, |
| 2781 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2782 | NO_STR |
| 2783 | NEIGHBOR_STR |
| 2784 | NEIGHBOR_ADDR_STR2 |
| 2785 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2786 | "Nexthop attribute\n" |
| 2787 | "As-path attribute\n" |
| 2788 | "Med attribute\n") |
| 2789 | |
| 2790 | ALIAS (no_neighbor_attr_unchanged, |
| 2791 | no_neighbor_attr_unchanged9_cmd, |
| 2792 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2793 | NO_STR |
| 2794 | NEIGHBOR_STR |
| 2795 | NEIGHBOR_ADDR_STR2 |
| 2796 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2797 | "Med attribute\n" |
| 2798 | "Nexthop attribute\n" |
| 2799 | "As-path attribute\n") |
| 2800 | |
| 2801 | ALIAS (no_neighbor_attr_unchanged, |
| 2802 | no_neighbor_attr_unchanged10_cmd, |
| 2803 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2804 | NO_STR |
| 2805 | NEIGHBOR_STR |
| 2806 | NEIGHBOR_ADDR_STR2 |
| 2807 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2808 | "Med attribute\n" |
| 2809 | "As-path attribute\n" |
| 2810 | "Nexthop attribute\n") |
| 2811 | |
| 2812 | /* For old version Zebra compatibility. */ |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2813 | DEFUN_DEPRECATED (neighbor_transparent_as, |
| 2814 | neighbor_transparent_as_cmd, |
| 2815 | NEIGHBOR_CMD "transparent-as", |
| 2816 | NEIGHBOR_STR |
| 2817 | NEIGHBOR_ADDR_STR |
| 2818 | "Do not append my AS number even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2819 | { |
| 2820 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2821 | bgp_node_safi (vty), |
| 2822 | PEER_FLAG_AS_PATH_UNCHANGED); |
| 2823 | } |
| 2824 | |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2825 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
| 2826 | neighbor_transparent_nexthop_cmd, |
| 2827 | NEIGHBOR_CMD "transparent-nexthop", |
| 2828 | NEIGHBOR_STR |
| 2829 | NEIGHBOR_ADDR_STR |
| 2830 | "Do not change nexthop even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2831 | { |
| 2832 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2833 | bgp_node_safi (vty), |
| 2834 | PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2835 | } |
| 2836 | |
| 2837 | /* EBGP multihop configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2838 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2839 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
| 2840 | const char *ttl_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2841 | { |
| 2842 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2843 | unsigned int ttl; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2844 | |
| 2845 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2846 | if (! peer) |
| 2847 | return CMD_WARNING; |
| 2848 | |
| 2849 | if (! ttl_str) |
| 2850 | ttl = TTL_MAX; |
| 2851 | else |
| 2852 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); |
| 2853 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 2854 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2855 | } |
| 2856 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2857 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2858 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2859 | { |
| 2860 | struct peer *peer; |
| 2861 | |
| 2862 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2863 | if (! peer) |
| 2864 | return CMD_WARNING; |
| 2865 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 2866 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2867 | } |
| 2868 | |
| 2869 | /* neighbor ebgp-multihop. */ |
| 2870 | DEFUN (neighbor_ebgp_multihop, |
| 2871 | neighbor_ebgp_multihop_cmd, |
| 2872 | NEIGHBOR_CMD2 "ebgp-multihop", |
| 2873 | NEIGHBOR_STR |
| 2874 | NEIGHBOR_ADDR_STR2 |
| 2875 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2876 | { |
| 2877 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); |
| 2878 | } |
| 2879 | |
| 2880 | DEFUN (neighbor_ebgp_multihop_ttl, |
| 2881 | neighbor_ebgp_multihop_ttl_cmd, |
| 2882 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2883 | NEIGHBOR_STR |
| 2884 | NEIGHBOR_ADDR_STR2 |
| 2885 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2886 | "maximum hop count\n") |
| 2887 | { |
| 2888 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); |
| 2889 | } |
| 2890 | |
| 2891 | DEFUN (no_neighbor_ebgp_multihop, |
| 2892 | no_neighbor_ebgp_multihop_cmd, |
| 2893 | NO_NEIGHBOR_CMD2 "ebgp-multihop", |
| 2894 | NO_STR |
| 2895 | NEIGHBOR_STR |
| 2896 | NEIGHBOR_ADDR_STR2 |
| 2897 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2898 | { |
| 2899 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); |
| 2900 | } |
| 2901 | |
| 2902 | ALIAS (no_neighbor_ebgp_multihop, |
| 2903 | no_neighbor_ebgp_multihop_ttl_cmd, |
| 2904 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2905 | NO_STR |
| 2906 | NEIGHBOR_STR |
| 2907 | NEIGHBOR_ADDR_STR2 |
| 2908 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2909 | "maximum hop count\n") |
| 2910 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2911 | /* disable-connected-check */ |
| 2912 | DEFUN (neighbor_disable_connected_check, |
| 2913 | neighbor_disable_connected_check_cmd, |
| 2914 | NEIGHBOR_CMD2 "disable-connected-check", |
| 2915 | NEIGHBOR_STR |
| 2916 | NEIGHBOR_ADDR_STR2 |
| 2917 | "one-hop away EBGP peer using loopback address\n") |
| 2918 | { |
| 2919 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2920 | } |
| 2921 | |
| 2922 | DEFUN (no_neighbor_disable_connected_check, |
| 2923 | no_neighbor_disable_connected_check_cmd, |
| 2924 | NO_NEIGHBOR_CMD2 "disable-connected-check", |
| 2925 | NO_STR |
| 2926 | NEIGHBOR_STR |
| 2927 | NEIGHBOR_ADDR_STR2 |
| 2928 | "one-hop away EBGP peer using loopback address\n") |
| 2929 | { |
| 2930 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2931 | } |
| 2932 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2933 | /* Enforce multihop. */ |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2934 | ALIAS (neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2935 | neighbor_enforce_multihop_cmd, |
| 2936 | NEIGHBOR_CMD2 "enforce-multihop", |
| 2937 | NEIGHBOR_STR |
| 2938 | NEIGHBOR_ADDR_STR2 |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 2939 | "Enforce EBGP neighbors perform multihop\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2940 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2941 | /* Enforce multihop. */ |
| 2942 | ALIAS (no_neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2943 | no_neighbor_enforce_multihop_cmd, |
| 2944 | NO_NEIGHBOR_CMD2 "enforce-multihop", |
| 2945 | NO_STR |
| 2946 | NEIGHBOR_STR |
| 2947 | NEIGHBOR_ADDR_STR2 |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 2948 | "Enforce EBGP neighbors perform multihop\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2949 | |
| 2950 | DEFUN (neighbor_description, |
| 2951 | neighbor_description_cmd, |
| 2952 | NEIGHBOR_CMD2 "description .LINE", |
| 2953 | NEIGHBOR_STR |
| 2954 | NEIGHBOR_ADDR_STR2 |
| 2955 | "Neighbor specific description\n" |
| 2956 | "Up to 80 characters describing this neighbor\n") |
| 2957 | { |
| 2958 | struct peer *peer; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2959 | char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2960 | |
| 2961 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2962 | if (! peer) |
| 2963 | return CMD_WARNING; |
| 2964 | |
| 2965 | if (argc == 1) |
| 2966 | return CMD_SUCCESS; |
| 2967 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2968 | str = argv_concat(argv, argc, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2969 | |
| 2970 | peer_description_set (peer, str); |
| 2971 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2972 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2973 | |
| 2974 | return CMD_SUCCESS; |
| 2975 | } |
| 2976 | |
| 2977 | DEFUN (no_neighbor_description, |
| 2978 | no_neighbor_description_cmd, |
| 2979 | NO_NEIGHBOR_CMD2 "description", |
| 2980 | NO_STR |
| 2981 | NEIGHBOR_STR |
| 2982 | NEIGHBOR_ADDR_STR2 |
| 2983 | "Neighbor specific description\n") |
| 2984 | { |
| 2985 | struct peer *peer; |
| 2986 | |
| 2987 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2988 | if (! peer) |
| 2989 | return CMD_WARNING; |
| 2990 | |
| 2991 | peer_description_unset (peer); |
| 2992 | |
| 2993 | return CMD_SUCCESS; |
| 2994 | } |
| 2995 | |
| 2996 | ALIAS (no_neighbor_description, |
| 2997 | no_neighbor_description_val_cmd, |
| 2998 | NO_NEIGHBOR_CMD2 "description .LINE", |
| 2999 | NO_STR |
| 3000 | NEIGHBOR_STR |
| 3001 | NEIGHBOR_ADDR_STR2 |
| 3002 | "Neighbor specific description\n" |
| 3003 | "Up to 80 characters describing this neighbor\n") |
| 3004 | |
| 3005 | /* Neighbor update-source. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3006 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3007 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
| 3008 | const char *source_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3009 | { |
| 3010 | struct peer *peer; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3011 | |
| 3012 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 3013 | if (! peer) |
| 3014 | return CMD_WARNING; |
| 3015 | |
| 3016 | if (source_str) |
| 3017 | { |
Jorge Boncompte [DTI2] | c63b83f | 2012-04-10 16:57:24 +0200 | [diff] [blame] | 3018 | union sockunion su; |
| 3019 | int ret = str2sockunion (source_str, &su); |
| 3020 | |
| 3021 | if (ret == 0) |
| 3022 | peer_update_source_addr_set (peer, &su); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3023 | else |
| 3024 | peer_update_source_if_set (peer, source_str); |
| 3025 | } |
| 3026 | else |
| 3027 | peer_update_source_unset (peer); |
| 3028 | |
| 3029 | return CMD_SUCCESS; |
| 3030 | } |
| 3031 | |
Paul Jakma | 9a1a331 | 2009-07-27 12:27:55 +0100 | [diff] [blame] | 3032 | #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] | 3033 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
| 3034 | "IPv4 address\n" \ |
Paul Jakma | 9a1a331 | 2009-07-27 12:27:55 +0100 | [diff] [blame] | 3035 | "IPv6 address\n" \ |
| 3036 | "Interface name (requires zebra to be running)\n" |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 3037 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3038 | DEFUN (neighbor_update_source, |
| 3039 | neighbor_update_source_cmd, |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 3040 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3041 | NEIGHBOR_STR |
| 3042 | NEIGHBOR_ADDR_STR2 |
| 3043 | "Source of routing updates\n" |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 3044 | BGP_UPDATE_SOURCE_HELP_STR) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3045 | { |
| 3046 | return peer_update_source_vty (vty, argv[0], argv[1]); |
| 3047 | } |
| 3048 | |
| 3049 | DEFUN (no_neighbor_update_source, |
| 3050 | no_neighbor_update_source_cmd, |
| 3051 | NO_NEIGHBOR_CMD2 "update-source", |
| 3052 | NO_STR |
| 3053 | NEIGHBOR_STR |
| 3054 | NEIGHBOR_ADDR_STR2 |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 3055 | "Source of routing updates\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3056 | { |
| 3057 | return peer_update_source_vty (vty, argv[0], NULL); |
| 3058 | } |
| 3059 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3060 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3061 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
| 3062 | afi_t afi, safi_t safi, |
| 3063 | const char *rmap, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3064 | { |
| 3065 | int ret; |
| 3066 | struct peer *peer; |
| 3067 | |
| 3068 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 3069 | if (! peer) |
| 3070 | return CMD_WARNING; |
| 3071 | |
| 3072 | if (set) |
| 3073 | ret = peer_default_originate_set (peer, afi, safi, rmap); |
| 3074 | else |
| 3075 | ret = peer_default_originate_unset (peer, afi, safi); |
| 3076 | |
| 3077 | return bgp_vty_return (vty, ret); |
| 3078 | } |
| 3079 | |
| 3080 | /* neighbor default-originate. */ |
| 3081 | DEFUN (neighbor_default_originate, |
| 3082 | neighbor_default_originate_cmd, |
| 3083 | NEIGHBOR_CMD2 "default-originate", |
| 3084 | NEIGHBOR_STR |
| 3085 | NEIGHBOR_ADDR_STR2 |
| 3086 | "Originate default route to this neighbor\n") |
| 3087 | { |
| 3088 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3089 | bgp_node_safi (vty), NULL, 1); |
| 3090 | } |
| 3091 | |
| 3092 | DEFUN (neighbor_default_originate_rmap, |
| 3093 | neighbor_default_originate_rmap_cmd, |
| 3094 | NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 3095 | NEIGHBOR_STR |
| 3096 | NEIGHBOR_ADDR_STR2 |
| 3097 | "Originate default route to this neighbor\n" |
| 3098 | "Route-map to specify criteria to originate default\n" |
| 3099 | "route-map name\n") |
| 3100 | { |
| 3101 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3102 | bgp_node_safi (vty), argv[1], 1); |
| 3103 | } |
| 3104 | |
| 3105 | DEFUN (no_neighbor_default_originate, |
| 3106 | no_neighbor_default_originate_cmd, |
| 3107 | NO_NEIGHBOR_CMD2 "default-originate", |
| 3108 | NO_STR |
| 3109 | NEIGHBOR_STR |
| 3110 | NEIGHBOR_ADDR_STR2 |
| 3111 | "Originate default route to this neighbor\n") |
| 3112 | { |
| 3113 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3114 | bgp_node_safi (vty), NULL, 0); |
| 3115 | } |
| 3116 | |
| 3117 | ALIAS (no_neighbor_default_originate, |
| 3118 | no_neighbor_default_originate_rmap_cmd, |
| 3119 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 3120 | NO_STR |
| 3121 | NEIGHBOR_STR |
| 3122 | NEIGHBOR_ADDR_STR2 |
| 3123 | "Originate default route to this neighbor\n" |
| 3124 | "Route-map to specify criteria to originate default\n" |
| 3125 | "route-map name\n") |
| 3126 | |
| 3127 | /* Set neighbor's BGP port. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3128 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3129 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
| 3130 | const char *port_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3131 | { |
| 3132 | struct peer *peer; |
| 3133 | u_int16_t port; |
| 3134 | struct servent *sp; |
| 3135 | |
| 3136 | peer = peer_lookup_vty (vty, ip_str); |
| 3137 | if (! peer) |
| 3138 | return CMD_WARNING; |
| 3139 | |
| 3140 | if (! port_str) |
| 3141 | { |
| 3142 | sp = getservbyname ("bgp", "tcp"); |
| 3143 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); |
| 3144 | } |
| 3145 | else |
| 3146 | { |
| 3147 | VTY_GET_INTEGER("port", port, port_str); |
| 3148 | } |
| 3149 | |
| 3150 | peer_port_set (peer, port); |
| 3151 | |
| 3152 | return CMD_SUCCESS; |
| 3153 | } |
| 3154 | |
hasso | f418446 | 2005-02-01 20:13:16 +0000 | [diff] [blame] | 3155 | /* Set specified peer's BGP port. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3156 | DEFUN (neighbor_port, |
| 3157 | neighbor_port_cmd, |
| 3158 | NEIGHBOR_CMD "port <0-65535>", |
| 3159 | NEIGHBOR_STR |
| 3160 | NEIGHBOR_ADDR_STR |
| 3161 | "Neighbor's BGP port\n" |
| 3162 | "TCP port number\n") |
| 3163 | { |
| 3164 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); |
| 3165 | } |
| 3166 | |
| 3167 | DEFUN (no_neighbor_port, |
| 3168 | no_neighbor_port_cmd, |
| 3169 | NO_NEIGHBOR_CMD "port", |
| 3170 | NO_STR |
| 3171 | NEIGHBOR_STR |
| 3172 | NEIGHBOR_ADDR_STR |
| 3173 | "Neighbor's BGP port\n") |
| 3174 | { |
| 3175 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); |
| 3176 | } |
| 3177 | |
| 3178 | ALIAS (no_neighbor_port, |
| 3179 | no_neighbor_port_val_cmd, |
| 3180 | NO_NEIGHBOR_CMD "port <0-65535>", |
| 3181 | NO_STR |
| 3182 | NEIGHBOR_STR |
| 3183 | NEIGHBOR_ADDR_STR |
| 3184 | "Neighbor's BGP port\n" |
| 3185 | "TCP port number\n") |
| 3186 | |
| 3187 | /* neighbor weight. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3188 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3189 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
| 3190 | const char *weight_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3191 | { |
| 3192 | int ret; |
| 3193 | struct peer *peer; |
| 3194 | unsigned long weight; |
| 3195 | |
| 3196 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3197 | if (! peer) |
| 3198 | return CMD_WARNING; |
| 3199 | |
| 3200 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); |
| 3201 | |
| 3202 | ret = peer_weight_set (peer, weight); |
| 3203 | |
| 3204 | return CMD_SUCCESS; |
| 3205 | } |
| 3206 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3207 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3208 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3209 | { |
| 3210 | struct peer *peer; |
| 3211 | |
| 3212 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3213 | if (! peer) |
| 3214 | return CMD_WARNING; |
| 3215 | |
| 3216 | peer_weight_unset (peer); |
| 3217 | |
| 3218 | return CMD_SUCCESS; |
| 3219 | } |
| 3220 | |
| 3221 | DEFUN (neighbor_weight, |
| 3222 | neighbor_weight_cmd, |
| 3223 | NEIGHBOR_CMD2 "weight <0-65535>", |
| 3224 | NEIGHBOR_STR |
| 3225 | NEIGHBOR_ADDR_STR2 |
| 3226 | "Set default weight for routes from this neighbor\n" |
| 3227 | "default weight\n") |
| 3228 | { |
| 3229 | return peer_weight_set_vty (vty, argv[0], argv[1]); |
| 3230 | } |
| 3231 | |
| 3232 | DEFUN (no_neighbor_weight, |
| 3233 | no_neighbor_weight_cmd, |
| 3234 | NO_NEIGHBOR_CMD2 "weight", |
| 3235 | NO_STR |
| 3236 | NEIGHBOR_STR |
| 3237 | NEIGHBOR_ADDR_STR2 |
| 3238 | "Set default weight for routes from this neighbor\n") |
| 3239 | { |
| 3240 | return peer_weight_unset_vty (vty, argv[0]); |
| 3241 | } |
| 3242 | |
| 3243 | ALIAS (no_neighbor_weight, |
| 3244 | no_neighbor_weight_val_cmd, |
| 3245 | NO_NEIGHBOR_CMD2 "weight <0-65535>", |
| 3246 | NO_STR |
| 3247 | NEIGHBOR_STR |
| 3248 | NEIGHBOR_ADDR_STR2 |
| 3249 | "Set default weight for routes from this neighbor\n" |
| 3250 | "default weight\n") |
| 3251 | |
| 3252 | /* Override capability negotiation. */ |
| 3253 | DEFUN (neighbor_override_capability, |
| 3254 | neighbor_override_capability_cmd, |
| 3255 | NEIGHBOR_CMD2 "override-capability", |
| 3256 | NEIGHBOR_STR |
| 3257 | NEIGHBOR_ADDR_STR2 |
| 3258 | "Override capability negotiation result\n") |
| 3259 | { |
| 3260 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 3261 | } |
| 3262 | |
| 3263 | DEFUN (no_neighbor_override_capability, |
| 3264 | no_neighbor_override_capability_cmd, |
| 3265 | NO_NEIGHBOR_CMD2 "override-capability", |
| 3266 | NO_STR |
| 3267 | NEIGHBOR_STR |
| 3268 | NEIGHBOR_ADDR_STR2 |
| 3269 | "Override capability negotiation result\n") |
| 3270 | { |
| 3271 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 3272 | } |
| 3273 | |
| 3274 | DEFUN (neighbor_strict_capability, |
| 3275 | neighbor_strict_capability_cmd, |
| 3276 | NEIGHBOR_CMD "strict-capability-match", |
| 3277 | NEIGHBOR_STR |
| 3278 | NEIGHBOR_ADDR_STR |
| 3279 | "Strict capability negotiation match\n") |
| 3280 | { |
| 3281 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3282 | } |
| 3283 | |
| 3284 | DEFUN (no_neighbor_strict_capability, |
| 3285 | no_neighbor_strict_capability_cmd, |
| 3286 | NO_NEIGHBOR_CMD "strict-capability-match", |
| 3287 | NO_STR |
| 3288 | NEIGHBOR_STR |
| 3289 | NEIGHBOR_ADDR_STR |
| 3290 | "Strict capability negotiation match\n") |
| 3291 | { |
| 3292 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3293 | } |
| 3294 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3295 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3296 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
| 3297 | const char *keep_str, const char *hold_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3298 | { |
| 3299 | int ret; |
| 3300 | struct peer *peer; |
| 3301 | u_int32_t keepalive; |
| 3302 | u_int32_t holdtime; |
| 3303 | |
| 3304 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3305 | if (! peer) |
| 3306 | return CMD_WARNING; |
| 3307 | |
| 3308 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); |
| 3309 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); |
| 3310 | |
| 3311 | ret = peer_timers_set (peer, keepalive, holdtime); |
| 3312 | |
| 3313 | return bgp_vty_return (vty, ret); |
| 3314 | } |
| 3315 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3316 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3317 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3318 | { |
| 3319 | int ret; |
| 3320 | struct peer *peer; |
| 3321 | |
| 3322 | peer = peer_lookup_vty (vty, ip_str); |
| 3323 | if (! peer) |
| 3324 | return CMD_WARNING; |
| 3325 | |
| 3326 | ret = peer_timers_unset (peer); |
| 3327 | |
| 3328 | return bgp_vty_return (vty, ret); |
| 3329 | } |
| 3330 | |
| 3331 | DEFUN (neighbor_timers, |
| 3332 | neighbor_timers_cmd, |
| 3333 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", |
| 3334 | NEIGHBOR_STR |
| 3335 | NEIGHBOR_ADDR_STR2 |
| 3336 | "BGP per neighbor timers\n" |
| 3337 | "Keepalive interval\n" |
| 3338 | "Holdtime\n") |
| 3339 | { |
| 3340 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); |
| 3341 | } |
| 3342 | |
| 3343 | DEFUN (no_neighbor_timers, |
| 3344 | no_neighbor_timers_cmd, |
| 3345 | NO_NEIGHBOR_CMD2 "timers", |
| 3346 | NO_STR |
| 3347 | NEIGHBOR_STR |
| 3348 | NEIGHBOR_ADDR_STR2 |
| 3349 | "BGP per neighbor timers\n") |
| 3350 | { |
| 3351 | return peer_timers_unset_vty (vty, argv[0]); |
| 3352 | } |
| 3353 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3354 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3355 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
| 3356 | const char *time_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3357 | { |
| 3358 | int ret; |
| 3359 | struct peer *peer; |
| 3360 | u_int32_t connect; |
| 3361 | |
| 3362 | peer = peer_lookup_vty (vty, ip_str); |
| 3363 | if (! peer) |
| 3364 | return CMD_WARNING; |
| 3365 | |
| 3366 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); |
| 3367 | |
| 3368 | ret = peer_timers_connect_set (peer, connect); |
| 3369 | |
| 3370 | return CMD_SUCCESS; |
| 3371 | } |
| 3372 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3373 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3374 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3375 | { |
| 3376 | int ret; |
| 3377 | struct peer *peer; |
| 3378 | |
| 3379 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3380 | if (! peer) |
| 3381 | return CMD_WARNING; |
| 3382 | |
| 3383 | ret = peer_timers_connect_unset (peer); |
| 3384 | |
| 3385 | return CMD_SUCCESS; |
| 3386 | } |
| 3387 | |
| 3388 | DEFUN (neighbor_timers_connect, |
| 3389 | neighbor_timers_connect_cmd, |
| 3390 | NEIGHBOR_CMD "timers connect <0-65535>", |
| 3391 | NEIGHBOR_STR |
| 3392 | NEIGHBOR_ADDR_STR |
| 3393 | "BGP per neighbor timers\n" |
| 3394 | "BGP connect timer\n" |
| 3395 | "Connect timer\n") |
| 3396 | { |
| 3397 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); |
| 3398 | } |
| 3399 | |
| 3400 | DEFUN (no_neighbor_timers_connect, |
| 3401 | no_neighbor_timers_connect_cmd, |
| 3402 | NO_NEIGHBOR_CMD "timers connect", |
| 3403 | NO_STR |
| 3404 | NEIGHBOR_STR |
| 3405 | NEIGHBOR_ADDR_STR |
| 3406 | "BGP per neighbor timers\n" |
| 3407 | "BGP connect timer\n") |
| 3408 | { |
| 3409 | return peer_timers_connect_unset_vty (vty, argv[0]); |
| 3410 | } |
| 3411 | |
| 3412 | ALIAS (no_neighbor_timers_connect, |
| 3413 | no_neighbor_timers_connect_val_cmd, |
| 3414 | NO_NEIGHBOR_CMD "timers connect <0-65535>", |
| 3415 | NO_STR |
| 3416 | NEIGHBOR_STR |
| 3417 | NEIGHBOR_ADDR_STR |
| 3418 | "BGP per neighbor timers\n" |
| 3419 | "BGP connect timer\n" |
| 3420 | "Connect timer\n") |
| 3421 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3422 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3423 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
| 3424 | const char *time_str, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3425 | { |
| 3426 | int ret; |
| 3427 | struct peer *peer; |
| 3428 | u_int32_t routeadv = 0; |
| 3429 | |
| 3430 | peer = peer_lookup_vty (vty, ip_str); |
| 3431 | if (! peer) |
| 3432 | return CMD_WARNING; |
| 3433 | |
| 3434 | if (time_str) |
| 3435 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); |
| 3436 | |
| 3437 | if (set) |
| 3438 | ret = peer_advertise_interval_set (peer, routeadv); |
| 3439 | else |
| 3440 | ret = peer_advertise_interval_unset (peer); |
| 3441 | |
| 3442 | return CMD_SUCCESS; |
| 3443 | } |
| 3444 | |
| 3445 | DEFUN (neighbor_advertise_interval, |
| 3446 | neighbor_advertise_interval_cmd, |
| 3447 | NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3448 | NEIGHBOR_STR |
| 3449 | NEIGHBOR_ADDR_STR |
| 3450 | "Minimum interval between sending BGP routing updates\n" |
| 3451 | "time in seconds\n") |
| 3452 | { |
| 3453 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); |
| 3454 | } |
| 3455 | |
| 3456 | DEFUN (no_neighbor_advertise_interval, |
| 3457 | no_neighbor_advertise_interval_cmd, |
| 3458 | NO_NEIGHBOR_CMD "advertisement-interval", |
| 3459 | NO_STR |
| 3460 | NEIGHBOR_STR |
| 3461 | NEIGHBOR_ADDR_STR |
| 3462 | "Minimum interval between sending BGP routing updates\n") |
| 3463 | { |
| 3464 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); |
| 3465 | } |
| 3466 | |
| 3467 | ALIAS (no_neighbor_advertise_interval, |
| 3468 | no_neighbor_advertise_interval_val_cmd, |
| 3469 | NO_NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3470 | NO_STR |
| 3471 | NEIGHBOR_STR |
| 3472 | NEIGHBOR_ADDR_STR |
| 3473 | "Minimum interval between sending BGP routing updates\n" |
| 3474 | "time in seconds\n") |
| 3475 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3476 | /* neighbor interface */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3477 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3478 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3479 | { |
| 3480 | int ret; |
| 3481 | struct peer *peer; |
| 3482 | |
| 3483 | peer = peer_lookup_vty (vty, ip_str); |
| 3484 | if (! peer) |
| 3485 | return CMD_WARNING; |
| 3486 | |
| 3487 | if (str) |
| 3488 | ret = peer_interface_set (peer, str); |
| 3489 | else |
| 3490 | ret = peer_interface_unset (peer); |
| 3491 | |
| 3492 | return CMD_SUCCESS; |
| 3493 | } |
| 3494 | |
| 3495 | DEFUN (neighbor_interface, |
| 3496 | neighbor_interface_cmd, |
| 3497 | NEIGHBOR_CMD "interface WORD", |
| 3498 | NEIGHBOR_STR |
| 3499 | NEIGHBOR_ADDR_STR |
| 3500 | "Interface\n" |
| 3501 | "Interface name\n") |
| 3502 | { |
| 3503 | return peer_interface_vty (vty, argv[0], argv[1]); |
| 3504 | } |
| 3505 | |
| 3506 | DEFUN (no_neighbor_interface, |
| 3507 | no_neighbor_interface_cmd, |
| 3508 | NO_NEIGHBOR_CMD "interface WORD", |
| 3509 | NO_STR |
| 3510 | NEIGHBOR_STR |
| 3511 | NEIGHBOR_ADDR_STR |
| 3512 | "Interface\n" |
| 3513 | "Interface name\n") |
| 3514 | { |
| 3515 | return peer_interface_vty (vty, argv[0], NULL); |
| 3516 | } |
| 3517 | |
| 3518 | /* Set distribute list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3519 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3520 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
| 3521 | afi_t afi, safi_t safi, |
| 3522 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3523 | { |
| 3524 | int ret; |
| 3525 | struct peer *peer; |
| 3526 | int direct = FILTER_IN; |
| 3527 | |
| 3528 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3529 | if (! peer) |
| 3530 | return CMD_WARNING; |
| 3531 | |
| 3532 | /* Check filter direction. */ |
| 3533 | if (strncmp (direct_str, "i", 1) == 0) |
| 3534 | direct = FILTER_IN; |
| 3535 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3536 | direct = FILTER_OUT; |
| 3537 | |
| 3538 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); |
| 3539 | |
| 3540 | return bgp_vty_return (vty, ret); |
| 3541 | } |
| 3542 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3543 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3544 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3545 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3546 | { |
| 3547 | int ret; |
| 3548 | struct peer *peer; |
| 3549 | int direct = FILTER_IN; |
| 3550 | |
| 3551 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3552 | if (! peer) |
| 3553 | return CMD_WARNING; |
| 3554 | |
| 3555 | /* Check filter direction. */ |
| 3556 | if (strncmp (direct_str, "i", 1) == 0) |
| 3557 | direct = FILTER_IN; |
| 3558 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3559 | direct = FILTER_OUT; |
| 3560 | |
| 3561 | ret = peer_distribute_unset (peer, afi, safi, direct); |
| 3562 | |
| 3563 | return bgp_vty_return (vty, ret); |
| 3564 | } |
| 3565 | |
| 3566 | DEFUN (neighbor_distribute_list, |
| 3567 | neighbor_distribute_list_cmd, |
| 3568 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3569 | NEIGHBOR_STR |
| 3570 | NEIGHBOR_ADDR_STR2 |
| 3571 | "Filter updates to/from this neighbor\n" |
| 3572 | "IP access-list number\n" |
| 3573 | "IP access-list number (expanded range)\n" |
| 3574 | "IP Access-list name\n" |
| 3575 | "Filter incoming updates\n" |
| 3576 | "Filter outgoing updates\n") |
| 3577 | { |
| 3578 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3579 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3580 | } |
| 3581 | |
| 3582 | DEFUN (no_neighbor_distribute_list, |
| 3583 | no_neighbor_distribute_list_cmd, |
| 3584 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3585 | NO_STR |
| 3586 | NEIGHBOR_STR |
| 3587 | NEIGHBOR_ADDR_STR2 |
| 3588 | "Filter updates to/from this neighbor\n" |
| 3589 | "IP access-list number\n" |
| 3590 | "IP access-list number (expanded range)\n" |
| 3591 | "IP Access-list name\n" |
| 3592 | "Filter incoming updates\n" |
| 3593 | "Filter outgoing updates\n") |
| 3594 | { |
| 3595 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3596 | bgp_node_safi (vty), argv[2]); |
| 3597 | } |
| 3598 | |
| 3599 | /* Set prefix list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3600 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3601 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3602 | safi_t safi, const char *name_str, |
| 3603 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3604 | { |
| 3605 | int ret; |
| 3606 | struct peer *peer; |
| 3607 | int direct = FILTER_IN; |
| 3608 | |
| 3609 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3610 | if (! peer) |
| 3611 | return CMD_WARNING; |
| 3612 | |
| 3613 | /* Check filter direction. */ |
| 3614 | if (strncmp (direct_str, "i", 1) == 0) |
| 3615 | direct = FILTER_IN; |
| 3616 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3617 | direct = FILTER_OUT; |
| 3618 | |
| 3619 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); |
| 3620 | |
| 3621 | return bgp_vty_return (vty, ret); |
| 3622 | } |
| 3623 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3624 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3625 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3626 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3627 | { |
| 3628 | int ret; |
| 3629 | struct peer *peer; |
| 3630 | int direct = FILTER_IN; |
| 3631 | |
| 3632 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3633 | if (! peer) |
| 3634 | return CMD_WARNING; |
| 3635 | |
| 3636 | /* Check filter direction. */ |
| 3637 | if (strncmp (direct_str, "i", 1) == 0) |
| 3638 | direct = FILTER_IN; |
| 3639 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3640 | direct = FILTER_OUT; |
| 3641 | |
| 3642 | ret = peer_prefix_list_unset (peer, afi, safi, direct); |
| 3643 | |
| 3644 | return bgp_vty_return (vty, ret); |
| 3645 | } |
| 3646 | |
| 3647 | DEFUN (neighbor_prefix_list, |
| 3648 | neighbor_prefix_list_cmd, |
| 3649 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3650 | NEIGHBOR_STR |
| 3651 | NEIGHBOR_ADDR_STR2 |
| 3652 | "Filter updates to/from this neighbor\n" |
| 3653 | "Name of a prefix list\n" |
| 3654 | "Filter incoming updates\n" |
| 3655 | "Filter outgoing updates\n") |
| 3656 | { |
| 3657 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3658 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3659 | } |
| 3660 | |
| 3661 | DEFUN (no_neighbor_prefix_list, |
| 3662 | no_neighbor_prefix_list_cmd, |
| 3663 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3664 | NO_STR |
| 3665 | NEIGHBOR_STR |
| 3666 | NEIGHBOR_ADDR_STR2 |
| 3667 | "Filter updates to/from this neighbor\n" |
| 3668 | "Name of a prefix list\n" |
| 3669 | "Filter incoming updates\n" |
| 3670 | "Filter outgoing updates\n") |
| 3671 | { |
| 3672 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3673 | bgp_node_safi (vty), argv[2]); |
| 3674 | } |
| 3675 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3676 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3677 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
| 3678 | afi_t afi, safi_t safi, |
| 3679 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3680 | { |
| 3681 | int ret; |
| 3682 | struct peer *peer; |
| 3683 | int direct = FILTER_IN; |
| 3684 | |
| 3685 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3686 | if (! peer) |
| 3687 | return CMD_WARNING; |
| 3688 | |
| 3689 | /* Check filter direction. */ |
| 3690 | if (strncmp (direct_str, "i", 1) == 0) |
| 3691 | direct = FILTER_IN; |
| 3692 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3693 | direct = FILTER_OUT; |
| 3694 | |
| 3695 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); |
| 3696 | |
| 3697 | return bgp_vty_return (vty, ret); |
| 3698 | } |
| 3699 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3700 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3701 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
| 3702 | afi_t afi, safi_t safi, |
| 3703 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3704 | { |
| 3705 | int ret; |
| 3706 | struct peer *peer; |
| 3707 | int direct = FILTER_IN; |
| 3708 | |
| 3709 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3710 | if (! peer) |
| 3711 | return CMD_WARNING; |
| 3712 | |
| 3713 | /* Check filter direction. */ |
| 3714 | if (strncmp (direct_str, "i", 1) == 0) |
| 3715 | direct = FILTER_IN; |
| 3716 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3717 | direct = FILTER_OUT; |
| 3718 | |
| 3719 | ret = peer_aslist_unset (peer, afi, safi, direct); |
| 3720 | |
| 3721 | return bgp_vty_return (vty, ret); |
| 3722 | } |
| 3723 | |
| 3724 | DEFUN (neighbor_filter_list, |
| 3725 | neighbor_filter_list_cmd, |
| 3726 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3727 | NEIGHBOR_STR |
| 3728 | NEIGHBOR_ADDR_STR2 |
| 3729 | "Establish BGP filters\n" |
| 3730 | "AS path access-list name\n" |
| 3731 | "Filter incoming routes\n" |
| 3732 | "Filter outgoing routes\n") |
| 3733 | { |
| 3734 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3735 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3736 | } |
| 3737 | |
| 3738 | DEFUN (no_neighbor_filter_list, |
| 3739 | no_neighbor_filter_list_cmd, |
| 3740 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3741 | NO_STR |
| 3742 | NEIGHBOR_STR |
| 3743 | NEIGHBOR_ADDR_STR2 |
| 3744 | "Establish BGP filters\n" |
| 3745 | "AS path access-list name\n" |
| 3746 | "Filter incoming routes\n" |
| 3747 | "Filter outgoing routes\n") |
| 3748 | { |
| 3749 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3750 | bgp_node_safi (vty), argv[2]); |
| 3751 | } |
| 3752 | |
| 3753 | /* Set route-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3754 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3755 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
| 3756 | afi_t afi, safi_t safi, |
| 3757 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3758 | { |
| 3759 | int ret; |
| 3760 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3761 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3762 | |
| 3763 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3764 | if (! peer) |
| 3765 | return CMD_WARNING; |
| 3766 | |
| 3767 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3768 | if (strncmp (direct_str, "in", 2) == 0) |
| 3769 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3770 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3771 | direct = RMAP_OUT; |
| 3772 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3773 | direct = RMAP_IMPORT; |
| 3774 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3775 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3776 | |
| 3777 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); |
| 3778 | |
| 3779 | return bgp_vty_return (vty, ret); |
| 3780 | } |
| 3781 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3782 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3783 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3784 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3785 | { |
| 3786 | int ret; |
| 3787 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3788 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3789 | |
| 3790 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3791 | if (! peer) |
| 3792 | return CMD_WARNING; |
| 3793 | |
| 3794 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3795 | if (strncmp (direct_str, "in", 2) == 0) |
| 3796 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3797 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3798 | direct = RMAP_OUT; |
| 3799 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3800 | direct = RMAP_IMPORT; |
| 3801 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3802 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3803 | |
| 3804 | ret = peer_route_map_unset (peer, afi, safi, direct); |
| 3805 | |
| 3806 | return bgp_vty_return (vty, ret); |
| 3807 | } |
| 3808 | |
| 3809 | DEFUN (neighbor_route_map, |
| 3810 | neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3811 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3812 | NEIGHBOR_STR |
| 3813 | NEIGHBOR_ADDR_STR2 |
| 3814 | "Apply route map to neighbor\n" |
| 3815 | "Name of route map\n" |
| 3816 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3817 | "Apply map to outbound routes\n" |
| 3818 | "Apply map to routes going into a Route-Server client's table\n" |
| 3819 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3820 | { |
| 3821 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3822 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3823 | } |
| 3824 | |
| 3825 | DEFUN (no_neighbor_route_map, |
| 3826 | no_neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3827 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3828 | NO_STR |
| 3829 | NEIGHBOR_STR |
| 3830 | NEIGHBOR_ADDR_STR2 |
| 3831 | "Apply route map to neighbor\n" |
| 3832 | "Name of route map\n" |
| 3833 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3834 | "Apply map to outbound routes\n" |
| 3835 | "Apply map to routes going into a Route-Server client's table\n" |
| 3836 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3837 | { |
| 3838 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3839 | bgp_node_safi (vty), argv[2]); |
| 3840 | } |
| 3841 | |
| 3842 | /* Set unsuppress-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3843 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3844 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3845 | safi_t safi, const char *name_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3846 | { |
| 3847 | int ret; |
| 3848 | struct peer *peer; |
| 3849 | |
| 3850 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3851 | if (! peer) |
| 3852 | return CMD_WARNING; |
| 3853 | |
| 3854 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); |
| 3855 | |
| 3856 | return bgp_vty_return (vty, ret); |
| 3857 | } |
| 3858 | |
| 3859 | /* Unset route-map from the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3860 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3861 | 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] | 3862 | safi_t safi) |
| 3863 | { |
| 3864 | int ret; |
| 3865 | struct peer *peer; |
| 3866 | |
| 3867 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3868 | if (! peer) |
| 3869 | return CMD_WARNING; |
| 3870 | |
| 3871 | ret = peer_unsuppress_map_unset (peer, afi, safi); |
| 3872 | |
| 3873 | return bgp_vty_return (vty, ret); |
| 3874 | } |
| 3875 | |
| 3876 | DEFUN (neighbor_unsuppress_map, |
| 3877 | neighbor_unsuppress_map_cmd, |
| 3878 | NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3879 | NEIGHBOR_STR |
| 3880 | NEIGHBOR_ADDR_STR2 |
| 3881 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3882 | "Name of route map\n") |
| 3883 | { |
| 3884 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3885 | bgp_node_safi (vty), argv[1]); |
| 3886 | } |
| 3887 | |
| 3888 | DEFUN (no_neighbor_unsuppress_map, |
| 3889 | no_neighbor_unsuppress_map_cmd, |
| 3890 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3891 | NO_STR |
| 3892 | NEIGHBOR_STR |
| 3893 | NEIGHBOR_ADDR_STR2 |
| 3894 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3895 | "Name of route map\n") |
| 3896 | { |
| 3897 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3898 | bgp_node_safi (vty)); |
| 3899 | } |
| 3900 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3901 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3902 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3903 | safi_t safi, const char *num_str, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3904 | const char *threshold_str, int warning, |
| 3905 | const char *restart_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3906 | { |
| 3907 | int ret; |
| 3908 | struct peer *peer; |
| 3909 | u_int32_t max; |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3910 | u_char threshold; |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3911 | u_int16_t restart; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3912 | |
| 3913 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3914 | if (! peer) |
| 3915 | return CMD_WARNING; |
| 3916 | |
Denis Ovsienko | e6ec1c3 | 2011-09-10 21:50:53 +0400 | [diff] [blame] | 3917 | VTY_GET_INTEGER ("maximum number", max, num_str); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3918 | if (threshold_str) |
| 3919 | threshold = atoi (threshold_str); |
| 3920 | else |
| 3921 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3922 | |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3923 | if (restart_str) |
| 3924 | restart = atoi (restart_str); |
| 3925 | else |
| 3926 | restart = 0; |
| 3927 | |
| 3928 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3929 | |
| 3930 | return bgp_vty_return (vty, ret); |
| 3931 | } |
| 3932 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3933 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3934 | 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] | 3935 | safi_t safi) |
| 3936 | { |
| 3937 | int ret; |
| 3938 | struct peer *peer; |
| 3939 | |
| 3940 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3941 | if (! peer) |
| 3942 | return CMD_WARNING; |
| 3943 | |
| 3944 | ret = peer_maximum_prefix_unset (peer, afi, safi); |
| 3945 | |
| 3946 | return bgp_vty_return (vty, ret); |
| 3947 | } |
| 3948 | |
| 3949 | /* Maximum number of prefix configuration. prefix count is different |
| 3950 | for each peer configuration. So this configuration can be set for |
| 3951 | each peer configuration. */ |
| 3952 | DEFUN (neighbor_maximum_prefix, |
| 3953 | neighbor_maximum_prefix_cmd, |
| 3954 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3955 | NEIGHBOR_STR |
| 3956 | NEIGHBOR_ADDR_STR2 |
| 3957 | "Maximum number of prefix accept from this peer\n" |
| 3958 | "maximum no. of prefix limit\n") |
| 3959 | { |
| 3960 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3961 | bgp_node_safi (vty), argv[1], NULL, 0, |
| 3962 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3963 | } |
| 3964 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3965 | DEFUN (neighbor_maximum_prefix_threshold, |
| 3966 | neighbor_maximum_prefix_threshold_cmd, |
| 3967 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", |
| 3968 | NEIGHBOR_STR |
| 3969 | NEIGHBOR_ADDR_STR2 |
| 3970 | "Maximum number of prefix accept from this peer\n" |
| 3971 | "maximum no. of prefix limit\n" |
| 3972 | "Threshold value (%) at which to generate a warning msg\n") |
| 3973 | { |
| 3974 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3975 | bgp_node_safi (vty), argv[1], argv[2], 0, |
| 3976 | NULL); |
| 3977 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3978 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3979 | DEFUN (neighbor_maximum_prefix_warning, |
| 3980 | neighbor_maximum_prefix_warning_cmd, |
| 3981 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3982 | NEIGHBOR_STR |
| 3983 | NEIGHBOR_ADDR_STR2 |
| 3984 | "Maximum number of prefix accept from this peer\n" |
| 3985 | "maximum no. of prefix limit\n" |
| 3986 | "Only give warning message when limit is exceeded\n") |
| 3987 | { |
| 3988 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3989 | bgp_node_safi (vty), argv[1], NULL, 1, |
| 3990 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3991 | } |
| 3992 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3993 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
| 3994 | neighbor_maximum_prefix_threshold_warning_cmd, |
| 3995 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 3996 | NEIGHBOR_STR |
| 3997 | NEIGHBOR_ADDR_STR2 |
| 3998 | "Maximum number of prefix accept from this peer\n" |
| 3999 | "maximum no. of prefix limit\n" |
| 4000 | "Threshold value (%) at which to generate a warning msg\n" |
| 4001 | "Only give warning message when limit is exceeded\n") |
| 4002 | { |
| 4003 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4004 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
| 4005 | } |
| 4006 | |
| 4007 | DEFUN (neighbor_maximum_prefix_restart, |
| 4008 | neighbor_maximum_prefix_restart_cmd, |
| 4009 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
| 4010 | NEIGHBOR_STR |
| 4011 | NEIGHBOR_ADDR_STR2 |
| 4012 | "Maximum number of prefix accept from this peer\n" |
| 4013 | "maximum no. of prefix limit\n" |
| 4014 | "Restart bgp connection after limit is exceeded\n" |
| 4015 | "Restart interval in minutes") |
| 4016 | { |
| 4017 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 4018 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); |
| 4019 | } |
| 4020 | |
| 4021 | DEFUN (neighbor_maximum_prefix_threshold_restart, |
| 4022 | neighbor_maximum_prefix_threshold_restart_cmd, |
| 4023 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 4024 | NEIGHBOR_STR |
| 4025 | NEIGHBOR_ADDR_STR2 |
| 4026 | "Maximum number of prefix accept from this peer\n" |
| 4027 | "maximum no. of prefix limit\n" |
| 4028 | "Threshold value (%) at which to generate a warning msg\n" |
| 4029 | "Restart bgp connection after limit is exceeded\n" |
| 4030 | "Restart interval in minutes") |
| 4031 | { |
| 4032 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 4033 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); |
| 4034 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 4035 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4036 | DEFUN (no_neighbor_maximum_prefix, |
| 4037 | no_neighbor_maximum_prefix_cmd, |
| 4038 | NO_NEIGHBOR_CMD2 "maximum-prefix", |
| 4039 | NO_STR |
| 4040 | NEIGHBOR_STR |
| 4041 | NEIGHBOR_ADDR_STR2 |
| 4042 | "Maximum number of prefix accept from this peer\n") |
| 4043 | { |
| 4044 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 4045 | bgp_node_safi (vty)); |
| 4046 | } |
| 4047 | |
| 4048 | ALIAS (no_neighbor_maximum_prefix, |
| 4049 | no_neighbor_maximum_prefix_val_cmd, |
| 4050 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 4051 | NO_STR |
| 4052 | NEIGHBOR_STR |
| 4053 | NEIGHBOR_ADDR_STR2 |
| 4054 | "Maximum number of prefix accept from this peer\n" |
| 4055 | "maximum no. of prefix limit\n") |
| 4056 | |
| 4057 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4058 | no_neighbor_maximum_prefix_threshold_cmd, |
| 4059 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 4060 | NO_STR |
| 4061 | NEIGHBOR_STR |
| 4062 | NEIGHBOR_ADDR_STR2 |
| 4063 | "Maximum number of prefix accept from this peer\n" |
| 4064 | "maximum no. of prefix limit\n" |
| 4065 | "Threshold value (%) at which to generate a warning msg\n") |
| 4066 | |
| 4067 | ALIAS (no_neighbor_maximum_prefix, |
| 4068 | no_neighbor_maximum_prefix_warning_cmd, |
| 4069 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 4070 | NO_STR |
| 4071 | NEIGHBOR_STR |
| 4072 | NEIGHBOR_ADDR_STR2 |
| 4073 | "Maximum number of prefix accept from this peer\n" |
| 4074 | "maximum no. of prefix limit\n" |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 4075 | "Only give warning message when limit is exceeded\n") |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4076 | |
| 4077 | ALIAS (no_neighbor_maximum_prefix, |
| 4078 | no_neighbor_maximum_prefix_threshold_warning_cmd, |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 4079 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 4080 | NO_STR |
| 4081 | NEIGHBOR_STR |
| 4082 | NEIGHBOR_ADDR_STR2 |
| 4083 | "Maximum number of prefix accept from this peer\n" |
| 4084 | "maximum no. of prefix limit\n" |
| 4085 | "Threshold value (%) at which to generate a warning msg\n" |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 4086 | "Only give warning message when limit is exceeded\n") |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 4087 | |
| 4088 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4089 | no_neighbor_maximum_prefix_restart_cmd, |
| 4090 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4091 | NO_STR |
| 4092 | NEIGHBOR_STR |
| 4093 | NEIGHBOR_ADDR_STR2 |
| 4094 | "Maximum number of prefix accept from this peer\n" |
| 4095 | "maximum no. of prefix limit\n" |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 4096 | "Restart bgp connection after limit is exceeded\n" |
| 4097 | "Restart interval in minutes") |
| 4098 | |
| 4099 | ALIAS (no_neighbor_maximum_prefix, |
| 4100 | no_neighbor_maximum_prefix_threshold_restart_cmd, |
| 4101 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 4102 | NO_STR |
| 4103 | NEIGHBOR_STR |
| 4104 | NEIGHBOR_ADDR_STR2 |
| 4105 | "Maximum number of prefix accept from this peer\n" |
| 4106 | "maximum no. of prefix limit\n" |
| 4107 | "Threshold value (%) at which to generate a warning msg\n" |
| 4108 | "Restart bgp connection after limit is exceeded\n" |
| 4109 | "Restart interval in minutes") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4110 | |
| 4111 | /* "neighbor allowas-in" */ |
| 4112 | DEFUN (neighbor_allowas_in, |
| 4113 | neighbor_allowas_in_cmd, |
| 4114 | NEIGHBOR_CMD2 "allowas-in", |
| 4115 | NEIGHBOR_STR |
| 4116 | NEIGHBOR_ADDR_STR2 |
| 4117 | "Accept as-path with my AS present in it\n") |
| 4118 | { |
| 4119 | int ret; |
| 4120 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4121 | unsigned int allow_num; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4122 | |
| 4123 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4124 | if (! peer) |
| 4125 | return CMD_WARNING; |
| 4126 | |
| 4127 | if (argc == 1) |
| 4128 | allow_num = 3; |
| 4129 | else |
| 4130 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); |
| 4131 | |
| 4132 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), |
| 4133 | allow_num); |
| 4134 | |
| 4135 | return bgp_vty_return (vty, ret); |
| 4136 | } |
| 4137 | |
| 4138 | ALIAS (neighbor_allowas_in, |
| 4139 | neighbor_allowas_in_arg_cmd, |
| 4140 | NEIGHBOR_CMD2 "allowas-in <1-10>", |
| 4141 | NEIGHBOR_STR |
| 4142 | NEIGHBOR_ADDR_STR2 |
| 4143 | "Accept as-path with my AS present in it\n" |
| 4144 | "Number of occurances of AS number\n") |
| 4145 | |
| 4146 | DEFUN (no_neighbor_allowas_in, |
| 4147 | no_neighbor_allowas_in_cmd, |
| 4148 | NO_NEIGHBOR_CMD2 "allowas-in", |
| 4149 | NO_STR |
| 4150 | NEIGHBOR_STR |
| 4151 | NEIGHBOR_ADDR_STR2 |
| 4152 | "allow local ASN appears in aspath attribute\n") |
| 4153 | { |
| 4154 | int ret; |
| 4155 | struct peer *peer; |
| 4156 | |
| 4157 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4158 | if (! peer) |
| 4159 | return CMD_WARNING; |
| 4160 | |
| 4161 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 4162 | |
| 4163 | return bgp_vty_return (vty, ret); |
| 4164 | } |
| 4165 | |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4166 | DEFUN (neighbor_ttl_security, |
| 4167 | neighbor_ttl_security_cmd, |
| 4168 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", |
| 4169 | NEIGHBOR_STR |
| 4170 | NEIGHBOR_ADDR_STR2 |
| 4171 | "Specify the maximum number of hops to the BGP peer\n") |
| 4172 | { |
| 4173 | struct peer *peer; |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 4174 | int gtsm_hops; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4175 | |
| 4176 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4177 | if (! peer) |
| 4178 | return CMD_WARNING; |
| 4179 | |
| 4180 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); |
| 4181 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 4182 | 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] | 4183 | } |
| 4184 | |
| 4185 | DEFUN (no_neighbor_ttl_security, |
| 4186 | no_neighbor_ttl_security_cmd, |
| 4187 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", |
| 4188 | NO_STR |
| 4189 | NEIGHBOR_STR |
| 4190 | NEIGHBOR_ADDR_STR2 |
| 4191 | "Specify the maximum number of hops to the BGP peer\n") |
| 4192 | { |
| 4193 | struct peer *peer; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4194 | |
| 4195 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 4196 | if (! peer) |
| 4197 | return CMD_WARNING; |
| 4198 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 4199 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 4200 | } |
| 4201 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4202 | /* Address family configuration. */ |
| 4203 | DEFUN (address_family_ipv4, |
| 4204 | address_family_ipv4_cmd, |
| 4205 | "address-family ipv4", |
| 4206 | "Enter Address Family command mode\n" |
| 4207 | "Address family\n") |
| 4208 | { |
| 4209 | vty->node = BGP_IPV4_NODE; |
| 4210 | return CMD_SUCCESS; |
| 4211 | } |
| 4212 | |
| 4213 | DEFUN (address_family_ipv4_safi, |
| 4214 | address_family_ipv4_safi_cmd, |
| 4215 | "address-family ipv4 (unicast|multicast)", |
| 4216 | "Enter Address Family command mode\n" |
| 4217 | "Address family\n" |
| 4218 | "Address Family modifier\n" |
| 4219 | "Address Family modifier\n") |
| 4220 | { |
| 4221 | if (strncmp (argv[0], "m", 1) == 0) |
| 4222 | vty->node = BGP_IPV4M_NODE; |
| 4223 | else |
| 4224 | vty->node = BGP_IPV4_NODE; |
| 4225 | |
| 4226 | return CMD_SUCCESS; |
| 4227 | } |
| 4228 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4229 | DEFUN (address_family_ipv6, |
| 4230 | address_family_ipv6_cmd, |
| 4231 | "address-family ipv6", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4232 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4233 | "Address family\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4234 | { |
| 4235 | vty->node = BGP_IPV6_NODE; |
| 4236 | return CMD_SUCCESS; |
| 4237 | } |
| 4238 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4239 | DEFUN (address_family_ipv6_safi, |
| 4240 | address_family_ipv6_safi_cmd, |
| 4241 | "address-family ipv6 (unicast|multicast)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4242 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4243 | "Address family\n" |
| 4244 | "Address Family modifier\n" |
| 4245 | "Address Family modifier\n") |
| 4246 | { |
| 4247 | if (strncmp (argv[0], "m", 1) == 0) |
| 4248 | vty->node = BGP_IPV6M_NODE; |
| 4249 | else |
| 4250 | vty->node = BGP_IPV6_NODE; |
| 4251 | |
| 4252 | return CMD_SUCCESS; |
| 4253 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4254 | |
| 4255 | DEFUN (address_family_vpnv4, |
| 4256 | address_family_vpnv4_cmd, |
| 4257 | "address-family vpnv4", |
| 4258 | "Enter Address Family command mode\n" |
| 4259 | "Address family\n") |
| 4260 | { |
| 4261 | vty->node = BGP_VPNV4_NODE; |
| 4262 | return CMD_SUCCESS; |
| 4263 | } |
| 4264 | |
| 4265 | ALIAS (address_family_vpnv4, |
| 4266 | address_family_vpnv4_unicast_cmd, |
| 4267 | "address-family vpnv4 unicast", |
| 4268 | "Enter Address Family command mode\n" |
| 4269 | "Address family\n" |
| 4270 | "Address Family Modifier\n") |
| 4271 | |
| 4272 | DEFUN (exit_address_family, |
| 4273 | exit_address_family_cmd, |
| 4274 | "exit-address-family", |
| 4275 | "Exit from Address Family configuration mode\n") |
| 4276 | { |
hasso | a8a80d5 | 2005-04-09 13:07:47 +0000 | [diff] [blame] | 4277 | if (vty->node == BGP_IPV4_NODE |
| 4278 | || vty->node == BGP_IPV4M_NODE |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4279 | || vty->node == BGP_VPNV4_NODE |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4280 | || vty->node == BGP_IPV6_NODE |
| 4281 | || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4282 | vty->node = BGP_NODE; |
| 4283 | return CMD_SUCCESS; |
| 4284 | } |
| 4285 | |
| 4286 | /* BGP clear sort. */ |
| 4287 | enum clear_sort |
| 4288 | { |
| 4289 | clear_all, |
| 4290 | clear_peer, |
| 4291 | clear_group, |
| 4292 | clear_external, |
| 4293 | clear_as |
| 4294 | }; |
| 4295 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4296 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4297 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
| 4298 | safi_t safi, int error) |
| 4299 | { |
| 4300 | switch (error) |
| 4301 | { |
| 4302 | case BGP_ERR_AF_UNCONFIGURED: |
| 4303 | vty_out (vty, |
| 4304 | "%%BGP: Enable %s %s address family for the neighbor %s%s", |
| 4305 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", |
| 4306 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", |
| 4307 | peer->host, VTY_NEWLINE); |
| 4308 | break; |
| 4309 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: |
| 4310 | 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); |
| 4311 | break; |
| 4312 | default: |
| 4313 | break; |
| 4314 | } |
| 4315 | } |
| 4316 | |
| 4317 | /* `clear ip bgp' functions. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4318 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4319 | 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] | 4320 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4321 | { |
| 4322 | int ret; |
| 4323 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4324 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4325 | |
| 4326 | /* Clear all neighbors. */ |
| 4327 | if (sort == clear_all) |
| 4328 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4329 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4330 | { |
| 4331 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4332 | ret = peer_clear (peer); |
| 4333 | else |
| 4334 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4335 | |
| 4336 | if (ret < 0) |
| 4337 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4338 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4339 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4340 | } |
| 4341 | |
| 4342 | /* Clear specified neighbors. */ |
| 4343 | if (sort == clear_peer) |
| 4344 | { |
| 4345 | union sockunion su; |
| 4346 | int ret; |
| 4347 | |
| 4348 | /* Make sockunion for lookup. */ |
| 4349 | ret = str2sockunion (arg, &su); |
| 4350 | if (ret < 0) |
| 4351 | { |
| 4352 | vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4353 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4354 | } |
| 4355 | peer = peer_lookup (bgp, &su); |
| 4356 | if (! peer) |
| 4357 | { |
| 4358 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4359 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4360 | } |
| 4361 | |
| 4362 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4363 | ret = peer_clear (peer); |
| 4364 | else |
| 4365 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4366 | |
| 4367 | if (ret < 0) |
| 4368 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4369 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4370 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4371 | } |
| 4372 | |
| 4373 | /* Clear all peer-group members. */ |
| 4374 | if (sort == clear_group) |
| 4375 | { |
| 4376 | struct peer_group *group; |
| 4377 | |
| 4378 | group = peer_group_lookup (bgp, arg); |
| 4379 | if (! group) |
| 4380 | { |
| 4381 | 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] | 4382 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4383 | } |
| 4384 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4385 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4386 | { |
| 4387 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4388 | { |
| 4389 | ret = peer_clear (peer); |
| 4390 | continue; |
| 4391 | } |
| 4392 | |
| 4393 | if (! peer->af_group[afi][safi]) |
| 4394 | continue; |
| 4395 | |
| 4396 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4397 | |
| 4398 | if (ret < 0) |
| 4399 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4400 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4401 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4402 | } |
| 4403 | |
| 4404 | if (sort == clear_external) |
| 4405 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4406 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4407 | { |
Jorge Boncompte [DTI2] | 6d85b15 | 2012-05-07 16:52:54 +0000 | [diff] [blame] | 4408 | if (peer->sort == BGP_PEER_IBGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4409 | continue; |
| 4410 | |
| 4411 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4412 | ret = peer_clear (peer); |
| 4413 | else |
| 4414 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4415 | |
| 4416 | if (ret < 0) |
| 4417 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4418 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4419 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4420 | } |
| 4421 | |
| 4422 | if (sort == clear_as) |
| 4423 | { |
| 4424 | as_t as; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4425 | int find = 0; |
| 4426 | |
Ulrich Weber | bde12e3 | 2011-11-16 19:32:12 +0400 | [diff] [blame] | 4427 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4428 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4429 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4430 | { |
| 4431 | if (peer->as != as) |
| 4432 | continue; |
| 4433 | |
| 4434 | find = 1; |
| 4435 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4436 | ret = peer_clear (peer); |
| 4437 | else |
| 4438 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4439 | |
| 4440 | if (ret < 0) |
| 4441 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4442 | } |
| 4443 | if (! find) |
| 4444 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, |
| 4445 | VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4446 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4447 | } |
| 4448 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4449 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4450 | } |
| 4451 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4452 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4453 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
| 4454 | enum clear_sort sort, enum bgp_clear_type stype, |
| 4455 | const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4456 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4457 | struct bgp *bgp; |
| 4458 | |
| 4459 | /* BGP structure lookup. */ |
| 4460 | if (name) |
| 4461 | { |
| 4462 | bgp = bgp_lookup_by_name (name); |
| 4463 | if (bgp == NULL) |
| 4464 | { |
| 4465 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); |
| 4466 | return CMD_WARNING; |
| 4467 | } |
| 4468 | } |
| 4469 | else |
| 4470 | { |
| 4471 | bgp = bgp_get_default (); |
| 4472 | if (bgp == NULL) |
| 4473 | { |
| 4474 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); |
| 4475 | return CMD_WARNING; |
| 4476 | } |
| 4477 | } |
| 4478 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4479 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4480 | } |
| 4481 | |
| 4482 | DEFUN (clear_ip_bgp_all, |
| 4483 | clear_ip_bgp_all_cmd, |
| 4484 | "clear ip bgp *", |
| 4485 | CLEAR_STR |
| 4486 | IP_STR |
| 4487 | BGP_STR |
| 4488 | "Clear all peers\n") |
| 4489 | { |
| 4490 | if (argc == 1) |
| 4491 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4492 | |
| 4493 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4494 | } |
| 4495 | |
| 4496 | ALIAS (clear_ip_bgp_all, |
| 4497 | clear_bgp_all_cmd, |
| 4498 | "clear bgp *", |
| 4499 | CLEAR_STR |
| 4500 | BGP_STR |
| 4501 | "Clear all peers\n") |
| 4502 | |
| 4503 | ALIAS (clear_ip_bgp_all, |
| 4504 | clear_bgp_ipv6_all_cmd, |
| 4505 | "clear bgp ipv6 *", |
| 4506 | CLEAR_STR |
| 4507 | BGP_STR |
| 4508 | "Address family\n" |
| 4509 | "Clear all peers\n") |
| 4510 | |
| 4511 | ALIAS (clear_ip_bgp_all, |
| 4512 | clear_ip_bgp_instance_all_cmd, |
| 4513 | "clear ip bgp view WORD *", |
| 4514 | CLEAR_STR |
| 4515 | IP_STR |
| 4516 | BGP_STR |
| 4517 | "BGP view\n" |
| 4518 | "view name\n" |
| 4519 | "Clear all peers\n") |
| 4520 | |
| 4521 | ALIAS (clear_ip_bgp_all, |
| 4522 | clear_bgp_instance_all_cmd, |
| 4523 | "clear bgp view WORD *", |
| 4524 | CLEAR_STR |
| 4525 | BGP_STR |
| 4526 | "BGP view\n" |
| 4527 | "view name\n" |
| 4528 | "Clear all peers\n") |
| 4529 | |
| 4530 | DEFUN (clear_ip_bgp_peer, |
| 4531 | clear_ip_bgp_peer_cmd, |
| 4532 | "clear ip bgp (A.B.C.D|X:X::X:X)", |
| 4533 | CLEAR_STR |
| 4534 | IP_STR |
| 4535 | BGP_STR |
| 4536 | "BGP neighbor IP address to clear\n" |
| 4537 | "BGP IPv6 neighbor to clear\n") |
| 4538 | { |
| 4539 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4540 | } |
| 4541 | |
| 4542 | ALIAS (clear_ip_bgp_peer, |
| 4543 | clear_bgp_peer_cmd, |
| 4544 | "clear bgp (A.B.C.D|X:X::X:X)", |
| 4545 | CLEAR_STR |
| 4546 | BGP_STR |
| 4547 | "BGP neighbor address to clear\n" |
| 4548 | "BGP IPv6 neighbor to clear\n") |
| 4549 | |
| 4550 | ALIAS (clear_ip_bgp_peer, |
| 4551 | clear_bgp_ipv6_peer_cmd, |
| 4552 | "clear bgp ipv6 (A.B.C.D|X:X::X:X)", |
| 4553 | CLEAR_STR |
| 4554 | BGP_STR |
| 4555 | "Address family\n" |
| 4556 | "BGP neighbor address to clear\n" |
| 4557 | "BGP IPv6 neighbor to clear\n") |
| 4558 | |
| 4559 | DEFUN (clear_ip_bgp_peer_group, |
| 4560 | clear_ip_bgp_peer_group_cmd, |
| 4561 | "clear ip bgp peer-group WORD", |
| 4562 | CLEAR_STR |
| 4563 | IP_STR |
| 4564 | BGP_STR |
| 4565 | "Clear all members of peer-group\n" |
| 4566 | "BGP peer-group name\n") |
| 4567 | { |
| 4568 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4569 | } |
| 4570 | |
| 4571 | ALIAS (clear_ip_bgp_peer_group, |
| 4572 | clear_bgp_peer_group_cmd, |
| 4573 | "clear bgp peer-group WORD", |
| 4574 | CLEAR_STR |
| 4575 | BGP_STR |
| 4576 | "Clear all members of peer-group\n" |
| 4577 | "BGP peer-group name\n") |
| 4578 | |
| 4579 | ALIAS (clear_ip_bgp_peer_group, |
| 4580 | clear_bgp_ipv6_peer_group_cmd, |
| 4581 | "clear bgp ipv6 peer-group WORD", |
| 4582 | CLEAR_STR |
| 4583 | BGP_STR |
| 4584 | "Address family\n" |
| 4585 | "Clear all members of peer-group\n" |
| 4586 | "BGP peer-group name\n") |
| 4587 | |
| 4588 | DEFUN (clear_ip_bgp_external, |
| 4589 | clear_ip_bgp_external_cmd, |
| 4590 | "clear ip bgp external", |
| 4591 | CLEAR_STR |
| 4592 | IP_STR |
| 4593 | BGP_STR |
| 4594 | "Clear all external peers\n") |
| 4595 | { |
| 4596 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
| 4597 | } |
| 4598 | |
| 4599 | ALIAS (clear_ip_bgp_external, |
| 4600 | clear_bgp_external_cmd, |
| 4601 | "clear bgp external", |
| 4602 | CLEAR_STR |
| 4603 | BGP_STR |
| 4604 | "Clear all external peers\n") |
| 4605 | |
| 4606 | ALIAS (clear_ip_bgp_external, |
| 4607 | clear_bgp_ipv6_external_cmd, |
| 4608 | "clear bgp ipv6 external", |
| 4609 | CLEAR_STR |
| 4610 | BGP_STR |
| 4611 | "Address family\n" |
| 4612 | "Clear all external peers\n") |
| 4613 | |
| 4614 | DEFUN (clear_ip_bgp_as, |
| 4615 | clear_ip_bgp_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4616 | "clear ip bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4617 | CLEAR_STR |
| 4618 | IP_STR |
| 4619 | BGP_STR |
| 4620 | "Clear peers with the AS number\n") |
| 4621 | { |
| 4622 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4623 | } |
| 4624 | |
| 4625 | ALIAS (clear_ip_bgp_as, |
| 4626 | clear_bgp_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4627 | "clear bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4628 | CLEAR_STR |
| 4629 | BGP_STR |
| 4630 | "Clear peers with the AS number\n") |
| 4631 | |
| 4632 | ALIAS (clear_ip_bgp_as, |
| 4633 | clear_bgp_ipv6_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4634 | "clear bgp ipv6 " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4635 | CLEAR_STR |
| 4636 | BGP_STR |
| 4637 | "Address family\n" |
| 4638 | "Clear peers with the AS number\n") |
| 4639 | |
| 4640 | /* Outbound soft-reconfiguration */ |
| 4641 | DEFUN (clear_ip_bgp_all_soft_out, |
| 4642 | clear_ip_bgp_all_soft_out_cmd, |
| 4643 | "clear ip bgp * soft out", |
| 4644 | CLEAR_STR |
| 4645 | IP_STR |
| 4646 | BGP_STR |
| 4647 | "Clear all peers\n" |
| 4648 | "Soft reconfig\n" |
| 4649 | "Soft reconfig outbound update\n") |
| 4650 | { |
| 4651 | if (argc == 1) |
| 4652 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4653 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4654 | |
| 4655 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4656 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4657 | } |
| 4658 | |
| 4659 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4660 | clear_ip_bgp_all_out_cmd, |
| 4661 | "clear ip bgp * out", |
| 4662 | CLEAR_STR |
| 4663 | IP_STR |
| 4664 | BGP_STR |
| 4665 | "Clear all peers\n" |
| 4666 | "Soft reconfig outbound update\n") |
| 4667 | |
| 4668 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4669 | clear_ip_bgp_instance_all_soft_out_cmd, |
| 4670 | "clear ip bgp view WORD * soft out", |
| 4671 | CLEAR_STR |
| 4672 | IP_STR |
| 4673 | BGP_STR |
| 4674 | "BGP view\n" |
| 4675 | "view name\n" |
| 4676 | "Clear all peers\n" |
| 4677 | "Soft reconfig\n" |
| 4678 | "Soft reconfig outbound update\n") |
| 4679 | |
| 4680 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, |
| 4681 | clear_ip_bgp_all_ipv4_soft_out_cmd, |
| 4682 | "clear ip bgp * ipv4 (unicast|multicast) soft out", |
| 4683 | CLEAR_STR |
| 4684 | IP_STR |
| 4685 | BGP_STR |
| 4686 | "Clear all peers\n" |
| 4687 | "Address family\n" |
| 4688 | "Address Family modifier\n" |
| 4689 | "Address Family modifier\n" |
| 4690 | "Soft reconfig\n" |
| 4691 | "Soft reconfig outbound update\n") |
| 4692 | { |
| 4693 | if (strncmp (argv[0], "m", 1) == 0) |
| 4694 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 4695 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4696 | |
| 4697 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4698 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4699 | } |
| 4700 | |
| 4701 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, |
| 4702 | clear_ip_bgp_all_ipv4_out_cmd, |
| 4703 | "clear ip bgp * ipv4 (unicast|multicast) out", |
| 4704 | CLEAR_STR |
| 4705 | IP_STR |
| 4706 | BGP_STR |
| 4707 | "Clear all peers\n" |
| 4708 | "Address family\n" |
| 4709 | "Address Family modifier\n" |
| 4710 | "Address Family modifier\n" |
| 4711 | "Soft reconfig outbound update\n") |
| 4712 | |
| 4713 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
| 4714 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, |
| 4715 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", |
| 4716 | CLEAR_STR |
| 4717 | IP_STR |
| 4718 | BGP_STR |
| 4719 | "BGP view\n" |
| 4720 | "view name\n" |
| 4721 | "Clear all peers\n" |
| 4722 | "Address family\n" |
| 4723 | "Address Family modifier\n" |
| 4724 | "Address Family modifier\n" |
| 4725 | "Soft reconfig outbound update\n") |
| 4726 | { |
| 4727 | if (strncmp (argv[1], "m", 1) == 0) |
| 4728 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 4729 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4730 | |
| 4731 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4732 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4733 | } |
| 4734 | |
| 4735 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, |
| 4736 | clear_ip_bgp_all_vpnv4_soft_out_cmd, |
| 4737 | "clear ip bgp * vpnv4 unicast soft out", |
| 4738 | CLEAR_STR |
| 4739 | IP_STR |
| 4740 | BGP_STR |
| 4741 | "Clear all peers\n" |
| 4742 | "Address family\n" |
| 4743 | "Address Family Modifier\n" |
| 4744 | "Soft reconfig\n" |
| 4745 | "Soft reconfig outbound update\n") |
| 4746 | { |
| 4747 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 4748 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4749 | } |
| 4750 | |
| 4751 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, |
| 4752 | clear_ip_bgp_all_vpnv4_out_cmd, |
| 4753 | "clear ip bgp * vpnv4 unicast out", |
| 4754 | CLEAR_STR |
| 4755 | IP_STR |
| 4756 | BGP_STR |
| 4757 | "Clear all peers\n" |
| 4758 | "Address family\n" |
| 4759 | "Address Family Modifier\n" |
| 4760 | "Soft reconfig outbound update\n") |
| 4761 | |
| 4762 | DEFUN (clear_bgp_all_soft_out, |
| 4763 | clear_bgp_all_soft_out_cmd, |
| 4764 | "clear bgp * soft out", |
| 4765 | CLEAR_STR |
| 4766 | BGP_STR |
| 4767 | "Clear all peers\n" |
| 4768 | "Soft reconfig\n" |
| 4769 | "Soft reconfig outbound update\n") |
| 4770 | { |
| 4771 | if (argc == 1) |
| 4772 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 4773 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4774 | |
| 4775 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 4776 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4777 | } |
| 4778 | |
| 4779 | ALIAS (clear_bgp_all_soft_out, |
| 4780 | clear_bgp_instance_all_soft_out_cmd, |
| 4781 | "clear bgp view WORD * soft out", |
| 4782 | CLEAR_STR |
| 4783 | BGP_STR |
| 4784 | "BGP view\n" |
| 4785 | "view name\n" |
| 4786 | "Clear all peers\n" |
| 4787 | "Soft reconfig\n" |
| 4788 | "Soft reconfig outbound update\n") |
| 4789 | |
| 4790 | ALIAS (clear_bgp_all_soft_out, |
| 4791 | clear_bgp_all_out_cmd, |
| 4792 | "clear bgp * out", |
| 4793 | CLEAR_STR |
| 4794 | BGP_STR |
| 4795 | "Clear all peers\n" |
| 4796 | "Soft reconfig outbound update\n") |
| 4797 | |
| 4798 | ALIAS (clear_bgp_all_soft_out, |
| 4799 | clear_bgp_ipv6_all_soft_out_cmd, |
| 4800 | "clear bgp ipv6 * soft out", |
| 4801 | CLEAR_STR |
| 4802 | BGP_STR |
| 4803 | "Address family\n" |
| 4804 | "Clear all peers\n" |
| 4805 | "Soft reconfig\n" |
| 4806 | "Soft reconfig outbound update\n") |
| 4807 | |
| 4808 | ALIAS (clear_bgp_all_soft_out, |
| 4809 | clear_bgp_ipv6_all_out_cmd, |
| 4810 | "clear bgp ipv6 * out", |
| 4811 | CLEAR_STR |
| 4812 | BGP_STR |
| 4813 | "Address family\n" |
| 4814 | "Clear all peers\n" |
| 4815 | "Soft reconfig outbound update\n") |
| 4816 | |
| 4817 | DEFUN (clear_ip_bgp_peer_soft_out, |
| 4818 | clear_ip_bgp_peer_soft_out_cmd, |
| 4819 | "clear ip bgp A.B.C.D soft out", |
| 4820 | CLEAR_STR |
| 4821 | IP_STR |
| 4822 | BGP_STR |
| 4823 | "BGP neighbor address to clear\n" |
| 4824 | "Soft reconfig\n" |
| 4825 | "Soft reconfig outbound update\n") |
| 4826 | { |
| 4827 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4828 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4829 | } |
| 4830 | |
| 4831 | ALIAS (clear_ip_bgp_peer_soft_out, |
| 4832 | clear_ip_bgp_peer_out_cmd, |
| 4833 | "clear ip bgp A.B.C.D out", |
| 4834 | CLEAR_STR |
| 4835 | IP_STR |
| 4836 | BGP_STR |
| 4837 | "BGP neighbor address to clear\n" |
| 4838 | "Soft reconfig outbound update\n") |
| 4839 | |
| 4840 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
| 4841 | clear_ip_bgp_peer_ipv4_soft_out_cmd, |
| 4842 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", |
| 4843 | CLEAR_STR |
| 4844 | IP_STR |
| 4845 | BGP_STR |
| 4846 | "BGP neighbor address to clear\n" |
| 4847 | "Address family\n" |
| 4848 | "Address Family modifier\n" |
| 4849 | "Address Family modifier\n" |
| 4850 | "Soft reconfig\n" |
| 4851 | "Soft reconfig outbound update\n") |
| 4852 | { |
| 4853 | if (strncmp (argv[1], "m", 1) == 0) |
| 4854 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 4855 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4856 | |
| 4857 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4858 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4859 | } |
| 4860 | |
| 4861 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, |
| 4862 | clear_ip_bgp_peer_ipv4_out_cmd, |
| 4863 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", |
| 4864 | CLEAR_STR |
| 4865 | IP_STR |
| 4866 | BGP_STR |
| 4867 | "BGP neighbor address to clear\n" |
| 4868 | "Address family\n" |
| 4869 | "Address Family modifier\n" |
| 4870 | "Address Family modifier\n" |
| 4871 | "Soft reconfig outbound update\n") |
| 4872 | |
| 4873 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4874 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, |
| 4875 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", |
| 4876 | CLEAR_STR |
| 4877 | IP_STR |
| 4878 | BGP_STR |
| 4879 | "BGP neighbor address to clear\n" |
| 4880 | "Address family\n" |
| 4881 | "Address Family Modifier\n" |
| 4882 | "Soft reconfig\n" |
| 4883 | "Soft reconfig outbound update\n") |
| 4884 | { |
| 4885 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 4886 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4887 | } |
| 4888 | |
| 4889 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4890 | clear_ip_bgp_peer_vpnv4_out_cmd, |
| 4891 | "clear ip bgp A.B.C.D vpnv4 unicast out", |
| 4892 | CLEAR_STR |
| 4893 | IP_STR |
| 4894 | BGP_STR |
| 4895 | "BGP neighbor address to clear\n" |
| 4896 | "Address family\n" |
| 4897 | "Address Family Modifier\n" |
| 4898 | "Soft reconfig outbound update\n") |
| 4899 | |
| 4900 | DEFUN (clear_bgp_peer_soft_out, |
| 4901 | clear_bgp_peer_soft_out_cmd, |
| 4902 | "clear bgp (A.B.C.D|X:X::X:X) soft out", |
| 4903 | CLEAR_STR |
| 4904 | BGP_STR |
| 4905 | "BGP neighbor address to clear\n" |
| 4906 | "BGP IPv6 neighbor to clear\n" |
| 4907 | "Soft reconfig\n" |
| 4908 | "Soft reconfig outbound update\n") |
| 4909 | { |
| 4910 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 4911 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4912 | } |
| 4913 | |
| 4914 | ALIAS (clear_bgp_peer_soft_out, |
| 4915 | clear_bgp_ipv6_peer_soft_out_cmd, |
| 4916 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out", |
| 4917 | CLEAR_STR |
| 4918 | BGP_STR |
| 4919 | "Address family\n" |
| 4920 | "BGP neighbor address to clear\n" |
| 4921 | "BGP IPv6 neighbor to clear\n" |
| 4922 | "Soft reconfig\n" |
| 4923 | "Soft reconfig outbound update\n") |
| 4924 | |
| 4925 | ALIAS (clear_bgp_peer_soft_out, |
| 4926 | clear_bgp_peer_out_cmd, |
| 4927 | "clear bgp (A.B.C.D|X:X::X:X) out", |
| 4928 | CLEAR_STR |
| 4929 | BGP_STR |
| 4930 | "BGP neighbor address to clear\n" |
| 4931 | "BGP IPv6 neighbor to clear\n" |
| 4932 | "Soft reconfig outbound update\n") |
| 4933 | |
| 4934 | ALIAS (clear_bgp_peer_soft_out, |
| 4935 | clear_bgp_ipv6_peer_out_cmd, |
| 4936 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) out", |
| 4937 | CLEAR_STR |
| 4938 | BGP_STR |
| 4939 | "Address family\n" |
| 4940 | "BGP neighbor address to clear\n" |
| 4941 | "BGP IPv6 neighbor to clear\n" |
| 4942 | "Soft reconfig outbound update\n") |
| 4943 | |
| 4944 | DEFUN (clear_ip_bgp_peer_group_soft_out, |
| 4945 | clear_ip_bgp_peer_group_soft_out_cmd, |
| 4946 | "clear ip bgp peer-group WORD soft out", |
| 4947 | CLEAR_STR |
| 4948 | IP_STR |
| 4949 | BGP_STR |
| 4950 | "Clear all members of peer-group\n" |
| 4951 | "BGP peer-group name\n" |
| 4952 | "Soft reconfig\n" |
| 4953 | "Soft reconfig outbound update\n") |
| 4954 | { |
| 4955 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4956 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4957 | } |
| 4958 | |
| 4959 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
| 4960 | clear_ip_bgp_peer_group_out_cmd, |
| 4961 | "clear ip bgp peer-group WORD out", |
| 4962 | CLEAR_STR |
| 4963 | IP_STR |
| 4964 | BGP_STR |
| 4965 | "Clear all members of peer-group\n" |
| 4966 | "BGP peer-group name\n" |
| 4967 | "Soft reconfig outbound update\n") |
| 4968 | |
| 4969 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4970 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, |
| 4971 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", |
| 4972 | CLEAR_STR |
| 4973 | IP_STR |
| 4974 | BGP_STR |
| 4975 | "Clear all members of peer-group\n" |
| 4976 | "BGP peer-group name\n" |
| 4977 | "Address family\n" |
| 4978 | "Address Family modifier\n" |
| 4979 | "Address Family modifier\n" |
| 4980 | "Soft reconfig\n" |
| 4981 | "Soft reconfig outbound update\n") |
| 4982 | { |
| 4983 | if (strncmp (argv[1], "m", 1) == 0) |
| 4984 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 4985 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4986 | |
| 4987 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4988 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4989 | } |
| 4990 | |
| 4991 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4992 | clear_ip_bgp_peer_group_ipv4_out_cmd, |
| 4993 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", |
| 4994 | CLEAR_STR |
| 4995 | IP_STR |
| 4996 | BGP_STR |
| 4997 | "Clear all members of peer-group\n" |
| 4998 | "BGP peer-group name\n" |
| 4999 | "Address family\n" |
| 5000 | "Address Family modifier\n" |
| 5001 | "Address Family modifier\n" |
| 5002 | "Soft reconfig outbound update\n") |
| 5003 | |
| 5004 | DEFUN (clear_bgp_peer_group_soft_out, |
| 5005 | clear_bgp_peer_group_soft_out_cmd, |
| 5006 | "clear bgp peer-group WORD soft out", |
| 5007 | CLEAR_STR |
| 5008 | BGP_STR |
| 5009 | "Clear all members of peer-group\n" |
| 5010 | "BGP peer-group name\n" |
| 5011 | "Soft reconfig\n" |
| 5012 | "Soft reconfig outbound update\n") |
| 5013 | { |
| 5014 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5015 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5016 | } |
| 5017 | |
| 5018 | ALIAS (clear_bgp_peer_group_soft_out, |
| 5019 | clear_bgp_ipv6_peer_group_soft_out_cmd, |
| 5020 | "clear bgp ipv6 peer-group WORD soft out", |
| 5021 | CLEAR_STR |
| 5022 | BGP_STR |
| 5023 | "Address family\n" |
| 5024 | "Clear all members of peer-group\n" |
| 5025 | "BGP peer-group name\n" |
| 5026 | "Soft reconfig\n" |
| 5027 | "Soft reconfig outbound update\n") |
| 5028 | |
| 5029 | ALIAS (clear_bgp_peer_group_soft_out, |
| 5030 | clear_bgp_peer_group_out_cmd, |
| 5031 | "clear bgp peer-group WORD out", |
| 5032 | CLEAR_STR |
| 5033 | BGP_STR |
| 5034 | "Clear all members of peer-group\n" |
| 5035 | "BGP peer-group name\n" |
| 5036 | "Soft reconfig outbound update\n") |
| 5037 | |
| 5038 | ALIAS (clear_bgp_peer_group_soft_out, |
| 5039 | clear_bgp_ipv6_peer_group_out_cmd, |
| 5040 | "clear bgp ipv6 peer-group WORD out", |
| 5041 | CLEAR_STR |
| 5042 | BGP_STR |
| 5043 | "Address family\n" |
| 5044 | "Clear all members of peer-group\n" |
| 5045 | "BGP peer-group name\n" |
| 5046 | "Soft reconfig outbound update\n") |
| 5047 | |
| 5048 | DEFUN (clear_ip_bgp_external_soft_out, |
| 5049 | clear_ip_bgp_external_soft_out_cmd, |
| 5050 | "clear ip bgp external soft out", |
| 5051 | CLEAR_STR |
| 5052 | IP_STR |
| 5053 | BGP_STR |
| 5054 | "Clear all external peers\n" |
| 5055 | "Soft reconfig\n" |
| 5056 | "Soft reconfig outbound update\n") |
| 5057 | { |
| 5058 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5059 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5060 | } |
| 5061 | |
| 5062 | ALIAS (clear_ip_bgp_external_soft_out, |
| 5063 | clear_ip_bgp_external_out_cmd, |
| 5064 | "clear ip bgp external out", |
| 5065 | CLEAR_STR |
| 5066 | IP_STR |
| 5067 | BGP_STR |
| 5068 | "Clear all external peers\n" |
| 5069 | "Soft reconfig outbound update\n") |
| 5070 | |
| 5071 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, |
| 5072 | clear_ip_bgp_external_ipv4_soft_out_cmd, |
| 5073 | "clear ip bgp external ipv4 (unicast|multicast) soft out", |
| 5074 | CLEAR_STR |
| 5075 | IP_STR |
| 5076 | BGP_STR |
| 5077 | "Clear all external peers\n" |
| 5078 | "Address family\n" |
| 5079 | "Address Family modifier\n" |
| 5080 | "Address Family modifier\n" |
| 5081 | "Soft reconfig\n" |
| 5082 | "Soft reconfig outbound update\n") |
| 5083 | { |
| 5084 | if (strncmp (argv[0], "m", 1) == 0) |
| 5085 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5086 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5087 | |
| 5088 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5089 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5090 | } |
| 5091 | |
| 5092 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, |
| 5093 | clear_ip_bgp_external_ipv4_out_cmd, |
| 5094 | "clear ip bgp external ipv4 (unicast|multicast) out", |
| 5095 | CLEAR_STR |
| 5096 | IP_STR |
| 5097 | BGP_STR |
| 5098 | "Clear all external peers\n" |
| 5099 | "Address family\n" |
| 5100 | "Address Family modifier\n" |
| 5101 | "Address Family modifier\n" |
| 5102 | "Soft reconfig outbound update\n") |
| 5103 | |
| 5104 | DEFUN (clear_bgp_external_soft_out, |
| 5105 | clear_bgp_external_soft_out_cmd, |
| 5106 | "clear bgp external soft out", |
| 5107 | CLEAR_STR |
| 5108 | BGP_STR |
| 5109 | "Clear all external peers\n" |
| 5110 | "Soft reconfig\n" |
| 5111 | "Soft reconfig outbound update\n") |
| 5112 | { |
| 5113 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5114 | BGP_CLEAR_SOFT_OUT, NULL); |
| 5115 | } |
| 5116 | |
| 5117 | ALIAS (clear_bgp_external_soft_out, |
| 5118 | clear_bgp_ipv6_external_soft_out_cmd, |
| 5119 | "clear bgp ipv6 external soft out", |
| 5120 | CLEAR_STR |
| 5121 | BGP_STR |
| 5122 | "Address family\n" |
| 5123 | "Clear all external peers\n" |
| 5124 | "Soft reconfig\n" |
| 5125 | "Soft reconfig outbound update\n") |
| 5126 | |
| 5127 | ALIAS (clear_bgp_external_soft_out, |
| 5128 | clear_bgp_external_out_cmd, |
| 5129 | "clear bgp external out", |
| 5130 | CLEAR_STR |
| 5131 | BGP_STR |
| 5132 | "Clear all external peers\n" |
| 5133 | "Soft reconfig outbound update\n") |
| 5134 | |
| 5135 | ALIAS (clear_bgp_external_soft_out, |
| 5136 | clear_bgp_ipv6_external_out_cmd, |
| 5137 | "clear bgp ipv6 external WORD out", |
| 5138 | CLEAR_STR |
| 5139 | BGP_STR |
| 5140 | "Address family\n" |
| 5141 | "Clear all external peers\n" |
| 5142 | "Soft reconfig outbound update\n") |
| 5143 | |
| 5144 | DEFUN (clear_ip_bgp_as_soft_out, |
| 5145 | clear_ip_bgp_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5146 | "clear ip bgp " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5147 | CLEAR_STR |
| 5148 | IP_STR |
| 5149 | BGP_STR |
| 5150 | "Clear peers with the AS number\n" |
| 5151 | "Soft reconfig\n" |
| 5152 | "Soft reconfig outbound update\n") |
| 5153 | { |
| 5154 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5155 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5156 | } |
| 5157 | |
| 5158 | ALIAS (clear_ip_bgp_as_soft_out, |
| 5159 | clear_ip_bgp_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5160 | "clear ip bgp " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5161 | CLEAR_STR |
| 5162 | IP_STR |
| 5163 | BGP_STR |
| 5164 | "Clear peers with the AS number\n" |
| 5165 | "Soft reconfig outbound update\n") |
| 5166 | |
| 5167 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
| 5168 | clear_ip_bgp_as_ipv4_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5169 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5170 | CLEAR_STR |
| 5171 | IP_STR |
| 5172 | BGP_STR |
| 5173 | "Clear peers with the AS number\n" |
| 5174 | "Address family\n" |
| 5175 | "Address Family modifier\n" |
| 5176 | "Address Family modifier\n" |
| 5177 | "Soft reconfig\n" |
| 5178 | "Soft reconfig outbound update\n") |
| 5179 | { |
| 5180 | if (strncmp (argv[1], "m", 1) == 0) |
| 5181 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5182 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5183 | |
| 5184 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5185 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5186 | } |
| 5187 | |
| 5188 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, |
| 5189 | clear_ip_bgp_as_ipv4_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5190 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5191 | CLEAR_STR |
| 5192 | IP_STR |
| 5193 | BGP_STR |
| 5194 | "Clear peers with the AS number\n" |
| 5195 | "Address family\n" |
| 5196 | "Address Family modifier\n" |
| 5197 | "Address Family modifier\n" |
| 5198 | "Soft reconfig outbound update\n") |
| 5199 | |
| 5200 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
| 5201 | clear_ip_bgp_as_vpnv4_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5202 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5203 | CLEAR_STR |
| 5204 | IP_STR |
| 5205 | BGP_STR |
| 5206 | "Clear peers with the AS number\n" |
| 5207 | "Address family\n" |
| 5208 | "Address Family modifier\n" |
| 5209 | "Soft reconfig\n" |
| 5210 | "Soft reconfig outbound update\n") |
| 5211 | { |
| 5212 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 5213 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5214 | } |
| 5215 | |
| 5216 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, |
| 5217 | clear_ip_bgp_as_vpnv4_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5218 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5219 | CLEAR_STR |
| 5220 | IP_STR |
| 5221 | BGP_STR |
| 5222 | "Clear peers with the AS number\n" |
| 5223 | "Address family\n" |
| 5224 | "Address Family modifier\n" |
| 5225 | "Soft reconfig outbound update\n") |
| 5226 | |
| 5227 | DEFUN (clear_bgp_as_soft_out, |
| 5228 | clear_bgp_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5229 | "clear bgp " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5230 | CLEAR_STR |
| 5231 | BGP_STR |
| 5232 | "Clear peers with the AS number\n" |
| 5233 | "Soft reconfig\n" |
| 5234 | "Soft reconfig outbound update\n") |
| 5235 | { |
| 5236 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5237 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5238 | } |
| 5239 | |
| 5240 | ALIAS (clear_bgp_as_soft_out, |
| 5241 | clear_bgp_ipv6_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5242 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5243 | CLEAR_STR |
| 5244 | BGP_STR |
| 5245 | "Address family\n" |
| 5246 | "Clear peers with the AS number\n" |
| 5247 | "Soft reconfig\n" |
| 5248 | "Soft reconfig outbound update\n") |
| 5249 | |
| 5250 | ALIAS (clear_bgp_as_soft_out, |
| 5251 | clear_bgp_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5252 | "clear bgp " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5253 | CLEAR_STR |
| 5254 | BGP_STR |
| 5255 | "Clear peers with the AS number\n" |
| 5256 | "Soft reconfig outbound update\n") |
| 5257 | |
| 5258 | ALIAS (clear_bgp_as_soft_out, |
| 5259 | clear_bgp_ipv6_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5260 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5261 | CLEAR_STR |
| 5262 | BGP_STR |
| 5263 | "Address family\n" |
| 5264 | "Clear peers with the AS number\n" |
| 5265 | "Soft reconfig outbound update\n") |
| 5266 | |
| 5267 | /* Inbound soft-reconfiguration */ |
| 5268 | DEFUN (clear_ip_bgp_all_soft_in, |
| 5269 | clear_ip_bgp_all_soft_in_cmd, |
| 5270 | "clear ip bgp * soft in", |
| 5271 | CLEAR_STR |
| 5272 | IP_STR |
| 5273 | BGP_STR |
| 5274 | "Clear all peers\n" |
| 5275 | "Soft reconfig\n" |
| 5276 | "Soft reconfig inbound update\n") |
| 5277 | { |
| 5278 | if (argc == 1) |
| 5279 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5280 | BGP_CLEAR_SOFT_IN, NULL); |
| 5281 | |
| 5282 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5283 | BGP_CLEAR_SOFT_IN, NULL); |
| 5284 | } |
| 5285 | |
| 5286 | ALIAS (clear_ip_bgp_all_soft_in, |
| 5287 | clear_ip_bgp_instance_all_soft_in_cmd, |
| 5288 | "clear ip bgp view WORD * soft in", |
| 5289 | CLEAR_STR |
| 5290 | IP_STR |
| 5291 | BGP_STR |
| 5292 | "BGP view\n" |
| 5293 | "view name\n" |
| 5294 | "Clear all peers\n" |
| 5295 | "Soft reconfig\n" |
| 5296 | "Soft reconfig inbound update\n") |
| 5297 | |
| 5298 | ALIAS (clear_ip_bgp_all_soft_in, |
| 5299 | clear_ip_bgp_all_in_cmd, |
| 5300 | "clear ip bgp * in", |
| 5301 | CLEAR_STR |
| 5302 | IP_STR |
| 5303 | BGP_STR |
| 5304 | "Clear all peers\n" |
| 5305 | "Soft reconfig inbound update\n") |
| 5306 | |
| 5307 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
| 5308 | clear_ip_bgp_all_in_prefix_filter_cmd, |
| 5309 | "clear ip bgp * in prefix-filter", |
| 5310 | CLEAR_STR |
| 5311 | IP_STR |
| 5312 | BGP_STR |
| 5313 | "Clear all peers\n" |
| 5314 | "Soft reconfig inbound update\n" |
| 5315 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5316 | { |
| 5317 | if (argc== 1) |
| 5318 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5319 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5320 | |
| 5321 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5322 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5323 | } |
| 5324 | |
| 5325 | ALIAS (clear_ip_bgp_all_in_prefix_filter, |
| 5326 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, |
| 5327 | "clear ip bgp view WORD * in prefix-filter", |
| 5328 | CLEAR_STR |
| 5329 | IP_STR |
| 5330 | BGP_STR |
| 5331 | "BGP view\n" |
| 5332 | "view name\n" |
| 5333 | "Clear all peers\n" |
| 5334 | "Soft reconfig inbound update\n" |
| 5335 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5336 | |
| 5337 | |
| 5338 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
| 5339 | clear_ip_bgp_all_ipv4_soft_in_cmd, |
| 5340 | "clear ip bgp * ipv4 (unicast|multicast) soft in", |
| 5341 | CLEAR_STR |
| 5342 | IP_STR |
| 5343 | BGP_STR |
| 5344 | "Clear all peers\n" |
| 5345 | "Address family\n" |
| 5346 | "Address Family modifier\n" |
| 5347 | "Address Family modifier\n" |
| 5348 | "Soft reconfig\n" |
| 5349 | "Soft reconfig inbound update\n") |
| 5350 | { |
| 5351 | if (strncmp (argv[0], "m", 1) == 0) |
| 5352 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5353 | BGP_CLEAR_SOFT_IN, NULL); |
| 5354 | |
| 5355 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5356 | BGP_CLEAR_SOFT_IN, NULL); |
| 5357 | } |
| 5358 | |
| 5359 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, |
| 5360 | clear_ip_bgp_all_ipv4_in_cmd, |
| 5361 | "clear ip bgp * ipv4 (unicast|multicast) in", |
| 5362 | CLEAR_STR |
| 5363 | IP_STR |
| 5364 | BGP_STR |
| 5365 | "Clear all peers\n" |
| 5366 | "Address family\n" |
| 5367 | "Address Family modifier\n" |
| 5368 | "Address Family modifier\n" |
| 5369 | "Soft reconfig inbound update\n") |
| 5370 | |
| 5371 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
| 5372 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, |
| 5373 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", |
| 5374 | CLEAR_STR |
| 5375 | IP_STR |
| 5376 | BGP_STR |
| 5377 | "BGP view\n" |
| 5378 | "view name\n" |
| 5379 | "Clear all peers\n" |
| 5380 | "Address family\n" |
| 5381 | "Address Family modifier\n" |
| 5382 | "Address Family modifier\n" |
| 5383 | "Soft reconfig\n" |
| 5384 | "Soft reconfig inbound update\n") |
| 5385 | { |
| 5386 | if (strncmp (argv[1], "m", 1) == 0) |
| 5387 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5388 | BGP_CLEAR_SOFT_IN, NULL); |
| 5389 | |
| 5390 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5391 | BGP_CLEAR_SOFT_IN, NULL); |
| 5392 | } |
| 5393 | |
| 5394 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
| 5395 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, |
| 5396 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", |
| 5397 | CLEAR_STR |
| 5398 | IP_STR |
| 5399 | BGP_STR |
| 5400 | "Clear all peers\n" |
| 5401 | "Address family\n" |
| 5402 | "Address Family modifier\n" |
| 5403 | "Address Family modifier\n" |
| 5404 | "Soft reconfig inbound update\n" |
| 5405 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5406 | { |
| 5407 | if (strncmp (argv[0], "m", 1) == 0) |
| 5408 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5409 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5410 | |
| 5411 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5412 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5413 | } |
| 5414 | |
| 5415 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, |
| 5416 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, |
| 5417 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", |
| 5418 | CLEAR_STR |
| 5419 | IP_STR |
| 5420 | BGP_STR |
| 5421 | "Clear all peers\n" |
| 5422 | "Address family\n" |
| 5423 | "Address Family modifier\n" |
| 5424 | "Address Family modifier\n" |
| 5425 | "Soft reconfig inbound update\n" |
| 5426 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5427 | { |
| 5428 | if (strncmp (argv[1], "m", 1) == 0) |
| 5429 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5430 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5431 | |
| 5432 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5433 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5434 | } |
| 5435 | |
| 5436 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, |
| 5437 | clear_ip_bgp_all_vpnv4_soft_in_cmd, |
| 5438 | "clear ip bgp * vpnv4 unicast soft in", |
| 5439 | CLEAR_STR |
| 5440 | IP_STR |
| 5441 | BGP_STR |
| 5442 | "Clear all peers\n" |
| 5443 | "Address family\n" |
| 5444 | "Address Family Modifier\n" |
| 5445 | "Soft reconfig\n" |
| 5446 | "Soft reconfig inbound update\n") |
| 5447 | { |
| 5448 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 5449 | BGP_CLEAR_SOFT_IN, NULL); |
| 5450 | } |
| 5451 | |
| 5452 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, |
| 5453 | clear_ip_bgp_all_vpnv4_in_cmd, |
| 5454 | "clear ip bgp * vpnv4 unicast in", |
| 5455 | CLEAR_STR |
| 5456 | IP_STR |
| 5457 | BGP_STR |
| 5458 | "Clear all peers\n" |
| 5459 | "Address family\n" |
| 5460 | "Address Family Modifier\n" |
| 5461 | "Soft reconfig inbound update\n") |
| 5462 | |
| 5463 | DEFUN (clear_bgp_all_soft_in, |
| 5464 | clear_bgp_all_soft_in_cmd, |
| 5465 | "clear bgp * soft in", |
| 5466 | CLEAR_STR |
| 5467 | BGP_STR |
| 5468 | "Clear all peers\n" |
| 5469 | "Soft reconfig\n" |
| 5470 | "Soft reconfig inbound update\n") |
| 5471 | { |
| 5472 | if (argc == 1) |
| 5473 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 5474 | BGP_CLEAR_SOFT_IN, NULL); |
| 5475 | |
| 5476 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5477 | BGP_CLEAR_SOFT_IN, NULL); |
| 5478 | } |
| 5479 | |
| 5480 | ALIAS (clear_bgp_all_soft_in, |
| 5481 | clear_bgp_instance_all_soft_in_cmd, |
| 5482 | "clear bgp view WORD * soft in", |
| 5483 | CLEAR_STR |
| 5484 | BGP_STR |
| 5485 | "BGP view\n" |
| 5486 | "view name\n" |
| 5487 | "Clear all peers\n" |
| 5488 | "Soft reconfig\n" |
| 5489 | "Soft reconfig inbound update\n") |
| 5490 | |
| 5491 | ALIAS (clear_bgp_all_soft_in, |
| 5492 | clear_bgp_ipv6_all_soft_in_cmd, |
| 5493 | "clear bgp ipv6 * soft in", |
| 5494 | CLEAR_STR |
| 5495 | BGP_STR |
| 5496 | "Address family\n" |
| 5497 | "Clear all peers\n" |
| 5498 | "Soft reconfig\n" |
| 5499 | "Soft reconfig inbound update\n") |
| 5500 | |
| 5501 | ALIAS (clear_bgp_all_soft_in, |
| 5502 | clear_bgp_all_in_cmd, |
| 5503 | "clear bgp * in", |
| 5504 | CLEAR_STR |
| 5505 | BGP_STR |
| 5506 | "Clear all peers\n" |
| 5507 | "Soft reconfig inbound update\n") |
| 5508 | |
| 5509 | ALIAS (clear_bgp_all_soft_in, |
| 5510 | clear_bgp_ipv6_all_in_cmd, |
| 5511 | "clear bgp ipv6 * in", |
| 5512 | CLEAR_STR |
| 5513 | BGP_STR |
| 5514 | "Address family\n" |
| 5515 | "Clear all peers\n" |
| 5516 | "Soft reconfig inbound update\n") |
| 5517 | |
| 5518 | DEFUN (clear_bgp_all_in_prefix_filter, |
| 5519 | clear_bgp_all_in_prefix_filter_cmd, |
| 5520 | "clear bgp * in prefix-filter", |
| 5521 | CLEAR_STR |
| 5522 | BGP_STR |
| 5523 | "Clear all peers\n" |
| 5524 | "Soft reconfig inbound update\n" |
| 5525 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5526 | { |
| 5527 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5528 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5529 | } |
| 5530 | |
| 5531 | ALIAS (clear_bgp_all_in_prefix_filter, |
| 5532 | clear_bgp_ipv6_all_in_prefix_filter_cmd, |
| 5533 | "clear bgp ipv6 * in prefix-filter", |
| 5534 | CLEAR_STR |
| 5535 | BGP_STR |
| 5536 | "Address family\n" |
| 5537 | "Clear all peers\n" |
| 5538 | "Soft reconfig inbound update\n" |
| 5539 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5540 | |
| 5541 | DEFUN (clear_ip_bgp_peer_soft_in, |
| 5542 | clear_ip_bgp_peer_soft_in_cmd, |
| 5543 | "clear ip bgp A.B.C.D soft in", |
| 5544 | CLEAR_STR |
| 5545 | IP_STR |
| 5546 | BGP_STR |
| 5547 | "BGP neighbor address to clear\n" |
| 5548 | "Soft reconfig\n" |
| 5549 | "Soft reconfig inbound update\n") |
| 5550 | { |
| 5551 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5552 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5553 | } |
| 5554 | |
| 5555 | ALIAS (clear_ip_bgp_peer_soft_in, |
| 5556 | clear_ip_bgp_peer_in_cmd, |
| 5557 | "clear ip bgp A.B.C.D in", |
| 5558 | CLEAR_STR |
| 5559 | IP_STR |
| 5560 | BGP_STR |
| 5561 | "BGP neighbor address to clear\n" |
| 5562 | "Soft reconfig inbound update\n") |
| 5563 | |
| 5564 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
| 5565 | clear_ip_bgp_peer_in_prefix_filter_cmd, |
| 5566 | "clear ip bgp A.B.C.D in prefix-filter", |
| 5567 | CLEAR_STR |
| 5568 | IP_STR |
| 5569 | BGP_STR |
| 5570 | "BGP neighbor address to clear\n" |
| 5571 | "Soft reconfig inbound update\n" |
| 5572 | "Push out the existing ORF prefix-list\n") |
| 5573 | { |
| 5574 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5575 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5576 | } |
| 5577 | |
| 5578 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, |
| 5579 | clear_ip_bgp_peer_ipv4_soft_in_cmd, |
| 5580 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", |
| 5581 | CLEAR_STR |
| 5582 | IP_STR |
| 5583 | BGP_STR |
| 5584 | "BGP neighbor address to clear\n" |
| 5585 | "Address family\n" |
| 5586 | "Address Family modifier\n" |
| 5587 | "Address Family modifier\n" |
| 5588 | "Soft reconfig\n" |
| 5589 | "Soft reconfig inbound update\n") |
| 5590 | { |
| 5591 | if (strncmp (argv[1], "m", 1) == 0) |
| 5592 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5593 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5594 | |
| 5595 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5596 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5597 | } |
| 5598 | |
| 5599 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, |
| 5600 | clear_ip_bgp_peer_ipv4_in_cmd, |
| 5601 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", |
| 5602 | CLEAR_STR |
| 5603 | IP_STR |
| 5604 | BGP_STR |
| 5605 | "BGP neighbor address to clear\n" |
| 5606 | "Address family\n" |
| 5607 | "Address Family modifier\n" |
| 5608 | "Address Family modifier\n" |
| 5609 | "Soft reconfig inbound update\n") |
| 5610 | |
| 5611 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
| 5612 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, |
| 5613 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", |
| 5614 | CLEAR_STR |
| 5615 | IP_STR |
| 5616 | BGP_STR |
| 5617 | "BGP neighbor address to clear\n" |
| 5618 | "Address family\n" |
| 5619 | "Address Family modifier\n" |
| 5620 | "Address Family modifier\n" |
| 5621 | "Soft reconfig inbound update\n" |
| 5622 | "Push out the existing ORF prefix-list\n") |
| 5623 | { |
| 5624 | if (strncmp (argv[1], "m", 1) == 0) |
| 5625 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5626 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5627 | |
| 5628 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5629 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5630 | } |
| 5631 | |
| 5632 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5633 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, |
| 5634 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", |
| 5635 | CLEAR_STR |
| 5636 | IP_STR |
| 5637 | BGP_STR |
| 5638 | "BGP neighbor address to clear\n" |
| 5639 | "Address family\n" |
| 5640 | "Address Family Modifier\n" |
| 5641 | "Soft reconfig\n" |
| 5642 | "Soft reconfig inbound update\n") |
| 5643 | { |
| 5644 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 5645 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5646 | } |
| 5647 | |
| 5648 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5649 | clear_ip_bgp_peer_vpnv4_in_cmd, |
| 5650 | "clear ip bgp A.B.C.D vpnv4 unicast in", |
| 5651 | CLEAR_STR |
| 5652 | IP_STR |
| 5653 | BGP_STR |
| 5654 | "BGP neighbor address to clear\n" |
| 5655 | "Address family\n" |
| 5656 | "Address Family Modifier\n" |
| 5657 | "Soft reconfig inbound update\n") |
| 5658 | |
| 5659 | DEFUN (clear_bgp_peer_soft_in, |
| 5660 | clear_bgp_peer_soft_in_cmd, |
| 5661 | "clear bgp (A.B.C.D|X:X::X:X) soft in", |
| 5662 | CLEAR_STR |
| 5663 | BGP_STR |
| 5664 | "BGP neighbor address to clear\n" |
| 5665 | "BGP IPv6 neighbor to clear\n" |
| 5666 | "Soft reconfig\n" |
| 5667 | "Soft reconfig inbound update\n") |
| 5668 | { |
| 5669 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5670 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5671 | } |
| 5672 | |
| 5673 | ALIAS (clear_bgp_peer_soft_in, |
| 5674 | clear_bgp_ipv6_peer_soft_in_cmd, |
| 5675 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in", |
| 5676 | CLEAR_STR |
| 5677 | BGP_STR |
| 5678 | "Address family\n" |
| 5679 | "BGP neighbor address to clear\n" |
| 5680 | "BGP IPv6 neighbor to clear\n" |
| 5681 | "Soft reconfig\n" |
| 5682 | "Soft reconfig inbound update\n") |
| 5683 | |
| 5684 | ALIAS (clear_bgp_peer_soft_in, |
| 5685 | clear_bgp_peer_in_cmd, |
| 5686 | "clear bgp (A.B.C.D|X:X::X:X) in", |
| 5687 | CLEAR_STR |
| 5688 | BGP_STR |
| 5689 | "BGP neighbor address to clear\n" |
| 5690 | "BGP IPv6 neighbor to clear\n" |
| 5691 | "Soft reconfig inbound update\n") |
| 5692 | |
| 5693 | ALIAS (clear_bgp_peer_soft_in, |
| 5694 | clear_bgp_ipv6_peer_in_cmd, |
| 5695 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in", |
| 5696 | CLEAR_STR |
| 5697 | BGP_STR |
| 5698 | "Address family\n" |
| 5699 | "BGP neighbor address to clear\n" |
| 5700 | "BGP IPv6 neighbor to clear\n" |
| 5701 | "Soft reconfig inbound update\n") |
| 5702 | |
| 5703 | DEFUN (clear_bgp_peer_in_prefix_filter, |
| 5704 | clear_bgp_peer_in_prefix_filter_cmd, |
| 5705 | "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5706 | CLEAR_STR |
| 5707 | BGP_STR |
| 5708 | "BGP neighbor address to clear\n" |
| 5709 | "BGP IPv6 neighbor to clear\n" |
| 5710 | "Soft reconfig inbound update\n" |
| 5711 | "Push out the existing ORF prefix-list\n") |
| 5712 | { |
| 5713 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5714 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5715 | } |
| 5716 | |
| 5717 | ALIAS (clear_bgp_peer_in_prefix_filter, |
| 5718 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, |
| 5719 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5720 | CLEAR_STR |
| 5721 | BGP_STR |
| 5722 | "Address family\n" |
| 5723 | "BGP neighbor address to clear\n" |
| 5724 | "BGP IPv6 neighbor to clear\n" |
| 5725 | "Soft reconfig inbound update\n" |
| 5726 | "Push out the existing ORF prefix-list\n") |
| 5727 | |
| 5728 | DEFUN (clear_ip_bgp_peer_group_soft_in, |
| 5729 | clear_ip_bgp_peer_group_soft_in_cmd, |
| 5730 | "clear ip bgp peer-group WORD soft in", |
| 5731 | CLEAR_STR |
| 5732 | IP_STR |
| 5733 | BGP_STR |
| 5734 | "Clear all members of peer-group\n" |
| 5735 | "BGP peer-group name\n" |
| 5736 | "Soft reconfig\n" |
| 5737 | "Soft reconfig inbound update\n") |
| 5738 | { |
| 5739 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5740 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5741 | } |
| 5742 | |
| 5743 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
| 5744 | clear_ip_bgp_peer_group_in_cmd, |
| 5745 | "clear ip bgp peer-group WORD in", |
| 5746 | CLEAR_STR |
| 5747 | IP_STR |
| 5748 | BGP_STR |
| 5749 | "Clear all members of peer-group\n" |
| 5750 | "BGP peer-group name\n" |
| 5751 | "Soft reconfig inbound update\n") |
| 5752 | |
| 5753 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
| 5754 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, |
| 5755 | "clear ip bgp peer-group WORD in prefix-filter", |
| 5756 | CLEAR_STR |
| 5757 | IP_STR |
| 5758 | BGP_STR |
| 5759 | "Clear all members of peer-group\n" |
| 5760 | "BGP peer-group name\n" |
| 5761 | "Soft reconfig inbound update\n" |
| 5762 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5763 | { |
| 5764 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5765 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5766 | } |
| 5767 | |
| 5768 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5769 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, |
| 5770 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", |
| 5771 | CLEAR_STR |
| 5772 | IP_STR |
| 5773 | BGP_STR |
| 5774 | "Clear all members of peer-group\n" |
| 5775 | "BGP peer-group name\n" |
| 5776 | "Address family\n" |
| 5777 | "Address Family modifier\n" |
| 5778 | "Address Family modifier\n" |
| 5779 | "Soft reconfig\n" |
| 5780 | "Soft reconfig inbound update\n") |
| 5781 | { |
| 5782 | if (strncmp (argv[1], "m", 1) == 0) |
| 5783 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5784 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5785 | |
| 5786 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5787 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5788 | } |
| 5789 | |
| 5790 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5791 | clear_ip_bgp_peer_group_ipv4_in_cmd, |
| 5792 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", |
| 5793 | CLEAR_STR |
| 5794 | IP_STR |
| 5795 | BGP_STR |
| 5796 | "Clear all members of peer-group\n" |
| 5797 | "BGP peer-group name\n" |
| 5798 | "Address family\n" |
| 5799 | "Address Family modifier\n" |
| 5800 | "Address Family modifier\n" |
| 5801 | "Soft reconfig inbound update\n") |
| 5802 | |
| 5803 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
| 5804 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, |
| 5805 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", |
| 5806 | CLEAR_STR |
| 5807 | IP_STR |
| 5808 | BGP_STR |
| 5809 | "Clear all members of peer-group\n" |
| 5810 | "BGP peer-group name\n" |
| 5811 | "Address family\n" |
| 5812 | "Address Family modifier\n" |
| 5813 | "Address Family modifier\n" |
| 5814 | "Soft reconfig inbound update\n" |
| 5815 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5816 | { |
| 5817 | if (strncmp (argv[1], "m", 1) == 0) |
| 5818 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5819 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5820 | |
| 5821 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5822 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5823 | } |
| 5824 | |
| 5825 | DEFUN (clear_bgp_peer_group_soft_in, |
| 5826 | clear_bgp_peer_group_soft_in_cmd, |
| 5827 | "clear bgp peer-group WORD soft in", |
| 5828 | CLEAR_STR |
| 5829 | BGP_STR |
| 5830 | "Clear all members of peer-group\n" |
| 5831 | "BGP peer-group name\n" |
| 5832 | "Soft reconfig\n" |
| 5833 | "Soft reconfig inbound update\n") |
| 5834 | { |
| 5835 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5836 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5837 | } |
| 5838 | |
| 5839 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5840 | clear_bgp_ipv6_peer_group_soft_in_cmd, |
| 5841 | "clear bgp ipv6 peer-group WORD soft in", |
| 5842 | CLEAR_STR |
| 5843 | BGP_STR |
| 5844 | "Address family\n" |
| 5845 | "Clear all members of peer-group\n" |
| 5846 | "BGP peer-group name\n" |
| 5847 | "Soft reconfig\n" |
| 5848 | "Soft reconfig inbound update\n") |
| 5849 | |
| 5850 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5851 | clear_bgp_peer_group_in_cmd, |
| 5852 | "clear bgp peer-group WORD in", |
| 5853 | CLEAR_STR |
| 5854 | BGP_STR |
| 5855 | "Clear all members of peer-group\n" |
| 5856 | "BGP peer-group name\n" |
| 5857 | "Soft reconfig inbound update\n") |
| 5858 | |
| 5859 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5860 | clear_bgp_ipv6_peer_group_in_cmd, |
| 5861 | "clear bgp ipv6 peer-group WORD in", |
| 5862 | CLEAR_STR |
| 5863 | BGP_STR |
| 5864 | "Address family\n" |
| 5865 | "Clear all members of peer-group\n" |
| 5866 | "BGP peer-group name\n" |
| 5867 | "Soft reconfig inbound update\n") |
| 5868 | |
| 5869 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
| 5870 | clear_bgp_peer_group_in_prefix_filter_cmd, |
| 5871 | "clear bgp peer-group WORD in prefix-filter", |
| 5872 | CLEAR_STR |
| 5873 | BGP_STR |
| 5874 | "Clear all members of peer-group\n" |
| 5875 | "BGP peer-group name\n" |
| 5876 | "Soft reconfig inbound update\n" |
| 5877 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5878 | { |
| 5879 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5880 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5881 | } |
| 5882 | |
| 5883 | ALIAS (clear_bgp_peer_group_in_prefix_filter, |
| 5884 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, |
| 5885 | "clear bgp ipv6 peer-group WORD in prefix-filter", |
| 5886 | CLEAR_STR |
| 5887 | BGP_STR |
| 5888 | "Address family\n" |
| 5889 | "Clear all members of peer-group\n" |
| 5890 | "BGP peer-group name\n" |
| 5891 | "Soft reconfig inbound update\n" |
| 5892 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5893 | |
| 5894 | DEFUN (clear_ip_bgp_external_soft_in, |
| 5895 | clear_ip_bgp_external_soft_in_cmd, |
| 5896 | "clear ip bgp external soft in", |
| 5897 | CLEAR_STR |
| 5898 | IP_STR |
| 5899 | BGP_STR |
| 5900 | "Clear all external peers\n" |
| 5901 | "Soft reconfig\n" |
| 5902 | "Soft reconfig inbound update\n") |
| 5903 | { |
| 5904 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5905 | BGP_CLEAR_SOFT_IN, NULL); |
| 5906 | } |
| 5907 | |
| 5908 | ALIAS (clear_ip_bgp_external_soft_in, |
| 5909 | clear_ip_bgp_external_in_cmd, |
| 5910 | "clear ip bgp external in", |
| 5911 | CLEAR_STR |
| 5912 | IP_STR |
| 5913 | BGP_STR |
| 5914 | "Clear all external peers\n" |
| 5915 | "Soft reconfig inbound update\n") |
| 5916 | |
| 5917 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
| 5918 | clear_ip_bgp_external_in_prefix_filter_cmd, |
| 5919 | "clear ip bgp external in prefix-filter", |
| 5920 | CLEAR_STR |
| 5921 | IP_STR |
| 5922 | BGP_STR |
| 5923 | "Clear all external peers\n" |
| 5924 | "Soft reconfig inbound update\n" |
| 5925 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5926 | { |
| 5927 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5928 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5929 | } |
| 5930 | |
| 5931 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, |
| 5932 | clear_ip_bgp_external_ipv4_soft_in_cmd, |
| 5933 | "clear ip bgp external ipv4 (unicast|multicast) soft in", |
| 5934 | CLEAR_STR |
| 5935 | IP_STR |
| 5936 | BGP_STR |
| 5937 | "Clear all external peers\n" |
| 5938 | "Address family\n" |
| 5939 | "Address Family modifier\n" |
| 5940 | "Address Family modifier\n" |
| 5941 | "Soft reconfig\n" |
| 5942 | "Soft reconfig inbound update\n") |
| 5943 | { |
| 5944 | if (strncmp (argv[0], "m", 1) == 0) |
| 5945 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5946 | BGP_CLEAR_SOFT_IN, NULL); |
| 5947 | |
| 5948 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5949 | BGP_CLEAR_SOFT_IN, NULL); |
| 5950 | } |
| 5951 | |
| 5952 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, |
| 5953 | clear_ip_bgp_external_ipv4_in_cmd, |
| 5954 | "clear ip bgp external ipv4 (unicast|multicast) in", |
| 5955 | CLEAR_STR |
| 5956 | IP_STR |
| 5957 | BGP_STR |
| 5958 | "Clear all external peers\n" |
| 5959 | "Address family\n" |
| 5960 | "Address Family modifier\n" |
| 5961 | "Address Family modifier\n" |
| 5962 | "Soft reconfig inbound update\n") |
| 5963 | |
| 5964 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
| 5965 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, |
| 5966 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", |
| 5967 | CLEAR_STR |
| 5968 | IP_STR |
| 5969 | BGP_STR |
| 5970 | "Clear all external peers\n" |
| 5971 | "Address family\n" |
| 5972 | "Address Family modifier\n" |
| 5973 | "Address Family modifier\n" |
| 5974 | "Soft reconfig inbound update\n" |
| 5975 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5976 | { |
| 5977 | if (strncmp (argv[0], "m", 1) == 0) |
| 5978 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5979 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5980 | |
| 5981 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5982 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5983 | } |
| 5984 | |
| 5985 | DEFUN (clear_bgp_external_soft_in, |
| 5986 | clear_bgp_external_soft_in_cmd, |
| 5987 | "clear bgp external soft in", |
| 5988 | CLEAR_STR |
| 5989 | BGP_STR |
| 5990 | "Clear all external peers\n" |
| 5991 | "Soft reconfig\n" |
| 5992 | "Soft reconfig inbound update\n") |
| 5993 | { |
| 5994 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5995 | BGP_CLEAR_SOFT_IN, NULL); |
| 5996 | } |
| 5997 | |
| 5998 | ALIAS (clear_bgp_external_soft_in, |
| 5999 | clear_bgp_ipv6_external_soft_in_cmd, |
| 6000 | "clear bgp ipv6 external soft in", |
| 6001 | CLEAR_STR |
| 6002 | BGP_STR |
| 6003 | "Address family\n" |
| 6004 | "Clear all external peers\n" |
| 6005 | "Soft reconfig\n" |
| 6006 | "Soft reconfig inbound update\n") |
| 6007 | |
| 6008 | ALIAS (clear_bgp_external_soft_in, |
| 6009 | clear_bgp_external_in_cmd, |
| 6010 | "clear bgp external in", |
| 6011 | CLEAR_STR |
| 6012 | BGP_STR |
| 6013 | "Clear all external peers\n" |
| 6014 | "Soft reconfig inbound update\n") |
| 6015 | |
| 6016 | ALIAS (clear_bgp_external_soft_in, |
| 6017 | clear_bgp_ipv6_external_in_cmd, |
| 6018 | "clear bgp ipv6 external WORD in", |
| 6019 | CLEAR_STR |
| 6020 | BGP_STR |
| 6021 | "Address family\n" |
| 6022 | "Clear all external peers\n" |
| 6023 | "Soft reconfig inbound update\n") |
| 6024 | |
| 6025 | DEFUN (clear_bgp_external_in_prefix_filter, |
| 6026 | clear_bgp_external_in_prefix_filter_cmd, |
| 6027 | "clear bgp external in prefix-filter", |
| 6028 | CLEAR_STR |
| 6029 | BGP_STR |
| 6030 | "Clear all external peers\n" |
| 6031 | "Soft reconfig inbound update\n" |
| 6032 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6033 | { |
| 6034 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 6035 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 6036 | } |
| 6037 | |
| 6038 | ALIAS (clear_bgp_external_in_prefix_filter, |
| 6039 | clear_bgp_ipv6_external_in_prefix_filter_cmd, |
| 6040 | "clear bgp ipv6 external in prefix-filter", |
| 6041 | CLEAR_STR |
| 6042 | BGP_STR |
| 6043 | "Address family\n" |
| 6044 | "Clear all external peers\n" |
| 6045 | "Soft reconfig inbound update\n" |
| 6046 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6047 | |
| 6048 | DEFUN (clear_ip_bgp_as_soft_in, |
| 6049 | clear_ip_bgp_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6050 | "clear ip bgp " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6051 | CLEAR_STR |
| 6052 | IP_STR |
| 6053 | BGP_STR |
| 6054 | "Clear peers with the AS number\n" |
| 6055 | "Soft reconfig\n" |
| 6056 | "Soft reconfig inbound update\n") |
| 6057 | { |
| 6058 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6059 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6060 | } |
| 6061 | |
| 6062 | ALIAS (clear_ip_bgp_as_soft_in, |
| 6063 | clear_ip_bgp_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6064 | "clear ip bgp " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6065 | CLEAR_STR |
| 6066 | IP_STR |
| 6067 | BGP_STR |
| 6068 | "Clear peers with the AS number\n" |
| 6069 | "Soft reconfig inbound update\n") |
| 6070 | |
| 6071 | DEFUN (clear_ip_bgp_as_in_prefix_filter, |
| 6072 | clear_ip_bgp_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6073 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6074 | CLEAR_STR |
| 6075 | IP_STR |
| 6076 | BGP_STR |
| 6077 | "Clear peers with the AS number\n" |
| 6078 | "Soft reconfig inbound update\n" |
| 6079 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6080 | { |
| 6081 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6082 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6083 | } |
| 6084 | |
| 6085 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, |
| 6086 | clear_ip_bgp_as_ipv4_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6087 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6088 | CLEAR_STR |
| 6089 | IP_STR |
| 6090 | BGP_STR |
| 6091 | "Clear peers with the AS number\n" |
| 6092 | "Address family\n" |
| 6093 | "Address Family modifier\n" |
| 6094 | "Address Family modifier\n" |
| 6095 | "Soft reconfig\n" |
| 6096 | "Soft reconfig inbound update\n") |
| 6097 | { |
| 6098 | if (strncmp (argv[1], "m", 1) == 0) |
| 6099 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6100 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6101 | |
| 6102 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6103 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6104 | } |
| 6105 | |
| 6106 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, |
| 6107 | clear_ip_bgp_as_ipv4_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6108 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6109 | CLEAR_STR |
| 6110 | IP_STR |
| 6111 | BGP_STR |
| 6112 | "Clear peers with the AS number\n" |
| 6113 | "Address family\n" |
| 6114 | "Address Family modifier\n" |
| 6115 | "Address Family modifier\n" |
| 6116 | "Soft reconfig inbound update\n") |
| 6117 | |
| 6118 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
| 6119 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6120 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6121 | CLEAR_STR |
| 6122 | IP_STR |
| 6123 | BGP_STR |
| 6124 | "Clear peers with the AS number\n" |
| 6125 | "Address family\n" |
| 6126 | "Address Family modifier\n" |
| 6127 | "Address Family modifier\n" |
| 6128 | "Soft reconfig inbound update\n" |
| 6129 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6130 | { |
| 6131 | if (strncmp (argv[1], "m", 1) == 0) |
| 6132 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6133 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6134 | |
| 6135 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6136 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6137 | } |
| 6138 | |
| 6139 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, |
| 6140 | clear_ip_bgp_as_vpnv4_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6141 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6142 | CLEAR_STR |
| 6143 | IP_STR |
| 6144 | BGP_STR |
| 6145 | "Clear peers with the AS number\n" |
| 6146 | "Address family\n" |
| 6147 | "Address Family modifier\n" |
| 6148 | "Soft reconfig\n" |
| 6149 | "Soft reconfig inbound update\n") |
| 6150 | { |
| 6151 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 6152 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6153 | } |
| 6154 | |
| 6155 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, |
| 6156 | clear_ip_bgp_as_vpnv4_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6157 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6158 | CLEAR_STR |
| 6159 | IP_STR |
| 6160 | BGP_STR |
| 6161 | "Clear peers with the AS number\n" |
| 6162 | "Address family\n" |
| 6163 | "Address Family modifier\n" |
| 6164 | "Soft reconfig inbound update\n") |
| 6165 | |
| 6166 | DEFUN (clear_bgp_as_soft_in, |
| 6167 | clear_bgp_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6168 | "clear bgp " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6169 | CLEAR_STR |
| 6170 | BGP_STR |
| 6171 | "Clear peers with the AS number\n" |
| 6172 | "Soft reconfig\n" |
| 6173 | "Soft reconfig inbound update\n") |
| 6174 | { |
| 6175 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6176 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 6177 | } |
| 6178 | |
| 6179 | ALIAS (clear_bgp_as_soft_in, |
| 6180 | clear_bgp_ipv6_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6181 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6182 | CLEAR_STR |
| 6183 | BGP_STR |
| 6184 | "Address family\n" |
| 6185 | "Clear peers with the AS number\n" |
| 6186 | "Soft reconfig\n" |
| 6187 | "Soft reconfig inbound update\n") |
| 6188 | |
| 6189 | ALIAS (clear_bgp_as_soft_in, |
| 6190 | clear_bgp_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6191 | "clear bgp " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6192 | CLEAR_STR |
| 6193 | BGP_STR |
| 6194 | "Clear peers with the AS number\n" |
| 6195 | "Soft reconfig inbound update\n") |
| 6196 | |
| 6197 | ALIAS (clear_bgp_as_soft_in, |
| 6198 | clear_bgp_ipv6_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6199 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6200 | CLEAR_STR |
| 6201 | BGP_STR |
| 6202 | "Address family\n" |
| 6203 | "Clear peers with the AS number\n" |
| 6204 | "Soft reconfig inbound update\n") |
| 6205 | |
| 6206 | DEFUN (clear_bgp_as_in_prefix_filter, |
| 6207 | clear_bgp_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6208 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6209 | CLEAR_STR |
| 6210 | BGP_STR |
| 6211 | "Clear peers with the AS number\n" |
| 6212 | "Soft reconfig inbound update\n" |
| 6213 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6214 | { |
| 6215 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6216 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6217 | } |
| 6218 | |
| 6219 | ALIAS (clear_bgp_as_in_prefix_filter, |
| 6220 | clear_bgp_ipv6_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6221 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6222 | CLEAR_STR |
| 6223 | BGP_STR |
| 6224 | "Address family\n" |
| 6225 | "Clear peers with the AS number\n" |
| 6226 | "Soft reconfig inbound update\n" |
| 6227 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6228 | |
| 6229 | /* Both soft-reconfiguration */ |
| 6230 | DEFUN (clear_ip_bgp_all_soft, |
| 6231 | clear_ip_bgp_all_soft_cmd, |
| 6232 | "clear ip bgp * soft", |
| 6233 | CLEAR_STR |
| 6234 | IP_STR |
| 6235 | BGP_STR |
| 6236 | "Clear all peers\n" |
| 6237 | "Soft reconfig\n") |
| 6238 | { |
| 6239 | if (argc == 1) |
| 6240 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6241 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6242 | |
| 6243 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6244 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6245 | } |
| 6246 | |
| 6247 | ALIAS (clear_ip_bgp_all_soft, |
| 6248 | clear_ip_bgp_instance_all_soft_cmd, |
| 6249 | "clear ip bgp view WORD * soft", |
| 6250 | CLEAR_STR |
| 6251 | IP_STR |
| 6252 | BGP_STR |
| 6253 | "BGP view\n" |
| 6254 | "view name\n" |
| 6255 | "Clear all peers\n" |
| 6256 | "Soft reconfig\n") |
| 6257 | |
| 6258 | |
| 6259 | DEFUN (clear_ip_bgp_all_ipv4_soft, |
| 6260 | clear_ip_bgp_all_ipv4_soft_cmd, |
| 6261 | "clear ip bgp * ipv4 (unicast|multicast) soft", |
| 6262 | CLEAR_STR |
| 6263 | IP_STR |
| 6264 | BGP_STR |
| 6265 | "Clear all peers\n" |
| 6266 | "Address family\n" |
| 6267 | "Address Family Modifier\n" |
| 6268 | "Address Family Modifier\n" |
| 6269 | "Soft reconfig\n") |
| 6270 | { |
| 6271 | if (strncmp (argv[0], "m", 1) == 0) |
| 6272 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 6273 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6274 | |
| 6275 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6276 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6277 | } |
| 6278 | |
| 6279 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, |
| 6280 | clear_ip_bgp_instance_all_ipv4_soft_cmd, |
| 6281 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", |
| 6282 | CLEAR_STR |
| 6283 | IP_STR |
| 6284 | BGP_STR |
| 6285 | "BGP view\n" |
| 6286 | "view name\n" |
| 6287 | "Clear all peers\n" |
| 6288 | "Address family\n" |
| 6289 | "Address Family Modifier\n" |
| 6290 | "Address Family Modifier\n" |
| 6291 | "Soft reconfig\n") |
| 6292 | { |
| 6293 | if (strncmp (argv[1], "m", 1) == 0) |
| 6294 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 6295 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6296 | |
| 6297 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6298 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6299 | } |
| 6300 | |
| 6301 | DEFUN (clear_ip_bgp_all_vpnv4_soft, |
| 6302 | clear_ip_bgp_all_vpnv4_soft_cmd, |
| 6303 | "clear ip bgp * vpnv4 unicast soft", |
| 6304 | CLEAR_STR |
| 6305 | IP_STR |
| 6306 | BGP_STR |
| 6307 | "Clear all peers\n" |
| 6308 | "Address family\n" |
| 6309 | "Address Family Modifier\n" |
| 6310 | "Soft reconfig\n") |
| 6311 | { |
| 6312 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 6313 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6314 | } |
| 6315 | |
| 6316 | DEFUN (clear_bgp_all_soft, |
| 6317 | clear_bgp_all_soft_cmd, |
| 6318 | "clear bgp * soft", |
| 6319 | CLEAR_STR |
| 6320 | BGP_STR |
| 6321 | "Clear all peers\n" |
| 6322 | "Soft reconfig\n") |
| 6323 | { |
| 6324 | if (argc == 1) |
| 6325 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6326 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6327 | |
| 6328 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6329 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6330 | } |
| 6331 | |
| 6332 | ALIAS (clear_bgp_all_soft, |
| 6333 | clear_bgp_instance_all_soft_cmd, |
| 6334 | "clear bgp view WORD * soft", |
| 6335 | CLEAR_STR |
| 6336 | BGP_STR |
| 6337 | "BGP view\n" |
| 6338 | "view name\n" |
| 6339 | "Clear all peers\n" |
| 6340 | "Soft reconfig\n") |
| 6341 | |
| 6342 | ALIAS (clear_bgp_all_soft, |
| 6343 | clear_bgp_ipv6_all_soft_cmd, |
| 6344 | "clear bgp ipv6 * soft", |
| 6345 | CLEAR_STR |
| 6346 | BGP_STR |
| 6347 | "Address family\n" |
| 6348 | "Clear all peers\n" |
| 6349 | "Soft reconfig\n") |
| 6350 | |
| 6351 | DEFUN (clear_ip_bgp_peer_soft, |
| 6352 | clear_ip_bgp_peer_soft_cmd, |
| 6353 | "clear ip bgp A.B.C.D soft", |
| 6354 | CLEAR_STR |
| 6355 | IP_STR |
| 6356 | BGP_STR |
| 6357 | "BGP neighbor address to clear\n" |
| 6358 | "Soft reconfig\n") |
| 6359 | { |
| 6360 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6361 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6362 | } |
| 6363 | |
| 6364 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
| 6365 | clear_ip_bgp_peer_ipv4_soft_cmd, |
| 6366 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", |
| 6367 | CLEAR_STR |
| 6368 | IP_STR |
| 6369 | BGP_STR |
| 6370 | "BGP neighbor address to clear\n" |
| 6371 | "Address family\n" |
| 6372 | "Address Family Modifier\n" |
| 6373 | "Address Family Modifier\n" |
| 6374 | "Soft reconfig\n") |
| 6375 | { |
| 6376 | if (strncmp (argv[1], "m", 1) == 0) |
| 6377 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 6378 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6379 | |
| 6380 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6381 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6382 | } |
| 6383 | |
| 6384 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
| 6385 | clear_ip_bgp_peer_vpnv4_soft_cmd, |
| 6386 | "clear ip bgp A.B.C.D vpnv4 unicast soft", |
| 6387 | CLEAR_STR |
| 6388 | IP_STR |
| 6389 | BGP_STR |
| 6390 | "BGP neighbor address to clear\n" |
| 6391 | "Address family\n" |
| 6392 | "Address Family Modifier\n" |
| 6393 | "Soft reconfig\n") |
| 6394 | { |
| 6395 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 6396 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6397 | } |
| 6398 | |
| 6399 | DEFUN (clear_bgp_peer_soft, |
| 6400 | clear_bgp_peer_soft_cmd, |
| 6401 | "clear bgp (A.B.C.D|X:X::X:X) soft", |
| 6402 | CLEAR_STR |
| 6403 | BGP_STR |
| 6404 | "BGP neighbor address to clear\n" |
| 6405 | "BGP IPv6 neighbor to clear\n" |
| 6406 | "Soft reconfig\n") |
| 6407 | { |
| 6408 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6409 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6410 | } |
| 6411 | |
| 6412 | ALIAS (clear_bgp_peer_soft, |
| 6413 | clear_bgp_ipv6_peer_soft_cmd, |
| 6414 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft", |
| 6415 | CLEAR_STR |
| 6416 | BGP_STR |
| 6417 | "Address family\n" |
| 6418 | "BGP neighbor address to clear\n" |
| 6419 | "BGP IPv6 neighbor to clear\n" |
| 6420 | "Soft reconfig\n") |
| 6421 | |
| 6422 | DEFUN (clear_ip_bgp_peer_group_soft, |
| 6423 | clear_ip_bgp_peer_group_soft_cmd, |
| 6424 | "clear ip bgp peer-group WORD soft", |
| 6425 | CLEAR_STR |
| 6426 | IP_STR |
| 6427 | BGP_STR |
| 6428 | "Clear all members of peer-group\n" |
| 6429 | "BGP peer-group name\n" |
| 6430 | "Soft reconfig\n") |
| 6431 | { |
| 6432 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6433 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6434 | } |
| 6435 | |
| 6436 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
| 6437 | clear_ip_bgp_peer_group_ipv4_soft_cmd, |
| 6438 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", |
| 6439 | CLEAR_STR |
| 6440 | IP_STR |
| 6441 | BGP_STR |
| 6442 | "Clear all members of peer-group\n" |
| 6443 | "BGP peer-group name\n" |
| 6444 | "Address family\n" |
| 6445 | "Address Family modifier\n" |
| 6446 | "Address Family modifier\n" |
| 6447 | "Soft reconfig\n") |
| 6448 | { |
| 6449 | if (strncmp (argv[1], "m", 1) == 0) |
| 6450 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 6451 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6452 | |
| 6453 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6454 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6455 | } |
| 6456 | |
| 6457 | DEFUN (clear_bgp_peer_group_soft, |
| 6458 | clear_bgp_peer_group_soft_cmd, |
| 6459 | "clear bgp peer-group WORD soft", |
| 6460 | CLEAR_STR |
| 6461 | BGP_STR |
| 6462 | "Clear all members of peer-group\n" |
| 6463 | "BGP peer-group name\n" |
| 6464 | "Soft reconfig\n") |
| 6465 | { |
| 6466 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 6467 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6468 | } |
| 6469 | |
| 6470 | ALIAS (clear_bgp_peer_group_soft, |
| 6471 | clear_bgp_ipv6_peer_group_soft_cmd, |
| 6472 | "clear bgp ipv6 peer-group WORD soft", |
| 6473 | CLEAR_STR |
| 6474 | BGP_STR |
| 6475 | "Address family\n" |
| 6476 | "Clear all members of peer-group\n" |
| 6477 | "BGP peer-group name\n" |
| 6478 | "Soft reconfig\n") |
| 6479 | |
| 6480 | DEFUN (clear_ip_bgp_external_soft, |
| 6481 | clear_ip_bgp_external_soft_cmd, |
| 6482 | "clear ip bgp external soft", |
| 6483 | CLEAR_STR |
| 6484 | IP_STR |
| 6485 | BGP_STR |
| 6486 | "Clear all external peers\n" |
| 6487 | "Soft reconfig\n") |
| 6488 | { |
| 6489 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6490 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6491 | } |
| 6492 | |
| 6493 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
| 6494 | clear_ip_bgp_external_ipv4_soft_cmd, |
| 6495 | "clear ip bgp external ipv4 (unicast|multicast) soft", |
| 6496 | CLEAR_STR |
| 6497 | IP_STR |
| 6498 | BGP_STR |
| 6499 | "Clear all external peers\n" |
| 6500 | "Address family\n" |
| 6501 | "Address Family modifier\n" |
| 6502 | "Address Family modifier\n" |
| 6503 | "Soft reconfig\n") |
| 6504 | { |
| 6505 | if (strncmp (argv[0], "m", 1) == 0) |
| 6506 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 6507 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6508 | |
| 6509 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6510 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6511 | } |
| 6512 | |
| 6513 | DEFUN (clear_bgp_external_soft, |
| 6514 | clear_bgp_external_soft_cmd, |
| 6515 | "clear bgp external soft", |
| 6516 | CLEAR_STR |
| 6517 | BGP_STR |
| 6518 | "Clear all external peers\n" |
| 6519 | "Soft reconfig\n") |
| 6520 | { |
| 6521 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 6522 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6523 | } |
| 6524 | |
| 6525 | ALIAS (clear_bgp_external_soft, |
| 6526 | clear_bgp_ipv6_external_soft_cmd, |
| 6527 | "clear bgp ipv6 external soft", |
| 6528 | CLEAR_STR |
| 6529 | BGP_STR |
| 6530 | "Address family\n" |
| 6531 | "Clear all external peers\n" |
| 6532 | "Soft reconfig\n") |
| 6533 | |
| 6534 | DEFUN (clear_ip_bgp_as_soft, |
| 6535 | clear_ip_bgp_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6536 | "clear ip bgp " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6537 | CLEAR_STR |
| 6538 | IP_STR |
| 6539 | BGP_STR |
| 6540 | "Clear peers with the AS number\n" |
| 6541 | "Soft reconfig\n") |
| 6542 | { |
| 6543 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6544 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6545 | } |
| 6546 | |
| 6547 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
| 6548 | clear_ip_bgp_as_ipv4_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6549 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6550 | CLEAR_STR |
| 6551 | IP_STR |
| 6552 | BGP_STR |
| 6553 | "Clear peers with the AS number\n" |
| 6554 | "Address family\n" |
| 6555 | "Address Family Modifier\n" |
| 6556 | "Address Family Modifier\n" |
| 6557 | "Soft reconfig\n") |
| 6558 | { |
| 6559 | if (strncmp (argv[1], "m", 1) == 0) |
| 6560 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6561 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6562 | |
| 6563 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, |
| 6564 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6565 | } |
| 6566 | |
| 6567 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
| 6568 | clear_ip_bgp_as_vpnv4_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6569 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6570 | CLEAR_STR |
| 6571 | IP_STR |
| 6572 | BGP_STR |
| 6573 | "Clear peers with the AS number\n" |
| 6574 | "Address family\n" |
| 6575 | "Address Family Modifier\n" |
| 6576 | "Soft reconfig\n") |
| 6577 | { |
| 6578 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 6579 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6580 | } |
| 6581 | |
| 6582 | DEFUN (clear_bgp_as_soft, |
| 6583 | clear_bgp_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6584 | "clear bgp " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6585 | CLEAR_STR |
| 6586 | BGP_STR |
| 6587 | "Clear peers with the AS number\n" |
| 6588 | "Soft reconfig\n") |
| 6589 | { |
| 6590 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6591 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6592 | } |
| 6593 | |
| 6594 | ALIAS (clear_bgp_as_soft, |
| 6595 | clear_bgp_ipv6_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6596 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6597 | CLEAR_STR |
| 6598 | BGP_STR |
| 6599 | "Address family\n" |
| 6600 | "Clear peers with the AS number\n" |
| 6601 | "Soft reconfig\n") |
| 6602 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6603 | /* RS-client soft reconfiguration. */ |
| 6604 | #ifdef HAVE_IPV6 |
| 6605 | DEFUN (clear_bgp_all_rsclient, |
| 6606 | clear_bgp_all_rsclient_cmd, |
| 6607 | "clear bgp * rsclient", |
| 6608 | CLEAR_STR |
| 6609 | BGP_STR |
| 6610 | "Clear all peers\n" |
| 6611 | "Soft reconfig for rsclient RIB\n") |
| 6612 | { |
| 6613 | if (argc == 1) |
| 6614 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6615 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6616 | |
| 6617 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6618 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6619 | } |
| 6620 | |
| 6621 | ALIAS (clear_bgp_all_rsclient, |
| 6622 | clear_bgp_ipv6_all_rsclient_cmd, |
| 6623 | "clear bgp ipv6 * rsclient", |
| 6624 | CLEAR_STR |
| 6625 | BGP_STR |
| 6626 | "Address family\n" |
| 6627 | "Clear all peers\n" |
| 6628 | "Soft reconfig for rsclient RIB\n") |
| 6629 | |
| 6630 | ALIAS (clear_bgp_all_rsclient, |
| 6631 | clear_bgp_instance_all_rsclient_cmd, |
| 6632 | "clear bgp view WORD * rsclient", |
| 6633 | CLEAR_STR |
| 6634 | BGP_STR |
| 6635 | "BGP view\n" |
| 6636 | "view name\n" |
| 6637 | "Clear all peers\n" |
| 6638 | "Soft reconfig for rsclient RIB\n") |
| 6639 | |
| 6640 | ALIAS (clear_bgp_all_rsclient, |
| 6641 | clear_bgp_ipv6_instance_all_rsclient_cmd, |
| 6642 | "clear bgp ipv6 view WORD * rsclient", |
| 6643 | CLEAR_STR |
| 6644 | BGP_STR |
| 6645 | "Address family\n" |
| 6646 | "BGP view\n" |
| 6647 | "view name\n" |
| 6648 | "Clear all peers\n" |
| 6649 | "Soft reconfig for rsclient RIB\n") |
| 6650 | #endif /* HAVE_IPV6 */ |
| 6651 | |
| 6652 | DEFUN (clear_ip_bgp_all_rsclient, |
| 6653 | clear_ip_bgp_all_rsclient_cmd, |
| 6654 | "clear ip bgp * rsclient", |
| 6655 | CLEAR_STR |
| 6656 | IP_STR |
| 6657 | BGP_STR |
| 6658 | "Clear all peers\n" |
| 6659 | "Soft reconfig for rsclient RIB\n") |
| 6660 | { |
| 6661 | if (argc == 1) |
| 6662 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6663 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6664 | |
| 6665 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6666 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6667 | } |
| 6668 | |
| 6669 | ALIAS (clear_ip_bgp_all_rsclient, |
| 6670 | clear_ip_bgp_instance_all_rsclient_cmd, |
| 6671 | "clear ip bgp view WORD * rsclient", |
| 6672 | CLEAR_STR |
| 6673 | IP_STR |
| 6674 | BGP_STR |
| 6675 | "BGP view\n" |
| 6676 | "view name\n" |
| 6677 | "Clear all peers\n" |
| 6678 | "Soft reconfig for rsclient RIB\n") |
| 6679 | |
| 6680 | #ifdef HAVE_IPV6 |
| 6681 | DEFUN (clear_bgp_peer_rsclient, |
| 6682 | clear_bgp_peer_rsclient_cmd, |
| 6683 | "clear bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6684 | CLEAR_STR |
| 6685 | BGP_STR |
| 6686 | "BGP neighbor IP address to clear\n" |
| 6687 | "BGP IPv6 neighbor to clear\n" |
| 6688 | "Soft reconfig for rsclient RIB\n") |
| 6689 | { |
| 6690 | if (argc == 2) |
| 6691 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6692 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6693 | |
| 6694 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6695 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6696 | } |
| 6697 | |
| 6698 | ALIAS (clear_bgp_peer_rsclient, |
| 6699 | clear_bgp_ipv6_peer_rsclient_cmd, |
| 6700 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient", |
| 6701 | CLEAR_STR |
| 6702 | BGP_STR |
| 6703 | "Address family\n" |
| 6704 | "BGP neighbor IP address to clear\n" |
| 6705 | "BGP IPv6 neighbor to clear\n" |
| 6706 | "Soft reconfig for rsclient RIB\n") |
| 6707 | |
| 6708 | ALIAS (clear_bgp_peer_rsclient, |
| 6709 | clear_bgp_instance_peer_rsclient_cmd, |
| 6710 | "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6711 | CLEAR_STR |
| 6712 | BGP_STR |
| 6713 | "BGP view\n" |
| 6714 | "view name\n" |
| 6715 | "BGP neighbor IP address to clear\n" |
| 6716 | "BGP IPv6 neighbor to clear\n" |
| 6717 | "Soft reconfig for rsclient RIB\n") |
| 6718 | |
| 6719 | ALIAS (clear_bgp_peer_rsclient, |
| 6720 | clear_bgp_ipv6_instance_peer_rsclient_cmd, |
| 6721 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6722 | CLEAR_STR |
| 6723 | BGP_STR |
| 6724 | "Address family\n" |
| 6725 | "BGP view\n" |
| 6726 | "view name\n" |
| 6727 | "BGP neighbor IP address to clear\n" |
| 6728 | "BGP IPv6 neighbor to clear\n" |
| 6729 | "Soft reconfig for rsclient RIB\n") |
| 6730 | #endif /* HAVE_IPV6 */ |
| 6731 | |
| 6732 | DEFUN (clear_ip_bgp_peer_rsclient, |
| 6733 | clear_ip_bgp_peer_rsclient_cmd, |
| 6734 | "clear ip bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6735 | CLEAR_STR |
| 6736 | IP_STR |
| 6737 | BGP_STR |
| 6738 | "BGP neighbor IP address to clear\n" |
| 6739 | "BGP IPv6 neighbor to clear\n" |
| 6740 | "Soft reconfig for rsclient RIB\n") |
| 6741 | { |
| 6742 | if (argc == 2) |
| 6743 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, |
| 6744 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6745 | |
| 6746 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6747 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6748 | } |
| 6749 | |
| 6750 | ALIAS (clear_ip_bgp_peer_rsclient, |
| 6751 | clear_ip_bgp_instance_peer_rsclient_cmd, |
| 6752 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6753 | CLEAR_STR |
| 6754 | IP_STR |
| 6755 | BGP_STR |
| 6756 | "BGP view\n" |
| 6757 | "view name\n" |
| 6758 | "BGP neighbor IP address to clear\n" |
| 6759 | "BGP IPv6 neighbor to clear\n" |
| 6760 | "Soft reconfig for rsclient RIB\n") |
| 6761 | |
Michael Lambert | e0081f7 | 2008-11-16 20:12:04 +0000 | [diff] [blame] | 6762 | DEFUN (show_bgp_views, |
| 6763 | show_bgp_views_cmd, |
| 6764 | "show bgp views", |
| 6765 | SHOW_STR |
| 6766 | BGP_STR |
| 6767 | "Show the defined BGP views\n") |
| 6768 | { |
| 6769 | struct list *inst = bm->bgp; |
| 6770 | struct listnode *node; |
| 6771 | struct bgp *bgp; |
| 6772 | |
| 6773 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) |
| 6774 | { |
| 6775 | vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE); |
| 6776 | return CMD_WARNING; |
| 6777 | } |
| 6778 | |
| 6779 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); |
| 6780 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) |
| 6781 | vty_out (vty, "\t%s (AS%u)%s", |
| 6782 | bgp->name ? bgp->name : "(null)", |
| 6783 | bgp->as, VTY_NEWLINE); |
| 6784 | |
| 6785 | return CMD_SUCCESS; |
| 6786 | } |
| 6787 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6788 | DEFUN (show_bgp_memory, |
| 6789 | show_bgp_memory_cmd, |
| 6790 | "show bgp memory", |
| 6791 | SHOW_STR |
| 6792 | BGP_STR |
| 6793 | "Global BGP memory statistics\n") |
| 6794 | { |
| 6795 | char memstrbuf[MTYPE_MEMSTR_LEN]; |
| 6796 | unsigned long count; |
| 6797 | |
| 6798 | /* RIB related usage stats */ |
| 6799 | count = mtype_stats_alloc (MTYPE_BGP_NODE); |
| 6800 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, |
| 6801 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6802 | count * sizeof (struct bgp_node)), |
| 6803 | VTY_NEWLINE); |
| 6804 | |
| 6805 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); |
| 6806 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, |
| 6807 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6808 | count * sizeof (struct bgp_info)), |
| 6809 | VTY_NEWLINE); |
Paul Jakma | fb982c2 | 2007-05-04 20:15:47 +0000 | [diff] [blame] | 6810 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
| 6811 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, |
| 6812 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6813 | count * sizeof (struct bgp_info_extra)), |
| 6814 | VTY_NEWLINE); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6815 | |
| 6816 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) |
| 6817 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, |
| 6818 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6819 | count * sizeof (struct bgp_static)), |
| 6820 | VTY_NEWLINE); |
| 6821 | |
| 6822 | /* Adj-In/Out */ |
| 6823 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) |
| 6824 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, |
| 6825 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6826 | count * sizeof (struct bgp_adj_in)), |
| 6827 | VTY_NEWLINE); |
| 6828 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) |
| 6829 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, |
| 6830 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6831 | count * sizeof (struct bgp_adj_out)), |
| 6832 | VTY_NEWLINE); |
| 6833 | |
| 6834 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) |
| 6835 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, |
| 6836 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6837 | count * sizeof (struct bgp_nexthop_cache)), |
| 6838 | VTY_NEWLINE); |
| 6839 | |
| 6840 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) |
| 6841 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, |
| 6842 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6843 | count * sizeof (struct bgp_damp_info)), |
| 6844 | VTY_NEWLINE); |
| 6845 | |
| 6846 | /* Attributes */ |
| 6847 | count = attr_count(); |
| 6848 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, |
| 6849 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6850 | count * sizeof(struct attr)), |
| 6851 | VTY_NEWLINE); |
Paul Jakma | fb982c2 | 2007-05-04 20:15:47 +0000 | [diff] [blame] | 6852 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
| 6853 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, |
| 6854 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6855 | count * sizeof(struct attr_extra)), |
| 6856 | VTY_NEWLINE); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6857 | |
| 6858 | if ((count = attr_unknown_count())) |
| 6859 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); |
| 6860 | |
| 6861 | /* AS_PATH attributes */ |
| 6862 | count = aspath_count (); |
| 6863 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, |
| 6864 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6865 | count * sizeof (struct aspath)), |
| 6866 | VTY_NEWLINE); |
| 6867 | |
| 6868 | count = mtype_stats_alloc (MTYPE_AS_SEG); |
| 6869 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, |
| 6870 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6871 | count * sizeof (struct assegment)), |
| 6872 | VTY_NEWLINE); |
| 6873 | |
| 6874 | /* Other attributes */ |
| 6875 | if ((count = community_count ())) |
| 6876 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, |
| 6877 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6878 | count * sizeof (struct community)), |
| 6879 | VTY_NEWLINE); |
| 6880 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) |
| 6881 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, |
| 6882 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6883 | count * sizeof (struct ecommunity)), |
| 6884 | VTY_NEWLINE); |
| 6885 | |
| 6886 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) |
| 6887 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, |
| 6888 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6889 | count * sizeof (struct cluster_list)), |
| 6890 | VTY_NEWLINE); |
| 6891 | |
| 6892 | /* Peer related usage */ |
| 6893 | count = mtype_stats_alloc (MTYPE_BGP_PEER); |
| 6894 | vty_out (vty, "%ld peers, using %s of memory%s", count, |
| 6895 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6896 | count * sizeof (struct peer)), |
| 6897 | VTY_NEWLINE); |
| 6898 | |
| 6899 | if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP))) |
| 6900 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, |
| 6901 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6902 | count * sizeof (struct peer_group)), |
| 6903 | VTY_NEWLINE); |
| 6904 | |
| 6905 | /* Other */ |
| 6906 | if ((count = mtype_stats_alloc (MTYPE_HASH))) |
| 6907 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, |
| 6908 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6909 | count * sizeof (struct hash)), |
| 6910 | VTY_NEWLINE); |
| 6911 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) |
| 6912 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, |
| 6913 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6914 | count * sizeof (struct hash_backet)), |
| 6915 | VTY_NEWLINE); |
| 6916 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) |
| 6917 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, |
| 6918 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6919 | count * sizeof (regex_t)), |
| 6920 | VTY_NEWLINE); |
| 6921 | return CMD_SUCCESS; |
| 6922 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6923 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6924 | /* Show BGP peer's summary information. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6925 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6926 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) |
| 6927 | { |
| 6928 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6929 | struct listnode *node, *nnode; |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6930 | unsigned int count = 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6931 | char timebuf[BGP_UPTIME_LEN]; |
| 6932 | int len; |
| 6933 | |
| 6934 | /* Header string for each address family. */ |
| 6935 | 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] | 6936 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6937 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6938 | { |
| 6939 | if (peer->afc[afi][safi]) |
| 6940 | { |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6941 | if (!count) |
| 6942 | { |
| 6943 | unsigned long ents; |
| 6944 | char memstrbuf[MTYPE_MEMSTR_LEN]; |
| 6945 | |
| 6946 | /* Usage summary and header */ |
| 6947 | vty_out (vty, |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 6948 | "BGP router identifier %s, local AS number %u%s", |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6949 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6950 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6951 | ents = bgp_table_count (bgp->rib[afi][safi]); |
| 6952 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, |
| 6953 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6954 | ents * sizeof (struct bgp_node)), |
| 6955 | VTY_NEWLINE); |
| 6956 | |
| 6957 | /* Peer related usage */ |
| 6958 | ents = listcount (bgp->peer); |
| 6959 | vty_out (vty, "Peers %ld, using %s of memory%s", |
| 6960 | ents, |
| 6961 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6962 | ents * sizeof (struct peer)), |
| 6963 | VTY_NEWLINE); |
| 6964 | |
| 6965 | if ((ents = listcount (bgp->rsclient))) |
| 6966 | vty_out (vty, "RS-Client peers %ld, using %s of memory%s", |
| 6967 | ents, |
| 6968 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6969 | ents * sizeof (struct peer)), |
| 6970 | VTY_NEWLINE); |
| 6971 | |
| 6972 | if ((ents = listcount (bgp->group))) |
| 6973 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, |
| 6974 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6975 | ents * sizeof (struct peer_group)), |
| 6976 | VTY_NEWLINE); |
| 6977 | |
| 6978 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
| 6979 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); |
| 6980 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6981 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 6982 | } |
| 6983 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6984 | count++; |
| 6985 | |
| 6986 | len = vty_out (vty, "%s", peer->host); |
| 6987 | len = 16 - len; |
| 6988 | if (len < 1) |
| 6989 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 6990 | else |
| 6991 | vty_out (vty, "%*s", len, " "); |
| 6992 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 6993 | vty_out (vty, "4 "); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6994 | |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 6995 | vty_out (vty, "%5u %7d %7d %8d %4d %4lu ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6996 | peer->as, |
| 6997 | peer->open_in + peer->update_in + peer->keepalive_in |
| 6998 | + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in, |
| 6999 | peer->open_out + peer->update_out + peer->keepalive_out |
| 7000 | + peer->notify_out + peer->refresh_out |
| 7001 | + peer->dynamic_cap_out, |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7002 | 0, 0, (unsigned long) peer->obuf->count); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7003 | |
| 7004 | vty_out (vty, "%8s", |
| 7005 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); |
| 7006 | |
| 7007 | if (peer->status == Established) |
| 7008 | { |
| 7009 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); |
| 7010 | } |
| 7011 | else |
| 7012 | { |
| 7013 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) |
| 7014 | vty_out (vty, " Idle (Admin)"); |
| 7015 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7016 | vty_out (vty, " Idle (PfxCt)"); |
| 7017 | else |
| 7018 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); |
| 7019 | } |
| 7020 | |
| 7021 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7022 | } |
| 7023 | } |
| 7024 | |
| 7025 | if (count) |
| 7026 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, |
| 7027 | count, VTY_NEWLINE); |
| 7028 | else |
| 7029 | vty_out (vty, "No %s neighbor is configured%s", |
| 7030 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 7031 | return CMD_SUCCESS; |
| 7032 | } |
| 7033 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7034 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7035 | bgp_show_summary_vty (struct vty *vty, const char *name, |
| 7036 | afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7037 | { |
| 7038 | struct bgp *bgp; |
| 7039 | |
| 7040 | if (name) |
| 7041 | { |
| 7042 | bgp = bgp_lookup_by_name (name); |
| 7043 | |
| 7044 | if (! bgp) |
| 7045 | { |
| 7046 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7047 | return CMD_WARNING; |
| 7048 | } |
| 7049 | |
| 7050 | bgp_show_summary (vty, bgp, afi, safi); |
| 7051 | return CMD_SUCCESS; |
| 7052 | } |
| 7053 | |
| 7054 | bgp = bgp_get_default (); |
| 7055 | |
| 7056 | if (bgp) |
| 7057 | bgp_show_summary (vty, bgp, afi, safi); |
| 7058 | |
| 7059 | return CMD_SUCCESS; |
| 7060 | } |
| 7061 | |
| 7062 | /* `show ip bgp summary' commands. */ |
| 7063 | DEFUN (show_ip_bgp_summary, |
| 7064 | show_ip_bgp_summary_cmd, |
| 7065 | "show ip bgp summary", |
| 7066 | SHOW_STR |
| 7067 | IP_STR |
| 7068 | BGP_STR |
| 7069 | "Summary of BGP neighbor status\n") |
| 7070 | { |
| 7071 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 7072 | } |
| 7073 | |
| 7074 | DEFUN (show_ip_bgp_instance_summary, |
| 7075 | show_ip_bgp_instance_summary_cmd, |
| 7076 | "show ip bgp view WORD summary", |
| 7077 | SHOW_STR |
| 7078 | IP_STR |
| 7079 | BGP_STR |
| 7080 | "BGP view\n" |
| 7081 | "View name\n" |
| 7082 | "Summary of BGP neighbor status\n") |
| 7083 | { |
| 7084 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 7085 | } |
| 7086 | |
| 7087 | DEFUN (show_ip_bgp_ipv4_summary, |
| 7088 | show_ip_bgp_ipv4_summary_cmd, |
| 7089 | "show ip bgp ipv4 (unicast|multicast) summary", |
| 7090 | SHOW_STR |
| 7091 | IP_STR |
| 7092 | BGP_STR |
| 7093 | "Address family\n" |
| 7094 | "Address Family modifier\n" |
| 7095 | "Address Family modifier\n" |
| 7096 | "Summary of BGP neighbor status\n") |
| 7097 | { |
| 7098 | if (strncmp (argv[0], "m", 1) == 0) |
| 7099 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 7100 | |
| 7101 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 7102 | } |
| 7103 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 7104 | ALIAS (show_ip_bgp_ipv4_summary, |
| 7105 | show_bgp_ipv4_safi_summary_cmd, |
| 7106 | "show bgp ipv4 (unicast|multicast) summary", |
| 7107 | SHOW_STR |
| 7108 | BGP_STR |
| 7109 | "Address family\n" |
| 7110 | "Address Family modifier\n" |
| 7111 | "Address Family modifier\n" |
| 7112 | "Summary of BGP neighbor status\n") |
| 7113 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7114 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
| 7115 | show_ip_bgp_instance_ipv4_summary_cmd, |
| 7116 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", |
| 7117 | SHOW_STR |
| 7118 | IP_STR |
| 7119 | BGP_STR |
| 7120 | "BGP view\n" |
| 7121 | "View name\n" |
| 7122 | "Address family\n" |
| 7123 | "Address Family modifier\n" |
| 7124 | "Address Family modifier\n" |
| 7125 | "Summary of BGP neighbor status\n") |
| 7126 | { |
| 7127 | if (strncmp (argv[1], "m", 1) == 0) |
| 7128 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 7129 | else |
| 7130 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 7131 | } |
| 7132 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 7133 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
| 7134 | show_bgp_instance_ipv4_safi_summary_cmd, |
| 7135 | "show bgp view WORD ipv4 (unicast|multicast) summary", |
| 7136 | SHOW_STR |
| 7137 | BGP_STR |
| 7138 | "BGP view\n" |
| 7139 | "View name\n" |
| 7140 | "Address family\n" |
| 7141 | "Address Family modifier\n" |
| 7142 | "Address Family modifier\n" |
| 7143 | "Summary of BGP neighbor status\n") |
| 7144 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7145 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
| 7146 | show_ip_bgp_vpnv4_all_summary_cmd, |
| 7147 | "show ip bgp vpnv4 all summary", |
| 7148 | SHOW_STR |
| 7149 | IP_STR |
| 7150 | BGP_STR |
| 7151 | "Display VPNv4 NLRI specific information\n" |
| 7152 | "Display information about all VPNv4 NLRIs\n" |
| 7153 | "Summary of BGP neighbor status\n") |
| 7154 | { |
| 7155 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 7156 | } |
| 7157 | |
| 7158 | DEFUN (show_ip_bgp_vpnv4_rd_summary, |
| 7159 | show_ip_bgp_vpnv4_rd_summary_cmd, |
| 7160 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", |
| 7161 | SHOW_STR |
| 7162 | IP_STR |
| 7163 | BGP_STR |
| 7164 | "Display VPNv4 NLRI specific information\n" |
| 7165 | "Display information for a route distinguisher\n" |
| 7166 | "VPN Route Distinguisher\n" |
| 7167 | "Summary of BGP neighbor status\n") |
| 7168 | { |
| 7169 | int ret; |
| 7170 | struct prefix_rd prd; |
| 7171 | |
| 7172 | ret = str2prefix_rd (argv[0], &prd); |
| 7173 | if (! ret) |
| 7174 | { |
| 7175 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); |
| 7176 | return CMD_WARNING; |
| 7177 | } |
| 7178 | |
| 7179 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 7180 | } |
| 7181 | |
| 7182 | #ifdef HAVE_IPV6 |
| 7183 | DEFUN (show_bgp_summary, |
| 7184 | show_bgp_summary_cmd, |
| 7185 | "show bgp summary", |
| 7186 | SHOW_STR |
| 7187 | BGP_STR |
| 7188 | "Summary of BGP neighbor status\n") |
| 7189 | { |
| 7190 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7191 | } |
| 7192 | |
| 7193 | DEFUN (show_bgp_instance_summary, |
| 7194 | show_bgp_instance_summary_cmd, |
| 7195 | "show bgp view WORD summary", |
| 7196 | SHOW_STR |
| 7197 | BGP_STR |
| 7198 | "BGP view\n" |
| 7199 | "View name\n" |
| 7200 | "Summary of BGP neighbor status\n") |
| 7201 | { |
| 7202 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 7203 | } |
| 7204 | |
| 7205 | ALIAS (show_bgp_summary, |
| 7206 | show_bgp_ipv6_summary_cmd, |
| 7207 | "show bgp ipv6 summary", |
| 7208 | SHOW_STR |
| 7209 | BGP_STR |
| 7210 | "Address family\n" |
| 7211 | "Summary of BGP neighbor status\n") |
| 7212 | |
| 7213 | ALIAS (show_bgp_instance_summary, |
| 7214 | show_bgp_instance_ipv6_summary_cmd, |
| 7215 | "show bgp view WORD ipv6 summary", |
| 7216 | SHOW_STR |
| 7217 | BGP_STR |
| 7218 | "BGP view\n" |
| 7219 | "View name\n" |
| 7220 | "Address family\n" |
| 7221 | "Summary of BGP neighbor status\n") |
| 7222 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 7223 | DEFUN (show_bgp_ipv6_safi_summary, |
| 7224 | show_bgp_ipv6_safi_summary_cmd, |
| 7225 | "show bgp ipv6 (unicast|multicast) summary", |
| 7226 | SHOW_STR |
| 7227 | BGP_STR |
| 7228 | "Address family\n" |
| 7229 | "Address Family modifier\n" |
| 7230 | "Address Family modifier\n" |
| 7231 | "Summary of BGP neighbor status\n") |
| 7232 | { |
| 7233 | if (strncmp (argv[0], "m", 1) == 0) |
| 7234 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 7235 | |
| 7236 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7237 | } |
| 7238 | |
| 7239 | DEFUN (show_bgp_instance_ipv6_safi_summary, |
| 7240 | show_bgp_instance_ipv6_safi_summary_cmd, |
| 7241 | "show bgp view WORD ipv6 (unicast|multicast) summary", |
| 7242 | SHOW_STR |
| 7243 | BGP_STR |
| 7244 | "BGP view\n" |
| 7245 | "View name\n" |
| 7246 | "Address family\n" |
| 7247 | "Address Family modifier\n" |
| 7248 | "Address Family modifier\n" |
| 7249 | "Summary of BGP neighbor status\n") |
| 7250 | { |
| 7251 | if (strncmp (argv[1], "m", 1) == 0) |
| 7252 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST); |
| 7253 | |
| 7254 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 7255 | } |
| 7256 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7257 | /* old command */ |
| 7258 | DEFUN (show_ipv6_bgp_summary, |
| 7259 | show_ipv6_bgp_summary_cmd, |
| 7260 | "show ipv6 bgp summary", |
| 7261 | SHOW_STR |
| 7262 | IPV6_STR |
| 7263 | BGP_STR |
| 7264 | "Summary of BGP neighbor status\n") |
| 7265 | { |
| 7266 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7267 | } |
| 7268 | |
| 7269 | /* old command */ |
| 7270 | DEFUN (show_ipv6_mbgp_summary, |
| 7271 | show_ipv6_mbgp_summary_cmd, |
| 7272 | "show ipv6 mbgp summary", |
| 7273 | SHOW_STR |
| 7274 | IPV6_STR |
| 7275 | MBGP_STR |
| 7276 | "Summary of BGP neighbor status\n") |
| 7277 | { |
| 7278 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 7279 | } |
| 7280 | #endif /* HAVE_IPV6 */ |
| 7281 | |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7282 | const char * |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7283 | afi_safi_print (afi_t afi, safi_t safi) |
| 7284 | { |
| 7285 | if (afi == AFI_IP && safi == SAFI_UNICAST) |
| 7286 | return "IPv4 Unicast"; |
| 7287 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) |
| 7288 | return "IPv4 Multicast"; |
| 7289 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) |
| 7290 | return "VPNv4 Unicast"; |
| 7291 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) |
| 7292 | return "IPv6 Unicast"; |
| 7293 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) |
| 7294 | return "IPv6 Multicast"; |
| 7295 | else |
| 7296 | return "Unknown"; |
| 7297 | } |
| 7298 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7299 | /* Show BGP peer's information. */ |
| 7300 | enum show_type |
| 7301 | { |
| 7302 | show_all, |
| 7303 | show_peer |
| 7304 | }; |
| 7305 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7306 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7307 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
| 7308 | afi_t afi, safi_t safi, |
| 7309 | u_int16_t adv_smcap, u_int16_t adv_rmcap, |
| 7310 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) |
| 7311 | { |
| 7312 | /* Send-Mode */ |
| 7313 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) |
| 7314 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 7315 | { |
| 7316 | vty_out (vty, " Send-mode: "); |
| 7317 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) |
| 7318 | vty_out (vty, "advertised"); |
| 7319 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 7320 | vty_out (vty, "%sreceived", |
| 7321 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? |
| 7322 | ", " : ""); |
| 7323 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7324 | } |
| 7325 | |
| 7326 | /* Receive-Mode */ |
| 7327 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) |
| 7328 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 7329 | { |
| 7330 | vty_out (vty, " Receive-mode: "); |
| 7331 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) |
| 7332 | vty_out (vty, "advertised"); |
| 7333 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 7334 | vty_out (vty, "%sreceived", |
| 7335 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? |
| 7336 | ", " : ""); |
| 7337 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7338 | } |
| 7339 | } |
| 7340 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7341 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7342 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
| 7343 | { |
| 7344 | struct bgp_filter *filter; |
| 7345 | char orf_pfx_name[BUFSIZ]; |
| 7346 | int orf_pfx_count; |
| 7347 | |
| 7348 | filter = &p->filter[afi][safi]; |
| 7349 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7350 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7351 | VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7352 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7353 | if (p->af_group[afi][safi]) |
| 7354 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
| 7355 | |
| 7356 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7357 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 7358 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 7359 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7360 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) |
| 7361 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 7362 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); |
| 7363 | |
| 7364 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7365 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 7366 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7367 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) |
| 7368 | { |
| 7369 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 7370 | ORF_TYPE_PREFIX, VTY_NEWLINE); |
| 7371 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 7372 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 7373 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 7374 | PEER_CAP_ORF_PREFIX_SM_RCV, |
| 7375 | PEER_CAP_ORF_PREFIX_RM_RCV); |
| 7376 | } |
| 7377 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7378 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 7379 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7380 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 7381 | { |
| 7382 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 7383 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); |
| 7384 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 7385 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 7386 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 7387 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, |
| 7388 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); |
| 7389 | } |
| 7390 | |
| 7391 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
| 7392 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); |
| 7393 | |
| 7394 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
| 7395 | || orf_pfx_count) |
| 7396 | { |
| 7397 | vty_out (vty, " Outbound Route Filter (ORF):"); |
| 7398 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) |
| 7399 | vty_out (vty, " sent;"); |
| 7400 | if (orf_pfx_count) |
| 7401 | vty_out (vty, " received (%d entries)", orf_pfx_count); |
| 7402 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7403 | } |
| 7404 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) |
| 7405 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); |
| 7406 | |
| 7407 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) |
| 7408 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); |
| 7409 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 7410 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); |
| 7411 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) |
| 7412 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); |
| 7413 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
| 7414 | vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE); |
| 7415 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) |
| 7416 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); |
| 7417 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) |
| 7418 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7419 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) |
| 7420 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7421 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) |
| 7422 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7423 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 7424 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
| 7425 | { |
| 7426 | vty_out (vty, " Community attribute sent to this neighbor"); |
| 7427 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 7428 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7429 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7430 | 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] | 7431 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7432 | else |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7433 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7434 | } |
| 7435 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) |
| 7436 | { |
| 7437 | vty_out (vty, " Default information originate,"); |
| 7438 | |
| 7439 | if (p->default_rmap[afi][safi].name) |
| 7440 | vty_out (vty, " default route-map %s%s,", |
| 7441 | p->default_rmap[afi][safi].map ? "*" : "", |
| 7442 | p->default_rmap[afi][safi].name); |
| 7443 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) |
| 7444 | vty_out (vty, " default sent%s", VTY_NEWLINE); |
| 7445 | else |
| 7446 | vty_out (vty, " default not sent%s", VTY_NEWLINE); |
| 7447 | } |
| 7448 | |
| 7449 | if (filter->plist[FILTER_IN].name |
| 7450 | || filter->dlist[FILTER_IN].name |
| 7451 | || filter->aslist[FILTER_IN].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7452 | || filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7453 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
| 7454 | if (filter->plist[FILTER_OUT].name |
| 7455 | || filter->dlist[FILTER_OUT].name |
| 7456 | || filter->aslist[FILTER_OUT].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7457 | || filter->map[RMAP_OUT].name |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7458 | || filter->usmap.name) |
| 7459 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7460 | if (filter->map[RMAP_IMPORT].name) |
| 7461 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); |
| 7462 | if (filter->map[RMAP_EXPORT].name) |
| 7463 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7464 | |
| 7465 | /* prefix-list */ |
| 7466 | if (filter->plist[FILTER_IN].name) |
| 7467 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", |
| 7468 | filter->plist[FILTER_IN].plist ? "*" : "", |
| 7469 | filter->plist[FILTER_IN].name, |
| 7470 | VTY_NEWLINE); |
| 7471 | if (filter->plist[FILTER_OUT].name) |
| 7472 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", |
| 7473 | filter->plist[FILTER_OUT].plist ? "*" : "", |
| 7474 | filter->plist[FILTER_OUT].name, |
| 7475 | VTY_NEWLINE); |
| 7476 | |
| 7477 | /* distribute-list */ |
| 7478 | if (filter->dlist[FILTER_IN].name) |
| 7479 | vty_out (vty, " Incoming update network filter list is %s%s%s", |
| 7480 | filter->dlist[FILTER_IN].alist ? "*" : "", |
| 7481 | filter->dlist[FILTER_IN].name, |
| 7482 | VTY_NEWLINE); |
| 7483 | if (filter->dlist[FILTER_OUT].name) |
| 7484 | vty_out (vty, " Outgoing update network filter list is %s%s%s", |
| 7485 | filter->dlist[FILTER_OUT].alist ? "*" : "", |
| 7486 | filter->dlist[FILTER_OUT].name, |
| 7487 | VTY_NEWLINE); |
| 7488 | |
| 7489 | /* filter-list. */ |
| 7490 | if (filter->aslist[FILTER_IN].name) |
| 7491 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", |
| 7492 | filter->aslist[FILTER_IN].aslist ? "*" : "", |
| 7493 | filter->aslist[FILTER_IN].name, |
| 7494 | VTY_NEWLINE); |
| 7495 | if (filter->aslist[FILTER_OUT].name) |
| 7496 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", |
| 7497 | filter->aslist[FILTER_OUT].aslist ? "*" : "", |
| 7498 | filter->aslist[FILTER_OUT].name, |
| 7499 | VTY_NEWLINE); |
| 7500 | |
| 7501 | /* route-map. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7502 | if (filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7503 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7504 | filter->map[RMAP_IN].map ? "*" : "", |
| 7505 | filter->map[RMAP_IN].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7506 | VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7507 | if (filter->map[RMAP_OUT].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7508 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7509 | filter->map[RMAP_OUT].map ? "*" : "", |
| 7510 | filter->map[RMAP_OUT].name, |
| 7511 | VTY_NEWLINE); |
| 7512 | if (filter->map[RMAP_IMPORT].name) |
| 7513 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", |
| 7514 | filter->map[RMAP_IMPORT].map ? "*" : "", |
| 7515 | filter->map[RMAP_IMPORT].name, |
| 7516 | VTY_NEWLINE); |
| 7517 | if (filter->map[RMAP_EXPORT].name) |
| 7518 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", |
| 7519 | filter->map[RMAP_EXPORT].map ? "*" : "", |
| 7520 | filter->map[RMAP_EXPORT].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7521 | VTY_NEWLINE); |
| 7522 | |
| 7523 | /* unsuppress-map */ |
| 7524 | if (filter->usmap.name) |
| 7525 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", |
| 7526 | filter->usmap.map ? "*" : "", |
| 7527 | filter->usmap.name, VTY_NEWLINE); |
| 7528 | |
| 7529 | /* Receive prefix count */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7530 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
| 7531 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7532 | /* Maximum prefix */ |
| 7533 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) |
| 7534 | { |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7535 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7536 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7537 | ? " (warning-only)" : "", VTY_NEWLINE); |
| 7538 | vty_out (vty, " Threshold for warning message %d%%", |
| 7539 | p->pmax_threshold[afi][safi]); |
| 7540 | if (p->pmax_restart[afi][safi]) |
| 7541 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); |
| 7542 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7543 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7544 | |
| 7545 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7546 | } |
| 7547 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7548 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7549 | bgp_show_peer (struct vty *vty, struct peer *p) |
| 7550 | { |
| 7551 | struct bgp *bgp; |
| 7552 | char buf1[BUFSIZ]; |
| 7553 | char timebuf[BGP_UPTIME_LEN]; |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7554 | afi_t afi; |
| 7555 | safi_t safi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7556 | |
| 7557 | bgp = p->bgp; |
| 7558 | |
| 7559 | /* Configured IP address. */ |
| 7560 | vty_out (vty, "BGP neighbor is %s, ", p->host); |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 7561 | vty_out (vty, "remote AS %u, ", p->as); |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 7562 | vty_out (vty, "local AS %u%s%s, ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7563 | p->change_local_as ? p->change_local_as : p->local_as, |
| 7564 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 7565 | " no-prepend" : "", |
| 7566 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? |
| 7567 | " replace-as" : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7568 | vty_out (vty, "%s link%s", |
| 7569 | p->as == p->local_as ? "internal" : "external", |
| 7570 | VTY_NEWLINE); |
| 7571 | |
| 7572 | /* Description. */ |
| 7573 | if (p->desc) |
| 7574 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); |
| 7575 | |
| 7576 | /* Peer-group */ |
| 7577 | if (p->group) |
| 7578 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
| 7579 | p->group->name, VTY_NEWLINE); |
| 7580 | |
| 7581 | /* Administrative shutdown. */ |
| 7582 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) |
| 7583 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); |
| 7584 | |
| 7585 | /* BGP Version. */ |
| 7586 | vty_out (vty, " BGP version 4"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7587 | vty_out (vty, ", remote router ID %s%s", |
| 7588 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), |
| 7589 | VTY_NEWLINE); |
| 7590 | |
| 7591 | /* Confederation */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7592 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
| 7593 | && bgp_confederation_peers_check (bgp, p->as)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7594 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
| 7595 | |
| 7596 | /* Status. */ |
| 7597 | vty_out (vty, " BGP state = %s", |
| 7598 | LOOKUP (bgp_status_msg, p->status)); |
| 7599 | if (p->status == Established) |
| 7600 | vty_out (vty, ", up for %8s", |
| 7601 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7602 | else if (p->status == Active) |
| 7603 | { |
| 7604 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) |
| 7605 | vty_out (vty, " (passive)"); |
| 7606 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) |
| 7607 | vty_out (vty, " (NSF passive)"); |
| 7608 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7609 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7610 | |
| 7611 | /* read timer */ |
| 7612 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); |
| 7613 | |
| 7614 | /* Configured timer values. */ |
| 7615 | vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s", |
| 7616 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); |
| 7617 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) |
| 7618 | { |
| 7619 | vty_out (vty, " Configured hold time is %d", p->holdtime); |
| 7620 | vty_out (vty, ", keepalive interval is %d seconds%s", |
| 7621 | p->keepalive, VTY_NEWLINE); |
| 7622 | } |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7623 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7624 | /* Capability. */ |
| 7625 | if (p->status == Established) |
| 7626 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7627 | if (p->cap |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7628 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
| 7629 | || p->afc_recv[AFI_IP][SAFI_UNICAST] |
| 7630 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] |
| 7631 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] |
| 7632 | #ifdef HAVE_IPV6 |
| 7633 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] |
| 7634 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] |
| 7635 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] |
| 7636 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] |
| 7637 | #endif /* HAVE_IPV6 */ |
| 7638 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] |
| 7639 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) |
| 7640 | { |
| 7641 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); |
| 7642 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7643 | /* AS4 */ |
| 7644 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) |
| 7645 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) |
| 7646 | { |
| 7647 | vty_out (vty, " 4 Byte AS:"); |
| 7648 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) |
| 7649 | vty_out (vty, " advertised"); |
| 7650 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) |
| 7651 | vty_out (vty, " %sreceived", |
| 7652 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); |
| 7653 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7654 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7655 | /* Dynamic */ |
| 7656 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) |
| 7657 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7658 | { |
| 7659 | vty_out (vty, " Dynamic:"); |
| 7660 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7661 | vty_out (vty, " advertised"); |
| 7662 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7663 | vty_out (vty, " %sreceived", |
| 7664 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7665 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7666 | } |
| 7667 | |
| 7668 | /* Route Refresh */ |
| 7669 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) |
| 7670 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7671 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
| 7672 | { |
| 7673 | vty_out (vty, " Route refresh:"); |
| 7674 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) |
| 7675 | vty_out (vty, " advertised"); |
| 7676 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7677 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7678 | vty_out (vty, " %sreceived(%s)", |
| 7679 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", |
| 7680 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) |
| 7681 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? |
| 7682 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); |
| 7683 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7684 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7685 | } |
| 7686 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7687 | /* Multiprotocol Extensions */ |
| 7688 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7689 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7690 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7691 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7692 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
| 7693 | if (p->afc_adv[afi][safi]) |
| 7694 | vty_out (vty, " advertised"); |
| 7695 | if (p->afc_recv[afi][safi]) |
| 7696 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); |
| 7697 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7698 | } |
| 7699 | |
| 7700 | /* Gracefull Restart */ |
| 7701 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7702 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7703 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7704 | vty_out (vty, " Graceful Restart Capabilty:"); |
| 7705 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7706 | vty_out (vty, " advertised"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7707 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
| 7708 | vty_out (vty, " %sreceived", |
| 7709 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7710 | vty_out (vty, "%s", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7711 | |
| 7712 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7713 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7714 | int restart_af_count = 0; |
| 7715 | |
| 7716 | vty_out (vty, " Remote Restart timer is %d seconds%s", |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7717 | p->v_gr_restart, VTY_NEWLINE); |
| 7718 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7719 | |
| 7720 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7721 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7722 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) |
| 7723 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7724 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
| 7725 | afi_safi_print (afi, safi), |
| 7726 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? |
| 7727 | "preserved" : "not preserved"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7728 | restart_af_count++; |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7729 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7730 | if (! restart_af_count) |
| 7731 | vty_out (vty, "none"); |
| 7732 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7733 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7734 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7735 | } |
| 7736 | } |
| 7737 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7738 | /* graceful restart information */ |
| 7739 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7740 | || p->t_gr_restart |
| 7741 | || p->t_gr_stale) |
| 7742 | { |
| 7743 | int eor_send_af_count = 0; |
| 7744 | int eor_receive_af_count = 0; |
| 7745 | |
| 7746 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); |
| 7747 | if (p->status == Established) |
| 7748 | { |
| 7749 | vty_out (vty, " End-of-RIB send: "); |
| 7750 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7751 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7752 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) |
| 7753 | { |
| 7754 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", |
| 7755 | afi_safi_print (afi, safi)); |
| 7756 | eor_send_af_count++; |
| 7757 | } |
| 7758 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7759 | |
| 7760 | vty_out (vty, " End-of-RIB received: "); |
| 7761 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7762 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7763 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) |
| 7764 | { |
| 7765 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", |
| 7766 | afi_safi_print (afi, safi)); |
| 7767 | eor_receive_af_count++; |
| 7768 | } |
| 7769 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7770 | } |
| 7771 | |
| 7772 | if (p->t_gr_restart) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7773 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
| 7774 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); |
| 7775 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7776 | if (p->t_gr_stale) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7777 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
| 7778 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7779 | } |
| 7780 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7781 | /* Packet counts. */ |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7782 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
| 7783 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7784 | 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] | 7785 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
| 7786 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); |
| 7787 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); |
| 7788 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); |
| 7789 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); |
| 7790 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); |
| 7791 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); |
| 7792 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + |
| 7793 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, |
| 7794 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + |
| 7795 | p->dynamic_cap_in, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7796 | |
| 7797 | /* advertisement-interval */ |
| 7798 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", |
| 7799 | p->v_routeadv, VTY_NEWLINE); |
| 7800 | |
| 7801 | /* Update-source. */ |
| 7802 | if (p->update_if || p->update_source) |
| 7803 | { |
| 7804 | vty_out (vty, " Update source is "); |
| 7805 | if (p->update_if) |
| 7806 | vty_out (vty, "%s", p->update_if); |
| 7807 | else if (p->update_source) |
| 7808 | vty_out (vty, "%s", |
| 7809 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); |
| 7810 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7811 | } |
| 7812 | |
| 7813 | /* Default weight */ |
| 7814 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) |
| 7815 | vty_out (vty, " Default weight %d%s", p->weight, |
| 7816 | VTY_NEWLINE); |
| 7817 | |
| 7818 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7819 | |
| 7820 | /* Address Family Information */ |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7821 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7822 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7823 | if (p->afc[afi][safi]) |
| 7824 | bgp_show_peer_afi (vty, p, afi, safi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7825 | |
| 7826 | vty_out (vty, " Connections established %d; dropped %d%s", |
| 7827 | p->established, p->dropped, |
| 7828 | VTY_NEWLINE); |
| 7829 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7830 | if (! p->dropped) |
| 7831 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); |
| 7832 | else |
| 7833 | vty_out (vty, " Last reset %s, due to %s%s", |
| 7834 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), |
| 7835 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 7836 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7837 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7838 | { |
| 7839 | 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] | 7840 | |
| 7841 | if (p->t_pmax_restart) |
| 7842 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", |
| 7843 | p->host, thread_timer_remain_second (p->t_pmax_restart), |
| 7844 | VTY_NEWLINE); |
| 7845 | else |
| 7846 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", |
| 7847 | p->host, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7848 | } |
| 7849 | |
Stephen Hemminger | f5a4827 | 2011-03-24 17:30:21 +0000 | [diff] [blame] | 7850 | /* EBGP Multihop and GTSM */ |
Jorge Boncompte [DTI2] | 6d85b15 | 2012-05-07 16:52:54 +0000 | [diff] [blame] | 7851 | if (p->sort != BGP_PEER_IBGP) |
Stephen Hemminger | f5a4827 | 2011-03-24 17:30:21 +0000 | [diff] [blame] | 7852 | { |
| 7853 | if (p->gtsm_hops > 0) |
| 7854 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 7855 | p->gtsm_hops, VTY_NEWLINE); |
| 7856 | else if (p->ttl > 1) |
| 7857 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 7858 | p->ttl, VTY_NEWLINE); |
| 7859 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7860 | |
| 7861 | /* Local address. */ |
| 7862 | if (p->su_local) |
| 7863 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7864 | vty_out (vty, "Local host: %s, Local port: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7865 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
| 7866 | ntohs (p->su_local->sin.sin_port), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7867 | VTY_NEWLINE); |
| 7868 | } |
| 7869 | |
| 7870 | /* Remote address. */ |
| 7871 | if (p->su_remote) |
| 7872 | { |
| 7873 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", |
| 7874 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
| 7875 | ntohs (p->su_remote->sin.sin_port), |
| 7876 | VTY_NEWLINE); |
| 7877 | } |
| 7878 | |
| 7879 | /* Nexthop display. */ |
| 7880 | if (p->su_local) |
| 7881 | { |
| 7882 | vty_out (vty, "Nexthop: %s%s", |
| 7883 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), |
| 7884 | VTY_NEWLINE); |
| 7885 | #ifdef HAVE_IPV6 |
| 7886 | vty_out (vty, "Nexthop global: %s%s", |
| 7887 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), |
| 7888 | VTY_NEWLINE); |
| 7889 | vty_out (vty, "Nexthop local: %s%s", |
| 7890 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), |
| 7891 | VTY_NEWLINE); |
| 7892 | vty_out (vty, "BGP connection: %s%s", |
| 7893 | p->shared_network ? "shared network" : "non shared network", |
| 7894 | VTY_NEWLINE); |
| 7895 | #endif /* HAVE_IPV6 */ |
| 7896 | } |
| 7897 | |
| 7898 | /* Timer information. */ |
| 7899 | if (p->t_start) |
| 7900 | vty_out (vty, "Next start timer due in %ld seconds%s", |
| 7901 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); |
| 7902 | if (p->t_connect) |
| 7903 | vty_out (vty, "Next connect timer due in %ld seconds%s", |
| 7904 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); |
| 7905 | |
| 7906 | vty_out (vty, "Read thread: %s Write thread: %s%s", |
| 7907 | p->t_read ? "on" : "off", |
| 7908 | p->t_write ? "on" : "off", |
| 7909 | VTY_NEWLINE); |
| 7910 | |
| 7911 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR |
| 7912 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) |
| 7913 | bgp_capability_vty_out (vty, p); |
| 7914 | |
| 7915 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7916 | } |
| 7917 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7918 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7919 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
| 7920 | enum show_type type, union sockunion *su) |
| 7921 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7922 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7923 | struct peer *peer; |
| 7924 | int find = 0; |
| 7925 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7926 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7927 | { |
| 7928 | switch (type) |
| 7929 | { |
| 7930 | case show_all: |
| 7931 | bgp_show_peer (vty, peer); |
| 7932 | break; |
| 7933 | case show_peer: |
| 7934 | if (sockunion_same (&peer->su, su)) |
| 7935 | { |
| 7936 | find = 1; |
| 7937 | bgp_show_peer (vty, peer); |
| 7938 | } |
| 7939 | break; |
| 7940 | } |
| 7941 | } |
| 7942 | |
| 7943 | if (type == show_peer && ! find) |
| 7944 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); |
| 7945 | |
| 7946 | return CMD_SUCCESS; |
| 7947 | } |
| 7948 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7949 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7950 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
| 7951 | enum show_type type, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7952 | { |
| 7953 | int ret; |
| 7954 | struct bgp *bgp; |
| 7955 | union sockunion su; |
| 7956 | |
| 7957 | if (ip_str) |
| 7958 | { |
| 7959 | ret = str2sockunion (ip_str, &su); |
| 7960 | if (ret < 0) |
| 7961 | { |
| 7962 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 7963 | return CMD_WARNING; |
| 7964 | } |
| 7965 | } |
| 7966 | |
| 7967 | if (name) |
| 7968 | { |
| 7969 | bgp = bgp_lookup_by_name (name); |
| 7970 | |
| 7971 | if (! bgp) |
| 7972 | { |
| 7973 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7974 | return CMD_WARNING; |
| 7975 | } |
| 7976 | |
| 7977 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7978 | |
| 7979 | return CMD_SUCCESS; |
| 7980 | } |
| 7981 | |
| 7982 | bgp = bgp_get_default (); |
| 7983 | |
| 7984 | if (bgp) |
| 7985 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7986 | |
| 7987 | return CMD_SUCCESS; |
| 7988 | } |
| 7989 | |
| 7990 | /* "show ip bgp neighbors" commands. */ |
| 7991 | DEFUN (show_ip_bgp_neighbors, |
| 7992 | show_ip_bgp_neighbors_cmd, |
| 7993 | "show ip bgp neighbors", |
| 7994 | SHOW_STR |
| 7995 | IP_STR |
| 7996 | BGP_STR |
| 7997 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7998 | { |
| 7999 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); |
| 8000 | } |
| 8001 | |
| 8002 | ALIAS (show_ip_bgp_neighbors, |
| 8003 | show_ip_bgp_ipv4_neighbors_cmd, |
| 8004 | "show ip bgp ipv4 (unicast|multicast) neighbors", |
| 8005 | SHOW_STR |
| 8006 | IP_STR |
| 8007 | BGP_STR |
| 8008 | "Address family\n" |
| 8009 | "Address Family modifier\n" |
| 8010 | "Address Family modifier\n" |
| 8011 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8012 | |
| 8013 | ALIAS (show_ip_bgp_neighbors, |
| 8014 | show_ip_bgp_vpnv4_all_neighbors_cmd, |
| 8015 | "show ip bgp vpnv4 all neighbors", |
| 8016 | SHOW_STR |
| 8017 | IP_STR |
| 8018 | BGP_STR |
| 8019 | "Display VPNv4 NLRI specific information\n" |
| 8020 | "Display information about all VPNv4 NLRIs\n" |
| 8021 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8022 | |
| 8023 | ALIAS (show_ip_bgp_neighbors, |
| 8024 | show_ip_bgp_vpnv4_rd_neighbors_cmd, |
| 8025 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", |
| 8026 | SHOW_STR |
| 8027 | IP_STR |
| 8028 | BGP_STR |
| 8029 | "Display VPNv4 NLRI specific information\n" |
| 8030 | "Display information for a route distinguisher\n" |
| 8031 | "VPN Route Distinguisher\n" |
| 8032 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8033 | |
| 8034 | ALIAS (show_ip_bgp_neighbors, |
| 8035 | show_bgp_neighbors_cmd, |
| 8036 | "show bgp neighbors", |
| 8037 | SHOW_STR |
| 8038 | BGP_STR |
| 8039 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8040 | |
| 8041 | ALIAS (show_ip_bgp_neighbors, |
| 8042 | show_bgp_ipv6_neighbors_cmd, |
| 8043 | "show bgp ipv6 neighbors", |
| 8044 | SHOW_STR |
| 8045 | BGP_STR |
| 8046 | "Address family\n" |
| 8047 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8048 | |
| 8049 | DEFUN (show_ip_bgp_neighbors_peer, |
| 8050 | show_ip_bgp_neighbors_peer_cmd, |
| 8051 | "show ip bgp neighbors (A.B.C.D|X:X::X:X)", |
| 8052 | SHOW_STR |
| 8053 | IP_STR |
| 8054 | BGP_STR |
| 8055 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8056 | "Neighbor to display information about\n" |
| 8057 | "Neighbor to display information about\n") |
| 8058 | { |
| 8059 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); |
| 8060 | } |
| 8061 | |
| 8062 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8063 | show_ip_bgp_ipv4_neighbors_peer_cmd, |
| 8064 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)", |
| 8065 | SHOW_STR |
| 8066 | IP_STR |
| 8067 | BGP_STR |
| 8068 | "Address family\n" |
| 8069 | "Address Family modifier\n" |
| 8070 | "Address Family modifier\n" |
| 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 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8076 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, |
| 8077 | "show ip bgp vpnv4 all neighbors A.B.C.D", |
| 8078 | SHOW_STR |
| 8079 | IP_STR |
| 8080 | BGP_STR |
| 8081 | "Display VPNv4 NLRI specific information\n" |
| 8082 | "Display information about all VPNv4 NLRIs\n" |
| 8083 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8084 | "Neighbor to display information about\n") |
| 8085 | |
| 8086 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8087 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, |
| 8088 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", |
| 8089 | SHOW_STR |
| 8090 | IP_STR |
| 8091 | BGP_STR |
| 8092 | "Display VPNv4 NLRI specific information\n" |
| 8093 | "Display information about all VPNv4 NLRIs\n" |
| 8094 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8095 | "Neighbor to display information about\n") |
| 8096 | |
| 8097 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8098 | show_bgp_neighbors_peer_cmd, |
| 8099 | "show bgp neighbors (A.B.C.D|X:X::X:X)", |
| 8100 | SHOW_STR |
| 8101 | BGP_STR |
| 8102 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8103 | "Neighbor to display information about\n" |
| 8104 | "Neighbor to display information about\n") |
| 8105 | |
| 8106 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8107 | show_bgp_ipv6_neighbors_peer_cmd, |
| 8108 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 8109 | SHOW_STR |
| 8110 | BGP_STR |
| 8111 | "Address family\n" |
| 8112 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8113 | "Neighbor to display information about\n" |
| 8114 | "Neighbor to display information about\n") |
| 8115 | |
| 8116 | DEFUN (show_ip_bgp_instance_neighbors, |
| 8117 | show_ip_bgp_instance_neighbors_cmd, |
| 8118 | "show ip bgp view WORD neighbors", |
| 8119 | SHOW_STR |
| 8120 | IP_STR |
| 8121 | BGP_STR |
| 8122 | "BGP view\n" |
| 8123 | "View name\n" |
| 8124 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8125 | { |
| 8126 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); |
| 8127 | } |
| 8128 | |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 8129 | ALIAS (show_ip_bgp_instance_neighbors, |
| 8130 | show_bgp_instance_neighbors_cmd, |
| 8131 | "show bgp view WORD neighbors", |
| 8132 | SHOW_STR |
| 8133 | BGP_STR |
| 8134 | "BGP view\n" |
| 8135 | "View name\n" |
| 8136 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8137 | |
| 8138 | ALIAS (show_ip_bgp_instance_neighbors, |
| 8139 | show_bgp_instance_ipv6_neighbors_cmd, |
| 8140 | "show bgp view WORD ipv6 neighbors", |
| 8141 | SHOW_STR |
| 8142 | BGP_STR |
| 8143 | "BGP view\n" |
| 8144 | "View name\n" |
| 8145 | "Address family\n" |
| 8146 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8147 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8148 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
| 8149 | show_ip_bgp_instance_neighbors_peer_cmd, |
| 8150 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 8151 | SHOW_STR |
| 8152 | IP_STR |
| 8153 | BGP_STR |
| 8154 | "BGP view\n" |
| 8155 | "View name\n" |
| 8156 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8157 | "Neighbor to display information about\n" |
| 8158 | "Neighbor to display information about\n") |
| 8159 | { |
| 8160 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); |
| 8161 | } |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 8162 | |
| 8163 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 8164 | show_bgp_instance_neighbors_peer_cmd, |
| 8165 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 8166 | SHOW_STR |
| 8167 | BGP_STR |
| 8168 | "BGP view\n" |
| 8169 | "View name\n" |
| 8170 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8171 | "Neighbor to display information about\n" |
| 8172 | "Neighbor to display information about\n") |
| 8173 | |
| 8174 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 8175 | show_bgp_instance_ipv6_neighbors_peer_cmd, |
| 8176 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 8177 | SHOW_STR |
| 8178 | BGP_STR |
| 8179 | "BGP view\n" |
| 8180 | "View name\n" |
| 8181 | "Address family\n" |
| 8182 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8183 | "Neighbor to display information about\n" |
| 8184 | "Neighbor to display information about\n") |
| 8185 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8186 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
| 8187 | paths' and `show ip mbgp paths'. Those functions results are the |
| 8188 | same.*/ |
| 8189 | DEFUN (show_ip_bgp_paths, |
| 8190 | show_ip_bgp_paths_cmd, |
| 8191 | "show ip bgp paths", |
| 8192 | SHOW_STR |
| 8193 | IP_STR |
| 8194 | BGP_STR |
| 8195 | "Path information\n") |
| 8196 | { |
| 8197 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); |
| 8198 | aspath_print_all_vty (vty); |
| 8199 | return CMD_SUCCESS; |
| 8200 | } |
| 8201 | |
| 8202 | DEFUN (show_ip_bgp_ipv4_paths, |
| 8203 | show_ip_bgp_ipv4_paths_cmd, |
| 8204 | "show ip bgp ipv4 (unicast|multicast) paths", |
| 8205 | SHOW_STR |
| 8206 | IP_STR |
| 8207 | BGP_STR |
| 8208 | "Address family\n" |
| 8209 | "Address Family modifier\n" |
| 8210 | "Address Family modifier\n" |
| 8211 | "Path information\n") |
| 8212 | { |
| 8213 | vty_out (vty, "Address Refcnt Path\r\n"); |
| 8214 | aspath_print_all_vty (vty); |
| 8215 | |
| 8216 | return CMD_SUCCESS; |
| 8217 | } |
| 8218 | |
| 8219 | #include "hash.h" |
| 8220 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8221 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8222 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
| 8223 | { |
| 8224 | struct community *com; |
| 8225 | |
| 8226 | com = (struct community *) backet->data; |
| 8227 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, |
| 8228 | community_str (com), VTY_NEWLINE); |
| 8229 | } |
| 8230 | |
| 8231 | /* Show BGP's community internal data. */ |
| 8232 | DEFUN (show_ip_bgp_community_info, |
| 8233 | show_ip_bgp_community_info_cmd, |
| 8234 | "show ip bgp community-info", |
| 8235 | SHOW_STR |
| 8236 | IP_STR |
| 8237 | BGP_STR |
| 8238 | "List all bgp community information\n") |
| 8239 | { |
| 8240 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); |
| 8241 | |
| 8242 | hash_iterate (community_hash (), |
| 8243 | (void (*) (struct hash_backet *, void *)) |
| 8244 | community_show_all_iterator, |
| 8245 | vty); |
| 8246 | |
| 8247 | return CMD_SUCCESS; |
| 8248 | } |
| 8249 | |
| 8250 | DEFUN (show_ip_bgp_attr_info, |
| 8251 | show_ip_bgp_attr_info_cmd, |
| 8252 | "show ip bgp attribute-info", |
| 8253 | SHOW_STR |
| 8254 | IP_STR |
| 8255 | BGP_STR |
| 8256 | "List all bgp attribute information\n") |
| 8257 | { |
| 8258 | attr_show_all (vty); |
| 8259 | return CMD_SUCCESS; |
| 8260 | } |
| 8261 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8262 | static int |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8263 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
| 8264 | afi_t afi, safi_t safi) |
| 8265 | { |
| 8266 | char timebuf[BGP_UPTIME_LEN]; |
| 8267 | char rmbuf[14]; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8268 | const char *rmname; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8269 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8270 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8271 | int len; |
| 8272 | int count = 0; |
| 8273 | |
| 8274 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) |
| 8275 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8276 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8277 | { |
| 8278 | count++; |
| 8279 | bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 8280 | } |
| 8281 | return count; |
| 8282 | } |
| 8283 | |
| 8284 | len = vty_out (vty, "%s", rsclient->host); |
| 8285 | len = 16 - len; |
| 8286 | |
| 8287 | if (len < 1) |
| 8288 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 8289 | else |
| 8290 | vty_out (vty, "%*s", len, " "); |
| 8291 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 8292 | vty_out (vty, "4 "); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8293 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 8294 | vty_out (vty, "%11d ", rsclient->as); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8295 | |
| 8296 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); |
| 8297 | if ( rmname && strlen (rmname) > 13 ) |
| 8298 | { |
| 8299 | sprintf (rmbuf, "%13s", "..."); |
| 8300 | rmname = strncpy (rmbuf, rmname, 10); |
| 8301 | } |
| 8302 | else if (! rmname) |
| 8303 | rmname = "<none>"; |
| 8304 | vty_out (vty, " %13s ", rmname); |
| 8305 | |
| 8306 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); |
| 8307 | if ( rmname && strlen (rmname) > 13 ) |
| 8308 | { |
| 8309 | sprintf (rmbuf, "%13s", "..."); |
| 8310 | rmname = strncpy (rmbuf, rmname, 10); |
| 8311 | } |
| 8312 | else if (! rmname) |
| 8313 | rmname = "<none>"; |
| 8314 | vty_out (vty, " %13s ", rmname); |
| 8315 | |
| 8316 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); |
| 8317 | |
| 8318 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) |
| 8319 | vty_out (vty, " Idle (Admin)"); |
| 8320 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 8321 | vty_out (vty, " Idle (PfxCt)"); |
| 8322 | else |
| 8323 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); |
| 8324 | |
| 8325 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8326 | |
| 8327 | return 1; |
| 8328 | } |
| 8329 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8330 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8331 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
| 8332 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8333 | { |
| 8334 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8335 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8336 | int count = 0; |
| 8337 | |
| 8338 | /* Header string for each address family. */ |
| 8339 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; |
| 8340 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8341 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8342 | { |
| 8343 | if (peer->afc[afi][safi] && |
| 8344 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 8345 | { |
| 8346 | if (! count) |
| 8347 | { |
| 8348 | vty_out (vty, |
| 8349 | "Route Server's BGP router identifier %s%s", |
| 8350 | inet_ntoa (bgp->router_id), VTY_NEWLINE); |
| 8351 | vty_out (vty, |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 8352 | "Route Server's local AS number %u%s", bgp->as, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8353 | VTY_NEWLINE); |
| 8354 | |
| 8355 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8356 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 8357 | } |
| 8358 | |
| 8359 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 8360 | } |
| 8361 | } |
| 8362 | |
| 8363 | if (count) |
| 8364 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, |
| 8365 | count, VTY_NEWLINE); |
| 8366 | else |
| 8367 | vty_out (vty, "No %s Route Server Client is configured%s", |
| 8368 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 8369 | |
| 8370 | return CMD_SUCCESS; |
| 8371 | } |
| 8372 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8373 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8374 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
| 8375 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8376 | { |
| 8377 | struct bgp *bgp; |
| 8378 | |
| 8379 | if (name) |
| 8380 | { |
| 8381 | bgp = bgp_lookup_by_name (name); |
| 8382 | |
| 8383 | if (! bgp) |
| 8384 | { |
| 8385 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 8386 | return CMD_WARNING; |
| 8387 | } |
| 8388 | |
| 8389 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 8390 | return CMD_SUCCESS; |
| 8391 | } |
| 8392 | |
| 8393 | bgp = bgp_get_default (); |
| 8394 | |
| 8395 | if (bgp) |
| 8396 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 8397 | |
| 8398 | return CMD_SUCCESS; |
| 8399 | } |
| 8400 | |
| 8401 | /* 'show bgp rsclient' commands. */ |
| 8402 | DEFUN (show_ip_bgp_rsclient_summary, |
| 8403 | show_ip_bgp_rsclient_summary_cmd, |
| 8404 | "show ip bgp rsclient summary", |
| 8405 | SHOW_STR |
| 8406 | IP_STR |
| 8407 | BGP_STR |
| 8408 | "Information about Route Server Clients\n" |
| 8409 | "Summary of all Route Server Clients\n") |
| 8410 | { |
| 8411 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 8412 | } |
| 8413 | |
| 8414 | DEFUN (show_ip_bgp_instance_rsclient_summary, |
| 8415 | show_ip_bgp_instance_rsclient_summary_cmd, |
| 8416 | "show ip bgp view WORD rsclient summary", |
| 8417 | SHOW_STR |
| 8418 | IP_STR |
| 8419 | BGP_STR |
| 8420 | "BGP view\n" |
| 8421 | "View name\n" |
| 8422 | "Information about Route Server Clients\n" |
| 8423 | "Summary of all Route Server Clients\n") |
| 8424 | { |
| 8425 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 8426 | } |
| 8427 | |
| 8428 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, |
| 8429 | show_ip_bgp_ipv4_rsclient_summary_cmd, |
| 8430 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", |
| 8431 | SHOW_STR |
| 8432 | IP_STR |
| 8433 | BGP_STR |
| 8434 | "Address family\n" |
| 8435 | "Address Family modifier\n" |
| 8436 | "Address Family modifier\n" |
| 8437 | "Information about Route Server Clients\n" |
| 8438 | "Summary of all Route Server Clients\n") |
| 8439 | { |
| 8440 | if (strncmp (argv[0], "m", 1) == 0) |
| 8441 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 8442 | |
| 8443 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 8444 | } |
| 8445 | |
| 8446 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, |
| 8447 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, |
| 8448 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 8449 | SHOW_STR |
| 8450 | IP_STR |
| 8451 | BGP_STR |
| 8452 | "BGP view\n" |
| 8453 | "View name\n" |
| 8454 | "Address family\n" |
| 8455 | "Address Family modifier\n" |
| 8456 | "Address Family modifier\n" |
| 8457 | "Information about Route Server Clients\n" |
| 8458 | "Summary of all Route Server Clients\n") |
| 8459 | { |
| 8460 | if (strncmp (argv[1], "m", 1) == 0) |
| 8461 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 8462 | |
| 8463 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 8464 | } |
| 8465 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 8466 | DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary, |
| 8467 | show_bgp_instance_ipv4_safi_rsclient_summary_cmd, |
| 8468 | "show bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 8469 | SHOW_STR |
| 8470 | BGP_STR |
| 8471 | "BGP view\n" |
| 8472 | "View name\n" |
| 8473 | "Address family\n" |
| 8474 | "Address Family modifier\n" |
| 8475 | "Address Family modifier\n" |
| 8476 | "Information about Route Server Clients\n" |
| 8477 | "Summary of all Route Server Clients\n") |
| 8478 | { |
| 8479 | safi_t safi; |
| 8480 | |
| 8481 | if (argc == 2) { |
| 8482 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8483 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi); |
| 8484 | } else { |
| 8485 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8486 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi); |
| 8487 | } |
| 8488 | } |
| 8489 | |
| 8490 | ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary, |
| 8491 | show_bgp_ipv4_safi_rsclient_summary_cmd, |
| 8492 | "show bgp ipv4 (unicast|multicast) rsclient summary", |
| 8493 | SHOW_STR |
| 8494 | BGP_STR |
| 8495 | "Address family\n" |
| 8496 | "Address Family modifier\n" |
| 8497 | "Address Family modifier\n" |
| 8498 | "Information about Route Server Clients\n" |
| 8499 | "Summary of all Route Server Clients\n") |
| 8500 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8501 | #ifdef HAVE_IPV6 |
| 8502 | DEFUN (show_bgp_rsclient_summary, |
| 8503 | show_bgp_rsclient_summary_cmd, |
| 8504 | "show bgp rsclient summary", |
| 8505 | SHOW_STR |
| 8506 | BGP_STR |
| 8507 | "Information about Route Server Clients\n" |
| 8508 | "Summary of all Route Server Clients\n") |
| 8509 | { |
| 8510 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 8511 | } |
| 8512 | |
| 8513 | DEFUN (show_bgp_instance_rsclient_summary, |
| 8514 | show_bgp_instance_rsclient_summary_cmd, |
| 8515 | "show bgp view WORD rsclient summary", |
| 8516 | SHOW_STR |
| 8517 | BGP_STR |
| 8518 | "BGP view\n" |
| 8519 | "View name\n" |
| 8520 | "Information about Route Server Clients\n" |
| 8521 | "Summary of all Route Server Clients\n") |
| 8522 | { |
| 8523 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 8524 | } |
| 8525 | |
| 8526 | ALIAS (show_bgp_rsclient_summary, |
| 8527 | show_bgp_ipv6_rsclient_summary_cmd, |
| 8528 | "show bgp ipv6 rsclient summary", |
| 8529 | SHOW_STR |
| 8530 | BGP_STR |
| 8531 | "Address family\n" |
| 8532 | "Information about Route Server Clients\n" |
| 8533 | "Summary of all Route Server Clients\n") |
| 8534 | |
| 8535 | ALIAS (show_bgp_instance_rsclient_summary, |
| 8536 | show_bgp_instance_ipv6_rsclient_summary_cmd, |
| 8537 | "show bgp view WORD ipv6 rsclient summary", |
| 8538 | SHOW_STR |
| 8539 | BGP_STR |
| 8540 | "BGP view\n" |
| 8541 | "View name\n" |
| 8542 | "Address family\n" |
| 8543 | "Information about Route Server Clients\n" |
| 8544 | "Summary of all Route Server Clients\n") |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 8545 | |
| 8546 | DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary, |
| 8547 | show_bgp_instance_ipv6_safi_rsclient_summary_cmd, |
| 8548 | "show bgp view WORD ipv6 (unicast|multicast) rsclient summary", |
| 8549 | SHOW_STR |
| 8550 | BGP_STR |
| 8551 | "BGP view\n" |
| 8552 | "View name\n" |
| 8553 | "Address family\n" |
| 8554 | "Address Family modifier\n" |
| 8555 | "Address Family modifier\n" |
| 8556 | "Information about Route Server Clients\n" |
| 8557 | "Summary of all Route Server Clients\n") |
| 8558 | { |
| 8559 | safi_t safi; |
| 8560 | |
| 8561 | if (argc == 2) { |
| 8562 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8563 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi); |
| 8564 | } else { |
| 8565 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8566 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi); |
| 8567 | } |
| 8568 | } |
| 8569 | |
| 8570 | ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary, |
| 8571 | show_bgp_ipv6_safi_rsclient_summary_cmd, |
| 8572 | "show bgp ipv6 (unicast|multicast) rsclient summary", |
| 8573 | SHOW_STR |
| 8574 | BGP_STR |
| 8575 | "Address family\n" |
| 8576 | "Address Family modifier\n" |
| 8577 | "Address Family modifier\n" |
| 8578 | "Information about Route Server Clients\n" |
| 8579 | "Summary of all Route Server Clients\n") |
| 8580 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8581 | #endif /* HAVE IPV6 */ |
| 8582 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8583 | /* Redistribute VTY commands. */ |
| 8584 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8585 | DEFUN (bgp_redistribute_ipv4, |
| 8586 | bgp_redistribute_ipv4_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8587 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8588 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8589 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8590 | { |
| 8591 | int type; |
| 8592 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8593 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8594 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8595 | { |
| 8596 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8597 | return CMD_WARNING; |
| 8598 | } |
| 8599 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8600 | } |
| 8601 | |
| 8602 | DEFUN (bgp_redistribute_ipv4_rmap, |
| 8603 | bgp_redistribute_ipv4_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8604 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8605 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8606 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8607 | "Route map reference\n" |
| 8608 | "Pointer to route-map entries\n") |
| 8609 | { |
| 8610 | int type; |
| 8611 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8612 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8613 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8614 | { |
| 8615 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8616 | return CMD_WARNING; |
| 8617 | } |
| 8618 | |
| 8619 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8620 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8621 | } |
| 8622 | |
| 8623 | DEFUN (bgp_redistribute_ipv4_metric, |
| 8624 | bgp_redistribute_ipv4_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8625 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8626 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8627 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8628 | "Metric for redistributed routes\n" |
| 8629 | "Default metric\n") |
| 8630 | { |
| 8631 | int type; |
| 8632 | u_int32_t metric; |
| 8633 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8634 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8635 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8636 | { |
| 8637 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8638 | return CMD_WARNING; |
| 8639 | } |
| 8640 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8641 | |
| 8642 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8643 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8644 | } |
| 8645 | |
| 8646 | DEFUN (bgp_redistribute_ipv4_rmap_metric, |
| 8647 | bgp_redistribute_ipv4_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8648 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8649 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8650 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8651 | "Route map reference\n" |
| 8652 | "Pointer to route-map entries\n" |
| 8653 | "Metric for redistributed routes\n" |
| 8654 | "Default metric\n") |
| 8655 | { |
| 8656 | int type; |
| 8657 | u_int32_t metric; |
| 8658 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8659 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8660 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8661 | { |
| 8662 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8663 | return CMD_WARNING; |
| 8664 | } |
| 8665 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8666 | |
| 8667 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8668 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8669 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8670 | } |
| 8671 | |
| 8672 | DEFUN (bgp_redistribute_ipv4_metric_rmap, |
| 8673 | bgp_redistribute_ipv4_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8674 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8675 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8676 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8677 | "Metric for redistributed routes\n" |
| 8678 | "Default metric\n" |
| 8679 | "Route map reference\n" |
| 8680 | "Pointer to route-map entries\n") |
| 8681 | { |
| 8682 | int type; |
| 8683 | u_int32_t metric; |
| 8684 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8685 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8686 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8687 | { |
| 8688 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8689 | return CMD_WARNING; |
| 8690 | } |
| 8691 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8692 | |
| 8693 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8694 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); |
| 8695 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8696 | } |
| 8697 | |
| 8698 | DEFUN (no_bgp_redistribute_ipv4, |
| 8699 | no_bgp_redistribute_ipv4_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8700 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8701 | NO_STR |
| 8702 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8703 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8704 | { |
| 8705 | int type; |
| 8706 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8707 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8708 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8709 | { |
| 8710 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8711 | return CMD_WARNING; |
| 8712 | } |
| 8713 | |
| 8714 | return bgp_redistribute_unset (vty->index, AFI_IP, type); |
| 8715 | } |
| 8716 | |
| 8717 | DEFUN (no_bgp_redistribute_ipv4_rmap, |
| 8718 | no_bgp_redistribute_ipv4_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8719 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8720 | NO_STR |
| 8721 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8722 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8723 | "Route map reference\n" |
| 8724 | "Pointer to route-map entries\n") |
| 8725 | { |
| 8726 | int type; |
| 8727 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8728 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8729 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8730 | { |
| 8731 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8732 | return CMD_WARNING; |
| 8733 | } |
| 8734 | |
| 8735 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8736 | return CMD_SUCCESS; |
| 8737 | } |
| 8738 | |
| 8739 | DEFUN (no_bgp_redistribute_ipv4_metric, |
| 8740 | no_bgp_redistribute_ipv4_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8741 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8742 | NO_STR |
| 8743 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8744 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8745 | "Metric for redistributed routes\n" |
| 8746 | "Default metric\n") |
| 8747 | { |
| 8748 | int type; |
| 8749 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8750 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8751 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8752 | { |
| 8753 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8754 | return CMD_WARNING; |
| 8755 | } |
| 8756 | |
| 8757 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8758 | return CMD_SUCCESS; |
| 8759 | } |
| 8760 | |
| 8761 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, |
| 8762 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8763 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8764 | NO_STR |
| 8765 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8766 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8767 | "Route map reference\n" |
| 8768 | "Pointer to route-map entries\n" |
| 8769 | "Metric for redistributed routes\n" |
| 8770 | "Default metric\n") |
| 8771 | { |
| 8772 | int type; |
| 8773 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8774 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8775 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8776 | { |
| 8777 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8778 | return CMD_WARNING; |
| 8779 | } |
| 8780 | |
| 8781 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8782 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8783 | return CMD_SUCCESS; |
| 8784 | } |
| 8785 | |
| 8786 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, |
| 8787 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8788 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8789 | NO_STR |
| 8790 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8791 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8792 | "Metric for redistributed routes\n" |
| 8793 | "Default metric\n" |
| 8794 | "Route map reference\n" |
| 8795 | "Pointer to route-map entries\n") |
| 8796 | |
| 8797 | #ifdef HAVE_IPV6 |
| 8798 | DEFUN (bgp_redistribute_ipv6, |
| 8799 | bgp_redistribute_ipv6_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8800 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8801 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8802 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8803 | { |
| 8804 | int type; |
| 8805 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8806 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8807 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8808 | { |
| 8809 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8810 | return CMD_WARNING; |
| 8811 | } |
| 8812 | |
| 8813 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8814 | } |
| 8815 | |
| 8816 | DEFUN (bgp_redistribute_ipv6_rmap, |
| 8817 | bgp_redistribute_ipv6_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8818 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8819 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8820 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8821 | "Route map reference\n" |
| 8822 | "Pointer to route-map entries\n") |
| 8823 | { |
| 8824 | int type; |
| 8825 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8826 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8827 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8828 | { |
| 8829 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8830 | return CMD_WARNING; |
| 8831 | } |
| 8832 | |
| 8833 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8834 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8835 | } |
| 8836 | |
| 8837 | DEFUN (bgp_redistribute_ipv6_metric, |
| 8838 | bgp_redistribute_ipv6_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8839 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8840 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8841 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8842 | "Metric for redistributed routes\n" |
| 8843 | "Default metric\n") |
| 8844 | { |
| 8845 | int type; |
| 8846 | u_int32_t metric; |
| 8847 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8848 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8849 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8850 | { |
| 8851 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8852 | return CMD_WARNING; |
| 8853 | } |
| 8854 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8855 | |
| 8856 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8857 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8858 | } |
| 8859 | |
| 8860 | DEFUN (bgp_redistribute_ipv6_rmap_metric, |
| 8861 | bgp_redistribute_ipv6_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8862 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8863 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8864 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8865 | "Route map reference\n" |
| 8866 | "Pointer to route-map entries\n" |
| 8867 | "Metric for redistributed routes\n" |
| 8868 | "Default metric\n") |
| 8869 | { |
| 8870 | int type; |
| 8871 | u_int32_t metric; |
| 8872 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8873 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8874 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8875 | { |
| 8876 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8877 | return CMD_WARNING; |
| 8878 | } |
| 8879 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8880 | |
| 8881 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8882 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8883 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8884 | } |
| 8885 | |
| 8886 | DEFUN (bgp_redistribute_ipv6_metric_rmap, |
| 8887 | bgp_redistribute_ipv6_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8888 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8889 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8890 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8891 | "Metric for redistributed routes\n" |
| 8892 | "Default metric\n" |
| 8893 | "Route map reference\n" |
| 8894 | "Pointer to route-map entries\n") |
| 8895 | { |
| 8896 | int type; |
| 8897 | u_int32_t metric; |
| 8898 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8899 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8900 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8901 | { |
| 8902 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8903 | return CMD_WARNING; |
| 8904 | } |
| 8905 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8906 | |
| 8907 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8908 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); |
| 8909 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8910 | } |
| 8911 | |
| 8912 | DEFUN (no_bgp_redistribute_ipv6, |
| 8913 | no_bgp_redistribute_ipv6_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8914 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8915 | NO_STR |
| 8916 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8917 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8918 | { |
| 8919 | int type; |
| 8920 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8921 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8922 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8923 | { |
| 8924 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8925 | return CMD_WARNING; |
| 8926 | } |
| 8927 | |
| 8928 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); |
| 8929 | } |
| 8930 | |
| 8931 | DEFUN (no_bgp_redistribute_ipv6_rmap, |
| 8932 | no_bgp_redistribute_ipv6_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8933 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8934 | NO_STR |
| 8935 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8936 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8937 | "Route map reference\n" |
| 8938 | "Pointer to route-map entries\n") |
| 8939 | { |
| 8940 | int type; |
| 8941 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8942 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8943 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8944 | { |
| 8945 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8946 | return CMD_WARNING; |
| 8947 | } |
| 8948 | |
| 8949 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8950 | return CMD_SUCCESS; |
| 8951 | } |
| 8952 | |
| 8953 | DEFUN (no_bgp_redistribute_ipv6_metric, |
| 8954 | no_bgp_redistribute_ipv6_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8955 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8956 | NO_STR |
| 8957 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8958 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8959 | "Metric for redistributed routes\n" |
| 8960 | "Default metric\n") |
| 8961 | { |
| 8962 | int type; |
| 8963 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8964 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8965 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8966 | { |
| 8967 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8968 | return CMD_WARNING; |
| 8969 | } |
| 8970 | |
| 8971 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8972 | return CMD_SUCCESS; |
| 8973 | } |
| 8974 | |
| 8975 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, |
| 8976 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8977 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8978 | NO_STR |
| 8979 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8980 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8981 | "Route map reference\n" |
| 8982 | "Pointer to route-map entries\n" |
| 8983 | "Metric for redistributed routes\n" |
| 8984 | "Default metric\n") |
| 8985 | { |
| 8986 | int type; |
| 8987 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8988 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8989 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8990 | { |
| 8991 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8992 | return CMD_WARNING; |
| 8993 | } |
| 8994 | |
| 8995 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8996 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8997 | return CMD_SUCCESS; |
| 8998 | } |
| 8999 | |
| 9000 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, |
| 9001 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 9002 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9003 | NO_STR |
| 9004 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 9005 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9006 | "Metric for redistributed routes\n" |
| 9007 | "Default metric\n" |
| 9008 | "Route map reference\n" |
| 9009 | "Pointer to route-map entries\n") |
| 9010 | #endif /* HAVE_IPV6 */ |
| 9011 | |
| 9012 | int |
| 9013 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 9014 | safi_t safi, int *write) |
| 9015 | { |
| 9016 | int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9017 | |
| 9018 | /* Unicast redistribution only. */ |
| 9019 | if (safi != SAFI_UNICAST) |
| 9020 | return 0; |
| 9021 | |
| 9022 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 9023 | { |
| 9024 | /* Redistribute BGP does not make sense. */ |
| 9025 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) |
| 9026 | { |
| 9027 | /* Display "address-family" when it is not yet diplayed. */ |
| 9028 | bgp_config_write_family_header (vty, afi, safi, write); |
| 9029 | |
| 9030 | /* "redistribute" configuration. */ |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 9031 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9032 | |
| 9033 | if (bgp->redist_metric_flag[afi][i]) |
Jorge Boncompte [DTI2] | ddc943d | 2012-04-13 13:46:07 +0200 | [diff] [blame] | 9034 | vty_out (vty, " metric %u", bgp->redist_metric[afi][i]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9035 | |
| 9036 | if (bgp->rmap[afi][i].name) |
| 9037 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); |
| 9038 | |
| 9039 | vty_out (vty, "%s", VTY_NEWLINE); |
| 9040 | } |
| 9041 | } |
| 9042 | return *write; |
| 9043 | } |
| 9044 | |
| 9045 | /* BGP node structure. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9046 | static struct cmd_node bgp_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9047 | { |
| 9048 | BGP_NODE, |
| 9049 | "%s(config-router)# ", |
| 9050 | 1, |
| 9051 | }; |
| 9052 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9053 | static struct cmd_node bgp_ipv4_unicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9054 | { |
| 9055 | BGP_IPV4_NODE, |
| 9056 | "%s(config-router-af)# ", |
| 9057 | 1, |
| 9058 | }; |
| 9059 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9060 | static struct cmd_node bgp_ipv4_multicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9061 | { |
| 9062 | BGP_IPV4M_NODE, |
| 9063 | "%s(config-router-af)# ", |
| 9064 | 1, |
| 9065 | }; |
| 9066 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9067 | static struct cmd_node bgp_ipv6_unicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9068 | { |
| 9069 | BGP_IPV6_NODE, |
| 9070 | "%s(config-router-af)# ", |
| 9071 | 1, |
| 9072 | }; |
| 9073 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9074 | static struct cmd_node bgp_ipv6_multicast_node = |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9075 | { |
| 9076 | BGP_IPV6M_NODE, |
| 9077 | "%s(config-router-af)# ", |
| 9078 | 1, |
| 9079 | }; |
| 9080 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9081 | static struct cmd_node bgp_vpnv4_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9082 | { |
| 9083 | BGP_VPNV4_NODE, |
| 9084 | "%s(config-router-af)# ", |
| 9085 | 1 |
| 9086 | }; |
| 9087 | |
paul | 1f8ae70 | 2005-09-09 23:49:49 +0000 | [diff] [blame] | 9088 | static void community_list_vty (void); |
| 9089 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9090 | void |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9091 | bgp_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9092 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9093 | /* Install bgp top node. */ |
| 9094 | install_node (&bgp_node, bgp_config_write); |
| 9095 | install_node (&bgp_ipv4_unicast_node, NULL); |
| 9096 | install_node (&bgp_ipv4_multicast_node, NULL); |
| 9097 | install_node (&bgp_ipv6_unicast_node, NULL); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9098 | install_node (&bgp_ipv6_multicast_node, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9099 | install_node (&bgp_vpnv4_node, NULL); |
| 9100 | |
| 9101 | /* Install default VTY commands to new nodes. */ |
| 9102 | install_default (BGP_NODE); |
| 9103 | install_default (BGP_IPV4_NODE); |
| 9104 | install_default (BGP_IPV4M_NODE); |
| 9105 | install_default (BGP_IPV6_NODE); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9106 | install_default (BGP_IPV6M_NODE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9107 | install_default (BGP_VPNV4_NODE); |
| 9108 | |
| 9109 | /* "bgp multiple-instance" commands. */ |
| 9110 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); |
| 9111 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); |
| 9112 | |
| 9113 | /* "bgp config-type" commands. */ |
| 9114 | install_element (CONFIG_NODE, &bgp_config_type_cmd); |
| 9115 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); |
| 9116 | |
| 9117 | /* Dummy commands (Currently not supported) */ |
| 9118 | install_element (BGP_NODE, &no_synchronization_cmd); |
| 9119 | install_element (BGP_NODE, &no_auto_summary_cmd); |
| 9120 | |
| 9121 | /* "router bgp" commands. */ |
| 9122 | install_element (CONFIG_NODE, &router_bgp_cmd); |
| 9123 | install_element (CONFIG_NODE, &router_bgp_view_cmd); |
| 9124 | |
| 9125 | /* "no router bgp" commands. */ |
| 9126 | install_element (CONFIG_NODE, &no_router_bgp_cmd); |
| 9127 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); |
| 9128 | |
| 9129 | /* "bgp router-id" commands. */ |
| 9130 | install_element (BGP_NODE, &bgp_router_id_cmd); |
| 9131 | install_element (BGP_NODE, &no_bgp_router_id_cmd); |
| 9132 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); |
| 9133 | |
| 9134 | /* "bgp cluster-id" commands. */ |
| 9135 | install_element (BGP_NODE, &bgp_cluster_id_cmd); |
| 9136 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); |
| 9137 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); |
| 9138 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); |
| 9139 | |
| 9140 | /* "bgp confederation" commands. */ |
| 9141 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); |
| 9142 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); |
| 9143 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); |
| 9144 | |
| 9145 | /* "bgp confederation peers" commands. */ |
| 9146 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); |
| 9147 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); |
| 9148 | |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 9149 | /* "maximum-paths" commands. */ |
| 9150 | install_element (BGP_NODE, &bgp_maxpaths_cmd); |
| 9151 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); |
| 9152 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); |
| 9153 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); |
| 9154 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); |
| 9155 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); |
| 9156 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
| 9157 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
| 9158 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
| 9159 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
| 9160 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
| 9161 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
| 9162 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9163 | /* "timers bgp" commands. */ |
| 9164 | install_element (BGP_NODE, &bgp_timers_cmd); |
| 9165 | install_element (BGP_NODE, &no_bgp_timers_cmd); |
| 9166 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); |
| 9167 | |
| 9168 | /* "bgp client-to-client reflection" commands */ |
| 9169 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); |
| 9170 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); |
| 9171 | |
| 9172 | /* "bgp always-compare-med" commands */ |
| 9173 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); |
| 9174 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); |
| 9175 | |
| 9176 | /* "bgp deterministic-med" commands */ |
| 9177 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); |
| 9178 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 9179 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 9180 | /* "bgp graceful-restart" commands */ |
| 9181 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); |
| 9182 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 9183 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
| 9184 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); |
| 9185 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9186 | |
| 9187 | /* "bgp fast-external-failover" commands */ |
| 9188 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); |
| 9189 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); |
| 9190 | |
| 9191 | /* "bgp enforce-first-as" commands */ |
| 9192 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); |
| 9193 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); |
| 9194 | |
| 9195 | /* "bgp bestpath compare-routerid" commands */ |
| 9196 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); |
| 9197 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); |
| 9198 | |
| 9199 | /* "bgp bestpath as-path ignore" commands */ |
| 9200 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); |
| 9201 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); |
| 9202 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 9203 | /* "bgp bestpath as-path confed" commands */ |
| 9204 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); |
| 9205 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); |
| 9206 | |
Pradosh Mohapatra | 2fdd455 | 2013-09-07 07:02:36 +0000 | [diff] [blame^] | 9207 | /* "bgp bestpath as-path multipath-relax" commands */ |
| 9208 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); |
| 9209 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); |
| 9210 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 9211 | /* "bgp log-neighbor-changes" commands */ |
| 9212 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); |
| 9213 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); |
| 9214 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9215 | /* "bgp bestpath med" commands */ |
| 9216 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); |
| 9217 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); |
| 9218 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); |
| 9219 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); |
| 9220 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); |
| 9221 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); |
| 9222 | |
| 9223 | /* "no bgp default ipv4-unicast" commands. */ |
| 9224 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); |
| 9225 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); |
| 9226 | |
| 9227 | /* "bgp network import-check" commands. */ |
| 9228 | install_element (BGP_NODE, &bgp_network_import_check_cmd); |
| 9229 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
| 9230 | |
| 9231 | /* "bgp default local-preference" commands. */ |
| 9232 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); |
| 9233 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); |
| 9234 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); |
| 9235 | |
| 9236 | /* "neighbor remote-as" commands. */ |
| 9237 | install_element (BGP_NODE, &neighbor_remote_as_cmd); |
| 9238 | install_element (BGP_NODE, &no_neighbor_cmd); |
| 9239 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); |
| 9240 | |
| 9241 | /* "neighbor peer-group" commands. */ |
| 9242 | install_element (BGP_NODE, &neighbor_peer_group_cmd); |
| 9243 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); |
| 9244 | install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd); |
| 9245 | |
| 9246 | /* "neighbor local-as" commands. */ |
| 9247 | install_element (BGP_NODE, &neighbor_local_as_cmd); |
| 9248 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 9249 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9250 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
| 9251 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); |
| 9252 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 9253 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9254 | |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 9255 | /* "neighbor password" commands. */ |
| 9256 | install_element (BGP_NODE, &neighbor_password_cmd); |
| 9257 | install_element (BGP_NODE, &no_neighbor_password_cmd); |
| 9258 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9259 | /* "neighbor activate" commands. */ |
| 9260 | install_element (BGP_NODE, &neighbor_activate_cmd); |
| 9261 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); |
| 9262 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); |
| 9263 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9264 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9265 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
| 9266 | |
| 9267 | /* "no neighbor activate" commands. */ |
| 9268 | install_element (BGP_NODE, &no_neighbor_activate_cmd); |
| 9269 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); |
| 9270 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); |
| 9271 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9272 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9273 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
| 9274 | |
| 9275 | /* "neighbor peer-group set" commands. */ |
| 9276 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
| 9277 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); |
| 9278 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); |
| 9279 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9280 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9281 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
| 9282 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9283 | /* "no neighbor peer-group unset" commands. */ |
| 9284 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); |
| 9285 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 9286 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); |
| 9287 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9288 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9289 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 9290 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9291 | /* "neighbor softreconfiguration inbound" commands.*/ |
| 9292 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9293 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9294 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9295 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9296 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9297 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9298 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9299 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9300 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9301 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9302 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9303 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9304 | |
| 9305 | /* "neighbor attribute-unchanged" commands. */ |
| 9306 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); |
| 9307 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); |
| 9308 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); |
| 9309 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); |
| 9310 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); |
| 9311 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); |
| 9312 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); |
| 9313 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); |
| 9314 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); |
| 9315 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); |
| 9316 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); |
| 9317 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9318 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9319 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9320 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9321 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9322 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9323 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9324 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9325 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9326 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9327 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9328 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); |
| 9329 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 9330 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 9331 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 9332 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 9333 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 9334 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 9335 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 9336 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 9337 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 9338 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 9339 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9340 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9341 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9342 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9343 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9344 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9345 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9346 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9347 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9348 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9349 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9350 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); |
| 9351 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); |
| 9352 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); |
| 9353 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); |
| 9354 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); |
| 9355 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); |
| 9356 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); |
| 9357 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); |
| 9358 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); |
| 9359 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); |
| 9360 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); |
| 9361 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9362 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9363 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9364 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9365 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9366 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9367 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9368 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9369 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9370 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9371 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9372 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); |
| 9373 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); |
| 9374 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); |
| 9375 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); |
| 9376 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); |
| 9377 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); |
| 9378 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); |
| 9379 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); |
| 9380 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); |
| 9381 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); |
| 9382 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); |
| 9383 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9384 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9385 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9386 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9387 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9388 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9389 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9390 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9391 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9392 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9393 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9394 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
| 9395 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); |
| 9396 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); |
| 9397 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); |
| 9398 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); |
| 9399 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); |
| 9400 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); |
| 9401 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); |
| 9402 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); |
| 9403 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); |
| 9404 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); |
| 9405 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9406 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9407 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9408 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9409 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9410 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9411 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9412 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9413 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9414 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9415 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9416 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
| 9417 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 9418 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 9419 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 9420 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 9421 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 9422 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 9423 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 9424 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 9425 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 9426 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 9427 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9428 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9429 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9430 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9431 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9432 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9433 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9434 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9435 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9436 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9437 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9438 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9439 | /* "nexthop-local unchanged" commands */ |
| 9440 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); |
| 9441 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); |
| 9442 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9443 | /* "transparent-as" and "transparent-nexthop" for old version |
| 9444 | compatibility. */ |
| 9445 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); |
| 9446 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); |
| 9447 | |
| 9448 | /* "neighbor next-hop-self" commands. */ |
| 9449 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); |
| 9450 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); |
| 9451 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); |
| 9452 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 9453 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); |
| 9454 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); |
| 9455 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); |
| 9456 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9457 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
| 9458 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9459 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
| 9460 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 9461 | |
| 9462 | /* "neighbor remove-private-AS" commands. */ |
| 9463 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); |
| 9464 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); |
| 9465 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
| 9466 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 9467 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
| 9468 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); |
| 9469 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
| 9470 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9471 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
| 9472 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9473 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
| 9474 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 9475 | |
| 9476 | /* "neighbor send-community" commands.*/ |
| 9477 | install_element (BGP_NODE, &neighbor_send_community_cmd); |
| 9478 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); |
| 9479 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); |
| 9480 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); |
| 9481 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); |
| 9482 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); |
| 9483 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); |
| 9484 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); |
| 9485 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); |
| 9486 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); |
| 9487 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); |
| 9488 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); |
| 9489 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); |
| 9490 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); |
| 9491 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); |
| 9492 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9493 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
| 9494 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); |
| 9495 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); |
| 9496 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9497 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
| 9498 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); |
| 9499 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); |
| 9500 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); |
| 9501 | |
| 9502 | /* "neighbor route-reflector" commands.*/ |
| 9503 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); |
| 9504 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9505 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); |
| 9506 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9507 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); |
| 9508 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9509 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); |
| 9510 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9511 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
| 9512 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9513 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
| 9514 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9515 | |
| 9516 | /* "neighbor route-server" commands.*/ |
| 9517 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); |
| 9518 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); |
| 9519 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); |
| 9520 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9521 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); |
| 9522 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); |
| 9523 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); |
| 9524 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9525 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
| 9526 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9527 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
| 9528 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9529 | |
| 9530 | /* "neighbor passive" commands. */ |
| 9531 | install_element (BGP_NODE, &neighbor_passive_cmd); |
| 9532 | install_element (BGP_NODE, &no_neighbor_passive_cmd); |
| 9533 | |
| 9534 | /* "neighbor shutdown" commands. */ |
| 9535 | install_element (BGP_NODE, &neighbor_shutdown_cmd); |
| 9536 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); |
| 9537 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 9538 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9539 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
| 9540 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); |
| 9541 | |
| 9542 | /* "neighbor capability orf prefix-list" commands.*/ |
| 9543 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9544 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9545 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9546 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9547 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9548 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9549 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9550 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9551 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9552 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9553 | |
| 9554 | /* "neighbor capability dynamic" commands.*/ |
| 9555 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); |
| 9556 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); |
| 9557 | |
| 9558 | /* "neighbor dont-capability-negotiate" commands. */ |
| 9559 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); |
| 9560 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); |
| 9561 | |
| 9562 | /* "neighbor ebgp-multihop" commands. */ |
| 9563 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); |
| 9564 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); |
| 9565 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); |
| 9566 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); |
| 9567 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 9568 | /* "neighbor disable-connected-check" commands. */ |
| 9569 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); |
| 9570 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9571 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
| 9572 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); |
| 9573 | |
| 9574 | /* "neighbor description" commands. */ |
| 9575 | install_element (BGP_NODE, &neighbor_description_cmd); |
| 9576 | install_element (BGP_NODE, &no_neighbor_description_cmd); |
| 9577 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); |
| 9578 | |
| 9579 | /* "neighbor update-source" commands. "*/ |
| 9580 | install_element (BGP_NODE, &neighbor_update_source_cmd); |
| 9581 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); |
| 9582 | |
| 9583 | /* "neighbor default-originate" commands. */ |
| 9584 | install_element (BGP_NODE, &neighbor_default_originate_cmd); |
| 9585 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); |
| 9586 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); |
| 9587 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9588 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); |
| 9589 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); |
| 9590 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); |
| 9591 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9592 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); |
| 9593 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9594 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); |
| 9595 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9596 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); |
| 9597 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); |
| 9598 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); |
| 9599 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9600 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
| 9601 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9602 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); |
| 9603 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9604 | |
| 9605 | /* "neighbor port" commands. */ |
| 9606 | install_element (BGP_NODE, &neighbor_port_cmd); |
| 9607 | install_element (BGP_NODE, &no_neighbor_port_cmd); |
| 9608 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); |
| 9609 | |
| 9610 | /* "neighbor weight" commands. */ |
| 9611 | install_element (BGP_NODE, &neighbor_weight_cmd); |
| 9612 | install_element (BGP_NODE, &no_neighbor_weight_cmd); |
| 9613 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); |
| 9614 | |
| 9615 | /* "neighbor override-capability" commands. */ |
| 9616 | install_element (BGP_NODE, &neighbor_override_capability_cmd); |
| 9617 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); |
| 9618 | |
| 9619 | /* "neighbor strict-capability-match" commands. */ |
| 9620 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); |
| 9621 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); |
| 9622 | |
| 9623 | /* "neighbor timers" commands. */ |
| 9624 | install_element (BGP_NODE, &neighbor_timers_cmd); |
| 9625 | install_element (BGP_NODE, &no_neighbor_timers_cmd); |
| 9626 | |
| 9627 | /* "neighbor timers connect" commands. */ |
| 9628 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); |
| 9629 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); |
| 9630 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); |
| 9631 | |
| 9632 | /* "neighbor advertisement-interval" commands. */ |
| 9633 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); |
| 9634 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); |
| 9635 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); |
| 9636 | |
| 9637 | /* "neighbor version" commands. */ |
| 9638 | install_element (BGP_NODE, &neighbor_version_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9639 | |
| 9640 | /* "neighbor interface" commands. */ |
| 9641 | install_element (BGP_NODE, &neighbor_interface_cmd); |
| 9642 | install_element (BGP_NODE, &no_neighbor_interface_cmd); |
| 9643 | |
| 9644 | /* "neighbor distribute" commands. */ |
| 9645 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); |
| 9646 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); |
| 9647 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); |
| 9648 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9649 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); |
| 9650 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); |
| 9651 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); |
| 9652 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9653 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
| 9654 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9655 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
| 9656 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9657 | |
| 9658 | /* "neighbor prefix-list" commands. */ |
| 9659 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); |
| 9660 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); |
| 9661 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); |
| 9662 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9663 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); |
| 9664 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); |
| 9665 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); |
| 9666 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9667 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
| 9668 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9669 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
| 9670 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9671 | |
| 9672 | /* "neighbor filter-list" commands. */ |
| 9673 | install_element (BGP_NODE, &neighbor_filter_list_cmd); |
| 9674 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); |
| 9675 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); |
| 9676 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); |
| 9677 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); |
| 9678 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); |
| 9679 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); |
| 9680 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9681 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
| 9682 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9683 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
| 9684 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); |
| 9685 | |
| 9686 | /* "neighbor route-map" commands. */ |
| 9687 | install_element (BGP_NODE, &neighbor_route_map_cmd); |
| 9688 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); |
| 9689 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); |
| 9690 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); |
| 9691 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); |
| 9692 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); |
| 9693 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); |
| 9694 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9695 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
| 9696 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9697 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
| 9698 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); |
| 9699 | |
| 9700 | /* "neighbor unsuppress-map" commands. */ |
| 9701 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); |
| 9702 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9703 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9704 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9705 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); |
| 9706 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9707 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); |
| 9708 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9709 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
| 9710 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9711 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9712 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9713 | |
| 9714 | /* "neighbor maximum-prefix" commands. */ |
| 9715 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9716 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9717 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9718 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9719 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9720 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9721 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9722 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9723 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9724 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9725 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9726 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9727 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9728 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9729 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9730 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9731 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9732 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9733 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9734 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9735 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9736 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9737 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9738 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9739 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9740 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9741 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9742 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9743 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9744 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9745 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9746 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9747 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9748 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9749 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9750 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9751 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9752 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9753 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9754 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9755 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9756 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9757 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9758 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9759 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9760 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9761 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9762 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9763 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9764 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9765 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9766 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9767 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
| 9768 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
| 9769 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); |
| 9770 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
| 9771 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9772 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
| 9773 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9774 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
| 9775 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9776 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9777 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9778 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9779 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9780 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9781 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9782 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9783 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9784 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9785 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9786 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9787 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9788 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9789 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9790 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9791 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9792 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9793 | |
| 9794 | /* "neighbor allowas-in" */ |
| 9795 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); |
| 9796 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); |
| 9797 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); |
| 9798 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
| 9799 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9800 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9801 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
| 9802 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9803 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); |
| 9804 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
| 9805 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); |
| 9806 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9807 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
| 9808 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9809 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9810 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
| 9811 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9812 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9813 | |
| 9814 | /* address-family commands. */ |
| 9815 | install_element (BGP_NODE, &address_family_ipv4_cmd); |
| 9816 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); |
| 9817 | #ifdef HAVE_IPV6 |
| 9818 | install_element (BGP_NODE, &address_family_ipv6_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9819 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9820 | #endif /* HAVE_IPV6 */ |
| 9821 | install_element (BGP_NODE, &address_family_vpnv4_cmd); |
| 9822 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); |
| 9823 | |
| 9824 | /* "exit-address-family" command. */ |
| 9825 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); |
| 9826 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); |
| 9827 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9828 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9829 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
| 9830 | |
| 9831 | /* "clear ip bgp commands" */ |
| 9832 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); |
| 9833 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); |
| 9834 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); |
| 9835 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
| 9836 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
| 9837 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
| 9838 | #ifdef HAVE_IPV6 |
| 9839 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
| 9840 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); |
| 9841 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); |
| 9842 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
| 9843 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
| 9844 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
| 9845 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
| 9846 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
| 9847 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
| 9848 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
| 9849 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
| 9850 | #endif /* HAVE_IPV6 */ |
| 9851 | |
| 9852 | /* "clear ip bgp neighbor soft in" */ |
| 9853 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); |
| 9854 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); |
| 9855 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); |
| 9856 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
| 9857 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); |
| 9858 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
| 9859 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
| 9860 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
| 9861 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); |
| 9862 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
| 9863 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
| 9864 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); |
| 9865 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
| 9866 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
| 9867 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); |
| 9868 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
| 9869 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
| 9870 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); |
| 9871 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); |
| 9872 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); |
| 9873 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
| 9874 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); |
| 9875 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
| 9876 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
| 9877 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
| 9878 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); |
| 9879 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
| 9880 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
| 9881 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); |
| 9882 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
| 9883 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
| 9884 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); |
| 9885 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
| 9886 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
| 9887 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); |
| 9888 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); |
| 9889 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); |
| 9890 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); |
| 9891 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); |
| 9892 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); |
| 9893 | #ifdef HAVE_IPV6 |
| 9894 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
| 9895 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); |
| 9896 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); |
| 9897 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
| 9898 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); |
| 9899 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
| 9900 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
| 9901 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); |
| 9902 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
| 9903 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
| 9904 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); |
| 9905 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
| 9906 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
| 9907 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); |
| 9908 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
| 9909 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
| 9910 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); |
| 9911 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
| 9912 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
| 9913 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); |
| 9914 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
| 9915 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
| 9916 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); |
| 9917 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
| 9918 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
| 9919 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); |
| 9920 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
| 9921 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
| 9922 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); |
| 9923 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
| 9924 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
| 9925 | #endif /* HAVE_IPV6 */ |
| 9926 | |
| 9927 | /* "clear ip bgp neighbor soft out" */ |
| 9928 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); |
| 9929 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); |
| 9930 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); |
| 9931 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
| 9932 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
| 9933 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
| 9934 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
| 9935 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
| 9936 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
| 9937 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
| 9938 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
| 9939 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
| 9940 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); |
| 9941 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); |
| 9942 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
| 9943 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
| 9944 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
| 9945 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
| 9946 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
| 9947 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
| 9948 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
| 9949 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
| 9950 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
| 9951 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); |
| 9952 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); |
| 9953 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); |
| 9954 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); |
| 9955 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); |
| 9956 | #ifdef HAVE_IPV6 |
| 9957 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
| 9958 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); |
| 9959 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); |
| 9960 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
| 9961 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
| 9962 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
| 9963 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
| 9964 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
| 9965 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
| 9966 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
| 9967 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
| 9968 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
| 9969 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
| 9970 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
| 9971 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
| 9972 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
| 9973 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
| 9974 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
| 9975 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
| 9976 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
| 9977 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
| 9978 | #endif /* HAVE_IPV6 */ |
| 9979 | |
| 9980 | /* "clear ip bgp neighbor soft" */ |
| 9981 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); |
| 9982 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); |
| 9983 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); |
| 9984 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
| 9985 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
| 9986 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
| 9987 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
| 9988 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); |
| 9989 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); |
| 9990 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
| 9991 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
| 9992 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
| 9993 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
| 9994 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); |
| 9995 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); |
| 9996 | #ifdef HAVE_IPV6 |
| 9997 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
| 9998 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); |
| 9999 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); |
| 10000 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
| 10001 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
| 10002 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
| 10003 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
| 10004 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
| 10005 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
| 10006 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
| 10007 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
| 10008 | #endif /* HAVE_IPV6 */ |
| 10009 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10010 | /* "clear ip bgp neighbor rsclient" */ |
| 10011 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); |
| 10012 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); |
| 10013 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); |
| 10014 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); |
| 10015 | #ifdef HAVE_IPV6 |
| 10016 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); |
| 10017 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); |
| 10018 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); |
| 10019 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); |
| 10020 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); |
| 10021 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); |
| 10022 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); |
| 10023 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); |
| 10024 | #endif /* HAVE_IPV6 */ |
| 10025 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10026 | /* "show ip bgp summary" commands. */ |
| 10027 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); |
| 10028 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
| 10029 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10030 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10031 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10032 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10033 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 10034 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 10035 | #ifdef HAVE_IPV6 |
| 10036 | install_element (VIEW_NODE, &show_bgp_summary_cmd); |
| 10037 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); |
| 10038 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10039 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10040 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10041 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10042 | #endif /* HAVE_IPV6 */ |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10043 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); |
| 10044 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
| 10045 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10046 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10047 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10048 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10049 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 10050 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 10051 | #ifdef HAVE_IPV6 |
| 10052 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); |
| 10053 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); |
| 10054 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10055 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10056 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10057 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10058 | #endif /* HAVE_IPV6 */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10059 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); |
| 10060 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
| 10061 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10062 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10063 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10064 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10065 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 10066 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 10067 | #ifdef HAVE_IPV6 |
| 10068 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); |
| 10069 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); |
| 10070 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10071 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10072 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10073 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10074 | #endif /* HAVE_IPV6 */ |
| 10075 | |
| 10076 | /* "show ip bgp neighbors" commands. */ |
| 10077 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); |
| 10078 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 10079 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10080 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10081 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 10082 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 10083 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10084 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10085 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 10086 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10087 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10088 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10089 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10090 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10091 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10092 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
| 10093 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 10094 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10095 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10096 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 10097 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 10098 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10099 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10100 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 10101 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 10102 | |
| 10103 | #ifdef HAVE_IPV6 |
| 10104 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); |
| 10105 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 10106 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); |
| 10107 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 10108 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
| 10109 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 10110 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10111 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10112 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
| 10113 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
| 10114 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10115 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10116 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
| 10117 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 10118 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); |
| 10119 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 10120 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
| 10121 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 10122 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10123 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10124 | |
| 10125 | /* Old commands. */ |
| 10126 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); |
| 10127 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); |
| 10128 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); |
| 10129 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); |
| 10130 | #endif /* HAVE_IPV6 */ |
| 10131 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10132 | /* "show ip bgp rsclient" commands. */ |
| 10133 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10134 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10135 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10136 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10137 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10138 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10139 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10140 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10141 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10142 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10143 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10144 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10145 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10146 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10147 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10148 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10149 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10150 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10151 | |
| 10152 | #ifdef HAVE_IPV6 |
| 10153 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); |
| 10154 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10155 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10156 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10157 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10158 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10159 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
| 10160 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10161 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10162 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10163 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10164 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10165 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
| 10166 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10167 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10168 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10169 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10170 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10171 | #endif /* HAVE_IPV6 */ |
| 10172 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10173 | /* "show ip bgp paths" commands. */ |
| 10174 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); |
| 10175 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 10176 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); |
| 10177 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 10178 | |
| 10179 | /* "show ip bgp community" commands. */ |
| 10180 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); |
| 10181 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); |
| 10182 | |
| 10183 | /* "show ip bgp attribute-info" commands. */ |
| 10184 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); |
| 10185 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); |
| 10186 | |
| 10187 | /* "redistribute" commands. */ |
| 10188 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); |
| 10189 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); |
| 10190 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); |
| 10191 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); |
| 10192 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); |
| 10193 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); |
| 10194 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); |
| 10195 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); |
| 10196 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); |
| 10197 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); |
| 10198 | #ifdef HAVE_IPV6 |
| 10199 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); |
| 10200 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); |
| 10201 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); |
| 10202 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); |
| 10203 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); |
| 10204 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); |
| 10205 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); |
| 10206 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); |
| 10207 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); |
| 10208 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); |
| 10209 | #endif /* HAVE_IPV6 */ |
| 10210 | |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 10211 | /* ttl_security commands */ |
| 10212 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); |
| 10213 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); |
| 10214 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 10215 | /* "show bgp memory" commands. */ |
| 10216 | install_element (VIEW_NODE, &show_bgp_memory_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10217 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 10218 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
| 10219 | |
Michael Lambert | e0081f7 | 2008-11-16 20:12:04 +0000 | [diff] [blame] | 10220 | /* "show bgp views" commands. */ |
| 10221 | install_element (VIEW_NODE, &show_bgp_views_cmd); |
| 10222 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); |
| 10223 | install_element (ENABLE_NODE, &show_bgp_views_cmd); |
| 10224 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10225 | /* Community-list. */ |
| 10226 | community_list_vty (); |
| 10227 | } |
| 10228 | |
| 10229 | #include "memory.h" |
| 10230 | #include "bgp_regex.h" |
| 10231 | #include "bgp_clist.h" |
| 10232 | #include "bgp_ecommunity.h" |
| 10233 | |
| 10234 | /* VTY functions. */ |
| 10235 | |
| 10236 | /* Direction value to string conversion. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10237 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10238 | community_direct_str (int direct) |
| 10239 | { |
| 10240 | switch (direct) |
| 10241 | { |
| 10242 | case COMMUNITY_DENY: |
| 10243 | return "deny"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10244 | case COMMUNITY_PERMIT: |
| 10245 | return "permit"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10246 | default: |
| 10247 | return "unknown"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10248 | } |
| 10249 | } |
| 10250 | |
| 10251 | /* Display error string. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10252 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10253 | community_list_perror (struct vty *vty, int ret) |
| 10254 | { |
| 10255 | switch (ret) |
| 10256 | { |
| 10257 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10258 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10259 | break; |
| 10260 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: |
| 10261 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); |
| 10262 | break; |
| 10263 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: |
| 10264 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); |
| 10265 | break; |
| 10266 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: |
| 10267 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); |
| 10268 | break; |
| 10269 | } |
| 10270 | } |
| 10271 | |
| 10272 | /* VTY interface for community_set() function. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10273 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10274 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10275 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10276 | { |
| 10277 | int ret; |
| 10278 | int direct; |
| 10279 | char *str; |
| 10280 | |
| 10281 | /* Check the list type. */ |
| 10282 | if (strncmp (argv[1], "p", 1) == 0) |
| 10283 | direct = COMMUNITY_PERMIT; |
| 10284 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10285 | direct = COMMUNITY_DENY; |
| 10286 | else |
| 10287 | { |
| 10288 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10289 | VTY_NEWLINE); |
| 10290 | return CMD_WARNING; |
| 10291 | } |
| 10292 | |
| 10293 | /* All digit name check. */ |
| 10294 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10295 | { |
| 10296 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10297 | return CMD_WARNING; |
| 10298 | } |
| 10299 | |
| 10300 | /* Concat community string argument. */ |
| 10301 | if (argc > 1) |
| 10302 | str = argv_concat (argv, argc, 2); |
| 10303 | else |
| 10304 | str = NULL; |
| 10305 | |
| 10306 | /* When community_list_set() return nevetive value, it means |
| 10307 | malformed community string. */ |
| 10308 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); |
| 10309 | |
| 10310 | /* Free temporary community list string allocated by |
| 10311 | argv_concat(). */ |
| 10312 | if (str) |
| 10313 | XFREE (MTYPE_TMP, str); |
| 10314 | |
| 10315 | if (ret < 0) |
| 10316 | { |
| 10317 | /* Display error string. */ |
| 10318 | community_list_perror (vty, ret); |
| 10319 | return CMD_WARNING; |
| 10320 | } |
| 10321 | |
| 10322 | return CMD_SUCCESS; |
| 10323 | } |
| 10324 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10325 | /* Communiyt-list entry delete. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10326 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10327 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10328 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10329 | { |
| 10330 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10331 | int direct = 0; |
| 10332 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10333 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10334 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10335 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10336 | /* Check the list direct. */ |
| 10337 | if (strncmp (argv[1], "p", 1) == 0) |
| 10338 | direct = COMMUNITY_PERMIT; |
| 10339 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10340 | direct = COMMUNITY_DENY; |
| 10341 | else |
| 10342 | { |
| 10343 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10344 | VTY_NEWLINE); |
| 10345 | return CMD_WARNING; |
| 10346 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10347 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10348 | /* Concat community string argument. */ |
| 10349 | str = argv_concat (argv, argc, 2); |
| 10350 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10351 | |
| 10352 | /* Unset community list. */ |
| 10353 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10354 | |
| 10355 | /* Free temporary community list string allocated by |
| 10356 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10357 | if (str) |
| 10358 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10359 | |
| 10360 | if (ret < 0) |
| 10361 | { |
| 10362 | community_list_perror (vty, ret); |
| 10363 | return CMD_WARNING; |
| 10364 | } |
| 10365 | |
| 10366 | return CMD_SUCCESS; |
| 10367 | } |
| 10368 | |
| 10369 | /* "community-list" keyword help string. */ |
| 10370 | #define COMMUNITY_LIST_STR "Add a community list entry\n" |
| 10371 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" |
| 10372 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10373 | DEFUN (ip_community_list_standard, |
| 10374 | ip_community_list_standard_cmd, |
| 10375 | "ip community-list <1-99> (deny|permit) .AA:NN", |
| 10376 | IP_STR |
| 10377 | COMMUNITY_LIST_STR |
| 10378 | "Community list number (standard)\n" |
| 10379 | "Specify community to reject\n" |
| 10380 | "Specify community to accept\n" |
| 10381 | COMMUNITY_VAL_STR) |
| 10382 | { |
| 10383 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
| 10384 | } |
| 10385 | |
| 10386 | ALIAS (ip_community_list_standard, |
| 10387 | ip_community_list_standard2_cmd, |
| 10388 | "ip community-list <1-99> (deny|permit)", |
| 10389 | IP_STR |
| 10390 | COMMUNITY_LIST_STR |
| 10391 | "Community list number (standard)\n" |
| 10392 | "Specify community to reject\n" |
| 10393 | "Specify community to accept\n") |
| 10394 | |
| 10395 | DEFUN (ip_community_list_expanded, |
| 10396 | ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10397 | "ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10398 | IP_STR |
| 10399 | COMMUNITY_LIST_STR |
| 10400 | "Community list number (expanded)\n" |
| 10401 | "Specify community to reject\n" |
| 10402 | "Specify community to accept\n" |
| 10403 | "An ordered list as a regular-expression\n") |
| 10404 | { |
| 10405 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
| 10406 | } |
| 10407 | |
| 10408 | DEFUN (ip_community_list_name_standard, |
| 10409 | ip_community_list_name_standard_cmd, |
| 10410 | "ip community-list standard WORD (deny|permit) .AA:NN", |
| 10411 | IP_STR |
| 10412 | COMMUNITY_LIST_STR |
| 10413 | "Add a standard community-list entry\n" |
| 10414 | "Community list name\n" |
| 10415 | "Specify community to reject\n" |
| 10416 | "Specify community to accept\n" |
| 10417 | COMMUNITY_VAL_STR) |
| 10418 | { |
| 10419 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
| 10420 | } |
| 10421 | |
| 10422 | ALIAS (ip_community_list_name_standard, |
| 10423 | ip_community_list_name_standard2_cmd, |
| 10424 | "ip community-list standard WORD (deny|permit)", |
| 10425 | IP_STR |
| 10426 | COMMUNITY_LIST_STR |
| 10427 | "Add a standard community-list entry\n" |
| 10428 | "Community list name\n" |
| 10429 | "Specify community to reject\n" |
| 10430 | "Specify community to accept\n") |
| 10431 | |
| 10432 | DEFUN (ip_community_list_name_expanded, |
| 10433 | ip_community_list_name_expanded_cmd, |
| 10434 | "ip community-list expanded WORD (deny|permit) .LINE", |
| 10435 | IP_STR |
| 10436 | COMMUNITY_LIST_STR |
| 10437 | "Add an expanded community-list entry\n" |
| 10438 | "Community list name\n" |
| 10439 | "Specify community to reject\n" |
| 10440 | "Specify community to accept\n" |
| 10441 | "An ordered list as a regular-expression\n") |
| 10442 | { |
| 10443 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
| 10444 | } |
| 10445 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10446 | DEFUN (no_ip_community_list_standard_all, |
| 10447 | no_ip_community_list_standard_all_cmd, |
| 10448 | "no ip community-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10449 | NO_STR |
| 10450 | IP_STR |
| 10451 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10452 | "Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10453 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10454 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10455 | } |
| 10456 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10457 | DEFUN (no_ip_community_list_expanded_all, |
| 10458 | no_ip_community_list_expanded_all_cmd, |
| 10459 | "no ip community-list <100-500>", |
| 10460 | NO_STR |
| 10461 | IP_STR |
| 10462 | COMMUNITY_LIST_STR |
| 10463 | "Community list number (expanded)\n") |
| 10464 | { |
| 10465 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10466 | } |
| 10467 | |
| 10468 | DEFUN (no_ip_community_list_name_standard_all, |
| 10469 | no_ip_community_list_name_standard_all_cmd, |
| 10470 | "no ip community-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10471 | NO_STR |
| 10472 | IP_STR |
| 10473 | COMMUNITY_LIST_STR |
| 10474 | "Add a standard community-list entry\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10475 | "Community list name\n") |
| 10476 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10477 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10478 | } |
| 10479 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10480 | DEFUN (no_ip_community_list_name_expanded_all, |
| 10481 | no_ip_community_list_name_expanded_all_cmd, |
| 10482 | "no ip community-list expanded WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10483 | NO_STR |
| 10484 | IP_STR |
| 10485 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10486 | "Add an expanded community-list entry\n" |
| 10487 | "Community list name\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10488 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10489 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10490 | } |
| 10491 | |
| 10492 | DEFUN (no_ip_community_list_standard, |
| 10493 | no_ip_community_list_standard_cmd, |
| 10494 | "no ip community-list <1-99> (deny|permit) .AA:NN", |
| 10495 | NO_STR |
| 10496 | IP_STR |
| 10497 | COMMUNITY_LIST_STR |
| 10498 | "Community list number (standard)\n" |
| 10499 | "Specify community to reject\n" |
| 10500 | "Specify community to accept\n" |
| 10501 | COMMUNITY_VAL_STR) |
| 10502 | { |
| 10503 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 10504 | } |
| 10505 | |
| 10506 | DEFUN (no_ip_community_list_expanded, |
| 10507 | no_ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10508 | "no ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10509 | NO_STR |
| 10510 | IP_STR |
| 10511 | COMMUNITY_LIST_STR |
| 10512 | "Community list number (expanded)\n" |
| 10513 | "Specify community to reject\n" |
| 10514 | "Specify community to accept\n" |
| 10515 | "An ordered list as a regular-expression\n") |
| 10516 | { |
| 10517 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10518 | } |
| 10519 | |
| 10520 | DEFUN (no_ip_community_list_name_standard, |
| 10521 | no_ip_community_list_name_standard_cmd, |
| 10522 | "no ip community-list standard WORD (deny|permit) .AA:NN", |
| 10523 | NO_STR |
| 10524 | IP_STR |
| 10525 | COMMUNITY_LIST_STR |
| 10526 | "Specify a standard community-list\n" |
| 10527 | "Community list name\n" |
| 10528 | "Specify community to reject\n" |
| 10529 | "Specify community to accept\n" |
| 10530 | COMMUNITY_VAL_STR) |
| 10531 | { |
| 10532 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 10533 | } |
| 10534 | |
| 10535 | DEFUN (no_ip_community_list_name_expanded, |
| 10536 | no_ip_community_list_name_expanded_cmd, |
| 10537 | "no ip community-list expanded WORD (deny|permit) .LINE", |
| 10538 | NO_STR |
| 10539 | IP_STR |
| 10540 | COMMUNITY_LIST_STR |
| 10541 | "Specify an expanded community-list\n" |
| 10542 | "Community list name\n" |
| 10543 | "Specify community to reject\n" |
| 10544 | "Specify community to accept\n" |
| 10545 | "An ordered list as a regular-expression\n") |
| 10546 | { |
| 10547 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10548 | } |
| 10549 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10550 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10551 | community_list_show (struct vty *vty, struct community_list *list) |
| 10552 | { |
| 10553 | struct community_entry *entry; |
| 10554 | |
| 10555 | for (entry = list->head; entry; entry = entry->next) |
| 10556 | { |
| 10557 | if (entry == list->head) |
| 10558 | { |
| 10559 | if (all_digit (list->name)) |
| 10560 | vty_out (vty, "Community %s list %s%s", |
| 10561 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 10562 | "standard" : "(expanded) access", |
| 10563 | list->name, VTY_NEWLINE); |
| 10564 | else |
| 10565 | vty_out (vty, "Named Community %s list %s%s", |
| 10566 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 10567 | "standard" : "expanded", |
| 10568 | list->name, VTY_NEWLINE); |
| 10569 | } |
| 10570 | if (entry->any) |
| 10571 | vty_out (vty, " %s%s", |
| 10572 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10573 | else |
| 10574 | vty_out (vty, " %s %s%s", |
| 10575 | community_direct_str (entry->direct), |
| 10576 | entry->style == COMMUNITY_LIST_STANDARD |
| 10577 | ? community_str (entry->u.com) : entry->config, |
| 10578 | VTY_NEWLINE); |
| 10579 | } |
| 10580 | } |
| 10581 | |
| 10582 | DEFUN (show_ip_community_list, |
| 10583 | show_ip_community_list_cmd, |
| 10584 | "show ip community-list", |
| 10585 | SHOW_STR |
| 10586 | IP_STR |
| 10587 | "List community-list\n") |
| 10588 | { |
| 10589 | struct community_list *list; |
| 10590 | struct community_list_master *cm; |
| 10591 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10592 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10593 | if (! cm) |
| 10594 | return CMD_SUCCESS; |
| 10595 | |
| 10596 | for (list = cm->num.head; list; list = list->next) |
| 10597 | community_list_show (vty, list); |
| 10598 | |
| 10599 | for (list = cm->str.head; list; list = list->next) |
| 10600 | community_list_show (vty, list); |
| 10601 | |
| 10602 | return CMD_SUCCESS; |
| 10603 | } |
| 10604 | |
| 10605 | DEFUN (show_ip_community_list_arg, |
| 10606 | show_ip_community_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10607 | "show ip community-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10608 | SHOW_STR |
| 10609 | IP_STR |
| 10610 | "List community-list\n" |
| 10611 | "Community-list number\n" |
| 10612 | "Community-list name\n") |
| 10613 | { |
| 10614 | struct community_list *list; |
| 10615 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10616 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10617 | if (! list) |
| 10618 | { |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10619 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10620 | return CMD_WARNING; |
| 10621 | } |
| 10622 | |
| 10623 | community_list_show (vty, list); |
| 10624 | |
| 10625 | return CMD_SUCCESS; |
| 10626 | } |
| 10627 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10628 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10629 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10630 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10631 | { |
| 10632 | int ret; |
| 10633 | int direct; |
| 10634 | char *str; |
| 10635 | |
| 10636 | /* Check the list type. */ |
| 10637 | if (strncmp (argv[1], "p", 1) == 0) |
| 10638 | direct = COMMUNITY_PERMIT; |
| 10639 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10640 | direct = COMMUNITY_DENY; |
| 10641 | else |
| 10642 | { |
| 10643 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10644 | VTY_NEWLINE); |
| 10645 | return CMD_WARNING; |
| 10646 | } |
| 10647 | |
| 10648 | /* All digit name check. */ |
| 10649 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10650 | { |
| 10651 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10652 | return CMD_WARNING; |
| 10653 | } |
| 10654 | |
| 10655 | /* Concat community string argument. */ |
| 10656 | if (argc > 1) |
| 10657 | str = argv_concat (argv, argc, 2); |
| 10658 | else |
| 10659 | str = NULL; |
| 10660 | |
| 10661 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); |
| 10662 | |
| 10663 | /* Free temporary community list string allocated by |
| 10664 | argv_concat(). */ |
| 10665 | if (str) |
| 10666 | XFREE (MTYPE_TMP, str); |
| 10667 | |
| 10668 | if (ret < 0) |
| 10669 | { |
| 10670 | community_list_perror (vty, ret); |
| 10671 | return CMD_WARNING; |
| 10672 | } |
| 10673 | return CMD_SUCCESS; |
| 10674 | } |
| 10675 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10676 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10677 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10678 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10679 | { |
| 10680 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10681 | int direct = 0; |
| 10682 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10683 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10684 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10685 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10686 | /* Check the list direct. */ |
| 10687 | if (strncmp (argv[1], "p", 1) == 0) |
| 10688 | direct = COMMUNITY_PERMIT; |
| 10689 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10690 | direct = COMMUNITY_DENY; |
| 10691 | else |
| 10692 | { |
| 10693 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10694 | VTY_NEWLINE); |
| 10695 | return CMD_WARNING; |
| 10696 | } |
| 10697 | |
| 10698 | /* Concat community string argument. */ |
| 10699 | str = argv_concat (argv, argc, 2); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10700 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10701 | |
| 10702 | /* Unset community list. */ |
| 10703 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10704 | |
| 10705 | /* Free temporary community list string allocated by |
| 10706 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10707 | if (str) |
| 10708 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10709 | |
| 10710 | if (ret < 0) |
| 10711 | { |
| 10712 | community_list_perror (vty, ret); |
| 10713 | return CMD_WARNING; |
| 10714 | } |
| 10715 | |
| 10716 | return CMD_SUCCESS; |
| 10717 | } |
| 10718 | |
| 10719 | /* "extcommunity-list" keyword help string. */ |
| 10720 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" |
| 10721 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" |
| 10722 | |
| 10723 | DEFUN (ip_extcommunity_list_standard, |
| 10724 | ip_extcommunity_list_standard_cmd, |
| 10725 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10726 | IP_STR |
| 10727 | EXTCOMMUNITY_LIST_STR |
| 10728 | "Extended Community list number (standard)\n" |
| 10729 | "Specify community to reject\n" |
| 10730 | "Specify community to accept\n" |
| 10731 | EXTCOMMUNITY_VAL_STR) |
| 10732 | { |
| 10733 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
| 10734 | } |
| 10735 | |
| 10736 | ALIAS (ip_extcommunity_list_standard, |
| 10737 | ip_extcommunity_list_standard2_cmd, |
| 10738 | "ip extcommunity-list <1-99> (deny|permit)", |
| 10739 | IP_STR |
| 10740 | EXTCOMMUNITY_LIST_STR |
| 10741 | "Extended Community list number (standard)\n" |
| 10742 | "Specify community to reject\n" |
| 10743 | "Specify community to accept\n") |
| 10744 | |
| 10745 | DEFUN (ip_extcommunity_list_expanded, |
| 10746 | ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10747 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10748 | IP_STR |
| 10749 | EXTCOMMUNITY_LIST_STR |
| 10750 | "Extended Community list number (expanded)\n" |
| 10751 | "Specify community to reject\n" |
| 10752 | "Specify community to accept\n" |
| 10753 | "An ordered list as a regular-expression\n") |
| 10754 | { |
| 10755 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
| 10756 | } |
| 10757 | |
| 10758 | DEFUN (ip_extcommunity_list_name_standard, |
| 10759 | ip_extcommunity_list_name_standard_cmd, |
| 10760 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10761 | IP_STR |
| 10762 | EXTCOMMUNITY_LIST_STR |
| 10763 | "Specify standard extcommunity-list\n" |
| 10764 | "Extended Community list name\n" |
| 10765 | "Specify community to reject\n" |
| 10766 | "Specify community to accept\n" |
| 10767 | EXTCOMMUNITY_VAL_STR) |
| 10768 | { |
| 10769 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
| 10770 | } |
| 10771 | |
| 10772 | ALIAS (ip_extcommunity_list_name_standard, |
| 10773 | ip_extcommunity_list_name_standard2_cmd, |
| 10774 | "ip extcommunity-list standard WORD (deny|permit)", |
| 10775 | IP_STR |
| 10776 | EXTCOMMUNITY_LIST_STR |
| 10777 | "Specify standard extcommunity-list\n" |
| 10778 | "Extended Community list name\n" |
| 10779 | "Specify community to reject\n" |
| 10780 | "Specify community to accept\n") |
| 10781 | |
| 10782 | DEFUN (ip_extcommunity_list_name_expanded, |
| 10783 | ip_extcommunity_list_name_expanded_cmd, |
| 10784 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10785 | IP_STR |
| 10786 | EXTCOMMUNITY_LIST_STR |
| 10787 | "Specify expanded extcommunity-list\n" |
| 10788 | "Extended Community list name\n" |
| 10789 | "Specify community to reject\n" |
| 10790 | "Specify community to accept\n" |
| 10791 | "An ordered list as a regular-expression\n") |
| 10792 | { |
| 10793 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
| 10794 | } |
| 10795 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10796 | DEFUN (no_ip_extcommunity_list_standard_all, |
| 10797 | no_ip_extcommunity_list_standard_all_cmd, |
| 10798 | "no ip extcommunity-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10799 | NO_STR |
| 10800 | IP_STR |
| 10801 | EXTCOMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10802 | "Extended Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10803 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10804 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10805 | } |
| 10806 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10807 | DEFUN (no_ip_extcommunity_list_expanded_all, |
| 10808 | no_ip_extcommunity_list_expanded_all_cmd, |
| 10809 | "no ip extcommunity-list <100-500>", |
| 10810 | NO_STR |
| 10811 | IP_STR |
| 10812 | EXTCOMMUNITY_LIST_STR |
| 10813 | "Extended Community list number (expanded)\n") |
| 10814 | { |
| 10815 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10816 | } |
| 10817 | |
| 10818 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
| 10819 | no_ip_extcommunity_list_name_standard_all_cmd, |
| 10820 | "no ip extcommunity-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10821 | NO_STR |
| 10822 | IP_STR |
| 10823 | EXTCOMMUNITY_LIST_STR |
| 10824 | "Specify standard extcommunity-list\n" |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10825 | "Extended Community list name\n") |
| 10826 | { |
| 10827 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10828 | } |
| 10829 | |
| 10830 | DEFUN (no_ip_extcommunity_list_name_expanded_all, |
| 10831 | no_ip_extcommunity_list_name_expanded_all_cmd, |
| 10832 | "no ip extcommunity-list expanded WORD", |
| 10833 | NO_STR |
| 10834 | IP_STR |
| 10835 | EXTCOMMUNITY_LIST_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10836 | "Specify expanded extcommunity-list\n" |
| 10837 | "Extended Community list name\n") |
| 10838 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10839 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10840 | } |
| 10841 | |
| 10842 | DEFUN (no_ip_extcommunity_list_standard, |
| 10843 | no_ip_extcommunity_list_standard_cmd, |
| 10844 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10845 | NO_STR |
| 10846 | IP_STR |
| 10847 | EXTCOMMUNITY_LIST_STR |
| 10848 | "Extended Community list number (standard)\n" |
| 10849 | "Specify community to reject\n" |
| 10850 | "Specify community to accept\n" |
| 10851 | EXTCOMMUNITY_VAL_STR) |
| 10852 | { |
| 10853 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10854 | } |
| 10855 | |
| 10856 | DEFUN (no_ip_extcommunity_list_expanded, |
| 10857 | no_ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10858 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10859 | NO_STR |
| 10860 | IP_STR |
| 10861 | EXTCOMMUNITY_LIST_STR |
| 10862 | "Extended Community list number (expanded)\n" |
| 10863 | "Specify community to reject\n" |
| 10864 | "Specify community to accept\n" |
| 10865 | "An ordered list as a regular-expression\n") |
| 10866 | { |
| 10867 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10868 | } |
| 10869 | |
| 10870 | DEFUN (no_ip_extcommunity_list_name_standard, |
| 10871 | no_ip_extcommunity_list_name_standard_cmd, |
| 10872 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10873 | NO_STR |
| 10874 | IP_STR |
| 10875 | EXTCOMMUNITY_LIST_STR |
| 10876 | "Specify standard extcommunity-list\n" |
| 10877 | "Extended Community list name\n" |
| 10878 | "Specify community to reject\n" |
| 10879 | "Specify community to accept\n" |
| 10880 | EXTCOMMUNITY_VAL_STR) |
| 10881 | { |
| 10882 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10883 | } |
| 10884 | |
| 10885 | DEFUN (no_ip_extcommunity_list_name_expanded, |
| 10886 | no_ip_extcommunity_list_name_expanded_cmd, |
| 10887 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10888 | NO_STR |
| 10889 | IP_STR |
| 10890 | EXTCOMMUNITY_LIST_STR |
| 10891 | "Specify expanded extcommunity-list\n" |
| 10892 | "Community list name\n" |
| 10893 | "Specify community to reject\n" |
| 10894 | "Specify community to accept\n" |
| 10895 | "An ordered list as a regular-expression\n") |
| 10896 | { |
| 10897 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10898 | } |
| 10899 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10900 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10901 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
| 10902 | { |
| 10903 | struct community_entry *entry; |
| 10904 | |
| 10905 | for (entry = list->head; entry; entry = entry->next) |
| 10906 | { |
| 10907 | if (entry == list->head) |
| 10908 | { |
| 10909 | if (all_digit (list->name)) |
| 10910 | vty_out (vty, "Extended community %s list %s%s", |
| 10911 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10912 | "standard" : "(expanded) access", |
| 10913 | list->name, VTY_NEWLINE); |
| 10914 | else |
| 10915 | vty_out (vty, "Named extended community %s list %s%s", |
| 10916 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10917 | "standard" : "expanded", |
| 10918 | list->name, VTY_NEWLINE); |
| 10919 | } |
| 10920 | if (entry->any) |
| 10921 | vty_out (vty, " %s%s", |
| 10922 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10923 | else |
| 10924 | vty_out (vty, " %s %s%s", |
| 10925 | community_direct_str (entry->direct), |
| 10926 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10927 | entry->u.ecom->str : entry->config, |
| 10928 | VTY_NEWLINE); |
| 10929 | } |
| 10930 | } |
| 10931 | |
| 10932 | DEFUN (show_ip_extcommunity_list, |
| 10933 | show_ip_extcommunity_list_cmd, |
| 10934 | "show ip extcommunity-list", |
| 10935 | SHOW_STR |
| 10936 | IP_STR |
| 10937 | "List extended-community list\n") |
| 10938 | { |
| 10939 | struct community_list *list; |
| 10940 | struct community_list_master *cm; |
| 10941 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10942 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10943 | if (! cm) |
| 10944 | return CMD_SUCCESS; |
| 10945 | |
| 10946 | for (list = cm->num.head; list; list = list->next) |
| 10947 | extcommunity_list_show (vty, list); |
| 10948 | |
| 10949 | for (list = cm->str.head; list; list = list->next) |
| 10950 | extcommunity_list_show (vty, list); |
| 10951 | |
| 10952 | return CMD_SUCCESS; |
| 10953 | } |
| 10954 | |
| 10955 | DEFUN (show_ip_extcommunity_list_arg, |
| 10956 | show_ip_extcommunity_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10957 | "show ip extcommunity-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10958 | SHOW_STR |
| 10959 | IP_STR |
| 10960 | "List extended-community list\n" |
| 10961 | "Extcommunity-list number\n" |
| 10962 | "Extcommunity-list name\n") |
| 10963 | { |
| 10964 | struct community_list *list; |
| 10965 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10966 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10967 | if (! list) |
| 10968 | { |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10969 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10970 | return CMD_WARNING; |
| 10971 | } |
| 10972 | |
| 10973 | extcommunity_list_show (vty, list); |
| 10974 | |
| 10975 | return CMD_SUCCESS; |
| 10976 | } |
| 10977 | |
| 10978 | /* Return configuration string of community-list entry. */ |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10979 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10980 | community_list_config_str (struct community_entry *entry) |
| 10981 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10982 | const char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10983 | |
| 10984 | if (entry->any) |
| 10985 | str = ""; |
| 10986 | else |
| 10987 | { |
| 10988 | if (entry->style == COMMUNITY_LIST_STANDARD) |
| 10989 | str = community_str (entry->u.com); |
| 10990 | else |
| 10991 | str = entry->config; |
| 10992 | } |
| 10993 | return str; |
| 10994 | } |
| 10995 | |
| 10996 | /* Display community-list and extcommunity-list configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10997 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10998 | community_list_config_write (struct vty *vty) |
| 10999 | { |
| 11000 | struct community_list *list; |
| 11001 | struct community_entry *entry; |
| 11002 | struct community_list_master *cm; |
| 11003 | int write = 0; |
| 11004 | |
| 11005 | /* Community-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11006 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11007 | |
| 11008 | for (list = cm->num.head; list; list = list->next) |
| 11009 | for (entry = list->head; entry; entry = entry->next) |
| 11010 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11011 | vty_out (vty, "ip community-list %s %s %s%s", |
| 11012 | list->name, community_direct_str (entry->direct), |
| 11013 | community_list_config_str (entry), |
| 11014 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11015 | write++; |
| 11016 | } |
| 11017 | for (list = cm->str.head; list; list = list->next) |
| 11018 | for (entry = list->head; entry; entry = entry->next) |
| 11019 | { |
| 11020 | vty_out (vty, "ip community-list %s %s %s %s%s", |
| 11021 | entry->style == COMMUNITY_LIST_STANDARD |
| 11022 | ? "standard" : "expanded", |
| 11023 | list->name, community_direct_str (entry->direct), |
| 11024 | community_list_config_str (entry), |
| 11025 | VTY_NEWLINE); |
| 11026 | write++; |
| 11027 | } |
| 11028 | |
| 11029 | /* Extcommunity-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11030 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11031 | |
| 11032 | for (list = cm->num.head; list; list = list->next) |
| 11033 | for (entry = list->head; entry; entry = entry->next) |
| 11034 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11035 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
| 11036 | list->name, community_direct_str (entry->direct), |
| 11037 | community_list_config_str (entry), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11038 | write++; |
| 11039 | } |
| 11040 | for (list = cm->str.head; list; list = list->next) |
| 11041 | for (entry = list->head; entry; entry = entry->next) |
| 11042 | { |
| 11043 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", |
| 11044 | entry->style == EXTCOMMUNITY_LIST_STANDARD |
| 11045 | ? "standard" : "expanded", |
| 11046 | list->name, community_direct_str (entry->direct), |
| 11047 | community_list_config_str (entry), VTY_NEWLINE); |
| 11048 | write++; |
| 11049 | } |
| 11050 | return write; |
| 11051 | } |
| 11052 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 11053 | static struct cmd_node community_list_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11054 | { |
| 11055 | COMMUNITY_LIST_NODE, |
| 11056 | "", |
| 11057 | 1 /* Export to vtysh. */ |
| 11058 | }; |
| 11059 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 11060 | static void |
| 11061 | community_list_vty (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11062 | { |
| 11063 | install_node (&community_list_node, community_list_config_write); |
| 11064 | |
| 11065 | /* Community-list. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11066 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
| 11067 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); |
| 11068 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); |
| 11069 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); |
| 11070 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); |
| 11071 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11072 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
| 11073 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
| 11074 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); |
| 11075 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11076 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
| 11077 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); |
| 11078 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); |
| 11079 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
| 11080 | install_element (VIEW_NODE, &show_ip_community_list_cmd); |
| 11081 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); |
| 11082 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); |
| 11083 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); |
| 11084 | |
| 11085 | /* Extcommunity-list. */ |
| 11086 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); |
| 11087 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); |
| 11088 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); |
| 11089 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); |
| 11090 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); |
| 11091 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11092 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
| 11093 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
| 11094 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); |
| 11095 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11096 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
| 11097 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); |
| 11098 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); |
| 11099 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
| 11100 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); |
| 11101 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 11102 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); |
| 11103 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 11104 | } |