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 | } |
Pradosh Mohapatra | 5d804b4 | 2013-09-12 03:37:07 +0000 | [diff] [blame^] | 7860 | else |
| 7861 | { |
| 7862 | if (p->gtsm_hops > 0) |
| 7863 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", |
| 7864 | p->gtsm_hops, VTY_NEWLINE); |
| 7865 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7866 | |
| 7867 | /* Local address. */ |
| 7868 | if (p->su_local) |
| 7869 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7870 | vty_out (vty, "Local host: %s, Local port: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7871 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
| 7872 | ntohs (p->su_local->sin.sin_port), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7873 | VTY_NEWLINE); |
| 7874 | } |
| 7875 | |
| 7876 | /* Remote address. */ |
| 7877 | if (p->su_remote) |
| 7878 | { |
| 7879 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", |
| 7880 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
| 7881 | ntohs (p->su_remote->sin.sin_port), |
| 7882 | VTY_NEWLINE); |
| 7883 | } |
| 7884 | |
| 7885 | /* Nexthop display. */ |
| 7886 | if (p->su_local) |
| 7887 | { |
| 7888 | vty_out (vty, "Nexthop: %s%s", |
| 7889 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), |
| 7890 | VTY_NEWLINE); |
| 7891 | #ifdef HAVE_IPV6 |
| 7892 | vty_out (vty, "Nexthop global: %s%s", |
| 7893 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), |
| 7894 | VTY_NEWLINE); |
| 7895 | vty_out (vty, "Nexthop local: %s%s", |
| 7896 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), |
| 7897 | VTY_NEWLINE); |
| 7898 | vty_out (vty, "BGP connection: %s%s", |
| 7899 | p->shared_network ? "shared network" : "non shared network", |
| 7900 | VTY_NEWLINE); |
| 7901 | #endif /* HAVE_IPV6 */ |
| 7902 | } |
| 7903 | |
| 7904 | /* Timer information. */ |
| 7905 | if (p->t_start) |
| 7906 | vty_out (vty, "Next start timer due in %ld seconds%s", |
| 7907 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); |
| 7908 | if (p->t_connect) |
| 7909 | vty_out (vty, "Next connect timer due in %ld seconds%s", |
| 7910 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); |
| 7911 | |
| 7912 | vty_out (vty, "Read thread: %s Write thread: %s%s", |
| 7913 | p->t_read ? "on" : "off", |
| 7914 | p->t_write ? "on" : "off", |
| 7915 | VTY_NEWLINE); |
| 7916 | |
| 7917 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR |
| 7918 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) |
| 7919 | bgp_capability_vty_out (vty, p); |
| 7920 | |
| 7921 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7922 | } |
| 7923 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7924 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7925 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
| 7926 | enum show_type type, union sockunion *su) |
| 7927 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7928 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7929 | struct peer *peer; |
| 7930 | int find = 0; |
| 7931 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7932 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7933 | { |
| 7934 | switch (type) |
| 7935 | { |
| 7936 | case show_all: |
| 7937 | bgp_show_peer (vty, peer); |
| 7938 | break; |
| 7939 | case show_peer: |
| 7940 | if (sockunion_same (&peer->su, su)) |
| 7941 | { |
| 7942 | find = 1; |
| 7943 | bgp_show_peer (vty, peer); |
| 7944 | } |
| 7945 | break; |
| 7946 | } |
| 7947 | } |
| 7948 | |
| 7949 | if (type == show_peer && ! find) |
| 7950 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); |
| 7951 | |
| 7952 | return CMD_SUCCESS; |
| 7953 | } |
| 7954 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7955 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7956 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
| 7957 | enum show_type type, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7958 | { |
| 7959 | int ret; |
| 7960 | struct bgp *bgp; |
| 7961 | union sockunion su; |
| 7962 | |
| 7963 | if (ip_str) |
| 7964 | { |
| 7965 | ret = str2sockunion (ip_str, &su); |
| 7966 | if (ret < 0) |
| 7967 | { |
| 7968 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 7969 | return CMD_WARNING; |
| 7970 | } |
| 7971 | } |
| 7972 | |
| 7973 | if (name) |
| 7974 | { |
| 7975 | bgp = bgp_lookup_by_name (name); |
| 7976 | |
| 7977 | if (! bgp) |
| 7978 | { |
| 7979 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7980 | return CMD_WARNING; |
| 7981 | } |
| 7982 | |
| 7983 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7984 | |
| 7985 | return CMD_SUCCESS; |
| 7986 | } |
| 7987 | |
| 7988 | bgp = bgp_get_default (); |
| 7989 | |
| 7990 | if (bgp) |
| 7991 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7992 | |
| 7993 | return CMD_SUCCESS; |
| 7994 | } |
| 7995 | |
| 7996 | /* "show ip bgp neighbors" commands. */ |
| 7997 | DEFUN (show_ip_bgp_neighbors, |
| 7998 | show_ip_bgp_neighbors_cmd, |
| 7999 | "show ip bgp neighbors", |
| 8000 | SHOW_STR |
| 8001 | IP_STR |
| 8002 | BGP_STR |
| 8003 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8004 | { |
| 8005 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); |
| 8006 | } |
| 8007 | |
| 8008 | ALIAS (show_ip_bgp_neighbors, |
| 8009 | show_ip_bgp_ipv4_neighbors_cmd, |
| 8010 | "show ip bgp ipv4 (unicast|multicast) neighbors", |
| 8011 | SHOW_STR |
| 8012 | IP_STR |
| 8013 | BGP_STR |
| 8014 | "Address family\n" |
| 8015 | "Address Family modifier\n" |
| 8016 | "Address Family modifier\n" |
| 8017 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8018 | |
| 8019 | ALIAS (show_ip_bgp_neighbors, |
| 8020 | show_ip_bgp_vpnv4_all_neighbors_cmd, |
| 8021 | "show ip bgp vpnv4 all neighbors", |
| 8022 | SHOW_STR |
| 8023 | IP_STR |
| 8024 | BGP_STR |
| 8025 | "Display VPNv4 NLRI specific information\n" |
| 8026 | "Display information about all VPNv4 NLRIs\n" |
| 8027 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8028 | |
| 8029 | ALIAS (show_ip_bgp_neighbors, |
| 8030 | show_ip_bgp_vpnv4_rd_neighbors_cmd, |
| 8031 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", |
| 8032 | SHOW_STR |
| 8033 | IP_STR |
| 8034 | BGP_STR |
| 8035 | "Display VPNv4 NLRI specific information\n" |
| 8036 | "Display information for a route distinguisher\n" |
| 8037 | "VPN Route Distinguisher\n" |
| 8038 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8039 | |
| 8040 | ALIAS (show_ip_bgp_neighbors, |
| 8041 | show_bgp_neighbors_cmd, |
| 8042 | "show bgp neighbors", |
| 8043 | SHOW_STR |
| 8044 | BGP_STR |
| 8045 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8046 | |
| 8047 | ALIAS (show_ip_bgp_neighbors, |
| 8048 | show_bgp_ipv6_neighbors_cmd, |
| 8049 | "show bgp ipv6 neighbors", |
| 8050 | SHOW_STR |
| 8051 | BGP_STR |
| 8052 | "Address family\n" |
| 8053 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8054 | |
| 8055 | DEFUN (show_ip_bgp_neighbors_peer, |
| 8056 | show_ip_bgp_neighbors_peer_cmd, |
| 8057 | "show ip bgp neighbors (A.B.C.D|X:X::X:X)", |
| 8058 | SHOW_STR |
| 8059 | IP_STR |
| 8060 | BGP_STR |
| 8061 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8062 | "Neighbor to display information about\n" |
| 8063 | "Neighbor to display information about\n") |
| 8064 | { |
| 8065 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); |
| 8066 | } |
| 8067 | |
| 8068 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8069 | show_ip_bgp_ipv4_neighbors_peer_cmd, |
| 8070 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)", |
| 8071 | SHOW_STR |
| 8072 | IP_STR |
| 8073 | BGP_STR |
| 8074 | "Address family\n" |
| 8075 | "Address Family modifier\n" |
| 8076 | "Address Family modifier\n" |
| 8077 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8078 | "Neighbor to display information about\n" |
| 8079 | "Neighbor to display information about\n") |
| 8080 | |
| 8081 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8082 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, |
| 8083 | "show ip bgp vpnv4 all neighbors A.B.C.D", |
| 8084 | SHOW_STR |
| 8085 | IP_STR |
| 8086 | BGP_STR |
| 8087 | "Display VPNv4 NLRI specific information\n" |
| 8088 | "Display information about all VPNv4 NLRIs\n" |
| 8089 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8090 | "Neighbor to display information about\n") |
| 8091 | |
| 8092 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8093 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, |
| 8094 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", |
| 8095 | SHOW_STR |
| 8096 | IP_STR |
| 8097 | BGP_STR |
| 8098 | "Display VPNv4 NLRI specific information\n" |
| 8099 | "Display information about all VPNv4 NLRIs\n" |
| 8100 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8101 | "Neighbor to display information about\n") |
| 8102 | |
| 8103 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8104 | show_bgp_neighbors_peer_cmd, |
| 8105 | "show bgp neighbors (A.B.C.D|X:X::X:X)", |
| 8106 | SHOW_STR |
| 8107 | BGP_STR |
| 8108 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8109 | "Neighbor to display information about\n" |
| 8110 | "Neighbor to display information about\n") |
| 8111 | |
| 8112 | ALIAS (show_ip_bgp_neighbors_peer, |
| 8113 | show_bgp_ipv6_neighbors_peer_cmd, |
| 8114 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 8115 | SHOW_STR |
| 8116 | BGP_STR |
| 8117 | "Address family\n" |
| 8118 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8119 | "Neighbor to display information about\n" |
| 8120 | "Neighbor to display information about\n") |
| 8121 | |
| 8122 | DEFUN (show_ip_bgp_instance_neighbors, |
| 8123 | show_ip_bgp_instance_neighbors_cmd, |
| 8124 | "show ip bgp view WORD neighbors", |
| 8125 | SHOW_STR |
| 8126 | IP_STR |
| 8127 | BGP_STR |
| 8128 | "BGP view\n" |
| 8129 | "View name\n" |
| 8130 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8131 | { |
| 8132 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); |
| 8133 | } |
| 8134 | |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 8135 | ALIAS (show_ip_bgp_instance_neighbors, |
| 8136 | show_bgp_instance_neighbors_cmd, |
| 8137 | "show bgp view WORD neighbors", |
| 8138 | SHOW_STR |
| 8139 | BGP_STR |
| 8140 | "BGP view\n" |
| 8141 | "View name\n" |
| 8142 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8143 | |
| 8144 | ALIAS (show_ip_bgp_instance_neighbors, |
| 8145 | show_bgp_instance_ipv6_neighbors_cmd, |
| 8146 | "show bgp view WORD ipv6 neighbors", |
| 8147 | SHOW_STR |
| 8148 | BGP_STR |
| 8149 | "BGP view\n" |
| 8150 | "View name\n" |
| 8151 | "Address family\n" |
| 8152 | "Detailed information on TCP and BGP neighbor connections\n") |
| 8153 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8154 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
| 8155 | show_ip_bgp_instance_neighbors_peer_cmd, |
| 8156 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 8157 | SHOW_STR |
| 8158 | IP_STR |
| 8159 | BGP_STR |
| 8160 | "BGP view\n" |
| 8161 | "View name\n" |
| 8162 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8163 | "Neighbor to display information about\n" |
| 8164 | "Neighbor to display information about\n") |
| 8165 | { |
| 8166 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); |
| 8167 | } |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 8168 | |
| 8169 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 8170 | show_bgp_instance_neighbors_peer_cmd, |
| 8171 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 8172 | SHOW_STR |
| 8173 | BGP_STR |
| 8174 | "BGP view\n" |
| 8175 | "View name\n" |
| 8176 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8177 | "Neighbor to display information about\n" |
| 8178 | "Neighbor to display information about\n") |
| 8179 | |
| 8180 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 8181 | show_bgp_instance_ipv6_neighbors_peer_cmd, |
| 8182 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 8183 | SHOW_STR |
| 8184 | BGP_STR |
| 8185 | "BGP view\n" |
| 8186 | "View name\n" |
| 8187 | "Address family\n" |
| 8188 | "Detailed information on TCP and BGP neighbor connections\n" |
| 8189 | "Neighbor to display information about\n" |
| 8190 | "Neighbor to display information about\n") |
| 8191 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8192 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
| 8193 | paths' and `show ip mbgp paths'. Those functions results are the |
| 8194 | same.*/ |
| 8195 | DEFUN (show_ip_bgp_paths, |
| 8196 | show_ip_bgp_paths_cmd, |
| 8197 | "show ip bgp paths", |
| 8198 | SHOW_STR |
| 8199 | IP_STR |
| 8200 | BGP_STR |
| 8201 | "Path information\n") |
| 8202 | { |
| 8203 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); |
| 8204 | aspath_print_all_vty (vty); |
| 8205 | return CMD_SUCCESS; |
| 8206 | } |
| 8207 | |
| 8208 | DEFUN (show_ip_bgp_ipv4_paths, |
| 8209 | show_ip_bgp_ipv4_paths_cmd, |
| 8210 | "show ip bgp ipv4 (unicast|multicast) paths", |
| 8211 | SHOW_STR |
| 8212 | IP_STR |
| 8213 | BGP_STR |
| 8214 | "Address family\n" |
| 8215 | "Address Family modifier\n" |
| 8216 | "Address Family modifier\n" |
| 8217 | "Path information\n") |
| 8218 | { |
| 8219 | vty_out (vty, "Address Refcnt Path\r\n"); |
| 8220 | aspath_print_all_vty (vty); |
| 8221 | |
| 8222 | return CMD_SUCCESS; |
| 8223 | } |
| 8224 | |
| 8225 | #include "hash.h" |
| 8226 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8227 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8228 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
| 8229 | { |
| 8230 | struct community *com; |
| 8231 | |
| 8232 | com = (struct community *) backet->data; |
| 8233 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, |
| 8234 | community_str (com), VTY_NEWLINE); |
| 8235 | } |
| 8236 | |
| 8237 | /* Show BGP's community internal data. */ |
| 8238 | DEFUN (show_ip_bgp_community_info, |
| 8239 | show_ip_bgp_community_info_cmd, |
| 8240 | "show ip bgp community-info", |
| 8241 | SHOW_STR |
| 8242 | IP_STR |
| 8243 | BGP_STR |
| 8244 | "List all bgp community information\n") |
| 8245 | { |
| 8246 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); |
| 8247 | |
| 8248 | hash_iterate (community_hash (), |
| 8249 | (void (*) (struct hash_backet *, void *)) |
| 8250 | community_show_all_iterator, |
| 8251 | vty); |
| 8252 | |
| 8253 | return CMD_SUCCESS; |
| 8254 | } |
| 8255 | |
| 8256 | DEFUN (show_ip_bgp_attr_info, |
| 8257 | show_ip_bgp_attr_info_cmd, |
| 8258 | "show ip bgp attribute-info", |
| 8259 | SHOW_STR |
| 8260 | IP_STR |
| 8261 | BGP_STR |
| 8262 | "List all bgp attribute information\n") |
| 8263 | { |
| 8264 | attr_show_all (vty); |
| 8265 | return CMD_SUCCESS; |
| 8266 | } |
| 8267 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8268 | static int |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8269 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
| 8270 | afi_t afi, safi_t safi) |
| 8271 | { |
| 8272 | char timebuf[BGP_UPTIME_LEN]; |
| 8273 | char rmbuf[14]; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8274 | const char *rmname; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8275 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8276 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8277 | int len; |
| 8278 | int count = 0; |
| 8279 | |
| 8280 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) |
| 8281 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8282 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8283 | { |
| 8284 | count++; |
| 8285 | bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 8286 | } |
| 8287 | return count; |
| 8288 | } |
| 8289 | |
| 8290 | len = vty_out (vty, "%s", rsclient->host); |
| 8291 | len = 16 - len; |
| 8292 | |
| 8293 | if (len < 1) |
| 8294 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 8295 | else |
| 8296 | vty_out (vty, "%*s", len, " "); |
| 8297 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 8298 | vty_out (vty, "4 "); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8299 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 8300 | vty_out (vty, "%11d ", rsclient->as); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8301 | |
| 8302 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); |
| 8303 | if ( rmname && strlen (rmname) > 13 ) |
| 8304 | { |
| 8305 | sprintf (rmbuf, "%13s", "..."); |
| 8306 | rmname = strncpy (rmbuf, rmname, 10); |
| 8307 | } |
| 8308 | else if (! rmname) |
| 8309 | rmname = "<none>"; |
| 8310 | vty_out (vty, " %13s ", rmname); |
| 8311 | |
| 8312 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); |
| 8313 | if ( rmname && strlen (rmname) > 13 ) |
| 8314 | { |
| 8315 | sprintf (rmbuf, "%13s", "..."); |
| 8316 | rmname = strncpy (rmbuf, rmname, 10); |
| 8317 | } |
| 8318 | else if (! rmname) |
| 8319 | rmname = "<none>"; |
| 8320 | vty_out (vty, " %13s ", rmname); |
| 8321 | |
| 8322 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); |
| 8323 | |
| 8324 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) |
| 8325 | vty_out (vty, " Idle (Admin)"); |
| 8326 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 8327 | vty_out (vty, " Idle (PfxCt)"); |
| 8328 | else |
| 8329 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); |
| 8330 | |
| 8331 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8332 | |
| 8333 | return 1; |
| 8334 | } |
| 8335 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8336 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8337 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
| 8338 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8339 | { |
| 8340 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8341 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8342 | int count = 0; |
| 8343 | |
| 8344 | /* Header string for each address family. */ |
| 8345 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; |
| 8346 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8347 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8348 | { |
| 8349 | if (peer->afc[afi][safi] && |
| 8350 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 8351 | { |
| 8352 | if (! count) |
| 8353 | { |
| 8354 | vty_out (vty, |
| 8355 | "Route Server's BGP router identifier %s%s", |
| 8356 | inet_ntoa (bgp->router_id), VTY_NEWLINE); |
| 8357 | vty_out (vty, |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 8358 | "Route Server's local AS number %u%s", bgp->as, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8359 | VTY_NEWLINE); |
| 8360 | |
| 8361 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8362 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 8363 | } |
| 8364 | |
| 8365 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 8366 | } |
| 8367 | } |
| 8368 | |
| 8369 | if (count) |
| 8370 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, |
| 8371 | count, VTY_NEWLINE); |
| 8372 | else |
| 8373 | vty_out (vty, "No %s Route Server Client is configured%s", |
| 8374 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 8375 | |
| 8376 | return CMD_SUCCESS; |
| 8377 | } |
| 8378 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8379 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8380 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
| 8381 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8382 | { |
| 8383 | struct bgp *bgp; |
| 8384 | |
| 8385 | if (name) |
| 8386 | { |
| 8387 | bgp = bgp_lookup_by_name (name); |
| 8388 | |
| 8389 | if (! bgp) |
| 8390 | { |
| 8391 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 8392 | return CMD_WARNING; |
| 8393 | } |
| 8394 | |
| 8395 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 8396 | return CMD_SUCCESS; |
| 8397 | } |
| 8398 | |
| 8399 | bgp = bgp_get_default (); |
| 8400 | |
| 8401 | if (bgp) |
| 8402 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 8403 | |
| 8404 | return CMD_SUCCESS; |
| 8405 | } |
| 8406 | |
| 8407 | /* 'show bgp rsclient' commands. */ |
| 8408 | DEFUN (show_ip_bgp_rsclient_summary, |
| 8409 | show_ip_bgp_rsclient_summary_cmd, |
| 8410 | "show ip bgp rsclient summary", |
| 8411 | SHOW_STR |
| 8412 | IP_STR |
| 8413 | BGP_STR |
| 8414 | "Information about Route Server Clients\n" |
| 8415 | "Summary of all Route Server Clients\n") |
| 8416 | { |
| 8417 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 8418 | } |
| 8419 | |
| 8420 | DEFUN (show_ip_bgp_instance_rsclient_summary, |
| 8421 | show_ip_bgp_instance_rsclient_summary_cmd, |
| 8422 | "show ip bgp view WORD rsclient summary", |
| 8423 | SHOW_STR |
| 8424 | IP_STR |
| 8425 | BGP_STR |
| 8426 | "BGP view\n" |
| 8427 | "View name\n" |
| 8428 | "Information about Route Server Clients\n" |
| 8429 | "Summary of all Route Server Clients\n") |
| 8430 | { |
| 8431 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 8432 | } |
| 8433 | |
| 8434 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, |
| 8435 | show_ip_bgp_ipv4_rsclient_summary_cmd, |
| 8436 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", |
| 8437 | SHOW_STR |
| 8438 | IP_STR |
| 8439 | BGP_STR |
| 8440 | "Address family\n" |
| 8441 | "Address Family modifier\n" |
| 8442 | "Address Family modifier\n" |
| 8443 | "Information about Route Server Clients\n" |
| 8444 | "Summary of all Route Server Clients\n") |
| 8445 | { |
| 8446 | if (strncmp (argv[0], "m", 1) == 0) |
| 8447 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 8448 | |
| 8449 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 8450 | } |
| 8451 | |
| 8452 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, |
| 8453 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, |
| 8454 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 8455 | SHOW_STR |
| 8456 | IP_STR |
| 8457 | BGP_STR |
| 8458 | "BGP view\n" |
| 8459 | "View name\n" |
| 8460 | "Address family\n" |
| 8461 | "Address Family modifier\n" |
| 8462 | "Address Family modifier\n" |
| 8463 | "Information about Route Server Clients\n" |
| 8464 | "Summary of all Route Server Clients\n") |
| 8465 | { |
| 8466 | if (strncmp (argv[1], "m", 1) == 0) |
| 8467 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 8468 | |
| 8469 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 8470 | } |
| 8471 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 8472 | DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary, |
| 8473 | show_bgp_instance_ipv4_safi_rsclient_summary_cmd, |
| 8474 | "show bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 8475 | SHOW_STR |
| 8476 | BGP_STR |
| 8477 | "BGP view\n" |
| 8478 | "View name\n" |
| 8479 | "Address family\n" |
| 8480 | "Address Family modifier\n" |
| 8481 | "Address Family modifier\n" |
| 8482 | "Information about Route Server Clients\n" |
| 8483 | "Summary of all Route Server Clients\n") |
| 8484 | { |
| 8485 | safi_t safi; |
| 8486 | |
| 8487 | if (argc == 2) { |
| 8488 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8489 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi); |
| 8490 | } else { |
| 8491 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8492 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi); |
| 8493 | } |
| 8494 | } |
| 8495 | |
| 8496 | ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary, |
| 8497 | show_bgp_ipv4_safi_rsclient_summary_cmd, |
| 8498 | "show bgp ipv4 (unicast|multicast) rsclient summary", |
| 8499 | SHOW_STR |
| 8500 | BGP_STR |
| 8501 | "Address family\n" |
| 8502 | "Address Family modifier\n" |
| 8503 | "Address Family modifier\n" |
| 8504 | "Information about Route Server Clients\n" |
| 8505 | "Summary of all Route Server Clients\n") |
| 8506 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8507 | #ifdef HAVE_IPV6 |
| 8508 | DEFUN (show_bgp_rsclient_summary, |
| 8509 | show_bgp_rsclient_summary_cmd, |
| 8510 | "show bgp rsclient summary", |
| 8511 | SHOW_STR |
| 8512 | BGP_STR |
| 8513 | "Information about Route Server Clients\n" |
| 8514 | "Summary of all Route Server Clients\n") |
| 8515 | { |
| 8516 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 8517 | } |
| 8518 | |
| 8519 | DEFUN (show_bgp_instance_rsclient_summary, |
| 8520 | show_bgp_instance_rsclient_summary_cmd, |
| 8521 | "show bgp view WORD rsclient summary", |
| 8522 | SHOW_STR |
| 8523 | BGP_STR |
| 8524 | "BGP view\n" |
| 8525 | "View name\n" |
| 8526 | "Information about Route Server Clients\n" |
| 8527 | "Summary of all Route Server Clients\n") |
| 8528 | { |
| 8529 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 8530 | } |
| 8531 | |
| 8532 | ALIAS (show_bgp_rsclient_summary, |
| 8533 | show_bgp_ipv6_rsclient_summary_cmd, |
| 8534 | "show bgp ipv6 rsclient summary", |
| 8535 | SHOW_STR |
| 8536 | BGP_STR |
| 8537 | "Address family\n" |
| 8538 | "Information about Route Server Clients\n" |
| 8539 | "Summary of all Route Server Clients\n") |
| 8540 | |
| 8541 | ALIAS (show_bgp_instance_rsclient_summary, |
| 8542 | show_bgp_instance_ipv6_rsclient_summary_cmd, |
| 8543 | "show bgp view WORD ipv6 rsclient summary", |
| 8544 | SHOW_STR |
| 8545 | BGP_STR |
| 8546 | "BGP view\n" |
| 8547 | "View name\n" |
| 8548 | "Address family\n" |
| 8549 | "Information about Route Server Clients\n" |
| 8550 | "Summary of all Route Server Clients\n") |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 8551 | |
| 8552 | DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary, |
| 8553 | show_bgp_instance_ipv6_safi_rsclient_summary_cmd, |
| 8554 | "show bgp view WORD ipv6 (unicast|multicast) rsclient summary", |
| 8555 | SHOW_STR |
| 8556 | BGP_STR |
| 8557 | "BGP view\n" |
| 8558 | "View name\n" |
| 8559 | "Address family\n" |
| 8560 | "Address Family modifier\n" |
| 8561 | "Address Family modifier\n" |
| 8562 | "Information about Route Server Clients\n" |
| 8563 | "Summary of all Route Server Clients\n") |
| 8564 | { |
| 8565 | safi_t safi; |
| 8566 | |
| 8567 | if (argc == 2) { |
| 8568 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8569 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi); |
| 8570 | } else { |
| 8571 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8572 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi); |
| 8573 | } |
| 8574 | } |
| 8575 | |
| 8576 | ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary, |
| 8577 | show_bgp_ipv6_safi_rsclient_summary_cmd, |
| 8578 | "show bgp ipv6 (unicast|multicast) rsclient summary", |
| 8579 | SHOW_STR |
| 8580 | BGP_STR |
| 8581 | "Address family\n" |
| 8582 | "Address Family modifier\n" |
| 8583 | "Address Family modifier\n" |
| 8584 | "Information about Route Server Clients\n" |
| 8585 | "Summary of all Route Server Clients\n") |
| 8586 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8587 | #endif /* HAVE IPV6 */ |
| 8588 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8589 | /* Redistribute VTY commands. */ |
| 8590 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8591 | DEFUN (bgp_redistribute_ipv4, |
| 8592 | bgp_redistribute_ipv4_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8593 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8594 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8595 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8596 | { |
| 8597 | int type; |
| 8598 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8599 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8600 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8601 | { |
| 8602 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8603 | return CMD_WARNING; |
| 8604 | } |
| 8605 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8606 | } |
| 8607 | |
| 8608 | DEFUN (bgp_redistribute_ipv4_rmap, |
| 8609 | bgp_redistribute_ipv4_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8610 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8611 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8612 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8613 | "Route map reference\n" |
| 8614 | "Pointer to route-map entries\n") |
| 8615 | { |
| 8616 | int type; |
| 8617 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8618 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8619 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8620 | { |
| 8621 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8622 | return CMD_WARNING; |
| 8623 | } |
| 8624 | |
| 8625 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8626 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8627 | } |
| 8628 | |
| 8629 | DEFUN (bgp_redistribute_ipv4_metric, |
| 8630 | bgp_redistribute_ipv4_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8631 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8632 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8633 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8634 | "Metric for redistributed routes\n" |
| 8635 | "Default metric\n") |
| 8636 | { |
| 8637 | int type; |
| 8638 | u_int32_t metric; |
| 8639 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8640 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8641 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8642 | { |
| 8643 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8644 | return CMD_WARNING; |
| 8645 | } |
| 8646 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8647 | |
| 8648 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8649 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8650 | } |
| 8651 | |
| 8652 | DEFUN (bgp_redistribute_ipv4_rmap_metric, |
| 8653 | bgp_redistribute_ipv4_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8654 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8655 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8656 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8657 | "Route map reference\n" |
| 8658 | "Pointer to route-map entries\n" |
| 8659 | "Metric for redistributed routes\n" |
| 8660 | "Default metric\n") |
| 8661 | { |
| 8662 | int type; |
| 8663 | u_int32_t metric; |
| 8664 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8665 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8666 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8667 | { |
| 8668 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8669 | return CMD_WARNING; |
| 8670 | } |
| 8671 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8672 | |
| 8673 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8674 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8675 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8676 | } |
| 8677 | |
| 8678 | DEFUN (bgp_redistribute_ipv4_metric_rmap, |
| 8679 | bgp_redistribute_ipv4_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8680 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8681 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8682 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8683 | "Metric for redistributed routes\n" |
| 8684 | "Default metric\n" |
| 8685 | "Route map reference\n" |
| 8686 | "Pointer to route-map entries\n") |
| 8687 | { |
| 8688 | int type; |
| 8689 | u_int32_t metric; |
| 8690 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8691 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8692 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8693 | { |
| 8694 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8695 | return CMD_WARNING; |
| 8696 | } |
| 8697 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8698 | |
| 8699 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8700 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); |
| 8701 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8702 | } |
| 8703 | |
| 8704 | DEFUN (no_bgp_redistribute_ipv4, |
| 8705 | no_bgp_redistribute_ipv4_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8706 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8707 | NO_STR |
| 8708 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8709 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8710 | { |
| 8711 | int type; |
| 8712 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8713 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8714 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8715 | { |
| 8716 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8717 | return CMD_WARNING; |
| 8718 | } |
| 8719 | |
| 8720 | return bgp_redistribute_unset (vty->index, AFI_IP, type); |
| 8721 | } |
| 8722 | |
| 8723 | DEFUN (no_bgp_redistribute_ipv4_rmap, |
| 8724 | no_bgp_redistribute_ipv4_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8725 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8726 | NO_STR |
| 8727 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8728 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8729 | "Route map reference\n" |
| 8730 | "Pointer to route-map entries\n") |
| 8731 | { |
| 8732 | int type; |
| 8733 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8734 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8735 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8736 | { |
| 8737 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8738 | return CMD_WARNING; |
| 8739 | } |
| 8740 | |
| 8741 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8742 | return CMD_SUCCESS; |
| 8743 | } |
| 8744 | |
| 8745 | DEFUN (no_bgp_redistribute_ipv4_metric, |
| 8746 | no_bgp_redistribute_ipv4_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8747 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8748 | NO_STR |
| 8749 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8750 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8751 | "Metric for redistributed routes\n" |
| 8752 | "Default metric\n") |
| 8753 | { |
| 8754 | int type; |
| 8755 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8756 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8757 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8758 | { |
| 8759 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8760 | return CMD_WARNING; |
| 8761 | } |
| 8762 | |
| 8763 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8764 | return CMD_SUCCESS; |
| 8765 | } |
| 8766 | |
| 8767 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, |
| 8768 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8769 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8770 | NO_STR |
| 8771 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8772 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8773 | "Route map reference\n" |
| 8774 | "Pointer to route-map entries\n" |
| 8775 | "Metric for redistributed routes\n" |
| 8776 | "Default metric\n") |
| 8777 | { |
| 8778 | int type; |
| 8779 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8780 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8781 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8782 | { |
| 8783 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8784 | return CMD_WARNING; |
| 8785 | } |
| 8786 | |
| 8787 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8788 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8789 | return CMD_SUCCESS; |
| 8790 | } |
| 8791 | |
| 8792 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, |
| 8793 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8794 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8795 | NO_STR |
| 8796 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8797 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8798 | "Metric for redistributed routes\n" |
| 8799 | "Default metric\n" |
| 8800 | "Route map reference\n" |
| 8801 | "Pointer to route-map entries\n") |
| 8802 | |
| 8803 | #ifdef HAVE_IPV6 |
| 8804 | DEFUN (bgp_redistribute_ipv6, |
| 8805 | bgp_redistribute_ipv6_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8806 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8807 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8808 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8809 | { |
| 8810 | int type; |
| 8811 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8812 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8813 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8814 | { |
| 8815 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8816 | return CMD_WARNING; |
| 8817 | } |
| 8818 | |
| 8819 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8820 | } |
| 8821 | |
| 8822 | DEFUN (bgp_redistribute_ipv6_rmap, |
| 8823 | bgp_redistribute_ipv6_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8824 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8825 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8826 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8827 | "Route map reference\n" |
| 8828 | "Pointer to route-map entries\n") |
| 8829 | { |
| 8830 | int type; |
| 8831 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8832 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8833 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8834 | { |
| 8835 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8836 | return CMD_WARNING; |
| 8837 | } |
| 8838 | |
| 8839 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8840 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8841 | } |
| 8842 | |
| 8843 | DEFUN (bgp_redistribute_ipv6_metric, |
| 8844 | bgp_redistribute_ipv6_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8845 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8846 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8847 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8848 | "Metric for redistributed routes\n" |
| 8849 | "Default metric\n") |
| 8850 | { |
| 8851 | int type; |
| 8852 | u_int32_t metric; |
| 8853 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8854 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8855 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8856 | { |
| 8857 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8858 | return CMD_WARNING; |
| 8859 | } |
| 8860 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8861 | |
| 8862 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8863 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8864 | } |
| 8865 | |
| 8866 | DEFUN (bgp_redistribute_ipv6_rmap_metric, |
| 8867 | bgp_redistribute_ipv6_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8868 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8869 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8870 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8871 | "Route map reference\n" |
| 8872 | "Pointer to route-map entries\n" |
| 8873 | "Metric for redistributed routes\n" |
| 8874 | "Default metric\n") |
| 8875 | { |
| 8876 | int type; |
| 8877 | u_int32_t metric; |
| 8878 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8879 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8880 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8881 | { |
| 8882 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8883 | return CMD_WARNING; |
| 8884 | } |
| 8885 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8886 | |
| 8887 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8888 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8889 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8890 | } |
| 8891 | |
| 8892 | DEFUN (bgp_redistribute_ipv6_metric_rmap, |
| 8893 | bgp_redistribute_ipv6_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8894 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8895 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8896 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8897 | "Metric for redistributed routes\n" |
| 8898 | "Default metric\n" |
| 8899 | "Route map reference\n" |
| 8900 | "Pointer to route-map entries\n") |
| 8901 | { |
| 8902 | int type; |
| 8903 | u_int32_t metric; |
| 8904 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8905 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8906 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8907 | { |
| 8908 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8909 | return CMD_WARNING; |
| 8910 | } |
| 8911 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8912 | |
| 8913 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8914 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); |
| 8915 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8916 | } |
| 8917 | |
| 8918 | DEFUN (no_bgp_redistribute_ipv6, |
| 8919 | no_bgp_redistribute_ipv6_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8920 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8921 | NO_STR |
| 8922 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8923 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8924 | { |
| 8925 | int type; |
| 8926 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8927 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8928 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8929 | { |
| 8930 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8931 | return CMD_WARNING; |
| 8932 | } |
| 8933 | |
| 8934 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); |
| 8935 | } |
| 8936 | |
| 8937 | DEFUN (no_bgp_redistribute_ipv6_rmap, |
| 8938 | no_bgp_redistribute_ipv6_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8939 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8940 | NO_STR |
| 8941 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8942 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8943 | "Route map reference\n" |
| 8944 | "Pointer to route-map entries\n") |
| 8945 | { |
| 8946 | int type; |
| 8947 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8948 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8949 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8950 | { |
| 8951 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8952 | return CMD_WARNING; |
| 8953 | } |
| 8954 | |
| 8955 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8956 | return CMD_SUCCESS; |
| 8957 | } |
| 8958 | |
| 8959 | DEFUN (no_bgp_redistribute_ipv6_metric, |
| 8960 | no_bgp_redistribute_ipv6_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8961 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8962 | NO_STR |
| 8963 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8964 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8965 | "Metric for redistributed routes\n" |
| 8966 | "Default metric\n") |
| 8967 | { |
| 8968 | int type; |
| 8969 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8970 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8971 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8972 | { |
| 8973 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8974 | return CMD_WARNING; |
| 8975 | } |
| 8976 | |
| 8977 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8978 | return CMD_SUCCESS; |
| 8979 | } |
| 8980 | |
| 8981 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, |
| 8982 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8983 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8984 | NO_STR |
| 8985 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8986 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8987 | "Route map reference\n" |
| 8988 | "Pointer to route-map entries\n" |
| 8989 | "Metric for redistributed routes\n" |
| 8990 | "Default metric\n") |
| 8991 | { |
| 8992 | int type; |
| 8993 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8994 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8995 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8996 | { |
| 8997 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8998 | return CMD_WARNING; |
| 8999 | } |
| 9000 | |
| 9001 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 9002 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 9003 | return CMD_SUCCESS; |
| 9004 | } |
| 9005 | |
| 9006 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, |
| 9007 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 9008 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9009 | NO_STR |
| 9010 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 9011 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9012 | "Metric for redistributed routes\n" |
| 9013 | "Default metric\n" |
| 9014 | "Route map reference\n" |
| 9015 | "Pointer to route-map entries\n") |
| 9016 | #endif /* HAVE_IPV6 */ |
| 9017 | |
| 9018 | int |
| 9019 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 9020 | safi_t safi, int *write) |
| 9021 | { |
| 9022 | int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9023 | |
| 9024 | /* Unicast redistribution only. */ |
| 9025 | if (safi != SAFI_UNICAST) |
| 9026 | return 0; |
| 9027 | |
| 9028 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 9029 | { |
| 9030 | /* Redistribute BGP does not make sense. */ |
| 9031 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) |
| 9032 | { |
| 9033 | /* Display "address-family" when it is not yet diplayed. */ |
| 9034 | bgp_config_write_family_header (vty, afi, safi, write); |
| 9035 | |
| 9036 | /* "redistribute" configuration. */ |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 9037 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9038 | |
| 9039 | if (bgp->redist_metric_flag[afi][i]) |
Jorge Boncompte [DTI2] | ddc943d | 2012-04-13 13:46:07 +0200 | [diff] [blame] | 9040 | vty_out (vty, " metric %u", bgp->redist_metric[afi][i]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9041 | |
| 9042 | if (bgp->rmap[afi][i].name) |
| 9043 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); |
| 9044 | |
| 9045 | vty_out (vty, "%s", VTY_NEWLINE); |
| 9046 | } |
| 9047 | } |
| 9048 | return *write; |
| 9049 | } |
| 9050 | |
| 9051 | /* BGP node structure. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9052 | static struct cmd_node bgp_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9053 | { |
| 9054 | BGP_NODE, |
| 9055 | "%s(config-router)# ", |
| 9056 | 1, |
| 9057 | }; |
| 9058 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9059 | static struct cmd_node bgp_ipv4_unicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9060 | { |
| 9061 | BGP_IPV4_NODE, |
| 9062 | "%s(config-router-af)# ", |
| 9063 | 1, |
| 9064 | }; |
| 9065 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9066 | static struct cmd_node bgp_ipv4_multicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9067 | { |
| 9068 | BGP_IPV4M_NODE, |
| 9069 | "%s(config-router-af)# ", |
| 9070 | 1, |
| 9071 | }; |
| 9072 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9073 | static struct cmd_node bgp_ipv6_unicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9074 | { |
| 9075 | BGP_IPV6_NODE, |
| 9076 | "%s(config-router-af)# ", |
| 9077 | 1, |
| 9078 | }; |
| 9079 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9080 | static struct cmd_node bgp_ipv6_multicast_node = |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9081 | { |
| 9082 | BGP_IPV6M_NODE, |
| 9083 | "%s(config-router-af)# ", |
| 9084 | 1, |
| 9085 | }; |
| 9086 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 9087 | static struct cmd_node bgp_vpnv4_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9088 | { |
| 9089 | BGP_VPNV4_NODE, |
| 9090 | "%s(config-router-af)# ", |
| 9091 | 1 |
| 9092 | }; |
| 9093 | |
paul | 1f8ae70 | 2005-09-09 23:49:49 +0000 | [diff] [blame] | 9094 | static void community_list_vty (void); |
| 9095 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9096 | void |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9097 | bgp_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9098 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9099 | /* Install bgp top node. */ |
| 9100 | install_node (&bgp_node, bgp_config_write); |
| 9101 | install_node (&bgp_ipv4_unicast_node, NULL); |
| 9102 | install_node (&bgp_ipv4_multicast_node, NULL); |
| 9103 | install_node (&bgp_ipv6_unicast_node, NULL); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9104 | install_node (&bgp_ipv6_multicast_node, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9105 | install_node (&bgp_vpnv4_node, NULL); |
| 9106 | |
| 9107 | /* Install default VTY commands to new nodes. */ |
| 9108 | install_default (BGP_NODE); |
| 9109 | install_default (BGP_IPV4_NODE); |
| 9110 | install_default (BGP_IPV4M_NODE); |
| 9111 | install_default (BGP_IPV6_NODE); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9112 | install_default (BGP_IPV6M_NODE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9113 | install_default (BGP_VPNV4_NODE); |
| 9114 | |
| 9115 | /* "bgp multiple-instance" commands. */ |
| 9116 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); |
| 9117 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); |
| 9118 | |
| 9119 | /* "bgp config-type" commands. */ |
| 9120 | install_element (CONFIG_NODE, &bgp_config_type_cmd); |
| 9121 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); |
| 9122 | |
| 9123 | /* Dummy commands (Currently not supported) */ |
| 9124 | install_element (BGP_NODE, &no_synchronization_cmd); |
| 9125 | install_element (BGP_NODE, &no_auto_summary_cmd); |
| 9126 | |
| 9127 | /* "router bgp" commands. */ |
| 9128 | install_element (CONFIG_NODE, &router_bgp_cmd); |
| 9129 | install_element (CONFIG_NODE, &router_bgp_view_cmd); |
| 9130 | |
| 9131 | /* "no router bgp" commands. */ |
| 9132 | install_element (CONFIG_NODE, &no_router_bgp_cmd); |
| 9133 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); |
| 9134 | |
| 9135 | /* "bgp router-id" commands. */ |
| 9136 | install_element (BGP_NODE, &bgp_router_id_cmd); |
| 9137 | install_element (BGP_NODE, &no_bgp_router_id_cmd); |
| 9138 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); |
| 9139 | |
| 9140 | /* "bgp cluster-id" commands. */ |
| 9141 | install_element (BGP_NODE, &bgp_cluster_id_cmd); |
| 9142 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); |
| 9143 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); |
| 9144 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); |
| 9145 | |
| 9146 | /* "bgp confederation" commands. */ |
| 9147 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); |
| 9148 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); |
| 9149 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); |
| 9150 | |
| 9151 | /* "bgp confederation peers" commands. */ |
| 9152 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); |
| 9153 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); |
| 9154 | |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 9155 | /* "maximum-paths" commands. */ |
| 9156 | install_element (BGP_NODE, &bgp_maxpaths_cmd); |
| 9157 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); |
| 9158 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); |
| 9159 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); |
| 9160 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); |
| 9161 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); |
| 9162 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
| 9163 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
| 9164 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
| 9165 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
| 9166 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
| 9167 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
| 9168 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9169 | /* "timers bgp" commands. */ |
| 9170 | install_element (BGP_NODE, &bgp_timers_cmd); |
| 9171 | install_element (BGP_NODE, &no_bgp_timers_cmd); |
| 9172 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); |
| 9173 | |
| 9174 | /* "bgp client-to-client reflection" commands */ |
| 9175 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); |
| 9176 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); |
| 9177 | |
| 9178 | /* "bgp always-compare-med" commands */ |
| 9179 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); |
| 9180 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); |
| 9181 | |
| 9182 | /* "bgp deterministic-med" commands */ |
| 9183 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); |
| 9184 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 9185 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 9186 | /* "bgp graceful-restart" commands */ |
| 9187 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); |
| 9188 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 9189 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
| 9190 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); |
| 9191 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9192 | |
| 9193 | /* "bgp fast-external-failover" commands */ |
| 9194 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); |
| 9195 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); |
| 9196 | |
| 9197 | /* "bgp enforce-first-as" commands */ |
| 9198 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); |
| 9199 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); |
| 9200 | |
| 9201 | /* "bgp bestpath compare-routerid" commands */ |
| 9202 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); |
| 9203 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); |
| 9204 | |
| 9205 | /* "bgp bestpath as-path ignore" commands */ |
| 9206 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); |
| 9207 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); |
| 9208 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 9209 | /* "bgp bestpath as-path confed" commands */ |
| 9210 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); |
| 9211 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); |
| 9212 | |
Pradosh Mohapatra | 2fdd455 | 2013-09-07 07:02:36 +0000 | [diff] [blame] | 9213 | /* "bgp bestpath as-path multipath-relax" commands */ |
| 9214 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); |
| 9215 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); |
| 9216 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 9217 | /* "bgp log-neighbor-changes" commands */ |
| 9218 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); |
| 9219 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); |
| 9220 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9221 | /* "bgp bestpath med" commands */ |
| 9222 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); |
| 9223 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); |
| 9224 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); |
| 9225 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); |
| 9226 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); |
| 9227 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); |
| 9228 | |
| 9229 | /* "no bgp default ipv4-unicast" commands. */ |
| 9230 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); |
| 9231 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); |
| 9232 | |
| 9233 | /* "bgp network import-check" commands. */ |
| 9234 | install_element (BGP_NODE, &bgp_network_import_check_cmd); |
| 9235 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
| 9236 | |
| 9237 | /* "bgp default local-preference" commands. */ |
| 9238 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); |
| 9239 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); |
| 9240 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); |
| 9241 | |
| 9242 | /* "neighbor remote-as" commands. */ |
| 9243 | install_element (BGP_NODE, &neighbor_remote_as_cmd); |
| 9244 | install_element (BGP_NODE, &no_neighbor_cmd); |
| 9245 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); |
| 9246 | |
| 9247 | /* "neighbor peer-group" commands. */ |
| 9248 | install_element (BGP_NODE, &neighbor_peer_group_cmd); |
| 9249 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); |
| 9250 | install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd); |
| 9251 | |
| 9252 | /* "neighbor local-as" commands. */ |
| 9253 | install_element (BGP_NODE, &neighbor_local_as_cmd); |
| 9254 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 9255 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9256 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
| 9257 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); |
| 9258 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 9259 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9260 | |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 9261 | /* "neighbor password" commands. */ |
| 9262 | install_element (BGP_NODE, &neighbor_password_cmd); |
| 9263 | install_element (BGP_NODE, &no_neighbor_password_cmd); |
| 9264 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9265 | /* "neighbor activate" commands. */ |
| 9266 | install_element (BGP_NODE, &neighbor_activate_cmd); |
| 9267 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); |
| 9268 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); |
| 9269 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9270 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9271 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
| 9272 | |
| 9273 | /* "no neighbor activate" commands. */ |
| 9274 | install_element (BGP_NODE, &no_neighbor_activate_cmd); |
| 9275 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); |
| 9276 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); |
| 9277 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9278 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9279 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
| 9280 | |
| 9281 | /* "neighbor peer-group set" commands. */ |
| 9282 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
| 9283 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); |
| 9284 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); |
| 9285 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9286 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9287 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
| 9288 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9289 | /* "no neighbor peer-group unset" commands. */ |
| 9290 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); |
| 9291 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 9292 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); |
| 9293 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9294 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9295 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 9296 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9297 | /* "neighbor softreconfiguration inbound" commands.*/ |
| 9298 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9299 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9300 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9301 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9302 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9303 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9304 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9305 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9306 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9307 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9308 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9309 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9310 | |
| 9311 | /* "neighbor attribute-unchanged" commands. */ |
| 9312 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); |
| 9313 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); |
| 9314 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); |
| 9315 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); |
| 9316 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); |
| 9317 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); |
| 9318 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); |
| 9319 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); |
| 9320 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); |
| 9321 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); |
| 9322 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); |
| 9323 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9324 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9325 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9326 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9327 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9328 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9329 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9330 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9331 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9332 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9333 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9334 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); |
| 9335 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 9336 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 9337 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 9338 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 9339 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 9340 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 9341 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 9342 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 9343 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 9344 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 9345 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9346 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9347 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9348 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9349 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9350 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9351 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9352 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9353 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9354 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9355 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9356 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); |
| 9357 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); |
| 9358 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); |
| 9359 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); |
| 9360 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); |
| 9361 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); |
| 9362 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); |
| 9363 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); |
| 9364 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); |
| 9365 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); |
| 9366 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); |
| 9367 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9368 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9369 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9370 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9371 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9372 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9373 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9374 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9375 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9376 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9377 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9378 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); |
| 9379 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); |
| 9380 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); |
| 9381 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); |
| 9382 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); |
| 9383 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); |
| 9384 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); |
| 9385 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); |
| 9386 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); |
| 9387 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); |
| 9388 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); |
| 9389 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9390 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9391 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9392 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9393 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9394 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9395 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9396 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9397 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9398 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9399 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9400 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
| 9401 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); |
| 9402 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); |
| 9403 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); |
| 9404 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); |
| 9405 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); |
| 9406 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); |
| 9407 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); |
| 9408 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); |
| 9409 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); |
| 9410 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); |
| 9411 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9412 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9413 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9414 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9415 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9416 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9417 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9418 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9419 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9420 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9421 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9422 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
| 9423 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 9424 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 9425 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 9426 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 9427 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 9428 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 9429 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 9430 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 9431 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 9432 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 9433 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9434 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9435 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9436 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9437 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9438 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9439 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9440 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9441 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9442 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9443 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9444 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9445 | /* "nexthop-local unchanged" commands */ |
| 9446 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); |
| 9447 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); |
| 9448 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9449 | /* "transparent-as" and "transparent-nexthop" for old version |
| 9450 | compatibility. */ |
| 9451 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); |
| 9452 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); |
| 9453 | |
| 9454 | /* "neighbor next-hop-self" commands. */ |
| 9455 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); |
| 9456 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); |
| 9457 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); |
| 9458 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 9459 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); |
| 9460 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); |
| 9461 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); |
| 9462 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9463 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
| 9464 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9465 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
| 9466 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 9467 | |
| 9468 | /* "neighbor remove-private-AS" commands. */ |
| 9469 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); |
| 9470 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); |
| 9471 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
| 9472 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 9473 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
| 9474 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); |
| 9475 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
| 9476 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9477 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
| 9478 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9479 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
| 9480 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 9481 | |
| 9482 | /* "neighbor send-community" commands.*/ |
| 9483 | install_element (BGP_NODE, &neighbor_send_community_cmd); |
| 9484 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); |
| 9485 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); |
| 9486 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); |
| 9487 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); |
| 9488 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); |
| 9489 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); |
| 9490 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); |
| 9491 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); |
| 9492 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); |
| 9493 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); |
| 9494 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); |
| 9495 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); |
| 9496 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); |
| 9497 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); |
| 9498 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9499 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
| 9500 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); |
| 9501 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); |
| 9502 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9503 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
| 9504 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); |
| 9505 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); |
| 9506 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); |
| 9507 | |
| 9508 | /* "neighbor route-reflector" commands.*/ |
| 9509 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); |
| 9510 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9511 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); |
| 9512 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9513 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); |
| 9514 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9515 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); |
| 9516 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9517 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
| 9518 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9519 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
| 9520 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9521 | |
| 9522 | /* "neighbor route-server" commands.*/ |
| 9523 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); |
| 9524 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); |
| 9525 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); |
| 9526 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9527 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); |
| 9528 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); |
| 9529 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); |
| 9530 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9531 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
| 9532 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9533 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
| 9534 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9535 | |
| 9536 | /* "neighbor passive" commands. */ |
| 9537 | install_element (BGP_NODE, &neighbor_passive_cmd); |
| 9538 | install_element (BGP_NODE, &no_neighbor_passive_cmd); |
| 9539 | |
| 9540 | /* "neighbor shutdown" commands. */ |
| 9541 | install_element (BGP_NODE, &neighbor_shutdown_cmd); |
| 9542 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); |
| 9543 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 9544 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9545 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
| 9546 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); |
| 9547 | |
| 9548 | /* "neighbor capability orf prefix-list" commands.*/ |
| 9549 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9550 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9551 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9552 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9553 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9554 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9555 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9556 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9557 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9558 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9559 | |
| 9560 | /* "neighbor capability dynamic" commands.*/ |
| 9561 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); |
| 9562 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); |
| 9563 | |
| 9564 | /* "neighbor dont-capability-negotiate" commands. */ |
| 9565 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); |
| 9566 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); |
| 9567 | |
| 9568 | /* "neighbor ebgp-multihop" commands. */ |
| 9569 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); |
| 9570 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); |
| 9571 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); |
| 9572 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); |
| 9573 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 9574 | /* "neighbor disable-connected-check" commands. */ |
| 9575 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); |
| 9576 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9577 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
| 9578 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); |
| 9579 | |
| 9580 | /* "neighbor description" commands. */ |
| 9581 | install_element (BGP_NODE, &neighbor_description_cmd); |
| 9582 | install_element (BGP_NODE, &no_neighbor_description_cmd); |
| 9583 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); |
| 9584 | |
| 9585 | /* "neighbor update-source" commands. "*/ |
| 9586 | install_element (BGP_NODE, &neighbor_update_source_cmd); |
| 9587 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); |
| 9588 | |
| 9589 | /* "neighbor default-originate" commands. */ |
| 9590 | install_element (BGP_NODE, &neighbor_default_originate_cmd); |
| 9591 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); |
| 9592 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); |
| 9593 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9594 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); |
| 9595 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); |
| 9596 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); |
| 9597 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9598 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); |
| 9599 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9600 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); |
| 9601 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9602 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); |
| 9603 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); |
| 9604 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); |
| 9605 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9606 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
| 9607 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9608 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); |
| 9609 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9610 | |
| 9611 | /* "neighbor port" commands. */ |
| 9612 | install_element (BGP_NODE, &neighbor_port_cmd); |
| 9613 | install_element (BGP_NODE, &no_neighbor_port_cmd); |
| 9614 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); |
| 9615 | |
| 9616 | /* "neighbor weight" commands. */ |
| 9617 | install_element (BGP_NODE, &neighbor_weight_cmd); |
| 9618 | install_element (BGP_NODE, &no_neighbor_weight_cmd); |
| 9619 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); |
| 9620 | |
| 9621 | /* "neighbor override-capability" commands. */ |
| 9622 | install_element (BGP_NODE, &neighbor_override_capability_cmd); |
| 9623 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); |
| 9624 | |
| 9625 | /* "neighbor strict-capability-match" commands. */ |
| 9626 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); |
| 9627 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); |
| 9628 | |
| 9629 | /* "neighbor timers" commands. */ |
| 9630 | install_element (BGP_NODE, &neighbor_timers_cmd); |
| 9631 | install_element (BGP_NODE, &no_neighbor_timers_cmd); |
| 9632 | |
| 9633 | /* "neighbor timers connect" commands. */ |
| 9634 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); |
| 9635 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); |
| 9636 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); |
| 9637 | |
| 9638 | /* "neighbor advertisement-interval" commands. */ |
| 9639 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); |
| 9640 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); |
| 9641 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); |
| 9642 | |
| 9643 | /* "neighbor version" commands. */ |
| 9644 | install_element (BGP_NODE, &neighbor_version_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9645 | |
| 9646 | /* "neighbor interface" commands. */ |
| 9647 | install_element (BGP_NODE, &neighbor_interface_cmd); |
| 9648 | install_element (BGP_NODE, &no_neighbor_interface_cmd); |
| 9649 | |
| 9650 | /* "neighbor distribute" commands. */ |
| 9651 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); |
| 9652 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); |
| 9653 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); |
| 9654 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9655 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); |
| 9656 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); |
| 9657 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); |
| 9658 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9659 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
| 9660 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9661 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
| 9662 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9663 | |
| 9664 | /* "neighbor prefix-list" commands. */ |
| 9665 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); |
| 9666 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); |
| 9667 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); |
| 9668 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9669 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); |
| 9670 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); |
| 9671 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); |
| 9672 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9673 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
| 9674 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9675 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
| 9676 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9677 | |
| 9678 | /* "neighbor filter-list" commands. */ |
| 9679 | install_element (BGP_NODE, &neighbor_filter_list_cmd); |
| 9680 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); |
| 9681 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); |
| 9682 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); |
| 9683 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); |
| 9684 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); |
| 9685 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); |
| 9686 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9687 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
| 9688 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9689 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
| 9690 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); |
| 9691 | |
| 9692 | /* "neighbor route-map" commands. */ |
| 9693 | install_element (BGP_NODE, &neighbor_route_map_cmd); |
| 9694 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); |
| 9695 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); |
| 9696 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); |
| 9697 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); |
| 9698 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); |
| 9699 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); |
| 9700 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9701 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
| 9702 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9703 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
| 9704 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); |
| 9705 | |
| 9706 | /* "neighbor unsuppress-map" commands. */ |
| 9707 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); |
| 9708 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9709 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9710 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9711 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); |
| 9712 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9713 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); |
| 9714 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9715 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
| 9716 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9717 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9718 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9719 | |
| 9720 | /* "neighbor maximum-prefix" commands. */ |
| 9721 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9722 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9723 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9724 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9725 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9726 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9727 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9728 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9729 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9730 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9731 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9732 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9733 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9734 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9735 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9736 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9737 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9738 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9739 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9740 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9741 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9742 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9743 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9744 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9745 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9746 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9747 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9748 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9749 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9750 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9751 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9752 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9753 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9754 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9755 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9756 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9757 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9758 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9759 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9760 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9761 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9762 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9763 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9764 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9765 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9766 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9767 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9768 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9769 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9770 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9771 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9772 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9773 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
| 9774 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
| 9775 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); |
| 9776 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
| 9777 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9778 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
| 9779 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9780 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
| 9781 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9782 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9783 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9784 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9785 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9786 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9787 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9788 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9789 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9790 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9791 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9792 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9793 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9794 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9795 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9796 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9797 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9798 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9799 | |
| 9800 | /* "neighbor allowas-in" */ |
| 9801 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); |
| 9802 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); |
| 9803 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); |
| 9804 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
| 9805 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9806 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9807 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
| 9808 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9809 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); |
| 9810 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
| 9811 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); |
| 9812 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9813 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
| 9814 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9815 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9816 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
| 9817 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9818 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9819 | |
| 9820 | /* address-family commands. */ |
| 9821 | install_element (BGP_NODE, &address_family_ipv4_cmd); |
| 9822 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); |
| 9823 | #ifdef HAVE_IPV6 |
| 9824 | install_element (BGP_NODE, &address_family_ipv6_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9825 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9826 | #endif /* HAVE_IPV6 */ |
| 9827 | install_element (BGP_NODE, &address_family_vpnv4_cmd); |
| 9828 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); |
| 9829 | |
| 9830 | /* "exit-address-family" command. */ |
| 9831 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); |
| 9832 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); |
| 9833 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9834 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9835 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
| 9836 | |
| 9837 | /* "clear ip bgp commands" */ |
| 9838 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); |
| 9839 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); |
| 9840 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); |
| 9841 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
| 9842 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
| 9843 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
| 9844 | #ifdef HAVE_IPV6 |
| 9845 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
| 9846 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); |
| 9847 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); |
| 9848 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
| 9849 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
| 9850 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
| 9851 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
| 9852 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
| 9853 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
| 9854 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
| 9855 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
| 9856 | #endif /* HAVE_IPV6 */ |
| 9857 | |
| 9858 | /* "clear ip bgp neighbor soft in" */ |
| 9859 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); |
| 9860 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); |
| 9861 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); |
| 9862 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
| 9863 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); |
| 9864 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
| 9865 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
| 9866 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
| 9867 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); |
| 9868 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
| 9869 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
| 9870 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); |
| 9871 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
| 9872 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
| 9873 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); |
| 9874 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
| 9875 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
| 9876 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); |
| 9877 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); |
| 9878 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); |
| 9879 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
| 9880 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); |
| 9881 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
| 9882 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
| 9883 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
| 9884 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); |
| 9885 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
| 9886 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
| 9887 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); |
| 9888 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
| 9889 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
| 9890 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); |
| 9891 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
| 9892 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
| 9893 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); |
| 9894 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); |
| 9895 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); |
| 9896 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); |
| 9897 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); |
| 9898 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); |
| 9899 | #ifdef HAVE_IPV6 |
| 9900 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
| 9901 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); |
| 9902 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); |
| 9903 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
| 9904 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); |
| 9905 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
| 9906 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
| 9907 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); |
| 9908 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
| 9909 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
| 9910 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); |
| 9911 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
| 9912 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
| 9913 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); |
| 9914 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
| 9915 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
| 9916 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); |
| 9917 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
| 9918 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
| 9919 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); |
| 9920 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
| 9921 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
| 9922 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); |
| 9923 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
| 9924 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
| 9925 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); |
| 9926 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
| 9927 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
| 9928 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); |
| 9929 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
| 9930 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
| 9931 | #endif /* HAVE_IPV6 */ |
| 9932 | |
| 9933 | /* "clear ip bgp neighbor soft out" */ |
| 9934 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); |
| 9935 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); |
| 9936 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); |
| 9937 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
| 9938 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
| 9939 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
| 9940 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
| 9941 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
| 9942 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
| 9943 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
| 9944 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
| 9945 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
| 9946 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); |
| 9947 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); |
| 9948 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
| 9949 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
| 9950 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
| 9951 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
| 9952 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
| 9953 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
| 9954 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
| 9955 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
| 9956 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
| 9957 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); |
| 9958 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); |
| 9959 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); |
| 9960 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); |
| 9961 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); |
| 9962 | #ifdef HAVE_IPV6 |
| 9963 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
| 9964 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); |
| 9965 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); |
| 9966 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
| 9967 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
| 9968 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
| 9969 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
| 9970 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
| 9971 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
| 9972 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
| 9973 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
| 9974 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
| 9975 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
| 9976 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
| 9977 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
| 9978 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
| 9979 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
| 9980 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
| 9981 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
| 9982 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
| 9983 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
| 9984 | #endif /* HAVE_IPV6 */ |
| 9985 | |
| 9986 | /* "clear ip bgp neighbor soft" */ |
| 9987 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); |
| 9988 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); |
| 9989 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); |
| 9990 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
| 9991 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
| 9992 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
| 9993 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
| 9994 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); |
| 9995 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); |
| 9996 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
| 9997 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
| 9998 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
| 9999 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
| 10000 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); |
| 10001 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); |
| 10002 | #ifdef HAVE_IPV6 |
| 10003 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
| 10004 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); |
| 10005 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); |
| 10006 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
| 10007 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
| 10008 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
| 10009 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
| 10010 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
| 10011 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
| 10012 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
| 10013 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
| 10014 | #endif /* HAVE_IPV6 */ |
| 10015 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10016 | /* "clear ip bgp neighbor rsclient" */ |
| 10017 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); |
| 10018 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); |
| 10019 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); |
| 10020 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); |
| 10021 | #ifdef HAVE_IPV6 |
| 10022 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); |
| 10023 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); |
| 10024 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); |
| 10025 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); |
| 10026 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); |
| 10027 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); |
| 10028 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); |
| 10029 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); |
| 10030 | #endif /* HAVE_IPV6 */ |
| 10031 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10032 | /* "show ip bgp summary" commands. */ |
| 10033 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); |
| 10034 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
| 10035 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10036 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10037 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10038 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10039 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 10040 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 10041 | #ifdef HAVE_IPV6 |
| 10042 | install_element (VIEW_NODE, &show_bgp_summary_cmd); |
| 10043 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); |
| 10044 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10045 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10046 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10047 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10048 | #endif /* HAVE_IPV6 */ |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10049 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); |
| 10050 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
| 10051 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10052 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10053 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10054 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10055 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 10056 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 10057 | #ifdef HAVE_IPV6 |
| 10058 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); |
| 10059 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); |
| 10060 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10061 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10062 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10063 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10064 | #endif /* HAVE_IPV6 */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10065 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); |
| 10066 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
| 10067 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10068 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10069 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10070 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10071 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 10072 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 10073 | #ifdef HAVE_IPV6 |
| 10074 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); |
| 10075 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); |
| 10076 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10077 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10078 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10079 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10080 | #endif /* HAVE_IPV6 */ |
| 10081 | |
| 10082 | /* "show ip bgp neighbors" commands. */ |
| 10083 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); |
| 10084 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 10085 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10086 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10087 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 10088 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 10089 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10090 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10091 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 10092 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10093 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10094 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10095 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10096 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10097 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10098 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
| 10099 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 10100 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 10101 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 10102 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 10103 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 10104 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 10105 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 10106 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 10107 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 10108 | |
| 10109 | #ifdef HAVE_IPV6 |
| 10110 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); |
| 10111 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 10112 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); |
| 10113 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 10114 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
| 10115 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 10116 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10117 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10118 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
| 10119 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
| 10120 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10121 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10122 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
| 10123 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 10124 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); |
| 10125 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 10126 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
| 10127 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 10128 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 10129 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10130 | |
| 10131 | /* Old commands. */ |
| 10132 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); |
| 10133 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); |
| 10134 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); |
| 10135 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); |
| 10136 | #endif /* HAVE_IPV6 */ |
| 10137 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10138 | /* "show ip bgp rsclient" commands. */ |
| 10139 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10140 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10141 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10142 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10143 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10144 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10145 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10146 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10147 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10148 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10149 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10150 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10151 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 10152 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 10153 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 10154 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10155 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 10156 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10157 | |
| 10158 | #ifdef HAVE_IPV6 |
| 10159 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); |
| 10160 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10161 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10162 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10163 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10164 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10165 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
| 10166 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10167 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10168 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10169 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10170 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10171 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
| 10172 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 10173 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 10174 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 10175 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 10176 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 10177 | #endif /* HAVE_IPV6 */ |
| 10178 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10179 | /* "show ip bgp paths" commands. */ |
| 10180 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); |
| 10181 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 10182 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); |
| 10183 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 10184 | |
| 10185 | /* "show ip bgp community" commands. */ |
| 10186 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); |
| 10187 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); |
| 10188 | |
| 10189 | /* "show ip bgp attribute-info" commands. */ |
| 10190 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); |
| 10191 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); |
| 10192 | |
| 10193 | /* "redistribute" commands. */ |
| 10194 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); |
| 10195 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); |
| 10196 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); |
| 10197 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); |
| 10198 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); |
| 10199 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); |
| 10200 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); |
| 10201 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); |
| 10202 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); |
| 10203 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); |
| 10204 | #ifdef HAVE_IPV6 |
| 10205 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); |
| 10206 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); |
| 10207 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); |
| 10208 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); |
| 10209 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); |
| 10210 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); |
| 10211 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); |
| 10212 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); |
| 10213 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); |
| 10214 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); |
| 10215 | #endif /* HAVE_IPV6 */ |
| 10216 | |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 10217 | /* ttl_security commands */ |
| 10218 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); |
| 10219 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); |
| 10220 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 10221 | /* "show bgp memory" commands. */ |
| 10222 | install_element (VIEW_NODE, &show_bgp_memory_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 10223 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 10224 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
| 10225 | |
Michael Lambert | e0081f7 | 2008-11-16 20:12:04 +0000 | [diff] [blame] | 10226 | /* "show bgp views" commands. */ |
| 10227 | install_element (VIEW_NODE, &show_bgp_views_cmd); |
| 10228 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); |
| 10229 | install_element (ENABLE_NODE, &show_bgp_views_cmd); |
| 10230 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10231 | /* Community-list. */ |
| 10232 | community_list_vty (); |
| 10233 | } |
| 10234 | |
| 10235 | #include "memory.h" |
| 10236 | #include "bgp_regex.h" |
| 10237 | #include "bgp_clist.h" |
| 10238 | #include "bgp_ecommunity.h" |
| 10239 | |
| 10240 | /* VTY functions. */ |
| 10241 | |
| 10242 | /* Direction value to string conversion. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10243 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10244 | community_direct_str (int direct) |
| 10245 | { |
| 10246 | switch (direct) |
| 10247 | { |
| 10248 | case COMMUNITY_DENY: |
| 10249 | return "deny"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10250 | case COMMUNITY_PERMIT: |
| 10251 | return "permit"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10252 | default: |
| 10253 | return "unknown"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10254 | } |
| 10255 | } |
| 10256 | |
| 10257 | /* Display error string. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10258 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10259 | community_list_perror (struct vty *vty, int ret) |
| 10260 | { |
| 10261 | switch (ret) |
| 10262 | { |
| 10263 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10264 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10265 | break; |
| 10266 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: |
| 10267 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); |
| 10268 | break; |
| 10269 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: |
| 10270 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); |
| 10271 | break; |
| 10272 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: |
| 10273 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); |
| 10274 | break; |
| 10275 | } |
| 10276 | } |
| 10277 | |
| 10278 | /* VTY interface for community_set() function. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10279 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10280 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10281 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10282 | { |
| 10283 | int ret; |
| 10284 | int direct; |
| 10285 | char *str; |
| 10286 | |
| 10287 | /* Check the list type. */ |
| 10288 | if (strncmp (argv[1], "p", 1) == 0) |
| 10289 | direct = COMMUNITY_PERMIT; |
| 10290 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10291 | direct = COMMUNITY_DENY; |
| 10292 | else |
| 10293 | { |
| 10294 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10295 | VTY_NEWLINE); |
| 10296 | return CMD_WARNING; |
| 10297 | } |
| 10298 | |
| 10299 | /* All digit name check. */ |
| 10300 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10301 | { |
| 10302 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10303 | return CMD_WARNING; |
| 10304 | } |
| 10305 | |
| 10306 | /* Concat community string argument. */ |
| 10307 | if (argc > 1) |
| 10308 | str = argv_concat (argv, argc, 2); |
| 10309 | else |
| 10310 | str = NULL; |
| 10311 | |
| 10312 | /* When community_list_set() return nevetive value, it means |
| 10313 | malformed community string. */ |
| 10314 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); |
| 10315 | |
| 10316 | /* Free temporary community list string allocated by |
| 10317 | argv_concat(). */ |
| 10318 | if (str) |
| 10319 | XFREE (MTYPE_TMP, str); |
| 10320 | |
| 10321 | if (ret < 0) |
| 10322 | { |
| 10323 | /* Display error string. */ |
| 10324 | community_list_perror (vty, ret); |
| 10325 | return CMD_WARNING; |
| 10326 | } |
| 10327 | |
| 10328 | return CMD_SUCCESS; |
| 10329 | } |
| 10330 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10331 | /* Communiyt-list entry delete. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10332 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10333 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10334 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10335 | { |
| 10336 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10337 | int direct = 0; |
| 10338 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10339 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10340 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10341 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10342 | /* Check the list direct. */ |
| 10343 | if (strncmp (argv[1], "p", 1) == 0) |
| 10344 | direct = COMMUNITY_PERMIT; |
| 10345 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10346 | direct = COMMUNITY_DENY; |
| 10347 | else |
| 10348 | { |
| 10349 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10350 | VTY_NEWLINE); |
| 10351 | return CMD_WARNING; |
| 10352 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10353 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10354 | /* Concat community string argument. */ |
| 10355 | str = argv_concat (argv, argc, 2); |
| 10356 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10357 | |
| 10358 | /* Unset community list. */ |
| 10359 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10360 | |
| 10361 | /* Free temporary community list string allocated by |
| 10362 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10363 | if (str) |
| 10364 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10365 | |
| 10366 | if (ret < 0) |
| 10367 | { |
| 10368 | community_list_perror (vty, ret); |
| 10369 | return CMD_WARNING; |
| 10370 | } |
| 10371 | |
| 10372 | return CMD_SUCCESS; |
| 10373 | } |
| 10374 | |
| 10375 | /* "community-list" keyword help string. */ |
| 10376 | #define COMMUNITY_LIST_STR "Add a community list entry\n" |
| 10377 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" |
| 10378 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10379 | DEFUN (ip_community_list_standard, |
| 10380 | ip_community_list_standard_cmd, |
| 10381 | "ip community-list <1-99> (deny|permit) .AA:NN", |
| 10382 | IP_STR |
| 10383 | COMMUNITY_LIST_STR |
| 10384 | "Community list number (standard)\n" |
| 10385 | "Specify community to reject\n" |
| 10386 | "Specify community to accept\n" |
| 10387 | COMMUNITY_VAL_STR) |
| 10388 | { |
| 10389 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
| 10390 | } |
| 10391 | |
| 10392 | ALIAS (ip_community_list_standard, |
| 10393 | ip_community_list_standard2_cmd, |
| 10394 | "ip community-list <1-99> (deny|permit)", |
| 10395 | IP_STR |
| 10396 | COMMUNITY_LIST_STR |
| 10397 | "Community list number (standard)\n" |
| 10398 | "Specify community to reject\n" |
| 10399 | "Specify community to accept\n") |
| 10400 | |
| 10401 | DEFUN (ip_community_list_expanded, |
| 10402 | ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10403 | "ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10404 | IP_STR |
| 10405 | COMMUNITY_LIST_STR |
| 10406 | "Community list number (expanded)\n" |
| 10407 | "Specify community to reject\n" |
| 10408 | "Specify community to accept\n" |
| 10409 | "An ordered list as a regular-expression\n") |
| 10410 | { |
| 10411 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
| 10412 | } |
| 10413 | |
| 10414 | DEFUN (ip_community_list_name_standard, |
| 10415 | ip_community_list_name_standard_cmd, |
| 10416 | "ip community-list standard WORD (deny|permit) .AA:NN", |
| 10417 | IP_STR |
| 10418 | COMMUNITY_LIST_STR |
| 10419 | "Add a standard community-list entry\n" |
| 10420 | "Community list name\n" |
| 10421 | "Specify community to reject\n" |
| 10422 | "Specify community to accept\n" |
| 10423 | COMMUNITY_VAL_STR) |
| 10424 | { |
| 10425 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
| 10426 | } |
| 10427 | |
| 10428 | ALIAS (ip_community_list_name_standard, |
| 10429 | ip_community_list_name_standard2_cmd, |
| 10430 | "ip community-list standard WORD (deny|permit)", |
| 10431 | IP_STR |
| 10432 | COMMUNITY_LIST_STR |
| 10433 | "Add a standard community-list entry\n" |
| 10434 | "Community list name\n" |
| 10435 | "Specify community to reject\n" |
| 10436 | "Specify community to accept\n") |
| 10437 | |
| 10438 | DEFUN (ip_community_list_name_expanded, |
| 10439 | ip_community_list_name_expanded_cmd, |
| 10440 | "ip community-list expanded WORD (deny|permit) .LINE", |
| 10441 | IP_STR |
| 10442 | COMMUNITY_LIST_STR |
| 10443 | "Add an expanded community-list entry\n" |
| 10444 | "Community list name\n" |
| 10445 | "Specify community to reject\n" |
| 10446 | "Specify community to accept\n" |
| 10447 | "An ordered list as a regular-expression\n") |
| 10448 | { |
| 10449 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
| 10450 | } |
| 10451 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10452 | DEFUN (no_ip_community_list_standard_all, |
| 10453 | no_ip_community_list_standard_all_cmd, |
| 10454 | "no ip community-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10455 | NO_STR |
| 10456 | IP_STR |
| 10457 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10458 | "Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10459 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10460 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10461 | } |
| 10462 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10463 | DEFUN (no_ip_community_list_expanded_all, |
| 10464 | no_ip_community_list_expanded_all_cmd, |
| 10465 | "no ip community-list <100-500>", |
| 10466 | NO_STR |
| 10467 | IP_STR |
| 10468 | COMMUNITY_LIST_STR |
| 10469 | "Community list number (expanded)\n") |
| 10470 | { |
| 10471 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10472 | } |
| 10473 | |
| 10474 | DEFUN (no_ip_community_list_name_standard_all, |
| 10475 | no_ip_community_list_name_standard_all_cmd, |
| 10476 | "no ip community-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10477 | NO_STR |
| 10478 | IP_STR |
| 10479 | COMMUNITY_LIST_STR |
| 10480 | "Add a standard community-list entry\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10481 | "Community list name\n") |
| 10482 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10483 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10484 | } |
| 10485 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10486 | DEFUN (no_ip_community_list_name_expanded_all, |
| 10487 | no_ip_community_list_name_expanded_all_cmd, |
| 10488 | "no ip community-list expanded WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10489 | NO_STR |
| 10490 | IP_STR |
| 10491 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10492 | "Add an expanded community-list entry\n" |
| 10493 | "Community list name\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10494 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10495 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10496 | } |
| 10497 | |
| 10498 | DEFUN (no_ip_community_list_standard, |
| 10499 | no_ip_community_list_standard_cmd, |
| 10500 | "no ip community-list <1-99> (deny|permit) .AA:NN", |
| 10501 | NO_STR |
| 10502 | IP_STR |
| 10503 | COMMUNITY_LIST_STR |
| 10504 | "Community list number (standard)\n" |
| 10505 | "Specify community to reject\n" |
| 10506 | "Specify community to accept\n" |
| 10507 | COMMUNITY_VAL_STR) |
| 10508 | { |
| 10509 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 10510 | } |
| 10511 | |
| 10512 | DEFUN (no_ip_community_list_expanded, |
| 10513 | no_ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10514 | "no ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10515 | NO_STR |
| 10516 | IP_STR |
| 10517 | COMMUNITY_LIST_STR |
| 10518 | "Community list number (expanded)\n" |
| 10519 | "Specify community to reject\n" |
| 10520 | "Specify community to accept\n" |
| 10521 | "An ordered list as a regular-expression\n") |
| 10522 | { |
| 10523 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10524 | } |
| 10525 | |
| 10526 | DEFUN (no_ip_community_list_name_standard, |
| 10527 | no_ip_community_list_name_standard_cmd, |
| 10528 | "no ip community-list standard WORD (deny|permit) .AA:NN", |
| 10529 | NO_STR |
| 10530 | IP_STR |
| 10531 | COMMUNITY_LIST_STR |
| 10532 | "Specify a standard community-list\n" |
| 10533 | "Community list name\n" |
| 10534 | "Specify community to reject\n" |
| 10535 | "Specify community to accept\n" |
| 10536 | COMMUNITY_VAL_STR) |
| 10537 | { |
| 10538 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 10539 | } |
| 10540 | |
| 10541 | DEFUN (no_ip_community_list_name_expanded, |
| 10542 | no_ip_community_list_name_expanded_cmd, |
| 10543 | "no ip community-list expanded WORD (deny|permit) .LINE", |
| 10544 | NO_STR |
| 10545 | IP_STR |
| 10546 | COMMUNITY_LIST_STR |
| 10547 | "Specify an expanded community-list\n" |
| 10548 | "Community list name\n" |
| 10549 | "Specify community to reject\n" |
| 10550 | "Specify community to accept\n" |
| 10551 | "An ordered list as a regular-expression\n") |
| 10552 | { |
| 10553 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10554 | } |
| 10555 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10556 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10557 | community_list_show (struct vty *vty, struct community_list *list) |
| 10558 | { |
| 10559 | struct community_entry *entry; |
| 10560 | |
| 10561 | for (entry = list->head; entry; entry = entry->next) |
| 10562 | { |
| 10563 | if (entry == list->head) |
| 10564 | { |
| 10565 | if (all_digit (list->name)) |
| 10566 | vty_out (vty, "Community %s list %s%s", |
| 10567 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 10568 | "standard" : "(expanded) access", |
| 10569 | list->name, VTY_NEWLINE); |
| 10570 | else |
| 10571 | vty_out (vty, "Named Community %s list %s%s", |
| 10572 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 10573 | "standard" : "expanded", |
| 10574 | list->name, VTY_NEWLINE); |
| 10575 | } |
| 10576 | if (entry->any) |
| 10577 | vty_out (vty, " %s%s", |
| 10578 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10579 | else |
| 10580 | vty_out (vty, " %s %s%s", |
| 10581 | community_direct_str (entry->direct), |
| 10582 | entry->style == COMMUNITY_LIST_STANDARD |
| 10583 | ? community_str (entry->u.com) : entry->config, |
| 10584 | VTY_NEWLINE); |
| 10585 | } |
| 10586 | } |
| 10587 | |
| 10588 | DEFUN (show_ip_community_list, |
| 10589 | show_ip_community_list_cmd, |
| 10590 | "show ip community-list", |
| 10591 | SHOW_STR |
| 10592 | IP_STR |
| 10593 | "List community-list\n") |
| 10594 | { |
| 10595 | struct community_list *list; |
| 10596 | struct community_list_master *cm; |
| 10597 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10598 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10599 | if (! cm) |
| 10600 | return CMD_SUCCESS; |
| 10601 | |
| 10602 | for (list = cm->num.head; list; list = list->next) |
| 10603 | community_list_show (vty, list); |
| 10604 | |
| 10605 | for (list = cm->str.head; list; list = list->next) |
| 10606 | community_list_show (vty, list); |
| 10607 | |
| 10608 | return CMD_SUCCESS; |
| 10609 | } |
| 10610 | |
| 10611 | DEFUN (show_ip_community_list_arg, |
| 10612 | show_ip_community_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10613 | "show ip community-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10614 | SHOW_STR |
| 10615 | IP_STR |
| 10616 | "List community-list\n" |
| 10617 | "Community-list number\n" |
| 10618 | "Community-list name\n") |
| 10619 | { |
| 10620 | struct community_list *list; |
| 10621 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10622 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10623 | if (! list) |
| 10624 | { |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10625 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10626 | return CMD_WARNING; |
| 10627 | } |
| 10628 | |
| 10629 | community_list_show (vty, list); |
| 10630 | |
| 10631 | return CMD_SUCCESS; |
| 10632 | } |
| 10633 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10634 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10635 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10636 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10637 | { |
| 10638 | int ret; |
| 10639 | int direct; |
| 10640 | char *str; |
| 10641 | |
| 10642 | /* Check the list type. */ |
| 10643 | if (strncmp (argv[1], "p", 1) == 0) |
| 10644 | direct = COMMUNITY_PERMIT; |
| 10645 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10646 | direct = COMMUNITY_DENY; |
| 10647 | else |
| 10648 | { |
| 10649 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10650 | VTY_NEWLINE); |
| 10651 | return CMD_WARNING; |
| 10652 | } |
| 10653 | |
| 10654 | /* All digit name check. */ |
| 10655 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10656 | { |
| 10657 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10658 | return CMD_WARNING; |
| 10659 | } |
| 10660 | |
| 10661 | /* Concat community string argument. */ |
| 10662 | if (argc > 1) |
| 10663 | str = argv_concat (argv, argc, 2); |
| 10664 | else |
| 10665 | str = NULL; |
| 10666 | |
| 10667 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); |
| 10668 | |
| 10669 | /* Free temporary community list string allocated by |
| 10670 | argv_concat(). */ |
| 10671 | if (str) |
| 10672 | XFREE (MTYPE_TMP, str); |
| 10673 | |
| 10674 | if (ret < 0) |
| 10675 | { |
| 10676 | community_list_perror (vty, ret); |
| 10677 | return CMD_WARNING; |
| 10678 | } |
| 10679 | return CMD_SUCCESS; |
| 10680 | } |
| 10681 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10682 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10683 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10684 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10685 | { |
| 10686 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10687 | int direct = 0; |
| 10688 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10689 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10690 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10691 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10692 | /* Check the list direct. */ |
| 10693 | if (strncmp (argv[1], "p", 1) == 0) |
| 10694 | direct = COMMUNITY_PERMIT; |
| 10695 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10696 | direct = COMMUNITY_DENY; |
| 10697 | else |
| 10698 | { |
| 10699 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10700 | VTY_NEWLINE); |
| 10701 | return CMD_WARNING; |
| 10702 | } |
| 10703 | |
| 10704 | /* Concat community string argument. */ |
| 10705 | str = argv_concat (argv, argc, 2); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10706 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10707 | |
| 10708 | /* Unset community list. */ |
| 10709 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10710 | |
| 10711 | /* Free temporary community list string allocated by |
| 10712 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10713 | if (str) |
| 10714 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10715 | |
| 10716 | if (ret < 0) |
| 10717 | { |
| 10718 | community_list_perror (vty, ret); |
| 10719 | return CMD_WARNING; |
| 10720 | } |
| 10721 | |
| 10722 | return CMD_SUCCESS; |
| 10723 | } |
| 10724 | |
| 10725 | /* "extcommunity-list" keyword help string. */ |
| 10726 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" |
| 10727 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" |
| 10728 | |
| 10729 | DEFUN (ip_extcommunity_list_standard, |
| 10730 | ip_extcommunity_list_standard_cmd, |
| 10731 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10732 | IP_STR |
| 10733 | EXTCOMMUNITY_LIST_STR |
| 10734 | "Extended Community list number (standard)\n" |
| 10735 | "Specify community to reject\n" |
| 10736 | "Specify community to accept\n" |
| 10737 | EXTCOMMUNITY_VAL_STR) |
| 10738 | { |
| 10739 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
| 10740 | } |
| 10741 | |
| 10742 | ALIAS (ip_extcommunity_list_standard, |
| 10743 | ip_extcommunity_list_standard2_cmd, |
| 10744 | "ip extcommunity-list <1-99> (deny|permit)", |
| 10745 | IP_STR |
| 10746 | EXTCOMMUNITY_LIST_STR |
| 10747 | "Extended Community list number (standard)\n" |
| 10748 | "Specify community to reject\n" |
| 10749 | "Specify community to accept\n") |
| 10750 | |
| 10751 | DEFUN (ip_extcommunity_list_expanded, |
| 10752 | ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10753 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10754 | IP_STR |
| 10755 | EXTCOMMUNITY_LIST_STR |
| 10756 | "Extended Community list number (expanded)\n" |
| 10757 | "Specify community to reject\n" |
| 10758 | "Specify community to accept\n" |
| 10759 | "An ordered list as a regular-expression\n") |
| 10760 | { |
| 10761 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
| 10762 | } |
| 10763 | |
| 10764 | DEFUN (ip_extcommunity_list_name_standard, |
| 10765 | ip_extcommunity_list_name_standard_cmd, |
| 10766 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10767 | IP_STR |
| 10768 | EXTCOMMUNITY_LIST_STR |
| 10769 | "Specify standard extcommunity-list\n" |
| 10770 | "Extended Community list name\n" |
| 10771 | "Specify community to reject\n" |
| 10772 | "Specify community to accept\n" |
| 10773 | EXTCOMMUNITY_VAL_STR) |
| 10774 | { |
| 10775 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
| 10776 | } |
| 10777 | |
| 10778 | ALIAS (ip_extcommunity_list_name_standard, |
| 10779 | ip_extcommunity_list_name_standard2_cmd, |
| 10780 | "ip extcommunity-list standard WORD (deny|permit)", |
| 10781 | IP_STR |
| 10782 | EXTCOMMUNITY_LIST_STR |
| 10783 | "Specify standard extcommunity-list\n" |
| 10784 | "Extended Community list name\n" |
| 10785 | "Specify community to reject\n" |
| 10786 | "Specify community to accept\n") |
| 10787 | |
| 10788 | DEFUN (ip_extcommunity_list_name_expanded, |
| 10789 | ip_extcommunity_list_name_expanded_cmd, |
| 10790 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10791 | IP_STR |
| 10792 | EXTCOMMUNITY_LIST_STR |
| 10793 | "Specify expanded extcommunity-list\n" |
| 10794 | "Extended Community list name\n" |
| 10795 | "Specify community to reject\n" |
| 10796 | "Specify community to accept\n" |
| 10797 | "An ordered list as a regular-expression\n") |
| 10798 | { |
| 10799 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
| 10800 | } |
| 10801 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10802 | DEFUN (no_ip_extcommunity_list_standard_all, |
| 10803 | no_ip_extcommunity_list_standard_all_cmd, |
| 10804 | "no ip extcommunity-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10805 | NO_STR |
| 10806 | IP_STR |
| 10807 | EXTCOMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10808 | "Extended Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10809 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10810 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10811 | } |
| 10812 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10813 | DEFUN (no_ip_extcommunity_list_expanded_all, |
| 10814 | no_ip_extcommunity_list_expanded_all_cmd, |
| 10815 | "no ip extcommunity-list <100-500>", |
| 10816 | NO_STR |
| 10817 | IP_STR |
| 10818 | EXTCOMMUNITY_LIST_STR |
| 10819 | "Extended Community list number (expanded)\n") |
| 10820 | { |
| 10821 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10822 | } |
| 10823 | |
| 10824 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
| 10825 | no_ip_extcommunity_list_name_standard_all_cmd, |
| 10826 | "no ip extcommunity-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10827 | NO_STR |
| 10828 | IP_STR |
| 10829 | EXTCOMMUNITY_LIST_STR |
| 10830 | "Specify standard extcommunity-list\n" |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10831 | "Extended Community list name\n") |
| 10832 | { |
| 10833 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10834 | } |
| 10835 | |
| 10836 | DEFUN (no_ip_extcommunity_list_name_expanded_all, |
| 10837 | no_ip_extcommunity_list_name_expanded_all_cmd, |
| 10838 | "no ip extcommunity-list expanded WORD", |
| 10839 | NO_STR |
| 10840 | IP_STR |
| 10841 | EXTCOMMUNITY_LIST_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10842 | "Specify expanded extcommunity-list\n" |
| 10843 | "Extended Community list name\n") |
| 10844 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10845 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10846 | } |
| 10847 | |
| 10848 | DEFUN (no_ip_extcommunity_list_standard, |
| 10849 | no_ip_extcommunity_list_standard_cmd, |
| 10850 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10851 | NO_STR |
| 10852 | IP_STR |
| 10853 | EXTCOMMUNITY_LIST_STR |
| 10854 | "Extended Community list number (standard)\n" |
| 10855 | "Specify community to reject\n" |
| 10856 | "Specify community to accept\n" |
| 10857 | EXTCOMMUNITY_VAL_STR) |
| 10858 | { |
| 10859 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10860 | } |
| 10861 | |
| 10862 | DEFUN (no_ip_extcommunity_list_expanded, |
| 10863 | no_ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10864 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10865 | NO_STR |
| 10866 | IP_STR |
| 10867 | EXTCOMMUNITY_LIST_STR |
| 10868 | "Extended Community list number (expanded)\n" |
| 10869 | "Specify community to reject\n" |
| 10870 | "Specify community to accept\n" |
| 10871 | "An ordered list as a regular-expression\n") |
| 10872 | { |
| 10873 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10874 | } |
| 10875 | |
| 10876 | DEFUN (no_ip_extcommunity_list_name_standard, |
| 10877 | no_ip_extcommunity_list_name_standard_cmd, |
| 10878 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10879 | NO_STR |
| 10880 | IP_STR |
| 10881 | EXTCOMMUNITY_LIST_STR |
| 10882 | "Specify standard extcommunity-list\n" |
| 10883 | "Extended Community list name\n" |
| 10884 | "Specify community to reject\n" |
| 10885 | "Specify community to accept\n" |
| 10886 | EXTCOMMUNITY_VAL_STR) |
| 10887 | { |
| 10888 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10889 | } |
| 10890 | |
| 10891 | DEFUN (no_ip_extcommunity_list_name_expanded, |
| 10892 | no_ip_extcommunity_list_name_expanded_cmd, |
| 10893 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10894 | NO_STR |
| 10895 | IP_STR |
| 10896 | EXTCOMMUNITY_LIST_STR |
| 10897 | "Specify expanded extcommunity-list\n" |
| 10898 | "Community list name\n" |
| 10899 | "Specify community to reject\n" |
| 10900 | "Specify community to accept\n" |
| 10901 | "An ordered list as a regular-expression\n") |
| 10902 | { |
| 10903 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10904 | } |
| 10905 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10906 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10907 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
| 10908 | { |
| 10909 | struct community_entry *entry; |
| 10910 | |
| 10911 | for (entry = list->head; entry; entry = entry->next) |
| 10912 | { |
| 10913 | if (entry == list->head) |
| 10914 | { |
| 10915 | if (all_digit (list->name)) |
| 10916 | vty_out (vty, "Extended community %s list %s%s", |
| 10917 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10918 | "standard" : "(expanded) access", |
| 10919 | list->name, VTY_NEWLINE); |
| 10920 | else |
| 10921 | vty_out (vty, "Named extended community %s list %s%s", |
| 10922 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10923 | "standard" : "expanded", |
| 10924 | list->name, VTY_NEWLINE); |
| 10925 | } |
| 10926 | if (entry->any) |
| 10927 | vty_out (vty, " %s%s", |
| 10928 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10929 | else |
| 10930 | vty_out (vty, " %s %s%s", |
| 10931 | community_direct_str (entry->direct), |
| 10932 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10933 | entry->u.ecom->str : entry->config, |
| 10934 | VTY_NEWLINE); |
| 10935 | } |
| 10936 | } |
| 10937 | |
| 10938 | DEFUN (show_ip_extcommunity_list, |
| 10939 | show_ip_extcommunity_list_cmd, |
| 10940 | "show ip extcommunity-list", |
| 10941 | SHOW_STR |
| 10942 | IP_STR |
| 10943 | "List extended-community list\n") |
| 10944 | { |
| 10945 | struct community_list *list; |
| 10946 | struct community_list_master *cm; |
| 10947 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10948 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10949 | if (! cm) |
| 10950 | return CMD_SUCCESS; |
| 10951 | |
| 10952 | for (list = cm->num.head; list; list = list->next) |
| 10953 | extcommunity_list_show (vty, list); |
| 10954 | |
| 10955 | for (list = cm->str.head; list; list = list->next) |
| 10956 | extcommunity_list_show (vty, list); |
| 10957 | |
| 10958 | return CMD_SUCCESS; |
| 10959 | } |
| 10960 | |
| 10961 | DEFUN (show_ip_extcommunity_list_arg, |
| 10962 | show_ip_extcommunity_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10963 | "show ip extcommunity-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10964 | SHOW_STR |
| 10965 | IP_STR |
| 10966 | "List extended-community list\n" |
| 10967 | "Extcommunity-list number\n" |
| 10968 | "Extcommunity-list name\n") |
| 10969 | { |
| 10970 | struct community_list *list; |
| 10971 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10972 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10973 | if (! list) |
| 10974 | { |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10975 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10976 | return CMD_WARNING; |
| 10977 | } |
| 10978 | |
| 10979 | extcommunity_list_show (vty, list); |
| 10980 | |
| 10981 | return CMD_SUCCESS; |
| 10982 | } |
| 10983 | |
| 10984 | /* Return configuration string of community-list entry. */ |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10985 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10986 | community_list_config_str (struct community_entry *entry) |
| 10987 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10988 | const char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10989 | |
| 10990 | if (entry->any) |
| 10991 | str = ""; |
| 10992 | else |
| 10993 | { |
| 10994 | if (entry->style == COMMUNITY_LIST_STANDARD) |
| 10995 | str = community_str (entry->u.com); |
| 10996 | else |
| 10997 | str = entry->config; |
| 10998 | } |
| 10999 | return str; |
| 11000 | } |
| 11001 | |
| 11002 | /* Display community-list and extcommunity-list configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 11003 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11004 | community_list_config_write (struct vty *vty) |
| 11005 | { |
| 11006 | struct community_list *list; |
| 11007 | struct community_entry *entry; |
| 11008 | struct community_list_master *cm; |
| 11009 | int write = 0; |
| 11010 | |
| 11011 | /* Community-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11012 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11013 | |
| 11014 | for (list = cm->num.head; list; list = list->next) |
| 11015 | for (entry = list->head; entry; entry = entry->next) |
| 11016 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11017 | vty_out (vty, "ip community-list %s %s %s%s", |
| 11018 | list->name, community_direct_str (entry->direct), |
| 11019 | community_list_config_str (entry), |
| 11020 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11021 | write++; |
| 11022 | } |
| 11023 | for (list = cm->str.head; list; list = list->next) |
| 11024 | for (entry = list->head; entry; entry = entry->next) |
| 11025 | { |
| 11026 | vty_out (vty, "ip community-list %s %s %s %s%s", |
| 11027 | entry->style == COMMUNITY_LIST_STANDARD |
| 11028 | ? "standard" : "expanded", |
| 11029 | list->name, community_direct_str (entry->direct), |
| 11030 | community_list_config_str (entry), |
| 11031 | VTY_NEWLINE); |
| 11032 | write++; |
| 11033 | } |
| 11034 | |
| 11035 | /* Extcommunity-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11036 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11037 | |
| 11038 | for (list = cm->num.head; list; list = list->next) |
| 11039 | for (entry = list->head; entry; entry = entry->next) |
| 11040 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11041 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
| 11042 | list->name, community_direct_str (entry->direct), |
| 11043 | community_list_config_str (entry), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11044 | write++; |
| 11045 | } |
| 11046 | for (list = cm->str.head; list; list = list->next) |
| 11047 | for (entry = list->head; entry; entry = entry->next) |
| 11048 | { |
| 11049 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", |
| 11050 | entry->style == EXTCOMMUNITY_LIST_STANDARD |
| 11051 | ? "standard" : "expanded", |
| 11052 | list->name, community_direct_str (entry->direct), |
| 11053 | community_list_config_str (entry), VTY_NEWLINE); |
| 11054 | write++; |
| 11055 | } |
| 11056 | return write; |
| 11057 | } |
| 11058 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 11059 | static struct cmd_node community_list_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11060 | { |
| 11061 | COMMUNITY_LIST_NODE, |
| 11062 | "", |
| 11063 | 1 /* Export to vtysh. */ |
| 11064 | }; |
| 11065 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 11066 | static void |
| 11067 | community_list_vty (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11068 | { |
| 11069 | install_node (&community_list_node, community_list_config_write); |
| 11070 | |
| 11071 | /* Community-list. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11072 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
| 11073 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); |
| 11074 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); |
| 11075 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); |
| 11076 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); |
| 11077 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11078 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
| 11079 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
| 11080 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); |
| 11081 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11082 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
| 11083 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); |
| 11084 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); |
| 11085 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
| 11086 | install_element (VIEW_NODE, &show_ip_community_list_cmd); |
| 11087 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); |
| 11088 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); |
| 11089 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); |
| 11090 | |
| 11091 | /* Extcommunity-list. */ |
| 11092 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); |
| 11093 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); |
| 11094 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); |
| 11095 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); |
| 11096 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); |
| 11097 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 11098 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
| 11099 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
| 11100 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); |
| 11101 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11102 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
| 11103 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); |
| 11104 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); |
| 11105 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
| 11106 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); |
| 11107 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 11108 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); |
| 11109 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 11110 | } |