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; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 216 | } |
| 217 | if (str) |
| 218 | { |
| 219 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); |
| 220 | return CMD_WARNING; |
| 221 | } |
| 222 | return CMD_SUCCESS; |
| 223 | } |
| 224 | |
| 225 | /* BGP global configuration. */ |
| 226 | |
| 227 | DEFUN (bgp_multiple_instance_func, |
| 228 | bgp_multiple_instance_cmd, |
| 229 | "bgp multiple-instance", |
| 230 | BGP_STR |
| 231 | "Enable bgp multiple instance\n") |
| 232 | { |
| 233 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); |
| 234 | return CMD_SUCCESS; |
| 235 | } |
| 236 | |
| 237 | DEFUN (no_bgp_multiple_instance, |
| 238 | no_bgp_multiple_instance_cmd, |
| 239 | "no bgp multiple-instance", |
| 240 | NO_STR |
| 241 | BGP_STR |
| 242 | "BGP multiple instance\n") |
| 243 | { |
| 244 | int ret; |
| 245 | |
| 246 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); |
| 247 | if (ret < 0) |
| 248 | { |
| 249 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); |
| 250 | return CMD_WARNING; |
| 251 | } |
| 252 | return CMD_SUCCESS; |
| 253 | } |
| 254 | |
| 255 | DEFUN (bgp_config_type, |
| 256 | bgp_config_type_cmd, |
| 257 | "bgp config-type (cisco|zebra)", |
| 258 | BGP_STR |
| 259 | "Configuration type\n" |
| 260 | "cisco\n" |
| 261 | "zebra\n") |
| 262 | { |
| 263 | if (strncmp (argv[0], "c", 1) == 0) |
| 264 | bgp_option_set (BGP_OPT_CONFIG_CISCO); |
| 265 | else |
| 266 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 267 | |
| 268 | return CMD_SUCCESS; |
| 269 | } |
| 270 | |
| 271 | DEFUN (no_bgp_config_type, |
| 272 | no_bgp_config_type_cmd, |
| 273 | "no bgp config-type", |
| 274 | NO_STR |
| 275 | BGP_STR |
| 276 | "Display configuration type\n") |
| 277 | { |
| 278 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); |
| 279 | return CMD_SUCCESS; |
| 280 | } |
| 281 | |
| 282 | DEFUN (no_synchronization, |
| 283 | no_synchronization_cmd, |
| 284 | "no synchronization", |
| 285 | NO_STR |
| 286 | "Perform IGP synchronization\n") |
| 287 | { |
| 288 | return CMD_SUCCESS; |
| 289 | } |
| 290 | |
| 291 | DEFUN (no_auto_summary, |
| 292 | no_auto_summary_cmd, |
| 293 | "no auto-summary", |
| 294 | NO_STR |
| 295 | "Enable automatic network number summarization\n") |
| 296 | { |
| 297 | return CMD_SUCCESS; |
| 298 | } |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 299 | |
| 300 | DEFUN_DEPRECATED (neighbor_version, |
| 301 | neighbor_version_cmd, |
| 302 | NEIGHBOR_CMD "version (4|4-)", |
| 303 | NEIGHBOR_STR |
| 304 | NEIGHBOR_ADDR_STR |
| 305 | "Set the BGP version to match a neighbor\n" |
| 306 | "Neighbor's BGP version\n") |
| 307 | { |
| 308 | return CMD_SUCCESS; |
| 309 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 310 | |
| 311 | /* "router bgp" commands. */ |
| 312 | DEFUN (router_bgp, |
| 313 | router_bgp_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 314 | "router bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 315 | ROUTER_STR |
| 316 | BGP_STR |
| 317 | AS_STR) |
| 318 | { |
| 319 | int ret; |
| 320 | as_t as; |
| 321 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 322 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 323 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 324 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 325 | |
| 326 | if (argc == 2) |
| 327 | name = argv[1]; |
| 328 | |
| 329 | ret = bgp_get (&bgp, &as, name); |
| 330 | switch (ret) |
| 331 | { |
| 332 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: |
| 333 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", |
| 334 | VTY_NEWLINE); |
| 335 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 336 | case BGP_ERR_AS_MISMATCH: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 337 | 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] | 338 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 339 | case BGP_ERR_INSTANCE_MISMATCH: |
| 340 | 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] | 341 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 342 | as, VTY_NEWLINE); |
| 343 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 344 | } |
| 345 | |
| 346 | vty->node = BGP_NODE; |
| 347 | vty->index = bgp; |
| 348 | |
| 349 | return CMD_SUCCESS; |
| 350 | } |
| 351 | |
| 352 | ALIAS (router_bgp, |
| 353 | router_bgp_view_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 354 | "router bgp " CMD_AS_RANGE " view WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 355 | ROUTER_STR |
| 356 | BGP_STR |
| 357 | AS_STR |
| 358 | "BGP view\n" |
| 359 | "view name\n") |
| 360 | |
| 361 | /* "no router bgp" commands. */ |
| 362 | DEFUN (no_router_bgp, |
| 363 | no_router_bgp_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 364 | "no router bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 365 | NO_STR |
| 366 | ROUTER_STR |
| 367 | BGP_STR |
| 368 | AS_STR) |
| 369 | { |
| 370 | as_t as; |
| 371 | struct bgp *bgp; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 372 | const char *name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 373 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 374 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 375 | |
| 376 | if (argc == 2) |
| 377 | name = argv[1]; |
| 378 | |
| 379 | /* Lookup bgp structure. */ |
| 380 | bgp = bgp_lookup (as, name); |
| 381 | if (! bgp) |
| 382 | { |
| 383 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); |
| 384 | return CMD_WARNING; |
| 385 | } |
| 386 | |
| 387 | bgp_delete (bgp); |
| 388 | |
| 389 | return CMD_SUCCESS; |
| 390 | } |
| 391 | |
| 392 | ALIAS (no_router_bgp, |
| 393 | no_router_bgp_view_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 394 | "no router bgp " CMD_AS_RANGE " view WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 395 | NO_STR |
| 396 | ROUTER_STR |
| 397 | BGP_STR |
| 398 | AS_STR |
| 399 | "BGP view\n" |
| 400 | "view name\n") |
| 401 | |
| 402 | /* BGP router-id. */ |
| 403 | |
| 404 | DEFUN (bgp_router_id, |
| 405 | bgp_router_id_cmd, |
| 406 | "bgp router-id A.B.C.D", |
| 407 | BGP_STR |
| 408 | "Override configured router identifier\n" |
| 409 | "Manually configured router identifier\n") |
| 410 | { |
| 411 | int ret; |
| 412 | struct in_addr id; |
| 413 | struct bgp *bgp; |
| 414 | |
| 415 | bgp = vty->index; |
| 416 | |
| 417 | ret = inet_aton (argv[0], &id); |
| 418 | if (! ret) |
| 419 | { |
| 420 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); |
| 421 | return CMD_WARNING; |
| 422 | } |
| 423 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 424 | bgp->router_id_static = id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 425 | bgp_router_id_set (bgp, &id); |
| 426 | |
| 427 | return CMD_SUCCESS; |
| 428 | } |
| 429 | |
| 430 | DEFUN (no_bgp_router_id, |
| 431 | no_bgp_router_id_cmd, |
| 432 | "no bgp router-id", |
| 433 | NO_STR |
| 434 | BGP_STR |
| 435 | "Override configured router identifier\n") |
| 436 | { |
| 437 | int ret; |
| 438 | struct in_addr id; |
| 439 | struct bgp *bgp; |
| 440 | |
| 441 | bgp = vty->index; |
| 442 | |
| 443 | if (argc == 1) |
| 444 | { |
| 445 | ret = inet_aton (argv[0], &id); |
| 446 | if (! ret) |
| 447 | { |
| 448 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); |
| 449 | return CMD_WARNING; |
| 450 | } |
| 451 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 452 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 453 | { |
| 454 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); |
| 455 | return CMD_WARNING; |
| 456 | } |
| 457 | } |
| 458 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 459 | bgp->router_id_static.s_addr = 0; |
| 460 | bgp_router_id_set (bgp, &router_id_zebra); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 461 | |
| 462 | return CMD_SUCCESS; |
| 463 | } |
| 464 | |
| 465 | ALIAS (no_bgp_router_id, |
| 466 | no_bgp_router_id_val_cmd, |
| 467 | "no bgp router-id A.B.C.D", |
| 468 | NO_STR |
| 469 | BGP_STR |
| 470 | "Override configured router identifier\n" |
| 471 | "Manually configured router identifier\n") |
| 472 | |
| 473 | /* BGP Cluster ID. */ |
| 474 | |
| 475 | DEFUN (bgp_cluster_id, |
| 476 | bgp_cluster_id_cmd, |
| 477 | "bgp cluster-id A.B.C.D", |
| 478 | BGP_STR |
| 479 | "Configure Route-Reflector Cluster-id\n" |
| 480 | "Route-Reflector Cluster-id in IP address format\n") |
| 481 | { |
| 482 | int ret; |
| 483 | struct bgp *bgp; |
| 484 | struct in_addr cluster; |
| 485 | |
| 486 | bgp = vty->index; |
| 487 | |
| 488 | ret = inet_aton (argv[0], &cluster); |
| 489 | if (! ret) |
| 490 | { |
| 491 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 492 | return CMD_WARNING; |
| 493 | } |
| 494 | |
| 495 | bgp_cluster_id_set (bgp, &cluster); |
| 496 | |
| 497 | return CMD_SUCCESS; |
| 498 | } |
| 499 | |
| 500 | ALIAS (bgp_cluster_id, |
| 501 | bgp_cluster_id32_cmd, |
| 502 | "bgp cluster-id <1-4294967295>", |
| 503 | BGP_STR |
| 504 | "Configure Route-Reflector Cluster-id\n" |
| 505 | "Route-Reflector Cluster-id as 32 bit quantity\n") |
| 506 | |
| 507 | DEFUN (no_bgp_cluster_id, |
| 508 | no_bgp_cluster_id_cmd, |
| 509 | "no bgp cluster-id", |
| 510 | NO_STR |
| 511 | BGP_STR |
| 512 | "Configure Route-Reflector Cluster-id\n") |
| 513 | { |
| 514 | int ret; |
| 515 | struct bgp *bgp; |
| 516 | struct in_addr cluster; |
| 517 | |
| 518 | bgp = vty->index; |
| 519 | |
| 520 | if (argc == 1) |
| 521 | { |
| 522 | ret = inet_aton (argv[0], &cluster); |
| 523 | if (! ret) |
| 524 | { |
| 525 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); |
| 526 | return CMD_WARNING; |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | bgp_cluster_id_unset (bgp); |
| 531 | |
| 532 | return CMD_SUCCESS; |
| 533 | } |
| 534 | |
| 535 | ALIAS (no_bgp_cluster_id, |
| 536 | no_bgp_cluster_id_arg_cmd, |
| 537 | "no bgp cluster-id A.B.C.D", |
| 538 | NO_STR |
| 539 | BGP_STR |
| 540 | "Configure Route-Reflector Cluster-id\n" |
| 541 | "Route-Reflector Cluster-id in IP address format\n") |
| 542 | |
| 543 | DEFUN (bgp_confederation_identifier, |
| 544 | bgp_confederation_identifier_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 545 | "bgp confederation identifier " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 546 | "BGP specific commands\n" |
| 547 | "AS confederation parameters\n" |
| 548 | "AS number\n" |
| 549 | "Set routing domain confederation AS\n") |
| 550 | { |
| 551 | struct bgp *bgp; |
| 552 | as_t as; |
| 553 | |
| 554 | bgp = vty->index; |
| 555 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 556 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 557 | |
| 558 | bgp_confederation_id_set (bgp, as); |
| 559 | |
| 560 | return CMD_SUCCESS; |
| 561 | } |
| 562 | |
| 563 | DEFUN (no_bgp_confederation_identifier, |
| 564 | no_bgp_confederation_identifier_cmd, |
| 565 | "no bgp confederation identifier", |
| 566 | NO_STR |
| 567 | "BGP specific commands\n" |
| 568 | "AS confederation parameters\n" |
| 569 | "AS number\n") |
| 570 | { |
| 571 | struct bgp *bgp; |
| 572 | as_t as; |
| 573 | |
| 574 | bgp = vty->index; |
| 575 | |
| 576 | if (argc == 1) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 577 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 578 | |
| 579 | bgp_confederation_id_unset (bgp); |
| 580 | |
| 581 | return CMD_SUCCESS; |
| 582 | } |
| 583 | |
| 584 | ALIAS (no_bgp_confederation_identifier, |
| 585 | no_bgp_confederation_identifier_arg_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 586 | "no bgp confederation identifier " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 587 | NO_STR |
| 588 | "BGP specific commands\n" |
| 589 | "AS confederation parameters\n" |
| 590 | "AS number\n" |
| 591 | "Set routing domain confederation AS\n") |
| 592 | |
| 593 | DEFUN (bgp_confederation_peers, |
| 594 | bgp_confederation_peers_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 595 | "bgp confederation peers ." CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 596 | "BGP specific commands\n" |
| 597 | "AS confederation parameters\n" |
| 598 | "Peer ASs in BGP confederation\n" |
| 599 | AS_STR) |
| 600 | { |
| 601 | struct bgp *bgp; |
| 602 | as_t as; |
| 603 | int i; |
| 604 | |
| 605 | bgp = vty->index; |
| 606 | |
| 607 | for (i = 0; i < argc; i++) |
| 608 | { |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 609 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 610 | |
| 611 | if (bgp->as == as) |
| 612 | { |
| 613 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", |
| 614 | VTY_NEWLINE); |
| 615 | continue; |
| 616 | } |
| 617 | |
| 618 | bgp_confederation_peers_add (bgp, as); |
| 619 | } |
| 620 | return CMD_SUCCESS; |
| 621 | } |
| 622 | |
| 623 | DEFUN (no_bgp_confederation_peers, |
| 624 | no_bgp_confederation_peers_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 625 | "no bgp confederation peers ." CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 626 | NO_STR |
| 627 | "BGP specific commands\n" |
| 628 | "AS confederation parameters\n" |
| 629 | "Peer ASs in BGP confederation\n" |
| 630 | AS_STR) |
| 631 | { |
| 632 | struct bgp *bgp; |
| 633 | as_t as; |
| 634 | int i; |
| 635 | |
| 636 | bgp = vty->index; |
| 637 | |
| 638 | for (i = 0; i < argc; i++) |
| 639 | { |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 640 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
| 641 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 642 | bgp_confederation_peers_remove (bgp, as); |
| 643 | } |
| 644 | return CMD_SUCCESS; |
| 645 | } |
| 646 | |
| 647 | /* BGP timers. */ |
| 648 | |
| 649 | DEFUN (bgp_timers, |
| 650 | bgp_timers_cmd, |
| 651 | "timers bgp <0-65535> <0-65535>", |
| 652 | "Adjust routing timers\n" |
| 653 | "BGP timers\n" |
| 654 | "Keepalive interval\n" |
| 655 | "Holdtime\n") |
| 656 | { |
| 657 | struct bgp *bgp; |
| 658 | unsigned long keepalive = 0; |
| 659 | unsigned long holdtime = 0; |
| 660 | |
| 661 | bgp = vty->index; |
| 662 | |
| 663 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); |
| 664 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); |
| 665 | |
| 666 | /* Holdtime value check. */ |
| 667 | if (holdtime < 3 && holdtime != 0) |
| 668 | { |
| 669 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", |
| 670 | VTY_NEWLINE); |
| 671 | return CMD_WARNING; |
| 672 | } |
| 673 | |
| 674 | bgp_timers_set (bgp, keepalive, holdtime); |
| 675 | |
| 676 | return CMD_SUCCESS; |
| 677 | } |
| 678 | |
| 679 | DEFUN (no_bgp_timers, |
| 680 | no_bgp_timers_cmd, |
| 681 | "no timers bgp", |
| 682 | NO_STR |
| 683 | "Adjust routing timers\n" |
| 684 | "BGP timers\n") |
| 685 | { |
| 686 | struct bgp *bgp; |
| 687 | |
| 688 | bgp = vty->index; |
| 689 | bgp_timers_unset (bgp); |
| 690 | |
| 691 | return CMD_SUCCESS; |
| 692 | } |
| 693 | |
| 694 | ALIAS (no_bgp_timers, |
| 695 | no_bgp_timers_arg_cmd, |
| 696 | "no timers bgp <0-65535> <0-65535>", |
| 697 | NO_STR |
| 698 | "Adjust routing timers\n" |
| 699 | "BGP timers\n" |
| 700 | "Keepalive interval\n" |
| 701 | "Holdtime\n") |
| 702 | |
| 703 | DEFUN (bgp_client_to_client_reflection, |
| 704 | bgp_client_to_client_reflection_cmd, |
| 705 | "bgp client-to-client reflection", |
| 706 | "BGP specific commands\n" |
| 707 | "Configure client to client route reflection\n" |
| 708 | "reflection of routes allowed\n") |
| 709 | { |
| 710 | struct bgp *bgp; |
| 711 | |
| 712 | bgp = vty->index; |
| 713 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 714 | return CMD_SUCCESS; |
| 715 | } |
| 716 | |
| 717 | DEFUN (no_bgp_client_to_client_reflection, |
| 718 | no_bgp_client_to_client_reflection_cmd, |
| 719 | "no bgp client-to-client reflection", |
| 720 | NO_STR |
| 721 | "BGP specific commands\n" |
| 722 | "Configure client to client route reflection\n" |
| 723 | "reflection of routes allowed\n") |
| 724 | { |
| 725 | struct bgp *bgp; |
| 726 | |
| 727 | bgp = vty->index; |
| 728 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); |
| 729 | return CMD_SUCCESS; |
| 730 | } |
| 731 | |
| 732 | /* "bgp always-compare-med" configuration. */ |
| 733 | DEFUN (bgp_always_compare_med, |
| 734 | bgp_always_compare_med_cmd, |
| 735 | "bgp always-compare-med", |
| 736 | "BGP specific commands\n" |
| 737 | "Allow comparing MED from different neighbors\n") |
| 738 | { |
| 739 | struct bgp *bgp; |
| 740 | |
| 741 | bgp = vty->index; |
| 742 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 743 | return CMD_SUCCESS; |
| 744 | } |
| 745 | |
| 746 | DEFUN (no_bgp_always_compare_med, |
| 747 | no_bgp_always_compare_med_cmd, |
| 748 | "no bgp always-compare-med", |
| 749 | NO_STR |
| 750 | "BGP specific commands\n" |
| 751 | "Allow comparing MED from different neighbors\n") |
| 752 | { |
| 753 | struct bgp *bgp; |
| 754 | |
| 755 | bgp = vty->index; |
| 756 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); |
| 757 | return CMD_SUCCESS; |
| 758 | } |
| 759 | |
| 760 | /* "bgp deterministic-med" configuration. */ |
| 761 | DEFUN (bgp_deterministic_med, |
| 762 | bgp_deterministic_med_cmd, |
| 763 | "bgp deterministic-med", |
| 764 | "BGP specific commands\n" |
| 765 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 766 | { |
| 767 | struct bgp *bgp; |
| 768 | |
| 769 | bgp = vty->index; |
| 770 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 771 | return CMD_SUCCESS; |
| 772 | } |
| 773 | |
| 774 | DEFUN (no_bgp_deterministic_med, |
| 775 | no_bgp_deterministic_med_cmd, |
| 776 | "no bgp deterministic-med", |
| 777 | NO_STR |
| 778 | "BGP specific commands\n" |
| 779 | "Pick the best-MED path among paths advertised from the neighboring AS\n") |
| 780 | { |
| 781 | struct bgp *bgp; |
| 782 | |
| 783 | bgp = vty->index; |
| 784 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); |
| 785 | return CMD_SUCCESS; |
| 786 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 787 | |
| 788 | /* "bgp graceful-restart" configuration. */ |
| 789 | DEFUN (bgp_graceful_restart, |
| 790 | bgp_graceful_restart_cmd, |
| 791 | "bgp graceful-restart", |
| 792 | "BGP specific commands\n" |
| 793 | "Graceful restart capability parameters\n") |
| 794 | { |
| 795 | struct bgp *bgp; |
| 796 | |
| 797 | bgp = vty->index; |
| 798 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 799 | return CMD_SUCCESS; |
| 800 | } |
| 801 | |
| 802 | DEFUN (no_bgp_graceful_restart, |
| 803 | no_bgp_graceful_restart_cmd, |
| 804 | "no bgp graceful-restart", |
| 805 | NO_STR |
| 806 | "BGP specific commands\n" |
| 807 | "Graceful restart capability parameters\n") |
| 808 | { |
| 809 | struct bgp *bgp; |
| 810 | |
| 811 | bgp = vty->index; |
| 812 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); |
| 813 | return CMD_SUCCESS; |
| 814 | } |
| 815 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 816 | DEFUN (bgp_graceful_restart_stalepath_time, |
| 817 | bgp_graceful_restart_stalepath_time_cmd, |
| 818 | "bgp graceful-restart stalepath-time <1-3600>", |
| 819 | "BGP specific commands\n" |
| 820 | "Graceful restart capability parameters\n" |
| 821 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 822 | "Delay value (seconds)\n") |
| 823 | { |
| 824 | struct bgp *bgp; |
| 825 | u_int32_t stalepath; |
| 826 | |
| 827 | bgp = vty->index; |
| 828 | if (! bgp) |
| 829 | return CMD_WARNING; |
| 830 | |
| 831 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); |
| 832 | bgp->stalepath_time = stalepath; |
| 833 | return CMD_SUCCESS; |
| 834 | } |
| 835 | |
| 836 | DEFUN (no_bgp_graceful_restart_stalepath_time, |
| 837 | no_bgp_graceful_restart_stalepath_time_cmd, |
| 838 | "no bgp graceful-restart stalepath-time", |
| 839 | NO_STR |
| 840 | "BGP specific commands\n" |
| 841 | "Graceful restart capability parameters\n" |
| 842 | "Set the max time to hold onto restarting peer's stale paths\n") |
| 843 | { |
| 844 | struct bgp *bgp; |
| 845 | |
| 846 | bgp = vty->index; |
| 847 | if (! bgp) |
| 848 | return CMD_WARNING; |
| 849 | |
| 850 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; |
| 851 | return CMD_SUCCESS; |
| 852 | } |
| 853 | |
| 854 | ALIAS (no_bgp_graceful_restart_stalepath_time, |
| 855 | no_bgp_graceful_restart_stalepath_time_val_cmd, |
| 856 | "no bgp graceful-restart stalepath-time <1-3600>", |
| 857 | NO_STR |
| 858 | "BGP specific commands\n" |
| 859 | "Graceful restart capability parameters\n" |
| 860 | "Set the max time to hold onto restarting peer's stale paths\n" |
| 861 | "Delay value (seconds)\n") |
| 862 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 863 | /* "bgp fast-external-failover" configuration. */ |
| 864 | DEFUN (bgp_fast_external_failover, |
| 865 | bgp_fast_external_failover_cmd, |
| 866 | "bgp fast-external-failover", |
| 867 | BGP_STR |
| 868 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 869 | { |
| 870 | struct bgp *bgp; |
| 871 | |
| 872 | bgp = vty->index; |
| 873 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 874 | return CMD_SUCCESS; |
| 875 | } |
| 876 | |
| 877 | DEFUN (no_bgp_fast_external_failover, |
| 878 | no_bgp_fast_external_failover_cmd, |
| 879 | "no bgp fast-external-failover", |
| 880 | NO_STR |
| 881 | BGP_STR |
| 882 | "Immediately reset session if a link to a directly connected external peer goes down\n") |
| 883 | { |
| 884 | struct bgp *bgp; |
| 885 | |
| 886 | bgp = vty->index; |
| 887 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); |
| 888 | return CMD_SUCCESS; |
| 889 | } |
| 890 | |
| 891 | /* "bgp enforce-first-as" configuration. */ |
| 892 | DEFUN (bgp_enforce_first_as, |
| 893 | bgp_enforce_first_as_cmd, |
| 894 | "bgp enforce-first-as", |
| 895 | BGP_STR |
| 896 | "Enforce the first AS for EBGP routes\n") |
| 897 | { |
| 898 | struct bgp *bgp; |
| 899 | |
| 900 | bgp = vty->index; |
| 901 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 902 | return CMD_SUCCESS; |
| 903 | } |
| 904 | |
| 905 | DEFUN (no_bgp_enforce_first_as, |
| 906 | no_bgp_enforce_first_as_cmd, |
| 907 | "no bgp enforce-first-as", |
| 908 | NO_STR |
| 909 | BGP_STR |
| 910 | "Enforce the first AS for EBGP routes\n") |
| 911 | { |
| 912 | struct bgp *bgp; |
| 913 | |
| 914 | bgp = vty->index; |
| 915 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); |
| 916 | return CMD_SUCCESS; |
| 917 | } |
| 918 | |
| 919 | /* "bgp bestpath compare-routerid" configuration. */ |
| 920 | DEFUN (bgp_bestpath_compare_router_id, |
| 921 | bgp_bestpath_compare_router_id_cmd, |
| 922 | "bgp bestpath compare-routerid", |
| 923 | "BGP specific commands\n" |
| 924 | "Change the default bestpath selection\n" |
| 925 | "Compare router-id for identical EBGP paths\n") |
| 926 | { |
| 927 | struct bgp *bgp; |
| 928 | |
| 929 | bgp = vty->index; |
| 930 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 931 | return CMD_SUCCESS; |
| 932 | } |
| 933 | |
| 934 | DEFUN (no_bgp_bestpath_compare_router_id, |
| 935 | no_bgp_bestpath_compare_router_id_cmd, |
| 936 | "no bgp bestpath compare-routerid", |
| 937 | NO_STR |
| 938 | "BGP specific commands\n" |
| 939 | "Change the default bestpath selection\n" |
| 940 | "Compare router-id for identical EBGP paths\n") |
| 941 | { |
| 942 | struct bgp *bgp; |
| 943 | |
| 944 | bgp = vty->index; |
| 945 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); |
| 946 | return CMD_SUCCESS; |
| 947 | } |
| 948 | |
| 949 | /* "bgp bestpath as-path ignore" configuration. */ |
| 950 | DEFUN (bgp_bestpath_aspath_ignore, |
| 951 | bgp_bestpath_aspath_ignore_cmd, |
| 952 | "bgp bestpath as-path ignore", |
| 953 | "BGP specific commands\n" |
| 954 | "Change the default bestpath selection\n" |
| 955 | "AS-path attribute\n" |
| 956 | "Ignore as-path length in selecting a route\n") |
| 957 | { |
| 958 | struct bgp *bgp; |
| 959 | |
| 960 | bgp = vty->index; |
| 961 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 962 | return CMD_SUCCESS; |
| 963 | } |
| 964 | |
| 965 | DEFUN (no_bgp_bestpath_aspath_ignore, |
| 966 | no_bgp_bestpath_aspath_ignore_cmd, |
| 967 | "no bgp bestpath as-path ignore", |
| 968 | NO_STR |
| 969 | "BGP specific commands\n" |
| 970 | "Change the default bestpath selection\n" |
| 971 | "AS-path attribute\n" |
| 972 | "Ignore as-path length in selecting a route\n") |
| 973 | { |
| 974 | struct bgp *bgp; |
| 975 | |
| 976 | bgp = vty->index; |
| 977 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); |
| 978 | return CMD_SUCCESS; |
| 979 | } |
| 980 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 981 | /* "bgp bestpath as-path confed" configuration. */ |
| 982 | DEFUN (bgp_bestpath_aspath_confed, |
| 983 | bgp_bestpath_aspath_confed_cmd, |
| 984 | "bgp bestpath as-path confed", |
| 985 | "BGP specific commands\n" |
| 986 | "Change the default bestpath selection\n" |
| 987 | "AS-path attribute\n" |
| 988 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 989 | { |
| 990 | struct bgp *bgp; |
| 991 | |
| 992 | bgp = vty->index; |
| 993 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); |
| 994 | return CMD_SUCCESS; |
| 995 | } |
| 996 | |
| 997 | DEFUN (no_bgp_bestpath_aspath_confed, |
| 998 | no_bgp_bestpath_aspath_confed_cmd, |
| 999 | "no bgp bestpath as-path confed", |
| 1000 | NO_STR |
| 1001 | "BGP specific commands\n" |
| 1002 | "Change the default bestpath selection\n" |
| 1003 | "AS-path attribute\n" |
| 1004 | "Compare path lengths including confederation sets & sequences in selecting a route\n") |
| 1005 | { |
| 1006 | struct bgp *bgp; |
| 1007 | |
| 1008 | bgp = vty->index; |
| 1009 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); |
| 1010 | return CMD_SUCCESS; |
| 1011 | } |
| 1012 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 1013 | /* "bgp log-neighbor-changes" configuration. */ |
| 1014 | DEFUN (bgp_log_neighbor_changes, |
| 1015 | bgp_log_neighbor_changes_cmd, |
| 1016 | "bgp log-neighbor-changes", |
| 1017 | "BGP specific commands\n" |
| 1018 | "Log neighbor up/down and reset reason\n") |
| 1019 | { |
| 1020 | struct bgp *bgp; |
| 1021 | |
| 1022 | bgp = vty->index; |
| 1023 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1024 | return CMD_SUCCESS; |
| 1025 | } |
| 1026 | |
| 1027 | DEFUN (no_bgp_log_neighbor_changes, |
| 1028 | no_bgp_log_neighbor_changes_cmd, |
| 1029 | "no bgp log-neighbor-changes", |
| 1030 | NO_STR |
| 1031 | "BGP specific commands\n" |
| 1032 | "Log neighbor up/down and reset reason\n") |
| 1033 | { |
| 1034 | struct bgp *bgp; |
| 1035 | |
| 1036 | bgp = vty->index; |
| 1037 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); |
| 1038 | return CMD_SUCCESS; |
| 1039 | } |
| 1040 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1041 | /* "bgp bestpath med" configuration. */ |
| 1042 | DEFUN (bgp_bestpath_med, |
| 1043 | bgp_bestpath_med_cmd, |
| 1044 | "bgp bestpath med (confed|missing-as-worst)", |
| 1045 | "BGP specific commands\n" |
| 1046 | "Change the default bestpath selection\n" |
| 1047 | "MED attribute\n" |
| 1048 | "Compare MED among confederation paths\n" |
| 1049 | "Treat missing MED as the least preferred one\n") |
| 1050 | { |
| 1051 | struct bgp *bgp; |
| 1052 | |
| 1053 | bgp = vty->index; |
| 1054 | |
| 1055 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1056 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1057 | else |
| 1058 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1059 | |
| 1060 | return CMD_SUCCESS; |
| 1061 | } |
| 1062 | |
| 1063 | DEFUN (bgp_bestpath_med2, |
| 1064 | bgp_bestpath_med2_cmd, |
| 1065 | "bgp bestpath med confed missing-as-worst", |
| 1066 | "BGP specific commands\n" |
| 1067 | "Change the default bestpath selection\n" |
| 1068 | "MED attribute\n" |
| 1069 | "Compare MED among confederation paths\n" |
| 1070 | "Treat missing MED as the least preferred one\n") |
| 1071 | { |
| 1072 | struct bgp *bgp; |
| 1073 | |
| 1074 | bgp = vty->index; |
| 1075 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
| 1076 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1077 | return CMD_SUCCESS; |
| 1078 | } |
| 1079 | |
| 1080 | ALIAS (bgp_bestpath_med2, |
| 1081 | bgp_bestpath_med3_cmd, |
| 1082 | "bgp bestpath med missing-as-worst confed", |
| 1083 | "BGP specific commands\n" |
| 1084 | "Change the default bestpath selection\n" |
| 1085 | "MED attribute\n" |
| 1086 | "Treat missing MED as the least preferred one\n" |
| 1087 | "Compare MED among confederation paths\n") |
| 1088 | |
| 1089 | DEFUN (no_bgp_bestpath_med, |
| 1090 | no_bgp_bestpath_med_cmd, |
| 1091 | "no bgp bestpath med (confed|missing-as-worst)", |
| 1092 | NO_STR |
| 1093 | "BGP specific commands\n" |
| 1094 | "Change the default bestpath selection\n" |
| 1095 | "MED attribute\n" |
| 1096 | "Compare MED among confederation paths\n" |
| 1097 | "Treat missing MED as the least preferred one\n") |
| 1098 | { |
| 1099 | struct bgp *bgp; |
| 1100 | |
| 1101 | bgp = vty->index; |
| 1102 | |
| 1103 | if (strncmp (argv[0], "confed", 1) == 0) |
| 1104 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1105 | else |
| 1106 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1107 | |
| 1108 | return CMD_SUCCESS; |
| 1109 | } |
| 1110 | |
| 1111 | DEFUN (no_bgp_bestpath_med2, |
| 1112 | no_bgp_bestpath_med2_cmd, |
| 1113 | "no bgp bestpath med confed missing-as-worst", |
| 1114 | NO_STR |
| 1115 | "BGP specific commands\n" |
| 1116 | "Change the default bestpath selection\n" |
| 1117 | "MED attribute\n" |
| 1118 | "Compare MED among confederation paths\n" |
| 1119 | "Treat missing MED as the least preferred one\n") |
| 1120 | { |
| 1121 | struct bgp *bgp; |
| 1122 | |
| 1123 | bgp = vty->index; |
| 1124 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
| 1125 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); |
| 1126 | return CMD_SUCCESS; |
| 1127 | } |
| 1128 | |
| 1129 | ALIAS (no_bgp_bestpath_med2, |
| 1130 | no_bgp_bestpath_med3_cmd, |
| 1131 | "no bgp bestpath med missing-as-worst confed", |
| 1132 | NO_STR |
| 1133 | "BGP specific commands\n" |
| 1134 | "Change the default bestpath selection\n" |
| 1135 | "MED attribute\n" |
| 1136 | "Treat missing MED as the least preferred one\n" |
| 1137 | "Compare MED among confederation paths\n") |
| 1138 | |
| 1139 | /* "no bgp default ipv4-unicast". */ |
| 1140 | DEFUN (no_bgp_default_ipv4_unicast, |
| 1141 | no_bgp_default_ipv4_unicast_cmd, |
| 1142 | "no bgp default ipv4-unicast", |
| 1143 | NO_STR |
| 1144 | "BGP specific commands\n" |
| 1145 | "Configure BGP defaults\n" |
| 1146 | "Activate ipv4-unicast for a peer by default\n") |
| 1147 | { |
| 1148 | struct bgp *bgp; |
| 1149 | |
| 1150 | bgp = vty->index; |
| 1151 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1152 | return CMD_SUCCESS; |
| 1153 | } |
| 1154 | |
| 1155 | DEFUN (bgp_default_ipv4_unicast, |
| 1156 | bgp_default_ipv4_unicast_cmd, |
| 1157 | "bgp default ipv4-unicast", |
| 1158 | "BGP specific commands\n" |
| 1159 | "Configure BGP defaults\n" |
| 1160 | "Activate ipv4-unicast for a peer by default\n") |
| 1161 | { |
| 1162 | struct bgp *bgp; |
| 1163 | |
| 1164 | bgp = vty->index; |
| 1165 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); |
| 1166 | return CMD_SUCCESS; |
| 1167 | } |
| 1168 | |
| 1169 | /* "bgp import-check" configuration. */ |
| 1170 | DEFUN (bgp_network_import_check, |
| 1171 | bgp_network_import_check_cmd, |
| 1172 | "bgp network import-check", |
| 1173 | "BGP specific commands\n" |
| 1174 | "BGP network command\n" |
| 1175 | "Check BGP network route exists in IGP\n") |
| 1176 | { |
| 1177 | struct bgp *bgp; |
| 1178 | |
| 1179 | bgp = vty->index; |
| 1180 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1181 | return CMD_SUCCESS; |
| 1182 | } |
| 1183 | |
| 1184 | DEFUN (no_bgp_network_import_check, |
| 1185 | no_bgp_network_import_check_cmd, |
| 1186 | "no bgp network import-check", |
| 1187 | NO_STR |
| 1188 | "BGP specific commands\n" |
| 1189 | "BGP network command\n" |
| 1190 | "Check BGP network route exists in IGP\n") |
| 1191 | { |
| 1192 | struct bgp *bgp; |
| 1193 | |
| 1194 | bgp = vty->index; |
| 1195 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); |
| 1196 | return CMD_SUCCESS; |
| 1197 | } |
| 1198 | |
| 1199 | DEFUN (bgp_default_local_preference, |
| 1200 | bgp_default_local_preference_cmd, |
| 1201 | "bgp default local-preference <0-4294967295>", |
| 1202 | "BGP specific commands\n" |
| 1203 | "Configure BGP defaults\n" |
| 1204 | "local preference (higher=more preferred)\n" |
| 1205 | "Configure default local preference value\n") |
| 1206 | { |
| 1207 | struct bgp *bgp; |
| 1208 | u_int32_t local_pref; |
| 1209 | |
| 1210 | bgp = vty->index; |
| 1211 | |
| 1212 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); |
| 1213 | |
| 1214 | bgp_default_local_preference_set (bgp, local_pref); |
| 1215 | |
| 1216 | return CMD_SUCCESS; |
| 1217 | } |
| 1218 | |
| 1219 | DEFUN (no_bgp_default_local_preference, |
| 1220 | no_bgp_default_local_preference_cmd, |
| 1221 | "no bgp default local-preference", |
| 1222 | NO_STR |
| 1223 | "BGP specific commands\n" |
| 1224 | "Configure BGP defaults\n" |
| 1225 | "local preference (higher=more preferred)\n") |
| 1226 | { |
| 1227 | struct bgp *bgp; |
| 1228 | |
| 1229 | bgp = vty->index; |
| 1230 | bgp_default_local_preference_unset (bgp); |
| 1231 | return CMD_SUCCESS; |
| 1232 | } |
| 1233 | |
| 1234 | ALIAS (no_bgp_default_local_preference, |
| 1235 | no_bgp_default_local_preference_val_cmd, |
| 1236 | "no bgp default local-preference <0-4294967295>", |
| 1237 | NO_STR |
| 1238 | "BGP specific commands\n" |
| 1239 | "Configure BGP defaults\n" |
| 1240 | "local preference (higher=more preferred)\n" |
| 1241 | "Configure default local preference value\n") |
| 1242 | |
| 1243 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1244 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
| 1245 | const char *as_str, afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1246 | { |
| 1247 | int ret; |
| 1248 | struct bgp *bgp; |
| 1249 | as_t as; |
| 1250 | union sockunion su; |
| 1251 | |
| 1252 | bgp = vty->index; |
| 1253 | |
| 1254 | /* Get AS number. */ |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 1255 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1256 | |
| 1257 | /* If peer is peer group, call proper function. */ |
| 1258 | ret = str2sockunion (peer_str, &su); |
| 1259 | if (ret < 0) |
| 1260 | { |
| 1261 | ret = peer_group_remote_as (bgp, peer_str, &as); |
| 1262 | if (ret < 0) |
| 1263 | { |
| 1264 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1265 | return CMD_WARNING; |
| 1266 | } |
| 1267 | return CMD_SUCCESS; |
| 1268 | } |
| 1269 | |
| 1270 | if (peer_address_self_check (&su)) |
| 1271 | { |
| 1272 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1273 | VTY_NEWLINE); |
| 1274 | return CMD_WARNING; |
| 1275 | } |
| 1276 | |
| 1277 | ret = peer_remote_as (bgp, &su, &as, afi, safi); |
| 1278 | |
| 1279 | /* This peer belongs to peer group. */ |
| 1280 | switch (ret) |
| 1281 | { |
| 1282 | case BGP_ERR_PEER_GROUP_MEMBER: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1283 | 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] | 1284 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1285 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1286 | 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] | 1287 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1288 | } |
| 1289 | return bgp_vty_return (vty, ret); |
| 1290 | } |
| 1291 | |
| 1292 | DEFUN (neighbor_remote_as, |
| 1293 | neighbor_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1294 | NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1295 | NEIGHBOR_STR |
| 1296 | NEIGHBOR_ADDR_STR2 |
| 1297 | "Specify a BGP neighbor\n" |
| 1298 | AS_STR) |
| 1299 | { |
| 1300 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); |
| 1301 | } |
| 1302 | |
| 1303 | DEFUN (neighbor_peer_group, |
| 1304 | neighbor_peer_group_cmd, |
| 1305 | "neighbor WORD peer-group", |
| 1306 | NEIGHBOR_STR |
| 1307 | "Neighbor tag\n" |
| 1308 | "Configure peer-group\n") |
| 1309 | { |
| 1310 | struct bgp *bgp; |
| 1311 | struct peer_group *group; |
| 1312 | |
| 1313 | bgp = vty->index; |
| 1314 | |
| 1315 | group = peer_group_get (bgp, argv[0]); |
| 1316 | if (! group) |
| 1317 | return CMD_WARNING; |
| 1318 | |
| 1319 | return CMD_SUCCESS; |
| 1320 | } |
| 1321 | |
| 1322 | DEFUN (no_neighbor, |
| 1323 | no_neighbor_cmd, |
| 1324 | NO_NEIGHBOR_CMD2, |
| 1325 | NO_STR |
| 1326 | NEIGHBOR_STR |
| 1327 | NEIGHBOR_ADDR_STR2) |
| 1328 | { |
| 1329 | int ret; |
| 1330 | union sockunion su; |
| 1331 | struct peer_group *group; |
| 1332 | struct peer *peer; |
| 1333 | |
| 1334 | ret = str2sockunion (argv[0], &su); |
| 1335 | if (ret < 0) |
| 1336 | { |
| 1337 | group = peer_group_lookup (vty->index, argv[0]); |
| 1338 | if (group) |
| 1339 | peer_group_delete (group); |
| 1340 | else |
| 1341 | { |
| 1342 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1343 | return CMD_WARNING; |
| 1344 | } |
| 1345 | } |
| 1346 | else |
| 1347 | { |
| 1348 | peer = peer_lookup (vty->index, &su); |
| 1349 | if (peer) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 1350 | peer_delete (peer); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1351 | } |
| 1352 | |
| 1353 | return CMD_SUCCESS; |
| 1354 | } |
| 1355 | |
| 1356 | ALIAS (no_neighbor, |
| 1357 | no_neighbor_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1358 | NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1359 | NO_STR |
| 1360 | NEIGHBOR_STR |
| 1361 | NEIGHBOR_ADDR_STR |
| 1362 | "Specify a BGP neighbor\n" |
| 1363 | AS_STR) |
| 1364 | |
| 1365 | DEFUN (no_neighbor_peer_group, |
| 1366 | no_neighbor_peer_group_cmd, |
| 1367 | "no neighbor WORD peer-group", |
| 1368 | NO_STR |
| 1369 | NEIGHBOR_STR |
| 1370 | "Neighbor tag\n" |
| 1371 | "Configure peer-group\n") |
| 1372 | { |
| 1373 | struct peer_group *group; |
| 1374 | |
| 1375 | group = peer_group_lookup (vty->index, argv[0]); |
| 1376 | if (group) |
| 1377 | peer_group_delete (group); |
| 1378 | else |
| 1379 | { |
| 1380 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1381 | return CMD_WARNING; |
| 1382 | } |
| 1383 | return CMD_SUCCESS; |
| 1384 | } |
| 1385 | |
| 1386 | DEFUN (no_neighbor_peer_group_remote_as, |
| 1387 | no_neighbor_peer_group_remote_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1388 | "no neighbor WORD remote-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1389 | NO_STR |
| 1390 | NEIGHBOR_STR |
| 1391 | "Neighbor tag\n" |
| 1392 | "Specify a BGP neighbor\n" |
| 1393 | AS_STR) |
| 1394 | { |
| 1395 | struct peer_group *group; |
| 1396 | |
| 1397 | group = peer_group_lookup (vty->index, argv[0]); |
| 1398 | if (group) |
| 1399 | peer_group_remote_as_delete (group); |
| 1400 | else |
| 1401 | { |
| 1402 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); |
| 1403 | return CMD_WARNING; |
| 1404 | } |
| 1405 | return CMD_SUCCESS; |
| 1406 | } |
| 1407 | |
| 1408 | DEFUN (neighbor_local_as, |
| 1409 | neighbor_local_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1410 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1411 | NEIGHBOR_STR |
| 1412 | NEIGHBOR_ADDR_STR2 |
| 1413 | "Specify a local-as number\n" |
| 1414 | "AS number used as local AS\n") |
| 1415 | { |
| 1416 | struct peer *peer; |
| 1417 | int ret; |
| 1418 | |
| 1419 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1420 | if (! peer) |
| 1421 | return CMD_WARNING; |
| 1422 | |
| 1423 | ret = peer_local_as_set (peer, atoi (argv[1]), 0); |
| 1424 | return bgp_vty_return (vty, ret); |
| 1425 | } |
| 1426 | |
| 1427 | DEFUN (neighbor_local_as_no_prepend, |
| 1428 | neighbor_local_as_no_prepend_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1429 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1430 | NEIGHBOR_STR |
| 1431 | NEIGHBOR_ADDR_STR2 |
| 1432 | "Specify a local-as number\n" |
| 1433 | "AS number used as local AS\n" |
| 1434 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1435 | { |
| 1436 | struct peer *peer; |
| 1437 | int ret; |
| 1438 | |
| 1439 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1440 | if (! peer) |
| 1441 | return CMD_WARNING; |
| 1442 | |
| 1443 | ret = peer_local_as_set (peer, atoi (argv[1]), 1); |
| 1444 | return bgp_vty_return (vty, ret); |
| 1445 | } |
| 1446 | |
| 1447 | DEFUN (no_neighbor_local_as, |
| 1448 | no_neighbor_local_as_cmd, |
| 1449 | NO_NEIGHBOR_CMD2 "local-as", |
| 1450 | NO_STR |
| 1451 | NEIGHBOR_STR |
| 1452 | NEIGHBOR_ADDR_STR2 |
| 1453 | "Specify a local-as number\n") |
| 1454 | { |
| 1455 | struct peer *peer; |
| 1456 | int ret; |
| 1457 | |
| 1458 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1459 | if (! peer) |
| 1460 | return CMD_WARNING; |
| 1461 | |
| 1462 | ret = peer_local_as_unset (peer); |
| 1463 | return bgp_vty_return (vty, ret); |
| 1464 | } |
| 1465 | |
| 1466 | ALIAS (no_neighbor_local_as, |
| 1467 | no_neighbor_local_as_val_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1468 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1469 | NO_STR |
| 1470 | NEIGHBOR_STR |
| 1471 | NEIGHBOR_ADDR_STR2 |
| 1472 | "Specify a local-as number\n" |
| 1473 | "AS number used as local AS\n") |
| 1474 | |
| 1475 | ALIAS (no_neighbor_local_as, |
| 1476 | no_neighbor_local_as_val2_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 1477 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1478 | NO_STR |
| 1479 | NEIGHBOR_STR |
| 1480 | NEIGHBOR_ADDR_STR2 |
| 1481 | "Specify a local-as number\n" |
| 1482 | "AS number used as local AS\n" |
| 1483 | "Do not prepend local-as to updates from ebgp peers\n") |
| 1484 | |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 1485 | DEFUN (neighbor_password, |
| 1486 | neighbor_password_cmd, |
| 1487 | NEIGHBOR_CMD2 "password LINE", |
| 1488 | NEIGHBOR_STR |
| 1489 | NEIGHBOR_ADDR_STR2 |
| 1490 | "Set a password\n" |
| 1491 | "The password\n") |
| 1492 | { |
| 1493 | struct peer *peer; |
| 1494 | int ret; |
| 1495 | |
| 1496 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1497 | if (! peer) |
| 1498 | return CMD_WARNING; |
| 1499 | |
| 1500 | ret = peer_password_set (peer, argv[1]); |
| 1501 | return bgp_vty_return (vty, ret); |
| 1502 | } |
| 1503 | |
| 1504 | DEFUN (no_neighbor_password, |
| 1505 | no_neighbor_password_cmd, |
| 1506 | NO_NEIGHBOR_CMD2 "password", |
| 1507 | NO_STR |
| 1508 | NEIGHBOR_STR |
| 1509 | NEIGHBOR_ADDR_STR2 |
| 1510 | "Set a password\n") |
| 1511 | { |
| 1512 | struct peer *peer; |
| 1513 | int ret; |
| 1514 | |
| 1515 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1516 | if (! peer) |
| 1517 | return CMD_WARNING; |
| 1518 | |
| 1519 | ret = peer_password_unset (peer); |
| 1520 | return bgp_vty_return (vty, ret); |
| 1521 | } |
| 1522 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1523 | DEFUN (neighbor_activate, |
| 1524 | neighbor_activate_cmd, |
| 1525 | NEIGHBOR_CMD2 "activate", |
| 1526 | NEIGHBOR_STR |
| 1527 | NEIGHBOR_ADDR_STR2 |
| 1528 | "Enable the Address Family for this Neighbor\n") |
| 1529 | { |
| 1530 | struct peer *peer; |
| 1531 | |
| 1532 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1533 | if (! peer) |
| 1534 | return CMD_WARNING; |
| 1535 | |
| 1536 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1537 | |
| 1538 | return CMD_SUCCESS; |
| 1539 | } |
| 1540 | |
| 1541 | DEFUN (no_neighbor_activate, |
| 1542 | no_neighbor_activate_cmd, |
| 1543 | NO_NEIGHBOR_CMD2 "activate", |
| 1544 | NO_STR |
| 1545 | NEIGHBOR_STR |
| 1546 | NEIGHBOR_ADDR_STR2 |
| 1547 | "Enable the Address Family for this Neighbor\n") |
| 1548 | { |
| 1549 | int ret; |
| 1550 | struct peer *peer; |
| 1551 | |
| 1552 | /* Lookup peer. */ |
| 1553 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 1554 | if (! peer) |
| 1555 | return CMD_WARNING; |
| 1556 | |
| 1557 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 1558 | |
| 1559 | return bgp_vty_return (vty, ret); |
| 1560 | } |
| 1561 | |
| 1562 | DEFUN (neighbor_set_peer_group, |
| 1563 | neighbor_set_peer_group_cmd, |
| 1564 | NEIGHBOR_CMD "peer-group WORD", |
| 1565 | NEIGHBOR_STR |
| 1566 | NEIGHBOR_ADDR_STR |
| 1567 | "Member of the peer-group\n" |
| 1568 | "peer-group name\n") |
| 1569 | { |
| 1570 | int ret; |
| 1571 | as_t as; |
| 1572 | union sockunion su; |
| 1573 | struct bgp *bgp; |
| 1574 | struct peer_group *group; |
| 1575 | |
| 1576 | bgp = vty->index; |
| 1577 | |
| 1578 | ret = str2sockunion (argv[0], &su); |
| 1579 | if (ret < 0) |
| 1580 | { |
| 1581 | vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); |
| 1582 | return CMD_WARNING; |
| 1583 | } |
| 1584 | |
| 1585 | group = peer_group_lookup (bgp, argv[1]); |
| 1586 | if (! group) |
| 1587 | { |
| 1588 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1589 | return CMD_WARNING; |
| 1590 | } |
| 1591 | |
| 1592 | if (peer_address_self_check (&su)) |
| 1593 | { |
| 1594 | vty_out (vty, "%% Can not configure the local system as neighbor%s", |
| 1595 | VTY_NEWLINE); |
| 1596 | return CMD_WARNING; |
| 1597 | } |
| 1598 | |
| 1599 | ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty), |
| 1600 | bgp_node_safi (vty), &as); |
| 1601 | |
| 1602 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) |
| 1603 | { |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 1604 | 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] | 1605 | return CMD_WARNING; |
| 1606 | } |
| 1607 | |
| 1608 | return bgp_vty_return (vty, ret); |
| 1609 | } |
| 1610 | |
| 1611 | DEFUN (no_neighbor_set_peer_group, |
| 1612 | no_neighbor_set_peer_group_cmd, |
| 1613 | NO_NEIGHBOR_CMD "peer-group WORD", |
| 1614 | NO_STR |
| 1615 | NEIGHBOR_STR |
| 1616 | NEIGHBOR_ADDR_STR |
| 1617 | "Member of the peer-group\n" |
| 1618 | "peer-group name\n") |
| 1619 | { |
| 1620 | int ret; |
| 1621 | struct bgp *bgp; |
| 1622 | struct peer *peer; |
| 1623 | struct peer_group *group; |
| 1624 | |
| 1625 | bgp = vty->index; |
| 1626 | |
| 1627 | peer = peer_lookup_vty (vty, argv[0]); |
| 1628 | if (! peer) |
| 1629 | return CMD_WARNING; |
| 1630 | |
| 1631 | group = peer_group_lookup (bgp, argv[1]); |
| 1632 | if (! group) |
| 1633 | { |
| 1634 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); |
| 1635 | return CMD_WARNING; |
| 1636 | } |
| 1637 | |
| 1638 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), |
| 1639 | bgp_node_safi (vty)); |
| 1640 | |
| 1641 | return bgp_vty_return (vty, ret); |
| 1642 | } |
| 1643 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1644 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1645 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
| 1646 | u_int16_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1647 | { |
| 1648 | int ret; |
| 1649 | struct peer *peer; |
| 1650 | |
| 1651 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 1652 | if (! peer) |
| 1653 | return CMD_WARNING; |
| 1654 | |
| 1655 | if (set) |
| 1656 | ret = peer_flag_set (peer, flag); |
| 1657 | else |
| 1658 | ret = peer_flag_unset (peer, flag); |
| 1659 | |
| 1660 | return bgp_vty_return (vty, ret); |
| 1661 | } |
| 1662 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1663 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1664 | 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] | 1665 | { |
| 1666 | return peer_flag_modify_vty (vty, ip_str, flag, 1); |
| 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_unset_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, 0); |
| 1673 | } |
| 1674 | |
| 1675 | /* neighbor passive. */ |
| 1676 | DEFUN (neighbor_passive, |
| 1677 | neighbor_passive_cmd, |
| 1678 | NEIGHBOR_CMD2 "passive", |
| 1679 | NEIGHBOR_STR |
| 1680 | NEIGHBOR_ADDR_STR2 |
| 1681 | "Don't send open messages to this neighbor\n") |
| 1682 | { |
| 1683 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1684 | } |
| 1685 | |
| 1686 | DEFUN (no_neighbor_passive, |
| 1687 | no_neighbor_passive_cmd, |
| 1688 | NO_NEIGHBOR_CMD2 "passive", |
| 1689 | NO_STR |
| 1690 | NEIGHBOR_STR |
| 1691 | NEIGHBOR_ADDR_STR2 |
| 1692 | "Don't send open messages to this neighbor\n") |
| 1693 | { |
| 1694 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); |
| 1695 | } |
| 1696 | |
| 1697 | /* neighbor shutdown. */ |
| 1698 | DEFUN (neighbor_shutdown, |
| 1699 | neighbor_shutdown_cmd, |
| 1700 | NEIGHBOR_CMD2 "shutdown", |
| 1701 | NEIGHBOR_STR |
| 1702 | NEIGHBOR_ADDR_STR2 |
| 1703 | "Administratively shut down this neighbor\n") |
| 1704 | { |
| 1705 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1706 | } |
| 1707 | |
| 1708 | DEFUN (no_neighbor_shutdown, |
| 1709 | no_neighbor_shutdown_cmd, |
| 1710 | NO_NEIGHBOR_CMD2 "shutdown", |
| 1711 | NO_STR |
| 1712 | NEIGHBOR_STR |
| 1713 | NEIGHBOR_ADDR_STR2 |
| 1714 | "Administratively shut down this neighbor\n") |
| 1715 | { |
| 1716 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); |
| 1717 | } |
| 1718 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1719 | /* Deprecated neighbor capability route-refresh. */ |
| 1720 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, |
| 1721 | neighbor_capability_route_refresh_cmd, |
| 1722 | NEIGHBOR_CMD2 "capability route-refresh", |
| 1723 | NEIGHBOR_STR |
| 1724 | NEIGHBOR_ADDR_STR2 |
| 1725 | "Advertise capability to the peer\n" |
| 1726 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1727 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1728 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1729 | } |
| 1730 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1731 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
| 1732 | no_neighbor_capability_route_refresh_cmd, |
| 1733 | NO_NEIGHBOR_CMD2 "capability route-refresh", |
| 1734 | NO_STR |
| 1735 | NEIGHBOR_STR |
| 1736 | NEIGHBOR_ADDR_STR2 |
| 1737 | "Advertise capability to the peer\n" |
| 1738 | "Advertise route-refresh capability to this neighbor\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1739 | { |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 1740 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1741 | } |
| 1742 | |
| 1743 | /* neighbor capability dynamic. */ |
| 1744 | DEFUN (neighbor_capability_dynamic, |
| 1745 | neighbor_capability_dynamic_cmd, |
| 1746 | NEIGHBOR_CMD2 "capability dynamic", |
| 1747 | NEIGHBOR_STR |
| 1748 | NEIGHBOR_ADDR_STR2 |
| 1749 | "Advertise capability to the peer\n" |
| 1750 | "Advertise dynamic capability to this neighbor\n") |
| 1751 | { |
| 1752 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1753 | } |
| 1754 | |
| 1755 | DEFUN (no_neighbor_capability_dynamic, |
| 1756 | no_neighbor_capability_dynamic_cmd, |
| 1757 | NO_NEIGHBOR_CMD2 "capability dynamic", |
| 1758 | NO_STR |
| 1759 | NEIGHBOR_STR |
| 1760 | NEIGHBOR_ADDR_STR2 |
| 1761 | "Advertise capability to the peer\n" |
| 1762 | "Advertise dynamic capability to this neighbor\n") |
| 1763 | { |
| 1764 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); |
| 1765 | } |
| 1766 | |
| 1767 | /* neighbor dont-capability-negotiate */ |
| 1768 | DEFUN (neighbor_dont_capability_negotiate, |
| 1769 | neighbor_dont_capability_negotiate_cmd, |
| 1770 | NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1771 | NEIGHBOR_STR |
| 1772 | NEIGHBOR_ADDR_STR2 |
| 1773 | "Do not perform capability negotiation\n") |
| 1774 | { |
| 1775 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1776 | } |
| 1777 | |
| 1778 | DEFUN (no_neighbor_dont_capability_negotiate, |
| 1779 | no_neighbor_dont_capability_negotiate_cmd, |
| 1780 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", |
| 1781 | NO_STR |
| 1782 | NEIGHBOR_STR |
| 1783 | NEIGHBOR_ADDR_STR2 |
| 1784 | "Do not perform capability negotiation\n") |
| 1785 | { |
| 1786 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); |
| 1787 | } |
| 1788 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1789 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1790 | 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] | 1791 | safi_t safi, u_int32_t flag, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1792 | { |
| 1793 | int ret; |
| 1794 | struct peer *peer; |
| 1795 | |
| 1796 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 1797 | if (! peer) |
| 1798 | return CMD_WARNING; |
| 1799 | |
| 1800 | if (set) |
| 1801 | ret = peer_af_flag_set (peer, afi, safi, flag); |
| 1802 | else |
| 1803 | ret = peer_af_flag_unset (peer, afi, safi, flag); |
| 1804 | |
| 1805 | return bgp_vty_return (vty, ret); |
| 1806 | } |
| 1807 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1808 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1809 | 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] | 1810 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1811 | { |
| 1812 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); |
| 1813 | } |
| 1814 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 1815 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 1816 | 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] | 1817 | safi_t safi, u_int32_t flag) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1818 | { |
| 1819 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); |
| 1820 | } |
| 1821 | |
| 1822 | /* neighbor capability orf prefix-list. */ |
| 1823 | DEFUN (neighbor_capability_orf_prefix, |
| 1824 | neighbor_capability_orf_prefix_cmd, |
| 1825 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 1826 | NEIGHBOR_STR |
| 1827 | NEIGHBOR_ADDR_STR2 |
| 1828 | "Advertise capability to the peer\n" |
| 1829 | "Advertise ORF capability to the peer\n" |
| 1830 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 1831 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 1832 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 1833 | "Capability to SEND the ORF to this neighbor\n") |
| 1834 | { |
| 1835 | u_int16_t flag = 0; |
| 1836 | |
| 1837 | if (strncmp (argv[1], "s", 1) == 0) |
| 1838 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 1839 | else if (strncmp (argv[1], "r", 1) == 0) |
| 1840 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 1841 | else if (strncmp (argv[1], "b", 1) == 0) |
| 1842 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 1843 | else |
| 1844 | return CMD_WARNING; |
| 1845 | |
| 1846 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1847 | bgp_node_safi (vty), flag); |
| 1848 | } |
| 1849 | |
| 1850 | DEFUN (no_neighbor_capability_orf_prefix, |
| 1851 | no_neighbor_capability_orf_prefix_cmd, |
| 1852 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", |
| 1853 | NO_STR |
| 1854 | NEIGHBOR_STR |
| 1855 | NEIGHBOR_ADDR_STR2 |
| 1856 | "Advertise capability to the peer\n" |
| 1857 | "Advertise ORF capability to the peer\n" |
| 1858 | "Advertise prefixlist ORF capability to this neighbor\n" |
| 1859 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" |
| 1860 | "Capability to RECEIVE the ORF from this neighbor\n" |
| 1861 | "Capability to SEND the ORF to this neighbor\n") |
| 1862 | { |
| 1863 | u_int16_t flag = 0; |
| 1864 | |
| 1865 | if (strncmp (argv[1], "s", 1) == 0) |
| 1866 | flag = PEER_FLAG_ORF_PREFIX_SM; |
| 1867 | else if (strncmp (argv[1], "r", 1) == 0) |
| 1868 | flag = PEER_FLAG_ORF_PREFIX_RM; |
| 1869 | else if (strncmp (argv[1], "b", 1) == 0) |
| 1870 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
| 1871 | else |
| 1872 | return CMD_WARNING; |
| 1873 | |
| 1874 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1875 | bgp_node_safi (vty), flag); |
| 1876 | } |
| 1877 | |
| 1878 | /* neighbor next-hop-self. */ |
| 1879 | DEFUN (neighbor_nexthop_self, |
| 1880 | neighbor_nexthop_self_cmd, |
| 1881 | NEIGHBOR_CMD2 "next-hop-self", |
| 1882 | NEIGHBOR_STR |
| 1883 | NEIGHBOR_ADDR_STR2 |
| 1884 | "Disable the next hop calculation for this neighbor\n") |
| 1885 | { |
| 1886 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1887 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 1888 | } |
| 1889 | |
| 1890 | DEFUN (no_neighbor_nexthop_self, |
| 1891 | no_neighbor_nexthop_self_cmd, |
| 1892 | NO_NEIGHBOR_CMD2 "next-hop-self", |
| 1893 | NO_STR |
| 1894 | NEIGHBOR_STR |
| 1895 | NEIGHBOR_ADDR_STR2 |
| 1896 | "Disable the next hop calculation for this neighbor\n") |
| 1897 | { |
| 1898 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1899 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
| 1900 | } |
| 1901 | |
| 1902 | /* neighbor remove-private-AS. */ |
| 1903 | DEFUN (neighbor_remove_private_as, |
| 1904 | neighbor_remove_private_as_cmd, |
| 1905 | NEIGHBOR_CMD2 "remove-private-AS", |
| 1906 | NEIGHBOR_STR |
| 1907 | NEIGHBOR_ADDR_STR2 |
| 1908 | "Remove private AS number from outbound updates\n") |
| 1909 | { |
| 1910 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1911 | bgp_node_safi (vty), |
| 1912 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 1913 | } |
| 1914 | |
| 1915 | DEFUN (no_neighbor_remove_private_as, |
| 1916 | no_neighbor_remove_private_as_cmd, |
| 1917 | NO_NEIGHBOR_CMD2 "remove-private-AS", |
| 1918 | NO_STR |
| 1919 | NEIGHBOR_STR |
| 1920 | NEIGHBOR_ADDR_STR2 |
| 1921 | "Remove private AS number from outbound updates\n") |
| 1922 | { |
| 1923 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1924 | bgp_node_safi (vty), |
| 1925 | PEER_FLAG_REMOVE_PRIVATE_AS); |
| 1926 | } |
| 1927 | |
| 1928 | /* neighbor send-community. */ |
| 1929 | DEFUN (neighbor_send_community, |
| 1930 | neighbor_send_community_cmd, |
| 1931 | NEIGHBOR_CMD2 "send-community", |
| 1932 | NEIGHBOR_STR |
| 1933 | NEIGHBOR_ADDR_STR2 |
| 1934 | "Send Community attribute to this neighbor\n") |
| 1935 | { |
| 1936 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1937 | bgp_node_safi (vty), |
| 1938 | PEER_FLAG_SEND_COMMUNITY); |
| 1939 | } |
| 1940 | |
| 1941 | DEFUN (no_neighbor_send_community, |
| 1942 | no_neighbor_send_community_cmd, |
| 1943 | NO_NEIGHBOR_CMD2 "send-community", |
| 1944 | NO_STR |
| 1945 | NEIGHBOR_STR |
| 1946 | NEIGHBOR_ADDR_STR2 |
| 1947 | "Send Community attribute to this neighbor\n") |
| 1948 | { |
| 1949 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1950 | bgp_node_safi (vty), |
| 1951 | PEER_FLAG_SEND_COMMUNITY); |
| 1952 | } |
| 1953 | |
| 1954 | /* neighbor send-community extended. */ |
| 1955 | DEFUN (neighbor_send_community_type, |
| 1956 | neighbor_send_community_type_cmd, |
| 1957 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 1958 | NEIGHBOR_STR |
| 1959 | NEIGHBOR_ADDR_STR2 |
| 1960 | "Send Community attribute to this neighbor\n" |
| 1961 | "Send Standard and Extended Community attributes\n" |
| 1962 | "Send Extended Community attributes\n" |
| 1963 | "Send Standard Community attributes\n") |
| 1964 | { |
| 1965 | if (strncmp (argv[1], "s", 1) == 0) |
| 1966 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1967 | bgp_node_safi (vty), |
| 1968 | PEER_FLAG_SEND_COMMUNITY); |
| 1969 | if (strncmp (argv[1], "e", 1) == 0) |
| 1970 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1971 | bgp_node_safi (vty), |
| 1972 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 1973 | |
| 1974 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 1975 | bgp_node_safi (vty), |
| 1976 | (PEER_FLAG_SEND_COMMUNITY| |
| 1977 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 1978 | } |
| 1979 | |
| 1980 | DEFUN (no_neighbor_send_community_type, |
| 1981 | no_neighbor_send_community_type_cmd, |
| 1982 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", |
| 1983 | NO_STR |
| 1984 | NEIGHBOR_STR |
| 1985 | NEIGHBOR_ADDR_STR2 |
| 1986 | "Send Community attribute to this neighbor\n" |
| 1987 | "Send Standard and Extended Community attributes\n" |
| 1988 | "Send Extended Community attributes\n" |
| 1989 | "Send Standard Community attributes\n") |
| 1990 | { |
| 1991 | if (strncmp (argv[1], "s", 1) == 0) |
| 1992 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1993 | bgp_node_safi (vty), |
| 1994 | PEER_FLAG_SEND_COMMUNITY); |
| 1995 | if (strncmp (argv[1], "e", 1) == 0) |
| 1996 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 1997 | bgp_node_safi (vty), |
| 1998 | PEER_FLAG_SEND_EXT_COMMUNITY); |
| 1999 | |
| 2000 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2001 | bgp_node_safi (vty), |
| 2002 | (PEER_FLAG_SEND_COMMUNITY | |
| 2003 | PEER_FLAG_SEND_EXT_COMMUNITY)); |
| 2004 | } |
| 2005 | |
| 2006 | /* neighbor soft-reconfig. */ |
| 2007 | DEFUN (neighbor_soft_reconfiguration, |
| 2008 | neighbor_soft_reconfiguration_cmd, |
| 2009 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 2010 | NEIGHBOR_STR |
| 2011 | NEIGHBOR_ADDR_STR2 |
| 2012 | "Per neighbor soft reconfiguration\n" |
| 2013 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 2014 | { |
| 2015 | return peer_af_flag_set_vty (vty, argv[0], |
| 2016 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 2017 | PEER_FLAG_SOFT_RECONFIG); |
| 2018 | } |
| 2019 | |
| 2020 | DEFUN (no_neighbor_soft_reconfiguration, |
| 2021 | no_neighbor_soft_reconfiguration_cmd, |
| 2022 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", |
| 2023 | NO_STR |
| 2024 | NEIGHBOR_STR |
| 2025 | NEIGHBOR_ADDR_STR2 |
| 2026 | "Per neighbor soft reconfiguration\n" |
| 2027 | "Allow inbound soft reconfiguration for this neighbor\n") |
| 2028 | { |
| 2029 | return peer_af_flag_unset_vty (vty, argv[0], |
| 2030 | bgp_node_afi (vty), bgp_node_safi (vty), |
| 2031 | PEER_FLAG_SOFT_RECONFIG); |
| 2032 | } |
| 2033 | |
| 2034 | DEFUN (neighbor_route_reflector_client, |
| 2035 | neighbor_route_reflector_client_cmd, |
| 2036 | NEIGHBOR_CMD2 "route-reflector-client", |
| 2037 | NEIGHBOR_STR |
| 2038 | NEIGHBOR_ADDR_STR2 |
| 2039 | "Configure a neighbor as Route Reflector client\n") |
| 2040 | { |
| 2041 | struct peer *peer; |
| 2042 | |
| 2043 | |
| 2044 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2045 | if (! peer) |
| 2046 | return CMD_WARNING; |
| 2047 | |
| 2048 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2049 | bgp_node_safi (vty), |
| 2050 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2051 | } |
| 2052 | |
| 2053 | DEFUN (no_neighbor_route_reflector_client, |
| 2054 | no_neighbor_route_reflector_client_cmd, |
| 2055 | NO_NEIGHBOR_CMD2 "route-reflector-client", |
| 2056 | NO_STR |
| 2057 | NEIGHBOR_STR |
| 2058 | NEIGHBOR_ADDR_STR2 |
| 2059 | "Configure a neighbor as Route Reflector client\n") |
| 2060 | { |
| 2061 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2062 | bgp_node_safi (vty), |
| 2063 | PEER_FLAG_REFLECTOR_CLIENT); |
| 2064 | } |
| 2065 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2066 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2067 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
| 2068 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2069 | { |
| 2070 | int ret; |
| 2071 | struct bgp *bgp; |
| 2072 | struct peer *peer; |
| 2073 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2074 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2075 | struct bgp_filter *pfilter; |
| 2076 | struct bgp_filter *gfilter; |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2077 | int locked_and_added = 0; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2078 | |
| 2079 | bgp = vty->index; |
| 2080 | |
| 2081 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2082 | if ( ! peer ) |
| 2083 | return CMD_WARNING; |
| 2084 | |
| 2085 | /* If it is already a RS-Client, don't do anything. */ |
| 2086 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2087 | return CMD_SUCCESS; |
| 2088 | |
| 2089 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2090 | { |
| 2091 | peer = peer_lock (peer); /* rsclient peer list reference */ |
| 2092 | listnode_add_sort (bgp->rsclient, peer); |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2093 | locked_and_added = 1; |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2094 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2095 | |
| 2096 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2097 | if (ret < 0) |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2098 | { |
| 2099 | if (locked_and_added) |
| 2100 | { |
| 2101 | listnode_delete (bgp->rsclient, peer); |
| 2102 | peer_unlock (peer); /* rsclient peer list reference */ |
| 2103 | } |
| 2104 | |
| 2105 | return bgp_vty_return (vty, ret); |
| 2106 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2107 | |
Paul Jakma | 64e580a | 2006-02-21 01:09:01 +0000 | [diff] [blame] | 2108 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2109 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2110 | /* RIB peer reference. Released when table is free'd in bgp_table_free. */ |
| 2111 | peer->rib[afi][safi]->owner = peer_lock (peer); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2112 | |
| 2113 | /* Check for existing 'network' and 'redistribute' routes. */ |
| 2114 | bgp_check_local_routes_rsclient (peer, afi, safi); |
| 2115 | |
| 2116 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ |
| 2117 | bgp_soft_reconfig_rsclient (peer, afi, safi); |
| 2118 | |
| 2119 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2120 | { |
| 2121 | group = peer->group; |
| 2122 | gfilter = &peer->filter[afi][safi]; |
| 2123 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2124 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2125 | { |
| 2126 | pfilter = &peer->filter[afi][safi]; |
| 2127 | |
| 2128 | /* Members of a non-RS-Client group should not be RS-Clients, as that |
| 2129 | is checked when the become part of the peer-group */ |
| 2130 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2131 | if (ret < 0) |
| 2132 | return bgp_vty_return (vty, ret); |
| 2133 | |
| 2134 | /* Make peer's RIB point to group's RIB. */ |
| 2135 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; |
| 2136 | |
| 2137 | /* Import policy. */ |
| 2138 | if (pfilter->map[RMAP_IMPORT].name) |
| 2139 | free (pfilter->map[RMAP_IMPORT].name); |
| 2140 | if (gfilter->map[RMAP_IMPORT].name) |
| 2141 | { |
| 2142 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); |
| 2143 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; |
| 2144 | } |
| 2145 | else |
| 2146 | { |
| 2147 | pfilter->map[RMAP_IMPORT].name = NULL; |
| 2148 | pfilter->map[RMAP_IMPORT].map =NULL; |
| 2149 | } |
| 2150 | |
| 2151 | /* Export policy. */ |
| 2152 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) |
| 2153 | { |
| 2154 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); |
| 2155 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; |
| 2156 | } |
| 2157 | } |
| 2158 | } |
| 2159 | return CMD_SUCCESS; |
| 2160 | } |
| 2161 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2162 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2163 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
| 2164 | int afi, int safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2165 | { |
| 2166 | int ret; |
| 2167 | struct bgp *bgp; |
| 2168 | struct peer *peer; |
| 2169 | struct peer_group *group; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2170 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2171 | |
| 2172 | bgp = vty->index; |
| 2173 | |
| 2174 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2175 | if ( ! peer ) |
| 2176 | return CMD_WARNING; |
| 2177 | |
| 2178 | /* If it is not a RS-Client, don't do anything. */ |
| 2179 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) |
| 2180 | return CMD_SUCCESS; |
| 2181 | |
| 2182 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) |
| 2183 | { |
| 2184 | group = peer->group; |
| 2185 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2186 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2187 | { |
| 2188 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2189 | if (ret < 0) |
| 2190 | return bgp_vty_return (vty, ret); |
| 2191 | |
| 2192 | peer->rib[afi][safi] = NULL; |
| 2193 | } |
| 2194 | |
| 2195 | peer = group->conf; |
| 2196 | } |
| 2197 | |
| 2198 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); |
| 2199 | if (ret < 0) |
| 2200 | return bgp_vty_return (vty, ret); |
| 2201 | |
| 2202 | if ( ! peer_rsclient_active (peer) ) |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2203 | { |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2204 | bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2205 | listnode_delete (bgp->rsclient, peer); |
Chris Caputo | 228da42 | 2009-07-18 05:44:03 +0000 | [diff] [blame] | 2206 | peer_unlock (peer); /* peer bgp rsclient reference */ |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 2207 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2208 | |
Paul Jakma | b608d5b | 2008-07-02 02:12:07 +0000 | [diff] [blame] | 2209 | bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2210 | |
| 2211 | return CMD_SUCCESS; |
| 2212 | } |
| 2213 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2214 | /* neighbor route-server-client. */ |
| 2215 | DEFUN (neighbor_route_server_client, |
| 2216 | neighbor_route_server_client_cmd, |
| 2217 | NEIGHBOR_CMD2 "route-server-client", |
| 2218 | NEIGHBOR_STR |
| 2219 | NEIGHBOR_ADDR_STR2 |
| 2220 | "Configure a neighbor as Route Server client\n") |
| 2221 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2222 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
| 2223 | bgp_node_safi(vty)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2224 | } |
| 2225 | |
| 2226 | DEFUN (no_neighbor_route_server_client, |
| 2227 | no_neighbor_route_server_client_cmd, |
| 2228 | NO_NEIGHBOR_CMD2 "route-server-client", |
| 2229 | NO_STR |
| 2230 | NEIGHBOR_STR |
| 2231 | NEIGHBOR_ADDR_STR2 |
| 2232 | "Configure a neighbor as Route Server client\n") |
| 2233 | { |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2234 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), |
| 2235 | bgp_node_safi(vty)); |
| 2236 | } |
| 2237 | |
| 2238 | DEFUN (neighbor_nexthop_local_unchanged, |
| 2239 | neighbor_nexthop_local_unchanged_cmd, |
| 2240 | NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2241 | NEIGHBOR_STR |
| 2242 | NEIGHBOR_ADDR_STR2 |
| 2243 | "Configure treatment of outgoing link-local nexthop attribute\n" |
| 2244 | "Leave link-local nexthop unchanged for this peer\n") |
| 2245 | { |
| 2246 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2247 | bgp_node_safi (vty), |
| 2248 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
| 2249 | } |
| 2250 | |
| 2251 | DEFUN (no_neighbor_nexthop_local_unchanged, |
| 2252 | no_neighbor_nexthop_local_unchanged_cmd, |
| 2253 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", |
| 2254 | NO_STR |
| 2255 | NEIGHBOR_STR |
| 2256 | NEIGHBOR_ADDR_STR2 |
| 2257 | "Configure treatment of outgoing link-local-nexthop attribute\n" |
| 2258 | "Leave link-local nexthop unchanged for this peer\n") |
| 2259 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2260 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2261 | bgp_node_safi (vty), |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 2262 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2263 | } |
| 2264 | |
| 2265 | DEFUN (neighbor_attr_unchanged, |
| 2266 | neighbor_attr_unchanged_cmd, |
| 2267 | NEIGHBOR_CMD2 "attribute-unchanged", |
| 2268 | NEIGHBOR_STR |
| 2269 | NEIGHBOR_ADDR_STR2 |
| 2270 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2271 | { |
| 2272 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2273 | bgp_node_safi (vty), |
| 2274 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2275 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2276 | PEER_FLAG_MED_UNCHANGED)); |
| 2277 | } |
| 2278 | |
| 2279 | DEFUN (neighbor_attr_unchanged1, |
| 2280 | neighbor_attr_unchanged1_cmd, |
| 2281 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2282 | NEIGHBOR_STR |
| 2283 | NEIGHBOR_ADDR_STR2 |
| 2284 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2285 | "As-path attribute\n" |
| 2286 | "Nexthop attribute\n" |
| 2287 | "Med attribute\n") |
| 2288 | { |
| 2289 | u_int16_t flags = 0; |
| 2290 | |
| 2291 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2292 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2293 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2294 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2295 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2296 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2297 | |
| 2298 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2299 | bgp_node_safi (vty), flags); |
| 2300 | } |
| 2301 | |
| 2302 | DEFUN (neighbor_attr_unchanged2, |
| 2303 | neighbor_attr_unchanged2_cmd, |
| 2304 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2305 | NEIGHBOR_STR |
| 2306 | NEIGHBOR_ADDR_STR2 |
| 2307 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2308 | "As-path attribute\n" |
| 2309 | "Nexthop attribute\n" |
| 2310 | "Med attribute\n") |
| 2311 | { |
| 2312 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2313 | |
| 2314 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2315 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2316 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2317 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2318 | |
| 2319 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2320 | bgp_node_safi (vty), flags); |
| 2321 | |
| 2322 | } |
| 2323 | |
| 2324 | DEFUN (neighbor_attr_unchanged3, |
| 2325 | neighbor_attr_unchanged3_cmd, |
| 2326 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2327 | NEIGHBOR_STR |
| 2328 | NEIGHBOR_ADDR_STR2 |
| 2329 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2330 | "Nexthop attribute\n" |
| 2331 | "As-path attribute\n" |
| 2332 | "Med attribute\n") |
| 2333 | { |
| 2334 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2335 | |
| 2336 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2337 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2338 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2339 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2340 | |
| 2341 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2342 | bgp_node_safi (vty), flags); |
| 2343 | } |
| 2344 | |
| 2345 | DEFUN (neighbor_attr_unchanged4, |
| 2346 | neighbor_attr_unchanged4_cmd, |
| 2347 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2348 | NEIGHBOR_STR |
| 2349 | NEIGHBOR_ADDR_STR2 |
| 2350 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2351 | "Med attribute\n" |
| 2352 | "As-path attribute\n" |
| 2353 | "Nexthop attribute\n") |
| 2354 | { |
| 2355 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2356 | |
| 2357 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2358 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2359 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2360 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2361 | |
| 2362 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2363 | bgp_node_safi (vty), flags); |
| 2364 | } |
| 2365 | |
| 2366 | ALIAS (neighbor_attr_unchanged, |
| 2367 | neighbor_attr_unchanged5_cmd, |
| 2368 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2369 | NEIGHBOR_STR |
| 2370 | NEIGHBOR_ADDR_STR2 |
| 2371 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2372 | "As-path attribute\n" |
| 2373 | "Nexthop attribute\n" |
| 2374 | "Med attribute\n") |
| 2375 | |
| 2376 | ALIAS (neighbor_attr_unchanged, |
| 2377 | neighbor_attr_unchanged6_cmd, |
| 2378 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2379 | NEIGHBOR_STR |
| 2380 | NEIGHBOR_ADDR_STR2 |
| 2381 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2382 | "As-path attribute\n" |
| 2383 | "Med attribute\n" |
| 2384 | "Nexthop attribute\n") |
| 2385 | |
| 2386 | ALIAS (neighbor_attr_unchanged, |
| 2387 | neighbor_attr_unchanged7_cmd, |
| 2388 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2389 | NEIGHBOR_STR |
| 2390 | NEIGHBOR_ADDR_STR2 |
| 2391 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2392 | "Nexthop attribute\n" |
| 2393 | "Med attribute\n" |
| 2394 | "As-path attribute\n") |
| 2395 | |
| 2396 | ALIAS (neighbor_attr_unchanged, |
| 2397 | neighbor_attr_unchanged8_cmd, |
| 2398 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2399 | NEIGHBOR_STR |
| 2400 | NEIGHBOR_ADDR_STR2 |
| 2401 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2402 | "Nexthop attribute\n" |
| 2403 | "As-path attribute\n" |
| 2404 | "Med attribute\n") |
| 2405 | |
| 2406 | ALIAS (neighbor_attr_unchanged, |
| 2407 | neighbor_attr_unchanged9_cmd, |
| 2408 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2409 | NEIGHBOR_STR |
| 2410 | NEIGHBOR_ADDR_STR2 |
| 2411 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2412 | "Med attribute\n" |
| 2413 | "Nexthop attribute\n" |
| 2414 | "As-path attribute\n") |
| 2415 | |
| 2416 | ALIAS (neighbor_attr_unchanged, |
| 2417 | neighbor_attr_unchanged10_cmd, |
| 2418 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2419 | NEIGHBOR_STR |
| 2420 | NEIGHBOR_ADDR_STR2 |
| 2421 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2422 | "Med attribute\n" |
| 2423 | "As-path attribute\n" |
| 2424 | "Nexthop attribute\n") |
| 2425 | |
| 2426 | DEFUN (no_neighbor_attr_unchanged, |
| 2427 | no_neighbor_attr_unchanged_cmd, |
| 2428 | NO_NEIGHBOR_CMD2 "attribute-unchanged", |
| 2429 | NO_STR |
| 2430 | NEIGHBOR_STR |
| 2431 | NEIGHBOR_ADDR_STR2 |
| 2432 | "BGP attribute is propagated unchanged to this neighbor\n") |
| 2433 | { |
| 2434 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2435 | bgp_node_safi (vty), |
| 2436 | (PEER_FLAG_AS_PATH_UNCHANGED | |
| 2437 | PEER_FLAG_NEXTHOP_UNCHANGED | |
| 2438 | PEER_FLAG_MED_UNCHANGED)); |
| 2439 | } |
| 2440 | |
| 2441 | DEFUN (no_neighbor_attr_unchanged1, |
| 2442 | no_neighbor_attr_unchanged1_cmd, |
| 2443 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", |
| 2444 | NO_STR |
| 2445 | NEIGHBOR_STR |
| 2446 | NEIGHBOR_ADDR_STR2 |
| 2447 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2448 | "As-path attribute\n" |
| 2449 | "Nexthop attribute\n" |
| 2450 | "Med attribute\n") |
| 2451 | { |
| 2452 | u_int16_t flags = 0; |
| 2453 | |
| 2454 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2455 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2456 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2457 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2458 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2459 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2460 | |
| 2461 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2462 | bgp_node_safi (vty), flags); |
| 2463 | } |
| 2464 | |
| 2465 | DEFUN (no_neighbor_attr_unchanged2, |
| 2466 | no_neighbor_attr_unchanged2_cmd, |
| 2467 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", |
| 2468 | NO_STR |
| 2469 | NEIGHBOR_STR |
| 2470 | NEIGHBOR_ADDR_STR2 |
| 2471 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2472 | "As-path attribute\n" |
| 2473 | "Nexthop attribute\n" |
| 2474 | "Med attribute\n") |
| 2475 | { |
| 2476 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; |
| 2477 | |
| 2478 | if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2479 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2480 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2481 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2482 | |
| 2483 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2484 | bgp_node_safi (vty), flags); |
| 2485 | } |
| 2486 | |
| 2487 | DEFUN (no_neighbor_attr_unchanged3, |
| 2488 | no_neighbor_attr_unchanged3_cmd, |
| 2489 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", |
| 2490 | NO_STR |
| 2491 | NEIGHBOR_STR |
| 2492 | NEIGHBOR_ADDR_STR2 |
| 2493 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2494 | "Nexthop attribute\n" |
| 2495 | "As-path attribute\n" |
| 2496 | "Med attribute\n") |
| 2497 | { |
| 2498 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; |
| 2499 | |
| 2500 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2501 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2502 | else if (strncmp (argv[1], "med", 1) == 0) |
| 2503 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
| 2504 | |
| 2505 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2506 | bgp_node_safi (vty), flags); |
| 2507 | } |
| 2508 | |
| 2509 | DEFUN (no_neighbor_attr_unchanged4, |
| 2510 | no_neighbor_attr_unchanged4_cmd, |
| 2511 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", |
| 2512 | NO_STR |
| 2513 | NEIGHBOR_STR |
| 2514 | NEIGHBOR_ADDR_STR2 |
| 2515 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2516 | "Med attribute\n" |
| 2517 | "As-path attribute\n" |
| 2518 | "Nexthop attribute\n") |
| 2519 | { |
| 2520 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; |
| 2521 | |
| 2522 | if (strncmp (argv[1], "as-path", 1) == 0) |
| 2523 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
| 2524 | else if (strncmp (argv[1], "next-hop", 1) == 0) |
| 2525 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2526 | |
| 2527 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 2528 | bgp_node_safi (vty), flags); |
| 2529 | } |
| 2530 | |
| 2531 | ALIAS (no_neighbor_attr_unchanged, |
| 2532 | no_neighbor_attr_unchanged5_cmd, |
| 2533 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", |
| 2534 | NO_STR |
| 2535 | NEIGHBOR_STR |
| 2536 | NEIGHBOR_ADDR_STR2 |
| 2537 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2538 | "As-path attribute\n" |
| 2539 | "Nexthop attribute\n" |
| 2540 | "Med attribute\n") |
| 2541 | |
| 2542 | ALIAS (no_neighbor_attr_unchanged, |
| 2543 | no_neighbor_attr_unchanged6_cmd, |
| 2544 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", |
| 2545 | NO_STR |
| 2546 | NEIGHBOR_STR |
| 2547 | NEIGHBOR_ADDR_STR2 |
| 2548 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2549 | "As-path attribute\n" |
| 2550 | "Med attribute\n" |
| 2551 | "Nexthop attribute\n") |
| 2552 | |
| 2553 | ALIAS (no_neighbor_attr_unchanged, |
| 2554 | no_neighbor_attr_unchanged7_cmd, |
| 2555 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", |
| 2556 | NO_STR |
| 2557 | NEIGHBOR_STR |
| 2558 | NEIGHBOR_ADDR_STR2 |
| 2559 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2560 | "Nexthop attribute\n" |
| 2561 | "Med attribute\n" |
| 2562 | "As-path attribute\n") |
| 2563 | |
| 2564 | ALIAS (no_neighbor_attr_unchanged, |
| 2565 | no_neighbor_attr_unchanged8_cmd, |
| 2566 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", |
| 2567 | NO_STR |
| 2568 | NEIGHBOR_STR |
| 2569 | NEIGHBOR_ADDR_STR2 |
| 2570 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2571 | "Nexthop attribute\n" |
| 2572 | "As-path attribute\n" |
| 2573 | "Med attribute\n") |
| 2574 | |
| 2575 | ALIAS (no_neighbor_attr_unchanged, |
| 2576 | no_neighbor_attr_unchanged9_cmd, |
| 2577 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", |
| 2578 | NO_STR |
| 2579 | NEIGHBOR_STR |
| 2580 | NEIGHBOR_ADDR_STR2 |
| 2581 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2582 | "Med attribute\n" |
| 2583 | "Nexthop attribute\n" |
| 2584 | "As-path attribute\n") |
| 2585 | |
| 2586 | ALIAS (no_neighbor_attr_unchanged, |
| 2587 | no_neighbor_attr_unchanged10_cmd, |
| 2588 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", |
| 2589 | NO_STR |
| 2590 | NEIGHBOR_STR |
| 2591 | NEIGHBOR_ADDR_STR2 |
| 2592 | "BGP attribute is propagated unchanged to this neighbor\n" |
| 2593 | "Med attribute\n" |
| 2594 | "As-path attribute\n" |
| 2595 | "Nexthop attribute\n") |
| 2596 | |
| 2597 | /* For old version Zebra compatibility. */ |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2598 | DEFUN_DEPRECATED (neighbor_transparent_as, |
| 2599 | neighbor_transparent_as_cmd, |
| 2600 | NEIGHBOR_CMD "transparent-as", |
| 2601 | NEIGHBOR_STR |
| 2602 | NEIGHBOR_ADDR_STR |
| 2603 | "Do not append my AS number even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2604 | { |
| 2605 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2606 | bgp_node_safi (vty), |
| 2607 | PEER_FLAG_AS_PATH_UNCHANGED); |
| 2608 | } |
| 2609 | |
hasso | dd4c593 | 2005-02-02 17:15:34 +0000 | [diff] [blame] | 2610 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
| 2611 | neighbor_transparent_nexthop_cmd, |
| 2612 | NEIGHBOR_CMD "transparent-nexthop", |
| 2613 | NEIGHBOR_STR |
| 2614 | NEIGHBOR_ADDR_STR |
| 2615 | "Do not change nexthop even peer is EBGP peer\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2616 | { |
| 2617 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2618 | bgp_node_safi (vty), |
| 2619 | PEER_FLAG_NEXTHOP_UNCHANGED); |
| 2620 | } |
| 2621 | |
| 2622 | /* EBGP multihop configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2623 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2624 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
| 2625 | const char *ttl_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2626 | { |
| 2627 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2628 | unsigned int ttl; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2629 | |
| 2630 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2631 | if (! peer) |
| 2632 | return CMD_WARNING; |
| 2633 | |
| 2634 | if (! ttl_str) |
| 2635 | ttl = TTL_MAX; |
| 2636 | else |
| 2637 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); |
| 2638 | |
| 2639 | peer_ebgp_multihop_set (peer, ttl); |
| 2640 | |
| 2641 | return CMD_SUCCESS; |
| 2642 | } |
| 2643 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2644 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2645 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2646 | { |
| 2647 | struct peer *peer; |
| 2648 | |
| 2649 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2650 | if (! peer) |
| 2651 | return CMD_WARNING; |
| 2652 | |
| 2653 | peer_ebgp_multihop_unset (peer); |
| 2654 | |
| 2655 | return CMD_SUCCESS; |
| 2656 | } |
| 2657 | |
| 2658 | /* neighbor ebgp-multihop. */ |
| 2659 | DEFUN (neighbor_ebgp_multihop, |
| 2660 | neighbor_ebgp_multihop_cmd, |
| 2661 | NEIGHBOR_CMD2 "ebgp-multihop", |
| 2662 | NEIGHBOR_STR |
| 2663 | NEIGHBOR_ADDR_STR2 |
| 2664 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2665 | { |
| 2666 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); |
| 2667 | } |
| 2668 | |
| 2669 | DEFUN (neighbor_ebgp_multihop_ttl, |
| 2670 | neighbor_ebgp_multihop_ttl_cmd, |
| 2671 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2672 | NEIGHBOR_STR |
| 2673 | NEIGHBOR_ADDR_STR2 |
| 2674 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2675 | "maximum hop count\n") |
| 2676 | { |
| 2677 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); |
| 2678 | } |
| 2679 | |
| 2680 | DEFUN (no_neighbor_ebgp_multihop, |
| 2681 | no_neighbor_ebgp_multihop_cmd, |
| 2682 | NO_NEIGHBOR_CMD2 "ebgp-multihop", |
| 2683 | NO_STR |
| 2684 | NEIGHBOR_STR |
| 2685 | NEIGHBOR_ADDR_STR2 |
| 2686 | "Allow EBGP neighbors not on directly connected networks\n") |
| 2687 | { |
| 2688 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); |
| 2689 | } |
| 2690 | |
| 2691 | ALIAS (no_neighbor_ebgp_multihop, |
| 2692 | no_neighbor_ebgp_multihop_ttl_cmd, |
| 2693 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", |
| 2694 | NO_STR |
| 2695 | NEIGHBOR_STR |
| 2696 | NEIGHBOR_ADDR_STR2 |
| 2697 | "Allow EBGP neighbors not on directly connected networks\n" |
| 2698 | "maximum hop count\n") |
| 2699 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2700 | /* disable-connected-check */ |
| 2701 | DEFUN (neighbor_disable_connected_check, |
| 2702 | neighbor_disable_connected_check_cmd, |
| 2703 | NEIGHBOR_CMD2 "disable-connected-check", |
| 2704 | NEIGHBOR_STR |
| 2705 | NEIGHBOR_ADDR_STR2 |
| 2706 | "one-hop away EBGP peer using loopback address\n") |
| 2707 | { |
| 2708 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2709 | } |
| 2710 | |
| 2711 | DEFUN (no_neighbor_disable_connected_check, |
| 2712 | no_neighbor_disable_connected_check_cmd, |
| 2713 | NO_NEIGHBOR_CMD2 "disable-connected-check", |
| 2714 | NO_STR |
| 2715 | NEIGHBOR_STR |
| 2716 | NEIGHBOR_ADDR_STR2 |
| 2717 | "one-hop away EBGP peer using loopback address\n") |
| 2718 | { |
| 2719 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); |
| 2720 | } |
| 2721 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2722 | /* Enforce multihop. */ |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2723 | ALIAS (neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2724 | neighbor_enforce_multihop_cmd, |
| 2725 | NEIGHBOR_CMD2 "enforce-multihop", |
| 2726 | NEIGHBOR_STR |
| 2727 | NEIGHBOR_ADDR_STR2 |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 2728 | "Enforce EBGP neighbors perform multihop\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2729 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 2730 | /* Enforce multihop. */ |
| 2731 | ALIAS (no_neighbor_disable_connected_check, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2732 | no_neighbor_enforce_multihop_cmd, |
| 2733 | NO_NEIGHBOR_CMD2 "enforce-multihop", |
| 2734 | NO_STR |
| 2735 | NEIGHBOR_STR |
| 2736 | NEIGHBOR_ADDR_STR2 |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 2737 | "Enforce EBGP neighbors perform multihop\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2738 | |
| 2739 | DEFUN (neighbor_description, |
| 2740 | neighbor_description_cmd, |
| 2741 | NEIGHBOR_CMD2 "description .LINE", |
| 2742 | NEIGHBOR_STR |
| 2743 | NEIGHBOR_ADDR_STR2 |
| 2744 | "Neighbor specific description\n" |
| 2745 | "Up to 80 characters describing this neighbor\n") |
| 2746 | { |
| 2747 | struct peer *peer; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2748 | char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2749 | |
| 2750 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2751 | if (! peer) |
| 2752 | return CMD_WARNING; |
| 2753 | |
| 2754 | if (argc == 1) |
| 2755 | return CMD_SUCCESS; |
| 2756 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2757 | str = argv_concat(argv, argc, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2758 | |
| 2759 | peer_description_set (peer, str); |
| 2760 | |
ajs | 3b8b185 | 2005-01-29 18:19:13 +0000 | [diff] [blame] | 2761 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2762 | |
| 2763 | return CMD_SUCCESS; |
| 2764 | } |
| 2765 | |
| 2766 | DEFUN (no_neighbor_description, |
| 2767 | no_neighbor_description_cmd, |
| 2768 | NO_NEIGHBOR_CMD2 "description", |
| 2769 | NO_STR |
| 2770 | NEIGHBOR_STR |
| 2771 | NEIGHBOR_ADDR_STR2 |
| 2772 | "Neighbor specific description\n") |
| 2773 | { |
| 2774 | struct peer *peer; |
| 2775 | |
| 2776 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 2777 | if (! peer) |
| 2778 | return CMD_WARNING; |
| 2779 | |
| 2780 | peer_description_unset (peer); |
| 2781 | |
| 2782 | return CMD_SUCCESS; |
| 2783 | } |
| 2784 | |
| 2785 | ALIAS (no_neighbor_description, |
| 2786 | no_neighbor_description_val_cmd, |
| 2787 | NO_NEIGHBOR_CMD2 "description .LINE", |
| 2788 | NO_STR |
| 2789 | NEIGHBOR_STR |
| 2790 | NEIGHBOR_ADDR_STR2 |
| 2791 | "Neighbor specific description\n" |
| 2792 | "Up to 80 characters describing this neighbor\n") |
| 2793 | |
| 2794 | /* Neighbor update-source. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2795 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2796 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
| 2797 | const char *source_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2798 | { |
| 2799 | struct peer *peer; |
| 2800 | union sockunion *su; |
| 2801 | |
| 2802 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2803 | if (! peer) |
| 2804 | return CMD_WARNING; |
| 2805 | |
| 2806 | if (source_str) |
| 2807 | { |
| 2808 | su = sockunion_str2su (source_str); |
| 2809 | if (su) |
| 2810 | { |
| 2811 | peer_update_source_addr_set (peer, su); |
| 2812 | sockunion_free (su); |
| 2813 | } |
| 2814 | else |
| 2815 | peer_update_source_if_set (peer, source_str); |
| 2816 | } |
| 2817 | else |
| 2818 | peer_update_source_unset (peer); |
| 2819 | |
| 2820 | return CMD_SUCCESS; |
| 2821 | } |
| 2822 | |
Paul Jakma | 9a1a331 | 2009-07-27 12:27:55 +0100 | [diff] [blame] | 2823 | #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] | 2824 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
| 2825 | "IPv4 address\n" \ |
Paul Jakma | 9a1a331 | 2009-07-27 12:27:55 +0100 | [diff] [blame] | 2826 | "IPv6 address\n" \ |
| 2827 | "Interface name (requires zebra to be running)\n" |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 2828 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2829 | DEFUN (neighbor_update_source, |
| 2830 | neighbor_update_source_cmd, |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 2831 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2832 | NEIGHBOR_STR |
| 2833 | NEIGHBOR_ADDR_STR2 |
| 2834 | "Source of routing updates\n" |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 2835 | BGP_UPDATE_SOURCE_HELP_STR) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2836 | { |
| 2837 | return peer_update_source_vty (vty, argv[0], argv[1]); |
| 2838 | } |
| 2839 | |
| 2840 | DEFUN (no_neighbor_update_source, |
| 2841 | no_neighbor_update_source_cmd, |
| 2842 | NO_NEIGHBOR_CMD2 "update-source", |
| 2843 | NO_STR |
| 2844 | NEIGHBOR_STR |
| 2845 | NEIGHBOR_ADDR_STR2 |
Paul Jakma | 369688c | 2006-05-23 22:27:55 +0000 | [diff] [blame] | 2846 | "Source of routing updates\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2847 | { |
| 2848 | return peer_update_source_vty (vty, argv[0], NULL); |
| 2849 | } |
| 2850 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2851 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2852 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
| 2853 | afi_t afi, safi_t safi, |
| 2854 | const char *rmap, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2855 | { |
| 2856 | int ret; |
| 2857 | struct peer *peer; |
| 2858 | |
| 2859 | peer = peer_and_group_lookup_vty (vty, peer_str); |
| 2860 | if (! peer) |
| 2861 | return CMD_WARNING; |
| 2862 | |
| 2863 | if (set) |
| 2864 | ret = peer_default_originate_set (peer, afi, safi, rmap); |
| 2865 | else |
| 2866 | ret = peer_default_originate_unset (peer, afi, safi); |
| 2867 | |
| 2868 | return bgp_vty_return (vty, ret); |
| 2869 | } |
| 2870 | |
| 2871 | /* neighbor default-originate. */ |
| 2872 | DEFUN (neighbor_default_originate, |
| 2873 | neighbor_default_originate_cmd, |
| 2874 | NEIGHBOR_CMD2 "default-originate", |
| 2875 | NEIGHBOR_STR |
| 2876 | NEIGHBOR_ADDR_STR2 |
| 2877 | "Originate default route to this neighbor\n") |
| 2878 | { |
| 2879 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2880 | bgp_node_safi (vty), NULL, 1); |
| 2881 | } |
| 2882 | |
| 2883 | DEFUN (neighbor_default_originate_rmap, |
| 2884 | neighbor_default_originate_rmap_cmd, |
| 2885 | NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 2886 | NEIGHBOR_STR |
| 2887 | NEIGHBOR_ADDR_STR2 |
| 2888 | "Originate default route to this neighbor\n" |
| 2889 | "Route-map to specify criteria to originate default\n" |
| 2890 | "route-map name\n") |
| 2891 | { |
| 2892 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2893 | bgp_node_safi (vty), argv[1], 1); |
| 2894 | } |
| 2895 | |
| 2896 | DEFUN (no_neighbor_default_originate, |
| 2897 | no_neighbor_default_originate_cmd, |
| 2898 | NO_NEIGHBOR_CMD2 "default-originate", |
| 2899 | NO_STR |
| 2900 | NEIGHBOR_STR |
| 2901 | NEIGHBOR_ADDR_STR2 |
| 2902 | "Originate default route to this neighbor\n") |
| 2903 | { |
| 2904 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 2905 | bgp_node_safi (vty), NULL, 0); |
| 2906 | } |
| 2907 | |
| 2908 | ALIAS (no_neighbor_default_originate, |
| 2909 | no_neighbor_default_originate_rmap_cmd, |
| 2910 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", |
| 2911 | NO_STR |
| 2912 | NEIGHBOR_STR |
| 2913 | NEIGHBOR_ADDR_STR2 |
| 2914 | "Originate default route to this neighbor\n" |
| 2915 | "Route-map to specify criteria to originate default\n" |
| 2916 | "route-map name\n") |
| 2917 | |
| 2918 | /* Set neighbor's BGP port. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2919 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2920 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
| 2921 | const char *port_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2922 | { |
| 2923 | struct peer *peer; |
| 2924 | u_int16_t port; |
| 2925 | struct servent *sp; |
| 2926 | |
| 2927 | peer = peer_lookup_vty (vty, ip_str); |
| 2928 | if (! peer) |
| 2929 | return CMD_WARNING; |
| 2930 | |
| 2931 | if (! port_str) |
| 2932 | { |
| 2933 | sp = getservbyname ("bgp", "tcp"); |
| 2934 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); |
| 2935 | } |
| 2936 | else |
| 2937 | { |
| 2938 | VTY_GET_INTEGER("port", port, port_str); |
| 2939 | } |
| 2940 | |
| 2941 | peer_port_set (peer, port); |
| 2942 | |
| 2943 | return CMD_SUCCESS; |
| 2944 | } |
| 2945 | |
hasso | f418446 | 2005-02-01 20:13:16 +0000 | [diff] [blame] | 2946 | /* Set specified peer's BGP port. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2947 | DEFUN (neighbor_port, |
| 2948 | neighbor_port_cmd, |
| 2949 | NEIGHBOR_CMD "port <0-65535>", |
| 2950 | NEIGHBOR_STR |
| 2951 | NEIGHBOR_ADDR_STR |
| 2952 | "Neighbor's BGP port\n" |
| 2953 | "TCP port number\n") |
| 2954 | { |
| 2955 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); |
| 2956 | } |
| 2957 | |
| 2958 | DEFUN (no_neighbor_port, |
| 2959 | no_neighbor_port_cmd, |
| 2960 | NO_NEIGHBOR_CMD "port", |
| 2961 | NO_STR |
| 2962 | NEIGHBOR_STR |
| 2963 | NEIGHBOR_ADDR_STR |
| 2964 | "Neighbor's BGP port\n") |
| 2965 | { |
| 2966 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); |
| 2967 | } |
| 2968 | |
| 2969 | ALIAS (no_neighbor_port, |
| 2970 | no_neighbor_port_val_cmd, |
| 2971 | NO_NEIGHBOR_CMD "port <0-65535>", |
| 2972 | NO_STR |
| 2973 | NEIGHBOR_STR |
| 2974 | NEIGHBOR_ADDR_STR |
| 2975 | "Neighbor's BGP port\n" |
| 2976 | "TCP port number\n") |
| 2977 | |
| 2978 | /* neighbor weight. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2979 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2980 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
| 2981 | const char *weight_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2982 | { |
| 2983 | int ret; |
| 2984 | struct peer *peer; |
| 2985 | unsigned long weight; |
| 2986 | |
| 2987 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 2988 | if (! peer) |
| 2989 | return CMD_WARNING; |
| 2990 | |
| 2991 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); |
| 2992 | |
| 2993 | ret = peer_weight_set (peer, weight); |
| 2994 | |
| 2995 | return CMD_SUCCESS; |
| 2996 | } |
| 2997 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 2998 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 2999 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3000 | { |
| 3001 | struct peer *peer; |
| 3002 | |
| 3003 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3004 | if (! peer) |
| 3005 | return CMD_WARNING; |
| 3006 | |
| 3007 | peer_weight_unset (peer); |
| 3008 | |
| 3009 | return CMD_SUCCESS; |
| 3010 | } |
| 3011 | |
| 3012 | DEFUN (neighbor_weight, |
| 3013 | neighbor_weight_cmd, |
| 3014 | NEIGHBOR_CMD2 "weight <0-65535>", |
| 3015 | NEIGHBOR_STR |
| 3016 | NEIGHBOR_ADDR_STR2 |
| 3017 | "Set default weight for routes from this neighbor\n" |
| 3018 | "default weight\n") |
| 3019 | { |
| 3020 | return peer_weight_set_vty (vty, argv[0], argv[1]); |
| 3021 | } |
| 3022 | |
| 3023 | DEFUN (no_neighbor_weight, |
| 3024 | no_neighbor_weight_cmd, |
| 3025 | NO_NEIGHBOR_CMD2 "weight", |
| 3026 | NO_STR |
| 3027 | NEIGHBOR_STR |
| 3028 | NEIGHBOR_ADDR_STR2 |
| 3029 | "Set default weight for routes from this neighbor\n") |
| 3030 | { |
| 3031 | return peer_weight_unset_vty (vty, argv[0]); |
| 3032 | } |
| 3033 | |
| 3034 | ALIAS (no_neighbor_weight, |
| 3035 | no_neighbor_weight_val_cmd, |
| 3036 | NO_NEIGHBOR_CMD2 "weight <0-65535>", |
| 3037 | NO_STR |
| 3038 | NEIGHBOR_STR |
| 3039 | NEIGHBOR_ADDR_STR2 |
| 3040 | "Set default weight for routes from this neighbor\n" |
| 3041 | "default weight\n") |
| 3042 | |
| 3043 | /* Override capability negotiation. */ |
| 3044 | DEFUN (neighbor_override_capability, |
| 3045 | neighbor_override_capability_cmd, |
| 3046 | NEIGHBOR_CMD2 "override-capability", |
| 3047 | NEIGHBOR_STR |
| 3048 | NEIGHBOR_ADDR_STR2 |
| 3049 | "Override capability negotiation result\n") |
| 3050 | { |
| 3051 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 3052 | } |
| 3053 | |
| 3054 | DEFUN (no_neighbor_override_capability, |
| 3055 | no_neighbor_override_capability_cmd, |
| 3056 | NO_NEIGHBOR_CMD2 "override-capability", |
| 3057 | NO_STR |
| 3058 | NEIGHBOR_STR |
| 3059 | NEIGHBOR_ADDR_STR2 |
| 3060 | "Override capability negotiation result\n") |
| 3061 | { |
| 3062 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); |
| 3063 | } |
| 3064 | |
| 3065 | DEFUN (neighbor_strict_capability, |
| 3066 | neighbor_strict_capability_cmd, |
| 3067 | NEIGHBOR_CMD "strict-capability-match", |
| 3068 | NEIGHBOR_STR |
| 3069 | NEIGHBOR_ADDR_STR |
| 3070 | "Strict capability negotiation match\n") |
| 3071 | { |
| 3072 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3073 | } |
| 3074 | |
| 3075 | DEFUN (no_neighbor_strict_capability, |
| 3076 | no_neighbor_strict_capability_cmd, |
| 3077 | NO_NEIGHBOR_CMD "strict-capability-match", |
| 3078 | NO_STR |
| 3079 | NEIGHBOR_STR |
| 3080 | NEIGHBOR_ADDR_STR |
| 3081 | "Strict capability negotiation match\n") |
| 3082 | { |
| 3083 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); |
| 3084 | } |
| 3085 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3086 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3087 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
| 3088 | const char *keep_str, const char *hold_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3089 | { |
| 3090 | int ret; |
| 3091 | struct peer *peer; |
| 3092 | u_int32_t keepalive; |
| 3093 | u_int32_t holdtime; |
| 3094 | |
| 3095 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3096 | if (! peer) |
| 3097 | return CMD_WARNING; |
| 3098 | |
| 3099 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); |
| 3100 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); |
| 3101 | |
| 3102 | ret = peer_timers_set (peer, keepalive, holdtime); |
| 3103 | |
| 3104 | return bgp_vty_return (vty, ret); |
| 3105 | } |
| 3106 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3107 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3108 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3109 | { |
| 3110 | int ret; |
| 3111 | struct peer *peer; |
| 3112 | |
| 3113 | peer = peer_lookup_vty (vty, ip_str); |
| 3114 | if (! peer) |
| 3115 | return CMD_WARNING; |
| 3116 | |
| 3117 | ret = peer_timers_unset (peer); |
| 3118 | |
| 3119 | return bgp_vty_return (vty, ret); |
| 3120 | } |
| 3121 | |
| 3122 | DEFUN (neighbor_timers, |
| 3123 | neighbor_timers_cmd, |
| 3124 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", |
| 3125 | NEIGHBOR_STR |
| 3126 | NEIGHBOR_ADDR_STR2 |
| 3127 | "BGP per neighbor timers\n" |
| 3128 | "Keepalive interval\n" |
| 3129 | "Holdtime\n") |
| 3130 | { |
| 3131 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); |
| 3132 | } |
| 3133 | |
| 3134 | DEFUN (no_neighbor_timers, |
| 3135 | no_neighbor_timers_cmd, |
| 3136 | NO_NEIGHBOR_CMD2 "timers", |
| 3137 | NO_STR |
| 3138 | NEIGHBOR_STR |
| 3139 | NEIGHBOR_ADDR_STR2 |
| 3140 | "BGP per neighbor timers\n") |
| 3141 | { |
| 3142 | return peer_timers_unset_vty (vty, argv[0]); |
| 3143 | } |
| 3144 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3145 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3146 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
| 3147 | const char *time_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3148 | { |
| 3149 | int ret; |
| 3150 | struct peer *peer; |
| 3151 | u_int32_t connect; |
| 3152 | |
| 3153 | peer = peer_lookup_vty (vty, ip_str); |
| 3154 | if (! peer) |
| 3155 | return CMD_WARNING; |
| 3156 | |
| 3157 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); |
| 3158 | |
| 3159 | ret = peer_timers_connect_set (peer, connect); |
| 3160 | |
| 3161 | return CMD_SUCCESS; |
| 3162 | } |
| 3163 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3164 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3165 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3166 | { |
| 3167 | int ret; |
| 3168 | struct peer *peer; |
| 3169 | |
| 3170 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3171 | if (! peer) |
| 3172 | return CMD_WARNING; |
| 3173 | |
| 3174 | ret = peer_timers_connect_unset (peer); |
| 3175 | |
| 3176 | return CMD_SUCCESS; |
| 3177 | } |
| 3178 | |
| 3179 | DEFUN (neighbor_timers_connect, |
| 3180 | neighbor_timers_connect_cmd, |
| 3181 | NEIGHBOR_CMD "timers connect <0-65535>", |
| 3182 | NEIGHBOR_STR |
| 3183 | NEIGHBOR_ADDR_STR |
| 3184 | "BGP per neighbor timers\n" |
| 3185 | "BGP connect timer\n" |
| 3186 | "Connect timer\n") |
| 3187 | { |
| 3188 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); |
| 3189 | } |
| 3190 | |
| 3191 | DEFUN (no_neighbor_timers_connect, |
| 3192 | no_neighbor_timers_connect_cmd, |
| 3193 | NO_NEIGHBOR_CMD "timers connect", |
| 3194 | NO_STR |
| 3195 | NEIGHBOR_STR |
| 3196 | NEIGHBOR_ADDR_STR |
| 3197 | "BGP per neighbor timers\n" |
| 3198 | "BGP connect timer\n") |
| 3199 | { |
| 3200 | return peer_timers_connect_unset_vty (vty, argv[0]); |
| 3201 | } |
| 3202 | |
| 3203 | ALIAS (no_neighbor_timers_connect, |
| 3204 | no_neighbor_timers_connect_val_cmd, |
| 3205 | NO_NEIGHBOR_CMD "timers connect <0-65535>", |
| 3206 | NO_STR |
| 3207 | NEIGHBOR_STR |
| 3208 | NEIGHBOR_ADDR_STR |
| 3209 | "BGP per neighbor timers\n" |
| 3210 | "BGP connect timer\n" |
| 3211 | "Connect timer\n") |
| 3212 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3213 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3214 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
| 3215 | const char *time_str, int set) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3216 | { |
| 3217 | int ret; |
| 3218 | struct peer *peer; |
| 3219 | u_int32_t routeadv = 0; |
| 3220 | |
| 3221 | peer = peer_lookup_vty (vty, ip_str); |
| 3222 | if (! peer) |
| 3223 | return CMD_WARNING; |
| 3224 | |
| 3225 | if (time_str) |
| 3226 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); |
| 3227 | |
| 3228 | if (set) |
| 3229 | ret = peer_advertise_interval_set (peer, routeadv); |
| 3230 | else |
| 3231 | ret = peer_advertise_interval_unset (peer); |
| 3232 | |
| 3233 | return CMD_SUCCESS; |
| 3234 | } |
| 3235 | |
| 3236 | DEFUN (neighbor_advertise_interval, |
| 3237 | neighbor_advertise_interval_cmd, |
| 3238 | NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3239 | NEIGHBOR_STR |
| 3240 | NEIGHBOR_ADDR_STR |
| 3241 | "Minimum interval between sending BGP routing updates\n" |
| 3242 | "time in seconds\n") |
| 3243 | { |
| 3244 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); |
| 3245 | } |
| 3246 | |
| 3247 | DEFUN (no_neighbor_advertise_interval, |
| 3248 | no_neighbor_advertise_interval_cmd, |
| 3249 | NO_NEIGHBOR_CMD "advertisement-interval", |
| 3250 | NO_STR |
| 3251 | NEIGHBOR_STR |
| 3252 | NEIGHBOR_ADDR_STR |
| 3253 | "Minimum interval between sending BGP routing updates\n") |
| 3254 | { |
| 3255 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); |
| 3256 | } |
| 3257 | |
| 3258 | ALIAS (no_neighbor_advertise_interval, |
| 3259 | no_neighbor_advertise_interval_val_cmd, |
| 3260 | NO_NEIGHBOR_CMD "advertisement-interval <0-600>", |
| 3261 | NO_STR |
| 3262 | NEIGHBOR_STR |
| 3263 | NEIGHBOR_ADDR_STR |
| 3264 | "Minimum interval between sending BGP routing updates\n" |
| 3265 | "time in seconds\n") |
| 3266 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3267 | /* neighbor interface */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3268 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3269 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3270 | { |
| 3271 | int ret; |
| 3272 | struct peer *peer; |
| 3273 | |
| 3274 | peer = peer_lookup_vty (vty, ip_str); |
| 3275 | if (! peer) |
| 3276 | return CMD_WARNING; |
| 3277 | |
| 3278 | if (str) |
| 3279 | ret = peer_interface_set (peer, str); |
| 3280 | else |
| 3281 | ret = peer_interface_unset (peer); |
| 3282 | |
| 3283 | return CMD_SUCCESS; |
| 3284 | } |
| 3285 | |
| 3286 | DEFUN (neighbor_interface, |
| 3287 | neighbor_interface_cmd, |
| 3288 | NEIGHBOR_CMD "interface WORD", |
| 3289 | NEIGHBOR_STR |
| 3290 | NEIGHBOR_ADDR_STR |
| 3291 | "Interface\n" |
| 3292 | "Interface name\n") |
| 3293 | { |
| 3294 | return peer_interface_vty (vty, argv[0], argv[1]); |
| 3295 | } |
| 3296 | |
| 3297 | DEFUN (no_neighbor_interface, |
| 3298 | no_neighbor_interface_cmd, |
| 3299 | NO_NEIGHBOR_CMD "interface WORD", |
| 3300 | NO_STR |
| 3301 | NEIGHBOR_STR |
| 3302 | NEIGHBOR_ADDR_STR |
| 3303 | "Interface\n" |
| 3304 | "Interface name\n") |
| 3305 | { |
| 3306 | return peer_interface_vty (vty, argv[0], NULL); |
| 3307 | } |
| 3308 | |
| 3309 | /* Set distribute list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3310 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3311 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
| 3312 | afi_t afi, safi_t safi, |
| 3313 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3314 | { |
| 3315 | int ret; |
| 3316 | struct peer *peer; |
| 3317 | int direct = FILTER_IN; |
| 3318 | |
| 3319 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3320 | if (! peer) |
| 3321 | return CMD_WARNING; |
| 3322 | |
| 3323 | /* Check filter direction. */ |
| 3324 | if (strncmp (direct_str, "i", 1) == 0) |
| 3325 | direct = FILTER_IN; |
| 3326 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3327 | direct = FILTER_OUT; |
| 3328 | |
| 3329 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); |
| 3330 | |
| 3331 | return bgp_vty_return (vty, ret); |
| 3332 | } |
| 3333 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3334 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3335 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3336 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3337 | { |
| 3338 | int ret; |
| 3339 | struct peer *peer; |
| 3340 | int direct = FILTER_IN; |
| 3341 | |
| 3342 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3343 | if (! peer) |
| 3344 | return CMD_WARNING; |
| 3345 | |
| 3346 | /* Check filter direction. */ |
| 3347 | if (strncmp (direct_str, "i", 1) == 0) |
| 3348 | direct = FILTER_IN; |
| 3349 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3350 | direct = FILTER_OUT; |
| 3351 | |
| 3352 | ret = peer_distribute_unset (peer, afi, safi, direct); |
| 3353 | |
| 3354 | return bgp_vty_return (vty, ret); |
| 3355 | } |
| 3356 | |
| 3357 | DEFUN (neighbor_distribute_list, |
| 3358 | neighbor_distribute_list_cmd, |
| 3359 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3360 | NEIGHBOR_STR |
| 3361 | NEIGHBOR_ADDR_STR2 |
| 3362 | "Filter updates to/from this neighbor\n" |
| 3363 | "IP access-list number\n" |
| 3364 | "IP access-list number (expanded range)\n" |
| 3365 | "IP Access-list name\n" |
| 3366 | "Filter incoming updates\n" |
| 3367 | "Filter outgoing updates\n") |
| 3368 | { |
| 3369 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3370 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3371 | } |
| 3372 | |
| 3373 | DEFUN (no_neighbor_distribute_list, |
| 3374 | no_neighbor_distribute_list_cmd, |
| 3375 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", |
| 3376 | NO_STR |
| 3377 | NEIGHBOR_STR |
| 3378 | NEIGHBOR_ADDR_STR2 |
| 3379 | "Filter updates to/from this neighbor\n" |
| 3380 | "IP access-list number\n" |
| 3381 | "IP access-list number (expanded range)\n" |
| 3382 | "IP Access-list name\n" |
| 3383 | "Filter incoming updates\n" |
| 3384 | "Filter outgoing updates\n") |
| 3385 | { |
| 3386 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3387 | bgp_node_safi (vty), argv[2]); |
| 3388 | } |
| 3389 | |
| 3390 | /* Set prefix list to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3391 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3392 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3393 | safi_t safi, const char *name_str, |
| 3394 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3395 | { |
| 3396 | int ret; |
| 3397 | struct peer *peer; |
| 3398 | int direct = FILTER_IN; |
| 3399 | |
| 3400 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3401 | if (! peer) |
| 3402 | return CMD_WARNING; |
| 3403 | |
| 3404 | /* Check filter direction. */ |
| 3405 | if (strncmp (direct_str, "i", 1) == 0) |
| 3406 | direct = FILTER_IN; |
| 3407 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3408 | direct = FILTER_OUT; |
| 3409 | |
| 3410 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); |
| 3411 | |
| 3412 | return bgp_vty_return (vty, ret); |
| 3413 | } |
| 3414 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3415 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3416 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3417 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3418 | { |
| 3419 | int ret; |
| 3420 | struct peer *peer; |
| 3421 | int direct = FILTER_IN; |
| 3422 | |
| 3423 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3424 | if (! peer) |
| 3425 | return CMD_WARNING; |
| 3426 | |
| 3427 | /* Check filter direction. */ |
| 3428 | if (strncmp (direct_str, "i", 1) == 0) |
| 3429 | direct = FILTER_IN; |
| 3430 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3431 | direct = FILTER_OUT; |
| 3432 | |
| 3433 | ret = peer_prefix_list_unset (peer, afi, safi, direct); |
| 3434 | |
| 3435 | return bgp_vty_return (vty, ret); |
| 3436 | } |
| 3437 | |
| 3438 | DEFUN (neighbor_prefix_list, |
| 3439 | neighbor_prefix_list_cmd, |
| 3440 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3441 | NEIGHBOR_STR |
| 3442 | NEIGHBOR_ADDR_STR2 |
| 3443 | "Filter updates to/from this neighbor\n" |
| 3444 | "Name of a prefix list\n" |
| 3445 | "Filter incoming updates\n" |
| 3446 | "Filter outgoing updates\n") |
| 3447 | { |
| 3448 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3449 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3450 | } |
| 3451 | |
| 3452 | DEFUN (no_neighbor_prefix_list, |
| 3453 | no_neighbor_prefix_list_cmd, |
| 3454 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", |
| 3455 | NO_STR |
| 3456 | NEIGHBOR_STR |
| 3457 | NEIGHBOR_ADDR_STR2 |
| 3458 | "Filter updates to/from this neighbor\n" |
| 3459 | "Name of a prefix list\n" |
| 3460 | "Filter incoming updates\n" |
| 3461 | "Filter outgoing updates\n") |
| 3462 | { |
| 3463 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3464 | bgp_node_safi (vty), argv[2]); |
| 3465 | } |
| 3466 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3467 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3468 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
| 3469 | afi_t afi, safi_t safi, |
| 3470 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3471 | { |
| 3472 | int ret; |
| 3473 | struct peer *peer; |
| 3474 | int direct = FILTER_IN; |
| 3475 | |
| 3476 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3477 | if (! peer) |
| 3478 | return CMD_WARNING; |
| 3479 | |
| 3480 | /* Check filter direction. */ |
| 3481 | if (strncmp (direct_str, "i", 1) == 0) |
| 3482 | direct = FILTER_IN; |
| 3483 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3484 | direct = FILTER_OUT; |
| 3485 | |
| 3486 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); |
| 3487 | |
| 3488 | return bgp_vty_return (vty, ret); |
| 3489 | } |
| 3490 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3491 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3492 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
| 3493 | afi_t afi, safi_t safi, |
| 3494 | const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3495 | { |
| 3496 | int ret; |
| 3497 | struct peer *peer; |
| 3498 | int direct = FILTER_IN; |
| 3499 | |
| 3500 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3501 | if (! peer) |
| 3502 | return CMD_WARNING; |
| 3503 | |
| 3504 | /* Check filter direction. */ |
| 3505 | if (strncmp (direct_str, "i", 1) == 0) |
| 3506 | direct = FILTER_IN; |
| 3507 | else if (strncmp (direct_str, "o", 1) == 0) |
| 3508 | direct = FILTER_OUT; |
| 3509 | |
| 3510 | ret = peer_aslist_unset (peer, afi, safi, direct); |
| 3511 | |
| 3512 | return bgp_vty_return (vty, ret); |
| 3513 | } |
| 3514 | |
| 3515 | DEFUN (neighbor_filter_list, |
| 3516 | neighbor_filter_list_cmd, |
| 3517 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3518 | NEIGHBOR_STR |
| 3519 | NEIGHBOR_ADDR_STR2 |
| 3520 | "Establish BGP filters\n" |
| 3521 | "AS path access-list name\n" |
| 3522 | "Filter incoming routes\n" |
| 3523 | "Filter outgoing routes\n") |
| 3524 | { |
| 3525 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3526 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3527 | } |
| 3528 | |
| 3529 | DEFUN (no_neighbor_filter_list, |
| 3530 | no_neighbor_filter_list_cmd, |
| 3531 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", |
| 3532 | NO_STR |
| 3533 | NEIGHBOR_STR |
| 3534 | NEIGHBOR_ADDR_STR2 |
| 3535 | "Establish BGP filters\n" |
| 3536 | "AS path access-list name\n" |
| 3537 | "Filter incoming routes\n" |
| 3538 | "Filter outgoing routes\n") |
| 3539 | { |
| 3540 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3541 | bgp_node_safi (vty), argv[2]); |
| 3542 | } |
| 3543 | |
| 3544 | /* Set route-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3545 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3546 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
| 3547 | afi_t afi, safi_t safi, |
| 3548 | const char *name_str, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3549 | { |
| 3550 | int ret; |
| 3551 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3552 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3553 | |
| 3554 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3555 | if (! peer) |
| 3556 | return CMD_WARNING; |
| 3557 | |
| 3558 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3559 | if (strncmp (direct_str, "in", 2) == 0) |
| 3560 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3561 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3562 | direct = RMAP_OUT; |
| 3563 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3564 | direct = RMAP_IMPORT; |
| 3565 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3566 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3567 | |
| 3568 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); |
| 3569 | |
| 3570 | return bgp_vty_return (vty, ret); |
| 3571 | } |
| 3572 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3573 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3574 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3575 | safi_t safi, const char *direct_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3576 | { |
| 3577 | int ret; |
| 3578 | struct peer *peer; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3579 | int direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3580 | |
| 3581 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3582 | if (! peer) |
| 3583 | return CMD_WARNING; |
| 3584 | |
| 3585 | /* Check filter direction. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3586 | if (strncmp (direct_str, "in", 2) == 0) |
| 3587 | direct = RMAP_IN; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3588 | else if (strncmp (direct_str, "o", 1) == 0) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3589 | direct = RMAP_OUT; |
| 3590 | else if (strncmp (direct_str, "im", 2) == 0) |
| 3591 | direct = RMAP_IMPORT; |
| 3592 | else if (strncmp (direct_str, "e", 1) == 0) |
| 3593 | direct = RMAP_EXPORT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3594 | |
| 3595 | ret = peer_route_map_unset (peer, afi, safi, direct); |
| 3596 | |
| 3597 | return bgp_vty_return (vty, ret); |
| 3598 | } |
| 3599 | |
| 3600 | DEFUN (neighbor_route_map, |
| 3601 | neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3602 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3603 | NEIGHBOR_STR |
| 3604 | NEIGHBOR_ADDR_STR2 |
| 3605 | "Apply route map to neighbor\n" |
| 3606 | "Name of route map\n" |
| 3607 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3608 | "Apply map to outbound routes\n" |
| 3609 | "Apply map to routes going into a Route-Server client's table\n" |
| 3610 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3611 | { |
| 3612 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3613 | bgp_node_safi (vty), argv[1], argv[2]); |
| 3614 | } |
| 3615 | |
| 3616 | DEFUN (no_neighbor_route_map, |
| 3617 | no_neighbor_route_map_cmd, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3618 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3619 | NO_STR |
| 3620 | NEIGHBOR_STR |
| 3621 | NEIGHBOR_ADDR_STR2 |
| 3622 | "Apply route map to neighbor\n" |
| 3623 | "Name of route map\n" |
| 3624 | "Apply map to incoming routes\n" |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 3625 | "Apply map to outbound routes\n" |
| 3626 | "Apply map to routes going into a Route-Server client's table\n" |
| 3627 | "Apply map to routes coming from a Route-Server client") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3628 | { |
| 3629 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3630 | bgp_node_safi (vty), argv[2]); |
| 3631 | } |
| 3632 | |
| 3633 | /* Set unsuppress-map to the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3634 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3635 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3636 | safi_t safi, const char *name_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3637 | { |
| 3638 | int ret; |
| 3639 | struct peer *peer; |
| 3640 | |
| 3641 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3642 | if (! peer) |
| 3643 | return CMD_WARNING; |
| 3644 | |
| 3645 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); |
| 3646 | |
| 3647 | return bgp_vty_return (vty, ret); |
| 3648 | } |
| 3649 | |
| 3650 | /* Unset route-map from the peer. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3651 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3652 | 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] | 3653 | safi_t safi) |
| 3654 | { |
| 3655 | int ret; |
| 3656 | struct peer *peer; |
| 3657 | |
| 3658 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3659 | if (! peer) |
| 3660 | return CMD_WARNING; |
| 3661 | |
| 3662 | ret = peer_unsuppress_map_unset (peer, afi, safi); |
| 3663 | |
| 3664 | return bgp_vty_return (vty, ret); |
| 3665 | } |
| 3666 | |
| 3667 | DEFUN (neighbor_unsuppress_map, |
| 3668 | neighbor_unsuppress_map_cmd, |
| 3669 | NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3670 | NEIGHBOR_STR |
| 3671 | NEIGHBOR_ADDR_STR2 |
| 3672 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3673 | "Name of route map\n") |
| 3674 | { |
| 3675 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3676 | bgp_node_safi (vty), argv[1]); |
| 3677 | } |
| 3678 | |
| 3679 | DEFUN (no_neighbor_unsuppress_map, |
| 3680 | no_neighbor_unsuppress_map_cmd, |
| 3681 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", |
| 3682 | NO_STR |
| 3683 | NEIGHBOR_STR |
| 3684 | NEIGHBOR_ADDR_STR2 |
| 3685 | "Route-map to selectively unsuppress suppressed routes\n" |
| 3686 | "Name of route map\n") |
| 3687 | { |
| 3688 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3689 | bgp_node_safi (vty)); |
| 3690 | } |
| 3691 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3692 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3693 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
| 3694 | safi_t safi, const char *num_str, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3695 | const char *threshold_str, int warning, |
| 3696 | const char *restart_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3697 | { |
| 3698 | int ret; |
| 3699 | struct peer *peer; |
| 3700 | u_int32_t max; |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3701 | u_char threshold; |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3702 | u_int16_t restart; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3703 | |
| 3704 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3705 | if (! peer) |
| 3706 | return CMD_WARNING; |
| 3707 | |
Denis Ovsienko | 6787978 | 2011-09-10 21:50:53 +0400 | [diff] [blame] | 3708 | VTY_GET_INTEGER ("maximum number", max, num_str); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3709 | if (threshold_str) |
| 3710 | threshold = atoi (threshold_str); |
| 3711 | else |
| 3712 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3713 | |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3714 | if (restart_str) |
| 3715 | restart = atoi (restart_str); |
| 3716 | else |
| 3717 | restart = 0; |
| 3718 | |
| 3719 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3720 | |
| 3721 | return bgp_vty_return (vty, ret); |
| 3722 | } |
| 3723 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 3724 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3725 | 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] | 3726 | safi_t safi) |
| 3727 | { |
| 3728 | int ret; |
| 3729 | struct peer *peer; |
| 3730 | |
| 3731 | peer = peer_and_group_lookup_vty (vty, ip_str); |
| 3732 | if (! peer) |
| 3733 | return CMD_WARNING; |
| 3734 | |
| 3735 | ret = peer_maximum_prefix_unset (peer, afi, safi); |
| 3736 | |
| 3737 | return bgp_vty_return (vty, ret); |
| 3738 | } |
| 3739 | |
| 3740 | /* Maximum number of prefix configuration. prefix count is different |
| 3741 | for each peer configuration. So this configuration can be set for |
| 3742 | each peer configuration. */ |
| 3743 | DEFUN (neighbor_maximum_prefix, |
| 3744 | neighbor_maximum_prefix_cmd, |
| 3745 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3746 | NEIGHBOR_STR |
| 3747 | NEIGHBOR_ADDR_STR2 |
| 3748 | "Maximum number of prefix accept from this peer\n" |
| 3749 | "maximum no. of prefix limit\n") |
| 3750 | { |
| 3751 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3752 | bgp_node_safi (vty), argv[1], NULL, 0, |
| 3753 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3754 | } |
| 3755 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3756 | DEFUN (neighbor_maximum_prefix_threshold, |
| 3757 | neighbor_maximum_prefix_threshold_cmd, |
| 3758 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", |
| 3759 | NEIGHBOR_STR |
| 3760 | NEIGHBOR_ADDR_STR2 |
| 3761 | "Maximum number of prefix accept from this peer\n" |
| 3762 | "maximum no. of prefix limit\n" |
| 3763 | "Threshold value (%) at which to generate a warning msg\n") |
| 3764 | { |
| 3765 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3766 | bgp_node_safi (vty), argv[1], argv[2], 0, |
| 3767 | NULL); |
| 3768 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3769 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3770 | DEFUN (neighbor_maximum_prefix_warning, |
| 3771 | neighbor_maximum_prefix_warning_cmd, |
| 3772 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3773 | NEIGHBOR_STR |
| 3774 | NEIGHBOR_ADDR_STR2 |
| 3775 | "Maximum number of prefix accept from this peer\n" |
| 3776 | "maximum no. of prefix limit\n" |
| 3777 | "Only give warning message when limit is exceeded\n") |
| 3778 | { |
| 3779 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3780 | bgp_node_safi (vty), argv[1], NULL, 1, |
| 3781 | NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3782 | } |
| 3783 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3784 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
| 3785 | neighbor_maximum_prefix_threshold_warning_cmd, |
| 3786 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 3787 | NEIGHBOR_STR |
| 3788 | NEIGHBOR_ADDR_STR2 |
| 3789 | "Maximum number of prefix accept from this peer\n" |
| 3790 | "maximum no. of prefix limit\n" |
| 3791 | "Threshold value (%) at which to generate a warning msg\n" |
| 3792 | "Only give warning message when limit is exceeded\n") |
| 3793 | { |
| 3794 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3795 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
| 3796 | } |
| 3797 | |
| 3798 | DEFUN (neighbor_maximum_prefix_restart, |
| 3799 | neighbor_maximum_prefix_restart_cmd, |
| 3800 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
| 3801 | NEIGHBOR_STR |
| 3802 | NEIGHBOR_ADDR_STR2 |
| 3803 | "Maximum number of prefix accept from this peer\n" |
| 3804 | "maximum no. of prefix limit\n" |
| 3805 | "Restart bgp connection after limit is exceeded\n" |
| 3806 | "Restart interval in minutes") |
| 3807 | { |
| 3808 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3809 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); |
| 3810 | } |
| 3811 | |
| 3812 | DEFUN (neighbor_maximum_prefix_threshold_restart, |
| 3813 | neighbor_maximum_prefix_threshold_restart_cmd, |
| 3814 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 3815 | NEIGHBOR_STR |
| 3816 | NEIGHBOR_ADDR_STR2 |
| 3817 | "Maximum number of prefix accept from this peer\n" |
| 3818 | "maximum no. of prefix limit\n" |
| 3819 | "Threshold value (%) at which to generate a warning msg\n" |
| 3820 | "Restart bgp connection after limit is exceeded\n" |
| 3821 | "Restart interval in minutes") |
| 3822 | { |
| 3823 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), |
| 3824 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); |
| 3825 | } |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3826 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3827 | DEFUN (no_neighbor_maximum_prefix, |
| 3828 | no_neighbor_maximum_prefix_cmd, |
| 3829 | NO_NEIGHBOR_CMD2 "maximum-prefix", |
| 3830 | NO_STR |
| 3831 | NEIGHBOR_STR |
| 3832 | NEIGHBOR_ADDR_STR2 |
| 3833 | "Maximum number of prefix accept from this peer\n") |
| 3834 | { |
| 3835 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), |
| 3836 | bgp_node_safi (vty)); |
| 3837 | } |
| 3838 | |
| 3839 | ALIAS (no_neighbor_maximum_prefix, |
| 3840 | no_neighbor_maximum_prefix_val_cmd, |
| 3841 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", |
| 3842 | NO_STR |
| 3843 | NEIGHBOR_STR |
| 3844 | NEIGHBOR_ADDR_STR2 |
| 3845 | "Maximum number of prefix accept from this peer\n" |
| 3846 | "maximum no. of prefix limit\n") |
| 3847 | |
| 3848 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3849 | no_neighbor_maximum_prefix_threshold_cmd, |
| 3850 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3851 | NO_STR |
| 3852 | NEIGHBOR_STR |
| 3853 | NEIGHBOR_ADDR_STR2 |
| 3854 | "Maximum number of prefix accept from this peer\n" |
| 3855 | "maximum no. of prefix limit\n" |
| 3856 | "Threshold value (%) at which to generate a warning msg\n") |
| 3857 | |
| 3858 | ALIAS (no_neighbor_maximum_prefix, |
| 3859 | no_neighbor_maximum_prefix_warning_cmd, |
| 3860 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
| 3861 | NO_STR |
| 3862 | NEIGHBOR_STR |
| 3863 | NEIGHBOR_ADDR_STR2 |
| 3864 | "Maximum number of prefix accept from this peer\n" |
| 3865 | "maximum no. of prefix limit\n" |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 3866 | "Only give warning message when limit is exceeded\n") |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3867 | |
| 3868 | ALIAS (no_neighbor_maximum_prefix, |
| 3869 | no_neighbor_maximum_prefix_threshold_warning_cmd, |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3870 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
| 3871 | NO_STR |
| 3872 | NEIGHBOR_STR |
| 3873 | NEIGHBOR_ADDR_STR2 |
| 3874 | "Maximum number of prefix accept from this peer\n" |
| 3875 | "maximum no. of prefix limit\n" |
| 3876 | "Threshold value (%) at which to generate a warning msg\n" |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 3877 | "Only give warning message when limit is exceeded\n") |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 3878 | |
| 3879 | ALIAS (no_neighbor_maximum_prefix, |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3880 | no_neighbor_maximum_prefix_restart_cmd, |
| 3881 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3882 | NO_STR |
| 3883 | NEIGHBOR_STR |
| 3884 | NEIGHBOR_ADDR_STR2 |
| 3885 | "Maximum number of prefix accept from this peer\n" |
| 3886 | "maximum no. of prefix limit\n" |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 3887 | "Restart bgp connection after limit is exceeded\n" |
| 3888 | "Restart interval in minutes") |
| 3889 | |
| 3890 | ALIAS (no_neighbor_maximum_prefix, |
| 3891 | no_neighbor_maximum_prefix_threshold_restart_cmd, |
| 3892 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", |
| 3893 | NO_STR |
| 3894 | NEIGHBOR_STR |
| 3895 | NEIGHBOR_ADDR_STR2 |
| 3896 | "Maximum number of prefix accept from this peer\n" |
| 3897 | "maximum no. of prefix limit\n" |
| 3898 | "Threshold value (%) at which to generate a warning msg\n" |
| 3899 | "Restart bgp connection after limit is exceeded\n" |
| 3900 | "Restart interval in minutes") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3901 | |
| 3902 | /* "neighbor allowas-in" */ |
| 3903 | DEFUN (neighbor_allowas_in, |
| 3904 | neighbor_allowas_in_cmd, |
| 3905 | NEIGHBOR_CMD2 "allowas-in", |
| 3906 | NEIGHBOR_STR |
| 3907 | NEIGHBOR_ADDR_STR2 |
| 3908 | "Accept as-path with my AS present in it\n") |
| 3909 | { |
| 3910 | int ret; |
| 3911 | struct peer *peer; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 3912 | unsigned int allow_num; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3913 | |
| 3914 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3915 | if (! peer) |
| 3916 | return CMD_WARNING; |
| 3917 | |
| 3918 | if (argc == 1) |
| 3919 | allow_num = 3; |
| 3920 | else |
| 3921 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); |
| 3922 | |
| 3923 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), |
| 3924 | allow_num); |
| 3925 | |
| 3926 | return bgp_vty_return (vty, ret); |
| 3927 | } |
| 3928 | |
| 3929 | ALIAS (neighbor_allowas_in, |
| 3930 | neighbor_allowas_in_arg_cmd, |
| 3931 | NEIGHBOR_CMD2 "allowas-in <1-10>", |
| 3932 | NEIGHBOR_STR |
| 3933 | NEIGHBOR_ADDR_STR2 |
| 3934 | "Accept as-path with my AS present in it\n" |
| 3935 | "Number of occurances of AS number\n") |
| 3936 | |
| 3937 | DEFUN (no_neighbor_allowas_in, |
| 3938 | no_neighbor_allowas_in_cmd, |
| 3939 | NO_NEIGHBOR_CMD2 "allowas-in", |
| 3940 | NO_STR |
| 3941 | NEIGHBOR_STR |
| 3942 | NEIGHBOR_ADDR_STR2 |
| 3943 | "allow local ASN appears in aspath attribute\n") |
| 3944 | { |
| 3945 | int ret; |
| 3946 | struct peer *peer; |
| 3947 | |
| 3948 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
| 3949 | if (! peer) |
| 3950 | return CMD_WARNING; |
| 3951 | |
| 3952 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
| 3953 | |
| 3954 | return bgp_vty_return (vty, ret); |
| 3955 | } |
| 3956 | |
| 3957 | /* Address family configuration. */ |
| 3958 | DEFUN (address_family_ipv4, |
| 3959 | address_family_ipv4_cmd, |
| 3960 | "address-family ipv4", |
| 3961 | "Enter Address Family command mode\n" |
| 3962 | "Address family\n") |
| 3963 | { |
| 3964 | vty->node = BGP_IPV4_NODE; |
| 3965 | return CMD_SUCCESS; |
| 3966 | } |
| 3967 | |
| 3968 | DEFUN (address_family_ipv4_safi, |
| 3969 | address_family_ipv4_safi_cmd, |
| 3970 | "address-family ipv4 (unicast|multicast)", |
| 3971 | "Enter Address Family command mode\n" |
| 3972 | "Address family\n" |
| 3973 | "Address Family modifier\n" |
| 3974 | "Address Family modifier\n") |
| 3975 | { |
| 3976 | if (strncmp (argv[0], "m", 1) == 0) |
| 3977 | vty->node = BGP_IPV4M_NODE; |
| 3978 | else |
| 3979 | vty->node = BGP_IPV4_NODE; |
| 3980 | |
| 3981 | return CMD_SUCCESS; |
| 3982 | } |
| 3983 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 3984 | DEFUN (address_family_ipv6, |
| 3985 | address_family_ipv6_cmd, |
| 3986 | "address-family ipv6", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3987 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 3988 | "Address family\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3989 | { |
| 3990 | vty->node = BGP_IPV6_NODE; |
| 3991 | return CMD_SUCCESS; |
| 3992 | } |
| 3993 | |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 3994 | DEFUN (address_family_ipv6_safi, |
| 3995 | address_family_ipv6_safi_cmd, |
| 3996 | "address-family ipv6 (unicast|multicast)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3997 | "Enter Address Family command mode\n" |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 3998 | "Address family\n" |
| 3999 | "Address Family modifier\n" |
| 4000 | "Address Family modifier\n") |
| 4001 | { |
| 4002 | if (strncmp (argv[0], "m", 1) == 0) |
| 4003 | vty->node = BGP_IPV6M_NODE; |
| 4004 | else |
| 4005 | vty->node = BGP_IPV6_NODE; |
| 4006 | |
| 4007 | return CMD_SUCCESS; |
| 4008 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4009 | |
| 4010 | DEFUN (address_family_vpnv4, |
| 4011 | address_family_vpnv4_cmd, |
| 4012 | "address-family vpnv4", |
| 4013 | "Enter Address Family command mode\n" |
| 4014 | "Address family\n") |
| 4015 | { |
| 4016 | vty->node = BGP_VPNV4_NODE; |
| 4017 | return CMD_SUCCESS; |
| 4018 | } |
| 4019 | |
| 4020 | ALIAS (address_family_vpnv4, |
| 4021 | address_family_vpnv4_unicast_cmd, |
| 4022 | "address-family vpnv4 unicast", |
| 4023 | "Enter Address Family command mode\n" |
| 4024 | "Address family\n" |
| 4025 | "Address Family Modifier\n") |
| 4026 | |
| 4027 | DEFUN (exit_address_family, |
| 4028 | exit_address_family_cmd, |
| 4029 | "exit-address-family", |
| 4030 | "Exit from Address Family configuration mode\n") |
| 4031 | { |
hasso | a8a80d5 | 2005-04-09 13:07:47 +0000 | [diff] [blame] | 4032 | if (vty->node == BGP_IPV4_NODE |
| 4033 | || vty->node == BGP_IPV4M_NODE |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4034 | || vty->node == BGP_VPNV4_NODE |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 4035 | || vty->node == BGP_IPV6_NODE |
| 4036 | || vty->node == BGP_IPV6M_NODE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4037 | vty->node = BGP_NODE; |
| 4038 | return CMD_SUCCESS; |
| 4039 | } |
| 4040 | |
| 4041 | /* BGP clear sort. */ |
| 4042 | enum clear_sort |
| 4043 | { |
| 4044 | clear_all, |
| 4045 | clear_peer, |
| 4046 | clear_group, |
| 4047 | clear_external, |
| 4048 | clear_as |
| 4049 | }; |
| 4050 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4051 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4052 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
| 4053 | safi_t safi, int error) |
| 4054 | { |
| 4055 | switch (error) |
| 4056 | { |
| 4057 | case BGP_ERR_AF_UNCONFIGURED: |
| 4058 | vty_out (vty, |
| 4059 | "%%BGP: Enable %s %s address family for the neighbor %s%s", |
| 4060 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", |
| 4061 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", |
| 4062 | peer->host, VTY_NEWLINE); |
| 4063 | break; |
| 4064 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: |
| 4065 | 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); |
| 4066 | break; |
| 4067 | default: |
| 4068 | break; |
| 4069 | } |
| 4070 | } |
| 4071 | |
| 4072 | /* `clear ip bgp' functions. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4073 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4074 | 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] | 4075 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4076 | { |
| 4077 | int ret; |
| 4078 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4079 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4080 | |
| 4081 | /* Clear all neighbors. */ |
| 4082 | if (sort == clear_all) |
| 4083 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4084 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4085 | { |
| 4086 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4087 | ret = peer_clear (peer); |
| 4088 | else |
| 4089 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4090 | |
| 4091 | if (ret < 0) |
| 4092 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4093 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4094 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4095 | } |
| 4096 | |
| 4097 | /* Clear specified neighbors. */ |
| 4098 | if (sort == clear_peer) |
| 4099 | { |
| 4100 | union sockunion su; |
| 4101 | int ret; |
| 4102 | |
| 4103 | /* Make sockunion for lookup. */ |
| 4104 | ret = str2sockunion (arg, &su); |
| 4105 | if (ret < 0) |
| 4106 | { |
| 4107 | vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4108 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4109 | } |
| 4110 | peer = peer_lookup (bgp, &su); |
| 4111 | if (! peer) |
| 4112 | { |
| 4113 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4114 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4115 | } |
| 4116 | |
| 4117 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4118 | ret = peer_clear (peer); |
| 4119 | else |
| 4120 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4121 | |
| 4122 | if (ret < 0) |
| 4123 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4124 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4125 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4126 | } |
| 4127 | |
| 4128 | /* Clear all peer-group members. */ |
| 4129 | if (sort == clear_group) |
| 4130 | { |
| 4131 | struct peer_group *group; |
| 4132 | |
| 4133 | group = peer_group_lookup (bgp, arg); |
| 4134 | if (! group) |
| 4135 | { |
| 4136 | 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] | 4137 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4138 | } |
| 4139 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4140 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4141 | { |
| 4142 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4143 | { |
| 4144 | ret = peer_clear (peer); |
| 4145 | continue; |
| 4146 | } |
| 4147 | |
| 4148 | if (! peer->af_group[afi][safi]) |
| 4149 | continue; |
| 4150 | |
| 4151 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4152 | |
| 4153 | if (ret < 0) |
| 4154 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4155 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4156 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4157 | } |
| 4158 | |
| 4159 | if (sort == clear_external) |
| 4160 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4161 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4162 | { |
| 4163 | if (peer_sort (peer) == BGP_PEER_IBGP) |
| 4164 | continue; |
| 4165 | |
| 4166 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4167 | ret = peer_clear (peer); |
| 4168 | else |
| 4169 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4170 | |
| 4171 | if (ret < 0) |
| 4172 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4173 | } |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4174 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4175 | } |
| 4176 | |
| 4177 | if (sort == clear_as) |
| 4178 | { |
| 4179 | as_t as; |
| 4180 | unsigned long as_ul; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4181 | int find = 0; |
| 4182 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4183 | VTY_GET_LONG ("AS", as_ul, arg); |
| 4184 | |
| 4185 | if (!as_ul) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4186 | { |
| 4187 | vty_out (vty, "Invalid AS number%s", VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4188 | return CMD_WARNING; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4189 | } |
| 4190 | as = (as_t) as_ul; |
| 4191 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4192 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4193 | { |
| 4194 | if (peer->as != as) |
| 4195 | continue; |
| 4196 | |
| 4197 | find = 1; |
| 4198 | if (stype == BGP_CLEAR_SOFT_NONE) |
| 4199 | ret = peer_clear (peer); |
| 4200 | else |
| 4201 | ret = peer_clear_soft (peer, afi, safi, stype); |
| 4202 | |
| 4203 | if (ret < 0) |
| 4204 | bgp_clear_vty_error (vty, peer, afi, safi, ret); |
| 4205 | } |
| 4206 | if (! find) |
| 4207 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, |
| 4208 | VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4209 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4210 | } |
| 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 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 4215 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 4216 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
| 4217 | enum clear_sort sort, enum bgp_clear_type stype, |
| 4218 | const char *arg) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4219 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4220 | struct bgp *bgp; |
| 4221 | |
| 4222 | /* BGP structure lookup. */ |
| 4223 | if (name) |
| 4224 | { |
| 4225 | bgp = bgp_lookup_by_name (name); |
| 4226 | if (bgp == NULL) |
| 4227 | { |
| 4228 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); |
| 4229 | return CMD_WARNING; |
| 4230 | } |
| 4231 | } |
| 4232 | else |
| 4233 | { |
| 4234 | bgp = bgp_get_default (); |
| 4235 | if (bgp == NULL) |
| 4236 | { |
| 4237 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); |
| 4238 | return CMD_WARNING; |
| 4239 | } |
| 4240 | } |
| 4241 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 4242 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4243 | } |
| 4244 | |
| 4245 | DEFUN (clear_ip_bgp_all, |
| 4246 | clear_ip_bgp_all_cmd, |
| 4247 | "clear ip bgp *", |
| 4248 | CLEAR_STR |
| 4249 | IP_STR |
| 4250 | BGP_STR |
| 4251 | "Clear all peers\n") |
| 4252 | { |
| 4253 | if (argc == 1) |
| 4254 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4255 | |
| 4256 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
| 4257 | } |
| 4258 | |
| 4259 | ALIAS (clear_ip_bgp_all, |
| 4260 | clear_bgp_all_cmd, |
| 4261 | "clear bgp *", |
| 4262 | CLEAR_STR |
| 4263 | BGP_STR |
| 4264 | "Clear all peers\n") |
| 4265 | |
| 4266 | ALIAS (clear_ip_bgp_all, |
| 4267 | clear_bgp_ipv6_all_cmd, |
| 4268 | "clear bgp ipv6 *", |
| 4269 | CLEAR_STR |
| 4270 | BGP_STR |
| 4271 | "Address family\n" |
| 4272 | "Clear all peers\n") |
| 4273 | |
| 4274 | ALIAS (clear_ip_bgp_all, |
| 4275 | clear_ip_bgp_instance_all_cmd, |
| 4276 | "clear ip bgp view WORD *", |
| 4277 | CLEAR_STR |
| 4278 | IP_STR |
| 4279 | BGP_STR |
| 4280 | "BGP view\n" |
| 4281 | "view name\n" |
| 4282 | "Clear all peers\n") |
| 4283 | |
| 4284 | ALIAS (clear_ip_bgp_all, |
| 4285 | clear_bgp_instance_all_cmd, |
| 4286 | "clear bgp view WORD *", |
| 4287 | CLEAR_STR |
| 4288 | BGP_STR |
| 4289 | "BGP view\n" |
| 4290 | "view name\n" |
| 4291 | "Clear all peers\n") |
| 4292 | |
| 4293 | DEFUN (clear_ip_bgp_peer, |
| 4294 | clear_ip_bgp_peer_cmd, |
| 4295 | "clear ip bgp (A.B.C.D|X:X::X:X)", |
| 4296 | CLEAR_STR |
| 4297 | IP_STR |
| 4298 | BGP_STR |
| 4299 | "BGP neighbor IP address to clear\n" |
| 4300 | "BGP IPv6 neighbor to clear\n") |
| 4301 | { |
| 4302 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4303 | } |
| 4304 | |
| 4305 | ALIAS (clear_ip_bgp_peer, |
| 4306 | clear_bgp_peer_cmd, |
| 4307 | "clear bgp (A.B.C.D|X:X::X:X)", |
| 4308 | CLEAR_STR |
| 4309 | BGP_STR |
| 4310 | "BGP neighbor address to clear\n" |
| 4311 | "BGP IPv6 neighbor to clear\n") |
| 4312 | |
| 4313 | ALIAS (clear_ip_bgp_peer, |
| 4314 | clear_bgp_ipv6_peer_cmd, |
| 4315 | "clear bgp ipv6 (A.B.C.D|X:X::X:X)", |
| 4316 | CLEAR_STR |
| 4317 | BGP_STR |
| 4318 | "Address family\n" |
| 4319 | "BGP neighbor address to clear\n" |
| 4320 | "BGP IPv6 neighbor to clear\n") |
| 4321 | |
| 4322 | DEFUN (clear_ip_bgp_peer_group, |
| 4323 | clear_ip_bgp_peer_group_cmd, |
| 4324 | "clear ip bgp peer-group WORD", |
| 4325 | CLEAR_STR |
| 4326 | IP_STR |
| 4327 | BGP_STR |
| 4328 | "Clear all members of peer-group\n" |
| 4329 | "BGP peer-group name\n") |
| 4330 | { |
| 4331 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4332 | } |
| 4333 | |
| 4334 | ALIAS (clear_ip_bgp_peer_group, |
| 4335 | clear_bgp_peer_group_cmd, |
| 4336 | "clear bgp peer-group WORD", |
| 4337 | CLEAR_STR |
| 4338 | BGP_STR |
| 4339 | "Clear all members of peer-group\n" |
| 4340 | "BGP peer-group name\n") |
| 4341 | |
| 4342 | ALIAS (clear_ip_bgp_peer_group, |
| 4343 | clear_bgp_ipv6_peer_group_cmd, |
| 4344 | "clear bgp ipv6 peer-group WORD", |
| 4345 | CLEAR_STR |
| 4346 | BGP_STR |
| 4347 | "Address family\n" |
| 4348 | "Clear all members of peer-group\n" |
| 4349 | "BGP peer-group name\n") |
| 4350 | |
| 4351 | DEFUN (clear_ip_bgp_external, |
| 4352 | clear_ip_bgp_external_cmd, |
| 4353 | "clear ip bgp external", |
| 4354 | CLEAR_STR |
| 4355 | IP_STR |
| 4356 | BGP_STR |
| 4357 | "Clear all external peers\n") |
| 4358 | { |
| 4359 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
| 4360 | } |
| 4361 | |
| 4362 | ALIAS (clear_ip_bgp_external, |
| 4363 | clear_bgp_external_cmd, |
| 4364 | "clear bgp external", |
| 4365 | CLEAR_STR |
| 4366 | BGP_STR |
| 4367 | "Clear all external peers\n") |
| 4368 | |
| 4369 | ALIAS (clear_ip_bgp_external, |
| 4370 | clear_bgp_ipv6_external_cmd, |
| 4371 | "clear bgp ipv6 external", |
| 4372 | CLEAR_STR |
| 4373 | BGP_STR |
| 4374 | "Address family\n" |
| 4375 | "Clear all external peers\n") |
| 4376 | |
| 4377 | DEFUN (clear_ip_bgp_as, |
| 4378 | clear_ip_bgp_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4379 | "clear ip bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4380 | CLEAR_STR |
| 4381 | IP_STR |
| 4382 | BGP_STR |
| 4383 | "Clear peers with the AS number\n") |
| 4384 | { |
| 4385 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); |
| 4386 | } |
| 4387 | |
| 4388 | ALIAS (clear_ip_bgp_as, |
| 4389 | clear_bgp_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4390 | "clear bgp " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4391 | CLEAR_STR |
| 4392 | BGP_STR |
| 4393 | "Clear peers with the AS number\n") |
| 4394 | |
| 4395 | ALIAS (clear_ip_bgp_as, |
| 4396 | clear_bgp_ipv6_as_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4397 | "clear bgp ipv6 " CMD_AS_RANGE, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4398 | CLEAR_STR |
| 4399 | BGP_STR |
| 4400 | "Address family\n" |
| 4401 | "Clear peers with the AS number\n") |
| 4402 | |
| 4403 | /* Outbound soft-reconfiguration */ |
| 4404 | DEFUN (clear_ip_bgp_all_soft_out, |
| 4405 | clear_ip_bgp_all_soft_out_cmd, |
| 4406 | "clear ip bgp * soft out", |
| 4407 | CLEAR_STR |
| 4408 | IP_STR |
| 4409 | BGP_STR |
| 4410 | "Clear all peers\n" |
| 4411 | "Soft reconfig\n" |
| 4412 | "Soft reconfig outbound update\n") |
| 4413 | { |
| 4414 | if (argc == 1) |
| 4415 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4416 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4417 | |
| 4418 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4419 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4420 | } |
| 4421 | |
| 4422 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4423 | clear_ip_bgp_all_out_cmd, |
| 4424 | "clear ip bgp * out", |
| 4425 | CLEAR_STR |
| 4426 | IP_STR |
| 4427 | BGP_STR |
| 4428 | "Clear all peers\n" |
| 4429 | "Soft reconfig outbound update\n") |
| 4430 | |
| 4431 | ALIAS (clear_ip_bgp_all_soft_out, |
| 4432 | clear_ip_bgp_instance_all_soft_out_cmd, |
| 4433 | "clear ip bgp view WORD * soft out", |
| 4434 | CLEAR_STR |
| 4435 | IP_STR |
| 4436 | BGP_STR |
| 4437 | "BGP view\n" |
| 4438 | "view name\n" |
| 4439 | "Clear all peers\n" |
| 4440 | "Soft reconfig\n" |
| 4441 | "Soft reconfig outbound update\n") |
| 4442 | |
| 4443 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, |
| 4444 | clear_ip_bgp_all_ipv4_soft_out_cmd, |
| 4445 | "clear ip bgp * ipv4 (unicast|multicast) soft out", |
| 4446 | CLEAR_STR |
| 4447 | IP_STR |
| 4448 | BGP_STR |
| 4449 | "Clear all peers\n" |
| 4450 | "Address family\n" |
| 4451 | "Address Family modifier\n" |
| 4452 | "Address Family modifier\n" |
| 4453 | "Soft reconfig\n" |
| 4454 | "Soft reconfig outbound update\n") |
| 4455 | { |
| 4456 | if (strncmp (argv[0], "m", 1) == 0) |
| 4457 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 4458 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4459 | |
| 4460 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 4461 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4462 | } |
| 4463 | |
| 4464 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, |
| 4465 | clear_ip_bgp_all_ipv4_out_cmd, |
| 4466 | "clear ip bgp * ipv4 (unicast|multicast) out", |
| 4467 | CLEAR_STR |
| 4468 | IP_STR |
| 4469 | BGP_STR |
| 4470 | "Clear all peers\n" |
| 4471 | "Address family\n" |
| 4472 | "Address Family modifier\n" |
| 4473 | "Address Family modifier\n" |
| 4474 | "Soft reconfig outbound update\n") |
| 4475 | |
| 4476 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
| 4477 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, |
| 4478 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", |
| 4479 | CLEAR_STR |
| 4480 | IP_STR |
| 4481 | BGP_STR |
| 4482 | "BGP view\n" |
| 4483 | "view name\n" |
| 4484 | "Clear all peers\n" |
| 4485 | "Address family\n" |
| 4486 | "Address Family modifier\n" |
| 4487 | "Address Family modifier\n" |
| 4488 | "Soft reconfig outbound update\n") |
| 4489 | { |
| 4490 | if (strncmp (argv[1], "m", 1) == 0) |
| 4491 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 4492 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4493 | |
| 4494 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 4495 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4496 | } |
| 4497 | |
| 4498 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, |
| 4499 | clear_ip_bgp_all_vpnv4_soft_out_cmd, |
| 4500 | "clear ip bgp * vpnv4 unicast soft out", |
| 4501 | CLEAR_STR |
| 4502 | IP_STR |
| 4503 | BGP_STR |
| 4504 | "Clear all peers\n" |
| 4505 | "Address family\n" |
| 4506 | "Address Family Modifier\n" |
| 4507 | "Soft reconfig\n" |
| 4508 | "Soft reconfig outbound update\n") |
| 4509 | { |
| 4510 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 4511 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4512 | } |
| 4513 | |
| 4514 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, |
| 4515 | clear_ip_bgp_all_vpnv4_out_cmd, |
| 4516 | "clear ip bgp * vpnv4 unicast out", |
| 4517 | CLEAR_STR |
| 4518 | IP_STR |
| 4519 | BGP_STR |
| 4520 | "Clear all peers\n" |
| 4521 | "Address family\n" |
| 4522 | "Address Family Modifier\n" |
| 4523 | "Soft reconfig outbound update\n") |
| 4524 | |
| 4525 | DEFUN (clear_bgp_all_soft_out, |
| 4526 | clear_bgp_all_soft_out_cmd, |
| 4527 | "clear bgp * soft out", |
| 4528 | CLEAR_STR |
| 4529 | BGP_STR |
| 4530 | "Clear all peers\n" |
| 4531 | "Soft reconfig\n" |
| 4532 | "Soft reconfig outbound update\n") |
| 4533 | { |
| 4534 | if (argc == 1) |
| 4535 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 4536 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4537 | |
| 4538 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 4539 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4540 | } |
| 4541 | |
| 4542 | ALIAS (clear_bgp_all_soft_out, |
| 4543 | clear_bgp_instance_all_soft_out_cmd, |
| 4544 | "clear bgp view WORD * soft out", |
| 4545 | CLEAR_STR |
| 4546 | BGP_STR |
| 4547 | "BGP view\n" |
| 4548 | "view name\n" |
| 4549 | "Clear all peers\n" |
| 4550 | "Soft reconfig\n" |
| 4551 | "Soft reconfig outbound update\n") |
| 4552 | |
| 4553 | ALIAS (clear_bgp_all_soft_out, |
| 4554 | clear_bgp_all_out_cmd, |
| 4555 | "clear bgp * out", |
| 4556 | CLEAR_STR |
| 4557 | BGP_STR |
| 4558 | "Clear all peers\n" |
| 4559 | "Soft reconfig outbound update\n") |
| 4560 | |
| 4561 | ALIAS (clear_bgp_all_soft_out, |
| 4562 | clear_bgp_ipv6_all_soft_out_cmd, |
| 4563 | "clear bgp ipv6 * soft out", |
| 4564 | CLEAR_STR |
| 4565 | BGP_STR |
| 4566 | "Address family\n" |
| 4567 | "Clear all peers\n" |
| 4568 | "Soft reconfig\n" |
| 4569 | "Soft reconfig outbound update\n") |
| 4570 | |
| 4571 | ALIAS (clear_bgp_all_soft_out, |
| 4572 | clear_bgp_ipv6_all_out_cmd, |
| 4573 | "clear bgp ipv6 * out", |
| 4574 | CLEAR_STR |
| 4575 | BGP_STR |
| 4576 | "Address family\n" |
| 4577 | "Clear all peers\n" |
| 4578 | "Soft reconfig outbound update\n") |
| 4579 | |
| 4580 | DEFUN (clear_ip_bgp_peer_soft_out, |
| 4581 | clear_ip_bgp_peer_soft_out_cmd, |
| 4582 | "clear ip bgp A.B.C.D soft out", |
| 4583 | CLEAR_STR |
| 4584 | IP_STR |
| 4585 | BGP_STR |
| 4586 | "BGP neighbor address to clear\n" |
| 4587 | "Soft reconfig\n" |
| 4588 | "Soft reconfig outbound update\n") |
| 4589 | { |
| 4590 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 4591 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4592 | } |
| 4593 | |
| 4594 | ALIAS (clear_ip_bgp_peer_soft_out, |
| 4595 | clear_ip_bgp_peer_out_cmd, |
| 4596 | "clear ip bgp A.B.C.D out", |
| 4597 | CLEAR_STR |
| 4598 | IP_STR |
| 4599 | BGP_STR |
| 4600 | "BGP neighbor address to clear\n" |
| 4601 | "Soft reconfig outbound update\n") |
| 4602 | |
| 4603 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
| 4604 | clear_ip_bgp_peer_ipv4_soft_out_cmd, |
| 4605 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", |
| 4606 | CLEAR_STR |
| 4607 | IP_STR |
| 4608 | BGP_STR |
| 4609 | "BGP neighbor address to clear\n" |
| 4610 | "Address family\n" |
| 4611 | "Address Family modifier\n" |
| 4612 | "Address Family modifier\n" |
| 4613 | "Soft reconfig\n" |
| 4614 | "Soft reconfig outbound update\n") |
| 4615 | { |
| 4616 | if (strncmp (argv[1], "m", 1) == 0) |
| 4617 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 4618 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 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_ipv4_soft_out, |
| 4625 | clear_ip_bgp_peer_ipv4_out_cmd, |
| 4626 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", |
| 4627 | CLEAR_STR |
| 4628 | IP_STR |
| 4629 | BGP_STR |
| 4630 | "BGP neighbor address to clear\n" |
| 4631 | "Address family\n" |
| 4632 | "Address Family modifier\n" |
| 4633 | "Address Family modifier\n" |
| 4634 | "Soft reconfig outbound update\n") |
| 4635 | |
| 4636 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4637 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, |
| 4638 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", |
| 4639 | CLEAR_STR |
| 4640 | IP_STR |
| 4641 | BGP_STR |
| 4642 | "BGP neighbor address to clear\n" |
| 4643 | "Address family\n" |
| 4644 | "Address Family Modifier\n" |
| 4645 | "Soft reconfig\n" |
| 4646 | "Soft reconfig outbound update\n") |
| 4647 | { |
| 4648 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 4649 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4650 | } |
| 4651 | |
| 4652 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, |
| 4653 | clear_ip_bgp_peer_vpnv4_out_cmd, |
| 4654 | "clear ip bgp A.B.C.D vpnv4 unicast out", |
| 4655 | CLEAR_STR |
| 4656 | IP_STR |
| 4657 | BGP_STR |
| 4658 | "BGP neighbor address to clear\n" |
| 4659 | "Address family\n" |
| 4660 | "Address Family Modifier\n" |
| 4661 | "Soft reconfig outbound update\n") |
| 4662 | |
| 4663 | DEFUN (clear_bgp_peer_soft_out, |
| 4664 | clear_bgp_peer_soft_out_cmd, |
| 4665 | "clear bgp (A.B.C.D|X:X::X:X) soft out", |
| 4666 | CLEAR_STR |
| 4667 | BGP_STR |
| 4668 | "BGP neighbor address to clear\n" |
| 4669 | "BGP IPv6 neighbor to clear\n" |
| 4670 | "Soft reconfig\n" |
| 4671 | "Soft reconfig outbound update\n") |
| 4672 | { |
| 4673 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 4674 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4675 | } |
| 4676 | |
| 4677 | ALIAS (clear_bgp_peer_soft_out, |
| 4678 | clear_bgp_ipv6_peer_soft_out_cmd, |
| 4679 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out", |
| 4680 | CLEAR_STR |
| 4681 | BGP_STR |
| 4682 | "Address family\n" |
| 4683 | "BGP neighbor address to clear\n" |
| 4684 | "BGP IPv6 neighbor to clear\n" |
| 4685 | "Soft reconfig\n" |
| 4686 | "Soft reconfig outbound update\n") |
| 4687 | |
| 4688 | ALIAS (clear_bgp_peer_soft_out, |
| 4689 | clear_bgp_peer_out_cmd, |
| 4690 | "clear bgp (A.B.C.D|X:X::X:X) out", |
| 4691 | CLEAR_STR |
| 4692 | BGP_STR |
| 4693 | "BGP neighbor address to clear\n" |
| 4694 | "BGP IPv6 neighbor to clear\n" |
| 4695 | "Soft reconfig outbound update\n") |
| 4696 | |
| 4697 | ALIAS (clear_bgp_peer_soft_out, |
| 4698 | clear_bgp_ipv6_peer_out_cmd, |
| 4699 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) out", |
| 4700 | CLEAR_STR |
| 4701 | BGP_STR |
| 4702 | "Address family\n" |
| 4703 | "BGP neighbor address to clear\n" |
| 4704 | "BGP IPv6 neighbor to clear\n" |
| 4705 | "Soft reconfig outbound update\n") |
| 4706 | |
| 4707 | DEFUN (clear_ip_bgp_peer_group_soft_out, |
| 4708 | clear_ip_bgp_peer_group_soft_out_cmd, |
| 4709 | "clear ip bgp peer-group WORD soft out", |
| 4710 | CLEAR_STR |
| 4711 | IP_STR |
| 4712 | BGP_STR |
| 4713 | "Clear all members of peer-group\n" |
| 4714 | "BGP peer-group name\n" |
| 4715 | "Soft reconfig\n" |
| 4716 | "Soft reconfig outbound update\n") |
| 4717 | { |
| 4718 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4719 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4720 | } |
| 4721 | |
| 4722 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
| 4723 | clear_ip_bgp_peer_group_out_cmd, |
| 4724 | "clear ip bgp peer-group WORD out", |
| 4725 | CLEAR_STR |
| 4726 | IP_STR |
| 4727 | BGP_STR |
| 4728 | "Clear all members of peer-group\n" |
| 4729 | "BGP peer-group name\n" |
| 4730 | "Soft reconfig outbound update\n") |
| 4731 | |
| 4732 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4733 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, |
| 4734 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", |
| 4735 | CLEAR_STR |
| 4736 | IP_STR |
| 4737 | BGP_STR |
| 4738 | "Clear all members of peer-group\n" |
| 4739 | "BGP peer-group name\n" |
| 4740 | "Address family\n" |
| 4741 | "Address Family modifier\n" |
| 4742 | "Address Family modifier\n" |
| 4743 | "Soft reconfig\n" |
| 4744 | "Soft reconfig outbound update\n") |
| 4745 | { |
| 4746 | if (strncmp (argv[1], "m", 1) == 0) |
| 4747 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 4748 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4749 | |
| 4750 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 4751 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4752 | } |
| 4753 | |
| 4754 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, |
| 4755 | clear_ip_bgp_peer_group_ipv4_out_cmd, |
| 4756 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", |
| 4757 | CLEAR_STR |
| 4758 | IP_STR |
| 4759 | BGP_STR |
| 4760 | "Clear all members of peer-group\n" |
| 4761 | "BGP peer-group name\n" |
| 4762 | "Address family\n" |
| 4763 | "Address Family modifier\n" |
| 4764 | "Address Family modifier\n" |
| 4765 | "Soft reconfig outbound update\n") |
| 4766 | |
| 4767 | DEFUN (clear_bgp_peer_group_soft_out, |
| 4768 | clear_bgp_peer_group_soft_out_cmd, |
| 4769 | "clear bgp peer-group WORD soft out", |
| 4770 | CLEAR_STR |
| 4771 | BGP_STR |
| 4772 | "Clear all members of peer-group\n" |
| 4773 | "BGP peer-group name\n" |
| 4774 | "Soft reconfig\n" |
| 4775 | "Soft reconfig outbound update\n") |
| 4776 | { |
| 4777 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 4778 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4779 | } |
| 4780 | |
| 4781 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4782 | clear_bgp_ipv6_peer_group_soft_out_cmd, |
| 4783 | "clear bgp ipv6 peer-group WORD soft out", |
| 4784 | CLEAR_STR |
| 4785 | BGP_STR |
| 4786 | "Address family\n" |
| 4787 | "Clear all members of peer-group\n" |
| 4788 | "BGP peer-group name\n" |
| 4789 | "Soft reconfig\n" |
| 4790 | "Soft reconfig outbound update\n") |
| 4791 | |
| 4792 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4793 | clear_bgp_peer_group_out_cmd, |
| 4794 | "clear bgp peer-group WORD out", |
| 4795 | CLEAR_STR |
| 4796 | BGP_STR |
| 4797 | "Clear all members of peer-group\n" |
| 4798 | "BGP peer-group name\n" |
| 4799 | "Soft reconfig outbound update\n") |
| 4800 | |
| 4801 | ALIAS (clear_bgp_peer_group_soft_out, |
| 4802 | clear_bgp_ipv6_peer_group_out_cmd, |
| 4803 | "clear bgp ipv6 peer-group WORD out", |
| 4804 | CLEAR_STR |
| 4805 | BGP_STR |
| 4806 | "Address family\n" |
| 4807 | "Clear all members of peer-group\n" |
| 4808 | "BGP peer-group name\n" |
| 4809 | "Soft reconfig outbound update\n") |
| 4810 | |
| 4811 | DEFUN (clear_ip_bgp_external_soft_out, |
| 4812 | clear_ip_bgp_external_soft_out_cmd, |
| 4813 | "clear ip bgp external soft out", |
| 4814 | CLEAR_STR |
| 4815 | IP_STR |
| 4816 | BGP_STR |
| 4817 | "Clear all external peers\n" |
| 4818 | "Soft reconfig\n" |
| 4819 | "Soft reconfig outbound update\n") |
| 4820 | { |
| 4821 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 4822 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4823 | } |
| 4824 | |
| 4825 | ALIAS (clear_ip_bgp_external_soft_out, |
| 4826 | clear_ip_bgp_external_out_cmd, |
| 4827 | "clear ip bgp external out", |
| 4828 | CLEAR_STR |
| 4829 | IP_STR |
| 4830 | BGP_STR |
| 4831 | "Clear all external peers\n" |
| 4832 | "Soft reconfig outbound update\n") |
| 4833 | |
| 4834 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, |
| 4835 | clear_ip_bgp_external_ipv4_soft_out_cmd, |
| 4836 | "clear ip bgp external ipv4 (unicast|multicast) soft out", |
| 4837 | CLEAR_STR |
| 4838 | IP_STR |
| 4839 | BGP_STR |
| 4840 | "Clear all external peers\n" |
| 4841 | "Address family\n" |
| 4842 | "Address Family modifier\n" |
| 4843 | "Address Family modifier\n" |
| 4844 | "Soft reconfig\n" |
| 4845 | "Soft reconfig outbound update\n") |
| 4846 | { |
| 4847 | if (strncmp (argv[0], "m", 1) == 0) |
| 4848 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 4849 | BGP_CLEAR_SOFT_OUT, NULL); |
| 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_ipv4_soft_out, |
| 4856 | clear_ip_bgp_external_ipv4_out_cmd, |
| 4857 | "clear ip bgp external ipv4 (unicast|multicast) out", |
| 4858 | CLEAR_STR |
| 4859 | IP_STR |
| 4860 | BGP_STR |
| 4861 | "Clear all external peers\n" |
| 4862 | "Address family\n" |
| 4863 | "Address Family modifier\n" |
| 4864 | "Address Family modifier\n" |
| 4865 | "Soft reconfig outbound update\n") |
| 4866 | |
| 4867 | DEFUN (clear_bgp_external_soft_out, |
| 4868 | clear_bgp_external_soft_out_cmd, |
| 4869 | "clear bgp external soft out", |
| 4870 | CLEAR_STR |
| 4871 | BGP_STR |
| 4872 | "Clear all external peers\n" |
| 4873 | "Soft reconfig\n" |
| 4874 | "Soft reconfig outbound update\n") |
| 4875 | { |
| 4876 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 4877 | BGP_CLEAR_SOFT_OUT, NULL); |
| 4878 | } |
| 4879 | |
| 4880 | ALIAS (clear_bgp_external_soft_out, |
| 4881 | clear_bgp_ipv6_external_soft_out_cmd, |
| 4882 | "clear bgp ipv6 external soft out", |
| 4883 | CLEAR_STR |
| 4884 | BGP_STR |
| 4885 | "Address family\n" |
| 4886 | "Clear all external peers\n" |
| 4887 | "Soft reconfig\n" |
| 4888 | "Soft reconfig outbound update\n") |
| 4889 | |
| 4890 | ALIAS (clear_bgp_external_soft_out, |
| 4891 | clear_bgp_external_out_cmd, |
| 4892 | "clear bgp external out", |
| 4893 | CLEAR_STR |
| 4894 | BGP_STR |
| 4895 | "Clear all external peers\n" |
| 4896 | "Soft reconfig outbound update\n") |
| 4897 | |
| 4898 | ALIAS (clear_bgp_external_soft_out, |
| 4899 | clear_bgp_ipv6_external_out_cmd, |
| 4900 | "clear bgp ipv6 external WORD out", |
| 4901 | CLEAR_STR |
| 4902 | BGP_STR |
| 4903 | "Address family\n" |
| 4904 | "Clear all external peers\n" |
| 4905 | "Soft reconfig outbound update\n") |
| 4906 | |
| 4907 | DEFUN (clear_ip_bgp_as_soft_out, |
| 4908 | clear_ip_bgp_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4909 | "clear ip bgp " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4910 | CLEAR_STR |
| 4911 | IP_STR |
| 4912 | BGP_STR |
| 4913 | "Clear peers with the AS number\n" |
| 4914 | "Soft reconfig\n" |
| 4915 | "Soft reconfig outbound update\n") |
| 4916 | { |
| 4917 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 4918 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4919 | } |
| 4920 | |
| 4921 | ALIAS (clear_ip_bgp_as_soft_out, |
| 4922 | clear_ip_bgp_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4923 | "clear ip bgp " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4924 | CLEAR_STR |
| 4925 | IP_STR |
| 4926 | BGP_STR |
| 4927 | "Clear peers with the AS number\n" |
| 4928 | "Soft reconfig outbound update\n") |
| 4929 | |
| 4930 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
| 4931 | clear_ip_bgp_as_ipv4_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4932 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4933 | CLEAR_STR |
| 4934 | IP_STR |
| 4935 | BGP_STR |
| 4936 | "Clear peers with the AS number\n" |
| 4937 | "Address family\n" |
| 4938 | "Address Family modifier\n" |
| 4939 | "Address Family modifier\n" |
| 4940 | "Soft reconfig\n" |
| 4941 | "Soft reconfig outbound update\n") |
| 4942 | { |
| 4943 | if (strncmp (argv[1], "m", 1) == 0) |
| 4944 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 4945 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 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_ipv4_soft_out, |
| 4952 | clear_ip_bgp_as_ipv4_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4953 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) 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 | "Address family\n" |
| 4959 | "Address Family modifier\n" |
| 4960 | "Address Family modifier\n" |
| 4961 | "Soft reconfig outbound update\n") |
| 4962 | |
| 4963 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
| 4964 | clear_ip_bgp_as_vpnv4_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4965 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4966 | CLEAR_STR |
| 4967 | IP_STR |
| 4968 | BGP_STR |
| 4969 | "Clear peers with the AS number\n" |
| 4970 | "Address family\n" |
| 4971 | "Address Family modifier\n" |
| 4972 | "Soft reconfig\n" |
| 4973 | "Soft reconfig outbound update\n") |
| 4974 | { |
| 4975 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 4976 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 4977 | } |
| 4978 | |
| 4979 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, |
| 4980 | clear_ip_bgp_as_vpnv4_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4981 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4982 | CLEAR_STR |
| 4983 | IP_STR |
| 4984 | BGP_STR |
| 4985 | "Clear peers with the AS number\n" |
| 4986 | "Address family\n" |
| 4987 | "Address Family modifier\n" |
| 4988 | "Soft reconfig outbound update\n") |
| 4989 | |
| 4990 | DEFUN (clear_bgp_as_soft_out, |
| 4991 | clear_bgp_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 4992 | "clear bgp " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4993 | CLEAR_STR |
| 4994 | BGP_STR |
| 4995 | "Clear peers with the AS number\n" |
| 4996 | "Soft reconfig\n" |
| 4997 | "Soft reconfig outbound update\n") |
| 4998 | { |
| 4999 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5000 | BGP_CLEAR_SOFT_OUT, argv[0]); |
| 5001 | } |
| 5002 | |
| 5003 | ALIAS (clear_bgp_as_soft_out, |
| 5004 | clear_bgp_ipv6_as_soft_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5005 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5006 | CLEAR_STR |
| 5007 | BGP_STR |
| 5008 | "Address family\n" |
| 5009 | "Clear peers with the AS number\n" |
| 5010 | "Soft reconfig\n" |
| 5011 | "Soft reconfig outbound update\n") |
| 5012 | |
| 5013 | ALIAS (clear_bgp_as_soft_out, |
| 5014 | clear_bgp_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5015 | "clear bgp " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5016 | CLEAR_STR |
| 5017 | BGP_STR |
| 5018 | "Clear peers with the AS number\n" |
| 5019 | "Soft reconfig outbound update\n") |
| 5020 | |
| 5021 | ALIAS (clear_bgp_as_soft_out, |
| 5022 | clear_bgp_ipv6_as_out_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5023 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5024 | CLEAR_STR |
| 5025 | BGP_STR |
| 5026 | "Address family\n" |
| 5027 | "Clear peers with the AS number\n" |
| 5028 | "Soft reconfig outbound update\n") |
| 5029 | |
| 5030 | /* Inbound soft-reconfiguration */ |
| 5031 | DEFUN (clear_ip_bgp_all_soft_in, |
| 5032 | clear_ip_bgp_all_soft_in_cmd, |
| 5033 | "clear ip bgp * soft in", |
| 5034 | CLEAR_STR |
| 5035 | IP_STR |
| 5036 | BGP_STR |
| 5037 | "Clear all peers\n" |
| 5038 | "Soft reconfig\n" |
| 5039 | "Soft reconfig inbound update\n") |
| 5040 | { |
| 5041 | if (argc == 1) |
| 5042 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5043 | BGP_CLEAR_SOFT_IN, NULL); |
| 5044 | |
| 5045 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5046 | BGP_CLEAR_SOFT_IN, NULL); |
| 5047 | } |
| 5048 | |
| 5049 | ALIAS (clear_ip_bgp_all_soft_in, |
| 5050 | clear_ip_bgp_instance_all_soft_in_cmd, |
| 5051 | "clear ip bgp view WORD * soft in", |
| 5052 | CLEAR_STR |
| 5053 | IP_STR |
| 5054 | BGP_STR |
| 5055 | "BGP view\n" |
| 5056 | "view name\n" |
| 5057 | "Clear all peers\n" |
| 5058 | "Soft reconfig\n" |
| 5059 | "Soft reconfig inbound update\n") |
| 5060 | |
| 5061 | ALIAS (clear_ip_bgp_all_soft_in, |
| 5062 | clear_ip_bgp_all_in_cmd, |
| 5063 | "clear ip bgp * in", |
| 5064 | CLEAR_STR |
| 5065 | IP_STR |
| 5066 | BGP_STR |
| 5067 | "Clear all peers\n" |
| 5068 | "Soft reconfig inbound update\n") |
| 5069 | |
| 5070 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
| 5071 | clear_ip_bgp_all_in_prefix_filter_cmd, |
| 5072 | "clear ip bgp * in prefix-filter", |
| 5073 | CLEAR_STR |
| 5074 | IP_STR |
| 5075 | BGP_STR |
| 5076 | "Clear all peers\n" |
| 5077 | "Soft reconfig inbound update\n" |
| 5078 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5079 | { |
| 5080 | if (argc== 1) |
| 5081 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5082 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5083 | |
| 5084 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5085 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5086 | } |
| 5087 | |
| 5088 | ALIAS (clear_ip_bgp_all_in_prefix_filter, |
| 5089 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, |
| 5090 | "clear ip bgp view WORD * in prefix-filter", |
| 5091 | CLEAR_STR |
| 5092 | IP_STR |
| 5093 | BGP_STR |
| 5094 | "BGP view\n" |
| 5095 | "view name\n" |
| 5096 | "Clear all peers\n" |
| 5097 | "Soft reconfig inbound update\n" |
| 5098 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5099 | |
| 5100 | |
| 5101 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
| 5102 | clear_ip_bgp_all_ipv4_soft_in_cmd, |
| 5103 | "clear ip bgp * ipv4 (unicast|multicast) soft in", |
| 5104 | CLEAR_STR |
| 5105 | IP_STR |
| 5106 | BGP_STR |
| 5107 | "Clear all peers\n" |
| 5108 | "Address family\n" |
| 5109 | "Address Family modifier\n" |
| 5110 | "Address Family modifier\n" |
| 5111 | "Soft reconfig\n" |
| 5112 | "Soft reconfig inbound update\n") |
| 5113 | { |
| 5114 | if (strncmp (argv[0], "m", 1) == 0) |
| 5115 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5116 | BGP_CLEAR_SOFT_IN, NULL); |
| 5117 | |
| 5118 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5119 | BGP_CLEAR_SOFT_IN, NULL); |
| 5120 | } |
| 5121 | |
| 5122 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, |
| 5123 | clear_ip_bgp_all_ipv4_in_cmd, |
| 5124 | "clear ip bgp * ipv4 (unicast|multicast) in", |
| 5125 | CLEAR_STR |
| 5126 | IP_STR |
| 5127 | BGP_STR |
| 5128 | "Clear all peers\n" |
| 5129 | "Address family\n" |
| 5130 | "Address Family modifier\n" |
| 5131 | "Address Family modifier\n" |
| 5132 | "Soft reconfig inbound update\n") |
| 5133 | |
| 5134 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
| 5135 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, |
| 5136 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", |
| 5137 | CLEAR_STR |
| 5138 | IP_STR |
| 5139 | BGP_STR |
| 5140 | "BGP view\n" |
| 5141 | "view name\n" |
| 5142 | "Clear all peers\n" |
| 5143 | "Address family\n" |
| 5144 | "Address Family modifier\n" |
| 5145 | "Address Family modifier\n" |
| 5146 | "Soft reconfig\n" |
| 5147 | "Soft reconfig inbound update\n") |
| 5148 | { |
| 5149 | if (strncmp (argv[1], "m", 1) == 0) |
| 5150 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5151 | BGP_CLEAR_SOFT_IN, NULL); |
| 5152 | |
| 5153 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5154 | BGP_CLEAR_SOFT_IN, NULL); |
| 5155 | } |
| 5156 | |
| 5157 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
| 5158 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, |
| 5159 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", |
| 5160 | CLEAR_STR |
| 5161 | IP_STR |
| 5162 | BGP_STR |
| 5163 | "Clear all peers\n" |
| 5164 | "Address family\n" |
| 5165 | "Address Family modifier\n" |
| 5166 | "Address Family modifier\n" |
| 5167 | "Soft reconfig inbound update\n" |
| 5168 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5169 | { |
| 5170 | if (strncmp (argv[0], "m", 1) == 0) |
| 5171 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 5172 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5173 | |
| 5174 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 5175 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5176 | } |
| 5177 | |
| 5178 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, |
| 5179 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, |
| 5180 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", |
| 5181 | CLEAR_STR |
| 5182 | IP_STR |
| 5183 | BGP_STR |
| 5184 | "Clear all peers\n" |
| 5185 | "Address family\n" |
| 5186 | "Address Family modifier\n" |
| 5187 | "Address Family modifier\n" |
| 5188 | "Soft reconfig inbound update\n" |
| 5189 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5190 | { |
| 5191 | if (strncmp (argv[1], "m", 1) == 0) |
| 5192 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, |
| 5193 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5194 | |
| 5195 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 5196 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5197 | } |
| 5198 | |
| 5199 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, |
| 5200 | clear_ip_bgp_all_vpnv4_soft_in_cmd, |
| 5201 | "clear ip bgp * vpnv4 unicast soft in", |
| 5202 | CLEAR_STR |
| 5203 | IP_STR |
| 5204 | BGP_STR |
| 5205 | "Clear all peers\n" |
| 5206 | "Address family\n" |
| 5207 | "Address Family Modifier\n" |
| 5208 | "Soft reconfig\n" |
| 5209 | "Soft reconfig inbound update\n") |
| 5210 | { |
| 5211 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 5212 | BGP_CLEAR_SOFT_IN, NULL); |
| 5213 | } |
| 5214 | |
| 5215 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, |
| 5216 | clear_ip_bgp_all_vpnv4_in_cmd, |
| 5217 | "clear ip bgp * vpnv4 unicast in", |
| 5218 | CLEAR_STR |
| 5219 | IP_STR |
| 5220 | BGP_STR |
| 5221 | "Clear all peers\n" |
| 5222 | "Address family\n" |
| 5223 | "Address Family Modifier\n" |
| 5224 | "Soft reconfig inbound update\n") |
| 5225 | |
| 5226 | DEFUN (clear_bgp_all_soft_in, |
| 5227 | clear_bgp_all_soft_in_cmd, |
| 5228 | "clear bgp * soft in", |
| 5229 | CLEAR_STR |
| 5230 | BGP_STR |
| 5231 | "Clear all peers\n" |
| 5232 | "Soft reconfig\n" |
| 5233 | "Soft reconfig inbound update\n") |
| 5234 | { |
| 5235 | if (argc == 1) |
| 5236 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 5237 | BGP_CLEAR_SOFT_IN, NULL); |
| 5238 | |
| 5239 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5240 | BGP_CLEAR_SOFT_IN, NULL); |
| 5241 | } |
| 5242 | |
| 5243 | ALIAS (clear_bgp_all_soft_in, |
| 5244 | clear_bgp_instance_all_soft_in_cmd, |
| 5245 | "clear bgp view WORD * soft in", |
| 5246 | CLEAR_STR |
| 5247 | BGP_STR |
| 5248 | "BGP view\n" |
| 5249 | "view name\n" |
| 5250 | "Clear all peers\n" |
| 5251 | "Soft reconfig\n" |
| 5252 | "Soft reconfig inbound update\n") |
| 5253 | |
| 5254 | ALIAS (clear_bgp_all_soft_in, |
| 5255 | clear_bgp_ipv6_all_soft_in_cmd, |
| 5256 | "clear bgp ipv6 * soft in", |
| 5257 | CLEAR_STR |
| 5258 | BGP_STR |
| 5259 | "Address family\n" |
| 5260 | "Clear all peers\n" |
| 5261 | "Soft reconfig\n" |
| 5262 | "Soft reconfig inbound update\n") |
| 5263 | |
| 5264 | ALIAS (clear_bgp_all_soft_in, |
| 5265 | clear_bgp_all_in_cmd, |
| 5266 | "clear bgp * in", |
| 5267 | CLEAR_STR |
| 5268 | BGP_STR |
| 5269 | "Clear all peers\n" |
| 5270 | "Soft reconfig inbound update\n") |
| 5271 | |
| 5272 | ALIAS (clear_bgp_all_soft_in, |
| 5273 | clear_bgp_ipv6_all_in_cmd, |
| 5274 | "clear bgp ipv6 * in", |
| 5275 | CLEAR_STR |
| 5276 | BGP_STR |
| 5277 | "Address family\n" |
| 5278 | "Clear all peers\n" |
| 5279 | "Soft reconfig inbound update\n") |
| 5280 | |
| 5281 | DEFUN (clear_bgp_all_in_prefix_filter, |
| 5282 | clear_bgp_all_in_prefix_filter_cmd, |
| 5283 | "clear bgp * in prefix-filter", |
| 5284 | CLEAR_STR |
| 5285 | BGP_STR |
| 5286 | "Clear all peers\n" |
| 5287 | "Soft reconfig inbound update\n" |
| 5288 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5289 | { |
| 5290 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 5291 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5292 | } |
| 5293 | |
| 5294 | ALIAS (clear_bgp_all_in_prefix_filter, |
| 5295 | clear_bgp_ipv6_all_in_prefix_filter_cmd, |
| 5296 | "clear bgp ipv6 * in prefix-filter", |
| 5297 | CLEAR_STR |
| 5298 | BGP_STR |
| 5299 | "Address family\n" |
| 5300 | "Clear all peers\n" |
| 5301 | "Soft reconfig inbound update\n" |
| 5302 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5303 | |
| 5304 | DEFUN (clear_ip_bgp_peer_soft_in, |
| 5305 | clear_ip_bgp_peer_soft_in_cmd, |
| 5306 | "clear ip bgp A.B.C.D soft in", |
| 5307 | CLEAR_STR |
| 5308 | IP_STR |
| 5309 | BGP_STR |
| 5310 | "BGP neighbor address to clear\n" |
| 5311 | "Soft reconfig\n" |
| 5312 | "Soft reconfig inbound update\n") |
| 5313 | { |
| 5314 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5315 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5316 | } |
| 5317 | |
| 5318 | ALIAS (clear_ip_bgp_peer_soft_in, |
| 5319 | clear_ip_bgp_peer_in_cmd, |
| 5320 | "clear ip bgp A.B.C.D in", |
| 5321 | CLEAR_STR |
| 5322 | IP_STR |
| 5323 | BGP_STR |
| 5324 | "BGP neighbor address to clear\n" |
| 5325 | "Soft reconfig inbound update\n") |
| 5326 | |
| 5327 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
| 5328 | clear_ip_bgp_peer_in_prefix_filter_cmd, |
| 5329 | "clear ip bgp A.B.C.D in prefix-filter", |
| 5330 | CLEAR_STR |
| 5331 | IP_STR |
| 5332 | BGP_STR |
| 5333 | "BGP neighbor address to clear\n" |
| 5334 | "Soft reconfig inbound update\n" |
| 5335 | "Push out the existing ORF prefix-list\n") |
| 5336 | { |
| 5337 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5338 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5339 | } |
| 5340 | |
| 5341 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, |
| 5342 | clear_ip_bgp_peer_ipv4_soft_in_cmd, |
| 5343 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", |
| 5344 | CLEAR_STR |
| 5345 | IP_STR |
| 5346 | BGP_STR |
| 5347 | "BGP neighbor address to clear\n" |
| 5348 | "Address family\n" |
| 5349 | "Address Family modifier\n" |
| 5350 | "Address Family modifier\n" |
| 5351 | "Soft reconfig\n" |
| 5352 | "Soft reconfig inbound update\n") |
| 5353 | { |
| 5354 | if (strncmp (argv[1], "m", 1) == 0) |
| 5355 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5356 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5357 | |
| 5358 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5359 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5360 | } |
| 5361 | |
| 5362 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, |
| 5363 | clear_ip_bgp_peer_ipv4_in_cmd, |
| 5364 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", |
| 5365 | CLEAR_STR |
| 5366 | IP_STR |
| 5367 | BGP_STR |
| 5368 | "BGP neighbor address to clear\n" |
| 5369 | "Address family\n" |
| 5370 | "Address Family modifier\n" |
| 5371 | "Address Family modifier\n" |
| 5372 | "Soft reconfig inbound update\n") |
| 5373 | |
| 5374 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
| 5375 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, |
| 5376 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", |
| 5377 | CLEAR_STR |
| 5378 | IP_STR |
| 5379 | BGP_STR |
| 5380 | "BGP neighbor address to clear\n" |
| 5381 | "Address family\n" |
| 5382 | "Address Family modifier\n" |
| 5383 | "Address Family modifier\n" |
| 5384 | "Soft reconfig inbound update\n" |
| 5385 | "Push out the existing ORF prefix-list\n") |
| 5386 | { |
| 5387 | if (strncmp (argv[1], "m", 1) == 0) |
| 5388 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 5389 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5390 | |
| 5391 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 5392 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5393 | } |
| 5394 | |
| 5395 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5396 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, |
| 5397 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", |
| 5398 | CLEAR_STR |
| 5399 | IP_STR |
| 5400 | BGP_STR |
| 5401 | "BGP neighbor address to clear\n" |
| 5402 | "Address family\n" |
| 5403 | "Address Family Modifier\n" |
| 5404 | "Soft reconfig\n" |
| 5405 | "Soft reconfig inbound update\n") |
| 5406 | { |
| 5407 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 5408 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5409 | } |
| 5410 | |
| 5411 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, |
| 5412 | clear_ip_bgp_peer_vpnv4_in_cmd, |
| 5413 | "clear ip bgp A.B.C.D vpnv4 unicast in", |
| 5414 | CLEAR_STR |
| 5415 | IP_STR |
| 5416 | BGP_STR |
| 5417 | "BGP neighbor address to clear\n" |
| 5418 | "Address family\n" |
| 5419 | "Address Family Modifier\n" |
| 5420 | "Soft reconfig inbound update\n") |
| 5421 | |
| 5422 | DEFUN (clear_bgp_peer_soft_in, |
| 5423 | clear_bgp_peer_soft_in_cmd, |
| 5424 | "clear bgp (A.B.C.D|X:X::X:X) soft in", |
| 5425 | CLEAR_STR |
| 5426 | BGP_STR |
| 5427 | "BGP neighbor address to clear\n" |
| 5428 | "BGP IPv6 neighbor to clear\n" |
| 5429 | "Soft reconfig\n" |
| 5430 | "Soft reconfig inbound update\n") |
| 5431 | { |
| 5432 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5433 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5434 | } |
| 5435 | |
| 5436 | ALIAS (clear_bgp_peer_soft_in, |
| 5437 | clear_bgp_ipv6_peer_soft_in_cmd, |
| 5438 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in", |
| 5439 | CLEAR_STR |
| 5440 | BGP_STR |
| 5441 | "Address family\n" |
| 5442 | "BGP neighbor address to clear\n" |
| 5443 | "BGP IPv6 neighbor to clear\n" |
| 5444 | "Soft reconfig\n" |
| 5445 | "Soft reconfig inbound update\n") |
| 5446 | |
| 5447 | ALIAS (clear_bgp_peer_soft_in, |
| 5448 | clear_bgp_peer_in_cmd, |
| 5449 | "clear bgp (A.B.C.D|X:X::X:X) in", |
| 5450 | CLEAR_STR |
| 5451 | BGP_STR |
| 5452 | "BGP neighbor address to clear\n" |
| 5453 | "BGP IPv6 neighbor to clear\n" |
| 5454 | "Soft reconfig inbound update\n") |
| 5455 | |
| 5456 | ALIAS (clear_bgp_peer_soft_in, |
| 5457 | clear_bgp_ipv6_peer_in_cmd, |
| 5458 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in", |
| 5459 | CLEAR_STR |
| 5460 | BGP_STR |
| 5461 | "Address family\n" |
| 5462 | "BGP neighbor address to clear\n" |
| 5463 | "BGP IPv6 neighbor to clear\n" |
| 5464 | "Soft reconfig inbound update\n") |
| 5465 | |
| 5466 | DEFUN (clear_bgp_peer_in_prefix_filter, |
| 5467 | clear_bgp_peer_in_prefix_filter_cmd, |
| 5468 | "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5469 | CLEAR_STR |
| 5470 | BGP_STR |
| 5471 | "BGP neighbor address to clear\n" |
| 5472 | "BGP IPv6 neighbor to clear\n" |
| 5473 | "Soft reconfig inbound update\n" |
| 5474 | "Push out the existing ORF prefix-list\n") |
| 5475 | { |
| 5476 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 5477 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5478 | } |
| 5479 | |
| 5480 | ALIAS (clear_bgp_peer_in_prefix_filter, |
| 5481 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, |
| 5482 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter", |
| 5483 | CLEAR_STR |
| 5484 | BGP_STR |
| 5485 | "Address family\n" |
| 5486 | "BGP neighbor address to clear\n" |
| 5487 | "BGP IPv6 neighbor to clear\n" |
| 5488 | "Soft reconfig inbound update\n" |
| 5489 | "Push out the existing ORF prefix-list\n") |
| 5490 | |
| 5491 | DEFUN (clear_ip_bgp_peer_group_soft_in, |
| 5492 | clear_ip_bgp_peer_group_soft_in_cmd, |
| 5493 | "clear ip bgp peer-group WORD soft in", |
| 5494 | CLEAR_STR |
| 5495 | IP_STR |
| 5496 | BGP_STR |
| 5497 | "Clear all members of peer-group\n" |
| 5498 | "BGP peer-group name\n" |
| 5499 | "Soft reconfig\n" |
| 5500 | "Soft reconfig inbound update\n") |
| 5501 | { |
| 5502 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5503 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5504 | } |
| 5505 | |
| 5506 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
| 5507 | clear_ip_bgp_peer_group_in_cmd, |
| 5508 | "clear ip bgp peer-group WORD in", |
| 5509 | CLEAR_STR |
| 5510 | IP_STR |
| 5511 | BGP_STR |
| 5512 | "Clear all members of peer-group\n" |
| 5513 | "BGP peer-group name\n" |
| 5514 | "Soft reconfig inbound update\n") |
| 5515 | |
| 5516 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
| 5517 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, |
| 5518 | "clear ip bgp peer-group WORD in prefix-filter", |
| 5519 | CLEAR_STR |
| 5520 | IP_STR |
| 5521 | BGP_STR |
| 5522 | "Clear all members of peer-group\n" |
| 5523 | "BGP peer-group name\n" |
| 5524 | "Soft reconfig inbound update\n" |
| 5525 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5526 | { |
| 5527 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5528 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5529 | } |
| 5530 | |
| 5531 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5532 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, |
| 5533 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", |
| 5534 | CLEAR_STR |
| 5535 | IP_STR |
| 5536 | BGP_STR |
| 5537 | "Clear all members of peer-group\n" |
| 5538 | "BGP peer-group name\n" |
| 5539 | "Address family\n" |
| 5540 | "Address Family modifier\n" |
| 5541 | "Address Family modifier\n" |
| 5542 | "Soft reconfig\n" |
| 5543 | "Soft reconfig inbound update\n") |
| 5544 | { |
| 5545 | if (strncmp (argv[1], "m", 1) == 0) |
| 5546 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5547 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5548 | |
| 5549 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5550 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5551 | } |
| 5552 | |
| 5553 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, |
| 5554 | clear_ip_bgp_peer_group_ipv4_in_cmd, |
| 5555 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", |
| 5556 | CLEAR_STR |
| 5557 | IP_STR |
| 5558 | BGP_STR |
| 5559 | "Clear all members of peer-group\n" |
| 5560 | "BGP peer-group name\n" |
| 5561 | "Address family\n" |
| 5562 | "Address Family modifier\n" |
| 5563 | "Address Family modifier\n" |
| 5564 | "Soft reconfig inbound update\n") |
| 5565 | |
| 5566 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
| 5567 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, |
| 5568 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", |
| 5569 | CLEAR_STR |
| 5570 | IP_STR |
| 5571 | BGP_STR |
| 5572 | "Clear all members of peer-group\n" |
| 5573 | "BGP peer-group name\n" |
| 5574 | "Address family\n" |
| 5575 | "Address Family modifier\n" |
| 5576 | "Address Family modifier\n" |
| 5577 | "Soft reconfig inbound update\n" |
| 5578 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5579 | { |
| 5580 | if (strncmp (argv[1], "m", 1) == 0) |
| 5581 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 5582 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5583 | |
| 5584 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 5585 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5586 | } |
| 5587 | |
| 5588 | DEFUN (clear_bgp_peer_group_soft_in, |
| 5589 | clear_bgp_peer_group_soft_in_cmd, |
| 5590 | "clear bgp peer-group WORD soft in", |
| 5591 | CLEAR_STR |
| 5592 | BGP_STR |
| 5593 | "Clear all members of peer-group\n" |
| 5594 | "BGP peer-group name\n" |
| 5595 | "Soft reconfig\n" |
| 5596 | "Soft reconfig inbound update\n") |
| 5597 | { |
| 5598 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5599 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5600 | } |
| 5601 | |
| 5602 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5603 | clear_bgp_ipv6_peer_group_soft_in_cmd, |
| 5604 | "clear bgp ipv6 peer-group WORD soft in", |
| 5605 | CLEAR_STR |
| 5606 | BGP_STR |
| 5607 | "Address family\n" |
| 5608 | "Clear all members of peer-group\n" |
| 5609 | "BGP peer-group name\n" |
| 5610 | "Soft reconfig\n" |
| 5611 | "Soft reconfig inbound update\n") |
| 5612 | |
| 5613 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5614 | clear_bgp_peer_group_in_cmd, |
| 5615 | "clear bgp peer-group WORD in", |
| 5616 | CLEAR_STR |
| 5617 | BGP_STR |
| 5618 | "Clear all members of peer-group\n" |
| 5619 | "BGP peer-group name\n" |
| 5620 | "Soft reconfig inbound update\n") |
| 5621 | |
| 5622 | ALIAS (clear_bgp_peer_group_soft_in, |
| 5623 | clear_bgp_ipv6_peer_group_in_cmd, |
| 5624 | "clear bgp ipv6 peer-group WORD in", |
| 5625 | CLEAR_STR |
| 5626 | BGP_STR |
| 5627 | "Address family\n" |
| 5628 | "Clear all members of peer-group\n" |
| 5629 | "BGP peer-group name\n" |
| 5630 | "Soft reconfig inbound update\n") |
| 5631 | |
| 5632 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
| 5633 | clear_bgp_peer_group_in_prefix_filter_cmd, |
| 5634 | "clear bgp peer-group WORD in prefix-filter", |
| 5635 | CLEAR_STR |
| 5636 | BGP_STR |
| 5637 | "Clear all members of peer-group\n" |
| 5638 | "BGP peer-group name\n" |
| 5639 | "Soft reconfig inbound update\n" |
| 5640 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5641 | { |
| 5642 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 5643 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5644 | } |
| 5645 | |
| 5646 | ALIAS (clear_bgp_peer_group_in_prefix_filter, |
| 5647 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, |
| 5648 | "clear bgp ipv6 peer-group WORD in prefix-filter", |
| 5649 | CLEAR_STR |
| 5650 | BGP_STR |
| 5651 | "Address family\n" |
| 5652 | "Clear all members of peer-group\n" |
| 5653 | "BGP peer-group name\n" |
| 5654 | "Soft reconfig inbound update\n" |
| 5655 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5656 | |
| 5657 | DEFUN (clear_ip_bgp_external_soft_in, |
| 5658 | clear_ip_bgp_external_soft_in_cmd, |
| 5659 | "clear ip bgp external soft in", |
| 5660 | CLEAR_STR |
| 5661 | IP_STR |
| 5662 | BGP_STR |
| 5663 | "Clear all external peers\n" |
| 5664 | "Soft reconfig\n" |
| 5665 | "Soft reconfig inbound update\n") |
| 5666 | { |
| 5667 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5668 | BGP_CLEAR_SOFT_IN, NULL); |
| 5669 | } |
| 5670 | |
| 5671 | ALIAS (clear_ip_bgp_external_soft_in, |
| 5672 | clear_ip_bgp_external_in_cmd, |
| 5673 | "clear ip bgp external in", |
| 5674 | CLEAR_STR |
| 5675 | IP_STR |
| 5676 | BGP_STR |
| 5677 | "Clear all external peers\n" |
| 5678 | "Soft reconfig inbound update\n") |
| 5679 | |
| 5680 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
| 5681 | clear_ip_bgp_external_in_prefix_filter_cmd, |
| 5682 | "clear ip bgp external in prefix-filter", |
| 5683 | CLEAR_STR |
| 5684 | IP_STR |
| 5685 | BGP_STR |
| 5686 | "Clear all external peers\n" |
| 5687 | "Soft reconfig inbound update\n" |
| 5688 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5689 | { |
| 5690 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5691 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5692 | } |
| 5693 | |
| 5694 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, |
| 5695 | clear_ip_bgp_external_ipv4_soft_in_cmd, |
| 5696 | "clear ip bgp external ipv4 (unicast|multicast) soft in", |
| 5697 | CLEAR_STR |
| 5698 | IP_STR |
| 5699 | BGP_STR |
| 5700 | "Clear all external peers\n" |
| 5701 | "Address family\n" |
| 5702 | "Address Family modifier\n" |
| 5703 | "Address Family modifier\n" |
| 5704 | "Soft reconfig\n" |
| 5705 | "Soft reconfig inbound update\n") |
| 5706 | { |
| 5707 | if (strncmp (argv[0], "m", 1) == 0) |
| 5708 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5709 | BGP_CLEAR_SOFT_IN, NULL); |
| 5710 | |
| 5711 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5712 | BGP_CLEAR_SOFT_IN, NULL); |
| 5713 | } |
| 5714 | |
| 5715 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, |
| 5716 | clear_ip_bgp_external_ipv4_in_cmd, |
| 5717 | "clear ip bgp external ipv4 (unicast|multicast) in", |
| 5718 | CLEAR_STR |
| 5719 | IP_STR |
| 5720 | BGP_STR |
| 5721 | "Clear all external peers\n" |
| 5722 | "Address family\n" |
| 5723 | "Address Family modifier\n" |
| 5724 | "Address Family modifier\n" |
| 5725 | "Soft reconfig inbound update\n") |
| 5726 | |
| 5727 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
| 5728 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, |
| 5729 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", |
| 5730 | CLEAR_STR |
| 5731 | IP_STR |
| 5732 | BGP_STR |
| 5733 | "Clear all external peers\n" |
| 5734 | "Address family\n" |
| 5735 | "Address Family modifier\n" |
| 5736 | "Address Family modifier\n" |
| 5737 | "Soft reconfig inbound update\n" |
| 5738 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5739 | { |
| 5740 | if (strncmp (argv[0], "m", 1) == 0) |
| 5741 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 5742 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5743 | |
| 5744 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 5745 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5746 | } |
| 5747 | |
| 5748 | DEFUN (clear_bgp_external_soft_in, |
| 5749 | clear_bgp_external_soft_in_cmd, |
| 5750 | "clear bgp external soft in", |
| 5751 | CLEAR_STR |
| 5752 | BGP_STR |
| 5753 | "Clear all external peers\n" |
| 5754 | "Soft reconfig\n" |
| 5755 | "Soft reconfig inbound update\n") |
| 5756 | { |
| 5757 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5758 | BGP_CLEAR_SOFT_IN, NULL); |
| 5759 | } |
| 5760 | |
| 5761 | ALIAS (clear_bgp_external_soft_in, |
| 5762 | clear_bgp_ipv6_external_soft_in_cmd, |
| 5763 | "clear bgp ipv6 external soft in", |
| 5764 | CLEAR_STR |
| 5765 | BGP_STR |
| 5766 | "Address family\n" |
| 5767 | "Clear all external peers\n" |
| 5768 | "Soft reconfig\n" |
| 5769 | "Soft reconfig inbound update\n") |
| 5770 | |
| 5771 | ALIAS (clear_bgp_external_soft_in, |
| 5772 | clear_bgp_external_in_cmd, |
| 5773 | "clear bgp external in", |
| 5774 | CLEAR_STR |
| 5775 | BGP_STR |
| 5776 | "Clear all external peers\n" |
| 5777 | "Soft reconfig inbound update\n") |
| 5778 | |
| 5779 | ALIAS (clear_bgp_external_soft_in, |
| 5780 | clear_bgp_ipv6_external_in_cmd, |
| 5781 | "clear bgp ipv6 external WORD in", |
| 5782 | CLEAR_STR |
| 5783 | BGP_STR |
| 5784 | "Address family\n" |
| 5785 | "Clear all external peers\n" |
| 5786 | "Soft reconfig inbound update\n") |
| 5787 | |
| 5788 | DEFUN (clear_bgp_external_in_prefix_filter, |
| 5789 | clear_bgp_external_in_prefix_filter_cmd, |
| 5790 | "clear bgp external in prefix-filter", |
| 5791 | CLEAR_STR |
| 5792 | BGP_STR |
| 5793 | "Clear all external peers\n" |
| 5794 | "Soft reconfig inbound update\n" |
| 5795 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5796 | { |
| 5797 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 5798 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
| 5799 | } |
| 5800 | |
| 5801 | ALIAS (clear_bgp_external_in_prefix_filter, |
| 5802 | clear_bgp_ipv6_external_in_prefix_filter_cmd, |
| 5803 | "clear bgp ipv6 external in prefix-filter", |
| 5804 | CLEAR_STR |
| 5805 | BGP_STR |
| 5806 | "Address family\n" |
| 5807 | "Clear all external peers\n" |
| 5808 | "Soft reconfig inbound update\n" |
| 5809 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5810 | |
| 5811 | DEFUN (clear_ip_bgp_as_soft_in, |
| 5812 | clear_ip_bgp_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5813 | "clear ip bgp " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5814 | CLEAR_STR |
| 5815 | IP_STR |
| 5816 | BGP_STR |
| 5817 | "Clear peers with the AS number\n" |
| 5818 | "Soft reconfig\n" |
| 5819 | "Soft reconfig inbound update\n") |
| 5820 | { |
| 5821 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5822 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5823 | } |
| 5824 | |
| 5825 | ALIAS (clear_ip_bgp_as_soft_in, |
| 5826 | clear_ip_bgp_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5827 | "clear ip bgp " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5828 | CLEAR_STR |
| 5829 | IP_STR |
| 5830 | BGP_STR |
| 5831 | "Clear peers with the AS number\n" |
| 5832 | "Soft reconfig inbound update\n") |
| 5833 | |
| 5834 | DEFUN (clear_ip_bgp_as_in_prefix_filter, |
| 5835 | clear_ip_bgp_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5836 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5837 | CLEAR_STR |
| 5838 | IP_STR |
| 5839 | BGP_STR |
| 5840 | "Clear peers with the AS number\n" |
| 5841 | "Soft reconfig inbound update\n" |
| 5842 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5843 | { |
| 5844 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5845 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5846 | } |
| 5847 | |
| 5848 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, |
| 5849 | clear_ip_bgp_as_ipv4_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5850 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5851 | CLEAR_STR |
| 5852 | IP_STR |
| 5853 | BGP_STR |
| 5854 | "Clear peers with the AS number\n" |
| 5855 | "Address family\n" |
| 5856 | "Address Family modifier\n" |
| 5857 | "Address Family modifier\n" |
| 5858 | "Soft reconfig\n" |
| 5859 | "Soft reconfig inbound update\n") |
| 5860 | { |
| 5861 | if (strncmp (argv[1], "m", 1) == 0) |
| 5862 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5863 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5864 | |
| 5865 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5866 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5867 | } |
| 5868 | |
| 5869 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, |
| 5870 | clear_ip_bgp_as_ipv4_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5871 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5872 | CLEAR_STR |
| 5873 | IP_STR |
| 5874 | BGP_STR |
| 5875 | "Clear peers with the AS number\n" |
| 5876 | "Address family\n" |
| 5877 | "Address Family modifier\n" |
| 5878 | "Address Family modifier\n" |
| 5879 | "Soft reconfig inbound update\n") |
| 5880 | |
| 5881 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
| 5882 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5883 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5884 | CLEAR_STR |
| 5885 | IP_STR |
| 5886 | BGP_STR |
| 5887 | "Clear peers with the AS number\n" |
| 5888 | "Address family\n" |
| 5889 | "Address Family modifier\n" |
| 5890 | "Address Family modifier\n" |
| 5891 | "Soft reconfig inbound update\n" |
| 5892 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5893 | { |
| 5894 | if (strncmp (argv[1], "m", 1) == 0) |
| 5895 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 5896 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5897 | |
| 5898 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 5899 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5900 | } |
| 5901 | |
| 5902 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, |
| 5903 | clear_ip_bgp_as_vpnv4_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5904 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5905 | CLEAR_STR |
| 5906 | IP_STR |
| 5907 | BGP_STR |
| 5908 | "Clear peers with the AS number\n" |
| 5909 | "Address family\n" |
| 5910 | "Address Family modifier\n" |
| 5911 | "Soft reconfig\n" |
| 5912 | "Soft reconfig inbound update\n") |
| 5913 | { |
| 5914 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 5915 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5916 | } |
| 5917 | |
| 5918 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, |
| 5919 | clear_ip_bgp_as_vpnv4_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5920 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5921 | CLEAR_STR |
| 5922 | IP_STR |
| 5923 | BGP_STR |
| 5924 | "Clear peers with the AS number\n" |
| 5925 | "Address family\n" |
| 5926 | "Address Family modifier\n" |
| 5927 | "Soft reconfig inbound update\n") |
| 5928 | |
| 5929 | DEFUN (clear_bgp_as_soft_in, |
| 5930 | clear_bgp_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5931 | "clear bgp " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5932 | CLEAR_STR |
| 5933 | BGP_STR |
| 5934 | "Clear peers with the AS number\n" |
| 5935 | "Soft reconfig\n" |
| 5936 | "Soft reconfig inbound update\n") |
| 5937 | { |
| 5938 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5939 | BGP_CLEAR_SOFT_IN, argv[0]); |
| 5940 | } |
| 5941 | |
| 5942 | ALIAS (clear_bgp_as_soft_in, |
| 5943 | clear_bgp_ipv6_as_soft_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5944 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5945 | CLEAR_STR |
| 5946 | BGP_STR |
| 5947 | "Address family\n" |
| 5948 | "Clear peers with the AS number\n" |
| 5949 | "Soft reconfig\n" |
| 5950 | "Soft reconfig inbound update\n") |
| 5951 | |
| 5952 | ALIAS (clear_bgp_as_soft_in, |
| 5953 | clear_bgp_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5954 | "clear bgp " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5955 | CLEAR_STR |
| 5956 | BGP_STR |
| 5957 | "Clear peers with the AS number\n" |
| 5958 | "Soft reconfig inbound update\n") |
| 5959 | |
| 5960 | ALIAS (clear_bgp_as_soft_in, |
| 5961 | clear_bgp_ipv6_as_in_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5962 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5963 | CLEAR_STR |
| 5964 | BGP_STR |
| 5965 | "Address family\n" |
| 5966 | "Clear peers with the AS number\n" |
| 5967 | "Soft reconfig inbound update\n") |
| 5968 | |
| 5969 | DEFUN (clear_bgp_as_in_prefix_filter, |
| 5970 | clear_bgp_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5971 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5972 | CLEAR_STR |
| 5973 | BGP_STR |
| 5974 | "Clear peers with the AS number\n" |
| 5975 | "Soft reconfig inbound update\n" |
| 5976 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5977 | { |
| 5978 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 5979 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); |
| 5980 | } |
| 5981 | |
| 5982 | ALIAS (clear_bgp_as_in_prefix_filter, |
| 5983 | clear_bgp_ipv6_as_in_prefix_filter_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 5984 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5985 | CLEAR_STR |
| 5986 | BGP_STR |
| 5987 | "Address family\n" |
| 5988 | "Clear peers with the AS number\n" |
| 5989 | "Soft reconfig inbound update\n" |
| 5990 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
| 5991 | |
| 5992 | /* Both soft-reconfiguration */ |
| 5993 | DEFUN (clear_ip_bgp_all_soft, |
| 5994 | clear_ip_bgp_all_soft_cmd, |
| 5995 | "clear ip bgp * soft", |
| 5996 | CLEAR_STR |
| 5997 | IP_STR |
| 5998 | BGP_STR |
| 5999 | "Clear all peers\n" |
| 6000 | "Soft reconfig\n") |
| 6001 | { |
| 6002 | if (argc == 1) |
| 6003 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6004 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6005 | |
| 6006 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6007 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6008 | } |
| 6009 | |
| 6010 | ALIAS (clear_ip_bgp_all_soft, |
| 6011 | clear_ip_bgp_instance_all_soft_cmd, |
| 6012 | "clear ip bgp view WORD * soft", |
| 6013 | CLEAR_STR |
| 6014 | IP_STR |
| 6015 | BGP_STR |
| 6016 | "BGP view\n" |
| 6017 | "view name\n" |
| 6018 | "Clear all peers\n" |
| 6019 | "Soft reconfig\n") |
| 6020 | |
| 6021 | |
| 6022 | DEFUN (clear_ip_bgp_all_ipv4_soft, |
| 6023 | clear_ip_bgp_all_ipv4_soft_cmd, |
| 6024 | "clear ip bgp * ipv4 (unicast|multicast) soft", |
| 6025 | CLEAR_STR |
| 6026 | IP_STR |
| 6027 | BGP_STR |
| 6028 | "Clear all peers\n" |
| 6029 | "Address family\n" |
| 6030 | "Address Family Modifier\n" |
| 6031 | "Address Family Modifier\n" |
| 6032 | "Soft reconfig\n") |
| 6033 | { |
| 6034 | if (strncmp (argv[0], "m", 1) == 0) |
| 6035 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 6036 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6037 | |
| 6038 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6039 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6040 | } |
| 6041 | |
| 6042 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, |
| 6043 | clear_ip_bgp_instance_all_ipv4_soft_cmd, |
| 6044 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", |
| 6045 | CLEAR_STR |
| 6046 | IP_STR |
| 6047 | BGP_STR |
| 6048 | "BGP view\n" |
| 6049 | "view name\n" |
| 6050 | "Clear all peers\n" |
| 6051 | "Address family\n" |
| 6052 | "Address Family Modifier\n" |
| 6053 | "Address Family Modifier\n" |
| 6054 | "Soft reconfig\n") |
| 6055 | { |
| 6056 | if (strncmp (argv[1], "m", 1) == 0) |
| 6057 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
| 6058 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6059 | |
| 6060 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6061 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6062 | } |
| 6063 | |
| 6064 | DEFUN (clear_ip_bgp_all_vpnv4_soft, |
| 6065 | clear_ip_bgp_all_vpnv4_soft_cmd, |
| 6066 | "clear ip bgp * vpnv4 unicast soft", |
| 6067 | CLEAR_STR |
| 6068 | IP_STR |
| 6069 | BGP_STR |
| 6070 | "Clear all peers\n" |
| 6071 | "Address family\n" |
| 6072 | "Address Family Modifier\n" |
| 6073 | "Soft reconfig\n") |
| 6074 | { |
| 6075 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, |
| 6076 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6077 | } |
| 6078 | |
| 6079 | DEFUN (clear_bgp_all_soft, |
| 6080 | clear_bgp_all_soft_cmd, |
| 6081 | "clear bgp * soft", |
| 6082 | CLEAR_STR |
| 6083 | BGP_STR |
| 6084 | "Clear all peers\n" |
| 6085 | "Soft reconfig\n") |
| 6086 | { |
| 6087 | if (argc == 1) |
| 6088 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6089 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6090 | |
| 6091 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6092 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6093 | } |
| 6094 | |
| 6095 | ALIAS (clear_bgp_all_soft, |
| 6096 | clear_bgp_instance_all_soft_cmd, |
| 6097 | "clear bgp view WORD * soft", |
| 6098 | CLEAR_STR |
| 6099 | BGP_STR |
| 6100 | "BGP view\n" |
| 6101 | "view name\n" |
| 6102 | "Clear all peers\n" |
| 6103 | "Soft reconfig\n") |
| 6104 | |
| 6105 | ALIAS (clear_bgp_all_soft, |
| 6106 | clear_bgp_ipv6_all_soft_cmd, |
| 6107 | "clear bgp ipv6 * soft", |
| 6108 | CLEAR_STR |
| 6109 | BGP_STR |
| 6110 | "Address family\n" |
| 6111 | "Clear all peers\n" |
| 6112 | "Soft reconfig\n") |
| 6113 | |
| 6114 | DEFUN (clear_ip_bgp_peer_soft, |
| 6115 | clear_ip_bgp_peer_soft_cmd, |
| 6116 | "clear ip bgp A.B.C.D soft", |
| 6117 | CLEAR_STR |
| 6118 | IP_STR |
| 6119 | BGP_STR |
| 6120 | "BGP neighbor address to clear\n" |
| 6121 | "Soft reconfig\n") |
| 6122 | { |
| 6123 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6124 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6125 | } |
| 6126 | |
| 6127 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
| 6128 | clear_ip_bgp_peer_ipv4_soft_cmd, |
| 6129 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", |
| 6130 | CLEAR_STR |
| 6131 | IP_STR |
| 6132 | BGP_STR |
| 6133 | "BGP neighbor address to clear\n" |
| 6134 | "Address family\n" |
| 6135 | "Address Family Modifier\n" |
| 6136 | "Address Family Modifier\n" |
| 6137 | "Soft reconfig\n") |
| 6138 | { |
| 6139 | if (strncmp (argv[1], "m", 1) == 0) |
| 6140 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
| 6141 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6142 | |
| 6143 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6144 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6145 | } |
| 6146 | |
| 6147 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
| 6148 | clear_ip_bgp_peer_vpnv4_soft_cmd, |
| 6149 | "clear ip bgp A.B.C.D vpnv4 unicast soft", |
| 6150 | CLEAR_STR |
| 6151 | IP_STR |
| 6152 | BGP_STR |
| 6153 | "BGP neighbor address to clear\n" |
| 6154 | "Address family\n" |
| 6155 | "Address Family Modifier\n" |
| 6156 | "Soft reconfig\n") |
| 6157 | { |
| 6158 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, |
| 6159 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6160 | } |
| 6161 | |
| 6162 | DEFUN (clear_bgp_peer_soft, |
| 6163 | clear_bgp_peer_soft_cmd, |
| 6164 | "clear bgp (A.B.C.D|X:X::X:X) soft", |
| 6165 | CLEAR_STR |
| 6166 | BGP_STR |
| 6167 | "BGP neighbor address to clear\n" |
| 6168 | "BGP IPv6 neighbor to clear\n" |
| 6169 | "Soft reconfig\n") |
| 6170 | { |
| 6171 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6172 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6173 | } |
| 6174 | |
| 6175 | ALIAS (clear_bgp_peer_soft, |
| 6176 | clear_bgp_ipv6_peer_soft_cmd, |
| 6177 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft", |
| 6178 | CLEAR_STR |
| 6179 | BGP_STR |
| 6180 | "Address family\n" |
| 6181 | "BGP neighbor address to clear\n" |
| 6182 | "BGP IPv6 neighbor to clear\n" |
| 6183 | "Soft reconfig\n") |
| 6184 | |
| 6185 | DEFUN (clear_ip_bgp_peer_group_soft, |
| 6186 | clear_ip_bgp_peer_group_soft_cmd, |
| 6187 | "clear ip bgp peer-group WORD soft", |
| 6188 | CLEAR_STR |
| 6189 | IP_STR |
| 6190 | BGP_STR |
| 6191 | "Clear all members of peer-group\n" |
| 6192 | "BGP peer-group name\n" |
| 6193 | "Soft reconfig\n") |
| 6194 | { |
| 6195 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6196 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6197 | } |
| 6198 | |
| 6199 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
| 6200 | clear_ip_bgp_peer_group_ipv4_soft_cmd, |
| 6201 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", |
| 6202 | CLEAR_STR |
| 6203 | IP_STR |
| 6204 | BGP_STR |
| 6205 | "Clear all members of peer-group\n" |
| 6206 | "BGP peer-group name\n" |
| 6207 | "Address family\n" |
| 6208 | "Address Family modifier\n" |
| 6209 | "Address Family modifier\n" |
| 6210 | "Soft reconfig\n") |
| 6211 | { |
| 6212 | if (strncmp (argv[1], "m", 1) == 0) |
| 6213 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
| 6214 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6215 | |
| 6216 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
| 6217 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6218 | } |
| 6219 | |
| 6220 | DEFUN (clear_bgp_peer_group_soft, |
| 6221 | clear_bgp_peer_group_soft_cmd, |
| 6222 | "clear bgp peer-group WORD soft", |
| 6223 | CLEAR_STR |
| 6224 | BGP_STR |
| 6225 | "Clear all members of peer-group\n" |
| 6226 | "BGP peer-group name\n" |
| 6227 | "Soft reconfig\n") |
| 6228 | { |
| 6229 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
| 6230 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6231 | } |
| 6232 | |
| 6233 | ALIAS (clear_bgp_peer_group_soft, |
| 6234 | clear_bgp_ipv6_peer_group_soft_cmd, |
| 6235 | "clear bgp ipv6 peer-group WORD soft", |
| 6236 | CLEAR_STR |
| 6237 | BGP_STR |
| 6238 | "Address family\n" |
| 6239 | "Clear all members of peer-group\n" |
| 6240 | "BGP peer-group name\n" |
| 6241 | "Soft reconfig\n") |
| 6242 | |
| 6243 | DEFUN (clear_ip_bgp_external_soft, |
| 6244 | clear_ip_bgp_external_soft_cmd, |
| 6245 | "clear ip bgp external soft", |
| 6246 | CLEAR_STR |
| 6247 | IP_STR |
| 6248 | BGP_STR |
| 6249 | "Clear all external peers\n" |
| 6250 | "Soft reconfig\n") |
| 6251 | { |
| 6252 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6253 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6254 | } |
| 6255 | |
| 6256 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
| 6257 | clear_ip_bgp_external_ipv4_soft_cmd, |
| 6258 | "clear ip bgp external ipv4 (unicast|multicast) soft", |
| 6259 | CLEAR_STR |
| 6260 | IP_STR |
| 6261 | BGP_STR |
| 6262 | "Clear all external peers\n" |
| 6263 | "Address family\n" |
| 6264 | "Address Family modifier\n" |
| 6265 | "Address Family modifier\n" |
| 6266 | "Soft reconfig\n") |
| 6267 | { |
| 6268 | if (strncmp (argv[0], "m", 1) == 0) |
| 6269 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
| 6270 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6271 | |
| 6272 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
| 6273 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6274 | } |
| 6275 | |
| 6276 | DEFUN (clear_bgp_external_soft, |
| 6277 | clear_bgp_external_soft_cmd, |
| 6278 | "clear bgp external soft", |
| 6279 | CLEAR_STR |
| 6280 | BGP_STR |
| 6281 | "Clear all external peers\n" |
| 6282 | "Soft reconfig\n") |
| 6283 | { |
| 6284 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
| 6285 | BGP_CLEAR_SOFT_BOTH, NULL); |
| 6286 | } |
| 6287 | |
| 6288 | ALIAS (clear_bgp_external_soft, |
| 6289 | clear_bgp_ipv6_external_soft_cmd, |
| 6290 | "clear bgp ipv6 external soft", |
| 6291 | CLEAR_STR |
| 6292 | BGP_STR |
| 6293 | "Address family\n" |
| 6294 | "Clear all external peers\n" |
| 6295 | "Soft reconfig\n") |
| 6296 | |
| 6297 | DEFUN (clear_ip_bgp_as_soft, |
| 6298 | clear_ip_bgp_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6299 | "clear ip bgp " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6300 | CLEAR_STR |
| 6301 | IP_STR |
| 6302 | BGP_STR |
| 6303 | "Clear peers with the AS number\n" |
| 6304 | "Soft reconfig\n") |
| 6305 | { |
| 6306 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
| 6307 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6308 | } |
| 6309 | |
| 6310 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
| 6311 | clear_ip_bgp_as_ipv4_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6312 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6313 | CLEAR_STR |
| 6314 | IP_STR |
| 6315 | BGP_STR |
| 6316 | "Clear peers with the AS number\n" |
| 6317 | "Address family\n" |
| 6318 | "Address Family Modifier\n" |
| 6319 | "Address Family Modifier\n" |
| 6320 | "Soft reconfig\n") |
| 6321 | { |
| 6322 | if (strncmp (argv[1], "m", 1) == 0) |
| 6323 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
| 6324 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6325 | |
| 6326 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, |
| 6327 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6328 | } |
| 6329 | |
| 6330 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
| 6331 | clear_ip_bgp_as_vpnv4_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6332 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6333 | CLEAR_STR |
| 6334 | IP_STR |
| 6335 | BGP_STR |
| 6336 | "Clear peers with the AS number\n" |
| 6337 | "Address family\n" |
| 6338 | "Address Family Modifier\n" |
| 6339 | "Soft reconfig\n") |
| 6340 | { |
| 6341 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, |
| 6342 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6343 | } |
| 6344 | |
| 6345 | DEFUN (clear_bgp_as_soft, |
| 6346 | clear_bgp_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6347 | "clear bgp " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6348 | CLEAR_STR |
| 6349 | BGP_STR |
| 6350 | "Clear peers with the AS number\n" |
| 6351 | "Soft reconfig\n") |
| 6352 | { |
| 6353 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
| 6354 | BGP_CLEAR_SOFT_BOTH, argv[0]); |
| 6355 | } |
| 6356 | |
| 6357 | ALIAS (clear_bgp_as_soft, |
| 6358 | clear_bgp_ipv6_as_soft_cmd, |
Paul Jakma | 320da87 | 2008-07-02 13:40:33 +0000 | [diff] [blame] | 6359 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6360 | CLEAR_STR |
| 6361 | BGP_STR |
| 6362 | "Address family\n" |
| 6363 | "Clear peers with the AS number\n" |
| 6364 | "Soft reconfig\n") |
| 6365 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6366 | /* RS-client soft reconfiguration. */ |
| 6367 | #ifdef HAVE_IPV6 |
| 6368 | DEFUN (clear_bgp_all_rsclient, |
| 6369 | clear_bgp_all_rsclient_cmd, |
| 6370 | "clear bgp * rsclient", |
| 6371 | CLEAR_STR |
| 6372 | BGP_STR |
| 6373 | "Clear all peers\n" |
| 6374 | "Soft reconfig for rsclient RIB\n") |
| 6375 | { |
| 6376 | if (argc == 1) |
| 6377 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, |
| 6378 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6379 | |
| 6380 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, |
| 6381 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6382 | } |
| 6383 | |
| 6384 | ALIAS (clear_bgp_all_rsclient, |
| 6385 | clear_bgp_ipv6_all_rsclient_cmd, |
| 6386 | "clear bgp ipv6 * rsclient", |
| 6387 | CLEAR_STR |
| 6388 | BGP_STR |
| 6389 | "Address family\n" |
| 6390 | "Clear all peers\n" |
| 6391 | "Soft reconfig for rsclient RIB\n") |
| 6392 | |
| 6393 | ALIAS (clear_bgp_all_rsclient, |
| 6394 | clear_bgp_instance_all_rsclient_cmd, |
| 6395 | "clear bgp view WORD * rsclient", |
| 6396 | CLEAR_STR |
| 6397 | BGP_STR |
| 6398 | "BGP view\n" |
| 6399 | "view name\n" |
| 6400 | "Clear all peers\n" |
| 6401 | "Soft reconfig for rsclient RIB\n") |
| 6402 | |
| 6403 | ALIAS (clear_bgp_all_rsclient, |
| 6404 | clear_bgp_ipv6_instance_all_rsclient_cmd, |
| 6405 | "clear bgp ipv6 view WORD * rsclient", |
| 6406 | CLEAR_STR |
| 6407 | BGP_STR |
| 6408 | "Address family\n" |
| 6409 | "BGP view\n" |
| 6410 | "view name\n" |
| 6411 | "Clear all peers\n" |
| 6412 | "Soft reconfig for rsclient RIB\n") |
| 6413 | #endif /* HAVE_IPV6 */ |
| 6414 | |
| 6415 | DEFUN (clear_ip_bgp_all_rsclient, |
| 6416 | clear_ip_bgp_all_rsclient_cmd, |
| 6417 | "clear ip bgp * rsclient", |
| 6418 | CLEAR_STR |
| 6419 | IP_STR |
| 6420 | BGP_STR |
| 6421 | "Clear all peers\n" |
| 6422 | "Soft reconfig for rsclient RIB\n") |
| 6423 | { |
| 6424 | if (argc == 1) |
| 6425 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, |
| 6426 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6427 | |
| 6428 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
| 6429 | BGP_CLEAR_SOFT_RSCLIENT, NULL); |
| 6430 | } |
| 6431 | |
| 6432 | ALIAS (clear_ip_bgp_all_rsclient, |
| 6433 | clear_ip_bgp_instance_all_rsclient_cmd, |
| 6434 | "clear ip bgp view WORD * rsclient", |
| 6435 | CLEAR_STR |
| 6436 | IP_STR |
| 6437 | BGP_STR |
| 6438 | "BGP view\n" |
| 6439 | "view name\n" |
| 6440 | "Clear all peers\n" |
| 6441 | "Soft reconfig for rsclient RIB\n") |
| 6442 | |
| 6443 | #ifdef HAVE_IPV6 |
| 6444 | DEFUN (clear_bgp_peer_rsclient, |
| 6445 | clear_bgp_peer_rsclient_cmd, |
| 6446 | "clear bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6447 | CLEAR_STR |
| 6448 | BGP_STR |
| 6449 | "BGP neighbor IP address to clear\n" |
| 6450 | "BGP IPv6 neighbor to clear\n" |
| 6451 | "Soft reconfig for rsclient RIB\n") |
| 6452 | { |
| 6453 | if (argc == 2) |
| 6454 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6455 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6456 | |
| 6457 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
| 6458 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6459 | } |
| 6460 | |
| 6461 | ALIAS (clear_bgp_peer_rsclient, |
| 6462 | clear_bgp_ipv6_peer_rsclient_cmd, |
| 6463 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient", |
| 6464 | CLEAR_STR |
| 6465 | BGP_STR |
| 6466 | "Address family\n" |
| 6467 | "BGP neighbor IP address to clear\n" |
| 6468 | "BGP IPv6 neighbor to clear\n" |
| 6469 | "Soft reconfig for rsclient RIB\n") |
| 6470 | |
| 6471 | ALIAS (clear_bgp_peer_rsclient, |
| 6472 | clear_bgp_instance_peer_rsclient_cmd, |
| 6473 | "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6474 | CLEAR_STR |
| 6475 | BGP_STR |
| 6476 | "BGP view\n" |
| 6477 | "view name\n" |
| 6478 | "BGP neighbor IP address to clear\n" |
| 6479 | "BGP IPv6 neighbor to clear\n" |
| 6480 | "Soft reconfig for rsclient RIB\n") |
| 6481 | |
| 6482 | ALIAS (clear_bgp_peer_rsclient, |
| 6483 | clear_bgp_ipv6_instance_peer_rsclient_cmd, |
| 6484 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6485 | CLEAR_STR |
| 6486 | BGP_STR |
| 6487 | "Address family\n" |
| 6488 | "BGP view\n" |
| 6489 | "view name\n" |
| 6490 | "BGP neighbor IP address to clear\n" |
| 6491 | "BGP IPv6 neighbor to clear\n" |
| 6492 | "Soft reconfig for rsclient RIB\n") |
| 6493 | #endif /* HAVE_IPV6 */ |
| 6494 | |
| 6495 | DEFUN (clear_ip_bgp_peer_rsclient, |
| 6496 | clear_ip_bgp_peer_rsclient_cmd, |
| 6497 | "clear ip bgp (A.B.C.D|X:X::X:X) rsclient", |
| 6498 | CLEAR_STR |
| 6499 | IP_STR |
| 6500 | BGP_STR |
| 6501 | "BGP neighbor IP address to clear\n" |
| 6502 | "BGP IPv6 neighbor to clear\n" |
| 6503 | "Soft reconfig for rsclient RIB\n") |
| 6504 | { |
| 6505 | if (argc == 2) |
| 6506 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, |
| 6507 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); |
| 6508 | |
| 6509 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
| 6510 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); |
| 6511 | } |
| 6512 | |
| 6513 | ALIAS (clear_ip_bgp_peer_rsclient, |
| 6514 | clear_ip_bgp_instance_peer_rsclient_cmd, |
| 6515 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient", |
| 6516 | CLEAR_STR |
| 6517 | IP_STR |
| 6518 | BGP_STR |
| 6519 | "BGP view\n" |
| 6520 | "view name\n" |
| 6521 | "BGP neighbor IP address to clear\n" |
| 6522 | "BGP IPv6 neighbor to clear\n" |
| 6523 | "Soft reconfig for rsclient RIB\n") |
| 6524 | |
Michael Lambert | e0081f7 | 2008-11-16 20:12:04 +0000 | [diff] [blame] | 6525 | DEFUN (show_bgp_views, |
| 6526 | show_bgp_views_cmd, |
| 6527 | "show bgp views", |
| 6528 | SHOW_STR |
| 6529 | BGP_STR |
| 6530 | "Show the defined BGP views\n") |
| 6531 | { |
| 6532 | struct list *inst = bm->bgp; |
| 6533 | struct listnode *node; |
| 6534 | struct bgp *bgp; |
| 6535 | |
| 6536 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) |
| 6537 | { |
| 6538 | vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE); |
| 6539 | return CMD_WARNING; |
| 6540 | } |
| 6541 | |
| 6542 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); |
| 6543 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) |
| 6544 | vty_out (vty, "\t%s (AS%u)%s", |
| 6545 | bgp->name ? bgp->name : "(null)", |
| 6546 | bgp->as, VTY_NEWLINE); |
| 6547 | |
| 6548 | return CMD_SUCCESS; |
| 6549 | } |
| 6550 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6551 | DEFUN (show_bgp_memory, |
| 6552 | show_bgp_memory_cmd, |
| 6553 | "show bgp memory", |
| 6554 | SHOW_STR |
| 6555 | BGP_STR |
| 6556 | "Global BGP memory statistics\n") |
| 6557 | { |
| 6558 | char memstrbuf[MTYPE_MEMSTR_LEN]; |
| 6559 | unsigned long count; |
| 6560 | |
| 6561 | /* RIB related usage stats */ |
| 6562 | count = mtype_stats_alloc (MTYPE_BGP_NODE); |
| 6563 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, |
| 6564 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6565 | count * sizeof (struct bgp_node)), |
| 6566 | VTY_NEWLINE); |
| 6567 | |
| 6568 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); |
| 6569 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, |
| 6570 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6571 | count * sizeof (struct bgp_info)), |
| 6572 | VTY_NEWLINE); |
Paul Jakma | fb982c2 | 2007-05-04 20:15:47 +0000 | [diff] [blame] | 6573 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
| 6574 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, |
| 6575 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6576 | count * sizeof (struct bgp_info_extra)), |
| 6577 | VTY_NEWLINE); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6578 | |
| 6579 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) |
| 6580 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, |
| 6581 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6582 | count * sizeof (struct bgp_static)), |
| 6583 | VTY_NEWLINE); |
| 6584 | |
| 6585 | /* Adj-In/Out */ |
| 6586 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) |
| 6587 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, |
| 6588 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6589 | count * sizeof (struct bgp_adj_in)), |
| 6590 | VTY_NEWLINE); |
| 6591 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) |
| 6592 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, |
| 6593 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6594 | count * sizeof (struct bgp_adj_out)), |
| 6595 | VTY_NEWLINE); |
| 6596 | |
| 6597 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) |
| 6598 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, |
| 6599 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6600 | count * sizeof (struct bgp_nexthop_cache)), |
| 6601 | VTY_NEWLINE); |
| 6602 | |
| 6603 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) |
| 6604 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, |
| 6605 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6606 | count * sizeof (struct bgp_damp_info)), |
| 6607 | VTY_NEWLINE); |
| 6608 | |
| 6609 | /* Attributes */ |
| 6610 | count = attr_count(); |
| 6611 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, |
| 6612 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6613 | count * sizeof(struct attr)), |
| 6614 | VTY_NEWLINE); |
Paul Jakma | fb982c2 | 2007-05-04 20:15:47 +0000 | [diff] [blame] | 6615 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
| 6616 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, |
| 6617 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6618 | count * sizeof(struct attr_extra)), |
| 6619 | VTY_NEWLINE); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6620 | |
| 6621 | if ((count = attr_unknown_count())) |
| 6622 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); |
| 6623 | |
| 6624 | /* AS_PATH attributes */ |
| 6625 | count = aspath_count (); |
| 6626 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, |
| 6627 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6628 | count * sizeof (struct aspath)), |
| 6629 | VTY_NEWLINE); |
| 6630 | |
| 6631 | count = mtype_stats_alloc (MTYPE_AS_SEG); |
| 6632 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, |
| 6633 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6634 | count * sizeof (struct assegment)), |
| 6635 | VTY_NEWLINE); |
| 6636 | |
| 6637 | /* Other attributes */ |
| 6638 | if ((count = community_count ())) |
| 6639 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, |
| 6640 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6641 | count * sizeof (struct community)), |
| 6642 | VTY_NEWLINE); |
| 6643 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) |
| 6644 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, |
| 6645 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6646 | count * sizeof (struct ecommunity)), |
| 6647 | VTY_NEWLINE); |
| 6648 | |
| 6649 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) |
| 6650 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, |
| 6651 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6652 | count * sizeof (struct cluster_list)), |
| 6653 | VTY_NEWLINE); |
| 6654 | |
| 6655 | /* Peer related usage */ |
| 6656 | count = mtype_stats_alloc (MTYPE_BGP_PEER); |
| 6657 | vty_out (vty, "%ld peers, using %s of memory%s", count, |
| 6658 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6659 | count * sizeof (struct peer)), |
| 6660 | VTY_NEWLINE); |
| 6661 | |
| 6662 | if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP))) |
| 6663 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, |
| 6664 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6665 | count * sizeof (struct peer_group)), |
| 6666 | VTY_NEWLINE); |
| 6667 | |
| 6668 | /* Other */ |
| 6669 | if ((count = mtype_stats_alloc (MTYPE_HASH))) |
| 6670 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, |
| 6671 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6672 | count * sizeof (struct hash)), |
| 6673 | VTY_NEWLINE); |
| 6674 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) |
| 6675 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, |
| 6676 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6677 | count * sizeof (struct hash_backet)), |
| 6678 | VTY_NEWLINE); |
| 6679 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) |
| 6680 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, |
| 6681 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6682 | count * sizeof (regex_t)), |
| 6683 | VTY_NEWLINE); |
| 6684 | return CMD_SUCCESS; |
| 6685 | } |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 6686 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6687 | /* Show BGP peer's summary information. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6688 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6689 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) |
| 6690 | { |
| 6691 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6692 | struct listnode *node, *nnode; |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6693 | unsigned int count = 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6694 | char timebuf[BGP_UPTIME_LEN]; |
| 6695 | int len; |
| 6696 | |
| 6697 | /* Header string for each address family. */ |
| 6698 | 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] | 6699 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6700 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6701 | { |
| 6702 | if (peer->afc[afi][safi]) |
| 6703 | { |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6704 | if (!count) |
| 6705 | { |
| 6706 | unsigned long ents; |
| 6707 | char memstrbuf[MTYPE_MEMSTR_LEN]; |
| 6708 | |
| 6709 | /* Usage summary and header */ |
| 6710 | vty_out (vty, |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 6711 | "BGP router identifier %s, local AS number %u%s", |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6712 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6713 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 6714 | ents = bgp_table_count (bgp->rib[afi][safi]); |
| 6715 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, |
| 6716 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6717 | ents * sizeof (struct bgp_node)), |
| 6718 | VTY_NEWLINE); |
| 6719 | |
| 6720 | /* Peer related usage */ |
| 6721 | ents = listcount (bgp->peer); |
| 6722 | vty_out (vty, "Peers %ld, using %s of memory%s", |
| 6723 | ents, |
| 6724 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6725 | ents * sizeof (struct peer)), |
| 6726 | VTY_NEWLINE); |
| 6727 | |
| 6728 | if ((ents = listcount (bgp->rsclient))) |
| 6729 | vty_out (vty, "RS-Client peers %ld, using %s of memory%s", |
| 6730 | ents, |
| 6731 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6732 | ents * sizeof (struct peer)), |
| 6733 | VTY_NEWLINE); |
| 6734 | |
| 6735 | if ((ents = listcount (bgp->group))) |
| 6736 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, |
| 6737 | mtype_memstr (memstrbuf, sizeof (memstrbuf), |
| 6738 | ents * sizeof (struct peer_group)), |
| 6739 | VTY_NEWLINE); |
| 6740 | |
| 6741 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
| 6742 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); |
| 6743 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6744 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 6745 | } |
| 6746 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6747 | count++; |
| 6748 | |
| 6749 | len = vty_out (vty, "%s", peer->host); |
| 6750 | len = 16 - len; |
| 6751 | if (len < 1) |
| 6752 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 6753 | else |
| 6754 | vty_out (vty, "%*s", len, " "); |
| 6755 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 6756 | vty_out (vty, "4 "); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6757 | |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 6758 | vty_out (vty, "%5u %7d %7d %8d %4d %4lu ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6759 | peer->as, |
| 6760 | peer->open_in + peer->update_in + peer->keepalive_in |
| 6761 | + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in, |
| 6762 | peer->open_out + peer->update_out + peer->keepalive_out |
| 6763 | + peer->notify_out + peer->refresh_out |
| 6764 | + peer->dynamic_cap_out, |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 6765 | 0, 0, (unsigned long) peer->obuf->count); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6766 | |
| 6767 | vty_out (vty, "%8s", |
| 6768 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); |
| 6769 | |
| 6770 | if (peer->status == Established) |
| 6771 | { |
| 6772 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); |
| 6773 | } |
| 6774 | else |
| 6775 | { |
| 6776 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) |
| 6777 | vty_out (vty, " Idle (Admin)"); |
| 6778 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 6779 | vty_out (vty, " Idle (PfxCt)"); |
| 6780 | else |
| 6781 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); |
| 6782 | } |
| 6783 | |
| 6784 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6785 | } |
| 6786 | } |
| 6787 | |
| 6788 | if (count) |
| 6789 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, |
| 6790 | count, VTY_NEWLINE); |
| 6791 | else |
| 6792 | vty_out (vty, "No %s neighbor is configured%s", |
| 6793 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 6794 | return CMD_SUCCESS; |
| 6795 | } |
| 6796 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 6797 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 6798 | bgp_show_summary_vty (struct vty *vty, const char *name, |
| 6799 | afi_t afi, safi_t safi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6800 | { |
| 6801 | struct bgp *bgp; |
| 6802 | |
| 6803 | if (name) |
| 6804 | { |
| 6805 | bgp = bgp_lookup_by_name (name); |
| 6806 | |
| 6807 | if (! bgp) |
| 6808 | { |
| 6809 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 6810 | return CMD_WARNING; |
| 6811 | } |
| 6812 | |
| 6813 | bgp_show_summary (vty, bgp, afi, safi); |
| 6814 | return CMD_SUCCESS; |
| 6815 | } |
| 6816 | |
| 6817 | bgp = bgp_get_default (); |
| 6818 | |
| 6819 | if (bgp) |
| 6820 | bgp_show_summary (vty, bgp, afi, safi); |
| 6821 | |
| 6822 | return CMD_SUCCESS; |
| 6823 | } |
| 6824 | |
| 6825 | /* `show ip bgp summary' commands. */ |
| 6826 | DEFUN (show_ip_bgp_summary, |
| 6827 | show_ip_bgp_summary_cmd, |
| 6828 | "show ip bgp summary", |
| 6829 | SHOW_STR |
| 6830 | IP_STR |
| 6831 | BGP_STR |
| 6832 | "Summary of BGP neighbor status\n") |
| 6833 | { |
| 6834 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 6835 | } |
| 6836 | |
| 6837 | DEFUN (show_ip_bgp_instance_summary, |
| 6838 | show_ip_bgp_instance_summary_cmd, |
| 6839 | "show ip bgp view WORD summary", |
| 6840 | SHOW_STR |
| 6841 | IP_STR |
| 6842 | BGP_STR |
| 6843 | "BGP view\n" |
| 6844 | "View name\n" |
| 6845 | "Summary of BGP neighbor status\n") |
| 6846 | { |
| 6847 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 6848 | } |
| 6849 | |
| 6850 | DEFUN (show_ip_bgp_ipv4_summary, |
| 6851 | show_ip_bgp_ipv4_summary_cmd, |
| 6852 | "show ip bgp ipv4 (unicast|multicast) summary", |
| 6853 | SHOW_STR |
| 6854 | IP_STR |
| 6855 | BGP_STR |
| 6856 | "Address family\n" |
| 6857 | "Address Family modifier\n" |
| 6858 | "Address Family modifier\n" |
| 6859 | "Summary of BGP neighbor status\n") |
| 6860 | { |
| 6861 | if (strncmp (argv[0], "m", 1) == 0) |
| 6862 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 6863 | |
| 6864 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 6865 | } |
| 6866 | |
| 6867 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
| 6868 | show_ip_bgp_instance_ipv4_summary_cmd, |
| 6869 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", |
| 6870 | SHOW_STR |
| 6871 | IP_STR |
| 6872 | BGP_STR |
| 6873 | "BGP view\n" |
| 6874 | "View name\n" |
| 6875 | "Address family\n" |
| 6876 | "Address Family modifier\n" |
| 6877 | "Address Family modifier\n" |
| 6878 | "Summary of BGP neighbor status\n") |
| 6879 | { |
| 6880 | if (strncmp (argv[1], "m", 1) == 0) |
| 6881 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 6882 | else |
| 6883 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 6884 | } |
| 6885 | |
| 6886 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
| 6887 | show_ip_bgp_vpnv4_all_summary_cmd, |
| 6888 | "show ip bgp vpnv4 all summary", |
| 6889 | SHOW_STR |
| 6890 | IP_STR |
| 6891 | BGP_STR |
| 6892 | "Display VPNv4 NLRI specific information\n" |
| 6893 | "Display information about all VPNv4 NLRIs\n" |
| 6894 | "Summary of BGP neighbor status\n") |
| 6895 | { |
| 6896 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 6897 | } |
| 6898 | |
| 6899 | DEFUN (show_ip_bgp_vpnv4_rd_summary, |
| 6900 | show_ip_bgp_vpnv4_rd_summary_cmd, |
| 6901 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", |
| 6902 | SHOW_STR |
| 6903 | IP_STR |
| 6904 | BGP_STR |
| 6905 | "Display VPNv4 NLRI specific information\n" |
| 6906 | "Display information for a route distinguisher\n" |
| 6907 | "VPN Route Distinguisher\n" |
| 6908 | "Summary of BGP neighbor status\n") |
| 6909 | { |
| 6910 | int ret; |
| 6911 | struct prefix_rd prd; |
| 6912 | |
| 6913 | ret = str2prefix_rd (argv[0], &prd); |
| 6914 | if (! ret) |
| 6915 | { |
| 6916 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); |
| 6917 | return CMD_WARNING; |
| 6918 | } |
| 6919 | |
| 6920 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); |
| 6921 | } |
| 6922 | |
| 6923 | #ifdef HAVE_IPV6 |
| 6924 | DEFUN (show_bgp_summary, |
| 6925 | show_bgp_summary_cmd, |
| 6926 | "show bgp summary", |
| 6927 | SHOW_STR |
| 6928 | BGP_STR |
| 6929 | "Summary of BGP neighbor status\n") |
| 6930 | { |
| 6931 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 6932 | } |
| 6933 | |
| 6934 | DEFUN (show_bgp_instance_summary, |
| 6935 | show_bgp_instance_summary_cmd, |
| 6936 | "show bgp view WORD summary", |
| 6937 | SHOW_STR |
| 6938 | BGP_STR |
| 6939 | "BGP view\n" |
| 6940 | "View name\n" |
| 6941 | "Summary of BGP neighbor status\n") |
| 6942 | { |
| 6943 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 6944 | } |
| 6945 | |
| 6946 | ALIAS (show_bgp_summary, |
| 6947 | show_bgp_ipv6_summary_cmd, |
| 6948 | "show bgp ipv6 summary", |
| 6949 | SHOW_STR |
| 6950 | BGP_STR |
| 6951 | "Address family\n" |
| 6952 | "Summary of BGP neighbor status\n") |
| 6953 | |
| 6954 | ALIAS (show_bgp_instance_summary, |
| 6955 | show_bgp_instance_ipv6_summary_cmd, |
| 6956 | "show bgp view WORD ipv6 summary", |
| 6957 | SHOW_STR |
| 6958 | BGP_STR |
| 6959 | "BGP view\n" |
| 6960 | "View name\n" |
| 6961 | "Address family\n" |
| 6962 | "Summary of BGP neighbor status\n") |
| 6963 | |
| 6964 | /* old command */ |
| 6965 | DEFUN (show_ipv6_bgp_summary, |
| 6966 | show_ipv6_bgp_summary_cmd, |
| 6967 | "show ipv6 bgp summary", |
| 6968 | SHOW_STR |
| 6969 | IPV6_STR |
| 6970 | BGP_STR |
| 6971 | "Summary of BGP neighbor status\n") |
| 6972 | { |
| 6973 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 6974 | } |
| 6975 | |
| 6976 | /* old command */ |
| 6977 | DEFUN (show_ipv6_mbgp_summary, |
| 6978 | show_ipv6_mbgp_summary_cmd, |
| 6979 | "show ipv6 mbgp summary", |
| 6980 | SHOW_STR |
| 6981 | IPV6_STR |
| 6982 | MBGP_STR |
| 6983 | "Summary of BGP neighbor status\n") |
| 6984 | { |
| 6985 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); |
| 6986 | } |
| 6987 | #endif /* HAVE_IPV6 */ |
| 6988 | |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 6989 | const char * |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 6990 | afi_safi_print (afi_t afi, safi_t safi) |
| 6991 | { |
| 6992 | if (afi == AFI_IP && safi == SAFI_UNICAST) |
| 6993 | return "IPv4 Unicast"; |
| 6994 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) |
| 6995 | return "IPv4 Multicast"; |
| 6996 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) |
| 6997 | return "VPNv4 Unicast"; |
| 6998 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) |
| 6999 | return "IPv6 Unicast"; |
| 7000 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) |
| 7001 | return "IPv6 Multicast"; |
| 7002 | else |
| 7003 | return "Unknown"; |
| 7004 | } |
| 7005 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7006 | /* Show BGP peer's information. */ |
| 7007 | enum show_type |
| 7008 | { |
| 7009 | show_all, |
| 7010 | show_peer |
| 7011 | }; |
| 7012 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7013 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7014 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
| 7015 | afi_t afi, safi_t safi, |
| 7016 | u_int16_t adv_smcap, u_int16_t adv_rmcap, |
| 7017 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) |
| 7018 | { |
| 7019 | /* Send-Mode */ |
| 7020 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) |
| 7021 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 7022 | { |
| 7023 | vty_out (vty, " Send-mode: "); |
| 7024 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) |
| 7025 | vty_out (vty, "advertised"); |
| 7026 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) |
| 7027 | vty_out (vty, "%sreceived", |
| 7028 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? |
| 7029 | ", " : ""); |
| 7030 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7031 | } |
| 7032 | |
| 7033 | /* Receive-Mode */ |
| 7034 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) |
| 7035 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 7036 | { |
| 7037 | vty_out (vty, " Receive-mode: "); |
| 7038 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) |
| 7039 | vty_out (vty, "advertised"); |
| 7040 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) |
| 7041 | vty_out (vty, "%sreceived", |
| 7042 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? |
| 7043 | ", " : ""); |
| 7044 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7045 | } |
| 7046 | } |
| 7047 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7048 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7049 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
| 7050 | { |
| 7051 | struct bgp_filter *filter; |
| 7052 | char orf_pfx_name[BUFSIZ]; |
| 7053 | int orf_pfx_count; |
| 7054 | |
| 7055 | filter = &p->filter[afi][safi]; |
| 7056 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7057 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7058 | VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7059 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7060 | if (p->af_group[afi][safi]) |
| 7061 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
| 7062 | |
| 7063 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7064 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 7065 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 7066 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7067 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) |
| 7068 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 7069 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); |
| 7070 | |
| 7071 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7072 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) |
| 7073 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7074 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) |
| 7075 | { |
| 7076 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 7077 | ORF_TYPE_PREFIX, VTY_NEWLINE); |
| 7078 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 7079 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 7080 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 7081 | PEER_CAP_ORF_PREFIX_SM_RCV, |
| 7082 | PEER_CAP_ORF_PREFIX_RM_RCV); |
| 7083 | } |
| 7084 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
| 7085 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) |
| 7086 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) |
| 7087 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) |
| 7088 | { |
| 7089 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", |
| 7090 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); |
| 7091 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, |
| 7092 | PEER_CAP_ORF_PREFIX_SM_ADV, |
| 7093 | PEER_CAP_ORF_PREFIX_RM_ADV, |
| 7094 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, |
| 7095 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); |
| 7096 | } |
| 7097 | |
| 7098 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
| 7099 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); |
| 7100 | |
| 7101 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
| 7102 | || orf_pfx_count) |
| 7103 | { |
| 7104 | vty_out (vty, " Outbound Route Filter (ORF):"); |
| 7105 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) |
| 7106 | vty_out (vty, " sent;"); |
| 7107 | if (orf_pfx_count) |
| 7108 | vty_out (vty, " received (%d entries)", orf_pfx_count); |
| 7109 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7110 | } |
| 7111 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) |
| 7112 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); |
| 7113 | |
| 7114 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) |
| 7115 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); |
| 7116 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 7117 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); |
| 7118 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) |
| 7119 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); |
| 7120 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
| 7121 | vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE); |
| 7122 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) |
| 7123 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); |
| 7124 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) |
| 7125 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7126 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) |
| 7127 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7128 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) |
| 7129 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); |
| 7130 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 7131 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
| 7132 | { |
| 7133 | vty_out (vty, " Community attribute sent to this neighbor"); |
| 7134 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
| 7135 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7136 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7137 | 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] | 7138 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7139 | else |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7140 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7141 | } |
| 7142 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) |
| 7143 | { |
| 7144 | vty_out (vty, " Default information originate,"); |
| 7145 | |
| 7146 | if (p->default_rmap[afi][safi].name) |
| 7147 | vty_out (vty, " default route-map %s%s,", |
| 7148 | p->default_rmap[afi][safi].map ? "*" : "", |
| 7149 | p->default_rmap[afi][safi].name); |
| 7150 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) |
| 7151 | vty_out (vty, " default sent%s", VTY_NEWLINE); |
| 7152 | else |
| 7153 | vty_out (vty, " default not sent%s", VTY_NEWLINE); |
| 7154 | } |
| 7155 | |
| 7156 | if (filter->plist[FILTER_IN].name |
| 7157 | || filter->dlist[FILTER_IN].name |
| 7158 | || filter->aslist[FILTER_IN].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7159 | || filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7160 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
| 7161 | if (filter->plist[FILTER_OUT].name |
| 7162 | || filter->dlist[FILTER_OUT].name |
| 7163 | || filter->aslist[FILTER_OUT].name |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7164 | || filter->map[RMAP_OUT].name |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7165 | || filter->usmap.name) |
| 7166 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7167 | if (filter->map[RMAP_IMPORT].name) |
| 7168 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); |
| 7169 | if (filter->map[RMAP_EXPORT].name) |
| 7170 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7171 | |
| 7172 | /* prefix-list */ |
| 7173 | if (filter->plist[FILTER_IN].name) |
| 7174 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", |
| 7175 | filter->plist[FILTER_IN].plist ? "*" : "", |
| 7176 | filter->plist[FILTER_IN].name, |
| 7177 | VTY_NEWLINE); |
| 7178 | if (filter->plist[FILTER_OUT].name) |
| 7179 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", |
| 7180 | filter->plist[FILTER_OUT].plist ? "*" : "", |
| 7181 | filter->plist[FILTER_OUT].name, |
| 7182 | VTY_NEWLINE); |
| 7183 | |
| 7184 | /* distribute-list */ |
| 7185 | if (filter->dlist[FILTER_IN].name) |
| 7186 | vty_out (vty, " Incoming update network filter list is %s%s%s", |
| 7187 | filter->dlist[FILTER_IN].alist ? "*" : "", |
| 7188 | filter->dlist[FILTER_IN].name, |
| 7189 | VTY_NEWLINE); |
| 7190 | if (filter->dlist[FILTER_OUT].name) |
| 7191 | vty_out (vty, " Outgoing update network filter list is %s%s%s", |
| 7192 | filter->dlist[FILTER_OUT].alist ? "*" : "", |
| 7193 | filter->dlist[FILTER_OUT].name, |
| 7194 | VTY_NEWLINE); |
| 7195 | |
| 7196 | /* filter-list. */ |
| 7197 | if (filter->aslist[FILTER_IN].name) |
| 7198 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", |
| 7199 | filter->aslist[FILTER_IN].aslist ? "*" : "", |
| 7200 | filter->aslist[FILTER_IN].name, |
| 7201 | VTY_NEWLINE); |
| 7202 | if (filter->aslist[FILTER_OUT].name) |
| 7203 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", |
| 7204 | filter->aslist[FILTER_OUT].aslist ? "*" : "", |
| 7205 | filter->aslist[FILTER_OUT].name, |
| 7206 | VTY_NEWLINE); |
| 7207 | |
| 7208 | /* route-map. */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7209 | if (filter->map[RMAP_IN].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7210 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7211 | filter->map[RMAP_IN].map ? "*" : "", |
| 7212 | filter->map[RMAP_IN].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7213 | VTY_NEWLINE); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7214 | if (filter->map[RMAP_OUT].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7215 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7216 | filter->map[RMAP_OUT].map ? "*" : "", |
| 7217 | filter->map[RMAP_OUT].name, |
| 7218 | VTY_NEWLINE); |
| 7219 | if (filter->map[RMAP_IMPORT].name) |
| 7220 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", |
| 7221 | filter->map[RMAP_IMPORT].map ? "*" : "", |
| 7222 | filter->map[RMAP_IMPORT].name, |
| 7223 | VTY_NEWLINE); |
| 7224 | if (filter->map[RMAP_EXPORT].name) |
| 7225 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", |
| 7226 | filter->map[RMAP_EXPORT].map ? "*" : "", |
| 7227 | filter->map[RMAP_EXPORT].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7228 | VTY_NEWLINE); |
| 7229 | |
| 7230 | /* unsuppress-map */ |
| 7231 | if (filter->usmap.name) |
| 7232 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", |
| 7233 | filter->usmap.map ? "*" : "", |
| 7234 | filter->usmap.name, VTY_NEWLINE); |
| 7235 | |
| 7236 | /* Receive prefix count */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7237 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
| 7238 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7239 | /* Maximum prefix */ |
| 7240 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) |
| 7241 | { |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7242 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7243 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 7244 | ? " (warning-only)" : "", VTY_NEWLINE); |
| 7245 | vty_out (vty, " Threshold for warning message %d%%", |
| 7246 | p->pmax_threshold[afi][safi]); |
| 7247 | if (p->pmax_restart[afi][safi]) |
| 7248 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); |
| 7249 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7250 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7251 | |
| 7252 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7253 | } |
| 7254 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7255 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7256 | bgp_show_peer (struct vty *vty, struct peer *p) |
| 7257 | { |
| 7258 | struct bgp *bgp; |
| 7259 | char buf1[BUFSIZ]; |
| 7260 | char timebuf[BGP_UPTIME_LEN]; |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7261 | afi_t afi; |
| 7262 | safi_t safi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7263 | |
| 7264 | bgp = p->bgp; |
| 7265 | |
| 7266 | /* Configured IP address. */ |
| 7267 | vty_out (vty, "BGP neighbor is %s, ", p->host); |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 7268 | vty_out (vty, "remote AS %u, ", p->as); |
| 7269 | vty_out (vty, "local AS %u%s, ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7270 | p->change_local_as ? p->change_local_as : p->local_as, |
| 7271 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? |
| 7272 | " no-prepend" : ""); |
| 7273 | vty_out (vty, "%s link%s", |
| 7274 | p->as == p->local_as ? "internal" : "external", |
| 7275 | VTY_NEWLINE); |
| 7276 | |
| 7277 | /* Description. */ |
| 7278 | if (p->desc) |
| 7279 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); |
| 7280 | |
| 7281 | /* Peer-group */ |
| 7282 | if (p->group) |
| 7283 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
| 7284 | p->group->name, VTY_NEWLINE); |
| 7285 | |
| 7286 | /* Administrative shutdown. */ |
| 7287 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) |
| 7288 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); |
| 7289 | |
| 7290 | /* BGP Version. */ |
| 7291 | vty_out (vty, " BGP version 4"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7292 | vty_out (vty, ", remote router ID %s%s", |
| 7293 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), |
| 7294 | VTY_NEWLINE); |
| 7295 | |
| 7296 | /* Confederation */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7297 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
| 7298 | && bgp_confederation_peers_check (bgp, p->as)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7299 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
| 7300 | |
| 7301 | /* Status. */ |
| 7302 | vty_out (vty, " BGP state = %s", |
| 7303 | LOOKUP (bgp_status_msg, p->status)); |
| 7304 | if (p->status == Established) |
| 7305 | vty_out (vty, ", up for %8s", |
| 7306 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7307 | else if (p->status == Active) |
| 7308 | { |
| 7309 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) |
| 7310 | vty_out (vty, " (passive)"); |
| 7311 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) |
| 7312 | vty_out (vty, " (NSF passive)"); |
| 7313 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7314 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7315 | |
| 7316 | /* read timer */ |
| 7317 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); |
| 7318 | |
| 7319 | /* Configured timer values. */ |
| 7320 | vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s", |
| 7321 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); |
| 7322 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) |
| 7323 | { |
| 7324 | vty_out (vty, " Configured hold time is %d", p->holdtime); |
| 7325 | vty_out (vty, ", keepalive interval is %d seconds%s", |
| 7326 | p->keepalive, VTY_NEWLINE); |
| 7327 | } |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7328 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7329 | /* Capability. */ |
| 7330 | if (p->status == Established) |
| 7331 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7332 | if (p->cap |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7333 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
| 7334 | || p->afc_recv[AFI_IP][SAFI_UNICAST] |
| 7335 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] |
| 7336 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] |
| 7337 | #ifdef HAVE_IPV6 |
| 7338 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] |
| 7339 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] |
| 7340 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] |
| 7341 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] |
| 7342 | #endif /* HAVE_IPV6 */ |
| 7343 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] |
| 7344 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) |
| 7345 | { |
| 7346 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); |
| 7347 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7348 | /* AS4 */ |
| 7349 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) |
| 7350 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) |
| 7351 | { |
| 7352 | vty_out (vty, " 4 Byte AS:"); |
| 7353 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) |
| 7354 | vty_out (vty, " advertised"); |
| 7355 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) |
| 7356 | vty_out (vty, " %sreceived", |
| 7357 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); |
| 7358 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7359 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7360 | /* Dynamic */ |
| 7361 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) |
| 7362 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7363 | { |
| 7364 | vty_out (vty, " Dynamic:"); |
| 7365 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) |
| 7366 | vty_out (vty, " advertised"); |
| 7367 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7368 | vty_out (vty, " %sreceived", |
| 7369 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7370 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7371 | } |
| 7372 | |
| 7373 | /* Route Refresh */ |
| 7374 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) |
| 7375 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7376 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
| 7377 | { |
| 7378 | vty_out (vty, " Route refresh:"); |
| 7379 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) |
| 7380 | vty_out (vty, " advertised"); |
| 7381 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) |
| 7382 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7383 | vty_out (vty, " %sreceived(%s)", |
| 7384 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", |
| 7385 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) |
| 7386 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? |
| 7387 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); |
| 7388 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7389 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7390 | } |
| 7391 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7392 | /* Multiprotocol Extensions */ |
| 7393 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7394 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7395 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7396 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7397 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
| 7398 | if (p->afc_adv[afi][safi]) |
| 7399 | vty_out (vty, " advertised"); |
| 7400 | if (p->afc_recv[afi][safi]) |
| 7401 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); |
| 7402 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7403 | } |
| 7404 | |
| 7405 | /* Gracefull Restart */ |
| 7406 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7407 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7408 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7409 | vty_out (vty, " Graceful Restart Capabilty:"); |
| 7410 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7411 | vty_out (vty, " advertised"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7412 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
| 7413 | vty_out (vty, " %sreceived", |
| 7414 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7415 | vty_out (vty, "%s", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7416 | |
| 7417 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7418 | { |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7419 | int restart_af_count = 0; |
| 7420 | |
| 7421 | vty_out (vty, " Remote Restart timer is %d seconds%s", |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7422 | p->v_gr_restart, VTY_NEWLINE); |
| 7423 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7424 | |
| 7425 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7426 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7427 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) |
| 7428 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7429 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
| 7430 | afi_safi_print (afi, safi), |
| 7431 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? |
| 7432 | "preserved" : "not preserved"); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7433 | restart_af_count++; |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7434 | } |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7435 | if (! restart_af_count) |
| 7436 | vty_out (vty, "none"); |
| 7437 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7438 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7439 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7440 | } |
| 7441 | } |
| 7442 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7443 | /* graceful restart information */ |
| 7444 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) |
| 7445 | || p->t_gr_restart |
| 7446 | || p->t_gr_stale) |
| 7447 | { |
| 7448 | int eor_send_af_count = 0; |
| 7449 | int eor_receive_af_count = 0; |
| 7450 | |
| 7451 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); |
| 7452 | if (p->status == Established) |
| 7453 | { |
| 7454 | vty_out (vty, " End-of-RIB send: "); |
| 7455 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7456 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7457 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) |
| 7458 | { |
| 7459 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", |
| 7460 | afi_safi_print (afi, safi)); |
| 7461 | eor_send_af_count++; |
| 7462 | } |
| 7463 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7464 | |
| 7465 | vty_out (vty, " End-of-RIB received: "); |
| 7466 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7467 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7468 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) |
| 7469 | { |
| 7470 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", |
| 7471 | afi_safi_print (afi, safi)); |
| 7472 | eor_receive_af_count++; |
| 7473 | } |
| 7474 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7475 | } |
| 7476 | |
| 7477 | if (p->t_gr_restart) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7478 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
| 7479 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); |
| 7480 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7481 | if (p->t_gr_stale) |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7482 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
| 7483 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7484 | } |
| 7485 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7486 | /* Packet counts. */ |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7487 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
| 7488 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7489 | 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] | 7490 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
| 7491 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); |
| 7492 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); |
| 7493 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); |
| 7494 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); |
| 7495 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); |
| 7496 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); |
| 7497 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + |
| 7498 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, |
| 7499 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + |
| 7500 | p->dynamic_cap_in, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7501 | |
| 7502 | /* advertisement-interval */ |
| 7503 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", |
| 7504 | p->v_routeadv, VTY_NEWLINE); |
| 7505 | |
| 7506 | /* Update-source. */ |
| 7507 | if (p->update_if || p->update_source) |
| 7508 | { |
| 7509 | vty_out (vty, " Update source is "); |
| 7510 | if (p->update_if) |
| 7511 | vty_out (vty, "%s", p->update_if); |
| 7512 | else if (p->update_source) |
| 7513 | vty_out (vty, "%s", |
| 7514 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); |
| 7515 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7516 | } |
| 7517 | |
| 7518 | /* Default weight */ |
| 7519 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) |
| 7520 | vty_out (vty, " Default weight %d%s", p->weight, |
| 7521 | VTY_NEWLINE); |
| 7522 | |
| 7523 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7524 | |
| 7525 | /* Address Family Information */ |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 7526 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
| 7527 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) |
| 7528 | if (p->afc[afi][safi]) |
| 7529 | bgp_show_peer_afi (vty, p, afi, safi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7530 | |
| 7531 | vty_out (vty, " Connections established %d; dropped %d%s", |
| 7532 | p->established, p->dropped, |
| 7533 | VTY_NEWLINE); |
| 7534 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 7535 | if (! p->dropped) |
| 7536 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); |
| 7537 | else |
| 7538 | vty_out (vty, " Last reset %s, due to %s%s", |
| 7539 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), |
| 7540 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 7541 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7542 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 7543 | { |
| 7544 | 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] | 7545 | |
| 7546 | if (p->t_pmax_restart) |
| 7547 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", |
| 7548 | p->host, thread_timer_remain_second (p->t_pmax_restart), |
| 7549 | VTY_NEWLINE); |
| 7550 | else |
| 7551 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", |
| 7552 | p->host, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7553 | } |
| 7554 | |
| 7555 | /* EBGP Multihop */ |
| 7556 | if (peer_sort (p) != BGP_PEER_IBGP && p->ttl > 1) |
| 7557 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", |
| 7558 | p->ttl, VTY_NEWLINE); |
| 7559 | |
| 7560 | /* Local address. */ |
| 7561 | if (p->su_local) |
| 7562 | { |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 7563 | vty_out (vty, "Local host: %s, Local port: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7564 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
| 7565 | ntohs (p->su_local->sin.sin_port), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7566 | VTY_NEWLINE); |
| 7567 | } |
| 7568 | |
| 7569 | /* Remote address. */ |
| 7570 | if (p->su_remote) |
| 7571 | { |
| 7572 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", |
| 7573 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
| 7574 | ntohs (p->su_remote->sin.sin_port), |
| 7575 | VTY_NEWLINE); |
| 7576 | } |
| 7577 | |
| 7578 | /* Nexthop display. */ |
| 7579 | if (p->su_local) |
| 7580 | { |
| 7581 | vty_out (vty, "Nexthop: %s%s", |
| 7582 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), |
| 7583 | VTY_NEWLINE); |
| 7584 | #ifdef HAVE_IPV6 |
| 7585 | vty_out (vty, "Nexthop global: %s%s", |
| 7586 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), |
| 7587 | VTY_NEWLINE); |
| 7588 | vty_out (vty, "Nexthop local: %s%s", |
| 7589 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), |
| 7590 | VTY_NEWLINE); |
| 7591 | vty_out (vty, "BGP connection: %s%s", |
| 7592 | p->shared_network ? "shared network" : "non shared network", |
| 7593 | VTY_NEWLINE); |
| 7594 | #endif /* HAVE_IPV6 */ |
| 7595 | } |
| 7596 | |
| 7597 | /* Timer information. */ |
| 7598 | if (p->t_start) |
| 7599 | vty_out (vty, "Next start timer due in %ld seconds%s", |
| 7600 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); |
| 7601 | if (p->t_connect) |
| 7602 | vty_out (vty, "Next connect timer due in %ld seconds%s", |
| 7603 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); |
| 7604 | |
| 7605 | vty_out (vty, "Read thread: %s Write thread: %s%s", |
| 7606 | p->t_read ? "on" : "off", |
| 7607 | p->t_write ? "on" : "off", |
| 7608 | VTY_NEWLINE); |
| 7609 | |
| 7610 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR |
| 7611 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) |
| 7612 | bgp_capability_vty_out (vty, p); |
| 7613 | |
| 7614 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7615 | } |
| 7616 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7617 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7618 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
| 7619 | enum show_type type, union sockunion *su) |
| 7620 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7621 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7622 | struct peer *peer; |
| 7623 | int find = 0; |
| 7624 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7625 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7626 | { |
| 7627 | switch (type) |
| 7628 | { |
| 7629 | case show_all: |
| 7630 | bgp_show_peer (vty, peer); |
| 7631 | break; |
| 7632 | case show_peer: |
| 7633 | if (sockunion_same (&peer->su, su)) |
| 7634 | { |
| 7635 | find = 1; |
| 7636 | bgp_show_peer (vty, peer); |
| 7637 | } |
| 7638 | break; |
| 7639 | } |
| 7640 | } |
| 7641 | |
| 7642 | if (type == show_peer && ! find) |
| 7643 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); |
| 7644 | |
| 7645 | return CMD_SUCCESS; |
| 7646 | } |
| 7647 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7648 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7649 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
| 7650 | enum show_type type, const char *ip_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7651 | { |
| 7652 | int ret; |
| 7653 | struct bgp *bgp; |
| 7654 | union sockunion su; |
| 7655 | |
| 7656 | if (ip_str) |
| 7657 | { |
| 7658 | ret = str2sockunion (ip_str, &su); |
| 7659 | if (ret < 0) |
| 7660 | { |
| 7661 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); |
| 7662 | return CMD_WARNING; |
| 7663 | } |
| 7664 | } |
| 7665 | |
| 7666 | if (name) |
| 7667 | { |
| 7668 | bgp = bgp_lookup_by_name (name); |
| 7669 | |
| 7670 | if (! bgp) |
| 7671 | { |
| 7672 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 7673 | return CMD_WARNING; |
| 7674 | } |
| 7675 | |
| 7676 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7677 | |
| 7678 | return CMD_SUCCESS; |
| 7679 | } |
| 7680 | |
| 7681 | bgp = bgp_get_default (); |
| 7682 | |
| 7683 | if (bgp) |
| 7684 | bgp_show_neighbor (vty, bgp, type, &su); |
| 7685 | |
| 7686 | return CMD_SUCCESS; |
| 7687 | } |
| 7688 | |
| 7689 | /* "show ip bgp neighbors" commands. */ |
| 7690 | DEFUN (show_ip_bgp_neighbors, |
| 7691 | show_ip_bgp_neighbors_cmd, |
| 7692 | "show ip bgp neighbors", |
| 7693 | SHOW_STR |
| 7694 | IP_STR |
| 7695 | BGP_STR |
| 7696 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7697 | { |
| 7698 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); |
| 7699 | } |
| 7700 | |
| 7701 | ALIAS (show_ip_bgp_neighbors, |
| 7702 | show_ip_bgp_ipv4_neighbors_cmd, |
| 7703 | "show ip bgp ipv4 (unicast|multicast) neighbors", |
| 7704 | SHOW_STR |
| 7705 | IP_STR |
| 7706 | BGP_STR |
| 7707 | "Address family\n" |
| 7708 | "Address Family modifier\n" |
| 7709 | "Address Family modifier\n" |
| 7710 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7711 | |
| 7712 | ALIAS (show_ip_bgp_neighbors, |
| 7713 | show_ip_bgp_vpnv4_all_neighbors_cmd, |
| 7714 | "show ip bgp vpnv4 all neighbors", |
| 7715 | SHOW_STR |
| 7716 | IP_STR |
| 7717 | BGP_STR |
| 7718 | "Display VPNv4 NLRI specific information\n" |
| 7719 | "Display information about all VPNv4 NLRIs\n" |
| 7720 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7721 | |
| 7722 | ALIAS (show_ip_bgp_neighbors, |
| 7723 | show_ip_bgp_vpnv4_rd_neighbors_cmd, |
| 7724 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", |
| 7725 | SHOW_STR |
| 7726 | IP_STR |
| 7727 | BGP_STR |
| 7728 | "Display VPNv4 NLRI specific information\n" |
| 7729 | "Display information for a route distinguisher\n" |
| 7730 | "VPN Route Distinguisher\n" |
| 7731 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7732 | |
| 7733 | ALIAS (show_ip_bgp_neighbors, |
| 7734 | show_bgp_neighbors_cmd, |
| 7735 | "show bgp neighbors", |
| 7736 | SHOW_STR |
| 7737 | BGP_STR |
| 7738 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7739 | |
| 7740 | ALIAS (show_ip_bgp_neighbors, |
| 7741 | show_bgp_ipv6_neighbors_cmd, |
| 7742 | "show bgp ipv6 neighbors", |
| 7743 | SHOW_STR |
| 7744 | BGP_STR |
| 7745 | "Address family\n" |
| 7746 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7747 | |
| 7748 | DEFUN (show_ip_bgp_neighbors_peer, |
| 7749 | show_ip_bgp_neighbors_peer_cmd, |
| 7750 | "show ip bgp neighbors (A.B.C.D|X:X::X:X)", |
| 7751 | SHOW_STR |
| 7752 | IP_STR |
| 7753 | BGP_STR |
| 7754 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7755 | "Neighbor to display information about\n" |
| 7756 | "Neighbor to display information about\n") |
| 7757 | { |
| 7758 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); |
| 7759 | } |
| 7760 | |
| 7761 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7762 | show_ip_bgp_ipv4_neighbors_peer_cmd, |
| 7763 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)", |
| 7764 | SHOW_STR |
| 7765 | IP_STR |
| 7766 | BGP_STR |
| 7767 | "Address family\n" |
| 7768 | "Address Family modifier\n" |
| 7769 | "Address Family modifier\n" |
| 7770 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7771 | "Neighbor to display information about\n" |
| 7772 | "Neighbor to display information about\n") |
| 7773 | |
| 7774 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7775 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, |
| 7776 | "show ip bgp vpnv4 all neighbors A.B.C.D", |
| 7777 | SHOW_STR |
| 7778 | IP_STR |
| 7779 | BGP_STR |
| 7780 | "Display VPNv4 NLRI specific information\n" |
| 7781 | "Display information about all VPNv4 NLRIs\n" |
| 7782 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7783 | "Neighbor to display information about\n") |
| 7784 | |
| 7785 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7786 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, |
| 7787 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", |
| 7788 | SHOW_STR |
| 7789 | IP_STR |
| 7790 | BGP_STR |
| 7791 | "Display VPNv4 NLRI specific information\n" |
| 7792 | "Display information about all VPNv4 NLRIs\n" |
| 7793 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7794 | "Neighbor to display information about\n") |
| 7795 | |
| 7796 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7797 | show_bgp_neighbors_peer_cmd, |
| 7798 | "show bgp neighbors (A.B.C.D|X:X::X:X)", |
| 7799 | SHOW_STR |
| 7800 | BGP_STR |
| 7801 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7802 | "Neighbor to display information about\n" |
| 7803 | "Neighbor to display information about\n") |
| 7804 | |
| 7805 | ALIAS (show_ip_bgp_neighbors_peer, |
| 7806 | show_bgp_ipv6_neighbors_peer_cmd, |
| 7807 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 7808 | SHOW_STR |
| 7809 | BGP_STR |
| 7810 | "Address family\n" |
| 7811 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7812 | "Neighbor to display information about\n" |
| 7813 | "Neighbor to display information about\n") |
| 7814 | |
| 7815 | DEFUN (show_ip_bgp_instance_neighbors, |
| 7816 | show_ip_bgp_instance_neighbors_cmd, |
| 7817 | "show ip bgp view WORD neighbors", |
| 7818 | SHOW_STR |
| 7819 | IP_STR |
| 7820 | BGP_STR |
| 7821 | "BGP view\n" |
| 7822 | "View name\n" |
| 7823 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7824 | { |
| 7825 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); |
| 7826 | } |
| 7827 | |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 7828 | ALIAS (show_ip_bgp_instance_neighbors, |
| 7829 | show_bgp_instance_neighbors_cmd, |
| 7830 | "show bgp view WORD neighbors", |
| 7831 | SHOW_STR |
| 7832 | BGP_STR |
| 7833 | "BGP view\n" |
| 7834 | "View name\n" |
| 7835 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7836 | |
| 7837 | ALIAS (show_ip_bgp_instance_neighbors, |
| 7838 | show_bgp_instance_ipv6_neighbors_cmd, |
| 7839 | "show bgp view WORD ipv6 neighbors", |
| 7840 | SHOW_STR |
| 7841 | BGP_STR |
| 7842 | "BGP view\n" |
| 7843 | "View name\n" |
| 7844 | "Address family\n" |
| 7845 | "Detailed information on TCP and BGP neighbor connections\n") |
| 7846 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7847 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
| 7848 | show_ip_bgp_instance_neighbors_peer_cmd, |
| 7849 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 7850 | SHOW_STR |
| 7851 | IP_STR |
| 7852 | BGP_STR |
| 7853 | "BGP view\n" |
| 7854 | "View name\n" |
| 7855 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7856 | "Neighbor to display information about\n" |
| 7857 | "Neighbor to display information about\n") |
| 7858 | { |
| 7859 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); |
| 7860 | } |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 7861 | |
| 7862 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 7863 | show_bgp_instance_neighbors_peer_cmd, |
| 7864 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)", |
| 7865 | SHOW_STR |
| 7866 | BGP_STR |
| 7867 | "BGP view\n" |
| 7868 | "View name\n" |
| 7869 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7870 | "Neighbor to display information about\n" |
| 7871 | "Neighbor to display information about\n") |
| 7872 | |
| 7873 | ALIAS (show_ip_bgp_instance_neighbors_peer, |
| 7874 | show_bgp_instance_ipv6_neighbors_peer_cmd, |
| 7875 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)", |
| 7876 | SHOW_STR |
| 7877 | BGP_STR |
| 7878 | "BGP view\n" |
| 7879 | "View name\n" |
| 7880 | "Address family\n" |
| 7881 | "Detailed information on TCP and BGP neighbor connections\n" |
| 7882 | "Neighbor to display information about\n" |
| 7883 | "Neighbor to display information about\n") |
| 7884 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7885 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
| 7886 | paths' and `show ip mbgp paths'. Those functions results are the |
| 7887 | same.*/ |
| 7888 | DEFUN (show_ip_bgp_paths, |
| 7889 | show_ip_bgp_paths_cmd, |
| 7890 | "show ip bgp paths", |
| 7891 | SHOW_STR |
| 7892 | IP_STR |
| 7893 | BGP_STR |
| 7894 | "Path information\n") |
| 7895 | { |
| 7896 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); |
| 7897 | aspath_print_all_vty (vty); |
| 7898 | return CMD_SUCCESS; |
| 7899 | } |
| 7900 | |
| 7901 | DEFUN (show_ip_bgp_ipv4_paths, |
| 7902 | show_ip_bgp_ipv4_paths_cmd, |
| 7903 | "show ip bgp ipv4 (unicast|multicast) paths", |
| 7904 | SHOW_STR |
| 7905 | IP_STR |
| 7906 | BGP_STR |
| 7907 | "Address family\n" |
| 7908 | "Address Family modifier\n" |
| 7909 | "Address Family modifier\n" |
| 7910 | "Path information\n") |
| 7911 | { |
| 7912 | vty_out (vty, "Address Refcnt Path\r\n"); |
| 7913 | aspath_print_all_vty (vty); |
| 7914 | |
| 7915 | return CMD_SUCCESS; |
| 7916 | } |
| 7917 | |
| 7918 | #include "hash.h" |
| 7919 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7920 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7921 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
| 7922 | { |
| 7923 | struct community *com; |
| 7924 | |
| 7925 | com = (struct community *) backet->data; |
| 7926 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, |
| 7927 | community_str (com), VTY_NEWLINE); |
| 7928 | } |
| 7929 | |
| 7930 | /* Show BGP's community internal data. */ |
| 7931 | DEFUN (show_ip_bgp_community_info, |
| 7932 | show_ip_bgp_community_info_cmd, |
| 7933 | "show ip bgp community-info", |
| 7934 | SHOW_STR |
| 7935 | IP_STR |
| 7936 | BGP_STR |
| 7937 | "List all bgp community information\n") |
| 7938 | { |
| 7939 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); |
| 7940 | |
| 7941 | hash_iterate (community_hash (), |
| 7942 | (void (*) (struct hash_backet *, void *)) |
| 7943 | community_show_all_iterator, |
| 7944 | vty); |
| 7945 | |
| 7946 | return CMD_SUCCESS; |
| 7947 | } |
| 7948 | |
| 7949 | DEFUN (show_ip_bgp_attr_info, |
| 7950 | show_ip_bgp_attr_info_cmd, |
| 7951 | "show ip bgp attribute-info", |
| 7952 | SHOW_STR |
| 7953 | IP_STR |
| 7954 | BGP_STR |
| 7955 | "List all bgp attribute information\n") |
| 7956 | { |
| 7957 | attr_show_all (vty); |
| 7958 | return CMD_SUCCESS; |
| 7959 | } |
| 7960 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 7961 | static int |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7962 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
| 7963 | afi_t afi, safi_t safi) |
| 7964 | { |
| 7965 | char timebuf[BGP_UPTIME_LEN]; |
| 7966 | char rmbuf[14]; |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 7967 | const char *rmname; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7968 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7969 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7970 | int len; |
| 7971 | int count = 0; |
| 7972 | |
| 7973 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) |
| 7974 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7975 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7976 | { |
| 7977 | count++; |
| 7978 | bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 7979 | } |
| 7980 | return count; |
| 7981 | } |
| 7982 | |
| 7983 | len = vty_out (vty, "%s", rsclient->host); |
| 7984 | len = 16 - len; |
| 7985 | |
| 7986 | if (len < 1) |
| 7987 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); |
| 7988 | else |
| 7989 | vty_out (vty, "%*s", len, " "); |
| 7990 | |
hasso | 3d515fd | 2005-02-01 21:30:04 +0000 | [diff] [blame] | 7991 | vty_out (vty, "4 "); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7992 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 7993 | vty_out (vty, "%11d ", rsclient->as); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 7994 | |
| 7995 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); |
| 7996 | if ( rmname && strlen (rmname) > 13 ) |
| 7997 | { |
| 7998 | sprintf (rmbuf, "%13s", "..."); |
| 7999 | rmname = strncpy (rmbuf, rmname, 10); |
| 8000 | } |
| 8001 | else if (! rmname) |
| 8002 | rmname = "<none>"; |
| 8003 | vty_out (vty, " %13s ", rmname); |
| 8004 | |
| 8005 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); |
| 8006 | if ( rmname && strlen (rmname) > 13 ) |
| 8007 | { |
| 8008 | sprintf (rmbuf, "%13s", "..."); |
| 8009 | rmname = strncpy (rmbuf, rmname, 10); |
| 8010 | } |
| 8011 | else if (! rmname) |
| 8012 | rmname = "<none>"; |
| 8013 | vty_out (vty, " %13s ", rmname); |
| 8014 | |
| 8015 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); |
| 8016 | |
| 8017 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) |
| 8018 | vty_out (vty, " Idle (Admin)"); |
| 8019 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
| 8020 | vty_out (vty, " Idle (PfxCt)"); |
| 8021 | else |
| 8022 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); |
| 8023 | |
| 8024 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8025 | |
| 8026 | return 1; |
| 8027 | } |
| 8028 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8029 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8030 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
| 8031 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8032 | { |
| 8033 | struct peer *peer; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8034 | struct listnode *node, *nnode; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8035 | int count = 0; |
| 8036 | |
| 8037 | /* Header string for each address family. */ |
| 8038 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; |
| 8039 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8040 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8041 | { |
| 8042 | if (peer->afc[afi][safi] && |
| 8043 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) |
| 8044 | { |
| 8045 | if (! count) |
| 8046 | { |
| 8047 | vty_out (vty, |
| 8048 | "Route Server's BGP router identifier %s%s", |
| 8049 | inet_ntoa (bgp->router_id), VTY_NEWLINE); |
| 8050 | vty_out (vty, |
Denis Ovsienko | aea339f | 2009-04-30 17:16:22 +0400 | [diff] [blame] | 8051 | "Route Server's local AS number %u%s", bgp->as, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8052 | VTY_NEWLINE); |
| 8053 | |
| 8054 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8055 | vty_out (vty, "%s%s", header, VTY_NEWLINE); |
| 8056 | } |
| 8057 | |
| 8058 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); |
| 8059 | } |
| 8060 | } |
| 8061 | |
| 8062 | if (count) |
| 8063 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, |
| 8064 | count, VTY_NEWLINE); |
| 8065 | else |
| 8066 | vty_out (vty, "No %s Route Server Client is configured%s", |
| 8067 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
| 8068 | |
| 8069 | return CMD_SUCCESS; |
| 8070 | } |
| 8071 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8072 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8073 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
| 8074 | afi_t afi, safi_t safi) |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 8075 | { |
| 8076 | struct bgp *bgp; |
| 8077 | |
| 8078 | if (name) |
| 8079 | { |
| 8080 | bgp = bgp_lookup_by_name (name); |
| 8081 | |
| 8082 | if (! bgp) |
| 8083 | { |
| 8084 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
| 8085 | return CMD_WARNING; |
| 8086 | } |
| 8087 | |
| 8088 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 8089 | return CMD_SUCCESS; |
| 8090 | } |
| 8091 | |
| 8092 | bgp = bgp_get_default (); |
| 8093 | |
| 8094 | if (bgp) |
| 8095 | bgp_show_rsclient_summary (vty, bgp, afi, safi); |
| 8096 | |
| 8097 | return CMD_SUCCESS; |
| 8098 | } |
| 8099 | |
| 8100 | /* 'show bgp rsclient' commands. */ |
| 8101 | DEFUN (show_ip_bgp_rsclient_summary, |
| 8102 | show_ip_bgp_rsclient_summary_cmd, |
| 8103 | "show ip bgp rsclient summary", |
| 8104 | SHOW_STR |
| 8105 | IP_STR |
| 8106 | BGP_STR |
| 8107 | "Information about Route Server Clients\n" |
| 8108 | "Summary of all Route Server Clients\n") |
| 8109 | { |
| 8110 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 8111 | } |
| 8112 | |
| 8113 | DEFUN (show_ip_bgp_instance_rsclient_summary, |
| 8114 | show_ip_bgp_instance_rsclient_summary_cmd, |
| 8115 | "show ip bgp view WORD rsclient summary", |
| 8116 | SHOW_STR |
| 8117 | IP_STR |
| 8118 | BGP_STR |
| 8119 | "BGP view\n" |
| 8120 | "View name\n" |
| 8121 | "Information about Route Server Clients\n" |
| 8122 | "Summary of all Route Server Clients\n") |
| 8123 | { |
| 8124 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 8125 | } |
| 8126 | |
| 8127 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, |
| 8128 | show_ip_bgp_ipv4_rsclient_summary_cmd, |
| 8129 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", |
| 8130 | SHOW_STR |
| 8131 | IP_STR |
| 8132 | BGP_STR |
| 8133 | "Address family\n" |
| 8134 | "Address Family modifier\n" |
| 8135 | "Address Family modifier\n" |
| 8136 | "Information about Route Server Clients\n" |
| 8137 | "Summary of all Route Server Clients\n") |
| 8138 | { |
| 8139 | if (strncmp (argv[0], "m", 1) == 0) |
| 8140 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); |
| 8141 | |
| 8142 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); |
| 8143 | } |
| 8144 | |
| 8145 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, |
| 8146 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, |
| 8147 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", |
| 8148 | SHOW_STR |
| 8149 | IP_STR |
| 8150 | BGP_STR |
| 8151 | "BGP view\n" |
| 8152 | "View name\n" |
| 8153 | "Address family\n" |
| 8154 | "Address Family modifier\n" |
| 8155 | "Address Family modifier\n" |
| 8156 | "Information about Route Server Clients\n" |
| 8157 | "Summary of all Route Server Clients\n") |
| 8158 | { |
| 8159 | if (strncmp (argv[1], "m", 1) == 0) |
| 8160 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); |
| 8161 | |
| 8162 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); |
| 8163 | } |
| 8164 | |
| 8165 | #ifdef HAVE_IPV6 |
| 8166 | DEFUN (show_bgp_rsclient_summary, |
| 8167 | show_bgp_rsclient_summary_cmd, |
| 8168 | "show bgp rsclient summary", |
| 8169 | SHOW_STR |
| 8170 | BGP_STR |
| 8171 | "Information about Route Server Clients\n" |
| 8172 | "Summary of all Route Server Clients\n") |
| 8173 | { |
| 8174 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); |
| 8175 | } |
| 8176 | |
| 8177 | DEFUN (show_bgp_instance_rsclient_summary, |
| 8178 | show_bgp_instance_rsclient_summary_cmd, |
| 8179 | "show bgp view WORD rsclient summary", |
| 8180 | SHOW_STR |
| 8181 | BGP_STR |
| 8182 | "BGP view\n" |
| 8183 | "View name\n" |
| 8184 | "Information about Route Server Clients\n" |
| 8185 | "Summary of all Route Server Clients\n") |
| 8186 | { |
| 8187 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); |
| 8188 | } |
| 8189 | |
| 8190 | ALIAS (show_bgp_rsclient_summary, |
| 8191 | show_bgp_ipv6_rsclient_summary_cmd, |
| 8192 | "show bgp ipv6 rsclient summary", |
| 8193 | SHOW_STR |
| 8194 | BGP_STR |
| 8195 | "Address family\n" |
| 8196 | "Information about Route Server Clients\n" |
| 8197 | "Summary of all Route Server Clients\n") |
| 8198 | |
| 8199 | ALIAS (show_bgp_instance_rsclient_summary, |
| 8200 | show_bgp_instance_ipv6_rsclient_summary_cmd, |
| 8201 | "show bgp view WORD ipv6 rsclient summary", |
| 8202 | SHOW_STR |
| 8203 | BGP_STR |
| 8204 | "BGP view\n" |
| 8205 | "View name\n" |
| 8206 | "Address family\n" |
| 8207 | "Information about Route Server Clients\n" |
| 8208 | "Summary of all Route Server Clients\n") |
| 8209 | #endif /* HAVE IPV6 */ |
| 8210 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8211 | /* Redistribute VTY commands. */ |
| 8212 | |
| 8213 | /* Utility function to convert user input route type string to route |
| 8214 | type. */ |
| 8215 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 8216 | bgp_str2route_type (int afi, const char *str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8217 | { |
| 8218 | if (! str) |
| 8219 | return 0; |
| 8220 | |
| 8221 | if (afi == AFI_IP) |
| 8222 | { |
| 8223 | if (strncmp (str, "k", 1) == 0) |
| 8224 | return ZEBRA_ROUTE_KERNEL; |
| 8225 | else if (strncmp (str, "c", 1) == 0) |
| 8226 | return ZEBRA_ROUTE_CONNECT; |
| 8227 | else if (strncmp (str, "s", 1) == 0) |
| 8228 | return ZEBRA_ROUTE_STATIC; |
| 8229 | else if (strncmp (str, "r", 1) == 0) |
| 8230 | return ZEBRA_ROUTE_RIP; |
| 8231 | else if (strncmp (str, "o", 1) == 0) |
| 8232 | return ZEBRA_ROUTE_OSPF; |
| 8233 | } |
| 8234 | if (afi == AFI_IP6) |
| 8235 | { |
| 8236 | if (strncmp (str, "k", 1) == 0) |
| 8237 | return ZEBRA_ROUTE_KERNEL; |
| 8238 | else if (strncmp (str, "c", 1) == 0) |
| 8239 | return ZEBRA_ROUTE_CONNECT; |
| 8240 | else if (strncmp (str, "s", 1) == 0) |
| 8241 | return ZEBRA_ROUTE_STATIC; |
| 8242 | else if (strncmp (str, "r", 1) == 0) |
| 8243 | return ZEBRA_ROUTE_RIPNG; |
| 8244 | else if (strncmp (str, "o", 1) == 0) |
| 8245 | return ZEBRA_ROUTE_OSPF6; |
| 8246 | } |
| 8247 | return 0; |
| 8248 | } |
| 8249 | |
| 8250 | DEFUN (bgp_redistribute_ipv4, |
| 8251 | bgp_redistribute_ipv4_cmd, |
| 8252 | "redistribute (connected|kernel|ospf|rip|static)", |
| 8253 | "Redistribute information from another routing protocol\n" |
| 8254 | "Connected\n" |
| 8255 | "Kernel routes\n" |
| 8256 | "Open Shurtest Path First (OSPF)\n" |
| 8257 | "Routing Information Protocol (RIP)\n" |
| 8258 | "Static routes\n") |
| 8259 | { |
| 8260 | int type; |
| 8261 | |
| 8262 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8263 | if (! type) |
| 8264 | { |
| 8265 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8266 | return CMD_WARNING; |
| 8267 | } |
| 8268 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8269 | } |
| 8270 | |
| 8271 | DEFUN (bgp_redistribute_ipv4_rmap, |
| 8272 | bgp_redistribute_ipv4_rmap_cmd, |
| 8273 | "redistribute (connected|kernel|ospf|rip|static) route-map WORD", |
| 8274 | "Redistribute information from another routing protocol\n" |
| 8275 | "Connected\n" |
| 8276 | "Kernel routes\n" |
| 8277 | "Open Shurtest Path First (OSPF)\n" |
| 8278 | "Routing Information Protocol (RIP)\n" |
| 8279 | "Static routes\n" |
| 8280 | "Route map reference\n" |
| 8281 | "Pointer to route-map entries\n") |
| 8282 | { |
| 8283 | int type; |
| 8284 | |
| 8285 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8286 | if (! type) |
| 8287 | { |
| 8288 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8289 | return CMD_WARNING; |
| 8290 | } |
| 8291 | |
| 8292 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8293 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8294 | } |
| 8295 | |
| 8296 | DEFUN (bgp_redistribute_ipv4_metric, |
| 8297 | bgp_redistribute_ipv4_metric_cmd, |
| 8298 | "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", |
| 8299 | "Redistribute information from another routing protocol\n" |
| 8300 | "Connected\n" |
| 8301 | "Kernel routes\n" |
| 8302 | "Open Shurtest Path First (OSPF)\n" |
| 8303 | "Routing Information Protocol (RIP)\n" |
| 8304 | "Static routes\n" |
| 8305 | "Metric for redistributed routes\n" |
| 8306 | "Default metric\n") |
| 8307 | { |
| 8308 | int type; |
| 8309 | u_int32_t metric; |
| 8310 | |
| 8311 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8312 | if (! type) |
| 8313 | { |
| 8314 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8315 | return CMD_WARNING; |
| 8316 | } |
| 8317 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8318 | |
| 8319 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8320 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8321 | } |
| 8322 | |
| 8323 | DEFUN (bgp_redistribute_ipv4_rmap_metric, |
| 8324 | bgp_redistribute_ipv4_rmap_metric_cmd, |
| 8325 | "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", |
| 8326 | "Redistribute information from another routing protocol\n" |
| 8327 | "Connected\n" |
| 8328 | "Kernel routes\n" |
| 8329 | "Open Shurtest Path First (OSPF)\n" |
| 8330 | "Routing Information Protocol (RIP)\n" |
| 8331 | "Static routes\n" |
| 8332 | "Route map reference\n" |
| 8333 | "Pointer to route-map entries\n" |
| 8334 | "Metric for redistributed routes\n" |
| 8335 | "Default metric\n") |
| 8336 | { |
| 8337 | int type; |
| 8338 | u_int32_t metric; |
| 8339 | |
| 8340 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8341 | if (! type) |
| 8342 | { |
| 8343 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8344 | return CMD_WARNING; |
| 8345 | } |
| 8346 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8347 | |
| 8348 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); |
| 8349 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8350 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8351 | } |
| 8352 | |
| 8353 | DEFUN (bgp_redistribute_ipv4_metric_rmap, |
| 8354 | bgp_redistribute_ipv4_metric_rmap_cmd, |
| 8355 | "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", |
| 8356 | "Redistribute information from another routing protocol\n" |
| 8357 | "Connected\n" |
| 8358 | "Kernel routes\n" |
| 8359 | "Open Shurtest Path First (OSPF)\n" |
| 8360 | "Routing Information Protocol (RIP)\n" |
| 8361 | "Static routes\n" |
| 8362 | "Metric for redistributed routes\n" |
| 8363 | "Default metric\n" |
| 8364 | "Route map reference\n" |
| 8365 | "Pointer to route-map entries\n") |
| 8366 | { |
| 8367 | int type; |
| 8368 | u_int32_t metric; |
| 8369 | |
| 8370 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8371 | if (! type) |
| 8372 | { |
| 8373 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8374 | return CMD_WARNING; |
| 8375 | } |
| 8376 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8377 | |
| 8378 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); |
| 8379 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); |
| 8380 | return bgp_redistribute_set (vty->index, AFI_IP, type); |
| 8381 | } |
| 8382 | |
| 8383 | DEFUN (no_bgp_redistribute_ipv4, |
| 8384 | no_bgp_redistribute_ipv4_cmd, |
| 8385 | "no redistribute (connected|kernel|ospf|rip|static)", |
| 8386 | NO_STR |
| 8387 | "Redistribute information from another routing protocol\n" |
| 8388 | "Connected\n" |
| 8389 | "Kernel routes\n" |
| 8390 | "Open Shurtest Path First (OSPF)\n" |
| 8391 | "Routing Information Protocol (RIP)\n" |
| 8392 | "Static routes\n") |
| 8393 | { |
| 8394 | int type; |
| 8395 | |
| 8396 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8397 | if (! type) |
| 8398 | { |
| 8399 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8400 | return CMD_WARNING; |
| 8401 | } |
| 8402 | |
| 8403 | return bgp_redistribute_unset (vty->index, AFI_IP, type); |
| 8404 | } |
| 8405 | |
| 8406 | DEFUN (no_bgp_redistribute_ipv4_rmap, |
| 8407 | no_bgp_redistribute_ipv4_rmap_cmd, |
| 8408 | "no redistribute (connected|kernel|ospf|rip|static) route-map WORD", |
| 8409 | NO_STR |
| 8410 | "Redistribute information from another routing protocol\n" |
| 8411 | "Connected\n" |
| 8412 | "Kernel routes\n" |
| 8413 | "Open Shurtest Path First (OSPF)\n" |
| 8414 | "Routing Information Protocol (RIP)\n" |
| 8415 | "Static routes\n" |
| 8416 | "Route map reference\n" |
| 8417 | "Pointer to route-map entries\n") |
| 8418 | { |
| 8419 | int type; |
| 8420 | |
| 8421 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8422 | if (! type) |
| 8423 | { |
| 8424 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8425 | return CMD_WARNING; |
| 8426 | } |
| 8427 | |
| 8428 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8429 | return CMD_SUCCESS; |
| 8430 | } |
| 8431 | |
| 8432 | DEFUN (no_bgp_redistribute_ipv4_metric, |
| 8433 | no_bgp_redistribute_ipv4_metric_cmd, |
| 8434 | "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", |
| 8435 | NO_STR |
| 8436 | "Redistribute information from another routing protocol\n" |
| 8437 | "Connected\n" |
| 8438 | "Kernel routes\n" |
| 8439 | "Open Shurtest Path First (OSPF)\n" |
| 8440 | "Routing Information Protocol (RIP)\n" |
| 8441 | "Static routes\n" |
| 8442 | "Metric for redistributed routes\n" |
| 8443 | "Default metric\n") |
| 8444 | { |
| 8445 | int type; |
| 8446 | |
| 8447 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8448 | if (! type) |
| 8449 | { |
| 8450 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8451 | return CMD_WARNING; |
| 8452 | } |
| 8453 | |
| 8454 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8455 | return CMD_SUCCESS; |
| 8456 | } |
| 8457 | |
| 8458 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, |
| 8459 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
| 8460 | "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", |
| 8461 | NO_STR |
| 8462 | "Redistribute information from another routing protocol\n" |
| 8463 | "Connected\n" |
| 8464 | "Kernel routes\n" |
| 8465 | "Open Shurtest Path First (OSPF)\n" |
| 8466 | "Routing Information Protocol (RIP)\n" |
| 8467 | "Static routes\n" |
| 8468 | "Route map reference\n" |
| 8469 | "Pointer to route-map entries\n" |
| 8470 | "Metric for redistributed routes\n" |
| 8471 | "Default metric\n") |
| 8472 | { |
| 8473 | int type; |
| 8474 | |
| 8475 | type = bgp_str2route_type (AFI_IP, argv[0]); |
| 8476 | if (! type) |
| 8477 | { |
| 8478 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8479 | return CMD_WARNING; |
| 8480 | } |
| 8481 | |
| 8482 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); |
| 8483 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); |
| 8484 | return CMD_SUCCESS; |
| 8485 | } |
| 8486 | |
| 8487 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, |
| 8488 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
| 8489 | "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", |
| 8490 | NO_STR |
| 8491 | "Redistribute information from another routing protocol\n" |
| 8492 | "Connected\n" |
| 8493 | "Kernel routes\n" |
| 8494 | "Open Shurtest Path First (OSPF)\n" |
| 8495 | "Routing Information Protocol (RIP)\n" |
| 8496 | "Static routes\n" |
| 8497 | "Metric for redistributed routes\n" |
| 8498 | "Default metric\n" |
| 8499 | "Route map reference\n" |
| 8500 | "Pointer to route-map entries\n") |
| 8501 | |
| 8502 | #ifdef HAVE_IPV6 |
| 8503 | DEFUN (bgp_redistribute_ipv6, |
| 8504 | bgp_redistribute_ipv6_cmd, |
| 8505 | "redistribute (connected|kernel|ospf6|ripng|static)", |
| 8506 | "Redistribute information from another routing protocol\n" |
| 8507 | "Connected\n" |
| 8508 | "Kernel routes\n" |
| 8509 | "Open Shurtest Path First (OSPFv3)\n" |
| 8510 | "Routing Information Protocol (RIPng)\n" |
| 8511 | "Static routes\n") |
| 8512 | { |
| 8513 | int type; |
| 8514 | |
| 8515 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8516 | if (! type) |
| 8517 | { |
| 8518 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8519 | return CMD_WARNING; |
| 8520 | } |
| 8521 | |
| 8522 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8523 | } |
| 8524 | |
| 8525 | DEFUN (bgp_redistribute_ipv6_rmap, |
| 8526 | bgp_redistribute_ipv6_rmap_cmd, |
| 8527 | "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", |
| 8528 | "Redistribute information from another routing protocol\n" |
| 8529 | "Connected\n" |
| 8530 | "Kernel routes\n" |
| 8531 | "Open Shurtest Path First (OSPFv3)\n" |
| 8532 | "Routing Information Protocol (RIPng)\n" |
| 8533 | "Static routes\n" |
| 8534 | "Route map reference\n" |
| 8535 | "Pointer to route-map entries\n") |
| 8536 | { |
| 8537 | int type; |
| 8538 | |
| 8539 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8540 | if (! type) |
| 8541 | { |
| 8542 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8543 | return CMD_WARNING; |
| 8544 | } |
| 8545 | |
| 8546 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8547 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8548 | } |
| 8549 | |
| 8550 | DEFUN (bgp_redistribute_ipv6_metric, |
| 8551 | bgp_redistribute_ipv6_metric_cmd, |
| 8552 | "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", |
| 8553 | "Redistribute information from another routing protocol\n" |
| 8554 | "Connected\n" |
| 8555 | "Kernel routes\n" |
| 8556 | "Open Shurtest Path First (OSPFv3)\n" |
| 8557 | "Routing Information Protocol (RIPng)\n" |
| 8558 | "Static routes\n" |
| 8559 | "Metric for redistributed routes\n" |
| 8560 | "Default metric\n") |
| 8561 | { |
| 8562 | int type; |
| 8563 | u_int32_t metric; |
| 8564 | |
| 8565 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8566 | if (! type) |
| 8567 | { |
| 8568 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8569 | return CMD_WARNING; |
| 8570 | } |
| 8571 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8572 | |
| 8573 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8574 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8575 | } |
| 8576 | |
| 8577 | DEFUN (bgp_redistribute_ipv6_rmap_metric, |
| 8578 | bgp_redistribute_ipv6_rmap_metric_cmd, |
| 8579 | "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", |
| 8580 | "Redistribute information from another routing protocol\n" |
| 8581 | "Connected\n" |
| 8582 | "Kernel routes\n" |
| 8583 | "Open Shurtest Path First (OSPFv3)\n" |
| 8584 | "Routing Information Protocol (RIPng)\n" |
| 8585 | "Static routes\n" |
| 8586 | "Route map reference\n" |
| 8587 | "Pointer to route-map entries\n" |
| 8588 | "Metric for redistributed routes\n" |
| 8589 | "Default metric\n") |
| 8590 | { |
| 8591 | int type; |
| 8592 | u_int32_t metric; |
| 8593 | |
| 8594 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8595 | if (! type) |
| 8596 | { |
| 8597 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8598 | return CMD_WARNING; |
| 8599 | } |
| 8600 | VTY_GET_INTEGER ("metric", metric, argv[2]); |
| 8601 | |
| 8602 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); |
| 8603 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8604 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8605 | } |
| 8606 | |
| 8607 | DEFUN (bgp_redistribute_ipv6_metric_rmap, |
| 8608 | bgp_redistribute_ipv6_metric_rmap_cmd, |
| 8609 | "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", |
| 8610 | "Redistribute information from another routing protocol\n" |
| 8611 | "Connected\n" |
| 8612 | "Kernel routes\n" |
| 8613 | "Open Shurtest Path First (OSPFv3)\n" |
| 8614 | "Routing Information Protocol (RIPng)\n" |
| 8615 | "Static routes\n" |
| 8616 | "Metric for redistributed routes\n" |
| 8617 | "Default metric\n" |
| 8618 | "Route map reference\n" |
| 8619 | "Pointer to route-map entries\n") |
| 8620 | { |
| 8621 | int type; |
| 8622 | u_int32_t metric; |
| 8623 | |
| 8624 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8625 | if (! type) |
| 8626 | { |
| 8627 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8628 | return CMD_WARNING; |
| 8629 | } |
| 8630 | VTY_GET_INTEGER ("metric", metric, argv[1]); |
| 8631 | |
| 8632 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); |
| 8633 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); |
| 8634 | return bgp_redistribute_set (vty->index, AFI_IP6, type); |
| 8635 | } |
| 8636 | |
| 8637 | DEFUN (no_bgp_redistribute_ipv6, |
| 8638 | no_bgp_redistribute_ipv6_cmd, |
| 8639 | "no redistribute (connected|kernel|ospf6|ripng|static)", |
| 8640 | NO_STR |
| 8641 | "Redistribute information from another routing protocol\n" |
| 8642 | "Connected\n" |
| 8643 | "Kernel routes\n" |
| 8644 | "Open Shurtest Path First (OSPFv3)\n" |
| 8645 | "Routing Information Protocol (RIPng)\n" |
| 8646 | "Static routes\n") |
| 8647 | { |
| 8648 | int type; |
| 8649 | |
| 8650 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8651 | if (! type) |
| 8652 | { |
| 8653 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8654 | return CMD_WARNING; |
| 8655 | } |
| 8656 | |
| 8657 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); |
| 8658 | } |
| 8659 | |
| 8660 | DEFUN (no_bgp_redistribute_ipv6_rmap, |
| 8661 | no_bgp_redistribute_ipv6_rmap_cmd, |
| 8662 | "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", |
| 8663 | NO_STR |
| 8664 | "Redistribute information from another routing protocol\n" |
| 8665 | "Connected\n" |
| 8666 | "Kernel routes\n" |
| 8667 | "Open Shurtest Path First (OSPFv3)\n" |
| 8668 | "Routing Information Protocol (RIPng)\n" |
| 8669 | "Static routes\n" |
| 8670 | "Route map reference\n" |
| 8671 | "Pointer to route-map entries\n") |
| 8672 | { |
| 8673 | int type; |
| 8674 | |
| 8675 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8676 | if (! type) |
| 8677 | { |
| 8678 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8679 | return CMD_WARNING; |
| 8680 | } |
| 8681 | |
| 8682 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8683 | return CMD_SUCCESS; |
| 8684 | } |
| 8685 | |
| 8686 | DEFUN (no_bgp_redistribute_ipv6_metric, |
| 8687 | no_bgp_redistribute_ipv6_metric_cmd, |
| 8688 | "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", |
| 8689 | NO_STR |
| 8690 | "Redistribute information from another routing protocol\n" |
| 8691 | "Connected\n" |
| 8692 | "Kernel routes\n" |
| 8693 | "Open Shurtest Path First (OSPFv3)\n" |
| 8694 | "Routing Information Protocol (RIPng)\n" |
| 8695 | "Static routes\n" |
| 8696 | "Metric for redistributed routes\n" |
| 8697 | "Default metric\n") |
| 8698 | { |
| 8699 | int type; |
| 8700 | |
| 8701 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8702 | if (! type) |
| 8703 | { |
| 8704 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8705 | return CMD_WARNING; |
| 8706 | } |
| 8707 | |
| 8708 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8709 | return CMD_SUCCESS; |
| 8710 | } |
| 8711 | |
| 8712 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, |
| 8713 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
| 8714 | "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", |
| 8715 | NO_STR |
| 8716 | "Redistribute information from another routing protocol\n" |
| 8717 | "Connected\n" |
| 8718 | "Kernel routes\n" |
| 8719 | "Open Shurtest Path First (OSPFv3)\n" |
| 8720 | "Routing Information Protocol (RIPng)\n" |
| 8721 | "Static routes\n" |
| 8722 | "Route map reference\n" |
| 8723 | "Pointer to route-map entries\n" |
| 8724 | "Metric for redistributed routes\n" |
| 8725 | "Default metric\n") |
| 8726 | { |
| 8727 | int type; |
| 8728 | |
| 8729 | type = bgp_str2route_type (AFI_IP6, argv[0]); |
| 8730 | if (! type) |
| 8731 | { |
| 8732 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); |
| 8733 | return CMD_WARNING; |
| 8734 | } |
| 8735 | |
| 8736 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); |
| 8737 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); |
| 8738 | return CMD_SUCCESS; |
| 8739 | } |
| 8740 | |
| 8741 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, |
| 8742 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
| 8743 | "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", |
| 8744 | NO_STR |
| 8745 | "Redistribute information from another routing protocol\n" |
| 8746 | "Connected\n" |
| 8747 | "Kernel routes\n" |
| 8748 | "Open Shurtest Path First (OSPFv3)\n" |
| 8749 | "Routing Information Protocol (RIPng)\n" |
| 8750 | "Static routes\n" |
| 8751 | "Metric for redistributed routes\n" |
| 8752 | "Default metric\n" |
| 8753 | "Route map reference\n" |
| 8754 | "Pointer to route-map entries\n") |
| 8755 | #endif /* HAVE_IPV6 */ |
| 8756 | |
| 8757 | int |
| 8758 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, |
| 8759 | safi_t safi, int *write) |
| 8760 | { |
| 8761 | int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8762 | |
| 8763 | /* Unicast redistribution only. */ |
| 8764 | if (safi != SAFI_UNICAST) |
| 8765 | return 0; |
| 8766 | |
| 8767 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
| 8768 | { |
| 8769 | /* Redistribute BGP does not make sense. */ |
| 8770 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) |
| 8771 | { |
| 8772 | /* Display "address-family" when it is not yet diplayed. */ |
| 8773 | bgp_config_write_family_header (vty, afi, safi, write); |
| 8774 | |
| 8775 | /* "redistribute" configuration. */ |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 8776 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8777 | |
| 8778 | if (bgp->redist_metric_flag[afi][i]) |
| 8779 | vty_out (vty, " metric %d", bgp->redist_metric[afi][i]); |
| 8780 | |
| 8781 | if (bgp->rmap[afi][i].name) |
| 8782 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); |
| 8783 | |
| 8784 | vty_out (vty, "%s", VTY_NEWLINE); |
| 8785 | } |
| 8786 | } |
| 8787 | return *write; |
| 8788 | } |
| 8789 | |
| 8790 | /* BGP node structure. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8791 | static struct cmd_node bgp_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8792 | { |
| 8793 | BGP_NODE, |
| 8794 | "%s(config-router)# ", |
| 8795 | 1, |
| 8796 | }; |
| 8797 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8798 | static struct cmd_node bgp_ipv4_unicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8799 | { |
| 8800 | BGP_IPV4_NODE, |
| 8801 | "%s(config-router-af)# ", |
| 8802 | 1, |
| 8803 | }; |
| 8804 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8805 | static struct cmd_node bgp_ipv4_multicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8806 | { |
| 8807 | BGP_IPV4M_NODE, |
| 8808 | "%s(config-router-af)# ", |
| 8809 | 1, |
| 8810 | }; |
| 8811 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8812 | static struct cmd_node bgp_ipv6_unicast_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8813 | { |
| 8814 | BGP_IPV6_NODE, |
| 8815 | "%s(config-router-af)# ", |
| 8816 | 1, |
| 8817 | }; |
| 8818 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8819 | static struct cmd_node bgp_ipv6_multicast_node = |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8820 | { |
| 8821 | BGP_IPV6M_NODE, |
| 8822 | "%s(config-router-af)# ", |
| 8823 | 1, |
| 8824 | }; |
| 8825 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8826 | static struct cmd_node bgp_vpnv4_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8827 | { |
| 8828 | BGP_VPNV4_NODE, |
| 8829 | "%s(config-router-af)# ", |
| 8830 | 1 |
| 8831 | }; |
| 8832 | |
paul | 1f8ae70 | 2005-09-09 23:49:49 +0000 | [diff] [blame] | 8833 | static void community_list_vty (void); |
| 8834 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8835 | void |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 8836 | bgp_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8837 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8838 | /* Install bgp top node. */ |
| 8839 | install_node (&bgp_node, bgp_config_write); |
| 8840 | install_node (&bgp_ipv4_unicast_node, NULL); |
| 8841 | install_node (&bgp_ipv4_multicast_node, NULL); |
| 8842 | install_node (&bgp_ipv6_unicast_node, NULL); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8843 | install_node (&bgp_ipv6_multicast_node, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8844 | install_node (&bgp_vpnv4_node, NULL); |
| 8845 | |
| 8846 | /* Install default VTY commands to new nodes. */ |
| 8847 | install_default (BGP_NODE); |
| 8848 | install_default (BGP_IPV4_NODE); |
| 8849 | install_default (BGP_IPV4M_NODE); |
| 8850 | install_default (BGP_IPV6_NODE); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8851 | install_default (BGP_IPV6M_NODE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8852 | install_default (BGP_VPNV4_NODE); |
| 8853 | |
| 8854 | /* "bgp multiple-instance" commands. */ |
| 8855 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); |
| 8856 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); |
| 8857 | |
| 8858 | /* "bgp config-type" commands. */ |
| 8859 | install_element (CONFIG_NODE, &bgp_config_type_cmd); |
| 8860 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); |
| 8861 | |
| 8862 | /* Dummy commands (Currently not supported) */ |
| 8863 | install_element (BGP_NODE, &no_synchronization_cmd); |
| 8864 | install_element (BGP_NODE, &no_auto_summary_cmd); |
| 8865 | |
| 8866 | /* "router bgp" commands. */ |
| 8867 | install_element (CONFIG_NODE, &router_bgp_cmd); |
| 8868 | install_element (CONFIG_NODE, &router_bgp_view_cmd); |
| 8869 | |
| 8870 | /* "no router bgp" commands. */ |
| 8871 | install_element (CONFIG_NODE, &no_router_bgp_cmd); |
| 8872 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); |
| 8873 | |
| 8874 | /* "bgp router-id" commands. */ |
| 8875 | install_element (BGP_NODE, &bgp_router_id_cmd); |
| 8876 | install_element (BGP_NODE, &no_bgp_router_id_cmd); |
| 8877 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); |
| 8878 | |
| 8879 | /* "bgp cluster-id" commands. */ |
| 8880 | install_element (BGP_NODE, &bgp_cluster_id_cmd); |
| 8881 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); |
| 8882 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); |
| 8883 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); |
| 8884 | |
| 8885 | /* "bgp confederation" commands. */ |
| 8886 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); |
| 8887 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); |
| 8888 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); |
| 8889 | |
| 8890 | /* "bgp confederation peers" commands. */ |
| 8891 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); |
| 8892 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); |
| 8893 | |
| 8894 | /* "timers bgp" commands. */ |
| 8895 | install_element (BGP_NODE, &bgp_timers_cmd); |
| 8896 | install_element (BGP_NODE, &no_bgp_timers_cmd); |
| 8897 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); |
| 8898 | |
| 8899 | /* "bgp client-to-client reflection" commands */ |
| 8900 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); |
| 8901 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); |
| 8902 | |
| 8903 | /* "bgp always-compare-med" commands */ |
| 8904 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); |
| 8905 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); |
| 8906 | |
| 8907 | /* "bgp deterministic-med" commands */ |
| 8908 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); |
| 8909 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 8910 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 8911 | /* "bgp graceful-restart" commands */ |
| 8912 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); |
| 8913 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 8914 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
| 8915 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); |
| 8916 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8917 | |
| 8918 | /* "bgp fast-external-failover" commands */ |
| 8919 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); |
| 8920 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); |
| 8921 | |
| 8922 | /* "bgp enforce-first-as" commands */ |
| 8923 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); |
| 8924 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); |
| 8925 | |
| 8926 | /* "bgp bestpath compare-routerid" commands */ |
| 8927 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); |
| 8928 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); |
| 8929 | |
| 8930 | /* "bgp bestpath as-path ignore" commands */ |
| 8931 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); |
| 8932 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); |
| 8933 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 8934 | /* "bgp bestpath as-path confed" commands */ |
| 8935 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); |
| 8936 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); |
| 8937 | |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 8938 | /* "bgp log-neighbor-changes" commands */ |
| 8939 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); |
| 8940 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); |
| 8941 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8942 | /* "bgp bestpath med" commands */ |
| 8943 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); |
| 8944 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); |
| 8945 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); |
| 8946 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); |
| 8947 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); |
| 8948 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); |
| 8949 | |
| 8950 | /* "no bgp default ipv4-unicast" commands. */ |
| 8951 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); |
| 8952 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); |
| 8953 | |
| 8954 | /* "bgp network import-check" commands. */ |
| 8955 | install_element (BGP_NODE, &bgp_network_import_check_cmd); |
| 8956 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
| 8957 | |
| 8958 | /* "bgp default local-preference" commands. */ |
| 8959 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); |
| 8960 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); |
| 8961 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); |
| 8962 | |
| 8963 | /* "neighbor remote-as" commands. */ |
| 8964 | install_element (BGP_NODE, &neighbor_remote_as_cmd); |
| 8965 | install_element (BGP_NODE, &no_neighbor_cmd); |
| 8966 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); |
| 8967 | |
| 8968 | /* "neighbor peer-group" commands. */ |
| 8969 | install_element (BGP_NODE, &neighbor_peer_group_cmd); |
| 8970 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); |
| 8971 | install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd); |
| 8972 | |
| 8973 | /* "neighbor local-as" commands. */ |
| 8974 | install_element (BGP_NODE, &neighbor_local_as_cmd); |
| 8975 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); |
| 8976 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
| 8977 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); |
| 8978 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); |
| 8979 | |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 8980 | /* "neighbor password" commands. */ |
| 8981 | install_element (BGP_NODE, &neighbor_password_cmd); |
| 8982 | install_element (BGP_NODE, &no_neighbor_password_cmd); |
| 8983 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8984 | /* "neighbor activate" commands. */ |
| 8985 | install_element (BGP_NODE, &neighbor_activate_cmd); |
| 8986 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); |
| 8987 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); |
| 8988 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8989 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8990 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
| 8991 | |
| 8992 | /* "no neighbor activate" commands. */ |
| 8993 | install_element (BGP_NODE, &no_neighbor_activate_cmd); |
| 8994 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); |
| 8995 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); |
| 8996 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 8997 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8998 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
| 8999 | |
| 9000 | /* "neighbor peer-group set" commands. */ |
| 9001 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
| 9002 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); |
| 9003 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); |
| 9004 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9005 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9006 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
| 9007 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9008 | /* "no neighbor peer-group unset" commands. */ |
| 9009 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); |
| 9010 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 9011 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); |
| 9012 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9013 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9014 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
| 9015 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9016 | /* "neighbor softreconfiguration inbound" commands.*/ |
| 9017 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9018 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9019 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9020 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9021 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9022 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
| 9023 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9024 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9025 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9026 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9027 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
| 9028 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9029 | |
| 9030 | /* "neighbor attribute-unchanged" commands. */ |
| 9031 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); |
| 9032 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); |
| 9033 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); |
| 9034 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); |
| 9035 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); |
| 9036 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); |
| 9037 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); |
| 9038 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); |
| 9039 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); |
| 9040 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); |
| 9041 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); |
| 9042 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9043 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9044 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9045 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9046 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9047 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9048 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9049 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9050 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9051 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9052 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9053 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); |
| 9054 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 9055 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 9056 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 9057 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 9058 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 9059 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 9060 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 9061 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 9062 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 9063 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 9064 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9065 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9066 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9067 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9068 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9069 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9070 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9071 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9072 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9073 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9074 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9075 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); |
| 9076 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); |
| 9077 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); |
| 9078 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); |
| 9079 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); |
| 9080 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); |
| 9081 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); |
| 9082 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); |
| 9083 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); |
| 9084 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); |
| 9085 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); |
| 9086 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9087 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9088 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9089 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9090 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9091 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9092 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9093 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9094 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9095 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9096 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9097 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); |
| 9098 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); |
| 9099 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); |
| 9100 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); |
| 9101 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); |
| 9102 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); |
| 9103 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); |
| 9104 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); |
| 9105 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); |
| 9106 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); |
| 9107 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); |
| 9108 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9109 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9110 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9111 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9112 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9113 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9114 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9115 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9116 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9117 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9118 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9119 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
| 9120 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); |
| 9121 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); |
| 9122 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); |
| 9123 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); |
| 9124 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); |
| 9125 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); |
| 9126 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); |
| 9127 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); |
| 9128 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); |
| 9129 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); |
| 9130 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9131 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9132 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9133 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9134 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9135 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9136 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9137 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9138 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9139 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9140 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9141 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
| 9142 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); |
| 9143 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); |
| 9144 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); |
| 9145 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); |
| 9146 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); |
| 9147 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); |
| 9148 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); |
| 9149 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); |
| 9150 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); |
| 9151 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); |
| 9152 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); |
| 9153 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); |
| 9154 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); |
| 9155 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); |
| 9156 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); |
| 9157 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); |
| 9158 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); |
| 9159 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); |
| 9160 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); |
| 9161 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); |
| 9162 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); |
| 9163 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9164 | /* "nexthop-local unchanged" commands */ |
| 9165 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); |
| 9166 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); |
| 9167 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9168 | /* "transparent-as" and "transparent-nexthop" for old version |
| 9169 | compatibility. */ |
| 9170 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); |
| 9171 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); |
| 9172 | |
| 9173 | /* "neighbor next-hop-self" commands. */ |
| 9174 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); |
| 9175 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); |
| 9176 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); |
| 9177 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 9178 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); |
| 9179 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); |
| 9180 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); |
| 9181 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9182 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
| 9183 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9184 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
| 9185 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); |
| 9186 | |
| 9187 | /* "neighbor remove-private-AS" commands. */ |
| 9188 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); |
| 9189 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); |
| 9190 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
| 9191 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 9192 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
| 9193 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); |
| 9194 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
| 9195 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9196 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
| 9197 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9198 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
| 9199 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); |
| 9200 | |
| 9201 | /* "neighbor send-community" commands.*/ |
| 9202 | install_element (BGP_NODE, &neighbor_send_community_cmd); |
| 9203 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); |
| 9204 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); |
| 9205 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); |
| 9206 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); |
| 9207 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); |
| 9208 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); |
| 9209 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); |
| 9210 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); |
| 9211 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); |
| 9212 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); |
| 9213 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); |
| 9214 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); |
| 9215 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); |
| 9216 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); |
| 9217 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9218 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
| 9219 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); |
| 9220 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); |
| 9221 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9222 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
| 9223 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); |
| 9224 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); |
| 9225 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); |
| 9226 | |
| 9227 | /* "neighbor route-reflector" commands.*/ |
| 9228 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); |
| 9229 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9230 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); |
| 9231 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9232 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); |
| 9233 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9234 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); |
| 9235 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9236 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
| 9237 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9238 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
| 9239 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); |
| 9240 | |
| 9241 | /* "neighbor route-server" commands.*/ |
| 9242 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); |
| 9243 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); |
| 9244 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); |
| 9245 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9246 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); |
| 9247 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); |
| 9248 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); |
| 9249 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9250 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
| 9251 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9252 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
| 9253 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); |
| 9254 | |
| 9255 | /* "neighbor passive" commands. */ |
| 9256 | install_element (BGP_NODE, &neighbor_passive_cmd); |
| 9257 | install_element (BGP_NODE, &no_neighbor_passive_cmd); |
| 9258 | |
| 9259 | /* "neighbor shutdown" commands. */ |
| 9260 | install_element (BGP_NODE, &neighbor_shutdown_cmd); |
| 9261 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); |
| 9262 | |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 9263 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9264 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
| 9265 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); |
| 9266 | |
| 9267 | /* "neighbor capability orf prefix-list" commands.*/ |
| 9268 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9269 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9270 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9271 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9272 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9273 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
| 9274 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9275 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9276 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
| 9277 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9278 | |
| 9279 | /* "neighbor capability dynamic" commands.*/ |
| 9280 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); |
| 9281 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); |
| 9282 | |
| 9283 | /* "neighbor dont-capability-negotiate" commands. */ |
| 9284 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); |
| 9285 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); |
| 9286 | |
| 9287 | /* "neighbor ebgp-multihop" commands. */ |
| 9288 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); |
| 9289 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); |
| 9290 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); |
| 9291 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); |
| 9292 | |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 9293 | /* "neighbor disable-connected-check" commands. */ |
| 9294 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); |
| 9295 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9296 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
| 9297 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); |
| 9298 | |
| 9299 | /* "neighbor description" commands. */ |
| 9300 | install_element (BGP_NODE, &neighbor_description_cmd); |
| 9301 | install_element (BGP_NODE, &no_neighbor_description_cmd); |
| 9302 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); |
| 9303 | |
| 9304 | /* "neighbor update-source" commands. "*/ |
| 9305 | install_element (BGP_NODE, &neighbor_update_source_cmd); |
| 9306 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); |
| 9307 | |
| 9308 | /* "neighbor default-originate" commands. */ |
| 9309 | install_element (BGP_NODE, &neighbor_default_originate_cmd); |
| 9310 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); |
| 9311 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); |
| 9312 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9313 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); |
| 9314 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); |
| 9315 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); |
| 9316 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9317 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); |
| 9318 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9319 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); |
| 9320 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); |
| 9321 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); |
| 9322 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); |
| 9323 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); |
| 9324 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9325 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
| 9326 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); |
| 9327 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); |
| 9328 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9329 | |
| 9330 | /* "neighbor port" commands. */ |
| 9331 | install_element (BGP_NODE, &neighbor_port_cmd); |
| 9332 | install_element (BGP_NODE, &no_neighbor_port_cmd); |
| 9333 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); |
| 9334 | |
| 9335 | /* "neighbor weight" commands. */ |
| 9336 | install_element (BGP_NODE, &neighbor_weight_cmd); |
| 9337 | install_element (BGP_NODE, &no_neighbor_weight_cmd); |
| 9338 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); |
| 9339 | |
| 9340 | /* "neighbor override-capability" commands. */ |
| 9341 | install_element (BGP_NODE, &neighbor_override_capability_cmd); |
| 9342 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); |
| 9343 | |
| 9344 | /* "neighbor strict-capability-match" commands. */ |
| 9345 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); |
| 9346 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); |
| 9347 | |
| 9348 | /* "neighbor timers" commands. */ |
| 9349 | install_element (BGP_NODE, &neighbor_timers_cmd); |
| 9350 | install_element (BGP_NODE, &no_neighbor_timers_cmd); |
| 9351 | |
| 9352 | /* "neighbor timers connect" commands. */ |
| 9353 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); |
| 9354 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); |
| 9355 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); |
| 9356 | |
| 9357 | /* "neighbor advertisement-interval" commands. */ |
| 9358 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); |
| 9359 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); |
| 9360 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); |
| 9361 | |
| 9362 | /* "neighbor version" commands. */ |
| 9363 | install_element (BGP_NODE, &neighbor_version_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9364 | |
| 9365 | /* "neighbor interface" commands. */ |
| 9366 | install_element (BGP_NODE, &neighbor_interface_cmd); |
| 9367 | install_element (BGP_NODE, &no_neighbor_interface_cmd); |
| 9368 | |
| 9369 | /* "neighbor distribute" commands. */ |
| 9370 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); |
| 9371 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); |
| 9372 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); |
| 9373 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9374 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); |
| 9375 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); |
| 9376 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); |
| 9377 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9378 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
| 9379 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9380 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
| 9381 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); |
| 9382 | |
| 9383 | /* "neighbor prefix-list" commands. */ |
| 9384 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); |
| 9385 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); |
| 9386 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); |
| 9387 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9388 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); |
| 9389 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); |
| 9390 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); |
| 9391 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9392 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
| 9393 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9394 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
| 9395 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); |
| 9396 | |
| 9397 | /* "neighbor filter-list" commands. */ |
| 9398 | install_element (BGP_NODE, &neighbor_filter_list_cmd); |
| 9399 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); |
| 9400 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); |
| 9401 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); |
| 9402 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); |
| 9403 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); |
| 9404 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); |
| 9405 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9406 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
| 9407 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9408 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
| 9409 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); |
| 9410 | |
| 9411 | /* "neighbor route-map" commands. */ |
| 9412 | install_element (BGP_NODE, &neighbor_route_map_cmd); |
| 9413 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); |
| 9414 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); |
| 9415 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); |
| 9416 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); |
| 9417 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); |
| 9418 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); |
| 9419 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9420 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
| 9421 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9422 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
| 9423 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); |
| 9424 | |
| 9425 | /* "neighbor unsuppress-map" commands. */ |
| 9426 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); |
| 9427 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9428 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9429 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9430 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); |
| 9431 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); |
| 9432 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); |
| 9433 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9434 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
| 9435 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | a58545b | 2003-07-12 21:43:01 +0000 | [diff] [blame] | 9436 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
| 9437 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9438 | |
| 9439 | /* "neighbor maximum-prefix" commands. */ |
| 9440 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9441 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9442 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9443 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9444 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9445 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9446 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9447 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9448 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9449 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9450 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9451 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9452 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9453 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9454 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9455 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9456 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9457 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9458 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9459 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9460 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9461 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9462 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9463 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9464 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9465 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9466 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9467 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9468 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9469 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9470 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9471 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9472 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9473 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9474 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9475 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9476 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9477 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9478 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9479 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9480 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9481 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9482 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9483 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9484 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9485 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9486 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9487 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9488 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9489 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9490 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9491 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9492 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
| 9493 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
| 9494 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); |
| 9495 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
| 9496 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9497 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
| 9498 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9499 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); |
| 9500 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9501 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9502 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9503 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9504 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9505 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9506 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9507 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 9508 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9509 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
| 9510 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9511 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
| 9512 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 9513 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
| 9514 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); |
| 9515 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); |
| 9516 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); |
| 9517 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9518 | |
| 9519 | /* "neighbor allowas-in" */ |
| 9520 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); |
| 9521 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); |
| 9522 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); |
| 9523 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
| 9524 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9525 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9526 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
| 9527 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9528 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); |
| 9529 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
| 9530 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); |
| 9531 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9532 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
| 9533 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); |
| 9534 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9535 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
| 9536 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); |
| 9537 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); |
| 9538 | |
| 9539 | /* address-family commands. */ |
| 9540 | install_element (BGP_NODE, &address_family_ipv4_cmd); |
| 9541 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); |
| 9542 | #ifdef HAVE_IPV6 |
| 9543 | install_element (BGP_NODE, &address_family_ipv6_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9544 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9545 | #endif /* HAVE_IPV6 */ |
| 9546 | install_element (BGP_NODE, &address_family_vpnv4_cmd); |
| 9547 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); |
| 9548 | |
| 9549 | /* "exit-address-family" command. */ |
| 9550 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); |
| 9551 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); |
| 9552 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); |
paul | 25ffbdc | 2005-08-22 22:42:08 +0000 | [diff] [blame] | 9553 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9554 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
| 9555 | |
| 9556 | /* "clear ip bgp commands" */ |
| 9557 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); |
| 9558 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); |
| 9559 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); |
| 9560 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
| 9561 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
| 9562 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
| 9563 | #ifdef HAVE_IPV6 |
| 9564 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
| 9565 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); |
| 9566 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); |
| 9567 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
| 9568 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
| 9569 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
| 9570 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
| 9571 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
| 9572 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
| 9573 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
| 9574 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
| 9575 | #endif /* HAVE_IPV6 */ |
| 9576 | |
| 9577 | /* "clear ip bgp neighbor soft in" */ |
| 9578 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); |
| 9579 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); |
| 9580 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); |
| 9581 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
| 9582 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); |
| 9583 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
| 9584 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
| 9585 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
| 9586 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); |
| 9587 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
| 9588 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
| 9589 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); |
| 9590 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
| 9591 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
| 9592 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); |
| 9593 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
| 9594 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
| 9595 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); |
| 9596 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); |
| 9597 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); |
| 9598 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
| 9599 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); |
| 9600 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
| 9601 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
| 9602 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
| 9603 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); |
| 9604 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
| 9605 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
| 9606 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); |
| 9607 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
| 9608 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
| 9609 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); |
| 9610 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
| 9611 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
| 9612 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); |
| 9613 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); |
| 9614 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); |
| 9615 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); |
| 9616 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); |
| 9617 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); |
| 9618 | #ifdef HAVE_IPV6 |
| 9619 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
| 9620 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); |
| 9621 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); |
| 9622 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
| 9623 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); |
| 9624 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
| 9625 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
| 9626 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); |
| 9627 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
| 9628 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
| 9629 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); |
| 9630 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
| 9631 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
| 9632 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); |
| 9633 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
| 9634 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
| 9635 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); |
| 9636 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
| 9637 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
| 9638 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); |
| 9639 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
| 9640 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
| 9641 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); |
| 9642 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
| 9643 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
| 9644 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); |
| 9645 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
| 9646 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
| 9647 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); |
| 9648 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
| 9649 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
| 9650 | #endif /* HAVE_IPV6 */ |
| 9651 | |
| 9652 | /* "clear ip bgp neighbor soft out" */ |
| 9653 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); |
| 9654 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); |
| 9655 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); |
| 9656 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
| 9657 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
| 9658 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
| 9659 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
| 9660 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
| 9661 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
| 9662 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
| 9663 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
| 9664 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
| 9665 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); |
| 9666 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); |
| 9667 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
| 9668 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
| 9669 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
| 9670 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
| 9671 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
| 9672 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
| 9673 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
| 9674 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
| 9675 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
| 9676 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); |
| 9677 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); |
| 9678 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); |
| 9679 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); |
| 9680 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); |
| 9681 | #ifdef HAVE_IPV6 |
| 9682 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
| 9683 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); |
| 9684 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); |
| 9685 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
| 9686 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
| 9687 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
| 9688 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
| 9689 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
| 9690 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
| 9691 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
| 9692 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
| 9693 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
| 9694 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
| 9695 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
| 9696 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
| 9697 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
| 9698 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
| 9699 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
| 9700 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
| 9701 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
| 9702 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
| 9703 | #endif /* HAVE_IPV6 */ |
| 9704 | |
| 9705 | /* "clear ip bgp neighbor soft" */ |
| 9706 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); |
| 9707 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); |
| 9708 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); |
| 9709 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
| 9710 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
| 9711 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
| 9712 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
| 9713 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); |
| 9714 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); |
| 9715 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
| 9716 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
| 9717 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
| 9718 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
| 9719 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); |
| 9720 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); |
| 9721 | #ifdef HAVE_IPV6 |
| 9722 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
| 9723 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); |
| 9724 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); |
| 9725 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
| 9726 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
| 9727 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
| 9728 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
| 9729 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
| 9730 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
| 9731 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
| 9732 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
| 9733 | #endif /* HAVE_IPV6 */ |
| 9734 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9735 | /* "clear ip bgp neighbor rsclient" */ |
| 9736 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); |
| 9737 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); |
| 9738 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); |
| 9739 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); |
| 9740 | #ifdef HAVE_IPV6 |
| 9741 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); |
| 9742 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); |
| 9743 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); |
| 9744 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); |
| 9745 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); |
| 9746 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); |
| 9747 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); |
| 9748 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); |
| 9749 | #endif /* HAVE_IPV6 */ |
| 9750 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9751 | /* "show ip bgp summary" commands. */ |
| 9752 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); |
| 9753 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9754 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
| 9755 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
| 9756 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9757 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9758 | #ifdef HAVE_IPV6 |
| 9759 | install_element (VIEW_NODE, &show_bgp_summary_cmd); |
| 9760 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); |
| 9761 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
| 9762 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
| 9763 | #endif /* HAVE_IPV6 */ |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9764 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); |
| 9765 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9766 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); |
| 9767 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
| 9768 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9769 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9770 | #ifdef HAVE_IPV6 |
| 9771 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); |
| 9772 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); |
| 9773 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); |
| 9774 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
| 9775 | #endif /* HAVE_IPV6 */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9776 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); |
| 9777 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
| 9778 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
| 9779 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
| 9780 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
| 9781 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); |
| 9782 | #ifdef HAVE_IPV6 |
| 9783 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); |
| 9784 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); |
| 9785 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
| 9786 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
| 9787 | #endif /* HAVE_IPV6 */ |
| 9788 | |
| 9789 | /* "show ip bgp neighbors" commands. */ |
| 9790 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); |
| 9791 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 9792 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 9793 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 9794 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 9795 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 9796 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 9797 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 9798 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 9799 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9800 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 9801 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 9802 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 9803 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 9804 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9805 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
| 9806 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); |
| 9807 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); |
| 9808 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); |
| 9809 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); |
| 9810 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); |
| 9811 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); |
| 9812 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); |
| 9813 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); |
| 9814 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
| 9815 | |
| 9816 | #ifdef HAVE_IPV6 |
| 9817 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); |
| 9818 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 9819 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); |
| 9820 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 9821 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
| 9822 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 9823 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 9824 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9825 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
| 9826 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
| 9827 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 9828 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9829 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
| 9830 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); |
| 9831 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); |
| 9832 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); |
paul | bb46e94 | 2003-10-24 19:02:03 +0000 | [diff] [blame] | 9833 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
| 9834 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); |
| 9835 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); |
| 9836 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9837 | |
| 9838 | /* Old commands. */ |
| 9839 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); |
| 9840 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); |
| 9841 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); |
| 9842 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); |
| 9843 | #endif /* HAVE_IPV6 */ |
| 9844 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9845 | /* "show ip bgp rsclient" commands. */ |
| 9846 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 9847 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 9848 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 9849 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9850 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 9851 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 9852 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 9853 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9854 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
| 9855 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); |
| 9856 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); |
| 9857 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); |
| 9858 | |
| 9859 | #ifdef HAVE_IPV6 |
| 9860 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); |
| 9861 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 9862 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 9863 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9864 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
| 9865 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 9866 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 9867 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 9868 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
| 9869 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); |
| 9870 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); |
| 9871 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); |
| 9872 | #endif /* HAVE_IPV6 */ |
| 9873 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9874 | /* "show ip bgp paths" commands. */ |
| 9875 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); |
| 9876 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 9877 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); |
| 9878 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); |
| 9879 | |
| 9880 | /* "show ip bgp community" commands. */ |
| 9881 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); |
| 9882 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); |
| 9883 | |
| 9884 | /* "show ip bgp attribute-info" commands. */ |
| 9885 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); |
| 9886 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); |
| 9887 | |
| 9888 | /* "redistribute" commands. */ |
| 9889 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); |
| 9890 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); |
| 9891 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); |
| 9892 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); |
| 9893 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); |
| 9894 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); |
| 9895 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); |
| 9896 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); |
| 9897 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); |
| 9898 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); |
| 9899 | #ifdef HAVE_IPV6 |
| 9900 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); |
| 9901 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); |
| 9902 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); |
| 9903 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); |
| 9904 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); |
| 9905 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); |
| 9906 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); |
| 9907 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); |
| 9908 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); |
| 9909 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); |
| 9910 | #endif /* HAVE_IPV6 */ |
| 9911 | |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 9912 | /* "show bgp memory" commands. */ |
| 9913 | install_element (VIEW_NODE, &show_bgp_memory_cmd); |
Paul Jakma | 62687ff | 2008-08-23 14:27:06 +0100 | [diff] [blame] | 9914 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
Paul Jakma | 4bf6a36 | 2006-03-30 14:05:23 +0000 | [diff] [blame] | 9915 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
| 9916 | |
Michael Lambert | e0081f7 | 2008-11-16 20:12:04 +0000 | [diff] [blame] | 9917 | /* "show bgp views" commands. */ |
| 9918 | install_element (VIEW_NODE, &show_bgp_views_cmd); |
| 9919 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); |
| 9920 | install_element (ENABLE_NODE, &show_bgp_views_cmd); |
| 9921 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9922 | /* Community-list. */ |
| 9923 | community_list_vty (); |
| 9924 | } |
| 9925 | |
| 9926 | #include "memory.h" |
| 9927 | #include "bgp_regex.h" |
| 9928 | #include "bgp_clist.h" |
| 9929 | #include "bgp_ecommunity.h" |
| 9930 | |
| 9931 | /* VTY functions. */ |
| 9932 | |
| 9933 | /* Direction value to string conversion. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9934 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9935 | community_direct_str (int direct) |
| 9936 | { |
| 9937 | switch (direct) |
| 9938 | { |
| 9939 | case COMMUNITY_DENY: |
| 9940 | return "deny"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9941 | case COMMUNITY_PERMIT: |
| 9942 | return "permit"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9943 | default: |
| 9944 | return "unknown"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9945 | } |
| 9946 | } |
| 9947 | |
| 9948 | /* Display error string. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9949 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9950 | community_list_perror (struct vty *vty, int ret) |
| 9951 | { |
| 9952 | switch (ret) |
| 9953 | { |
| 9954 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: |
Denis Ovsienko | dfc1d5c | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 9955 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9956 | break; |
| 9957 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: |
| 9958 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); |
| 9959 | break; |
| 9960 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: |
| 9961 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); |
| 9962 | break; |
| 9963 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: |
| 9964 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); |
| 9965 | break; |
| 9966 | } |
| 9967 | } |
| 9968 | |
| 9969 | /* VTY interface for community_set() function. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 9970 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 9971 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 9972 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 9973 | { |
| 9974 | int ret; |
| 9975 | int direct; |
| 9976 | char *str; |
| 9977 | |
| 9978 | /* Check the list type. */ |
| 9979 | if (strncmp (argv[1], "p", 1) == 0) |
| 9980 | direct = COMMUNITY_PERMIT; |
| 9981 | else if (strncmp (argv[1], "d", 1) == 0) |
| 9982 | direct = COMMUNITY_DENY; |
| 9983 | else |
| 9984 | { |
| 9985 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 9986 | VTY_NEWLINE); |
| 9987 | return CMD_WARNING; |
| 9988 | } |
| 9989 | |
| 9990 | /* All digit name check. */ |
| 9991 | if (reject_all_digit_name && all_digit (argv[0])) |
| 9992 | { |
| 9993 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 9994 | return CMD_WARNING; |
| 9995 | } |
| 9996 | |
| 9997 | /* Concat community string argument. */ |
| 9998 | if (argc > 1) |
| 9999 | str = argv_concat (argv, argc, 2); |
| 10000 | else |
| 10001 | str = NULL; |
| 10002 | |
| 10003 | /* When community_list_set() return nevetive value, it means |
| 10004 | malformed community string. */ |
| 10005 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); |
| 10006 | |
| 10007 | /* Free temporary community list string allocated by |
| 10008 | argv_concat(). */ |
| 10009 | if (str) |
| 10010 | XFREE (MTYPE_TMP, str); |
| 10011 | |
| 10012 | if (ret < 0) |
| 10013 | { |
| 10014 | /* Display error string. */ |
| 10015 | community_list_perror (vty, ret); |
| 10016 | return CMD_WARNING; |
| 10017 | } |
| 10018 | |
| 10019 | return CMD_SUCCESS; |
| 10020 | } |
| 10021 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10022 | /* Communiyt-list entry delete. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10023 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10024 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10025 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10026 | { |
| 10027 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10028 | int direct = 0; |
| 10029 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10030 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10031 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10032 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10033 | /* Check the list direct. */ |
| 10034 | if (strncmp (argv[1], "p", 1) == 0) |
| 10035 | direct = COMMUNITY_PERMIT; |
| 10036 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10037 | direct = COMMUNITY_DENY; |
| 10038 | else |
| 10039 | { |
| 10040 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10041 | VTY_NEWLINE); |
| 10042 | return CMD_WARNING; |
| 10043 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10044 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10045 | /* Concat community string argument. */ |
| 10046 | str = argv_concat (argv, argc, 2); |
| 10047 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10048 | |
| 10049 | /* Unset community list. */ |
| 10050 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10051 | |
| 10052 | /* Free temporary community list string allocated by |
| 10053 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10054 | if (str) |
| 10055 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10056 | |
| 10057 | if (ret < 0) |
| 10058 | { |
| 10059 | community_list_perror (vty, ret); |
| 10060 | return CMD_WARNING; |
| 10061 | } |
| 10062 | |
| 10063 | return CMD_SUCCESS; |
| 10064 | } |
| 10065 | |
| 10066 | /* "community-list" keyword help string. */ |
| 10067 | #define COMMUNITY_LIST_STR "Add a community list entry\n" |
| 10068 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" |
| 10069 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10070 | DEFUN (ip_community_list_standard, |
| 10071 | ip_community_list_standard_cmd, |
| 10072 | "ip community-list <1-99> (deny|permit) .AA:NN", |
| 10073 | IP_STR |
| 10074 | COMMUNITY_LIST_STR |
| 10075 | "Community list number (standard)\n" |
| 10076 | "Specify community to reject\n" |
| 10077 | "Specify community to accept\n" |
| 10078 | COMMUNITY_VAL_STR) |
| 10079 | { |
| 10080 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
| 10081 | } |
| 10082 | |
| 10083 | ALIAS (ip_community_list_standard, |
| 10084 | ip_community_list_standard2_cmd, |
| 10085 | "ip community-list <1-99> (deny|permit)", |
| 10086 | IP_STR |
| 10087 | COMMUNITY_LIST_STR |
| 10088 | "Community list number (standard)\n" |
| 10089 | "Specify community to reject\n" |
| 10090 | "Specify community to accept\n") |
| 10091 | |
| 10092 | DEFUN (ip_community_list_expanded, |
| 10093 | ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10094 | "ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10095 | IP_STR |
| 10096 | COMMUNITY_LIST_STR |
| 10097 | "Community list number (expanded)\n" |
| 10098 | "Specify community to reject\n" |
| 10099 | "Specify community to accept\n" |
| 10100 | "An ordered list as a regular-expression\n") |
| 10101 | { |
| 10102 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
| 10103 | } |
| 10104 | |
| 10105 | DEFUN (ip_community_list_name_standard, |
| 10106 | ip_community_list_name_standard_cmd, |
| 10107 | "ip community-list standard WORD (deny|permit) .AA:NN", |
| 10108 | IP_STR |
| 10109 | COMMUNITY_LIST_STR |
| 10110 | "Add a standard community-list entry\n" |
| 10111 | "Community list name\n" |
| 10112 | "Specify community to reject\n" |
| 10113 | "Specify community to accept\n" |
| 10114 | COMMUNITY_VAL_STR) |
| 10115 | { |
| 10116 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
| 10117 | } |
| 10118 | |
| 10119 | ALIAS (ip_community_list_name_standard, |
| 10120 | ip_community_list_name_standard2_cmd, |
| 10121 | "ip community-list standard WORD (deny|permit)", |
| 10122 | IP_STR |
| 10123 | COMMUNITY_LIST_STR |
| 10124 | "Add a standard community-list entry\n" |
| 10125 | "Community list name\n" |
| 10126 | "Specify community to reject\n" |
| 10127 | "Specify community to accept\n") |
| 10128 | |
| 10129 | DEFUN (ip_community_list_name_expanded, |
| 10130 | ip_community_list_name_expanded_cmd, |
| 10131 | "ip community-list expanded WORD (deny|permit) .LINE", |
| 10132 | IP_STR |
| 10133 | COMMUNITY_LIST_STR |
| 10134 | "Add an expanded community-list entry\n" |
| 10135 | "Community list name\n" |
| 10136 | "Specify community to reject\n" |
| 10137 | "Specify community to accept\n" |
| 10138 | "An ordered list as a regular-expression\n") |
| 10139 | { |
| 10140 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
| 10141 | } |
| 10142 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10143 | DEFUN (no_ip_community_list_standard_all, |
| 10144 | no_ip_community_list_standard_all_cmd, |
| 10145 | "no ip community-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10146 | NO_STR |
| 10147 | IP_STR |
| 10148 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10149 | "Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10150 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10151 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10152 | } |
| 10153 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10154 | DEFUN (no_ip_community_list_expanded_all, |
| 10155 | no_ip_community_list_expanded_all_cmd, |
| 10156 | "no ip community-list <100-500>", |
| 10157 | NO_STR |
| 10158 | IP_STR |
| 10159 | COMMUNITY_LIST_STR |
| 10160 | "Community list number (expanded)\n") |
| 10161 | { |
| 10162 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10163 | } |
| 10164 | |
| 10165 | DEFUN (no_ip_community_list_name_standard_all, |
| 10166 | no_ip_community_list_name_standard_all_cmd, |
| 10167 | "no ip community-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10168 | NO_STR |
| 10169 | IP_STR |
| 10170 | COMMUNITY_LIST_STR |
| 10171 | "Add a standard community-list entry\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10172 | "Community list name\n") |
| 10173 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10174 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10175 | } |
| 10176 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10177 | DEFUN (no_ip_community_list_name_expanded_all, |
| 10178 | no_ip_community_list_name_expanded_all_cmd, |
| 10179 | "no ip community-list expanded WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10180 | NO_STR |
| 10181 | IP_STR |
| 10182 | COMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10183 | "Add an expanded community-list entry\n" |
| 10184 | "Community list name\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10185 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10186 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10187 | } |
| 10188 | |
| 10189 | DEFUN (no_ip_community_list_standard, |
| 10190 | no_ip_community_list_standard_cmd, |
| 10191 | "no ip community-list <1-99> (deny|permit) .AA:NN", |
| 10192 | NO_STR |
| 10193 | IP_STR |
| 10194 | COMMUNITY_LIST_STR |
| 10195 | "Community list number (standard)\n" |
| 10196 | "Specify community to reject\n" |
| 10197 | "Specify community to accept\n" |
| 10198 | COMMUNITY_VAL_STR) |
| 10199 | { |
| 10200 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 10201 | } |
| 10202 | |
| 10203 | DEFUN (no_ip_community_list_expanded, |
| 10204 | no_ip_community_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10205 | "no ip community-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10206 | NO_STR |
| 10207 | IP_STR |
| 10208 | COMMUNITY_LIST_STR |
| 10209 | "Community list number (expanded)\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_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10215 | } |
| 10216 | |
| 10217 | DEFUN (no_ip_community_list_name_standard, |
| 10218 | no_ip_community_list_name_standard_cmd, |
| 10219 | "no ip community-list standard WORD (deny|permit) .AA:NN", |
| 10220 | NO_STR |
| 10221 | IP_STR |
| 10222 | COMMUNITY_LIST_STR |
| 10223 | "Specify a standard community-list\n" |
| 10224 | "Community list name\n" |
| 10225 | "Specify community to reject\n" |
| 10226 | "Specify community to accept\n" |
| 10227 | COMMUNITY_VAL_STR) |
| 10228 | { |
| 10229 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
| 10230 | } |
| 10231 | |
| 10232 | DEFUN (no_ip_community_list_name_expanded, |
| 10233 | no_ip_community_list_name_expanded_cmd, |
| 10234 | "no ip community-list expanded WORD (deny|permit) .LINE", |
| 10235 | NO_STR |
| 10236 | IP_STR |
| 10237 | COMMUNITY_LIST_STR |
| 10238 | "Specify an expanded community-list\n" |
| 10239 | "Community list name\n" |
| 10240 | "Specify community to reject\n" |
| 10241 | "Specify community to accept\n" |
| 10242 | "An ordered list as a regular-expression\n") |
| 10243 | { |
| 10244 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
| 10245 | } |
| 10246 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10247 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10248 | community_list_show (struct vty *vty, struct community_list *list) |
| 10249 | { |
| 10250 | struct community_entry *entry; |
| 10251 | |
| 10252 | for (entry = list->head; entry; entry = entry->next) |
| 10253 | { |
| 10254 | if (entry == list->head) |
| 10255 | { |
| 10256 | if (all_digit (list->name)) |
| 10257 | vty_out (vty, "Community %s list %s%s", |
| 10258 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 10259 | "standard" : "(expanded) access", |
| 10260 | list->name, VTY_NEWLINE); |
| 10261 | else |
| 10262 | vty_out (vty, "Named Community %s list %s%s", |
| 10263 | entry->style == COMMUNITY_LIST_STANDARD ? |
| 10264 | "standard" : "expanded", |
| 10265 | list->name, VTY_NEWLINE); |
| 10266 | } |
| 10267 | if (entry->any) |
| 10268 | vty_out (vty, " %s%s", |
| 10269 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10270 | else |
| 10271 | vty_out (vty, " %s %s%s", |
| 10272 | community_direct_str (entry->direct), |
| 10273 | entry->style == COMMUNITY_LIST_STANDARD |
| 10274 | ? community_str (entry->u.com) : entry->config, |
| 10275 | VTY_NEWLINE); |
| 10276 | } |
| 10277 | } |
| 10278 | |
| 10279 | DEFUN (show_ip_community_list, |
| 10280 | show_ip_community_list_cmd, |
| 10281 | "show ip community-list", |
| 10282 | SHOW_STR |
| 10283 | IP_STR |
| 10284 | "List community-list\n") |
| 10285 | { |
| 10286 | struct community_list *list; |
| 10287 | struct community_list_master *cm; |
| 10288 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10289 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10290 | if (! cm) |
| 10291 | return CMD_SUCCESS; |
| 10292 | |
| 10293 | for (list = cm->num.head; list; list = list->next) |
| 10294 | community_list_show (vty, list); |
| 10295 | |
| 10296 | for (list = cm->str.head; list; list = list->next) |
| 10297 | community_list_show (vty, list); |
| 10298 | |
| 10299 | return CMD_SUCCESS; |
| 10300 | } |
| 10301 | |
| 10302 | DEFUN (show_ip_community_list_arg, |
| 10303 | show_ip_community_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10304 | "show ip community-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10305 | SHOW_STR |
| 10306 | IP_STR |
| 10307 | "List community-list\n" |
| 10308 | "Community-list number\n" |
| 10309 | "Community-list name\n") |
| 10310 | { |
| 10311 | struct community_list *list; |
| 10312 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10313 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10314 | if (! list) |
| 10315 | { |
Denis Ovsienko | dfc1d5c | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10316 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10317 | return CMD_WARNING; |
| 10318 | } |
| 10319 | |
| 10320 | community_list_show (vty, list); |
| 10321 | |
| 10322 | return CMD_SUCCESS; |
| 10323 | } |
| 10324 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10325 | static int |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10326 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
| 10327 | int style, int reject_all_digit_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10328 | { |
| 10329 | int ret; |
| 10330 | int direct; |
| 10331 | char *str; |
| 10332 | |
| 10333 | /* Check the list type. */ |
| 10334 | if (strncmp (argv[1], "p", 1) == 0) |
| 10335 | direct = COMMUNITY_PERMIT; |
| 10336 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10337 | direct = COMMUNITY_DENY; |
| 10338 | else |
| 10339 | { |
| 10340 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10341 | VTY_NEWLINE); |
| 10342 | return CMD_WARNING; |
| 10343 | } |
| 10344 | |
| 10345 | /* All digit name check. */ |
| 10346 | if (reject_all_digit_name && all_digit (argv[0])) |
| 10347 | { |
| 10348 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); |
| 10349 | return CMD_WARNING; |
| 10350 | } |
| 10351 | |
| 10352 | /* Concat community string argument. */ |
| 10353 | if (argc > 1) |
| 10354 | str = argv_concat (argv, argc, 2); |
| 10355 | else |
| 10356 | str = NULL; |
| 10357 | |
| 10358 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); |
| 10359 | |
| 10360 | /* Free temporary community list string allocated by |
| 10361 | argv_concat(). */ |
| 10362 | if (str) |
| 10363 | XFREE (MTYPE_TMP, str); |
| 10364 | |
| 10365 | if (ret < 0) |
| 10366 | { |
| 10367 | community_list_perror (vty, ret); |
| 10368 | return CMD_WARNING; |
| 10369 | } |
| 10370 | return CMD_SUCCESS; |
| 10371 | } |
| 10372 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10373 | static int |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10374 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
| 10375 | int style) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10376 | { |
| 10377 | int ret; |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10378 | int direct = 0; |
| 10379 | char *str = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10380 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10381 | if (argc > 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10382 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10383 | /* Check the list direct. */ |
| 10384 | if (strncmp (argv[1], "p", 1) == 0) |
| 10385 | direct = COMMUNITY_PERMIT; |
| 10386 | else if (strncmp (argv[1], "d", 1) == 0) |
| 10387 | direct = COMMUNITY_DENY; |
| 10388 | else |
| 10389 | { |
| 10390 | vty_out (vty, "%% Matching condition must be permit or deny%s", |
| 10391 | VTY_NEWLINE); |
| 10392 | return CMD_WARNING; |
| 10393 | } |
| 10394 | |
| 10395 | /* Concat community string argument. */ |
| 10396 | str = argv_concat (argv, argc, 2); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10397 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10398 | |
| 10399 | /* Unset community list. */ |
| 10400 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); |
| 10401 | |
| 10402 | /* Free temporary community list string allocated by |
| 10403 | argv_concat(). */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10404 | if (str) |
| 10405 | XFREE (MTYPE_TMP, str); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10406 | |
| 10407 | if (ret < 0) |
| 10408 | { |
| 10409 | community_list_perror (vty, ret); |
| 10410 | return CMD_WARNING; |
| 10411 | } |
| 10412 | |
| 10413 | return CMD_SUCCESS; |
| 10414 | } |
| 10415 | |
| 10416 | /* "extcommunity-list" keyword help string. */ |
| 10417 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" |
| 10418 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" |
| 10419 | |
| 10420 | DEFUN (ip_extcommunity_list_standard, |
| 10421 | ip_extcommunity_list_standard_cmd, |
| 10422 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10423 | IP_STR |
| 10424 | EXTCOMMUNITY_LIST_STR |
| 10425 | "Extended Community list number (standard)\n" |
| 10426 | "Specify community to reject\n" |
| 10427 | "Specify community to accept\n" |
| 10428 | EXTCOMMUNITY_VAL_STR) |
| 10429 | { |
| 10430 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
| 10431 | } |
| 10432 | |
| 10433 | ALIAS (ip_extcommunity_list_standard, |
| 10434 | ip_extcommunity_list_standard2_cmd, |
| 10435 | "ip extcommunity-list <1-99> (deny|permit)", |
| 10436 | IP_STR |
| 10437 | EXTCOMMUNITY_LIST_STR |
| 10438 | "Extended Community list number (standard)\n" |
| 10439 | "Specify community to reject\n" |
| 10440 | "Specify community to accept\n") |
| 10441 | |
| 10442 | DEFUN (ip_extcommunity_list_expanded, |
| 10443 | ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10444 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10445 | IP_STR |
| 10446 | EXTCOMMUNITY_LIST_STR |
| 10447 | "Extended Community list number (expanded)\n" |
| 10448 | "Specify community to reject\n" |
| 10449 | "Specify community to accept\n" |
| 10450 | "An ordered list as a regular-expression\n") |
| 10451 | { |
| 10452 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
| 10453 | } |
| 10454 | |
| 10455 | DEFUN (ip_extcommunity_list_name_standard, |
| 10456 | ip_extcommunity_list_name_standard_cmd, |
| 10457 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10458 | IP_STR |
| 10459 | EXTCOMMUNITY_LIST_STR |
| 10460 | "Specify standard extcommunity-list\n" |
| 10461 | "Extended Community list name\n" |
| 10462 | "Specify community to reject\n" |
| 10463 | "Specify community to accept\n" |
| 10464 | EXTCOMMUNITY_VAL_STR) |
| 10465 | { |
| 10466 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
| 10467 | } |
| 10468 | |
| 10469 | ALIAS (ip_extcommunity_list_name_standard, |
| 10470 | ip_extcommunity_list_name_standard2_cmd, |
| 10471 | "ip extcommunity-list standard WORD (deny|permit)", |
| 10472 | IP_STR |
| 10473 | EXTCOMMUNITY_LIST_STR |
| 10474 | "Specify standard extcommunity-list\n" |
| 10475 | "Extended Community list name\n" |
| 10476 | "Specify community to reject\n" |
| 10477 | "Specify community to accept\n") |
| 10478 | |
| 10479 | DEFUN (ip_extcommunity_list_name_expanded, |
| 10480 | ip_extcommunity_list_name_expanded_cmd, |
| 10481 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10482 | IP_STR |
| 10483 | EXTCOMMUNITY_LIST_STR |
| 10484 | "Specify expanded extcommunity-list\n" |
| 10485 | "Extended Community list name\n" |
| 10486 | "Specify community to reject\n" |
| 10487 | "Specify community to accept\n" |
| 10488 | "An ordered list as a regular-expression\n") |
| 10489 | { |
| 10490 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
| 10491 | } |
| 10492 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10493 | DEFUN (no_ip_extcommunity_list_standard_all, |
| 10494 | no_ip_extcommunity_list_standard_all_cmd, |
| 10495 | "no ip extcommunity-list <1-99>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10496 | NO_STR |
| 10497 | IP_STR |
| 10498 | EXTCOMMUNITY_LIST_STR |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10499 | "Extended Community list number (standard)\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10500 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10501 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10502 | } |
| 10503 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10504 | DEFUN (no_ip_extcommunity_list_expanded_all, |
| 10505 | no_ip_extcommunity_list_expanded_all_cmd, |
| 10506 | "no ip extcommunity-list <100-500>", |
| 10507 | NO_STR |
| 10508 | IP_STR |
| 10509 | EXTCOMMUNITY_LIST_STR |
| 10510 | "Extended Community list number (expanded)\n") |
| 10511 | { |
| 10512 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10513 | } |
| 10514 | |
| 10515 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
| 10516 | no_ip_extcommunity_list_name_standard_all_cmd, |
| 10517 | "no ip extcommunity-list standard WORD", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10518 | NO_STR |
| 10519 | IP_STR |
| 10520 | EXTCOMMUNITY_LIST_STR |
| 10521 | "Specify standard extcommunity-list\n" |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10522 | "Extended Community list name\n") |
| 10523 | { |
| 10524 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10525 | } |
| 10526 | |
| 10527 | DEFUN (no_ip_extcommunity_list_name_expanded_all, |
| 10528 | no_ip_extcommunity_list_name_expanded_all_cmd, |
| 10529 | "no ip extcommunity-list expanded WORD", |
| 10530 | NO_STR |
| 10531 | IP_STR |
| 10532 | EXTCOMMUNITY_LIST_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10533 | "Specify expanded extcommunity-list\n" |
| 10534 | "Extended Community list name\n") |
| 10535 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10536 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10537 | } |
| 10538 | |
| 10539 | DEFUN (no_ip_extcommunity_list_standard, |
| 10540 | no_ip_extcommunity_list_standard_cmd, |
| 10541 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", |
| 10542 | NO_STR |
| 10543 | IP_STR |
| 10544 | EXTCOMMUNITY_LIST_STR |
| 10545 | "Extended Community list number (standard)\n" |
| 10546 | "Specify community to reject\n" |
| 10547 | "Specify community to accept\n" |
| 10548 | EXTCOMMUNITY_VAL_STR) |
| 10549 | { |
| 10550 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10551 | } |
| 10552 | |
| 10553 | DEFUN (no_ip_extcommunity_list_expanded, |
| 10554 | no_ip_extcommunity_list_expanded_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10555 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10556 | NO_STR |
| 10557 | IP_STR |
| 10558 | EXTCOMMUNITY_LIST_STR |
| 10559 | "Extended Community list number (expanded)\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_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10565 | } |
| 10566 | |
| 10567 | DEFUN (no_ip_extcommunity_list_name_standard, |
| 10568 | no_ip_extcommunity_list_name_standard_cmd, |
| 10569 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", |
| 10570 | NO_STR |
| 10571 | IP_STR |
| 10572 | EXTCOMMUNITY_LIST_STR |
| 10573 | "Specify standard extcommunity-list\n" |
| 10574 | "Extended Community list name\n" |
| 10575 | "Specify community to reject\n" |
| 10576 | "Specify community to accept\n" |
| 10577 | EXTCOMMUNITY_VAL_STR) |
| 10578 | { |
| 10579 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); |
| 10580 | } |
| 10581 | |
| 10582 | DEFUN (no_ip_extcommunity_list_name_expanded, |
| 10583 | no_ip_extcommunity_list_name_expanded_cmd, |
| 10584 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", |
| 10585 | NO_STR |
| 10586 | IP_STR |
| 10587 | EXTCOMMUNITY_LIST_STR |
| 10588 | "Specify expanded extcommunity-list\n" |
| 10589 | "Community list name\n" |
| 10590 | "Specify community to reject\n" |
| 10591 | "Specify community to accept\n" |
| 10592 | "An ordered list as a regular-expression\n") |
| 10593 | { |
| 10594 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
| 10595 | } |
| 10596 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10597 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10598 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
| 10599 | { |
| 10600 | struct community_entry *entry; |
| 10601 | |
| 10602 | for (entry = list->head; entry; entry = entry->next) |
| 10603 | { |
| 10604 | if (entry == list->head) |
| 10605 | { |
| 10606 | if (all_digit (list->name)) |
| 10607 | vty_out (vty, "Extended community %s list %s%s", |
| 10608 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10609 | "standard" : "(expanded) access", |
| 10610 | list->name, VTY_NEWLINE); |
| 10611 | else |
| 10612 | vty_out (vty, "Named extended community %s list %s%s", |
| 10613 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10614 | "standard" : "expanded", |
| 10615 | list->name, VTY_NEWLINE); |
| 10616 | } |
| 10617 | if (entry->any) |
| 10618 | vty_out (vty, " %s%s", |
| 10619 | community_direct_str (entry->direct), VTY_NEWLINE); |
| 10620 | else |
| 10621 | vty_out (vty, " %s %s%s", |
| 10622 | community_direct_str (entry->direct), |
| 10623 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? |
| 10624 | entry->u.ecom->str : entry->config, |
| 10625 | VTY_NEWLINE); |
| 10626 | } |
| 10627 | } |
| 10628 | |
| 10629 | DEFUN (show_ip_extcommunity_list, |
| 10630 | show_ip_extcommunity_list_cmd, |
| 10631 | "show ip extcommunity-list", |
| 10632 | SHOW_STR |
| 10633 | IP_STR |
| 10634 | "List extended-community list\n") |
| 10635 | { |
| 10636 | struct community_list *list; |
| 10637 | struct community_list_master *cm; |
| 10638 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10639 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10640 | if (! cm) |
| 10641 | return CMD_SUCCESS; |
| 10642 | |
| 10643 | for (list = cm->num.head; list; list = list->next) |
| 10644 | extcommunity_list_show (vty, list); |
| 10645 | |
| 10646 | for (list = cm->str.head; list; list = list->next) |
| 10647 | extcommunity_list_show (vty, list); |
| 10648 | |
| 10649 | return CMD_SUCCESS; |
| 10650 | } |
| 10651 | |
| 10652 | DEFUN (show_ip_extcommunity_list_arg, |
| 10653 | show_ip_extcommunity_list_arg_cmd, |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10654 | "show ip extcommunity-list (<1-500>|WORD)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10655 | SHOW_STR |
| 10656 | IP_STR |
| 10657 | "List extended-community list\n" |
| 10658 | "Extcommunity-list number\n" |
| 10659 | "Extcommunity-list name\n") |
| 10660 | { |
| 10661 | struct community_list *list; |
| 10662 | |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10663 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10664 | if (! list) |
| 10665 | { |
Denis Ovsienko | dfc1d5c | 2010-12-08 18:51:37 +0300 | [diff] [blame] | 10666 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10667 | return CMD_WARNING; |
| 10668 | } |
| 10669 | |
| 10670 | extcommunity_list_show (vty, list); |
| 10671 | |
| 10672 | return CMD_SUCCESS; |
| 10673 | } |
| 10674 | |
| 10675 | /* Return configuration string of community-list entry. */ |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10676 | static const char * |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10677 | community_list_config_str (struct community_entry *entry) |
| 10678 | { |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 10679 | const char *str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10680 | |
| 10681 | if (entry->any) |
| 10682 | str = ""; |
| 10683 | else |
| 10684 | { |
| 10685 | if (entry->style == COMMUNITY_LIST_STANDARD) |
| 10686 | str = community_str (entry->u.com); |
| 10687 | else |
| 10688 | str = entry->config; |
| 10689 | } |
| 10690 | return str; |
| 10691 | } |
| 10692 | |
| 10693 | /* Display community-list and extcommunity-list configuration. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10694 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10695 | community_list_config_write (struct vty *vty) |
| 10696 | { |
| 10697 | struct community_list *list; |
| 10698 | struct community_entry *entry; |
| 10699 | struct community_list_master *cm; |
| 10700 | int write = 0; |
| 10701 | |
| 10702 | /* Community-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10703 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10704 | |
| 10705 | for (list = cm->num.head; list; list = list->next) |
| 10706 | for (entry = list->head; entry; entry = entry->next) |
| 10707 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10708 | vty_out (vty, "ip community-list %s %s %s%s", |
| 10709 | list->name, community_direct_str (entry->direct), |
| 10710 | community_list_config_str (entry), |
| 10711 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10712 | write++; |
| 10713 | } |
| 10714 | for (list = cm->str.head; list; list = list->next) |
| 10715 | for (entry = list->head; entry; entry = entry->next) |
| 10716 | { |
| 10717 | vty_out (vty, "ip community-list %s %s %s %s%s", |
| 10718 | entry->style == COMMUNITY_LIST_STANDARD |
| 10719 | ? "standard" : "expanded", |
| 10720 | list->name, community_direct_str (entry->direct), |
| 10721 | community_list_config_str (entry), |
| 10722 | VTY_NEWLINE); |
| 10723 | write++; |
| 10724 | } |
| 10725 | |
| 10726 | /* Extcommunity-list. */ |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10727 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10728 | |
| 10729 | for (list = cm->num.head; list; list = list->next) |
| 10730 | for (entry = list->head; entry; entry = entry->next) |
| 10731 | { |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10732 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
| 10733 | list->name, community_direct_str (entry->direct), |
| 10734 | community_list_config_str (entry), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10735 | write++; |
| 10736 | } |
| 10737 | for (list = cm->str.head; list; list = list->next) |
| 10738 | for (entry = list->head; entry; entry = entry->next) |
| 10739 | { |
| 10740 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", |
| 10741 | entry->style == EXTCOMMUNITY_LIST_STANDARD |
| 10742 | ? "standard" : "expanded", |
| 10743 | list->name, community_direct_str (entry->direct), |
| 10744 | community_list_config_str (entry), VTY_NEWLINE); |
| 10745 | write++; |
| 10746 | } |
| 10747 | return write; |
| 10748 | } |
| 10749 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 10750 | static struct cmd_node community_list_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10751 | { |
| 10752 | COMMUNITY_LIST_NODE, |
| 10753 | "", |
| 10754 | 1 /* Export to vtysh. */ |
| 10755 | }; |
| 10756 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 10757 | static void |
| 10758 | community_list_vty (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10759 | { |
| 10760 | install_node (&community_list_node, community_list_config_write); |
| 10761 | |
| 10762 | /* Community-list. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10763 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
| 10764 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); |
| 10765 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); |
| 10766 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); |
| 10767 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); |
| 10768 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10769 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
| 10770 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
| 10771 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); |
| 10772 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10773 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
| 10774 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); |
| 10775 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); |
| 10776 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
| 10777 | install_element (VIEW_NODE, &show_ip_community_list_cmd); |
| 10778 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); |
| 10779 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); |
| 10780 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); |
| 10781 | |
| 10782 | /* Extcommunity-list. */ |
| 10783 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); |
| 10784 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); |
| 10785 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); |
| 10786 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); |
| 10787 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); |
| 10788 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); |
hasso | fee6e4e | 2005-02-02 16:29:31 +0000 | [diff] [blame] | 10789 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
| 10790 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
| 10791 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); |
| 10792 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 10793 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
| 10794 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); |
| 10795 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); |
| 10796 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
| 10797 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); |
| 10798 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 10799 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); |
| 10800 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); |
| 10801 | } |