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" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 51 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 52 | extern struct in_addr router_id_zebra; |
| 53 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 54 | /* Utility function to get address family from current node. */ |
| 55 | afi_t |
| 56 | bgp_node_afi (struct vty *vty) |
| 57 | { |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 58 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 59 | return AFI_IP6; |
| 60 | return AFI_IP; |
| 61 | } |
| 62 | |
| 63 | /* Utility function to get subsequent address family from current |
| 64 | node. */ |
| 65 | safi_t |
| 66 | bgp_node_safi (struct vty *vty) |
| 67 | { |
| 68 | if (vty->node == BGP_VPNV4_NODE) |
| 69 | return SAFI_MPLS_VPN; |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 70 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 71 | return SAFI_MULTICAST; |
| 72 | return SAFI_UNICAST; |
| 73 | } |
| 74 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 75 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 76 | peer_address_self_check (union sockunion *su) |
| 77 | { |
| 78 | struct interface *ifp = NULL; |
| 79 | |
| 80 | if (su->sa.sa_family == AF_INET) |
| 81 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); |
| 82 | #ifdef HAVE_IPV6 |
| 83 | else if (su->sa.sa_family == AF_INET6) |
| 84 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); |
| 85 | #endif /* HAVE IPV6 */ |
| 86 | |
| 87 | if (ifp) |
| 88 | return 1; |
| 89 | |
| 90 | return 0; |
| 91 | } |
| 92 | |
| 93 | /* Utility function for looking up peer from VTY. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 94 | static struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 95 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 96 | { |
| 97 | int ret; |
| 98 | struct bgp *bgp; |
| 99 | union sockunion su; |
| 100 | struct peer *peer; |
| 101 | |
| 102 | bgp = vty->index; |
| 103 | |
| 104 | ret = str2sockunion (ip_str, &su); |
| 105 | if (ret < 0) |
| 106 | { |
| 107 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 108 | return NULL; |
| 109 | } |
| 110 | |
| 111 | peer = peer_lookup (bgp, &su); |
| 112 | if (! peer) |
| 113 | { |
| 114 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE); |
| 115 | return NULL; |
| 116 | } |
| 117 | return peer; |
| 118 | } |
| 119 | |
| 120 | /* Utility function for looking up peer or peer group. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 121 | static struct peer * |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 122 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 123 | { |
| 124 | int ret; |
| 125 | struct bgp *bgp; |
| 126 | union sockunion su; |
| 127 | struct peer *peer; |
| 128 | struct peer_group *group; |
| 129 | |
| 130 | bgp = vty->index; |
| 131 | |
| 132 | ret = str2sockunion (peer_str, &su); |
| 133 | if (ret == 0) |
| 134 | { |
| 135 | peer = peer_lookup (bgp, &su); |
| 136 | if (peer) |
| 137 | return peer; |
| 138 | } |
| 139 | else |
| 140 | { |
| 141 | group = peer_group_lookup (bgp, peer_str); |
| 142 | if (group) |
| 143 | return group->conf; |
| 144 | } |
| 145 | |
| 146 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
| 147 | VTY_NEWLINE); |
| 148 | |
| 149 | return NULL; |
| 150 | } |
| 151 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 152 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 153 | bgp_vty_return (struct vty *vty, int ret) |
| 154 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 155 | const char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 156 | |
| 157 | switch (ret) |
| 158 | { |
| 159 | case BGP_ERR_INVALID_VALUE: |
| 160 | str = "Invalid value"; |
| 161 | break; |
| 162 | case BGP_ERR_INVALID_FLAG: |
| 163 | str = "Invalid flag"; |
| 164 | break; |
| 165 | case BGP_ERR_PEER_INACTIVE: |
| 166 | str = "Activate the neighbor for the address family first"; |
| 167 | break; |
| 168 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: |
| 169 | str = "Invalid command for a peer-group member"; |
| 170 | break; |
| 171 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
| 172 | str = "Peer-group has been shutdown. Activate the peer-group first"; |
| 173 | break; |
| 174 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: |
| 175 | str = "This peer is a peer-group member. Please change peer-group configuration"; |
| 176 | break; |
| 177 | case BGP_ERR_PEER_FLAG_CONFLICT: |
| 178 | str = "Can't set override-capability and strict-capability-match at the same time"; |
| 179 | break; |
| 180 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: |
| 181 | str = "No activate for peergroup can be given only if peer-group has no members"; |
| 182 | break; |
| 183 | case BGP_ERR_PEER_BELONGS_TO_GROUP: |
| 184 | str = "No activate for an individual peer-group member is invalid"; |
| 185 | break; |
| 186 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: |
| 187 | str = "Activate the peer-group for the address family first"; |
| 188 | break; |
| 189 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
| 190 | str = "Specify remote-as or peer-group remote AS first"; |
| 191 | break; |
| 192 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: |
| 193 | str = "Cannot change the peer-group. Deconfigure first"; |
| 194 | break; |
| 195 | case BGP_ERR_PEER_GROUP_MISMATCH: |
| 196 | str = "Cannot have different peer-group for the neighbor"; |
| 197 | break; |
| 198 | case BGP_ERR_PEER_FILTER_CONFLICT: |
| 199 | str = "Prefix/distribute list can not co-exist"; |
| 200 | break; |
| 201 | case BGP_ERR_NOT_INTERNAL_PEER: |
| 202 | str = "Invalid command. Not an internal neighbor"; |
| 203 | break; |
| 204 | case BGP_ERR_REMOVE_PRIVATE_AS: |
| 205 | str = "Private AS cannot be removed for IBGP peers"; |
| 206 | break; |
| 207 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: |
| 208 | str = "Local-AS allowed only for EBGP peers"; |
| 209 | break; |
| 210 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: |
| 211 | str = "Cannot have local-as same as BGP AS number"; |
| 212 | break; |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 213 | case BGP_ERR_TCPSIG_FAILED: |
| 214 | str = "Error while applying TCP-Sig to session(s)"; |
| 215 | break; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 216 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
| 217 | str = "ebgp-multihop and ttl-security cannot be configured together"; |
| 218 | break; |
Stephen Hemminger | f5a4827 | 2011-03-24 17:30:21 +0000 | [diff] [blame] | 219 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
| 220 | str = "ttl-security only allowed for EBGP peers"; |
| 221 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 222 | } |
| 223 | if (str) |
| 224 | { |
| 225 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); |
| 226 | return CMD_WARNING; |
| 227 | } |
| 228 | return CMD_SUCCESS; |
| 229 | } |
| 230 | |
| 231 | /* BGP global configuration. */ |
| 232 | |
| 233 | DEFUN (bgp_multiple_instance_func, |
| 234 | bgp_multiple_instance_cmd, |
| 235 | "bgp multiple-instance", |
| 236 | BGP_STR |
| 237 | "Enable bgp multiple instance\n") |
| 238 | { |
| 239 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); |
| 240 | return CMD_SUCCESS; |
| 241 | } |
| 242 | |
| 243 | DEFUN (no_bgp_multiple_instance, |
| 244 | no_bgp_multiple_instance_cmd, |
| 245 | "no bgp multiple-instance", |
| 246 | NO_STR |
| 247 | BGP_STR |
| 248 | "BGP multiple instance\n") |
| 249 | { |
| 250 | int ret; |
| 251 | |
| 252 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); |
| 253 | if (ret < 0) |
| 254 | { |
| 255 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); |
| 256 | return CMD_WARNING; |
| 257 | } |
| 258 | return CMD_SUCCESS; |
| 259 | } |
| 260 | |
| 261 | DEFUN (bgp_config_type, |
| 262 | bgp_config_type_cmd, |
| 263 | "bgp config-type (cisco|zebra)", |
| 264 | BGP_STR |
| 265 | "Configuration type\n" |
| 266 | "cisco\n" |
| 267 | "zebra\n") |
| 268 | { |
| 269 | if (strncmp (argv[0], "c", 1) == 0) |
| 270 | bgp_option_set (BGP_OPT_CONFIG_CISCO); |
| 271 | else |
| 272 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 273 | |
| 274 | return CMD_SUCCESS; |
| 275 | } |
| 276 | |
| 277 | DEFUN (no_bgp_config_type, |
| 278 | no_bgp_config_type_cmd, |
| 279 | "no bgp config-type", |
| 280 | NO_STR |
| 281 | BGP_STR |
| 282 | "Display configuration type\n") |
| 283 | { |
| 284 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 285 | return CMD_SUCCESS; |
| 286 | } |
| 287 | |
| 288 | DEFUN (no_synchronization, |
| 289 | no_synchronization_cmd, |
| 290 | "no synchronization", |
| 291 | NO_STR |
| 292 | "Perform IGP synchronization\n") |
| 293 | { |
| 294 | return CMD_SUCCESS; |
| 295 | } |
| 296 | |
| 297 | DEFUN (no_auto_summary, |
| 298 | no_auto_summary_cmd, |
| 299 | "no auto-summary", |
| 300 | NO_STR |
| 301 | "Enable automatic network number summarization\n") |
| 302 | { |
| 303 | return CMD_SUCCESS; |
| 304 | } |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 305 | |
| 306 | DEFUN_DEPRECATED (neighbor_version, |
| 307 | neighbor_version_cmd, |
| 308 | NEIGHBOR_CMD "version (4|4-)", |
| 309 | NEIGHBOR_STR |
| 310 | NEIGHBOR_ADDR_STR |
| 311 | "Set the BGP version to match a neighbor\n" |
| 312 | "Neighbor's BGP version\n") |
| 313 | { |
| 314 | return CMD_SUCCESS; |
| 315 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 316 | |
| 317 | /* "router bgp" commands. */ |
| 318 | DEFUN (router_bgp, |
| 319 | router_bgp_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 320 | "router bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 321 | ROUTER_STR |
| 322 | BGP_STR |
| 323 | AS_STR) |
| 324 | { |
| 325 | int ret; |
| 326 | as_t as; |
| 327 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 328 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 329 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 330 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 331 | |
| 332 | if (argc == 2) |
| 333 | name = argv[1]; |
| 334 | |
| 335 | ret = bgp_get (&bgp, &as, name); |
| 336 | switch (ret) |
| 337 | { |
| 338 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: |
| 339 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", |
| 340 | VTY_NEWLINE); |
| 341 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 342 | case BGP_ERR_AS_MISMATCH: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 343 | 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] | 344 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 345 | case BGP_ERR_INSTANCE_MISMATCH: |
| 346 | 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] | 347 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 348 | as, VTY_NEWLINE); |
| 349 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 350 | } |
| 351 | |
| 352 | vty->node = BGP_NODE; |
| 353 | vty->index = bgp; |
| 354 | |
| 355 | return CMD_SUCCESS; |
| 356 | } |
| 357 | |
| 358 | ALIAS (router_bgp, |
| 359 | router_bgp_view_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 360 | "router bgp " CMD_AS_RANGE " view WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 361 | ROUTER_STR |
| 362 | BGP_STR |
| 363 | AS_STR |
| 364 | "BGP view\n" |
| 365 | "view name\n") |
| 366 | |
| 367 | /* "no router bgp" commands. */ |
| 368 | DEFUN (no_router_bgp, |
| 369 | no_router_bgp_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 370 | "no router bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 371 | NO_STR |
| 372 | ROUTER_STR |
| 373 | BGP_STR |
| 374 | AS_STR) |
| 375 | { |
| 376 | as_t as; |
| 377 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 378 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 379 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 380 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 381 | |
| 382 | if (argc == 2) |
| 383 | name = argv[1]; |
| 384 | |
| 385 | /* Lookup bgp structure. */ |
| 386 | bgp = bgp_lookup (as, name); |
| 387 | if (! bgp) |
| 388 | { |
| 389 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); |
| 390 | return CMD_WARNING; |
| 391 | } |
| 392 | |
| 393 | bgp_delete (bgp); |
| 394 | |
| 395 | return CMD_SUCCESS; |
| 396 | } |
| 397 | |
| 398 | ALIAS (no_router_bgp, |
| 399 | no_router_bgp_view_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 400 | "no router bgp " CMD_AS_RANGE " view WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 401 | NO_STR |
| 402 | ROUTER_STR |
| 403 | BGP_STR |
| 404 | AS_STR |
| 405 | "BGP view\n" |
| 406 | "view name\n") |
| 407 | |
| 408 | /* BGP router-id. */ |
| 409 | |
| 410 | DEFUN (bgp_router_id, |
| 411 | bgp_router_id_cmd, |
| 412 | "bgp router-id A.B.C.D", |
| 413 | BGP_STR |
| 414 | "Override configured router identifier\n" |
| 415 | "Manually configured router identifier\n") |
| 416 | { |
| 417 | int ret; |
| 418 | struct in_addr id; |
| 419 | struct bgp *bgp; |
| 420 | |
| 421 | bgp = vty->index; |
| 422 | |
| 423 | ret = inet_aton (argv[0], &id); |
| 424 | if (! ret) |
| 425 | { |
| 426 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); |
| 427 | return CMD_WARNING; |
| 428 | } |
| 429 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 430 | bgp->router_id_static = id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 431 | bgp_router_id_set (bgp, &id); |
| 432 | |
| 433 | return CMD_SUCCESS; |
| 434 | } |
| 435 | |
| 436 | DEFUN (no_bgp_router_id, |
| 437 | no_bgp_router_id_cmd, |
| 438 | "no bgp router-id", |
| 439 | NO_STR |
| 440 | BGP_STR |
| 441 | "Override configured router identifier\n") |
| 442 | { |
| 443 | int ret; |
| 444 | struct in_addr id; |
| 445 | struct bgp *bgp; |
| 446 | |
| 447 | bgp = vty->index; |
| 448 | |
| 449 | if (argc == 1) |
| 450 | { |
| 451 | ret = inet_aton (argv[0], &id); |
| 452 | if (! ret) |
| 453 | { |
| 454 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); |
| 455 | return CMD_WARNING; |
| 456 | } |
| 457 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 458 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 459 | { |
| 460 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); |
| 461 | return CMD_WARNING; |
| 462 | } |
| 463 | } |
| 464 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 465 | bgp->router_id_static.s_addr = 0; |
| 466 | bgp_router_id_set (bgp, &router_id_zebra); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 467 | |
| 468 | return CMD_SUCCESS; |
| 469 | } |
| 470 | |
| 471 | ALIAS (no_bgp_router_id, |
| 472 | no_bgp_router_id_val_cmd, |
| 473 | "no bgp router-id A.B.C.D", |
| 474 | NO_STR |
| 475 | BGP_STR |
| 476 | "Override configured router identifier\n" |
| 477 | "Manually configured router identifier\n") |
| 478 | |
| 479 | /* BGP Cluster ID. */ |
| 480 | |
| 481 | DEFUN (bgp_cluster_id, |
| 482 | bgp_cluster_id_cmd, |
| 483 | "bgp cluster-id A.B.C.D", |
| 484 | BGP_STR |
| 485 | "Configure Route-Reflector Cluster-id\n" |
| 486 | "Route-Reflector Cluster-id in IP address format\n") |
| 487 | { |
| 488 | int ret; |
| 489 | struct bgp *bgp; |
| 490 | struct in_addr cluster; |
| 491 | |
| 492 | bgp = vty->index; |
| 493 | |
| 494 | ret = inet_aton (argv[0], &cluster); |
| 495 | if (! ret) |
| 496 | { |
| 497 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 498 | return CMD_WARNING; |
| 499 | } |
| 500 | |
| 501 | bgp_cluster_id_set (bgp, &cluster); |
| 502 | |
| 503 | return CMD_SUCCESS; |
| 504 | } |
| 505 | |
| 506 | ALIAS (bgp_cluster_id, |
| 507 | bgp_cluster_id32_cmd, |
| 508 | "bgp cluster-id <1-4294967295>", |
| 509 | BGP_STR |
| 510 | "Configure Route-Reflector Cluster-id\n" |
| 511 | "Route-Reflector Cluster-id as 32 bit quantity\n") |
| 512 | |
| 513 | DEFUN (no_bgp_cluster_id, |
| 514 | no_bgp_cluster_id_cmd, |
| 515 | "no bgp cluster-id", |
| 516 | NO_STR |
| 517 | BGP_STR |
| 518 | "Configure Route-Reflector Cluster-id\n") |
| 519 | { |
| 520 | int ret; |
| 521 | struct bgp *bgp; |
| 522 | struct in_addr cluster; |
| 523 | |
| 524 | bgp = vty->index; |
| 525 | |
| 526 | if (argc == 1) |
| 527 | { |
| 528 | ret = inet_aton (argv[0], &cluster); |
| 529 | if (! ret) |
| 530 | { |
| 531 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 532 | return CMD_WARNING; |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | bgp_cluster_id_unset (bgp); |
| 537 | |
| 538 | return CMD_SUCCESS; |
| 539 | } |
| 540 | |
| 541 | ALIAS (no_bgp_cluster_id, |
| 542 | no_bgp_cluster_id_arg_cmd, |
| 543 | "no bgp cluster-id A.B.C.D", |
| 544 | NO_STR |
| 545 | BGP_STR |
| 546 | "Configure Route-Reflector Cluster-id\n" |
| 547 | "Route-Reflector Cluster-id in IP address format\n") |
| 548 | |
| 549 | DEFUN (bgp_confederation_identifier, |
| 550 | bgp_confederation_identifier_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 551 | "bgp confederation identifier " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 552 | "BGP specific commands\n" |
| 553 | "AS confederation parameters\n" |
| 554 | "AS number\n" |
| 555 | "Set routing domain confederation AS\n") |
| 556 | { |
| 557 | struct bgp *bgp; |
| 558 | as_t as; |
| 559 | |
| 560 | bgp = vty->index; |
| 561 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 562 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 563 | |
| 564 | bgp_confederation_id_set (bgp, as); |
| 565 | |
| 566 | return CMD_SUCCESS; |
| 567 | } |
| 568 | |
| 569 | DEFUN (no_bgp_confederation_identifier, |
| 570 | no_bgp_confederation_identifier_cmd, |
| 571 | "no bgp confederation identifier", |
| 572 | NO_STR |
| 573 | "BGP specific commands\n" |
| 574 | "AS confederation parameters\n" |
| 575 | "AS number\n") |
| 576 | { |
| 577 | struct bgp *bgp; |
| 578 | as_t as; |
| 579 | |
| 580 | bgp = vty->index; |
| 581 | |
| 582 | if (argc == 1) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 583 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 584 | |
| 585 | bgp_confederation_id_unset (bgp); |
| 586 | |
| 587 | return CMD_SUCCESS; |
| 588 | } |
| 589 | |
| 590 | ALIAS (no_bgp_confederation_identifier, |
| 591 | no_bgp_confederation_identifier_arg_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 592 | "no bgp confederation identifier " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 593 | NO_STR |
| 594 | "BGP specific commands\n" |
| 595 | "AS confederation parameters\n" |
| 596 | "AS number\n" |
| 597 | "Set routing domain confederation AS\n") |
| 598 | |
| 599 | DEFUN (bgp_confederation_peers, |
| 600 | bgp_confederation_peers_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 601 | "bgp confederation peers ." CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 602 | "BGP specific commands\n" |
| 603 | "AS confederation parameters\n" |
| 604 | "Peer ASs in BGP confederation\n" |
| 605 | AS_STR) |
| 606 | { |
| 607 | struct bgp *bgp; |
| 608 | as_t as; |
| 609 | int i; |
| 610 | |
| 611 | bgp = vty->index; |
| 612 | |
| 613 | for (i = 0; i < argc; i++) |
| 614 | { |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 615 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 616 | |
| 617 | if (bgp->as == as) |
| 618 | { |
| 619 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", |
| 620 | VTY_NEWLINE); |
| 621 | continue; |
| 622 | } |
| 623 | |
| 624 | bgp_confederation_peers_add (bgp, as); |
| 625 | } |
| 626 | return CMD_SUCCESS; |
| 627 | } |
| 628 | |
| 629 | DEFUN (no_bgp_confederation_peers, |
| 630 | no_bgp_confederation_peers_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 631 | "no bgp confederation peers ." CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 632 | NO_STR |
| 633 | "BGP specific commands\n" |
| 634 | "AS confederation parameters\n" |
| 635 | "Peer ASs in BGP confederation\n" |
| 636 | AS_STR) |
| 637 | { |
| 638 | struct bgp *bgp; |
| 639 | as_t as; |
| 640 | int i; |
| 641 | |
| 642 | bgp = vty->index; |
| 643 | |
| 644 | for (i = 0; i < argc; i++) |
| 645 | { |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 646 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
| 647 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 648 | bgp_confederation_peers_remove (bgp, as); |
| 649 | } |
| 650 | return CMD_SUCCESS; |
| 651 | } |
| 652 | |
| 653 | /* BGP timers. */ |
| 654 | |
| 655 | DEFUN (bgp_timers, |
| 656 | bgp_timers_cmd, |
| 657 | "timers bgp <0-65535> <0-65535>", |
| 658 | "Adjust routing timers\n" |
| 659 | "BGP timers\n" |
| 660 | "Keepalive interval\n" |
| 661 | "Holdtime\n") |
| 662 | { |
| 663 | struct bgp *bgp; |
| 664 | unsigned long keepalive = 0; |
| 665 | unsigned long holdtime = 0; |
| 666 | |
| 667 | bgp = vty->index; |
| 668 | |
| 669 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); |
| 670 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); |
| 671 | |
| 672 | /* Holdtime value check. */ |
| 673 | if (holdtime < 3 && holdtime != 0) |
| 674 | { |
| 675 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", |
| 676 | VTY_NEWLINE); |
| 677 | return CMD_WARNING; |
| 678 | } |
| 679 | |
| 680 | bgp_timers_set (bgp, keepalive, holdtime); |
| 681 | |
| 682 | return CMD_SUCCESS; |
| 683 | } |
| 684 | |
| 685 | DEFUN (no_bgp_timers, |
| 686 | no_bgp_timers_cmd, |
| 687 | "no timers bgp", |
| 688 | NO_STR |
| 689 | "Adjust routing timers\n" |
| 690 | "BGP timers\n") |
| 691 | { |
| 692 | struct bgp *bgp; |
| 693 | |
| 694 | bgp = vty->index; |
| 695 | bgp_timers_unset (bgp); |
| 696 | |
| 697 | return CMD_SUCCESS; |
| 698 | } |
| 699 | |
| 700 | ALIAS (no_bgp_timers, |
| 701 | no_bgp_timers_arg_cmd, |
| 702 | "no timers bgp <0-65535> <0-65535>", |
| 703 | NO_STR |
| 704 | "Adjust routing timers\n" |
| 705 | "BGP timers\n" |
| 706 | "Keepalive interval\n" |
| 707 | "Holdtime\n") |
| 708 | |
| 709 | DEFUN (bgp_client_to_client_reflection, |
| 710 | bgp_client_to_client_reflection_cmd, |
| 711 | "bgp client-to-client reflection", |
| 712 | "BGP specific commands\n" |
| 713 | "Configure client to client route reflection\n" |
| 714 | "reflection of routes allowed\n") |
| 715 | { |
| 716 | struct bgp *bgp; |
| 717 | |
| 718 | bgp = vty->index; |
| 719 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 720 | return CMD_SUCCESS; |
| 721 | } |
| 722 | |
| 723 | DEFUN (no_bgp_client_to_client_reflection, |
| 724 | no_bgp_client_to_client_reflection_cmd, |
| 725 | "no bgp client-to-client reflection", |
| 726 | NO_STR |
| 727 | "BGP specific commands\n" |
| 728 | "Configure client to client route reflection\n" |
| 729 | "reflection of routes allowed\n") |
| 730 | { |
| 731 | struct bgp *bgp; |
| 732 | |
| 733 | bgp = vty->index; |
| 734 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 735 | return CMD_SUCCESS; |
| 736 | } |
| 737 | |
| 738 | /* "bgp always-compare-med" configuration. */ |
| 739 | DEFUN (bgp_always_compare_med, |
| 740 | bgp_always_compare_med_cmd, |
| 741 | "bgp always-compare-med", |
| 742 | "BGP specific commands\n" |
| 743 | "Allow comparing MED from different neighbors\n") |
| 744 | { |
| 745 | struct bgp *bgp; |
| 746 | |
| 747 | bgp = vty->index; |
| 748 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 749 | return CMD_SUCCESS; |
| 750 | } |
| 751 | |
| 752 | DEFUN (no_bgp_always_compare_med, |
| 753 | no_bgp_always_compare_med_cmd, |
| 754 | "no bgp always-compare-med", |
| 755 | NO_STR |
| 756 | "BGP specific commands\n" |
| 757 | "Allow comparing MED from different neighbors\n") |
| 758 | { |
| 759 | struct bgp *bgp; |
| 760 | |
| 761 | bgp = vty->index; |
| 762 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 763 | return CMD_SUCCESS; |
| 764 | } |
| 765 | |
| 766 | /* "bgp deterministic-med" configuration. */ |
| 767 | DEFUN (bgp_deterministic_med, |
| 768 | bgp_deterministic_med_cmd, |
| 769 | "bgp deterministic-med", |
| 770 | "BGP specific commands\n" |
| 771 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 772 | { |
| 773 | struct bgp *bgp; |
| 774 | |
| 775 | bgp = vty->index; |
| 776 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 777 | return CMD_SUCCESS; |
| 778 | } |
| 779 | |
| 780 | DEFUN (no_bgp_deterministic_med, |
| 781 | no_bgp_deterministic_med_cmd, |
| 782 | "no bgp deterministic-med", |
| 783 | NO_STR |
| 784 | "BGP specific commands\n" |
| 785 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 786 | { |
| 787 | struct bgp *bgp; |
| 788 | |
| 789 | bgp = vty->index; |
| 790 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 791 | return CMD_SUCCESS; |
| 792 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 793 | |
| 794 | /* "bgp graceful-restart" configuration. */ |
| 795 | DEFUN (bgp_graceful_restart, |
| 796 | bgp_graceful_restart_cmd, |
| 797 | "bgp graceful-restart", |
| 798 | "BGP specific commands\n" |
| 799 | "Graceful restart capability parameters\n") |
| 800 | { |
| 801 | struct bgp *bgp; |
| 802 | |
| 803 | bgp = vty->index; |
| 804 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 805 | return CMD_SUCCESS; |
| 806 | } |
| 807 | |
| 808 | DEFUN (no_bgp_graceful_restart, |
| 809 | no_bgp_graceful_restart_cmd, |
| 810 | "no bgp graceful-restart", |
| 811 | NO_STR |
| 812 | "BGP specific commands\n" |
| 813 | "Graceful restart capability parameters\n") |
| 814 | { |
| 815 | struct bgp *bgp; |
| 816 | |
| 817 | bgp = vty->index; |
| 818 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 819 | return CMD_SUCCESS; |
| 820 | } |
| 821 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 822 | DEFUN (bgp_graceful_restart_stalepath_time, |
| 823 | bgp_graceful_restart_stalepath_time_cmd, |
| 824 | "bgp graceful-restart stalepath-time <1-3600>", |
| 825 | "BGP specific commands\n" |
| 826 | "Graceful restart capability parameters\n" |
| 827 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 828 | "Delay value (seconds)\n") |
| 829 | { |
| 830 | struct bgp *bgp; |
| 831 | u_int32_t stalepath; |
| 832 | |
| 833 | bgp = vty->index; |
| 834 | if (! bgp) |
| 835 | return CMD_WARNING; |
| 836 | |
| 837 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); |
| 838 | bgp->stalepath_time = stalepath; |
| 839 | return CMD_SUCCESS; |
| 840 | } |
| 841 | |
| 842 | DEFUN (no_bgp_graceful_restart_stalepath_time, |
| 843 | no_bgp_graceful_restart_stalepath_time_cmd, |
| 844 | "no bgp graceful-restart stalepath-time", |
| 845 | NO_STR |
| 846 | "BGP specific commands\n" |
| 847 | "Graceful restart capability parameters\n" |
| 848 | "Set the max time to hold onto restarting peer's stale paths\n") |
| 849 | { |
| 850 | struct bgp *bgp; |
| 851 | |
| 852 | bgp = vty->index; |
| 853 | if (! bgp) |
| 854 | return CMD_WARNING; |
| 855 | |
| 856 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; |
| 857 | return CMD_SUCCESS; |
| 858 | } |
| 859 | |
| 860 | ALIAS (no_bgp_graceful_restart_stalepath_time, |
| 861 | no_bgp_graceful_restart_stalepath_time_val_cmd, |
| 862 | "no bgp graceful-restart stalepath-time <1-3600>", |
| 863 | NO_STR |
| 864 | "BGP specific commands\n" |
| 865 | "Graceful restart capability parameters\n" |
| 866 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 867 | "Delay value (seconds)\n") |
| 868 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 869 | /* "bgp fast-external-failover" configuration. */ |
| 870 | DEFUN (bgp_fast_external_failover, |
| 871 | bgp_fast_external_failover_cmd, |
| 872 | "bgp fast-external-failover", |
| 873 | BGP_STR |
| 874 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 875 | { |
| 876 | struct bgp *bgp; |
| 877 | |
| 878 | bgp = vty->index; |
| 879 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 880 | return CMD_SUCCESS; |
| 881 | } |
| 882 | |
| 883 | DEFUN (no_bgp_fast_external_failover, |
| 884 | no_bgp_fast_external_failover_cmd, |
| 885 | "no bgp fast-external-failover", |
| 886 | NO_STR |
| 887 | BGP_STR |
| 888 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 889 | { |
| 890 | struct bgp *bgp; |
| 891 | |
| 892 | bgp = vty->index; |
| 893 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 894 | return CMD_SUCCESS; |
| 895 | } |
| 896 | |
| 897 | /* "bgp enforce-first-as" configuration. */ |
| 898 | DEFUN (bgp_enforce_first_as, |
| 899 | bgp_enforce_first_as_cmd, |
| 900 | "bgp enforce-first-as", |
| 901 | BGP_STR |
| 902 | "Enforce the first AS for EBGP routes\n") |
| 903 | { |
| 904 | struct bgp *bgp; |
| 905 | |
| 906 | bgp = vty->index; |
| 907 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 908 | return CMD_SUCCESS; |
| 909 | } |
| 910 | |
| 911 | DEFUN (no_bgp_enforce_first_as, |
| 912 | no_bgp_enforce_first_as_cmd, |
| 913 | "no bgp enforce-first-as", |
| 914 | NO_STR |
| 915 | BGP_STR |
| 916 | "Enforce the first AS for EBGP routes\n") |
| 917 | { |
| 918 | struct bgp *bgp; |
| 919 | |
| 920 | bgp = vty->index; |
| 921 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 922 | return CMD_SUCCESS; |
| 923 | } |
| 924 | |
| 925 | /* "bgp bestpath compare-routerid" configuration. */ |
| 926 | DEFUN (bgp_bestpath_compare_router_id, |
| 927 | bgp_bestpath_compare_router_id_cmd, |
| 928 | "bgp bestpath compare-routerid", |
| 929 | "BGP specific commands\n" |
| 930 | "Change the default bestpath selection\n" |
| 931 | "Compare router-id for identical EBGP paths\n") |
| 932 | { |
| 933 | struct bgp *bgp; |
| 934 | |
| 935 | bgp = vty->index; |
| 936 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 937 | return CMD_SUCCESS; |
| 938 | } |
| 939 | |
| 940 | DEFUN (no_bgp_bestpath_compare_router_id, |
| 941 | no_bgp_bestpath_compare_router_id_cmd, |
| 942 | "no bgp bestpath compare-routerid", |
| 943 | NO_STR |
| 944 | "BGP specific commands\n" |
| 945 | "Change the default bestpath selection\n" |
| 946 | "Compare router-id for identical EBGP paths\n") |
| 947 | { |
| 948 | struct bgp *bgp; |
| 949 | |
| 950 | bgp = vty->index; |
| 951 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 952 | return CMD_SUCCESS; |
| 953 | } |
| 954 | |
| 955 | /* "bgp bestpath as-path ignore" configuration. */ |
| 956 | DEFUN (bgp_bestpath_aspath_ignore, |
| 957 | bgp_bestpath_aspath_ignore_cmd, |
| 958 | "bgp bestpath as-path ignore", |
| 959 | "BGP specific commands\n" |
| 960 | "Change the default bestpath selection\n" |
| 961 | "AS-path attribute\n" |
| 962 | "Ignore as-path length in selecting a route\n") |
| 963 | { |
| 964 | struct bgp *bgp; |
| 965 | |
| 966 | bgp = vty->index; |
| 967 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 968 | return CMD_SUCCESS; |
| 969 | } |
| 970 | |
| 971 | DEFUN (no_bgp_bestpath_aspath_ignore, |
| 972 | no_bgp_bestpath_aspath_ignore_cmd, |
| 973 | "no bgp bestpath as-path ignore", |
| 974 | NO_STR |
| 975 | "BGP specific commands\n" |
| 976 | "Change the default bestpath selection\n" |
| 977 | "AS-path attribute\n" |
| 978 | "Ignore as-path length in selecting a route\n") |
| 979 | { |
| 980 | struct bgp *bgp; |
| 981 | |
| 982 | bgp = vty->index; |
| 983 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 984 | return CMD_SUCCESS; |
| 985 | } |
| 986 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 987 | /* "bgp bestpath as-path confed" configuration. */ |
| 988 | DEFUN (bgp_bestpath_aspath_confed, |
| 989 | bgp_bestpath_aspath_confed_cmd, |
| 990 | "bgp bestpath as-path confed", |
| 991 | "BGP specific commands\n" |
| 992 | "Change the default bestpath selection\n" |
| 993 | "AS-path attribute\n" |
| 994 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 995 | { |
| 996 | struct bgp *bgp; |
| 997 | |
| 998 | bgp = vty->index; |
| 999 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); |
| 1000 | return CMD_SUCCESS; |
| 1001 | } |
| 1002 | |
| 1003 | DEFUN (no_bgp_bestpath_aspath_confed, |
| 1004 | no_bgp_bestpath_aspath_confed_cmd, |
| 1005 | "no bgp bestpath as-path confed", |
| 1006 | NO_STR |
| 1007 | "BGP specific commands\n" |
| 1008 | "Change the default bestpath selection\n" |
| 1009 | "AS-path attribute\n" |
| 1010 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 1011 | { |
| 1012 | struct bgp *bgp; |
| 1013 | |
| 1014 | bgp = vty->index; |
| 1015 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); |
| 1016 | return CMD_SUCCESS; |
| 1017 | } |
| 1018 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 1019 | /* "bgp log-neighbor-changes" configuration. */ |
| 1020 | DEFUN (bgp_log_neighbor_changes, |
| 1021 | bgp_log_neighbor_changes_cmd, |
| 1022 | "bgp log-neighbor-changes", |
| 1023 | "BGP specific commands\n" |
| 1024 | "Log neighbor up/down and reset reason\n") |
| 1025 | { |
| 1026 | struct bgp *bgp; |
| 1027 | |
| 1028 | bgp = vty->index; |
| 1029 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1030 | return CMD_SUCCESS; |
| 1031 | } |
| 1032 | |
| 1033 | DEFUN (no_bgp_log_neighbor_changes, |
| 1034 | no_bgp_log_neighbor_changes_cmd, |
| 1035 | "no bgp log-neighbor-changes", |
| 1036 | NO_STR |
| 1037 | "BGP specific commands\n" |
| 1038 | "Log neighbor up/down and reset reason\n") |
| 1039 | { |
| 1040 | struct bgp *bgp; |
| 1041 | |
| 1042 | bgp = vty->index; |
| 1043 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1044 | return CMD_SUCCESS; |
| 1045 | } |
| 1046 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1047 | /* "bgp bestpath med" configuration. */ |
| 1048 | DEFUN (bgp_bestpath_med, |
| 1049 | bgp_bestpath_med_cmd, |
| 1050 | "bgp bestpath med (confed|missing-as-worst)", |
| 1051 | "BGP specific commands\n" |
| 1052 | "Change the default bestpath selection\n" |
| 1053 | "MED attribute\n" |
| 1054 | "Compare MED among confederation paths\n" |
| 1055 | "Treat missing MED as the least preferred one\n") |
| 1056 | { |
| 1057 | struct bgp *bgp; |
| 1058 | |
| 1059 | bgp = vty->index; |
| 1060 | |
| 1061 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1062 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1063 | else |
| 1064 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1065 | |
| 1066 | return CMD_SUCCESS; |
| 1067 | } |
| 1068 | |
| 1069 | DEFUN (bgp_bestpath_med2, |
| 1070 | bgp_bestpath_med2_cmd, |
| 1071 | "bgp bestpath med confed missing-as-worst", |
| 1072 | "BGP specific commands\n" |
| 1073 | "Change the default bestpath selection\n" |
| 1074 | "MED attribute\n" |
| 1075 | "Compare MED among confederation paths\n" |
| 1076 | "Treat missing MED as the least preferred one\n") |
| 1077 | { |
| 1078 | struct bgp *bgp; |
| 1079 | |
| 1080 | bgp = vty->index; |
| 1081 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1082 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1083 | return CMD_SUCCESS; |
| 1084 | } |
| 1085 | |
| 1086 | ALIAS (bgp_bestpath_med2, |
| 1087 | bgp_bestpath_med3_cmd, |
| 1088 | "bgp bestpath med missing-as-worst confed", |
| 1089 | "BGP specific commands\n" |
| 1090 | "Change the default bestpath selection\n" |
| 1091 | "MED attribute\n" |
| 1092 | "Treat missing MED as the least preferred one\n" |
| 1093 | "Compare MED among confederation paths\n") |
| 1094 | |
| 1095 | DEFUN (no_bgp_bestpath_med, |
| 1096 | no_bgp_bestpath_med_cmd, |
| 1097 | "no bgp bestpath med (confed|missing-as-worst)", |
| 1098 | NO_STR |
| 1099 | "BGP specific commands\n" |
| 1100 | "Change the default bestpath selection\n" |
| 1101 | "MED attribute\n" |
| 1102 | "Compare MED among confederation paths\n" |
| 1103 | "Treat missing MED as the least preferred one\n") |
| 1104 | { |
| 1105 | struct bgp *bgp; |
| 1106 | |
| 1107 | bgp = vty->index; |
| 1108 | |
| 1109 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1110 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1111 | else |
| 1112 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1113 | |
| 1114 | return CMD_SUCCESS; |
| 1115 | } |
| 1116 | |
| 1117 | DEFUN (no_bgp_bestpath_med2, |
| 1118 | no_bgp_bestpath_med2_cmd, |
| 1119 | "no bgp bestpath med confed missing-as-worst", |
| 1120 | NO_STR |
| 1121 | "BGP specific commands\n" |
| 1122 | "Change the default bestpath selection\n" |
| 1123 | "MED attribute\n" |
| 1124 | "Compare MED among confederation paths\n" |
| 1125 | "Treat missing MED as the least preferred one\n") |
| 1126 | { |
| 1127 | struct bgp *bgp; |
| 1128 | |
| 1129 | bgp = vty->index; |
| 1130 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1131 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1132 | return CMD_SUCCESS; |
| 1133 | } |
| 1134 | |
| 1135 | ALIAS (no_bgp_bestpath_med2, |
| 1136 | no_bgp_bestpath_med3_cmd, |
| 1137 | "no bgp bestpath med missing-as-worst confed", |
| 1138 | NO_STR |
| 1139 | "BGP specific commands\n" |
| 1140 | "Change the default bestpath selection\n" |
| 1141 | "MED attribute\n" |
| 1142 | "Treat missing MED as the least preferred one\n" |
| 1143 | "Compare MED among confederation paths\n") |
| 1144 | |
| 1145 | /* "no bgp default ipv4-unicast". */ |
| 1146 | DEFUN (no_bgp_default_ipv4_unicast, |
| 1147 | no_bgp_default_ipv4_unicast_cmd, |
| 1148 | "no bgp default ipv4-unicast", |
| 1149 | NO_STR |
| 1150 | "BGP specific commands\n" |
| 1151 | "Configure BGP defaults\n" |
| 1152 | "Activate ipv4-unicast for a peer by default\n") |
| 1153 | { |
| 1154 | struct bgp *bgp; |
| 1155 | |
| 1156 | bgp = vty->index; |
| 1157 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1158 | return CMD_SUCCESS; |
| 1159 | } |
| 1160 | |
| 1161 | DEFUN (bgp_default_ipv4_unicast, |
| 1162 | bgp_default_ipv4_unicast_cmd, |
| 1163 | "bgp default ipv4-unicast", |
| 1164 | "BGP specific commands\n" |
| 1165 | "Configure BGP defaults\n" |
| 1166 | "Activate ipv4-unicast for a peer by default\n") |
| 1167 | { |
| 1168 | struct bgp *bgp; |
| 1169 | |
| 1170 | bgp = vty->index; |
| 1171 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1172 | return CMD_SUCCESS; |
| 1173 | } |
| 1174 | |
| 1175 | /* "bgp import-check" configuration. */ |
| 1176 | DEFUN (bgp_network_import_check, |
| 1177 | bgp_network_import_check_cmd, |
| 1178 | "bgp network import-check", |
| 1179 | "BGP specific commands\n" |
| 1180 | "BGP network command\n" |
| 1181 | "Check BGP network route exists in IGP\n") |
| 1182 | { |
| 1183 | struct bgp *bgp; |
| 1184 | |
| 1185 | bgp = vty->index; |
| 1186 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1187 | return CMD_SUCCESS; |
| 1188 | } |
| 1189 | |
| 1190 | DEFUN (no_bgp_network_import_check, |
| 1191 | no_bgp_network_import_check_cmd, |
| 1192 | "no bgp network import-check", |
| 1193 | NO_STR |
| 1194 | "BGP specific commands\n" |
| 1195 | "BGP network command\n" |
| 1196 | "Check BGP network route exists in IGP\n") |
| 1197 | { |
| 1198 | struct bgp *bgp; |
| 1199 | |
| 1200 | bgp = vty->index; |
| 1201 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1202 | return CMD_SUCCESS; |
| 1203 | } |
| 1204 | |
| 1205 | DEFUN (bgp_default_local_preference, |
| 1206 | bgp_default_local_preference_cmd, |
| 1207 | "bgp default local-preference <0-4294967295>", |
| 1208 | "BGP specific commands\n" |
| 1209 | "Configure BGP defaults\n" |
| 1210 | "local preference (higher=more preferred)\n" |
| 1211 | "Configure default local preference value\n") |
| 1212 | { |
| 1213 | struct bgp *bgp; |
| 1214 | u_int32_t local_pref; |
| 1215 | |
| 1216 | bgp = vty->index; |
| 1217 | |
| 1218 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); |
| 1219 | |
| 1220 | bgp_default_local_preference_set (bgp, local_pref); |
| 1221 | |
| 1222 | return CMD_SUCCESS; |
| 1223 | } |
| 1224 | |
| 1225 | DEFUN (no_bgp_default_local_preference, |
| 1226 | no_bgp_default_local_preference_cmd, |
| 1227 | "no bgp default local-preference", |
| 1228 | NO_STR |
| 1229 | "BGP specific commands\n" |
| 1230 | "Configure BGP defaults\n" |
| 1231 | "local preference (higher=more preferred)\n") |
| 1232 | { |
| 1233 | struct bgp *bgp; |
| 1234 | |
| 1235 | bgp = vty->index; |
| 1236 | bgp_default_local_preference_unset (bgp); |
| 1237 | return CMD_SUCCESS; |
| 1238 | } |
| 1239 | |
| 1240 | ALIAS (no_bgp_default_local_preference, |
| 1241 | no_bgp_default_local_preference_val_cmd, |
| 1242 | "no bgp default local-preference <0-4294967295>", |
| 1243 | NO_STR |
| 1244 | "BGP specific commands\n" |
| 1245 | "Configure BGP defaults\n" |
| 1246 | "local preference (higher=more preferred)\n" |
| 1247 | "Configure default local preference value\n") |
| 1248 | |
| 1249 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1250 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
| 1251 | const char *as_str, afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1252 | { |
| 1253 | int ret; |
| 1254 | struct bgp *bgp; |
| 1255 | as_t as; |
| 1256 | union sockunion su; |
| 1257 | |
| 1258 | bgp = vty->index; |
| 1259 | |
| 1260 | /* Get AS number. */ |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 1261 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1262 | |
| 1263 | /* If peer is peer group, call proper function. */ |
| 1264 | ret = str2sockunion (peer_str, &su); |
| 1265 | if (ret < 0) |
| 1266 | { |
| 1267 | ret = peer_group_remote_as (bgp, peer_str, &as); |
| 1268 | if (ret < 0) |
| 1269 | { |
| 1270 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1271 | return CMD_WARNING; |
| 1272 | } |
| 1273 | return CMD_SUCCESS; |
| 1274 | } |
| 1275 | |
| 1276 | if (peer_address_self_check (&su)) |
| 1277 | { |
| 1278 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1279 | VTY_NEWLINE); |
| 1280 | return CMD_WARNING; |
| 1281 | } |
| 1282 | |
| 1283 | ret = peer_remote_as (bgp, &su, &as, afi, safi); |
| 1284 | |
| 1285 | /* This peer belongs to peer group. */ |
| 1286 | switch (ret) |
| 1287 | { |
| 1288 | case BGP_ERR_PEER_GROUP_MEMBER: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1289 | 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] | 1290 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1291 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1292 | 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] | 1293 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1294 | } |
| 1295 | return bgp_vty_return (vty, ret); |
| 1296 | } |
| 1297 | |
| 1298 | DEFUN (neighbor_remote_as, |
| 1299 | neighbor_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1300 | NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1301 | NEIGHBOR_STR |
| 1302 | NEIGHBOR_ADDR_STR2 |
| 1303 | "Specify a BGP neighbor\n" |
| 1304 | AS_STR) |
| 1305 | { |
| 1306 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); |
| 1307 | } |
| 1308 | |
| 1309 | DEFUN (neighbor_peer_group, |
| 1310 | neighbor_peer_group_cmd, |
| 1311 | "neighbor WORD peer-group", |
| 1312 | NEIGHBOR_STR |
| 1313 | "Neighbor tag\n" |
| 1314 | "Configure peer-group\n") |
| 1315 | { |
| 1316 | struct bgp *bgp; |
| 1317 | struct peer_group *group; |
| 1318 | |
| 1319 | bgp = vty->index; |
| 1320 | |
| 1321 | group = peer_group_get (bgp, argv[0]); |
| 1322 | if (! group) |
| 1323 | return CMD_WARNING; |
| 1324 | |
| 1325 | return CMD_SUCCESS; |
| 1326 | } |
| 1327 | |
| 1328 | DEFUN (no_neighbor, |
| 1329 | no_neighbor_cmd, |
| 1330 | NO_NEIGHBOR_CMD2, |
| 1331 | NO_STR |
| 1332 | NEIGHBOR_STR |
| 1333 | NEIGHBOR_ADDR_STR2) |
| 1334 | { |
| 1335 | int ret; |
| 1336 | union sockunion su; |
| 1337 | struct peer_group *group; |
| 1338 | struct peer *peer; |
| 1339 | |
| 1340 | ret = str2sockunion (argv[0], &su); |
| 1341 | if (ret < 0) |
| 1342 | { |
| 1343 | group = peer_group_lookup (vty->index, argv[0]); |
| 1344 | if (group) |
| 1345 | peer_group_delete (group); |
| 1346 | else |
| 1347 | { |
| 1348 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1349 | return CMD_WARNING; |
| 1350 | } |
| 1351 | } |
| 1352 | else |
| 1353 | { |
| 1354 | peer = peer_lookup (vty->index, &su); |
| 1355 | if (peer) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 1356 | peer_delete (peer); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1357 | } |
| 1358 | |
| 1359 | return CMD_SUCCESS; |
| 1360 | } |
| 1361 | |
| 1362 | ALIAS (no_neighbor, |
| 1363 | no_neighbor_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1364 | NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1365 | NO_STR |
| 1366 | NEIGHBOR_STR |
| 1367 | NEIGHBOR_ADDR_STR |
| 1368 | "Specify a BGP neighbor\n" |
| 1369 | AS_STR) |
| 1370 | |
| 1371 | DEFUN (no_neighbor_peer_group, |
| 1372 | no_neighbor_peer_group_cmd, |
| 1373 | "no neighbor WORD peer-group", |
| 1374 | NO_STR |
| 1375 | NEIGHBOR_STR |
| 1376 | "Neighbor tag\n" |
| 1377 | "Configure peer-group\n") |
| 1378 | { |
| 1379 | struct peer_group *group; |
| 1380 | |
| 1381 | group = peer_group_lookup (vty->index, argv[0]); |
| 1382 | if (group) |
| 1383 | peer_group_delete (group); |
| 1384 | else |
| 1385 | { |
| 1386 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1387 | return CMD_WARNING; |
| 1388 | } |
| 1389 | return CMD_SUCCESS; |
| 1390 | } |
| 1391 | |
| 1392 | DEFUN (no_neighbor_peer_group_remote_as, |
| 1393 | no_neighbor_peer_group_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1394 | "no neighbor WORD remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1395 | NO_STR |
| 1396 | NEIGHBOR_STR |
| 1397 | "Neighbor tag\n" |
| 1398 | "Specify a BGP neighbor\n" |
| 1399 | AS_STR) |
| 1400 | { |
| 1401 | struct peer_group *group; |
| 1402 | |
| 1403 | group = peer_group_lookup (vty->index, argv[0]); |
| 1404 | if (group) |
| 1405 | peer_group_remote_as_delete (group); |
| 1406 | else |
| 1407 | { |
| 1408 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1409 | return CMD_WARNING; |
| 1410 | } |
| 1411 | return CMD_SUCCESS; |
| 1412 | } |
| 1413 | |
| 1414 | DEFUN (neighbor_local_as, |
| 1415 | neighbor_local_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1416 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1417 | NEIGHBOR_STR |
| 1418 | NEIGHBOR_ADDR_STR2 |
| 1419 | "Specify a local-as number\n" |
| 1420 | "AS number used as local AS\n") |
| 1421 | { |
| 1422 | struct peer *peer; |
| 1423 | int ret; |
| 1424 | |
| 1425 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1426 | if (! peer) |
| 1427 | return CMD_WARNING; |
| 1428 | |
| 1429 | ret = peer_local_as_set (peer, atoi (argv[1]), 0); |
| 1430 | return bgp_vty_return (vty, ret); |
| 1431 | } |
| 1432 | |
| 1433 | DEFUN (neighbor_local_as_no_prepend, |
| 1434 | neighbor_local_as_no_prepend_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1435 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1436 | NEIGHBOR_STR |
| 1437 | NEIGHBOR_ADDR_STR2 |
| 1438 | "Specify a local-as number\n" |
| 1439 | "AS number used as local AS\n" |
| 1440 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1441 | { |
| 1442 | struct peer *peer; |
| 1443 | int ret; |
| 1444 | |
| 1445 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1446 | if (! peer) |
| 1447 | return CMD_WARNING; |
| 1448 | |
| 1449 | ret = peer_local_as_set (peer, atoi (argv[1]), 1); |
| 1450 | return bgp_vty_return (vty, ret); |
| 1451 | } |
| 1452 | |
| 1453 | DEFUN (no_neighbor_local_as, |
| 1454 | no_neighbor_local_as_cmd, |
| 1455 | NO_NEIGHBOR_CMD2 "local-as", |
| 1456 | NO_STR |
| 1457 | NEIGHBOR_STR |
| 1458 | NEIGHBOR_ADDR_STR2 |
| 1459 | "Specify a local-as number\n") |
| 1460 | { |
| 1461 | struct peer *peer; |
| 1462 | int ret; |
| 1463 | |
| 1464 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1465 | if (! peer) |
| 1466 | return CMD_WARNING; |
| 1467 | |
| 1468 | ret = peer_local_as_unset (peer); |
| 1469 | return bgp_vty_return (vty, ret); |
| 1470 | } |
| 1471 | |
| 1472 | ALIAS (no_neighbor_local_as, |
| 1473 | no_neighbor_local_as_val_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1474 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1475 | NO_STR |
| 1476 | NEIGHBOR_STR |
| 1477 | NEIGHBOR_ADDR_STR2 |
| 1478 | "Specify a local-as number\n" |
| 1479 | "AS number used as local AS\n") |
| 1480 | |
| 1481 | ALIAS (no_neighbor_local_as, |
| 1482 | no_neighbor_local_as_val2_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1483 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1484 | NO_STR |
| 1485 | NEIGHBOR_STR |
| 1486 | NEIGHBOR_ADDR_STR2 |
| 1487 | "Specify a local-as number\n" |
| 1488 | "AS number used as local AS\n" |
| 1489 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1490 | |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 1491 | DEFUN (neighbor_password, |
| 1492 | neighbor_password_cmd, |
| 1493 | NEIGHBOR_CMD2 "password LINE", |
| 1494 | NEIGHBOR_STR |
| 1495 | NEIGHBOR_ADDR_STR2 |
| 1496 | "Set a password\n" |
| 1497 | "The password\n") |
| 1498 | { |
| 1499 | struct peer *peer; |
| 1500 | int ret; |
| 1501 | |
| 1502 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1503 | if (! peer) |
| 1504 | return CMD_WARNING; |
| 1505 | |
| 1506 | ret = peer_password_set (peer, argv[1]); |
| 1507 | return bgp_vty_return (vty, ret); |
| 1508 | } |
| 1509 | |
| 1510 | DEFUN (no_neighbor_password, |
| 1511 | no_neighbor_password_cmd, |
| 1512 | NO_NEIGHBOR_CMD2 "password", |
| 1513 | NO_STR |
| 1514 | NEIGHBOR_STR |
| 1515 | NEIGHBOR_ADDR_STR2 |
| 1516 | "Set a password\n") |
| 1517 | { |
| 1518 | struct peer *peer; |
| 1519 | int ret; |
| 1520 | |
| 1521 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1522 | if (! peer) |
| 1523 | return CMD_WARNING; |
| 1524 | |
| 1525 | ret = peer_password_unset (peer); |
| 1526 | return bgp_vty_return (vty, ret); |
| 1527 | } |
| 1528 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1529 | DEFUN (neighbor_activate, |
| 1530 | neighbor_activate_cmd, |
| 1531 | NEIGHBOR_CMD2 "activate", |
| 1532 | NEIGHBOR_STR |
| 1533 | NEIGHBOR_ADDR_STR2 |
| 1534 | "Enable the Address Family for this Neighbor\n") |
| 1535 | { |
| 1536 | struct peer *peer; |
| 1537 | |
| 1538 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1539 | if (! peer) |
| 1540 | return CMD_WARNING; |
| 1541 | |
| 1542 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1543 | |
| 1544 | return CMD_SUCCESS; |
| 1545 | } |
| 1546 | |
| 1547 | DEFUN (no_neighbor_activate, |
| 1548 | no_neighbor_activate_cmd, |
| 1549 | NO_NEIGHBOR_CMD2 "activate", |
| 1550 | NO_STR |
| 1551 | NEIGHBOR_STR |
| 1552 | NEIGHBOR_ADDR_STR2 |
| 1553 | "Enable the Address Family for this Neighbor\n") |
| 1554 | { |
| 1555 | int ret; |
| 1556 | struct peer *peer; |
| 1557 | |
| 1558 | /* Lookup peer. */ |
| 1559 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1560 | if (! peer) |
| 1561 | return CMD_WARNING; |
| 1562 | |
| 1563 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1564 | |
| 1565 | return bgp_vty_return (vty, ret); |
| 1566 | } |
| 1567 | |
| 1568 | DEFUN (neighbor_set_peer_group, |
| 1569 | neighbor_set_peer_group_cmd, |
| 1570 | NEIGHBOR_CMD "peer-group WORD", |
| 1571 | NEIGHBOR_STR |
| 1572 | NEIGHBOR_ADDR_STR |
| 1573 | "Member of the peer-group\n" |
| 1574 | "peer-group name\n") |
| 1575 | { |
| 1576 | int ret; |
| 1577 | as_t as; |
| 1578 | union sockunion su; |
| 1579 | struct bgp *bgp; |
| 1580 | struct peer_group *group; |
| 1581 | |
| 1582 | bgp = vty->index; |
| 1583 | |
| 1584 | ret = str2sockunion (argv[0], &su); |
| 1585 | if (ret < 0) |
| 1586 | { |
| 1587 | vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); |
| 1588 | return CMD_WARNING; |
| 1589 | } |
| 1590 | |
| 1591 | group = peer_group_lookup (bgp, argv[1]); |
| 1592 | if (! group) |
| 1593 | { |
| 1594 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1595 | return CMD_WARNING; |
| 1596 | } |
| 1597 | |
| 1598 | if (peer_address_self_check (&su)) |
| 1599 | { |
| 1600 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1601 | VTY_NEWLINE); |
| 1602 | return CMD_WARNING; |
| 1603 | } |
| 1604 | |
| 1605 | ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty), |
| 1606 | bgp_node_safi (vty), &as); |
| 1607 | |
| 1608 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) |
| 1609 | { |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1610 | 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] | 1611 | return CMD_WARNING; |
| 1612 | } |
| 1613 | |
| 1614 | return bgp_vty_return (vty, ret); |
| 1615 | } |
| 1616 | |
| 1617 | DEFUN (no_neighbor_set_peer_group, |
| 1618 | no_neighbor_set_peer_group_cmd, |
| 1619 | NO_NEIGHBOR_CMD "peer-group WORD", |
| 1620 | NO_STR |
| 1621 | NEIGHBOR_STR |
| 1622 | NEIGHBOR_ADDR_STR |
| 1623 | "Member of the peer-group\n" |
| 1624 | "peer-group name\n") |
| 1625 | { |
| 1626 | int ret; |
| 1627 | struct bgp *bgp; |
| 1628 | struct peer *peer; |
| 1629 | struct peer_group *group; |
| 1630 | |
| 1631 | bgp = vty->index; |
| 1632 | |
| 1633 | peer = peer_lookup_vty (vty, argv[0]); |
| 1634 | if (! peer) |
| 1635 | return CMD_WARNING; |
| 1636 | |
| 1637 | group = peer_group_lookup (bgp, argv[1]); |
| 1638 | if (! group) |
| 1639 | { |
| 1640 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1641 | return CMD_WARNING; |
| 1642 | } |
| 1643 | |
| 1644 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), |
| 1645 | bgp_node_safi (vty)); |
| 1646 | |
| 1647 | return bgp_vty_return (vty, ret); |
| 1648 | } |
| 1649 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1650 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1651 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
| 1652 | u_int16_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1653 | { |
| 1654 | int ret; |
| 1655 | struct peer *peer; |
| 1656 | |
| 1657 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 1658 | if (! peer) |
| 1659 | return CMD_WARNING; |
| 1660 | |
| 1661 | if (set) |
| 1662 | ret = peer_flag_set (peer, flag); |
| 1663 | else |
| 1664 | ret = peer_flag_unset (peer, flag); |
| 1665 | |
| 1666 | return bgp_vty_return (vty, ret); |
| 1667 | } |
| 1668 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1669 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1670 | 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] | 1671 | { |
| 1672 | return peer_flag_modify_vty (vty, ip_str, flag, 1); |
| 1673 | } |
| 1674 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1675 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1676 | 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] | 1677 | { |
| 1678 | return peer_flag_modify_vty (vty, ip_str, flag, 0); |
| 1679 | } |
| 1680 | |
| 1681 | /* neighbor passive. */ |
| 1682 | DEFUN (neighbor_passive, |
| 1683 | neighbor_passive_cmd, |
| 1684 | NEIGHBOR_CMD2 "passive", |
| 1685 | NEIGHBOR_STR |
| 1686 | NEIGHBOR_ADDR_STR2 |
| 1687 | "Don't send open messages to this neighbor\n") |
| 1688 | { |
| 1689 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1690 | } |
| 1691 | |
| 1692 | DEFUN (no_neighbor_passive, |
| 1693 | no_neighbor_passive_cmd, |
| 1694 | NO_NEIGHBOR_CMD2 "passive", |
| 1695 | NO_STR |
| 1696 | NEIGHBOR_STR |
| 1697 | NEIGHBOR_ADDR_STR2 |
| 1698 | "Don't send open messages to this neighbor\n") |
| 1699 | { |
| 1700 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1701 | } |
| 1702 | |
| 1703 | /* neighbor shutdown. */ |
| 1704 | DEFUN (neighbor_shutdown, |
| 1705 | neighbor_shutdown_cmd, |
| 1706 | NEIGHBOR_CMD2 "shutdown", |
| 1707 | NEIGHBOR_STR |
| 1708 | NEIGHBOR_ADDR_STR2 |
| 1709 | "Administratively shut down this neighbor\n") |
| 1710 | { |
| 1711 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1712 | } |
| 1713 | |
| 1714 | DEFUN (no_neighbor_shutdown, |
| 1715 | no_neighbor_shutdown_cmd, |
| 1716 | NO_NEIGHBOR_CMD2 "shutdown", |
| 1717 | NO_STR |
| 1718 | NEIGHBOR_STR |
| 1719 | NEIGHBOR_ADDR_STR2 |
| 1720 | "Administratively shut down this neighbor\n") |
| 1721 | { |
| 1722 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1723 | } |
| 1724 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1725 | /* Deprecated neighbor capability route-refresh. */ |
| 1726 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, |
| 1727 | neighbor_capability_route_refresh_cmd, |
| 1728 | NEIGHBOR_CMD2 "capability route-refresh", |
| 1729 | NEIGHBOR_STR |
| 1730 | NEIGHBOR_ADDR_STR2 |
| 1731 | "Advertise capability to the peer\n" |
| 1732 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1733 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1734 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1735 | } |
| 1736 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1737 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
| 1738 | no_neighbor_capability_route_refresh_cmd, |
| 1739 | NO_NEIGHBOR_CMD2 "capability route-refresh", |
| 1740 | NO_STR |
| 1741 | NEIGHBOR_STR |
| 1742 | NEIGHBOR_ADDR_STR2 |
| 1743 | "Advertise capability to the peer\n" |
| 1744 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1745 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1746 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1747 | } |
| 1748 | |
| 1749 | /* neighbor capability dynamic. */ |
| 1750 | DEFUN (neighbor_capability_dynamic, |
| 1751 | neighbor_capability_dynamic_cmd, |
| 1752 | NEIGHBOR_CMD2 "capability dynamic", |
| 1753 | NEIGHBOR_STR |
| 1754 | NEIGHBOR_ADDR_STR2 |
| 1755 | "Advertise capability to the peer\n" |
| 1756 | "Advertise dynamic capability to this neighbor\n") |
| 1757 | { |
| 1758 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1759 | } |
| 1760 | |
| 1761 | DEFUN (no_neighbor_capability_dynamic, |
| 1762 | no_neighbor_capability_dynamic_cmd, |
| 1763 | NO_NEIGHBOR_CMD2 "capability dynamic", |
| 1764 | NO_STR |
| 1765 | NEIGHBOR_STR |
| 1766 | NEIGHBOR_ADDR_STR2 |
| 1767 | "Advertise capability to the peer\n" |
| 1768 | "Advertise dynamic capability to this neighbor\n") |
| 1769 | { |
| 1770 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1771 | } |
| 1772 | |
| 1773 | /* neighbor dont-capability-negotiate */ |
| 1774 | DEFUN (neighbor_dont_capability_negotiate, |
| 1775 | neighbor_dont_capability_negotiate_cmd, |
| 1776 | NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1777 | NEIGHBOR_STR |
| 1778 | NEIGHBOR_ADDR_STR2 |
| 1779 | "Do not perform capability negotiation\n") |
| 1780 | { |
| 1781 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1782 | } |
| 1783 | |
| 1784 | DEFUN (no_neighbor_dont_capability_negotiate, |
| 1785 | no_neighbor_dont_capability_negotiate_cmd, |
| 1786 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1787 | NO_STR |
| 1788 | NEIGHBOR_STR |
| 1789 | NEIGHBOR_ADDR_STR2 |
| 1790 | "Do not perform capability negotiation\n") |
| 1791 | { |
| 1792 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1793 | } |
| 1794 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1795 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1796 | 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] | 1797 | safi_t safi, u_int32_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1798 | { |
| 1799 | int ret; |
| 1800 | struct peer *peer; |
| 1801 | |
| 1802 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 1803 | if (! peer) |
| 1804 | return CMD_WARNING; |
| 1805 | |
| 1806 | if (set) |
| 1807 | ret = peer_af_flag_set (peer, afi, safi, flag); |
| 1808 | else |
| 1809 | ret = peer_af_flag_unset (peer, afi, safi, flag); |
| 1810 | |
| 1811 | return bgp_vty_return (vty, ret); |
| 1812 | } |
| 1813 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1814 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1815 | 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] | 1816 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1817 | { |
| 1818 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); |
| 1819 | } |
| 1820 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1821 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1822 | 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] | 1823 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1824 | { |
| 1825 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); |
| 1826 | } |
| 1827 | |
| 1828 | /* neighbor capability orf prefix-list. */ |
| 1829 | DEFUN (neighbor_capability_orf_prefix, |
| 1830 | neighbor_capability_orf_prefix_cmd, |
| 1831 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 1832 | NEIGHBOR_STR |
| 1833 | NEIGHBOR_ADDR_STR2 |
| 1834 | "Advertise capability to the peer\n" |
| 1835 | "Advertise ORF capability to the peer\n" |
| 1836 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 1837 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 1838 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 1839 | "Capability to SEND the ORF to this neighbor\n") |
| 1840 | { |
| 1841 | u_int16_t flag = 0; |
| 1842 | |
| 1843 | if (strncmp (argv[1], "s", 1) == 0) |
| 1844 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 1845 | else if (strncmp (argv[1], "r", 1) == 0) |
| 1846 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 1847 | else if (strncmp (argv[1], "b", 1) == 0) |
| 1848 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 1849 | else |
| 1850 | return CMD_WARNING; |
| 1851 | |
| 1852 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1853 | bgp_node_safi (vty), flag); |
| 1854 | } |
| 1855 | |
| 1856 | DEFUN (no_neighbor_capability_orf_prefix, |
| 1857 | no_neighbor_capability_orf_prefix_cmd, |
| 1858 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 1859 | NO_STR |
| 1860 | NEIGHBOR_STR |
| 1861 | NEIGHBOR_ADDR_STR2 |
| 1862 | "Advertise capability to the peer\n" |
| 1863 | "Advertise ORF capability to the peer\n" |
| 1864 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 1865 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 1866 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 1867 | "Capability to SEND the ORF to this neighbor\n") |
| 1868 | { |
| 1869 | u_int16_t flag = 0; |
| 1870 | |
| 1871 | if (strncmp (argv[1], "s", 1) == 0) |
| 1872 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 1873 | else if (strncmp (argv[1], "r", 1) == 0) |
| 1874 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 1875 | else if (strncmp (argv[1], "b", 1) == 0) |
| 1876 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 1877 | else |
| 1878 | return CMD_WARNING; |
| 1879 | |
| 1880 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1881 | bgp_node_safi (vty), flag); |
| 1882 | } |
| 1883 | |
| 1884 | /* neighbor next-hop-self. */ |
| 1885 | DEFUN (neighbor_nexthop_self, |
| 1886 | neighbor_nexthop_self_cmd, |
| 1887 | NEIGHBOR_CMD2 "next-hop-self", |
| 1888 | NEIGHBOR_STR |
| 1889 | NEIGHBOR_ADDR_STR2 |
| 1890 | "Disable the next hop calculation for this neighbor\n") |
| 1891 | { |
| 1892 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1893 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 1894 | } |
| 1895 | |
| 1896 | DEFUN (no_neighbor_nexthop_self, |
| 1897 | no_neighbor_nexthop_self_cmd, |
| 1898 | NO_NEIGHBOR_CMD2 "next-hop-self", |
| 1899 | NO_STR |
| 1900 | NEIGHBOR_STR |
| 1901 | NEIGHBOR_ADDR_STR2 |
| 1902 | "Disable the next hop calculation for this neighbor\n") |
| 1903 | { |
| 1904 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1905 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 1906 | } |
| 1907 | |
| 1908 | /* neighbor remove-private-AS. */ |
| 1909 | DEFUN (neighbor_remove_private_as, |
| 1910 | neighbor_remove_private_as_cmd, |
| 1911 | NEIGHBOR_CMD2 "remove-private-AS", |
| 1912 | NEIGHBOR_STR |
| 1913 | NEIGHBOR_ADDR_STR2 |
| 1914 | "Remove private AS number from outbound updates\n") |
| 1915 | { |
| 1916 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1917 | bgp_node_safi (vty), |
| 1918 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 1919 | } |
| 1920 | |
| 1921 | DEFUN (no_neighbor_remove_private_as, |
| 1922 | no_neighbor_remove_private_as_cmd, |
| 1923 | NO_NEIGHBOR_CMD2 "remove-private-AS", |
| 1924 | NO_STR |
| 1925 | NEIGHBOR_STR |
| 1926 | NEIGHBOR_ADDR_STR2 |
| 1927 | "Remove private AS number from outbound updates\n") |
| 1928 | { |
| 1929 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1930 | bgp_node_safi (vty), |
| 1931 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 1932 | } |
| 1933 | |
| 1934 | /* neighbor send-community. */ |
| 1935 | DEFUN (neighbor_send_community, |
| 1936 | neighbor_send_community_cmd, |
| 1937 | NEIGHBOR_CMD2 "send-community", |
| 1938 | NEIGHBOR_STR |
| 1939 | NEIGHBOR_ADDR_STR2 |
| 1940 | "Send Community attribute to this neighbor\n") |
| 1941 | { |
| 1942 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1943 | bgp_node_safi (vty), |
| 1944 | PEER_FLAG_SEND_COMMUNITY); |
| 1945 | } |
| 1946 | |
| 1947 | DEFUN (no_neighbor_send_community, |
| 1948 | no_neighbor_send_community_cmd, |
| 1949 | NO_NEIGHBOR_CMD2 "send-community", |
| 1950 | NO_STR |
| 1951 | NEIGHBOR_STR |
| 1952 | NEIGHBOR_ADDR_STR2 |
| 1953 | "Send Community attribute to this neighbor\n") |
| 1954 | { |
| 1955 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1956 | bgp_node_safi (vty), |
| 1957 | PEER_FLAG_SEND_COMMUNITY); |
| 1958 | } |
| 1959 | |
| 1960 | /* neighbor send-community extended. */ |
| 1961 | DEFUN (neighbor_send_community_type, |
| 1962 | neighbor_send_community_type_cmd, |
| 1963 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 1964 | NEIGHBOR_STR |
| 1965 | NEIGHBOR_ADDR_STR2 |
| 1966 | "Send Community attribute to this neighbor\n" |
| 1967 | "Send Standard and Extended Community attributes\n" |
| 1968 | "Send Extended Community attributes\n" |
| 1969 | "Send Standard Community attributes\n") |
| 1970 | { |
| 1971 | if (strncmp (argv[1], "s", 1) == 0) |
| 1972 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1973 | bgp_node_safi (vty), |
| 1974 | PEER_FLAG_SEND_COMMUNITY); |
| 1975 | if (strncmp (argv[1], "e", 1) == 0) |
| 1976 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1977 | bgp_node_safi (vty), |
| 1978 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 1979 | |
| 1980 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1981 | bgp_node_safi (vty), |
| 1982 | (PEER_FLAG_SEND_COMMUNITY| |
| 1983 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 1984 | } |
| 1985 | |
| 1986 | DEFUN (no_neighbor_send_community_type, |
| 1987 | no_neighbor_send_community_type_cmd, |
| 1988 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 1989 | NO_STR |
| 1990 | NEIGHBOR_STR |
| 1991 | NEIGHBOR_ADDR_STR2 |
| 1992 | "Send Community attribute to this neighbor\n" |
| 1993 | "Send Standard and Extended Community attributes\n" |
| 1994 | "Send Extended Community attributes\n" |
| 1995 | "Send Standard Community attributes\n") |
| 1996 | { |
| 1997 | if (strncmp (argv[1], "s", 1) == 0) |
| 1998 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1999 | bgp_node_safi (vty), |
| 2000 | PEER_FLAG_SEND_COMMUNITY); |
| 2001 | if (strncmp (argv[1], "e", 1) == 0) |
| 2002 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2003 | bgp_node_safi (vty), |
| 2004 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 2005 | |
| 2006 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2007 | bgp_node_safi (vty), |
| 2008 | (PEER_FLAG_SEND_COMMUNITY | |
| 2009 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 2010 | } |
| 2011 | |
| 2012 | /* neighbor soft-reconfig. */ |
| 2013 | DEFUN (neighbor_soft_reconfiguration, |
| 2014 | neighbor_soft_reconfiguration_cmd, |
| 2015 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 2016 | NEIGHBOR_STR |
| 2017 | NEIGHBOR_ADDR_STR2 |
| 2018 | "Per neighbor soft reconfiguration\n" |
| 2019 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 2020 | { |
| 2021 | return peer_af_flag_set_vty (vty, argv[0], |
| 2022 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 2023 | PEER_FLAG_SOFT_RECONFIG); |
| 2024 | } |
| 2025 | |
| 2026 | DEFUN (no_neighbor_soft_reconfiguration, |
| 2027 | no_neighbor_soft_reconfiguration_cmd, |
| 2028 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 2029 | NO_STR |
| 2030 | NEIGHBOR_STR |
| 2031 | NEIGHBOR_ADDR_STR2 |
| 2032 | "Per neighbor soft reconfiguration\n" |
| 2033 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 2034 | { |
| 2035 | return peer_af_flag_unset_vty (vty, argv[0], |
| 2036 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 2037 | PEER_FLAG_SOFT_RECONFIG); |
| 2038 | } |
| 2039 | |
| 2040 | DEFUN (neighbor_route_reflector_client, |
| 2041 | neighbor_route_reflector_client_cmd, |
| 2042 | NEIGHBOR_CMD2 "route-reflector-client", |
| 2043 | NEIGHBOR_STR |
| 2044 | NEIGHBOR_ADDR_STR2 |
| 2045 | "Configure a neighbor as Route Reflector client\n") |
| 2046 | { |
| 2047 | struct peer *peer; |
| 2048 | |
| 2049 | |
| 2050 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2051 | if (! peer) |
| 2052 | return CMD_WARNING; |
| 2053 | |
| 2054 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2055 | bgp_node_safi (vty), |
| 2056 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2057 | } |
| 2058 | |
| 2059 | DEFUN (no_neighbor_route_reflector_client, |
| 2060 | no_neighbor_route_reflector_client_cmd, |
| 2061 | NO_NEIGHBOR_CMD2 "route-reflector-client", |
| 2062 | NO_STR |
| 2063 | NEIGHBOR_STR |
| 2064 | NEIGHBOR_ADDR_STR2 |
| 2065 | "Configure a neighbor as Route Reflector client\n") |
| 2066 | { |
| 2067 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2068 | bgp_node_safi (vty), |
| 2069 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2070 | } |
| 2071 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2072 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2073 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
| 2074 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2075 | { |
| 2076 | int ret; |
| 2077 | struct bgp *bgp; |
| 2078 | struct peer *peer; |
| 2079 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2080 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2081 | struct bgp_filter *pfilter; |
| 2082 | struct bgp_filter *gfilter; |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2083 | int locked_and_added = 0; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2084 | |
| 2085 | bgp = vty->index; |
| 2086 | |
| 2087 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2088 | if ( ! peer ) |
| 2089 | return CMD_WARNING; |
| 2090 | |
| 2091 | /* If it is already a RS-Client, don't do anything. */ |
| 2092 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2093 | return CMD_SUCCESS; |
| 2094 | |
| 2095 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2096 | { |
| 2097 | peer = peer_lock (peer); /* rsclient peer list reference */ |
| 2098 | listnode_add_sort (bgp->rsclient, peer); |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2099 | locked_and_added = 1; |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2100 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2101 | |
| 2102 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2103 | if (ret < 0) |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2104 | { |
| 2105 | if (locked_and_added) |
| 2106 | { |
| 2107 | listnode_delete (bgp->rsclient, peer); |
| 2108 | peer_unlock (peer); /* rsclient peer list reference */ |
| 2109 | } |
| 2110 | |
| 2111 | return bgp_vty_return (vty, ret); |
| 2112 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2113 | |
Paul Jakma | 64e580a | 2006-02-21 01:09:01 +0000 | [diff] [blame] | 2114 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2115 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2116 | /* RIB peer reference. Released when table is free'd in bgp_table_free. */ |
| 2117 | peer->rib[afi][safi]->owner = peer_lock (peer); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2118 | |
| 2119 | /* Check for existing 'network' and 'redistribute' routes. */ |
| 2120 | bgp_check_local_routes_rsclient (peer, afi, safi); |
| 2121 | |
| 2122 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ |
| 2123 | bgp_soft_reconfig_rsclient (peer, afi, safi); |
| 2124 | |
| 2125 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2126 | { |
| 2127 | group = peer->group; |
| 2128 | gfilter = &peer->filter[afi][safi]; |
| 2129 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2130 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2131 | { |
| 2132 | pfilter = &peer->filter[afi][safi]; |
| 2133 | |
| 2134 | /* Members of a non-RS-Client group should not be RS-Clients, as that |
| 2135 | is checked when the become part of the peer-group */ |
| 2136 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2137 | if (ret < 0) |
| 2138 | return bgp_vty_return (vty, ret); |
| 2139 | |
| 2140 | /* Make peer's RIB point to group's RIB. */ |
| 2141 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; |
| 2142 | |
| 2143 | /* Import policy. */ |
| 2144 | if (pfilter->map[RMAP_IMPORT].name) |
| 2145 | free (pfilter->map[RMAP_IMPORT].name); |
| 2146 | if (gfilter->map[RMAP_IMPORT].name) |
| 2147 | { |
| 2148 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); |
| 2149 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; |
| 2150 | } |
| 2151 | else |
| 2152 | { |
| 2153 | pfilter->map[RMAP_IMPORT].name = NULL; |
| 2154 | pfilter->map[RMAP_IMPORT].map =NULL; |
| 2155 | } |
| 2156 | |
| 2157 | /* Export policy. */ |
| 2158 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) |
| 2159 | { |
| 2160 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); |
| 2161 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; |
| 2162 | } |
| 2163 | } |
| 2164 | } |
| 2165 | return CMD_SUCCESS; |
| 2166 | } |
| 2167 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2168 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2169 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
| 2170 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2171 | { |
| 2172 | int ret; |
| 2173 | struct bgp *bgp; |
| 2174 | struct peer *peer; |
| 2175 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2176 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2177 | |
| 2178 | bgp = vty->index; |
| 2179 | |
| 2180 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2181 | if ( ! peer ) |
| 2182 | return CMD_WARNING; |
| 2183 | |
| 2184 | /* If it is not a RS-Client, don't do anything. */ |
| 2185 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2186 | return CMD_SUCCESS; |
| 2187 | |
| 2188 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2189 | { |
| 2190 | group = peer->group; |
| 2191 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2192 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2193 | { |
| 2194 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2195 | if (ret < 0) |
| 2196 | return bgp_vty_return (vty, ret); |
| 2197 | |
| 2198 | peer->rib[afi][safi] = NULL; |
| 2199 | } |
| 2200 | |
| 2201 | peer = group->conf; |
| 2202 | } |
| 2203 | |
| 2204 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2205 | if (ret < 0) |
| 2206 | return bgp_vty_return (vty, ret); |
| 2207 | |
| 2208 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2209 | { |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2210 | bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2211 | listnode_delete (bgp->rsclient, peer); |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2212 | peer_unlock (peer); /* peer bgp rsclient reference */ |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2213 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2214 | |
Paul Jakma | b608d5b | 2008-07-02 02:12:07 +0000 | [diff] [blame] | 2215 | bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2216 | |
| 2217 | return CMD_SUCCESS; |
| 2218 | } |
| 2219 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2220 | /* neighbor route-server-client. */ |
| 2221 | DEFUN (neighbor_route_server_client, |
| 2222 | neighbor_route_server_client_cmd, |
| 2223 | NEIGHBOR_CMD2 "route-server-client", |
| 2224 | NEIGHBOR_STR |
| 2225 | NEIGHBOR_ADDR_STR2 |
| 2226 | "Configure a neighbor as Route Server client\n") |
| 2227 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2228 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
| 2229 | bgp_node_safi(vty)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2230 | } |
| 2231 | |
| 2232 | DEFUN (no_neighbor_route_server_client, |
| 2233 | no_neighbor_route_server_client_cmd, |
| 2234 | NO_NEIGHBOR_CMD2 "route-server-client", |
| 2235 | NO_STR |
| 2236 | NEIGHBOR_STR |
| 2237 | NEIGHBOR_ADDR_STR2 |
| 2238 | "Configure a neighbor as Route Server client\n") |
| 2239 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2240 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), |
| 2241 | bgp_node_safi(vty)); |
| 2242 | } |
| 2243 | |
| 2244 | DEFUN (neighbor_nexthop_local_unchanged, |
| 2245 | neighbor_nexthop_local_unchanged_cmd, |
| 2246 | NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2247 | NEIGHBOR_STR |
| 2248 | NEIGHBOR_ADDR_STR2 |
| 2249 | "Configure treatment of outgoing link-local nexthop attribute\n" |
| 2250 | "Leave link-local nexthop unchanged for this peer\n") |
| 2251 | { |
| 2252 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2253 | bgp_node_safi (vty), |
| 2254 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
| 2255 | } |
| 2256 | |
| 2257 | DEFUN (no_neighbor_nexthop_local_unchanged, |
| 2258 | no_neighbor_nexthop_local_unchanged_cmd, |
| 2259 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2260 | NO_STR |
| 2261 | NEIGHBOR_STR |
| 2262 | NEIGHBOR_ADDR_STR2 |
| 2263 | "Configure treatment of outgoing link-local-nexthop attribute\n" |
| 2264 | "Leave link-local nexthop unchanged for this peer\n") |
| 2265 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2266 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2267 | bgp_node_safi (vty), |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2268 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2269 | } |
| 2270 | |
| 2271 | DEFUN (neighbor_attr_unchanged, |
| 2272 | neighbor_attr_unchanged_cmd, |
| 2273 | NEIGHBOR_CMD2 "attribute-unchanged", |
| 2274 | NEIGHBOR_STR |
| 2275 | NEIGHBOR_ADDR_STR2 |
| 2276 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2277 | { |
| 2278 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2279 | bgp_node_safi (vty), |
| 2280 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2281 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2282 | PEER_FLAG_MED_UNCHANGED)); |
| 2283 | } |
| 2284 | |
| 2285 | DEFUN (neighbor_attr_unchanged1, |
| 2286 | neighbor_attr_unchanged1_cmd, |
| 2287 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2288 | NEIGHBOR_STR |
| 2289 | NEIGHBOR_ADDR_STR2 |
| 2290 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2291 | "As-path attribute\n" |
| 2292 | "Nexthop attribute\n" |
| 2293 | "Med attribute\n") |
| 2294 | { |
| 2295 | u_int16_t flags = 0; |
| 2296 | |
| 2297 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2298 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2299 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2300 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2301 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2302 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2303 | |
| 2304 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2305 | bgp_node_safi (vty), flags); |
| 2306 | } |
| 2307 | |
| 2308 | DEFUN (neighbor_attr_unchanged2, |
| 2309 | neighbor_attr_unchanged2_cmd, |
| 2310 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2311 | NEIGHBOR_STR |
| 2312 | NEIGHBOR_ADDR_STR2 |
| 2313 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2314 | "As-path attribute\n" |
| 2315 | "Nexthop attribute\n" |
| 2316 | "Med attribute\n") |
| 2317 | { |
| 2318 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2319 | |
| 2320 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2321 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2322 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2323 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2324 | |
| 2325 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2326 | bgp_node_safi (vty), flags); |
| 2327 | |
| 2328 | } |
| 2329 | |
| 2330 | DEFUN (neighbor_attr_unchanged3, |
| 2331 | neighbor_attr_unchanged3_cmd, |
| 2332 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2333 | NEIGHBOR_STR |
| 2334 | NEIGHBOR_ADDR_STR2 |
| 2335 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2336 | "Nexthop attribute\n" |
| 2337 | "As-path attribute\n" |
| 2338 | "Med attribute\n") |
| 2339 | { |
| 2340 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2341 | |
| 2342 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2343 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2344 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2345 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2346 | |
| 2347 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2348 | bgp_node_safi (vty), flags); |
| 2349 | } |
| 2350 | |
| 2351 | DEFUN (neighbor_attr_unchanged4, |
| 2352 | neighbor_attr_unchanged4_cmd, |
| 2353 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2354 | NEIGHBOR_STR |
| 2355 | NEIGHBOR_ADDR_STR2 |
| 2356 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2357 | "Med attribute\n" |
| 2358 | "As-path attribute\n" |
| 2359 | "Nexthop attribute\n") |
| 2360 | { |
| 2361 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2362 | |
| 2363 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2364 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2365 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2366 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2367 | |
| 2368 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2369 | bgp_node_safi (vty), flags); |
| 2370 | } |
| 2371 | |
| 2372 | ALIAS (neighbor_attr_unchanged, |
| 2373 | neighbor_attr_unchanged5_cmd, |
| 2374 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2375 | NEIGHBOR_STR |
| 2376 | NEIGHBOR_ADDR_STR2 |
| 2377 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2378 | "As-path attribute\n" |
| 2379 | "Nexthop attribute\n" |
| 2380 | "Med attribute\n") |
| 2381 | |
| 2382 | ALIAS (neighbor_attr_unchanged, |
| 2383 | neighbor_attr_unchanged6_cmd, |
| 2384 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2385 | NEIGHBOR_STR |
| 2386 | NEIGHBOR_ADDR_STR2 |
| 2387 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2388 | "As-path attribute\n" |
| 2389 | "Med attribute\n" |
| 2390 | "Nexthop attribute\n") |
| 2391 | |
| 2392 | ALIAS (neighbor_attr_unchanged, |
| 2393 | neighbor_attr_unchanged7_cmd, |
| 2394 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2395 | NEIGHBOR_STR |
| 2396 | NEIGHBOR_ADDR_STR2 |
| 2397 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2398 | "Nexthop attribute\n" |
| 2399 | "Med attribute\n" |
| 2400 | "As-path attribute\n") |
| 2401 | |
| 2402 | ALIAS (neighbor_attr_unchanged, |
| 2403 | neighbor_attr_unchanged8_cmd, |
| 2404 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2405 | NEIGHBOR_STR |
| 2406 | NEIGHBOR_ADDR_STR2 |
| 2407 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2408 | "Nexthop attribute\n" |
| 2409 | "As-path attribute\n" |
| 2410 | "Med attribute\n") |
| 2411 | |
| 2412 | ALIAS (neighbor_attr_unchanged, |
| 2413 | neighbor_attr_unchanged9_cmd, |
| 2414 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2415 | NEIGHBOR_STR |
| 2416 | NEIGHBOR_ADDR_STR2 |
| 2417 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2418 | "Med attribute\n" |
| 2419 | "Nexthop attribute\n" |
| 2420 | "As-path attribute\n") |
| 2421 | |
| 2422 | ALIAS (neighbor_attr_unchanged, |
| 2423 | neighbor_attr_unchanged10_cmd, |
| 2424 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2425 | NEIGHBOR_STR |
| 2426 | NEIGHBOR_ADDR_STR2 |
| 2427 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2428 | "Med attribute\n" |
| 2429 | "As-path attribute\n" |
| 2430 | "Nexthop attribute\n") |
| 2431 | |
| 2432 | DEFUN (no_neighbor_attr_unchanged, |
| 2433 | no_neighbor_attr_unchanged_cmd, |
| 2434 | NO_NEIGHBOR_CMD2 "attribute-unchanged", |
| 2435 | NO_STR |
| 2436 | NEIGHBOR_STR |
| 2437 | NEIGHBOR_ADDR_STR2 |
| 2438 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2439 | { |
| 2440 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2441 | bgp_node_safi (vty), |
| 2442 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2443 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2444 | PEER_FLAG_MED_UNCHANGED)); |
| 2445 | } |
| 2446 | |
| 2447 | DEFUN (no_neighbor_attr_unchanged1, |
| 2448 | no_neighbor_attr_unchanged1_cmd, |
| 2449 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2450 | NO_STR |
| 2451 | NEIGHBOR_STR |
| 2452 | NEIGHBOR_ADDR_STR2 |
| 2453 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2454 | "As-path attribute\n" |
| 2455 | "Nexthop attribute\n" |
| 2456 | "Med attribute\n") |
| 2457 | { |
| 2458 | u_int16_t flags = 0; |
| 2459 | |
| 2460 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2461 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2462 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2463 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2464 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2465 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2466 | |
| 2467 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2468 | bgp_node_safi (vty), flags); |
| 2469 | } |
| 2470 | |
| 2471 | DEFUN (no_neighbor_attr_unchanged2, |
| 2472 | no_neighbor_attr_unchanged2_cmd, |
| 2473 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2474 | NO_STR |
| 2475 | NEIGHBOR_STR |
| 2476 | NEIGHBOR_ADDR_STR2 |
| 2477 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2478 | "As-path attribute\n" |
| 2479 | "Nexthop attribute\n" |
| 2480 | "Med attribute\n") |
| 2481 | { |
| 2482 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2483 | |
| 2484 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2485 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2486 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2487 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2488 | |
| 2489 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2490 | bgp_node_safi (vty), flags); |
| 2491 | } |
| 2492 | |
| 2493 | DEFUN (no_neighbor_attr_unchanged3, |
| 2494 | no_neighbor_attr_unchanged3_cmd, |
| 2495 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2496 | NO_STR |
| 2497 | NEIGHBOR_STR |
| 2498 | NEIGHBOR_ADDR_STR2 |
| 2499 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2500 | "Nexthop attribute\n" |
| 2501 | "As-path attribute\n" |
| 2502 | "Med attribute\n") |
| 2503 | { |
| 2504 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 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], "med", 1) == 0) |
| 2509 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2510 | |
| 2511 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2512 | bgp_node_safi (vty), flags); |
| 2513 | } |
| 2514 | |
| 2515 | DEFUN (no_neighbor_attr_unchanged4, |
| 2516 | no_neighbor_attr_unchanged4_cmd, |
| 2517 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2518 | NO_STR |
| 2519 | NEIGHBOR_STR |
| 2520 | NEIGHBOR_ADDR_STR2 |
| 2521 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2522 | "Med attribute\n" |
| 2523 | "As-path attribute\n" |
| 2524 | "Nexthop attribute\n") |
| 2525 | { |
| 2526 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2527 | |
| 2528 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2529 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2530 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2531 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2532 | |
| 2533 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2534 | bgp_node_safi (vty), flags); |
| 2535 | } |
| 2536 | |
| 2537 | ALIAS (no_neighbor_attr_unchanged, |
| 2538 | no_neighbor_attr_unchanged5_cmd, |
| 2539 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2540 | NO_STR |
| 2541 | NEIGHBOR_STR |
| 2542 | NEIGHBOR_ADDR_STR2 |
| 2543 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2544 | "As-path attribute\n" |
| 2545 | "Nexthop attribute\n" |
| 2546 | "Med attribute\n") |
| 2547 | |
| 2548 | ALIAS (no_neighbor_attr_unchanged, |
| 2549 | no_neighbor_attr_unchanged6_cmd, |
| 2550 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2551 | NO_STR |
| 2552 | NEIGHBOR_STR |
| 2553 | NEIGHBOR_ADDR_STR2 |
| 2554 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2555 | "As-path attribute\n" |
| 2556 | "Med attribute\n" |
| 2557 | "Nexthop attribute\n") |
| 2558 | |
| 2559 | ALIAS (no_neighbor_attr_unchanged, |
| 2560 | no_neighbor_attr_unchanged7_cmd, |
| 2561 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2562 | NO_STR |
| 2563 | NEIGHBOR_STR |
| 2564 | NEIGHBOR_ADDR_STR2 |
| 2565 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2566 | "Nexthop attribute\n" |
| 2567 | "Med attribute\n" |
| 2568 | "As-path attribute\n") |
| 2569 | |
| 2570 | ALIAS (no_neighbor_attr_unchanged, |
| 2571 | no_neighbor_attr_unchanged8_cmd, |
| 2572 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2573 | NO_STR |
| 2574 | NEIGHBOR_STR |
| 2575 | NEIGHBOR_ADDR_STR2 |
| 2576 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2577 | "Nexthop attribute\n" |
| 2578 | "As-path attribute\n" |
| 2579 | "Med attribute\n") |
| 2580 | |
| 2581 | ALIAS (no_neighbor_attr_unchanged, |
| 2582 | no_neighbor_attr_unchanged9_cmd, |
| 2583 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2584 | NO_STR |
| 2585 | NEIGHBOR_STR |
| 2586 | NEIGHBOR_ADDR_STR2 |
| 2587 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2588 | "Med attribute\n" |
| 2589 | "Nexthop attribute\n" |
| 2590 | "As-path attribute\n") |
| 2591 | |
| 2592 | ALIAS (no_neighbor_attr_unchanged, |
| 2593 | no_neighbor_attr_unchanged10_cmd, |
| 2594 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2595 | NO_STR |
| 2596 | NEIGHBOR_STR |
| 2597 | NEIGHBOR_ADDR_STR2 |
| 2598 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2599 | "Med attribute\n" |
| 2600 | "As-path attribute\n" |
| 2601 | "Nexthop attribute\n") |
| 2602 | |
| 2603 | /* For old version Zebra compatibility. */ |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2604 | DEFUN_DEPRECATED (neighbor_transparent_as, |
| 2605 | neighbor_transparent_as_cmd, |
| 2606 | NEIGHBOR_CMD "transparent-as", |
| 2607 | NEIGHBOR_STR |
| 2608 | NEIGHBOR_ADDR_STR |
| 2609 | "Do not append my AS number even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2610 | { |
| 2611 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2612 | bgp_node_safi (vty), |
| 2613 | PEER_FLAG_AS_PATH_UNCHANGED); |
| 2614 | } |
| 2615 | |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2616 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
| 2617 | neighbor_transparent_nexthop_cmd, |
| 2618 | NEIGHBOR_CMD "transparent-nexthop", |
| 2619 | NEIGHBOR_STR |
| 2620 | NEIGHBOR_ADDR_STR |
| 2621 | "Do not change nexthop even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2622 | { |
| 2623 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2624 | bgp_node_safi (vty), |
| 2625 | PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2626 | } |
| 2627 | |
| 2628 | /* EBGP multihop configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2629 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2630 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
| 2631 | const char *ttl_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2632 | { |
| 2633 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2634 | unsigned int ttl; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2635 | |
| 2636 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2637 | if (! peer) |
| 2638 | return CMD_WARNING; |
| 2639 | |
| 2640 | if (! ttl_str) |
| 2641 | ttl = TTL_MAX; |
| 2642 | else |
| 2643 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); |
| 2644 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 2645 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2646 | } |
| 2647 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2648 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2649 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2650 | { |
| 2651 | struct peer *peer; |
| 2652 | |
| 2653 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2654 | if (! peer) |
| 2655 | return CMD_WARNING; |
| 2656 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 2657 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2658 | } |
| 2659 | |
| 2660 | /* neighbor ebgp-multihop. */ |
| 2661 | DEFUN (neighbor_ebgp_multihop, |
| 2662 | neighbor_ebgp_multihop_cmd, |
| 2663 | NEIGHBOR_CMD2 "ebgp-multihop", |
| 2664 | NEIGHBOR_STR |
| 2665 | NEIGHBOR_ADDR_STR2 |
| 2666 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2667 | { |
| 2668 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); |
| 2669 | } |
| 2670 | |
| 2671 | DEFUN (neighbor_ebgp_multihop_ttl, |
| 2672 | neighbor_ebgp_multihop_ttl_cmd, |
| 2673 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2674 | NEIGHBOR_STR |
| 2675 | NEIGHBOR_ADDR_STR2 |
| 2676 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2677 | "maximum hop count\n") |
| 2678 | { |
| 2679 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); |
| 2680 | } |
| 2681 | |
| 2682 | DEFUN (no_neighbor_ebgp_multihop, |
| 2683 | no_neighbor_ebgp_multihop_cmd, |
| 2684 | NO_NEIGHBOR_CMD2 "ebgp-multihop", |
| 2685 | NO_STR |
| 2686 | NEIGHBOR_STR |
| 2687 | NEIGHBOR_ADDR_STR2 |
| 2688 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2689 | { |
| 2690 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); |
| 2691 | } |
| 2692 | |
| 2693 | ALIAS (no_neighbor_ebgp_multihop, |
| 2694 | no_neighbor_ebgp_multihop_ttl_cmd, |
| 2695 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2696 | NO_STR |
| 2697 | NEIGHBOR_STR |
| 2698 | NEIGHBOR_ADDR_STR2 |
| 2699 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2700 | "maximum hop count\n") |
| 2701 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2702 | /* disable-connected-check */ |
| 2703 | DEFUN (neighbor_disable_connected_check, |
| 2704 | neighbor_disable_connected_check_cmd, |
| 2705 | NEIGHBOR_CMD2 "disable-connected-check", |
| 2706 | NEIGHBOR_STR |
| 2707 | NEIGHBOR_ADDR_STR2 |
| 2708 | "one-hop away EBGP peer using loopback address\n") |
| 2709 | { |
| 2710 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2711 | } |
| 2712 | |
| 2713 | DEFUN (no_neighbor_disable_connected_check, |
| 2714 | no_neighbor_disable_connected_check_cmd, |
| 2715 | NO_NEIGHBOR_CMD2 "disable-connected-check", |
| 2716 | NO_STR |
| 2717 | NEIGHBOR_STR |
| 2718 | NEIGHBOR_ADDR_STR2 |
| 2719 | "one-hop away EBGP peer using loopback address\n") |
| 2720 | { |
| 2721 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2722 | } |
| 2723 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2724 | /* Enforce multihop. */ |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2725 | ALIAS (neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2726 | neighbor_enforce_multihop_cmd, |
| 2727 | NEIGHBOR_CMD2 "enforce-multihop", |
| 2728 | NEIGHBOR_STR |
| 2729 | NEIGHBOR_ADDR_STR2 |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 2730 | "Enforce EBGP neighbors perform multihop\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2731 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2732 | /* Enforce multihop. */ |
| 2733 | ALIAS (no_neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2734 | no_neighbor_enforce_multihop_cmd, |
| 2735 | NO_NEIGHBOR_CMD2 "enforce-multihop", |
| 2736 | NO_STR |
| 2737 | NEIGHBOR_STR |
| 2738 | NEIGHBOR_ADDR_STR2 |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 2739 | "Enforce EBGP neighbors perform multihop\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2740 | |
| 2741 | DEFUN (neighbor_description, |
| 2742 | neighbor_description_cmd, |
| 2743 | NEIGHBOR_CMD2 "description .LINE", |
| 2744 | NEIGHBOR_STR |
| 2745 | NEIGHBOR_ADDR_STR2 |
| 2746 | "Neighbor specific description\n" |
| 2747 | "Up to 80 characters describing this neighbor\n") |
| 2748 | { |
| 2749 | struct peer *peer; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2750 | char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2751 | |
| 2752 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2753 | if (! peer) |
| 2754 | return CMD_WARNING; |
| 2755 | |
| 2756 | if (argc == 1) |
| 2757 | return CMD_SUCCESS; |
| 2758 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2759 | str = argv_concat(argv, argc, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2760 | |
| 2761 | peer_description_set (peer, str); |
| 2762 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2763 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2764 | |
| 2765 | return CMD_SUCCESS; |
| 2766 | } |
| 2767 | |
| 2768 | DEFUN (no_neighbor_description, |
| 2769 | no_neighbor_description_cmd, |
| 2770 | NO_NEIGHBOR_CMD2 "description", |
| 2771 | NO_STR |
| 2772 | NEIGHBOR_STR |
| 2773 | NEIGHBOR_ADDR_STR2 |
| 2774 | "Neighbor specific description\n") |
| 2775 | { |
| 2776 | struct peer *peer; |
| 2777 | |
| 2778 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2779 | if (! peer) |
| 2780 | return CMD_WARNING; |
| 2781 | |
| 2782 | peer_description_unset (peer); |
| 2783 | |
| 2784 | return CMD_SUCCESS; |
| 2785 | } |
| 2786 | |
| 2787 | ALIAS (no_neighbor_description, |
| 2788 | no_neighbor_description_val_cmd, |
| 2789 | NO_NEIGHBOR_CMD2 "description .LINE", |
| 2790 | NO_STR |
| 2791 | NEIGHBOR_STR |
| 2792 | NEIGHBOR_ADDR_STR2 |
| 2793 | "Neighbor specific description\n" |
| 2794 | "Up to 80 characters describing this neighbor\n") |
| 2795 | |
| 2796 | /* Neighbor update-source. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2797 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2798 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
| 2799 | const char *source_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2800 | { |
| 2801 | struct peer *peer; |
| 2802 | union sockunion *su; |
| 2803 | |
| 2804 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2805 | if (! peer) |
| 2806 | return CMD_WARNING; |
| 2807 | |
| 2808 | if (source_str) |
| 2809 | { |
| 2810 | su = sockunion_str2su (source_str); |
| 2811 | if (su) |
| 2812 | { |
| 2813 | peer_update_source_addr_set (peer, su); |
| 2814 | sockunion_free (su); |
| 2815 | } |
| 2816 | else |
| 2817 | peer_update_source_if_set (peer, source_str); |
| 2818 | } |
| 2819 | else |
| 2820 | peer_update_source_unset (peer); |
| 2821 | |
| 2822 | return CMD_SUCCESS; |
| 2823 | } |
| 2824 | |
Paul Jakma | 9a1a331 | 2009-07-27 12:27:55 +0100 | [diff] [blame] | 2825 | #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] | 2826 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
| 2827 | "IPv4 address\n" \ |
Paul Jakma | 9a1a331 | 2009-07-27 12:27:55 +0100 | [diff] [blame] | 2828 | "IPv6 address\n" \ |
| 2829 | "Interface name (requires zebra to be running)\n" |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 2830 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2831 | DEFUN (neighbor_update_source, |
| 2832 | neighbor_update_source_cmd, |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 2833 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2834 | NEIGHBOR_STR |
| 2835 | NEIGHBOR_ADDR_STR2 |
| 2836 | "Source of routing updates\n" |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 2837 | BGP_UPDATE_SOURCE_HELP_STR) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2838 | { |
| 2839 | return peer_update_source_vty (vty, argv[0], argv[1]); |
| 2840 | } |
| 2841 | |
| 2842 | DEFUN (no_neighbor_update_source, |
| 2843 | no_neighbor_update_source_cmd, |
| 2844 | NO_NEIGHBOR_CMD2 "update-source", |
| 2845 | NO_STR |
| 2846 | NEIGHBOR_STR |
| 2847 | NEIGHBOR_ADDR_STR2 |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 2848 | "Source of routing updates\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2849 | { |
| 2850 | return peer_update_source_vty (vty, argv[0], NULL); |
| 2851 | } |
| 2852 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2853 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2854 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
| 2855 | afi_t afi, safi_t safi, |
| 2856 | const char *rmap, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2857 | { |
| 2858 | int ret; |
| 2859 | struct peer *peer; |
| 2860 | |
| 2861 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2862 | if (! peer) |
| 2863 | return CMD_WARNING; |
| 2864 | |
| 2865 | if (set) |
| 2866 | ret = peer_default_originate_set (peer, afi, safi, rmap); |
| 2867 | else |
| 2868 | ret = peer_default_originate_unset (peer, afi, safi); |
| 2869 | |
| 2870 | return bgp_vty_return (vty, ret); |
| 2871 | } |
| 2872 | |
| 2873 | /* neighbor default-originate. */ |
| 2874 | DEFUN (neighbor_default_originate, |
| 2875 | neighbor_default_originate_cmd, |
| 2876 | NEIGHBOR_CMD2 "default-originate", |
| 2877 | NEIGHBOR_STR |
| 2878 | NEIGHBOR_ADDR_STR2 |
| 2879 | "Originate default route to this neighbor\n") |
| 2880 | { |
| 2881 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2882 | bgp_node_safi (vty), NULL, 1); |
| 2883 | } |
| 2884 | |
| 2885 | DEFUN (neighbor_default_originate_rmap, |
| 2886 | neighbor_default_originate_rmap_cmd, |
| 2887 | NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 2888 | NEIGHBOR_STR |
| 2889 | NEIGHBOR_ADDR_STR2 |
| 2890 | "Originate default route to this neighbor\n" |
| 2891 | "Route-map to specify criteria to originate default\n" |
| 2892 | "route-map name\n") |
| 2893 | { |
| 2894 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2895 | bgp_node_safi (vty), argv[1], 1); |
| 2896 | } |
| 2897 | |
| 2898 | DEFUN (no_neighbor_default_originate, |
| 2899 | no_neighbor_default_originate_cmd, |
| 2900 | NO_NEIGHBOR_CMD2 "default-originate", |
| 2901 | NO_STR |
| 2902 | NEIGHBOR_STR |
| 2903 | NEIGHBOR_ADDR_STR2 |
| 2904 | "Originate default route to this neighbor\n") |
| 2905 | { |
| 2906 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2907 | bgp_node_safi (vty), NULL, 0); |
| 2908 | } |
| 2909 | |
| 2910 | ALIAS (no_neighbor_default_originate, |
| 2911 | no_neighbor_default_originate_rmap_cmd, |
| 2912 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 2913 | NO_STR |
| 2914 | NEIGHBOR_STR |
| 2915 | NEIGHBOR_ADDR_STR2 |
| 2916 | "Originate default route to this neighbor\n" |
| 2917 | "Route-map to specify criteria to originate default\n" |
| 2918 | "route-map name\n") |
| 2919 | |
| 2920 | /* Set neighbor's BGP port. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2921 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2922 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
| 2923 | const char *port_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2924 | { |
| 2925 | struct peer *peer; |
| 2926 | u_int16_t port; |
| 2927 | struct servent *sp; |
| 2928 | |
| 2929 | peer = peer_lookup_vty (vty, ip_str); |
| 2930 | if (! peer) |
| 2931 | return CMD_WARNING; |
| 2932 | |
| 2933 | if (! port_str) |
| 2934 | { |
| 2935 | sp = getservbyname ("bgp", "tcp"); |
| 2936 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); |
| 2937 | } |
| 2938 | else |
| 2939 | { |
| 2940 | VTY_GET_INTEGER("port", port, port_str); |
| 2941 | } |
| 2942 | |
| 2943 | peer_port_set (peer, port); |
| 2944 | |
| 2945 | return CMD_SUCCESS; |
| 2946 | } |
| 2947 | |
hasso | f418446 | 2005-02-01 20:13:16 +0000 | [diff] [blame] | 2948 | /* Set specified peer's BGP port. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2949 | DEFUN (neighbor_port, |
| 2950 | neighbor_port_cmd, |
| 2951 | NEIGHBOR_CMD "port <0-65535>", |
| 2952 | NEIGHBOR_STR |
| 2953 | NEIGHBOR_ADDR_STR |
| 2954 | "Neighbor's BGP port\n" |
| 2955 | "TCP port number\n") |
| 2956 | { |
| 2957 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); |
| 2958 | } |
| 2959 | |
| 2960 | DEFUN (no_neighbor_port, |
| 2961 | no_neighbor_port_cmd, |
| 2962 | NO_NEIGHBOR_CMD "port", |
| 2963 | NO_STR |
| 2964 | NEIGHBOR_STR |
| 2965 | NEIGHBOR_ADDR_STR |
| 2966 | "Neighbor's BGP port\n") |
| 2967 | { |
| 2968 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); |
| 2969 | } |
| 2970 | |
| 2971 | ALIAS (no_neighbor_port, |
| 2972 | no_neighbor_port_val_cmd, |
| 2973 | NO_NEIGHBOR_CMD "port <0-65535>", |
| 2974 | NO_STR |
| 2975 | NEIGHBOR_STR |
| 2976 | NEIGHBOR_ADDR_STR |
| 2977 | "Neighbor's BGP port\n" |
| 2978 | "TCP port number\n") |
| 2979 | |
| 2980 | /* neighbor weight. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2981 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2982 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
| 2983 | const char *weight_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2984 | { |
| 2985 | int ret; |
| 2986 | struct peer *peer; |
| 2987 | unsigned long weight; |
| 2988 | |
| 2989 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2990 | if (! peer) |
| 2991 | return CMD_WARNING; |
| 2992 | |
| 2993 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); |
| 2994 | |
| 2995 | ret = peer_weight_set (peer, weight); |
| 2996 | |
| 2997 | return CMD_SUCCESS; |
| 2998 | } |
| 2999 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3000 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3001 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3002 | { |
| 3003 | struct peer *peer; |
| 3004 | |
| 3005 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3006 | if (! peer) |
| 3007 | return CMD_WARNING; |
| 3008 | |
| 3009 | peer_weight_unset (peer); |
| 3010 | |
| 3011 | return CMD_SUCCESS; |
| 3012 | } |
| 3013 | |
| 3014 | DEFUN (neighbor_weight, |
| 3015 | neighbor_weight_cmd, |
| 3016 | NEIGHBOR_CMD2 "weight <0-65535>", |
| 3017 | NEIGHBOR_STR |
| 3018 | NEIGHBOR_ADDR_STR2 |
| 3019 | "Set default weight for routes from this neighbor\n" |
| 3020 | "default weight\n") |
| 3021 | { |
| 3022 | return peer_weight_set_vty (vty, argv[0], argv[1]); |
| 3023 | } |
| 3024 | |
| 3025 | DEFUN (no_neighbor_weight, |
| 3026 | no_neighbor_weight_cmd, |
| 3027 | NO_NEIGHBOR_CMD2 "weight", |
| 3028 | NO_STR |
| 3029 | NEIGHBOR_STR |
| 3030 | NEIGHBOR_ADDR_STR2 |
| 3031 | "Set default weight for routes from this neighbor\n") |
| 3032 | { |
| 3033 | return peer_weight_unset_vty (vty, argv[0]); |
| 3034 | } |
| 3035 | |
| 3036 | ALIAS (no_neighbor_weight, |
| 3037 | no_neighbor_weight_val_cmd, |
| 3038 | NO_NEIGHBOR_CMD2 "weight <0-65535>", |
| 3039 | NO_STR |
| 3040 | NEIGHBOR_STR |
| 3041 | NEIGHBOR_ADDR_STR2 |
| 3042 | "Set default weight for routes from this neighbor\n" |
| 3043 | "default weight\n") |
| 3044 | |
| 3045 | /* Override capability negotiation. */ |
| 3046 | DEFUN (neighbor_override_capability, |
| 3047 | neighbor_override_capability_cmd, |
| 3048 | NEIGHBOR_CMD2 "override-capability", |
| 3049 | NEIGHBOR_STR |
| 3050 | NEIGHBOR_ADDR_STR2 |
| 3051 | "Override capability negotiation result\n") |
| 3052 | { |
| 3053 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 3054 | } |
| 3055 | |
| 3056 | DEFUN (no_neighbor_override_capability, |
| 3057 | no_neighbor_override_capability_cmd, |
| 3058 | NO_NEIGHBOR_CMD2 "override-capability", |
| 3059 | NO_STR |
| 3060 | NEIGHBOR_STR |
| 3061 | NEIGHBOR_ADDR_STR2 |
| 3062 | "Override capability negotiation result\n") |
| 3063 | { |
| 3064 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 3065 | } |
| 3066 | |
| 3067 | DEFUN (neighbor_strict_capability, |
| 3068 | neighbor_strict_capability_cmd, |
| 3069 | NEIGHBOR_CMD "strict-capability-match", |
| 3070 | NEIGHBOR_STR |
| 3071 | NEIGHBOR_ADDR_STR |
| 3072 | "Strict capability negotiation match\n") |
| 3073 | { |
| 3074 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3075 | } |
| 3076 | |
| 3077 | DEFUN (no_neighbor_strict_capability, |
| 3078 | no_neighbor_strict_capability_cmd, |
| 3079 | NO_NEIGHBOR_CMD "strict-capability-match", |
| 3080 | NO_STR |
| 3081 | NEIGHBOR_STR |
| 3082 | NEIGHBOR_ADDR_STR |
| 3083 | "Strict capability negotiation match\n") |
| 3084 | { |
| 3085 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3086 | } |
| 3087 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3088 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3089 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
| 3090 | const char *keep_str, const char *hold_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3091 | { |
| 3092 | int ret; |
| 3093 | struct peer *peer; |
| 3094 | u_int32_t keepalive; |
| 3095 | u_int32_t holdtime; |
| 3096 | |
| 3097 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3098 | if (! peer) |
| 3099 | return CMD_WARNING; |
| 3100 | |
| 3101 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); |
| 3102 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); |
| 3103 | |
| 3104 | ret = peer_timers_set (peer, keepalive, holdtime); |
| 3105 | |
| 3106 | return bgp_vty_return (vty, ret); |
| 3107 | } |
| 3108 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3109 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3110 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3111 | { |
| 3112 | int ret; |
| 3113 | struct peer *peer; |
| 3114 | |
| 3115 | peer = peer_lookup_vty (vty, ip_str); |
| 3116 | if (! peer) |
| 3117 | return CMD_WARNING; |
| 3118 | |
| 3119 | ret = peer_timers_unset (peer); |
| 3120 | |
| 3121 | return bgp_vty_return (vty, ret); |
| 3122 | } |
| 3123 | |
| 3124 | DEFUN (neighbor_timers, |
| 3125 | neighbor_timers_cmd, |
| 3126 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", |
| 3127 | NEIGHBOR_STR |
| 3128 | NEIGHBOR_ADDR_STR2 |
| 3129 | "BGP per neighbor timers\n" |
| 3130 | "Keepalive interval\n" |
| 3131 | "Holdtime\n") |
| 3132 | { |
| 3133 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); |
| 3134 | } |
| 3135 | |
| 3136 | DEFUN (no_neighbor_timers, |
| 3137 | no_neighbor_timers_cmd, |
| 3138 | NO_NEIGHBOR_CMD2 "timers", |
| 3139 | NO_STR |
| 3140 | NEIGHBOR_STR |
| 3141 | NEIGHBOR_ADDR_STR2 |
| 3142 | "BGP per neighbor timers\n") |
| 3143 | { |
| 3144 | return peer_timers_unset_vty (vty, argv[0]); |
| 3145 | } |
| 3146 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3147 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3148 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
| 3149 | const char *time_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3150 | { |
| 3151 | int ret; |
| 3152 | struct peer *peer; |
| 3153 | u_int32_t connect; |
| 3154 | |
| 3155 | peer = peer_lookup_vty (vty, ip_str); |
| 3156 | if (! peer) |
| 3157 | return CMD_WARNING; |
| 3158 | |
| 3159 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); |
| 3160 | |
| 3161 | ret = peer_timers_connect_set (peer, connect); |
| 3162 | |
| 3163 | return CMD_SUCCESS; |
| 3164 | } |
| 3165 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3166 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3167 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3168 | { |
| 3169 | int ret; |
| 3170 | struct peer *peer; |
| 3171 | |
| 3172 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3173 | if (! peer) |
| 3174 | return CMD_WARNING; |
| 3175 | |
| 3176 | ret = peer_timers_connect_unset (peer); |
| 3177 | |
| 3178 | return CMD_SUCCESS; |
| 3179 | } |
| 3180 | |
| 3181 | DEFUN (neighbor_timers_connect, |
| 3182 | neighbor_timers_connect_cmd, |
| 3183 | NEIGHBOR_CMD "timers connect <0-65535>", |
| 3184 | NEIGHBOR_STR |
| 3185 | NEIGHBOR_ADDR_STR |
| 3186 | "BGP per neighbor timers\n" |
| 3187 | "BGP connect timer\n" |
| 3188 | "Connect timer\n") |
| 3189 | { |
| 3190 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); |
| 3191 | } |
| 3192 | |
| 3193 | DEFUN (no_neighbor_timers_connect, |
| 3194 | no_neighbor_timers_connect_cmd, |
| 3195 | NO_NEIGHBOR_CMD "timers connect", |
| 3196 | NO_STR |
| 3197 | NEIGHBOR_STR |
| 3198 | NEIGHBOR_ADDR_STR |
| 3199 | "BGP per neighbor timers\n" |
| 3200 | "BGP connect timer\n") |
| 3201 | { |
| 3202 | return peer_timers_connect_unset_vty (vty, argv[0]); |
| 3203 | } |
| 3204 | |
| 3205 | ALIAS (no_neighbor_timers_connect, |
| 3206 | no_neighbor_timers_connect_val_cmd, |
| 3207 | NO_NEIGHBOR_CMD "timers connect <0-65535>", |
| 3208 | NO_STR |
| 3209 | NEIGHBOR_STR |
| 3210 | NEIGHBOR_ADDR_STR |
| 3211 | "BGP per neighbor timers\n" |
| 3212 | "BGP connect timer\n" |
| 3213 | "Connect timer\n") |
| 3214 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3215 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3216 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
| 3217 | const char *time_str, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3218 | { |
| 3219 | int ret; |
| 3220 | struct peer *peer; |
| 3221 | u_int32_t routeadv = 0; |
| 3222 | |
| 3223 | peer = peer_lookup_vty (vty, ip_str); |
| 3224 | if (! peer) |
| 3225 | return CMD_WARNING; |
| 3226 | |
| 3227 | if (time_str) |
| 3228 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); |
| 3229 | |
| 3230 | if (set) |
| 3231 | ret = peer_advertise_interval_set (peer, routeadv); |
| 3232 | else |
| 3233 | ret = peer_advertise_interval_unset (peer); |
| 3234 | |
| 3235 | return CMD_SUCCESS; |
| 3236 | } |
| 3237 | |
| 3238 | DEFUN (neighbor_advertise_interval, |
| 3239 | neighbor_advertise_interval_cmd, |
| 3240 | NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3241 | NEIGHBOR_STR |
| 3242 | NEIGHBOR_ADDR_STR |
| 3243 | "Minimum interval between sending BGP routing updates\n" |
| 3244 | "time in seconds\n") |
| 3245 | { |
| 3246 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); |
| 3247 | } |
| 3248 | |
| 3249 | DEFUN (no_neighbor_advertise_interval, |
| 3250 | no_neighbor_advertise_interval_cmd, |
| 3251 | NO_NEIGHBOR_CMD "advertisement-interval", |
| 3252 | NO_STR |
| 3253 | NEIGHBOR_STR |
| 3254 | NEIGHBOR_ADDR_STR |
| 3255 | "Minimum interval between sending BGP routing updates\n") |
| 3256 | { |
| 3257 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); |
| 3258 | } |
| 3259 | |
| 3260 | ALIAS (no_neighbor_advertise_interval, |
| 3261 | no_neighbor_advertise_interval_val_cmd, |
| 3262 | NO_NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3263 | NO_STR |
| 3264 | NEIGHBOR_STR |
| 3265 | NEIGHBOR_ADDR_STR |
| 3266 | "Minimum interval between sending BGP routing updates\n" |
| 3267 | "time in seconds\n") |
| 3268 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3269 | /* neighbor interface */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3270 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3271 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3272 | { |
| 3273 | int ret; |
| 3274 | struct peer *peer; |
| 3275 | |
| 3276 | peer = peer_lookup_vty (vty, ip_str); |
| 3277 | if (! peer) |
| 3278 | return CMD_WARNING; |
| 3279 | |
| 3280 | if (str) |
| 3281 | ret = peer_interface_set (peer, str); |
| 3282 | else |
| 3283 | ret = peer_interface_unset (peer); |
| 3284 | |
| 3285 | return CMD_SUCCESS; |
| 3286 | } |
| 3287 | |
| 3288 | DEFUN (neighbor_interface, |
| 3289 | neighbor_interface_cmd, |
| 3290 | NEIGHBOR_CMD "interface WORD", |
| 3291 | NEIGHBOR_STR |
| 3292 | NEIGHBOR_ADDR_STR |
| 3293 | "Interface\n" |
| 3294 | "Interface name\n") |
| 3295 | { |
| 3296 | return peer_interface_vty (vty, argv[0], argv[1]); |
| 3297 | } |
| 3298 | |
| 3299 | DEFUN (no_neighbor_interface, |
| 3300 | no_neighbor_interface_cmd, |
| 3301 | NO_NEIGHBOR_CMD "interface WORD", |
| 3302 | NO_STR |
| 3303 | NEIGHBOR_STR |
| 3304 | NEIGHBOR_ADDR_STR |
| 3305 | "Interface\n" |
| 3306 | "Interface name\n") |
| 3307 | { |
| 3308 | return peer_interface_vty (vty, argv[0], NULL); |
| 3309 | } |
| 3310 | |
| 3311 | /* Set distribute list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3312 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3313 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
| 3314 | afi_t afi, safi_t safi, |
| 3315 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3316 | { |
| 3317 | int ret; |
| 3318 | struct peer *peer; |
| 3319 | int direct = FILTER_IN; |
| 3320 | |
| 3321 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3322 | if (! peer) |
| 3323 | return CMD_WARNING; |
| 3324 | |
| 3325 | /* Check filter direction. */ |
| 3326 | if (strncmp (direct_str, "i", 1) == 0) |
| 3327 | direct = FILTER_IN; |
| 3328 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3329 | direct = FILTER_OUT; |
| 3330 | |
| 3331 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); |
| 3332 | |
| 3333 | return bgp_vty_return (vty, ret); |
| 3334 | } |
| 3335 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3336 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3337 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3338 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3339 | { |
| 3340 | int ret; |
| 3341 | struct peer *peer; |
| 3342 | int direct = FILTER_IN; |
| 3343 | |
| 3344 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3345 | if (! peer) |
| 3346 | return CMD_WARNING; |
| 3347 | |
| 3348 | /* Check filter direction. */ |
| 3349 | if (strncmp (direct_str, "i", 1) == 0) |
| 3350 | direct = FILTER_IN; |
| 3351 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3352 | direct = FILTER_OUT; |
| 3353 | |
| 3354 | ret = peer_distribute_unset (peer, afi, safi, direct); |
| 3355 | |
| 3356 | return bgp_vty_return (vty, ret); |
| 3357 | } |
| 3358 | |
| 3359 | DEFUN (neighbor_distribute_list, |
| 3360 | neighbor_distribute_list_cmd, |
| 3361 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3362 | NEIGHBOR_STR |
| 3363 | NEIGHBOR_ADDR_STR2 |
| 3364 | "Filter updates to/from this neighbor\n" |
| 3365 | "IP access-list number\n" |
| 3366 | "IP access-list number (expanded range)\n" |
| 3367 | "IP Access-list name\n" |
| 3368 | "Filter incoming updates\n" |
| 3369 | "Filter outgoing updates\n") |
| 3370 | { |
| 3371 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3372 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3373 | } |
| 3374 | |
| 3375 | DEFUN (no_neighbor_distribute_list, |
| 3376 | no_neighbor_distribute_list_cmd, |
| 3377 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3378 | NO_STR |
| 3379 | NEIGHBOR_STR |
| 3380 | NEIGHBOR_ADDR_STR2 |
| 3381 | "Filter updates to/from this neighbor\n" |
| 3382 | "IP access-list number\n" |
| 3383 | "IP access-list number (expanded range)\n" |
| 3384 | "IP Access-list name\n" |
| 3385 | "Filter incoming updates\n" |
| 3386 | "Filter outgoing updates\n") |
| 3387 | { |
| 3388 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3389 | bgp_node_safi (vty), argv[2]); |
| 3390 | } |
| 3391 | |
| 3392 | /* Set prefix list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3393 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3394 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3395 | safi_t safi, const char *name_str, |
| 3396 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3397 | { |
| 3398 | int ret; |
| 3399 | struct peer *peer; |
| 3400 | int direct = FILTER_IN; |
| 3401 | |
| 3402 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3403 | if (! peer) |
| 3404 | return CMD_WARNING; |
| 3405 | |
| 3406 | /* Check filter direction. */ |
| 3407 | if (strncmp (direct_str, "i", 1) == 0) |
| 3408 | direct = FILTER_IN; |
| 3409 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3410 | direct = FILTER_OUT; |
| 3411 | |
| 3412 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); |
| 3413 | |
| 3414 | return bgp_vty_return (vty, ret); |
| 3415 | } |
| 3416 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3417 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3418 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3419 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3420 | { |
| 3421 | int ret; |
| 3422 | struct peer *peer; |
| 3423 | int direct = FILTER_IN; |
| 3424 | |
| 3425 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3426 | if (! peer) |
| 3427 | return CMD_WARNING; |
| 3428 | |
| 3429 | /* Check filter direction. */ |
| 3430 | if (strncmp (direct_str, "i", 1) == 0) |
| 3431 | direct = FILTER_IN; |
| 3432 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3433 | direct = FILTER_OUT; |
| 3434 | |
| 3435 | ret = peer_prefix_list_unset (peer, afi, safi, direct); |
| 3436 | |
| 3437 | return bgp_vty_return (vty, ret); |
| 3438 | } |
| 3439 | |
| 3440 | DEFUN (neighbor_prefix_list, |
| 3441 | neighbor_prefix_list_cmd, |
| 3442 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3443 | NEIGHBOR_STR |
| 3444 | NEIGHBOR_ADDR_STR2 |
| 3445 | "Filter updates to/from this neighbor\n" |
| 3446 | "Name of a prefix list\n" |
| 3447 | "Filter incoming updates\n" |
| 3448 | "Filter outgoing updates\n") |
| 3449 | { |
| 3450 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3451 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3452 | } |
| 3453 | |
| 3454 | DEFUN (no_neighbor_prefix_list, |
| 3455 | no_neighbor_prefix_list_cmd, |
| 3456 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3457 | NO_STR |
| 3458 | NEIGHBOR_STR |
| 3459 | NEIGHBOR_ADDR_STR2 |
| 3460 | "Filter updates to/from this neighbor\n" |
| 3461 | "Name of a prefix list\n" |
| 3462 | "Filter incoming updates\n" |
| 3463 | "Filter outgoing updates\n") |
| 3464 | { |
| 3465 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3466 | bgp_node_safi (vty), argv[2]); |
| 3467 | } |
| 3468 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3469 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3470 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
| 3471 | afi_t afi, safi_t safi, |
| 3472 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3473 | { |
| 3474 | int ret; |
| 3475 | struct peer *peer; |
| 3476 | int direct = FILTER_IN; |
| 3477 | |
| 3478 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3479 | if (! peer) |
| 3480 | return CMD_WARNING; |
| 3481 | |
| 3482 | /* Check filter direction. */ |
| 3483 | if (strncmp (direct_str, "i", 1) == 0) |
| 3484 | direct = FILTER_IN; |
| 3485 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3486 | direct = FILTER_OUT; |
| 3487 | |
| 3488 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); |
| 3489 | |
| 3490 | return bgp_vty_return (vty, ret); |
| 3491 | } |
| 3492 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3493 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3494 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
| 3495 | afi_t afi, safi_t safi, |
| 3496 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3497 | { |
| 3498 | int ret; |
| 3499 | struct peer *peer; |
| 3500 | int direct = FILTER_IN; |
| 3501 | |
| 3502 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3503 | if (! peer) |
| 3504 | return CMD_WARNING; |
| 3505 | |
| 3506 | /* Check filter direction. */ |
| 3507 | if (strncmp (direct_str, "i", 1) == 0) |
| 3508 | direct = FILTER_IN; |
| 3509 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3510 | direct = FILTER_OUT; |
| 3511 | |
| 3512 | ret = peer_aslist_unset (peer, afi, safi, direct); |
| 3513 | |
| 3514 | return bgp_vty_return (vty, ret); |
| 3515 | } |
| 3516 | |
| 3517 | DEFUN (neighbor_filter_list, |
| 3518 | neighbor_filter_list_cmd, |
| 3519 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3520 | NEIGHBOR_STR |
| 3521 | NEIGHBOR_ADDR_STR2 |
| 3522 | "Establish BGP filters\n" |
| 3523 | "AS path access-list name\n" |
| 3524 | "Filter incoming routes\n" |
| 3525 | "Filter outgoing routes\n") |
| 3526 | { |
| 3527 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3528 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3529 | } |
| 3530 | |
| 3531 | DEFUN (no_neighbor_filter_list, |
| 3532 | no_neighbor_filter_list_cmd, |
| 3533 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3534 | NO_STR |
| 3535 | NEIGHBOR_STR |
| 3536 | NEIGHBOR_ADDR_STR2 |
| 3537 | "Establish BGP filters\n" |
| 3538 | "AS path access-list name\n" |
| 3539 | "Filter incoming routes\n" |
| 3540 | "Filter outgoing routes\n") |
| 3541 | { |
| 3542 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3543 | bgp_node_safi (vty), argv[2]); |
| 3544 | } |
| 3545 | |
| 3546 | /* Set route-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3547 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3548 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
| 3549 | afi_t afi, safi_t safi, |
| 3550 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3551 | { |
| 3552 | int ret; |
| 3553 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3554 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3555 | |
| 3556 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3557 | if (! peer) |
| 3558 | return CMD_WARNING; |
| 3559 | |
| 3560 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3561 | if (strncmp (direct_str, "in", 2) == 0) |
| 3562 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3563 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3564 | direct = RMAP_OUT; |
| 3565 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3566 | direct = RMAP_IMPORT; |
| 3567 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3568 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3569 | |
| 3570 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); |
| 3571 | |
| 3572 | return bgp_vty_return (vty, ret); |
| 3573 | } |
| 3574 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3575 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3576 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3577 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3578 | { |
| 3579 | int ret; |
| 3580 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3581 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3582 | |
| 3583 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3584 | if (! peer) |
| 3585 | return CMD_WARNING; |
| 3586 | |
| 3587 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3588 | if (strncmp (direct_str, "in", 2) == 0) |
| 3589 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3590 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3591 | direct = RMAP_OUT; |
| 3592 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3593 | direct = RMAP_IMPORT; |
| 3594 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3595 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3596 | |
| 3597 | ret = peer_route_map_unset (peer, afi, safi, direct); |
| 3598 | |
| 3599 | return bgp_vty_return (vty, ret); |
| 3600 | } |
| 3601 | |
| 3602 | DEFUN (neighbor_route_map, |
| 3603 | neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3604 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3605 | NEIGHBOR_STR |
| 3606 | NEIGHBOR_ADDR_STR2 |
| 3607 | "Apply route map to neighbor\n" |
| 3608 | "Name of route map\n" |
| 3609 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3610 | "Apply map to outbound routes\n" |
| 3611 | "Apply map to routes going into a Route-Server client's table\n" |
| 3612 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3613 | { |
| 3614 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3615 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3616 | } |
| 3617 | |
| 3618 | DEFUN (no_neighbor_route_map, |
| 3619 | no_neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3620 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3621 | NO_STR |
| 3622 | NEIGHBOR_STR |
| 3623 | NEIGHBOR_ADDR_STR2 |
| 3624 | "Apply route map to neighbor\n" |
| 3625 | "Name of route map\n" |
| 3626 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3627 | "Apply map to outbound routes\n" |
| 3628 | "Apply map to routes going into a Route-Server client's table\n" |
| 3629 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3630 | { |
| 3631 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3632 | bgp_node_safi (vty), argv[2]); |
| 3633 | } |
| 3634 | |
| 3635 | /* Set unsuppress-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3636 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3637 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3638 | safi_t safi, const char *name_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3639 | { |
| 3640 | int ret; |
| 3641 | struct peer *peer; |
| 3642 | |
| 3643 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3644 | if (! peer) |
| 3645 | return CMD_WARNING; |
| 3646 | |
| 3647 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); |
| 3648 | |
| 3649 | return bgp_vty_return (vty, ret); |
| 3650 | } |
| 3651 | |
| 3652 | /* Unset route-map from the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3653 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3654 | 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] | 3655 | safi_t safi) |
| 3656 | { |
| 3657 | int ret; |
| 3658 | struct peer *peer; |
| 3659 | |
| 3660 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3661 | if (! peer) |
| 3662 | return CMD_WARNING; |
| 3663 | |
| 3664 | ret = peer_unsuppress_map_unset (peer, afi, safi); |
| 3665 | |
| 3666 | return bgp_vty_return (vty, ret); |
| 3667 | } |
| 3668 | |
| 3669 | DEFUN (neighbor_unsuppress_map, |
| 3670 | neighbor_unsuppress_map_cmd, |
| 3671 | NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3672 | NEIGHBOR_STR |
| 3673 | NEIGHBOR_ADDR_STR2 |
| 3674 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3675 | "Name of route map\n") |
| 3676 | { |
| 3677 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3678 | bgp_node_safi (vty), argv[1]); |
| 3679 | } |
| 3680 | |
| 3681 | DEFUN (no_neighbor_unsuppress_map, |
| 3682 | no_neighbor_unsuppress_map_cmd, |
| 3683 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3684 | NO_STR |
| 3685 | NEIGHBOR_STR |
| 3686 | NEIGHBOR_ADDR_STR2 |
| 3687 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3688 | "Name of route map\n") |
| 3689 | { |
| 3690 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3691 | bgp_node_safi (vty)); |
| 3692 | } |
| 3693 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3694 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3695 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3696 | safi_t safi, const char *num_str, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3697 | const char *threshold_str, int warning, |
| 3698 | const char *restart_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3699 | { |
| 3700 | int ret; |
| 3701 | struct peer *peer; |
| 3702 | u_int32_t max; |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3703 | u_char threshold; |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3704 | u_int16_t restart; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3705 | |
| 3706 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3707 | if (! peer) |
| 3708 | return CMD_WARNING; |
| 3709 | |
Denis Ovsienko | e6ec1c3 | 2011-09-10 21:50:53 +0400 | [diff] [blame] | 3710 | VTY_GET_INTEGER ("maximum number", max, num_str); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3711 | if (threshold_str) |
| 3712 | threshold = atoi (threshold_str); |
| 3713 | else |
| 3714 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3715 | |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3716 | if (restart_str) |
| 3717 | restart = atoi (restart_str); |
| 3718 | else |
| 3719 | restart = 0; |
| 3720 | |
| 3721 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3722 | |
| 3723 | return bgp_vty_return (vty, ret); |
| 3724 | } |
| 3725 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3726 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3727 | 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] | 3728 | safi_t safi) |
| 3729 | { |
| 3730 | int ret; |
| 3731 | struct peer *peer; |
| 3732 | |
| 3733 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3734 | if (! peer) |
| 3735 | return CMD_WARNING; |
| 3736 | |
| 3737 | ret = peer_maximum_prefix_unset (peer, afi, safi); |
| 3738 | |
| 3739 | return bgp_vty_return (vty, ret); |
| 3740 | } |
| 3741 | |
| 3742 | /* Maximum number of prefix configuration. prefix count is different |
| 3743 | for each peer configuration. So this configuration can be set for |
| 3744 | each peer configuration. */ |
| 3745 | DEFUN (neighbor_maximum_prefix, |
| 3746 | neighbor_maximum_prefix_cmd, |
| 3747 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3748 | NEIGHBOR_STR |
| 3749 | NEIGHBOR_ADDR_STR2 |
| 3750 | "Maximum number of prefix accept from this peer\n" |
| 3751 | "maximum no. of prefix limit\n") |
| 3752 | { |
| 3753 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3754 | bgp_node_safi (vty), argv[1], NULL, 0, |
| 3755 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3756 | } |
| 3757 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3758 | DEFUN (neighbor_maximum_prefix_threshold, |
| 3759 | neighbor_maximum_prefix_threshold_cmd, |
| 3760 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", |
| 3761 | NEIGHBOR_STR |
| 3762 | NEIGHBOR_ADDR_STR2 |
| 3763 | "Maximum number of prefix accept from this peer\n" |
| 3764 | "maximum no. of prefix limit\n" |
| 3765 | "Threshold value (%) at which to generate a warning msg\n") |
| 3766 | { |
| 3767 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3768 | bgp_node_safi (vty), argv[1], argv[2], 0, |
| 3769 | NULL); |
| 3770 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3771 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3772 | DEFUN (neighbor_maximum_prefix_warning, |
| 3773 | neighbor_maximum_prefix_warning_cmd, |
| 3774 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3775 | NEIGHBOR_STR |
| 3776 | NEIGHBOR_ADDR_STR2 |
| 3777 | "Maximum number of prefix accept from this peer\n" |
| 3778 | "maximum no. of prefix limit\n" |
| 3779 | "Only give warning message when limit is exceeded\n") |
| 3780 | { |
| 3781 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3782 | bgp_node_safi (vty), argv[1], NULL, 1, |
| 3783 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3784 | } |
| 3785 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3786 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
| 3787 | neighbor_maximum_prefix_threshold_warning_cmd, |
| 3788 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 3789 | NEIGHBOR_STR |
| 3790 | NEIGHBOR_ADDR_STR2 |
| 3791 | "Maximum number of prefix accept from this peer\n" |
| 3792 | "maximum no. of prefix limit\n" |
| 3793 | "Threshold value (%) at which to generate a warning msg\n" |
| 3794 | "Only give warning message when limit is exceeded\n") |
| 3795 | { |
| 3796 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3797 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
| 3798 | } |
| 3799 | |
| 3800 | DEFUN (neighbor_maximum_prefix_restart, |
| 3801 | neighbor_maximum_prefix_restart_cmd, |
| 3802 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
| 3803 | NEIGHBOR_STR |
| 3804 | NEIGHBOR_ADDR_STR2 |
| 3805 | "Maximum number of prefix accept from this peer\n" |
| 3806 | "maximum no. of prefix limit\n" |
| 3807 | "Restart bgp connection after limit is exceeded\n" |
| 3808 | "Restart interval in minutes") |
| 3809 | { |
| 3810 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3811 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); |
| 3812 | } |
| 3813 | |
| 3814 | DEFUN (neighbor_maximum_prefix_threshold_restart, |
| 3815 | neighbor_maximum_prefix_threshold_restart_cmd, |
| 3816 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 3817 | NEIGHBOR_STR |
| 3818 | NEIGHBOR_ADDR_STR2 |
| 3819 | "Maximum number of prefix accept from this peer\n" |
| 3820 | "maximum no. of prefix limit\n" |
| 3821 | "Threshold value (%) at which to generate a warning msg\n" |
| 3822 | "Restart bgp connection after limit is exceeded\n" |
| 3823 | "Restart interval in minutes") |
| 3824 | { |
| 3825 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3826 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); |
| 3827 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3828 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3829 | DEFUN (no_neighbor_maximum_prefix, |
| 3830 | no_neighbor_maximum_prefix_cmd, |
| 3831 | NO_NEIGHBOR_CMD2 "maximum-prefix", |
| 3832 | NO_STR |
| 3833 | NEIGHBOR_STR |
| 3834 | NEIGHBOR_ADDR_STR2 |
| 3835 | "Maximum number of prefix accept from this peer\n") |
| 3836 | { |
| 3837 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3838 | bgp_node_safi (vty)); |
| 3839 | } |
| 3840 | |
| 3841 | ALIAS (no_neighbor_maximum_prefix, |
| 3842 | no_neighbor_maximum_prefix_val_cmd, |
| 3843 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3844 | NO_STR |
| 3845 | NEIGHBOR_STR |
| 3846 | NEIGHBOR_ADDR_STR2 |
| 3847 | "Maximum number of prefix accept from this peer\n" |
| 3848 | "maximum no. of prefix limit\n") |
| 3849 | |
| 3850 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3851 | no_neighbor_maximum_prefix_threshold_cmd, |
| 3852 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3853 | NO_STR |
| 3854 | NEIGHBOR_STR |
| 3855 | NEIGHBOR_ADDR_STR2 |
| 3856 | "Maximum number of prefix accept from this peer\n" |
| 3857 | "maximum no. of prefix limit\n" |
| 3858 | "Threshold value (%) at which to generate a warning msg\n") |
| 3859 | |
| 3860 | ALIAS (no_neighbor_maximum_prefix, |
| 3861 | no_neighbor_maximum_prefix_warning_cmd, |
| 3862 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3863 | NO_STR |
| 3864 | NEIGHBOR_STR |
| 3865 | NEIGHBOR_ADDR_STR2 |
| 3866 | "Maximum number of prefix accept from this peer\n" |
| 3867 | "maximum no. of prefix limit\n" |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 3868 | "Only give warning message when limit is exceeded\n") |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3869 | |
| 3870 | ALIAS (no_neighbor_maximum_prefix, |
| 3871 | no_neighbor_maximum_prefix_threshold_warning_cmd, |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3872 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 3873 | NO_STR |
| 3874 | NEIGHBOR_STR |
| 3875 | NEIGHBOR_ADDR_STR2 |
| 3876 | "Maximum number of prefix accept from this peer\n" |
| 3877 | "maximum no. of prefix limit\n" |
| 3878 | "Threshold value (%) at which to generate a warning msg\n" |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 3879 | "Only give warning message when limit is exceeded\n") |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3880 | |
| 3881 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3882 | no_neighbor_maximum_prefix_restart_cmd, |
| 3883 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3884 | NO_STR |
| 3885 | NEIGHBOR_STR |
| 3886 | NEIGHBOR_ADDR_STR2 |
| 3887 | "Maximum number of prefix accept from this peer\n" |
| 3888 | "maximum no. of prefix limit\n" |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3889 | "Restart bgp connection after limit is exceeded\n" |
| 3890 | "Restart interval in minutes") |
| 3891 | |
| 3892 | ALIAS (no_neighbor_maximum_prefix, |
| 3893 | no_neighbor_maximum_prefix_threshold_restart_cmd, |
| 3894 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 3895 | NO_STR |
| 3896 | NEIGHBOR_STR |
| 3897 | NEIGHBOR_ADDR_STR2 |
| 3898 | "Maximum number of prefix accept from this peer\n" |
| 3899 | "maximum no. of prefix limit\n" |
| 3900 | "Threshold value (%) at which to generate a warning msg\n" |
| 3901 | "Restart bgp connection after limit is exceeded\n" |
| 3902 | "Restart interval in minutes") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3903 | |
| 3904 | /* "neighbor allowas-in" */ |
| 3905 | DEFUN (neighbor_allowas_in, |
| 3906 | neighbor_allowas_in_cmd, |
| 3907 | NEIGHBOR_CMD2 "allowas-in", |
| 3908 | NEIGHBOR_STR |
| 3909 | NEIGHBOR_ADDR_STR2 |
| 3910 | "Accept as-path with my AS present in it\n") |
| 3911 | { |
| 3912 | int ret; |
| 3913 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3914 | unsigned int allow_num; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3915 | |
| 3916 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3917 | if (! peer) |
| 3918 | return CMD_WARNING; |
| 3919 | |
| 3920 | if (argc == 1) |
| 3921 | allow_num = 3; |
| 3922 | else |
| 3923 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); |
| 3924 | |
| 3925 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), |
| 3926 | allow_num); |
| 3927 | |
| 3928 | return bgp_vty_return (vty, ret); |
| 3929 | } |
| 3930 | |
| 3931 | ALIAS (neighbor_allowas_in, |
| 3932 | neighbor_allowas_in_arg_cmd, |
| 3933 | NEIGHBOR_CMD2 "allowas-in <1-10>", |
| 3934 | NEIGHBOR_STR |
| 3935 | NEIGHBOR_ADDR_STR2 |
| 3936 | "Accept as-path with my AS present in it\n" |
| 3937 | "Number of occurances of AS number\n") |
| 3938 | |
| 3939 | DEFUN (no_neighbor_allowas_in, |
| 3940 | no_neighbor_allowas_in_cmd, |
| 3941 | NO_NEIGHBOR_CMD2 "allowas-in", |
| 3942 | NO_STR |
| 3943 | NEIGHBOR_STR |
| 3944 | NEIGHBOR_ADDR_STR2 |
| 3945 | "allow local ASN appears in aspath attribute\n") |
| 3946 | { |
| 3947 | int ret; |
| 3948 | struct peer *peer; |
| 3949 | |
| 3950 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3951 | if (! peer) |
| 3952 | return CMD_WARNING; |
| 3953 | |
| 3954 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 3955 | |
| 3956 | return bgp_vty_return (vty, ret); |
| 3957 | } |
| 3958 | |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 3959 | DEFUN (neighbor_ttl_security, |
| 3960 | neighbor_ttl_security_cmd, |
| 3961 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", |
| 3962 | NEIGHBOR_STR |
| 3963 | NEIGHBOR_ADDR_STR2 |
| 3964 | "Specify the maximum number of hops to the BGP peer\n") |
| 3965 | { |
| 3966 | struct peer *peer; |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 3967 | int gtsm_hops; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 3968 | |
| 3969 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3970 | if (! peer) |
| 3971 | return CMD_WARNING; |
| 3972 | |
| 3973 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); |
| 3974 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 3975 | 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] | 3976 | } |
| 3977 | |
| 3978 | DEFUN (no_neighbor_ttl_security, |
| 3979 | no_neighbor_ttl_security_cmd, |
| 3980 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", |
| 3981 | NO_STR |
| 3982 | NEIGHBOR_STR |
| 3983 | NEIGHBOR_ADDR_STR2 |
| 3984 | "Specify the maximum number of hops to the BGP peer\n") |
| 3985 | { |
| 3986 | struct peer *peer; |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 3987 | |
| 3988 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3989 | if (! peer) |
| 3990 | return CMD_WARNING; |
| 3991 | |
Stephen Hemminger | 89b6d1f | 2011-03-24 10:51:59 +0000 | [diff] [blame] | 3992 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 3993 | } |
| 3994 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3995 | /* Address family configuration. */ |
| 3996 | DEFUN (address_family_ipv4, |
| 3997 | address_family_ipv4_cmd, |
| 3998 | "address-family ipv4", |
| 3999 | "Enter Address Family command mode\n" |
| 4000 | "Address family\n") |
| 4001 | { |
| 4002 | vty->node = BGP_IPV4_NODE; |
| 4003 | return CMD_SUCCESS; |
| 4004 | } |
| 4005 | |
| 4006 | DEFUN (address_family_ipv4_safi, |
| 4007 | address_family_ipv4_safi_cmd, |
| 4008 | "address-family ipv4 (unicast|multicast)", |
| 4009 | "Enter Address Family command mode\n" |
| 4010 | "Address family\n" |
| 4011 | "Address Family modifier\n" |
| 4012 | "Address Family modifier\n") |
| 4013 | { |
| 4014 | if (strncmp (argv[0], "m", 1) == 0) |
| 4015 | vty->node = BGP_IPV4M_NODE; |
| 4016 | else |
| 4017 | vty->node = BGP_IPV4_NODE; |
| 4018 | |
| 4019 | return CMD_SUCCESS; |
| 4020 | } |
| 4021 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4022 | DEFUN (address_family_ipv6, |
| 4023 | address_family_ipv6_cmd, |
| 4024 | "address-family ipv6", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4025 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4026 | "Address family\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4027 | { |
| 4028 | vty->node = BGP_IPV6_NODE; |
| 4029 | return CMD_SUCCESS; |
| 4030 | } |
| 4031 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4032 | DEFUN (address_family_ipv6_safi, |
| 4033 | address_family_ipv6_safi_cmd, |
| 4034 | "address-family ipv6 (unicast|multicast)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4035 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4036 | "Address family\n" |
| 4037 | "Address Family modifier\n" |
| 4038 | "Address Family modifier\n") |
| 4039 | { |
| 4040 | if (strncmp (argv[0], "m", 1) == 0) |
| 4041 | vty->node = BGP_IPV6M_NODE; |
| 4042 | else |
| 4043 | vty->node = BGP_IPV6_NODE; |
| 4044 | |
| 4045 | return CMD_SUCCESS; |
| 4046 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4047 | |
| 4048 | DEFUN (address_family_vpnv4, |
| 4049 | address_family_vpnv4_cmd, |
| 4050 | "address-family vpnv4", |
| 4051 | "Enter Address Family command mode\n" |
| 4052 | "Address family\n") |
| 4053 | { |
| 4054 | vty->node = BGP_VPNV4_NODE; |
| 4055 | return CMD_SUCCESS; |
| 4056 | } |
| 4057 | |
| 4058 | ALIAS (address_family_vpnv4, |
| 4059 | address_family_vpnv4_unicast_cmd, |
| 4060 | "address-family vpnv4 unicast", |
| 4061 | "Enter Address Family command mode\n" |
| 4062 | "Address family\n" |
| 4063 | "Address Family Modifier\n") |
| 4064 | |
| 4065 | DEFUN (exit_address_family, |
| 4066 | exit_address_family_cmd, |
| 4067 | "exit-address-family", |
| 4068 | "Exit from Address Family configuration mode\n") |
| 4069 | { |
hasso | a8a80d5 | 2005-04-09 13:07:47 +0000 | [diff] [blame] | 4070 | if (vty->node == BGP_IPV4_NODE |
| 4071 | || vty->node == BGP_IPV4M_NODE |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4072 | || vty->node == BGP_VPNV4_NODE |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4073 | || vty->node == BGP_IPV6_NODE |
| 4074 | || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4075 | vty->node = BGP_NODE; |
| 4076 | return CMD_SUCCESS; |
| 4077 | } |
| 4078 | |
| 4079 | /* BGP clear sort. */ |
| 4080 | enum clear_sort |
| 4081 | { |
| 4082 | clear_all, |
| 4083 | clear_peer, |
| 4084 | clear_group, |
| 4085 | clear_external, |
| 4086 | clear_as |
| 4087 | }; |
| 4088 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4089 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4090 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
| 4091 | safi_t safi, int error) |
| 4092 | { |
| 4093 | switch (error) |
| 4094 | { |
| 4095 | case BGP_ERR_AF_UNCONFIGURED: |
| 4096 | vty_out (vty, |
| 4097 | "%%BGP: Enable %s %s address family for the neighbor %s%s", |
| 4098 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", |
| 4099 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", |
| 4100 | peer->host, VTY_NEWLINE); |
| 4101 | break; |
| 4102 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: |
| 4103 | 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); |
| 4104 | break; |
| 4105 | default: |
| 4106 | break; |
| 4107 | } |
| 4108 | } |
| 4109 | |
| 4110 | /* `clear ip bgp' functions. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4111 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4112 | 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] | 4113 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4114 | { |
| 4115 | int ret; |
| 4116 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4117 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4118 | |
| 4119 | /* Clear all neighbors. */ |
| 4120 | if (sort == clear_all) |
| 4121 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4122 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4123 | { |
| 4124 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4125 | ret = peer_clear (peer); |
| 4126 | else |
| 4127 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4128 | |
| 4129 | if (ret < 0) |
| 4130 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4131 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4132 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4133 | } |
| 4134 | |
| 4135 | /* Clear specified neighbors. */ |
| 4136 | if (sort == clear_peer) |
| 4137 | { |
| 4138 | union sockunion su; |
| 4139 | int ret; |
| 4140 | |
| 4141 | /* Make sockunion for lookup. */ |
| 4142 | ret = str2sockunion (arg, &su); |
| 4143 | if (ret < 0) |
| 4144 | { |
| 4145 | vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4146 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4147 | } |
| 4148 | peer = peer_lookup (bgp, &su); |
| 4149 | if (! peer) |
| 4150 | { |
| 4151 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4152 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4153 | } |
| 4154 | |
| 4155 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4156 | ret = peer_clear (peer); |
| 4157 | else |
| 4158 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4159 | |
| 4160 | if (ret < 0) |
| 4161 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4162 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4163 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4164 | } |
| 4165 | |
| 4166 | /* Clear all peer-group members. */ |
| 4167 | if (sort == clear_group) |
| 4168 | { |
| 4169 | struct peer_group *group; |
| 4170 | |
| 4171 | group = peer_group_lookup (bgp, arg); |
| 4172 | if (! group) |
| 4173 | { |
| 4174 | 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] | 4175 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4176 | } |
| 4177 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4178 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4179 | { |
| 4180 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4181 | { |
| 4182 | ret = peer_clear (peer); |
| 4183 | continue; |
| 4184 | } |
| 4185 | |
| 4186 | if (! peer->af_group[afi][safi]) |
| 4187 | continue; |
| 4188 | |
| 4189 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4190 | |
| 4191 | if (ret < 0) |
| 4192 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4193 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4194 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4195 | } |
| 4196 | |
| 4197 | if (sort == clear_external) |
| 4198 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4199 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4200 | { |
| 4201 | if (peer_sort (peer) == BGP_PEER_IBGP) |
| 4202 | continue; |
| 4203 | |
| 4204 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4205 | ret = peer_clear (peer); |
| 4206 | else |
| 4207 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4208 | |
| 4209 | if (ret < 0) |
| 4210 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4211 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4212 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4213 | } |
| 4214 | |
| 4215 | if (sort == clear_as) |
| 4216 | { |
| 4217 | as_t as; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4218 | int find = 0; |
| 4219 | |
Ulrich Weber | bde12e3 | 2011-11-16 19:32:12 +0400 | [diff] [blame] | 4220 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4221 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4222 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4223 | { |
| 4224 | if (peer->as != as) |
| 4225 | continue; |
| 4226 | |
| 4227 | find = 1; |
| 4228 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4229 | ret = peer_clear (peer); |
| 4230 | else |
| 4231 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4232 | |
| 4233 | if (ret < 0) |
| 4234 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4235 | } |
| 4236 | if (! find) |
| 4237 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, |
| 4238 | VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4239 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4240 | } |
| 4241 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4242 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4243 | } |
| 4244 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4245 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4246 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
| 4247 | enum clear_sort sort, enum bgp_clear_type stype, |
| 4248 | const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4249 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4250 | struct bgp *bgp; |
| 4251 | |
| 4252 | /* BGP structure lookup. */ |
| 4253 | if (name) |
| 4254 | { |
| 4255 | bgp = bgp_lookup_by_name (name); |
| 4256 | if (bgp == NULL) |
| 4257 | { |
| 4258 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); |
| 4259 | return CMD_WARNING; |
| 4260 | } |
| 4261 | } |
| 4262 | else |
| 4263 | { |
| 4264 | bgp = bgp_get_default (); |
| 4265 | if (bgp == NULL) |
| 4266 | { |
| 4267 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); |
| 4268 | return CMD_WARNING; |
| 4269 | } |
| 4270 | } |
| 4271 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4272 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4273 | } |
| 4274 | |
| 4275 | DEFUN (clear_ip_bgp_all, |
| 4276 | clear_ip_bgp_all_cmd, |
| 4277 | "clear ip bgp *", |
| 4278 | CLEAR_STR |
| 4279 | IP_STR |
| 4280 | BGP_STR |
| 4281 | "Clear all peers\n") |
| 4282 | { |
| 4283 | if (argc == 1) |
| 4284 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4285 | |
| 4286 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4287 | } |
| 4288 | |
| 4289 | ALIAS (clear_ip_bgp_all, |
| 4290 | clear_bgp_all_cmd, |
| 4291 | "clear bgp *", |
| 4292 | CLEAR_STR |
| 4293 | BGP_STR |
| 4294 | "Clear all peers\n") |
| 4295 | |
| 4296 | ALIAS (clear_ip_bgp_all, |
| 4297 | clear_bgp_ipv6_all_cmd, |
| 4298 | "clear bgp ipv6 *", |
| 4299 | CLEAR_STR |
| 4300 | BGP_STR |
| 4301 | "Address family\n" |
| 4302 | "Clear all peers\n") |
| 4303 | |
| 4304 | ALIAS (clear_ip_bgp_all, |
| 4305 | clear_ip_bgp_instance_all_cmd, |
| 4306 | "clear ip bgp view WORD *", |
| 4307 | CLEAR_STR |
| 4308 | IP_STR |
| 4309 | BGP_STR |
| 4310 | "BGP view\n" |
| 4311 | "view name\n" |
| 4312 | "Clear all peers\n") |
| 4313 | |
| 4314 | ALIAS (clear_ip_bgp_all, |
| 4315 | clear_bgp_instance_all_cmd, |
| 4316 | "clear bgp view WORD *", |
| 4317 | CLEAR_STR |
| 4318 | BGP_STR |
| 4319 | "BGP view\n" |
| 4320 | "view name\n" |
| 4321 | "Clear all peers\n") |
| 4322 | |
| 4323 | DEFUN (clear_ip_bgp_peer, |
| 4324 | clear_ip_bgp_peer_cmd, |
| 4325 | "clear ip bgp (A.B.C.D|X:X::X:X)", |
| 4326 | CLEAR_STR |
| 4327 | IP_STR |
| 4328 | BGP_STR |
| 4329 | "BGP neighbor IP address to clear\n" |
| 4330 | "BGP IPv6 neighbor to clear\n") |
| 4331 | { |
| 4332 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4333 | } |
| 4334 | |
| 4335 | ALIAS (clear_ip_bgp_peer, |
| 4336 | clear_bgp_peer_cmd, |
| 4337 | "clear bgp (A.B.C.D|X:X::X:X)", |
| 4338 | CLEAR_STR |
| 4339 | BGP_STR |
| 4340 | "BGP neighbor address to clear\n" |
| 4341 | "BGP IPv6 neighbor to clear\n") |
| 4342 | |
| 4343 | ALIAS (clear_ip_bgp_peer, |
| 4344 | clear_bgp_ipv6_peer_cmd, |
| 4345 | "clear bgp ipv6 (A.B.C.D|X:X::X:X)", |
| 4346 | CLEAR_STR |
| 4347 | BGP_STR |
| 4348 | "Address family\n" |
| 4349 | "BGP neighbor address to clear\n" |
| 4350 | "BGP IPv6 neighbor to clear\n") |
| 4351 | |
| 4352 | DEFUN (clear_ip_bgp_peer_group, |
| 4353 | clear_ip_bgp_peer_group_cmd, |
| 4354 | "clear ip bgp peer-group WORD", |
| 4355 | CLEAR_STR |
| 4356 | IP_STR |
| 4357 | BGP_STR |
| 4358 | "Clear all members of peer-group\n" |
| 4359 | "BGP peer-group name\n") |
| 4360 | { |
| 4361 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4362 | } |
| 4363 | |
| 4364 | ALIAS (clear_ip_bgp_peer_group, |
| 4365 | clear_bgp_peer_group_cmd, |
| 4366 | "clear bgp peer-group WORD", |
| 4367 | CLEAR_STR |
| 4368 | BGP_STR |
| 4369 | "Clear all members of peer-group\n" |
| 4370 | "BGP peer-group name\n") |
| 4371 | |
| 4372 | ALIAS (clear_ip_bgp_peer_group, |
| 4373 | clear_bgp_ipv6_peer_group_cmd, |
| 4374 | "clear bgp ipv6 peer-group WORD", |
| 4375 | CLEAR_STR |
| 4376 | BGP_STR |
| 4377 | "Address family\n" |
| 4378 | "Clear all members of peer-group\n" |
| 4379 | "BGP peer-group name\n") |
| 4380 | |
| 4381 | DEFUN (clear_ip_bgp_external, |
| 4382 | clear_ip_bgp_external_cmd, |
| 4383 | "clear ip bgp external", |
| 4384 | CLEAR_STR |
| 4385 | IP_STR |
| 4386 | BGP_STR |
| 4387 | "Clear all external peers\n") |
| 4388 | { |
| 4389 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
| 4390 | } |
| 4391 | |
| 4392 | ALIAS (clear_ip_bgp_external, |
| 4393 | clear_bgp_external_cmd, |
| 4394 | "clear bgp external", |
| 4395 | CLEAR_STR |
| 4396 | BGP_STR |
| 4397 | "Clear all external peers\n") |
| 4398 | |
| 4399 | ALIAS (clear_ip_bgp_external, |
| 4400 | clear_bgp_ipv6_external_cmd, |
| 4401 | "clear bgp ipv6 external", |
| 4402 | CLEAR_STR |
| 4403 | BGP_STR |
| 4404 | "Address family\n" |
| 4405 | "Clear all external peers\n") |
| 4406 | |
| 4407 | DEFUN (clear_ip_bgp_as, |
| 4408 | clear_ip_bgp_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4409 | "clear ip bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4410 | CLEAR_STR |
| 4411 | IP_STR |
| 4412 | BGP_STR |
| 4413 | "Clear peers with the AS number\n") |
| 4414 | { |
| 4415 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4416 | } |
| 4417 | |
| 4418 | ALIAS (clear_ip_bgp_as, |
| 4419 | clear_bgp_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4420 | "clear bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4421 | CLEAR_STR |
| 4422 | BGP_STR |
| 4423 | "Clear peers with the AS number\n") |
| 4424 | |
| 4425 | ALIAS (clear_ip_bgp_as, |
| 4426 | clear_bgp_ipv6_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4427 | "clear bgp ipv6 " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4428 | CLEAR_STR |
| 4429 | BGP_STR |
| 4430 | "Address family\n" |
| 4431 | "Clear peers with the AS number\n") |
| 4432 | |
| 4433 | /* Outbound soft-reconfiguration */ |
| 4434 | DEFUN (clear_ip_bgp_all_soft_out, |
| 4435 | clear_ip_bgp_all_soft_out_cmd, |
| 4436 | "clear ip bgp * soft out", |
| 4437 | CLEAR_STR |
| 4438 | IP_STR |
| 4439 | BGP_STR |
| 4440 | "Clear all peers\n" |
| 4441 | "Soft reconfig\n" |
| 4442 | "Soft reconfig outbound update\n") |
| 4443 | { |
| 4444 | if (argc == 1) |
| 4445 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4446 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4447 | |
| 4448 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4449 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4450 | } |
| 4451 | |
| 4452 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4453 | clear_ip_bgp_all_out_cmd, |
| 4454 | "clear ip bgp * out", |
| 4455 | CLEAR_STR |
| 4456 | IP_STR |
| 4457 | BGP_STR |
| 4458 | "Clear all peers\n" |
| 4459 | "Soft reconfig outbound update\n") |
| 4460 | |
| 4461 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4462 | clear_ip_bgp_instance_all_soft_out_cmd, |
| 4463 | "clear ip bgp view WORD * soft out", |
| 4464 | CLEAR_STR |
| 4465 | IP_STR |
| 4466 | BGP_STR |
| 4467 | "BGP view\n" |
| 4468 | "view name\n" |
| 4469 | "Clear all peers\n" |
| 4470 | "Soft reconfig\n" |
| 4471 | "Soft reconfig outbound update\n") |
| 4472 | |
| 4473 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, |
| 4474 | clear_ip_bgp_all_ipv4_soft_out_cmd, |
| 4475 | "clear ip bgp * ipv4 (unicast|multicast) soft out", |
| 4476 | CLEAR_STR |
| 4477 | IP_STR |
| 4478 | BGP_STR |
| 4479 | "Clear all peers\n" |
| 4480 | "Address family\n" |
| 4481 | "Address Family modifier\n" |
| 4482 | "Address Family modifier\n" |
| 4483 | "Soft reconfig\n" |
| 4484 | "Soft reconfig outbound update\n") |
| 4485 | { |
| 4486 | if (strncmp (argv[0], "m", 1) == 0) |
| 4487 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 4488 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4489 | |
| 4490 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4491 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4492 | } |
| 4493 | |
| 4494 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, |
| 4495 | clear_ip_bgp_all_ipv4_out_cmd, |
| 4496 | "clear ip bgp * ipv4 (unicast|multicast) out", |
| 4497 | CLEAR_STR |
| 4498 | IP_STR |
| 4499 | BGP_STR |
| 4500 | "Clear all peers\n" |
| 4501 | "Address family\n" |
| 4502 | "Address Family modifier\n" |
| 4503 | "Address Family modifier\n" |
| 4504 | "Soft reconfig outbound update\n") |
| 4505 | |
| 4506 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
| 4507 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, |
| 4508 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", |
| 4509 | CLEAR_STR |
| 4510 | IP_STR |
| 4511 | BGP_STR |
| 4512 | "BGP view\n" |
| 4513 | "view name\n" |
| 4514 | "Clear all peers\n" |
| 4515 | "Address family\n" |
| 4516 | "Address Family modifier\n" |
| 4517 | "Address Family modifier\n" |
| 4518 | "Soft reconfig outbound update\n") |
| 4519 | { |
| 4520 | if (strncmp (argv[1], "m", 1) == 0) |
| 4521 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 4522 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4523 | |
| 4524 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4525 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4526 | } |
| 4527 | |
| 4528 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, |
| 4529 | clear_ip_bgp_all_vpnv4_soft_out_cmd, |
| 4530 | "clear ip bgp * vpnv4 unicast soft out", |
| 4531 | CLEAR_STR |
| 4532 | IP_STR |
| 4533 | BGP_STR |
| 4534 | "Clear all peers\n" |
| 4535 | "Address family\n" |
| 4536 | "Address Family Modifier\n" |
| 4537 | "Soft reconfig\n" |
| 4538 | "Soft reconfig outbound update\n") |
| 4539 | { |
| 4540 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 4541 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4542 | } |
| 4543 | |
| 4544 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, |
| 4545 | clear_ip_bgp_all_vpnv4_out_cmd, |
| 4546 | "clear ip bgp * vpnv4 unicast out", |
| 4547 | CLEAR_STR |
| 4548 | IP_STR |
| 4549 | BGP_STR |
| 4550 | "Clear all peers\n" |
| 4551 | "Address family\n" |
| 4552 | "Address Family Modifier\n" |
| 4553 | "Soft reconfig outbound update\n") |
| 4554 | |
| 4555 | DEFUN (clear_bgp_all_soft_out, |
| 4556 | clear_bgp_all_soft_out_cmd, |
| 4557 | "clear bgp * soft out", |
| 4558 | CLEAR_STR |
| 4559 | BGP_STR |
| 4560 | "Clear all peers\n" |
| 4561 | "Soft reconfig\n" |
| 4562 | "Soft reconfig outbound update\n") |
| 4563 | { |
| 4564 | if (argc == 1) |
| 4565 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 4566 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4567 | |
| 4568 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 4569 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4570 | } |
| 4571 | |
| 4572 | ALIAS (clear_bgp_all_soft_out, |
| 4573 | clear_bgp_instance_all_soft_out_cmd, |
| 4574 | "clear bgp view WORD * soft out", |
| 4575 | CLEAR_STR |
| 4576 | BGP_STR |
| 4577 | "BGP view\n" |
| 4578 | "view name\n" |
| 4579 | "Clear all peers\n" |
| 4580 | "Soft reconfig\n" |
| 4581 | "Soft reconfig outbound update\n") |
| 4582 | |
| 4583 | ALIAS (clear_bgp_all_soft_out, |
| 4584 | clear_bgp_all_out_cmd, |
| 4585 | "clear bgp * out", |
| 4586 | CLEAR_STR |
| 4587 | BGP_STR |
| 4588 | "Clear all peers\n" |
| 4589 | "Soft reconfig outbound update\n") |
| 4590 | |
| 4591 | ALIAS (clear_bgp_all_soft_out, |
| 4592 | clear_bgp_ipv6_all_soft_out_cmd, |
| 4593 | "clear bgp ipv6 * soft out", |
| 4594 | CLEAR_STR |
| 4595 | BGP_STR |
| 4596 | "Address family\n" |
| 4597 | "Clear all peers\n" |
| 4598 | "Soft reconfig\n" |
| 4599 | "Soft reconfig outbound update\n") |
| 4600 | |
| 4601 | ALIAS (clear_bgp_all_soft_out, |
| 4602 | clear_bgp_ipv6_all_out_cmd, |
| 4603 | "clear bgp ipv6 * out", |
| 4604 | CLEAR_STR |
| 4605 | BGP_STR |
| 4606 | "Address family\n" |
| 4607 | "Clear all peers\n" |
| 4608 | "Soft reconfig outbound update\n") |
| 4609 | |
| 4610 | DEFUN (clear_ip_bgp_peer_soft_out, |
| 4611 | clear_ip_bgp_peer_soft_out_cmd, |
| 4612 | "clear ip bgp A.B.C.D soft out", |
| 4613 | CLEAR_STR |
| 4614 | IP_STR |
| 4615 | BGP_STR |
| 4616 | "BGP neighbor address to clear\n" |
| 4617 | "Soft reconfig\n" |
| 4618 | "Soft reconfig outbound update\n") |
| 4619 | { |
| 4620 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4621 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4622 | } |
| 4623 | |
| 4624 | ALIAS (clear_ip_bgp_peer_soft_out, |
| 4625 | clear_ip_bgp_peer_out_cmd, |
| 4626 | "clear ip bgp A.B.C.D out", |
| 4627 | CLEAR_STR |
| 4628 | IP_STR |
| 4629 | BGP_STR |
| 4630 | "BGP neighbor address to clear\n" |
| 4631 | "Soft reconfig outbound update\n") |
| 4632 | |
| 4633 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
| 4634 | clear_ip_bgp_peer_ipv4_soft_out_cmd, |
| 4635 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", |
| 4636 | CLEAR_STR |
| 4637 | IP_STR |
| 4638 | BGP_STR |
| 4639 | "BGP neighbor address to clear\n" |
| 4640 | "Address family\n" |
| 4641 | "Address Family modifier\n" |
| 4642 | "Address Family modifier\n" |
| 4643 | "Soft reconfig\n" |
| 4644 | "Soft reconfig outbound update\n") |
| 4645 | { |
| 4646 | if (strncmp (argv[1], "m", 1) == 0) |
| 4647 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 4648 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4649 | |
| 4650 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4651 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4652 | } |
| 4653 | |
| 4654 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, |
| 4655 | clear_ip_bgp_peer_ipv4_out_cmd, |
| 4656 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", |
| 4657 | CLEAR_STR |
| 4658 | IP_STR |
| 4659 | BGP_STR |
| 4660 | "BGP neighbor address to clear\n" |
| 4661 | "Address family\n" |
| 4662 | "Address Family modifier\n" |
| 4663 | "Address Family modifier\n" |
| 4664 | "Soft reconfig outbound update\n") |
| 4665 | |
| 4666 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4667 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, |
| 4668 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", |
| 4669 | CLEAR_STR |
| 4670 | IP_STR |
| 4671 | BGP_STR |
| 4672 | "BGP neighbor address to clear\n" |
| 4673 | "Address family\n" |
| 4674 | "Address Family Modifier\n" |
| 4675 | "Soft reconfig\n" |
| 4676 | "Soft reconfig outbound update\n") |
| 4677 | { |
| 4678 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 4679 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4680 | } |
| 4681 | |
| 4682 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4683 | clear_ip_bgp_peer_vpnv4_out_cmd, |
| 4684 | "clear ip bgp A.B.C.D vpnv4 unicast out", |
| 4685 | CLEAR_STR |
| 4686 | IP_STR |
| 4687 | BGP_STR |
| 4688 | "BGP neighbor address to clear\n" |
| 4689 | "Address family\n" |
| 4690 | "Address Family Modifier\n" |
| 4691 | "Soft reconfig outbound update\n") |
| 4692 | |
| 4693 | DEFUN (clear_bgp_peer_soft_out, |
| 4694 | clear_bgp_peer_soft_out_cmd, |
| 4695 | "clear bgp (A.B.C.D|X:X::X:X) soft out", |
| 4696 | CLEAR_STR |
| 4697 | BGP_STR |
| 4698 | "BGP neighbor address to clear\n" |
| 4699 | "BGP IPv6 neighbor to clear\n" |
| 4700 | "Soft reconfig\n" |
| 4701 | "Soft reconfig outbound update\n") |
| 4702 | { |
| 4703 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 4704 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4705 | } |
| 4706 | |
| 4707 | ALIAS (clear_bgp_peer_soft_out, |
| 4708 | clear_bgp_ipv6_peer_soft_out_cmd, |
| 4709 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out", |
| 4710 | CLEAR_STR |
| 4711 | BGP_STR |
| 4712 | "Address family\n" |
| 4713 | "BGP neighbor address to clear\n" |
| 4714 | "BGP IPv6 neighbor to clear\n" |
| 4715 | "Soft reconfig\n" |
| 4716 | "Soft reconfig outbound update\n") |
| 4717 | |
| 4718 | ALIAS (clear_bgp_peer_soft_out, |
| 4719 | clear_bgp_peer_out_cmd, |
| 4720 | "clear bgp (A.B.C.D|X:X::X:X) out", |
| 4721 | CLEAR_STR |
| 4722 | BGP_STR |
| 4723 | "BGP neighbor address to clear\n" |
| 4724 | "BGP IPv6 neighbor to clear\n" |
| 4725 | "Soft reconfig outbound update\n") |
| 4726 | |
| 4727 | ALIAS (clear_bgp_peer_soft_out, |
| 4728 | clear_bgp_ipv6_peer_out_cmd, |
| 4729 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) out", |
| 4730 | CLEAR_STR |
| 4731 | BGP_STR |
| 4732 | "Address family\n" |
| 4733 | "BGP neighbor address to clear\n" |
| 4734 | "BGP IPv6 neighbor to clear\n" |
| 4735 | "Soft reconfig outbound update\n") |
| 4736 | |
| 4737 | DEFUN (clear_ip_bgp_peer_group_soft_out, |
| 4738 | clear_ip_bgp_peer_group_soft_out_cmd, |
| 4739 | "clear ip bgp peer-group WORD soft out", |
| 4740 | CLEAR_STR |
| 4741 | IP_STR |
| 4742 | BGP_STR |
| 4743 | "Clear all members of peer-group\n" |
| 4744 | "BGP peer-group name\n" |
| 4745 | "Soft reconfig\n" |
| 4746 | "Soft reconfig outbound update\n") |
| 4747 | { |
| 4748 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4749 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4750 | } |
| 4751 | |
| 4752 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
| 4753 | clear_ip_bgp_peer_group_out_cmd, |
| 4754 | "clear ip bgp peer-group WORD out", |
| 4755 | CLEAR_STR |
| 4756 | IP_STR |
| 4757 | BGP_STR |
| 4758 | "Clear all members of peer-group\n" |
| 4759 | "BGP peer-group name\n" |
| 4760 | "Soft reconfig outbound update\n") |
| 4761 | |
| 4762 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4763 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, |
| 4764 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", |
| 4765 | CLEAR_STR |
| 4766 | IP_STR |
| 4767 | BGP_STR |
| 4768 | "Clear all members of peer-group\n" |
| 4769 | "BGP peer-group name\n" |
| 4770 | "Address family\n" |
| 4771 | "Address Family modifier\n" |
| 4772 | "Address Family modifier\n" |
| 4773 | "Soft reconfig\n" |
| 4774 | "Soft reconfig outbound update\n") |
| 4775 | { |
| 4776 | if (strncmp (argv[1], "m", 1) == 0) |
| 4777 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 4778 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4779 | |
| 4780 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4781 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4782 | } |
| 4783 | |
| 4784 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4785 | clear_ip_bgp_peer_group_ipv4_out_cmd, |
| 4786 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", |
| 4787 | CLEAR_STR |
| 4788 | IP_STR |
| 4789 | BGP_STR |
| 4790 | "Clear all members of peer-group\n" |
| 4791 | "BGP peer-group name\n" |
| 4792 | "Address family\n" |
| 4793 | "Address Family modifier\n" |
| 4794 | "Address Family modifier\n" |
| 4795 | "Soft reconfig outbound update\n") |
| 4796 | |
| 4797 | DEFUN (clear_bgp_peer_group_soft_out, |
| 4798 | clear_bgp_peer_group_soft_out_cmd, |
| 4799 | "clear bgp peer-group WORD soft out", |
| 4800 | CLEAR_STR |
| 4801 | BGP_STR |
| 4802 | "Clear all members of peer-group\n" |
| 4803 | "BGP peer-group name\n" |
| 4804 | "Soft reconfig\n" |
| 4805 | "Soft reconfig outbound update\n") |
| 4806 | { |
| 4807 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 4808 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4809 | } |
| 4810 | |
| 4811 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4812 | clear_bgp_ipv6_peer_group_soft_out_cmd, |
| 4813 | "clear bgp ipv6 peer-group WORD soft out", |
| 4814 | CLEAR_STR |
| 4815 | BGP_STR |
| 4816 | "Address family\n" |
| 4817 | "Clear all members of peer-group\n" |
| 4818 | "BGP peer-group name\n" |
| 4819 | "Soft reconfig\n" |
| 4820 | "Soft reconfig outbound update\n") |
| 4821 | |
| 4822 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4823 | clear_bgp_peer_group_out_cmd, |
| 4824 | "clear bgp peer-group WORD out", |
| 4825 | CLEAR_STR |
| 4826 | BGP_STR |
| 4827 | "Clear all members of peer-group\n" |
| 4828 | "BGP peer-group name\n" |
| 4829 | "Soft reconfig outbound update\n") |
| 4830 | |
| 4831 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4832 | clear_bgp_ipv6_peer_group_out_cmd, |
| 4833 | "clear bgp ipv6 peer-group WORD out", |
| 4834 | CLEAR_STR |
| 4835 | BGP_STR |
| 4836 | "Address family\n" |
| 4837 | "Clear all members of peer-group\n" |
| 4838 | "BGP peer-group name\n" |
| 4839 | "Soft reconfig outbound update\n") |
| 4840 | |
| 4841 | DEFUN (clear_ip_bgp_external_soft_out, |
| 4842 | clear_ip_bgp_external_soft_out_cmd, |
| 4843 | "clear ip bgp external soft out", |
| 4844 | CLEAR_STR |
| 4845 | IP_STR |
| 4846 | BGP_STR |
| 4847 | "Clear all external peers\n" |
| 4848 | "Soft reconfig\n" |
| 4849 | "Soft reconfig outbound update\n") |
| 4850 | { |
| 4851 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 4852 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4853 | } |
| 4854 | |
| 4855 | ALIAS (clear_ip_bgp_external_soft_out, |
| 4856 | clear_ip_bgp_external_out_cmd, |
| 4857 | "clear ip bgp external out", |
| 4858 | CLEAR_STR |
| 4859 | IP_STR |
| 4860 | BGP_STR |
| 4861 | "Clear all external peers\n" |
| 4862 | "Soft reconfig outbound update\n") |
| 4863 | |
| 4864 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, |
| 4865 | clear_ip_bgp_external_ipv4_soft_out_cmd, |
| 4866 | "clear ip bgp external ipv4 (unicast|multicast) soft out", |
| 4867 | CLEAR_STR |
| 4868 | IP_STR |
| 4869 | BGP_STR |
| 4870 | "Clear all external peers\n" |
| 4871 | "Address family\n" |
| 4872 | "Address Family modifier\n" |
| 4873 | "Address Family modifier\n" |
| 4874 | "Soft reconfig\n" |
| 4875 | "Soft reconfig outbound update\n") |
| 4876 | { |
| 4877 | if (strncmp (argv[0], "m", 1) == 0) |
| 4878 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 4879 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4880 | |
| 4881 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 4882 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4883 | } |
| 4884 | |
| 4885 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, |
| 4886 | clear_ip_bgp_external_ipv4_out_cmd, |
| 4887 | "clear ip bgp external ipv4 (unicast|multicast) out", |
| 4888 | CLEAR_STR |
| 4889 | IP_STR |
| 4890 | BGP_STR |
| 4891 | "Clear all external peers\n" |
| 4892 | "Address family\n" |
| 4893 | "Address Family modifier\n" |
| 4894 | "Address Family modifier\n" |
| 4895 | "Soft reconfig outbound update\n") |
| 4896 | |
| 4897 | DEFUN (clear_bgp_external_soft_out, |
| 4898 | clear_bgp_external_soft_out_cmd, |
| 4899 | "clear bgp external soft out", |
| 4900 | CLEAR_STR |
| 4901 | BGP_STR |
| 4902 | "Clear all external peers\n" |
| 4903 | "Soft reconfig\n" |
| 4904 | "Soft reconfig outbound update\n") |
| 4905 | { |
| 4906 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 4907 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4908 | } |
| 4909 | |
| 4910 | ALIAS (clear_bgp_external_soft_out, |
| 4911 | clear_bgp_ipv6_external_soft_out_cmd, |
| 4912 | "clear bgp ipv6 external soft out", |
| 4913 | CLEAR_STR |
| 4914 | BGP_STR |
| 4915 | "Address family\n" |
| 4916 | "Clear all external peers\n" |
| 4917 | "Soft reconfig\n" |
| 4918 | "Soft reconfig outbound update\n") |
| 4919 | |
| 4920 | ALIAS (clear_bgp_external_soft_out, |
| 4921 | clear_bgp_external_out_cmd, |
| 4922 | "clear bgp external out", |
| 4923 | CLEAR_STR |
| 4924 | BGP_STR |
| 4925 | "Clear all external peers\n" |
| 4926 | "Soft reconfig outbound update\n") |
| 4927 | |
| 4928 | ALIAS (clear_bgp_external_soft_out, |
| 4929 | clear_bgp_ipv6_external_out_cmd, |
| 4930 | "clear bgp ipv6 external WORD out", |
| 4931 | CLEAR_STR |
| 4932 | BGP_STR |
| 4933 | "Address family\n" |
| 4934 | "Clear all external peers\n" |
| 4935 | "Soft reconfig outbound update\n") |
| 4936 | |
| 4937 | DEFUN (clear_ip_bgp_as_soft_out, |
| 4938 | clear_ip_bgp_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4939 | "clear ip bgp " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4940 | CLEAR_STR |
| 4941 | IP_STR |
| 4942 | BGP_STR |
| 4943 | "Clear peers with the AS number\n" |
| 4944 | "Soft reconfig\n" |
| 4945 | "Soft reconfig outbound update\n") |
| 4946 | { |
| 4947 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 4948 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4949 | } |
| 4950 | |
| 4951 | ALIAS (clear_ip_bgp_as_soft_out, |
| 4952 | clear_ip_bgp_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4953 | "clear ip bgp " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4954 | CLEAR_STR |
| 4955 | IP_STR |
| 4956 | BGP_STR |
| 4957 | "Clear peers with the AS number\n" |
| 4958 | "Soft reconfig outbound update\n") |
| 4959 | |
| 4960 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
| 4961 | clear_ip_bgp_as_ipv4_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4962 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4963 | CLEAR_STR |
| 4964 | IP_STR |
| 4965 | BGP_STR |
| 4966 | "Clear peers with the AS number\n" |
| 4967 | "Address family\n" |
| 4968 | "Address Family modifier\n" |
| 4969 | "Address Family modifier\n" |
| 4970 | "Soft reconfig\n" |
| 4971 | "Soft reconfig outbound update\n") |
| 4972 | { |
| 4973 | if (strncmp (argv[1], "m", 1) == 0) |
| 4974 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 4975 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4976 | |
| 4977 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 4978 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4979 | } |
| 4980 | |
| 4981 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, |
| 4982 | clear_ip_bgp_as_ipv4_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4983 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4984 | CLEAR_STR |
| 4985 | IP_STR |
| 4986 | BGP_STR |
| 4987 | "Clear peers with the AS number\n" |
| 4988 | "Address family\n" |
| 4989 | "Address Family modifier\n" |
| 4990 | "Address Family modifier\n" |
| 4991 | "Soft reconfig outbound update\n") |
| 4992 | |
| 4993 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
| 4994 | clear_ip_bgp_as_vpnv4_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4995 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4996 | CLEAR_STR |
| 4997 | IP_STR |
| 4998 | BGP_STR |
| 4999 | "Clear peers with the AS number\n" |
| 5000 | "Address family\n" |
| 5001 | "Address Family modifier\n" |
| 5002 | "Soft reconfig\n" |
| 5003 | "Soft reconfig outbound update\n") |
| 5004 | { |
| 5005 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 5006 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5007 | } |
| 5008 | |
| 5009 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, |
| 5010 | clear_ip_bgp_as_vpnv4_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5011 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5012 | CLEAR_STR |
| 5013 | IP_STR |
| 5014 | BGP_STR |
| 5015 | "Clear peers with the AS number\n" |
| 5016 | "Address family\n" |
| 5017 | "Address Family modifier\n" |
| 5018 | "Soft reconfig outbound update\n") |
| 5019 | |
| 5020 | DEFUN (clear_bgp_as_soft_out, |
| 5021 | clear_bgp_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5022 | "clear bgp " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5023 | CLEAR_STR |
| 5024 | BGP_STR |
| 5025 | "Clear peers with the AS number\n" |
| 5026 | "Soft reconfig\n" |
| 5027 | "Soft reconfig outbound update\n") |
| 5028 | { |
| 5029 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5030 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5031 | } |
| 5032 | |
| 5033 | ALIAS (clear_bgp_as_soft_out, |
| 5034 | clear_bgp_ipv6_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5035 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5036 | CLEAR_STR |
| 5037 | BGP_STR |
| 5038 | "Address family\n" |
| 5039 | "Clear peers with the AS number\n" |
| 5040 | "Soft reconfig\n" |
| 5041 | "Soft reconfig outbound update\n") |
| 5042 | |
| 5043 | ALIAS (clear_bgp_as_soft_out, |
| 5044 | clear_bgp_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5045 | "clear bgp " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5046 | CLEAR_STR |
| 5047 | BGP_STR |
| 5048 | "Clear peers with the AS number\n" |
| 5049 | "Soft reconfig outbound update\n") |
| 5050 | |
| 5051 | ALIAS (clear_bgp_as_soft_out, |
| 5052 | clear_bgp_ipv6_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5053 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5054 | CLEAR_STR |
| 5055 | BGP_STR |
| 5056 | "Address family\n" |
| 5057 | "Clear peers with the AS number\n" |
| 5058 | "Soft reconfig outbound update\n") |
| 5059 | |
| 5060 | /* Inbound soft-reconfiguration */ |
| 5061 | DEFUN (clear_ip_bgp_all_soft_in, |
| 5062 | clear_ip_bgp_all_soft_in_cmd, |
| 5063 | "clear ip bgp * soft in", |
| 5064 | CLEAR_STR |
| 5065 | IP_STR |
| 5066 | BGP_STR |
| 5067 | "Clear all peers\n" |
| 5068 | "Soft reconfig\n" |
| 5069 | "Soft reconfig inbound update\n") |
| 5070 | { |
| 5071 | if (argc == 1) |
| 5072 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5073 | BGP_CLEAR_SOFT_IN, NULL); |
| 5074 | |
| 5075 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5076 | BGP_CLEAR_SOFT_IN, NULL); |
| 5077 | } |
| 5078 | |
| 5079 | ALIAS (clear_ip_bgp_all_soft_in, |
| 5080 | clear_ip_bgp_instance_all_soft_in_cmd, |
| 5081 | "clear ip bgp view WORD * soft in", |
| 5082 | CLEAR_STR |
| 5083 | IP_STR |
| 5084 | BGP_STR |
| 5085 | "BGP view\n" |
| 5086 | "view name\n" |
| 5087 | "Clear all peers\n" |
| 5088 | "Soft reconfig\n" |
| 5089 | "Soft reconfig inbound update\n") |
| 5090 | |
| 5091 | ALIAS (clear_ip_bgp_all_soft_in, |
| 5092 | clear_ip_bgp_all_in_cmd, |
| 5093 | "clear ip bgp * in", |
| 5094 | CLEAR_STR |
| 5095 | IP_STR |
| 5096 | BGP_STR |
| 5097 | "Clear all peers\n" |
| 5098 | "Soft reconfig inbound update\n") |
| 5099 | |
| 5100 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
| 5101 | clear_ip_bgp_all_in_prefix_filter_cmd, |
| 5102 | "clear ip bgp * in prefix-filter", |
| 5103 | CLEAR_STR |
| 5104 | IP_STR |
| 5105 | BGP_STR |
| 5106 | "Clear all peers\n" |
| 5107 | "Soft reconfig inbound update\n" |
| 5108 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5109 | { |
| 5110 | if (argc== 1) |
| 5111 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5112 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5113 | |
| 5114 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5115 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5116 | } |
| 5117 | |
| 5118 | ALIAS (clear_ip_bgp_all_in_prefix_filter, |
| 5119 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, |
| 5120 | "clear ip bgp view WORD * in prefix-filter", |
| 5121 | CLEAR_STR |
| 5122 | IP_STR |
| 5123 | BGP_STR |
| 5124 | "BGP view\n" |
| 5125 | "view name\n" |
| 5126 | "Clear all peers\n" |
| 5127 | "Soft reconfig inbound update\n" |
| 5128 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5129 | |
| 5130 | |
| 5131 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
| 5132 | clear_ip_bgp_all_ipv4_soft_in_cmd, |
| 5133 | "clear ip bgp * ipv4 (unicast|multicast) soft in", |
| 5134 | CLEAR_STR |
| 5135 | IP_STR |
| 5136 | BGP_STR |
| 5137 | "Clear all peers\n" |
| 5138 | "Address family\n" |
| 5139 | "Address Family modifier\n" |
| 5140 | "Address Family modifier\n" |
| 5141 | "Soft reconfig\n" |
| 5142 | "Soft reconfig inbound update\n") |
| 5143 | { |
| 5144 | if (strncmp (argv[0], "m", 1) == 0) |
| 5145 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5146 | BGP_CLEAR_SOFT_IN, NULL); |
| 5147 | |
| 5148 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5149 | BGP_CLEAR_SOFT_IN, NULL); |
| 5150 | } |
| 5151 | |
| 5152 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, |
| 5153 | clear_ip_bgp_all_ipv4_in_cmd, |
| 5154 | "clear ip bgp * ipv4 (unicast|multicast) in", |
| 5155 | CLEAR_STR |
| 5156 | IP_STR |
| 5157 | BGP_STR |
| 5158 | "Clear all peers\n" |
| 5159 | "Address family\n" |
| 5160 | "Address Family modifier\n" |
| 5161 | "Address Family modifier\n" |
| 5162 | "Soft reconfig inbound update\n") |
| 5163 | |
| 5164 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
| 5165 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, |
| 5166 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", |
| 5167 | CLEAR_STR |
| 5168 | IP_STR |
| 5169 | BGP_STR |
| 5170 | "BGP view\n" |
| 5171 | "view name\n" |
| 5172 | "Clear all peers\n" |
| 5173 | "Address family\n" |
| 5174 | "Address Family modifier\n" |
| 5175 | "Address Family modifier\n" |
| 5176 | "Soft reconfig\n" |
| 5177 | "Soft reconfig inbound update\n") |
| 5178 | { |
| 5179 | if (strncmp (argv[1], "m", 1) == 0) |
| 5180 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5181 | BGP_CLEAR_SOFT_IN, NULL); |
| 5182 | |
| 5183 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5184 | BGP_CLEAR_SOFT_IN, NULL); |
| 5185 | } |
| 5186 | |
| 5187 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
| 5188 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, |
| 5189 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", |
| 5190 | CLEAR_STR |
| 5191 | IP_STR |
| 5192 | BGP_STR |
| 5193 | "Clear all peers\n" |
| 5194 | "Address family\n" |
| 5195 | "Address Family modifier\n" |
| 5196 | "Address Family modifier\n" |
| 5197 | "Soft reconfig inbound update\n" |
| 5198 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5199 | { |
| 5200 | if (strncmp (argv[0], "m", 1) == 0) |
| 5201 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5202 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5203 | |
| 5204 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5205 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5206 | } |
| 5207 | |
| 5208 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, |
| 5209 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, |
| 5210 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", |
| 5211 | CLEAR_STR |
| 5212 | IP_STR |
| 5213 | BGP_STR |
| 5214 | "Clear all peers\n" |
| 5215 | "Address family\n" |
| 5216 | "Address Family modifier\n" |
| 5217 | "Address Family modifier\n" |
| 5218 | "Soft reconfig inbound update\n" |
| 5219 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5220 | { |
| 5221 | if (strncmp (argv[1], "m", 1) == 0) |
| 5222 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5223 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5224 | |
| 5225 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5226 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5227 | } |
| 5228 | |
| 5229 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, |
| 5230 | clear_ip_bgp_all_vpnv4_soft_in_cmd, |
| 5231 | "clear ip bgp * vpnv4 unicast soft in", |
| 5232 | CLEAR_STR |
| 5233 | IP_STR |
| 5234 | BGP_STR |
| 5235 | "Clear all peers\n" |
| 5236 | "Address family\n" |
| 5237 | "Address Family Modifier\n" |
| 5238 | "Soft reconfig\n" |
| 5239 | "Soft reconfig inbound update\n") |
| 5240 | { |
| 5241 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 5242 | BGP_CLEAR_SOFT_IN, NULL); |
| 5243 | } |
| 5244 | |
| 5245 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, |
| 5246 | clear_ip_bgp_all_vpnv4_in_cmd, |
| 5247 | "clear ip bgp * vpnv4 unicast in", |
| 5248 | CLEAR_STR |
| 5249 | IP_STR |
| 5250 | BGP_STR |
| 5251 | "Clear all peers\n" |
| 5252 | "Address family\n" |
| 5253 | "Address Family Modifier\n" |
| 5254 | "Soft reconfig inbound update\n") |
| 5255 | |
| 5256 | DEFUN (clear_bgp_all_soft_in, |
| 5257 | clear_bgp_all_soft_in_cmd, |
| 5258 | "clear bgp * soft in", |
| 5259 | CLEAR_STR |
| 5260 | BGP_STR |
| 5261 | "Clear all peers\n" |
| 5262 | "Soft reconfig\n" |
| 5263 | "Soft reconfig inbound update\n") |
| 5264 | { |
| 5265 | if (argc == 1) |
| 5266 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 5267 | BGP_CLEAR_SOFT_IN, NULL); |
| 5268 | |
| 5269 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5270 | BGP_CLEAR_SOFT_IN, NULL); |
| 5271 | } |
| 5272 | |
| 5273 | ALIAS (clear_bgp_all_soft_in, |
| 5274 | clear_bgp_instance_all_soft_in_cmd, |
| 5275 | "clear bgp view WORD * soft in", |
| 5276 | CLEAR_STR |
| 5277 | BGP_STR |
| 5278 | "BGP view\n" |
| 5279 | "view name\n" |
| 5280 | "Clear all peers\n" |
| 5281 | "Soft reconfig\n" |
| 5282 | "Soft reconfig inbound update\n") |
| 5283 | |
| 5284 | ALIAS (clear_bgp_all_soft_in, |
| 5285 | clear_bgp_ipv6_all_soft_in_cmd, |
| 5286 | "clear bgp ipv6 * soft in", |
| 5287 | CLEAR_STR |
| 5288 | BGP_STR |
| 5289 | "Address family\n" |
| 5290 | "Clear all peers\n" |
| 5291 | "Soft reconfig\n" |
| 5292 | "Soft reconfig inbound update\n") |
| 5293 | |
| 5294 | ALIAS (clear_bgp_all_soft_in, |
| 5295 | clear_bgp_all_in_cmd, |
| 5296 | "clear bgp * in", |
| 5297 | CLEAR_STR |
| 5298 | BGP_STR |
| 5299 | "Clear all peers\n" |
| 5300 | "Soft reconfig inbound update\n") |
| 5301 | |
| 5302 | ALIAS (clear_bgp_all_soft_in, |
| 5303 | clear_bgp_ipv6_all_in_cmd, |
| 5304 | "clear bgp ipv6 * in", |
| 5305 | CLEAR_STR |
| 5306 | BGP_STR |
| 5307 | "Address family\n" |
| 5308 | "Clear all peers\n" |
| 5309 | "Soft reconfig inbound update\n") |
| 5310 | |
| 5311 | DEFUN (clear_bgp_all_in_prefix_filter, |
| 5312 | clear_bgp_all_in_prefix_filter_cmd, |
| 5313 | "clear bgp * in prefix-filter", |
| 5314 | CLEAR_STR |
| 5315 | BGP_STR |
| 5316 | "Clear all peers\n" |
| 5317 | "Soft reconfig inbound update\n" |
| 5318 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5319 | { |
| 5320 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5321 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5322 | } |
| 5323 | |
| 5324 | ALIAS (clear_bgp_all_in_prefix_filter, |
| 5325 | clear_bgp_ipv6_all_in_prefix_filter_cmd, |
| 5326 | "clear bgp ipv6 * in prefix-filter", |
| 5327 | CLEAR_STR |
| 5328 | BGP_STR |
| 5329 | "Address family\n" |
| 5330 | "Clear all peers\n" |
| 5331 | "Soft reconfig inbound update\n" |
| 5332 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5333 | |
| 5334 | DEFUN (clear_ip_bgp_peer_soft_in, |
| 5335 | clear_ip_bgp_peer_soft_in_cmd, |
| 5336 | "clear ip bgp A.B.C.D soft in", |
| 5337 | CLEAR_STR |
| 5338 | IP_STR |
| 5339 | BGP_STR |
| 5340 | "BGP neighbor address to clear\n" |
| 5341 | "Soft reconfig\n" |
| 5342 | "Soft reconfig inbound update\n") |
| 5343 | { |
| 5344 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5345 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5346 | } |
| 5347 | |
| 5348 | ALIAS (clear_ip_bgp_peer_soft_in, |
| 5349 | clear_ip_bgp_peer_in_cmd, |
| 5350 | "clear ip bgp A.B.C.D in", |
| 5351 | CLEAR_STR |
| 5352 | IP_STR |
| 5353 | BGP_STR |
| 5354 | "BGP neighbor address to clear\n" |
| 5355 | "Soft reconfig inbound update\n") |
| 5356 | |
| 5357 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
| 5358 | clear_ip_bgp_peer_in_prefix_filter_cmd, |
| 5359 | "clear ip bgp A.B.C.D in prefix-filter", |
| 5360 | CLEAR_STR |
| 5361 | IP_STR |
| 5362 | BGP_STR |
| 5363 | "BGP neighbor address to clear\n" |
| 5364 | "Soft reconfig inbound update\n" |
| 5365 | "Push out the existing ORF prefix-list\n") |
| 5366 | { |
| 5367 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5368 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5369 | } |
| 5370 | |
| 5371 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, |
| 5372 | clear_ip_bgp_peer_ipv4_soft_in_cmd, |
| 5373 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", |
| 5374 | CLEAR_STR |
| 5375 | IP_STR |
| 5376 | BGP_STR |
| 5377 | "BGP neighbor address to clear\n" |
| 5378 | "Address family\n" |
| 5379 | "Address Family modifier\n" |
| 5380 | "Address Family modifier\n" |
| 5381 | "Soft reconfig\n" |
| 5382 | "Soft reconfig inbound update\n") |
| 5383 | { |
| 5384 | if (strncmp (argv[1], "m", 1) == 0) |
| 5385 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5386 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5387 | |
| 5388 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5389 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5390 | } |
| 5391 | |
| 5392 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, |
| 5393 | clear_ip_bgp_peer_ipv4_in_cmd, |
| 5394 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", |
| 5395 | CLEAR_STR |
| 5396 | IP_STR |
| 5397 | BGP_STR |
| 5398 | "BGP neighbor address to clear\n" |
| 5399 | "Address family\n" |
| 5400 | "Address Family modifier\n" |
| 5401 | "Address Family modifier\n" |
| 5402 | "Soft reconfig inbound update\n") |
| 5403 | |
| 5404 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
| 5405 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, |
| 5406 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", |
| 5407 | CLEAR_STR |
| 5408 | IP_STR |
| 5409 | BGP_STR |
| 5410 | "BGP neighbor address to clear\n" |
| 5411 | "Address family\n" |
| 5412 | "Address Family modifier\n" |
| 5413 | "Address Family modifier\n" |
| 5414 | "Soft reconfig inbound update\n" |
| 5415 | "Push out the existing ORF prefix-list\n") |
| 5416 | { |
| 5417 | if (strncmp (argv[1], "m", 1) == 0) |
| 5418 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5419 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5420 | |
| 5421 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5422 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5423 | } |
| 5424 | |
| 5425 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5426 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, |
| 5427 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", |
| 5428 | CLEAR_STR |
| 5429 | IP_STR |
| 5430 | BGP_STR |
| 5431 | "BGP neighbor address to clear\n" |
| 5432 | "Address family\n" |
| 5433 | "Address Family Modifier\n" |
| 5434 | "Soft reconfig\n" |
| 5435 | "Soft reconfig inbound update\n") |
| 5436 | { |
| 5437 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 5438 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5439 | } |
| 5440 | |
| 5441 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5442 | clear_ip_bgp_peer_vpnv4_in_cmd, |
| 5443 | "clear ip bgp A.B.C.D vpnv4 unicast in", |
| 5444 | CLEAR_STR |
| 5445 | IP_STR |
| 5446 | BGP_STR |
| 5447 | "BGP neighbor address to clear\n" |
| 5448 | "Address family\n" |
| 5449 | "Address Family Modifier\n" |
| 5450 | "Soft reconfig inbound update\n") |
| 5451 | |
| 5452 | DEFUN (clear_bgp_peer_soft_in, |
| 5453 | clear_bgp_peer_soft_in_cmd, |
| 5454 | "clear bgp (A.B.C.D|X:X::X:X) soft in", |
| 5455 | CLEAR_STR |
| 5456 | BGP_STR |
| 5457 | "BGP neighbor address to clear\n" |
| 5458 | "BGP IPv6 neighbor to clear\n" |
| 5459 | "Soft reconfig\n" |
| 5460 | "Soft reconfig inbound update\n") |
| 5461 | { |
| 5462 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5463 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5464 | } |
| 5465 | |
| 5466 | ALIAS (clear_bgp_peer_soft_in, |
| 5467 | clear_bgp_ipv6_peer_soft_in_cmd, |
| 5468 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in", |
| 5469 | CLEAR_STR |
| 5470 | BGP_STR |
| 5471 | "Address family\n" |
| 5472 | "BGP neighbor address to clear\n" |
| 5473 | "BGP IPv6 neighbor to clear\n" |
| 5474 | "Soft reconfig\n" |
| 5475 | "Soft reconfig inbound update\n") |
| 5476 | |
| 5477 | ALIAS (clear_bgp_peer_soft_in, |
| 5478 | clear_bgp_peer_in_cmd, |
| 5479 | "clear bgp (A.B.C.D|X:X::X:X) in", |
| 5480 | CLEAR_STR |
| 5481 | BGP_STR |
| 5482 | "BGP neighbor address to clear\n" |
| 5483 | "BGP IPv6 neighbor to clear\n" |
| 5484 | "Soft reconfig inbound update\n") |
| 5485 | |
| 5486 | ALIAS (clear_bgp_peer_soft_in, |
| 5487 | clear_bgp_ipv6_peer_in_cmd, |
| 5488 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in", |
| 5489 | CLEAR_STR |
| 5490 | BGP_STR |
| 5491 | "Address family\n" |
| 5492 | "BGP neighbor address to clear\n" |
| 5493 | "BGP IPv6 neighbor to clear\n" |
| 5494 | "Soft reconfig inbound update\n") |
| 5495 | |
| 5496 | DEFUN (clear_bgp_peer_in_prefix_filter, |
| 5497 | clear_bgp_peer_in_prefix_filter_cmd, |
| 5498 | "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5499 | CLEAR_STR |
| 5500 | BGP_STR |
| 5501 | "BGP neighbor address to clear\n" |
| 5502 | "BGP IPv6 neighbor to clear\n" |
| 5503 | "Soft reconfig inbound update\n" |
| 5504 | "Push out the existing ORF prefix-list\n") |
| 5505 | { |
| 5506 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5507 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5508 | } |
| 5509 | |
| 5510 | ALIAS (clear_bgp_peer_in_prefix_filter, |
| 5511 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, |
| 5512 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5513 | CLEAR_STR |
| 5514 | BGP_STR |
| 5515 | "Address family\n" |
| 5516 | "BGP neighbor address to clear\n" |
| 5517 | "BGP IPv6 neighbor to clear\n" |
| 5518 | "Soft reconfig inbound update\n" |
| 5519 | "Push out the existing ORF prefix-list\n") |
| 5520 | |
| 5521 | DEFUN (clear_ip_bgp_peer_group_soft_in, |
| 5522 | clear_ip_bgp_peer_group_soft_in_cmd, |
| 5523 | "clear ip bgp peer-group WORD soft in", |
| 5524 | CLEAR_STR |
| 5525 | IP_STR |
| 5526 | BGP_STR |
| 5527 | "Clear all members of peer-group\n" |
| 5528 | "BGP peer-group name\n" |
| 5529 | "Soft reconfig\n" |
| 5530 | "Soft reconfig inbound update\n") |
| 5531 | { |
| 5532 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5533 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5534 | } |
| 5535 | |
| 5536 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
| 5537 | clear_ip_bgp_peer_group_in_cmd, |
| 5538 | "clear ip bgp peer-group WORD in", |
| 5539 | CLEAR_STR |
| 5540 | IP_STR |
| 5541 | BGP_STR |
| 5542 | "Clear all members of peer-group\n" |
| 5543 | "BGP peer-group name\n" |
| 5544 | "Soft reconfig inbound update\n") |
| 5545 | |
| 5546 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
| 5547 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, |
| 5548 | "clear ip bgp peer-group WORD in prefix-filter", |
| 5549 | CLEAR_STR |
| 5550 | IP_STR |
| 5551 | BGP_STR |
| 5552 | "Clear all members of peer-group\n" |
| 5553 | "BGP peer-group name\n" |
| 5554 | "Soft reconfig inbound update\n" |
| 5555 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5556 | { |
| 5557 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5558 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5559 | } |
| 5560 | |
| 5561 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5562 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, |
| 5563 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", |
| 5564 | CLEAR_STR |
| 5565 | IP_STR |
| 5566 | BGP_STR |
| 5567 | "Clear all members of peer-group\n" |
| 5568 | "BGP peer-group name\n" |
| 5569 | "Address family\n" |
| 5570 | "Address Family modifier\n" |
| 5571 | "Address Family modifier\n" |
| 5572 | "Soft reconfig\n" |
| 5573 | "Soft reconfig inbound update\n") |
| 5574 | { |
| 5575 | if (strncmp (argv[1], "m", 1) == 0) |
| 5576 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5577 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5578 | |
| 5579 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5580 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5581 | } |
| 5582 | |
| 5583 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5584 | clear_ip_bgp_peer_group_ipv4_in_cmd, |
| 5585 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", |
| 5586 | CLEAR_STR |
| 5587 | IP_STR |
| 5588 | BGP_STR |
| 5589 | "Clear all members of peer-group\n" |
| 5590 | "BGP peer-group name\n" |
| 5591 | "Address family\n" |
| 5592 | "Address Family modifier\n" |
| 5593 | "Address Family modifier\n" |
| 5594 | "Soft reconfig inbound update\n") |
| 5595 | |
| 5596 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
| 5597 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, |
| 5598 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", |
| 5599 | CLEAR_STR |
| 5600 | IP_STR |
| 5601 | BGP_STR |
| 5602 | "Clear all members of peer-group\n" |
| 5603 | "BGP peer-group name\n" |
| 5604 | "Address family\n" |
| 5605 | "Address Family modifier\n" |
| 5606 | "Address Family modifier\n" |
| 5607 | "Soft reconfig inbound update\n" |
| 5608 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5609 | { |
| 5610 | if (strncmp (argv[1], "m", 1) == 0) |
| 5611 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5612 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5613 | |
| 5614 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5615 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5616 | } |
| 5617 | |
| 5618 | DEFUN (clear_bgp_peer_group_soft_in, |
| 5619 | clear_bgp_peer_group_soft_in_cmd, |
| 5620 | "clear bgp peer-group WORD soft in", |
| 5621 | CLEAR_STR |
| 5622 | BGP_STR |
| 5623 | "Clear all members of peer-group\n" |
| 5624 | "BGP peer-group name\n" |
| 5625 | "Soft reconfig\n" |
| 5626 | "Soft reconfig inbound update\n") |
| 5627 | { |
| 5628 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5629 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5630 | } |
| 5631 | |
| 5632 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5633 | clear_bgp_ipv6_peer_group_soft_in_cmd, |
| 5634 | "clear bgp ipv6 peer-group WORD soft in", |
| 5635 | CLEAR_STR |
| 5636 | BGP_STR |
| 5637 | "Address family\n" |
| 5638 | "Clear all members of peer-group\n" |
| 5639 | "BGP peer-group name\n" |
| 5640 | "Soft reconfig\n" |
| 5641 | "Soft reconfig inbound update\n") |
| 5642 | |
| 5643 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5644 | clear_bgp_peer_group_in_cmd, |
| 5645 | "clear bgp peer-group WORD in", |
| 5646 | CLEAR_STR |
| 5647 | BGP_STR |
| 5648 | "Clear all members of peer-group\n" |
| 5649 | "BGP peer-group name\n" |
| 5650 | "Soft reconfig inbound update\n") |
| 5651 | |
| 5652 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5653 | clear_bgp_ipv6_peer_group_in_cmd, |
| 5654 | "clear bgp ipv6 peer-group WORD in", |
| 5655 | CLEAR_STR |
| 5656 | BGP_STR |
| 5657 | "Address family\n" |
| 5658 | "Clear all members of peer-group\n" |
| 5659 | "BGP peer-group name\n" |
| 5660 | "Soft reconfig inbound update\n") |
| 5661 | |
| 5662 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
| 5663 | clear_bgp_peer_group_in_prefix_filter_cmd, |
| 5664 | "clear bgp peer-group WORD in prefix-filter", |
| 5665 | CLEAR_STR |
| 5666 | BGP_STR |
| 5667 | "Clear all members of peer-group\n" |
| 5668 | "BGP peer-group name\n" |
| 5669 | "Soft reconfig inbound update\n" |
| 5670 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5671 | { |
| 5672 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5673 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5674 | } |
| 5675 | |
| 5676 | ALIAS (clear_bgp_peer_group_in_prefix_filter, |
| 5677 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, |
| 5678 | "clear bgp ipv6 peer-group WORD in prefix-filter", |
| 5679 | CLEAR_STR |
| 5680 | BGP_STR |
| 5681 | "Address family\n" |
| 5682 | "Clear all members of peer-group\n" |
| 5683 | "BGP peer-group name\n" |
| 5684 | "Soft reconfig inbound update\n" |
| 5685 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5686 | |
| 5687 | DEFUN (clear_ip_bgp_external_soft_in, |
| 5688 | clear_ip_bgp_external_soft_in_cmd, |
| 5689 | "clear ip bgp external soft in", |
| 5690 | CLEAR_STR |
| 5691 | IP_STR |
| 5692 | BGP_STR |
| 5693 | "Clear all external peers\n" |
| 5694 | "Soft reconfig\n" |
| 5695 | "Soft reconfig inbound update\n") |
| 5696 | { |
| 5697 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5698 | BGP_CLEAR_SOFT_IN, NULL); |
| 5699 | } |
| 5700 | |
| 5701 | ALIAS (clear_ip_bgp_external_soft_in, |
| 5702 | clear_ip_bgp_external_in_cmd, |
| 5703 | "clear ip bgp external in", |
| 5704 | CLEAR_STR |
| 5705 | IP_STR |
| 5706 | BGP_STR |
| 5707 | "Clear all external peers\n" |
| 5708 | "Soft reconfig inbound update\n") |
| 5709 | |
| 5710 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
| 5711 | clear_ip_bgp_external_in_prefix_filter_cmd, |
| 5712 | "clear ip bgp external in prefix-filter", |
| 5713 | CLEAR_STR |
| 5714 | IP_STR |
| 5715 | BGP_STR |
| 5716 | "Clear all external peers\n" |
| 5717 | "Soft reconfig inbound update\n" |
| 5718 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5719 | { |
| 5720 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5721 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5722 | } |
| 5723 | |
| 5724 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, |
| 5725 | clear_ip_bgp_external_ipv4_soft_in_cmd, |
| 5726 | "clear ip bgp external ipv4 (unicast|multicast) soft in", |
| 5727 | CLEAR_STR |
| 5728 | IP_STR |
| 5729 | BGP_STR |
| 5730 | "Clear all external peers\n" |
| 5731 | "Address family\n" |
| 5732 | "Address Family modifier\n" |
| 5733 | "Address Family modifier\n" |
| 5734 | "Soft reconfig\n" |
| 5735 | "Soft reconfig inbound update\n") |
| 5736 | { |
| 5737 | if (strncmp (argv[0], "m", 1) == 0) |
| 5738 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5739 | BGP_CLEAR_SOFT_IN, NULL); |
| 5740 | |
| 5741 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5742 | BGP_CLEAR_SOFT_IN, NULL); |
| 5743 | } |
| 5744 | |
| 5745 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, |
| 5746 | clear_ip_bgp_external_ipv4_in_cmd, |
| 5747 | "clear ip bgp external ipv4 (unicast|multicast) in", |
| 5748 | CLEAR_STR |
| 5749 | IP_STR |
| 5750 | BGP_STR |
| 5751 | "Clear all external peers\n" |
| 5752 | "Address family\n" |
| 5753 | "Address Family modifier\n" |
| 5754 | "Address Family modifier\n" |
| 5755 | "Soft reconfig inbound update\n") |
| 5756 | |
| 5757 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
| 5758 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, |
| 5759 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", |
| 5760 | CLEAR_STR |
| 5761 | IP_STR |
| 5762 | BGP_STR |
| 5763 | "Clear all external peers\n" |
| 5764 | "Address family\n" |
| 5765 | "Address Family modifier\n" |
| 5766 | "Address Family modifier\n" |
| 5767 | "Soft reconfig inbound update\n" |
| 5768 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5769 | { |
| 5770 | if (strncmp (argv[0], "m", 1) == 0) |
| 5771 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5772 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5773 | |
| 5774 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5775 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5776 | } |
| 5777 | |
| 5778 | DEFUN (clear_bgp_external_soft_in, |
| 5779 | clear_bgp_external_soft_in_cmd, |
| 5780 | "clear bgp external soft in", |
| 5781 | CLEAR_STR |
| 5782 | BGP_STR |
| 5783 | "Clear all external peers\n" |
| 5784 | "Soft reconfig\n" |
| 5785 | "Soft reconfig inbound update\n") |
| 5786 | { |
| 5787 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5788 | BGP_CLEAR_SOFT_IN, NULL); |
| 5789 | } |
| 5790 | |
| 5791 | ALIAS (clear_bgp_external_soft_in, |
| 5792 | clear_bgp_ipv6_external_soft_in_cmd, |
| 5793 | "clear bgp ipv6 external soft in", |
| 5794 | CLEAR_STR |
| 5795 | BGP_STR |
| 5796 | "Address family\n" |
| 5797 | "Clear all external peers\n" |
| 5798 | "Soft reconfig\n" |
| 5799 | "Soft reconfig inbound update\n") |
| 5800 | |
| 5801 | ALIAS (clear_bgp_external_soft_in, |
| 5802 | clear_bgp_external_in_cmd, |
| 5803 | "clear bgp external in", |
| 5804 | CLEAR_STR |
| 5805 | BGP_STR |
| 5806 | "Clear all external peers\n" |
| 5807 | "Soft reconfig inbound update\n") |
| 5808 | |
| 5809 | ALIAS (clear_bgp_external_soft_in, |
| 5810 | clear_bgp_ipv6_external_in_cmd, |
| 5811 | "clear bgp ipv6 external WORD in", |
| 5812 | CLEAR_STR |
| 5813 | BGP_STR |
| 5814 | "Address family\n" |
| 5815 | "Clear all external peers\n" |
| 5816 | "Soft reconfig inbound update\n") |
| 5817 | |
| 5818 | DEFUN (clear_bgp_external_in_prefix_filter, |
| 5819 | clear_bgp_external_in_prefix_filter_cmd, |
| 5820 | "clear bgp external in prefix-filter", |
| 5821 | CLEAR_STR |
| 5822 | BGP_STR |
| 5823 | "Clear all external peers\n" |
| 5824 | "Soft reconfig inbound update\n" |
| 5825 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5826 | { |
| 5827 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5828 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5829 | } |
| 5830 | |
| 5831 | ALIAS (clear_bgp_external_in_prefix_filter, |
| 5832 | clear_bgp_ipv6_external_in_prefix_filter_cmd, |
| 5833 | "clear bgp ipv6 external in prefix-filter", |
| 5834 | CLEAR_STR |
| 5835 | BGP_STR |
| 5836 | "Address family\n" |
| 5837 | "Clear all external peers\n" |
| 5838 | "Soft reconfig inbound update\n" |
| 5839 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5840 | |
| 5841 | DEFUN (clear_ip_bgp_as_soft_in, |
| 5842 | clear_ip_bgp_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5843 | "clear ip bgp " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5844 | CLEAR_STR |
| 5845 | IP_STR |
| 5846 | BGP_STR |
| 5847 | "Clear peers with the AS number\n" |
| 5848 | "Soft reconfig\n" |
| 5849 | "Soft reconfig inbound update\n") |
| 5850 | { |
| 5851 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5852 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5853 | } |
| 5854 | |
| 5855 | ALIAS (clear_ip_bgp_as_soft_in, |
| 5856 | clear_ip_bgp_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5857 | "clear ip bgp " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5858 | CLEAR_STR |
| 5859 | IP_STR |
| 5860 | BGP_STR |
| 5861 | "Clear peers with the AS number\n" |
| 5862 | "Soft reconfig inbound update\n") |
| 5863 | |
| 5864 | DEFUN (clear_ip_bgp_as_in_prefix_filter, |
| 5865 | clear_ip_bgp_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5866 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5867 | CLEAR_STR |
| 5868 | IP_STR |
| 5869 | BGP_STR |
| 5870 | "Clear peers with the AS number\n" |
| 5871 | "Soft reconfig inbound update\n" |
| 5872 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5873 | { |
| 5874 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5875 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5876 | } |
| 5877 | |
| 5878 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, |
| 5879 | clear_ip_bgp_as_ipv4_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5880 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5881 | CLEAR_STR |
| 5882 | IP_STR |
| 5883 | BGP_STR |
| 5884 | "Clear peers with the AS number\n" |
| 5885 | "Address family\n" |
| 5886 | "Address Family modifier\n" |
| 5887 | "Address Family modifier\n" |
| 5888 | "Soft reconfig\n" |
| 5889 | "Soft reconfig inbound update\n") |
| 5890 | { |
| 5891 | if (strncmp (argv[1], "m", 1) == 0) |
| 5892 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5893 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5894 | |
| 5895 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5896 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5897 | } |
| 5898 | |
| 5899 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, |
| 5900 | clear_ip_bgp_as_ipv4_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5901 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5902 | CLEAR_STR |
| 5903 | IP_STR |
| 5904 | BGP_STR |
| 5905 | "Clear peers with the AS number\n" |
| 5906 | "Address family\n" |
| 5907 | "Address Family modifier\n" |
| 5908 | "Address Family modifier\n" |
| 5909 | "Soft reconfig inbound update\n") |
| 5910 | |
| 5911 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
| 5912 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5913 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5914 | CLEAR_STR |
| 5915 | IP_STR |
| 5916 | BGP_STR |
| 5917 | "Clear peers with the AS number\n" |
| 5918 | "Address family\n" |
| 5919 | "Address Family modifier\n" |
| 5920 | "Address Family modifier\n" |
| 5921 | "Soft reconfig inbound update\n" |
| 5922 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5923 | { |
| 5924 | if (strncmp (argv[1], "m", 1) == 0) |
| 5925 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5926 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5927 | |
| 5928 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5929 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5930 | } |
| 5931 | |
| 5932 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, |
| 5933 | clear_ip_bgp_as_vpnv4_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5934 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5935 | CLEAR_STR |
| 5936 | IP_STR |
| 5937 | BGP_STR |
| 5938 | "Clear peers with the AS number\n" |
| 5939 | "Address family\n" |
| 5940 | "Address Family modifier\n" |
| 5941 | "Soft reconfig\n" |
| 5942 | "Soft reconfig inbound update\n") |
| 5943 | { |
| 5944 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 5945 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5946 | } |
| 5947 | |
| 5948 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, |
| 5949 | clear_ip_bgp_as_vpnv4_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5950 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5951 | CLEAR_STR |
| 5952 | IP_STR |
| 5953 | BGP_STR |
| 5954 | "Clear peers with the AS number\n" |
| 5955 | "Address family\n" |
| 5956 | "Address Family modifier\n" |
| 5957 | "Soft reconfig inbound update\n") |
| 5958 | |
| 5959 | DEFUN (clear_bgp_as_soft_in, |
| 5960 | clear_bgp_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5961 | "clear bgp " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5962 | CLEAR_STR |
| 5963 | BGP_STR |
| 5964 | "Clear peers with the AS number\n" |
| 5965 | "Soft reconfig\n" |
| 5966 | "Soft reconfig inbound update\n") |
| 5967 | { |
| 5968 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5969 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5970 | } |
| 5971 | |
| 5972 | ALIAS (clear_bgp_as_soft_in, |
| 5973 | clear_bgp_ipv6_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5974 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5975 | CLEAR_STR |
| 5976 | BGP_STR |
| 5977 | "Address family\n" |
| 5978 | "Clear peers with the AS number\n" |
| 5979 | "Soft reconfig\n" |
| 5980 | "Soft reconfig inbound update\n") |
| 5981 | |
| 5982 | ALIAS (clear_bgp_as_soft_in, |
| 5983 | clear_bgp_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5984 | "clear bgp " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5985 | CLEAR_STR |
| 5986 | BGP_STR |
| 5987 | "Clear peers with the AS number\n" |
| 5988 | "Soft reconfig inbound update\n") |
| 5989 | |
| 5990 | ALIAS (clear_bgp_as_soft_in, |
| 5991 | clear_bgp_ipv6_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5992 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5993 | CLEAR_STR |
| 5994 | BGP_STR |
| 5995 | "Address family\n" |
| 5996 | "Clear peers with the AS number\n" |
| 5997 | "Soft reconfig inbound update\n") |
| 5998 | |
| 5999 | DEFUN (clear_bgp_as_in_prefix_filter, |
| 6000 | clear_bgp_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6001 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6002 | CLEAR_STR |
| 6003 | BGP_STR |
| 6004 | "Clear peers with the AS number\n" |
| 6005 | "Soft reconfig inbound update\n" |
| 6006 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6007 | { |
| 6008 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6009 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 6010 | } |
| 6011 | |
| 6012 | ALIAS (clear_bgp_as_in_prefix_filter, |
| 6013 | clear_bgp_ipv6_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6014 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6015 | CLEAR_STR |
| 6016 | BGP_STR |
| 6017 | "Address family\n" |
| 6018 | "Clear peers with the AS number\n" |
| 6019 | "Soft reconfig inbound update\n" |
| 6020 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 6021 | |
| 6022 | /* Both soft-reconfiguration */ |
| 6023 | DEFUN (clear_ip_bgp_all_soft, |
| 6024 | clear_ip_bgp_all_soft_cmd, |
| 6025 | "clear ip bgp * soft", |
| 6026 | CLEAR_STR |
| 6027 | IP_STR |
| 6028 | BGP_STR |
| 6029 | "Clear all peers\n" |
| 6030 | "Soft reconfig\n") |
| 6031 | { |
| 6032 | if (argc == 1) |
| 6033 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6034 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6035 | |
| 6036 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6037 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6038 | } |
| 6039 | |
| 6040 | ALIAS (clear_ip_bgp_all_soft, |
| 6041 | clear_ip_bgp_instance_all_soft_cmd, |
| 6042 | "clear ip bgp view WORD * soft", |
| 6043 | CLEAR_STR |
| 6044 | IP_STR |
| 6045 | BGP_STR |
| 6046 | "BGP view\n" |
| 6047 | "view name\n" |
| 6048 | "Clear all peers\n" |
| 6049 | "Soft reconfig\n") |
| 6050 | |
| 6051 | |
| 6052 | DEFUN (clear_ip_bgp_all_ipv4_soft, |
| 6053 | clear_ip_bgp_all_ipv4_soft_cmd, |
| 6054 | "clear ip bgp * ipv4 (unicast|multicast) soft", |
| 6055 | CLEAR_STR |
| 6056 | IP_STR |
| 6057 | BGP_STR |
| 6058 | "Clear all peers\n" |
| 6059 | "Address family\n" |
| 6060 | "Address Family Modifier\n" |
| 6061 | "Address Family Modifier\n" |
| 6062 | "Soft reconfig\n") |
| 6063 | { |
| 6064 | if (strncmp (argv[0], "m", 1) == 0) |
| 6065 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 6066 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6067 | |
| 6068 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6069 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6070 | } |
| 6071 | |
| 6072 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, |
| 6073 | clear_ip_bgp_instance_all_ipv4_soft_cmd, |
| 6074 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", |
| 6075 | CLEAR_STR |
| 6076 | IP_STR |
| 6077 | BGP_STR |
| 6078 | "BGP view\n" |
| 6079 | "view name\n" |
| 6080 | "Clear all peers\n" |
| 6081 | "Address family\n" |
| 6082 | "Address Family Modifier\n" |
| 6083 | "Address Family Modifier\n" |
| 6084 | "Soft reconfig\n") |
| 6085 | { |
| 6086 | if (strncmp (argv[1], "m", 1) == 0) |
| 6087 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 6088 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6089 | |
| 6090 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6091 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6092 | } |
| 6093 | |
| 6094 | DEFUN (clear_ip_bgp_all_vpnv4_soft, |
| 6095 | clear_ip_bgp_all_vpnv4_soft_cmd, |
| 6096 | "clear ip bgp * vpnv4 unicast soft", |
| 6097 | CLEAR_STR |
| 6098 | IP_STR |
| 6099 | BGP_STR |
| 6100 | "Clear all peers\n" |
| 6101 | "Address family\n" |
| 6102 | "Address Family Modifier\n" |
| 6103 | "Soft reconfig\n") |
| 6104 | { |
| 6105 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 6106 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6107 | } |
| 6108 | |
| 6109 | DEFUN (clear_bgp_all_soft, |
| 6110 | clear_bgp_all_soft_cmd, |
| 6111 | "clear bgp * soft", |
| 6112 | CLEAR_STR |
| 6113 | BGP_STR |
| 6114 | "Clear all peers\n" |
| 6115 | "Soft reconfig\n") |
| 6116 | { |
| 6117 | if (argc == 1) |
| 6118 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6119 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6120 | |
| 6121 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6122 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6123 | } |
| 6124 | |
| 6125 | ALIAS (clear_bgp_all_soft, |
| 6126 | clear_bgp_instance_all_soft_cmd, |
| 6127 | "clear bgp view WORD * soft", |
| 6128 | CLEAR_STR |
| 6129 | BGP_STR |
| 6130 | "BGP view\n" |
| 6131 | "view name\n" |
| 6132 | "Clear all peers\n" |
| 6133 | "Soft reconfig\n") |
| 6134 | |
| 6135 | ALIAS (clear_bgp_all_soft, |
| 6136 | clear_bgp_ipv6_all_soft_cmd, |
| 6137 | "clear bgp ipv6 * soft", |
| 6138 | CLEAR_STR |
| 6139 | BGP_STR |
| 6140 | "Address family\n" |
| 6141 | "Clear all peers\n" |
| 6142 | "Soft reconfig\n") |
| 6143 | |
| 6144 | DEFUN (clear_ip_bgp_peer_soft, |
| 6145 | clear_ip_bgp_peer_soft_cmd, |
| 6146 | "clear ip bgp A.B.C.D soft", |
| 6147 | CLEAR_STR |
| 6148 | IP_STR |
| 6149 | BGP_STR |
| 6150 | "BGP neighbor address to clear\n" |
| 6151 | "Soft reconfig\n") |
| 6152 | { |
| 6153 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6154 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6155 | } |
| 6156 | |
| 6157 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
| 6158 | clear_ip_bgp_peer_ipv4_soft_cmd, |
| 6159 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", |
| 6160 | CLEAR_STR |
| 6161 | IP_STR |
| 6162 | BGP_STR |
| 6163 | "BGP neighbor address to clear\n" |
| 6164 | "Address family\n" |
| 6165 | "Address Family Modifier\n" |
| 6166 | "Address Family Modifier\n" |
| 6167 | "Soft reconfig\n") |
| 6168 | { |
| 6169 | if (strncmp (argv[1], "m", 1) == 0) |
| 6170 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 6171 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6172 | |
| 6173 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6174 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6175 | } |
| 6176 | |
| 6177 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
| 6178 | clear_ip_bgp_peer_vpnv4_soft_cmd, |
| 6179 | "clear ip bgp A.B.C.D vpnv4 unicast soft", |
| 6180 | CLEAR_STR |
| 6181 | IP_STR |
| 6182 | BGP_STR |
| 6183 | "BGP neighbor address to clear\n" |
| 6184 | "Address family\n" |
| 6185 | "Address Family Modifier\n" |
| 6186 | "Soft reconfig\n") |
| 6187 | { |
| 6188 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 6189 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6190 | } |
| 6191 | |
| 6192 | DEFUN (clear_bgp_peer_soft, |
| 6193 | clear_bgp_peer_soft_cmd, |
| 6194 | "clear bgp (A.B.C.D|X:X::X:X) soft", |
| 6195 | CLEAR_STR |
| 6196 | BGP_STR |
| 6197 | "BGP neighbor address to clear\n" |
| 6198 | "BGP IPv6 neighbor to clear\n" |
| 6199 | "Soft reconfig\n") |
| 6200 | { |
| 6201 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6202 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6203 | } |
| 6204 | |
| 6205 | ALIAS (clear_bgp_peer_soft, |
| 6206 | clear_bgp_ipv6_peer_soft_cmd, |
| 6207 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft", |
| 6208 | CLEAR_STR |
| 6209 | BGP_STR |
| 6210 | "Address family\n" |
| 6211 | "BGP neighbor address to clear\n" |
| 6212 | "BGP IPv6 neighbor to clear\n" |
| 6213 | "Soft reconfig\n") |
| 6214 | |
| 6215 | DEFUN (clear_ip_bgp_peer_group_soft, |
| 6216 | clear_ip_bgp_peer_group_soft_cmd, |
| 6217 | "clear ip bgp peer-group WORD soft", |
| 6218 | CLEAR_STR |
| 6219 | IP_STR |
| 6220 | BGP_STR |
| 6221 | "Clear all members of peer-group\n" |
| 6222 | "BGP peer-group name\n" |
| 6223 | "Soft reconfig\n") |
| 6224 | { |
| 6225 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6226 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6227 | } |
| 6228 | |
| 6229 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
| 6230 | clear_ip_bgp_peer_group_ipv4_soft_cmd, |
| 6231 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", |
| 6232 | CLEAR_STR |
| 6233 | IP_STR |
| 6234 | BGP_STR |
| 6235 | "Clear all members of peer-group\n" |
| 6236 | "BGP peer-group name\n" |
| 6237 | "Address family\n" |
| 6238 | "Address Family modifier\n" |
| 6239 | "Address Family modifier\n" |
| 6240 | "Soft reconfig\n") |
| 6241 | { |
| 6242 | if (strncmp (argv[1], "m", 1) == 0) |
| 6243 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 6244 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6245 | |
| 6246 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6247 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6248 | } |
| 6249 | |
| 6250 | DEFUN (clear_bgp_peer_group_soft, |
| 6251 | clear_bgp_peer_group_soft_cmd, |
| 6252 | "clear bgp peer-group WORD soft", |
| 6253 | CLEAR_STR |
| 6254 | BGP_STR |
| 6255 | "Clear all members of peer-group\n" |
| 6256 | "BGP peer-group name\n" |
| 6257 | "Soft reconfig\n") |
| 6258 | { |
| 6259 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 6260 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6261 | } |
| 6262 | |
| 6263 | ALIAS (clear_bgp_peer_group_soft, |
| 6264 | clear_bgp_ipv6_peer_group_soft_cmd, |
| 6265 | "clear bgp ipv6 peer-group WORD soft", |
| 6266 | CLEAR_STR |
| 6267 | BGP_STR |
| 6268 | "Address family\n" |
| 6269 | "Clear all members of peer-group\n" |
| 6270 | "BGP peer-group name\n" |
| 6271 | "Soft reconfig\n") |
| 6272 | |
| 6273 | DEFUN (clear_ip_bgp_external_soft, |
| 6274 | clear_ip_bgp_external_soft_cmd, |
| 6275 | "clear ip bgp external soft", |
| 6276 | CLEAR_STR |
| 6277 | IP_STR |
| 6278 | BGP_STR |
| 6279 | "Clear all external peers\n" |
| 6280 | "Soft reconfig\n") |
| 6281 | { |
| 6282 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6283 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6284 | } |
| 6285 | |
| 6286 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
| 6287 | clear_ip_bgp_external_ipv4_soft_cmd, |
| 6288 | "clear ip bgp external ipv4 (unicast|multicast) soft", |
| 6289 | CLEAR_STR |
| 6290 | IP_STR |
| 6291 | BGP_STR |
| 6292 | "Clear all external peers\n" |
| 6293 | "Address family\n" |
| 6294 | "Address Family modifier\n" |
| 6295 | "Address Family modifier\n" |
| 6296 | "Soft reconfig\n") |
| 6297 | { |
| 6298 | if (strncmp (argv[0], "m", 1) == 0) |
| 6299 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 6300 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6301 | |
| 6302 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6303 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6304 | } |
| 6305 | |
| 6306 | DEFUN (clear_bgp_external_soft, |
| 6307 | clear_bgp_external_soft_cmd, |
| 6308 | "clear bgp external soft", |
| 6309 | CLEAR_STR |
| 6310 | BGP_STR |
| 6311 | "Clear all external peers\n" |
| 6312 | "Soft reconfig\n") |
| 6313 | { |
| 6314 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 6315 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6316 | } |
| 6317 | |
| 6318 | ALIAS (clear_bgp_external_soft, |
| 6319 | clear_bgp_ipv6_external_soft_cmd, |
| 6320 | "clear bgp ipv6 external soft", |
| 6321 | CLEAR_STR |
| 6322 | BGP_STR |
| 6323 | "Address family\n" |
| 6324 | "Clear all external peers\n" |
| 6325 | "Soft reconfig\n") |
| 6326 | |
| 6327 | DEFUN (clear_ip_bgp_as_soft, |
| 6328 | clear_ip_bgp_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6329 | "clear ip bgp " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6330 | CLEAR_STR |
| 6331 | IP_STR |
| 6332 | BGP_STR |
| 6333 | "Clear peers with the AS number\n" |
| 6334 | "Soft reconfig\n") |
| 6335 | { |
| 6336 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6337 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6338 | } |
| 6339 | |
| 6340 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
| 6341 | clear_ip_bgp_as_ipv4_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6342 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6343 | CLEAR_STR |
| 6344 | IP_STR |
| 6345 | BGP_STR |
| 6346 | "Clear peers with the AS number\n" |
| 6347 | "Address family\n" |
| 6348 | "Address Family Modifier\n" |
| 6349 | "Address Family Modifier\n" |
| 6350 | "Soft reconfig\n") |
| 6351 | { |
| 6352 | if (strncmp (argv[1], "m", 1) == 0) |
| 6353 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6354 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6355 | |
| 6356 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, |
| 6357 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6358 | } |
| 6359 | |
| 6360 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
| 6361 | clear_ip_bgp_as_vpnv4_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6362 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6363 | CLEAR_STR |
| 6364 | IP_STR |
| 6365 | BGP_STR |
| 6366 | "Clear peers with the AS number\n" |
| 6367 | "Address family\n" |
| 6368 | "Address Family Modifier\n" |
| 6369 | "Soft reconfig\n") |
| 6370 | { |
| 6371 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 6372 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6373 | } |
| 6374 | |
| 6375 | DEFUN (clear_bgp_as_soft, |
| 6376 | clear_bgp_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6377 | "clear bgp " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6378 | CLEAR_STR |
| 6379 | BGP_STR |
| 6380 | "Clear peers with the AS number\n" |
| 6381 | "Soft reconfig\n") |
| 6382 | { |
| 6383 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6384 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6385 | } |
| 6386 | |
| 6387 | ALIAS (clear_bgp_as_soft, |
| 6388 | clear_bgp_ipv6_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6389 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6390 | CLEAR_STR |
| 6391 | BGP_STR |
| 6392 | "Address family\n" |
| 6393 | "Clear peers with the AS number\n" |
| 6394 | "Soft reconfig\n") |
| 6395 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6396 | /* RS-client soft reconfiguration. */ |
| 6397 | #ifdef HAVE_IPV6 |
| 6398 | DEFUN (clear_bgp_all_rsclient, |
| 6399 | clear_bgp_all_rsclient_cmd, |
| 6400 | "clear bgp * rsclient", |
| 6401 | CLEAR_STR |
| 6402 | BGP_STR |
| 6403 | "Clear all peers\n" |
| 6404 | "Soft reconfig for rsclient RIB\n") |
| 6405 | { |
| 6406 | if (argc == 1) |
| 6407 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6408 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6409 | |
| 6410 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6411 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6412 | } |
| 6413 | |
| 6414 | ALIAS (clear_bgp_all_rsclient, |
| 6415 | clear_bgp_ipv6_all_rsclient_cmd, |
| 6416 | "clear bgp ipv6 * rsclient", |
| 6417 | CLEAR_STR |
| 6418 | BGP_STR |
| 6419 | "Address family\n" |
| 6420 | "Clear all peers\n" |
| 6421 | "Soft reconfig for rsclient RIB\n") |
| 6422 | |
| 6423 | ALIAS (clear_bgp_all_rsclient, |
| 6424 | clear_bgp_instance_all_rsclient_cmd, |
| 6425 | "clear bgp view WORD * rsclient", |
| 6426 | CLEAR_STR |
| 6427 | BGP_STR |
| 6428 | "BGP view\n" |
| 6429 | "view name\n" |
| 6430 | "Clear all peers\n" |
| 6431 | "Soft reconfig for rsclient RIB\n") |
| 6432 | |
| 6433 | ALIAS (clear_bgp_all_rsclient, |
| 6434 | clear_bgp_ipv6_instance_all_rsclient_cmd, |
| 6435 | "clear bgp ipv6 view WORD * rsclient", |
| 6436 | CLEAR_STR |
| 6437 | BGP_STR |
| 6438 | "Address family\n" |
| 6439 | "BGP view\n" |
| 6440 | "view name\n" |
| 6441 | "Clear all peers\n" |
| 6442 | "Soft reconfig for rsclient RIB\n") |
| 6443 | #endif /* HAVE_IPV6 */ |
| 6444 | |
| 6445 | DEFUN (clear_ip_bgp_all_rsclient, |
| 6446 | clear_ip_bgp_all_rsclient_cmd, |
| 6447 | "clear ip bgp * rsclient", |
| 6448 | CLEAR_STR |
| 6449 | IP_STR |
| 6450 | BGP_STR |
| 6451 | "Clear all peers\n" |
| 6452 | "Soft reconfig for rsclient RIB\n") |
| 6453 | { |
| 6454 | if (argc == 1) |
| 6455 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6456 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6457 | |
| 6458 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6459 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6460 | } |
| 6461 | |
| 6462 | ALIAS (clear_ip_bgp_all_rsclient, |
| 6463 | clear_ip_bgp_instance_all_rsclient_cmd, |
| 6464 | "clear ip bgp view WORD * rsclient", |
| 6465 | CLEAR_STR |
| 6466 | IP_STR |
| 6467 | BGP_STR |
| 6468 | "BGP view\n" |
| 6469 | "view name\n" |
| 6470 | "Clear all peers\n" |
| 6471 | "Soft reconfig for rsclient RIB\n") |
| 6472 | |
| 6473 | #ifdef HAVE_IPV6 |
| 6474 | DEFUN (clear_bgp_peer_rsclient, |
| 6475 | clear_bgp_peer_rsclient_cmd, |
| 6476 | "clear bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6477 | CLEAR_STR |
| 6478 | BGP_STR |
| 6479 | "BGP neighbor IP address to clear\n" |
| 6480 | "BGP IPv6 neighbor to clear\n" |
| 6481 | "Soft reconfig for rsclient RIB\n") |
| 6482 | { |
| 6483 | if (argc == 2) |
| 6484 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6485 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6486 | |
| 6487 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6488 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6489 | } |
| 6490 | |
| 6491 | ALIAS (clear_bgp_peer_rsclient, |
| 6492 | clear_bgp_ipv6_peer_rsclient_cmd, |
| 6493 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient", |
| 6494 | CLEAR_STR |
| 6495 | BGP_STR |
| 6496 | "Address family\n" |
| 6497 | "BGP neighbor IP address to clear\n" |
| 6498 | "BGP IPv6 neighbor to clear\n" |
| 6499 | "Soft reconfig for rsclient RIB\n") |
| 6500 | |
| 6501 | ALIAS (clear_bgp_peer_rsclient, |
| 6502 | clear_bgp_instance_peer_rsclient_cmd, |
| 6503 | "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6504 | CLEAR_STR |
| 6505 | BGP_STR |
| 6506 | "BGP view\n" |
| 6507 | "view name\n" |
| 6508 | "BGP neighbor IP address to clear\n" |
| 6509 | "BGP IPv6 neighbor to clear\n" |
| 6510 | "Soft reconfig for rsclient RIB\n") |
| 6511 | |
| 6512 | ALIAS (clear_bgp_peer_rsclient, |
| 6513 | clear_bgp_ipv6_instance_peer_rsclient_cmd, |
| 6514 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6515 | CLEAR_STR |
| 6516 | BGP_STR |
| 6517 | "Address family\n" |
| 6518 | "BGP view\n" |
| 6519 | "view name\n" |
| 6520 | "BGP neighbor IP address to clear\n" |
| 6521 | "BGP IPv6 neighbor to clear\n" |
| 6522 | "Soft reconfig for rsclient RIB\n") |
| 6523 | #endif /* HAVE_IPV6 */ |
| 6524 | |
| 6525 | DEFUN (clear_ip_bgp_peer_rsclient, |
| 6526 | clear_ip_bgp_peer_rsclient_cmd, |
| 6527 | "clear ip bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6528 | CLEAR_STR |
| 6529 | IP_STR |
| 6530 | BGP_STR |
| 6531 | "BGP neighbor IP address to clear\n" |
| 6532 | "BGP IPv6 neighbor to clear\n" |
| 6533 | "Soft reconfig for rsclient RIB\n") |
| 6534 | { |
| 6535 | if (argc == 2) |
| 6536 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, |
| 6537 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6538 | |
| 6539 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6540 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6541 | } |
| 6542 | |
| 6543 | ALIAS (clear_ip_bgp_peer_rsclient, |
| 6544 | clear_ip_bgp_instance_peer_rsclient_cmd, |
| 6545 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6546 | CLEAR_STR |
| 6547 | IP_STR |
| 6548 | BGP_STR |
| 6549 | "BGP view\n" |
| 6550 | "view name\n" |
| 6551 | "BGP neighbor IP address to clear\n" |
| 6552 | "BGP IPv6 neighbor to clear\n" |
| 6553 | "Soft reconfig for rsclient RIB\n") |
| 6554 | |
Michael Lambert | e0081f7 | 2008-11-16 20:12:04 +0000 | [diff] [blame] | 6555 | DEFUN (show_bgp_views, |
| 6556 | show_bgp_views_cmd, |
| 6557 | "show bgp views", |
| 6558 | SHOW_STR |
| 6559 | BGP_STR |
| 6560 | "Show the defined BGP views\n") |
| 6561 | { |
| 6562 | struct list *inst = bm->bgp; |
| 6563 | struct listnode *node; |
| 6564 | struct bgp *bgp; |
| 6565 | |
| 6566 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) |
| 6567 | { |
| 6568 | vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE); |
| 6569 | return CMD_WARNING; |
| 6570 | } |
| 6571 | |
| 6572 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); |
| 6573 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) |
| 6574 | vty_out (vty, "\t%s (AS%u)%s", |
| 6575 | bgp->name ? bgp->name : "(null)", |
| 6576 | bgp->as, VTY_NEWLINE); |
| 6577 | |
| 6578 | return CMD_SUCCESS; |
| 6579 | } |
| 6580 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6581 | DEFUN (show_bgp_memory, |
| 6582 | show_bgp_memory_cmd, |
| 6583 | "show bgp memory", |
| 6584 | SHOW_STR |
| 6585 | BGP_STR |
| 6586 | "Global BGP memory statistics\n") |
| 6587 | { |
| 6588 | char memstrbuf[MTYPE_MEMSTR_LEN]; |
| 6589 | unsigned long count; |
| 6590 | |
| 6591 | /* RIB related usage stats */ |
| 6592 | count = mtype_stats_alloc (MTYPE_BGP_NODE); |
| 6593 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, |
| 6594 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6595 | count * sizeof (struct bgp_node)), |
| 6596 | VTY_NEWLINE); |
| 6597 | |
| 6598 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); |
| 6599 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, |
| 6600 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6601 | count * sizeof (struct bgp_info)), |
| 6602 | VTY_NEWLINE); |
Paul Jakma | fb982c2 | 2007-05-04 20:15:47 +0000 | [diff] [blame] | 6603 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
| 6604 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, |
| 6605 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6606 | count * sizeof (struct bgp_info_extra)), |
| 6607 | VTY_NEWLINE); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6608 | |
| 6609 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) |
| 6610 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, |
| 6611 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6612 | count * sizeof (struct bgp_static)), |
| 6613 | VTY_NEWLINE); |
| 6614 | |
| 6615 | /* Adj-In/Out */ |
| 6616 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) |
| 6617 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, |
| 6618 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6619 | count * sizeof (struct bgp_adj_in)), |
| 6620 | VTY_NEWLINE); |
| 6621 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) |
| 6622 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, |
| 6623 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6624 | count * sizeof (struct bgp_adj_out)), |
| 6625 | VTY_NEWLINE); |
| 6626 | |
| 6627 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) |
| 6628 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, |
| 6629 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6630 | count * sizeof (struct bgp_nexthop_cache)), |
| 6631 | VTY_NEWLINE); |
| 6632 | |
| 6633 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) |
| 6634 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, |
| 6635 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6636 | count * sizeof (struct bgp_damp_info)), |
| 6637 | VTY_NEWLINE); |
| 6638 | |
| 6639 | /* Attributes */ |
| 6640 | count = attr_count(); |
| 6641 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, |
| 6642 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6643 | count * sizeof(struct attr)), |
| 6644 | VTY_NEWLINE); |
Paul Jakma | fb982c2 | 2007-05-04 20:15:47 +0000 | [diff] [blame] | 6645 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
| 6646 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, |
| 6647 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6648 | count * sizeof(struct attr_extra)), |
| 6649 | VTY_NEWLINE); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6650 | |
| 6651 | if ((count = attr_unknown_count())) |
| 6652 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); |
| 6653 | |
| 6654 | /* AS_PATH attributes */ |
| 6655 | count = aspath_count (); |
| 6656 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, |
| 6657 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6658 | count * sizeof (struct aspath)), |
| 6659 | VTY_NEWLINE); |
| 6660 | |
| 6661 | count = mtype_stats_alloc (MTYPE_AS_SEG); |
| 6662 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, |
| 6663 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6664 | count * sizeof (struct assegment)), |
| 6665 | VTY_NEWLINE); |
| 6666 | |
| 6667 | /* Other attributes */ |
| 6668 | if ((count = community_count ())) |
| 6669 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, |
| 6670 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6671 | count * sizeof (struct community)), |
| 6672 | VTY_NEWLINE); |
| 6673 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) |
| 6674 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, |
| 6675 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6676 | count * sizeof (struct ecommunity)), |
| 6677 | VTY_NEWLINE); |
| 6678 | |
| 6679 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) |
| 6680 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, |
| 6681 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6682 | count * sizeof (struct cluster_list)), |
| 6683 | VTY_NEWLINE); |
| 6684 | |
| 6685 | /* Peer related usage */ |
| 6686 | count = mtype_stats_alloc (MTYPE_BGP_PEER); |
| 6687 | vty_out (vty, "%ld peers, using %s of memory%s", count, |
| 6688 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6689 | count * sizeof (struct peer)), |
| 6690 | VTY_NEWLINE); |
| 6691 | |
| 6692 | if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP))) |
| 6693 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, |
| 6694 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6695 | count * sizeof (struct peer_group)), |
| 6696 | VTY_NEWLINE); |
| 6697 | |
| 6698 | /* Other */ |
| 6699 | if ((count = mtype_stats_alloc (MTYPE_HASH))) |
| 6700 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, |
| 6701 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6702 | count * sizeof (struct hash)), |
| 6703 | VTY_NEWLINE); |
| 6704 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) |
| 6705 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, |
| 6706 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6707 | count * sizeof (struct hash_backet)), |
| 6708 | VTY_NEWLINE); |
| 6709 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) |
| 6710 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, |
| 6711 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6712 | count * sizeof (regex_t)), |
| 6713 | VTY_NEWLINE); |
| 6714 | return CMD_SUCCESS; |
| 6715 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6716 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6717 | /* Show BGP peer's summary information. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6718 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6719 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) |
| 6720 | { |
| 6721 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6722 | struct listnode *node, *nnode; |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6723 | unsigned int count = 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6724 | char timebuf[BGP_UPTIME_LEN]; |
| 6725 | int len; |
| 6726 | |
| 6727 | /* Header string for each address family. */ |
| 6728 | 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] | 6729 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6730 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6731 | { |
| 6732 | if (peer->afc[afi][safi]) |
| 6733 | { |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6734 | if (!count) |
| 6735 | { |
| 6736 | unsigned long ents; |
| 6737 | char memstrbuf[MTYPE_MEMSTR_LEN]; |
| 6738 | |
| 6739 | /* Usage summary and header */ |
| 6740 | vty_out (vty, |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 6741 | "BGP router identifier %s, local AS number %u%s", |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6742 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6743 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6744 | ents = bgp_table_count (bgp->rib[afi][safi]); |
| 6745 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, |
| 6746 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6747 | ents * sizeof (struct bgp_node)), |
| 6748 | VTY_NEWLINE); |
| 6749 | |
| 6750 | /* Peer related usage */ |
| 6751 | ents = listcount (bgp->peer); |
| 6752 | vty_out (vty, "Peers %ld, using %s of memory%s", |
| 6753 | ents, |
| 6754 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6755 | ents * sizeof (struct peer)), |
| 6756 | VTY_NEWLINE); |
| 6757 | |
| 6758 | if ((ents = listcount (bgp->rsclient))) |
| 6759 | vty_out (vty, "RS-Client peers %ld, using %s of memory%s", |
| 6760 | ents, |
| 6761 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6762 | ents * sizeof (struct peer)), |
| 6763 | VTY_NEWLINE); |
| 6764 | |
| 6765 | if ((ents = listcount (bgp->group))) |
| 6766 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, |
| 6767 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6768 | ents * sizeof (struct peer_group)), |
| 6769 | VTY_NEWLINE); |
| 6770 | |
| 6771 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
| 6772 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); |
| 6773 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6774 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 6775 | } |
| 6776 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6777 | count++; |
| 6778 | |
| 6779 | len = vty_out (vty, "%s", peer->host); |
| 6780 | len = 16 - len; |
| 6781 | if (len < 1) |
| 6782 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 6783 | else |
| 6784 | vty_out (vty, "%*s", len, " "); |
| 6785 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 6786 | vty_out (vty, "4 "); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6787 | |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 6788 | vty_out (vty, "%5u %7d %7d %8d %4d %4lu ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6789 | peer->as, |
| 6790 | peer->open_in + peer->update_in + peer->keepalive_in |
| 6791 | + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in, |
| 6792 | peer->open_out + peer->update_out + peer->keepalive_out |
| 6793 | + peer->notify_out + peer->refresh_out |
| 6794 | + peer->dynamic_cap_out, |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 6795 | 0, 0, (unsigned long) peer->obuf->count); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6796 | |
| 6797 | vty_out (vty, "%8s", |
| 6798 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); |
| 6799 | |
| 6800 | if (peer->status == Established) |
| 6801 | { |
| 6802 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); |
| 6803 | } |
| 6804 | else |
| 6805 | { |
| 6806 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) |
| 6807 | vty_out (vty, " Idle (Admin)"); |
| 6808 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 6809 | vty_out (vty, " Idle (PfxCt)"); |
| 6810 | else |
| 6811 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); |
| 6812 | } |
| 6813 | |
| 6814 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6815 | } |
| 6816 | } |
| 6817 | |
| 6818 | if (count) |
| 6819 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, |
| 6820 | count, VTY_NEWLINE); |
| 6821 | else |
| 6822 | vty_out (vty, "No %s neighbor is configured%s", |
| 6823 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 6824 | return CMD_SUCCESS; |
| 6825 | } |
| 6826 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6827 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 6828 | bgp_show_summary_vty (struct vty *vty, const char *name, |
| 6829 | afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6830 | { |
| 6831 | struct bgp *bgp; |
| 6832 | |
| 6833 | if (name) |
| 6834 | { |
| 6835 | bgp = bgp_lookup_by_name (name); |
| 6836 | |
| 6837 | if (! bgp) |
| 6838 | { |
| 6839 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 6840 | return CMD_WARNING; |
| 6841 | } |
| 6842 | |
| 6843 | bgp_show_summary (vty, bgp, afi, safi); |
| 6844 | return CMD_SUCCESS; |
| 6845 | } |
| 6846 | |
| 6847 | bgp = bgp_get_default (); |
| 6848 | |
| 6849 | if (bgp) |
| 6850 | bgp_show_summary (vty, bgp, afi, safi); |
| 6851 | |
| 6852 | return CMD_SUCCESS; |
| 6853 | } |
| 6854 | |
| 6855 | /* `show ip bgp summary' commands. */ |
| 6856 | DEFUN (show_ip_bgp_summary, |
| 6857 | show_ip_bgp_summary_cmd, |
| 6858 | "show ip bgp summary", |
| 6859 | SHOW_STR |
| 6860 | IP_STR |
| 6861 | BGP_STR |
| 6862 | "Summary of BGP neighbor status\n") |
| 6863 | { |
| 6864 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 6865 | } |
| 6866 | |
| 6867 | DEFUN (show_ip_bgp_instance_summary, |
| 6868 | show_ip_bgp_instance_summary_cmd, |
| 6869 | "show ip bgp view WORD summary", |
| 6870 | SHOW_STR |
| 6871 | IP_STR |
| 6872 | BGP_STR |
| 6873 | "BGP view\n" |
| 6874 | "View name\n" |
| 6875 | "Summary of BGP neighbor status\n") |
| 6876 | { |
| 6877 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 6878 | } |
| 6879 | |
| 6880 | DEFUN (show_ip_bgp_ipv4_summary, |
| 6881 | show_ip_bgp_ipv4_summary_cmd, |
| 6882 | "show ip bgp ipv4 (unicast|multicast) summary", |
| 6883 | SHOW_STR |
| 6884 | IP_STR |
| 6885 | BGP_STR |
| 6886 | "Address family\n" |
| 6887 | "Address Family modifier\n" |
| 6888 | "Address Family modifier\n" |
| 6889 | "Summary of BGP neighbor status\n") |
| 6890 | { |
| 6891 | if (strncmp (argv[0], "m", 1) == 0) |
| 6892 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 6893 | |
| 6894 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 6895 | } |
| 6896 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 6897 | ALIAS (show_ip_bgp_ipv4_summary, |
| 6898 | show_bgp_ipv4_safi_summary_cmd, |
| 6899 | "show bgp ipv4 (unicast|multicast) summary", |
| 6900 | SHOW_STR |
| 6901 | BGP_STR |
| 6902 | "Address family\n" |
| 6903 | "Address Family modifier\n" |
| 6904 | "Address Family modifier\n" |
| 6905 | "Summary of BGP neighbor status\n") |
| 6906 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6907 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
| 6908 | show_ip_bgp_instance_ipv4_summary_cmd, |
| 6909 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", |
| 6910 | SHOW_STR |
| 6911 | IP_STR |
| 6912 | BGP_STR |
| 6913 | "BGP view\n" |
| 6914 | "View name\n" |
| 6915 | "Address family\n" |
| 6916 | "Address Family modifier\n" |
| 6917 | "Address Family modifier\n" |
| 6918 | "Summary of BGP neighbor status\n") |
| 6919 | { |
| 6920 | if (strncmp (argv[1], "m", 1) == 0) |
| 6921 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 6922 | else |
| 6923 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 6924 | } |
| 6925 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 6926 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
| 6927 | show_bgp_instance_ipv4_safi_summary_cmd, |
| 6928 | "show bgp view WORD ipv4 (unicast|multicast) summary", |
| 6929 | SHOW_STR |
| 6930 | BGP_STR |
| 6931 | "BGP view\n" |
| 6932 | "View name\n" |
| 6933 | "Address family\n" |
| 6934 | "Address Family modifier\n" |
| 6935 | "Address Family modifier\n" |
| 6936 | "Summary of BGP neighbor status\n") |
| 6937 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6938 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
| 6939 | show_ip_bgp_vpnv4_all_summary_cmd, |
| 6940 | "show ip bgp vpnv4 all summary", |
| 6941 | SHOW_STR |
| 6942 | IP_STR |
| 6943 | BGP_STR |
| 6944 | "Display VPNv4 NLRI specific information\n" |
| 6945 | "Display information about all VPNv4 NLRIs\n" |
| 6946 | "Summary of BGP neighbor status\n") |
| 6947 | { |
| 6948 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 6949 | } |
| 6950 | |
| 6951 | DEFUN (show_ip_bgp_vpnv4_rd_summary, |
| 6952 | show_ip_bgp_vpnv4_rd_summary_cmd, |
| 6953 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", |
| 6954 | SHOW_STR |
| 6955 | IP_STR |
| 6956 | BGP_STR |
| 6957 | "Display VPNv4 NLRI specific information\n" |
| 6958 | "Display information for a route distinguisher\n" |
| 6959 | "VPN Route Distinguisher\n" |
| 6960 | "Summary of BGP neighbor status\n") |
| 6961 | { |
| 6962 | int ret; |
| 6963 | struct prefix_rd prd; |
| 6964 | |
| 6965 | ret = str2prefix_rd (argv[0], &prd); |
| 6966 | if (! ret) |
| 6967 | { |
| 6968 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); |
| 6969 | return CMD_WARNING; |
| 6970 | } |
| 6971 | |
| 6972 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 6973 | } |
| 6974 | |
| 6975 | #ifdef HAVE_IPV6 |
| 6976 | DEFUN (show_bgp_summary, |
| 6977 | show_bgp_summary_cmd, |
| 6978 | "show bgp summary", |
| 6979 | SHOW_STR |
| 6980 | BGP_STR |
| 6981 | "Summary of BGP neighbor status\n") |
| 6982 | { |
| 6983 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 6984 | } |
| 6985 | |
| 6986 | DEFUN (show_bgp_instance_summary, |
| 6987 | show_bgp_instance_summary_cmd, |
| 6988 | "show bgp view WORD summary", |
| 6989 | SHOW_STR |
| 6990 | BGP_STR |
| 6991 | "BGP view\n" |
| 6992 | "View name\n" |
| 6993 | "Summary of BGP neighbor status\n") |
| 6994 | { |
| 6995 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 6996 | } |
| 6997 | |
| 6998 | ALIAS (show_bgp_summary, |
| 6999 | show_bgp_ipv6_summary_cmd, |
| 7000 | "show bgp ipv6 summary", |
| 7001 | SHOW_STR |
| 7002 | BGP_STR |
| 7003 | "Address family\n" |
| 7004 | "Summary of BGP neighbor status\n") |
| 7005 | |
| 7006 | ALIAS (show_bgp_instance_summary, |
| 7007 | show_bgp_instance_ipv6_summary_cmd, |
| 7008 | "show bgp view WORD ipv6 summary", |
| 7009 | SHOW_STR |
| 7010 | BGP_STR |
| 7011 | "BGP view\n" |
| 7012 | "View name\n" |
| 7013 | "Address family\n" |
| 7014 | "Summary of BGP neighbor status\n") |
| 7015 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 7016 | DEFUN (show_bgp_ipv6_safi_summary, |
| 7017 | show_bgp_ipv6_safi_summary_cmd, |
| 7018 | "show bgp ipv6 (unicast|multicast) summary", |
| 7019 | SHOW_STR |
| 7020 | BGP_STR |
| 7021 | "Address family\n" |
| 7022 | "Address Family modifier\n" |
| 7023 | "Address Family modifier\n" |
| 7024 | "Summary of BGP neighbor status\n") |
| 7025 | { |
| 7026 | if (strncmp (argv[0], "m", 1) == 0) |
| 7027 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 7028 | |
| 7029 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7030 | } |
| 7031 | |
| 7032 | DEFUN (show_bgp_instance_ipv6_safi_summary, |
| 7033 | show_bgp_instance_ipv6_safi_summary_cmd, |
| 7034 | "show bgp view WORD ipv6 (unicast|multicast) summary", |
| 7035 | SHOW_STR |
| 7036 | BGP_STR |
| 7037 | "BGP view\n" |
| 7038 | "View name\n" |
| 7039 | "Address family\n" |
| 7040 | "Address Family modifier\n" |
| 7041 | "Address Family modifier\n" |
| 7042 | "Summary of BGP neighbor status\n") |
| 7043 | { |
| 7044 | if (strncmp (argv[1], "m", 1) == 0) |
| 7045 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST); |
| 7046 | |
| 7047 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 7048 | } |
| 7049 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7050 | /* old command */ |
| 7051 | DEFUN (show_ipv6_bgp_summary, |
| 7052 | show_ipv6_bgp_summary_cmd, |
| 7053 | "show ipv6 bgp summary", |
| 7054 | SHOW_STR |
| 7055 | IPV6_STR |
| 7056 | BGP_STR |
| 7057 | "Summary of BGP neighbor status\n") |
| 7058 | { |
| 7059 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 7060 | } |
| 7061 | |
| 7062 | /* old command */ |
| 7063 | DEFUN (show_ipv6_mbgp_summary, |
| 7064 | show_ipv6_mbgp_summary_cmd, |
| 7065 | "show ipv6 mbgp summary", |
| 7066 | SHOW_STR |
| 7067 | IPV6_STR |
| 7068 | MBGP_STR |
| 7069 | "Summary of BGP neighbor status\n") |
| 7070 | { |
| 7071 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 7072 | } |
| 7073 | #endif /* HAVE_IPV6 */ |
| 7074 | |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7075 | const char * |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7076 | afi_safi_print (afi_t afi, safi_t safi) |
| 7077 | { |
| 7078 | if (afi == AFI_IP && safi == SAFI_UNICAST) |
| 7079 | return "IPv4 Unicast"; |
| 7080 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) |
| 7081 | return "IPv4 Multicast"; |
| 7082 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) |
| 7083 | return "VPNv4 Unicast"; |
| 7084 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) |
| 7085 | return "IPv6 Unicast"; |
| 7086 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) |
| 7087 | return "IPv6 Multicast"; |
| 7088 | else |
| 7089 | return "Unknown"; |
| 7090 | } |
| 7091 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7092 | /* Show BGP peer's information. */ |
| 7093 | enum show_type |
| 7094 | { |
| 7095 | show_all, |
| 7096 | show_peer |
| 7097 | }; |
| 7098 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7099 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7100 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
| 7101 | afi_t afi, safi_t safi, |
| 7102 | u_int16_t adv_smcap, u_int16_t adv_rmcap, |
| 7103 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) |
| 7104 | { |
| 7105 | /* Send-Mode */ |
| 7106 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) |
| 7107 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 7108 | { |
| 7109 | vty_out (vty, " Send-mode: "); |
| 7110 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) |
| 7111 | vty_out (vty, "advertised"); |
| 7112 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 7113 | vty_out (vty, "%sreceived", |
| 7114 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? |
| 7115 | ", " : ""); |
| 7116 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7117 | } |
| 7118 | |
| 7119 | /* Receive-Mode */ |
| 7120 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) |
| 7121 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 7122 | { |
| 7123 | vty_out (vty, " Receive-mode: "); |
| 7124 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) |
| 7125 | vty_out (vty, "advertised"); |
| 7126 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 7127 | vty_out (vty, "%sreceived", |
| 7128 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? |
| 7129 | ", " : ""); |
| 7130 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7131 | } |
| 7132 | } |
| 7133 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7134 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7135 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
| 7136 | { |
| 7137 | struct bgp_filter *filter; |
| 7138 | char orf_pfx_name[BUFSIZ]; |
| 7139 | int orf_pfx_count; |
| 7140 | |
| 7141 | filter = &p->filter[afi][safi]; |
| 7142 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7143 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7144 | VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7145 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7146 | if (p->af_group[afi][safi]) |
| 7147 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
| 7148 | |
| 7149 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7150 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 7151 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 7152 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7153 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) |
| 7154 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 7155 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); |
| 7156 | |
| 7157 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7158 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 7159 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7160 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) |
| 7161 | { |
| 7162 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 7163 | ORF_TYPE_PREFIX, VTY_NEWLINE); |
| 7164 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 7165 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 7166 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 7167 | PEER_CAP_ORF_PREFIX_SM_RCV, |
| 7168 | PEER_CAP_ORF_PREFIX_RM_RCV); |
| 7169 | } |
| 7170 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7171 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 7172 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7173 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 7174 | { |
| 7175 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 7176 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); |
| 7177 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 7178 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 7179 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 7180 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, |
| 7181 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); |
| 7182 | } |
| 7183 | |
| 7184 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
| 7185 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); |
| 7186 | |
| 7187 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
| 7188 | || orf_pfx_count) |
| 7189 | { |
| 7190 | vty_out (vty, " Outbound Route Filter (ORF):"); |
| 7191 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) |
| 7192 | vty_out (vty, " sent;"); |
| 7193 | if (orf_pfx_count) |
| 7194 | vty_out (vty, " received (%d entries)", orf_pfx_count); |
| 7195 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7196 | } |
| 7197 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) |
| 7198 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); |
| 7199 | |
| 7200 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) |
| 7201 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); |
| 7202 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 7203 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); |
| 7204 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) |
| 7205 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); |
| 7206 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
| 7207 | vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE); |
| 7208 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) |
| 7209 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); |
| 7210 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) |
| 7211 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7212 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) |
| 7213 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7214 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) |
| 7215 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7216 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 7217 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
| 7218 | { |
| 7219 | vty_out (vty, " Community attribute sent to this neighbor"); |
| 7220 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 7221 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7222 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7223 | 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] | 7224 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7225 | else |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7226 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7227 | } |
| 7228 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) |
| 7229 | { |
| 7230 | vty_out (vty, " Default information originate,"); |
| 7231 | |
| 7232 | if (p->default_rmap[afi][safi].name) |
| 7233 | vty_out (vty, " default route-map %s%s,", |
| 7234 | p->default_rmap[afi][safi].map ? "*" : "", |
| 7235 | p->default_rmap[afi][safi].name); |
| 7236 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) |
| 7237 | vty_out (vty, " default sent%s", VTY_NEWLINE); |
| 7238 | else |
| 7239 | vty_out (vty, " default not sent%s", VTY_NEWLINE); |
| 7240 | } |
| 7241 | |
| 7242 | if (filter->plist[FILTER_IN].name |
| 7243 | || filter->dlist[FILTER_IN].name |
| 7244 | || filter->aslist[FILTER_IN].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7245 | || filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7246 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
| 7247 | if (filter->plist[FILTER_OUT].name |
| 7248 | || filter->dlist[FILTER_OUT].name |
| 7249 | || filter->aslist[FILTER_OUT].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7250 | || filter->map[RMAP_OUT].name |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7251 | || filter->usmap.name) |
| 7252 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7253 | if (filter->map[RMAP_IMPORT].name) |
| 7254 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); |
| 7255 | if (filter->map[RMAP_EXPORT].name) |
| 7256 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7257 | |
| 7258 | /* prefix-list */ |
| 7259 | if (filter->plist[FILTER_IN].name) |
| 7260 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", |
| 7261 | filter->plist[FILTER_IN].plist ? "*" : "", |
| 7262 | filter->plist[FILTER_IN].name, |
| 7263 | VTY_NEWLINE); |
| 7264 | if (filter->plist[FILTER_OUT].name) |
| 7265 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", |
| 7266 | filter->plist[FILTER_OUT].plist ? "*" : "", |
| 7267 | filter->plist[FILTER_OUT].name, |
| 7268 | VTY_NEWLINE); |
| 7269 | |
| 7270 | /* distribute-list */ |
| 7271 | if (filter->dlist[FILTER_IN].name) |
| 7272 | vty_out (vty, " Incoming update network filter list is %s%s%s", |
| 7273 | filter->dlist[FILTER_IN].alist ? "*" : "", |
| 7274 | filter->dlist[FILTER_IN].name, |
| 7275 | VTY_NEWLINE); |
| 7276 | if (filter->dlist[FILTER_OUT].name) |
| 7277 | vty_out (vty, " Outgoing update network filter list is %s%s%s", |
| 7278 | filter->dlist[FILTER_OUT].alist ? "*" : "", |
| 7279 | filter->dlist[FILTER_OUT].name, |
| 7280 | VTY_NEWLINE); |
| 7281 | |
| 7282 | /* filter-list. */ |
| 7283 | if (filter->aslist[FILTER_IN].name) |
| 7284 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", |
| 7285 | filter->aslist[FILTER_IN].aslist ? "*" : "", |
| 7286 | filter->aslist[FILTER_IN].name, |
| 7287 | VTY_NEWLINE); |
| 7288 | if (filter->aslist[FILTER_OUT].name) |
| 7289 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", |
| 7290 | filter->aslist[FILTER_OUT].aslist ? "*" : "", |
| 7291 | filter->aslist[FILTER_OUT].name, |
| 7292 | VTY_NEWLINE); |
| 7293 | |
| 7294 | /* route-map. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7295 | if (filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7296 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7297 | filter->map[RMAP_IN].map ? "*" : "", |
| 7298 | filter->map[RMAP_IN].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7299 | VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7300 | if (filter->map[RMAP_OUT].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7301 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7302 | filter->map[RMAP_OUT].map ? "*" : "", |
| 7303 | filter->map[RMAP_OUT].name, |
| 7304 | VTY_NEWLINE); |
| 7305 | if (filter->map[RMAP_IMPORT].name) |
| 7306 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", |
| 7307 | filter->map[RMAP_IMPORT].map ? "*" : "", |
| 7308 | filter->map[RMAP_IMPORT].name, |
| 7309 | VTY_NEWLINE); |
| 7310 | if (filter->map[RMAP_EXPORT].name) |
| 7311 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", |
| 7312 | filter->map[RMAP_EXPORT].map ? "*" : "", |
| 7313 | filter->map[RMAP_EXPORT].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7314 | VTY_NEWLINE); |
| 7315 | |
| 7316 | /* unsuppress-map */ |
| 7317 | if (filter->usmap.name) |
| 7318 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", |
| 7319 | filter->usmap.map ? "*" : "", |
| 7320 | filter->usmap.name, VTY_NEWLINE); |
| 7321 | |
| 7322 | /* Receive prefix count */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7323 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
| 7324 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7325 | /* Maximum prefix */ |
| 7326 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) |
| 7327 | { |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7328 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7329 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7330 | ? " (warning-only)" : "", VTY_NEWLINE); |
| 7331 | vty_out (vty, " Threshold for warning message %d%%", |
| 7332 | p->pmax_threshold[afi][safi]); |
| 7333 | if (p->pmax_restart[afi][safi]) |
| 7334 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); |
| 7335 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7336 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7337 | |
| 7338 | vty_out (vty, "%s", VTY_NEWLINE); |
| 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 (struct vty *vty, struct peer *p) |
| 7343 | { |
| 7344 | struct bgp *bgp; |
| 7345 | char buf1[BUFSIZ]; |
| 7346 | char timebuf[BGP_UPTIME_LEN]; |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7347 | afi_t afi; |
| 7348 | safi_t safi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7349 | |
| 7350 | bgp = p->bgp; |
| 7351 | |
| 7352 | /* Configured IP address. */ |
| 7353 | vty_out (vty, "BGP neighbor is %s, ", p->host); |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 7354 | vty_out (vty, "remote AS %u, ", p->as); |
| 7355 | vty_out (vty, "local AS %u%s, ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7356 | p->change_local_as ? p->change_local_as : p->local_as, |
| 7357 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? |
| 7358 | " no-prepend" : ""); |
| 7359 | vty_out (vty, "%s link%s", |
| 7360 | p->as == p->local_as ? "internal" : "external", |
| 7361 | VTY_NEWLINE); |
| 7362 | |
| 7363 | /* Description. */ |
| 7364 | if (p->desc) |
| 7365 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); |
| 7366 | |
| 7367 | /* Peer-group */ |
| 7368 | if (p->group) |
| 7369 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
| 7370 | p->group->name, VTY_NEWLINE); |
| 7371 | |
| 7372 | /* Administrative shutdown. */ |
| 7373 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) |
| 7374 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); |
| 7375 | |
| 7376 | /* BGP Version. */ |
| 7377 | vty_out (vty, " BGP version 4"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7378 | vty_out (vty, ", remote router ID %s%s", |
| 7379 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), |
| 7380 | VTY_NEWLINE); |
| 7381 | |
| 7382 | /* Confederation */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7383 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
| 7384 | && bgp_confederation_peers_check (bgp, p->as)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7385 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
| 7386 | |
| 7387 | /* Status. */ |
| 7388 | vty_out (vty, " BGP state = %s", |
| 7389 | LOOKUP (bgp_status_msg, p->status)); |
| 7390 | if (p->status == Established) |
| 7391 | vty_out (vty, ", up for %8s", |
| 7392 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7393 | else if (p->status == Active) |
| 7394 | { |
| 7395 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) |
| 7396 | vty_out (vty, " (passive)"); |
| 7397 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) |
| 7398 | vty_out (vty, " (NSF passive)"); |
| 7399 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7400 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7401 | |
| 7402 | /* read timer */ |
| 7403 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); |
| 7404 | |
| 7405 | /* Configured timer values. */ |
| 7406 | vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s", |
| 7407 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); |
| 7408 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) |
| 7409 | { |
| 7410 | vty_out (vty, " Configured hold time is %d", p->holdtime); |
| 7411 | vty_out (vty, ", keepalive interval is %d seconds%s", |
| 7412 | p->keepalive, VTY_NEWLINE); |
| 7413 | } |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7414 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7415 | /* Capability. */ |
| 7416 | if (p->status == Established) |
| 7417 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7418 | if (p->cap |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7419 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
| 7420 | || p->afc_recv[AFI_IP][SAFI_UNICAST] |
| 7421 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] |
| 7422 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] |
| 7423 | #ifdef HAVE_IPV6 |
| 7424 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] |
| 7425 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] |
| 7426 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] |
| 7427 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] |
| 7428 | #endif /* HAVE_IPV6 */ |
| 7429 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] |
| 7430 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) |
| 7431 | { |
| 7432 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); |
| 7433 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7434 | /* AS4 */ |
| 7435 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) |
| 7436 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) |
| 7437 | { |
| 7438 | vty_out (vty, " 4 Byte AS:"); |
| 7439 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) |
| 7440 | vty_out (vty, " advertised"); |
| 7441 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) |
| 7442 | vty_out (vty, " %sreceived", |
| 7443 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); |
| 7444 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7445 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7446 | /* Dynamic */ |
| 7447 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) |
| 7448 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7449 | { |
| 7450 | vty_out (vty, " Dynamic:"); |
| 7451 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7452 | vty_out (vty, " advertised"); |
| 7453 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7454 | vty_out (vty, " %sreceived", |
| 7455 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7456 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7457 | } |
| 7458 | |
| 7459 | /* Route Refresh */ |
| 7460 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) |
| 7461 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7462 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
| 7463 | { |
| 7464 | vty_out (vty, " Route refresh:"); |
| 7465 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) |
| 7466 | vty_out (vty, " advertised"); |
| 7467 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7468 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7469 | vty_out (vty, " %sreceived(%s)", |
| 7470 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", |
| 7471 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) |
| 7472 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? |
| 7473 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); |
| 7474 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7475 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7476 | } |
| 7477 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7478 | /* Multiprotocol Extensions */ |
| 7479 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7480 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7481 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7482 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7483 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
| 7484 | if (p->afc_adv[afi][safi]) |
| 7485 | vty_out (vty, " advertised"); |
| 7486 | if (p->afc_recv[afi][safi]) |
| 7487 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); |
| 7488 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7489 | } |
| 7490 | |
| 7491 | /* Gracefull Restart */ |
| 7492 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7493 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7494 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7495 | vty_out (vty, " Graceful Restart Capabilty:"); |
| 7496 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7497 | vty_out (vty, " advertised"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7498 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
| 7499 | vty_out (vty, " %sreceived", |
| 7500 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7501 | vty_out (vty, "%s", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7502 | |
| 7503 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7504 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7505 | int restart_af_count = 0; |
| 7506 | |
| 7507 | vty_out (vty, " Remote Restart timer is %d seconds%s", |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7508 | p->v_gr_restart, VTY_NEWLINE); |
| 7509 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7510 | |
| 7511 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7512 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7513 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) |
| 7514 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7515 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
| 7516 | afi_safi_print (afi, safi), |
| 7517 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? |
| 7518 | "preserved" : "not preserved"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7519 | restart_af_count++; |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7520 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7521 | if (! restart_af_count) |
| 7522 | vty_out (vty, "none"); |
| 7523 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7524 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7525 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7526 | } |
| 7527 | } |
| 7528 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7529 | /* graceful restart information */ |
| 7530 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7531 | || p->t_gr_restart |
| 7532 | || p->t_gr_stale) |
| 7533 | { |
| 7534 | int eor_send_af_count = 0; |
| 7535 | int eor_receive_af_count = 0; |
| 7536 | |
| 7537 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); |
| 7538 | if (p->status == Established) |
| 7539 | { |
| 7540 | vty_out (vty, " End-of-RIB send: "); |
| 7541 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7542 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7543 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) |
| 7544 | { |
| 7545 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", |
| 7546 | afi_safi_print (afi, safi)); |
| 7547 | eor_send_af_count++; |
| 7548 | } |
| 7549 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7550 | |
| 7551 | vty_out (vty, " End-of-RIB received: "); |
| 7552 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7553 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7554 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) |
| 7555 | { |
| 7556 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", |
| 7557 | afi_safi_print (afi, safi)); |
| 7558 | eor_receive_af_count++; |
| 7559 | } |
| 7560 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7561 | } |
| 7562 | |
| 7563 | if (p->t_gr_restart) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7564 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
| 7565 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); |
| 7566 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7567 | if (p->t_gr_stale) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7568 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
| 7569 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7570 | } |
| 7571 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7572 | /* Packet counts. */ |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7573 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
| 7574 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7575 | 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] | 7576 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
| 7577 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); |
| 7578 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); |
| 7579 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); |
| 7580 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); |
| 7581 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); |
| 7582 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); |
| 7583 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + |
| 7584 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, |
| 7585 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + |
| 7586 | p->dynamic_cap_in, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7587 | |
| 7588 | /* advertisement-interval */ |
| 7589 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", |
| 7590 | p->v_routeadv, VTY_NEWLINE); |
| 7591 | |
| 7592 | /* Update-source. */ |
| 7593 | if (p->update_if || p->update_source) |
| 7594 | { |
| 7595 | vty_out (vty, " Update source is "); |
| 7596 | if (p->update_if) |
| 7597 | vty_out (vty, "%s", p->update_if); |
| 7598 | else if (p->update_source) |
| 7599 | vty_out (vty, "%s", |
| 7600 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); |
| 7601 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7602 | } |
| 7603 | |
| 7604 | /* Default weight */ |
| 7605 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) |
| 7606 | vty_out (vty, " Default weight %d%s", p->weight, |
| 7607 | VTY_NEWLINE); |
| 7608 | |
| 7609 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7610 | |
| 7611 | /* Address Family Information */ |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7612 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7613 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7614 | if (p->afc[afi][safi]) |
| 7615 | bgp_show_peer_afi (vty, p, afi, safi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7616 | |
| 7617 | vty_out (vty, " Connections established %d; dropped %d%s", |
| 7618 | p->established, p->dropped, |
| 7619 | VTY_NEWLINE); |
| 7620 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7621 | if (! p->dropped) |
| 7622 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); |
| 7623 | else |
| 7624 | vty_out (vty, " Last reset %s, due to %s%s", |
| 7625 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), |
| 7626 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 7627 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7628 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7629 | { |
| 7630 | 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] | 7631 | |
| 7632 | if (p->t_pmax_restart) |
| 7633 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", |
| 7634 | p->host, thread_timer_remain_second (p->t_pmax_restart), |
| 7635 | VTY_NEWLINE); |
| 7636 | else |
| 7637 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", |
| 7638 | p->host, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7639 | } |
| 7640 | |
Stephen Hemminger | f5a4827 | 2011-03-24 17:30:21 +0000 | [diff] [blame] | 7641 | /* EBGP Multihop and GTSM */ |
| 7642 | if (peer_sort (p) != BGP_PEER_IBGP) |
| 7643 | { |
| 7644 | if (p->gtsm_hops > 0) |
| 7645 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 7646 | p->gtsm_hops, VTY_NEWLINE); |
| 7647 | else if (p->ttl > 1) |
| 7648 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 7649 | p->ttl, VTY_NEWLINE); |
| 7650 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7651 | |
| 7652 | /* Local address. */ |
| 7653 | if (p->su_local) |
| 7654 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7655 | vty_out (vty, "Local host: %s, Local port: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7656 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
| 7657 | ntohs (p->su_local->sin.sin_port), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7658 | VTY_NEWLINE); |
| 7659 | } |
| 7660 | |
| 7661 | /* Remote address. */ |
| 7662 | if (p->su_remote) |
| 7663 | { |
| 7664 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", |
| 7665 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
| 7666 | ntohs (p->su_remote->sin.sin_port), |
| 7667 | VTY_NEWLINE); |
| 7668 | } |
| 7669 | |
| 7670 | /* Nexthop display. */ |
| 7671 | if (p->su_local) |
| 7672 | { |
| 7673 | vty_out (vty, "Nexthop: %s%s", |
| 7674 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), |
| 7675 | VTY_NEWLINE); |
| 7676 | #ifdef HAVE_IPV6 |
| 7677 | vty_out (vty, "Nexthop global: %s%s", |
| 7678 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), |
| 7679 | VTY_NEWLINE); |
| 7680 | vty_out (vty, "Nexthop local: %s%s", |
| 7681 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), |
| 7682 | VTY_NEWLINE); |
| 7683 | vty_out (vty, "BGP connection: %s%s", |
| 7684 | p->shared_network ? "shared network" : "non shared network", |
| 7685 | VTY_NEWLINE); |
| 7686 | #endif /* HAVE_IPV6 */ |
| 7687 | } |
| 7688 | |
| 7689 | /* Timer information. */ |
| 7690 | if (p->t_start) |
| 7691 | vty_out (vty, "Next start timer due in %ld seconds%s", |
| 7692 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); |
| 7693 | if (p->t_connect) |
| 7694 | vty_out (vty, "Next connect timer due in %ld seconds%s", |
| 7695 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); |
| 7696 | |
| 7697 | vty_out (vty, "Read thread: %s Write thread: %s%s", |
| 7698 | p->t_read ? "on" : "off", |
| 7699 | p->t_write ? "on" : "off", |
| 7700 | VTY_NEWLINE); |
| 7701 | |
| 7702 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR |
| 7703 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) |
| 7704 | bgp_capability_vty_out (vty, p); |
| 7705 | |
| 7706 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7707 | } |
| 7708 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7709 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7710 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
| 7711 | enum show_type type, union sockunion *su) |
| 7712 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7713 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7714 | struct peer *peer; |
| 7715 | int find = 0; |
| 7716 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7717 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7718 | { |
| 7719 | switch (type) |
| 7720 | { |
| 7721 | case show_all: |
| 7722 | bgp_show_peer (vty, peer); |
| 7723 | break; |
| 7724 | case show_peer: |
| 7725 | if (sockunion_same (&peer->su, su)) |
| 7726 | { |
| 7727 | find = 1; |
| 7728 | bgp_show_peer (vty, peer); |
| 7729 | } |
| 7730 | break; |
| 7731 | } |
| 7732 | } |
| 7733 | |
| 7734 | if (type == show_peer && ! find) |
| 7735 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); |
| 7736 | |
| 7737 | return CMD_SUCCESS; |
| 7738 | } |
| 7739 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7740 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7741 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
| 7742 | enum show_type type, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7743 | { |
| 7744 | int ret; |
| 7745 | struct bgp *bgp; |
| 7746 | union sockunion su; |
| 7747 | |
| 7748 | if (ip_str) |
| 7749 | { |
| 7750 | ret = str2sockunion (ip_str, &su); |
| 7751 | if (ret < 0) |
| 7752 | { |
| 7753 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 7754 | return CMD_WARNING; |
| 7755 | } |
| 7756 | } |
| 7757 | |
| 7758 | if (name) |
| 7759 | { |
| 7760 | bgp = bgp_lookup_by_name (name); |
| 7761 | |
| 7762 | if (! bgp) |
| 7763 | { |
| 7764 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7765 | return CMD_WARNING; |
| 7766 | } |
| 7767 | |
| 7768 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7769 | |
| 7770 | return CMD_SUCCESS; |
| 7771 | } |
| 7772 | |
| 7773 | bgp = bgp_get_default (); |
| 7774 | |
| 7775 | if (bgp) |
| 7776 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7777 | |
| 7778 | return CMD_SUCCESS; |
| 7779 | } |
| 7780 | |
| 7781 | /* "show ip bgp neighbors" commands. */ |
| 7782 | DEFUN (show_ip_bgp_neighbors, |
| 7783 | show_ip_bgp_neighbors_cmd, |
| 7784 | "show ip bgp neighbors", |
| 7785 | SHOW_STR |
| 7786 | IP_STR |
| 7787 | BGP_STR |
| 7788 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7789 | { |
| 7790 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); |
| 7791 | } |
| 7792 | |
| 7793 | ALIAS (show_ip_bgp_neighbors, |
| 7794 | show_ip_bgp_ipv4_neighbors_cmd, |
| 7795 | "show ip bgp ipv4 (unicast|multicast) neighbors", |
| 7796 | SHOW_STR |
| 7797 | IP_STR |
| 7798 | BGP_STR |
| 7799 | "Address family\n" |
| 7800 | "Address Family modifier\n" |
| 7801 | "Address Family modifier\n" |
| 7802 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7803 | |
| 7804 | ALIAS (show_ip_bgp_neighbors, |
| 7805 | show_ip_bgp_vpnv4_all_neighbors_cmd, |
| 7806 | "show ip bgp vpnv4 all neighbors", |
| 7807 | SHOW_STR |
| 7808 | IP_STR |
| 7809 | BGP_STR |
| 7810 | "Display VPNv4 NLRI specific information\n" |
| 7811 | "Display information about all VPNv4 NLRIs\n" |
| 7812 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7813 | |
| 7814 | ALIAS (show_ip_bgp_neighbors, |
| 7815 | show_ip_bgp_vpnv4_rd_neighbors_cmd, |
| 7816 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", |
| 7817 | SHOW_STR |
| 7818 | IP_STR |
| 7819 | BGP_STR |
| 7820 | "Display VPNv4 NLRI specific information\n" |
| 7821 | "Display information for a route distinguisher\n" |
| 7822 | "VPN Route Distinguisher\n" |
| 7823 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7824 | |
| 7825 | ALIAS (show_ip_bgp_neighbors, |
| 7826 | show_bgp_neighbors_cmd, |
| 7827 | "show bgp neighbors", |
| 7828 | SHOW_STR |
| 7829 | BGP_STR |
| 7830 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7831 | |
| 7832 | ALIAS (show_ip_bgp_neighbors, |
| 7833 | show_bgp_ipv6_neighbors_cmd, |
| 7834 | "show bgp ipv6 neighbors", |
| 7835 | SHOW_STR |
| 7836 | BGP_STR |
| 7837 | "Address family\n" |
| 7838 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7839 | |
| 7840 | DEFUN (show_ip_bgp_neighbors_peer, |
| 7841 | show_ip_bgp_neighbors_peer_cmd, |
| 7842 | "show ip bgp neighbors (A.B.C.D|X:X::X:X)", |
| 7843 | SHOW_STR |
| 7844 | IP_STR |
| 7845 | BGP_STR |
| 7846 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7847 | "Neighbor to display information about\n" |
| 7848 | "Neighbor to display information about\n") |
| 7849 | { |
| 7850 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); |
| 7851 | } |
| 7852 | |
| 7853 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7854 | show_ip_bgp_ipv4_neighbors_peer_cmd, |
| 7855 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)", |
| 7856 | SHOW_STR |
| 7857 | IP_STR |
| 7858 | BGP_STR |
| 7859 | "Address family\n" |
| 7860 | "Address Family modifier\n" |
| 7861 | "Address Family modifier\n" |
| 7862 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7863 | "Neighbor to display information about\n" |
| 7864 | "Neighbor to display information about\n") |
| 7865 | |
| 7866 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7867 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, |
| 7868 | "show ip bgp vpnv4 all neighbors A.B.C.D", |
| 7869 | SHOW_STR |
| 7870 | IP_STR |
| 7871 | BGP_STR |
| 7872 | "Display VPNv4 NLRI specific information\n" |
| 7873 | "Display information about all VPNv4 NLRIs\n" |
| 7874 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7875 | "Neighbor to display information about\n") |
| 7876 | |
| 7877 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7878 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, |
| 7879 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", |
| 7880 | SHOW_STR |
| 7881 | IP_STR |
| 7882 | BGP_STR |
| 7883 | "Display VPNv4 NLRI specific information\n" |
| 7884 | "Display information about all VPNv4 NLRIs\n" |
| 7885 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7886 | "Neighbor to display information about\n") |
| 7887 | |
| 7888 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7889 | show_bgp_neighbors_peer_cmd, |
| 7890 | "show bgp neighbors (A.B.C.D|X:X::X:X)", |
| 7891 | SHOW_STR |
| 7892 | BGP_STR |
| 7893 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7894 | "Neighbor to display information about\n" |
| 7895 | "Neighbor to display information about\n") |
| 7896 | |
| 7897 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7898 | show_bgp_ipv6_neighbors_peer_cmd, |
| 7899 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 7900 | SHOW_STR |
| 7901 | BGP_STR |
| 7902 | "Address family\n" |
| 7903 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7904 | "Neighbor to display information about\n" |
| 7905 | "Neighbor to display information about\n") |
| 7906 | |
| 7907 | DEFUN (show_ip_bgp_instance_neighbors, |
| 7908 | show_ip_bgp_instance_neighbors_cmd, |
| 7909 | "show ip bgp view WORD neighbors", |
| 7910 | SHOW_STR |
| 7911 | IP_STR |
| 7912 | BGP_STR |
| 7913 | "BGP view\n" |
| 7914 | "View name\n" |
| 7915 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7916 | { |
| 7917 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); |
| 7918 | } |
| 7919 | |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 7920 | ALIAS (show_ip_bgp_instance_neighbors, |
| 7921 | show_bgp_instance_neighbors_cmd, |
| 7922 | "show bgp view WORD neighbors", |
| 7923 | SHOW_STR |
| 7924 | BGP_STR |
| 7925 | "BGP view\n" |
| 7926 | "View name\n" |
| 7927 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7928 | |
| 7929 | ALIAS (show_ip_bgp_instance_neighbors, |
| 7930 | show_bgp_instance_ipv6_neighbors_cmd, |
| 7931 | "show bgp view WORD ipv6 neighbors", |
| 7932 | SHOW_STR |
| 7933 | BGP_STR |
| 7934 | "BGP view\n" |
| 7935 | "View name\n" |
| 7936 | "Address family\n" |
| 7937 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7938 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7939 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
| 7940 | show_ip_bgp_instance_neighbors_peer_cmd, |
| 7941 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 7942 | SHOW_STR |
| 7943 | IP_STR |
| 7944 | BGP_STR |
| 7945 | "BGP view\n" |
| 7946 | "View name\n" |
| 7947 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7948 | "Neighbor to display information about\n" |
| 7949 | "Neighbor to display information about\n") |
| 7950 | { |
| 7951 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); |
| 7952 | } |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 7953 | |
| 7954 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 7955 | show_bgp_instance_neighbors_peer_cmd, |
| 7956 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 7957 | SHOW_STR |
| 7958 | BGP_STR |
| 7959 | "BGP view\n" |
| 7960 | "View name\n" |
| 7961 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7962 | "Neighbor to display information about\n" |
| 7963 | "Neighbor to display information about\n") |
| 7964 | |
| 7965 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 7966 | show_bgp_instance_ipv6_neighbors_peer_cmd, |
| 7967 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 7968 | SHOW_STR |
| 7969 | BGP_STR |
| 7970 | "BGP view\n" |
| 7971 | "View name\n" |
| 7972 | "Address family\n" |
| 7973 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7974 | "Neighbor to display information about\n" |
| 7975 | "Neighbor to display information about\n") |
| 7976 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7977 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
| 7978 | paths' and `show ip mbgp paths'. Those functions results are the |
| 7979 | same.*/ |
| 7980 | DEFUN (show_ip_bgp_paths, |
| 7981 | show_ip_bgp_paths_cmd, |
| 7982 | "show ip bgp paths", |
| 7983 | SHOW_STR |
| 7984 | IP_STR |
| 7985 | BGP_STR |
| 7986 | "Path information\n") |
| 7987 | { |
| 7988 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); |
| 7989 | aspath_print_all_vty (vty); |
| 7990 | return CMD_SUCCESS; |
| 7991 | } |
| 7992 | |
| 7993 | DEFUN (show_ip_bgp_ipv4_paths, |
| 7994 | show_ip_bgp_ipv4_paths_cmd, |
| 7995 | "show ip bgp ipv4 (unicast|multicast) paths", |
| 7996 | SHOW_STR |
| 7997 | IP_STR |
| 7998 | BGP_STR |
| 7999 | "Address family\n" |
| 8000 | "Address Family modifier\n" |
| 8001 | "Address Family modifier\n" |
| 8002 | "Path information\n") |
| 8003 | { |
| 8004 | vty_out (vty, "Address Refcnt Path\r\n"); |
| 8005 | aspath_print_all_vty (vty); |
| 8006 | |
| 8007 | return CMD_SUCCESS; |
| 8008 | } |
| 8009 | |
| 8010 | #include "hash.h" |
| 8011 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8012 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8013 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
| 8014 | { |
| 8015 | struct community *com; |
| 8016 | |
| 8017 | com = (struct community *) backet->data; |
| 8018 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, |
| 8019 | community_str (com), VTY_NEWLINE); |
| 8020 | } |
| 8021 | |
| 8022 | /* Show BGP's community internal data. */ |
| 8023 | DEFUN (show_ip_bgp_community_info, |
| 8024 | show_ip_bgp_community_info_cmd, |
| 8025 | "show ip bgp community-info", |
| 8026 | SHOW_STR |
| 8027 | IP_STR |
| 8028 | BGP_STR |
| 8029 | "List all bgp community information\n") |
| 8030 | { |
| 8031 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); |
| 8032 | |
| 8033 | hash_iterate (community_hash (), |
| 8034 | (void (*) (struct hash_backet *, void *)) |
| 8035 | community_show_all_iterator, |
| 8036 | vty); |
| 8037 | |
| 8038 | return CMD_SUCCESS; |
| 8039 | } |
| 8040 | |
| 8041 | DEFUN (show_ip_bgp_attr_info, |
| 8042 | show_ip_bgp_attr_info_cmd, |
| 8043 | "show ip bgp attribute-info", |
| 8044 | SHOW_STR |
| 8045 | IP_STR |
| 8046 | BGP_STR |
| 8047 | "List all bgp attribute information\n") |
| 8048 | { |
| 8049 | attr_show_all (vty); |
| 8050 | return CMD_SUCCESS; |
| 8051 | } |
| 8052 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8053 | static int |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8054 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
| 8055 | afi_t afi, safi_t safi) |
| 8056 | { |
| 8057 | char timebuf[BGP_UPTIME_LEN]; |
| 8058 | char rmbuf[14]; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8059 | const char *rmname; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8060 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8061 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8062 | int len; |
| 8063 | int count = 0; |
| 8064 | |
| 8065 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) |
| 8066 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8067 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8068 | { |
| 8069 | count++; |
| 8070 | bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 8071 | } |
| 8072 | return count; |
| 8073 | } |
| 8074 | |
| 8075 | len = vty_out (vty, "%s", rsclient->host); |
| 8076 | len = 16 - len; |
| 8077 | |
| 8078 | if (len < 1) |
| 8079 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 8080 | else |
| 8081 | vty_out (vty, "%*s", len, " "); |
| 8082 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 8083 | vty_out (vty, "4 "); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8084 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 8085 | vty_out (vty, "%11d ", rsclient->as); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8086 | |
| 8087 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); |
| 8088 | if ( rmname && strlen (rmname) > 13 ) |
| 8089 | { |
| 8090 | sprintf (rmbuf, "%13s", "..."); |
| 8091 | rmname = strncpy (rmbuf, rmname, 10); |
| 8092 | } |
| 8093 | else if (! rmname) |
| 8094 | rmname = "<none>"; |
| 8095 | vty_out (vty, " %13s ", rmname); |
| 8096 | |
| 8097 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); |
| 8098 | if ( rmname && strlen (rmname) > 13 ) |
| 8099 | { |
| 8100 | sprintf (rmbuf, "%13s", "..."); |
| 8101 | rmname = strncpy (rmbuf, rmname, 10); |
| 8102 | } |
| 8103 | else if (! rmname) |
| 8104 | rmname = "<none>"; |
| 8105 | vty_out (vty, " %13s ", rmname); |
| 8106 | |
| 8107 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); |
| 8108 | |
| 8109 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) |
| 8110 | vty_out (vty, " Idle (Admin)"); |
| 8111 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 8112 | vty_out (vty, " Idle (PfxCt)"); |
| 8113 | else |
| 8114 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); |
| 8115 | |
| 8116 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8117 | |
| 8118 | return 1; |
| 8119 | } |
| 8120 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8121 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8122 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
| 8123 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8124 | { |
| 8125 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8126 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8127 | int count = 0; |
| 8128 | |
| 8129 | /* Header string for each address family. */ |
| 8130 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; |
| 8131 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8132 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8133 | { |
| 8134 | if (peer->afc[afi][safi] && |
| 8135 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 8136 | { |
| 8137 | if (! count) |
| 8138 | { |
| 8139 | vty_out (vty, |
| 8140 | "Route Server's BGP router identifier %s%s", |
| 8141 | inet_ntoa (bgp->router_id), VTY_NEWLINE); |
| 8142 | vty_out (vty, |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 8143 | "Route Server's local AS number %u%s", bgp->as, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8144 | VTY_NEWLINE); |
| 8145 | |
| 8146 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8147 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 8148 | } |
| 8149 | |
| 8150 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 8151 | } |
| 8152 | } |
| 8153 | |
| 8154 | if (count) |
| 8155 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, |
| 8156 | count, VTY_NEWLINE); |
| 8157 | else |
| 8158 | vty_out (vty, "No %s Route Server Client is configured%s", |
| 8159 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 8160 | |
| 8161 | return CMD_SUCCESS; |
| 8162 | } |
| 8163 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8164 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8165 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
| 8166 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8167 | { |
| 8168 | struct bgp *bgp; |
| 8169 | |
| 8170 | if (name) |
| 8171 | { |
| 8172 | bgp = bgp_lookup_by_name (name); |
| 8173 | |
| 8174 | if (! bgp) |
| 8175 | { |
| 8176 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 8177 | return CMD_WARNING; |
| 8178 | } |
| 8179 | |
| 8180 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 8181 | return CMD_SUCCESS; |
| 8182 | } |
| 8183 | |
| 8184 | bgp = bgp_get_default (); |
| 8185 | |
| 8186 | if (bgp) |
| 8187 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 8188 | |
| 8189 | return CMD_SUCCESS; |
| 8190 | } |
| 8191 | |
| 8192 | /* 'show bgp rsclient' commands. */ |
| 8193 | DEFUN (show_ip_bgp_rsclient_summary, |
| 8194 | show_ip_bgp_rsclient_summary_cmd, |
| 8195 | "show ip bgp rsclient summary", |
| 8196 | SHOW_STR |
| 8197 | IP_STR |
| 8198 | BGP_STR |
| 8199 | "Information about Route Server Clients\n" |
| 8200 | "Summary of all Route Server Clients\n") |
| 8201 | { |
| 8202 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 8203 | } |
| 8204 | |
| 8205 | DEFUN (show_ip_bgp_instance_rsclient_summary, |
| 8206 | show_ip_bgp_instance_rsclient_summary_cmd, |
| 8207 | "show ip bgp view WORD rsclient summary", |
| 8208 | SHOW_STR |
| 8209 | IP_STR |
| 8210 | BGP_STR |
| 8211 | "BGP view\n" |
| 8212 | "View name\n" |
| 8213 | "Information about Route Server Clients\n" |
| 8214 | "Summary of all Route Server Clients\n") |
| 8215 | { |
| 8216 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 8217 | } |
| 8218 | |
| 8219 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, |
| 8220 | show_ip_bgp_ipv4_rsclient_summary_cmd, |
| 8221 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", |
| 8222 | SHOW_STR |
| 8223 | IP_STR |
| 8224 | BGP_STR |
| 8225 | "Address family\n" |
| 8226 | "Address Family modifier\n" |
| 8227 | "Address Family modifier\n" |
| 8228 | "Information about Route Server Clients\n" |
| 8229 | "Summary of all Route Server Clients\n") |
| 8230 | { |
| 8231 | if (strncmp (argv[0], "m", 1) == 0) |
| 8232 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 8233 | |
| 8234 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 8235 | } |
| 8236 | |
| 8237 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, |
| 8238 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, |
| 8239 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 8240 | SHOW_STR |
| 8241 | IP_STR |
| 8242 | BGP_STR |
| 8243 | "BGP view\n" |
| 8244 | "View name\n" |
| 8245 | "Address family\n" |
| 8246 | "Address Family modifier\n" |
| 8247 | "Address Family modifier\n" |
| 8248 | "Information about Route Server Clients\n" |
| 8249 | "Summary of all Route Server Clients\n") |
| 8250 | { |
| 8251 | if (strncmp (argv[1], "m", 1) == 0) |
| 8252 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 8253 | |
| 8254 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 8255 | } |
| 8256 | |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 8257 | DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary, |
| 8258 | show_bgp_instance_ipv4_safi_rsclient_summary_cmd, |
| 8259 | "show bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 8260 | SHOW_STR |
| 8261 | BGP_STR |
| 8262 | "BGP view\n" |
| 8263 | "View name\n" |
| 8264 | "Address family\n" |
| 8265 | "Address Family modifier\n" |
| 8266 | "Address Family modifier\n" |
| 8267 | "Information about Route Server Clients\n" |
| 8268 | "Summary of all Route Server Clients\n") |
| 8269 | { |
| 8270 | safi_t safi; |
| 8271 | |
| 8272 | if (argc == 2) { |
| 8273 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8274 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi); |
| 8275 | } else { |
| 8276 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8277 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi); |
| 8278 | } |
| 8279 | } |
| 8280 | |
| 8281 | ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary, |
| 8282 | show_bgp_ipv4_safi_rsclient_summary_cmd, |
| 8283 | "show bgp ipv4 (unicast|multicast) rsclient summary", |
| 8284 | SHOW_STR |
| 8285 | BGP_STR |
| 8286 | "Address family\n" |
| 8287 | "Address Family modifier\n" |
| 8288 | "Address Family modifier\n" |
| 8289 | "Information about Route Server Clients\n" |
| 8290 | "Summary of all Route Server Clients\n") |
| 8291 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8292 | #ifdef HAVE_IPV6 |
| 8293 | DEFUN (show_bgp_rsclient_summary, |
| 8294 | show_bgp_rsclient_summary_cmd, |
| 8295 | "show bgp rsclient summary", |
| 8296 | SHOW_STR |
| 8297 | BGP_STR |
| 8298 | "Information about Route Server Clients\n" |
| 8299 | "Summary of all Route Server Clients\n") |
| 8300 | { |
| 8301 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 8302 | } |
| 8303 | |
| 8304 | DEFUN (show_bgp_instance_rsclient_summary, |
| 8305 | show_bgp_instance_rsclient_summary_cmd, |
| 8306 | "show bgp view WORD rsclient summary", |
| 8307 | SHOW_STR |
| 8308 | BGP_STR |
| 8309 | "BGP view\n" |
| 8310 | "View name\n" |
| 8311 | "Information about Route Server Clients\n" |
| 8312 | "Summary of all Route Server Clients\n") |
| 8313 | { |
| 8314 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 8315 | } |
| 8316 | |
| 8317 | ALIAS (show_bgp_rsclient_summary, |
| 8318 | show_bgp_ipv6_rsclient_summary_cmd, |
| 8319 | "show bgp ipv6 rsclient summary", |
| 8320 | SHOW_STR |
| 8321 | BGP_STR |
| 8322 | "Address family\n" |
| 8323 | "Information about Route Server Clients\n" |
| 8324 | "Summary of all Route Server Clients\n") |
| 8325 | |
| 8326 | ALIAS (show_bgp_instance_rsclient_summary, |
| 8327 | show_bgp_instance_ipv6_rsclient_summary_cmd, |
| 8328 | "show bgp view WORD ipv6 rsclient summary", |
| 8329 | SHOW_STR |
| 8330 | BGP_STR |
| 8331 | "BGP view\n" |
| 8332 | "View name\n" |
| 8333 | "Address family\n" |
| 8334 | "Information about Route Server Clients\n" |
| 8335 | "Summary of all Route Server Clients\n") |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 8336 | |
| 8337 | DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary, |
| 8338 | show_bgp_instance_ipv6_safi_rsclient_summary_cmd, |
| 8339 | "show bgp view WORD ipv6 (unicast|multicast) rsclient summary", |
| 8340 | SHOW_STR |
| 8341 | BGP_STR |
| 8342 | "BGP view\n" |
| 8343 | "View name\n" |
| 8344 | "Address family\n" |
| 8345 | "Address Family modifier\n" |
| 8346 | "Address Family modifier\n" |
| 8347 | "Information about Route Server Clients\n" |
| 8348 | "Summary of all Route Server Clients\n") |
| 8349 | { |
| 8350 | safi_t safi; |
| 8351 | |
| 8352 | if (argc == 2) { |
| 8353 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8354 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi); |
| 8355 | } else { |
| 8356 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; |
| 8357 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi); |
| 8358 | } |
| 8359 | } |
| 8360 | |
| 8361 | ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary, |
| 8362 | show_bgp_ipv6_safi_rsclient_summary_cmd, |
| 8363 | "show bgp ipv6 (unicast|multicast) rsclient summary", |
| 8364 | SHOW_STR |
| 8365 | BGP_STR |
| 8366 | "Address family\n" |
| 8367 | "Address Family modifier\n" |
| 8368 | "Address Family modifier\n" |
| 8369 | "Information about Route Server Clients\n" |
| 8370 | "Summary of all Route Server Clients\n") |
| 8371 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8372 | #endif /* HAVE IPV6 */ |
| 8373 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8374 | /* Redistribute VTY commands. */ |
| 8375 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8376 | DEFUN (bgp_redistribute_ipv4, |
| 8377 | bgp_redistribute_ipv4_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8378 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8379 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8380 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8381 | { |
| 8382 | int type; |
| 8383 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8384 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8385 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8386 | { |
| 8387 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8388 | return CMD_WARNING; |
| 8389 | } |
| 8390 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8391 | } |
| 8392 | |
| 8393 | DEFUN (bgp_redistribute_ipv4_rmap, |
| 8394 | bgp_redistribute_ipv4_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8395 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8396 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8397 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8398 | "Route map reference\n" |
| 8399 | "Pointer to route-map entries\n") |
| 8400 | { |
| 8401 | int type; |
| 8402 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8403 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8404 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8405 | { |
| 8406 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8407 | return CMD_WARNING; |
| 8408 | } |
| 8409 | |
| 8410 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8411 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8412 | } |
| 8413 | |
| 8414 | DEFUN (bgp_redistribute_ipv4_metric, |
| 8415 | bgp_redistribute_ipv4_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8416 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8417 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8418 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8419 | "Metric for redistributed routes\n" |
| 8420 | "Default metric\n") |
| 8421 | { |
| 8422 | int type; |
| 8423 | u_int32_t metric; |
| 8424 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8425 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8426 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8427 | { |
| 8428 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8429 | return CMD_WARNING; |
| 8430 | } |
| 8431 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8432 | |
| 8433 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8434 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8435 | } |
| 8436 | |
| 8437 | DEFUN (bgp_redistribute_ipv4_rmap_metric, |
| 8438 | bgp_redistribute_ipv4_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8439 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8440 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8441 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8442 | "Route map reference\n" |
| 8443 | "Pointer to route-map entries\n" |
| 8444 | "Metric for redistributed routes\n" |
| 8445 | "Default metric\n") |
| 8446 | { |
| 8447 | int type; |
| 8448 | u_int32_t metric; |
| 8449 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8450 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8451 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8452 | { |
| 8453 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8454 | return CMD_WARNING; |
| 8455 | } |
| 8456 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8457 | |
| 8458 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8459 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8460 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8461 | } |
| 8462 | |
| 8463 | DEFUN (bgp_redistribute_ipv4_metric_rmap, |
| 8464 | bgp_redistribute_ipv4_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8465 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8466 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8467 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8468 | "Metric for redistributed routes\n" |
| 8469 | "Default metric\n" |
| 8470 | "Route map reference\n" |
| 8471 | "Pointer to route-map entries\n") |
| 8472 | { |
| 8473 | int type; |
| 8474 | u_int32_t metric; |
| 8475 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8476 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8477 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8478 | { |
| 8479 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8480 | return CMD_WARNING; |
| 8481 | } |
| 8482 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8483 | |
| 8484 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8485 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); |
| 8486 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8487 | } |
| 8488 | |
| 8489 | DEFUN (no_bgp_redistribute_ipv4, |
| 8490 | no_bgp_redistribute_ipv4_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8491 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8492 | NO_STR |
| 8493 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8494 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8495 | { |
| 8496 | int type; |
| 8497 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8498 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8499 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8500 | { |
| 8501 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8502 | return CMD_WARNING; |
| 8503 | } |
| 8504 | |
| 8505 | return bgp_redistribute_unset (vty->index, AFI_IP, type); |
| 8506 | } |
| 8507 | |
| 8508 | DEFUN (no_bgp_redistribute_ipv4_rmap, |
| 8509 | no_bgp_redistribute_ipv4_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8510 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8511 | NO_STR |
| 8512 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8513 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8514 | "Route map reference\n" |
| 8515 | "Pointer to route-map entries\n") |
| 8516 | { |
| 8517 | int type; |
| 8518 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8519 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8520 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8521 | { |
| 8522 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8523 | return CMD_WARNING; |
| 8524 | } |
| 8525 | |
| 8526 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8527 | return CMD_SUCCESS; |
| 8528 | } |
| 8529 | |
| 8530 | DEFUN (no_bgp_redistribute_ipv4_metric, |
| 8531 | no_bgp_redistribute_ipv4_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8532 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8533 | NO_STR |
| 8534 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8535 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8536 | "Metric for redistributed routes\n" |
| 8537 | "Default metric\n") |
| 8538 | { |
| 8539 | int type; |
| 8540 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8541 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8542 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8543 | { |
| 8544 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8545 | return CMD_WARNING; |
| 8546 | } |
| 8547 | |
| 8548 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8549 | return CMD_SUCCESS; |
| 8550 | } |
| 8551 | |
| 8552 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, |
| 8553 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8554 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8555 | NO_STR |
| 8556 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8557 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8558 | "Route map reference\n" |
| 8559 | "Pointer to route-map entries\n" |
| 8560 | "Metric for redistributed routes\n" |
| 8561 | "Default metric\n") |
| 8562 | { |
| 8563 | int type; |
| 8564 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8565 | type = proto_redistnum (AFI_IP, argv[0]); |
| 8566 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8567 | { |
| 8568 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8569 | return CMD_WARNING; |
| 8570 | } |
| 8571 | |
| 8572 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8573 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8574 | return CMD_SUCCESS; |
| 8575 | } |
| 8576 | |
| 8577 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, |
| 8578 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8579 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8580 | NO_STR |
| 8581 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8582 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8583 | "Metric for redistributed routes\n" |
| 8584 | "Default metric\n" |
| 8585 | "Route map reference\n" |
| 8586 | "Pointer to route-map entries\n") |
| 8587 | |
| 8588 | #ifdef HAVE_IPV6 |
| 8589 | DEFUN (bgp_redistribute_ipv6, |
| 8590 | bgp_redistribute_ipv6_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8591 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8592 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8593 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8594 | { |
| 8595 | int type; |
| 8596 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8597 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8598 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8599 | { |
| 8600 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8601 | return CMD_WARNING; |
| 8602 | } |
| 8603 | |
| 8604 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8605 | } |
| 8606 | |
| 8607 | DEFUN (bgp_redistribute_ipv6_rmap, |
| 8608 | bgp_redistribute_ipv6_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8609 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8610 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8611 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8612 | "Route map reference\n" |
| 8613 | "Pointer to route-map entries\n") |
| 8614 | { |
| 8615 | int type; |
| 8616 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8617 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8618 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8619 | { |
| 8620 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8621 | return CMD_WARNING; |
| 8622 | } |
| 8623 | |
| 8624 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8625 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8626 | } |
| 8627 | |
| 8628 | DEFUN (bgp_redistribute_ipv6_metric, |
| 8629 | bgp_redistribute_ipv6_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8630 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8631 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8632 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8633 | "Metric for redistributed routes\n" |
| 8634 | "Default metric\n") |
| 8635 | { |
| 8636 | int type; |
| 8637 | u_int32_t metric; |
| 8638 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8639 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8640 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8641 | { |
| 8642 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8643 | return CMD_WARNING; |
| 8644 | } |
| 8645 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8646 | |
| 8647 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8648 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8649 | } |
| 8650 | |
| 8651 | DEFUN (bgp_redistribute_ipv6_rmap_metric, |
| 8652 | bgp_redistribute_ipv6_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8653 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8654 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8655 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8656 | "Route map reference\n" |
| 8657 | "Pointer to route-map entries\n" |
| 8658 | "Metric for redistributed routes\n" |
| 8659 | "Default metric\n") |
| 8660 | { |
| 8661 | int type; |
| 8662 | u_int32_t metric; |
| 8663 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8664 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8665 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8666 | { |
| 8667 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8668 | return CMD_WARNING; |
| 8669 | } |
| 8670 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8671 | |
| 8672 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8673 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8674 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8675 | } |
| 8676 | |
| 8677 | DEFUN (bgp_redistribute_ipv6_metric_rmap, |
| 8678 | bgp_redistribute_ipv6_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8679 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8680 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8681 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8682 | "Metric for redistributed routes\n" |
| 8683 | "Default metric\n" |
| 8684 | "Route map reference\n" |
| 8685 | "Pointer to route-map entries\n") |
| 8686 | { |
| 8687 | int type; |
| 8688 | u_int32_t metric; |
| 8689 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8690 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8691 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8692 | { |
| 8693 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8694 | return CMD_WARNING; |
| 8695 | } |
| 8696 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8697 | |
| 8698 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8699 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); |
| 8700 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8701 | } |
| 8702 | |
| 8703 | DEFUN (no_bgp_redistribute_ipv6, |
| 8704 | no_bgp_redistribute_ipv6_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8705 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8706 | NO_STR |
| 8707 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8708 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8709 | { |
| 8710 | int type; |
| 8711 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8712 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8713 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8714 | { |
| 8715 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8716 | return CMD_WARNING; |
| 8717 | } |
| 8718 | |
| 8719 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); |
| 8720 | } |
| 8721 | |
| 8722 | DEFUN (no_bgp_redistribute_ipv6_rmap, |
| 8723 | no_bgp_redistribute_ipv6_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8724 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8725 | NO_STR |
| 8726 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8727 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8728 | "Route map reference\n" |
| 8729 | "Pointer to route-map entries\n") |
| 8730 | { |
| 8731 | int type; |
| 8732 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8733 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8734 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8735 | { |
| 8736 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8737 | return CMD_WARNING; |
| 8738 | } |
| 8739 | |
| 8740 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8741 | return CMD_SUCCESS; |
| 8742 | } |
| 8743 | |
| 8744 | DEFUN (no_bgp_redistribute_ipv6_metric, |
| 8745 | no_bgp_redistribute_ipv6_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8746 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8747 | NO_STR |
| 8748 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8749 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8750 | "Metric for redistributed routes\n" |
| 8751 | "Default metric\n") |
| 8752 | { |
| 8753 | int type; |
| 8754 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8755 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8756 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8757 | { |
| 8758 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8759 | return CMD_WARNING; |
| 8760 | } |
| 8761 | |
| 8762 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8763 | return CMD_SUCCESS; |
| 8764 | } |
| 8765 | |
| 8766 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, |
| 8767 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8768 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8769 | NO_STR |
| 8770 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8771 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8772 | "Route map reference\n" |
| 8773 | "Pointer to route-map entries\n" |
| 8774 | "Metric for redistributed routes\n" |
| 8775 | "Default metric\n") |
| 8776 | { |
| 8777 | int type; |
| 8778 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8779 | type = proto_redistnum (AFI_IP6, argv[0]); |
| 8780 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8781 | { |
| 8782 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8783 | return CMD_WARNING; |
| 8784 | } |
| 8785 | |
| 8786 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8787 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8788 | return CMD_SUCCESS; |
| 8789 | } |
| 8790 | |
| 8791 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, |
| 8792 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8793 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8794 | NO_STR |
| 8795 | "Redistribute information from another routing protocol\n" |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 8796 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8797 | "Metric for redistributed routes\n" |
| 8798 | "Default metric\n" |
| 8799 | "Route map reference\n" |
| 8800 | "Pointer to route-map entries\n") |
| 8801 | #endif /* HAVE_IPV6 */ |
| 8802 | |
| 8803 | int |
| 8804 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 8805 | safi_t safi, int *write) |
| 8806 | { |
| 8807 | int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8808 | |
| 8809 | /* Unicast redistribution only. */ |
| 8810 | if (safi != SAFI_UNICAST) |
| 8811 | return 0; |
| 8812 | |
| 8813 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 8814 | { |
| 8815 | /* Redistribute BGP does not make sense. */ |
| 8816 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) |
| 8817 | { |
| 8818 | /* Display "address-family" when it is not yet diplayed. */ |
| 8819 | bgp_config_write_family_header (vty, afi, safi, write); |
| 8820 | |
| 8821 | /* "redistribute" configuration. */ |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 8822 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8823 | |
| 8824 | if (bgp->redist_metric_flag[afi][i]) |
| 8825 | vty_out (vty, " metric %d", bgp->redist_metric[afi][i]); |
| 8826 | |
| 8827 | if (bgp->rmap[afi][i].name) |
| 8828 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); |
| 8829 | |
| 8830 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8831 | } |
| 8832 | } |
| 8833 | return *write; |
| 8834 | } |
| 8835 | |
| 8836 | /* BGP node structure. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8837 | static struct cmd_node bgp_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8838 | { |
| 8839 | BGP_NODE, |
| 8840 | "%s(config-router)# ", |
| 8841 | 1, |
| 8842 | }; |
| 8843 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8844 | static struct cmd_node bgp_ipv4_unicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8845 | { |
| 8846 | BGP_IPV4_NODE, |
| 8847 | "%s(config-router-af)# ", |
| 8848 | 1, |
| 8849 | }; |
| 8850 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8851 | static struct cmd_node bgp_ipv4_multicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8852 | { |
| 8853 | BGP_IPV4M_NODE, |
| 8854 | "%s(config-router-af)# ", |
| 8855 | 1, |
| 8856 | }; |
| 8857 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8858 | static struct cmd_node bgp_ipv6_unicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8859 | { |
| 8860 | BGP_IPV6_NODE, |
| 8861 | "%s(config-router-af)# ", |
| 8862 | 1, |
| 8863 | }; |
| 8864 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8865 | static struct cmd_node bgp_ipv6_multicast_node = |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8866 | { |
| 8867 | BGP_IPV6M_NODE, |
| 8868 | "%s(config-router-af)# ", |
| 8869 | 1, |
| 8870 | }; |
| 8871 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8872 | static struct cmd_node bgp_vpnv4_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8873 | { |
| 8874 | BGP_VPNV4_NODE, |
| 8875 | "%s(config-router-af)# ", |
| 8876 | 1 |
| 8877 | }; |
| 8878 | |
paul | 1f8ae70 | 2005-09-09 23:49:49 +0000 | [diff] [blame] | 8879 | static void community_list_vty (void); |
| 8880 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8881 | void |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8882 | bgp_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8883 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8884 | /* Install bgp top node. */ |
| 8885 | install_node (&bgp_node, bgp_config_write); |
| 8886 | install_node (&bgp_ipv4_unicast_node, NULL); |
| 8887 | install_node (&bgp_ipv4_multicast_node, NULL); |
| 8888 | install_node (&bgp_ipv6_unicast_node, NULL); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8889 | install_node (&bgp_ipv6_multicast_node, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8890 | install_node (&bgp_vpnv4_node, NULL); |
| 8891 | |
| 8892 | /* Install default VTY commands to new nodes. */ |
| 8893 | install_default (BGP_NODE); |
| 8894 | install_default (BGP_IPV4_NODE); |
| 8895 | install_default (BGP_IPV4M_NODE); |
| 8896 | install_default (BGP_IPV6_NODE); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8897 | install_default (BGP_IPV6M_NODE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8898 | install_default (BGP_VPNV4_NODE); |
| 8899 | |
| 8900 | /* "bgp multiple-instance" commands. */ |
| 8901 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); |
| 8902 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); |
| 8903 | |
| 8904 | /* "bgp config-type" commands. */ |
| 8905 | install_element (CONFIG_NODE, &bgp_config_type_cmd); |
| 8906 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); |
| 8907 | |
| 8908 | /* Dummy commands (Currently not supported) */ |
| 8909 | install_element (BGP_NODE, &no_synchronization_cmd); |
| 8910 | install_element (BGP_NODE, &no_auto_summary_cmd); |
| 8911 | |
| 8912 | /* "router bgp" commands. */ |
| 8913 | install_element (CONFIG_NODE, &router_bgp_cmd); |
| 8914 | install_element (CONFIG_NODE, &router_bgp_view_cmd); |
| 8915 | |
| 8916 | /* "no router bgp" commands. */ |
| 8917 | install_element (CONFIG_NODE, &no_router_bgp_cmd); |
| 8918 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); |
| 8919 | |
| 8920 | /* "bgp router-id" commands. */ |
| 8921 | install_element (BGP_NODE, &bgp_router_id_cmd); |
| 8922 | install_element (BGP_NODE, &no_bgp_router_id_cmd); |
| 8923 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); |
| 8924 | |
| 8925 | /* "bgp cluster-id" commands. */ |
| 8926 | install_element (BGP_NODE, &bgp_cluster_id_cmd); |
| 8927 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); |
| 8928 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); |
| 8929 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); |
| 8930 | |
| 8931 | /* "bgp confederation" commands. */ |
| 8932 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); |
| 8933 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); |
| 8934 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); |
| 8935 | |
| 8936 | /* "bgp confederation peers" commands. */ |
| 8937 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); |
| 8938 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); |
| 8939 | |
| 8940 | /* "timers bgp" commands. */ |
| 8941 | install_element (BGP_NODE, &bgp_timers_cmd); |
| 8942 | install_element (BGP_NODE, &no_bgp_timers_cmd); |
| 8943 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); |
| 8944 | |
| 8945 | /* "bgp client-to-client reflection" commands */ |
| 8946 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); |
| 8947 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); |
| 8948 | |
| 8949 | /* "bgp always-compare-med" commands */ |
| 8950 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); |
| 8951 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); |
| 8952 | |
| 8953 | /* "bgp deterministic-med" commands */ |
| 8954 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); |
| 8955 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 8956 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 8957 | /* "bgp graceful-restart" commands */ |
| 8958 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); |
| 8959 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 8960 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
| 8961 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); |
| 8962 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8963 | |
| 8964 | /* "bgp fast-external-failover" commands */ |
| 8965 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); |
| 8966 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); |
| 8967 | |
| 8968 | /* "bgp enforce-first-as" commands */ |
| 8969 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); |
| 8970 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); |
| 8971 | |
| 8972 | /* "bgp bestpath compare-routerid" commands */ |
| 8973 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); |
| 8974 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); |
| 8975 | |
| 8976 | /* "bgp bestpath as-path ignore" commands */ |
| 8977 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); |
| 8978 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); |
| 8979 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 8980 | /* "bgp bestpath as-path confed" commands */ |
| 8981 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); |
| 8982 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); |
| 8983 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 8984 | /* "bgp log-neighbor-changes" commands */ |
| 8985 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); |
| 8986 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); |
| 8987 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8988 | /* "bgp bestpath med" commands */ |
| 8989 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); |
| 8990 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); |
| 8991 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); |
| 8992 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); |
| 8993 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); |
| 8994 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); |
| 8995 | |
| 8996 | /* "no bgp default ipv4-unicast" commands. */ |
| 8997 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); |
| 8998 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); |
| 8999 | |
| 9000 | /* "bgp network import-check" commands. */ |
| 9001 | install_element (BGP_NODE, &bgp_network_import_check_cmd); |
| 9002 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
| 9003 | |
| 9004 | /* "bgp default local-preference" commands. */ |
| 9005 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); |
| 9006 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); |
| 9007 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); |
| 9008 | |
| 9009 | /* "neighbor remote-as" commands. */ |
| 9010 | install_element (BGP_NODE, &neighbor_remote_as_cmd); |
| 9011 | install_element (BGP_NODE, &no_neighbor_cmd); |
| 9012 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); |
| 9013 | |
| 9014 | /* "neighbor peer-group" commands. */ |
| 9015 | install_element (BGP_NODE, &neighbor_peer_group_cmd); |
| 9016 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); |
| 9017 | install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd); |
| 9018 | |
| 9019 | /* "neighbor local-as" commands. */ |
| 9020 | install_element (BGP_NODE, &neighbor_local_as_cmd); |
| 9021 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); |
| 9022 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
| 9023 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); |
| 9024 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); |
| 9025 | |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 9026 | /* "neighbor password" commands. */ |
| 9027 | install_element (BGP_NODE, &neighbor_password_cmd); |
| 9028 | install_element (BGP_NODE, &no_neighbor_password_cmd); |
| 9029 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9030 | /* "neighbor activate" commands. */ |
| 9031 | install_element (BGP_NODE, &neighbor_activate_cmd); |
| 9032 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); |
| 9033 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); |
| 9034 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9035 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9036 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
| 9037 | |
| 9038 | /* "no neighbor activate" commands. */ |
| 9039 | install_element (BGP_NODE, &no_neighbor_activate_cmd); |
| 9040 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); |
| 9041 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); |
| 9042 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9043 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9044 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
| 9045 | |
| 9046 | /* "neighbor peer-group set" commands. */ |
| 9047 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
| 9048 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); |
| 9049 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); |
| 9050 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9051 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9052 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
| 9053 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9054 | /* "no neighbor peer-group unset" commands. */ |
| 9055 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); |
| 9056 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 9057 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); |
| 9058 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9059 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9060 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 9061 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9062 | /* "neighbor softreconfiguration inbound" commands.*/ |
| 9063 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9064 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9065 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9066 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9067 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9068 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9069 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9070 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9071 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9072 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9073 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9074 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9075 | |
| 9076 | /* "neighbor attribute-unchanged" commands. */ |
| 9077 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); |
| 9078 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); |
| 9079 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); |
| 9080 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); |
| 9081 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); |
| 9082 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); |
| 9083 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); |
| 9084 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); |
| 9085 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); |
| 9086 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); |
| 9087 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); |
| 9088 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9089 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9090 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9091 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9092 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9093 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9094 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9095 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9096 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9097 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9098 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9099 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); |
| 9100 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 9101 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 9102 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 9103 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 9104 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 9105 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 9106 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 9107 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 9108 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 9109 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 9110 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9111 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9112 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9113 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9114 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9115 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9116 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9117 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9118 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9119 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9120 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9121 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); |
| 9122 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); |
| 9123 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); |
| 9124 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); |
| 9125 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); |
| 9126 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); |
| 9127 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); |
| 9128 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); |
| 9129 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); |
| 9130 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); |
| 9131 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); |
| 9132 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9133 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9134 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9135 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9136 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9137 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9138 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9139 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9140 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9141 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9142 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9143 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); |
| 9144 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); |
| 9145 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); |
| 9146 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); |
| 9147 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); |
| 9148 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); |
| 9149 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); |
| 9150 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); |
| 9151 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); |
| 9152 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); |
| 9153 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); |
| 9154 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9155 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9156 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9157 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9158 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9159 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9160 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9161 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9162 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9163 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9164 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9165 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
| 9166 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); |
| 9167 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); |
| 9168 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); |
| 9169 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); |
| 9170 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); |
| 9171 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); |
| 9172 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); |
| 9173 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); |
| 9174 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); |
| 9175 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); |
| 9176 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9177 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9178 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9179 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9180 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9181 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9182 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9183 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9184 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9185 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9186 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9187 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
| 9188 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 9189 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 9190 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 9191 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 9192 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 9193 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 9194 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 9195 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 9196 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 9197 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 9198 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9199 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9200 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9201 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9202 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9203 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9204 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9205 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9206 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9207 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9208 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9209 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9210 | /* "nexthop-local unchanged" commands */ |
| 9211 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); |
| 9212 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); |
| 9213 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9214 | /* "transparent-as" and "transparent-nexthop" for old version |
| 9215 | compatibility. */ |
| 9216 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); |
| 9217 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); |
| 9218 | |
| 9219 | /* "neighbor next-hop-self" commands. */ |
| 9220 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); |
| 9221 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); |
| 9222 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); |
| 9223 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 9224 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); |
| 9225 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); |
| 9226 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); |
| 9227 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9228 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
| 9229 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9230 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
| 9231 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 9232 | |
| 9233 | /* "neighbor remove-private-AS" commands. */ |
| 9234 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); |
| 9235 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); |
| 9236 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
| 9237 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 9238 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
| 9239 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); |
| 9240 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
| 9241 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9242 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
| 9243 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9244 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
| 9245 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 9246 | |
| 9247 | /* "neighbor send-community" commands.*/ |
| 9248 | install_element (BGP_NODE, &neighbor_send_community_cmd); |
| 9249 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); |
| 9250 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); |
| 9251 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); |
| 9252 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); |
| 9253 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); |
| 9254 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); |
| 9255 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); |
| 9256 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); |
| 9257 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); |
| 9258 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); |
| 9259 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); |
| 9260 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); |
| 9261 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); |
| 9262 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); |
| 9263 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9264 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
| 9265 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); |
| 9266 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); |
| 9267 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9268 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
| 9269 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); |
| 9270 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); |
| 9271 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); |
| 9272 | |
| 9273 | /* "neighbor route-reflector" commands.*/ |
| 9274 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); |
| 9275 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9276 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); |
| 9277 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9278 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); |
| 9279 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9280 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); |
| 9281 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9282 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
| 9283 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9284 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
| 9285 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9286 | |
| 9287 | /* "neighbor route-server" commands.*/ |
| 9288 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); |
| 9289 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); |
| 9290 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); |
| 9291 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9292 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); |
| 9293 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); |
| 9294 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); |
| 9295 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9296 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
| 9297 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9298 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
| 9299 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9300 | |
| 9301 | /* "neighbor passive" commands. */ |
| 9302 | install_element (BGP_NODE, &neighbor_passive_cmd); |
| 9303 | install_element (BGP_NODE, &no_neighbor_passive_cmd); |
| 9304 | |
| 9305 | /* "neighbor shutdown" commands. */ |
| 9306 | install_element (BGP_NODE, &neighbor_shutdown_cmd); |
| 9307 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); |
| 9308 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 9309 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9310 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
| 9311 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); |
| 9312 | |
| 9313 | /* "neighbor capability orf prefix-list" commands.*/ |
| 9314 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9315 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9316 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9317 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9318 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9319 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9320 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9321 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9322 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9323 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9324 | |
| 9325 | /* "neighbor capability dynamic" commands.*/ |
| 9326 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); |
| 9327 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); |
| 9328 | |
| 9329 | /* "neighbor dont-capability-negotiate" commands. */ |
| 9330 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); |
| 9331 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); |
| 9332 | |
| 9333 | /* "neighbor ebgp-multihop" commands. */ |
| 9334 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); |
| 9335 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); |
| 9336 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); |
| 9337 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); |
| 9338 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 9339 | /* "neighbor disable-connected-check" commands. */ |
| 9340 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); |
| 9341 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9342 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
| 9343 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); |
| 9344 | |
| 9345 | /* "neighbor description" commands. */ |
| 9346 | install_element (BGP_NODE, &neighbor_description_cmd); |
| 9347 | install_element (BGP_NODE, &no_neighbor_description_cmd); |
| 9348 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); |
| 9349 | |
| 9350 | /* "neighbor update-source" commands. "*/ |
| 9351 | install_element (BGP_NODE, &neighbor_update_source_cmd); |
| 9352 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); |
| 9353 | |
| 9354 | /* "neighbor default-originate" commands. */ |
| 9355 | install_element (BGP_NODE, &neighbor_default_originate_cmd); |
| 9356 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); |
| 9357 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); |
| 9358 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9359 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); |
| 9360 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); |
| 9361 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); |
| 9362 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9363 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); |
| 9364 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9365 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); |
| 9366 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9367 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); |
| 9368 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); |
| 9369 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); |
| 9370 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9371 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
| 9372 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9373 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); |
| 9374 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9375 | |
| 9376 | /* "neighbor port" commands. */ |
| 9377 | install_element (BGP_NODE, &neighbor_port_cmd); |
| 9378 | install_element (BGP_NODE, &no_neighbor_port_cmd); |
| 9379 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); |
| 9380 | |
| 9381 | /* "neighbor weight" commands. */ |
| 9382 | install_element (BGP_NODE, &neighbor_weight_cmd); |
| 9383 | install_element (BGP_NODE, &no_neighbor_weight_cmd); |
| 9384 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); |
| 9385 | |
| 9386 | /* "neighbor override-capability" commands. */ |
| 9387 | install_element (BGP_NODE, &neighbor_override_capability_cmd); |
| 9388 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); |
| 9389 | |
| 9390 | /* "neighbor strict-capability-match" commands. */ |
| 9391 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); |
| 9392 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); |
| 9393 | |
| 9394 | /* "neighbor timers" commands. */ |
| 9395 | install_element (BGP_NODE, &neighbor_timers_cmd); |
| 9396 | install_element (BGP_NODE, &no_neighbor_timers_cmd); |
| 9397 | |
| 9398 | /* "neighbor timers connect" commands. */ |
| 9399 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); |
| 9400 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); |
| 9401 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); |
| 9402 | |
| 9403 | /* "neighbor advertisement-interval" commands. */ |
| 9404 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); |
| 9405 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); |
| 9406 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); |
| 9407 | |
| 9408 | /* "neighbor version" commands. */ |
| 9409 | install_element (BGP_NODE, &neighbor_version_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9410 | |
| 9411 | /* "neighbor interface" commands. */ |
| 9412 | install_element (BGP_NODE, &neighbor_interface_cmd); |
| 9413 | install_element (BGP_NODE, &no_neighbor_interface_cmd); |
| 9414 | |
| 9415 | /* "neighbor distribute" commands. */ |
| 9416 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); |
| 9417 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); |
| 9418 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); |
| 9419 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9420 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); |
| 9421 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); |
| 9422 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); |
| 9423 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9424 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
| 9425 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9426 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
| 9427 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9428 | |
| 9429 | /* "neighbor prefix-list" commands. */ |
| 9430 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); |
| 9431 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); |
| 9432 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); |
| 9433 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9434 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); |
| 9435 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); |
| 9436 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); |
| 9437 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9438 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
| 9439 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9440 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
| 9441 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9442 | |
| 9443 | /* "neighbor filter-list" commands. */ |
| 9444 | install_element (BGP_NODE, &neighbor_filter_list_cmd); |
| 9445 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); |
| 9446 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); |
| 9447 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); |
| 9448 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); |
| 9449 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); |
| 9450 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); |
| 9451 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9452 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
| 9453 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9454 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
| 9455 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); |
| 9456 | |
| 9457 | /* "neighbor route-map" commands. */ |
| 9458 | install_element (BGP_NODE, &neighbor_route_map_cmd); |
| 9459 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); |
| 9460 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); |
| 9461 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); |
| 9462 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); |
| 9463 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); |
| 9464 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); |
| 9465 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9466 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
| 9467 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9468 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
| 9469 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); |
| 9470 | |
| 9471 | /* "neighbor unsuppress-map" commands. */ |
| 9472 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); |
| 9473 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9474 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9475 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9476 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); |
| 9477 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9478 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); |
| 9479 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9480 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
| 9481 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9482 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9483 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9484 | |
| 9485 | /* "neighbor maximum-prefix" commands. */ |
| 9486 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9487 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9488 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9489 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9490 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9491 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9492 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9493 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9494 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9495 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9496 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9497 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9498 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9499 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9500 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9501 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9502 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9503 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9504 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9505 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9506 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9507 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9508 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9509 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9510 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9511 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9512 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9513 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9514 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9515 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9516 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9517 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9518 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9519 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9520 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9521 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9522 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9523 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9524 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9525 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9526 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9527 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9528 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9529 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9530 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9531 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9532 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9533 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9534 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9535 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9536 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9537 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9538 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
| 9539 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
| 9540 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); |
| 9541 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
| 9542 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9543 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
| 9544 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9545 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
| 9546 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9547 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9548 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9549 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9550 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9551 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9552 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9553 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9554 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9555 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9556 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9557 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9558 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9559 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9560 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9561 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9562 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9563 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9564 | |
| 9565 | /* "neighbor allowas-in" */ |
| 9566 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); |
| 9567 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); |
| 9568 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); |
| 9569 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
| 9570 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9571 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9572 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
| 9573 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9574 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); |
| 9575 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
| 9576 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); |
| 9577 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9578 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
| 9579 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9580 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9581 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
| 9582 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9583 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9584 | |
| 9585 | /* address-family commands. */ |
| 9586 | install_element (BGP_NODE, &address_family_ipv4_cmd); |
| 9587 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); |
| 9588 | #ifdef HAVE_IPV6 |
| 9589 | install_element (BGP_NODE, &address_family_ipv6_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9590 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9591 | #endif /* HAVE_IPV6 */ |
| 9592 | install_element (BGP_NODE, &address_family_vpnv4_cmd); |
| 9593 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); |
| 9594 | |
| 9595 | /* "exit-address-family" command. */ |
| 9596 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); |
| 9597 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); |
| 9598 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9599 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9600 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
| 9601 | |
| 9602 | /* "clear ip bgp commands" */ |
| 9603 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); |
| 9604 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); |
| 9605 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); |
| 9606 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
| 9607 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
| 9608 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
| 9609 | #ifdef HAVE_IPV6 |
| 9610 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
| 9611 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); |
| 9612 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); |
| 9613 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
| 9614 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
| 9615 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
| 9616 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
| 9617 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
| 9618 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
| 9619 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
| 9620 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
| 9621 | #endif /* HAVE_IPV6 */ |
| 9622 | |
| 9623 | /* "clear ip bgp neighbor soft in" */ |
| 9624 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); |
| 9625 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); |
| 9626 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); |
| 9627 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
| 9628 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); |
| 9629 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
| 9630 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
| 9631 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
| 9632 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); |
| 9633 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
| 9634 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
| 9635 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); |
| 9636 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
| 9637 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
| 9638 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); |
| 9639 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
| 9640 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
| 9641 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); |
| 9642 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); |
| 9643 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); |
| 9644 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
| 9645 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); |
| 9646 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
| 9647 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
| 9648 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
| 9649 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); |
| 9650 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
| 9651 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
| 9652 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); |
| 9653 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
| 9654 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
| 9655 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); |
| 9656 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
| 9657 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
| 9658 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); |
| 9659 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); |
| 9660 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); |
| 9661 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); |
| 9662 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); |
| 9663 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); |
| 9664 | #ifdef HAVE_IPV6 |
| 9665 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
| 9666 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); |
| 9667 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); |
| 9668 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
| 9669 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); |
| 9670 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
| 9671 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
| 9672 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); |
| 9673 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
| 9674 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
| 9675 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); |
| 9676 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
| 9677 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
| 9678 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); |
| 9679 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
| 9680 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
| 9681 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); |
| 9682 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
| 9683 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
| 9684 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); |
| 9685 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
| 9686 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
| 9687 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); |
| 9688 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
| 9689 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
| 9690 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); |
| 9691 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
| 9692 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
| 9693 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); |
| 9694 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
| 9695 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
| 9696 | #endif /* HAVE_IPV6 */ |
| 9697 | |
| 9698 | /* "clear ip bgp neighbor soft out" */ |
| 9699 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); |
| 9700 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); |
| 9701 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); |
| 9702 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
| 9703 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
| 9704 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
| 9705 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
| 9706 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
| 9707 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
| 9708 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
| 9709 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
| 9710 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
| 9711 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); |
| 9712 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); |
| 9713 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
| 9714 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
| 9715 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
| 9716 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
| 9717 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
| 9718 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
| 9719 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
| 9720 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
| 9721 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
| 9722 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); |
| 9723 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); |
| 9724 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); |
| 9725 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); |
| 9726 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); |
| 9727 | #ifdef HAVE_IPV6 |
| 9728 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
| 9729 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); |
| 9730 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); |
| 9731 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
| 9732 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
| 9733 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
| 9734 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
| 9735 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
| 9736 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
| 9737 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
| 9738 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
| 9739 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
| 9740 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
| 9741 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
| 9742 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
| 9743 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
| 9744 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
| 9745 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
| 9746 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
| 9747 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
| 9748 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
| 9749 | #endif /* HAVE_IPV6 */ |
| 9750 | |
| 9751 | /* "clear ip bgp neighbor soft" */ |
| 9752 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); |
| 9753 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); |
| 9754 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); |
| 9755 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
| 9756 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
| 9757 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
| 9758 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
| 9759 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); |
| 9760 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); |
| 9761 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
| 9762 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
| 9763 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
| 9764 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
| 9765 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); |
| 9766 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); |
| 9767 | #ifdef HAVE_IPV6 |
| 9768 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
| 9769 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); |
| 9770 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); |
| 9771 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
| 9772 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
| 9773 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
| 9774 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
| 9775 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
| 9776 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
| 9777 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
| 9778 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
| 9779 | #endif /* HAVE_IPV6 */ |
| 9780 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9781 | /* "clear ip bgp neighbor rsclient" */ |
| 9782 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); |
| 9783 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); |
| 9784 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); |
| 9785 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); |
| 9786 | #ifdef HAVE_IPV6 |
| 9787 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); |
| 9788 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); |
| 9789 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); |
| 9790 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); |
| 9791 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); |
| 9792 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); |
| 9793 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); |
| 9794 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); |
| 9795 | #endif /* HAVE_IPV6 */ |
| 9796 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9797 | /* "show ip bgp summary" commands. */ |
| 9798 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); |
| 9799 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9800 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9801 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9802 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9803 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9804 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9805 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9806 | #ifdef HAVE_IPV6 |
| 9807 | install_element (VIEW_NODE, &show_bgp_summary_cmd); |
| 9808 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); |
| 9809 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9810 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9811 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9812 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9813 | #endif /* HAVE_IPV6 */ |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9814 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); |
| 9815 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9816 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9817 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9818 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9819 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9820 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9821 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9822 | #ifdef HAVE_IPV6 |
| 9823 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); |
| 9824 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); |
| 9825 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9826 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9827 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9828 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9829 | #endif /* HAVE_IPV6 */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9830 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); |
| 9831 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9832 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9833 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9834 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9835 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9836 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9837 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9838 | #ifdef HAVE_IPV6 |
| 9839 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); |
| 9840 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); |
| 9841 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9842 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9843 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9844 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9845 | #endif /* HAVE_IPV6 */ |
| 9846 | |
| 9847 | /* "show ip bgp neighbors" commands. */ |
| 9848 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); |
| 9849 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 9850 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 9851 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 9852 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 9853 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 9854 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 9855 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 9856 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 9857 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9858 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 9859 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 9860 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 9861 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 9862 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9863 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
| 9864 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 9865 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 9866 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 9867 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 9868 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 9869 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 9870 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 9871 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 9872 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 9873 | |
| 9874 | #ifdef HAVE_IPV6 |
| 9875 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); |
| 9876 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 9877 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); |
| 9878 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 9879 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
| 9880 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 9881 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 9882 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9883 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
| 9884 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
| 9885 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 9886 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9887 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
| 9888 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 9889 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); |
| 9890 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 9891 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
| 9892 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 9893 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 9894 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9895 | |
| 9896 | /* Old commands. */ |
| 9897 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); |
| 9898 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); |
| 9899 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); |
| 9900 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); |
| 9901 | #endif /* HAVE_IPV6 */ |
| 9902 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9903 | /* "show ip bgp rsclient" commands. */ |
| 9904 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 9905 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 9906 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 9907 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9908 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 9909 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9910 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 9911 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 9912 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 9913 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9914 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 9915 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9916 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 9917 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 9918 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 9919 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9920 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
| 9921 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9922 | |
| 9923 | #ifdef HAVE_IPV6 |
| 9924 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); |
| 9925 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 9926 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 9927 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9928 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 9929 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9930 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
| 9931 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 9932 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 9933 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9934 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 9935 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9936 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
| 9937 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 9938 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 9939 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Michael Lambert | 95cbbd2 | 2010-07-23 14:43:04 -0400 | [diff] [blame] | 9940 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
| 9941 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9942 | #endif /* HAVE_IPV6 */ |
| 9943 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9944 | /* "show ip bgp paths" commands. */ |
| 9945 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); |
| 9946 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 9947 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); |
| 9948 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 9949 | |
| 9950 | /* "show ip bgp community" commands. */ |
| 9951 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); |
| 9952 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); |
| 9953 | |
| 9954 | /* "show ip bgp attribute-info" commands. */ |
| 9955 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); |
| 9956 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); |
| 9957 | |
| 9958 | /* "redistribute" commands. */ |
| 9959 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); |
| 9960 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); |
| 9961 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); |
| 9962 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); |
| 9963 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); |
| 9964 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); |
| 9965 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); |
| 9966 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); |
| 9967 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); |
| 9968 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); |
| 9969 | #ifdef HAVE_IPV6 |
| 9970 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); |
| 9971 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); |
| 9972 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); |
| 9973 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); |
| 9974 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); |
| 9975 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); |
| 9976 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); |
| 9977 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); |
| 9978 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); |
| 9979 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); |
| 9980 | #endif /* HAVE_IPV6 */ |
| 9981 | |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 9982 | /* ttl_security commands */ |
| 9983 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); |
| 9984 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); |
| 9985 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 9986 | /* "show bgp memory" commands. */ |
| 9987 | install_element (VIEW_NODE, &show_bgp_memory_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9988 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 9989 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
| 9990 | |
Michael Lambert | e0081f7 | 2008-11-16 20:12:04 +0000 | [diff] [blame] | 9991 | /* "show bgp views" commands. */ |
| 9992 | install_element (VIEW_NODE, &show_bgp_views_cmd); |
| 9993 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); |
| 9994 | install_element (ENABLE_NODE, &show_bgp_views_cmd); |
| 9995 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9996 | /* Community-list. */ |
| 9997 | community_list_vty (); |
| 9998 | } |
| 9999 | |
| 10000 | #include "memory.h" |
| 10001 | #include "bgp_regex.h" |
| 10002 | #include "bgp_clist.h" |
| 10003 | #include "bgp_ecommunity.h" |
| 10004 | |
| 10005 | /* VTY functions. */ |
| 10006 | |
| 10007 | /* Direction value to string conversion. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10008 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10009 | community_direct_str (int direct) |
| 10010 | { |
| 10011 | switch (direct) |
| 10012 | { |
| 10013 | case COMMUNITY_DENY: |
| 10014 | return "deny"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10015 | case COMMUNITY_PERMIT: |
| 10016 | return "permit"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10017 | default: |
| 10018 | return "unknown"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10019 | } |
| 10020 | } |
| 10021 | |
| 10022 | /* Display error string. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10023 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10024 | community_list_perror (struct vty *vty, int ret) |
| 10025 | { |
| 10026 | switch (ret) |
| 10027 | { |
| 10028 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10029 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10030 | break; |
| 10031 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: |
| 10032 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); |
| 10033 | break; |
| 10034 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: |
| 10035 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); |
| 10036 | break; |
| 10037 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: |
| 10038 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); |
| 10039 | break; |
| 10040 | } |
| 10041 | } |
| 10042 | |
| 10043 | /* VTY interface for community_set() function. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10044 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10045 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10046 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10047 | { |
| 10048 | int ret; |
| 10049 | int direct; |
| 10050 | char *str; |
| 10051 | |
| 10052 | /* Check the list type. */ |
| 10053 | if (strncmp (argv[1], "p", 1) == 0) |
| 10054 | direct = COMMUNITY_PERMIT; |
| 10055 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10056 | direct = COMMUNITY_DENY; |
| 10057 | else |
| 10058 | { |
| 10059 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10060 | VTY_NEWLINE); |
| 10061 | return CMD_WARNING; |
| 10062 | } |
| 10063 | |
| 10064 | /* All digit name check. */ |
| 10065 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10066 | { |
| 10067 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10068 | return CMD_WARNING; |
| 10069 | } |
| 10070 | |
| 10071 | /* Concat community string argument. */ |
| 10072 | if (argc > 1) |
| 10073 | str = argv_concat (argv, argc, 2); |
| 10074 | else |
| 10075 | str = NULL; |
| 10076 | |
| 10077 | /* When community_list_set() return nevetive value, it means |
| 10078 | malformed community string. */ |
| 10079 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); |
| 10080 | |
| 10081 | /* Free temporary community list string allocated by |
| 10082 | argv_concat(). */ |
| 10083 | if (str) |
| 10084 | XFREE (MTYPE_TMP, str); |
| 10085 | |
| 10086 | if (ret < 0) |
| 10087 | { |
| 10088 | /* Display error string. */ |
| 10089 | community_list_perror (vty, ret); |
| 10090 | return CMD_WARNING; |
| 10091 | } |
| 10092 | |
| 10093 | return CMD_SUCCESS; |
| 10094 | } |
| 10095 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10096 | /* Communiyt-list entry delete. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10097 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10098 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10099 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10100 | { |
| 10101 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10102 | int direct = 0; |
| 10103 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10104 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10105 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10106 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10107 | /* Check the list direct. */ |
| 10108 | if (strncmp (argv[1], "p", 1) == 0) |
| 10109 | direct = COMMUNITY_PERMIT; |
| 10110 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10111 | direct = COMMUNITY_DENY; |
| 10112 | else |
| 10113 | { |
| 10114 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10115 | VTY_NEWLINE); |
| 10116 | return CMD_WARNING; |
| 10117 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10118 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10119 | /* Concat community string argument. */ |
| 10120 | str = argv_concat (argv, argc, 2); |
| 10121 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10122 | |
| 10123 | /* Unset community list. */ |
| 10124 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10125 | |
| 10126 | /* Free temporary community list string allocated by |
| 10127 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10128 | if (str) |
| 10129 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10130 | |
| 10131 | if (ret < 0) |
| 10132 | { |
| 10133 | community_list_perror (vty, ret); |
| 10134 | return CMD_WARNING; |
| 10135 | } |
| 10136 | |
| 10137 | return CMD_SUCCESS; |
| 10138 | } |
| 10139 | |
| 10140 | /* "community-list" keyword help string. */ |
| 10141 | #define COMMUNITY_LIST_STR "Add a community list entry\n" |
| 10142 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" |
| 10143 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10144 | DEFUN (ip_community_list_standard, |
| 10145 | ip_community_list_standard_cmd, |
| 10146 | "ip community-list <1-99> (deny|permit) .AA:NN", |
| 10147 | IP_STR |
| 10148 | COMMUNITY_LIST_STR |
| 10149 | "Community list number (standard)\n" |
| 10150 | "Specify community to reject\n" |
| 10151 | "Specify community to accept\n" |
| 10152 | COMMUNITY_VAL_STR) |
| 10153 | { |
| 10154 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
| 10155 | } |
| 10156 | |
| 10157 | ALIAS (ip_community_list_standard, |
| 10158 | ip_community_list_standard2_cmd, |
| 10159 | "ip community-list <1-99> (deny|permit)", |
| 10160 | IP_STR |
| 10161 | COMMUNITY_LIST_STR |
| 10162 | "Community list number (standard)\n" |
| 10163 | "Specify community to reject\n" |
| 10164 | "Specify community to accept\n") |
| 10165 | |
| 10166 | DEFUN (ip_community_list_expanded, |
| 10167 | ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10168 | "ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10169 | IP_STR |
| 10170 | COMMUNITY_LIST_STR |
| 10171 | "Community list number (expanded)\n" |
| 10172 | "Specify community to reject\n" |
| 10173 | "Specify community to accept\n" |
| 10174 | "An ordered list as a regular-expression\n") |
| 10175 | { |
| 10176 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
| 10177 | } |
| 10178 | |
| 10179 | DEFUN (ip_community_list_name_standard, |
| 10180 | ip_community_list_name_standard_cmd, |
| 10181 | "ip community-list standard WORD (deny|permit) .AA:NN", |
| 10182 | IP_STR |
| 10183 | COMMUNITY_LIST_STR |
| 10184 | "Add a standard community-list entry\n" |
| 10185 | "Community list name\n" |
| 10186 | "Specify community to reject\n" |
| 10187 | "Specify community to accept\n" |
| 10188 | COMMUNITY_VAL_STR) |
| 10189 | { |
| 10190 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
| 10191 | } |
| 10192 | |
| 10193 | ALIAS (ip_community_list_name_standard, |
| 10194 | ip_community_list_name_standard2_cmd, |
| 10195 | "ip community-list standard WORD (deny|permit)", |
| 10196 | IP_STR |
| 10197 | COMMUNITY_LIST_STR |
| 10198 | "Add a standard community-list entry\n" |
| 10199 | "Community list name\n" |
| 10200 | "Specify community to reject\n" |
| 10201 | "Specify community to accept\n") |
| 10202 | |
| 10203 | DEFUN (ip_community_list_name_expanded, |
| 10204 | ip_community_list_name_expanded_cmd, |
| 10205 | "ip community-list expanded WORD (deny|permit) .LINE", |
| 10206 | IP_STR |
| 10207 | COMMUNITY_LIST_STR |
| 10208 | "Add an expanded community-list entry\n" |
| 10209 | "Community list name\n" |
| 10210 | "Specify community to reject\n" |
| 10211 | "Specify community to accept\n" |
| 10212 | "An ordered list as a regular-expression\n") |
| 10213 | { |
| 10214 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
| 10215 | } |
| 10216 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10217 | DEFUN (no_ip_community_list_standard_all, |
| 10218 | no_ip_community_list_standard_all_cmd, |
| 10219 | "no ip community-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10220 | NO_STR |
| 10221 | IP_STR |
| 10222 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10223 | "Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10224 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10225 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10226 | } |
| 10227 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10228 | DEFUN (no_ip_community_list_expanded_all, |
| 10229 | no_ip_community_list_expanded_all_cmd, |
| 10230 | "no ip community-list <100-500>", |
| 10231 | NO_STR |
| 10232 | IP_STR |
| 10233 | COMMUNITY_LIST_STR |
| 10234 | "Community list number (expanded)\n") |
| 10235 | { |
| 10236 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10237 | } |
| 10238 | |
| 10239 | DEFUN (no_ip_community_list_name_standard_all, |
| 10240 | no_ip_community_list_name_standard_all_cmd, |
| 10241 | "no ip community-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10242 | NO_STR |
| 10243 | IP_STR |
| 10244 | COMMUNITY_LIST_STR |
| 10245 | "Add a standard community-list entry\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10246 | "Community list name\n") |
| 10247 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10248 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10249 | } |
| 10250 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10251 | DEFUN (no_ip_community_list_name_expanded_all, |
| 10252 | no_ip_community_list_name_expanded_all_cmd, |
| 10253 | "no ip community-list expanded WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10254 | NO_STR |
| 10255 | IP_STR |
| 10256 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10257 | "Add an expanded community-list entry\n" |
| 10258 | "Community list name\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10259 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10260 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10261 | } |
| 10262 | |
| 10263 | DEFUN (no_ip_community_list_standard, |
| 10264 | no_ip_community_list_standard_cmd, |
| 10265 | "no ip community-list <1-99> (deny|permit) .AA:NN", |
| 10266 | NO_STR |
| 10267 | IP_STR |
| 10268 | COMMUNITY_LIST_STR |
| 10269 | "Community list number (standard)\n" |
| 10270 | "Specify community to reject\n" |
| 10271 | "Specify community to accept\n" |
| 10272 | COMMUNITY_VAL_STR) |
| 10273 | { |
| 10274 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 10275 | } |
| 10276 | |
| 10277 | DEFUN (no_ip_community_list_expanded, |
| 10278 | no_ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10279 | "no ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10280 | NO_STR |
| 10281 | IP_STR |
| 10282 | COMMUNITY_LIST_STR |
| 10283 | "Community list number (expanded)\n" |
| 10284 | "Specify community to reject\n" |
| 10285 | "Specify community to accept\n" |
| 10286 | "An ordered list as a regular-expression\n") |
| 10287 | { |
| 10288 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10289 | } |
| 10290 | |
| 10291 | DEFUN (no_ip_community_list_name_standard, |
| 10292 | no_ip_community_list_name_standard_cmd, |
| 10293 | "no ip community-list standard WORD (deny|permit) .AA:NN", |
| 10294 | NO_STR |
| 10295 | IP_STR |
| 10296 | COMMUNITY_LIST_STR |
| 10297 | "Specify a standard community-list\n" |
| 10298 | "Community list name\n" |
| 10299 | "Specify community to reject\n" |
| 10300 | "Specify community to accept\n" |
| 10301 | COMMUNITY_VAL_STR) |
| 10302 | { |
| 10303 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 10304 | } |
| 10305 | |
| 10306 | DEFUN (no_ip_community_list_name_expanded, |
| 10307 | no_ip_community_list_name_expanded_cmd, |
| 10308 | "no ip community-list expanded WORD (deny|permit) .LINE", |
| 10309 | NO_STR |
| 10310 | IP_STR |
| 10311 | COMMUNITY_LIST_STR |
| 10312 | "Specify an expanded community-list\n" |
| 10313 | "Community list name\n" |
| 10314 | "Specify community to reject\n" |
| 10315 | "Specify community to accept\n" |
| 10316 | "An ordered list as a regular-expression\n") |
| 10317 | { |
| 10318 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10319 | } |
| 10320 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10321 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10322 | community_list_show (struct vty *vty, struct community_list *list) |
| 10323 | { |
| 10324 | struct community_entry *entry; |
| 10325 | |
| 10326 | for (entry = list->head; entry; entry = entry->next) |
| 10327 | { |
| 10328 | if (entry == list->head) |
| 10329 | { |
| 10330 | if (all_digit (list->name)) |
| 10331 | vty_out (vty, "Community %s list %s%s", |
| 10332 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 10333 | "standard" : "(expanded) access", |
| 10334 | list->name, VTY_NEWLINE); |
| 10335 | else |
| 10336 | vty_out (vty, "Named Community %s list %s%s", |
| 10337 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 10338 | "standard" : "expanded", |
| 10339 | list->name, VTY_NEWLINE); |
| 10340 | } |
| 10341 | if (entry->any) |
| 10342 | vty_out (vty, " %s%s", |
| 10343 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10344 | else |
| 10345 | vty_out (vty, " %s %s%s", |
| 10346 | community_direct_str (entry->direct), |
| 10347 | entry->style == COMMUNITY_LIST_STANDARD |
| 10348 | ? community_str (entry->u.com) : entry->config, |
| 10349 | VTY_NEWLINE); |
| 10350 | } |
| 10351 | } |
| 10352 | |
| 10353 | DEFUN (show_ip_community_list, |
| 10354 | show_ip_community_list_cmd, |
| 10355 | "show ip community-list", |
| 10356 | SHOW_STR |
| 10357 | IP_STR |
| 10358 | "List community-list\n") |
| 10359 | { |
| 10360 | struct community_list *list; |
| 10361 | struct community_list_master *cm; |
| 10362 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10363 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10364 | if (! cm) |
| 10365 | return CMD_SUCCESS; |
| 10366 | |
| 10367 | for (list = cm->num.head; list; list = list->next) |
| 10368 | community_list_show (vty, list); |
| 10369 | |
| 10370 | for (list = cm->str.head; list; list = list->next) |
| 10371 | community_list_show (vty, list); |
| 10372 | |
| 10373 | return CMD_SUCCESS; |
| 10374 | } |
| 10375 | |
| 10376 | DEFUN (show_ip_community_list_arg, |
| 10377 | show_ip_community_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10378 | "show ip community-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10379 | SHOW_STR |
| 10380 | IP_STR |
| 10381 | "List community-list\n" |
| 10382 | "Community-list number\n" |
| 10383 | "Community-list name\n") |
| 10384 | { |
| 10385 | struct community_list *list; |
| 10386 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10387 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10388 | if (! list) |
| 10389 | { |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10390 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10391 | return CMD_WARNING; |
| 10392 | } |
| 10393 | |
| 10394 | community_list_show (vty, list); |
| 10395 | |
| 10396 | return CMD_SUCCESS; |
| 10397 | } |
| 10398 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10399 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10400 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10401 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10402 | { |
| 10403 | int ret; |
| 10404 | int direct; |
| 10405 | char *str; |
| 10406 | |
| 10407 | /* Check the list type. */ |
| 10408 | if (strncmp (argv[1], "p", 1) == 0) |
| 10409 | direct = COMMUNITY_PERMIT; |
| 10410 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10411 | direct = COMMUNITY_DENY; |
| 10412 | else |
| 10413 | { |
| 10414 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10415 | VTY_NEWLINE); |
| 10416 | return CMD_WARNING; |
| 10417 | } |
| 10418 | |
| 10419 | /* All digit name check. */ |
| 10420 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10421 | { |
| 10422 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10423 | return CMD_WARNING; |
| 10424 | } |
| 10425 | |
| 10426 | /* Concat community string argument. */ |
| 10427 | if (argc > 1) |
| 10428 | str = argv_concat (argv, argc, 2); |
| 10429 | else |
| 10430 | str = NULL; |
| 10431 | |
| 10432 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); |
| 10433 | |
| 10434 | /* Free temporary community list string allocated by |
| 10435 | argv_concat(). */ |
| 10436 | if (str) |
| 10437 | XFREE (MTYPE_TMP, str); |
| 10438 | |
| 10439 | if (ret < 0) |
| 10440 | { |
| 10441 | community_list_perror (vty, ret); |
| 10442 | return CMD_WARNING; |
| 10443 | } |
| 10444 | return CMD_SUCCESS; |
| 10445 | } |
| 10446 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10447 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10448 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10449 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10450 | { |
| 10451 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10452 | int direct = 0; |
| 10453 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10454 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10455 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10456 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10457 | /* Check the list direct. */ |
| 10458 | if (strncmp (argv[1], "p", 1) == 0) |
| 10459 | direct = COMMUNITY_PERMIT; |
| 10460 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10461 | direct = COMMUNITY_DENY; |
| 10462 | else |
| 10463 | { |
| 10464 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10465 | VTY_NEWLINE); |
| 10466 | return CMD_WARNING; |
| 10467 | } |
| 10468 | |
| 10469 | /* Concat community string argument. */ |
| 10470 | str = argv_concat (argv, argc, 2); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10471 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10472 | |
| 10473 | /* Unset community list. */ |
| 10474 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10475 | |
| 10476 | /* Free temporary community list string allocated by |
| 10477 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10478 | if (str) |
| 10479 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10480 | |
| 10481 | if (ret < 0) |
| 10482 | { |
| 10483 | community_list_perror (vty, ret); |
| 10484 | return CMD_WARNING; |
| 10485 | } |
| 10486 | |
| 10487 | return CMD_SUCCESS; |
| 10488 | } |
| 10489 | |
| 10490 | /* "extcommunity-list" keyword help string. */ |
| 10491 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" |
| 10492 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" |
| 10493 | |
| 10494 | DEFUN (ip_extcommunity_list_standard, |
| 10495 | ip_extcommunity_list_standard_cmd, |
| 10496 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10497 | IP_STR |
| 10498 | EXTCOMMUNITY_LIST_STR |
| 10499 | "Extended Community list number (standard)\n" |
| 10500 | "Specify community to reject\n" |
| 10501 | "Specify community to accept\n" |
| 10502 | EXTCOMMUNITY_VAL_STR) |
| 10503 | { |
| 10504 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
| 10505 | } |
| 10506 | |
| 10507 | ALIAS (ip_extcommunity_list_standard, |
| 10508 | ip_extcommunity_list_standard2_cmd, |
| 10509 | "ip extcommunity-list <1-99> (deny|permit)", |
| 10510 | IP_STR |
| 10511 | EXTCOMMUNITY_LIST_STR |
| 10512 | "Extended Community list number (standard)\n" |
| 10513 | "Specify community to reject\n" |
| 10514 | "Specify community to accept\n") |
| 10515 | |
| 10516 | DEFUN (ip_extcommunity_list_expanded, |
| 10517 | ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10518 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10519 | IP_STR |
| 10520 | EXTCOMMUNITY_LIST_STR |
| 10521 | "Extended Community list number (expanded)\n" |
| 10522 | "Specify community to reject\n" |
| 10523 | "Specify community to accept\n" |
| 10524 | "An ordered list as a regular-expression\n") |
| 10525 | { |
| 10526 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
| 10527 | } |
| 10528 | |
| 10529 | DEFUN (ip_extcommunity_list_name_standard, |
| 10530 | ip_extcommunity_list_name_standard_cmd, |
| 10531 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10532 | IP_STR |
| 10533 | EXTCOMMUNITY_LIST_STR |
| 10534 | "Specify standard extcommunity-list\n" |
| 10535 | "Extended Community list name\n" |
| 10536 | "Specify community to reject\n" |
| 10537 | "Specify community to accept\n" |
| 10538 | EXTCOMMUNITY_VAL_STR) |
| 10539 | { |
| 10540 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
| 10541 | } |
| 10542 | |
| 10543 | ALIAS (ip_extcommunity_list_name_standard, |
| 10544 | ip_extcommunity_list_name_standard2_cmd, |
| 10545 | "ip extcommunity-list standard WORD (deny|permit)", |
| 10546 | IP_STR |
| 10547 | EXTCOMMUNITY_LIST_STR |
| 10548 | "Specify standard extcommunity-list\n" |
| 10549 | "Extended Community list name\n" |
| 10550 | "Specify community to reject\n" |
| 10551 | "Specify community to accept\n") |
| 10552 | |
| 10553 | DEFUN (ip_extcommunity_list_name_expanded, |
| 10554 | ip_extcommunity_list_name_expanded_cmd, |
| 10555 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10556 | IP_STR |
| 10557 | EXTCOMMUNITY_LIST_STR |
| 10558 | "Specify expanded extcommunity-list\n" |
| 10559 | "Extended Community list name\n" |
| 10560 | "Specify community to reject\n" |
| 10561 | "Specify community to accept\n" |
| 10562 | "An ordered list as a regular-expression\n") |
| 10563 | { |
| 10564 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
| 10565 | } |
| 10566 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10567 | DEFUN (no_ip_extcommunity_list_standard_all, |
| 10568 | no_ip_extcommunity_list_standard_all_cmd, |
| 10569 | "no ip extcommunity-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10570 | NO_STR |
| 10571 | IP_STR |
| 10572 | EXTCOMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10573 | "Extended Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10574 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10575 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10576 | } |
| 10577 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10578 | DEFUN (no_ip_extcommunity_list_expanded_all, |
| 10579 | no_ip_extcommunity_list_expanded_all_cmd, |
| 10580 | "no ip extcommunity-list <100-500>", |
| 10581 | NO_STR |
| 10582 | IP_STR |
| 10583 | EXTCOMMUNITY_LIST_STR |
| 10584 | "Extended Community list number (expanded)\n") |
| 10585 | { |
| 10586 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10587 | } |
| 10588 | |
| 10589 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
| 10590 | no_ip_extcommunity_list_name_standard_all_cmd, |
| 10591 | "no ip extcommunity-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10592 | NO_STR |
| 10593 | IP_STR |
| 10594 | EXTCOMMUNITY_LIST_STR |
| 10595 | "Specify standard extcommunity-list\n" |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10596 | "Extended Community list name\n") |
| 10597 | { |
| 10598 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10599 | } |
| 10600 | |
| 10601 | DEFUN (no_ip_extcommunity_list_name_expanded_all, |
| 10602 | no_ip_extcommunity_list_name_expanded_all_cmd, |
| 10603 | "no ip extcommunity-list expanded WORD", |
| 10604 | NO_STR |
| 10605 | IP_STR |
| 10606 | EXTCOMMUNITY_LIST_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10607 | "Specify expanded extcommunity-list\n" |
| 10608 | "Extended Community list name\n") |
| 10609 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10610 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10611 | } |
| 10612 | |
| 10613 | DEFUN (no_ip_extcommunity_list_standard, |
| 10614 | no_ip_extcommunity_list_standard_cmd, |
| 10615 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10616 | NO_STR |
| 10617 | IP_STR |
| 10618 | EXTCOMMUNITY_LIST_STR |
| 10619 | "Extended Community list number (standard)\n" |
| 10620 | "Specify community to reject\n" |
| 10621 | "Specify community to accept\n" |
| 10622 | EXTCOMMUNITY_VAL_STR) |
| 10623 | { |
| 10624 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10625 | } |
| 10626 | |
| 10627 | DEFUN (no_ip_extcommunity_list_expanded, |
| 10628 | no_ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10629 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10630 | NO_STR |
| 10631 | IP_STR |
| 10632 | EXTCOMMUNITY_LIST_STR |
| 10633 | "Extended Community list number (expanded)\n" |
| 10634 | "Specify community to reject\n" |
| 10635 | "Specify community to accept\n" |
| 10636 | "An ordered list as a regular-expression\n") |
| 10637 | { |
| 10638 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10639 | } |
| 10640 | |
| 10641 | DEFUN (no_ip_extcommunity_list_name_standard, |
| 10642 | no_ip_extcommunity_list_name_standard_cmd, |
| 10643 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10644 | NO_STR |
| 10645 | IP_STR |
| 10646 | EXTCOMMUNITY_LIST_STR |
| 10647 | "Specify standard extcommunity-list\n" |
| 10648 | "Extended Community list name\n" |
| 10649 | "Specify community to reject\n" |
| 10650 | "Specify community to accept\n" |
| 10651 | EXTCOMMUNITY_VAL_STR) |
| 10652 | { |
| 10653 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10654 | } |
| 10655 | |
| 10656 | DEFUN (no_ip_extcommunity_list_name_expanded, |
| 10657 | no_ip_extcommunity_list_name_expanded_cmd, |
| 10658 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10659 | NO_STR |
| 10660 | IP_STR |
| 10661 | EXTCOMMUNITY_LIST_STR |
| 10662 | "Specify expanded extcommunity-list\n" |
| 10663 | "Community list name\n" |
| 10664 | "Specify community to reject\n" |
| 10665 | "Specify community to accept\n" |
| 10666 | "An ordered list as a regular-expression\n") |
| 10667 | { |
| 10668 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10669 | } |
| 10670 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10671 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10672 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
| 10673 | { |
| 10674 | struct community_entry *entry; |
| 10675 | |
| 10676 | for (entry = list->head; entry; entry = entry->next) |
| 10677 | { |
| 10678 | if (entry == list->head) |
| 10679 | { |
| 10680 | if (all_digit (list->name)) |
| 10681 | vty_out (vty, "Extended community %s list %s%s", |
| 10682 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10683 | "standard" : "(expanded) access", |
| 10684 | list->name, VTY_NEWLINE); |
| 10685 | else |
| 10686 | vty_out (vty, "Named extended community %s list %s%s", |
| 10687 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10688 | "standard" : "expanded", |
| 10689 | list->name, VTY_NEWLINE); |
| 10690 | } |
| 10691 | if (entry->any) |
| 10692 | vty_out (vty, " %s%s", |
| 10693 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10694 | else |
| 10695 | vty_out (vty, " %s %s%s", |
| 10696 | community_direct_str (entry->direct), |
| 10697 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10698 | entry->u.ecom->str : entry->config, |
| 10699 | VTY_NEWLINE); |
| 10700 | } |
| 10701 | } |
| 10702 | |
| 10703 | DEFUN (show_ip_extcommunity_list, |
| 10704 | show_ip_extcommunity_list_cmd, |
| 10705 | "show ip extcommunity-list", |
| 10706 | SHOW_STR |
| 10707 | IP_STR |
| 10708 | "List extended-community list\n") |
| 10709 | { |
| 10710 | struct community_list *list; |
| 10711 | struct community_list_master *cm; |
| 10712 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10713 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10714 | if (! cm) |
| 10715 | return CMD_SUCCESS; |
| 10716 | |
| 10717 | for (list = cm->num.head; list; list = list->next) |
| 10718 | extcommunity_list_show (vty, list); |
| 10719 | |
| 10720 | for (list = cm->str.head; list; list = list->next) |
| 10721 | extcommunity_list_show (vty, list); |
| 10722 | |
| 10723 | return CMD_SUCCESS; |
| 10724 | } |
| 10725 | |
| 10726 | DEFUN (show_ip_extcommunity_list_arg, |
| 10727 | show_ip_extcommunity_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10728 | "show ip extcommunity-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10729 | SHOW_STR |
| 10730 | IP_STR |
| 10731 | "List extended-community list\n" |
| 10732 | "Extcommunity-list number\n" |
| 10733 | "Extcommunity-list name\n") |
| 10734 | { |
| 10735 | struct community_list *list; |
| 10736 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10737 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10738 | if (! list) |
| 10739 | { |
Denis Ovsienko | b729294 | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10740 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10741 | return CMD_WARNING; |
| 10742 | } |
| 10743 | |
| 10744 | extcommunity_list_show (vty, list); |
| 10745 | |
| 10746 | return CMD_SUCCESS; |
| 10747 | } |
| 10748 | |
| 10749 | /* Return configuration string of community-list entry. */ |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10750 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10751 | community_list_config_str (struct community_entry *entry) |
| 10752 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10753 | const char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10754 | |
| 10755 | if (entry->any) |
| 10756 | str = ""; |
| 10757 | else |
| 10758 | { |
| 10759 | if (entry->style == COMMUNITY_LIST_STANDARD) |
| 10760 | str = community_str (entry->u.com); |
| 10761 | else |
| 10762 | str = entry->config; |
| 10763 | } |
| 10764 | return str; |
| 10765 | } |
| 10766 | |
| 10767 | /* Display community-list and extcommunity-list configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10768 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10769 | community_list_config_write (struct vty *vty) |
| 10770 | { |
| 10771 | struct community_list *list; |
| 10772 | struct community_entry *entry; |
| 10773 | struct community_list_master *cm; |
| 10774 | int write = 0; |
| 10775 | |
| 10776 | /* Community-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10777 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10778 | |
| 10779 | for (list = cm->num.head; list; list = list->next) |
| 10780 | for (entry = list->head; entry; entry = entry->next) |
| 10781 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10782 | vty_out (vty, "ip community-list %s %s %s%s", |
| 10783 | list->name, community_direct_str (entry->direct), |
| 10784 | community_list_config_str (entry), |
| 10785 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10786 | write++; |
| 10787 | } |
| 10788 | for (list = cm->str.head; list; list = list->next) |
| 10789 | for (entry = list->head; entry; entry = entry->next) |
| 10790 | { |
| 10791 | vty_out (vty, "ip community-list %s %s %s %s%s", |
| 10792 | entry->style == COMMUNITY_LIST_STANDARD |
| 10793 | ? "standard" : "expanded", |
| 10794 | list->name, community_direct_str (entry->direct), |
| 10795 | community_list_config_str (entry), |
| 10796 | VTY_NEWLINE); |
| 10797 | write++; |
| 10798 | } |
| 10799 | |
| 10800 | /* Extcommunity-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10801 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10802 | |
| 10803 | for (list = cm->num.head; list; list = list->next) |
| 10804 | for (entry = list->head; entry; entry = entry->next) |
| 10805 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10806 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
| 10807 | list->name, community_direct_str (entry->direct), |
| 10808 | community_list_config_str (entry), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10809 | write++; |
| 10810 | } |
| 10811 | for (list = cm->str.head; list; list = list->next) |
| 10812 | for (entry = list->head; entry; entry = entry->next) |
| 10813 | { |
| 10814 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", |
| 10815 | entry->style == EXTCOMMUNITY_LIST_STANDARD |
| 10816 | ? "standard" : "expanded", |
| 10817 | list->name, community_direct_str (entry->direct), |
| 10818 | community_list_config_str (entry), VTY_NEWLINE); |
| 10819 | write++; |
| 10820 | } |
| 10821 | return write; |
| 10822 | } |
| 10823 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 10824 | static struct cmd_node community_list_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10825 | { |
| 10826 | COMMUNITY_LIST_NODE, |
| 10827 | "", |
| 10828 | 1 /* Export to vtysh. */ |
| 10829 | }; |
| 10830 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10831 | static void |
| 10832 | community_list_vty (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10833 | { |
| 10834 | install_node (&community_list_node, community_list_config_write); |
| 10835 | |
| 10836 | /* Community-list. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10837 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
| 10838 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); |
| 10839 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); |
| 10840 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); |
| 10841 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); |
| 10842 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10843 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
| 10844 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
| 10845 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); |
| 10846 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10847 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
| 10848 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); |
| 10849 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); |
| 10850 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
| 10851 | install_element (VIEW_NODE, &show_ip_community_list_cmd); |
| 10852 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); |
| 10853 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); |
| 10854 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); |
| 10855 | |
| 10856 | /* Extcommunity-list. */ |
| 10857 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); |
| 10858 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); |
| 10859 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); |
| 10860 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); |
| 10861 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); |
| 10862 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10863 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
| 10864 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
| 10865 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); |
| 10866 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10867 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
| 10868 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); |
| 10869 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); |
| 10870 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
| 10871 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); |
| 10872 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 10873 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); |
| 10874 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 10875 | } |